home *** CD-ROM | disk | FTP | other *** search
Text File | 1995-06-29 | 82.2 KB | 2,457 lines |
- (*************************************************************************
-
- $RCSfile: Dos.mod $
- Description: Interface to dos.library
-
- Created by: fjc (Frank Copeland)
- $Revision: 3.8 $
- $Author: fjc $
- $Date: 1995/06/04 23:13:14 $
-
- Includes Release 40.15
-
- (C) Copyright 1985-1993 Commodore-Amiga, Inc.
- All Rights Reserved
-
- Oberon-A interface Copyright © 1994-1995, Frank Copeland.
- This file is part of the Oberon-A Interface.
- See Oberon-A.doc for conditions of use and distribution.
-
- *************************************************************************)
-
- <* STANDARD- *>
-
- MODULE [2] Dos;
-
- IMPORT
- SYS := SYSTEM, Kernel, e := Exec, t := Timer, u := Utility,
- s := Sets;
-
-
- (**-- Pointer declarations ---------------------------------------------*)
-
- TYPE
-
- DatePtr* = POINTER TO Date;
- FileInfoBlockPtr* = POINTER TO FileInfoBlock;
- InfoDataPtr* = POINTER TO InfoData;
- DateTimePtr* = POINTER TO DateTime;
- AChainPtr* = POINTER TO AChain;
- AnchorPathPtr* = POINTER TO AnchorPath;
- DosEnvecPtr* = POINTER [3] TO DosEnvec;
- FileSysStartupMsgPtr* = POINTER [3] TO FileSysStartupMsg;
- DeviceNodePtr* = POINTER TO DeviceNode;
- NotifyRequestPtr* = POINTER TO NotifyRequest;
- NotifyMessagePtr* = POINTER TO NotifyMessage;
- CSourcePtr* = POINTER TO CSource;
- RDArgsPtr* = POINTER TO RDArgs;
- RecordLockPtr* = POINTER TO RecordLock;
- LocalVarPtr* = POINTER TO LocalVar;
- ExAllDataPtr* = POINTER TO ExAllData;
- ExAllControlPtr* = POINTER TO ExAllControl;
- ProcessPtr* = POINTER TO Process;
- FileHandlePtr* = POINTER [3] TO FileHandle;
- DosPacketPtr* = POINTER TO DosPacket;
- StandardPacketPtr* = POINTER TO StandardPacket;
- TaskArrayPtr* = POINTER [3] TO TaskArray;
- RootNodePtr* = POINTER TO RootNode;
- ErrorStringPtr* = POINTER TO ErrorString;
- DosLibraryPtr* = POINTER TO DosLibrary;
- CliProcListPtr* = POINTER TO CliProcList;
- DosInfoPtr* = POINTER [3] TO DosInfo;
- SegmentPtr* = POINTER TO Segment;
- CommandLineInterfacePtr* = POINTER [3] TO CommandLineInterface;
- DeviceListPtr* = POINTER [3] TO DeviceList;
- DevInfoPtr* = POINTER [3] TO DevInfo;
- AssignListPtr* = POINTER TO AssignList;
- DosListPtr* = POINTER [3] TO DosList;
- DevProcPtr* = POINTER TO DevProc;
- FileLockPtr* = POINTER [3] TO FileLock;
- ProcessId* = e.MsgPortPtr; (* Points to Process.msgPort *)
- DosListNodePtr* = POINTER TO DosListNode;
-
- (*
- ** $VER: dos.h 36.27 (5.4.92)
- **
- ** Standard header for AmigaDOS
- *)
-
- CONST
-
- dosName * = "dos.library";
-
- (* Predefined Amiga DOS global constants *)
-
- DOSTRUE * = e.LTRUE;
- DOSFALSE * = e.LFALSE;
-
- (* Mode parameter to Open() *)
- oldFile * = 1005; (* Open existing file read/write
- * positioned at beginning of file. *)
- newFile * = 1006; (* Open freshly created file (delete
- * old file) read/write, exclusive lock. *)
- readWrite * = 1004; (* Open old file w/shared lock,
- * creates file if doesn't exist. *)
-
- (* Relative position to Seek() *)
- beginning * = -1; (* relative to Begining Of File *)
- current * = 0; (* relative to Current file position *)
- end * = 1; (* relative to End Of File *)
-
- bitsPerByte * = 8;
- bytesPerLong * = 4;
- bitsPerLong * = 32;
- maxInt * = 7FFFFFFFH;
- minInt * = 80000000H;
-
- (* Passed as type to Lock() *)
- sharedLock * = -2; (* File is readable by others *)
- accessRead * = -2; (* Synonym *)
- exclusiveLock * = -1; (* No other access allowed *)
- accessWrite * = -1; (* Synonym *)
-
- TYPE
-
- (*
- ** Note that the type name has been changed from DateStamp to Date to
- ** avoid a name clash with the DateStamp() function.
- *)
-
- DateBase *= RECORD END;
- DateBasePtr *= POINTER TO DateBase;
-
- Date* = RECORD (DateBase)
- days * : LONGINT; (* Number of days since Jan. 1, 1978 *)
- minute* : LONGINT; (* Number of minutes past midnight *)
- tick * : LONGINT; (* Number of ticks past minute *)
- END; (* Date *)
-
- CONST
-
- ticksPerSecond * = 50; (* Number of ticks in one second *)
-
- TYPE
-
- (* Returned by Examine() and ExNext(), must be on a 4 byte boundary *)
- FileInfoBlock* = RECORD
- diskKey * : LONGINT;
- dirEntryType* : LONGINT;
- (* Type of Directory. If < 0, then a plain file.
- * If > 0 a directory *)
- fileName * : ARRAY 108 OF CHAR;
- (* Null terminated. Max 30 chars used for now *)
- protection * : s.SET32;(* bit mask of protection, rwxd are 3-0. *)
- entryType * : LONGINT;
- size * : LONGINT; (* Number of bytes in file *)
- numBlocks * : LONGINT; (* Number of blocks in file *)
- date * : Date; (* Date file last changed *)
- comment * : ARRAY 80 OF CHAR;
- (* Null terminated comment associated with file *)
-
- (* Note: the following fields are not supported by all filesystems. *)
- (* They should be initialized to 0 sending an ACTION_EXAMINE packet. *)
- (* When Examine() is called, these are set to 0 for you. *)
- (* AllocDosObject() also initializes them to 0. *)
- ownerUID * : e.UWORD; (* owner's UID *)
- ownerGID * : e.UWORD; (* owner's GID *)
-
- reserved * : ARRAY 32 OF CHAR;
- END; (* FileInfoBlock *)
-
- CONST
-
- (* fib stands for FileInfoBlock *)
-
- (* Bit definitions *)
- (* Regular RWED bits are 0 == allowed. *)
- (* NOTE: GRP and OTR RWED permissions are 0 == not allowed! *)
- (* Group and Other permissions are not directly handled by the filesystem *)
- otrRead * = 15; (* Other: file is readable *)
- otrWrite * = 14; (* Other: file is writable *)
- otrExecute * = 13; (* Other: file is executable *)
- otrDelete * = 12; (* Other: prevent file from being deleted *)
- grpRead * = 11; (* Group: file is readable *)
- grpWrite * = 10; (* Group: file is writable *)
- grpExecute * = 9; (* Group: file is executable *)
- grpDelete * = 8; (* Group: prevent file from being deleted *)
-
- script * = 6; (* program is a script (execute) file *)
- pure * = 5; (* program is reentrant and rexecutable *)
- archive * = 4; (* cleared whenever file is changed *)
- readProt * = 3; (* ignored by old filesystem *)
- writeProt * = 2; (* ignored by old filesystem *)
- execute * = 1; (* ignored by system, used by Shell *)
- delete * = 0; (* prevent file from being deleted *)
-
- (* Standard maximum length for an error string from fault. However, most *)
- (* error strings should be kept under 60 characters if possible. Don't *)
- (* forget space for the header you pass in. *)
- faultMax * = 82;
-
- TYPE
-
- (* All BCPL data must be long word aligned. BCPL pointers are the long word
- * address (i.e byte address divided by 4 (>>2)) *)
-
- BPTR* = SYS.BPTR; (* Long word pointer *)
- BSTR* = POINTER [3] TO ARRAY 256 OF CHAR; (* Long word pointer to BCPL string *)
-
- (* BCPL strings have a length in the first byte and then the characters.
- * For example: s[0]=3 s[1]=S s[2]=Y s[3]=S *)
-
- (* returned by Info(), must be on a 4 byte boundary *)
- InfoData* = RECORD
- numSoftErrors* : LONGINT; (* number of soft errors on disk *)
- unitNumber * : LONGINT; (* Which unit disk is (was) mounted on *)
- diskState * : LONGINT; (* See defines below *)
- numBlocks * : LONGINT; (* Number of blocks on disk *)
- numBlocksUsed* : LONGINT; (* Number of block in use *)
- bytesPerBlock* : LONGINT;
- diskType * : LONGINT; (* Disk Type code *)
- volumeNode * : DeviceListPtr;(* BCPL pointer to volume node *)
- inUse * : LONGINT; (* Flag, zero if not in use *)
- END; (* InfoData *)
-
- CONST
-
- (* id stands for InfoData *)
- (* Disk states *)
- writeProtect * = 80; (* Disk is write protected *)
- validating * = 81; (* Disk is currently being validated *)
- validated * = 82; (* Disk is consistent and writeable *)
-
- (* Disk types *)
- (* idInter* use international case comparison routines for hashing *)
- noDiskPresent * = -1;
- unreadableDisk * = 42414400H; (* 'BAD\0' *)
- dosDisk * = 444F5300H; (* 'DOS\0' *)
- ffsDisk * = 444F5301H; (* 'DOS\1' *)
- interDosDisk * = 444F5302H; (* 'DOS\2' *)
- interFfsDisk * = 444F5303H; (* 'DOS\3' *)
- notReallyDos * = 4E444F53H; (* 'NDOS' *)
- kickstartDisk * = 4B49434BH; (* 'KICK' *)
- msdosDisk * = 4D534400H; (* 'MSD\0' *)
-
- (* Errors from IoErr(), etc. *)
- noFreeStore * = 103;
- taskTableFull * = 105;
- badTemplate * = 114;
- badNumber * = 115;
- requiredArgMissing * = 116;
- keyNeedsArg * = 117;
- tooManyArgs * = 118;
- unmatchedQuotes * = 119;
- lineTooLong * = 120;
- fileNotObject * = 121;
- invalidResidentLibrary * = 122;
- noDefaultDir * = 201;
- objectInUse * = 202;
- objectExists * = 203;
- dirNotFound * = 204;
- objectNotFound * = 205;
- badStreamName * = 206;
- objectTooLarge * = 207;
- actionNotKnown * = 209;
- invalidComponentName * = 210;
- invalidLock * = 211;
- objectWrongType * = 212;
- diskNotValidated * = 213;
- diskWriteProtected * = 214;
- renameAcrossDevices * = 215;
- directoryNotEmpty * = 216;
- tooManyLevels * = 217;
- deviceNotMounted * = 218;
- seekError * = 219;
- commentTooBig * = 220;
- diskFull * = 221;
- deleteProtected * = 222;
- writeProtected * = 223;
- readProtected * = 224;
- notADosDisk * = 225;
- noDisk * = 226;
- noMoreEntries * = 232;
- (* added for 1.4 *)
- isSoftLink * = 233;
- objectLinked * = 234;
- badHunk * = 235;
- notImplemented * = 236;
- recordNotLocked * = 240;
- lockCollision * = 241;
- lockTimeout * = 242;
- unlockError * = 243;
-
- (* error codes 303-305 are defined in dosasl.h *)
-
- (* These are the return codes used by convention by AmigaDOS commands *)
- (* See FAILAT and IF for relvance to EXECUTE files *)
- ok * = 0; (* No problems, success *)
- warn * = 5; (* A warning only *)
- error * = 10; (* Something wrong *)
- fail * = 20; (* Complete or severe failure*)
-
- (* Bit numbers that signal you that a user has issued a break *)
- ctrlC * = 12;
- ctrlD * = 13;
- ctrlE * = 14;
- ctrlF * = 15;
-
- (* Values returned by SameLock() *)
- different * = -1;
- same * = 0;
- sameVolume * = 1; (* locks are on same volume *)
- sameHandler * = sameVolume;
- (* sameHandler was a misleading name, def kept for src compatibility *)
-
- (* types for ChangeMode() *)
- changeLock * = 0;
- changeFH * = 1;
-
- (* Values for MakeLink() *)
- hard * = 0;
- soft * = 1; (* softlinks are not fully supported yet *)
-
- (* values returned by ReadItem *)
- equal * = -2; (* "=" Symbol *)
- itemError * = -1; (* error *)
- nothing * = 0; (* *N, ;, endstreamch *)
- unQuoted * = 1; (* unquoted item *)
- quoted * = 2; (* quoted item *)
-
- (* types for AllocDosObject/FreeDosObject *)
- fileHandle * = 0; (* few people should use this *)
- exAllControl * = 1; (* Must be used to allocate this! *)
- fib * = 2; (* useful *)
- stdPkt * = 3; (* for doing packet-level I/O *)
- cli * = 4; (* for shell-writers, etc *)
- rdArgs * = 5; (* for ReadArgs if you pass it in *)
-
- (*
- ** $VER: datetime.h 36.7 (12.7.90)
- **
- ** Date and time header for AmigaDOS
- *)
-
- (*
- * Data structures and equates used by the V1.4 DOS functions
- * StrtoDate() and DatetoStr()
- *)
-
- CONST
-
- (* You need this much room for each of the DateTime strings: *)
- lenDatString * = 16;
-
- TYPE
- DatString * = ARRAY lenDatString OF CHAR;
- DatStringPtr * = POINTER TO DatString;
-
- (* --------- String/Date structures etc *)
- DateTime* = RECORD (DateBase)
- stamp * : Date; (* DOS Date *)
- format * : SHORTINT; (* controls appearance of datStrDate *)
- flags * : s.SET8; (* see BITDEF's below *)
- strDay * : DatStringPtr; (* day of the week string *)
- strDate* : DatStringPtr; (* date string *)
- strTime* : DatStringPtr; (* time string *)
- END; (* DateTime *)
-
- CONST
-
- (* flags for datFlags *)
-
- subst * = 0; (* substitute Today, Tomorrow, etc. *)
- future * = 1; (* day of the week is in future *)
-
- (*
- * date format values
- *)
-
- formatDos * = 0; (* dd-mmm-yy *)
- formatInt * = 1; (* yy-mm-dd *)
- formatUSA * = 2; (* mm-dd-yy *)
- formatCDN * = 3; (* dd-mm-yy *)
- formatMax * = formatCDN;
-
- (*
- ** $VER: dosasl.h 36.16 (2.5.91)
- **
- ** Pattern-matching structure definitions
- *)
-
- (***********************************************************************
- ************************ PATTERN MATCHING ******************************
- ************************************************************************
-
- * structure expected by MatchFirst, MatchNext.
- * Allocate this structure and initialize it as follows:
- *
- * Set apBreakBits to the signal bits (CDEF) that you want to take a
- * break on, or NULL, if you don't want to convenience the user.
- *
- * If you want to have the FULL PATH NAME of the files you found,
- * allocate a buffer at the END of this structure, and put the size of
- * it into apStrlen. If you don't want the full path name, make sure
- * you set apStrlen to zero. In this case, the name of the file, and stats
- * are available in the apInfo, as per usual.
- *
- * Then call MatchFirst() and then afterwards, MatchNext() with this structure.
- * You should check the return value each time (see below) and take the
- * appropriate action, ultimately calling MatchEnd() when there are
- * no more files and you are done. You can tell when you are done by
- * checking for the normal AmigaDOS return code errornomoreENTRIES.
- *
- *)
-
- TYPE
-
- AnchorPath* = RECORD
- base * : AChainPtr; (* pointer to first anchor *)
- last * : AChainPtr; (* pointer to last anchor *)
- breakBits * : s.SET32; (* Bits we want to break on *)
- foundBreak* : s.SET32; (* Bits we broke on. Also returns errorBREAK *)
- flags * : s.SET8; (* New use for extra word. *)
- reserved * : e.BYTE;
- strlen * : INTEGER; (* This is what apLength used to be *)
- info * : FileInfoBlock;
- buf * : e.STRING; (* Buffer for path name, allocated by user *)
- END; (* AnchorPath *)
-
-
- CONST
-
- doWild * = 0; (* User option ALL *)
- itsWild * = 1; (* Set by MatchFirst, used by MatchNext *)
- (* Application can test apItsWild, too *)
- (* (means that there's a wildcard *)
- (* in the pattern after calling *)
- (* MatchFirst). *)
- doDir * = 2; (* Bit is SET if a DIR node should be *)
- (* entered. Application can RESET this *)
- (* bit after MatchFirst/MatchNext to AVOID *)
- (* entering a dir. *)
- didDir * = 3; (* Bit is SET for an "expired" dir node. *)
- noMemErr * = 4; (* Set on memory error *)
- doDot * = 5; (* If set, allow conversion of '.' to *)
- (* CurrentDir *)
- dirChanged * = 6; (* apcurrent->anLock changed *)
- (* since last MatchNext call *)
- followHLinks* = 7; (* follow hardlinks on DODIR - defaults *)
- (* to not following hardlinks on a DODIR. *)
-
- TYPE
-
- AChain* = RECORD
- child * : AChainPtr;
- parent * : AChainPtr;
- lock * : FileLockPtr;
- info * : FileInfoBlock;
- flags * : s.SET8;
- string * : e.STRING;
- END; (* AChain *)
-
- CONST
-
- patternBit * = 0;
- examinedBit* = 1;
- completed * = 2;
- allBit * = 3;
- single * = 4;
-
- (*
- * Constants used by wildcard routines, these are the pre-parsed tokens
- * referred to by pattern match. It is not necessary for you to do
- * anything about these, MatchFirst() MatchNext() handle all these for you.
- *)
-
- pAny * = 80H; (* Token for '*' or '#? *)
- pSingle * = 81H; (* Token for '?' *)
- pOrStart * = 82H; (* Token for '(' *)
- pOrNext * = 83H; (* Token for '|' *)
- pOeEnd * = 84H; (* Token for ')' *)
- pNot * = 85H; (* Token for '~' *)
- pNotEnd * = 86H; (* Token for *)
- pNotClass * = 87H; (* Token for '^' *)
- pClass * = 88H; (* Token for '[]' *)
- pRepBeg * = 89H; (* Token for '[' *)
- pRepEnd * = 8AH; (* Token for ']' *)
- pStop * = 8BH; (* token to force end of evaluation *)
-
- (* Values for anStatus, NOTE: These are the actual bit numbers *)
-
- complexBit * = 1; (* Parsing complex pattern *)
- examineBit * = 2; (* Searching directory *)
-
- (*
- * Returns from MatchFirst(), MatchNext()
- * You can also get dos error returns, such as errornomoreENTRIES,
- * these are in the dos.h file.
- *)
-
- bufferOverflow * = 303; (* User or internal buffer overflow *)
- break * = 304; (* A break character was received *)
- notExecutable * = 305; (* A file has E bit cleared *)
-
-
- (*
- ** $VER: doshunks.h 36.9 (2.6.92)
- **
- ** Hunk definitions for object and load modules.
- *)
-
- CONST
-
- (* hunk types *)
- hunkUnit * = 999;
- hunkName * = 1000;
- hunkCode * = 1001;
- hunkData * = 1002;
- hunkBSS * = 1003;
- hunkReloc32 * = 1004;
- hunkAbsReloc32 * = hunkReloc32;
- hunkReloc16 * = 1005;
- hunkRelReloc16 * = hunkReloc16;
- hunkReloc8 * = 1006;
- hunkRelReloc8 * = hunkReloc8;
- hunkExt * = 1007;
- hunkSymbol * = 1008;
- hunkDebug * = 1009;
- hunkEnd * = 1010;
- hunkHeader * = 1011;
-
- hunkOverlay * = 1013;
- hunkBreak * = 1014;
-
- hunkDRel32 * = 1015;
- hunkDRel16 * = 1016;
- hunkDRel8 * = 1017;
-
- hunkLib * = 1018;
- hunkIndex * = 1019;
-
- (*
- * Nkte: V37 LoadSeg uses 1015 (hunkDRel32) by mistake. This will continue
- * to be supported in future versions, since hunkDRel32 is illegal in load files
- * anyways. Future versions will support both 1015 and 1020, though anything
- * that should be usable under V37 should use 1015.
- *)
- hunkReloc32Short * = 1020;
-
- (* see ext_xxx below. New for V39 (note that LoadSeg only handles relReloc32).*)
- hunkRelReloc32 * = 1021;
- hunkAbsReloc16 * = 1022;
-
- (*
- * Any hunks that have the hunkAdvisory bit set will be ignored if they
- * aren't understood. When ignored, they're treated like hunkDebug hunks.
- * NOTE: this handling of hunkAdvisory started as of V39 dos.library! If
- * lading such executables is attempted under <V39 dos, it will fail with a
- * bad hunk type.
- *)
- hunkAdvisory * = 29;
- hunkChip * = 30;
- hunkFast * = 31;
-
-
- (* hunkext sub-types *)
- extSymb * = 0; (* symbol table *)
- extDef * = 1; (* relocatable definition *)
- extAbs * = 2; (* Absolute definition *)
- extRes * = 3; (* no longer supported *)
- extRef32 * = 129; (* 32 bit reference to symbol *)
- extAbsRef32 * = extRef32;
- extCommon * = 130; (* 32 bit reference to COMMON block *)
- extAbsCommon * = extCommon;
- extRef16 * = 131; (* 16 bit reference to symbol *)
- extRelRef16 * = extRef16;
- extRef8 * = 132; (* 8 bit reference to symbol *)
- extRelRef8 * = extRef8;
- extDExt32 * = 133; (* 32 bit data releative reference *)
- extDExt16 * = 134; (* 16 bit data releative reference *)
- extDExt8 * = 135; (* 8 bit data releative reference *)
-
- (* These are to support some of the '020 and up modes that are rarely used *)
- extRelRef32 * = 136; (* 32 bit PC-relative reference to symbol *)
- extRelCommon * = 137; (* 32 bit PC-relative reference to COMMON block *)
-
- (* for completeness... All 680x0's support this *)
- extAbsRef16 * = 138; (* 16 bit absolute reference to symbol *)
-
- (* this only exists on '020's and above, in the (d8,An,Xn) address mode *)
- extAbsRef8 * = 139; (* 8 bit absolute reference to symbol *)
-
-
- (*
- ** $VER: filehandler.h 36.6 (9.8.92)
- **
- ** device and file handler specific code for AmigaDOS
- *)
-
- TYPE
-
- (* The disk "environment" is a longword array that describes the
- * disk geometry. It is variable sized, with the length at the beginning.
- * Here are the constants for a standard geometry.
- *)
-
- DosEnvec* = RECORD
- tableSize * : e.ULONG; (* Size of Environment vector *)
- sizeBlock * : e.ULONG; (* in longwords: standard value is 128 *)
- secOrg * : e.ULONG; (* not used; must be 0 *)
- surfaces * : e.ULONG; (* # of heads (surfaces). drive specific *)
- sectorPerBlock* : e.ULONG; (* not used; must be 1 *)
- blocksPerTrack* : e.ULONG; (* blocks per track. drive specific *)
- reserved * : e.ULONG; (* DOS reserved blocks at start of partition. *)
- preAlloc * : e.ULONG; (* DOS reserved blocks at end of partition *)
- interleave * : e.ULONG; (* usually 0 *)
- lowCyl * : e.ULONG; (* starting cylinder. typically 0 *)
- highCyl * : e.ULONG; (* max cylinder. drive specific *)
- numBuffers * : e.ULONG; (* Initial # DOS of buffers. *)
- bufMemType * : e.ULONG; (* type of mem to allocate for buffers *)
- maxTransfer * : e.ULONG; (* Max number of bytes to transfer at a time *)
- mask * : s.SET32; (* Address Mask to block out certain memory *)
- bootPri * : LONGINT; (* Boot priority for autoboot *)
- dosType * : e.ULONG; (* ASCII (HEX) string showing filesystem type;
- * 444F5300H is old filesystem,
- * 444F5301H is fast file system *)
- baud * : e.ULONG; (* Baud rate for serial handler *)
- control * : e.ULONG; (* Control word for handler/filesystem *)
- bootBlocks * : e.ULONG; (* Number of blocks containing boot code *)
-
- END; (* DosEnvec *)
-
- CONST
-
- (* these are the offsets into the array *)
- (* deTableSize is set to the number of longwords in the table minus 1 *)
-
- tableSize * = 0; (* minimum value is 11 (includes NumBuffers) *)
- sizeBlock * = 1; (* in longwords: standard value is 128 *)
- secOrg * = 2; (* not used; must be 0 *)
- numHeads * = 3; (* # of heads (surfaces). drive specific *)
- secsPerBlk * = 4; (* not used; must be 1 *)
- blksPerTrack* = 5; (* blocks per track. drive specific *)
- reservedBlks* = 6; (* unavailable blocks at start. usually 2 *)
- prefac * = 7; (* not used; must be 0 *)
- interleave * = 8; (* usually 0 *)
- lowCyl * = 9; (* starting cylinder. typically 0 *)
- upperCyl * = 10; (* max cylinder. drive specific *)
- numBuffers * = 11; (* starting # of buffers. typically 5 *)
- memBufType * = 12; (* type of mem to allocate for buffers. *)
- bufMemType * = 12; (* same as above, better name
- * 1 is public, 3 is chip, 5 is fast *)
- maxTransfer * = 13; (* Max number bytes to transfer at a time *)
- mask * = 14; (* Address Mask to block out certain memory *)
- bootPri * = 15; (* Boot priority for autoboot *)
- dosType * = 16; (* ASCII (HEX) string showing filesystem type;
- * 444F5300H is old filesystem,
- * 444F5301H is fast file system *)
- baud * = 17; (* Baud rate for serial handler *)
- control * = 18; (* Control word for handler/filesystem *)
- bootBlocks * = 19; (* Number of blocks containing boot code *)
-
- TYPE
-
- (* The file system startup message is linked into a device node's startup
- ** field. It contains a pointer to the above environment, plus the
- ** information needed to do an exec OpenDevice().
- *)
- FileSysStartupMsg* = RECORD
- unit * : e.ULONG; (* exec unit number for this device *)
- device * : BSTR; (* null terminated bstring to the device name *)
- environ* : DosEnvecPtr; (* ptr to environment table (see above) *)
- flags * : s.SET32; (* flags for OpenDevice() *)
- END; (* FileSysStartupMsg *)
-
-
- (* The include file "libraries/dosextens.h" has a DeviceList structure.
- * The "device list" can have one of three different things linked onto
- * it. Dosextens defines the structure for a volume. dltDirectory
- * is for an assigned directory. The following structure is for
- * a dos "device" (dltDevice).
- *)
-
- DeviceNode* = RECORD
- next * : DeviceNodePtr; (* singly linked list *)
- type * : e.ULONG; (* always 0 for dos "devices" *)
- task * : ProcessId; (* standard dos "task" field. If this is
- * null when the node is accesses, a task
- * will be started up *)
- lock * : FileLockPtr; (* not used for devices -- leave null *)
- handler * : BSTR; (* filename to loadseg (if seglist is null) *)
- stackSize* : e.ULONG; (* stacksize to use when starting task *)
- priority * : LONGINT; (* task priority when starting task *)
- startup * : FileSysStartupMsgPtr; (* startup msg: FileSysStartupMsg for disks *)
- segList * : e.BPTR; (* code to run to start new task (if necessary).
- * if null then dnHandler will be loaded. *)
- globalVec* : e.BPTR; (* BCPL global vector to use when starting
- * a task. -1 means that dnSegList is not
- * for a bcpl program, so the dos won't
- * try and construct one. 0 tell the
- * dos that you obey BCPL linkage rules,
- * and that it should construct a global
- * vector for you.
- *)
- name * : BSTR; (* the node name, e.g. '\3','D','F','3' *)
- END; (* DeviceNode *)
-
-
- (*
- ** $VER: notify.h 36.8 (29.8.90)
- **
- ** dos notification definitions
- *)
-
- CONST
-
- (* use of Class and code is discouraged for the time being - we might want
- to change things *)
- (* --- NotifyMessage Class ---------------------------------------------- *)
- class * = 40000000H;
-
- (* --- NotifyMessage Codes ---------------------------------------------- *)
- code * = 1234H;
-
- TYPE
-
- (* Sent to the application if sendMESSAGE is specified. *)
-
- NotifyMessage* = RECORD (e.MessageBase)
- execMessage * : e.Message;
- class * : e.ULONG;
- code * : e.UWORD;
- nReq * : NotifyRequestPtr; (* don't modify the request! *)
- doNotTouch : e.ULONG; (* like it says! For use by handlers *)
- doNotTouch2 : e.ULONG; (* ditto *)
- END; (* NotifyMessage *)
-
- (* Do not modify or reuse the notifyrequest while active. *)
- (* note: the first LONG of nrData has the length transfered *)
-
- NotifyRequest* = RECORD
- name * : e.LSTRPTR;
- fullName* : e.LSTRPTR; (* set by dos - don't touch *)
- userData* : e.ULONG; (* for applications use *)
- flags * : s.SET32;
- task * : e.TaskPtr; (* for sendSignal *)
- (** port * : e.MsgPortPtr; (* for sendMessage *)
- *
- * port occupies the same space as task (a C union). Access via:
- * SYS.VAL (e.MsgPortPtr, NotifyRequest.task)
- *)
- signalNum* : e.UBYTE; (* for sendSignal *)
- pad : ARRAY 3 OF e.UBYTE;
- reserved* : ARRAY 4 OF e.ULONG; (* leave 0 for now *)
-
- (* internal use by handlers *)
- msgCount* : e.ULONG; (* # of outstanding msgs *)
- handler * : e.MsgPortPtr; (* handler sent to (for EndNotify) *)
- END; (* NotifyRequest *)
-
- CONST
-
- (* --- NotifyRequest Flags ------------------------------------------------ *)
-
- (* bit numbers *)
- sendMessage * = 0;
- sendSignal * = 1;
- waitReply * = 3;
- notifyInitial * = 4;
-
- (* do NOT set or remove nrMagic! Only for use by handlers! *)
- magic * = 31;
-
- (* Flags reserved for private use by the handler: *)
- handlerFlags * = {16 .. 31};
-
-
- (*
- ** $VER: rdargs.h 36.6 (12.7.90)
- **
- ** ReadArgs() structure definitions
- *)
-
- (**********************************************************************
- *
- * The CSource data structure defines the input source for "ReadItem()"
- * as well as the ReadArgs call. It is a publicly defined structure
- * which may be used by applications which use code that follows the
- * conventions defined for access.
- *
- * When passed to the dos.library functions, the value passed as
- * struct *CSource is defined as follows:
- * if ( CSource == 0) Use buffered IO "ReadChar()" as data source
- * else Use CSource for input character stream
- *
- * The following two pseudo-code routines define how the CSource structure
- * is used:
- *
- * long csReadChar( CSource : CSourcePtr )
- * {
- * if ( CSource == 0 ) return ReadChar();
- * if ( CSource->CurChr >= CSource->Length ) return ENDSTREAMCHAR;
- * return CSource->Buffer[ CSource->CurChr++ ];
- * }
- *
- * BOOL csUnReadChar( CSource : CSourcePtr )
- * {
- * if ( CSource == 0 ) return UnReadChar();
- * if ( CSource->CurChr <= 0 ) return FALSE;
- * CSource->CurChr--;
- * return TRUE;
- * }
- *
- * To initialize a struct CSource, you set csource->csBuffer to
- * a string which is used as the data source, and set csLength to
- * the number of characters in the string. Normally csCurChr should
- * be initialized to ZERO, or left as it was from prior use as
- * a CSource.
- *
- **********************************************************************)
-
- TYPE
-
- CSource* = RECORD
- buffer* : e.LSTRPTR;
- length* : LONGINT;
- curChr* : LONGINT;
- END; (* CSource *)
-
- (**********************************************************************
- *
- * The RDArgs data structure is the input parameter passed to the DOS
- * ReadArgs() function call.
- *
- * The rdaSource structure is a CSource as defined above;
- * if rdasource.csBuffer is non-null, rdaSource is used as the input
- * character stream to parse, else the input comes from the buffered STDIN
- * calls ReadChar/UnReadChar.
- *
- * rdaDAList is a private address which is used internally to track
- * allocations which are freed by FreeArgs(). This MUST be initialized
- * to NULL prior to the first call to ReadArgs().
- *
- * The rdaBuffer and rdaBufSiz fields allow the application to supply
- * a fixed-size buffer in which to store the parsed data. This allows
- * the application to pre-allocate a buffer rather than requiring buffer
- * space to be allocated. If either rdaBuffer or rdaBufSiz is NULL,
- * the application has not supplied a buffer.
- *
- * rdaExtHelp is a text string which will be displayed instead of the
- * template string, if the user is prompted for input.
- *
- * rdaFlags bits control how ReadArgs() works. The flag bits are
- * defined below. Defaults are initialized to ZERO.
- *
- **********************************************************************)
-
- TYPE
-
- RDArgs* = RECORD
- source * : CSource; (* Select input source *)
- daList * : LONGINT; (* PRIVATE. *)
- buffer * : e.LSTRPTR; (* Optional string parsing space. *)
- bufSiz * : LONGINT; (* Size of rdaBuffer (0..n) *)
- extHelp* : e.LSTRPTR; (* Optional extended help *)
- flags * : s.SET32; (* Flags for any required control *)
- END; (* RDArgs *)
-
- CONST
-
- stdIn * = 0; (* Use "STDIN" rather than "COMMAND LINE" *)
- noAlloc * = 1; (* If set, do not allocate extra string space.*)
- noPrompt * = 2; (* Disable reprompting for string input. *)
-
- (**********************************************************************
- * Maximum number of template keywords which can be in a template passed
- * to ReadArgs(). IMPLEMENTOR NOTE - must be a multiple of 4.
- **********************************************************************)
- maxTemplateItems * = 100;
-
- (**********************************************************************
- * Maximum number of MULTIARG items returned by ReadArgs(), before
- * an errorLineTooLONG. These two limitations are due to stack
- * usage. Applications should allow "a lot" of stack to use ReadArgs().
- **********************************************************************)
- maxMultiArgs * = 128;
-
-
- (*
- ** $VER: record.h 36.5 (12.7.90)
- **
- ** include file for record locking
- *)
-
- TYPE
- (*
- * use an extension of this and pass it to ReadArgs()
- * use one entry (see definitions below) for every template keyword
- * according to it's type.
- *)
-
- ArgsStruct * = RECORD END;
-
- ArgLong * = POINTER TO ARRAY 1 OF LONGINT; (* /N *)
- ArgLongArray * = POINTER TO ARRAY maxMultiArgs OF ArgLong; (* /M/N*)
- ArgBool * = e.LONGBOOL; (* /S, /T *)
- ArgString * = e.LSTRPTR; (* /K, or nothing *)
- ArgStringArray * = POINTER TO ARRAY maxMultiArgs OF ArgString; (* /K/M, /M *)
-
-
- CONST
-
- (* Modes for LockRecord/LockRecords() *)
- recExclusive * = 0;
- recExclusiveImmed * = 1;
- recShared * = 2;
- recSharedImmed * = 3;
-
- TYPE
-
- (* struct to be passed to LockRecords()/UnLockRecords() *)
-
- RecordLock* = RECORD
- fh * : FileHandlePtr; (* filehandle *)
- offset* : e.ULONG; (* offset in file *)
- length* : e.ULONG; (* length of file to be locked *)
- mode * : e.ULONG; (* Type of lock *)
- END; (* RecordLock *)
-
-
- (*
- ** $VER: var.h 36.11 (2.6.92)
- **
- ** include file for dos local and environment variables
- *)
-
- TYPE
-
- (* the structure in the prLocalVars list *)
- (* Do NOT allocate yourself, use SetVar()!!! This structure may grow in *)
- (* future releases! The list should be left in alphabetical order, and *)
- (* may have multiple entries with the same name but different types. *)
-
- LocalVar* = RECORD (e.NodeBase)
- node * : e.Node;
- flags* : s.SET16;
- value* : e.LSTRPTR;
- len * : e.ULONG;
- END; (* LocalVar *)
-
- CONST
-
- (*
- * The LocalVar.flags bits are available to the application. The unused
- * LocalVar.pri bits are reserved for system use.
- *)
-
- (* bit definitions for LocalVar.type: *)
- var * = 0; (* an variable *)
- alias * = 1; (* an alias *)
- (* to be or'ed into LocalVar.type: *)
- ignore * = 7; (* ignore this entry on GetVar, etc *)
-
- (* definitions of flags passed to GetVar()/SetVar()/DeleteVar() *)
- (* bit defs to be OR'ed with the type: *)
- (* item will be treated as a single line of text unless binaryVAR is used *)
- globalOnly * = 8;
- localOnly * = 9;
- binaryVar * = 10; (* treat variable as binary *)
- dontNullTerm * = 11; (* only with gvBinaryVar *)
-
- (* this is only supported in >= V39 dos. V37 dos ignores this. *)
- (* this causes SetVar to affect ENVARC: as well as ENV:. *)
- saveVar * = 12; (* only with gvGlobalVar *)
-
-
- (*
- ** $VER: dostags.h 36.11 (29.4.91)
- **
- ** Tag definitions for all Dos routines using tags
- *)
-
- CONST
-
- (*****************************************************************************)
- (* definitions for the System() call *)
-
- sysDummy * = u.user + 32;
- sysInput * = sysDummy + 1; (* specifies the input filehandle *)
- sysOutput * = sysDummy + 2; (* specifies the output filehandle *)
- sysAsynch * = sysDummy + 3; (* run asynch, close input/output on exit(!) *)
- sysUserShell * = sysDummy + 4; (* send to user shell instead of boot shell *)
- sysCustomShell* = sysDummy + 5; (* send to a specific shell (data is name) *)
-
- (*****************************************************************************)
- (* definitions for the CreateNewProc() call *)
- (* you MUST specify one of npSeglist or npEntry. All else is optional. *)
-
- npDummy * = u.user + 1000;
- npSeglist * = npDummy + 1; (* seglist of code to run for the process *)
- npFreeSeglist * = npDummy + 2; (* free seglist on exit - only valid for *)
- (* for npSeglist. Default is TRUe. *)
- npEntry * = npDummy + 3; (* entry point to run - mutually exclusive *)
- (* with npSeglist! *)
- npInput * = npDummy + 4; (* filehandle - default is Open("NIL:"...) *)
- npOutput * = npDummy + 5; (* filehandle - default is Open("NIL:"...) *)
- npCloseInput * = npDummy + 6; (* close input filehandle on exit *)
- (* default TRUE *)
- npCloseOutput * = npDummy + 7; (* close output filehandle on exit *)
- (* default TRUE *)
- npError * = npDummy + 8; (* filehandle - default is Open("NIL:"...) *)
- npCloseError * = npDummy + 9; (* close error filehandle on exit *)
- (* default TRUE *)
- npCurrentDir * = npDummy + 10; (* lock - default is parent's current dir *)
- npStackSize * = npDummy + 11; (* stacksize for process - default 4000 *)
- npName * = npDummy + 12; (* name for process - default "New Process"*)
- npPriority * = npDummy + 13; (* priority - default same as parent *)
- npConsoleTask * = npDummy + 14; (* consoletask - default same as parent *)
- npWindowPtr * = npDummy + 15; (* window ptr - default is same as parent *)
- npHomeDir * = npDummy + 16; (* home directory - default curr home dir *)
- npCopyVars * = npDummy + 17; (* boolean to copy local vars-default TRUE *)
- npCli * = npDummy + 18; (* create cli structure - default FALSE *)
- npPath * = npDummy + 19; (* path - default is copy of parents path *)
- (* only valid if a cli process! *)
- npCommandName * = npDummy + 20; (* commandname - valid only for CLI *)
- npArguments * = npDummy + 21; (* cstring of arguments - passed with str in a0, length in d0. *)
- (* (copied and freed on exit.) Default is 0-length NULL ptr. *)
- (* NOTE: not operational until V37 - see BIX/TechNotes for *)
- (* more info/workaround. In V36, the registers were random. *)
- (* You must NEVER use npArguments with a npInput of NULL. *)
- (* FIX! should this be only for cli's? *)
- npNotifyOnDeath* = npDummy + 22; (* notify parent on death - default FALSE *)
- (* Not functional yet. *)
- npSynchronous * = npDummy + 23; (* don't return until process finishes - *)
- (* default FALSe. *)
- (* Not functional yet. *)
- npExitCode * = npDummy + 24; (* code to be called on process exit *)
- npExitData * = npDummy + 25; (* optional argument for npEndCode rtn - *)
- (* default NULL *)
-
-
- (*****************************************************************************)
- (* tags for AllocDosObject *)
-
- adoDummy * = u.user + 2000;
- adoFHMode * = adoDummy + 1;
- (* for type dosFILEHANDLE only *)
- (* sets up FH for mode specified.
- This can make a big difference for buffered
- files. *)
- (* The following are for dosCLI *)
- (* If you do not specify these, dos will use it's preferred values *)
- (* which may change from release to release. The BPTRs to these *)
- (* will be set up correctly for you. Everything will be zero, *)
- (* except cliFailLevel (10) and cliBackground (DOSTRUE). *)
- (* NOTE: you may also use these 4 tags with CreateNewProc. *)
-
- adoDirLen * = adoDummy + 2; (* size in bytes for current dir buffer *)
- adoCommNameLen* = adoDummy + 3; (* size in bytes for command name buffer *)
- adoCommFileLen* = adoDummy + 4; (* size in bytes for command file buffer *)
- adoPromptLen * = adoDummy + 5; (* size in bytes for the prompt buffer *)
-
- (*****************************************************************************)
- (* tags for NewLoadSeg *)
- (* no tags are defined yet for NewLoadSeg *)
-
-
- (*
- ** $VER: exall.h 36.6 (5.4.92)
- **
- ** include file for ExAll() data structures
- *)
-
- (* NOTE: V37 dos.library, when doing ExAll() emulation, and V37 filesystems *)
- (* will return an error if passed edOwner. If you get errorBadNumber, *)
- (* retry with edComment to get everything but owner info. All filesystems *)
- (* supporting ExAll() must support through edComment, and must check Type *)
- (* and return errorBadNumber if they don't support the type. *)
-
- CONST
-
- (* values that can be passed for what data you want from ExAll() *)
- (* each higher value includes those below it (numerically) *)
- (* you MUST chose one of these values *)
- name * = 1;
- type * = 2;
- size * = 3;
- protection * = 4;
- date * = 5;
- comment * = 6;
- owner * = 7;
-
- TYPE
-
- (*
- * Structure in which exall results are returned in. Note that only the
- * fields asked for will exist!
- *)
-
- ExAllData* = RECORD
- next * : ExAllDataPtr;
- name * : e.LSTRPTR;
- type * : LONGINT;
- size * : e.ULONG;
- prot * : s.SET32;
- days * : e.ULONG;
- mins * : e.ULONG;
- ticks * : e.ULONG;
- comment * : e.LSTRPTR; (* strings will be after last used field *)
- ownerUID * : e.UWORD; (* new for V39 *)
- ownerGID * : e.UWORD;
- END; (* ExAllData *)
-
- (*
- * Control structure passed to ExAll. Unused fields MUST be initialized to
- * 0, expecially eacLastKey.
- *
- * eacMatchFunc is a hook (see utility.library documentation for usage)
- * It should return true if the entry is to returned, false if it is to be
- * ignored.
- *
- * This structure MUST be allocated by AllocDosObject()!
- *)
-
- ExAllControl* = RECORD
- entries * : e.ULONG; (* number of entries returned in buffer *)
- lastKey * : e.ULONG; (* Don't touch inbetween linked ExAll calls! *)
- matchString* : e.LSTRPTR; (* wildcard string for pattern match or NULL *)
- matchFunc * : u.HookPtr; (* optional private wildcard function *)
- END; (* ExAllControl *)
-
- (*
- ** $VER: dosextens.h 36.41 (14.5.92)
- **
- ** DOS structures not needed for the casual AmigaDOS user
- *)
-
- TYPE
-
- (* All DOS processes have this structure *)
- (* Create and Device Proc returns pointer to the MsgPort in this structure *)
- (* devproc* = (DeviceProc(..) - SIZE (Task)); *)
-
- Process* = RECORD (e.TaskBase)
- task * : e.Task;
- msgPort * : e.MsgPort; (* This is BPTR address from DOS functions *)
- pad * : INTEGER; (* Remaining variables on 4 byte boundaries *)
- segList * : e.BPTR; (* Array of seg lists used by this process *)
- stackSize * : LONGINT; (* Size of process stack in bytes *)
- globVec * : e.APTR; (* Global vector for this process (BCPL) *)
- taskNum * : LONGINT; (* CLI task number of zero if not a CLI *)
- stackBase * : e.BPTR; (* Ptr to high memory end of process stack *)
- result2 * : LONGINT; (* Value of secondary result from last call *)
- currentDir * : FileLockPtr; (* Lock associated with current directory *)
- cis * : FileHandlePtr; (* Current CLI Input Stream *)
- cos * : FileHandlePtr; (* Current CLI Output Stream *)
- consoleTask * : ProcessId; (* Console handler process for current window*)
- fileSystemTask* : ProcessId; (* File handler process for current drive *)
- cli * : CommandLineInterfacePtr;
- (* pointer to CommandLineInterface *)
- returnAddr * : e.APTR; (* pointer to previous stack frame *)
- pktWait * : e.APTR; (* Function to be called when awaiting msg *)
- windowPtr * : e.APTR; (* Window for error printing *)
-
- (* following definitions are new with 2.0 *)
- homeDir * : FileLockPtr; (* Home directory of executing program *)
- flags * : s.SET32; (* flags telling dos about process *)
- exitCode * : e.PROC; (* code to call on exit of program or NULL *)
- exitData * : LONGINT; (* Passed as an argument to prExitCode. *)
- arguments * : e.LSTRPTR; (* Arguments passed to the process at start *)
- localVars * : e.MinList; (* Local environment variables *)
- shellPrivate * : e.ULONG; (* for the use of the current shell *)
- ces * : FileHandlePtr; (* Error stream - if NULL, use prCOS *)
- END; (* Process *)
-
- CONST
-
- (*
- * Flags for Process.prFlags
- *)
- freeSegList * = 0;
- freeCurrDir * = 1;
- freeCli * = 2;
- closeInput * = 3;
- closeOutput * = 4;
- freeArgs * = 5;
-
- TYPE
-
- (* The long word address (BPTR) of this structure is returned by
- * Open() and other routines that return a file. You need only worry
- * about this struct to do async io's via PutMsg() instead of
- * standard file system calls *)
-
- FileHandle* = RECORD
- link * : e.MessagePtr; (* EXEC message *)
- port * : e.MsgPortPtr; (* Reply port for the packet *)
- type * : ProcessId; (* Port to do PutMsg() to
- * Address is negative if a plain file *)
- buf * : LONGINT;
- pos * : LONGINT;
- end * : LONGINT;
- func1 * : LONGINT;
- func2 * : LONGINT;
- func3 * : LONGINT;
- arg1 * : LONGINT;
- arg2 * : LONGINT;
- END; (* FileHandle *)
-
- (* This is the extension to EXEC Messages used by DOS *)
-
- DosPacket* = RECORD
- link* : e.MessagePtr; (* EXEC message *)
- port* : e.MsgPortPtr; (* Reply port for the packet *)
- (* Must be filled in each send. *)
- type* : LONGINT; (* See action... below and
- * 'R' means Read, 'W' means Write to the
- * file system *)
- res1* : LONGINT; (* For file system calls this is the result
- * that would have been returned by the
- * function, e.g. Write ('W') returns actual
- * length written *)
- res2* : LONGINT; (* For file system calls this is what would
- * have been returned by IoErr() *)
- arg1* : LONGINT;
- arg2* : LONGINT;
- arg3* : LONGINT;
- arg4* : LONGINT;
- arg5* : LONGINT;
- arg6* : LONGINT;
- arg7* : LONGINT;
- END; (* DosPacket *)
-
- (* A Packet does not require the Message to be before it in memory, but
- * for convenience it is useful to associate the two.
- * Also see the function initstdpkt for initializing this structure *)
-
- StandardPacket* = RECORD (e.MessageBase)
- msg * : e.Message;
- pkt * : DosPacket;
- END; (* StandardPacket *)
-
- CONST
-
- (* DosPacket types *)
- nil * = 0;
- startup * = 0;
- getBlock * = 2; (* OBSOLETE *)
- setMap * = 4;
- die * = 5;
- event * = 6;
- currentVolume * = 7;
- locateObject * = 8;
- renameDisk * = 9;
- write * = ORD ("W");
- read * = ORD ("R");
- freeLock * = 15;
- deleteObject * = 16;
- renameObject * = 17;
- moreCache * = 18;
- copyDir * = 19;
- waitChar * = 20;
- setProtect * = 21;
- createDir * = 22;
- examineObject * = 23;
- examineNext * = 24;
- diskInfo * = 25;
- info * = 26;
- flush * = 27;
- setComment * = 28;
- parent * = 29;
- timer * = 30;
- inhibit * = 31;
- diskType * = 32;
- diskChange * = 33;
- setDate * = 34;
-
- screenMode * = 994;
-
- readReturn * = 1001;
- writeReturn * = 1002;
- seek * = 1008;
- findUpdate * = 1004;
- findInput * = 1005;
- findOutput * = 1006;
- actionEnd * = 1007;
- setFileSize * = 1022; (* fast file system only in 1.3 *)
- writeprotect * = 1023; (* fast file system only in 1.3 *)
-
- (* new 2.0 packets *)
- sameLock * = 40;
- changeSignal * = 995;
- format * = 1020;
- makeLink * = 1021;
-
- readLink * = 1024;
- fhFromLock * = 1026;
- isFileSystem * = 1027;
- changeMode * = 1028;
-
- copyDirFH * = 1030;
- parentFH * = 1031;
- examineAll * = 1033;
- examineFH * = 1034;
-
- lockRecord * = 2008;
- freeRecord * = 2009;
-
- addNotify * = 4097;
- removeNotify * = 4098;
-
- (* Added in V39: *)
- examineAllEnd * = 1035;
- setOwner * = 1036;
-
- (* Tell a file system to serialize the current volume. This is typically
- * done by changing the creation date of the disk. This packet does not take
- * any arguments. NOTE: be prepared to handle failure of this packet for
- * V37 ROM filesystems.
- *)
- serializeDisk * = 4200;
-
- TYPE
-
- (*
- * A structure for holding error messages - stored as array with error = 0
- * for the last entry.
- *)
- ErrorString* = RECORD
- nums * : e.APTR;
- strings* : e.APTR;
- END; (* ErrorString *)
-
- (* DOS library node structure.
- * This is the data at positive offsets from the library node.
- * Negative offsets from the node is the jump table to DOS functions
- * node = OpenLibrary( "dos.library" .. ) *)
-
- DosLibrary* = RECORD (e.LibraryBase)
- lib * : e.Library;
- root * : RootNodePtr; (* Pointer to RootNode, described below *)
- gv * : e.APTR; (* Pointer to BCPL global vector *)
- a2 : LONGINT; (* BCPL standard register values *)
- a5 : LONGINT;
- a6 : LONGINT;
- errors * : ErrorStringPtr; (* PRIVATE pointer to array of error msgs *)
- timeReq : t.TimeRequestPtr; (* PRIVATE pointer to timer request *)
- utilityBase : e.LibraryPtr; (* PRIVATE ptr to utility library *)
- intuitionBase : e.LibraryPtr (* PRIVATE ptr to intuition library *)
- END; (* DosLibrary *)
-
- TaskArray* = RECORD
- maxCLI * : LONGINT;
- cli * : ARRAY 32767 OF ProcessId;
- END; (* TaskArray *)
-
- RootNode* = RECORD
- taskArray * : TaskArrayPtr; (* [0] is max number of CLI's
- * [1] is APTR to process id of CLI 1
- * [n] is APTR to process id of CLI n *)
- consoleSegment* : e.BPTR; (* SegList for the CLI *)
- time * : Date; (* Current time *)
- restartSeg * : e.BPTR; (* SegList for the disk validator process *)
- info * : DosInfoPtr; (* Pointer to the Info structure *)
- fileHandlerSegment* : e.BPTR; (* segment for a file handler *)
- cliList * : e.MinList; (* new list of all CLI processes *)
- (* the first cplArray is also rnTaskArray *)
- bootProc * : ProcessId; (* private ptr to msgport of boot fs *)
- shellSegment * : e.BPTR; (* seglist for Shell (for NewShell) *)
- flags * : s.SET32; (* dos flags *)
- END; (* RootNode *)
-
- CONST
-
- wildStar * = 24;
- private1 = 1; (* private for dos *)
-
- TYPE
-
- (* ONLY to be allocated by DOS! *)
- CliProcList* = RECORD (e.MinNodeBase)
- node * : e.MinNode;
- first* : LONGINT; (* number of first entry in array *)
- array* : POINTER TO ARRAY 32767 OF ProcessId;
- (* [0] is max number of CLI's in this entry (n)
- * [1] is CPTR to process id of CLI cplFirst
- * [n] is CPTR to process id of CLI cplFirst+n-1
- *)
- END; (* CliProcList *)
-
- DosInfo* = RECORD
- mcName * : e.BPTR; (* PRIVATE: system resident module list *)
- devInfo * : DevInfoPtr; (* Device List *)
- devices * : e.BPTR; (* Currently zero *)
- handlers * : e.BPTR; (* Currently zero *)
- netHand * : ProcessId; (* Network handler processid; currently zero *)
- devLock * : e.SignalSemaphore; (* do NOT access directly! *)
- entryLock * : e.SignalSemaphore; (* do NOT access directly! *)
- deleteLock* : e.SignalSemaphore; (* do NOT access directly! *)
- END; (* DosInfo *) (* DosInfo *)
-
- (* structure for the Dos resident list. Do NOT allocate these, use *)
- (* AddSegment(), and heed the warnings in the autodocs! *)
-
- Segment* = RECORD
- next* : e.BPTR;
- uc * : LONGINT;
- seg * : e.BPTR;
- name* : ARRAY 4 OF CHAR; (* actually the first 4 chars of BSTR name *)
- END; (* Segment *)
-
- CONST
-
- cmdSystem * = -1;
- cmdInternal * = -2;
- cmdDisabled * = -999;
-
- TYPE
-
- PathLockPtr * = POINTER TO PathLock;
- PathLock * = RECORD
- next * : PathLockPtr;
- lock * : FileLockPtr;
- END; (* PathLock *)
-
-
- (* DOS Processes started from the CLI via RUN or NEWCLI have this additional
- * set to data associated with them *)
-
- CommandLineInterface* = RECORD
- result2 * : LONGINT; (* Value of IoErr from last command *)
- setName * : BSTR; (* Name of current directory *)
- commandDir * : PathLockPtr; (* Head of the path locklist *)
- returnCode * : LONGINT; (* Return code from last command *)
- commandName * : BSTR; (* Name of current command *)
- failLevel * : LONGINT; (* Fail level (set by FAILAT) *)
- prompt * : BSTR; (* Current prompt (set by PROMPT) *)
- standardInput * : FileHandlePtr; (* Default (terminal) CLI input *)
- currentInput * : FileHandlePtr; (* Current CLI input *)
- commandFile * : BSTR; (* Name of EXECUTE command file *)
- interactive * : LONGINT; (* Boolean; True if prompts required *)
- background * : LONGINT; (* Boolean; True if CLI created by RUN *)
- currentOutput * : FileHandlePtr; (* Current CLI output *)
- defaultStack * : LONGINT; (* Stack size to be obtained in long words *)
- standardOutput* : FileHandlePtr; (* Default (terminal) CLI output *)
- module * : e.BPTR; (* SegList of currently loaded command *)
- END; (* CommandLineInterface *)
- CommandLineInterfaceAPtr* = POINTER TO CommandLineInterface;
-
- (* This structure can take on different values depending on whether it is
- * a device, an assigned directory, or a volume. Below is the structure
- * reflecting volumes only. Following that is the structure representing
- * only devices. Following that is the unioned structure representing all
- * the values
- *)
-
- DosListNode * = RECORD END;
-
- (* structure representing a volume *)
-
- DeviceList* = RECORD (DosListNode)
- next * : DeviceListPtr; (* bptr to next device list *)
- type * : LONGINT; (* see DLT below *)
- task * : ProcessId; (* ptr to handler task *)
- lock * : FileLockPtr; (* not for volumes *)
- volumeDate* : Date; (* creation date *)
- lockList * : FileLockPtr; (* outstanding locks *)
- diskType * : LONGINT; (* 'DOS', etc *)
- unused * : LONGINT;
- name * : BSTR; (* bptr to bcpl name *)
- END; (* DeviceList *)
- DeviceListAPtr* = POINTER TO DeviceList;
-
- (* device structure (same as the DeviceNode structure in filehandler.h) *)
-
- DevInfo* = RECORD (DosListNode)
- next * : DevInfoPtr;
- type * : LONGINT;
- task * : ProcessId;
- lock * : FileLockPtr;
- handler * : BSTR;
- stackSize* : LONGINT;
- priority * : LONGINT;
- startup * : FileSysStartupMsgPtr;
- segList * : e.BPTR;
- globVec * : e.BPTR;
- name * : BSTR;
- END; (* DevInfo *)
- DevInfoAPtr* = POINTER TO DevInfo;
-
- (* structure used for multi-directory assigns. AllocVec()ed. *)
-
- AssignList* = RECORD
- next* : AssignListPtr;
- lock* : FileLockPtr;
- END; (* AssignList *)
-
- (* combined structure for devices, assigned directories, volumes *)
-
- DosList* = RECORD (DosListNode)
- next * : DevInfoPtr; (* bptr to next device on list *)
- type * : LONGINT; (* see DLT below *)
- task * : ProcessId; (* ptr to handler task *)
- lock * : FileLockPtr;
- assignName* : e.LSTRPTR; (* name for non-or-late-binding assign *)
- list * : AssignListPtr; (* for multi-directory assigns (regular) *)
- unused * : ARRAY 4 OF LONGINT;
-
- name * : BSTR; (* bptr to bcpl name *)
- END; (* DosList *)
- DosListAPtr* = POINTER TO DosList;
-
- CONST
-
- (* definitions for DosList.type *)
- device * = 0;
- directory * = 1; (* assign *)
- volume * = 2;
- late * = 3; (* late-binding assign *)
- nonBinding * = 4; (* non-binding assign *)
- private * = -1; (* for internal use only *)
-
- TYPE
-
- (* structure return by GetDeviceProc() *)
- DevProc* = RECORD
- port * : e.MsgPortPtr;
- lock * : FileLockPtr;
- flags * : s.SET32;
- devNode : DosListNodePtr; (* DON'T TOUCH OR USE! *)
- END; (* DevProc *)
-
- CONST
-
- (* definitions for DevProc.flags *)
- unLock * = 0;
- assign * = 1;
-
- (* Flags to be passed to LockDosList(), etc *)
- devices * = 2;
- volumes * = 3;
- assigns * = 4;
- entry * = 5;
- ldDelete * = 6;
-
- (* you MUST specify one of read or write *)
- dosListRead * = 0;
- dosListWrite * = 1;
-
- (* actually all but ldEntry (which is used for internal locking) *)
- all * = {devices, volumes, assigns};
-
- TYPE
-
- (* a lock structure, as returned by Lock() or DupLock() *)
- FileLock* = RECORD
- link * : FileLockPtr; (* bcpl pointer to next lock *)
- key * : LONGINT; (* disk block number *)
- access* : LONGINT; (* exclusive or shared *)
- task * : ProcessId; (* handler task's port *)
- volume* : DeviceListPtr; (* bptr to dltVOLUME DosList entry *)
- END; (* FileLock *)
-
- CONST
-
- (* error report types for ErrorReport() *)
- reportStream * = 0; (* a stream *)
- reportTask * = 1; (* a process - unused *)
- reportLock * = 2; (* a lock *)
- reportVolume * = 3; (* a volume node *)
- reportInsert * = 4; (* please insert volume *)
-
- (* Special error codes for ErrorReport() *)
- diskError * = 296; (* Read/write error *)
- abortBusy * = 288; (* You MUST replace... *)
-
- (* types for initial packets to shells from run/newcli/execute/system. *)
- (* For shell-writers only *)
- runExecute * = -1;
- runSystem * = -2;
- runSystemAsynch * = -3;
-
- (* Types for fibDirEntryType. NOTE that both USERDIR and ROOT are *)
- (* directories, and that directory/file checks should use <0 and >=0. *)
- (* This is not necessarily exhaustive! Some handlers may use other *)
- (* values as needed, though <0 and >=0 should remain as supported as *)
- (* possible. *)
- root * = 1;
- userDir * = 2;
- softLink * = 3; (* looks like dir, but may point to a file! *)
- linkDir * = 4; (* hard link to dir *)
- file * = -3; (* must be negative for FIB! *)
- linkFile * = -4; (* hard link to file *)
- pipeFile * = -5; (* for pipes that(s}pport ExamineFH *)
-
- (*
- ** $VER: stdio.h 36.6 (1.11.91)
- **
- ** ANSI-like stdio defines for dos buffered I/O
- *)
-
- CONST
-
- (* types for SetVBuf *)
- bufLine * = 0; (* flush on \n, etc *)
- bufFull * = 1; (* never flush except when needed *)
- bufNone * = 2; (* no buffering *)
-
- (* EOF return value *)
- endStreamCh * = -1;
-
-
- (**-- Library Base variable --------------------------------------------*)
-
- VAR
-
- base* : DosLibraryPtr;
-
-
- (**-- Library Functions ------------------------------------------------*)
-
- TYPE
- OwnerInfo * = RECORD (* dummy for better access on SetOwner etc.*)
- uid *: INTEGER;
- gid *: INTEGER;
- END;
-
- (*
- ** $VER: dos_protos.h 36.31 (17.12.92)
- *)
-
-
- PROCEDURE Open* [base,-30]
- ( name [1] : ARRAY OF CHAR;
- accessMode [2] : LONGINT)
- : FileHandlePtr;
- PROCEDURE Close* [base,-36]
- ( file [1] : FileHandlePtr )
- : BOOLEAN;
- PROCEDURE OldClose* [base,-36]
- ( file [1] : FileHandlePtr );
- PROCEDURE Read* [base,-42]
- ( file [1] : FileHandlePtr;
- VAR buffer [2] : ARRAY OF SYS.BYTE;
- length [3] : LONGINT)
- : LONGINT;
- PROCEDURE Write* [base,-48]
- ( file [1] : FileHandlePtr;
- buffer [2] : ARRAY OF SYS.BYTE;
- length [3] : LONGINT)
- : LONGINT;
- PROCEDURE Input* [base,-54] ()
- : FileHandlePtr;
- PROCEDURE Output* [base,-60] ()
- : FileHandlePtr;
- PROCEDURE Seek* [base,-66]
- ( file [1] : FileHandlePtr;
- position [2] : LONGINT;
- offset [3] : LONGINT)
- : LONGINT;
- PROCEDURE DeleteFile* [base,-72]
- ( name [1] : ARRAY OF CHAR )
- : BOOLEAN;
- PROCEDURE Rename* [base,-78]
- ( oldName [1] : ARRAY OF CHAR;
- newName [2] : ARRAY OF CHAR )
- : BOOLEAN;
- PROCEDURE Lock* [base,-84]
- ( name [1] : ARRAY OF CHAR;
- type [2] : LONGINT)
- : FileLockPtr;
- PROCEDURE UnLock* [base,-90]
- ( lock [1] : FileLockPtr );
- PROCEDURE DupLock* [base,-96]
- ( lock [1] : FileLockPtr )
- : FileLockPtr;
- PROCEDURE Examine* [base,-102]
- ( lock [1] : FileLockPtr;
- VAR fib [2] : FileInfoBlock )
- : BOOLEAN;
- PROCEDURE ExNext* [base,-108]
- ( lock [1] : FileLockPtr;
- VAR fib [2] : FileInfoBlock )
- : BOOLEAN;
- PROCEDURE Info* [base,-114]
- ( lock [1] : FileLockPtr;
- VAR info [2] : InfoData )
- : BOOLEAN;
- PROCEDURE CreateDir* [base,-120]
- ( name [1] : ARRAY OF CHAR )
- : FileLockPtr;
- PROCEDURE CurrentDir* [base,-126]
- ( lock [1] : FileLockPtr )
- : FileLockPtr;
- PROCEDURE IoErr* [base,-132] ()
- : LONGINT;
- PROCEDURE CreateProc* [base,-138]
- ( name [1] : ARRAY OF CHAR;
- pri [2] : LONGINT;
- segList [3] : e.BPTR;
- stackSize [4] : LONGINT)
- : ProcessId;
- PROCEDURE Exit* [base,-144]
- ( returnCode [1] : LONGINT);
- PROCEDURE LoadSeg* [base,-150]
- ( name [1] : ARRAY OF CHAR )
- : e.BPTR;
- PROCEDURE UnLoadSeg* [base,-156]
- ( seglist [1] : e.BPTR );
- PROCEDURE DeviceProc* [base,-174]
- ( name [1] : ARRAY OF CHAR )
- : ProcessId;
- PROCEDURE SetComment* [base,-180]
- ( name [1] : ARRAY OF CHAR;
- comment [2] : ARRAY OF CHAR )
- : BOOLEAN;
- PROCEDURE SetProtection* [base,-186]
- ( name [1] : ARRAY OF CHAR;
- protect [2] : s.SET32)
- : BOOLEAN;
- PROCEDURE DateStamp* [base,-192]
- ( VAR date [1] : DateBase );
- PROCEDURE Delay* [base,-198]
- ( timeout [1] : e.ULONG);
- PROCEDURE WaitForChar* [base,-204]
- ( file [1] : FileHandlePtr;
- timeout [2] : LONGINT)
- : BOOLEAN;
- PROCEDURE ParentDir* [base,-210]
- ( lock [1] : FileLockPtr )
- : FileLockPtr;
- PROCEDURE IsInteractive* [base,-216]
- ( file [1] : FileHandlePtr )
- : BOOLEAN;
- PROCEDURE Execute* [base,-222]
- ( string [1] : ARRAY OF CHAR;
- file [2] : FileHandlePtr;
- file2 [3] : FileHandlePtr )
- : BOOLEAN;
-
- (* --- functions in V36 or higher (distributed as Release 2.0) ---*)
-
- (* DOS Object creation/deletion *)
-
- PROCEDURE AllocDosObject* [base,-228]
- ( type [1] : e.ULONG;
- tags [2] : ARRAY OF u.TagItem )
- : e.APTR;
- PROCEDURE AllocDosObjectTags* [base,-228]
- ( type [1] : e.ULONG;
- tags [2].. : u.Tag )
- : e.APTR;
- PROCEDURE FreeDosObject* [base,-234]
- ( type [1] : e.ULONG;
- ptr [2] : e.APTR );
-
- (* Packet Level routines *)
-
- PROCEDURE DoPkt* [base,-240]
- ( port [1] : ProcessId;
- action [2] : LONGINT;
- arg1 [3] : LONGINT;
- arg2 [4] : LONGINT;
- arg3 [5] : LONGINT;
- arg4 [6] : LONGINT;
- arg5 [7] : LONGINT)
- : LONGINT;
- PROCEDURE DoPkt0* [base,-240]
- ( port [1] : ProcessId;
- action [2] : LONGINT)
- : LONGINT;
- PROCEDURE DoPkt1* [base,-240]
- ( port [1] : ProcessId;
- action [2] : LONGINT;
- arg1 [3] : LONGINT)
- : LONGINT;
- PROCEDURE DoPkt2* [base,-240]
- ( port [1] : ProcessId;
- action [2] : LONGINT;
- arg1 [3] : LONGINT;
- arg2 [4] : LONGINT)
- : LONGINT;
- PROCEDURE DoPkt3* [base,-240]
- ( port [1] : ProcessId;
- action [2] : LONGINT;
- arg1 [3] : LONGINT;
- arg2 [4] : LONGINT;
- arg3 [5] : LONGINT)
- : LONGINT;
- PROCEDURE DoPkt4* [base,-240]
- ( port [1] : ProcessId;
- action [2] : LONGINT;
- arg1 [3] : LONGINT;
- arg2 [4] : LONGINT;
- arg3 [5] : LONGINT;
- arg4 [6] : LONGINT)
- : LONGINT;
- PROCEDURE SendPkt* [base,-246]
- ( VAR dp [1] : DosPacket;
- port [2] : ProcessId;
- replyport [3] : e.MsgPortPtr );
- PROCEDURE WaitPkt* [base,-252] ()
- : DosPacketPtr;
- PROCEDURE ReplyPkt* [base,-258]
- ( dp [1] : DosPacketPtr;
- res1 [2] : LONGINT;
- res2 [3] : LONGINT);
- PROCEDURE AbortPkt* [base,-264]
- ( port [1] : ProcessId;
- pkt [2] : DosPacketPtr );
-
- (* Record Locking *)
-
- PROCEDURE LockRecord* [base,-270]
- ( fh [1] : FileHandlePtr;
- offset [2] : e.ULONG;
- length [3] : e.ULONG;
- mode [4] : e.ULONG;
- timeout [5] : e.ULONG )
- : BOOLEAN;
- PROCEDURE LockRecords* [base,-276]
- ( recArray [1] : RecordLockPtr;
- timeout [2] : e.ULONG )
- : BOOLEAN;
- PROCEDURE UnLockRecord* [base,-282]
- ( fh [1] : FileHandlePtr;
- offset [2] : e.ULONG;
- length [3] : e.ULONG )
- : BOOLEAN;
- PROCEDURE UnLockRecords* [base,-288]
- ( recArray [1] : RecordLockPtr )
- : BOOLEAN;
-
- (* Buffered File I/O *)
-
- PROCEDURE SelectInput* [base,-294]
- ( fh [1] : FileHandlePtr )
- : FileHandlePtr;
- PROCEDURE SelectOutput* [base,-300]
- ( fh [1] : FileHandlePtr )
- : FileHandlePtr;
- PROCEDURE FGetC* [base,-306]
- ( fh [1] : FileHandlePtr )
- : LONGINT;
- PROCEDURE FPutC* [base,-312]
- ( fh [1] : FileHandlePtr;
- ch [2] : LONGINT )
- : LONGINT;
- PROCEDURE UnGetC* [base,-318]
- ( fh [1] : FileHandlePtr;
- character [2] : LONGINT)
- : LONGINT;
- PROCEDURE FRead* [base,-324]
- ( fh [1] : FileHandlePtr;
- VAR block [2] : ARRAY OF SYS.BYTE;
- blocklen [3] : e.ULONG;
- number [4] : e.ULONG )
- : LONGINT;
- PROCEDURE FWrite* [base,-330]
- ( fh [1] : FileHandlePtr;
- block [2] : ARRAY OF SYS.BYTE;
- blocklen [3] : e.ULONG;
- number [4] : e.ULONG )
- : LONGINT;
- PROCEDURE FGets* [base,-336]
- ( fh [1] : FileHandlePtr;
- VAR buf [2] : ARRAY OF CHAR;
- buflen [3] : e.ULONG )
- : e.APTR;
- PROCEDURE FPuts* [base,-342]
- ( fh [1] : FileHandlePtr;
- str [2] : ARRAY OF CHAR )
- : BOOLEAN;
- PROCEDURE VFWritef* [base,-348]
- ( fh [1] : FileHandlePtr;
- format [2] : ARRAY OF CHAR;
- argv [3] : ARRAY OF SYS.BYTE )
- : LONGINT;
- PROCEDURE FWritef* [base,-348]
- ( fh [1] : FileHandlePtr;
- format [2] : ARRAY OF CHAR;
- argv [3].. : SYS.LONGWORD )
- : LONGINT;
- PROCEDURE VFPrintf* [base,-354]
- ( fh [1] : FileHandlePtr;
- format [2] : ARRAY OF CHAR;
- argv [3] : ARRAY OF SYS.LONGWORD )
- : LONGINT;
- PROCEDURE FPrintf* [base,-354]
- ( fh [1] : FileHandlePtr;
- format [2] : ARRAY OF CHAR;
- argv [3].. : SYS.LONGWORD )
- : LONGINT;
- PROCEDURE Flush* [base,-360]
- ( fh [1] : FileHandlePtr )
- : BOOLEAN;
- PROCEDURE SetVBuf* [base,-366]
- ( fh [1] : FileHandlePtr;
- VAR buff [2] : ARRAY OF CHAR;
- type [3] : LONGINT;
- size [4] : LONGINT)
- : LONGINT;
- PROCEDURE SetVBufPtr* [base,-366]
- ( fh [1] : FileHandlePtr;
- buff [2] : e.LSTRPTR;
- type [3] : LONGINT;
- size [4] : LONGINT)
- : LONGINT;
-
- (* DOS Object Management *)
-
- PROCEDURE DupLockFromFH* [base,-372]
- ( fh [1] : FileHandlePtr )
- : FileLockPtr;
- PROCEDURE OpenFromLock* [base,-378]
- ( lock [1] : FileLockPtr )
- : FileHandlePtr;
- PROCEDURE ParentOfFH* [base,-384]
- ( fh [1] : FileHandlePtr )
- : FileLockPtr;
- PROCEDURE ExamineFH* [base,-390]
- ( fh [1] : FileHandlePtr;
- VAR fib [2] : FileInfoBlock )
- : BOOLEAN;
- PROCEDURE SetFileDate* [base,-396]
- ( name [1] : ARRAY OF CHAR;
- VAR date [2] : DateBase )
- : BOOLEAN;
- PROCEDURE NameFromLock* [base,-402]
- ( lock [1] : FileLockPtr;
- VAR buffer [2] : ARRAY OF CHAR;
- len [3] : LONGINT)
- : BOOLEAN;
- PROCEDURE NameFromFH* [base,-408]
- ( fh [1] : FileHandlePtr;
- VAR buffer [2] : ARRAY OF CHAR;
- len [3] : LONGINT)
- : BOOLEAN;
- PROCEDURE SplitName* [base,-414]
- ( name [1] : ARRAY OF CHAR;
- seperator [2] : CHAR;
- VAR buf [3] : ARRAY OF CHAR;
- oldpos [4] : LONGINT;
- size [5] : LONGINT)
- : INTEGER;
- PROCEDURE SameLock* [base,-420]
- ( lock1 [1] : FileLockPtr;
- lock2 [2] : FileLockPtr )
- : INTEGER;
- PROCEDURE SetMode* [base,-426]
- ( fh [1] : FileHandlePtr;
- mode [2] : LONGINT)
- : BOOLEAN;
- PROCEDURE ExAll* [base,-432]
- ( lock [1] : FileLockPtr;
- buffer [2] : ARRAY OF SYS.BYTE;
- size [3] : LONGINT;
- data [4] : LONGINT;
- control [5] : ExAllControlPtr )
- : BOOLEAN;
- PROCEDURE ReadLink* [base,-438]
- ( port [1] : ProcessId;
- lock [2] : FileLockPtr;
- path [3] : ARRAY OF CHAR;
- VAR buffer [4] : ARRAY OF CHAR;
- size [5] : e.ULONG )
- : LONGINT;
- PROCEDURE MakeLink* [base,-444]
- ( name [1] : ARRAY OF CHAR;
- dest [2] : LONGINT;
- soft [3] : LONGINT)
- : LONGINT;
- PROCEDURE ChangeMode* [base,-450]
- ( type [1] : LONGINT; (* must be changeFH *)
- fh [2] : FileHandlePtr;
- newmode [3] : LONGINT)
- : BOOLEAN;
- PROCEDURE ChangeModeLock* [base,-450]
- ( type [1] : LONGINT; (* must be changeLock *)
- fh [2] : FileLockPtr;
- newmode [3] : LONGINT)
- : BOOLEAN;
- PROCEDURE SetFileSize* [base,-456]
- ( fh [1] : FileHandlePtr;
- pos [2] : LONGINT;
- mode [3] : LONGINT)
- : LONGINT;
-
- (* Error Handling *)
-
- PROCEDURE SetIoErr* [base,-462]
- ( result [1] : LONGINT)
- : LONGINT;
- PROCEDURE Fault* [base,-468]
- ( code [1] : LONGINT;
- header [2] : ARRAY OF CHAR;
- VAR buffer [3] : ARRAY OF CHAR;
- len [4] : LONGINT)
- : LONGINT;
- PROCEDURE PrintFault* [base,-474]
- ( code [1] : LONGINT;
- header [2] : ARRAY OF CHAR )
- : BOOLEAN;
- PROCEDURE ErrorReport* [base,-480]
- ( code [1] : LONGINT;
- type [2] : LONGINT;
- arg1 [3] : DeviceListAPtr;
- device [8] : ProcessId )
- : LONGINT;
- PROCEDURE ErrorReportLock* [base,-480]
- ( code [1] : LONGINT;
- type [2] : LONGINT;
- arg1 [3] : FileLockPtr;
- device [8] : ProcessId )
- : LONGINT;
- PROCEDURE ErrorReportFH* [base,-480]
- ( code [1] : LONGINT;
- type [2] : LONGINT;
- arg1 [3] : FileHandlePtr;
- device [8] : ProcessId )
- : LONGINT;
- PROCEDURE Requester* [base,-486]
- ( s1 [1] : ARRAY OF CHAR;
- s2 [2] : ARRAY OF CHAR;
- s3 [3] : ARRAY OF CHAR;
- flags [4] : s.SET32 )
- : LONGINT;
-
- (* Process Management *)
-
- PROCEDURE Cli* [base,-492] ()
- : CommandLineInterfaceAPtr;
- PROCEDURE CreateNewProc* [base,-498]
- ( tags [1] : ARRAY OF u.TagItem )
- : ProcessPtr;
- PROCEDURE CreateNewProcTags* [base,-498]
- ( tags [1].. : u.Tag )
- : ProcessPtr;
- PROCEDURE RunCommand* [base,-504]
- ( seg [1] : e.BPTR;
- stack [2] : LONGINT;
- paramptr [3] : ARRAY OF CHAR;
- paramlen [4] : LONGINT)
- : LONGINT;
- PROCEDURE GetConsoleTask* [base,-510] ()
- : ProcessId;
- PROCEDURE SetConsoleTask* [base,-516]
- ( task [1] : ProcessId )
- : ProcessId;
- PROCEDURE GetFileSysTask* [base,-522] ()
- : ProcessId;
- PROCEDURE SetFileSysTask* [base,-528]
- ( task [1] : ProcessId )
- : ProcessId;
- PROCEDURE GetArgStr* [base,-534] ()
- : e.LSTRPTR;
- PROCEDURE SetArgStr* [base,-540]
- ( string [1] : ARRAY OF CHAR )
- : e.LSTRPTR;
- PROCEDURE FindCliProc* [base,-546]
- ( num [1] : e.ULONG )
- : ProcessPtr;
- PROCEDURE MaxCli* [base,-552] ()
- : e.ULONG;
- PROCEDURE SetCurrentDirName* [base,-558]
- ( name [1] : ARRAY OF CHAR )
- : BOOLEAN;
- PROCEDURE GetCurrentDirName* [base,-564]
- ( VAR buf [1] : ARRAY OF CHAR;
- len [2] : LONGINT)
- : BOOLEAN;
- PROCEDURE SetProgramName* [base,-570]
- ( name [1] : ARRAY OF CHAR )
- : BOOLEAN;
- PROCEDURE GetProgramName* [base,-576]
- ( VAR buf [1] : ARRAY OF CHAR;
- len [2] : LONGINT)
- : BOOLEAN;
- PROCEDURE SetPrompt* [base,-582]
- ( name [1] : ARRAY OF CHAR )
- : BOOLEAN;
- PROCEDURE GetPrompt* [base,-588]
- ( VAR buf [1] : ARRAY OF CHAR;
- len [2] : LONGINT)
- : BOOLEAN;
- PROCEDURE SetProgramDir* [base,-594]
- ( lock [1] : FileLockPtr )
- : FileLockPtr;
- PROCEDURE GetProgramDir* [base,-600] ()
- : FileLockPtr;
-
- (* Device List Management *)
-
- PROCEDURE System* [base,-606]
- ( command [1] : ARRAY OF CHAR;
- tags [2] : ARRAY OF u.TagItem )
- : LONGINT;
- PROCEDURE SystemTags* [base,-606]
- ( command [1] : ARRAY OF CHAR;
- tags [2].. : u.Tag )
- : LONGINT;
- PROCEDURE AssignLock* [base,-612]
- ( name [1] : ARRAY OF CHAR;
- lock [2] : FileLockPtr )
- : BOOLEAN;
- PROCEDURE AssignLate* [base,-618]
- ( name [1] : ARRAY OF CHAR;
- path [2] : ARRAY OF CHAR )
- : BOOLEAN;
- PROCEDURE AssignPath* [base,-624]
- ( name [1] : ARRAY OF CHAR;
- path [2] : ARRAY OF CHAR )
- : BOOLEAN;
- PROCEDURE AssignAdd* [base,-630]
- ( name [1] : ARRAY OF CHAR;
- lock [2] : FileLockPtr )
- : BOOLEAN;
- PROCEDURE RemAssignList* [base,-636]
- ( name [1] : ARRAY OF CHAR;
- lock [2] : FileLockPtr )
- : LONGINT;
- PROCEDURE GetDeviceProc* [base,-642]
- ( name [1] : ARRAY OF CHAR;
- dp [2] : DevProcPtr )
- : DevProcPtr;
- PROCEDURE FreeDeviceProc* [base,-648]
- ( dp [1] : DevProcPtr );
- PROCEDURE LockDosList* [base,-654]
- ( flags [1] : s.SET32 )
- : DosListNodePtr;
- PROCEDURE UnLockDosList* [base,-660]
- ( flags [1] : s.SET32 );
- PROCEDURE AttemptLockDosList* [base,-666]
- ( flags [1] : s.SET32 )
- : DosListNodePtr;
- PROCEDURE RemDosEntry* [base,-672]
- ( dlist [1] : DosListNodePtr )
- : BOOLEAN;
- PROCEDURE AddDosEntry* [base,-678]
- ( dlist [1] : DosListNodePtr )
- : DosListNodePtr;
- PROCEDURE FindDosEntry* [base,-684]
- ( dlist [1] : DosListNodePtr;
- name [2] : ARRAY OF CHAR;
- flags [3] : s.SET32 )
- : DosListNodePtr;
- PROCEDURE NextDosEntry* [base,-690]
- ( dlist [1] : DosListNodePtr;
- flags [2] : s.SET32 )
- : DosListNodePtr;
- PROCEDURE MakeDosEntry* [base,-696]
- ( name [1] : ARRAY OF CHAR;
- type [2] : LONGINT)
- : DosListNodePtr;
- PROCEDURE FreeDosEntry* [base,-702]
- ( dlist [1] : DosListNodePtr );
- PROCEDURE IsFileSystem* [base,-708]
- ( name [1] : ARRAY OF CHAR )
- : BOOLEAN;
-
- (* Handler Interface *)
-
- PROCEDURE Format* [base,-714]
- ( filesystem [1] : ARRAY OF CHAR;
- volumename [2] : ARRAY OF CHAR;
- dostype [3] : e.ULONG )
- : BOOLEAN;
- PROCEDURE Relabel* [base,-720]
- ( drive [1] : ARRAY OF CHAR;
- newname [2] : ARRAY OF CHAR )
- : BOOLEAN;
- PROCEDURE Inhibit* [base,-726]
- ( name [1] : ARRAY OF CHAR;
- onoff [2] : LONGINT)
- : BOOLEAN;
- PROCEDURE AddBuffers* [base,-732]
- ( name [1] : ARRAY OF CHAR;
- number [2] : LONGINT)
- : BOOLEAN;
-
- (* Date, Time Routines *)
-
- PROCEDURE CompareDates* [base,-738]
- ( VAR date1 [1] : DateBase;
- VAR date2 [2] : DateBase )
- : LONGINT;
- PROCEDURE DateToStr* [base,-744]
- ( VAR datetime [1] : DateTime )
- : BOOLEAN;
- PROCEDURE StrToDate* [base,-750]
- ( VAR datetime [1] : DateTime )
- : BOOLEAN;
-
- (* Image Management *)
-
- PROCEDURE InternalLoadSeg* [base,-756]
- ( fh [1] : FileHandlePtr;
- table [8] : e.BPTR;
- funcarray [9] : e.APTR;
- VAR stack [10] : LONGINT )
- : e.BPTR;
- PROCEDURE InternalUnLoadSeg* [base,-762]
- ( seglist [1] : e.BPTR;
- freefunc [9] : e.PROC )
- : BOOLEAN;
- PROCEDURE NewLoadSeg* [base,-768]
- ( file [1] : ARRAY OF CHAR;
- tags [2] : ARRAY OF u.TagItem )
- : e.BPTR;
- PROCEDURE NewLoadSegTags* [base,-768]
- ( file [1] : ARRAY OF CHAR;
- tags [2].. : u.Tag )
- : e.BPTR;
- PROCEDURE AddSegment* [base,-774]
- ( name [1] : ARRAY OF CHAR;
- seg [2] : e.BPTR;
- system [3] : LONGINT)
- : BOOLEAN;
- PROCEDURE FindSegment* [base,-780]
- ( name [1] : ARRAY OF CHAR;
- seg [2] : SegmentPtr;
- system [3] : LONGINT)
- : SegmentPtr;
- PROCEDURE RemSegment* [base,-786]
- ( seg [1] : SegmentPtr )
- : BOOLEAN;
-
- (* Command Support *)
-
- PROCEDURE CheckSignal* [base,-792]
- ( mask [1] : s.SET32)
- : s.SET32;
- PROCEDURE OldReadArgs* [base,-798]
- ( template [1] : ARRAY OF CHAR;
- VAR array [2] : ARRAY OF SYS.BYTE;
- args [3] : RDArgsPtr )
- : RDArgsPtr;
- PROCEDURE ReadArgs* [base,-798]
- ( template [1] : ARRAY OF CHAR;
- VAR array [2] : ArgsStruct;
- args [3] : RDArgsPtr )
- : RDArgsPtr;
- PROCEDURE FindArg* [base,-804]
- ( template [1] : ARRAY OF CHAR;
- keyword [2] : ARRAY OF CHAR )
- : LONGINT;
- PROCEDURE ReadItem* [base,-810]
- ( VAR name [1] : ARRAY OF CHAR;
- maxchars [2] : LONGINT;
- cSource [3] : CSourcePtr )
- : LONGINT;
- PROCEDURE StrToLong* [base,-816]
- ( string [1] : ARRAY OF CHAR;
- VAR value [2] : LONGINT )
- : LONGINT;
- PROCEDURE MatchFirst* [base,-822]
- ( pat [1] : ARRAY OF CHAR;
- VAR anchor [2] : AnchorPath )
- : LONGINT;
- PROCEDURE MatchNext* [base,-828]
- ( VAR anchor [1] : AnchorPath )
- : LONGINT;
- PROCEDURE MatchEnd* [base,-834]
- ( VAR anchor [1] : AnchorPath );
- PROCEDURE ParsePattern* [base,-840]
- ( pat [1] : ARRAY OF CHAR;
- VAR buf [2] : ARRAY OF CHAR;
- buflen [3] : LONGINT)
- : INTEGER;
- PROCEDURE MatchPattern* [base,-846]
- ( pat [1] : ARRAY OF CHAR;
- str [2] : ARRAY OF CHAR )
- : BOOLEAN;
- PROCEDURE FreeArgs* [base,-858]
- ( args [1] : RDArgsPtr );
- PROCEDURE FilePart* [base,-870]
- ( path [1] : ARRAY OF CHAR )
- : e.LSTRPTR;
- PROCEDURE PathPart* [base,-876]
- ( path [1] : ARRAY OF CHAR )
- : e.LSTRPTR;
- PROCEDURE AddPart* [base,-882]
- ( VAR dirname [1] : ARRAY OF CHAR;
- filename [2] : ARRAY OF CHAR;
- size [3] : e.ULONG )
- : BOOLEAN;
-
- (* Notification *)
-
- PROCEDURE StartNotify* [base,-888]
- ( VAR notify [1] : NotifyRequest )
- : BOOLEAN;
- PROCEDURE EndNotify* [base,-894]
- ( VAR notify [1] : NotifyRequest );
-
- (* Environment Variable functions *)
-
- PROCEDURE SetVar* [base,-900]
- ( name [1] : ARRAY OF CHAR;
- VAR buffer [2] : ARRAY OF CHAR;
- size [3] : LONGINT;
- flags [4] : s.SET32)
- : BOOLEAN;
- PROCEDURE GetVar* [base,-906]
- ( name [1] : ARRAY OF CHAR;
- VAR buffer [2] : ARRAY OF CHAR;
- size [3] : LONGINT;
- flags [4] : s.SET32)
- : LONGINT;
- PROCEDURE DeleteVar* [base,-912]
- ( name [1] : ARRAY OF CHAR;
- flags [2] : s.SET32 )
- : BOOLEAN;
- PROCEDURE FindVar* [base,-918]
- ( name [1] : ARRAY OF CHAR;
- type [2] : s.SET32 )
- : LocalVarPtr;
- PROCEDURE CliInit* [base,-924]
- ( VAR dp [8] : DosPacket )
- : s.SET32;
- PROCEDURE CliInitNewcli* [base,-930]
- ( VAR dp [8] : DosPacket )
- : s.SET32;
- PROCEDURE CliInitRun* [base,-936]
- ( VAR dp [8] : DosPacket )
- : s.SET32;
- PROCEDURE WriteChars* [base,-942]
- ( buf [1] : ARRAY OF CHAR;
- buflen [2] : LONGINT )
- : LONGINT;
- PROCEDURE PutStr* [base,-948]
- ( str [1] : ARRAY OF CHAR )
- : LONGINT;
- PROCEDURE VPrintf* [base,-954]
- ( format [1] : ARRAY OF CHAR;
- argarray [2] : ARRAY OF SYS.BYTE )
- : LONGINT;
- PROCEDURE Printf* [base,-954]
- ( format [1] : ARRAY OF CHAR;
- argarray [2].. : SYS.LONGWORD )
- : LONGINT;
- PROCEDURE PrintF* [base,-954]
- ( format [1] : ARRAY OF CHAR;
- argarray [2].. : SYS.LONGWORD );
-
- (* these were unimplemented until dos 36.147 *)
-
- PROCEDURE ParsePatternNoCase* [base,-966]
- ( pat [1] : ARRAY OF CHAR;
- VAR buf [2] : ARRAY OF CHAR;
- buflen [3] : LONGINT)
- : INTEGER;
- PROCEDURE MatchPatternNoCase* [base,-972]
- ( pat [1] : ARRAY OF CHAR;
- str [2] : ARRAY OF CHAR )
- : BOOLEAN;
-
- (* this was added for V37 dos; returned 0 before then. *)
-
- PROCEDURE SameDevice* [base,-984]
- ( lock1 [1] : FileLockPtr;
- lock2 [2] : FileLockPtr )
- : BOOLEAN;
-
- (* NOTE: the following entries did NOT exist before ks 36.303 (2.02) *)
- (* If you are going to use them, open dos.library with version 37 *)
-
- (* These calls were added for V39 dos: *)
- PROCEDURE ExAllEnd* [base,-990]
- ( lock [1] : FileLockPtr;
- buffer [2] : ARRAY OF SYS.BYTE;
- size [3] : LONGINT;
- data [4] : LONGINT;
- control [5] : ExAllControlPtr );
- PROCEDURE SetOwner* [base,-996]
- ( name [1] : ARRAY OF CHAR;
- ownerInfo [2] : OwnerInfo)
- : BOOLEAN;
-
-
- (**-- C Macros ---------------------------------------------------------*)
-
- (*
- ** $VER: stdio.h 36.6 (1.11.91)
- **
- ** ANSI-like stdio defines for dos buffered I/O
- *)
-
-
- PROCEDURE [0] ReadChar * () : CHAR;
- VAR c : LONGINT;
- BEGIN
- c := FGetC (Input());
- IF (c < 0) OR (c > 255) THEN c := 0 END;
- RETURN CHR(c)
- END ReadChar;
-
- PROCEDURE [0] WriteChar * ( c : CHAR ) : LONGINT;
- BEGIN
- RETURN FPutC (Output (), ORD (c))
- END WriteChar;
-
- PROCEDURE [0] UnReadChar * ( c : CHAR ) : LONGINT;
- BEGIN
- RETURN UnGetC (Input(), ORD(c))
- END UnReadChar;
-
- (* next one is inefficient *)
-
- PROCEDURE [0] ReadChars *
- (VAR buf : ARRAY OF SYS.BYTE; num : LONGINT)
- : LONGINT;
- BEGIN
- RETURN FRead (Input (), buf, 1, num)
- END ReadChars;
-
- PROCEDURE [0] ReadLn * (VAR buf : ARRAY OF CHAR; len : LONGINT) : e.APTR;
- BEGIN
- RETURN FGets (Input (), buf, len)
- END ReadLn;
-
- PROCEDURE [0] WriteStr * (s : ARRAY OF CHAR) : BOOLEAN;
- <*$CopyArrays-*>
- BEGIN
- RETURN FPuts (Output (), s)
- END WriteStr;
-
- PROCEDURE [0] VWritef *
- (format : ARRAY OF CHAR; argv : ARRAY OF SYS.BYTE)
- : LONGINT;
- <*$CopyArrays-*>
- BEGIN
- RETURN VFWritef (Output(), format, argv)
- END VWritef;
-
- (*
- * Use this to convert a ProcessId (eg. WBStartup.process) to a ProcessPtr.
- *)
- PROCEDURE [0] ProcessIdToProcess*(id: ProcessId): ProcessPtr;
- BEGIN
- RETURN SYS.VAL(ProcessPtr,SYS.VAL(LONGINT,id)-SIZE(e.Task))
- END ProcessIdToProcess;
-
- (*
- * Use this to get a Process' ProcessId, ie. a pointer to its MsgPort.
- *)
- PROCEDURE [0] ProcessToProcessId*(proc: ProcessPtr): ProcessId;
- BEGIN
- RETURN SYS.ADR(proc.msgPort);
- END ProcessToProcessId;
-
- (**-- Library Base variable --------------------------------------------*)
-
- <*$LongVars-*>
-
- PROCEDURE* [0] CloseLib (VAR rc : LONGINT);
-
- BEGIN (* CloseLib *)
- IF base # NIL THEN e.CloseLibrary (base) END;
- END CloseLib;
-
- BEGIN (* Dos *)
- base := SYS.VAL (DosLibraryPtr,
- e.OpenLibrary (dosName, e.libraryMinimum));
- IF base = NIL THEN HALT (100) END;
- Kernel.SetCleanup (CloseLib)
- END Dos.
-