home *** CD-ROM | disk | FTP | other *** search
/ Amiga ISO Collection / AmigaUtilCD2.iso / Programming / C / SASC6574.LZX / include / dos.h < prev    next >
Encoding:
C/C++ Source or Header  |  1997-04-04  |  6.5 KB  |  257 lines

  1. /* Copyright (c) 1992-1993 SAS Institute, Inc., Cary, NC USA */
  2. /* All Rights Reserved */
  3.  
  4.  
  5. #ifndef _DOS_H
  6. #define _DOS_H 1
  7.  
  8. #ifndef EXEC_TYPES_H
  9. #include <exec/types.h>
  10. #endif
  11.  
  12. #ifndef EXEC_PORTS_H
  13. #include <exec/ports.h>
  14. #endif
  15.  
  16. #ifndef EXEC_LISTS_H
  17. #include <exec/lists.h>
  18. #endif
  19.  
  20. #ifndef LIBRARIES_DOS_H
  21. #include <libraries/dos.h>
  22. #endif
  23.  
  24. #ifndef LIBRARIES_DOSEXTENS_H
  25. #include <libraries/dosextens.h>
  26. #endif
  27.  
  28. #ifndef _COMMSIZE_H
  29. #include <sys/commsize.h>
  30. #endif
  31.  
  32. /***
  33. *
  34. * The following type definitions take care of the particularly nasty
  35. * machine dependency caused by the unspecified handling of sign extension
  36. * in the C language.  When converting "char" to "int" some compilers
  37. * will extend the sign, while others will not.  Both are correct, and
  38. * the unsuspecting programmer is the loser.  For situations where it
  39. * matters, the new type "byte" is equivalent to "unsigned char".
  40. *
  41. ***/
  42.  
  43. typedef unsigned char byte;
  44.  
  45.  
  46. /***
  47. *
  48. * Miscellaneous definitions
  49. *
  50. ***/
  51.  
  52. #define SECSIZ 512        /* disk sector size */
  53.  
  54.  
  55. /***
  56. *
  57. * The following symbols define the sizes of file names and node names.
  58. *
  59. ***/
  60.  
  61. #define FNSIZE 108    /* maximum file node size      - DOS limit */
  62. #define FMSIZE 256    /* maximum file name size      - DOS limit */
  63. #define FESIZE 32    /* maximum file extension size - arbitrary */
  64.  
  65.  
  66. /***
  67. *
  68. * The following structure appears at the beginning (low address) of
  69. * each free memory block.
  70. *
  71. ***/
  72.  
  73. struct MELT {
  74.     struct MELT *fwd;            /* points to next free block */
  75.     long size;                /* number of MELTs in this block */
  76. };
  77.  
  78. #define MELTSIZE sizeof(struct MELT)
  79.  
  80.  
  81. /***
  82. *
  83. * The following structure is used to keep track of currently allocated
  84. * system memory
  85. *
  86. ***/
  87.  
  88. struct MELT2 {
  89.     struct MELT2 *fwd;            /* points to next block */
  90.     struct MELT2 *bwd;            /* points to previous block */
  91.     unsigned long size;            /* size of this block */
  92. };
  93.  
  94. #define MELT2SIZE sizeof(struct MELT2)
  95.  
  96.  
  97. /***
  98. *
  99. * The following structures are used with the AmigaDOS fork() and wait()
  100. * functions
  101. *
  102. ***/
  103.  
  104. struct ProcID {                /* packet returned from fork()  */
  105.     struct ProcID *nextID;        /* link to next packet        */
  106.     struct Message *process;            /* startup message to child     */
  107.     int UserPortFlag;
  108.     struct MsgPort *parent;        /* termination msg destination    */
  109.     struct MsgPort *child;        /* child process' task msg port    */
  110.     BPTR seglist;            /* child process' segment list    */
  111. };
  112.  
  113. struct FORKENV {
  114.     long priority;            /* new process priority        */
  115.     long stack;                    /* stack size for new process    */
  116.     BPTR std_in;            /* stdin for new process    */
  117.     BPTR std_out;            /* stdout for new process    */
  118.     BPTR console;            /* console window for new process */
  119.     struct MsgPort *msgport;            /* msg port to receive termination */
  120. };                      /* message from child        */
  121.  
  122. struct TermMsg {            /* termination message from child */
  123.     struct Message msg;
  124.     long _class;                    /* class == 0            */
  125.     short type;                    /* message type == 0        */
  126.     struct Process *process;            /* process ID of sending task    */
  127.     long ret;                    /* return value            */
  128. };
  129.  
  130.  
  131. extern int forkl(char *, char *, ...);
  132. extern int forkv(char *, char **, struct FORKENV *, struct ProcID *);
  133. extern int wait(struct ProcID *);
  134. extern struct ProcID *waitm(struct ProcID **);
  135.  
  136. /***
  137. *
  138. * Level 0 I/O services
  139. *
  140. ***/
  141.  
  142. extern int dfind(struct FileInfoBlock *, const char *, int);
  143. extern int dnext(struct FileInfoBlock *);
  144.  
  145. extern int           _dclose(long);
  146. extern long          _dcreat(const char *, int);
  147. extern long          _dcreatx(const char *, int);
  148. extern long          _dopen(const char *, int);
  149. extern unsigned int  _dread(long, char *, unsigned int);
  150. extern long          _dseek(long, long, int);
  151. extern unsigned int  _dwrite(long, char *, unsigned int);
  152.  
  153. extern int getcd(int, char *);
  154. extern int chdir(const char *);
  155. extern char *getcwd(char *, int);
  156. extern int mkdir(const char *);
  157. extern int rmdir(const char *);
  158.  
  159. extern int getfnl(const char *, char *, size_t, int);
  160. extern int getdfs(const char *, struct InfoData *);
  161. extern int getfa(const char *);
  162. extern long getft(const char *);
  163.  
  164. extern int getpath(BPTR, char *);
  165. extern BPTR findpath(const char *);
  166.  
  167.  
  168. /***
  169. *
  170. * External definitions used by the startup code
  171. *
  172. ***/
  173.  
  174. extern long _BackGroundIO;   /* Declare and init to 1 to get stdout */
  175.                              /* in a cback program                  */
  176. extern BPTR _Backstdout;     /* Points to stdout in a cback program */
  177.                              /* If _BackGroundIO was set.  You are  */
  178.                              /* responsible for closing this!       */
  179. extern long __priority;      /* Default priority of cback programs  */
  180. extern char *__procname;     /* Default process name for cback progs*/                             
  181. #ifdef _M68881
  182. extern char __near __stdiowin[];  /* stdio window specification */
  183. #else
  184. extern char __stdiowin[];    /* stdio window specification */
  185. #endif
  186. extern char __stdiov37[];    /* Modifiers for stdio window, V37+ */
  187. extern long __oslibversion;  /* Minimum OS version for autoopen libs */
  188. extern long __stack;         /* Minimum stack size for program */
  189. extern long __STKNEED;       /* Minimum stack size for function */
  190.  
  191. #ifndef _COMMWBEN_H
  192. #include <sys/commwben.h>
  193. #endif
  194.  
  195. /***
  196. *
  197. * Miscellaneous external definitions
  198. *
  199. ***/
  200.  
  201. extern int datecmp(const struct DateStamp *, const struct DateStamp *);
  202. extern int chgclk(const unsigned char *);
  203. extern void getclk(unsigned char *);
  204. extern int onbreak(int (*)(void));
  205. extern int poserr(const char *);
  206.  
  207. /* Note: If you attempt to replace the library version of  */
  208. /* __chkabort(), you must declare your version with the    */
  209. /* __regargs keyword in order to match these prototypes.   */
  210. extern void __regargs __chkabort(void);
  211.  
  212. extern void chkabort(void);
  213. extern void Chk_Abort(void);
  214. struct DeviceList *getasn(const char *);
  215.  
  216. extern unsigned long stacksize(void);
  217. extern unsigned long stackused(void);
  218. extern unsigned long stackavail(void);
  219.  
  220. #define geta4 __builtin_geta4
  221. extern void geta4(void);
  222.  
  223. #define getreg __builtin_getreg
  224. extern long getreg(int);
  225.  
  226. #define putreg __builtin_putreg
  227. extern void putreg(int, long);
  228.  
  229. #define __emit __builtin_emit
  230. extern void __emit(int);
  231.  
  232. #define REG_D0 0
  233. #define REG_D1 1
  234. #define REG_D2 2
  235. #define REG_D3 3
  236. #define REG_D4 4
  237. #define REG_D5 5
  238. #define REG_D6 6
  239. #define REG_D7 7
  240. #define REG_A0 8
  241. #define REG_A1 9
  242. #define REG_A2 10
  243. #define REG_A3 11
  244. #define REG_A4 12
  245. #define REG_A5 13
  246. #define REG_A6 14
  247. #define REG_A7 15
  248. #define REG_FP0 16
  249. #define REG_FP1 17
  250. #define REG_FP2 18
  251. #define REG_FP3 19
  252. #define REG_FP4 20
  253. #define REG_FP5 21
  254. #define REG_FP6 22
  255. #define REG_FP7 23
  256. #endif
  257.