home *** CD-ROM | disk | FTP | other *** search
/ AMIGA PD 1 / AMIGA-PD-1.iso / Programme_zum_Heft / Programmieren / Kurztests / PascalPCQ / Include / Libraries / DOS.i < prev    next >
Text File  |  1990-08-28  |  8KB  |  285 lines

  1. {
  2.     DOS.i for PCQ Pascal
  3.  
  4.     Standard C header for AmigaDOS
  5. }
  6.  
  7. Const
  8.  
  9.     DOSNAME    = "dos.library";
  10.  
  11. { Predefined Amiga DOS global constants }
  12.  
  13.     DOSTRUE    = -1;
  14.     DOSFALSE    = 0;
  15.  
  16. { Mode parameter to Open() }
  17.  
  18.     MODE_OLDFILE    = 1005;        { Open existing file read/write 
  19.                       positioned at beginning of file. }
  20.     MODE_NEWFILE    = 1006;        { Open freshly created file (delete 
  21.                       old file) read/write }
  22.     MODE_READWRITE    = 1004;        { Open old file w/exclusive lock }
  23.  
  24. { Relative position to Seek() }
  25.  
  26.     OFFSET_BEGINNING    = -1;        { relative to Begining Of File }
  27.     OFFSET_CURRENT    = 0;        { relative to Current file position }
  28.     OFFSET_END        = 1;        { relative to End Of File }
  29.  
  30.     BITSPERBYTE        = 8;
  31.     BYTESPERLONG    = 4;
  32.     BITSPERLONG        = 32;
  33.     MAXINT        = $7FFFFFFF;
  34.     MININT        = $80000000;
  35.  
  36. { Passed as type to Lock() }
  37.  
  38.     SHARED_LOCK        = -2;        { File is readable by others }
  39.     ACCESS_READ        = -2;        { Synonym }
  40.     EXCLUSIVE_LOCK    = -1;        { No other access allowed }
  41.     ACCESS_WRITE    = -1;        { Synonym }
  42.  
  43. Type
  44.  
  45.     FileHandle    = Address;
  46.     FileLock    = Address;
  47.  
  48.     DateStampRec = record
  49.     ds_Days        : Integer;    { Number of days since Jan. 1, 1978 }
  50.     ds_Minute    : Integer;    { Number of minutes past midnight }
  51.     ds_Tick        : Integer;    { Number of ticks past minute }
  52.     end;
  53.     DateStampPtr = ^DateStampRec;
  54.  
  55. Const
  56.  
  57.     TICKS_PER_SECOND    = 50;        { Number of ticks in one second }
  58.  
  59. Type
  60.  
  61. { Returned by Examine() and ExInfo(), must be on a 4 byte boundary }
  62.  
  63.     FileInfoBlock = record
  64.     fib_DiskKey    : Integer;
  65.     fib_DirEntryType : Integer;
  66.             { Type of Directory. If < 0, then a plain file.
  67.               If > 0 a directory }
  68.     fib_FileName    : Array [0..107] of Char;
  69.             { Null terminated. Max 30 chars used for now }
  70.     fib_Protection    : Integer;
  71.             { bit mask of protection, rwxd are 3-0. }
  72.     fib_EntryType    : Integer;
  73.     fib_Size    : Integer;    { Number of bytes in file }
  74.     fib_NumBlocks    : Integer;    { Number of blocks in file }
  75.     fib_Date    : DateStampRec;    { Date file last changed }
  76.     fib_Comment    : Array [0..79] of Char;
  77.             { Null terminated comment associated with file }
  78.     fib_Reserved    : Array [0..35] of Char;
  79.     end;
  80.     FileInfoBlockPtr = ^FileInfoBlock;
  81.  
  82.  
  83. Const
  84.  
  85. { FIB stands for FileInfoBlock }
  86.  
  87. { FIBB are bit definitions, FIBF are field definitions }
  88.  
  89.     FIBB_SCRIPT        = 6;    { program is a script (execute) file }
  90.     FIBB_PURE        = 5;    { program is reentrant and rexecutable}
  91.     FIBB_ARCHIVE    = 4;    { cleared whenever file is changed }
  92.     FIBB_READ          = 3;    { ignored by old filesystem }
  93.     FIBB_WRITE        = 2;    { ignored by old filesystem }
  94.     FIBB_EXECUTE    = 1;    { ignored by system, used by Shell }
  95.     FIBB_DELETE        = 0;    { prevent file from being deleted }
  96.     FIBF_SCRIPT        = 64;
  97.     FIBF_PURE        = 32;
  98.     FIBF_ARCHIVE    = 16;
  99.     FIBF_READ        = 8;
  100.     FIBF_WRITE        = 4;
  101.     FIBF_EXECUTE    = 2;
  102.     FIBF_DELETE        = 1;
  103.  
  104.  
  105. Type
  106.  
  107. { All BCPL data must be long word aligned.  BCPL pointers are the long word
  108.  *  address (i.e byte address divided by 4 (>>2)) }
  109.  
  110.     BPTR    = Address;    { Long word pointer }
  111.     BSTR    = Address;    { Long word pointer to BCPL string }
  112.  
  113. { returned by Info(), must be on a 4 byte boundary }
  114.  
  115.     InfoData = record
  116.     id_NumSoftErrors    : Integer;    { number of soft errors on disk }
  117.     id_UnitNumber        : Integer;    { Which unit disk is (was) mounted on }
  118.     id_DiskState        : Integer;    { See defines below }
  119.     id_NumBlocks        : Integer;    { Number of blocks on disk }
  120.     id_NumBlocksUsed    : Integer;    { Number of block in use }
  121.     id_BytesPerBlock    : Integer;
  122.     id_DiskType        : Integer;    { Disk Type code }
  123.     id_VolumeNode        : BPTR;        { BCPL pointer to volume node }
  124.     id_InUse        : Integer;    { Flag, zero if not in use }
  125.     end;
  126.     InfoDataPtr = ^InfoData;
  127.  
  128. Const
  129.  
  130. { ID stands for InfoData }
  131.  
  132.     { Disk states }
  133.  
  134.     ID_WRITE_PROTECTED    = 80;    { Disk is write protected }
  135.     ID_VALIDATING    = 81;    { Disk is currently being validated }
  136.     ID_VALIDATED    = 82;    { Disk is consistent and writeable }
  137.  
  138.     { Disk types }
  139.  
  140.     ID_NO_DISK_PRESENT    = -1;
  141.     ID_UNREADABLE_DISK    = $42414400;    { 'BAD\0' }
  142.     ID_DOS_DISK        = $444F5300;    { 'DOS\0' }
  143.     ID_NOT_REALLY_DOS    = $4E444F53;    { 'NDOS' }
  144.     ID_KICKSTART_DISK    = $4B49434B;    { 'KICK' }
  145.  
  146. { Errors from IoErr(), etc. }
  147.  
  148.     ERROR_NO_FREE_STORE            = 103;
  149.     ERROR_TASK_TABLE_FULL        = 105;
  150.     ERROR_LINE_TOO_LONG            = 120;
  151.     ERROR_FILE_NOT_OBJECT        = 121;
  152.     ERROR_INVALID_RESIDENT_LIBRARY    = 122;
  153.     ERROR_NO_DEFAULT_DIR        = 201;
  154.     ERROR_OBJECT_IN_USE            = 202;
  155.     ERROR_OBJECT_EXISTS            = 203;
  156.     ERROR_DIR_NOT_FOUND            = 204;
  157.     ERROR_OBJECT_NOT_FOUND        = 205;
  158.     ERROR_BAD_STREAM_NAME        = 206;
  159.     ERROR_OBJECT_TOO_LARGE        = 207;
  160.     ERROR_ACTION_NOT_KNOWN        = 209;
  161.     ERROR_INVALID_COMPONENT_NAME    = 210;
  162.     ERROR_INVALID_LOCK            = 211;
  163.     ERROR_OBJECT_WRONG_TYPE        = 212;
  164.     ERROR_DISK_NOT_VALIDATED        = 213;
  165.     ERROR_DISK_WRITE_PROTECTED        = 214;
  166.     ERROR_RENAME_ACROSS_DEVICES        = 215;
  167.     ERROR_DIRECTORY_NOT_EMPTY        = 216;
  168.     ERROR_TOO_MANY_LEVELS        = 217;
  169.     ERROR_DEVICE_NOT_MOUNTED        = 218;
  170.     ERROR_SEEK_ERROR            = 219;
  171.     ERROR_COMMENT_TOO_BIG        = 220;
  172.     ERROR_DISK_FULL            = 221;
  173.     ERROR_DELETE_PROTECTED        = 222;
  174.     ERROR_WRITE_PROTECTED        = 223;
  175.     ERROR_READ_PROTECTED        = 224;
  176.     ERROR_NOT_A_DOS_DISK        = 225;
  177.     ERROR_NO_DISK            = 226;
  178.     ERROR_NO_MORE_ENTRIES        = 232;
  179.  
  180. { These are the return codes used by convention by AmigaDOS commands }
  181. { See FAILAT and IF for relvance to EXECUTE files              }
  182.  
  183.     RETURN_OK        = 0;    { No problems, success }
  184.     RETURN_WARN        = 5;    { A warning only }
  185.     RETURN_ERROR    = 10;    { Something wrong }
  186.     RETURN_FAIL        = 20;    { Complete or severe failure}
  187.  
  188. { Bit numbers that signal you that a user has issued a break }
  189.  
  190.     SIGBREAKB_CTRL_C    = 12;
  191.     SIGBREAKB_CTRL_D    = 13;
  192.     SIGBREAKB_CTRL_E    = 14;
  193.     SIGBREAKB_CTRL_F    = 15;
  194.  
  195. { Bit fields that signal you that a user has issued a break }
  196. { for example:     if (SetSignal(0,0) & BREAK_CTRL_CF) cleanup_and_exit(); }
  197.  
  198.     SIGBREAKF_CTRL_C    = $00001000;
  199.     SIGBREAKF_CTRL_D    = $00002000;
  200.     SIGBREAKF_CTRL_E    = $00004000;
  201.     SIGBREAKF_CTRL_F    = $00008000;
  202.  
  203.  
  204. Procedure DOSClose(filehand : FileHandle);
  205.     External;
  206.  
  207. Function CreateDir(name : String) : FileLock;
  208.     External;
  209.  
  210. Function CurrentDir(lock : FileLock) : FileLock;
  211.     External;
  212.  
  213. Procedure DateStamp(var ds : DateStampRec);
  214.     External;
  215.  
  216. Procedure Delay(ticks : Integer);
  217.     External;
  218.  
  219. Function DeleteFile(name : String) : Boolean;
  220.     External;
  221.  
  222. Function DupLock(lock : FileLock) : FileLock;
  223.     External;
  224.  
  225. Function Examine(lock : FileLock; info : FileInfoBlockPtr) : Boolean;
  226.     External;
  227.  
  228. Function Execute(command : String; InFile, OutFile : FileHandle) : Boolean;
  229.     External;
  230.  
  231. Procedure DOSExit(code : Integer);
  232.     External;
  233.  
  234. Function ExNext(lock : FileLock; info : FileInfoBlockPtr) : Boolean;
  235.     External;
  236.  
  237. Function Info(lock : FileLock; params : InfoDataPtr) : Boolean;
  238.     External;
  239.  
  240. Function IoErr : Integer;
  241.     External;
  242.  
  243. Function DOSInput : FileHandle;
  244.     External;
  245.  
  246. Function IsInteractive(f : FileHandle) : Boolean;
  247.     External;
  248.  
  249. Function Lock(name : String; accessmode : Integer) : FileLock;
  250.     External;
  251.  
  252. Function DOSOpen(name : String; accessmode : Integer) : FileHandle;
  253.     External;
  254.  
  255. Function DOSOutput : FileHandle;
  256.     External;
  257.  
  258. Function ParentDir(lock : FileLock) : FileLock;
  259.     External;
  260.  
  261. Function DOSRead(f : FileHandle; buffer : Address; length : Integer) : Integer;
  262.     External;
  263.  
  264. Function Rename(oldname, newname : String) : Boolean;
  265.     External;
  266.  
  267. Function Seek(f : FileHandle; pos : Integer; mode : Integer) : Integer;
  268.     External;
  269.  
  270. Function SetComment(name : String; comment : String) : Boolean;
  271.     External;
  272.  
  273. Function SetProtection(name : String; mask : Integer) : Boolean;
  274.     External;
  275.  
  276. Procedure UnLock(lock : FileLock);
  277.     External;
  278.  
  279. Function WaitForChar(f : FileHandle; timeout : Integer) : Boolean;
  280.     External;
  281.  
  282. Function DOSWrite(f : FileHandle; buffer : Address; len : Integer) : Integer;
  283.     External;
  284.  
  285.