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