|##########|
|#MAGIC   #|CLABLKLH
|#PROJECT #|"IMPORTALL"
|#PATHS   #|"StdProject"
|#FLAGS   #|xx---x-xx-x-xxx--x--------------
|#USERSW  #|--------------------------------
|#USERMASK#|--------------------------------
|#SWITCHES#|xx---xxxxx------
|##########|
DEFINITION MODULE T_Dos;

| tested

| Adapting to 2.0 by WB starting 23 May 1992

FROM Dos   IMPORT actionEnd,actionNotKnown,badStreamName,beginning,
		  BPTR,BSTR,CommandLineInterface,CommandLineInterfacePtr,
		  commentTooBig,copyDir,createDir,CreateProc,
		  ctrlC,ctrlD,ctrlE,ctrlF,current,currentVolume,Date,DatePtr,
		  DateStamp,Delay,DeleteFile,deleteObject,
		  deleteProtected,DeviceList,DeviceListPtr,DeviceListType,
		  DeviceNode,DeviceNodePtr,deviceNotMounted,DeviceProc,
		  die,dirNotFound,diskChange,diskFull,
		  diskInfo,diskNotValidated,diskType,diskWriteProtected,
		  DosBase,dosDisk,DosEnvec,DosEnvecPtr,
		  DosInfo,DosInfoPtr,DosLibrary,DosLibraryPtr,
		  DosPacket,DosPacketPtr,end,error,
		  event,Examine,examineNext,examineObject,
		  LockMode,Execute,Exit,ExNext,
		  fail,FileHandle,FileHandlePtr,FileHandlePtr,
		  FileInfoBlock,FileInfoBlockPtr,FileLock,FileLockPtr,
		  fileNotObject,FileSysStartupMsg,FileSysStartupMsgPtr,findInput,
		  findOutput,findUpDate,flush,freelock,
		  getBlock,GetPacket,Info,info,
		  InfoData,InfoDataPtr,inhibit,Input,
		  invalidComponentName,invalidLock,invalidResidentLibrary,IoErr,
		  IsInteractive,kickstartDisk,lineTooLong,LoadSeg,
		  locateObject,moreCache,newFile,nil,
		  noDefaultDir,noDisk,noDiskPresent,noFreeStore,
		  noMoreEntries,notADosDisk,notReallyDos,objectExists,
		  objectInUse,objectNotFound,objectTooLarge,objectWrongType,
		  ok,(*oldFile,*)Output,parent,
		  PathInfo,PathInfoPtr,Process,Process,
		  ProcessId,ProcessPtr,ProtectionFlags,ProtectionFlagSet,
		  QueuePacket,read,readOnly,readProtected,
		  readReturn,readWrite,Rename,renameAcrossDevices,
		  renameDisk,renameObject,ResidentSegment,ResidentSegmentPtr,
		  RootNode,RootNodePtr,screenMode,Seek,
		  seek,seekError,setComment,SetComment,
		  setDate,setMap,setProtect,SetProtection,
		  StandardPacket,StandardPacketPtr,TaskArray,
		  TaskArrayPtr,taskTableFull,ticksPerSecond,timer,
		  tooManyLevels,truncate,TypeGrp,UnLoadSeg,
		  unreadableDisk,validated,validating,waitChar,
		  WaitForChar,warn,write,writeLock,
		  writeProtect,writeProtected,writeReturn;



FROM Resources  IMPORT ContextPtr;


EXCEPTION
  WriteError             : "WriteError";
  ReadError              : "ReadError";
  EOF                    : "End of File";
  NoParentDir            : "No parent-directory accessable";
  NoFreeStore            : 103;
  TaskTableFull          : 105;
  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;


  Protected     = DiskWriteProtected,DeleteProtected,ReadProtected,
		  WriteProtected;

  OpenErr       = ObjectNotFound,ObjectInUse,DirNotFound,NotADosDisk,NoDisk,             DiskNotValidated,
		  DeviceNotMounted,ObjectWrongType;

  ReadErr       = ReadError,Protected;

  WriteErr      = WriteError,DiskNotValidated,DiskFull,
		  Protected,NotADosDisk,NoDisk;
  DirErr        = NoParentDir,ObjectExists,DirNotFound;

  DeleteErr     = Protected,ObjectInUse,DirectoryNotEmpty;

  InternalErr   = NoFreeStore,TaskTableFull,LineTooLong,FileNotObject,
		  InvalidResidentLibrary,NoDefaultDir,BadStreamName,
		  ObjectTooLarge,ActionNotKnown,InvalidComponentName,
		  InvalidLock,TooManyLevels,SeekError;

  AllDosErr     = Protected,OpenErr,ReadErr,WriteErr,DirErr,DeleteErr,
		  InternalErr;



GROUP
  DosExceptionGrp =
		  ActionNotKnown,               BadStreamName,
		  CommentTooBig,                DeleteProtected,
		  DeviceNotMounted,             DirectoryNotEmpty,
		  DirNotFound,                  DiskFull,
		  DiskNotValidated,             DiskWriteProtected,
		  EOF,                          FileNotObject,
		  InvalidComponentName,         InvalidLock,
		  InvalidResidentLibrary,       LineTooLong,
		  NoDefaultDir,                 NoDisk,
		  NoFreeStore,                  NoMoreEntries,
		  NoParentDir,                  NotADosDisk,
		  ObjectExists,                 ObjectInUse,
		  ObjectNotFound,               ObjectTooLarge,
		  ObjectWrongType,              ReadError,
		  ReadProtected,                RenameAcrossDevices,
		  SeekError,                    TaskTableFull,
		  TooManyLevels,                WriteError,
		  WriteProtected;


  DosExceptGroupGrp = Protected,OpenErr,ReadErr,WriteErr,DirErr,DeleteErr,
		      InternalErr;


