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