home *** CD-ROM | disk | FTP | other *** search
/ Aminet 18 / aminetcdnumber181997.iso / Aminet / dev / m2 / CycloneModules.lha / modules / txt / DosD.def < prev    next >
Text File  |  1997-01-10  |  52KB  |  1,348 lines

  1. (**************************************************************************)
  2. (*                                                                        *)
  3. (* Definition Module DosD by Marcel Timmermans.                           *)
  4. (* Date     : 21 Feb 1994                                                 *)
  5. (* Language : Modula-2                                                    *)
  6. (*                                                                        *)
  7. (**************************************************************************)
  8.  
  9. (*$ Implementation- *)
  10. DEFINITION MODULE DosD; 
  11.  
  12. FROM SYSTEM IMPORT ADDRESS,BYTE,LONGSET,WORD,CAST;
  13.  
  14. FROM ExecD IMPORT
  15.  Library,LibraryPtr,MemReqSet,Message,MessagePtr,MinList,MinNode
  16.  ,MsgPort,MsgPortPtr,Node,SignalSemaphore,Task,TaskPtr;
  17.  
  18. FROM Timer IMPORT
  19.  TimeRequestPtr;
  20.  
  21. FROM UtilityD IMPORT
  22.  HookPtr,tagUser,TagItemPtr;
  23.  
  24. IMPORT Reg;
  25.  
  26. TYPE 
  27.   StrPtr=ADDRESS;
  28.   BPTR=BPOINTER TO LONGINT;
  29.   BSTR=BPOINTER TO ARRAY[0..255] OF CHAR;
  30.   AChainPtr=POINTER TO AChain;
  31.   AnchorPathPtr=POINTER TO AnchorPath;
  32.   AssignListPtr=POINTER TO AssignList;
  33.   CliProcListPtr=POINTER TO CliProcList;
  34.   CommandLineInterfaceAPtr=POINTER TO CommandLineInterface;
  35.   CommandLineInterfacePtr=BPOINTER TO CommandLineInterface;
  36.   CSourcePtr=POINTER TO CSource;
  37.   DatePtr=POINTER TO Date;
  38.   DateTimePtr=POINTER TO DateTime;
  39.   DeviceListPtr=BPOINTER TO DeviceList;
  40.   DeviceNodePtr=POINTER TO DeviceNode;
  41.   DevProcPtr = POINTER TO DevProc;
  42.   DosEnvecPtr=BPOINTER TO DosEnvec;
  43.   DosInfoPtr=BPOINTER TO DosInfo;
  44.   DosLibraryPtr=POINTER TO DosLibrary;
  45.   DosListPtr=POINTER TO DosList;
  46.   DosPacketPtr=POINTER TO DosPacket;
  47.   ErrorStringPtr=POINTER TO ErrorString;
  48.   ExAllControlPtr=POINTER TO ExAllControl;
  49.   ExAllDataPtr=POINTER TO ExAllData;
  50.   FileHandlePtr=BPOINTER TO FileHandle;
  51.   FileInfoBlockPtr=POINTER TO FileInfoBlock;
  52.   FileLockPtr=BPOINTER TO FileLock;
  53.   FileSysStartupMsgPtr=BPOINTER TO FileSysStartupMsg;
  54.   InfoDataPtr=POINTER TO InfoData;
  55.   LocalVarPtr=POINTER TO LocalVar;
  56.   NotifyMsgPtr=POINTER TO NotifyMessage;
  57.   NotifyRequestPtr=POINTER TO NotifyRequest;
  58.   PathLockPtr=BPOINTER TO PathLock;
  59.   ProcessPtr=POINTER TO Process;
  60.   RDArgsPtr=POINTER TO RDArgs;
  61.   RecordLockPtr=POINTER TO RecordLock;
  62.   SegmentPtr=POINTER TO Segment;
  63.   RootNodePtr=POINTER TO RootNode;
  64.   StandardPacketPtr=POINTER TO StandardPacket;
  65.   TaskArrayAPtr=POINTER TO TaskArray;
  66.   TaskArrayPtr=BPOINTER TO TaskArray;
  67.   ProcessId=MsgPortPtr;
  68.  
  69. CONST
  70.  dosName="dos.library";
  71.  
  72.   oldFile  =1005;  (* Open existing file read/write
  73.                     * positioned at beginning of file. *)
  74.   newFile  =1006;  (* Open freshly created file (delete
  75.                     * old file) read/write, exclusive lock. *)
  76.   readWrite=1004;  (* Open old file w/shared lock,
  77.                     * creates file if doesn't exist. *)
  78.  
  79. (* Relative position to Seek() *)
  80.   beginning  =-1;      (* relative to Begining Of File *)
  81.   current    = 0;      (* relative to Current file position *)
  82.   end        = 1;      (* relative to End Of File    *)
  83.  
  84.   bitsPerByte  =8;
  85.   bytesPerLong =4;
  86.   bitsPerLong  =32;
  87.   maxInt       =7FFFFFFFH;
  88.   minInt       =80000000H;
  89.  
  90. (* Passed as type to Lock() *)
  91.   sharedLock    =-2;    (* File is readable by others *)
  92.   accessRead    =-2;    (* Synonym *)
  93.   exclusiveLock =-1;    (* No other access allowed    *)
  94.   accessWrite   =-1;    (* Synonym *)
  95.  
  96. TYPE
  97.   Date=RECORD
  98.     days:LONGINT;          (* Number of days since Jan. 1, 1978 *)
  99.     minute:LONGINT;        (* Number of minutes past midnight *)
  100.     tick:LONGINT;          (* Number of ticks past minute *)
  101.   END;
  102.  
  103. CONST
  104.   ticksPerSecond=50;       (* Number of ticks in one second *)
  105.  
  106.  
  107. TYPE
  108.  
  109. (* FIB stands for FileInfoBlock *)
  110.  
  111. (* FIBB are bit definitions, FIBF are field definitions *)
  112. (* Regular RWED bits are 0 == allowed. *)
  113. (* NOTE: GRP and OTR RWED permissions are 0 == not allowed! *)
  114. (* Group and Other permissions are not directly handled by the filesystem *)
  115.  
  116.   ProtectionMask = (
  117.     delete,     (* prevent file from being deleted *)
  118.     execute,    (* ignored by system, used by Shell *)
  119.     writeProt,  (* ignored by old filesystem *)
  120.     readProt,   (* ignored by old filesystem *)
  121.     archive,    (* cleared whenever file is changed *)
  122.     pure,       (* program is reentrant and rexecutable *)
  123.     script,     (* program is a script (execute) file *)
  124.     pm7,
  125.     grpDelete,  (* Group: prevent file from being deleted *)
  126.     grpExecute, (* Group: file is executable *)
  127.     grpWrite,   (* Group: file is writable *)
  128.     grpRead,    (* Group: file is readable *)
  129.     otrDelete,  (* Other: prevent file from being deleted *)
  130.     otrExecute, (* Other: file is executable *)
  131.     otrWrite,   (* Other: file is writable *)
  132.     otrRead,    (* Other: file is readable *)
  133.     pm16,pm17,pm18,pm19,pm20,pm21,pm22,pm23,pm24,pm25,
  134.     pm26,pm27,pm28,pm29,pm30,pm31);
  135.  
  136.   ProtectionMaskSet=SET OF ProtectionMask;
  137.  
  138. (* Returned by Examine() and ExNext(), must be on a 4 byte boundary *)
  139.   FileInfoBlock=RECORD
  140.     diskKey:LONGINT;
  141.     dirEntryType:LONGINT;           (* Type of Directory. If < 0, then a plain file.
  142.                                      * If > 0 a directory *)
  143.     fileName:ARRAY[0..107] OF CHAR; (* Null terminated. Max 30 chars used for now *)
  144.     protection:ProtectionMaskSet;   (* bit mask of protection, rwxd are 3-0.      *)
  145.     entryType:LONGINT;
  146.     size:LONGINT;                   (* Number of bytes in file *)
  147.     numBlock:LONGINT;               (* Number of blocks in file *)
  148.     date:Date;                      (* Date file last changed *)
  149.     comment:ARRAY[0..79] OF CHAR;   (* Null terminated comment associated with file *)
  150.  
  151.    (* Note: the following fields are not supported by all filesystems.        *)
  152.    (* They should be initialized to 0 sending an ACTION_EXAMINE packet.       *)
  153.    (* When Examine() is called, these are set to 0 for you.           *)
  154.    (* AllocDosObject() also initializes them to 0.                    *)
  155.     ownerUID:INTEGER;            (* owner's UID *)
  156.     ownerGID:INTEGER;            (* owner's GID *)
  157.  
  158.     reserved:ARRAY[0..31] OF CHAR;
  159.   END;
  160.  
  161. CONST
  162. (* Standard maximum length for an error string from fault.  However, most *)
  163. (* error strings should be kept under 60 characters if possible.  Don't   *)
  164. (* forget space for the header you pass in. *)
  165.   faultMax=82;
  166.  
  167. TYPE
  168. (* returned by Info(), must be on a 4 byte boundary *)
  169.   InfoData=RECORD
  170.     numSoftErrors : LONGINT;   (* number of soft errors on disk *)
  171.     unitNumber    : LONGINT;   (* Which unit disk is (was) mounted on *)
  172.     diskState     : LONGINT;   (* See defines below *)
  173.     numBlocks     : LONGINT;   (* Number of blocks on disk *)
  174.     numBlocksUsed : LONGINT;   (* Number of block in use *)
  175.     bytesPerBlock : LONGINT;
  176.     diskType      : LONGINT;   (* Disk Type code *)
  177.     volumeNode    : DeviceListPtr; (* BCPL pointer to volume node *)
  178.     inUse         : LONGINT;   (* Flag, zero if not in use *)
  179.   END;
  180.  
  181. CONST
  182.  
  183. (* InfoData.diskState *)
  184.   writeProtect = 80;    (* Disk is write protected *)
  185.   validating   = 81;    (* Disk is currently being validated *)
  186.   validated    = 82;    (* Disk is consistent and writeable *)
  187.  
  188. (* InfoData.diskType *)
  189. (* Any other new filesystems should also, if possible. *)
  190.   noDiskPresent        = -1;
  191.   unreadableDisk       = CAST(LONGINT,'BAD\o');
  192.   dosDisk              = CAST(LONGINT,'DOS\o');
  193.   ffsDisk              = CAST(LONGINT,'DOS\x01');
  194.   interDosDisk         = CAST(LONGINT,'DOS\x02');
  195.   interFFSDisk         = CAST(LONGINT,'DOS\x03');
  196.   fastDirDosDisk       = CAST(LONGINT,'DOS\x04');
  197.   fastDirFFSDisk       = CAST(LONGINT,'DOS\x05');
  198.   notReallyDos         = CAST(LONGINT,'NDOS' );
  199.   kickStartDisk        = CAST(LONGINT,'KICK' );
  200.   msdosDisk            = CAST(LONGINT,'MSD\o');
  201.  
  202. (* Errors from IoErr(), etc. *)
  203.   noFreeStore                = 103;
  204.   taskTableFull              = 105;
  205.   badTemplate                = 114;
  206.   badNumber                  = 115;
  207.   requiredArgMissing         = 116;
  208.   keyNeedsArg                = 117;
  209.   tooManyArgs                = 118;
  210.   unmatchedQuotes            = 119;
  211.   lineTooLong                = 120;
  212.   fileNotObject              = 121;
  213.   invalidResidentLibrary     = 122;
  214.   noDefaultDir               = 201;
  215.   objectInUse                = 202;
  216.   objectExists               = 203;
  217.   dirNotFound                = 204;
  218.   objectNotFound             = 205;
  219.   badStreamName              = 206;
  220.   objectTooLarge             = 207;
  221.   actionNotKnown             = 209;
  222.   invalidComponentName       = 210;
  223.   invalidLock                = 211;
  224.   objectWrongType            = 212;
  225.   diskNotValidated           = 213;
  226.   diskWriteProtected         = 214;
  227.   renameAcrossDevices        = 215;
  228.   directoryNotEmpty          = 216;
  229.   tooManyLevels              = 217;
  230.   deviceNotMounted           = 218;
  231.   seekError                  = 219;
  232.   commentTooBig              = 220;
  233.   diskFull                   = 221;
  234.   deleteProtected            = 222;
  235.   writeProtected             = 223;
  236.   readProtected              = 224;
  237.   notADosDisk                = 225;
  238.   noDisk                     = 226;
  239.   noMoreEntries              = 232;
  240. (* added for 1.4 *)
  241.   isSoftLink                 = 233;
  242.   objectLinked               = 234;
  243.   badHunk                    = 235;
  244.   notImplemented             = 236;
  245.   recordNotLocked            = 240;
  246.   lockCollision              = 241;
  247.   lockTimeOut                = 242;
  248.   unLockError                = 243;
  249.  
  250. (* These are the return codes used by convention by AmigaDOS commands *)
  251. (* See FAILAT and IF for relvance to EXECUTE files                    *)
  252.   ok    =  0; (* No problems, success *)
  253.   warn  =  5; (* A warning only *)
  254.   error = 10; (* Something wrong *)
  255.   fail  = 20; (* Complete or severe failure*)
  256.  
  257. (* Bit numbers that signal you that a user has issued a break *)
  258.   ctrlC = 12;
  259.   ctrlD = 13;
  260.   ctrlE = 14;
  261.   ctrlF = 15;
  262.  
  263. (* Values returned by SameLock() *)
  264.   same        = 0;
  265.   sameHandler = 1;      (* actually same volume *)
  266.   different   =-1;
  267.  
  268. (* types for ChangeMode() *)
  269.   changeLock  = 0;
  270.   changeFH    = 1;
  271.  
  272. (* Values for MakeLink() *)
  273.   hard = 0;
  274.   soft = 1; (* softlinks are not fully supported yet *)
  275.  
  276. (* values returned by ReadItem *)
  277.   equal      = -2;    (* "=" Symbol *)
  278.   itemError  = -1;    (* error *)
  279.   nothing    =  0;    (* *N, ;, endstreamch *)
  280.   unQuoted   =  1;    (* unquoted item *)
  281.   quoted     =  2;    (* quoted item *)
  282.  
  283. (* types for AllocDosObject/FreeDosObject *)
  284.   fileHandle    = 0;      (* few people should use this *)
  285.   exAllControl  = 1;      (* Must be used to allocate this! *)
  286.   fib           = 2;      (* useful *)
  287.   stdpkt        = 3;      (* for doing packet-level I/O *)
  288.   cli           = 4;      (* for shell-writers, etc *)
  289.   rdArgs        = 5;      (* for ReadArgs if you pass it in *)
  290.  
  291. TYPE
  292.  DateFormat=(
  293.     formatDOS,    (* dd-mmm-yy *)
  294.     formatINT,    (* yy-mm-dd  *)
  295.     formatUSA,    (* mm-dd-yy  *)
  296.     formatCDN     (* dd-mm-yy  *)
  297.  );
  298.  
  299. CONST
  300.  formatMAX=MAX(DateFormat);
  301.  lenDatString=16;
  302.  
  303. TYPE
  304.  DateTimeFlags=(subst,future,dtf2,dtf3,dtf4,dtf5,dtf6,dtf7);
  305.  DateTimeFlagSet=SET OF DateTimeFlags;
  306.  
  307.  DateTime = RECORD
  308.   date    : Date;             (* DOS Date *)
  309.   format  : DateFormat;       (* controls appearance of dat_StrDate *)
  310.   flags   : DateTimeFlagSet;  (* see BITDEF's below *)
  311.   strDay  : StrPtr;           (* day of the week string *)
  312.   strDate : StrPtr;           (* date string *)
  313.   strTime : StrPtr;           (* time string *)                        
  314.  END;
  315.  
  316.  
  317. (***********************************************************************
  318. ************************ PATTERN MATCHING ******************************
  319. ************************************************************************
  320.  
  321. * structure expected by MatchFirst, MatchNext.
  322. * Allocate this structure and initialize it as follows:
  323. *
  324. * Set ap_BreakBits to the signal bits (CDEF) that you want to take a
  325. * break on, or NULL, if you don't want to convenience the user.
  326. *
  327. * If you want to have the FULL PATH NAME of the files you found,
  328. * allocate a buffer at the END of this structure, and put the size of
  329. * it into ap_Length.  If you don't want the full path name, make sure
  330. * you set ap_Length to zero.  In this case, the name of the file, and stats
  331. * are available in the ap_Info, as per usual.
  332. *
  333. * Then call MatchFirst() and then afterwards, MatchNext() with this structure.
  334. * You should check the return value each time (see below) and take the
  335. * appropriate action, ultimately calling MatchEnd() when there are
  336. * no more files and you are done.  You can tell when you are done by
  337. * checking for the normal AmigaDOS return code ERROR_NO_MORE_ENTRIES.
  338. *
  339. *)
  340.  
  341. TYPE
  342.  AnchorPathFlags=( 
  343.   doWild,     (* User option ALL *)
  344.   itsWild,    (* Set by MatchFirst, used by MatchNext *)
  345.               (* Application can test itsWild, too *)
  346.   doDir,      (* Bit is SET if a DIR node should be *)
  347.               (* entered. Application can RESET this *)
  348.               (* bit after MatchFirst/MatchNext to AVOID *)
  349.               (* entering a dir. *)
  350.   didDir,     (* Bit is SET for an "expired" dir node. *)
  351.   noMemErr,   (* Set on memory error *)
  352.   doDot,      (* If set, allow conversion of '.' to *)
  353.               (* CurrentDir *)
  354.   dirChanged  (* ap_Current->an_Lock changed *)
  355.               (* since last MatchNext call *)
  356. );
  357. AnchorPathFlagSet=SET OF AnchorPathFlags;
  358.  
  359.  AnchorPath=RECORD
  360.   base,                          (* pointer to first anchor *)
  361.   last:AChainPtr;                (* pointer to last anchor *)
  362.   breakBits:LONGSET;             (* Bits we want to break on *)
  363.   foundBreak:LONGSET;            (* Bits we broke on. Also returns ERROR_BREAK *)
  364.   flags:AnchorPathFlagSet;       (* New use for extra word. *)                    
  365.   reserved:SHORTINT;
  366.   strLen:INTEGER;                (* This is what ap_Length used to be *)
  367.   info:FileInfoBlock;
  368.   (*ARRAY[0..strLen-1] OF CHAR*) (* Buffer for path name, allocated by user *)
  369.  END;
  370.  
  371.  AChainFlags=(
  372.   patternBit,examinedBit,completed,allBit,single,acf5,acf6,acf7
  373.  );
  374.  AChainFlagSet=SET OF AChainFlags;
  375.  
  376.   AChain = RECORD
  377.         child  : AChainPtr;
  378.         parent : AChainPtr;
  379.         lock   : FileLockPtr;
  380.         info   : FileInfoBlock;
  381.         flags  : AChainFlagSet;
  382.         (*string : SIZE ?? UBYTE an_String[1];    (* FIX!! *) *);
  383.   END;
  384.  
  385. CONST
  386. (*
  387.  * Constants used by wildcard routines, these are the pre-parsed tokens
  388.  * referred to by pattern match.  It is not necessary for you to do
  389.  * anything about these, MatchFirst() MatchNext() handle all these for you.
  390.  *)
  391.  
  392.   pAny           = 80H;    (* Token for '*' or '#?  *)
  393.   pSingle        = 81H;    (* Token for '?' *)
  394.   pOrStart       = 82H;    (* Token for '(' *)
  395.   pOrNext        = 83H;    (* Token for '|' *)
  396.   pOrEnd         = 84H;    (* Token for ')' *)
  397.   pNot           = 85H;    (* Token for '~' *)
  398.   pNotEnd        = 86H;    (* Token for *)
  399.   pNotClass      = 87H;    (* Token for '^' *)
  400.   pClass         = 88H;    (* Token for '[]' *)
  401.   pRepBeg        = 89H;    (* Token for '[' *)
  402.   pRepEnd        = 8AH;    (* Token for ']' *)
  403.   pStop          = 8BH;    (* Token to force end of evaluation *)
  404.  
  405. (* Values for an_Status, NOTE: These are the actual bit numbers *)
  406.  
  407.   complexBit   = 1;       (* Parsing complex pattern *)
  408.   examineBit   = 2;       (* Searching directory *)
  409.  
  410. (*
  411.  * Returns from MatchFirst(), MatchNext()
  412.  * You can also get dos error returns, such as ERROR_NO_MORE_ENTRIES,
  413.  * these are in the dos.h file.
  414.  *)
  415.  
  416.   bufferOverflow = 303;     (* User or internal buffer overflow *)
  417.   break          = 304;     (* A break character was received *)
  418.   notExecutable  = 305;     (* A file has E bit cleared *)
  419.  
  420.  
  421. TYPE
  422.  ProcessFlags=(
  423.   freeSegList,freeCurrDir,freeCLI,closeInput,closeOutput,freeArgs,
  424.   pr6,pr7,pr8,pr9,pr10,pr11,pr12,pr13,pr14,pr15,pr16
  425.  );
  426.  ProcessFlagSet=SET OF ProcessFlags;
  427.  
  428. (* All DOS processes have this structure *)
  429. (* Create and Device Proc returns pointer to the MsgPort in this structure *)
  430. (* dev_proc = (struct Process * ) (DeviceProc(..) - sizeof(struct Task)); *)
  431.  
  432.  Process=RECORD
  433.   task:Task;                    
  434.   msgPort:MsgPort;          (* This is BPTR address from DOS functions  *)
  435.   pad:WORD;                 (* Remaining variables on 4 byte boundaries *)
  436.   segList:BPTR;             (* Array of seg lists used by this process  *)
  437.   stackSize:LONGINT;        (* Size of process stack in bytes           *)
  438.   globVec:ADDRESS;          (* Global vector for this process (BCPL)    *)
  439.   taskNum:LONGINT;          (* CLI task number of zero if not a CLI     *)
  440.   stackBase:BPTR;           (* Ptr to high memory end of process stack  *)
  441.   result2:LONGINT;          (* Value of secondary result from last call *)
  442.   currentDir:FileLockPtr;   (* Lock associated with current directory   *)
  443.   cis:FileHandlePtr;        (* Current CLI Input Stream                 *)
  444.   cos:FileHandlePtr;        (* Current CLI Output Stream                *)
  445.   consoleTask:ProcessId;    (* Console handler process for current window*)
  446.   fileSystemTask:ProcessId; (* File handler process for current drive   *)
  447.   cli:CommandLineInterfacePtr;(* pointer to CommandLineInterface          *)
  448.   returnAddr:ADDRESS;       (* pointer to previous stack frame          *)
  449.   pktWait:ADDRESS;          (* Function to be called when awaiting msg  *)
  450.   windowPtr:ADDRESS;        (* Window for error printing                *)                       
  451.  
  452.   (* following definitions are new with 2.0 *)
  453.   homeDir: FileLockPtr;     (* Home directory of executing program      *)
  454.   flags:ProcessFlagSet;     (* flags telling dos about process          *)
  455.   exitCode:PROC;            (* code to call on exit of program or NULL  *)
  456.   exitData:ADDRESS;         (* Passed as an argument to pr_ExitCode.    *)
  457.   arguments:StrPtr;         (* Arguments passed to the process at start *)
  458.   localVars:MinList;        (* Local environment variables             *)
  459.   shellPrivate:LONGCARD     (* for the use of the current shell         *);
  460.   ces:FileHandlePtr;        (* Error stream - if NULL, use pr_COS       *)      
  461.  END;
  462.  
  463. (* The long word address (BPTR) of this structure is returned by
  464.  * Open() and other routines that return a file.  You need only worry
  465.  * about this struct to do async io's via PutMsg() instead of
  466.  * standard file system calls *)
  467.  
  468.  FileHandle=RECORD
  469.   link:MessagePtr;    (* EXEC message              *)
  470.   port:MsgPortPtr;    (* Reply port for the packet *)
  471.   type:ProcessId;     (* Port to do PutMsg() to
  472.                        * Address is negative if a plain file *)
  473.   buf:LONGINT;
  474.   pos:LONGINT;
  475.   end:LONGINT;
  476.   func1:LONGINT;
  477.   func2:LONGINT;
  478.   func3:LONGINT;
  479.   arg1:LONGINT;
  480.   arg2:LONGINT;
  481.  END;
  482.  
  483. (* This is the extension to EXEC Messages used by DOS *)
  484.  DosPacket=RECORD
  485.   link:MessagePtr;    (* EXEC message              *)
  486.   port:MsgPortPtr;    (* Reply port for the packet *)
  487.                       (* Must be filled in each send. *)
  488.   type:LONGINT;       (* See ACTION_... below and
  489.                        * 'R' means Read, 'W' means Write to the
  490.                        * file system *)                     
  491.   res1:LONGINT;       (* For file system calls this is the result    (* status *)
  492.                        * that would have been returned by the
  493.                        * function, e.g. Write ('W') returns actual
  494.                        * length written *)
  495.   res2:LONGINT;       (* For file system calls this is what would 
  496.                        * have been returned by IoErr() *)
  497.   arg1:LONGINT;
  498.   arg2:LONGINT;
  499.   arg3:LONGINT;
  500.   arg4:LONGINT;
  501.   arg5:LONGINT;
  502.   arg6:LONGINT;
  503.   arg7:LONGINT;
  504.  END;
  505.  
  506. (* A Packet does not require the Message to be before it in memory, but
  507.  * for convenience it is useful to associate the two.
  508.  * Also see the function init_std_pkt for initializing this structure *)
  509.  
  510.  StandardPacket=RECORD
  511.   msg:Message;
  512.   pkt:DosPacket;
  513.  END;
  514.  
  515. CONST
  516. (* Packet types *)
  517.   nil              = 0;
  518.   startup          = 0;
  519.   getBlock         = 2;       (* OBSOLETE *)
  520.   setMap           = 4;
  521.   die              = 5;
  522.   event            = 6;
  523.   currentVolume    = 7;
  524.   locateObject     = 8;
  525.   renameDisk       = 9;
  526.   write            = ORD('W');
  527.   read             = ORD('R');
  528.   freeLock         = 15;
  529.   deleteObject     = 16;
  530.   renameObject     = 17;
  531.   moreCache        = 18;
  532.   copyDir          = 19;
  533.   waitChar         = 20;
  534.   setProtect       = 21;
  535.   createDir        = 22;
  536.   examineObject    = 23;
  537.   examineNext      = 24;
  538.   diskInfo         = 25;
  539.   info             = 26;
  540.   flush            = 27;
  541.   setComment       = 28;
  542.   parent           = 29;
  543.   timer            = 30;
  544.   inhibit          = 31;
  545.   diskType         = 32;
  546.   diskChange       = 33;
  547.   setDate          = 34;
  548.  
  549.   screenMode       = 994;
  550.  
  551.   readReturn       = 1001;
  552.   writeReturn      = 1002;
  553.   seek             = 1008;
  554.   findUpdate       = 1004;
  555.   findInput        = 1005;
  556.   findOutput       = 1006;
  557.   actionEnd        = 1007;
  558.   setFileSize      = 1022;    (* fast file system only in 1.3 *)
  559.   writeprotect     = 1023;    (* fast file system only in 1.3 *)
  560.  
  561. (* new 2.0 packets *)
  562.   sameLock         = 40;
  563.   changeSignal     = 995;
  564.   format           = 1020;
  565.   makeLink         = 1021;
  566.   (**)
  567.   (**)
  568.   readLink         = 1024;
  569.   fhFromLock       = 1026;
  570.   isFileSystem     = 1027;
  571.   changeMode       = 1028;
  572.   (**)
  573.   copyDirFH        = 1030;
  574.   parentFH         = 1031;
  575.   examineAll       = 1033;
  576.   examineFH        = 1034;
  577.  
  578.   lockRecord       = 2008;
  579.   freeRecord       = 2009;
  580.  
  581.   addNotify        = 4097;
  582.   removeNotify     = 4098;
  583.  
  584. (* Added in V39: *)
  585.   examineAllEnd    = 1035;
  586.   setOwner         = 1036;
  587.  
  588. TYPE
  589. (*
  590.  * A structure for holding error messages - stored as array with error == 0
  591.  * for the last entry.
  592.  *)
  593.  
  594.  ErrorString=RECORD
  595.   nums: ADDRESS;
  596.   strings:ADDRESS;
  597.  END;
  598.  
  599. (* DOS library node structure.
  600.  * This is the data at positive offsets from the library node.
  601.  * Negative offsets from the node is the jump table to DOS functions
  602.  * node = (struct DosLibrary * ) OpenLibrary( "dos.library" .. )      *)
  603.  
  604.  DosLibrary=RECORD
  605.   lib:Library;
  606.   root:RootNodePtr;   (* Pointer to RootNode, described below *)
  607.   gv:ADDRESS;         (* Pointer to BCPL global vector        *)
  608.   a2:LONGINT;         (* Private register dump of DOS         *)
  609.   a5:LONGINT;
  610.   a6:LONGINT;
  611.   errors:ErrorStringPtr;    (* pointer to array of error msgs *)
  612.   timeReq:TimeRequestPtr;   (* private pointer to timer request *)
  613.   utilityBase:LibraryPtr;   (* private ptr to utility library *)  
  614.   intuitionBase:LibraryPtr; (* private ptr to intuition library *)
  615.  END;
  616.  
  617.  RootNodeFlags=(
  618.   rnf0,private1,rnf2,rnf3,rnf4,rnf5,rnf6,rnf7
  619.   ,rnf8,rnf9,rnf10,rnf11,rnf12,rnf13,rnf14,rnf15
  620.   ,rnf16,rnf17,rnf18,rnf19,rnf20,rnf21,rnf22,rnf23
  621.   ,wildStar,rnf25,rnf26,rnf27,rnf28,rnf29,rnf30,rnf31
  622.  );
  623.  RootNodeFlagSet=SET OF RootNodeFlags;
  624.  
  625.  RootNode=RECORD
  626.   taskArray:TaskArrayPtr; (* [0] is max number of CLI's
  627.                            * [1] is APTR to process id of CLI 1
  628.                            * [n] is APTR to process id of CLI n *)
  629.   consoleSegment:SegmentPtr;  (* SegList for the CLI                      *)
  630.   time:Date;                  (* Current time                             *)
  631.   restartSeg:BPTR;            (* SegList for the disk validator process   *)
  632.   info:DosInfoPtr;            (* Pointer to the Info structure            *)
  633.   fileHandlerSegment:SegmentPtr;  (* segment for a file handler           *)
  634.   cliList:MinList;            (* new list of all CLI processes *)               
  635.                               (* the first cpl_Array is also rn_TaskArray *)
  636.   bootProc:ProcessId;         (* private ptr to msgport of boot fs      *)
  637.   shellSegment:SegmentPtr;    (* seglist for Shell (for NewShell)         *)
  638.   flags:RootNodeFlagSet;     (* dos flags *)
  639.  END;
  640.  
  641.  TaskArray=RECORD
  642.   maxCli:LONGINT; (* max number of CLI's in this entry (n) *)
  643.   cli:ARRAY [1..99] OF ProcessId; (* CPTR to process id of CLI *)
  644.  END;
  645.  
  646.  CliProcList=RECORD
  647.   node:MinNode;
  648.   first:LONGINT;        (* number of first entry in array *)
  649.   array:TaskArrayAPtr;
  650.  END;
  651.  
  652.  DosInfo=RECORD
  653.   mcName:BPTR;          (* PRIVATE: system resident module list         *)
  654.   devInfo:DeviceListPtr;(* Device List                               *)
  655.   devices:BPTR;         (* Currently zero                            *)
  656.   handlers:BPTR;        (* Currently zero                            *)
  657.   netHand:ProcessId;    (* Network handler processid; currently zero *)
  658.   devLock:SignalSemaphore;      (* do NOT access directly! *)
  659.   entryLock:SignalSemaphore;    (* do NOT access directly! *)
  660.   deleteLock:SignalSemaphore;   (* do NOT access directly! *)
  661.  END;
  662.  
  663.  
  664. (* structure for the Dos resident list.  Do NOT allocate these, use       *)
  665. (* AddSegment(), and heed the warnings in the autodocs!                   *)
  666.  
  667.  Segment=RECORD
  668.   next:BPTR;
  669.   uc:LONGINT;
  670.   seg:BPTR;
  671.   name:ARRAY[0..3] OF CHAR; (* actually the first 4 chars of BSTR name *)
  672.  END;
  673.  
  674. CONST
  675.  
  676.   cmdSystem   = -1;
  677.   cmdInternal = -2;
  678.   cmdDisabled = -999;
  679.  
  680. (* DOS Processes started from the CLI via RUN or NEWCLI have this additional
  681.  * set to data associated with them *)
  682.  
  683. TYPE
  684.   PathLock = RECORD
  685.     next:PathLockPtr;
  686.     lock:FileLockPtr;
  687.   END;
  688.  
  689.  
  690.  CommandLineInterface=RECORD
  691.   result2:LONGINT;            (* Value of IoErr from last command        *)
  692.   setName:BSTR;               (* Name of current directory               *)
  693.   commandDir:PathLockPtr;     (* Head of the path locklist               *)
  694.   returnCode:LONGINT;         (* Return code from last command           *)
  695.   commandName:BSTR;           (* Name of current command                 *)
  696.   failLevel:LONGINT;          (* Fail level (set by FAILAT)              *)  
  697.   prompt:BSTR;                (* Current prompt (set by PROMPT)          *)    
  698.   standardInput:FileHandlePtr;(* Default (terminal) CLI input            *)      
  699.   currentInput:FileHandlePtr; (* Current CLI input                       *)    
  700.   commandFile:BSTR;           (* Name of EXECUTE command file            *)  
  701.   interactive:LONGINT;        (* Boolean; True if prompts required       *)    
  702.   background:LONGINT;         (* Boolean; True if CLI created by RUN     *)      
  703.   currentOutput:FileHandlePtr;(* Current CLI output                      *)      
  704.   defaultStack:LONGINT;       (* Stack size to be obtained in long words *)        
  705.   standardOutput:FileHandlePtr(* Default (terminal) CLI output           *);       
  706.   module:BPTR;                (* SegList of currently loaded command     *)      
  707.  END;
  708.  
  709. (* This structure can take on different values depending on whether it is
  710.  * a device, an assigned directory, or a volume.  Below is the structure
  711.  * reflecting volumes only.  Following that is the structure representing
  712.  * only devices. Following that is the unioned structure representing all
  713.  * the values
  714.  *)
  715.  
  716.  (* Combined structure of DeviceList, Doslist and DevInfo *)
  717.  
  718.  DeviceListType=(device,directory,volume,late,nonBinding);
  719.  DeviceList=RECORD
  720.   next:DeviceListPtr;   (* bptr to next device list *)
  721.   pad1,pad2,pad3:BYTE;  (* pad Bytes for padding to LONGINT *)
  722.   type:DeviceListType;  (* See above *)
  723.   task:ProcessId;       (* ptr to handler task *)
  724.   lock:FileLockPtr;     (* not for volumes *)          
  725.   CASE :DeviceListType OF
  726.   | device:                       
  727.    handler:BSTR;                  (* file name to load if seglist is null *)
  728.    stackSize:LONGINT;             (* stacksize to use when starting process *)
  729.    priority:LONGINT;              (* task priority when starting process *)
  730.    startup:FileSysStartupMsgPtr;  (* startup msg: FileSysStartupMsg for disks *)
  731.    segList:BPTR;                  (* already loaded code for new task *)
  732.    globVec:BPTR;                  (* BCPL global vector to use when starting      
  733.                                    * a process. -1 indicates a C/Assembler
  734.                                    * program. *)
  735.   | volume:
  736.    volumeDate:Date;               (* creation date *)
  737.    lockList:FileLockPtr;          (* outstanding locks *)
  738.    diskType:LONGINT;              (* 'DOS', etc *)               
  739.    unused:LONGINT
  740.   | directory,late,nonBinding:
  741.    assignName:ADDRESS;            (* name for non-or-late-binding assign *)
  742.    list:AssignListPtr;            (* for multi-directory assigns (regular) *)
  743.   END;
  744.   name:BSTR;
  745.  END;
  746.  DosList    = DeviceList;
  747.  DeviceNode = DeviceList;
  748.  
  749. (* structure used for multi-directory assigns. AllocVec()ed. *)
  750.  
  751.  AssignList=RECORD
  752.   next:AssignListPtr;
  753.   lock:FileLockPtr;
  754.  END;
  755.  
  756.  DevProcFlags=(
  757.   unlock,assign,dpf2,dpf3,dpf4,dpf5,dpf6,dpf7
  758.   ,dpf8,dpf9,dpf10,dpf11,dpf12,dpf13,dpf14,dpf15
  759.   ,dpf16,dpf17,dpf18,dpf19,dpf20,dpf21,dpf22,dpf23
  760.   ,dpf24,dpf25,dpf26,dpf27,dpf28,dpf29,dpf30,dpf31
  761.  );
  762.  DevProcFlagSet=SET OF DevProcFlags;
  763.  
  764.  DevProc=RECORD
  765.   port:MsgPortPtr;
  766.   lock:FileLockPtr;
  767.   flags:DevProcFlagSet;
  768.   devNode:DosListPtr; (* DON'T TOUCH OR USE! *)
  769.  END;
  770.  
  771.  LockDosFlags=(
  772.   ldbRead,ldbWrite,devices,volumes,assigns,entry,ldbDelete,ldb7
  773.   ,ldb8,ldb9,ldb10,ldb11,ldb12,ldb13,ldb14,ldb15
  774.   ,ldb16,ldb17,ldb18,ldb19,ldb20,ldb21,ldb22,ldb23
  775.   ,ldb24,ldb25,ldb26,ldb27,ldb28,ldb29,ldb30,ldb31
  776.  );
  777.  LockDosFlagSet=SET OF LockDosFlags;
  778.  
  779. CONST
  780. (* actually all but entry (which is used for internal locking) *)
  781.  ldAll=LockDosFlagSet{devices,volumes,assigns};
  782.  
  783. TYPE
  784.  FileLock=RECORD
  785.   link:FileLockPtr;       (* bcpl pointer to next lock *)
  786.   key:LONGINT;            (* disk block number *)
  787.   access:LONGINT;         (* exclusive or shared *)
  788.   task:ProcessId;         (* handler task's port *)
  789.   volume:DeviceListPtr;   (* bptr to DLT_VOLUME DosList entry *) 
  790.  END;
  791.  
  792. CONST
  793. (* error report types for ErrorReport() *)
  794.   reportStream = 0;      (* a stream *)
  795.   reportTask   = 1;      (* a process - unused *)
  796.   reportLock   = 2;      (* a lock *)
  797.   reportVolume = 3;      (* a volume node *)
  798.   reportInsert = 4;      (* please insert volume *)
  799.  
  800. (* Special error codes for ErrorReport() *)
  801.   diskError  = 296;     (* Read/write error *)
  802.   abortBusy  = 288;     (* You MUST replace... *)
  803.  
  804. (* types for initial packets to shells from run/newcli/execute/system. *)
  805. (* For shell-writers only *)
  806.   runExecute         = -1;
  807.   runSystem          = -2;
  808.   runSystemAsynch    = -3;
  809.  
  810. (* Types for FileInfoBlock.dirEntryType. NOTE that both USERDIR and ROOT are  *)
  811. (* directories, and that directory/file checks should use <0 and >=0.    *)
  812. (* This is not necessarily exhaustive!  Some handlers may use other      *)
  813. (* values as needed, though <0 and >=0 should remain as supported as     *)
  814. (* possible.                                                             *)
  815.   root       = 1;
  816.   userDir    = 2;
  817.   softLink   = 3;       (* looks like dir, but may point to a file! *)
  818.   linkDir    = 4;       (* hard link to dir *)
  819.   file       = -3;      (* must be negative for FIB! *)
  820.   linkFile   = -4;      (* hard link to file *)
  821.  
  822.  
  823. (* hunk types *)
  824.   hunkUnit       = 999;
  825.   hunkName       = 1000;
  826.   hunkCode       = 1001;
  827.   hunkData       = 1002;
  828.   hunkBSS        = 1003;
  829.   hunkReloc32    = 1004;
  830.   hunkAbsReloc32 = hunkReloc32;
  831.   hunkReloc16    = 1005;
  832.   hunkRelReloc16 = hunkReloc16;
  833.   hunkReloc8     = 1006;
  834.   hunkRelReloc8  = hunkReloc8;
  835.   hunkExt        = 1007;
  836.   hunkSymbol     = 1008;
  837.   hunkDebug      = 1009;
  838.   hunkEnd        = 1010;
  839.   hunkHeader     = 1011;
  840.  
  841.   hunkOverlay    = 1013;
  842.   hunkBreak      = 1014;
  843.  
  844.   hunkDRel32     = 1015;
  845.   hunkDRel16     = 1016;
  846.   hunkDRel8      = 1017;
  847.  
  848.   hunkLib        = 1018;
  849.   hunkIndex      = 1019;
  850.  
  851. (*
  852.  * Note: V37 LoadSeg uses 1015 (HUNK_DREL32) by mistake.  This will continue
  853.  * to be supported in future versions, since HUNK_DREL32 is illegal in load files
  854.  * anyways.  Future versions will support both 1015 and 1020, though anything
  855.  * that should be usable under V37 should use 1015.
  856.  *)
  857.   hunkReloc32Short = 1020;
  858.  
  859. (* see ext_xxx below.  New for V39 (note that LoadSeg only handles RELRELOC32).*)
  860.   hunkRelReloc32   = 1021;
  861.   hunkAbsReloc16   = 1022;
  862.  
  863. (*
  864.  * Any hunks that have the HUNKB_ADVISORY bit set will be ignored if they
  865.  * aren't understood.  When ignored, they're treated like HUNK_DEBUG hunks.
  866.  * NOTE: this handling of HUNKB_ADVISORY started as of V39 dos.library!  If
  867.  * lading such executables is attempted under <V39 dos, it will fail with a
  868.  * bad hunk type.
  869.  *)
  870.   hunkBAdvisory    = 29;
  871.   hunkBChip        = 30;
  872.   hunkBFast        = 31;
  873.  
  874.  
  875. (* hunk_ext sub-types *)
  876.   extSymb        = 0;       (* symbol table *)
  877.   extDef         = 1;       (* relocatable definition *)
  878.   extAbs         = 2;       (* Absolute definition *)
  879.   extRes         = 3;       (* no longer supported *)
  880.   extRef32       = 129;     (* 32 bit reference to symbol *)
  881.   extAbsRef32    = extRef32;
  882.   extCommon      = 130;     (* 32 bit reference to COMMON block *)
  883.   extAbsCommon   = extCommon;
  884.   extRef16       = 131;     (* 16 bit reference to symbol *)
  885.   extRelRef16    = extRef16;
  886.   extRef8        = 132;     (*  8 bit reference to symbol *)
  887.   extRelRef8     = extRef8;
  888.   extDExt32      = 133;     (* 32 bit data releative reference *)
  889.   extDExt16      = 134;     (* 16 bit data releative reference *)
  890.   extDExt8       = 135;     (*  8 bit data releative reference *)
  891.  
  892. (* These are to support some of the '020 and up modes that are rarely used *)
  893.   extRelRef32    = 136;     (* 32 bit PC-relative reference to symbol *)
  894.   extRelCommon   = 137;     (* 32 bit PC-relative reference to COMMON block *)
  895.  
  896. (* for completeness... All 680x0's support this *)
  897.   extAbsRef16    = 138;     (* 16 bit absolute reference to symbol *)
  898.  
  899. (* this only exists on '020's and above, in the (d8,An,Xn) address mode *)
  900.   extAbsRef8     = 139;     (* 8 bit absolute reference to symbol *)
  901.  
  902.  
  903. (*****************************************************************************)
  904. (* definitions for the System() call *)
  905.  
  906. TYPE
  907.  
  908.  SysTags=(
  909.   sysDummy:=tagUser+32,
  910.   sysInput,               (* specifies the input filehandle  *)
  911.   sysOutput,              (* specifies the output filehandle *)
  912.   sysASynch,              (* run asynch, close input/output on exit(!) *)
  913.   sysUserShell,           (* send to user shell instead of boot shell *)
  914.   sysCustomShell          (* send to a specific shell (data is name) *)  
  915.  );
  916.  
  917. (*****************************************************************************)
  918. (* definitions for the CreateNewProc() call *)
  919. (* you MUST specify one of NP_Seglist or NP_Entry.  All else is optional. *)
  920.  
  921.  NpTags=(
  922.   npDummy:=tagUser+1000,
  923.   npSeglist,              (* seglist of code to run for the process  *)
  924.   npFreeSeglist,          (* free seglist on exit - only valid for   *)    
  925.                           (* for NP_Seglist.  Default is TRUE.       *)
  926.   npEntry,                (* entry point to run - mutually exclusive *)
  927.                           (* with NP_Seglist! *)
  928.   npInput,                (* filehandle - default is Open("NIL:"...) *)
  929.   npOutput,               (* filehandle - default is Open("NIL:"...) *)
  930.   npCloseInput,           (* close input filehandle on exit          *)  
  931.                           (* default TRUE                            *)
  932.   npCloseOutput,          (* close output filehandle on exit         *)    
  933.                           (* default TRUE                            *)
  934.   npError,                (* filehandle - default is Open("NIL:"...) *)
  935.   npCloseError,           (* close error filehandle on exit          *)  
  936.                           (* default TRUE                            *)
  937.   npCurrentDir,           (* lock - default is parent's current dir  *)  
  938.   npStackSize,            (* stacksize for process - default 4000    *)  
  939.   npName,                 (* name for process - default "New Process"*)
  940.   npPriority,             (* priority - default same as parent       *)
  941.   npConsoleTask,          (* consoletask - default same as parent    *)    
  942.   npWindowPtr,            (* window ptr - default is same as parent  *)  
  943.   npHomeDir,              (* home directory - default curr home dir  *)
  944.   npCopyVars,             (* boolean to copy local vars-default TRUE *)
  945.   npCli,                  (* create cli structure - default FALSE    *)
  946.   npPath,                 (* path - default is copy of parents path  *)
  947.                           (* only valid if a cli process!    *)
  948.   npCommandName,          (* commandname - valid only for CLI        *)    
  949.   npArguments,            (* cstring of arguments - passed with str  *)  
  950.                           (* in a0, length in d0.  (copied and freed *)
  951.                           (* on exit.  Default is empty string.      *)
  952.                           (* NOTE: not operational until 2.04 - see  *)
  953.                           (* BIX/TechNotes for more info/workarounds *)
  954.                           (* NOTE: in 2.0, it DIDN'T pass "" - the   *)
  955.                           (* registers were random.                  *)       
  956. (* FIX! should this be only for cli's? *)
  957.   npNotifyOnDeath,        (* notify parent on death - default FALSE  *)
  958.                           (* Not functional yet. *)                     
  959.   npSynchronous,          (* don't return until process finishes -   *)
  960.                           (* default FALSE.                          *)
  961.                           (* Not functional yet. *)
  962.   npExitCode,             (* code to be called on process exit       *)
  963.   npExitData              (* optional argument for NP_EndCode rtn -  *)
  964.                           (* default NULL                            *)
  965.  );
  966.  
  967. (*****************************************************************************)
  968. (* tags for AllocDosObject *)
  969.  
  970.  AdoTags=(
  971.   adoDummy:=tagUser+2000,
  972.   adoFhMode,                    (* for type DOS_FILEHANDLE only            *)
  973.                                 (* sets up FH for mode specified.
  974.                                    This can make a big difference for buffered
  975.                                    files.                                  *)
  976.  
  977.         (* The following are for DOS_CLI *)
  978.         (* If you do not specify these, dos will use it's preferred values *)
  979.         (* which may change from release to release.  The BPTRs to these   *)
  980.         (* will be set up correctly for you.  Everything will be zero,     *)
  981.         (* except cli_FailLevel (10) and cli_Background (DOSTRUE).         *)
  982.         (* NOTE: you may also use these 4 tags with CreateNewProc.         *)
  983.   adoDirLen,        (* size in bytes for current dir buffer    *)
  984.   adoCommNameLen,   (* size in bytes for command name buffer   *)
  985.   adoCommFileLen,   (* size in bytes for command file buffer   *)
  986.   adoPromptLen      (* size in bytes for the prompt buffer     *)
  987.  );
  988.  
  989. CONST
  990.  
  991. (*****************************************************************************)
  992. (* tags for NewLoadSeg *)
  993. (* no tags are defined yet for NewLoadSeg *)
  994.  
  995. (* NOTE: V37 dos.library, when doing ExAll() emulation, and V37 filesystems  *)
  996. (* will return an error if passed ED_OWNER.  If you get ERROR_BAD_NUMBER,    *)
  997. (* retry with ED_COMMENT to get everything but owner info.  All filesystems  *)
  998. (* supporting ExAll() must support through ED_COMMENT, and must check Type   *)
  999. (* and return ERROR_BAD_NUMBER if they don't support the type.                     *)
  1000.  
  1001. (* values that can be passed for what data you want from ExAll() *)
  1002. (* each higher value includes those below it (numerically)       *)
  1003. (* you MUST chose one of these values *)
  1004.   edName        = 1;
  1005.   edType        = 2;
  1006.   edSize        = 3;
  1007.   edProtection  = 4;
  1008.   edDate        = 5;
  1009.   edComment     = 6;
  1010.   edOwner       = 7;
  1011.  
  1012. TYPE
  1013.  
  1014. (*
  1015.  *   Structure in which exall results are returned in.  Note that only the
  1016.  *   fields asked for will exist!
  1017.  *)
  1018.  
  1019.  ExAllData=RECORD
  1020.   next:ExAllDataPtr;
  1021.   name:StrPtr;
  1022.   type:LONGINT;
  1023.   size:LONGCARD;
  1024.   prot:ProtectionMaskSet;
  1025.   date:Date;
  1026.   comment:StrPtr; (* strings will be after last used field *)
  1027.   ownerUID:CARDINAL; (* new for V39 *)
  1028.   ownerGID:CARDINAL;
  1029.  END;
  1030.  
  1031. (*
  1032.  *   Control structure passed to ExAll.  Unused fields MUST be initialized to
  1033.  *   0, expecially eac_LastKey.
  1034.  *
  1035.  *   eac_MatchFunc is a hook (see utility.library documentation for usage)
  1036.  *   It should return true if the entry is to returned, false if it is to be
  1037.  *   ignored.
  1038.  *
  1039.  *   This structure MUST be allocated by AllocDosObject()!
  1040.  *)
  1041.  
  1042.  ExAllControl=RECORD
  1043.   entries:LONGCARD;   (* number of entries returned in buffer      *)
  1044.   lastKey:LONGCARD;   (* Don't touch inbetween linked ExAll calls! *)
  1045.   matchString:StrPtr; (* wildcard string for pattern match or NULL *)
  1046.   matchFunc:HookPtr;  (* optional private wildcard function        *)   
  1047.  END;
  1048.  
  1049. (* The disk "environment" is a longword array that describes the
  1050.  * disk geometry.  It is variable sized, with the length at the beginning.
  1051.  * Here are the constants for a standard geometry.
  1052.  *)
  1053.  
  1054.  DosEnvec=RECORD
  1055.   tableSize:LONGCARD;           (* size of Environment vector *)
  1056.   sizeBlock:LONGCARD;           (* in longwords: standard value is 128 *)
  1057.   secOrg:LONGCARD;              (* not used; must be 0 *)
  1058.   surfaces:LONGCARD;            (* # of heads (surfaces). drive specific *)
  1059.   sectorsPerBlock:LONGCARD;     (* not used; must be 1 *)
  1060.   blocksPerTrack:LONGCARD;      (* blocks per track. drive specific *)
  1061.   reserved:LONGCARD;            (* DOS reserved blocks at start of partition. *)
  1062.   preAlloc:LONGCARD;            (* DOS reserved blocks at end of partition *)
  1063.   interleave:LONGCARD;          (* usually 0 *)  
  1064.   lowCyl:LONGCARD;              (* starting cylinder. typically 0 *)  
  1065.   highCyl:LONGCARD;             (* max cylinder. drive specific *)  
  1066.   numBuffers:LONGCARD;          (* Initial # DOS of buffers.  *)  
  1067.   bufMemType:LONGCARD;          (* type of mem to allocate for buffers *)  
  1068.   maxTransfers:LONGCARD;        (* Max number of bytes to transfer at a time *)    
  1069.   mask:LONGSET;                 (* Address Mask to block out certain memory *)  
  1070.   bootPri:LONGINT;              (* Boot priority for autoboot *)  
  1071.   dosType:LONGCARD;             (* ASCII (HEX) string showing filesystem type;
  1072.                                  * 0X444F5300 is old filesystem,
  1073.                                  * 0X444F5301 is fast file system *)
  1074.   baud:LONGCARD;                (* Baud rate for serial handler *)
  1075.   control:LONGCARD;             (* Control word for handler/filesystem *)
  1076.   bootBlocks:LONGCARD;          (* Number of blocks containing boot code *)  
  1077.  END;
  1078.  
  1079. CONST
  1080. (* these are the offsets into the array *)
  1081. (* DE_TABLESIZE is set to the number of longwords in the table minus 1 *)
  1082.  
  1083.   tableSize    = 0;       (* minimum value is 11 (includes NumBuffers) *)
  1084.   sizeBlock    = 1;       (* in longwords: standard value is 128 *)
  1085.   secOrg       = 2;       (* not used; must be 0 *)
  1086.   numHeads     = 3;       (* # of heads (surfaces). drive specific *)
  1087.   secsPerBlk   = 4;       (* not used; must be 1 *)
  1088.   blksPerTrack = 5;       (* blocks per track. drive specific *)
  1089.   reservedBlks = 6;       (* unavailable blocks at start.  usually 2 *)
  1090.   preFac       = 7;       (* not used; must be 0 *)
  1091.   interLeave   = 8;       (* usually 0 *)
  1092.   lowCyl       = 9;       (* starting cylinder. typically 0 *)
  1093.   upperCyl     = 10;      (* max cylinder.  drive specific *)
  1094.   numBuffers   = 11;      (* starting # of buffers.  typically 5 *)
  1095.   memBufType   = 12;      (* type of mem to allocate for buffers. *)
  1096.   bufMemType   = 12;      (* same as above, better name
  1097.                            * 1 is public, 3 is chip, 5 is fast *)
  1098.   maxTransfer  = 13;      (* Max number bytes to transfer at a time *)
  1099.   mask         = 14;      (* Address Mask to block out certain memory *)
  1100.   bootPri      = 15;      (* Boot priority for autoboot *)
  1101.   dosType      = 16;      (* ASCII (HEX) string showing filesystem type;
  1102.                            * 0X444F5300 is old filesystem,
  1103.                            * 0X444F5301 is fast file system *)
  1104.   baud         = 17;      (* Baud rate for serial handler *)
  1105.   control      = 18;      (* Control word for handler/filesystem *)
  1106.   bootBlocks   = 19;      (* Number of blocks containing boot code *)
  1107.  
  1108. TYPE
  1109. (* The file system startup message is linked into a device node's startup
  1110. ** field.  It contains a pointer to the above environment, plus the
  1111. ** information needed to do an exec OpenDevice().
  1112. *)
  1113.  
  1114.  FileSysStartupMsg=RECORD
  1115.   unit:LONGCARD;          (* exec unit number for this device *)
  1116.   device:BSTR;            (* null terminated bstring to the device name *)
  1117.   environ:DosEnvecPtr;    (* ptr to environment table (see above) *)
  1118.   flags:LONGSET;          (* flags for OpenDevice() *)                     
  1119.  END;
  1120.  
  1121. CONST
  1122. (* use of Class and code is discouraged for the time being - we might want to
  1123.    change things *)
  1124. (* --- NotifyMessage Class ------------------------------------------------ *)
  1125.   notifyClass = 40000000H;
  1126.  
  1127. (* --- NotifyMessage Codes ------------------------------------------------ *)
  1128.   notifyCode = 1234H;
  1129.  
  1130. TYPE
  1131. (* Sent to the application if SEND_MESSAGE is specified.                    *)
  1132.  
  1133.  NotifyMessage=RECORD
  1134.   execMessage:Message;
  1135.   class:LONGCARD;
  1136.   code:CARDINAL;
  1137.   nReq:NotifyRequestPtr;  (* don't modify the request! *)
  1138.   doNotTouch:LONGCARD;    (* like it says!  For use by handlers *)
  1139.   doNotTouch2:LONGCARD;   (* dito *)                               
  1140.  END;
  1141.  
  1142. NotifyFlags=(
  1143.   sendMessage,
  1144.   sendSignal,
  1145.   nf2,
  1146.   waitReply,
  1147.   notifyInitial,
  1148.   nf5,nf6,nf7,nf8,nf9,nf10,nf11,nf12,nf13,nf14,nf15,nf16,nf17,nf18,
  1149.   nf19,nf20,nf21,nf22,nf23,nf24,nf25,nf26,nf27,nf28,nf29,nf30,
  1150. (* do NOT set or remove NRF_MAGIC!  Only for use by handlers! *)
  1151.   magic
  1152.  );
  1153.  NotifyFlagSet=SET OF NotifyFlags;
  1154.  
  1155.  CONST
  1156. (* Flags reserved for private use by the handler: *)
  1157.   handlerFlags = LONGSET{16..31};
  1158.  
  1159. TYPE
  1160. (* Do not modify or reuse the notifyrequest while active.                   *)
  1161. (* note: the first LONG of nr_Data has the length transfered                *)
  1162.  
  1163.  NotifyRequest=RECORD
  1164.   name:StrPtr;
  1165.   fullName:StrPtr;    (* set by dos - don't touch *)
  1166.   userData:ADDRESS;   (* for applications use *)    
  1167.   flags:NotifyFlagSet;
  1168.   CASE :INTEGER OF
  1169.   | 0:
  1170.    port:MsgPortPtr;           (* for SEND_MESSAGE *)
  1171.   | 1:
  1172.    task:TaskPtr;              (* for SEND_SIGNAL *)
  1173.    signalNum:SHORTCARD;       (* for SEND_SIGNAL *)
  1174.    pad1,pad2,pad3:SHORTCARD; 
  1175.   END;
  1176.   reserved:ARRAY[1..4] OF LONGCARD; (* leave 0 for now *)
  1177.     (* internal use by handlers *)
  1178.   msgCount:LONGCARD;    (* # of outstanding msgs *)
  1179.   handler:MsgPortPtr;   (* handler sent to (for EndNotify) *)
  1180.  END;
  1181.  
  1182. (**********************************************************************
  1183.  *
  1184.  * The CSource data structure defines the input source for "ReadItem()"
  1185.  * as well as the ReadArgs call.  It is a publicly defined structure
  1186.  * which may be used by applications which use code that follows the
  1187.  * conventions defined for access.
  1188.  *
  1189.  * When passed to the dos.library functions, the value passed as
  1190.  * struct *CSource is defined as follows:
  1191.  *      if ( CSource == 0)      Use buffered IO "ReadChar()" as data source
  1192.  *      else                    Use CSource for input character stream
  1193.  *
  1194.  * The following two pseudo-code routines define how the CSource structure
  1195.  * is used:
  1196.  *
  1197.  * long CS_ReadChar( struct CSource *CSource )
  1198.  * {
  1199.  *      if ( CSource == 0 )     return ReadChar();
  1200.  *      if ( CSource->CurChr >= CSource->Length )       return ENDSTREAMCHAR;
  1201.  *      return CSource->Buffer[ CSource->CurChr++ ];
  1202.  * }
  1203.  *
  1204.  * BOOL CS_UnReadChar( struct CSource *CSource )
  1205.  * {
  1206.  *      if ( CSource == 0 )     return UnReadChar();
  1207.  *      if ( CSource->CurChr <= 0 )     return FALSE;
  1208.  *      CSource->CurChr--;
  1209.  *      return TRUE;
  1210.  * }
  1211.  *
  1212.  * To initialize a struct CSource, you set CSource->CS_Buffer to
  1213.  * a string which is used as the data source, and set CS_Length to
  1214.  * the number of characters in the string.  Normally CS_CurChr should
  1215.  * be initialized to ZERO, or left as it was from prior use as
  1216.  * a CSource.
  1217.  *
  1218.  **********************************************************************)
  1219.  
  1220.  CSource=RECORD
  1221.   buffer:StrPtr;
  1222.   length:LONGINT;
  1223.   curChr:LONGINT;
  1224.  END;
  1225.  
  1226. (**********************************************************************
  1227.  *
  1228.  * The RDArgs data structure is the input parameter passed to the DOS
  1229.  * ReadArgs() function call.
  1230.  *
  1231.  * The RDA_Source structure is a CSource as defined above;
  1232.  * if RDA_Source.CS_Buffer is non-null, RDA_Source is used as the input
  1233.  * character stream to parse, else the input comes from the buffered STDIN
  1234.  * calls ReadChar/UnReadChar.
  1235.  *
  1236.  * RDA_DAList is a private address which is used internally to track
  1237.  * allocations which are freed by FreeArgs().  This MUST be initialized
  1238.  * to NULL prior to the first call to ReadArgs().
  1239.  *
  1240.  * The RDA_Buffer and RDA_BufSiz fields allow the application to supply
  1241.  * a fixed-size buffer in which to store the parsed data.  This allows
  1242.  * the application to pre-allocate a buffer rather than requiring buffer
  1243.  * space to be allocated.  If either RDA_Buffer or RDA_BufSiz is NULL,
  1244.  * the application has not supplied a buffer.
  1245.  *
  1246.  * RDA_ExtHelp is a text string which will be displayed instead of the
  1247.  * template string, if the user is prompted for input.
  1248.  *
  1249.  * RDA_Flags bits control how ReadArgs() works.  The flag bits are
  1250.  * defined below.  Defaults are initialized to ZERO.
  1251.  *
  1252.  **********************************************************************)
  1253.  
  1254.  RDAFlags=(
  1255.   stdIn,      (* Use "STDIN" rather than "COMMAND LINE" *)
  1256.   noAlloc,    (* If set, do not allocate extra string space.*)
  1257.   noPrompt,   (* Disable reprompting for string input. *)      
  1258.   rdaf3,rdaf4,rdaf5,rdaf6,rdaf7,rdaf8,rdaf9,rdaf10,
  1259.   rdaf11,rdaf12,rdaf13,rdaf14,rdaf15,rdaf16
  1260.  );
  1261.  RDAFlagSet=SET OF RDAFlags;
  1262.  
  1263.  RDArgs=RECORD
  1264.   source:CSource;   (* Select input source *)
  1265.   daList:LONGINT;   (* PRIVATE. *)
  1266.   buffer:ADDRESS;   (* Optional string parsing space. *)
  1267.   bufSiz:LONGINT;   (* Size of RDA_Buffer (0..n) *)
  1268.   extHelp:StrPtr;   (* Optional extended help *)
  1269.   flags:RDAFlagSet; (* Flags for any required control *)
  1270.  END;
  1271.  
  1272. CONST
  1273. (**********************************************************************
  1274.  * Maximum number of template keywords which can be in a template passed
  1275.  * to ReadArgs(). IMPLEMENTOR NOTE - must be a multiple of 4.
  1276.  **********************************************************************)
  1277.   maxTemplateItems = 100;
  1278.  
  1279. (**********************************************************************
  1280.  * Maximum number of MULTIARG items returned by ReadArgs(), before
  1281.  * an ERROR_LINE_TOO_LONG.  These two limitations are due to stack
  1282.  * usage.  Applications should allow "a lot" of stack to use ReadArgs().
  1283.  **********************************************************************)
  1284.   maxMultiArgs = 128;
  1285.  
  1286. (* Modes for LockRecord/LockRecords() *)
  1287.   recExclusive       = 0;
  1288.   recExclusiveImmed  = 1;
  1289.   recShared          = 2;
  1290.   recSharedImmed     = 3;
  1291.  
  1292. TYPE
  1293. (* struct to be passed to LockRecords()/UnLockRecords() *)
  1294.  
  1295.  RecordLock=RECORD
  1296.   fh:FileHandlePtr; (* filehandle *)
  1297.   offset:LONGCARD;  (* offset in file *)
  1298.   length:LONGCARD;  (* length of file to be locked *)
  1299.   mode:LONGCARD;    (* Type of lock *)
  1300.  END;
  1301.  
  1302. CONST
  1303. (* types for SetVBuf *)
  1304.   bufLine = 0; (* flush on \n, etc *)
  1305.   bufFull = 1; (* never flush except when needed *)
  1306.   bufNone = 2; (* no buffering *)
  1307.  
  1308. (* EOF return value *)
  1309.  endStreamCh = -1;
  1310.  
  1311. (* the structure in the pr_LocalVars list *)
  1312. (* Do NOT allocate yourself, use SetVar()!!! This structure may grow in *)
  1313. (* future releases!  The list should be left in alphabetical order, and *)
  1314. (* may have multiple entries with the same name but different types.    *)
  1315.  
  1316. TYPE
  1317.  VarFlags=(
  1318.   var,          (* an variable *)
  1319.   alias,        (* an alias    *)
  1320.   vf1,vf2,vf3,vf4,vf5,vf6,
  1321.   ignore,       (* ignore this entry on GetVar, etc *)
  1322.  
  1323. (* definitions of flags passed to GetVar()/SetVar()/DeleteVar() *)
  1324. (* bit defs to be OR'ed with the type: *)
  1325. (* item will be treated as a single line of text unless BINARY_VAR is used *)
  1326.  
  1327.   globalOnly,   
  1328.   localOnly,    
  1329.   binaryVar,    (* treat variable as binary *)
  1330.   dontNullTerm, (* only with GVF_BINARY_VAR *)
  1331.  
  1332. (* this is only supported in >= V39 dos.  V37 dos ignores this. *)
  1333. (* this causes SetVar to affect ENVARC: as well as ENV:.      *)
  1334.   saveVar,      (* only with GVF_GLOBAL_VAR *)    
  1335.   vf13,vf14,vf15,vf16
  1336.  );
  1337.  VarFlagSet=SET OF VarFlags;
  1338.  
  1339.  LocalVar=RECORD
  1340.   node:Node;
  1341.   flags:VarFlagSet;
  1342.   value:StrPtr;
  1343.   len:LONGCARD;
  1344.  END;
  1345.  
  1346.  
  1347. END DosD.
  1348.