home *** CD-ROM | disk | FTP | other *** search
/ Amiga ISO Collection / AmigaUtilCD2.iso / Programming / Misc / OB3.2D3.DMS / in.adf / Interfaces / Dos.mod < prev    next >
Encoding:
Text File  |  1993-05-23  |  85.0 KB  |  1,937 lines

  1. (*-------------------------------------------------------------------------*)
  2. (*                                                                         *)
  3. (*  Amiga Oberon Interface Module:                    Date: 21-May-93      *)
  4. (*                                                                         *)
  5. (*   © 1992 by Fridtjof Siebert                                            *)
  6. (*   updated for V39 by hartmut Goebel                                     *)
  7. (*                                                                         *)
  8. (*-------------------------------------------------------------------------*)
  9.  
  10. MODULE Dos;
  11.  
  12. IMPORT e * := Exec,
  13.        t * := Timer,
  14.        u * := Utility,
  15.        sys := SYSTEM;
  16.  
  17.  
  18. CONST
  19.   dosName * = "dos.library";
  20.   DOSTRUE * = e.LTRUE;
  21.   DOSFALSE * = e.LFALSE;
  22.  
  23. (* Mode parameter to Open() *)
  24.   oldFile    * =  1005;  (* Open existing file read/write
  25.                           * positioned at beginning of file. *)
  26.   newFile    * =  1006;  (* Open freshly created file (delete
  27.                           * old file) read/write, exclusive lock. *)
  28.   readWrite  * =  1004;  (* Open old file w/shared lock,
  29.                           * creates file if doesn't exist. *)
  30.  
  31. (* Relative position to Seek() *)
  32.   beginning  * =  -1;      (* relative to Begining Of File *)
  33.   current    * =   0;      (* relative to Current file position *)
  34.   end        * =   1;      (* relative to End Of File    *)
  35.  
  36.   bitsPerByte     * =  8;
  37.   bytesPerLong    * =  4;
  38.   bitsPerLong     * =  32;
  39.   maxInt          * =  7FFFFFFFH;
  40.   minInt          * =  80000000H;
  41.  
  42. (* Passed as type to Lock() *)
  43.   sharedLock      * =  -2;    (* File is readable by others *)
  44.   accessRead      * =  -2;    (* Synonym *)
  45.   exclusiveLock   * =  -1;    (* No other access allowed    *)
  46.   accessWrite     * =  -1;    (* Synonym *)
  47.  
  48.  
  49. TYPE
  50.   DatePtr                 * = UNTRACED POINTER TO Date;
  51.   FileInfoBlockPtr        * = UNTRACED POINTER TO FileInfoBlock;
  52.   InfoDataPtr             * = UNTRACED POINTER TO InfoData;
  53.   DateTimePtr             * = UNTRACED POINTER TO DateTime;
  54.   AnchorPathPtr           * = UNTRACED POINTER TO AnchorPath;
  55.   AChainPtr               * = UNTRACED POINTER TO AChain;
  56.   ProcessPtr              * = UNTRACED POINTER TO Process;
  57.   DosPacketPtr            * = UNTRACED POINTER TO DosPacket;
  58.   StandardPacketPtr       * = UNTRACED POINTER TO StandardPacket;
  59.   ErrorStringPtr          * = UNTRACED POINTER TO ErrorString;
  60.   DosLibraryPtr           * = UNTRACED POINTER TO DosLibrary;
  61.   RootNodePtr             * = UNTRACED POINTER TO RootNode;
  62.   CliProcListPtr          * = UNTRACED POINTER TO CliProcList;
  63.   AssignListPtr           * = UNTRACED POINTER TO AssignList;
  64.   DevProcPtr              * = UNTRACED POINTER TO DevProc;
  65.   ExAllDataPtr            * = UNTRACED POINTER TO ExAllData;
  66.   ExAllControlPtr         * = UNTRACED POINTER TO ExAllControl;
  67.   DeviceNodePtr           * = UNTRACED POINTER TO DeviceNode;
  68.   NotifyMessagePtr        * = UNTRACED POINTER TO NotifyMessage;
  69.   NotifyRequestPtr        * = UNTRACED POINTER TO NotifyRequest;
  70.   CSourcePtr              * = UNTRACED POINTER TO CSource;
  71.   RDArgsPtr               * = UNTRACED POINTER TO RDArgs;
  72.   RecordLockPtr           * = UNTRACED POINTER TO RecordLock;
  73.   LocalVarPtr             * = UNTRACED POINTER TO LocalVar;
  74.   DeviceListAPtr          * = UNTRACED POINTER TO DeviceList;
  75.   SegmentPtr              * = UNTRACED POINTER TO Segment;
  76.   DosListNodePtr          * = UNTRACED POINTER TO DosListNode;
  77.   CommandLineInterfaceAPtr* = UNTRACED POINTER TO CommandLineInterface;
  78.   FileLockPtr             * = BPOINTER TO FileLock;
  79.   FileHandlePtr           * = BPOINTER TO FileHandle;
  80.   DosEnvecPtr             * = BPOINTER TO DosEnvec;
  81.   DeviceListPtr           * = BPOINTER TO DeviceList;
  82.   DevInfoPtr              * = BPOINTER TO DevInfo;
  83.   DosListPtr              * = BPOINTER TO DosList;
  84.   CommandLineInterfacePtr * = BPOINTER TO CommandLineInterface;
  85.   TaskArrayPtr            * = BPOINTER TO TaskArray;
  86.   DosInfoPtr              * = BPOINTER TO DosInfo;
  87.   FileSysStartupMsgPtr    * = BPOINTER TO FileSysStartupMsg;
  88.   PathLockPtr             * = BPOINTER TO PathLock;
  89.   ArgsStructPtr           * = POINTER TO ArgsStruct;
  90.  
  91.   Date * = STRUCT
  92.     days * : LONGINT;          (* Number of days since Jan. 1, 1978 *)
  93.     minute * : LONGINT;        (* Number of minutes past midnight *)
  94.     tick * : LONGINT;          (* Number of ticks past minute *)
  95.   END;
  96.  
  97. CONST
  98.   ticksPerSecond * = 50;       (* Number of ticks in one second *)
  99.  
  100. TYPE
  101.  
  102. (* Returned by Examine() and ExNext(), must be on a 4 byte boundary *)
  103.   FileInfoBlock * = STRUCT
  104.     diskKey * : LONGINT;
  105.     dirEntryType * : LONGINT;       (* Type of Directory. If < 0, then a plain file.
  106.                                      * If > 0 a directory *)
  107.     fileName * : ARRAY 108 OF CHAR; (* Null terminated. Max 30 chars used for now *)
  108.     protection * : LONGSET;         (* bit mask of protection, rwxd are 3-0.      *)
  109.     entryType * : LONGINT;
  110.     size * : LONGINT;               (* Number of bytes in file *)
  111.     numBlock * : LONGINT;           (* Number of blocks in file *)
  112.     date * : Date;                  (* Date file last changed *)
  113.     comment * : ARRAY 80 OF CHAR;   (* Null terminated comment associated with file *)
  114.  
  115.    (* Note: the following fields are not supported by all filesystems.        *)
  116.    (* They should be initialized to 0 sending an ACTION_EXAMINE packet.       *)
  117.    (* When Examine() is called, these are set to 0 for you.           *)
  118.    (* AllocDosObject() also initializes them to 0.                    *)
  119.     ownerUID *: INTEGER;            (* owner's UID *)
  120.     ownerGID *: INTEGER;            (* owner's GID *)
  121.  
  122.     reserved * : ARRAY 32 OF CHAR;
  123.   END;
  124.  
  125. CONST
  126.  
  127. (* FileInfoBLock.protection flag definitions: *)
  128. (* Regular RWED bits are 0 == allowed. *)
  129. (* NOTE: GRP and OTR RWED permissions are 0 == not allowed! *)
  130. (* Group and Other permissions are not directly handled by the filesystem *)
  131.   otrRead    * = 15;  (* Other: file is readable *)
  132.   otrWrite   * = 14;  (* Other: file is writable *)
  133.   otrExecute * = 13;  (* Other: file is executable *)
  134.   otrDelete  * = 12;  (* Other: prevent file from being deleted *)
  135.   grpRead    * = 11;  (* Group: file is readable *)
  136.   grpWrite   * = 10;  (* Group: file is writable *)
  137.   grpExecute * =  9;  (* Group: file is executable *)
  138.   grpDelete  * =  8;  (* Group: prevent file from being deleted *)
  139.  
  140.   script   * = 6;        (* program is a script (execute) file *)
  141.   pure     * = 5;        (* program is reentrant and rexecutable *)
  142.   archive  * = 4;        (* cleared whenever file is changed *)
  143.   readProt * = 3;        (* ignored by old filesystem *)
  144.   writeProt* = 2;        (* ignored by old filesystem *)
  145.   execute  * = 1;        (* ignored by system, used by Shell *)
  146.   delete   * = 0;        (* prevent file from being deleted *)
  147.  
  148. (* Standard maximum length for an error string from fault.  However, most *)
  149. (* error strings should be kept under 60 characters if possible.  Don't   *)
  150. (* forget space for the header you pass in. *)
  151.   faultMax * = 82;
  152.  
  153. TYPE
  154.  
  155. (* All BCPL data must be long word aligned.  BCPL pointers are the long word
  156.  *  address (i.e byte address divided by 4 (>>2)) *)
  157.   BPTR * = e.BPTR;                   (* Long word pointer *)
  158.   BSTR * = BPOINTER TO e.STRING;     (* Long word pointer to BCPL string  *)
  159.  
  160. (* BCPL strings have a length in the first byte and then the characters.
  161.  * For example:  s[0]=3 s[1]=S s[2]=Y s[3]=S                             *)
  162.  
  163. TYPE
  164.  
  165. (* returned by Info(), must be on a 4 byte boundary *)
  166.   InfoData * = STRUCT
  167.     numSoftErrors * : LONGINT;   (* number of soft errors on disk *)
  168.     unitNumber    * : LONGINT;   (* Which unit disk is (was) mounted on *)
  169.     diskState     * : LONGINT;   (* See defines below *)
  170.     numBlock      * : LONGINT;   (* Number of blocks on disk *)
  171.     numBlockUsed  * : LONGINT;   (* Number of block in use *)
  172.     bytesPerBlock * : LONGINT;
  173.     diskType      * : LONGINT;   (* Disk Type code *)
  174.     volumeNode    * : DeviceListPtr; (* BCPL pointer to volume node *)
  175.     inUse         * : LONGINT;   (* Flag, zero if not in use *)
  176.   END;
  177.  
  178. CONST
  179.  
  180. (* InfoData.diskState *)
  181.   writeProtect * = 80;    (* Disk is write protected *)
  182.   validating   * = 81;    (* Disk is currently being validated *)
  183.   validated    * = 82;    (* Disk is consistent and writeable *)
  184.  
  185. (* InfoData.diskType *)
  186. (* Any other new filesystems should also, if possible. *)
  187.   noDiskPresent        * = -1;
  188.   unreadableDisk       * = sys.VAL(LONGINT,'BAD\o');
  189.   dosDisk              * = sys.VAL(LONGINT,'DOS\o');
  190.   ffsDisk              * = sys.VAL(LONGINT,'DOS\x01');
  191.   interDosDisk         * = sys.VAL(LONGINT,'DOS\x02');
  192.   interFFSDisk         * = sys.VAL(LONGINT,'DOS\x03');
  193.   fastDirDosDisk       * = sys.VAL(LONGINT,'DOS\x04');
  194.   fastDirFFSDisk       * = sys.VAL(LONGINT,'DOS\x05');
  195.   notReallyDos         * = sys.VAL(LONGINT,'NDOS' );
  196.   kickStartDisk        * = sys.VAL(LONGINT,'KICK' );
  197.   msdosDisk            * = sys.VAL(LONGINT,'MSD\o');
  198.  
  199. (* Errors from IoErr(), etc. *)
  200.   noFreeStore                * = 103;
  201.   taskTableFull              * = 105;
  202.   badTemplate                * = 114;
  203.   badNumber                  * = 115;
  204.   requiredArgMissing         * = 116;
  205.   keyNeedsArg                * = 117;
  206.   tooManyArgs                * = 118;
  207.   unmatchedQuotes            * = 119;
  208.   lineTooLong                * = 120;
  209.   fileNotObject              * = 121;
  210.   invalidResidentLibrary     * = 122;
  211.   noDefaultDir               * = 201;
  212.   objectInUse                * = 202;
  213.   objectExists               * = 203;
  214.   dirNotFound                * = 204;
  215.   objectNotFound             * = 205;
  216.   badStreamName              * = 206;
  217.   objectTooLarge             * = 207;
  218.   actionNotKnown             * = 209;
  219.   invalidComponentName       * = 210;
  220.   invalidLock                * = 211;
  221.   objectWrongType            * = 212;
  222.   diskNotValidated           * = 213;
  223.   diskWriteProtected         * = 214;
  224.   renameAcrossDevices        * = 215;
  225.   directoryNotEmpty          * = 216;
  226.   tooManyLevels              * = 217;
  227.   deviceNotMounted           * = 218;
  228.   seekError                  * = 219;
  229.   commentTooBig              * = 220;
  230.   diskFull                   * = 221;
  231.   deleteProtected            * = 222;
  232.   writeProtected             * = 223;
  233.   readProtected              * = 224;
  234.   notADosDisk                * = 225;
  235.   noDisk                     * = 226;
  236.   noMoreEntries              * = 232;
  237. (* added for 1.4 *)
  238.   isSoftLink                 * = 233;
  239.   objectLinked               * = 234;
  240.   badHunk                    * = 235;
  241.   notImplemented             * = 236;
  242.   recordNotLocked            * = 240;
  243.   lockCollision              * = 241;
  244.   lockTimeOut                * = 242;
  245.   unLockError                * = 243;
  246.  
  247. (* These are the return codes used by convention by AmigaDOS commands *)
  248. (* See FAILAT and IF for relvance to EXECUTE files                    *)
  249.   ok                    * =  0; (* No problems, success *)
  250.   warn                  * =  5; (* A warning only *)
  251.   error                 * = 10; (* Something wrong *)
  252.   fail                  * = 20; (* Complete or severe failure*)
  253.  
  254. (* Bit numbers that signal you that a user has issued a break *)
  255.   ctrlC  * = 12;
  256.   ctrlD  * = 13;
  257.   ctrlE  * = 14;
  258.   ctrlF  * = 15;
  259.  
  260. (* Values returned by SameLock() *)
  261.   same          * = 0;
  262.   sameHandler   * = 1;      (* actually same volume *)
  263.   different     * = -1;
  264.  
  265. (* types for ChangeMode() *)
  266.   changeLock  * = 0;
  267.   changeFH    * = 1;
  268.  
  269. (* Values for MakeLink() *)
  270.   hard   * = 0;
  271.   soft   * = 1;      (* softlinks are not fully supported yet *)
  272.  
  273. (* values returned by ReadItem *)
  274.   equal      * =  -2;              (* "=" Symbol *)
  275.   itemError  * =  -1;              (* error *)
  276.   nothing    * =  0;               (* *N, ;, endstreamch *)
  277.   unQuoted   * =  1;               (* unquoted item *)
  278.   quoted     * =  2;               (* quoted item *)
  279.  
  280. (* types for AllocDosObject/FreeDosObject *)
  281.   fileHandle      * = 0;      (* few people should use this *)
  282.   exAllControl    * = 1;      (* Must be used to allocate this! *)
  283.   fib             * = 2;      (* useful *)
  284.   stdpkt          * = 3;      (* for doing packet-level I/O *)
  285.   cli             * = 4;      (* for shell-writers, etc *)
  286.   rdArgs          * = 5;      (* for ReadArgs if you pass it in *)
  287.  
  288. TYPE
  289.  
  290. (*
  291.  *      Data structures and equates used by the V1.4 DOS functions
  292.  * StrtoDate() and DatetoStr()
  293.  *)
  294.  
  295. CONST
  296.  
  297. (* You need this much room for each of the DateTime strings: *)
  298.   lenDatString * = 16;
  299.  
  300. TYPE
  301.   DatString * = ARRAY 16 OF CHAR;
  302.   DatStringPtr * = UNTRACED POINTER TO DatString;
  303.  
  304. (*--------- String/Date structures etc *)
  305.   DateTime * = STRUCT (stamp * : Date)              (* DOS Date *)
  306.     format * : SHORTINT;            (* controls appearance of dat_StrDate *)
  307.     flags  * : SHORTSET;            (* see BITDEF's below *)
  308.     strDay * : DatStringPtr;        (* day of the week string *)
  309.     strDate* : DatStringPtr;        (* date string *)
  310.     strTime* : DatStringPtr;        (* time string *)
  311.   END;
  312.  
  313. CONST
  314.  
  315. (* flags for DateTime.flags *)
  316.  
  317.   subst   * = 0;              (* substitute Today, Tomorrow, etc. *)
  318.   future  * = 1;              (* day of the week is in future *)
  319.  
  320. (*
  321.  *      date format values
  322.  *)
  323.  
  324.   formatDos   * = 0;              (* dd-mmm-yy *)
  325.   formatInt   * = 1;              (* yy-mm-dd  *)
  326.   formatUSA   * = 2;              (* mm-dd-yy  *)
  327.   formatCDN   * = 3;              (* dd-mm-yy  *)
  328.   formatMax   * = formatCDN;
  329.  
  330.  
  331. (***********************************************************************
  332. ************************ PATTERN MATCHING ******************************
  333. ************************************************************************
  334.  
  335. * structure expected by MatchFirst, MatchNext.
  336. * Allocate this structure and initialize it as follows:
  337. *
  338. * Set ap_BreakBits to the signal bits (CDEF) that you want to take a
  339. * break on, or NULL, if you don't want to convenience the user.
  340. *
  341. * If you want to have the FULL PATH NAME of the files you found,
  342. * allocate a buffer at the END of this structure, and put the size of
  343. * it into ap_Length.  If you don't want the full path name, make sure
  344. * you set ap_Length to zero.  In this case, the name of the file, and stats
  345. * are available in the ap_Info, as per usual.
  346. *
  347. * Then call MatchFirst() and then afterwards, MatchNext() with this structure.
  348. * You should check the return value each time (see below) and take the
  349. * appropriate action, ultimately calling MatchEnd() when there are
  350. * no more files and you are done.  You can tell when you are done by
  351. * checking for the normal AmigaDOS return code ERROR_NO_MORE_ENTRIES.
  352. *
  353. *)
  354.  
  355. TYPE
  356.   AnchorPath * = STRUCT
  357.         base * : AChainPtr;        (* pointer to first anchor *)
  358.         last * : AChainPtr;        (* pointer to last anchor *)
  359.         breakBits * : LONGSET;     (* Bits we want to break on *)
  360.         foundBreak * : LONGSET;    (* Bits we broke on. Also returns ERROR_BREAK *)
  361.         flags * : SHORTSET;        (* New use for extra word. *)
  362.         reserved * : e.BYTE;
  363.         strLen * : INTEGER;        (* This is what AnchoPath.length used to be *)
  364.         info * : FileInfoBlock;
  365.         buf * : e.STRING;          (* Buffer for path name *)
  366.   END;
  367.  
  368. CONST
  369. (* AnchorPath.flags *)
  370.   doWild  * = 0;       (* User option ALL *)
  371.   itsWild * = 1;       (* Set by MatchFirst, used by MatchNext *)
  372.                        (* Application can test itsWild, too *)
  373.   doDir   * = 2;       (* Bit is SET if a DIR node should be *)
  374.                        (* entered. Application can RESET this *)
  375.                        (* bit after MatchFirst/MatchNext to AVOID *)
  376.                        (* entering a dir. *)
  377.   didDir  * = 3;       (* Bit is SET for an "expired" dir node. *)
  378.   noMemErr* = 4;       (* Set on memory error *)
  379.   doDot   * = 5;       (* If set, allow conversion of '.' to *)
  380.                        (* CurrentDir *)
  381.   dirChanged * = 6;    (* ap_Current->an_Lock changed *)
  382.                        (* since last MatchNext call *)
  383.  
  384. TYPE
  385.   AChain * = STRUCT
  386.         child  * : AChainPtr;
  387.         parent * : AChainPtr;
  388.         lock   * : FileLockPtr;
  389.         info   * : FileInfoBlock;
  390.         flags  * : SHORTSET;
  391.         string * : e.STRING;
  392.   END;
  393.  
  394. CONST
  395.  
  396.   patternBit  * = 0;
  397.   examinedBit * = 1;
  398.   completed   * = 2;
  399.   allBit      * = 3;
  400.   single      * = 4;
  401.  
  402. (*
  403.  * Constants used by wildcard routines, these are the pre-parsed tokens
  404.  * referred to by pattern match.  It is not necessary for you to do
  405.  * anything about these, MatchFirst() MatchNext() handle all these for you.
  406.  *)
  407.  
  408.   pAny           * = 80H;    (* Token for '*' or '#?  *)
  409.   pSingle        * = 81H;    (* Token for '?' *)
  410.   pOrStart       * = 82H;    (* Token for '(' *)
  411.   pOrNext        * = 83H;    (* Token for '|' *)
  412.   pOrEnd         * = 84H;    (* Token for ')' *)
  413.   pNot           * = 85H;    (* Token for '~' *)
  414.   pNotEnd        * = 86H;    (* Token for *)
  415.   pNotClass      * = 87H;    (* Token for '^' *)
  416.   pClass         * = 88H;    (* Token for '[]' *)
  417.   pRepBeg        * = 89H;    (* Token for '[' *)
  418.   pRepEnd        * = 8AH;    (* Token for ']' *)
  419.   pStop          * = 8BH;    (* Token to force end of evaluation *)
  420.  
  421. (* Values for an_Status, NOTE: These are the actual bit numbers *)
  422.  
  423.   complexBit   * = 1;       (* Parsing complex pattern *)
  424.   examineBit   * = 2;       (* Searching directory *)
  425.  
  426. (*
  427.  * Returns from MatchFirst(), MatchNext()
  428.  * You can also get dos error returns, such as ERROR_NO_MORE_ENTRIES,
  429.  * these are in the dos.h file.
  430.  *)
  431.  
  432.   bufferOverflow * = 303;     (* User or internal buffer overflow *)
  433.   break          * = 304;     (* A break character was received *)
  434.   notExecutable  * = 305;     (* A file has E bit cleared *)
  435.  
  436. TYPE
  437.  
  438.   ProcessId * = e.MsgPortPtr; (* Points to Process.msgPort *)
  439.  
  440. (* All DOS processes have this structure *)
  441. (* Create and Device Proc returns pointer to the MsgPort in this structure *)
  442. (* dev_proc = (struct Process * ) (DeviceProc(..) - sizeof(struct Task)); *)
  443.  
  444.   Process * = STRUCT (task * : e.Task)
  445.     msgPort        * : e.MsgPort;     (* This is BPTR address from DOS functions  *)
  446.     pad            * : INTEGER;       (* Remaining variables on 4 byte boundaries *)
  447.     segList        * : e.BPTR;        (* Array of seg lists used by this process  *)
  448.     stackSize      * : LONGINT;       (* Size of process stack in bytes           *)
  449.     globVec        * : e.APTR;        (* Global vector for this process (BCPL)    *)
  450.     taskNum        * : LONGINT;       (* CLI task number of zero if not a CLI     *)
  451.     stackBase      * : e.BPTR;        (* Ptr to high memory end of process stack  *)
  452.     result2        * : LONGINT;       (* Value of secondary result from last call *)
  453.     currentDir     * : FileLockPtr;   (* Lock associated with current directory   *)
  454.     cis            * : FileHandlePtr; (* Current CLI Input Stream                 *)
  455.     cos            * : FileHandlePtr; (* Current CLI Output Stream                *)
  456.     consoleTask    * : ProcessId;     (* Console handler process for current window*)
  457.     fileSystemTask * : ProcessId;     (* File handler process for current drive   *)
  458.     cli            * : CommandLineInterfacePtr;  (* pointer to CommandLineInterface          *)
  459.     returnAddr     * : e.APTR;        (* pointer to previous stack frame          *)
  460.     pktWait        * : e.APTR;        (* Function to be called when awaiting msg  *)
  461.     windowPtr      * : e.APTR;        (* Window for error printing                *)
  462.  
  463.     (* following definitions are new with 2.0 *)
  464.     homeDir        * : FileLockPtr;   (* Home directory of executing program      *)
  465.     flags          * : LONGSET;       (* flags telling dos about process          *)
  466.     exitCode       * : e.PROC;        (* code to call on exit of program or NULL  *)
  467.     exitData       * : LONGINT;       (* Passed as an argument to pr_ExitCode.    *)
  468.     arguments      * : e.STRPTR;      (* Arguments passed to the process at start *)
  469.     localVars      * : e.MinList;     (* Local environment variables             *)
  470.     shellPrivate   * : LONGINT;       (* for the use of the current shell         *)
  471.     ces            * : FileHandlePtr; (* Error stream - if NULL, use pr_COS       *)
  472.   END;
  473.  
  474. CONST
  475.  
  476. (*
  477.  * Flags for Process.flags
  478.  *)
  479.   freeSegList     * = 0;
  480.   freeCurrDir     * = 1;
  481.   freeCLI         * = 2;
  482.   closeInput      * = 3;
  483.   closeOutput     * = 4;
  484.   freeArgs        * = 5;
  485.  
  486. TYPE
  487.  
  488. (* The long word address (BPTR) of this structure is returned by
  489.  * Open() and other routines that return a file.  You need only worry
  490.  * about this struct to do async io's via PutMsg() instead of
  491.  * standard file system calls *)
  492.  
  493.   FileHandle * = STRUCT
  494.     link * : e.MessagePtr;      (* EXEC message              *)
  495.     port * : e.MsgPortPtr;      (* Reply port for the packet *)
  496.     type * : ProcessId;         (* Port to do PutMsg() to
  497.                                  * Address is negative if a plain file *)
  498.     buf  * : LONGINT;
  499.     pos  * : LONGINT;
  500.     end  * : LONGINT;
  501.     func1* : LONGINT;
  502.     func2* : LONGINT;
  503.     func3* : LONGINT;
  504.     arg1 * : LONGINT;
  505.     arg2 * : LONGINT;
  506.   END;
  507.  
  508. (* This is the extension to EXEC Messages used by DOS *)
  509.  
  510.   DosPacket * = STRUCT
  511.     link * : e.MessagePtr;      (* EXEC message              *)
  512.     port * : e.MsgPortPtr;      (* Reply port for the packet *)
  513.                                 (* Must be filled in each send. *)
  514.     type * : LONGINT;           (* See ACTION_... below and                    (* action *)
  515.                                  * 'R' means Read, 'W' means Write to the
  516.                                  * file system *)
  517.     res1 * : LONGINT;           (* For file system calls this is the result    (* status *)
  518.                                  * that would have been returned by the
  519.                                  * function, e.g. Write ('W') returns actual
  520.                                  * length written *)
  521.     res2 * : LONGINT;           (* For file system calls this is what would    (* status2 *)
  522.                                  * have been returned by IoErr() *)
  523.     arg1 * : LONGINT;                                                          (* bufAddr *)
  524.     arg2 * : LONGINT;
  525.     arg3 * : LONGINT;
  526.     arg4 * : LONGINT;
  527.     arg5 * : LONGINT;
  528.     arg6 * : LONGINT;
  529.     arg7 * : LONGINT;
  530.   END;
  531.  
  532. (* A Packet does not require the Message to be before it in memory, but
  533.  * for convenience it is useful to associate the two.
  534.  * Also see the function init_std_pkt for initializing this structure *)
  535.  
  536.   StandardPacket * = STRUCT (msg * : e.Message)
  537.     pkt * : DosPacket;
  538.   END;
  539.  
  540. CONST
  541.  
  542. (* DosPacket.type *)
  543.   nil              * = 0;
  544.   startup          * = 0;
  545.   getBlock         * = 2;       (* OBSOLETE *)
  546.   setMap           * = 4;
  547.   die              * = 5;
  548.   event            * = 6;
  549.   currentVolume    * = 7;
  550.   locateObject     * = 8;
  551.   renameDisk       * = 9;
  552.   write            * = ORD('W');
  553.   read             * = ORD('R');
  554.   freeLock         * = 15;
  555.   deleteObject     * = 16;
  556.   renameObject     * = 17;
  557.   moreCache        * = 18;
  558.   copyDir          * = 19;
  559.   waitChar         * = 20;
  560.   setProtect       * = 21;
  561.   createDir        * = 22;
  562.   examineObject    * = 23;
  563.   examineNext      * = 24;
  564.   diskInfo         * = 25;
  565.   info             * = 26;
  566.   flush            * = 27;
  567.   setComment       * = 28;
  568.   parent           * = 29;
  569.   timer            * = 30;
  570.   inhibit          * = 31;
  571.   diskType         * = 32;
  572.   diskChange       * = 33;
  573.   setDate          * = 34;
  574.  
  575.   screenMode       * = 994;
  576.  
  577.   readReturn       * = 1001;
  578.   writeReturn      * = 1002;
  579.   seek             * = 1008;
  580.   findUpdate       * = 1004;
  581.   findInput        * = 1005;
  582.   findOutput       * = 1006;
  583.   actionEnd        * = 1007;
  584.   setFileSize      * = 1022;    (* fast file system only in 1.3 *)
  585.   writeprotect     * = 1023;    (* fast file system only in 1.3 *)
  586.  
  587. (* new 2.0 packets *)
  588.   sameLock         * = 40;
  589.   changeSignal     * = 995;
  590.   format           * = 1020;
  591.   makeLink         * = 1021;
  592.   (**)
  593.   (**)
  594.   readLink         * = 1024;
  595.   fhFromLock       * = 1026;
  596.   isFileSystem     * = 1027;
  597.   changeMode       * = 1028;
  598.   (**)
  599.   copyDirFH        * = 1030;
  600.   parentFH         * = 1031;
  601.   examineAll       * = 1033;
  602.   examineFH        * = 1034;
  603.  
  604.   lockRecord       * = 2008;
  605.   freeRecord       * = 2009;
  606.  
  607.   addNotify        * = 4097;
  608.   removeNotify     * = 4098;
  609.  
  610. (* Added in V39: *)
  611.   examineAllEnd    * = 1035;
  612.   setOwner         * = 1036;
  613.  
  614.  
  615. TYPE
  616.  
  617. (*
  618.  * A structure for holding error messages - stored as array with error == 0
  619.  * for the last entry.
  620.  *)
  621.  
  622.   ErrorString * = STRUCT
  623.     nums    * : e.APTR;
  624.     strings * : e.APTR;
  625.   END;
  626.  
  627. (* DOS library node structure.
  628.  * This is the data at positive offsets from the library node.
  629.  * Negative offsets from the node is the jump table to DOS functions
  630.  * node = (struct DosLibrary * ) OpenLibrary( "dos.library" .. )      *)
  631.  
  632.   DosLibrary * = STRUCT (lib * : e.Library)
  633.     root * : RootNodePtr;       (* Pointer to RootNode, described below *)
  634.     gv   * : e.APTR;            (* Pointer to BCPL global vector        *)
  635.     a2   * : LONGINT;           (* Private register dump of DOS         *)
  636.     a5   * : LONGINT;
  637.     a6   * : LONGINT;
  638.     errors * : ErrorStringPtr; (* pointer to array of error msgs *)
  639.     timeReq * : t.TimeRequestPtr; (* private pointer to timer request *)
  640.     utilityBase * : e.LibraryPtr; (* private ptr to utility library *)
  641.   END;
  642.  
  643. (*                             *)
  644.  
  645.   TaskArray * = STRUCT
  646.     maxCLI * : LONGINT;
  647.     cli    * : ARRAY 10000000H OF ProcessId;
  648.   END;
  649.  
  650.   RootNode * = STRUCT
  651.     taskArray * : TaskArrayPtr;      (* [0] is max number of CLI's
  652.                                       * [1] is APTR to process id of CLI 1
  653.                                       * [n] is APTR to process id of CLI n *)
  654.     consoleSegment * : e.BPTR;       (* SegList for the CLI                      *)
  655.     time * : Date;                   (* Current time                             *)
  656.     restartSeg * : e.BPTR;           (* SegList for the disk validator process   *)
  657.     info * : DosInfoPtr;             (* Pointer to the Info structure            *)
  658.     fileHandlerSegment * : e.BPTR;   (* segment for a file handler           *)
  659.     cliList * : e.MinList;           (* new list of all CLI processes *)
  660.                                      (* the first cpl_Array is also rn_TaskArray *)
  661.     bootProc * : ProcessId;          (* private ptr to msgport of boot fs      *)
  662.     shellSegment * : e.BPTR;         (* seglist for Shell (for NewShell)         *)
  663.     flags * : LONGSET;               (* dos flags *)
  664.   END;
  665.  
  666. CONST
  667. (* RootNode.flags *)
  668.   wildStar * = 24;
  669.   private1 * = 1;
  670.  
  671. TYPE
  672.  
  673. (* ONLY to be allocated by DOS! *)
  674.   CliProcList * = STRUCT (node * : e.MinNode)
  675.         first * : LONGINT;      (* number of first entry in array *)
  676.         array * : UNTRACED POINTER TO ARRAY 1FFFFFFFH OF ProcessId;
  677.                              (* [0] is max number of CLI's in this entry (n)
  678.                               * [1] is CPTR to process id of CLI cpl_First
  679.                               * [n] is CPTR to process id of CLI cpl_First+n-1
  680.                               *)
  681.   END;
  682.  
  683.   DosInfo * = STRUCT
  684.     mcName * : BSTR;           (* Network name of this machine; currently 0 *)
  685.     devInfo * : DevInfoPtr;    (* Device List                               *)
  686.     devices * : e.BPTR;        (* Currently zero                            *)
  687.     handlers * : e.BPTR;       (* Currently zero                            *)
  688.     nethand  * : ProcessId;          (* Network handler processid; currently zero *)
  689.     devLock * : e.SignalSemaphore;   (* do NOT access directly! *)
  690.     entryLock * : e.SignalSemaphore; (* do NOT access directly! *)
  691.     deleteLock * : e.SignalSemaphore;(* do NOT access directly! *)
  692.   END;
  693.  
  694.  
  695. (* structure for the Dos resident list.  Do NOT allocate these, use       *)
  696. (* AddSegment(), and heed the warnings in the autodocs!                   *)
  697.  
  698.   Segment * = STRUCT
  699.     next * : e.BPTR;
  700.     uc * : LONGINT;
  701.     seg * : e.BPTR;
  702.     name * : ARRAY 4 OF CHAR;     (* actually the first 4 chars of BSTR name *)
  703.   END;
  704.  
  705. CONST
  706.  
  707.   cmdSystem   * = -1;
  708.   cmdInternal * = -2;
  709.   cmdDisabled * = -999;
  710.  
  711.  
  712. TYPE
  713.  
  714.   PathLock    * = STRUCT
  715.                     next * : PathLockPtr;
  716.                     lock * : FileLockPtr;
  717.                   END;
  718.  
  719. (* DOS Processes started from the CLI via RUN or NEWCLI have this additional
  720.  * set to data associated with them *)
  721.  
  722.   CommandLineInterface * = STRUCT
  723.     result2        * : LONGINT;       (* Value of IoErr from last command        *)
  724.     setName        * : BSTR;          (* Name of current directory               *)
  725.     commandDir     * : PathLockPtr;   (* Head of the path locklist               *)
  726.     returnCode     * : LONGINT;       (* Return code from last command           *)
  727.     commandName    * : BSTR;          (* Name of current command                 *)
  728.     failLevel      * : LONGINT;       (* Fail level (set by FAILAT)              *)
  729.     prompt         * : BSTR;          (* Current prompt (set by PROMPT)          *)
  730.     standardInput  * : FileHandlePtr; (* Default (terminal) CLI input            *)
  731.     currentInput   * : FileHandlePtr; (* Current CLI input                       *)
  732.     commandFile    * : BSTR;          (* Name of EXECUTE command file            *)
  733.     interactive    * : LONGINT;       (* Boolean; True if prompts required       *)
  734.     background     * : LONGINT;       (* Boolean; True if CLI created by RUN     *)
  735.     currentOutput  * : FileHandlePtr; (* Current CLI output                      *)
  736.     defaultStack   * : LONGINT;       (* Stack size to be obtained in long words *)
  737.     standardOutput * : FileHandlePtr; (* Default (terminal) CLI output           *)
  738.     module         * : e.BPTR;        (* SegList of currently loaded command     *)
  739.  
  740.  
  741.   END;
  742.  
  743. (* This structure can take on different values depending on whether it is
  744.  * a device, an assigned directory, or a volume.  Below is the structure
  745.  * reflecting volumes only.  Following that is the structure representing
  746.  * only devices. Following that is the unioned structure representing all
  747.  * the values
  748.  *)
  749.  
  750.   DosListNode * = STRUCT END; (* Dummy to make the following STRUCTs compatible *)
  751.  
  752. (* structure representing a volume *)
  753.  
  754.   DeviceList * = STRUCT (dummy : DosListNode)
  755.     next       * : DeviceListPtr;  (* bptr to next device list *)
  756.     type       * : LONGINT;        (* see DLT below *)
  757.     task       * : ProcessId;      (* ptr to handler task *)
  758.     lock       * : FileLockPtr;    (* not for volumes *)
  759.     volumeDate * : Date;           (* creation date *)
  760.     lockList   * : FileLockPtr;    (* outstanding locks *)
  761.     diskType   * : LONGINT;        (* 'DOS', etc *)
  762.     unused     * : LONGINT;
  763.     name       * : BSTR;           (* bptr to bcpl name *)
  764.   END;
  765.  
  766. (* device structure (same as the DeviceNode structure in filehandler.h) *)
  767.  
  768.   DevInfo * = STRUCT (dummy: DosListNode)
  769.     next      * : DevInfoPtr;
  770.     type      * : LONGINT;
  771.     task      * : ProcessId;
  772.     lock      * : FileLockPtr;
  773.     handler   * : BSTR;
  774.     stackSize * : LONGINT;
  775.     priority  * : LONGINT;
  776.     startup   * : FileSysStartupMsgPtr;
  777.     segList   * : e.BPTR;
  778.     globVec   * : e.BPTR;
  779.     name      * : BSTR;
  780.   END;
  781.  
  782. (* combined structure for devices, assigned directories, volumes *)
  783.  
  784.   DosList * = STRUCT (dummy : DosListNode)
  785.     next      * : DevInfoPtr;
  786.     type      * : LONGINT;
  787.     task      * : ProcessId;
  788.     lock      * : FileLockPtr;
  789.  
  790.     assignName* : e.STRPTR;       (* name for non-or-late-binding assign *)
  791.     list      * : AssignListPtr;  (* for multi-directory assigns (regular) *)
  792.     unused    * : ARRAY 4 OF LONGINT;
  793.     name      * : BSTR;
  794.   END;
  795.  
  796. (* structure used for multi-directory assigns. AllocVec()ed. *)
  797.  
  798.   AssignList * = STRUCT
  799.     next * : AssignListPtr;
  800.     lock * : FileLockPtr;
  801.   END;
  802.  
  803. CONST
  804.  
  805. (* definitions for DosList.type *)
  806.   device      * = 0;
  807.   directory   * = 1;       (* assign *)
  808.   volume      * = 2;
  809.   late        * = 3;       (* late-binding assign *)
  810.   nonBinding  * = 4;       (* non-binding assign *)
  811.   private     * = -1;      (* for internal use only *)
  812.  
  813. TYPE
  814.  
  815. (* structure return by GetDeviceProc() *)
  816.   DevProc * = STRUCT
  817.     port * : e.MsgPortPtr;
  818.     lock * : FileLockPtr;
  819.     flags * : LONGSET;
  820.     devNode * : DosListNodePtr;    (* DON'T TOUCH OR USE! *)
  821.   END;
  822.  
  823. CONST
  824.  
  825. (* definitions for DevProc.flags *)
  826.   unLock  * = 0;
  827.   assign  * = 1;
  828.  
  829. (* Flags to be passed to LockDosList(), etc *)
  830.   devices   * = 2;
  831.   volumes   * = 3;
  832.   assigns   * = 4;
  833.   entry     * = 5;
  834.   ldDelete  * = 6;
  835.  
  836. (* you MUST specify one of read or write *)
  837.   dosListRead * = 0;
  838.   dosListWrite * = 1;
  839.  
  840. (* actually all but entry (which is used for internal locking) *)
  841.   all * = LONGSET{devices,volumes,assigns};
  842.  
  843. TYPE
  844.  
  845. (* a lock structure, as returned by Lock() or DupLock() *)
  846.   FileLock * = STRUCT
  847.     link   * : FileLockPtr;   (* bcpl pointer to next lock *)
  848.     key    * : LONGINT;       (* disk block number *)
  849.     access * : LONGINT;       (* exclusive or shared *)
  850.     task   * : ProcessId;     (* handler task's port *)
  851.     volume * : DeviceListPtr; (* bptr to DLT_VOLUME DosList entry *)
  852.   END;
  853.  
  854. CONST
  855.  
  856. (* error report types for ErrorReport() *)
  857.   reportStream * = 0;      (* a stream *)
  858.   reportTask   * = 1;      (* a process - unused *)
  859.   reportLock   * = 2;      (* a lock *)
  860.   reportVolume * = 3;      (* a volume node *)
  861.   reportInsert * = 4;      (* please insert volume *)
  862.  
  863. (* Special error codes for ErrorReport() *)
  864.   diskError  * = 296;     (* Read/write error *)
  865.   abortBusy  * = 288;     (* You MUST replace... *)
  866.  
  867. (* types for initial packets to shells from run/newcli/execute/system. *)
  868. (* For shell-writers only *)
  869.   runExecute         * = -1;
  870.   runSystem          * = -2;
  871.   runSystemAsynch    * = -3;
  872.  
  873. (* Types for FileInfoBlock.dirEntryType. NOTE that both USERDIR and ROOT are  *)
  874. (* directories, and that directory/file checks should use <0 and >=0.    *)
  875. (* This is not necessarily exhaustive!  Some handlers may use other      *)
  876. (* values as needed, though <0 and >=0 should remain as supported as     *)
  877. (* possible.                                                             *)
  878.   root       * = 1;
  879.   userDir    * = 2;
  880.   softLink   * = 3;       (* looks like dir, but may point to a file! *)
  881.   linkDir    * = 4;       (* hard link to dir *)
  882.   file       * = -3;      (* must be negative for FIB! *)
  883.   linkFile   * = -4;      (* hard link to file *)
  884.  
  885.  
  886. (* hunk types *)
  887.   hunkUnit       * = 999;
  888.   hunkName       * = 1000;
  889.   hunkCode       * = 1001;
  890.   hunkData       * = 1002;
  891.   hunkBSS        * = 1003;
  892.   hunkReloc32    * = 1004;
  893.   hunkAbsReloc32 * = hunkReloc32;
  894.   hunkReloc16    * = 1005;
  895.   hunkRelReloc16 * = hunkReloc16;
  896.   hunkReloc8     * = 1006;
  897.   hunkRelReloc8  * = hunkReloc8;
  898.   hunkExt        * = 1007;
  899.   hunkSymbol     * = 1008;
  900.   hunkDebug      * = 1009;
  901.   hunkEnd        * = 1010;
  902.   hunkHeader     * = 1011;
  903.  
  904.   hunkOverlay    * = 1013;
  905.   hunkBreak      * = 1014;
  906.  
  907.   hunkDRel32     * = 1015;
  908.   hunkDRel16     * = 1016;
  909.   hunkDRel8      * = 1017;
  910.  
  911.   hunkLib        * = 1018;
  912.   hunkIndex      * = 1019;
  913.  
  914. (*
  915.  * Note: V37 LoadSeg uses 1015 (HUNK_DREL32) by mistake.  This will continue
  916.  * to be supported in future versions, since HUNK_DREL32 is illegal in load files
  917.  * anyways.  Future versions will support both 1015 and 1020, though anything
  918.  * that should be usable under V37 should use 1015.
  919.  *)
  920.   hunkReloc32Short * = 1020;
  921.  
  922. (* see ext_xxx below.  New for V39 (note that LoadSeg only handles RELRELOC32).*)
  923.   hunkRelReloc32   * = 1021;
  924.   hunkAbsReloc16   * = 1022;
  925.  
  926. (*
  927.  * Any hunks that have the HUNKB_ADVISORY bit set will be ignored if they
  928.  * aren't understood.  When ignored, they're treated like HUNK_DEBUG hunks.
  929.  * NOTE: this handling of HUNKB_ADVISORY started as of V39 dos.library!  If
  930.  * lading such executables is attempted under <V39 dos, it will fail with a
  931.  * bad hunk type.
  932.  *)
  933.   hunkBAdvisory    * = 29;
  934.   hunkBChip        * = 30;
  935.   hunkBFast        * = 31;
  936.  
  937.  
  938. (* hunk_ext sub-types *)
  939.   extSymb        * = 0;       (* symbol table *)
  940.   extDef         * = 1;       (* relocatable definition *)
  941.   extAbs         * = 2;       (* Absolute definition *)
  942.   extRes         * = 3;       (* no longer supported *)
  943.   extRef32       * = 129;     (* 32 bit reference to symbol *)
  944.   extAbsRef32    * = extRef32;
  945.   extCommon      * = 130;     (* 32 bit reference to COMMON block *)
  946.   extAbsCommon   * = extCommon;
  947.   extRef16       * = 131;     (* 16 bit reference to symbol *)
  948.   extRelRef16    * = extRef16;
  949.   extRef8        * = 132;     (*  8 bit reference to symbol *)
  950.   extRelRef8     * = extRef8;
  951.   extDExt32      * = 133;     (* 32 bit data releative reference *)
  952.   extDExt16      * = 134;     (* 16 bit data releative reference *)
  953.   extDExt8       * = 135;     (*  8 bit data releative reference *)
  954.  
  955. (* These are to support some of the '020 and up modes that are rarely used *)
  956.   extRelRef32    * = 136;     (* 32 bit PC-relative reference to symbol *)
  957.   extRelCommon   * = 137;     (* 32 bit PC-relative reference to COMMON block *)
  958.  
  959. (* for completeness... All 680x0's support this *)
  960.   extAbsRef16    * = 138;     (* 16 bit absolute reference to symbol *)
  961.  
  962. (* this only exists on '020's and above, in the (d8,An,Xn) address mode *)
  963.   extAbsRef8     * = 139;     (* 8 bit absolute reference to symbol *)
  964.  
  965.  
  966. (*****************************************************************************)
  967. (* definitions for the System() call *)
  968.  
  969.   sysDummy       * = u.user + 32;
  970.   sysInput       * = sysDummy + 1;      (* specifies the input filehandle  *)
  971.   sysOutput      * = sysDummy + 2;      (* specifies the output filehandle *)
  972.   sysAsynch      * = sysDummy + 3;      (* run asynch, close input/output on exit(!) *)
  973.   sysUserShell   * = sysDummy + 4;      (* send to user shell instead of boot shell *)
  974.   sysCustomShell * = sysDummy + 5;      (* send to a specific shell (data is name) *)
  975.  
  976.  
  977. (*****************************************************************************)
  978. (* definitions for the CreateNewProc() call *)
  979. (* you MUST specify one of NP_Seglist or NP_Entry.  All else is optional. *)
  980.  
  981.   npDummy        * = u.user + 1000;
  982.   npSeglist      * = npDummy + 1; (* seglist of code to run for the process  *)
  983.   npFreeSeglist  * = npDummy + 2; (* free seglist on exit - only valid for   *)
  984.                                   (* for NP_Seglist.  Default is TRUE.       *)
  985.   npEntry        * = npDummy + 3; (* entry point to run - mutually exclusive *)
  986.                                   (* with NP_Seglist! *)
  987.   npInput        * = npDummy + 4; (* filehandle - default is Open("NIL:"...) *)
  988.   npOutput       * = npDummy + 5; (* filehandle - default is Open("NIL:"...) *)
  989.   npCloseInput   * = npDummy + 6; (* close input filehandle on exit          *)
  990.                                   (* default TRUE                            *)
  991.   npCloseOutput  * = npDummy + 7; (* close output filehandle on exit         *)
  992.                                   (* default TRUE                            *)
  993.   npError        * = npDummy + 8; (* filehandle - default is Open("NIL:"...) *)
  994.   npCloseError   * = npDummy + 9; (* close error filehandle on exit          *)
  995.                                   (* default TRUE                            *)
  996.   npCurrentDir   * = npDummy + 10; (* lock - default is parent's current dir  *)
  997.   npStackSize    * = npDummy + 11; (* stacksize for process - default 4000    *)
  998.   npName         * = npDummy + 12; (* name for process - default "New Process"*)
  999.   npPriority     * = npDummy + 13; (* priority - default same as parent       *)
  1000.   npConsoleTask  * = npDummy + 14; (* consoletask - default same as parent    *)
  1001.   npWindowPtr    * = npDummy + 15; (* window ptr - default is same as parent  *)
  1002.   npHomeDir      * = npDummy + 16; (* home directory - default curr home dir  *)
  1003.   npCopyVars     * = npDummy + 17; (* boolean to copy local vars-default TRUE *)
  1004.   npCli          * = npDummy + 18; (* create cli structure - default FALSE    *)
  1005.   npPath         * = npDummy + 19; (* path - default is copy of parents path  *)
  1006.                                    (* only valid if a cli process!    *)
  1007.   npCommandName  * = npDummy + 20; (* commandname - valid only for CLI        *)
  1008.   npArguments    * = npDummy + 21; (* cstring of arguments - passed with str  *)
  1009.                                    (* in a0, length in d0.  (copied and freed *)
  1010.                                    (* on exit.  Default is empty string.      *)
  1011.                                    (* NOTE: not operational until 2.04 - see  *)
  1012.                                    (* BIX/TechNotes for more info/workarounds *)
  1013.                                    (* NOTE: in 2.0, it DIDN'T pass "" - the   *)
  1014.                                    (* registers were random.                  *)
  1015. (* FIX! should this be only for cli's? *)
  1016.   npNotifyOnDeath * = npDummy + 22; (* notify parent on death - default FALSE  *)
  1017.                                     (* Not functional yet. *)
  1018.   npSynchronous  * = npDummy + 23; (* don't return until process finishes -   *)
  1019.                                    (* default FALSE.                          *)
  1020.                                    (* Not functional yet. *)
  1021.   npExitCode     * = npDummy + 24; (* code to be called on process exit       *)
  1022.   npExitData     * = npDummy + 25; (* optional argument for NP_EndCode rtn -  *)
  1023.                                    (* default NULL                            *)
  1024.  
  1025.  
  1026. (*****************************************************************************)
  1027. (* tags for AllocDosObject *)
  1028.  
  1029.   adoDummy       * = u.user + 2000;
  1030.   adoFHMode      * = adoDummy + 1;
  1031.                                 (* for type DOS_FILEHANDLE only            *)
  1032.                                 (* sets up FH for mode specified.
  1033.                                    This can make a big difference for buffered
  1034.                                    files.                                  *)
  1035.         (* The following are for DOS_CLI *)
  1036.         (* If you do not specify these, dos will use it's preferred values *)
  1037.         (* which may change from release to release.  The BPTRs to these   *)
  1038.         (* will be set up correctly for you.  Everything will be zero,     *)
  1039.         (* except cli_FailLevel (10) and cli_Background (DOSTRUE).         *)
  1040.         (* NOTE: you may also use these 4 tags with CreateNewProc.         *)
  1041.  
  1042.   adoDirLen      * = adoDummy + 2; (* size in bytes for current dir buffer    *)
  1043.   adoCommNameLen * = adoDummy + 3; (* size in bytes for command name buffer   *)
  1044.   adoCommFileLen * = adoDummy + 4; (* size in bytes for command file buffer   *)
  1045.   adoPromptLen   * = adoDummy + 5; (* size in bytes for the prompt buffer     *)
  1046.  
  1047. (*****************************************************************************)
  1048. (* tags for NewLoadSeg *)
  1049. (* no tags are defined yet for NewLoadSeg *)
  1050.  
  1051. (* NOTE: V37 dos.library, when doing ExAll() emulation, and V37 filesystems  *)
  1052. (* will return an error if passed ED_OWNER.  If you get ERROR_BAD_NUMBER,    *)
  1053. (* retry with ED_COMMENT to get everything but owner info.  All filesystems  *)
  1054. (* supporting ExAll() must support through ED_COMMENT, and must check Type   *)
  1055. (* and return ERROR_BAD_NUMBER if they don't support the type.                     *)
  1056.  
  1057. (* values that can be passed for what data you want from ExAll() *)
  1058. (* each higher value includes those below it (numerically)       *)
  1059. (* you MUST chose one of these values *)
  1060.   name        * = 1;
  1061.   type        * = 2;
  1062.   size        * = 3;
  1063.   protection  * = 4;
  1064.   date        * = 5;
  1065.   comment     * = 6;
  1066.   owner       * = 7;
  1067.  
  1068. TYPE
  1069.  
  1070. (*
  1071.  *   Structure in which exall results are returned in.  Note that only the
  1072.  *   fields asked for will exist!
  1073.  *)
  1074.  
  1075.   ExAllData * = STRUCT
  1076.         next * : ExAllDataPtr;
  1077.         name * : e.STRPTR;
  1078.         type * : LONGINT;
  1079.         size * : LONGINT;
  1080.         prot * : LONGSET;
  1081.         days * : LONGINT;
  1082.         mins * : LONGINT;
  1083.         ticks    * : LONGINT;
  1084.         comment  * : e.STRPTR;   (* strings will be after last used field *)
  1085.         ownerUID * : INTEGER;    (* new for V39 *)
  1086.         ownerGID * : INTEGER;
  1087.   END;
  1088.  
  1089. (*
  1090.  *   Control structure passed to ExAll.  Unused fields MUST be initialized to
  1091.  *   0, expecially eac_LastKey.
  1092.  *
  1093.  *   eac_MatchFunc is a hook (see utility.library documentation for usage)
  1094.  *   It should return true if the entry is to returned, false if it is to be
  1095.  *   ignored.
  1096.  *
  1097.  *   This structure MUST be allocated by AllocDosObject()!
  1098.  *)
  1099.  
  1100.   ExAllControl * = STRUCT
  1101.     entries     * : LONGINT;    (* number of entries returned in buffer      *)
  1102.     lastKey     * : LONGINT;    (* Don't touch inbetween linked ExAll calls! *)
  1103.     matchString * : e.STRPTR;   (* wildcard string for pattern match or NULL *)
  1104.     matchFunc   * : u.HookPtr;  (* optional private wildcard function     *)
  1105.   END;
  1106.  
  1107.  
  1108. (* The disk "environment" is a longword array that describes the
  1109.  * disk geometry.  It is variable sized, with the length at the beginning.
  1110.  * Here are the constants for a standard geometry.
  1111.  *)
  1112.  
  1113.   DosEnvec * = STRUCT
  1114.     tableSize      * : LONGINT; (* size of Environment vector *)
  1115.     sizeBlock      * : LONGINT; (* in longwords: standard value is 128 *)
  1116.     secOrg         * : LONGINT; (* not used; must be 0 *)
  1117.     surfaces       * : LONGINT; (* # of heads (surfaces). drive specific *)
  1118.     sectorPerBlock * : LONGINT; (* not used; must be 1 *)
  1119.     blocksPerTrack * : LONGINT; (* blocks per track. drive specific *)
  1120.     reserved       * : LONGINT; (* DOS reserved blocks at start of partition. *)
  1121.     preAlloc       * : LONGINT; (* DOS reserved blocks at end of partition *)
  1122.     interleave     * : LONGINT; (* usually 0 *)
  1123.     lowCyl         * : LONGINT; (* starting cylinder. typically 0 *)
  1124.     highCyl        * : LONGINT; (* max cylinder. drive specific *)
  1125.     numBuffers     * : LONGINT; (* Initial # DOS of buffers.  *)
  1126.     bufMemType     * : LONGINT; (* type of mem to allocate for buffers *)
  1127.     maxTransfer    * : LONGINT; (* Max number of bytes to transfer at a time *)
  1128.     mask           * : LONGSET; (* Address Mask to block out certain memory *)
  1129.     bootPri        * : LONGINT; (* Boot priority for autoboot *)
  1130.     dosType        * : LONGINT; (* ASCII (HEX) string showing filesystem type;
  1131.                                  * 0X444F5300 is old filesystem,
  1132.                                  * 0X444F5301 is fast file system *)
  1133.     baud           * : LONGINT; (* Baud rate for serial handler *)
  1134.     control        * : LONGINT; (* Control word for handler/filesystem *)
  1135.     bootBlocks     * : LONGINT; (* Number of blocks containing boot code *)
  1136.   END;
  1137.  
  1138. CONST
  1139.  
  1140. (* these are the offsets into the array *)
  1141. (* DE_TABLESIZE is set to the number of longwords in the table minus 1 *)
  1142.  
  1143.   tableSize    * = 0;       (* minimum value is 11 (includes NumBuffers) *)
  1144.   sizeBlock    * = 1;       (* in longwords: standard value is 128 *)
  1145.   secOrg       * = 2;       (* not used; must be 0 *)
  1146.   numHeads     * = 3;       (* # of heads (surfaces). drive specific *)
  1147.   secsPerBlk   * = 4;       (* not used; must be 1 *)
  1148.   blksPerTrack * = 5;       (* blocks per track. drive specific *)
  1149.   reservedBlks * = 6;       (* unavailable blocks at start.  usually 2 *)
  1150.   preFac       * = 7;       (* not used; must be 0 *)
  1151.   interLeave   * = 8;       (* usually 0 *)
  1152.   lowCyl       * = 9;       (* starting cylinder. typically 0 *)
  1153.   upperCyl     * = 10;      (* max cylinder.  drive specific *)
  1154.   numBuffers   * = 11;      (* starting # of buffers.  typically 5 *)
  1155.   memBufType   * = 12;      (* type of mem to allocate for buffers. *)
  1156.   bufMemType   * = 12;      (* same as above, better name
  1157.                              * 1 is public, 3 is chip, 5 is fast *)
  1158.   maxTransfer  * = 13;      (* Max number bytes to transfer at a time *)
  1159.   mask         * = 14;      (* Address Mask to block out certain memory *)
  1160.   bootPri      * = 15;      (* Boot priority for autoboot *)
  1161.   dosType      * = 16;      (* ASCII (HEX) string showing filesystem type;
  1162.                              * 0X444F5300 is old filesystem,
  1163.                              * 0X444F5301 is fast file system *)
  1164.   baud         * = 17;      (* Baud rate for serial handler *)
  1165.   control      * = 18;      (* Control word for handler/filesystem *)
  1166.   bootBlocks   * = 19;      (* Number of blocks containing boot code *)
  1167.  
  1168. TYPE
  1169.  
  1170. (* The file system startup message is linked into a device node's startup
  1171. ** field.  It contains a pointer to the above environment, plus the
  1172. ** information needed to do an exec OpenDevice().
  1173. *)
  1174.   FileSysStartupMsg * = STRUCT
  1175.     unit    * : LONGINT;     (* exec unit number for this device *)
  1176.     device  * : BSTR;        (* null terminated bstring to the device name *)
  1177.     environ * : DosEnvecPtr; (* ptr to environment table (see above) *)
  1178.     flags   * : LONGSET;     (* flags for OpenDevice() *)
  1179.   END;
  1180.  
  1181.  
  1182. (* The include file "libraries/dosextens.h" has a DeviceList structure.
  1183.  * The "device list" can have one of three different things linked onto
  1184.  * it.  Dosextens defines the structure for a volume.  DLT_DIRECTORY
  1185.  * is for an assigned directory.  The following structure is for
  1186.  * a dos "device" (DLT_DEVICE).
  1187. *)
  1188.  
  1189.   DeviceNode * = STRUCT
  1190.     next      * : DeviceNodePtr;        (* singly linked list *)
  1191.     type      * : LONGINT;              (* always 0 for dos "devices" *)
  1192.     task      * : ProcessId;            (* standard dos "task" field.  If this is
  1193.                                          * null when the node is accesses, a task
  1194.                                          * will be started up *)
  1195.     lock      * : FileLockPtr;          (* not used for devices -- leave null *)
  1196.     handler   * : BSTR;                 (* filename to loadseg (if seglist is null) *)
  1197.     stackSize * : LONGINT;              (* stacksize to use when starting task *)
  1198.     priority  * : LONGINT;              (* task priority when starting task *)
  1199.     startup   * : FileSysStartupMsgPtr; (* startup msg: FileSysStartupMsg for disks *)
  1200.     segList   * : e.BPTR;               (* code to run to start new task (if necessary).
  1201.                                          * if null then dn_Handler will be loaded. *)
  1202.     globalVec * : e.BPTR;               (* BCPL global vector to use when starting
  1203.                                          * a task.  -1 means that dn_SegList is not
  1204.                                          * for a bcpl program, so the dos won't
  1205.                                          * try and construct one.  0 tell the
  1206.                                          * dos that you obey BCPL linkage rules,
  1207.                                          * and that it should construct a global
  1208.                                          * vector for you.
  1209.                                          *)
  1210.     name      * : BSTR;                 (* the node name, e.g. '\3','D','F','3' *)
  1211.   END;
  1212.  
  1213. CONST
  1214.  
  1215. (* use of Class and code is discouraged for the time being - we might want to
  1216.    change things *)
  1217. (* --- NotifyMessage Class ------------------------------------------------ *)
  1218.   class  * = 40000000H;
  1219.  
  1220. (* --- NotifyMessage Codes ------------------------------------------------ *)
  1221.   code   * = 1234H;
  1222.  
  1223. TYPE
  1224.  
  1225. (* Sent to the application if SEND_MESSAGE is specified.                    *)
  1226.  
  1227.   NotifyMessage * = STRUCT (execMessage * : e.Message)
  1228.     class       * : LONGINT;
  1229.     code        * : INTEGER;
  1230.     nReq        * : NotifyRequestPtr;      (* don't modify the request! *)
  1231.     doNotTouch    : LONGINT;               (* like it says!  For use by handlers *)
  1232.     doNotTouch2   : LONGINT;               (* dito *)
  1233.   END;
  1234.  
  1235. (* Do not modify or reuse the notifyrequest while active.                   *)
  1236. (* note: the first LONG of nr_Data has the length transfered                *)
  1237.  
  1238.   NotifyRequest * = STRUCT
  1239.     name * : e.STRPTR;
  1240.     fullName * : e.STRPTR;           (* set by dos - don't touch *)
  1241.     userData * : LONGINT;            (* for applications use *)
  1242.     flags * : LONGSET;
  1243.  
  1244.     task * : e.TaskPtr;              (* could also be: port * : e.MsgPortPtr *)
  1245.     signalNum * : SHORTINT;
  1246.     pad1,pad2,pad3: SHORTINT;
  1247.  
  1248.     reserved * : ARRAY 4 OF LONGINT; (* leave 0 for now *)
  1249.  
  1250.     (* internal use by handlers *)
  1251.     msgCount * : LONGINT;            (* # of outstanding msgs *)
  1252.     handler  * : e.MsgPortPtr;       (* handler sent to (for EndNotify) *)
  1253.   END;
  1254.  
  1255. CONST
  1256.  
  1257. (* --- NotifyRequest.flags ------------------------------------------------ *)
  1258.  
  1259.  
  1260.   sendMessage     * = 0;
  1261.   sendSignal      * = 1;
  1262.   waitReply       * = 3;
  1263.   notifyInitial   * = 4;
  1264.  
  1265. (* do NOT set or remove MAGIC!  Only for use by handlers! *)
  1266.   magic           * = 31;
  1267.  
  1268. (* Flags reserved for private use by the handler: *)
  1269.   handlerFlags    * = LONGSET{16..31};
  1270.  
  1271. TYPE
  1272.  
  1273. (**********************************************************************
  1274.  *
  1275.  * The CSource data structure defines the input source for "ReadItem()"
  1276.  * as well as the ReadArgs call.  It is a publicly defined structure
  1277.  * which may be used by applications which use code that follows the
  1278.  * conventions defined for access.
  1279.  *
  1280.  * When passed to the dos.library functions, the value passed as
  1281.  * struct *CSource is defined as follows:
  1282.  *      if ( CSource == 0)      Use buffered IO "ReadChar()" as data source
  1283.  *      else                    Use CSource for input character stream
  1284.  *
  1285.  * The following two pseudo-code routines define how the CSource structure
  1286.  * is used:
  1287.  *
  1288.  * long CS_ReadChar( struct CSource *CSource )
  1289.  * {
  1290.  *      if ( CSource == 0 )     return ReadChar();
  1291.  *      if ( CSource->CurChr >= CSource->Length )       return ENDSTREAMCHAR;
  1292.  *      return CSource->Buffer[ CSource->CurChr++ ];
  1293.  * }
  1294.  *
  1295.  * BOOL CS_UnReadChar( struct CSource *CSource )
  1296.  * {
  1297.  *      if ( CSource == 0 )     return UnReadChar();
  1298.  *      if ( CSource->CurChr <= 0 )     return FALSE;
  1299.  *      CSource->CurChr--;
  1300.  *      return TRUE;
  1301.  * }
  1302.  *
  1303.  * To initialize a struct CSource, you set CSource->CS_Buffer to
  1304.  * a string which is used as the data source, and set CS_Length to
  1305.  * the number of characters in the string.  Normally CS_CurChr should
  1306.  * be initialized to ZERO, or left as it was from prior use as
  1307.  * a CSource.
  1308.  *
  1309.  **********************************************************************)
  1310.  
  1311.   CSource * = STRUCT
  1312.     buffer * : UNTRACED POINTER TO ARRAY 1FFFFFFFH OF CHAR;
  1313.     length * : LONGINT;
  1314.     curChr * : LONGINT;
  1315.   END;
  1316.  
  1317. (**********************************************************************
  1318.  *
  1319.  * The RDArgs data structure is the input parameter passed to the DOS
  1320.  * ReadArgs() function call.
  1321.  *
  1322.  * The RDA_Source structure is a CSource as defined above;
  1323.  * if RDA_Source.CS_Buffer is non-null, RDA_Source is used as the input
  1324.  * character stream to parse, else the input comes from the buffered STDIN
  1325.  * calls ReadChar/UnReadChar.
  1326.  *
  1327.  * RDA_DAList is a private address which is used internally to track
  1328.  * allocations which are freed by FreeArgs().  This MUST be initialized
  1329.  * to NULL prior to the first call to ReadArgs().
  1330.  *
  1331.  * The RDA_Buffer and RDA_BufSiz fields allow the application to supply
  1332.  * a fixed-size buffer in which to store the parsed data.  This allows
  1333.  * the application to pre-allocate a buffer rather than requiring buffer
  1334.  * space to be allocated.  If either RDA_Buffer or RDA_BufSiz is NULL,
  1335.  * the application has not supplied a buffer.
  1336.  *
  1337.  * RDA_ExtHelp is a text string which will be displayed instead of the
  1338.  * template string, if the user is prompted for input.
  1339.  *
  1340.  * RDA_Flags bits control how ReadArgs() works.  The flag bits are
  1341.  * defined below.  Defaults are initialized to ZERO.
  1342.  *
  1343.  **********************************************************************)
  1344.  
  1345.   RDArgs * = STRUCT
  1346.     source  * : CSource;       (* Select input source *)
  1347.     daList  * : LONGINT;       (* PRIVATE. *)
  1348.     buffer  * : e.STRPTR;      (* Optional string parsing space. *)
  1349.     bufSiz  * : LONGINT;       (* Size of RDA_Buffer (0..n) *)
  1350.     extHelp * : e.STRPTR;      (* Optional extended help *)
  1351.     flags   * : LONGSET;       (* Flags for any required control *)
  1352.   END;
  1353.  
  1354. CONST
  1355.  
  1356. (* RDArgs.flags *)
  1357.   stdIn    * = 0;       (* Use "STDIN" rather than "COMMAND LINE" *)
  1358.   noAlloc  * = 1;       (* If set, do not allocate extra string space.*)
  1359.   noPrompt * = 2;       (* Disable reprompting for string input. *)
  1360.  
  1361. (**********************************************************************
  1362.  * Maximum number of template keywords which can be in a template passed
  1363.  * to ReadArgs(). IMPLEMENTOR NOTE - must be a multiple of 4.
  1364.  **********************************************************************)
  1365.   maxTemplateItems * = 100;
  1366.  
  1367. (**********************************************************************
  1368.  * Maximum number of MULTIARG items returned by ReadArgs(), before
  1369.  * an ERROR_LINE_TOO_LONG.  These two limitations are due to stack
  1370.  * usage.  Applications should allow "a lot" of stack to use ReadArgs().
  1371.  **********************************************************************)
  1372.   maxMultiArgs * = 128;
  1373.  
  1374.  
  1375. TYPE
  1376. (*
  1377.  * use an extension of this and pass it to ReadArgs()
  1378.  * use one entry (see definitions below) for every template keyword
  1379.  * according to it's type.
  1380.  *
  1381.  * NOTE: This has been introduced to improof type safety since somebody
  1382.  *       tried to pass a POINTER TO ARRAY OF CHAR, what totaly confused the
  1383.  *       garbage collector.
  1384.  *)
  1385.  
  1386.   ArgsStruct * = STRUCT END;
  1387.  
  1388.   (* these are UNTRACED 'cause allocated by DOS *)
  1389.   ArgLong        * = UNTRACED POINTER TO ARRAY 1 OF LONGINT;   (* /N *)
  1390.   ArgLongArray   * = UNTRACED POINTER TO ARRAY maxMultiArgs OF ArgLong;   (* /M/N*)
  1391.   ArgBool        * = e.LONGBOOL;   (* /S, /T *)
  1392.   ArgString      * = e.STRPTR;     (* /K, or nothing *)
  1393.   ArgStringArray * = UNTRACED POINTER TO ARRAY maxMultiArgs OF ArgString; (* /K/M, /M *)
  1394.  
  1395.  
  1396. CONST
  1397. (* Modes for LockRecord/LockRecords() *)
  1398.   recExclusive       * = 0;
  1399.   recExclusiveImmed  * = 1;
  1400.   recShared          * = 2;
  1401.   recSharedImmed     * = 3;
  1402.  
  1403. TYPE
  1404.  
  1405. (* struct to be passed to LockRecords()/UnLockRecords() *)
  1406.  
  1407.   RecordLock * = STRUCT
  1408.     fh     * : FileHandlePtr; (* filehandle *)
  1409.     offset * : LONGINT;       (* offset in file *)
  1410.     lenght * : LONGINT;       (* length of file to be locked *)
  1411.     mode   * : LONGINT;       (* Type of lock *)
  1412.   END;
  1413.  
  1414. CONST
  1415.  
  1416. (* types for SetVBuf *)
  1417.   bufLine     * = 0;      (* flush on \n, etc *)
  1418.   bufFull     * = 1;      (* never flush except when needed *)
  1419.   bufNone     * = 2;      (* no buffering *)
  1420.  
  1421.  
  1422. (* the structure in the pr_LocalVars list *)
  1423. (* Do NOT allocate yourself, use SetVar()!!! This structure may grow in *)
  1424. (* future releases!  The list should be left in alphabetical order, and *)
  1425. (* may have multiple entries with the same name but different types.    *)
  1426.  
  1427. TYPE
  1428.   LocalVar * = STRUCT (node * : e.Node)
  1429.     flags * : SET;
  1430.     value * : e.STRPTR;
  1431.     len   * : LONGINT;
  1432.   END;
  1433.  
  1434. (*
  1435.  * The lv_Flags bits are available to the application.  The unused
  1436.  * lv_Node.ln_Pri bits are reserved for system use.
  1437.  *)
  1438.  
  1439. CONST
  1440.  
  1441. (* definitions for LocalVar.node.type: *)
  1442.   var        * = 0;       (* an variable *)
  1443.   alias      * = 1;       (* an alias    *)
  1444. (* to be or'ed into type: *)
  1445.   ingnore    * = -80H;    (* ignore this entry on GetVar, etc *)
  1446.  
  1447. (* definitions of flags passed to GetVar()/SetVar()/DeleteVar() *)
  1448. (* bit defs to be OR'ed with the type: *)
  1449. (* item will be treated as a single line of text unless BINARY_VAR is used *)
  1450.   globalOnly      * = 8;
  1451.   localOnly       * = 9;
  1452.   binaryVar       * = 10;             (* treat variable as binary *)
  1453.   dontNullTerm    * = 11;      (* only with GVF_BINARY_VAR *)
  1454.  
  1455. (* this is only supported in >= V39 dos.  V37 dos ignores this. *)
  1456. (* this causes SetVar to affect ENVARC: as well as ENV:.      *)
  1457.   saveVar         * = 12;      (* only with GVF_GLOBAL_VAR *)
  1458.  
  1459. TYPE
  1460.   OwnerInfo = STRUCT (* dummy for better access on SetOwner etc.*)
  1461.     uid *: INTEGER;
  1462.     gid *: INTEGER;
  1463.   END;
  1464.  
  1465. VAR
  1466.   dos*, base*: DosLibraryPtr;   (* synonyms *)
  1467.  
  1468.  
  1469. PROCEDURE Open          *{dos,- 30}(name{1}      : ARRAY OF CHAR;
  1470.                                     accessMode{2}: LONGINT): FileHandlePtr;
  1471. PROCEDURE Close         *{dos,- 36}(file{1}      : FileHandlePtr): BOOLEAN;
  1472. PROCEDURE OldClose      *{dos,- 36}(file{1}      : FileHandlePtr);      (* Version < 36 *)
  1473. PROCEDURE Read          *{dos,- 42}(file{1}      : FileHandlePtr;
  1474.                                     buffer{2}    : ARRAY OF sys.BYTE;
  1475.                                     length{3}    : LONGINT): LONGINT;
  1476. PROCEDURE Write         *{dos,- 48}(file{1}      : FileHandlePtr;
  1477.                                     buffer{2}    : ARRAY OF sys.BYTE;
  1478.                                     length{3}    : LONGINT): LONGINT;
  1479. PROCEDURE Input         *{dos,- 54}(): FileHandlePtr;
  1480. PROCEDURE Output        *{dos,- 60}(): FileHandlePtr;
  1481. PROCEDURE Seek          *{dos,- 66}(file{1}      : FileHandlePtr;
  1482.                                     position{2}  : LONGINT;
  1483.                                     offset{3}    : LONGINT): LONGINT;
  1484. PROCEDURE DeleteFile    *{dos,- 72}(name{1}      : ARRAY OF CHAR): BOOLEAN;
  1485. PROCEDURE Rename        *{dos,- 78}(oldName{1}   : ARRAY OF CHAR;
  1486.                                     newName{2}   : ARRAY OF CHAR): BOOLEAN;
  1487. PROCEDURE Lock          *{dos,- 84}(name{1}      : ARRAY OF CHAR;
  1488.                                     type{2}      : LONGINT): FileLockPtr;
  1489. PROCEDURE UnLock        *{dos,- 90}(lock{1}      : FileLockPtr);
  1490. PROCEDURE DupLock       *{dos,- 96}(lock{1}      : FileLockPtr): FileLockPtr;
  1491. PROCEDURE Examine       *{dos,-102}(lock{1}      : FileLockPtr;
  1492.                                     VAR info{2}  : FileInfoBlock): BOOLEAN;
  1493. PROCEDURE ExNext        *{dos,-108}(lock{1}      : FileLockPtr;
  1494.                                     VAR info{2}  : FileInfoBlock): BOOLEAN;
  1495. PROCEDURE Info          *{dos,-114}(lock{1}      : FileLockPtr;
  1496.                                     VAR info{2}  : InfoData): BOOLEAN;
  1497. PROCEDURE CreateDir     *{dos,-120}(name{1}      : ARRAY OF CHAR): FileLockPtr;
  1498. PROCEDURE CurrentDir    *{dos,-126}(lock{1}      : FileLockPtr): FileLockPtr;
  1499. PROCEDURE IoErr         *{dos,-132}(): LONGINT;
  1500. PROCEDURE CreateProc    *{dos,-138}(name{1}      : ARRAY OF CHAR;
  1501.                                     pri{2}       : LONGINT;
  1502.                                     segList{3}   : e.BPTR;
  1503.                                     stackSize{4} : LONGINT): ProcessId;
  1504. PROCEDURE Exit          *{dos,-144}(returnCode{1}: LONGINT);
  1505. PROCEDURE LoadSeg       *{dos,-150}(name{1}      : ARRAY OF CHAR): e.BPTR;
  1506. PROCEDURE UnLoadSeg     *{dos,-156}(segList{1}   : e.BPTR);
  1507. PROCEDURE DeviceProc    *{dos,-174}(name{1}      : ARRAY OF CHAR): ProcessId;
  1508. PROCEDURE SetComment    *{dos,-180}(name{1}      : ARRAY OF CHAR;
  1509.                                     comment{2}   : ARRAY OF CHAR): BOOLEAN;
  1510. PROCEDURE SetProtection *{dos,-186}(name{1}      : ARRAY OF CHAR;
  1511.                                     protect{2}   : LONGSET): BOOLEAN;
  1512. PROCEDURE DateStamp     *{dos,-192}(VAR date{1}  : Date);
  1513. PROCEDURE Delay         *{dos,-198}(timeout{1}   : LONGINT);
  1514. PROCEDURE WaitForChar   *{dos,-204}(file{1}      : FileHandlePtr;
  1515.                                     timeout{2}   : LONGINT): BOOLEAN;
  1516. PROCEDURE ParentDir     *{dos,-210}(lock{1}      : FileLockPtr): FileLockPtr;
  1517. PROCEDURE IsInteractive *{dos,-216}(file{1}      : FileHandlePtr): BOOLEAN;
  1518. PROCEDURE Execute       *{dos,-222}(string{1}    : ARRAY OF CHAR;
  1519.                                     file{2}      : FileHandlePtr;
  1520.                                     file2{3}     : FileHandlePtr): BOOLEAN;
  1521. (* ---   functions in V36 or higher (distributed as Release 2.0)    --- *)
  1522. (* --- REMEMBER: You are to check the version BEFORE you use this ! --- *)
  1523. (*      DOS Object creation/deletion *)
  1524. PROCEDURE AllocDosObject*{dos,-228}(type{1}      : LONGINT;
  1525.                                     tags{2}      : ARRAY OF u.TagItem): e.APTR;
  1526. PROCEDURE AllocDosObjectTags*{dos,-228}(type{1}  : LONGINT;
  1527.                                     tag1{2}..    : u.Tag): e.APTR;
  1528. PROCEDURE FreeDosObject *{dos,-234}(type{1}      : LONGINT;
  1529.                                     ptr{2}       : e.APTR);
  1530. (*      Packet Level routines *)
  1531. PROCEDURE DoPkt0        *{dos,-240}(port{1}      : ProcessId;
  1532.                                     action{2}    : LONGINT): LONGINT;
  1533. PROCEDURE DoPkt1        *{dos,-240}(port{1}      : ProcessId;
  1534.                                     action{2}    : LONGINT;
  1535.                                     arg1{3}      : LONGINT): LONGINT;
  1536. PROCEDURE DoPkt2        *{dos,-240}(port{1}      : ProcessId;
  1537.                                     action{2}    : LONGINT;
  1538.                                     arg1{3}      : LONGINT;
  1539.                                     arg2{4}      : LONGINT): LONGINT;
  1540. PROCEDURE DoPkt3        *{dos,-240}(port{1}      : ProcessId;
  1541.                                     action{2}    : LONGINT;
  1542.                                     arg1{3}      : LONGINT;
  1543.                                     arg2{4}      : LONGINT;
  1544.                                     arg3{5}      : LONGINT): LONGINT;
  1545. PROCEDURE DoPkt4        *{dos,-240}(port{1}      : ProcessId;
  1546.                                     action{2}    : LONGINT;
  1547.                                     arg1{3}      : LONGINT;
  1548.                                     arg2{4}      : LONGINT;
  1549.                                     arg3{5}      : LONGINT;
  1550.                                     arg4{6}      : LONGINT): LONGINT;
  1551. PROCEDURE DoPkt         *{dos,-240}(port{1}      : ProcessId;
  1552.                                     action{2}    : LONGINT;
  1553.                                     arg1{3}      : LONGINT;
  1554.                                     arg2{4}      : LONGINT;
  1555.                                     arg3{5}      : LONGINT;
  1556.                                     arg4{6}      : LONGINT;
  1557.                                     arg5{7}      : LONGINT): LONGINT;
  1558. PROCEDURE SendPkt       *{dos,-246}(VAR dp{1}    : DosPacket;
  1559.                                     port{2}      : ProcessId;
  1560.                                     replyport{3} : e.MsgPortPtr);
  1561. PROCEDURE WaitPkt       *{dos,-252}(): DosPacketPtr;
  1562. PROCEDURE ReplyPkt      *{dos,-258}(dp{1}        : DosPacketPtr;
  1563.                                     res1{2}      : LONGINT;
  1564.                                     res2{3}      : LONGINT);
  1565. PROCEDURE AbortPkt      *{dos,-264}(port{1}      : ProcessId;
  1566.                                     pkt{2}       : DosPacketPtr);
  1567. (*      Record Locking *)
  1568. PROCEDURE LockRecord    *{dos,-270}(fh{1}        : FileHandlePtr;
  1569.                                     offset{2}    : LONGINT;
  1570.                                     length{3}    : LONGINT;
  1571.                                     mode{4}      : LONGINT;
  1572.                                     timeout{5}   : LONGINT): BOOLEAN;
  1573. PROCEDURE LockRecords   *{dos,-276}(recArray{1}  : RecordLockPtr;
  1574.                                     timeout{2}   : LONGINT): BOOLEAN;
  1575. PROCEDURE UnLockRecord  *{dos,-282}(fh{1}        : FileHandlePtr;
  1576.                                     offset{2}    : LONGINT;
  1577.                                     length{3}    : LONGINT): BOOLEAN;
  1578. PROCEDURE UnLockRecords *{dos,-288}(recArray{1}  : RecordLockPtr): BOOLEAN;
  1579. (*      Buffered File I/O *)
  1580. PROCEDURE SelectInput   *{dos,-294}(fh{1}        : FileHandlePtr): FileHandlePtr;
  1581. PROCEDURE SelectOutput  *{dos,-300}(fh{1}        : FileHandlePtr): FileHandlePtr;
  1582. PROCEDURE FGetC         *{dos,-306}(fh{1}        : FileHandlePtr): LONGINT;
  1583. PROCEDURE FPutC         *{dos,-312}(fh{1}        : FileHandlePtr;
  1584.                                     ch{2}        : LONGINT): LONGINT;
  1585. PROCEDURE UnGetC        *{dos,-318}(fh{1}        : FileHandlePtr;
  1586.                                     character{2} : LONGINT): LONGINT;
  1587. PROCEDURE FRead         *{dos,-324}(fh{1}        : FileHandlePtr;
  1588.                                     block{2}     : ARRAY OF sys.BYTE;
  1589.                                     blocklen{3}  : LONGINT;
  1590.                                     number{4}    : LONGINT): LONGINT;
  1591. PROCEDURE FWrite        *{dos,-330}(fh{1}        : FileHandlePtr;
  1592.                                     block{2}     : ARRAY OF sys.BYTE;
  1593.                                     blocklen{3}  : LONGINT;
  1594.                                     number{4}    : LONGINT): LONGINT;
  1595. PROCEDURE FGets         *{dos,-336}(fh{1}        : FileHandlePtr;
  1596.                                     VAR buf{2}   : ARRAY OF CHAR;
  1597.                                     buflen{3}    : LONGINT): e.APTR;
  1598. PROCEDURE FPuts         *{dos,-342}(fh{1}        : FileHandlePtr;
  1599.                                     str{2}       : ARRAY OF CHAR): BOOLEAN;
  1600. PROCEDURE VFWritef      *{dos,-348}(fh{1}        : FileHandlePtr;
  1601.                                     format{2}    : ARRAY OF CHAR;
  1602.                                     argarray{3}  : ARRAY OF sys.BYTE): LONGINT;
  1603. PROCEDURE FWritef       *{dos,-348}(fh{1}        : FileHandlePtr;
  1604.                                     format{2}    : ARRAY OF CHAR;
  1605.                                     arg1{3}..    : e.APTR): LONGINT;
  1606. PROCEDURE VFPrintf      *{dos,-354}(fh{1}        : FileHandlePtr;
  1607.                                     format{2}    : ARRAY OF CHAR;
  1608.                                     argarray{3}  : ARRAY OF e.APTR): LONGINT;
  1609. PROCEDURE FPrintf       *{dos,-354}(fh{1}        : FileHandlePtr;
  1610.                                     format{2}    : ARRAY OF CHAR;
  1611.                                     arg1{3}..    : e.APTR): LONGINT;
  1612. PROCEDURE Flush         *{dos,-360}(fh{1}        : FileHandlePtr): BOOLEAN;
  1613. PROCEDURE SetVBuf       *{dos,-366}(fh{1}        : FileHandlePtr;
  1614.                                     VAR buff{2}  : ARRAY OF CHAR;
  1615.                                     type{3}      : LONGINT;
  1616.                                     size{4}      : LONGINT): LONGINT;
  1617. (*      DOS Object Management *)
  1618. PROCEDURE DupLockFromFH *{dos,-372}(fh{1}        : FileHandlePtr): FileLockPtr;
  1619. PROCEDURE OpenFromLock  *{dos,-378}(lock{1}      : FileLockPtr): FileHandlePtr;
  1620. PROCEDURE ParentOfFH    *{dos,-384}(fh{1}        : FileHandlePtr): FileLockPtr;
  1621. PROCEDURE ExamineFH     *{dos,-390}(fh{1}        : FileHandlePtr;
  1622.                                     VAR fib{2}   : FileInfoBlock): BOOLEAN;
  1623. PROCEDURE SetFileDate   *{dos,-396}(name{1}      : ARRAY OF CHAR;
  1624.                                     date{2}      : Date): BOOLEAN;
  1625. PROCEDURE NameFromLock  *{dos,-402}(lock{1}      : FileLockPtr;
  1626.                                     VAR buffer{2}: ARRAY OF CHAR;
  1627.                                     len{3}       : LONGINT): BOOLEAN;
  1628. PROCEDURE NameFromFH    *{dos,-408}(fh{1}        : FileHandlePtr;
  1629.                                     VAR buffer{2}: ARRAY OF CHAR;
  1630.                                     len{3}       : LONGINT): BOOLEAN;
  1631. PROCEDURE SplitName     *{dos,-414}(name{1}      : ARRAY OF CHAR;
  1632.                                     seperator{2} : CHAR;
  1633.                                     buf{3}       : ARRAY OF CHAR;
  1634.                                     oldpos{4}    : LONGINT;
  1635.                                     size{5}      : LONGINT): INTEGER;
  1636. PROCEDURE SameLock      *{dos,-420}(lock1{1}     : FileLockPtr;
  1637.                                     lock2{2}     : FileLockPtr): INTEGER;
  1638. PROCEDURE SetMode       *{dos,-426}(fh{1}        : FileHandlePtr;
  1639.                                     mode{2}      : LONGINT): LONGINT;
  1640. PROCEDURE ExAll         *{dos,-432}(lock{1}      : FileLockPtr;
  1641.                                     buffer{2}    : ARRAY OF sys.BYTE;
  1642.                                     size{3}      : LONGINT;
  1643.                                     data{4}      : LONGINT;
  1644.                                     ctrl{5}      : ExAllControlPtr): BOOLEAN;
  1645. PROCEDURE ReadLink      *{dos,-438}(port{1}      : ProcessId;
  1646.                                     lock{2}      : FileLockPtr;
  1647.                                     path{3}      : ARRAY OF CHAR;
  1648.                                     buffer{4}    : ARRAY OF CHAR;
  1649.                                     size{5}      : LONGINT): LONGINT;
  1650. PROCEDURE MakeLink      *{dos,-444}(name{1}      : ARRAY OF CHAR;
  1651.                                     dest{2}      : LONGINT;
  1652.                                     soft{3}      : LONGINT): LONGINT;
  1653. PROCEDURE ChangeMode    *{dos,-450}(type{1}      : LONGINT; (* must be changeFH *)
  1654.                                     fh{2}        : FileHandlePtr;
  1655.                                     newmode{3}   : LONGINT): BOOLEAN;
  1656. PROCEDURE ChangeModeLock*{dos,-450}(type{1}      : LONGINT; (* must be changeLock *)
  1657.                                     lock{2}      : FileLockPtr;
  1658.                                     newmode{3}   : LONGINT): BOOLEAN;
  1659. PROCEDURE SetFileSize   *{dos,-456}(fh{1}        : FileHandlePtr;
  1660.                                     pos{2}       : LONGINT;
  1661.                                     mode{3}      : LONGINT): LONGINT;
  1662. (*      Error Handling *)
  1663. PROCEDURE SetIoErr      *{dos,-462}(result{1}    : LONGINT): LONGINT;
  1664. PROCEDURE Fault         *{dos,-468}(code{1}      : LONGINT;
  1665.                                     header{2}    : ARRAY OF CHAR;
  1666.                                     VAR buffer{3}: ARRAY OF CHAR;
  1667.                                     len{4}       : LONGINT): BOOLEAN;
  1668. PROCEDURE PrintFault    *{dos,-474}(code{1}      : LONGINT;
  1669.                                     header{2}    : ARRAY OF CHAR): BOOLEAN;
  1670. PROCEDURE ErrorReport   *{dos,-480}(code{1}      : LONGINT;
  1671.                                     type{2}      : LONGINT;   (* should be reportVolume *)
  1672.                                     arg1{3}      : DeviceListAPtr;
  1673.                                     device{4}    : ProcessId): LONGINT;
  1674. PROCEDURE ErrorReportLock*{dos,-480}(code{1}      : LONGINT;
  1675.                                     type{2}      : LONGINT;   (* should be reportLock *)
  1676.                                     arg1{3}      : FileLockPtr;
  1677.                                     device{4}    : ProcessId): LONGINT;
  1678. PROCEDURE ErrorReportFH *{dos,-480}(code{1}      : LONGINT;
  1679.                                     type{2}      : LONGINT;   (* should be reportStream *)
  1680.                                     arg1{3}      : FileHandlePtr;
  1681.                                     device{4}    : ProcessId): LONGINT;
  1682. PROCEDURE Requester     *{dos,-486}(s1{1}        : ARRAY OF CHAR;
  1683.                                     s2{2}        : ARRAY OF CHAR;
  1684.                                     s3{3}        : ARRAY OF CHAR;
  1685.                                     flags{4}     : LONGSET): LONGINT;
  1686. (*      Process Management *)
  1687. PROCEDURE Cli           *{dos,-492}(): CommandLineInterfaceAPtr;
  1688. PROCEDURE CreateNewProc *{dos,-498}(tags{1}      : ARRAY OF u.TagItem): ProcessPtr;
  1689. PROCEDURE CreateNewProcTags*{dos,-498}(tag1{1}.. : u.Tag): ProcessPtr;
  1690. PROCEDURE RunCommand    *{dos,-504}(seg{1}       : e.BPTR;
  1691.                                     stack{2}     : LONGINT;
  1692.                                     paramptr{3}  : ARRAY OF CHAR;
  1693.                                     paramlen{4}  : LONGINT): LONGINT;
  1694. PROCEDURE GetConsoleTask*{dos,-510}(): ProcessId ;
  1695. PROCEDURE SetConsoleTask*{dos,-516}(task{1}      : ProcessId): ProcessId;
  1696. PROCEDURE GetFileSysTask*{dos,-522}(): ProcessId;
  1697. PROCEDURE SetFileSysTask*{dos,-528}(task{1}      : ProcessId): ProcessId;
  1698. PROCEDURE GetArgStr     *{dos,-534}(): e.STRPTR;
  1699. PROCEDURE SetArgStr     *{dos,-540}(string{1}    : ARRAY OF CHAR): e.STRPTR;
  1700. PROCEDURE FindCliProc   *{dos,-546}(num{1}       : LONGINT): ProcessPtr;
  1701. PROCEDURE MaxCli        *{dos,-552}(): LONGINT;
  1702. PROCEDURE SetCurrentDirName*{dos,-558}(name{1}   : ARRAY OF CHAR): BOOLEAN;
  1703. PROCEDURE GetCurrentDirName*{dos,-564}(VAR buf{1}: ARRAY OF CHAR;
  1704.                                        len{2}    : LONGINT): BOOLEAN;
  1705. PROCEDURE SetProgramName*{dos,-570}(name{1}      : ARRAY OF CHAR): BOOLEAN;
  1706. PROCEDURE GetProgramName*{dos,-576}(VAR buf{1}   : ARRAY OF CHAR;
  1707.                                     len{2}       : LONGINT): BOOLEAN;
  1708. PROCEDURE SetPrompt     *{dos,-582}(name{1}      : ARRAY OF CHAR): BOOLEAN;
  1709. PROCEDURE GetPrompt     *{dos,-588}(VAR buf{1}   : ARRAY OF CHAR;
  1710.                                     len{2}       : LONGINT): BOOLEAN;
  1711. PROCEDURE SetProgramDir *{dos,-594}(lock{1}      : FileLockPtr): FileLockPtr;
  1712. PROCEDURE GetProgramDir *{dos,-600}(): FileLockPtr;
  1713. (*      Device List Management *)
  1714. PROCEDURE System        *{dos,-606}(command{1}   : ARRAY OF CHAR;
  1715.                                     tags{2}      : ARRAY OF u.TagItem): LONGINT;
  1716. PROCEDURE SystemTags    *{dos,-606}(command{1}   : ARRAY OF CHAR;
  1717.                                     tag1{2}..    : u.Tag): LONGINT;
  1718. PROCEDURE AssignLock    *{dos,-612}(name{1}      : ARRAY OF CHAR;
  1719.                                     lock{2}      : FileLockPtr): BOOLEAN;
  1720. PROCEDURE AssignLate    *{dos,-618}(name{1}      : ARRAY OF CHAR;
  1721.                                     path{2}      : ARRAY OF CHAR): BOOLEAN;
  1722. PROCEDURE AssignPath    *{dos,-624}(name{1}      : ARRAY OF CHAR;
  1723.                                     path{2}      : ARRAY OF CHAR): BOOLEAN;
  1724. PROCEDURE AssignAdd     *{dos,-630}(name{1}      : ARRAY OF CHAR;
  1725.                                     lock{2}      : FileLockPtr): BOOLEAN;
  1726. PROCEDURE RemAssignList *{dos,-636}(name{1}      : ARRAY OF CHAR;
  1727.                                     lock{2}      : FileLockPtr): LONGINT;
  1728. PROCEDURE GetDeviceProc *{dos,-642}(name{1}      : ARRAY OF CHAR;
  1729.                                     dp{2}        : DevProcPtr): DevProcPtr;
  1730. PROCEDURE FreeDeviceProc*{dos,-648}(dp{1}        : DevProcPtr);
  1731. PROCEDURE LockDosList   *{dos,-654}(flags{1}     : LONGSET): DosListNodePtr;
  1732. PROCEDURE UnLockDosList *{dos,-660}(flags{1}     : LONGSET);
  1733. PROCEDURE AttemptLockDosList*{dos,-666}(flags{1} : LONGSET): DosListNodePtr;
  1734. PROCEDURE RemDosEntry   *{dos,-672}(dlist{1}     : DosListNodePtr): BOOLEAN;
  1735. PROCEDURE AddDosEntry   *{dos,-678}(dlist{1}     : DosListNodePtr): DosListNodePtr;
  1736. PROCEDURE FindDosEntry  *{dos,-684}(dlist{1}     : DosListNodePtr;
  1737.                                     name{2}      : ARRAY OF CHAR;
  1738.                                     flags{3}     : LONGSET): DosListNodePtr;
  1739. PROCEDURE NextDosEntry  *{dos,-690}(dlist{1}     : DosListNodePtr;
  1740.                                     flags{2}     : LONGSET): DosListNodePtr;
  1741. PROCEDURE MakeDosEntry  *{dos,-696}(name{1}      : ARRAY OF CHAR;
  1742.                                     type{2}      : LONGINT): DosListNodePtr;
  1743. PROCEDURE FreeDosEntry  *{dos,-702}(dlist{1}     : DosListNodePtr);
  1744. PROCEDURE IsFileSystem  *{dos,-708}(name{1}      : ARRAY OF CHAR): BOOLEAN;
  1745. (*      Handler Interface *)
  1746. PROCEDURE Format        *{dos,-714}(filesystem{1}: ARRAY OF CHAR;
  1747.                                     volumename{2}: ARRAY OF CHAR;
  1748.                                     dostype{3}   : LONGINT): BOOLEAN;
  1749. PROCEDURE Relabel       *{dos,-720}(drive{1}     : ARRAY OF CHAR;
  1750.                                     newname{2}   : ARRAY OF CHAR): BOOLEAN;
  1751. PROCEDURE Inhibit       *{dos,-726}(name{1}      : ARRAY OF CHAR;
  1752.                                     onoff{2}     : LONGINT): BOOLEAN;
  1753. PROCEDURE AddBuffers    *{dos,-732}(name{1}      : ARRAY OF CHAR;
  1754.                                     number{2}    : LONGINT): LONGINT;
  1755. (*      Date, Time Routines *)
  1756. PROCEDURE CompareDates  *{dos,-738}(date1{1}     : Date;
  1757.                                     date2{2}     : Date): LONGINT;
  1758. PROCEDURE DateToStr     *{dos,-744}(VAR dt{1}    : DateTime): BOOLEAN;
  1759. PROCEDURE StrToDate     *{dos,-750}(VAR dt{1}    : DateTime): BOOLEAN;
  1760. (*      Image Management *)
  1761. PROCEDURE InternalLoadSeg*{dos,-756}(fh{1}       : FileHandlePtr;
  1762.                                     table{2}     : e.BPTR;
  1763.                                     funcarray{9} : e.APTR;
  1764.                                     VAR stack{10}: LONGINT): e.BPTR;
  1765. PROCEDURE InternalUnLoadSeg*{dos,-762}(seglist{1}: e.BPTR;
  1766.                                     freefunc{9}  : e.PROC): BOOLEAN;
  1767. PROCEDURE NewLoadSeg    *{dos,-768}(file{1}      : ARRAY OF CHAR;
  1768.                                     tags{2}      : ARRAY OF u.TagItem): e.BPTR;
  1769. PROCEDURE NewLoadSegTags*{dos,-768}(file{1}      : ARRAY OF CHAR;
  1770.                                     tags{2}..    : u.Tag): e.BPTR;
  1771. PROCEDURE AddSegment    *{dos,-774}(name{1}      : ARRAY OF CHAR;
  1772.                                     seg{2}       : e.BPTR;
  1773.                                     system{3}    : LONGINT): BOOLEAN;
  1774. PROCEDURE FindSegment   *{dos,-780}(name{1}      : ARRAY OF CHAR;
  1775.                                     seg{2}       : SegmentPtr;
  1776.                                     system{3}    : LONGINT): SegmentPtr;
  1777. PROCEDURE RemSegment    *{dos,-786}(seg{1}       : SegmentPtr): BOOLEAN;
  1778. (*      Command Support *)
  1779. PROCEDURE CheckSignal   *{dos,-792}(mask{1}      : LONGSET): LONGSET;
  1780. PROCEDURE OldReadArgs   *{dos,-798}(template{1}  : ARRAY OF CHAR;
  1781.                                     VAR array{2} : ARRAY OF sys.BYTE;
  1782.                                     args{3}      : RDArgsPtr): RDArgsPtr;
  1783. PROCEDURE ReadArgs      *{dos,-798}(template{1}  : ARRAY OF CHAR;
  1784.                                     VAR array{2} : ArgsStruct;
  1785.                                     args{3}      : RDArgsPtr): RDArgsPtr;
  1786. PROCEDURE FindArg       *{dos,-804}(template{1}  : ARRAY OF CHAR;
  1787.                                     keyword{2}   : ARRAY OF CHAR): LONGINT;
  1788. PROCEDURE ReadItem      *{dos,-810}(VAR name{1}  : ARRAY OF CHAR;
  1789.                                     maxchars{2}  : LONGINT;
  1790.                                     cSrc{3}      : CSourcePtr): LONGINT;
  1791. PROCEDURE StrToLong     *{dos,-816}(string{1}    : ARRAY OF CHAR;
  1792.                                     VAR value{2} : LONGINT): LONGINT;
  1793. PROCEDURE MatchFirst    *{dos,-822}(pat{1}       : ARRAY OF CHAR;
  1794.                                     VAR anchor{2}: AnchorPath): LONGINT;
  1795. PROCEDURE MatchNext     *{dos,-828}(VAR anchor{1}: AnchorPath): LONGINT;
  1796. PROCEDURE MatchEnd      *{dos,-834}(VAR anchor{1}: AnchorPath);
  1797. PROCEDURE ParsePattern  *{dos,-840}(pat{1}       : ARRAY OF CHAR;
  1798.                                     VAR buf{2}   : ARRAY OF CHAR;
  1799.                                     buflen{3}    : LONGINT): INTEGER;
  1800. PROCEDURE MatchPattern  *{dos,-846}(pat{1}       : ARRAY OF CHAR;
  1801.                                     str{2}       : ARRAY OF CHAR): BOOLEAN;
  1802. PROCEDURE FreeArgs      *{dos,-858}(args{1}      : RDArgsPtr);
  1803. PROCEDURE FilePart      *{dos,-870}(path{1}      : ARRAY OF CHAR): e.STRPTR;
  1804. PROCEDURE PathPart      *{dos,-876}(path{1}      : ARRAY OF CHAR): e.APTR;
  1805. PROCEDURE AddPart       *{dos,-882}(VAR dir{1}   : ARRAY OF CHAR;
  1806.                                     filename{2}  : ARRAY OF CHAR;
  1807.                                     size{3}      : LONGINT): BOOLEAN;
  1808. (*      Notification *)
  1809. PROCEDURE StartNotify   *{dos,-888}(VAR notify{1}: NotifyRequest): BOOLEAN;
  1810. PROCEDURE EndNotify     *{dos,-894}(VAR nofify{1}: NotifyRequest);
  1811. (*      Environment Variable functions *)
  1812. PROCEDURE SetVar        *{dos,-900}(name{1}      : ARRAY OF CHAR;
  1813.                                     buffer{2}    : ARRAY OF CHAR;
  1814.                                     size{3}      : LONGINT;
  1815.                                     flags{4}     : LONGSET): BOOLEAN;
  1816. PROCEDURE GetVar        *{dos,-906}(name{1}      : ARRAY OF CHAR;
  1817.                                     VAR buffer{2}: ARRAY OF CHAR;
  1818.                                     size{3}      : LONGINT;
  1819.                                     flags{4}     : LONGSET): LONGINT;
  1820. PROCEDURE DeleteVar     *{dos,-912}(name{1}      : ARRAY OF CHAR;
  1821.                                     flags{2}     : LONGSET): BOOLEAN;
  1822. PROCEDURE FindVar       *{dos,-918}(name{1}      : ARRAY OF CHAR;
  1823.                                     type{2}      : LONGSET): LocalVarPtr;
  1824. PROCEDURE CliInit       *{dos,-924}(VAR dp{8}    : DosPacket): LONGINT;
  1825. PROCEDURE CliInitNewcli *{dos,-930}(VAR dp{8}    : DosPacket): LONGINT;
  1826. PROCEDURE CliInitRun    *{dos,-936}(VAR dp{8}    : DosPacket): LONGINT;
  1827. PROCEDURE WriteChars    *{dos,-942}(buf{1}       : ARRAY OF CHAR;
  1828.                                     buflen{2}    : LONGINT): LONGINT;
  1829. PROCEDURE PutStr        *{dos,-948}(str{1}       : ARRAY OF CHAR): LONGINT;
  1830. PROCEDURE VPrintf       *{dos,-954}(format{1}    : ARRAY OF CHAR;
  1831.                                     argarray{2}  : ARRAY OF sys.BYTE): LONGINT;
  1832. PROCEDURE Printf        *{dos,-954}(format{1}    : ARRAY OF CHAR;
  1833.                                     arg1{2}..    : e.APTR): LONGINT;
  1834. PROCEDURE PrintF        *{dos,-954}(format{1}    : ARRAY OF CHAR;
  1835.                                     arg1{2}..    : e.APTR); (* result is ignored *)
  1836. (* these were unimplemented until dos 36.147 *)
  1837. PROCEDURE ParsePatternNoCase*{dos,-966}(pat{1}   : ARRAY OF CHAR;
  1838.                                     VAR buf{2}   : ARRAY OF CHAR;
  1839.                                     len{3}       : LONGINT): INTEGER;
  1840. PROCEDURE MatchPatternNoCase*{dos,-972}(pat{1}   : ARRAY OF CHAR;
  1841.                                     str{2}       : ARRAY OF CHAR): BOOLEAN;
  1842. (* this was added for V37 dos, returned 0 before then. *)
  1843. PROCEDURE SameDevice    *{dos,-984}(lock1{1}     : FileLockPtr;
  1844.                                     lock2{2}     : FileLockPtr): BOOLEAN;
  1845.  
  1846. (* NOTE: the following entries did NOT exist before ks 36.303 (2.02) *)
  1847. (* If you are going to use them, open dos.library with version 37 *)
  1848.  
  1849. (* These calls were added for V39 dos: *)
  1850. PROCEDURE ExAllEnd      *{dos,-3DEH}(lock{1}     : FileLockPtr;
  1851.                                     buffer{2}    : ARRAY OF sys.BYTE;
  1852.                                     size{3}      : LONGINT;
  1853.                                     data{4}      : LONGINT;
  1854.                                     ctrl{5}      : ExAllControlPtr);
  1855. PROCEDURE SetOwner      *{dos,-3E4H}(name{1}     : ARRAY OF CHAR;
  1856.                                      ownerInfo{2}: OwnerInfo): BOOLEAN;
  1857.  
  1858.  
  1859. (* $OvflChk- $RangeChk- $StackChk- $NilChk- $ReturnChk- $CaseChk- *)
  1860.  
  1861. PROCEDURE ReadChar*(): CHAR;
  1862. VAR c: LONGINT;
  1863. BEGIN
  1864.   c := FGetC(Input());
  1865.   IF (c<0) OR (c>255) THEN c := 0 END;
  1866.   RETURN CHR(c);
  1867. END ReadChar;
  1868.  
  1869.  
  1870. PROCEDURE WriteChar*(c: CHAR): LONGINT;
  1871. BEGIN
  1872.   RETURN FPutC(Output(),ORD(c))
  1873. END WriteChar;
  1874.  
  1875.  
  1876. PROCEDURE UnReadChar*(c: CHAR): LONGINT;
  1877. BEGIN
  1878.   RETURN UnGetC(Input(),ORD(c));
  1879. END UnReadChar;
  1880.  
  1881. (* next one is inefficient *)
  1882.  
  1883. PROCEDURE ReadChars*(VAR buf: ARRAY OF sys.BYTE; num: LONGINT): LONGINT;
  1884. BEGIN
  1885.   RETURN FRead(Input(),buf,1,num);
  1886. END ReadChars;
  1887.  
  1888. PROCEDURE ReadLn*(VAR buf: ARRAY OF CHAR; len: LONGINT): e.APTR;
  1889. BEGIN
  1890.   RETURN FGets(Input(),buf,len);
  1891. END ReadLn;
  1892.  
  1893. PROCEDURE WriteStr*(s: ARRAY OF CHAR): BOOLEAN; (* $CopyArrays- *)
  1894. BEGIN
  1895.   RETURN FPuts(Output(),s);
  1896. END WriteStr;
  1897.  
  1898. PROCEDURE VWritef*(format: ARRAY OF CHAR; argv: ARRAY OF sys.BYTE): LONGINT; (* $CopyArrays- *)
  1899. BEGIN
  1900.   RETURN VFWritef(Output(),format,argv);
  1901. END VWritef;
  1902.  
  1903.  
  1904. (*
  1905.  * The following procedures are implemented for to avoid using SYSTEM within
  1906.  * Oberon programs.
  1907.  *)
  1908.  
  1909. PROCEDURE ProcessIdToProcess*(id: ProcessId): ProcessPtr;
  1910. (*
  1911.  * Use this to convert a ProcessId (eg. WBStartup.process) to a ProcessPtr.
  1912.  *)
  1913.  
  1914. BEGIN
  1915.   RETURN sys.VAL(ProcessPtr,sys.VAL(LONGINT,id)-SIZE(e.Task));
  1916. END ProcessIdToProcess;
  1917.  
  1918. PROCEDURE ProcessToProcessId*(proc: ProcessPtr): ProcessId;
  1919. (*
  1920.  * Use this to get a Process' ProcessId, ie. a pointer to its MsgPort.
  1921.  *)
  1922.  
  1923. BEGIN
  1924.   RETURN sys.ADR(proc.msgPort);
  1925. END ProcessToProcessId;
  1926.  
  1927. BEGIN
  1928.   dos :=  e.OpenLibrary(dosName,33);
  1929.   IF dos = NIL THEN HALT(0) END;
  1930.   base := dos;
  1931.  
  1932. CLOSE
  1933.   IF dos#NIL THEN e.CloseLibrary(dos) END;
  1934.  
  1935. END Dos.
  1936.  
  1937.