home *** CD-ROM | disk | FTP | other *** search
/ Amiga ISO Collection / AmigaUtilCD2.iso / Programming / Misc / TRSICAT.LZX / CATS_CD2_TRSI / Inc&AD2.1 / includes / dos / dos.h < prev    next >
Encoding:
C/C++ Source or Header  |  1992-09-11  |  9.1 KB  |  249 lines

  1. #ifndef DOS_DOS_H
  2. #define DOS_DOS_H
  3. /*
  4. **    $VER: dos.h 36.24 (29.10.91)
  5. **    Includes Release 38.56
  6. **
  7. **    Standard C header for AmigaDOS
  8. **
  9. **    (C) Copyright 1985-1992 Commodore-Amiga, Inc.
  10. **        All Rights Reserved
  11. */
  12.  
  13. #ifndef EXEC_TYPES_H
  14. #include "exec/types.h"
  15. #endif
  16.  
  17.  
  18. #define     DOSNAME  "dos.library"
  19.  
  20. /* Predefined Amiga DOS global constants */
  21.  
  22. #define DOSTRUE (-1L)
  23. #define DOSFALSE (0L)
  24.  
  25. /* Mode parameter to Open() */
  26. #define MODE_OLDFILE         1005   /* Open existing file read/write
  27.                      * positioned at beginning of file. */
  28. #define MODE_NEWFILE         1006   /* Open freshly created file (delete
  29.                      * old file) read/write, exclusive lock. */
  30. #define MODE_READWRITE         1004   /* Open old file w/shared lock,
  31.                      * creates file if doesn't exist. */
  32.  
  33. /* Relative position to Seek() */
  34. #define OFFSET_BEGINNING    -1        /* relative to Begining Of File */
  35. #define OFFSET_CURRENT         0        /* relative to Current file position */
  36. #define OFFSET_END         1        /* relative to End Of File      */
  37.  
  38. #define OFFSET_BEGINING        OFFSET_BEGINNING  /* ancient compatibility */
  39.  
  40. #define BITSPERBYTE         8
  41. #define BYTESPERLONG         4
  42. #define BITSPERLONG         32
  43. #define MAXINT             0x7FFFFFFF
  44. #define MININT             0x80000000
  45.  
  46. /* Passed as type to Lock() */
  47. #define SHARED_LOCK         -2        /* File is readable by others */
  48. #define ACCESS_READ         -2        /* Synonym */
  49. #define EXCLUSIVE_LOCK         -1        /* No other access allowed      */
  50. #define ACCESS_WRITE         -1        /* Synonym */
  51.  
  52. struct DateStamp {
  53.    LONG     ds_Days;          /* Number of days since Jan. 1, 1978 */
  54.    LONG     ds_Minute;          /* Number of minutes past midnight */
  55.    LONG     ds_Tick;          /* Number of ticks past minute */
  56. }; /* DateStamp */
  57.  
  58. #define TICKS_PER_SECOND      50   /* Number of ticks in one second */
  59.  
  60. /* Returned by Examine() and ExNext(), must be on a 4 byte boundary */
  61. struct FileInfoBlock {
  62.    LONG      fib_DiskKey;
  63.    LONG      fib_DirEntryType;  /* Type of Directory. If < 0, then a plain file.
  64.                   * If > 0 a directory */
  65.    char      fib_FileName[108]; /* Null terminated. Max 30 chars used for now */
  66.    LONG      fib_Protection;    /* bit mask of protection, rwxd are 3-0.       */
  67.    LONG      fib_EntryType;
  68.    LONG      fib_Size;         /* Number of bytes in file */
  69.    LONG      fib_NumBlocks;     /* Number of blocks in file */
  70.    struct DateStamp fib_Date;/* Date file last changed */
  71.    char      fib_Comment[80];  /* Null terminated comment associated with file */
  72.    char      fib_Reserved[36];
  73. }; /* FileInfoBlock */
  74.  
  75. /* FIB stands for FileInfoBlock */
  76.  
  77. /* FIBB are bit definitions, FIBF are field definitions */
  78. #define FIBB_SCRIPT    6    /* program is a script (execute) file */
  79. #define FIBB_PURE      5    /* program is reentrant and rexecutable */
  80. #define FIBB_ARCHIVE   4    /* cleared whenever file is changed */
  81. #define FIBB_READ      3    /* ignored by old filesystem */
  82. #define FIBB_WRITE     2    /* ignored by old filesystem */
  83. #define FIBB_EXECUTE   1    /* ignored by system, used by Shell */
  84. #define FIBB_DELETE    0    /* prevent file from being deleted */
  85. #define FIBF_SCRIPT    (1<<FIBB_SCRIPT)
  86. #define FIBF_PURE      (1<<FIBB_PURE)
  87. #define FIBF_ARCHIVE   (1<<FIBB_ARCHIVE)
  88. #define FIBF_READ      (1<<FIBB_READ)
  89. #define FIBF_WRITE     (1<<FIBB_WRITE)
  90. #define FIBF_EXECUTE   (1<<FIBB_EXECUTE)
  91. #define FIBF_DELETE    (1<<FIBB_DELETE)
  92.  
  93. /* Standard maximum length for an error string from fault.  However, most */
  94. /* error strings should be kept under 60 characters if possible.  Don't   */
  95. /* forget space for the header you pass in. */
  96. #define FAULT_MAX    82
  97.  
  98. /* All BCPL data must be long word aligned.  BCPL pointers are the long word
  99.  *  address (i.e byte address divided by 4 (>>2)) */
  100. typedef long  BPTR;            /* Long word pointer */
  101. typedef long  BSTR;            /* Long word pointer to BCPL string     */
  102.  
  103. /* Convert BPTR to typical C pointer */
  104. #ifdef OBSOLETE_LIBRARIES_DOS_H
  105. #define BADDR( bptr )    (((ULONG)bptr) << 2)
  106. #else
  107. /* This one has no problems with CASTing */
  108. #define BADDR(x)    ((APTR)((ULONG)(x) << 2))
  109. #endif
  110. /* Convert address into a BPTR */
  111. #define MKBADDR(x)    (((LONG)(x)) >> 2)
  112.  
  113. /* BCPL strings have a length in the first byte and then the characters.
  114.  * For example:     s[0]=3 s[1]=S s[2]=Y s[3]=S                 */
  115.  
  116. /* returned by Info(), must be on a 4 byte boundary */
  117. struct InfoData {
  118.    LONG      id_NumSoftErrors;    /* number of soft errors on disk */
  119.    LONG      id_UnitNumber;    /* Which unit disk is (was) mounted on */
  120.    LONG      id_DiskState;        /* See defines below */
  121.    LONG      id_NumBlocks;        /* Number of blocks on disk */
  122.    LONG      id_NumBlocksUsed;    /* Number of block in use */
  123.    LONG      id_BytesPerBlock;
  124.    LONG      id_DiskType;        /* Disk Type code */
  125.    BPTR      id_VolumeNode;    /* BCPL pointer to volume node */
  126.    LONG      id_InUse;        /* Flag, zero if not in use */
  127. }; /* InfoData */
  128.  
  129. /* ID stands for InfoData */
  130.     /* Disk states */
  131. #define ID_WRITE_PROTECTED 80     /* Disk is write protected */
  132. #define ID_VALIDATING       81     /* Disk is currently being validated */
  133. #define ID_VALIDATED       82     /* Disk is consistent and writeable */
  134.  
  135.     /* Disk types */
  136. /* ID_INTER_* use international case comparison routines for hashing */
  137. #define ID_NO_DISK_PRESENT    (-1)
  138. #define ID_UNREADABLE_DISK    (0x42414400L)    /* 'BAD\0' */
  139. #define ID_DOS_DISK        (0x444F5300L)    /* 'DOS\0' */
  140. #define ID_FFS_DISK        (0x444F5301L)    /* 'DOS\1' */
  141. #define ID_INTER_DOS_DISK    (0x444F5302L)    /* 'DOS\2' */
  142. #define ID_INTER_FFS_DISK    (0x444F5303L)    /* 'DOS\3' */
  143. #define ID_NOT_REALLY_DOS    (0x4E444F53L)    /* 'NDOS'  */
  144. #define ID_KICKSTART_DISK    (0x4B49434BL)    /* 'KICK'  */
  145. #define ID_MSDOS_DISK        (0x4d534400L)    /* 'MSD\0' */
  146.  
  147. /* Errors from IoErr(), etc. */
  148. #define ERROR_NO_FREE_STORE          103
  149. #define ERROR_TASK_TABLE_FULL          105
  150. #define ERROR_BAD_TEMPLATE          114
  151. #define ERROR_BAD_NUMBER          115
  152. #define ERROR_REQUIRED_ARG_MISSING      116
  153. #define ERROR_KEY_NEEDS_ARG          117
  154. #define ERROR_TOO_MANY_ARGS          118
  155. #define ERROR_UNMATCHED_QUOTES          119
  156. #define ERROR_LINE_TOO_LONG          120
  157. #define ERROR_FILE_NOT_OBJECT          121
  158. #define ERROR_INVALID_RESIDENT_LIBRARY      122
  159. #define ERROR_NO_DEFAULT_DIR          201
  160. #define ERROR_OBJECT_IN_USE          202
  161. #define ERROR_OBJECT_EXISTS          203
  162. #define ERROR_DIR_NOT_FOUND          204
  163. #define ERROR_OBJECT_NOT_FOUND          205
  164. #define ERROR_BAD_STREAM_NAME          206
  165. #define ERROR_OBJECT_TOO_LARGE          207
  166. #define ERROR_ACTION_NOT_KNOWN          209
  167. #define ERROR_INVALID_COMPONENT_NAME      210
  168. #define ERROR_INVALID_LOCK          211
  169. #define ERROR_OBJECT_WRONG_TYPE          212
  170. #define ERROR_DISK_NOT_VALIDATED      213
  171. #define ERROR_DISK_WRITE_PROTECTED      214
  172. #define ERROR_RENAME_ACROSS_DEVICES      215
  173. #define ERROR_DIRECTORY_NOT_EMPTY      216
  174. #define ERROR_TOO_MANY_LEVELS          217
  175. #define ERROR_DEVICE_NOT_MOUNTED      218
  176. #define ERROR_SEEK_ERROR          219
  177. #define ERROR_COMMENT_TOO_BIG          220
  178. #define ERROR_DISK_FULL              221
  179. #define ERROR_DELETE_PROTECTED          222
  180. #define ERROR_WRITE_PROTECTED          223
  181. #define ERROR_READ_PROTECTED          224
  182. #define ERROR_NOT_A_DOS_DISK          225
  183. #define ERROR_NO_DISK              226
  184. #define ERROR_NO_MORE_ENTRIES          232
  185. /* added for 1.4 */
  186. #define ERROR_IS_SOFT_LINK          233
  187. #define ERROR_OBJECT_LINKED          234
  188. #define ERROR_BAD_HUNK              235
  189. #define ERROR_NOT_IMPLEMENTED          236
  190. #define ERROR_RECORD_NOT_LOCKED          240
  191. #define ERROR_LOCK_COLLISION          241
  192. #define ERROR_LOCK_TIMEOUT          242
  193. #define ERROR_UNLOCK_ERROR          243
  194.  
  195. /* error codes 303-305 are defined in dosasl.h */
  196.  
  197. /* These are the return codes used by convention by AmigaDOS commands */
  198. /* See FAILAT and IF for relvance to EXECUTE files              */
  199. #define RETURN_OK                0  /* No problems, success */
  200. #define RETURN_WARN                5  /* A warning only */
  201. #define RETURN_ERROR               10  /* Something wrong */
  202. #define RETURN_FAIL               20  /* Complete or severe failure*/
  203.  
  204. /* Bit numbers that signal you that a user has issued a break */
  205. #define SIGBREAKB_CTRL_C   12
  206. #define SIGBREAKB_CTRL_D   13
  207. #define SIGBREAKB_CTRL_E   14
  208. #define SIGBREAKB_CTRL_F   15
  209.  
  210. /* Bit fields that signal you that a user has issued a break */
  211. /* for example:     if (SetSignal(0,0) & SIGBREAKF_CTRL_C) cleanup_and_exit(); */
  212. #define SIGBREAKF_CTRL_C   (1<<SIGBREAKB_CTRL_C)
  213. #define SIGBREAKF_CTRL_D   (1<<SIGBREAKB_CTRL_D)
  214. #define SIGBREAKF_CTRL_E   (1<<SIGBREAKB_CTRL_E)
  215. #define SIGBREAKF_CTRL_F   ((long)1<<SIGBREAKB_CTRL_F)
  216.  
  217. /* Values returned by SameLock() */
  218. #define LOCK_DIFFERENT        -1
  219. #define LOCK_SAME        0
  220. #define LOCK_SAME_VOLUME    1    /* locks are on same volume */
  221. #define LOCK_SAME_HANDLER    LOCK_SAME_VOLUME
  222. /* LOCK_SAME_HANDLER was a misleading name, def kept for src compatibility */
  223.  
  224. /* types for ChangeMode() */
  225. #define CHANGE_LOCK    0
  226. #define CHANGE_FH    1
  227.  
  228. /* Values for MakeLink() */
  229. #define LINK_HARD    0
  230. #define LINK_SOFT    1    /* softlinks are not fully supported yet */
  231.  
  232. /* values returned by ReadItem */
  233. #define    ITEM_EQUAL    -2        /* "=" Symbol */
  234. #define ITEM_ERROR    -1        /* error */
  235. #define ITEM_NOTHING    0        /* *N, ;, endstreamch */
  236. #define ITEM_UNQUOTED    1        /* unquoted item */
  237. #define ITEM_QUOTED    2        /* quoted item */
  238.  
  239. /* types for AllocDosObject/FreeDosObject */
  240. #define DOS_FILEHANDLE        0    /* few people should use this */
  241. #define DOS_EXALLCONTROL    1    /* Must be used to allocate this! */
  242. #define    DOS_FIB            2    /* useful */
  243. #define DOS_STDPKT        3    /* for doing packet-level I/O */
  244. #define DOS_CLI            4    /* for shell-writers, etc */
  245. #define DOS_RDARGS        5    /* for ReadArgs if you pass it in */
  246.  
  247. #endif    /* DOS_DOS_H */
  248.  
  249.