home *** CD-ROM | disk | FTP | other *** search
/ Fish 'n' More 2 / fishmore-publicdomainlibraryvol.ii1991xetec.iso / dirs / m2utils_439.lzh / M2Utils / ARP / ARP.DEF < prev    next >
Text File  |  1991-01-18  |  64KB  |  1,823 lines

  1. (*
  2.    Name   : ARP.DEF
  3.    Version: 1.0
  4.    Author : Sascha Wildner
  5.    Date   : 07-Dec-90
  6.  
  7.    Description: DEFINITION MODULE for Modula-2 interface to ARP 1.3
  8.  
  9.  
  10.    -== UPDATE HISTORY ==-
  11.  
  12.    Date          Version            Author          Comments
  13.    --------------------------------------------------------------------------
  14.    07-Dec-90       1.0              Sascha Wildner  First implementation
  15.                                                                               *)
  16.  
  17.  
  18. DEFINITION MODULE ARP;
  19.  
  20.    FROM SYSTEM          IMPORT ADDRESS, BYTE;
  21.    FROM AmigaDOS        IMPORT BPTR, DateStampRecord, FileHandle, FileInfoBlock,
  22.                                FileInfoBlockPtr, FileLock, InfoData,
  23.                                ProtectionSet;
  24.    FROM AmigaDOSExt     IMPORT DeviceListPtr, FileLockPtr, RootNodePtr;
  25.    FROM AmigaDOSProcess IMPORT ProcessID, ProcessPtr, StandardPacketPtr;
  26.    FROM Intuition       IMPORT WindowPtr;
  27.    FROM Libraries       IMPORT Library, LibraryPtr;
  28.    FROM Lists           IMPORT MinList;
  29.    FROM Memory          IMPORT MemReqSet;
  30.    FROM Nodes           IMPORT MinNode, Node;
  31.    FROM Ports           IMPORT Message, MsgPortPtr;
  32.    FROM Semaphores      IMPORT SignalSemaphore;
  33.    FROM Tasks           IMPORT SignalSet, TaskPtr;
  34.  
  35.  
  36.    (* Standard definitions for arp.library information *)
  37.  
  38.    CONST ARPName    = "arp.library";
  39.          ARPVersion = 39;
  40.  
  41.  
  42.    (* RPN flag defintions *)
  43.  
  44.    TYPE RPNFlags    = (NoCheck, (* No checksumming *)
  45.                        Cache,   (* Private usage *)
  46.                        RPNF2,
  47.                        RPNF3,
  48.                        RPNF4,
  49.                        RPNF5,
  50.                        RPNF6,
  51.                        RPNF7,
  52.                        RPNF8);
  53.         RPNFlagsSet = SET OF RPNFlags;
  54.  
  55.  
  56.    (* Resident Program Support [defined here because of the ResidentPrgList *)
  57.    (* entry in the ARPBase structure]                                       *)
  58.    (*                                                                       *)
  59.    (* This is the kind of node allocated for you when you AddResidentPrg()  *)
  60.    (* a code segment. They are stored as a single linked list with the root *)
  61.    (* in ARPBase. If you absolutely *must* wander through this list instead *)
  62.    (* of using the supplied functions, then you must first obtain the       *)
  63.    (* semaphore which protects this list, and then release it afterwards.   *)
  64.    (* Do not use Forbid() and Permit() to gain exclusive access! Note that  *)
  65.    (* the supplied functions handle this locking protocol for you.          *)
  66.  
  67.    TYPE ResidentProgramNodePtr = POINTER TO ResidentProgramNode;
  68.         ResidentProgramNode    = RECORD
  69.                                     rpnNext     : ResidentProgramNodePtr; (* Next or NIL *)
  70.                                     rpnUsage    : LONGINT;                (* Number of current users *)
  71.                                     rpnAccessCnt: CARDINAL;               (* Total times used *)
  72.                                     rpnCheckSum : LONGCARD;               (* Checksum of code *)
  73.                                     rpnSegment  : BPTR;                   (* Actual segment *)
  74.                                     rpnFlags    : RPNFlagsSet;            (* See flag definitions above *)
  75.                                     rpnName     : BYTE;                   (* Allocated as needed *)
  76.                                  END;
  77.  
  78.  
  79.    (* These are used in release 33.4 but not by the library code. *)
  80.    (* Instead, individual programs check for these flags.         *)
  81.  
  82.    TYPE ARPFlags    = (WildWorld, (* Mixed BCPL/Normal wildcards *)
  83.                        WildBCPL); (* Pure BCPL wildcards *)
  84.         ARPFlagsSet = SET OF ARPFlags;
  85.  
  86.  
  87.    (* The current ARP library node... *)
  88.  
  89.    TYPE ARPBasePtr    = POINTER TO ARPBaseRecord;
  90.         ARPBaseRecord = RECORD
  91.                            LibNode         : Library;                (* Standard library node *)
  92.                            DosRootNode     : RootNodePtr;            (* Copy of dlRoot *)
  93.                            Flags           : ARPFlagsSet;            (* See flag definitions above *)
  94.                            ESCChar         : CHAR;                   (* Character to be used for escaping *)
  95.                            ArpReserved1    : LONGINT;                (* ArpLib's use only!! *)
  96.                            EnvBase         : LibraryPtr;             (* Dummy library *)
  97.                            DosBase         : LibraryPtr;             (* Cached DosBase *)
  98.                            GfxBase         : LibraryPtr;             (* Cached GfxBase *)
  99.                            IntuiBase       : LibraryPtr;             (* Cached IntuitionBase *)
  100.                            ResLists        : MinList;                (* Resource trackers *)
  101.                            ResidentPrgList : ResidentProgramNodePtr; (* Resident programs *)
  102.                            ResPrgProtection: SignalSemaphore;        (* Protection for above *)
  103.                            SegList         : BPTR;                   (* Pointer to loaded libcode *)
  104.                         END;
  105.  
  106.  
  107.    (* You use this when opening the library *)
  108.  
  109.    VAR ARPBase: LibraryPtr;
  110.  
  111.  
  112.    (* The alert object is what you use if you really must return an alert *)
  113.    (* to the user. You would normally OR this with another alert number   *)
  114.    (* from the Alerts MODULE. Generally, should be NON deadend alerts.    *)
  115.  
  116.    CONST AOArpLib       = 00008036D; (* Alert object *)
  117.  
  118.    (* Alerts that arp.library may return... *)
  119.  
  120.          ANArpLib       = 03600000D; (* Alert number *)
  121.          ANArpNoMem     = 03610000D; (* No more memory *)
  122.          ANArpInputMem  = 03610002D; (* No memory for input buffer *)
  123.          ANArpNoMakeEnv = 83610003D; (* No memory to make EnvLib *)
  124.          ANArpNoDOS     = 83630001D; (* Can't open dos.library *)
  125.          ANArpNoGfx     = 83630002D; (* Can't open graphics.library *)
  126.          ANArpNoIntuit  = 83630003D; (* Can't open intuition *)
  127.          ANBadPackBlues = 83640000D; (* Bad packet returned to SendPacket() *)
  128.          ANZombie       = 83600003D; (* Zombie roaming around system *)
  129.          ANArpScattered = 83600002D; (* Scatter loading not allowed for ARP *)
  130.  
  131.  
  132.    (* Return codes you can get from calling ARP Assign()... *)
  133.  
  134.    CONST AssignOK     = 0D; (* Everything is cool and groovy *)
  135.          AssignNoDev  = 1D; (* "Physical" is not valid for assignment *)
  136.          AssignFatal  = 2D; (* Something really icky happened *)
  137.          AssignCancel = 3D; (* Tried to cancel something but it won't cancel *)
  138.  
  139.  
  140.    (* Size of buffer you need if you are going to call ReadLine() *)
  141.  
  142.    CONST MaxInputBuf = 256D;
  143.  
  144.  
  145.    (* The following are the defines for frFuncFlags. These bits tell *)
  146.    (* FileRequest() what your frUserFunc is expecting, and what      *)
  147.    (* FileRequest() should call it for.                              *)
  148.    (*                                                                *)
  149.    (* You are called like so:                                        *)
  150.    (* frFunction(Mask: LONGCARD; Object: ADDRESS)                    *)
  151.    (*                                                                *)
  152.    (* The Mask is a copy of the flag value that caused FileRequest() *)
  153.    (* call your function. You can use this to determine what action  *)
  154.    (* you need to perform, and exactly what Object is, so you know   *)
  155.    (* what to do and what to return.                                 *)
  156.  
  157.    TYPE FileRequesterFlags    = (ListFunc,    (* Not implemented yet *)
  158.                                  GEventFunc,  (* Function to call if one of your gadgets is selected *)
  159.                                  AddGadFunc,  (* You get to add gadgets *)
  160.                                  NewWindFunc, (* You get to modify the NewWindow structure *)
  161.                                  NewIDCMP,    (* Force a new IDCMP (only if frWindow#NIL) *)
  162.                                  DoColor,     (* Set this bit for that new and different look *)
  163.                                  DoMsgFunc,   (* You get all IDCMP messages not for FileRequest() *)
  164.                                  DoWildFunc); (* Call me with a FIB and a name, ZERO return accepts *)
  165.         FileRequesterFlagsSet = SET OF FileRequesterFlags;
  166.  
  167.  
  168.    (* These bits are for frFlags2 in the file requester structure *)
  169.  
  170.    TYPE FileRequesterFlags2    = (LongPath); (* Specify the frDir buffer is 256 bytes long *)
  171.         FileRequesterFlags2Set = SET OF FileRequesterFlags2;
  172.  
  173.  
  174.    (* The ARP file requester data structure... *)
  175.  
  176.    TYPE FileRequesterPtr = POINTER TO FileRequester;
  177.         FileRequester    = RECORD
  178.                               frHail     : ADDRESS;                                            (* Hailing text *)
  179.                               frFile     : ADDRESS;                                            (* Filename array *)
  180.                               frDir      : ADDRESS;                                            (* Directory array *)
  181.                               frWindow   : WindowPtr;                                          (* Window requesting or NIL *)
  182.                               frFuncFlags: FileRequesterFlagsSet;                              (* See flag definitions above *)
  183.                               frFlags2   : FileRequesterFlags2Set;                             (* New flags *)
  184.                               frFunction : PROCEDURE(FileRequesterFlagsSet, ADDRESS): INTEGER; (* Your function *)
  185.                               frLeftEdge : INTEGER;                                            (* To be used later *)
  186.                               frTopEdge  : INTEGER;
  187.                            END;
  188.  
  189.  
  190.    (* The sizes of the different buffers... *)
  191.  
  192.    CONST FChars    = 32D;  (* Filename size *)
  193.          DSize     = 33D;  (* Directory name if not LongPath *)
  194.          LongDSize = 254D; (* If LongPath is set, use LongDSize *)
  195.          LongFSize = 126D; (* For compatibility with ArpBase.i *)
  196.  
  197.  
  198.    (* User GadgetIDs must be less than this value *)
  199.  
  200.    CONST FRFirstGadget = 7680H;
  201.  
  202.  
  203.    (* AChain flag definitions *)
  204.  
  205.    TYPE AChainFlags    = (PatternBit,ExaminedBit,Completed,AllBit);
  206.         AChainFlagsSet = SET OF AChainFlags;
  207.  
  208.  
  209.    (* Structure used by the pattern matching functions, no need to obtain, *)
  210.    (* diddle or allocate this yourself.                                    *)
  211.    (*                                                                      *)
  212.    (* Note: If you did, you will now break as it has changed...            *)
  213.  
  214.    TYPE AChainPtr = POINTER TO AChain;
  215.         AChain = RECORD
  216.                     anChild : AChainPtr;
  217.                     anParent: AChainPtr;
  218.                     anLock  : FileLockPtr;
  219.                     anInfo  : FileInfoBlockPtr;
  220.                     anFlags : AChainFlagsSet;
  221.                     anString: CHAR;
  222.                  END;
  223.  
  224.  
  225.    (* Bit definitions for the new apFlags... *)
  226.  
  227.    TYPE AnchorFlags    = (DoWild,   (* User option ALL *)
  228.                           ItsWild,  (* Set by FindFirst, used by FindNext *)
  229.                           DoDir,    (* Bit is set if a dir node should be entered *)
  230.                           DidDir,   (* Bit is set for an "expired" dir node *)
  231.                           NoMemErr, (* Set if there was not enough memory *)
  232.                           DoDot);   (* If set, '.' will convert to CurrentDir *)
  233.         AnchorFlagsSet = SET OF AnchorFlags;
  234.  
  235.  
  236.    (* Structure expected by FindFirst()/FindNext()                        *)
  237.    (*                                                                     *)
  238.    (* You need to allocate this structure and initialize it as follows:   *)
  239.    (*                                                                     *)
  240.    (* Set apBreakBits to the signal bits that you want to take a break    *)
  241.    (* on, or 0, if you don't want to convenience the user.                *)
  242.    (*                                                                     *)
  243.    (* If you want to have the FULL PATH NAME of the files you found,      *)
  244.    (* allocate a buffer at the END of this structure, and put the size of *)
  245.    (* it into apStrLen. If you don't want the full path name, make sure   *)
  246.    (* you set apStrLen to zero. In this case, the name of the file, and   *)
  247.    (* stats are available in the apInfo, as per usual.                    *)
  248.    (*                                                                     *)
  249.    (* Then call FindFirst() and the afterwards, FindNext() with this      *)
  250.    (* structure. You should check the return value each time (see below)  *)
  251.    (* and take the appropriate action, ultimately calling                 *)
  252.    (* FreeAnchorChain() when there are no more files and you are done.    *)
  253.    (* You can tell when you are done by checking for the normal AmigaDOS  *)
  254.    (* return code ErrorNoMoreEntries.                                     *)
  255.    (*                                                                     *)
  256.    (* You will also have to check the DirEntryType variable in the apInfo *)
  257.    (* structure to determine what exactly you have received.              *)
  258.  
  259.    TYPE AnchorPathPtr = POINTER TO AnchorPath;
  260.         AnchorPath    = RECORD
  261.                            apBase      : AChainPtr;      (* Pointer to first anchor *)
  262.                            apLast      : AChainPtr;      (* Pointer to last anchor *)
  263.                            apBreakBits : LONGINT;        (* Bits to break on *)
  264.                            apFoundBreak: LONGINT;        (* Bits we broke on *)
  265.                            apFlags     : AnchorFlagsSet; (* New use for the extra word *)
  266.                            apReserved  : BYTE;           (* To fill it out *)
  267.                            apStrLen    : INTEGER;        (* This is what used to be apLength *)
  268.                            apInfo      : FileInfoBlock;
  269.                            apBuf       : BYTE;           (* Allocate a buffer here, if desired *)
  270.                         END;
  271.  
  272.  
  273.    (* Constants used by wildcard routines                              *)
  274.    (*                                                                  *)
  275.    (* These are the pre-parsed tokens referred to by pattern match. It *)
  276.    (* is not necessary for you to do anything about these, FindFirst() *)
  277.    (* and FindNext() handle all these for you.                         *)
  278.  
  279.    CONST PAny      = 80H; (* Token for '*' + '#?' *)
  280.          PSingle   = 81H; (* Token for '?' *)
  281.  
  282.    (* No need to muck with these as they may change... *)
  283.  
  284.          POrStart  = 82H; (* Token for '(' *)
  285.          POrNext   = 83H; (* Token for '|' *)
  286.          POrEnd    = 84H; (* Token for ')' *)
  287.          PNot      = 85H; (* Token for '~' *)
  288.          PNotClass = 87H; (* Token for '^' *)
  289.          PClass    = 88H; (* Token for '[]' *)
  290.          PRepBeg   = 89H; (* Token for '[' *)
  291.          PRepEnd   = 8AH; (* Token for ']' *)
  292.  
  293.  
  294.    (* Defines you use to get a list of the devices you want to look at.    *)
  295.    (* For example, to get a list of all directories and volumes, do:       *)
  296.    (*                                                                      *)
  297.    (* AddDADevs(MyDAList,DeviceListFlagsSet{Dirs,Volumes})                 *)
  298.    (*                                                                      *)
  299.    (* After this, you can examine the deType field of the elements added   *)
  300.    (* to your list (if any) to discover specifics about the objects added. *)
  301.    (*                                                                      *)
  302.    (* Note that if you want only devices which are also disks, you must    *)
  303.    (* DeviceListFlagsSet{Devices,DiskOnly}.                                *)
  304.  
  305.    TYPE DeviceListFlags    = (Devices,  (* Return devices *)
  306.                               DiskOnly, (* Modifier for above: Return disk devices only *)
  307.                               Volumes,  (* Return volumes only *)
  308.                               Dirs);    (* Return assigned devices only *)
  309.         DeviceListFlagsSet = SET OF DeviceListFlags;
  310.  
  311.  
  312.    (* Legal deType values, check for these after a call to AddDADevs(), *)
  313.    (* or use on your own as the ID values in AddDANode().               *)
  314.  
  315.    CONST DLXFile      = BYTE(0);  (* AddDADevs() can't determine this *)
  316.          DLXDir       = BYTE(8);  (* AddDADevs() can't determine this *)
  317.          DLXDevice    = BYTE(16); (* It's a resident device *)
  318.  
  319.          DLXVolume    = BYTE(24); (* Device is a volume *)
  320.          DLXUnmounted = BYTE(32); (* Device is not resident *)
  321.  
  322.          DLXAssign    = BYTE(40); (* Device is a logical assignment *)
  323.  
  324.  
  325.    (* Structure used by AddDANode, AddDADevs, FreeDAList.             *)
  326.    (*                                                                 *)
  327.    (* This structure is used to create lists of names, which normally *)
  328.    (* are devices, assigns, volumes, files, or directories.           *)
  329.  
  330.    TYPE DirectoryEntryPtr = POINTER TO DirectoryEntry;
  331.         DirectoryEntry    = RECORD
  332.                                deNext : DirectoryEntryPtr; (* Next in list *)
  333.                                deType : BYTE;              (* DLXMumble *)
  334.                                deFlags: BYTE;              (* For future expansion *)
  335.                                deName : BYTE;              (* The name of the thing found *)
  336.                             END;
  337.  
  338.  
  339.    (* The rlFirstItem list (ResList) is a list of TrackedResource (below) *)
  340.    (* It is very important that nothing in this list depend on the task   *)
  341.    (* existing at resource freeing time (i.e., RemTask(NIL) type stuff,   *)
  342.    (* DeletePort() and the rest).                                         *)
  343.    (*                                                                     *)
  344.    (* The tracking functions return a TrackerPtr to you, this is a        *)
  345.    (* pointer to whatever follows the trID variable.                      *)
  346.    (* The default case is reflected below, and you get it if you call     *)
  347.    (* GetTracker() (see DefaultTracker below).                            *)
  348.    (*                                                                     *)
  349.    (* However, you can still use ArpAlloc() to allocate your own tracking *)
  350.    (* nodes and they can be any size or shape you like, as long as the    *)
  351.    (* base structure is preserved. They will be freed automagically just  *)
  352.    (* like the default trackers.                                          *)
  353.  
  354.    TYPE TrackedResourcePtr = POINTER TO TrackedResource;
  355.         TrackedResource    = RECORD
  356.                                 trNode : MinNode;                             (* Double linked pointer *)
  357.                                 trFlags: BYTE;                                (* Don't touch *)
  358.                                 trLock : BYTE;                                (* Don't touch, for Get/FreeAccess() *)
  359.                                 trID   : INTEGER;                             (* Item's ID *)
  360.  
  361.    (* The DefaultTracker portion of the structure. The stuff below this point *)
  362.    (* can conceivably vary, depending on user needs, etc. This reflects the   *)
  363.    (* default.                                                                *)
  364.  
  365.                                 CASE trObject: BOOLEAN OF                     (* The thing being tracked *)
  366.                                    FALSE: trResource: ADDRESS|                (* Whatever *)
  367.                                    TRUE : tgVerify  : LONGINT                 (* For use during TrakGeneric *)
  368.                                 END;
  369.                                 CASE trExtra : BOOLEAN OF                     (* Only needed sometimes *)
  370.                                    FALSE: tgFunction: POINTER TO PROCEDURE()| (* Function to call for TrakGeneric *)
  371.                                    TRUE : trWindow2 : WindowPtr               (* For TrakWindow *)
  372.                                 END;
  373.                              END;
  374.  
  375.  
  376.    (* You get a pointer to a structure of the following type when you call *)
  377.    (* GetTracker(). You can change this, and use ArpAlloc() instead of     *)
  378.    (* GetTracker() to do tracking. Of course, you have to take a wee bit   *)
  379.    (* more responsibility if you do so, as well as if you use TrakGeneric  *)
  380.    (* stuff.                                                               *)
  381.    (*                                                                      *)
  382.    (* TrakGeneric folks need to set up a task function to be called when   *)
  383.    (* an item is freed. Some care is required to set this up properly.     *)
  384.    (*                                                                      *)
  385.    (* Some special cases are indicated by the unions, for TrakWindow, if   *)
  386.    (* you have more than one window opened, and don't want the IDCMP       *)
  387.    (* closed particularly, you need to set a Ptr to the other window in    *)
  388.    (* dtWindow2. See CloseWindowSafely() for more info. If only one        *)
  389.    (* window, set this to NIL.                                             *)
  390.  
  391.    TYPE DefaultTrackerPtr = POINTER TO DefaultTracker;
  392.         DefaultTracker    = RECORD
  393.                                CASE dtObject: BOOLEAN OF                     (* The object being tracked *)
  394.                                   FALSE: dtResource: ADDRESS|                (* Whatever *)
  395.                                   TRUE : tgVerify  : LONGINT                 (* For use during TrakGeneric *)
  396.                                END;
  397.                                CASE dtExtra : BOOLEAN OF
  398.                                   FALSE: tgFunction: POINTER TO PROCEDURE()| (* Function to call for TrakGeneric *)
  399.                                   TRUE : dtWindow2 : WindowPtr               (* For TrakWindow *)
  400.                                END;
  401.                             END;
  402.  
  403.  
  404.    (* Items the tracker knows what to do about *)
  405.  
  406.    CONST TrakAAMem   =  0D; (* Default (ArpAlloc) element *)
  407.          TrakLock    =  1D; (* File lock *)
  408.          TrakFile    =  2D; (* Opened file *)
  409.          TrakWindow  =  3D; (* Window -- see docs *)
  410.          TrakScreen  =  4D; (* Screen *)
  411.          TrakLibrary =  5D; (* Opened library *)
  412.          TrakDAMem   =  6D; (* Pointer to DosAllocMem block *)
  413.          TrakMemNode =  7D; (* AllocEntry() node *)
  414.          TrakSegList =  8D; (* Program segment *)
  415.          TrakResList =  9D; (* ARP (nested) ResList *)
  416.          TrakMem     = 10D; (* Memory ptr/length *)
  417.          TrakGeneric = 11D; (* Generic element, your choice *)
  418.          TrakDAList  = 12D; (* DAList (aka file request *)
  419.          TrakAnchor  = 13D; (* Anchor chain (pattern matching) *)
  420.          TrakFReq    = 14D; (* FileRequest structure *)
  421.          TrakFont    = 15D; (* GfxBase CloseFont() *)
  422.          TrakMax     = 15D; (* Poof, anything higher is tossed *)
  423.  
  424.  
  425.    (* Tracker flag definitions *)
  426.  
  427.    TYPE TrackerFlags    = (TF0,
  428.                            TF1,
  429.                            TF2,
  430.                            TF3,
  431.                            TF4,
  432.                            Moved,   (* Item moved *)
  433.                            Reloc,   (* This may be relocated (not used yet) *)
  434.                            Unlink); (* Free node bit *)
  435.         TrackerFlagsSet = SET OF TrackerFlags;
  436.  
  437.  
  438.    (* Note: ResList MUST be a DosAllocMem'ed list!, this is done for *)
  439.    (* you when you call CreateTaskResList(), typically, you won't    *)
  440.    (* need to access/allocate this structure.                        *)
  441.  
  442.    TYPE ResListPtr = POINTER TO ResList;
  443.         ResList    = RECORD
  444.                         rlNode     : MinNode;    (* Used by ArpLib to link ResLists *)
  445.                         rlTaskID   : TaskPtr;    (* Owner of this list *)
  446.                         rlFirstItem: MinList;    (* List of tracked resources *)
  447.                         rlLink     : ResListPtr; (* SyncRun's use - hide list here *)
  448.                      END;
  449.  
  450.  
  451.    (* Returns from CompareLock() *)
  452.  
  453.    CONST LCKEqual   = 0D; (* The two locks refer to the same object *)
  454.          LCKVolume  = 1D; (* Locks are on the same volumes *)
  455.          LCKDifVol1 = 2D; (* Locks are on different volumes *)
  456.          LCKDifVol2 = 3D; (* Locks are on different volumes *)
  457.  
  458.  
  459.    (* ASyncRun() stuff...                                          *)
  460.    (*                                                              *)
  461.    (* Message sent back on your request by an exiting process.     *)
  462.    (* You request this by putting the address of your message in   *)
  463.    (* pcbLastGasp, and initializing the ReplyPort variable of your *)
  464.    (* ZombieMsg to the port you wish the message posted to.        *)
  465.  
  466.    TYPE ZombieMsgPtr = POINTER TO ZombieMsg;
  467.         ZombieMsg    = RECORD
  468.                           zmExecMessage: Message;
  469.                           zmTaskNum    : LONGCARD;        (* Task ID *)
  470.                           zmReturnCode : LONGINT;         (* Process's return code *)
  471.                           zmResult2    : LONGCARD;        (* System return code *)
  472.                           zmExitTime   : DateStampRecord; (* Date stamp at the time of exit *)
  473.                           zmUserInfo   : LONGCARD;        (* For whatever you wish *)
  474.                        END;
  475.  
  476.  
  477.    (* The following control bits determine what ASyncRun does on *)
  478.    (* abnormal exits and on background process termination.      *)
  479.  
  480.    TYPE PCBFlags    = (SaveIO,      (* Don't free/check file handles on exit *)
  481.                        CloseSplat,  (* Close splat file, must request explicitly *)
  482.                        NoCli,       (* Don't create a CLI process *)
  483.                        Interactive, (* This is now obsolete... *)
  484.                        Code,        (* Dangerous yet enticing *)
  485.                        StdIO);      (* Do the StdIO thing, splat = CON:Filename *)
  486.         PCBFlagsSet = SET OF PCBFlags;
  487.  
  488.  
  489.    (* Structure required by ASyncRun() -- see docs for more info. *)
  490.  
  491.    TYPE ProcessControlBlockPtr = POINTER TO ProcessControlBlock;
  492.         ProcessControlBlock    = RECORD
  493.                                     pcbStackSize : LONGCARD;         (* Stacksize for new process *)
  494.                                     pcbPri       : BYTE;             (* Priority of new task *);
  495.                                     pcbControl   : PCBFlagsSet;      (* Control bits, see defines above *)
  496.                                     pcbTrapCode  : ADDRESS;          (* Optional TrapCode *)
  497.                                     pcbInput     : BPTR;
  498.                                     pcbOutput    : BPTR;             (* Optional StdIn, StdOut *)
  499.                                     CASE pcbConsole: BOOLEAN OF
  500.                                        FALSE: pcbSplatFile: BPTR|    (* File to use for Open("*") *)
  501.                                        TRUE : pcbConName  : ADDRESS  (* CON: filename *)
  502.                                     END;
  503.                                     pcbLoadedCode: ADDRESS;          (* If not NIL, will not load/unload code *)
  504.                                     pcbLastGasp  : ZombieMsgPtr;     (* ReplyMsg() to be filled in by exit *)
  505.                                     pcbWBProcess : MsgPortPtr;       (* Valid only when NoCli *)
  506.                                  END;
  507.  
  508.  
  509.    (* Formerly needed to pass NULLCMD to a child. No longer needed. *)
  510.    (* It is being kept here for compatibility only...               *)
  511.    CONST NoCmd = "\n";
  512.  
  513.  
  514.    (* Error returns from SyncRun() and ASyncRun() *)
  515.  
  516.    CONST PRNoFile       =  -1D; (* Could not LoadSeg() the file *)
  517.          PRNoMem        =  -2D; (* No memory for something *)
  518.       (* PRNoCLI        =  -3D;    This is now obsolete *)
  519.          PRNoSlot       =  -4D; (* No room in TaskArray *)
  520.          PRNoInput      =  -5D; (* Could not open input file *)
  521.          PRNoOutput     =  -6D; (* Could not get output file *)
  522.       (* PRNoLock       =  -7D;    This is now obsolete *)
  523.       (* PRArgErr       =  -8D;    This is now obsolete *)
  524.       (* PRNoBCPL       =  -9D;    This is now obsolete *)
  525.       (* PRBadLib       = -10D;    This is now obsolete *)
  526.          PRNoStdIO      = -11D; (* Couldn't get StdIO handles *)
  527.  
  528.    (* Added V35 of arp.library *)
  529.  
  530.          PRWantsMessage = -12D; (* Child wants you to report IoErr() to user *)
  531.          PRNoShellProc  = -13D; (* Can't create a Shell/CLI process *)
  532.          PRNoExec       = -14D; (* 'E' bit is clear *)
  533.          PRScript       = -15D; (* S and E are set, IoErr() contains directory *)
  534.  
  535.  
  536.    (* Bit values for nshControl, you should use them as shown below, or *)
  537.    (* just use the actual values indicated.                             *)
  538.  
  539.    TYPE NSHFlags    = (CLI,         (* Do a CLI, not a Shell *)
  540.                        Background,  (* Background Shell *)
  541.                        execute,     (* Do as EXECUTE *)
  542.                        InterActive, (* Run an interactive shell *)
  543.                        NSHF4,
  544.                        NSHF5,
  545.                        NSHF6,
  546.                        FB);         (* Alt function bit *)
  547.         NSHFlagsSet = SET OF NSHFlags;
  548.  
  549.  
  550.    (* Common values for nshControl which allow you to do useful *)
  551.    (* and somewhat "standard" things...                         *)
  552.  
  553.    CONST InteractiveShell = NSHFlagsSet{FB,InterActive};        (* Gimme a newshell! *)
  554.          InteractiveCLI   = NSHFlagsSet{FB,InterActive,CLI};    (* Gimme that ol' newcli *)
  555.          BackgroundShell  = NSHFlagsSet{FB,Background};         (* Gimme a background Shell *)
  556.          ExecuteMe        = NSHFlagsSet{FB,Background,execute}; (* Aptly named, doncha think? *)
  557.  
  558.  
  559.    (* Version 35 ASyncRun() allows you to create an independent            *)
  560.    (* interactive or background Shell/CLI. You need this variant of the    *)
  561.    (* pcb structure to do it, and you also have new values for nshControl, *)
  562.    (* see below.                                                           *)
  563.    (*                                                                      *)
  564.    (* Syntax for Interactive shell is:                                     *)
  565.    (*                                                                      *)
  566.    (* rc:=ASyncRun(ADR("Optional Window Name"),ADR("Optional From File"),  *)
  567.    (*              NewShell);                                              *)
  568.    (*                                                                      *)
  569.    (* Syntax for a background shell is:                                    *)
  570.    (*                                                                      *)
  571.    (* rc:=ASyncRun(ADR("Command line"),NIL,NewShell);                      *)
  572.    (*                                                                      *)
  573.    (* Same syntax for an execute style call, but you have to be on drugs   *)
  574.    (* if you want to do that.                                              *)
  575.  
  576.    TYPE NewShellPtr = POINTER TO NewShell;
  577.         NewShell    = RECORD
  578.                          nshStackSize: LONGCARD;                (* Stacksize Shell will use for children *)
  579.                          nshPri      : BYTE;                    (* Ignored by interactive Shells *)
  580.                          nshControl  : NSHFlagsSet;             (* See above *)
  581.                          nshLogMsg   : ADDRESS;                 (* Optional login message, if NIL, use default *)
  582.                          nshInput    : BPTR;                    (* Ignored by interactive Shells, but     *)
  583.                          nshOutput   : BPTR;                    (* used by background and execute options *)
  584.                          nshReserved : ARRAY [0..4] OF LONGINT;
  585.                       END;
  586.  
  587.  
  588.    (* Additional IoErr() returns added by ARP... *)
  589.  
  590.    CONST ErrorBufferOverflow = 303D; (* User or internal buffer overflow *)
  591.          ErrorBreak          = 304D; (* A break character was received *)
  592.          ErrorNotExecutable  = 305D; (* A file has E bit cleared *)
  593.          ErrorNotCLI         = 400D; (* Program/function needs to be CLI *)
  594.  
  595.  
  596.    (* If your program starts with this structure, ASyncRun() and SyncRun() *)
  597.    (* will override a users stack request with the value in rptStackSize.  *)
  598.    (* Furthermore, if you are actually attached to the resident list, a    *)
  599.    (* memory block of size rptDataSize will be allocated for you, and a    *)
  600.    (* pointer to this data passed to you in register A4. You may use this  *)
  601.    (* block to clone the data segment of programs, thus resulting in one   *)
  602.    (* copy of the text, but multiple copies of data/bss for each process   *)
  603.    (* invocation. If you are resident, your program will start at          *)
  604.    (* rptInstruction, otherwise, it will be launched from the initial      *)
  605.    (* branch.                                                              *)
  606.  
  607.    TYPE ResidentProgramTagPtr = POINTER TO ResidentProgramTag;
  608.         ResidentProgramTag    = RECORD
  609.                                    rptNextSeg  : BPTR;     (* Provided by DOS at LoadSeg time *)
  610.  
  611.    (* The initial branch destination and rptInstruction do not have to be the *)
  612.    (* same. This allows different actions to be taken if you are diskloaded   *)
  613.    (* or resident. DataSize memory will be allocated only if you are          *)
  614.    (* resident, but StackSize will override all user stack requests.          *)
  615.  
  616.                                    rptBRA      : CARDINAL; (* Short branch to executable *)
  617.                                    rptMagic    : CARDINAL; (* Resident majik value *)
  618.                                    rptStackSize: LONGCARD; (* Min stack for this process *)
  619.                                    rptDataSize : LONGCARD; (* Data size to allocate if resident *)
  620.                                 (* rptInstruction             Start here if resident *)
  621.                                 END;
  622.  
  623.  
  624.    (* The form of the ARP allocated node in your tasks memlist when launched *)
  625.    (* as a resident program. Note that the data portion of the node will     *)
  626.    (* only exist if you have specified a nonzero value for rptDataSize. Note *)
  627.    (* also that this structure is READ ONLY, modify values in this at your   *)
  628.    (* own risk. The stack stuff is for tracking, if you need actual          *)
  629.    (* addresses or stack size, check the normal places for it in your        *)
  630.    (* process/task structure.                                                *)
  631.  
  632.    TYPE ProcessMemoryPtr = POINTER TO ProcessMemory;
  633.         ProcessMemory    = RECORD
  634.                               pmNode     : Node;
  635.                               pmNum      : CARDINAL; (* This is 1 if no data, 2 if data *)
  636.                               pmStack    : ADDRESS;
  637.                               pmStackSize: LONGCARD;
  638.                               pmData     : ADDRESS;  (* Only here if pmNum=2 *)
  639.                               pmDataSize : LONGCARD;
  640.                            END;
  641.  
  642.  
  643.    (* To find the above on your memlist, search for the following name. *)
  644.    (* We guarantee this will be the only arp.library allocated node on  *)
  645.    (* your memlist with this name.                                      *)
  646.    (* i.e. FindName(ADR(task^.tcbMemEntry),PMemName);                   *)
  647.  
  648.    CONST PMemName      = "ARP_MEM";
  649.          ResidentMagic = 4AFCH;     (* Same as RTCMatchWord (trapf) *)
  650.  
  651.  
  652.    (* For datFlags *)
  653.  
  654.    TYPE DateTimeFlags    = (Subst,   (* Substitute "Today" & "Tomorrow" where appropriate *)
  655.                             Future); (* Day of the week is in future *)
  656.         DateTimeFlagsSet = SET OF DateTimeFlags;
  657.  
  658.  
  659.    (* Date string/data structures *)
  660.  
  661.    TYPE DateTimePtr = POINTER TO DateTime;
  662.         DateTime    = RECORD
  663.                          datStamp  : DateStampRecord;  (* DOS DateStamp *)
  664.                          datFormat : BYTE;             (* Controls appearance on datStrDate *)
  665.                          datFlags  : DateTimeFlagsSet; (* See above *)
  666.                          datStrDay : ADDRESS;          (* Day of the week string *)
  667.                          datStrDate: ADDRESS;          (* Date string *)
  668.                          datStrTime: ADDRESS;          (* Time string *)
  669.                       END;
  670.  
  671.  
  672.    (* Size of buffer you need for each DateTime strings: *)
  673.  
  674.    CONST LenDatString = 10D;
  675.  
  676.  
  677.    (* For datFormat *)
  678.  
  679.    CONST FormatDOS = BYTE(0);   (* dd-mmm-yy AmigaDOS's own, unique style *)
  680.          FormatINT = BYTE(1);   (* yy-mm-dd  International format *)
  681.          FormatUSA = BYTE(2);   (* mm-dd-yy  The good ol' USA *)
  682.          FormatCDN = BYTE(3);   (* dd-mm-yy  Out brothers and sisters to the north *)
  683.          FormatMAX = FormatCDN; (* Larger than this? Defaults to AmigaDOS *)
  684.  
  685.  
  686.  
  687.    (* These duplicate the calls in dos.library *)
  688.  
  689.    TYPE ProcPtr = POINTER TO PROCEDURE();
  690.  
  691.  
  692. PROCEDURE Open(name: ADDRESS; accessMode: LONGINT): FileHandle;
  693. (*
  694.    Open a file for input or output.
  695.  
  696.    name - a null terminated string
  697.    accessMode - ModeOldFile or ModeNewFile
  698.  
  699.    result - file handle
  700. *)
  701.  
  702.  
  703. PROCEDURE Close(file: FileHandle);
  704. (*
  705.    Close an open file.
  706.  
  707.    file - file handle
  708. *)
  709.  
  710.  
  711. PROCEDURE Read(file: FileHandle; buffer: ADDRESS; length: LONGINT): LONGINT;
  712. (*
  713.    Read n bytes of data from a file.
  714.  
  715.    file - file handle
  716.    buffer - pointer to a buffer
  717.    length - number of bytes to read
  718.  
  719.    result - actual number of bytes read or -1 if an error occured
  720. *)
  721.  
  722.  
  723. PROCEDURE Write(file: FileHandle; buffer: ADDRESS; length: LONGINT): LONGINT;
  724. (*
  725.    Write n bytes of data to a file.
  726.  
  727.    file - file handle
  728.    buffer - pointer to a buffer
  729.    length - number of bytes to write
  730.  
  731.    result - actual number of bytes written or -1 if an error occured
  732. *)
  733.  
  734.  
  735. PROCEDURE Input(): FileHandle;
  736. (*
  737.    Return the initial input file handle assigned to the program.
  738.  
  739.    result - file handle
  740. *)
  741.  
  742.  
  743. PROCEDURE Output(): FileHandle;
  744. (*
  745.    Return the initial output file handle assigned to the program.
  746.  
  747.    result - file handle
  748. *)
  749.  
  750.  
  751. PROCEDURE Seek(file: FileHandle; position: LONGINT; mode: LONGINT): LONGINT;
  752. (*
  753.    Move to a logical file position.
  754.  
  755.    file - file handle
  756.    position - an offset to move file position ptr to, positive or negative
  757.    mode - OffsetBeginning or OffsetCurrent or OffsetEnd
  758.  
  759.    result - old file position or -1 if an error occured
  760. *)
  761.  
  762.  
  763. PROCEDURE DeleteFile(name: ADDRESS): BOOLEAN;
  764. (*
  765.    Delete a file or directory.
  766.  
  767.    name - null terminated string
  768.  
  769.    result - success(TRUE) or failure(FALSE)
  770. *)
  771.  
  772.  
  773. PROCEDURE Rename(oldName, newName: ADDRESS): BOOLEAN;
  774. (*
  775.    Rename directory or file.
  776.  
  777.    oldName - null terminated string
  778.    newName - null terminated string
  779.  
  780.    result - success(TRUE) or failure(FALSE)
  781. *)
  782.  
  783.  
  784. PROCEDURE Lock(name: ADDRESS; accessMode: LONGINT): FileLock;
  785. (*
  786.    Lock a directory or file.
  787.  
  788.    name - a null terminated string
  789.    accessMode - SharedLock or ExclusiveLock
  790.  
  791.    result - BCPL pointer to a lock
  792. *)
  793.  
  794.  
  795. PROCEDURE UnLock(lock: FileLock);
  796. (*
  797.    Unlock a directory or file.
  798.  
  799.    lock - BCPL pointer to a lock
  800. *)
  801.  
  802.  
  803. PROCEDURE DupLock(lock: FileLock): FileLock;
  804. (*
  805.    Duplicate a lock.
  806.  
  807.    lock - BCPL pointer to a lock
  808.  
  809.    result - BCPL pointer to a lock
  810. *)
  811.  
  812.  
  813. PROCEDURE Examine(lock: FileLock; VAR infoBlock: FileInfoBlock): BOOLEAN;
  814. (*
  815.    Examine a directory or file associated with a lock.
  816.  
  817.    lock - BCPL pointer to a lock
  818.    infoBlock - pointer to a file info block to be filled in
  819.  
  820.    result - success(TRUE) or failure(FALSE)
  821. *)
  822.  
  823.  
  824. PROCEDURE ExNext(lock: FileLock; VAR infoBlock: FileInfoBlock): BOOLEAN;
  825. (*
  826.    Examine the next entry in a directory.
  827.  
  828.    lock - BCPL pointer to a lock
  829.    infoBlock - pointer to a file info block to be filled in
  830.  
  831.    result - success(TRUE) or failure(FALSE)
  832. *)
  833.  
  834.  
  835. PROCEDURE Info(lock: FileLock; VAR infoData: InfoData): BOOLEAN;
  836. (*
  837.    Return information about a disk.
  838.  
  839.    lock - BCPL pointer to a lock
  840.    infoData - pointer to a InfoData structure to be filled in
  841.  
  842.    result - success(TRUE) or failure(FALSE)
  843. *)
  844.  
  845.  
  846. PROCEDURE CreateDir(name: ADDRESS): FileLock;
  847. (*
  848.    Create a new directory.
  849.  
  850.    name - null terminated string
  851.  
  852.    result - BCPL pointer to a lock
  853. *)
  854.  
  855.  
  856. PROCEDURE CurrentDir(lock: FileLock): FileLock;
  857. (*
  858.    Make a directory associated with a lock the current working directory.
  859.  
  860.    lock - BCPL pointer to a lock
  861.  
  862.    result - BCPL pointer to a lock
  863. *)
  864.  
  865.  
  866. PROCEDURE CreateProc(name: ADDRESS; pri: LONGINT; segment: ADDRESS;
  867.                      stackSize: LONGINT): ProcessID;
  868. (*
  869.    Create a new process.
  870.  
  871.    name - null terminated string
  872.    pri - priority to be given to process
  873.    segment - pointer to segment list, as returned by LoadSeg()
  874.    stackSize - size of root stack in bytes
  875.  
  876.    result - the ProcessID or 0 if an error occured
  877. *)
  878.  
  879.  
  880. PROCEDURE Exit(returnCode: LONGINT);
  881. (*
  882.    Exit from a process.
  883.  
  884.    returnCode - if the process is running under the CLI this will be the
  885.                 return code returned to the CLI. If the program is running
  886.                 as a distinct process, Exit deletes the process and releases
  887.                 the space associated with the stack, segment list, and process
  888.                 structure
  889. *)
  890.  
  891.  
  892. PROCEDURE LoadSeg(name: ADDRESS): BPTR;
  893. (*
  894.    Load a load module into memory.
  895.  
  896.    name - null terminated string
  897.  
  898.    result - pointer to a segment or 0 if the load failed
  899. *)
  900.  
  901.  
  902. PROCEDURE UnLoadSeg(segment: BPTR);
  903. (*
  904.    Unload a segment previously loaded by LoadSeg.
  905.  
  906.    segment - pointer to a segment originally returned by LoadSeg
  907. *)
  908.  
  909.  
  910. PROCEDURE DeviceProc(name: ADDRESS): ProcessID;
  911. (*
  912.    Return the process identifier of the process handling that I/O.
  913.  
  914.    name - null terminated string
  915.  
  916.    result - process identifier of the device handler or 0 if not found.
  917.             If the name refers to a file on a mounted device then a
  918.             pointer to a directory lock is returned by IOErr()
  919. *)
  920.  
  921.  
  922. PROCEDURE SetComment(name, comment: ADDRESS): BOOLEAN;
  923. (*
  924.    Set a comment on file or directory.
  925.  
  926.    name - null terminated string
  927.    comment - null terminated string of up to 80 characters in length
  928.  
  929.    result - success(TRUE) or failure(FALSE)
  930. *)
  931.  
  932.  
  933. PROCEDURE SetProtection(name: ADDRESS; mask: ProtectionSet): BOOLEAN;
  934. (*
  935.    Set file or directory protection.
  936.  
  937.    name - null terminated string
  938.    mask - protection mask to be set
  939.  
  940.    result - success(TRUE) or failure(FALSE)
  941. *)
  942.  
  943.  
  944. PROCEDURE DateStamp(VAR v: DateStampRecord);
  945. (*
  946.    Obtain the current date and time in internal format.
  947.  
  948.    v - pointer to a DateStamp structure (3 long words)
  949. *)
  950.  
  951.  
  952. PROCEDURE Delay(ticks: LONGINT);
  953. (*
  954.    Delay a process for a specified amount of time.
  955.  
  956.    ticks - number of ticks to wait (50 ticks/second)
  957. *)
  958.  
  959.  
  960. PROCEDURE WaitForChar(file: FileHandle; timeout: LONGINT): BOOLEAN;
  961. (*
  962.    Indicates whether characters arrive within a time limit or not.
  963.  
  964.    file - file handle
  965.    timeout - amount of time to wait in micro seconds
  966.  
  967.    result - if character arrived before timeout returns TRUE, else FALSE
  968. *)
  969.  
  970.  
  971. PROCEDURE ParentDir(lock: FileLock): FileLock;
  972. (*
  973.    Obtain the parent of a directory or file.
  974.  
  975.    lock - BCPL pointer to a lock
  976.  
  977.    result - BCPL pointer to a lock
  978. *)
  979.  
  980.  
  981. PROCEDURE IsInteractive(file: FileHandle): BOOLEAN;
  982. (*
  983.    Test if a file is connected to a virtual terminal or not.
  984.  
  985.    file - file handle
  986.  
  987.    result - TRUE = interactive, FALSE = non-interactive
  988. *)
  989.  
  990.  
  991. PROCEDURE Execute(cmdString: ADDRESS; input, output: FileHandle): BOOLEAN;
  992. (*
  993.    Execute a CLI command.
  994.  
  995.    cmdString - null terminated string
  996.    input - file handle
  997.    output - file handle
  998.  
  999.    result - success(TRUE) or failure(FALSE)
  1000. *)
  1001.  
  1002.  
  1003.  
  1004.    (* Now for the stuff that only exists in arp.library *)
  1005.  
  1006.  
  1007. PROCEDURE Printf(string: ADDRESS; args: ADDRESS): LONGINT;
  1008. (*
  1009.    Print formatted data on current output.
  1010.  
  1011.    string - null terminated string
  1012.    args - null terminated string
  1013.  
  1014.    result - if all goes well, the total count of characters actually written,
  1015.             else -1
  1016. *)
  1017.  
  1018.  
  1019. PROCEDURE FPrintf(file: FileHandle; string: ADDRESS; args: ADDRESS): LONGINT;
  1020. (*
  1021.    Print formatted data on file.
  1022.  
  1023.    file - file handle
  1024.    string - null terminated string
  1025.    args - null terminated string
  1026.  
  1027.    result - if all goes well, the total count of characters actually written,
  1028.             else -1 or 0 (if a NIL FileHandle was passed)
  1029. *)
  1030.  
  1031.  
  1032. PROCEDURE Puts(string: ADDRESS): LONGINT;
  1033. (*
  1034.    Print string with newline on stdout.
  1035.  
  1036.    string - a null terminated string
  1037.  
  1038.    result - if all goes well, the total count of characters actually written,
  1039.             else -1
  1040. *)
  1041.  
  1042.  
  1043. PROCEDURE ReadLine(buffer: ADDRESS): LONGINT;
  1044. (*
  1045.    Get a line from current input.
  1046.  
  1047.    buffer - pointer to a 256 byte buffer to store the input string in
  1048.  
  1049.    result - the actual count of the characters returned
  1050. *)
  1051.  
  1052.  
  1053. PROCEDURE GADS(line: ADDRESS; len: LONGINT; help: ADDRESS; args: ADDRESS;
  1054.                temp: ADDRESS): LONGINT;
  1055. (*
  1056.    Do standard AmigaDOS command line parsing.
  1057.  
  1058.    line - pointer to the command line
  1059.    len - length of command line
  1060.    help - pointer to optional extra help string (displayed when question mark
  1061.           typed after command)
  1062.    args - pointer to an array of longwords which will receive the results of
  1063.           the argoment parse. The must ALWAYS be at least one element in this
  1064.           array
  1065.    temp - pointer to AmigaDOS style template
  1066.  
  1067.    result - number of arguments found or -1 if there was an error in the command
  1068.             line
  1069. *)
  1070.  
  1071.  
  1072. PROCEDURE Atol(string: ADDRESS): LONGINT;
  1073. (*
  1074.    Convert ASCII string to LONGINT.
  1075.  
  1076.    string - null terminated string
  1077.  
  1078.    result - the binary value of the string
  1079. *)
  1080.  
  1081.  
  1082. PROCEDURE EscapeString(string: ADDRESS): LONGCARD;
  1083. (*
  1084.    Convert escape characters in string.
  1085.  
  1086.    string - null terminated string
  1087.  
  1088.    result - new length of the string
  1089. *)
  1090.  
  1091.  
  1092. PROCEDURE CheckAbort(func: ProcPtr): LONGINT;
  1093. (*
  1094.    Check for CTRL-C.
  1095.  
  1096.    func - function to call if signal was received (optional, may be NIL)
  1097.  
  1098.    result - either 0 (if signal not received), return value of user function (if
  1099.             func#NIL and signal was received) or signal flag (if func=NIL)
  1100. *)
  1101.  
  1102.  
  1103. PROCEDURE CheckBreak(mask: SignalSet; func: ProcPtr): LONGINT;
  1104. (*
  1105.    Check for CTRL-C/D/E/F.
  1106.  
  1107.    mask - signal set containing the SigBreakCtrlC/D/E/F bits to check for
  1108.    func - (optional) function to call if BREAK occured
  1109.  
  1110.    result - either 0 (if none of the signals specified were received), return
  1111.             value of user function (if func#NIL) or passed signal set
  1112. *)
  1113.  
  1114.  
  1115. PROCEDURE GetEnv(string: ADDRESS; buffer: ADDRESS; size: LONGINT): ADDRESS;
  1116. (*
  1117.    Get the value of an environment variable.
  1118.  
  1119.    string - pointer to environment variable name
  1120.    buffer - user allocated area to store the value associated with the
  1121.             environment variable
  1122.    size - size of buffer in bytes
  1123.  
  1124.    result - if found, pointer to the start of the value string for that variable
  1125. *)
  1126.  
  1127.  
  1128. PROCEDURE SetEnv(varName: ADDRESS; value: ADDRESS): BOOLEAN;
  1129. (*
  1130.    Set the value of an environment variable.
  1131.  
  1132.    varName - pointer to an environment variable name
  1133.    value - buffer which contains the values to be associated with this
  1134.            environment variable
  1135.  
  1136.    result - success(TRUE) or failure(FALSE)
  1137. *)
  1138.  
  1139.  
  1140. PROCEDURE FileRequest(fileRequester: FileRequesterPtr): ADDRESS;
  1141. (*
  1142.    Get filename from user.
  1143.  
  1144.    fileRequester - pointer to an initialized FileRequester structure
  1145.  
  1146.    result - pointer to the file buffer in your FileRequester structure (if user
  1147.             pressed OK) or NIL (if user pressed CANCEL)
  1148. *)
  1149.  
  1150.  
  1151. PROCEDURE CloseWindowSafely(window: WindowPtr; moreWindows: ADDRESS);
  1152. (*
  1153.    Close a window without GURUing.
  1154.  
  1155.    window - pointer to window to be closed
  1156.    moreWindows - if NIL, the MsgPort for this window will be released
  1157. *)
  1158.  
  1159.  
  1160. PROCEDURE CreatePort(name: ADDRESS; pri: LONGINT): MsgPortPtr;
  1161. (*
  1162.    Create a message port.
  1163.  
  1164.    name - pointer to null terminated string (if MsgPort is to be attached to
  1165.           system MsgPort list) or NIL (if MsgPort is to be private to the
  1166.           caller)
  1167.    pri - priority of this MsgPort
  1168.  
  1169.    result - pointer to an initialized MsgPort or NIL (if port could not be
  1170.             allocated)
  1171. *)
  1172.  
  1173.  
  1174. PROCEDURE DeletePort(port: MsgPortPtr);
  1175. (*
  1176.    Deletes a message port.
  1177.  
  1178.    port - pointer to a message port
  1179. *)
  1180.  
  1181.  
  1182. PROCEDURE SendPacket(action: LONGINT; args: ADDRESS;
  1183.                      handler: MsgPortPtr): LONGINT;
  1184. (*
  1185.    Send a packet to DOS.
  1186.  
  1187.    action - the action you wish this packet to cause
  1188.    args - pointer to an array of seven long words specifying the arguments to
  1189.           send with the packet. May be NIL (arguments will be set to zero)
  1190.    handler - address of MsgPort of the handler you wish to receive this packet
  1191.  
  1192.    result - dpRes1 field of returned packet
  1193. *)
  1194.  
  1195.  
  1196. PROCEDURE InitStdPacket(action: LONGINT; args: ADDRESS;
  1197.                         packet: StandardPacketPtr; replyPort: MsgPortPtr);
  1198. (*
  1199.    Initialize a standard packet structure.
  1200.  
  1201.    action - the type (action) of packet you need
  1202.    args - pointer to an array of seven long words representing the argument
  1203.           values you wish to send to AmigaDOS. May be NIL (packet arguments will
  1204.           be cleared)
  1205.    packet - pointer to the StandardPacket you wish initialized
  1206.    replyPort - reply port for this packet
  1207. *)
  1208.  
  1209.  
  1210. PROCEDURE PathName(lock: FileLock; buffer: ADDRESS;
  1211.                    componentCount: LONGINT): LONGCARD;
  1212. (*
  1213.    Find complete pathname of file/directory.
  1214.  
  1215.    lock - lock in the file or directory
  1216.    buffer - area of memory to place the filename in
  1217.    componentCount - number of names that can be placed in the destination area
  1218.  
  1219.    result - 0 (problem: either buffer overflow or disk error) or length of
  1220.             pathname in characters
  1221. *)
  1222.  
  1223.  
  1224. PROCEDURE Assign(logical: ADDRESS; physical: ADDRESS): LONGCARD;
  1225. (*
  1226.    Assigns a logical device name.
  1227.  
  1228.    logical - pointer to name to give to physical device
  1229.    physical - pointer to name of file or device to assign logical or NIL
  1230.               (existing assignment will be removed)
  1231.  
  1232.    result - AssignOk (DeviceInfo has been created) or error (see above)
  1233. *)
  1234.  
  1235.  
  1236. PROCEDURE DosAllocMem(size: LONGINT): ADDRESS;
  1237. (*
  1238.    AmigaDOS compatible memory allocator.
  1239.  
  1240.    size - size of the desired block in bytes
  1241.  
  1242.    result - pointer to allocated memory block (will be longword aligned) or
  1243.             NIL (if the allocation failed)
  1244. *)
  1245.  
  1246.  
  1247. PROCEDURE DosFreeMem(block: ADDRESS);
  1248. (*
  1249.    AmigaDOS compatible memory freer.
  1250.  
  1251.    block - pointer to a memory block returned by DosAllocMem()
  1252. *)
  1253.  
  1254.  
  1255. PROCEDURE BtoCstr(cstr: ADDRESS; bstr: BPTR; maxLength: LONGINT): LONGCARD;
  1256. (*
  1257.    Copy a BSTR to a null terminated string.
  1258.  
  1259.    cstr - pointer to a buffer area for the resulting string (should be
  1260.           maxLength+1 in size)
  1261.    bstr - BPTR to the BSTR to convert
  1262.    maxLength - maximum number of characters in buffer (not including null
  1263.                terminator)
  1264.  
  1265.    result - actual number of characters copied
  1266. *)
  1267.  
  1268.  
  1269. PROCEDURE CtoBstr(cstr: ADDRESS; bstr: BPTR; maxLength: LONGINT): LONGCARD;
  1270. (*
  1271.    Copy a null terminated string to a BSTR.
  1272.  
  1273.    cstr - pointer to the string to convert
  1274.    bstr - BPTR to the destination string (must be maxLength+1 bytes in size)
  1275.    maxLength - number of characters available in BSTR (not including initial
  1276.                count byte)
  1277.  
  1278.    result - actual number of characters transferred
  1279. *)
  1280.  
  1281.  
  1282. PROCEDURE GetDevInfo(devNode: DeviceListPtr): DeviceListPtr;
  1283. (*
  1284.    Traverse through DevInfo device list.
  1285.  
  1286.    devNode - current position in list (or NIL for head)
  1287.  
  1288.    result - next node in list or NIL (if at end of list)
  1289. *)
  1290.  
  1291.  
  1292. PROCEDURE FreeTaskResList(): BOOLEAN;
  1293. (*
  1294.    Free tracked resources for this task.
  1295.  
  1296.    result - success(TRUE) or failure(FALSE)
  1297. *)
  1298.  
  1299.  
  1300. PROCEDURE ArpExit(rc: LONGINT; fault: LONGINT);
  1301. (*
  1302.    Exit immediately, closing ARP, freeing resources.
  1303.  
  1304.    rc - the value you wish to return (0 means a normal exit)
  1305.    fault - if rc#0, this value is the AmigaDOS error code which is used with
  1306.            the "Why" program (ignored if rc=0)
  1307. *)
  1308.  
  1309.  
  1310. PROCEDURE ArpAlloc(size: LONGINT): ADDRESS;
  1311. (*
  1312.    Allocate memory and track.
  1313.  
  1314.    size - amount of memory required
  1315.  
  1316.    result - pointer to a memory block with MemReqSet(MemPuclic,MemClear) or NIL
  1317.             (if an error occurred)
  1318. *)
  1319.  
  1320.  
  1321. PROCEDURE ArpAllocMem(size: LONGINT; requirements: MemReqSet): ADDRESS;
  1322. (*
  1323.    Allocate and track memory.
  1324.  
  1325.    size - amount of memory required
  1326.    requirements - type of memory required
  1327.  
  1328.    result - pointer to a memory block of type and size requested or NIL (if an
  1329.             error occurred)
  1330. *)
  1331.  
  1332.  
  1333. PROCEDURE ArpOpen(name: ADDRESS; mode: LONGINT): FileHandle;
  1334. (*
  1335.    Open a file and track it.
  1336.  
  1337.    name - pointer to a null terminated string
  1338.    mode - valid AmigaDOS access mode
  1339.  
  1340.    result - file handle or NIL
  1341. *)
  1342.  
  1343.  
  1344. PROCEDURE ArpDupLock(lock: FileLock): FileLock;
  1345. (*
  1346.    Duplicate a lock and track it.
  1347.  
  1348.    lock - pointer to a lock
  1349.  
  1350.    result - pointer to a lock or NIL
  1351. *)
  1352.  
  1353.  
  1354. PROCEDURE ArpLock(name: ADDRESS; mode: LONGINT): FileLock;
  1355. (*
  1356.    Get a lock and track it.
  1357.  
  1358.    name - pointer to a null terminated string
  1359.    mode - valid AmigaDOS access value
  1360.  
  1361.    result - a lock or NIL
  1362. *)
  1363.  
  1364.  
  1365. PROCEDURE RListAlloc(resList: ResListPtr; size: LONGINT): ADDRESS;
  1366. (*
  1367.    Allocate and track memory on specific ResList.
  1368.  
  1369.    resList - the ResList the allocation will be chained onto
  1370.    size - the size of the memory request
  1371.  
  1372.    result - pointer to a block of memory of the requested size or NIL
  1373. *)
  1374.  
  1375.  
  1376. PROCEDURE FindCLI(cliNum: LONGINT): ProcessPtr;
  1377. (*
  1378.    Get process structure for CLI number.
  1379.  
  1380.    cliNum - the CLI task number for the process or 0 (which returns the total
  1381.             number of process slots)
  1382.  
  1383.    result - a process structure, NIL or total number of allowable CLI processes
  1384.             (see above)
  1385. *)
  1386.  
  1387.  
  1388. PROCEDURE QSort(base: ADDRESS; rSize: LONGINT; bSize: LONGINT;
  1389.                 comp: ADDRESS): BOOLEAN;
  1390. (*
  1391.    Quickly sort whatever you want.
  1392.  
  1393.    base - pointer to the start of a memory region to be sorted
  1394.    rSize - size of region to be sorted
  1395.    bSize - size of a single element in bytes
  1396.    comp - function to be provided by caller, which compares two elements from
  1397.           the set to be sorted.
  1398.  
  1399.    result - success(TRUE) or failure(FALSE)
  1400. *)
  1401.  
  1402.  
  1403. PROCEDURE PatternMatch(pattern: ADDRESS; string: ADDRESS): BOOLEAN;
  1404. (*
  1405.    Perform a wildcard match on a string.
  1406.  
  1407.    pattern - pointer to the pattern string to match against
  1408.    string - pointer to the string to be matched
  1409.  
  1410.    result - success(TRUE) or failure(FALSE)
  1411. *)
  1412.  
  1413.  
  1414. PROCEDURE FindFirst(pattern: ADDRESS; path: AnchorPathPtr): LONGINT;
  1415. (*
  1416.    Search for multilevel pattern match.
  1417.  
  1418.    pattern - pointer to an ASCII string
  1419.    path - pointer to an initialized AnchorPath structure
  1420.  
  1421.    result - 0 if success, non-zero for any error (see above)
  1422. *)
  1423.  
  1424.  
  1425. PROCEDURE FindNext(path: AnchorPathPtr): LONGINT;
  1426. (*
  1427.    Locate next match for a file pattern.
  1428.  
  1429.    path - pointer to an AnchorPath structure which has been initialized by a
  1430.           call to FindFirst()
  1431.  
  1432.    result - 0 for success, non-zero for any error (see above)
  1433. *)
  1434.  
  1435.  
  1436. PROCEDURE FreeAnchorChain(path: AnchorPathPtr);
  1437. (*
  1438.    Free an allocated anchor chain.
  1439.  
  1440.    path - AnchorPath structure initialized by calls to FindFirst() and/or
  1441.           FindNext()
  1442. *)
  1443.  
  1444.  
  1445. PROCEDURE CompareLock(lock1: FileLock; lock2: FileLock): LONGINT;
  1446. (*
  1447.    Compares two locks for "equality".
  1448.  
  1449.    lock1 - pointer to a lock
  1450.    lock2 - pointer to a lock
  1451.  
  1452.    result - return code as documented above
  1453. *)
  1454.  
  1455.  
  1456. PROCEDURE FindTaskResList(): ResListPtr;
  1457. (*
  1458.    Find a pointer to current task's ResList.
  1459.  
  1460.    result - pointer to most recent ResList for your task or NIL (if nothing is
  1461.             being tracked)
  1462. *)
  1463.  
  1464.  
  1465. PROCEDURE CreateTaskResList(): ResListPtr;
  1466. (*
  1467.    Create a new nested ResList for this task.
  1468.  
  1469.    result - pointer to the new list or NIL (if failure)
  1470. *)
  1471.  
  1472.  
  1473. PROCEDURE FreeResList(freeList: ResListPtr);
  1474. (*
  1475.    NOT DOCUMENTED
  1476. *)
  1477.  
  1478.  
  1479. PROCEDURE FreeTrackedItem(item: DefaultTrackerPtr);
  1480. (*
  1481.    Free a tracked item from a ResList.
  1482.  
  1483.    item - pointer to the tracker for this resource
  1484. *)
  1485.  
  1486.  
  1487. PROCEDURE GetTracker(): DefaultTrackerPtr;
  1488. (*
  1489.    Get a tracking node for resource tracking.
  1490.  
  1491.    result - pointer to a DefaultTracker or NIL (if the allocation failed)
  1492. *)
  1493.  
  1494.  
  1495. PROCEDURE GetAccess(tracker: DefaultTrackerPtr): TrackedResourcePtr;
  1496. (*
  1497.    Locks access to a tracked resource.
  1498.  
  1499.    tracker - the tracker for the resource you want to reclaim
  1500.  
  1501.    result - pointer to the resource or NIL (if the resource is gone)
  1502. *)
  1503.  
  1504.  
  1505. PROCEDURE FreeAccess(tracker: DefaultTrackerPtr);
  1506. (*
  1507.    Decrements use count for a tracked item.
  1508.  
  1509.    tracker - pointer to the DefaultTracker for this item
  1510. *)
  1511.  
  1512.  
  1513. PROCEDURE FreeDAList(node: DirectoryEntryPtr);
  1514. (*
  1515.    Free a DosAllocMem (DA) list.
  1516.  
  1517.    node - pointer to the first node to free
  1518. *)
  1519.  
  1520.  
  1521. PROCEDURE AddDANode(data: ADDRESS; daList: DirectoryEntryPtr; length: LONGINT;
  1522.                     id: LONGINT): DirectoryEntryPtr;
  1523. (*
  1524.    Add a new entry to a DAList.
  1525.  
  1526.    data - pointer to the data to be copied to the deName field of the new node.
  1527.           See length parameter
  1528.    daList - address of a DA list header for this node
  1529.    length - if 0, data is assumed to be a null terminated string. Otherwise,
  1530.             length gives the amount of memory to copy to the deName field
  1531.    id - id is the secondary sort key/type code. This will be the deType variable
  1532.         of the new code
  1533.  
  1534.    result - a pointer to the node just added to the DAList (or NIL, if an error
  1535.             occurred)
  1536. *)
  1537.  
  1538.  
  1539. PROCEDURE AddDADevs(daList: DirectoryEntryPtr;
  1540.                     select: DeviceListFlagsSet): LONGCARD;
  1541. (*
  1542.    Get private copy of DevInfo list.
  1543.  
  1544.    daList - pointer to a DA list header
  1545.    select - the selection mask which determines which devices will be added to
  1546.             the DA list
  1547.  
  1548.    result - the number of entries actually added to the user's DA list
  1549. *)
  1550.  
  1551.  
  1552. PROCEDURE Strcmp(s1: ADDRESS; s2: ADDRESS): LONGINT;
  1553. (*
  1554.    Compare two strings, ignoring case.
  1555.  
  1556.    s1 - pointer to null terminated string
  1557.    s2 - pointer to null terminated string
  1558.  
  1559.    result - less than zero if s1<s2, zero if s1=s2 and greater than zero if
  1560.             s1>s2
  1561. *)
  1562.  
  1563.  
  1564. PROCEDURE Strncmp(s1: ADDRESS; s2: ADDRESS; length: LONGINT): LONGINT;
  1565. (*
  1566.    Compare two strings for n bytes, ignoring case.
  1567.  
  1568.    s1 - pointer to null terminated string
  1569.    s2 - pointer to null terminated string
  1570.    length - maximum number of characters to compare
  1571.  
  1572.    result - see Strcmp()
  1573. *)
  1574.  
  1575.  
  1576. PROCEDURE Toupper(char: CHAR): CHAR;
  1577. (*
  1578.    Convert character to uppercase.
  1579.  
  1580.    char - a character
  1581.  
  1582.    result - an uppercase character
  1583. *)
  1584.  
  1585.  
  1586. PROCEDURE SyncRun(name: ADDRESS; command: ADDRESS; input: FileHandle;
  1587.                   output: FileHandle): LONGINT;
  1588. (*
  1589.    Load a process and wait for its completion.
  1590.  
  1591.    name - a pointer to the filename of the process you wish to load and run
  1592.    command - a pointer to the arguments you wish to pass to this process
  1593.    input - the standard input for the new process (NIL means default)
  1594.    output - the standard output for the new process (NIL means default)
  1595.  
  1596.    result - return code of the process executed (if positive or zero) or error
  1597.             (if negative)
  1598. *)
  1599.  
  1600.  
  1601.  
  1602.    (* Added V32 of arp.library *)
  1603.  
  1604. PROCEDURE ASyncRun(name: ADDRESS; command: ADDRESS;
  1605.                    pcb: ProcessControlBlockPtr): LONGINT;
  1606. (*
  1607.    Create an ansynchronous process.
  1608.  
  1609.    name - pointer to command name. If you do not supply a value on the
  1610.           pcbLoadedCode variable this must be a valid pathname or resident
  1611.           program name. If you provide already loaded code, the name does not
  1612.           need to refer to an actual program file or resident code, of course
  1613.    command - pointer to the commands you wish to pass to this argument. This may
  1614.              be NIL, but it must not exceed 256 characters in length. Note that
  1615.              IO redirection must be performed by the caller. Also note that some
  1616.              programs appear to have bugs in dealing with 0 length or NIL
  1617.              command lines. To safely pass a NIL command line, you should pass
  1618.              a string consisting of a newline and a null, i.e. "\n". This is
  1619.              defined above
  1620.    pcb - only pcbStackSize and pcbPro must be initialized by you
  1621.  
  1622.    result - if this function succeeds, a positive value, corresponding to the
  1623.             number of the CLI created will be returned. If no CLI is created,
  1624.             the value returned will be zero. If there is an error, then the
  1625.             return will be negative, and one of the documented error returns
  1626. *)
  1627.  
  1628.  
  1629. PROCEDURE SpawnShell(name: ADDRESS; command: ADDRESS;
  1630.                      shell: NewShellPtr): LONGINT;
  1631. (*
  1632.    NOT DOCUMENTED
  1633. *)
  1634.  
  1635.  
  1636. PROCEDURE LoadPrg(name: ADDRESS): BPTR;
  1637. (*
  1638.    Load a program by searching path.
  1639.  
  1640.    name - pointer to the null terminated pathname of the command to load
  1641.  
  1642.    result - a BPTR to the loaded code, or NIL, of an error occurred
  1643. *)
  1644.  
  1645.  
  1646. PROCEDURE PreParse(source: ADDRESS; dest: ADDRESS): BOOLEAN;
  1647. (*
  1648.    Create a tokenized string suitable for PatternMatch.
  1649.  
  1650.    source - pointer to wildcarded unparsed string
  1651.    dest - pointer to a buffer to place the parsed string in
  1652.  
  1653.    result - TRUE if any wildcards at all were encountered, FALSE otherwise
  1654. *)
  1655.  
  1656.  
  1657.  
  1658.    (* Added V33 of arp.library *)
  1659.  
  1660. PROCEDURE StampToStr(dateTime: DateTimePtr): BOOLEAN;
  1661. (*
  1662.    Convert DateStamp portion of DateTime structure to string.
  1663.  
  1664.    dateTime - a pointer to an initialized DateTime structure
  1665.  
  1666.    result - a non-zero return indicates that the DateStamp was invalid. Zero
  1667.             indicates that everything went according to plan
  1668. *)
  1669.  
  1670.  
  1671. PROCEDURE StrToStamp(dateTime: DateTimePtr): BOOLEAN;
  1672. (*
  1673.    Convert ASCII portion of DateTime structure to a DateStamp.
  1674.  
  1675.    dateTime - a pointer to an initialized DateTime structure
  1676.  
  1677.    result - see StampToStr()
  1678. *)
  1679.  
  1680.  
  1681. PROCEDURE ObtainResidentPrg(name: ADDRESS): ResidentProgramNodePtr;
  1682. (*
  1683.    Obtains a resident program for your use.
  1684.  
  1685.    name - pointer to a null terminated pathname
  1686.  
  1687.    result - pointer to the resident program node for the program. If NIL, an
  1688.             error occurred
  1689. *)
  1690.  
  1691.  
  1692. PROCEDURE AddResidentPrg(segment: BPTR; name: ADDRESS): ResidentProgramNodePtr;
  1693. (*
  1694.    Add a program to the resident list.
  1695.  
  1696.    segment - BPTR as returned by LoadSeg()
  1697.    name - pointer to a null terminated pathname
  1698.  
  1699.    result - pointer to the resident program node for the program or NIL (if it
  1700.             could not be added)
  1701. *)
  1702.  
  1703.  
  1704. PROCEDURE RemResidentPrg(name: ADDRESS): LONGINT;
  1705. (*
  1706.    Remove a program from the resident list, freeing it's node and code segments.
  1707.  
  1708.    name - a pointer to a null terminated pathname
  1709.  
  1710.    result - zero (everything is O.K.) or non-zero (code is in use)
  1711. *)
  1712.  
  1713.  
  1714. PROCEDURE UnLoadPrg(segment: BPTR);
  1715. (*
  1716.    Unload a program received from LoadPrg().
  1717.  
  1718.    segment - pointer to a segment obtained from LoadPrg()
  1719. *)
  1720.  
  1721.  
  1722. PROCEDURE LMult(a: LONGINT; b: LONGINT): LONGINT;
  1723. (*
  1724.    Perform a long multiply.
  1725.  
  1726.    a - a 32 bit signed number
  1727.    b - a 32 bit signed number
  1728.  
  1729.    result - the 32 bit result of a*b
  1730. *)
  1731.  
  1732.  
  1733. PROCEDURE LDiv(a: LONGINT; b: LONGINT): LONGINT;
  1734. (*
  1735.    Perform a long divide.
  1736.  
  1737.    a - a 32 bit signed number
  1738.    b - a 32 bit signed number
  1739.  
  1740.    result - the 32 bit result of a/b
  1741. *)
  1742.  
  1743.  
  1744. PROCEDURE LMod(a: LONGINT; b: LONGINT): LONGINT;
  1745. (*
  1746.    Perform a long modulus, doing canonical thing with sign.
  1747.  
  1748.    a - a 32 bit signed number
  1749.    b - a 32 bit signed number
  1750.  
  1751.    result - the 32 bit result of a MOD b, with sign of a
  1752. *)
  1753.  
  1754.  
  1755. PROCEDURE CheckSumPrg(node: ResidentProgramNodePtr): LONGINT;
  1756. (*
  1757.    Calculate the checksum on a resident program.
  1758.  
  1759.    node - pointer to a resident program node
  1760.  
  1761.    result - a newly calculated checksum
  1762. *)
  1763.  
  1764.  
  1765. PROCEDURE TackOn(pathname: ADDRESS; filename: ADDRESS);
  1766. (*
  1767.    Correctly add a filename to an existing pathname.
  1768.  
  1769.    pathname - pointer to the pathname to be augmented
  1770.    filename - pointer to the filename to augment pathname with
  1771. *)
  1772.  
  1773.  
  1774. PROCEDURE BaseName(name: ADDRESS): ADDRESS;
  1775. (*
  1776.    Return basename of pathname.
  1777.  
  1778.    name - pointer to a valid pathname
  1779.  
  1780.    result - pointer to start of basename
  1781. *)
  1782.  
  1783.  
  1784. PROCEDURE ReleaseResidentPrg(segment: BPTR): ResidentProgramNodePtr;
  1785. (*
  1786.    If segment is resident, decrement usage count.
  1787.  
  1788.    segment - pointer to a loaded code segment
  1789.  
  1790.    result - the corresponding node if found
  1791. *)
  1792.  
  1793.  
  1794.  
  1795.    (* Added V36 of arp.library *)
  1796.  
  1797. PROCEDURE SPrintf(buffer: ADDRESS; string: ADDRESS; stream: ADDRESS): LONGINT;
  1798. (*
  1799.    NOT DOCUMENTED
  1800. *)
  1801.  
  1802.  
  1803. PROCEDURE GetKeywordIndex(key: ADDRESS; template: ADDRESS): LONGINT;
  1804. (*
  1805.    NOT DOCUMENTED
  1806. *)
  1807.  
  1808.  
  1809. PROCEDURE ArpOpenLibrary(name: ADDRESS; version: LONGINT): LibraryPtr;
  1810. (*
  1811.    NOT DOCUMENTED
  1812. *)
  1813.  
  1814.  
  1815. PROCEDURE ArpAllocFReq(): FileRequesterPtr;
  1816. (*
  1817.    NOT DOCUMENTED
  1818. *)
  1819.  
  1820.  
  1821.  
  1822. END ARP.
  1823.