home *** CD-ROM | disk | FTP | other *** search
/ Club Amiga de Montreal - CAM / CAM_CD_1.iso / files / 460.lha / 3DPlot_v2.0 / sources / ARPBase.h < prev    next >
C/C++ Source or Header  |  1991-01-04  |  53KB  |  1,127 lines

  1. #ifndef LIBRARIES_ARPBASE_H
  2. #define LIBRARIES_ARPBASE_H    1
  3.  
  4. /*
  5.  ************************************************************************
  6.  *                                    *
  7.  * 5/3/89    ARPbase.h    by MKSoft from ARPbase.i by SDB     *
  8.  *                                    *
  9.  ************************************************************************
  10.  *                                    *
  11.  *    AmigaDOS Resource Project -- Library Include File        *
  12.  *                     for Lattice C 5.x or Manx C 3.6    *
  13.  *                                    *
  14.  ************************************************************************
  15.  *                                    *
  16.  *    Copyright (c) 1987/1988/1989 by Scott Ballantyne                *
  17.  *                                    *
  18.  *    The arp.library, and related code and files may be freely used    *
  19.  *    by supporters of ARP.  Modules in the arp.library may not be    *
  20.  *    extracted for use in independent code, but you are welcome to    *
  21.  *    provide the arp.library with your work and call on it freely.    *
  22.  *                                    *
  23.  *    You are equally welcome to add new functions, improve the ones    *
  24.  *    within, or suggest additions.                    *
  25.  *                                    *
  26.  *    BCPL programs are not welcome to call on the arp.library.    *
  27.  *    The welcome mat is out to all others.                *
  28.  *                                    *
  29.  ************************************************************************
  30.  *                                    *
  31.  * N O T E !  You MUST! have IoErr() defined as LONG to use LastTracker *
  32.  *          If your compiler has other defines for this, you may wish *
  33.  *          to remove the prototype for IoErr() from this file.       *
  34.  *                                    *
  35.  ************************************************************************
  36.  */
  37.  
  38. /*
  39.  ************************************************************************
  40.  *    First we need to include the Amiga Standard Include files...    *
  41.  ************************************************************************
  42.  */
  43. #ifndef EXEC_TYPES_H
  44. #include    <EXEC/Types.h>
  45. #endif    EXEC_TYPES_H
  46.  
  47. #ifndef EXEC_LISTS_H
  48. #include    <EXEC/Lists.h>
  49. #endif    EXEC_LISTS_H
  50.  
  51. #ifndef EXEC_ALERTS_H
  52. #include    <EXEC/Alerts.h>
  53. #endif    EXEC_ALERTS_H
  54.  
  55. #ifndef EXEC_LIBRARIES_H
  56. #include    <EXEC/Libraries.h>
  57. #endif    EXEC_LIBRARIES_H
  58.  
  59. #ifndef EXEC_SEMAPHORES_H
  60. #include    <EXEC/Semaphores.h>
  61. #endif    EXEC_SEMAPHORES_H
  62.  
  63. #ifndef LIBRARIES_DOS_H
  64. #include    <Libraries/DOS.h>
  65. #endif    LIBRARIES_DOS_H
  66.  
  67. /*
  68.  ************************************************************************
  69.  *    Check for MANX/Lattice and define the differences...        *
  70.  ************************************************************************
  71.  *    At the moment MANX 3.6 does not have prototypes or the        *
  72.  *    wonderful #pragma statements of Lattice 5.0...            *
  73.  *    And, no __stdargs in MANX either...                *
  74.  ************************************************************************
  75.  */
  76. #ifdef    AZTEC_C
  77.  
  78. #define NO_PRAGMAS    1
  79. #define NO_PROTOTYPES    1
  80. #define C_Args
  81.  
  82. #endif    AZTEC_C
  83.  
  84. #ifdef    LATTICE
  85.  
  86. #define C_Args        __stdargs
  87.  
  88. #endif    LATTICE
  89.  
  90. /*
  91.  ************************************************************************
  92.  *    Standard definitions for arp library information        *
  93.  ************************************************************************
  94.  */
  95. #define ArpName     "arp.library"   /* Name of library... */
  96. #define ArpVersion    39L        /* Current version... */
  97.  
  98. /*
  99.  ************************************************************************
  100.  *    The current ARP library node...                 *
  101.  ************************************************************************
  102.  */
  103. struct    ArpBase {
  104.     struct    Library         LibNode;     /* Standard library node        */
  105.         APTR            DosRootNode;     /* Copy of dl_Root            */
  106.         UBYTE            Flags;         /* See bitdefs below            */
  107.         UBYTE            ESCChar;     /* Character to be used for escaping    */
  108.         LONG            ArpReserved1;     /* ArpLib's use only!!                 */
  109.     struct    Library         *EnvBase;     /* Dummy library for MANX compatibility*/
  110.     struct    Library         *DosBase;     /* Cached DosBase            */
  111.     struct    Library         *GfxBase;     /* Cached GfxBase            */
  112.     struct    Library         *IntuiBase;     /* Cached IntuitionBase        */
  113.     struct    MinList         ResLists;     /* Resource trackers            */
  114.     struct    ResidentProgramNode    *ResidentPrgList;/* Resident Programs.            */
  115.     struct    SignalSemaphore     ResPrgProtection;/* protection for above        */
  116.         BPTR            SegList;     /* Pointer to loaded libcode (a BPTR). */
  117.         };
  118.  
  119. /*
  120.  ************************************************************************
  121.  *    The following is here *ONLY* for information and for        *
  122.  *    compatibility with MANX.  DO NOT use in new code!        *
  123.  ************************************************************************
  124.  */
  125. #ifdef    ARP_PRIVATE
  126. struct EnvBase {
  127.     struct    Library LibNode;    /* Standard library node for linkage    */
  128.         BYTE    *EnvSpace;    /* Access only when Forbidden!        */
  129.         ULONG    EnvSize;    /* Total allocated mem for EnvSpace    */
  130.     struct    ArpBase *ArpBase;    /* Added in V32 for Resource Tracking    */
  131.         };
  132. #endif    ARP_PRIVATE
  133.  
  134. /*
  135.  ************************************************************************
  136.  *    These are used in release 33.4 but not by the library code.    *
  137.  *    Instead, individual programs check for these flags.        *
  138.  ************************************************************************
  139.  */
  140. #define ARPB_WILD_WORLD 0L        ; Mixed BCPL/Normal wildcards.
  141. #define ARPB_WILD_BCPL    1L        ; Pure BCPL wildcards.
  142.  
  143. #define ARPF_WILD_WORLD (1L << ARPB_WILD_WORLD)
  144. #define ARPF_WILD_BCPL    (1L << ARPB_WILD_BCPL)
  145.  
  146. /*
  147.  ************************************************************************
  148.  * The alert object is what you use if you really must return an alert    *
  149.  * to the user. You would normally OR this with another alert number    *
  150.  * from the alerts.h file. Generally, should be NON deadend alerts.    *
  151.  *                                    *
  152.  * For example, if you can't open ArpLibrary:                           *
  153.  *    Alert( (AG_OpenLib|AO_ArpLib), 0L);                             *
  154.  ************************************************************************
  155.  */
  156. #define AO_ArpLib    0x00008036L        /* Alert object */
  157.  
  158. /*
  159.  ************************************************************************
  160.  *    Alerts that arp.library may return...                *
  161.  ************************************************************************
  162.  */
  163. #define AN_ArpLib    0x03600000L    /* Alert number             */
  164. #define AN_ArpNoMem    0x03610000L    /* No more memory            */
  165. #define AN_ArpInputMem    0x03610002L    /* No memory for input buffer        */
  166. #define AN_ArpNoMakeEnv 0x83610003L    /* No memory to make EnvLib        */
  167.  
  168. #define AN_ArpNoDOS    0x83630001L    /* Can't open dos.library               */
  169. #define AN_ArpNoGfx    0x83630002L    /* Can't open graphics.library          */
  170. #define AN_ArpNoIntuit    0x83630003L    /* Can't open intuition                 */
  171. #define AN_BadPackBlues 0x83640000L    /* Bad packet returned to SendPacket()  */
  172. #define AN_Zombie    0x83600003L    /* Zombie roaming around system     */
  173.  
  174. #define AN_ArpScattered 0x83600002L    /* Scatter loading not allowed for arp    */
  175.  
  176.  
  177. /*
  178.  ************************************************************************
  179.  *    Return codes you can get from calling ARP Assign()...           *
  180.  ************************************************************************
  181.  */
  182. #define ASSIGN_OK    0L    /* Everything is cool and groovey            */
  183. #define ASSIGN_NODEV    1L    /* "Physical" is not valid for assignment               */
  184. #define ASSIGN_FATAL    2L    /* Something really icky happened            */
  185. #define ASSIGN_CANCEL    3L    /* Tried to cancel something but it won't cancel        */
  186.  
  187. /*
  188.  ************************************************************************
  189.  *    Size of buffer you need if you are going to call ReadLine()     *
  190.  ************************************************************************
  191.  */
  192. #define MaxInputBuf    256L
  193.  
  194. /*
  195.  ************************************************************************
  196.  *    The ARP file requester data structure...            *
  197.  ************************************************************************
  198.  */
  199. struct FileRequester    {
  200.             BYTE    *fr_Hail;        /* Hailing text         */
  201.             BYTE    *fr_File;        /* Filename array (FCHARS + 1)  */
  202.             BYTE    *fr_Dir;        /* Directory array (DSIZE + 1)  */
  203.         struct    Window    *fr_Window;        /* Window requesting or NULL    */
  204.             UBYTE    fr_FuncFlags;        /* Set bitdef's below           */
  205.             UBYTE    fr_Flags2;        /* New flags...         */
  206.             VOID    (*fr_Function)();       /* Your function, see bitdef's  */
  207.             WORD    fr_LeftEdge;        /* To be used later...        */
  208.             WORD    fr_TopEdge;
  209.             };
  210.  
  211. /*
  212.  ************************************************************************
  213.  * The following are the defines for fr_FuncFlags.  These bits tell    *
  214.  * FileRequest() what your fr_UserFunc is expecting, and what           *
  215.  * FileRequest() should call it for.                                    *
  216.  *                                    *
  217.  * You are called like so:                        *
  218.  * fr_Function(Mask, Object)                                            *
  219.  * ULONG    Mask;                            *
  220.  * CPTR     *Object;                        *
  221.  *                                    *
  222.  * The Mask is a copy of the flag value that caused FileRequest() to    *
  223.  * call your function. You can use this to determine what action you    *
  224.  * need to perform, and exactly what Object is, so you know what to do    *
  225.  * and what to return.                            *
  226.  ************************************************************************
  227.  */
  228. #define FRB_DoWildFunc    7L /* Call me with a FIB and a name, ZERO return accepts.    */
  229. #define FRB_DoMsgFunc    6L /* You get all IDCMP messages not for FileRequest()          */
  230. #define FRB_DoColor    5L /* Set this bit for that new and different look        */
  231. #define FRB_NewIDCMP    4L /* Force a new IDCMP (only if fr_Window != NULL)             */
  232. #define FRB_NewWindFunc 3L /* You get to modify the newwindow structure.        */
  233. #define FRB_AddGadFunc    2L /* You get to add gadgets.                    */
  234. #define FRB_GEventFunc    1L /* Function to call if one of your gadgets is selected.    */
  235. #define FRB_ListFunc    0L /* Not implemented yet.                    */
  236.  
  237. #define FRF_DoWildFunc    (1L << FRB_DoWildFunc)
  238. #define FRF_DoMsgFunc    (1L << FRB_DoMsgFunc)
  239. #define FRF_DoColor    (1L << FRB_DoColor)
  240. #define FRF_NewIDCMP    (1L << FRB_NewIDCMP)
  241. #define FRF_NewWindFunc (1L << FRB_NewWindFunc)
  242. #define FRF_AddGadFunc    (1L << FRB_AddGadFunc)
  243. #define FRF_GEventFunc    (1L << FRB_GEventFunc)
  244. #define FRF_ListFunc    (1L << FRB_ListFunc)
  245.  
  246. /*
  247.  ************************************************************************
  248.  * The FR2B_ bits are for fr_Flags2 in the file requester structure    *
  249.  ************************************************************************
  250.  */
  251. #define FR2B_LongPath    0L /* Specify the fr_Dir buffer is 256 bytes long */
  252.  
  253. #define FR2F_LongPath    (1L << FR2B_LongPath)
  254.  
  255. /*
  256.  ************************************************************************
  257.  *    The sizes of the different buffers...                *
  258.  ************************************************************************
  259.  */
  260. #define FCHARS        32L    /* Filename size                */
  261. #define DSIZE        33L    /* Directory name size if not FR2B_LongPath    */
  262.  
  263. #define LONG_DSIZE    254L    /* If FR2B_LongPath is set, use LONG_DSIZE    */
  264. #define LONG_FSIZE    126L    /* For compatibility with ARPbase.i        */
  265.  
  266. #define FR_FIRST_GADGET 0x7680L /* User gadgetID's must be less than this value */
  267.  
  268. /*
  269.  ************************************************************************
  270.  * Structure expected by FindFirst()/FindNext()                         *
  271.  *                                    *
  272.  * You need to allocate this structure and initialize it as follows:    *
  273.  *                                    *
  274.  * Set ap_BreakBits to the signal bits (CDEF) that you want to take a   *
  275.  * break on, or NULL, if you don't want to convenience the user.        *
  276.  *                                    *
  277.  * if you want to have the FULL PATH NAME of the files you found,    *
  278.  * allocate a buffer at the END of this structure, and put the size of    *
  279.  * it into ap_StrLen.  If you don't want the full path name, make sure  *
  280.  * you set ap_StrLen to zero.  In this case, the name of the file, and    *
  281.  * stats are available in the ap_Info, as per usual.            *
  282.  *                                    *
  283.  * Then call FindFirst() and then afterwards, FindNext() with this      *
  284.  * structure.  You should check the return value each time (see below)  *
  285.  * and take the appropriate action, ultimately calling            *
  286.  * FreeAnchorChain() when there are no more files and you are done.     *
  287.  * You can tell when you are done by checking for the normal AmigaDOS    *
  288.  * return code ERROR_NO_MORE_ENTRIES.                    *
  289.  *                                    *
  290.  * You will also have to check the DirEntryType variable in the ap_Info *
  291.  * structure to determine what exactly you have received.        *
  292.  ************************************************************************
  293.  */
  294. struct    AnchorPath    {
  295.         struct    AChain        *ap_Base;    /* Pointer to first anchor            */
  296.         struct    AChain        *ap_Last;    /* Pointer to last anchor            */
  297.             LONG        ap_BreakBits;    /* Bits to break on                */
  298.             LONG        ap_FoundBreak;    /* Bits we broke on. Also returns ERROR_BREAK    */
  299.             BYTE        ap_Flags;    /* New use for the extra word...        */
  300.             BYTE        ap_Reserved;    /* To fill it out...                */
  301.             WORD        ap_StrLen;    /* This is what used to be ap_Length        */
  302.         struct    FileInfoBlock    ap_Info;
  303.             BYTE        ap_Buf[1];    /* Allocate a buffer here, if desired        */
  304.             };
  305.  
  306. /*
  307.  ************************************************************************
  308.  *    Bit definitions for the new ap_Flags...             *
  309.  ************************************************************************
  310.  */
  311. #define APB_DoWild    0L    /* User option ALL                */
  312. #define APB_ItsWild    1L    /* Set by FindFirst, used by FindNext        */
  313. #define APB_DoDir    2L    /* Bit is SET if a DIR node should be entered    */
  314.                 /* Application can RESET this bit to AVOID    */
  315.                 /* entering a dir.                */
  316. #define APB_DidDir    3L    /* Bit is set for an "expired" dir node         */
  317. #define APB_NoMemErr    4L    /* Set if there was not enough memory        */
  318. #define APB_DoDot    5L    /* If set, '.' (DOT) will convert to CurrentDir */
  319.  
  320. #define APF_DoWild    (1L << APB_DoWild)
  321. #define APF_ItsWild    (1L << APB_ItsWild)
  322. #define APF_DoDir    (1L << APB_DoDir)
  323. #define APF_DidDir    (1L << APB_DidDir)
  324. #define APF_NoMemErr    (1L << APB_NoMemErr)
  325. #define APF_DoDot    (1L << APB_DoDot)
  326.  
  327. /*
  328.  ************************************************************************
  329.  * Structure used by the pattern matching functions, no need to obtain, *
  330.  * diddle or allocate this yourself.                    *
  331.  *                                    *
  332.  * Note:  If you did, you will now break as it has changed...        *
  333.  ************************************************************************
  334.  */
  335. #ifdef    ARP_PRIVATE
  336. struct    AChain    {
  337.     struct    AChain        *an_Child;
  338.     struct    AChain        *an_Parent;
  339.     struct    FileLock    *an_Lock;
  340.     struct    FileInfoBlock    *an_Info;
  341.         BYTE        an_Flags;
  342.         char        an_String[1];    /* Just as is .i file    */
  343.         };                /* ???    Don't use this! */
  344. #endif    ARP_PRIVATE
  345.  
  346. #define DDB_PatternBit    0L
  347. #define DDB_ExaminedBit 1L
  348. #define DDB_Completed    2L
  349. #define DDB_AllBit    3L
  350.  
  351. #define DDF_PatternBit    (1L << DDB_PatternBit)
  352. #define DDF_ExaminedBit (1L << DDB_ExaminedBit)
  353. #define DDF_Completed    (1L << DDB_Completed)
  354. #define DDF_AllBit    (1L << DDB_AllBit)
  355.  
  356. /*
  357.  ************************************************************************
  358.  * This structure takes a pointer, and returns FALSE if wildcard was    *
  359.  * not found by FindFirst()                                             *
  360.  ************************************************************************
  361.  */
  362. #define IsWild( ptr )           ( *((LONG *)(ptr)) )
  363.  
  364. /*
  365.  ************************************************************************
  366.  * Constants used by wildcard routines                    *
  367.  *                                    *
  368.  * These are the pre-parsed tokens referred to by pattern match.  It    *
  369.  * is not necessary for you to do anything about these, FindFirst()     *
  370.  * FindNext() handle all these for you.                                 *
  371.  ************************************************************************
  372.  */
  373. #define P_ANY        0x80L    /* Token for '*' | '#?' */
  374. #define P_SINGLE    0x81L    /* Token for '?'        */
  375.  
  376. /*
  377.  ************************************************************************
  378.  * No need to muck with these as they may change...            *
  379.  ************************************************************************
  380.  */
  381. #ifdef    ARP_PRIVATE
  382. #define P_ORSTART    0x82L    /* Token for '('        */
  383. #define P_ORNEXT    0x83L    /* Token for '|'        */
  384. #define P_OREND     0x84L    /* Token for ')'        */
  385. #define P_NOT        0x85L    /* Token for '~'        */
  386. #define P_NOTCLASS    0x87L    /* Token for '^'        */
  387. #define P_CLASS     0x88L    /* Token for '[]'       */
  388. #define P_REPBEG    0x89L    /* Token for '['        */
  389. #define P_REPEND    0x8AL    /* Token for ']'        */
  390. #endif    ARP_PRIVATE
  391.  
  392. /*
  393.  ************************************************************************
  394.  * Structure used by AddDANode(), AddDADevs(), FreeDAList().            *
  395.  *                                    *
  396.  * This structure is used to create lists of names, which normally    *
  397.  * are devices, assigns, volumes, files, or directories.        *
  398.  ************************************************************************
  399.  */
  400. struct    DirectoryEntry    {
  401.         struct    DirectoryEntry    *de_Next;    /* Next in list             */
  402.             BYTE        de_Type;    /* DLX_mumble                */
  403.             BYTE        de_Flags;    /* For future expansion, DO NOT USE!    */
  404.             BYTE        de_Name[1];    /* The name of the thing found        */
  405.             };
  406.  
  407. /*
  408.  ************************************************************************
  409.  * Defines you use to get a list of the devices you want to look at.    *
  410.  * For example, to get a list of all directories and volumes, do:    *
  411.  *                                    *
  412.  *    AddDADevs( mydalist, (DLF_DIRS | DLF_VOLUMES) )                 *
  413.  *                                    *
  414.  * After this, you can examine the de_type field of the elements added    *
  415.  * to your list (if any) to discover specifics about the objects added. *
  416.  *                                    *
  417.  * Note that if you want only devices which are also disks, you must    *
  418.  * (DLF_DEVICES | DLF_DISKONLY).                                        *
  419.  ************************************************************************
  420.  */
  421. #define DLB_DEVICES    0L    /* Return devices                */
  422. #define DLB_DISKONLY    1L    /* Modifier for above: Return disk devices only */
  423. #define DLB_VOLUMES    2L    /* Return volumes only                */
  424. #define DLB_DIRS    3L    /* Return assigned devices only         */
  425.  
  426. #define DLF_DEVICES    (1L << DLB_DEVICES)
  427. #define DLF_DISKONLY    (1L << DLB_DISKONLY)
  428. #define DLF_VOLUMES    (1L << DLB_VOLUMES)
  429. #define DLF_DIRS    (1L << DLB_DIRS)
  430.  
  431. /*
  432.  ************************************************************************
  433.  * Legal de_Type values, check for these after a call to AddDADevs(),   *
  434.  * or use on your own as the ID values in AddDANode().                  *
  435.  ************************************************************************
  436.  */
  437. #define DLX_FILE    0L    /* AddDADevs() can't determine this     */
  438. #define DLX_DIR     8L    /* AddDADevs() can't determine this     */
  439. #define DLX_DEVICE    16L    /* It's a resident device               */
  440.  
  441. #define DLX_VOLUME    24L    /* Device is a volume            */
  442. #define DLX_UNMOUNTED    32L    /* Device is not resident        */
  443.  
  444. #define DLX_ASSIGN    40L    /* Device is a logical assignment    */
  445.  
  446. /*
  447.  ************************************************************************
  448.  *    This macro is to check for an error return from the Atol()      *
  449.  *    routine.  If Errno is ERRBADINT, then there was an error...    *
  450.  *    This was done to try to remain as close to source compatible    *
  451.  *    as possible with the older (rel 1.1) ARPbase.h                  *
  452.  ************************************************************************
  453.  */
  454. #define ERRBADINT    1L
  455. #define Errno        (IoErr() ? ERRBADINT : 0)
  456.  
  457. /*
  458.  ************************************************************************
  459.  *    Resource Tracking stuff...                    *
  460.  ************************************************************************
  461.  *                                    *
  462.  * There are a few things in arp.library that are only directly     *
  463.  * acessable from assembler.  The glue routines provided by us for    *
  464.  * all 'C' compilers use the following conventions to make these        *
  465.  * available to C programs.  The glue for other language's should use   *
  466.  * as similar a mechanism as possible, so that no matter what language    *
  467.  * or compiler we speak, when talk about arp, we will know what the    *
  468.  * other guy is saying.                         *
  469.  *                                    *
  470.  * Here are the cases:                            *
  471.  *                                    *
  472.  * Tracker calls...                            *
  473.  *        These calls return the Tracker pointer as a secondary    *
  474.  *        result in the register A1.  For C, there is no clean    *
  475.  *        way to return more than one result so the tracker    *
  476.  *        pointer is returned in IoErr().  For ease of use,       *
  477.  *        there is a define that typecasts IoErr() to the correct *
  478.  *        pointer type.  This is called LastTracker and should    *
  479.  *        be source compatible with the earlier method of storing *
  480.  *        the secondary result.                    *
  481.  *                                    *
  482.  * GetTracker() -                                                       *
  483.  *        Syntax is a bit different for C than the assembly call    *
  484.  *        The C syntax is GetTracker(ID).  The binding routines   *
  485.  *        will store the ID into the tracker on return.  Also,    *
  486.  *        in an effort to remain consistant, the tracker will    *
  487.  *        also be stored in LastTracker.                *
  488.  *                                    *
  489.  * In cases where you have allocated a tracker before you have obtained *
  490.  * a resource (usually the most efficient method), and the resource has *
  491.  * not been obtained, you will need to clear the tracker id.  The macro *
  492.  * CLEAR_ID() has been provided for that purpose.  It expects a pointer *
  493.  * to a DefaultTracker sort of struct.                    *
  494.  ************************************************************************
  495.  */
  496. #define CLEAR_ID(t)     ((SHORT *) t)[-1]=NULL
  497.  
  498. /*
  499.  ************************************************************************
  500.  * You MUST prototype IoErr() to prevent the possible error in defining *
  501.  * IoErr() and thus causing LastTracker to give you trash...            *
  502.  *                                    *
  503.  * N O T E !  You MUST! have IoErr() defined as LONG to use LastTracker *
  504.  *          If your compiler has other defines for this, you may wish *
  505.  *          to remove the prototype for IoErr().                      *
  506.  ************************************************************************
  507.  */
  508. #define LastTracker    ((struct DefaultTracker *)IoErr())
  509.  
  510. /*
  511.  ************************************************************************
  512.  * The rl_FirstItem list (ResList) is a list of TrackedResource (below) *
  513.  * It is very important that nothing in this list depend on the task    *
  514.  * existing at resource freeing time (i.e., RemTask(0L) type stuff,     *
  515.  * DeletePort() and the rest).                                          *
  516.  *                                    *
  517.  * The tracking functions return a struct Tracker *Tracker to you, this *
  518.  * is a pointer to whatever follows the tr_ID variable.         *
  519.  * The default case is reflected below, and you get it if you call    *
  520.  * GetTracker() ( see DefaultTracker below).                            *
  521.  *                                    *
  522.  * NOTE: The two user variables mentioned in an earlier version don't   *
  523.  * exist, and never did. Sorry about that (SDB).                        *
  524.  *                                    *
  525.  * However, you can still use ArpAlloc() to allocate your own tracking  *
  526.  * nodes and they can be any size or shape you like, as long as the    *
  527.  * base structure is preserved. They will be freed automagically just    *
  528.  * like the default trackers.                        *
  529.  ************************************************************************
  530.  */
  531. struct    TrackedResource {
  532.         struct    MinNode tr_Node;    /* Double linked pointer        */
  533.             BYTE    tr_Flags;    /* Don't touch                          */
  534.             BYTE    tr_Lock;    /* Don't touch, for Get/FreeAccess()    */
  535.             SHORT    tr_ID;        /* Item's ID                            */
  536.  
  537. /*
  538.  ************************************************************************
  539.  * The struct DefaultTracker *Tracker portion of the structure.     *
  540.  * The stuff below this point can conceivably vary, depending        *
  541.  * on user needs, etc.    This reflects the default.            *
  542.  ************************************************************************
  543.  */
  544.             union    {
  545.                 CPTR    tr_Resource;    /* Whatever                */
  546.                 LONG    tg_Verify;    /* For use during TRAK_GENERIC        */
  547.                 }    tr_Object;    /* The thing being tracked        */
  548.             union    {
  549.                 VOID    (*tg_Function)();/* Function to call for TRAK_GENERIC   */
  550.             struct    Window    *tr_Window2;    /* For TRAK_WINDOW            */
  551.                 }    tr_Extra;    /* Only needed sometimes        */
  552.             };
  553.  
  554. #define tg_Value tg_Verify    /* Ancient compatibility only!    Do NOT use in new CODE!!! */
  555.  
  556. /*
  557.  ************************************************************************
  558.  * You get a pointer to a struct of the following type when you call    *
  559.  * GetTracker().  You can change this, and use ArpAlloc() instead of    *
  560.  * GetTracker() to do tracking. Of course, you have to take a wee bit   *
  561.  * more responsibility if you do, as well as if you use TRAK_GENERIC    *
  562.  * stuff.                                *
  563.  *                                    *
  564.  * TRAK_GENERIC folks need to set up a task function to be called when    *
  565.  * an item is freed.  Some care is required to set this up properly.    *
  566.  *                                    *
  567.  * Some special cases are indicated by the unions below, for        *
  568.  * TRAK_WINDOW, if you have more than one window opened, and don't      *
  569.  * want the IDCMP closed particularly, you need to set a ptr to the    *
  570.  * other window in dt_Window2.    See CloseWindowSafely() for more info.  *
  571.  * If only one window, set this to NULL.                *
  572.  ************************************************************************
  573.  */
  574. struct    DefaultTracker    {
  575.             union    {
  576.                 CPTR    dt_Resource;    /* Whatever                */
  577.                 LONG    tg_Verify;    /* For use during TRAK_GENERIC        */
  578.                 }    dt_Object;    /* The object being tracked        */
  579.             union    {
  580.                 VOID    (*tg_Function)();/* Function to call for TRAK_GENERIC   */
  581.             struct    Window    *dt_Window2;    /* For TRAK_WINDOW            */
  582.                 }    dt_Extra;
  583.             };
  584.  
  585. /*
  586.  ************************************************************************
  587.  *    Items the tracker knows what to do about            *
  588.  ************************************************************************
  589.  */
  590. #define TRAK_AAMEM    0L    /* Default (ArpAlloc) element           */
  591. #define TRAK_LOCK    1L    /* File lock                */
  592. #define TRAK_FILE    2L    /* Opened file                */
  593. #define TRAK_WINDOW    3L    /* Window -- see docs            */
  594. #define TRAK_SCREEN    4L    /* Screen                */
  595. #define TRAK_LIBRARY    5L    /* Opened library            */
  596. #define TRAK_DAMEM    6L    /* Pointer to DosAllocMem block     */
  597. #define TRAK_MEMNODE    7L    /* AllocEntry() node                    */
  598. #define TRAK_SEGLIST    8L    /* Program segment            */
  599. #define TRAK_RESLIST    9L    /* ARP (nested) ResList                 */
  600. #define TRAK_MEM    10L    /* Memory ptr/length            */
  601. #define TRAK_GENERIC    11L    /* Generic Element, your choice     */
  602. #define TRAK_DALIST    12L    /* DAlist ( aka file request )          */
  603. #define TRAK_ANCHOR    13L    /* Anchor chain (pattern matching)      */
  604. #define TRAK_FREQ    14L    /* FileRequest struct            */
  605. #define TRAK_FONT    15L    /* GfxBase CloseFont()                  */
  606. #define TRAK_MAX    15L    /* Poof, anything higher is tossed    */
  607.  
  608. #define TRB_UNLINK    7L    /* Free node bit            */
  609. #define TRB_RELOC    6L    /* This may be relocated (not used yet) */
  610. #define TRB_MOVED    5L    /* Item moved                */
  611.  
  612. #define TRF_UNLINK    (1L << TRB_UNLINK)
  613. #define TRF_RELOC    (1L << TRB_RELOC)
  614. #define TRF_MOVED    (1L << TRB_MOVED)
  615.  
  616. /*
  617.  ************************************************************************
  618.  * Note: ResList MUST be a DosAllocMem'ed list!, this is done for       *
  619.  * you when you call CreateTaskResList(), typically, you won't need     *
  620.  * to access/allocate this structure.                    *
  621.  ************************************************************************
  622.  */
  623. struct    ResList {
  624.     struct    MinNode     rl_Node;    /* Used by arplib to link reslists    */
  625.     struct    Task        *rl_TaskID;    /* Owner of this list            */
  626.     struct    MinList     rl_FirstItem;    /* List of Tracked Resources        */
  627.     struct    ResList     *rl_Link;    /* SyncRun's use - hide list here       */
  628.         };
  629.  
  630. /*
  631.  ************************************************************************
  632.  *    Returns from CompareLock()                                      *
  633.  ************************************************************************
  634.  */
  635. #define LCK_EQUAL    0L    /* The two locks refer to the same object    */
  636. #define LCK_VOLUME    1L    /* Locks are on the same volume         */
  637. #define LCK_DIFVOL1    2L    /* Locks are on different volumes        */
  638. #define LCK_DIFVOL2    3L    /* Locks are on different volumes        */
  639.  
  640. /*
  641.  ************************************************************************
  642.  *    ASyncRun() stuff...                                             *
  643.  ************************************************************************
  644.  * Message sent back on your request by an exiting process.        *
  645.  * You request this by putting the address of your message in        *
  646.  * pcb_LastGasp, and initializing the ReplyPort variable of your    *
  647.  * ZombieMsg to the port you wish the message posted to.        *
  648.  ************************************************************************
  649.  */
  650. struct    ZombieMsg    {
  651.         struct    Message     zm_ExecMessage;
  652.             ULONG        zm_TaskNum;    /* Task ID            */
  653.             LONG        zm_ReturnCode;    /* Process's return code        */
  654.             ULONG        zm_Result2;    /* System return code        */
  655.         struct    DateStamp    zm_ExitTime;    /* Date stamp at time of exit    */
  656.             ULONG        zm_UserInfo;    /* For whatever you wish    */
  657.             };
  658.  
  659. /*
  660.  ************************************************************************
  661.  * Structure required by ASyncRun() -- see docs for more info.          *
  662.  ************************************************************************
  663.  */
  664. struct    ProcessControlBlock    {
  665.                 ULONG        pcb_StackSize;    /* Stacksize for new process            */
  666.                 BYTE        pcb_Pri;    /* Priority of new task             */
  667.                 UBYTE        pcb_Control;    /* Control bits, see defines below        */
  668.                 APTR        pcb_TrapCode;    /* Optional Trap Code                */
  669.                 BPTR        pcb_Input;
  670.                 BPTR        pcb_Output;    /* Optional stdin, stdout            */
  671.                 union    {
  672.                     BPTR    pcb_SplatFile;    /* File to use for Open("*")                    */
  673.                     BYTE    *pcb_ConName;    /* CON: filename                */
  674.                     }    pcb_Console;
  675.                 CPTR        pcb_LoadedCode; /* If not null, will not load/unload code    */
  676.             struct    ZombieMsg    *pcb_LastGasp;    /* ReplyMsg() to be filled in by exit           */
  677.             struct    MsgPort     *pcb_WBProcess; /* Valid only when PRB_NOCLI            */
  678.                 };
  679.  
  680. /*
  681.  ************************************************************************
  682.  * Formerly needed to pass NULLCMD to a child.    No longer needed.    *
  683.  * It is being kept here for compatibility only...            *
  684.  ************************************************************************
  685.  */
  686. #define NOCMD    "\n"
  687.  
  688. /*
  689.  ************************************************************************
  690.  * The following control bits determine what ASyncRun() does on         *
  691.  * Abnormal Exits and on background process termination.        *
  692.  ************************************************************************
  693.  */
  694. #define PRB_SAVEIO    0L    /* Don't free/check file handles on exit        */
  695. #define PRB_CLOSESPLAT    1L    /* Close Splat file, must request explicitly    */
  696. #define PRB_NOCLI    2L    /* Don't create a CLI process                   */
  697. /*    PRB_INTERACTIVE 3L       This is now obsolete...            */
  698. #define PRB_CODE    4L    /* Dangerous yet enticing            */
  699. #define PRB_STDIO    5L    /* Do the stdio thing, splat = CON:Filename    */
  700.  
  701. #define PRF_SAVEIO    (1L << PRB_SAVEIO)
  702. #define PRF_CLOSESPLAT    (1L << PRB_CLOSESPLAT)
  703. #define PRF_NOCLI    (1L << PRB_NOCLI)
  704. #define PRF_CODE    (1L << PRB_CODE)
  705. #define PRF_STDIO    (1L << PRB_STDIO)
  706.  
  707. /*
  708.  ************************************************************************
  709.  *    Error returns from SyncRun() and ASyncRun()                     *
  710.  ************************************************************************
  711.  */
  712. #define PR_NOFILE    -1L    /* Could not LoadSeg() the file                 */
  713. #define PR_NOMEM    -2L    /* No memory for something            */
  714. /*    PR_NOCLI    -3L       This is now obsolete             */
  715. #define PR_NOSLOT    -4L    /* No room in TaskArray             */
  716. #define PR_NOINPUT    -5L    /* Could not open input file            */
  717. #define PR_NOOUTPUT    -6L    /* Could not get output file            */
  718. /*    PR_NOLOCK    -7L       This is now obsolete             */
  719. /*    PR_ARGERR    -8L       This is now obsolete             */
  720. /*    PR_NOBCPL    -9L       This is now obsolete             */
  721. /*    PR_BADLIB    -10L       This is now obsolete             */
  722. #define PR_NOSTDIO    -11L    /* Couldn't get stdio handles                   */
  723.  
  724. /*
  725.  ************************************************************************
  726.  *    Added V35 of arp.library                    *
  727.  ************************************************************************
  728.  */
  729. #define PR_WANTSMESSAGE -12L    /* Child wants you to report IoErr() to user    */
  730.                 /* for SyncRun() only...                        */
  731. #define PR_NOSHELLPROC    -13L    /* Can't create a shell/cli process             */
  732. #define PR_NOEXEC    -14L    /* 'E' bit is clear                             */
  733. #define PR_SCRIPT    -15L    /* S and E are set, IoErr() contains directory  */
  734.  
  735. /*
  736.  ************************************************************************
  737.  * Version 35 ASyncRun() allows you to create an independent            *
  738.  * interactive or background Shell/CLI. You need this variant of the    *
  739.  * pcb structure to do it, and you also have new values for nsh_Control,*
  740.  * see below.                                *
  741.  *                                    *
  742.  * Syntax for Interactive shell is:                    *
  743.  *                                    *
  744.  * rc=ASyncRun("Optional Window Name","Optional From File",&NewShell);  *
  745.  *                                    *
  746.  * Syntax for a background shell is:                    *
  747.  *                                    *
  748.  * rc=ASyncRun("Command line",0L,&NewShell);                            *
  749.  *                                    *
  750.  * Same syntax for an Execute style call, but you have to be on drugs    *
  751.  * if you want to do that.                        *
  752.  ************************************************************************
  753.  */
  754. struct    NewShell    {
  755.             ULONG    nsh_StackSize;    /* stacksize shell will use for children    */
  756.             BYTE    nsh_Pri;    /* ignored by interactive shells        */
  757.             UBYTE    nsh_Control;    /* bits/values: see above            */
  758.             CPTR    nsh_LogMsg;    /* Optional login message, if null, use default */
  759.             BPTR    nsh_Input;    /* ignored by interactive shells, but        */
  760.             BPTR    nsh_Output;    /* used by background and execute options.    */
  761.             LONG    nsh_RESERVED[5];
  762.             };
  763.  
  764. /*
  765.  ************************************************************************
  766.  * Bit Values for nsh_Control, you should use them as shown below, or    *
  767.  * just use the actual values indicated.                *
  768.  ************************************************************************
  769.  */
  770. #define PRB_CLI     0L    /* Do a CLI, not a shell    */
  771. #define PRB_BACKGROUND    1L    /* Background shell        */
  772. #define PRB_EXECUTE    2L    /* Do as EXECUTE...        */
  773. #define PRB_INTERACTIVE 3L    /* Run an interactive shell    */
  774. #define PRB_FB        7L    /* Alt function bit...        */
  775.  
  776. #define PRF_CLI     (1L << PRB_CLI)
  777. #define PRF_BACKGOUND    (1L << PRB_BACKGROUND)
  778. #define PRF_EXECUTE    (1L << PRB_EXECUTE)
  779. #define PRF_INTERACTIVE (1L << PRB_INTERACTIVE)
  780. #define PRF_FB        (1L << PRB_FB)
  781.  
  782. /*
  783.  ************************************************************************
  784.  *    Common values for sh_Control which allow you to do usefull    *
  785.  *    and somewhat "standard" things...                               *
  786.  ************************************************************************
  787.  */
  788. #define INTERACTIVE_SHELL    (PRF_FB|PRF_INTERACTIVE)                /* Gimme a newshell!            */
  789. #define INTERACTIVE_CLI     (PRF_FB|PRF_INTERACTIVE|PRF_CLI)        /* Gimme that ol newcli!        */
  790. #define BACKGROUND_SHELL    (PRF_FB|PRF_BACKGROUND)                 /* gimme a background shell     */
  791. #define EXECUTE_ME        (PRF_FB|PRF_BACKGROUND|PRF_EXECUTE)     /* aptly named, doncha think?   */
  792.  
  793. /*
  794.  ************************************************************************
  795.  *    Additional IoErr() returns added by ARP...                      *
  796.  ************************************************************************
  797.  */
  798. #define ERROR_BUFFER_OVERFLOW    303L    /* User or internal buffer overflow    */
  799. #define ERROR_BREAK        304L    /* A break character was received    */
  800. #define ERROR_NOT_EXECUTABLE    305L    /* A file has E bit cleared        */
  801. #define ERROR_NOT_CLI        400L    /* Program/function neeeds to be cli    */
  802.  
  803. /*
  804.  ************************************************************************
  805.  *    Resident Program Support                    *
  806.  ************************************************************************
  807.  * This is the kind of node allocated for you when you AddResidentPrg() *
  808.  * a code segment.  They are stored as a single linked list with the    *
  809.  * root in ArpBase.  If you absolutely *must* wander through this list    *
  810.  * instead of using the supplied functions, then you must first obtain    *
  811.  * the semaphore which protects this list, and then release it        *
  812.  * afterwards.    Do not use Forbid() and Permit() to gain exclusive      *
  813.  * access!  Note that the supplied functions handle this locking    *
  814.  * protocol for you.                            *
  815.  ************************************************************************
  816.  */
  817. struct    ResidentProgramNode    {
  818.             struct    ResidentProgramNode    *rpn_Next;    /* next or NULL         */
  819.                 LONG            rpn_Usage;    /* Number of current users    */
  820.                 UWORD            rpn_AccessCnt;    /* Total times used...        */
  821.                 ULONG            rpn_CheckSum;    /* Checksum of code        */
  822.                 BPTR            rpn_Segment;    /* Actual segment        */
  823.                 UWORD            rpn_Flags;    /* See definitions below...    */
  824.                 BYTE            rpn_Name[1];    /* Allocated as needed        */
  825.                 };
  826.  
  827. /*
  828.  ************************************************************************
  829.  *    Bit definitions for rpn_Flags....                *
  830.  ************************************************************************
  831.  */
  832. #define RPNB_NOCHECK    0L    /* Set in rpn_Flags for no checksumming...    */
  833. #define RPNB_CACHE    1L    /* Private usage in v1.3...            */
  834.  
  835. #define RPNF_NOCHECK    (1L << RPNB_NOCHECK)
  836. #define RPNF_CACHE    (1L << RPNB_CACHE)
  837.  
  838. /*
  839.  ************************************************************************
  840.  * If your program starts with this structure, ASyncRun() and SyncRun() *
  841.  * will override a users stack request with the value in rpt_StackSize. *
  842.  * Furthermore, if you are actually attached to the resident list, a    *
  843.  * memory block of size rpt_DataSize will be allocated for you, and    *
  844.  * a pointer to this data passed to you in register A4.  You may use    *
  845.  * this block to clone the data segment of programs, thus resulting in    *
  846.  * one copy of text, but multiple copies of data/bss for each process    *
  847.  * invocation.    If you are resident, your program will start at     *
  848.  * rpt_Instruction, otherwise, it will be launched from the initial    *
  849.  * branch.                                *
  850.  ************************************************************************
  851.  */
  852. struct    ResidentProgramTag    {
  853.                 BPTR    rpt_NextSeg;    /* Provided by DOS at LoadSeg time    */
  854. /*
  855.  ************************************************************************
  856.  * The initial branch destination and rpt_Instruction do not have to be *
  857.  * the same.  This allows different actions to be taken if you are    *
  858.  * diskloaded or resident.  DataSize memory will be allocated only if    *
  859.  * you are resident, but StackSize will override all user stack     *
  860.  * requests.                                *
  861.  ************************************************************************
  862.  */
  863.                 UWORD    rpt_BRA;    /* Short branch to executable        */
  864.                 UWORD    rpt_Magic;    /* Resident majik value         */
  865.                 ULONG    rpt_StackSize;    /* min stack for this process        */
  866.                 ULONG    rpt_DataSize;    /* Data size to allocate if resident    */
  867.                 /*    rpt_Instruction;    Start here if resident        */
  868.                 };
  869.  
  870. /*
  871.  ************************************************************************
  872.  * The form of the ARP allocated node in your tasks memlist when    *
  873.  * launched as a resident program. Note that the data portion of the    *
  874.  * node will only exist if you have specified a nonzero value for    *
  875.  * rpt_DataSize. Note also that this structure is READ ONLY, modify    *
  876.  * values in this at your own risk.  The stack stuff is for tracking,    *
  877.  * if you need actual addresses or stack size, check the normal places    *
  878.  * for it in your process/task struct.                    *
  879.  ************************************************************************
  880.  */
  881. struct    ProcessMemory    {
  882.         struct    Node    pm_Node;
  883.             UWORD    pm_Num;     /* This is 1 if no data, two if data    */
  884.             CPTR    pm_Stack;
  885.             ULONG    pm_StackSize;
  886.             CPTR    pm_Data;    /* Only here if pm_Num == 2        */
  887.             ULONG    pm_DataSize;
  888.             };
  889.  
  890. /*
  891.  ************************************************************************
  892.  * To find the above on your memlist, search for the following name.    *
  893.  * We guarantee this will be the only arp.library allocated node on    *
  894.  * your memlist with this name.                     *
  895.  * i.e. FindName(task->tcb_MemEntry, PMEM_NAME);                        *
  896.  ************************************************************************
  897.  */
  898. #define PMEM_NAME    "ARP_MEM"
  899.  
  900. #define RESIDENT_MAGIC    0x4AFC        /* same as RTC_MATCHWORD (trapf) */
  901.  
  902. /*
  903.  ************************************************************************
  904.  *    Date String/Data structures                    *
  905.  ************************************************************************
  906.  */
  907. struct    DateTime    {
  908.         struct    DateStamp    dat_Stamp;    /* DOS Datestamp            */
  909.             UBYTE        dat_Format;    /* controls appearance ot dat_StrDate    */
  910.             UBYTE        dat_Flags;    /* See BITDEF's below                   */
  911.             BYTE        *dat_StrDay;    /* day of the week string        */
  912.             BYTE        *dat_StrDate;    /* date string                */
  913.             BYTE        *dat_StrTime;    /* time string                */
  914.             };
  915.  
  916. /*
  917.  ************************************************************************
  918.  *    Size of buffer you need for each DateTime strings:        *
  919.  ************************************************************************
  920.  */
  921. #define LEN_DATSTRING    10L
  922.  
  923. /*
  924.  ************************************************************************
  925.  *    For dat_Flags                            *
  926.  ************************************************************************
  927.  */
  928. #define DTB_SUBST    0L    /* Substitute "Today" "Tomorrow" where appropriate      */
  929. #define DTB_FUTURE    1L    /* Day of the week is in future             */
  930.  
  931. #define DTF_SUBST    (1L << DTB_SUBST)
  932. #define DTF_FUTURE    (1L << DTB_FUTURE)
  933.  
  934. /*
  935.  ************************************************************************
  936.  *    For dat_Format                            *
  937.  ************************************************************************
  938.  */
  939. #define FORMAT_DOS    0L        /* dd-mmm-yy AmigaDOS's own, unique style               */
  940. #define FORMAT_INT    1L        /* yy-mm-dd International format            */
  941. #define FORMAT_USA    2L        /* mm-dd-yy The good'ol'USA.                            */
  942. #define FORMAT_CDN    3L        /* dd-mm-yy Our brothers and sisters to the north    */
  943. #define FORMAT_MAX    FORMAT_CDN    /* Larger than this? Defaults to AmigaDOS        */
  944.  
  945. /*
  946.  ************************************************************************
  947.  * Define NO_PROTOTYPES if your compiler does not handle them...    *
  948.  ************************************************************************
  949.  */
  950. #ifdef    NO_PROTOTYPES
  951. #define ARGs(x) ()
  952. #else
  953. #define ARGs(x) x
  954. #endif
  955.  
  956. /*
  957.  ************************************************************************
  958.  * Note that C_Args is a #define that, in LATTICE does __stdargs    *
  959.  ************************************************************************
  960.  */
  961.  
  962. /*
  963.  ************************************************************************
  964.  * This prototype is here to prevent the possible error in defining    *
  965.  * IoErr() as LONG and thus causing LastTracker to give you trash...    *
  966.  *                                    *
  967.  * N O T E !  You MUST! have IoErr() defined as LONG to use LastTracker *
  968.  *          If your compiler has other defines for this, you may wish *
  969.  *          to move the prototype for IoErr() into the DO_ARP_COPIES  *
  970.  ************************************************************************
  971.  */
  972.     LONG            IoErr            ARGs(   (VOID)                                                  );
  973.  
  974. /*
  975.  ************************************************************************
  976.  *    These duplicate the calls in dos.library            *
  977.  *    Only include if you can use arp.library without dos.library    *
  978.  ************************************************************************
  979.  */
  980. #ifdef    DO_ARP_COPIES
  981.     BPTR            Open            ARGs(   (char *, LONG)                                          );
  982.     VOID            Close            ARGs(   (BPTR)                                                  );
  983.     LONG            Read            ARGs(   (BPTR, char *, LONG)                                    );
  984.     LONG            Write            ARGs(   (BPTR, char *, LONG)                                    );
  985.     BPTR            Input            ARGs(   (VOID)                                                  );
  986.     BPTR            Output            ARGs(   (VOID)                                                  );
  987.     LONG            Seek            ARGs(   (BPTR, LONG, LONG)                                      );
  988.     LONG            DeleteFile        ARGs(   (char *)                                                );
  989.     LONG            Rename            ARGs(   (char *, char *)                                        );
  990.     BPTR            Lock            ARGs(   (char *, LONG)                                          );
  991.     VOID            UnLock            ARGs(   (BPTR)                                                  );
  992.     BPTR            DupLock         ARGs(   (BPTR)                                                  );
  993.     LONG            Examine         ARGs(   (BPTR, struct FileInfoBlock *)                          );
  994.     LONG            ExNext            ARGs(   (BPTR, struct FileInfoBlock *)                          );
  995.     LONG            Info            ARGs(   (BPTR, struct InfoData *)                               );
  996.     BPTR            CreateDir        ARGs(   (char *)                                                );
  997.     BPTR            CurrentDir        ARGs(   (BPTR)                                                  );
  998. struct    MsgPort         *CreateProc        ARGs(   (char *, LONG, BPTR, LONG)                              );
  999.     VOID            Exit            ARGs(   (LONG)                                                  );
  1000.     BPTR            LoadSeg         ARGs(   (char *)                                                );
  1001.     VOID            UnLoadSeg        ARGs(   (BPTR)                                                  );
  1002. struct    MsgPort         *DeviceProc        ARGs(   (char *)                                                );
  1003.     LONG            SetComment        ARGs(   (char *, char *)                                        );
  1004.     LONG            SetProtection        ARGs(   (char *, LONG)                                          );
  1005.     LONG            *DateStamp        ARGs(   (LONG *)                                                );
  1006.     VOID            Delay            ARGs(   (LONG)                                                  );
  1007.     LONG            WaitForChar        ARGs(   (BPTR, LONG)                                            );
  1008.     BPTR            ParentDir        ARGs(   (BPTR)                                                  );
  1009.     LONG            IsInteractive        ARGs(   (BPTR)                                                  );
  1010.     LONG            Execute         ARGs(   (char *, BPTR, BPTR)                                    );
  1011. #endif    DO_ARP_COPIES
  1012.  
  1013. /*
  1014.  ************************************************************************
  1015.  *    Now for the stuff that only exists in arp.library...        *
  1016.  ************************************************************************
  1017.  */
  1018.     LONG        C_Args    Printf            ARGs(   (char *,)                                               );
  1019.     LONG        C_Args    FPrintf         ARGs(   (BPTR, char *,)                                         );
  1020.     LONG            Puts            ARGs(   (char *)                                                );
  1021.     LONG            Readline        ARGs(   (char *)                                                );
  1022.     LONG            GADS            ARGs(   (char *, LONG, char *, char **, char *)                 );
  1023.     LONG            Atol            ARGs(   (char *)                                                );
  1024.     ULONG            EscapeString        ARGs(   (char *)                                                );
  1025.     LONG            CheckAbort        ARGs(   (VOID(*))                                               );
  1026.     LONG            CheckBreak        ARGs(   (LONG, VOID(*))                                         );
  1027.     BYTE            *Getenv         ARGs(   (char *, char *, LONG)                                  );
  1028.     BOOL            Setenv            ARGs(   (char *, char *)                                        );
  1029.     BYTE            *FileRequest        ARGs(   (struct FileRequester *)                                );
  1030.     VOID            CloseWindowSafely    ARGs(   (struct Window *, LONG)                                 );
  1031. struct    MsgPort         *CreatePort        ARGs(   (char *, LONG)                                          );
  1032.     VOID            DeletePort        ARGs(   (struct MsgPort *)                                      );
  1033.     LONG            SendPacket        ARGs(   (LONG, LONG *, struct MsgPort *)                        );
  1034.     VOID            InitStdPacket        ARGs(   (LONG, LONG *, struct DosPacket *, struct MsgPort *)    );
  1035.     ULONG            PathName        ARGs(   (BPTR, char *,LONG)                                     );
  1036.     ULONG            Assign            ARGs(   (char *, char *)                                        );
  1037.     VOID            *DosAllocMem        ARGs(   (LONG)                                                  );
  1038.     VOID            DosFreeMem        ARGs(   (VOID *)                                                );
  1039.     ULONG            BtoCStr         ARGs(   (char *, BSTR, LONG)                                    );
  1040.     ULONG            CtoBStr         ARGs(   (char *, BSTR, LONG)                                    );
  1041. struct    DeviceList        *GetDevInfo        ARGs(   (struct DeviceList *)                                   );
  1042.     BOOL            FreeTaskResList     ARGs(   (VOID)                                                  );
  1043.     VOID            ArpExit         ARGs(   (LONG,LONG)                                             );
  1044.     VOID        C_Args    *ArpAlloc        ARGs(   (LONG)                                                  );
  1045.     VOID        C_Args    *ArpAllocMem        ARGs(   (LONG, LONG)                                            );
  1046.     BPTR        C_Args    ArpOpen         ARGs(   (char *, LONG)                                          );
  1047.     BPTR        C_Args    ArpDupLock        ARGs(   (BPTR)                                                  );
  1048.     BPTR        C_Args    ArpLock         ARGs(   (char *, LONG)                                          );
  1049.     VOID        C_Args    *RListAlloc        ARGs(   (struct ResList *, LONG)                                );
  1050. struct    Process         *FindCLI        ARGs(   (LONG)                                                  );
  1051.     BOOL            QSort            ARGs(   (VOID *, LONG, LONG, int(*))                            );
  1052.     BOOL            PatternMatch        ARGs(   (char *,char *)                                         );
  1053.     LONG            FindFirst        ARGs(   (char *, struct AnchorPath *)                           );
  1054.     LONG            FindNext        ARGs(   (struct AnchorPath *)                                   );
  1055.     VOID            FreeAnchorChain     ARGs(   (struct AnchorPath *)                                   );
  1056.     ULONG            CompareLock        ARGs(   (BPTR, BPTR)                                            );
  1057. struct    ResList         *FindTaskResList    ARGs(   (VOID)                                                  );
  1058. struct    ResList         *CreateTaskResList    ARGs(   (VOID)                                                  );
  1059.     VOID            FreeResList        ARGs(   (struct ResList *)                                      );
  1060.     VOID            FreeTrackedItem     ARGs(   (struct DefaultTracker *)                               );
  1061. struct    DefaultTracker    C_Args    *GetTracker        ARGs(   (LONG)                                                  );
  1062.     VOID            *GetAccess        ARGs(   (struct DefaultTracker *)                               );
  1063.     VOID            FreeAccess        ARGs(   (struct DefaultTracker *)                               );
  1064.     VOID            FreeDAList        ARGs(   (struct DirectoryEntry *)                               );
  1065. struct    DirectoryEntry        *AddDANode        ARGs(   (char *, struct DirectoryEntry **, LONG, LONG)          );
  1066.     ULONG            AddDADevs        ARGs(   (struct DirectoryEntry **, LONG)                        );
  1067.     LONG            Strcmp            ARGs(   (char *, char *)                                        );
  1068.     LONG            Strncmp         ARGs(   (char *, char *, LONG)                                  );
  1069.     BYTE            Toupper         ARGs(   (BYTE)                                                  );
  1070.     LONG            SyncRun         ARGs(   (char *, char *, BPTR, BPTR)                            );
  1071.  
  1072. /*
  1073.  ************************************************************************
  1074.  *    Added V32 of arp.library                    *
  1075.  ************************************************************************
  1076.  */
  1077.     LONG            ASyncRun        ARGs(   (char *, char *, struct ProcessControlBlock *)          );
  1078.     LONG            SpawnShell        ARGs(   (char *, char *, struct NewShell *)                     );
  1079.     BPTR            LoadPrg         ARGs(   (char *)                                                );
  1080.     BOOL            PreParse        ARGs(   (char *, char *)                                        );
  1081.  
  1082. /*
  1083.  ************************************************************************
  1084.  *    Added V33 of arp.library                    *
  1085.  ************************************************************************
  1086.  */
  1087.     BOOL            StamptoStr        ARGs(   (struct DateTime *)                                     );
  1088.     BOOL            StrtoStamp        ARGs(   (struct DateTime *)                                     );
  1089. struct    ResidentProgramNode    *ObtainResidentPrg    ARGs(   (char *)                                                );
  1090. struct    ResidentProgramNode    *AddResidentPrg     ARGs(   (BPTR, char *)                                          );
  1091.     LONG            RemResidentPrg        ARGs(   (char *)                                                );
  1092.     VOID            UnLoadPrg        ARGs(   (BPTR)                                                  );
  1093.     LONG            LMult            ARGs(   (LONG, LONG)                                            );
  1094.     LONG            LDiv            ARGs(   (LONG, LONG)                                            );
  1095.     LONG            LMod            ARGs(   (LONG, LONG)                                            );
  1096.     ULONG            CheckSumPrg        ARGs(   (struct ResidentProgramNode *)                          );
  1097.     VOID            TackOn            ARGs(   (char *, char *)                                        );
  1098.     BYTE            *BaseName        ARGs(   (char *)                                                );
  1099. struct    ResidentProgramNode    *ReleaseResidentPrg    ARGs(   (BPTR)                                                  );
  1100.  
  1101. /*
  1102.  ************************************************************************
  1103.  *    Added V36 of arp.library                    *
  1104.  ************************************************************************
  1105.  */
  1106.     LONG        C_Args    SPrintf         ARGs(   (char *, char *,)                                       );
  1107.     LONG            GetKeywordIndex     ARGs(   (char *, char *)                                        );
  1108. struct    Library     C_Args    *ArpOpenLibrary     ARGs(   (char *, LONG)                                          );
  1109. struct    FileRequester    C_Args    *ArpAllocFreq        ARGs(   (VOID)                                                  );
  1110.  
  1111. /*
  1112.  ************************************************************************
  1113.  *    Check if we should do the pragmas...                *
  1114.  ************************************************************************
  1115.  */
  1116. #ifndef NO_PRAGMAS
  1117.  
  1118. /*
  1119. #ifndef PROTO_ARP_H
  1120. #include    <Proto/ARP.h>
  1121. #endif    PROTO_ARP_H
  1122. */
  1123.  
  1124. #endif    NO_PRAGMAS
  1125.  
  1126. #endif    LIBRARIES_ARPBASE_H
  1127.