GROUP
  DosErrorGrp  = writeProtect, validating, validated,DiskStatus,
		 noDiskPresent, unreadableDisk, dosDisk, notReallyDos,
		 kickstartDisk,DiskType,noFreeStore,taskTableFull,lineTooLong,
		 fileNotObject,invalidResidentLibrary,noDefaultDir,objectInUse,
		 objectExists,dirNotFound,objectNotFound,badStreamName,
		 objectTooLarge,actionNotKnown,invalidComponentName,
		 invalidLock,objectWrongType,diskNotValidated,
		 diskWriteProtected,renameAcrossDevices,tooManyLevels,
		 deviceNotMounted,seekError,commentTooBig,diskFull,
		 deleteProtected,writeProtected,readProtected,
		 notADosDisk,noDisk,noMoreEntries;


|-----------------------------------------------------------------------------|
|  1. Ein- und Ausgabe                                                        |
|-----------------------------------------------------------------------------|

PROCEDURE Close(VAR file : FileHandlePtr):LONGBOOL;

PROCEDURE Open(REF name       : STRING;
		   accessMode : OpenMode := oldFile;
		   context    : ContextPtr := NIL):FileHandlePtr;

PROCEDURE Read(    file       : FileHandlePtr;
		   buffer     : ANYPTR;
		   length     : LONGINT):LONGINT;


PROCEDURE Write(   file       : FileHandlePtr;
		   buffer     : ANYPTR;
		   length     : LONGINT):LONGINT;

GROUP
  DosIOGrp   = Open,Open,Close,Read,FileHandlePtr,FileHandlePtr,Seek,Write,
	       readWrite,readOnly,oldFile,newFile,beginning,current,end;

|-----------------------------------------------------------------------------|
|  2. Dateiverwaltung                                                         |
|-----------------------------------------------------------------------------|

VAR
  CD_at_ProgrammEnd : FileLockPtr;

PROCEDURE CreateDir(REF name : STRING;context : ContextPtr:=NIL):FileLockPtr;

PROCEDURE CurrentDir(lock : FileLockPtr):FileLockPtr;

PROCEDURE ParentDir(lock : FileLockPtr;context : ContextPtr:=NIL):FileLockPtr;

PROCEDURE DupLock(lock : FileLockPtr;context : ContextPtr:=NIL):FileLockPtr;

PROCEDURE Lock(REF name       : STRING;
		   accessMode : LockMode;
		   context    : ContextPtr:=NIL):FileLockPtr;

PROCEDURE Unlock(VAR lock : FileLockPtr);


GROUP
  DosFileGrp  =  CreateDir,FileLockPtr,CurrentDir,DeleteFile,Examine,ExNext,
		 FileInfoBlockPtr,FileInfoBlock,Info,InfoDataPtr,InfoData,
		 ParentDir,Rename,SetComment,SetProtection,ProtectionFlagSet,ProtectionFlags,
		 DupLock,Input,IoErr,IsInteractive,Lock,Output,Unlock,
		 sharedLock,exclusiveLock,accessRead,accessWrite;


  DosProcessGrp  = CreateProc,DateStamp,Delay,DeviceProc,Exit,
		   WaitForChar,ticksPerSecond,Date,Process,ProcessPtr,
		   ProcessId;

  DosSegmentGrp  = Execute,LoadSeg,UnLoadSeg,BPTR;

  PacketGrp      = DosPacket,DosPacketPtr,StandardPacket,StandardPacketPtr,
		   nil,getBlock,setMap,die,event,currentVolume,locateObject,
		   renameDisk,write,read,freelock,deleteObject,renameObject,
		   moreCache,copyDir,waitChar,setProtect,createDir,
		   examineObject,examineNext,diskInfo,info,flush,setComment,
		   parent,timer,inhibit,diskType,diskChange,setDate,
		   screenMode,readReturn,writeReturn,findUpDate,findInput,
		   findOutput,actionEnd,seek,truncate,writeLock,
		   GetPacket,QueuePacket;

  All            = DosIOGrp,DosFileGrp,DosProcessGrp,PacketGrp,DosSegmentGrp,
		   DosErrorGrp,DosExceptionGrp,DosExceptGroupGrp,
		   BSTR,DeviceListPtr,DatePtr,PathInfoPtr,PathInfo,
		   ok,warn,error,fail,ctrlC,ctrlD,ctrlE,ctrlF,
		   CommandLineInterfacePtr,Process,FileHandle,RootNodePtr,
		   DosLibrary,DosLibraryPtr,TaskArray,DosInfoPtr,TaskArrayPtr,
		   DosEnvecPtr,FileSysStartupMsgPtr,ResidentSegmentPtr,
		   ResidentSegment,RootNode,DosInfo,CommandLineInterface,
		   DeviceListType,DeviceList,DeviceNode,DeviceNodePtr,DosEnvec,
		   FileLock,FileSysStartupMsg,DosBase,LockMode;

END T_Dos.

