Reqtools Library ~~~~~~~~~~~~~~~~ Nico Francois ~~~~~~~~~~~~~~~ This library has been around for some time now, but few implementation have found their way onto ACC. This is a pity because it really is a great library, compatible with all Amigas. One of the reasons for this may have been that all the examples given by Nico were in C. So for those of you who are looking for a means of adding user friendliness to your programs, I've written a bunch of assembler examples. These cover all the basic functions supplied by reqtools, you will have to experiment with the more specialised functions. Getting Started ~~~~~~~~~~~~~~~ If you are using reqtools.library, your program need not open intuition, graphics or DOS. Reqtools does this and stores the library base pointers in it's base structure. See the file reqtools.i for more details. For the time being, accept that the following fragment will obtain the required library base pointers for you: lea reqtoolsname,a1 library name moveq.l #0,d0 any version CALLEXEC OpenLibrary open it move.l d0,_reqBase save base pointer beq Error exit if not open! move.l d0,a0 a0->library base move.l rt_IntuitionBase(a0),_IntuitionBase move.l rt_GfxBase(a0),_GfxBase move.l rt_DOSBase(a0),_DOSBase I have also added a library calling macro to reqtools_lib.i called CALLREQ. This can be used in the same way as those supplied with Devpac. About Tags ~~~~~~~~~~ Workbench 2 has seen the introduction of Tags. Put very simply, a Tag can be used to pass optional information to a function. When you call a library function for instance, one of the address registers can point to a Tag list. The function called will then parse the tag list ( tags can occur in any order ) and take the appropriate action. For example, the rt_FileRequestA accepts the tag RTFI_Height which should be followed by the desired height of the file requester: dc.l RTFI_Height,200 dc.l TAG_DONE The above declaration shows a simple tag list that contains only one tag, used to specify the height of the requester. Note: 1. Tags are constants that must be stored in memory. 2. A Tag list is terminated by a TAG_DONE Tag. 3. A Tag can be followed by a literal value. All of the reqtools functions require a pointer to a tag list to be in register a0. If you do not wish to specify any tags, clear a0 to ensure a bogus tag list is not passed. Some tags specify flags, for instance the RTFI_Flags tag used with the reqtools file requester. A number of flags may be selected, this is done by ORing them together: dc.l RTFI_Flags,FREQF_NOFILES+FREQF_PATGAD The tag informs the function that a long word value follows and that it contains flags. The flags specified are FREQ_NOFILES and FREQ_PATGAD. This may seem a little confusing at first, but is very easy to get the hang of. I have covered some of the tags in the examples. The Examples ~~~~~~~~~~~~~ The fun part! I have covered from a simple information requester through to putting up a file requester. Below are the details, the source has been kept simple and is well commented: Example Description. 1 Opening and closing reqtools.library. 2 A single gadget requester. 3 A 4 gadget requester and using C style format strings. 4 A string requester. 5 An integer requester. 6 Tag list with integer requester to specify max/min values. 7 A file requester. 8 File requesters with pattern and save facilities. That should do for the time being! 1.3 or 2.0 ~~~~~~~~~~ Reqtools.library comes in two versions as you can see when you examine the archive. Your programs will be compatible with both, but you are safest distributing it with the 1.3 library, giving the option to install the 2.0 one. This will ensure every one can use the program. Footnote ~~~~~~~~ As always, for more information drop me a line. Time permitting, I will reply. If you enclose an SAE I will at least return your disks. Written requests for help stand little chance of help, I do not have time to type them in. Mark.