home *** CD-ROM | disk | FTP | other *** search
/ PC World Komputer 1997 May / Pcwk0597.iso / sybase / starbuck / h.z / DOS.H < prev    next >
C/C++ Source or Header  |  1996-07-24  |  8KB  |  216 lines

  1. /*
  2.  *  dos.h       Defines the structs and unions used to handle the input and
  3.  *              output registers for the DOS and 386 DOS Extender interface
  4.  *              routines.
  5.  *
  6.  *  Copyright by WATCOM International Corp. 1988-1996.  All rights reserved.
  7.  */
  8. #ifndef _DOS_H_INCLUDED
  9. #define _DOS_H_INCLUDED
  10. #ifdef __cplusplus
  11. extern "C" {
  12. #endif
  13.  
  14. #ifndef _COMDEF_H_INCLUDED
  15.  #include <_comdef.h>
  16. #endif
  17. #if defined(_M_IX86) && !defined(_I86_H_INCLUDED)
  18.  #include <i86.h>
  19. #endif
  20.  
  21. #if defined(__DOS__) && defined(__386__)
  22.  #define _DOSFAR _WCFAR
  23. #else
  24.  #define _DOSFAR _WCI86FAR
  25. #endif
  26.  
  27. #if defined(_M_IX86)
  28.   #pragma pack(__push,1);
  29. #else
  30.   #pragma pack(__push,8);
  31. #endif
  32.  
  33. #ifndef _WCHAR_T_DEFINED
  34. #define _WCHAR_T_DEFINED
  35. #define _WCHAR_T_DEFINED_
  36. #ifdef __cplusplus
  37. typedef long char wchar_t;
  38. #else
  39. typedef unsigned short wchar_t;
  40. #endif
  41. #endif
  42.  
  43. /* dosexterror struct */
  44.  
  45. struct _DOSERROR {
  46.         int exterror;
  47.         char errclass;
  48.         char action;
  49.         char locus;
  50. };
  51. #ifndef __cplusplus
  52. struct DOSERROR {
  53.         int exterror;
  54.         char class;
  55.         char action;
  56.         char locus;
  57. };
  58. #endif
  59.  
  60. struct dosdate_t {
  61.         unsigned char day;      /* 1-31 */
  62.         unsigned char month;    /* 1-12 */
  63.         unsigned short year;    /* 1980-2099 */
  64.         unsigned char dayofweek;/* 0-6 (0=Sunday) */
  65. };
  66. #define _dosdate_t dosdate_t
  67.  
  68. struct dostime_t {
  69.         unsigned char hour;     /* 0-23 */
  70.         unsigned char minute;   /* 0-59 */
  71.         unsigned char second;   /* 0-59 */
  72.         unsigned char hsecond;  /* 1/100 second; 0-99 */
  73. };
  74. #define _dostime_t dostime_t
  75.  
  76. struct find_t {
  77.         char reserved[21];      /* reserved for use by DOS    */
  78.         char attrib;            /* attribute byte for file    */
  79.         unsigned short wr_time; /* time of last write to file */
  80.         unsigned short wr_date; /* date of last write to file */
  81.         unsigned long  size;    /* length of file in bytes    */
  82. #if defined(__OS2__) || defined(__NT__)
  83.         char name[256];         /* null-terminated filename   */
  84. #else
  85.         char name[13];          /* null-terminated filename   */
  86. #endif
  87. };
  88. struct _wfind_t {
  89.         char reserved[21];      /* reserved for use by DOS    */
  90.         char attrib;            /* attribute byte for file    */
  91.         unsigned short wr_time; /* time of last write to file */
  92.         unsigned short wr_date; /* date of last write to file */
  93.         unsigned long  size;    /* length of file in bytes    */
  94. #if defined(__OS2__) || defined(__NT__)
  95.     wchar_t name[256];    /* null-terminated filename   */
  96. #else
  97.     wchar_t name[13];    /* null-terminated filename   */
  98. #endif
  99. };
  100. #define _find_t find_t
  101.  
  102. /* Critical error handler equates for _hardresume result parameter */
  103.  
  104. #define _HARDERR_IGNORE 0       /* Ignore the error */
  105. #define _HARDERR_RETRY  1       /* Retry the operation */
  106. #define _HARDERR_ABORT  2       /* Abort the program */
  107. #define _HARDERR_FAIL   3       /* Fail the system call in progress */
  108.  
  109. /* File attribute constants for attribute field */
  110.  
  111. #define _A_NORMAL       0x00    /* Normal file - read/write permitted */
  112. #define _A_RDONLY       0x01    /* Read-only file */
  113. #define _A_HIDDEN       0x02    /* Hidden file */
  114. #define _A_SYSTEM       0x04    /* System file */
  115. #define _A_VOLID        0x08    /* Volume-ID entry */
  116. #define _A_SUBDIR       0x10    /* Subdirectory */
  117. #define _A_ARCH         0x20    /* Archive file */
  118.  
  119. #ifndef _DISKFREE_T_DEFINED
  120. #define _DISKFREE_T_DEFINED
  121. #define _DISKFREE_T_DEFINED_
  122. struct _diskfree_t {
  123.         unsigned total_clusters;
  124.         unsigned avail_clusters;
  125.         unsigned sectors_per_cluster;
  126.         unsigned bytes_per_sector;
  127. };
  128. #define diskfree_t _diskfree_t
  129. #endif
  130.  
  131. _WCRTLINK extern int      bdos( int __dosfn, unsigned int __dx, 
  132.                 unsigned int __al);
  133. _WCRTLINK extern void     _chain_intr( register void 
  134.                       (_WCINTERRUPT _DOSFAR *__handler)() );
  135. #if defined(__NT__) || ( defined(__OS2__) && (defined(__386__)||defined(__PPC__)) )
  136. _WCRTLINK extern unsigned _dos_allocmem( unsigned __size, void **__storage );
  137. #else
  138. _WCRTLINK extern unsigned _dos_allocmem( unsigned __size, 
  139.                      unsigned short *__seg );
  140. #endif
  141. _WCRTLINK extern unsigned _dos_close( int __handle );
  142. _WCRTLINK extern unsigned _dos_commit( int __handle );
  143. _WCRTLINK extern unsigned _dos_creat( const char *__path, 
  144.                       unsigned __attr, int *__handle );
  145. _WCRTLINK extern unsigned _dos_creatnew( const char *__path, 
  146.                      unsigned __attr, int *__handle );
  147. _WCRTLINK extern unsigned _dos_findfirst( const char *__path, 
  148.                       unsigned __attr, 
  149.                       struct find_t *__buf );
  150. _WCRTLINK extern unsigned _dos_findnext( struct find_t *__buf );
  151. _WCRTLINK extern unsigned _dos_findclose( struct find_t *__buf );
  152. #if defined(__NT__) || ( defined(__OS2__) && (defined(__386__)||defined(__PPC__)) )
  153. _WCRTLINK extern unsigned _dos_freemem( void *__storage );
  154. #else
  155. _WCRTLINK extern unsigned _dos_freemem( unsigned short __seg );
  156. #endif
  157. _WCRTLINK extern void     _dos_getdate( struct dosdate_t *__date );
  158. _WCRTLINK extern unsigned _dos_getdiskfree( unsigned __drive, 
  159.                         struct _diskfree_t *__diskspace );
  160. _WCRTLINK extern unsigned _getdiskfree( unsigned __drive, 
  161.                     struct _diskfree_t *__diskspace );
  162. _WCRTLINK extern void     _dos_getdrive( unsigned *__drive );
  163. _WCRTLINK extern unsigned _getdrive( void );
  164. _WCRTLINK extern unsigned _dos_getfileattr( const char *__path, 
  165.                         unsigned *__attr );
  166. _WCRTLINK extern unsigned _dos_getftime( int __handle, unsigned short *__date,
  167.                      unsigned short *__time );
  168. _WCRTLINK extern void     _dos_gettime( struct dostime_t *__time );
  169. _WCRTLINK extern void     (_WCINTERRUPT _DOSFAR *_dos_getvect( int __intnum ))();
  170. _WCRTLINK extern void     _dos_keep( unsigned __retcode, unsigned __memsize );
  171.  
  172. _WCRTLINK extern unsigned _dos_open( const char *__path, unsigned __mode, 
  173.                      int *__handle );
  174. _WCRTLINK extern unsigned _dos_read( int __handle, void _DOSFAR *__buf, 
  175.                      unsigned __count, unsigned *__bytes );
  176. _WCRTLINK extern unsigned _dos_setblock( unsigned __size, unsigned short __seg,
  177.                      unsigned  *__maxsize );
  178. _WCRTLINK extern unsigned _dos_setdate( struct dosdate_t *__date );
  179. _WCRTLINK extern void     _dos_setdrive( unsigned __drivenum, 
  180.                      unsigned *__drives );
  181. _WCRTLINK extern unsigned _dos_setfileattr( const char *__path, 
  182.                         unsigned __attr );
  183. _WCRTLINK extern unsigned _dos_setftime( int __handle, unsigned short __date, 
  184.                      unsigned short __time );
  185. _WCRTLINK extern unsigned _dos_settime( struct dostime_t *__time );
  186. _WCRTLINK extern void     _dos_setvect( int __intnum, void 
  187.                        (_WCINTERRUPT _DOSFAR *__handler)() );
  188. _WCRTLINK extern unsigned _dos_write( int __handle, void const _DOSFAR *__buf,
  189.                       unsigned __count, unsigned *__bytes );
  190. _WCRTLINK extern int      dosexterr( struct _DOSERROR * );
  191. _WCRTLINK extern void     _harderr( register int (_DOSFAR *__func)(
  192.                     unsigned __deverr, unsigned __errcode,
  193.                     unsigned _DOSFAR *__devhdr));
  194. _WCRTLINK extern void     _hardresume( int __result );
  195. _WCRTLINK extern void     _hardretn( int __error );
  196. #if defined(_M_IX86)
  197. _WCRTLINK extern int      intdos( union REGS *, union REGS * );
  198. _WCRTLINK extern int      intdosx( union REGS *, union REGS *, struct SREGS * );
  199. #endif
  200. _WCRTLINK extern void     sleep( unsigned __seconds );
  201.  
  202. _WCRTLINK extern unsigned _wdos_findfirst( const wchar_t *__path, 
  203.                        unsigned __attr, 
  204.                        struct _wfind_t *__buf );
  205. _WCRTLINK extern unsigned _wdos_findnext( struct _wfind_t *__buf );
  206. _WCRTLINK extern unsigned _wdos_findclose( struct _wfind_t *__buf );
  207.  
  208. #pragma pack(__pop);
  209.  
  210. #undef _DOSFAR
  211.  
  212. #ifdef __cplusplus
  213. };
  214. #endif
  215. #endif
  216.