home *** CD-ROM | disk | FTP | other *** search
/ Club Amiga de Montreal - CAM / CAM_CD_1.iso / files / 402.lha / IconTools / arp / ArpBase.j.ab < prev   
Text File  |  1990-07-27  |  20KB  |  346 lines

  1. 3   constant PRB_INTERACTIVE (  Run an interactive shell     )
  2. 7   constant PRB_FB (  Alt function bit...           )
  3.  
  4. 1  PRB_CLI <<  constant PRF_CLI
  5. 1  PRB_BACKGROUND <<  constant PRF_BACKGROUND
  6. 1  PRB_EXECUTE <<  constant PRF_EXECUTE
  7. 1  PRB_INTERACTIVE <<  constant PRF_INTERACTIVE
  8. 1  PRB_FB <<  constant PRF_FB
  9.  
  10. ( )
  11. (  ************************************************************************)
  12. (  *    Common values for sh_Control which allow you to do usefull      *)
  13. (  *    and somewhat "standard" things...                               *)
  14. (  ************************************************************************)
  15. (  )
  16. PRF_FB    PRF_INTERACTIVE |  constant INTERACTIVE_SHELL (  Gimme a newshell!              )
  17. PRF_FB    PRF_INTERACTIVE | PRF_CLI |  constant INTERACTIVE_CLI (  Gimme that ol newcli!  )
  18. PRF_FB    PRF_BACKGROUND |  constant BACKGROUND_SHELL (  gimme a background shell )
  19. PRF_FB    PRF_BACKGROUND | PRF_EXECUTE |    constant EXECUTE_ME (  aptly named, doncha think?       )
  20.  
  21. ( )
  22. (  ************************************************************************)
  23. (  *    Additional IoErr[] returns added by ARP...                      *)
  24. (  ************************************************************************)
  25. (  )
  26. 303   constant ERROR_BUFFER_OVERFLOW (  User or internal buffer overflow     )
  27. 304   constant ERROR_BREAK (  A break character was received )
  28. 305   constant ERROR_NOT_EXECUTABLE (  A file has E bit cleared              )
  29. 400   constant ERROR_NOT_CLI (  Program/function neeeds to be cli    )
  30.  
  31. ( )
  32. (  ************************************************************************)
  33. (  *    Resident Program Support                                        *)
  34. (  ************************************************************************)
  35. (  * This is the kind of node allocated for you when you AddResidentPrg[]       *)
  36. (  * a code segment.  They are stored as a single linked list with the  *)
  37. (  * root in ArpBase.  If you absolutely *must* wander through this list        *)
  38. (  * instead of using the supplied functions, then you must first obtain        *)
  39. (  * the semaphore which protects this list, and then release it                *)
  40. (  * afterwards.  Do not use Forbid[] and Permit[] to gain exclusive    *)
  41. (  * access!  Note that the supplied functions handle this locking      *)
  42. (  * protocol for you.                                                  *)
  43. (  ************************************************************************)
  44. (  )
  45.  
  46. :STRUCT ResidentProgramNode
  47.               APTR rpn_Next (  next or NULL                 )
  48.                   LONG rpn_Usage    (  Number of current users      )
  49.                   USHORT rpn_AccessCnt    (  Total times used...          )
  50.                   ULONG rpn_CheckSum    (  Checksum of code             )
  51.                   LONG rpn_Segment    (  Actual segment               )
  52.                   USHORT rpn_Flags    (  See definitions below...     )
  53.                 ( %?)   1 BYTES rpn_Name        (  Allocated as needed          )
  54.                 ;STRUCT
  55.  
  56.  
  57. ( )
  58. (  ************************************************************************)
  59. (  *    Bit definitions for rpn_Flags....                               *)
  60. (  ************************************************************************)
  61. (  )
  62. 0   constant RPNB_NOCHECK (  Set in rpn_Flags for no checksumming... )
  63. 1   constant RPNB_CACHE (  Private usage in v1.3...                  )
  64.  
  65. 1  RPNB_NOCHECK <<  constant RPNF_NOCHECK
  66. 1  RPNB_CACHE <<  constant RPNF_CACHE
  67.  
  68. ( )
  69. (  ************************************************************************)
  70. (  * If your program starts with this structure, ASyncRun[] and SyncRun[]       *)
  71. (  * will override a users stack request with the value in rpt_StackSize.       *)
  72. (  * Furthermore, if you are actually attached to the resident list, a  *)
  73. (  * memory block of size rpt_DataSize will be allocated for you, and   *)
  74. (  * a pointer to this data passed to you in register A4.  You may use  *)
  75. (  * this block to clone the data segment of programs, thus resulting in        *)
  76. (  * one copy of text, but multiple copies of data/bss for each process *)
  77. (  * invocation.  If you are resident, your program will start at               *)
  78. (  * rpt_Instruction, otherwise, it will be launched from the initial   *)
  79. (  * branch.                                                            *)
  80. (  ************************************************************************)
  81. (  )
  82.  
  83. :STRUCT ResidentProgramTag
  84.                   LONG rpt_NextSeg    (  Provided by DOS at LoadSeg time      )
  85. ( )
  86. (  ************************************************************************)
  87. (  * The initial branch destination and rpt_Instruction do not have to be       *)
  88. (  * the same.  This allows different actions to be taken if you are    *)
  89. (  * diskloaded or resident.  DataSize memory will be allocated only if *)
  90. (  * you are resident, but StackSize will override all user stack               *)
  91. (  * requests.                                                          *)
  92. (  ************************************************************************)
  93. (  )
  94.                   USHORT rpt_BRA    (  Short branch to executable           )
  95.                   USHORT rpt_Magic    (  Resident majik value                 )
  96.                   ULONG rpt_StackSize    (  min stack for this process           )
  97.                   ULONG rpt_DataSize    (  Data size to allocate if resident    )
  98.                 (       rpt_Instruction;        Start here if resident          )
  99.                 ;STRUCT
  100.  
  101.  
  102. ( )
  103. (  ************************************************************************)
  104. (  * The form of the ARP allocated node in your tasks memlist when      *)
  105. (  * launched as a resident program. Note that the data portion of the  *)
  106. (  * node will only exist if you have specified a nonzero value for     *)
  107. (  * rpt_DataSize. Note also that this structure is READ ONLY, modify   *)
  108. (  * values in this at your own risk.  The stack stuff is for tracking, *)
  109. (  * if you need actual addresses or stack size, check the normal places        *)
  110. (  * for it in your process/task struct.                                        *)
  111. (  ************************************************************************)
  112. (  )
  113.  
  114. :STRUCT ProcessMemory
  115.           STRUCT Node    pm_Node
  116.               USHORT pm_Num     (  This is 1 if no data, two if data    )
  117. \ %? correct below? -RM CPTR    pm_Stack;
  118.               APTR    pm_Stack
  119.               ULONG pm_StackSize
  120. \ %? correct below? -RM CPTR    pm_Data;    /* Only here if pm_Num == 2        */
  121.               APTR    pm_Data     (  Only here if pm_Num == 2             )
  122.               ULONG pm_DataSize
  123.             ;STRUCT
  124.  
  125.  
  126. ( )
  127. (  ************************************************************************)
  128. (  * To find the above on your memlist, search for the following name.  *)
  129. (  * We guarantee this will be the only arp.library allocated node on   *)
  130. (  * your memlist with this name.                                               *)
  131. (  * i.e. FindName[task->tcb_MemEntry, PMEM_NAME];                      *)
  132. (  ************************************************************************)
  133. (  )
  134. 0" ARP_MEM"  0string PMEM_NAME
  135.  
  136. $ 4AFC     constant RESIDENT_MAGIC (  same as RTC_MATCHWORD [trapf] )
  137.  
  138. ( )
  139. (  ************************************************************************)
  140. (  *    Date String/Data structures                                     *)
  141. (  ************************************************************************)
  142. (  )
  143.  
  144. :STRUCT DateTime
  145.           STRUCT DateStamp    dat_Stamp    (  DOS Datestamp                        )
  146.               UBYTE dat_Format    (  controls appearance ot dat_StrDate   )
  147.               UBYTE dat_Flags    (  See BITDEF's below                   )
  148.               APTR dat_StrDay    (  day of the week string               )
  149.               APTR dat_StrDate    (  date string                          )
  150.               APTR dat_StrTime    (  time string                          )
  151.             ;STRUCT
  152.  
  153.  
  154. ( )
  155. (  ************************************************************************)
  156. (  *    Size of buffer you need for each DateTime strings:              *)
  157. (  ************************************************************************)
  158. (  )
  159. 10   constant LEN_DATSTRING
  160.  
  161. ( )
  162. (  ************************************************************************)
  163. (  *    For dat_Flags                                                   *)
  164. (  ************************************************************************)
  165. (  )
  166. 0   constant DTB_SUBST (  Substitute "Today" "Tomorrow" where appropriate    )
  167. 1   constant DTB_FUTURE (  Day of the week is in future                              )
  168.  
  169. 1  DTB_SUBST <<  constant DTF_SUBST
  170. 1  DTB_FUTURE <<  constant DTF_FUTURE
  171.  
  172. ( )
  173. (  ************************************************************************)
  174. (  *    For dat_Format                                                  *)
  175. (  ************************************************************************)
  176. (  )
  177. 0   constant FORMAT_DOS (  dd-mmm-yy AmigaDOS's own, unique style            )
  178. 1   constant FORMAT_INT (  yy-mm-dd International format                     )
  179. 2   constant FORMAT_USA (  mm-dd-yy The good'ol'USA.                         )
  180. 3   constant FORMAT_CDN (  dd-mm-yy Our brothers and sisters to the north    )
  181. FORMAT_CDN   constant FORMAT_MAX (  Larger than this? Defaults to AmigaDOS              )
  182.  
  183. ( )
  184. (  ************************************************************************)
  185. (  * This prototype is here to prevent the possible error in defining   *)
  186. (  * IoErr[] as LONG and thus causing LastTracker to give you trash...  *)
  187. (  *                                                                    *)
  188. (  * N O T E !  You MUST! have IoErr[] defined as LONG to use LastTracker *)
  189. (  *          If your compiler has other defines for this, you may wish *)
  190. (  *          to move the prototype for IoErr[] into the DO_ARP_COPIES  *)
  191. (  ************************************************************************)
  192. (  )
  193. \ %?    LONG            IoErr            ARGs(   (VOID)                                                  );
  194.  
  195. \ %? /*
  196.  
  197. \ %?  * These duplicate the calls in dos.library            *
  198. \ %?  * Only include if you can use arp.library without dos.library    *
  199.  
  200. \ %?  */
  201. \ %? #ifdef    DO_ARP_COPIES
  202. \ %?    BPTR            Open            ARGs(   (char *, LONG)                                          );
  203. \ %?    VOID            Close            ARGs(   (BPTR)                                                  );
  204. \ %?    LONG            Read            ARGs(   (BPTR, char *, LONG)                                    );
  205. \ %?    LONG            Write            ARGs(   (BPTR, char *, LONG)                                    );
  206. \ %?    BPTR            Input            ARGs(   (VOID)                                                  );
  207. \ %?    BPTR            Output            ARGs(   (VOID)                                                  );
  208. \ %?    LONG            Seek            ARGs(   (BPTR, LONG, LONG)                                      );
  209. \ %?    LONG            DeleteFile        ARGs(   (char *)                                                );
  210. \ %?    LONG            Rename            ARGs(   (char *, char *)                                        );
  211. \ %?    BPTR            Lock            ARGs(   (char *, LONG)                                          );
  212. \ %?    VOID            UnLock            ARGs(   (BPTR)                                                  );
  213. \ %?    BPTR            DupLock         ARGs(   (BPTR)                                                  );
  214. \ %?    LONG            Examine         ARGs(   (BPTR, struct FileInfoBlock *)                          );
  215. \ %?    LONG            ExNext            ARGs(   (BPTR, struct FileInfoBlock *)                          );
  216. \ %?    LONG            Info            ARGs(   (BPTR, struct InfoData *)                               );
  217. \ %?    BPTR            CreateDir        ARGs(   (char *)                                                );
  218. \ %?    BPTR            CurrentDir        ARGs(   (BPTR)                                                  );
  219. \ %? struct    MsgPort         *CreateProc        ARGs(   (char *, LONG, BPTR, LONG)                              );
  220. \ %?    VOID            Exit            ARGs(   (LONG)                                                  );
  221. \ %?    BPTR            LoadSeg         ARGs(   (char *)                                                );
  222. \ %?    VOID            UnLoadSeg        ARGs(   (BPTR)                                                  );
  223. \ %? struct    MsgPort         *DeviceProc        ARGs(   (char *)                                                );
  224. \ %?    LONG            SetComment        ARGs(   (char *, char *)                                        );
  225. \ %?    LONG            SetProtection        ARGs(   (char *, LONG)                                          );
  226. \ %?    LONG            *DateStamp        ARGs(   (LONG *)                                                );
  227. \ %?    VOID            Delay            ARGs(   (LONG)                                                  );
  228. \ %?    LONG            WaitForChar        ARGs(   (BPTR, LONG)                                            );
  229. \ %?    BPTR            ParentDir        ARGs(   (BPTR)                                                  );
  230. \ %?    LONG            IsInteractive        ARGs(   (BPTR)                                                  );
  231. \ %?    LONG            Execute         ARGs(   (char *, BPTR, BPTR)                                    );
  232. \ %? #endif    DO_ARP_COPIES
  233.  
  234. \ %? /*
  235.  
  236. \ %?  * Now for the stuff that only exists in arp.library...        *
  237.  
  238. \ %?  */
  239. \ %?    LONG        C_Args    Printf            ARGs(   (char *,)                                               );
  240. \ %?    LONG        C_Args    FPrintf         ARGs(   (BPTR, char *,)                                         );
  241. \ %?    LONG            Puts            ARGs(   (char *)                                                );
  242. \ %?    LONG            Readline        ARGs(   (char *)                                                );
  243. \ %?    LONG            GADS            ARGs(   (char *, LONG, char *, char **, char *)                 );
  244. \ %?    LONG            Atol            ARGs(   (char *)                                                );
  245. \ %?    ULONG            EscapeString        ARGs(   (char *)                                                );
  246. \ %?    LONG            CheckAbort        ARGs(   (VOID(*))                                               );
  247. \ %?    LONG            CheckBreak        ARGs(   (LONG, VOID(*))                                         );
  248. \ %?    BYTE            *Getenv         ARGs(   (char *, char *, LONG)                                  );
  249. \ %?    BOOL            Setenv            ARGs(   (char *, char *)                                        );
  250. \ %?    BYTE            *FileRequest        ARGs(   (struct FileRequester *)                                );
  251. \ %?    VOID            CloseWindowSafely    ARGs(   (struct Window *, LONG)                                 );
  252. \ %? struct    MsgPort         *CreatePort        ARGs(   (char *, LONG)                                          );
  253. \ %?    VOID            DeletePort        ARGs(   (struct MsgPort *)                                      );
  254. \ %?    LONG            SendPacket        ARGs(   (LONG, LONG *, struct MsgPort *)                        );
  255. \ %?    VOID            InitStdPacket        ARGs(   (LONG, LONG *, struct DosPacket *, struct MsgPort *)    );
  256. \ %?    ULONG            PathName        ARGs(   (BPTR, char *,LONG)                                     );
  257. \ %?    ULONG            Assign            ARGs(   (char *, char *)                                        );
  258. \ %?    VOID            *DosAllocMem        ARGs(   (LONG)                                                  );
  259. \ %?    VOID            DosFreeMem        ARGs(   (VOID *)                                                );
  260. \ %?    ULONG            BtoCStr         ARGs(   (char *, BSTR, LONG)                                    );
  261. \ %?    ULONG            CtoBStr         ARGs(   (char *, BSTR, LONG)                                    );
  262. \ %? struct    DeviceList        *GetDevInfo        ARGs(   (struct DeviceList *)                                   );
  263. \ %?    BOOL            FreeTaskResList     ARGs(   (VOID)                                                  );
  264. \ %?    VOID            ArpExit         ARGs(   (LONG,LONG)                                             );
  265. \ %?    VOID        C_Args    *ArpAlloc        ARGs(   (LONG)                                                  );
  266. \ %?    VOID        C_Args    *ArpAllocMem        ARGs(   (LONG, LONG)                                            );
  267. \ %?    BPTR        C_Args    ArpOpen         ARGs(   (char *, LONG)                                          );
  268. \ %?    BPTR        C_Args    ArpDupLock        ARGs(   (BPTR)                                                  );
  269. \ %?    BPTR        C_Args    ArpLock         ARGs(   (char *, LONG)                                          );
  270. \ %?    VOID        C_Args    *RListAlloc        ARGs(   (struct ResList *, LONG)                                );
  271. \ %? struct    Process         *FindCLI        ARGs(   (LONG)                                                  );
  272. \ %?    BOOL            QSort            ARGs(   (VOID *, LONG, LONG, int(*))                            );
  273. \ %?    BOOL            PatternMatch        ARGs(   (char *,char *)                                         );
  274. \ %?    LONG            FindFirst        ARGs(   (char *, struct AnchorPath *)                           );
  275. \ %?    LONG            FindNext        ARGs(   (struct AnchorPath *)                                   );
  276. \ %?    VOID            FreeAnchorChain     ARGs(   (struct AnchorPath *)                                   );
  277. \ %?    ULONG            CompareLock        ARGs(   (BPTR, BPTR)                                            );
  278. \ %? struct    ResList         *FindTaskResList    ARGs(   (VOID)                                                  );
  279. \ %? struct    ResList         *CreateTaskResList    ARGs(   (VOID)                                                  );
  280. \ %?    VOID            FreeResList        ARGs(   (struct ResList *)                                      );
  281. \ %?    VOID            FreeTrackedItem     ARGs(   (struct DefaultTracker *)                               );
  282. \ %? struct    DefaultTracker    C_Args    *GetTracker        ARGs(   (LONG)                                                  );
  283. \ %?    VOID            *GetAccess        ARGs(   (struct DefaultTracker *)                               );
  284. \ %?    VOID            FreeAccess        ARGs(   (struct DefaultTracker *)                               );
  285. \ %?    VOID            FreeDAList        ARGs(   (struct DirectoryEntry *)                               );
  286. \ %? struct    DirectoryEntry        *AddDANode        ARGs(   (char *, struct DirectoryEntry **, LONG, LONG)          );
  287. \ %?    ULONG            AddDADevs        ARGs(   (struct DirectoryEntry **, LONG)                        );
  288. \ %?    LONG            Strcmp            ARGs(   (char *, char *)                                        );
  289. \ %?    LONG            Strncmp         ARGs(   (char *, char *, LONG)                                  );
  290. \ %?    BYTE            Toupper         ARGs(   (BYTE)                                                  );
  291. \ %?    LONG            SyncRun         ARGs(   (char *, char *, BPTR, BPTR)                            );
  292.  
  293. \ %? /*
  294.  
  295. \ %?  * Added V32 of arp.library                    *
  296.  
  297. \ %?  */
  298. \ %?    LONG            ASyncRun        ARGs(   (char *, char *, struct ProcessControlBlock *)          );
  299. \ %?    LONG            SpawnShell        ARGs(   (char *, char *, struct NewShell *)                     );
  300. \ %?    BPTR            LoadPrg         ARGs(   (char *)                                                );
  301. \ %?    BOOL            PreParse        ARGs(   (char *, char *)                                        );
  302.  
  303. \ %? /*
  304.  
  305. \ %?  * Added V33 of arp.library                    *
  306.  
  307. \ %?  */
  308. \ %?    BOOL            StamptoStr        ARGs(   (struct DateTime *)                                     );
  309. \ %?    BOOL            StrtoStamp        ARGs(   (struct DateTime *)                                     );
  310. \ %? struct    ResidentProgramNode    *ObtainResidentPrg    ARGs(   (char *)                                                );
  311. \ %? struct    ResidentProgramNode    *AddResidentPrg     ARGs(   (BPTR, char *)                                          );
  312. \ %?    LONG            RemResidentPrg        ARGs(   (char *)                                                );
  313. \ %?    VOID            UnLoadPrg        ARGs(   (BPTR)                                                  );
  314. \ %?    LONG            LMult            ARGs(   (LONG, LONG)                                            );
  315. \ %?    LONG            LDiv            ARGs(   (LONG, LONG)                                            );
  316. \ %?    LONG            LMod            ARGs(   (LONG, LONG)                                            );
  317. \ %?    ULONG            CheckSumPrg        ARGs(   (struct ResidentProgramNode *)                          );
  318. \ %?    VOID            TackOn            ARGs(   (char *, char *)                                        );
  319. \ %?    BYTE            *BaseName        ARGs(   (char *)                                                );
  320. \ %? struct    ResidentProgramNode    *ReleaseResidentPrg    ARGs(   (BPTR)                                                  );
  321.  
  322. \ %? /*
  323.  
  324. \ %?  * Added V36 of arp.library                    *
  325.  
  326. \ %?  */
  327. \ %?    LONG        C_Args    SPrintf         ARGs(   (char *, char *,)                                       );
  328. \ %?    LONG            GetKeywordIndex     ARGs(   (char *, char *)                                        );
  329. \ %? struct    Library     C_Args    *ArpOpenLibrary     ARGs(   (char *, LONG)                                          );
  330. \ %? struct    FileRequester    C_Args    *ArpAllocFreq        ARGs(   (VOID)                                                  );
  331.  
  332. \ %? /*
  333.  
  334. \ %?  * Check if we should do the pragmas...                *
  335.  
  336. \ %?  */
  337. \ %? #ifndef    NO_PRAGMAS
  338.  
  339. \ %? #ifndef    PROTO_ARP_H
  340. \ %? #include    <Proto/ARP.h>
  341. \ %? #endif    PROTO_ARP_H
  342.  
  343. \ %? #endif    NO_PRAGMAS
  344.  
  345. \ %? #endif    LIBRARIES_ARPBASE_H
  346.