home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / borhead.zip / DOS.H < prev    next >
C/C++ Source or Header  |  1994-11-09  |  9KB  |  276 lines

  1. /*  dos.h
  2.  
  3.     Defines structs, unions, macros, and functions for dealing
  4.     with MSDOS and the Intel iAPX86 microprocessor family.
  5.  
  6. */
  7. /*
  8.  *      C/C++ Run Time Library - Version 1.5
  9.  *
  10.  *      Copyright (c) 1987, 1994 by Borland International
  11.  *      All Rights Reserved.
  12.  *
  13.  */
  14.  
  15. #ifndef __DOS_H
  16. #define __DOS_H
  17.  
  18. #if !defined(___DEFS_H)
  19. #include <_defs.h>
  20. #endif
  21.  
  22.  
  23. #if !defined(RC_INVOKED)
  24.  
  25. #if defined(__STDC__)
  26. #pragma warn -nak
  27. #endif
  28.  
  29. #endif  /* !RC_INVOKED */
  30.  
  31.  
  32.  
  33.  
  34. #if !defined(RC_INVOKED)
  35. #pragma option -a-
  36. #endif
  37.  
  38.  
  39. #ifdef _MT
  40.  
  41. #ifdef __cplusplus
  42. extern "C" {
  43. #endif
  44. extern  int * _RTLENTRY _EXPFUNC __errno(void);
  45. extern  int * _RTLENTRY _EXPFUNC __doserrno(void);
  46. #ifdef  __cplusplus
  47. }
  48. #endif
  49. #define errno (*__errno())
  50. #define _doserrno (*__doserrno())
  51.  
  52. #else
  53.  
  54. extern  int _RTLENTRY _EXPDATA errno;
  55. extern  int _RTLENTRY _EXPDATA _doserrno;
  56.  
  57. #endif
  58.  
  59. #if !defined(__STDC__)
  60. #define environ  _environ
  61. #endif
  62.  
  63. /* Variables */
  64. extern  int const _RTLENTRY _EXPDATA _8087;
  65. extern  int       _RTLENTRY _EXPDATA _argc;
  66. extern  char    **_RTLENTRY _EXPDATA _argv;
  67. extern  char    **_RTLENTRY _EXPDATA _environ;
  68.  
  69. extern  unsigned char _RTLENTRY _EXPDATA _osmajor;
  70. extern  unsigned char _RTLENTRY _EXPDATA _osminor;
  71. extern  unsigned      _RTLENTRY _EXPDATA _osversion;
  72. extern  unsigned      _RTLENTRY _EXPDATA _version;
  73.  
  74.  
  75. #define FA_NORMAL   0x00        /* Normal file, no attributes */
  76. #define FA_RDONLY   0x01        /* Read only attribute */
  77. #define FA_HIDDEN   0x02        /* Hidden file */
  78. #define FA_SYSTEM   0x04        /* System file */
  79. #define FA_LABEL    0x08        /* Volume label */
  80. #define FA_DIREC    0x10        /* Directory */
  81. #define FA_ARCH     0x20        /* Archive */
  82.  
  83. /* MSC names for file attributes */
  84.  
  85. #define _A_NORMAL   0x00        /* Normal file, no attributes */
  86. #define _A_RDONLY   0x01        /* Read only attribute */
  87. #define _A_HIDDEN   0x02        /* Hidden file */
  88. #define _A_SYSTEM   0x04        /* System file */
  89. #define _A_VOLID    0x08        /* Volume label */
  90. #define _A_SUBDIR   0x10        /* Directory */
  91. #define _A_ARCH     0x20        /* Archive */
  92.  
  93. struct COUNTRY {
  94.     int co_date;
  95.     char    co_curr[5];
  96.     char    co_thsep[2];
  97.     char    co_desep[2];
  98.     char    co_dtsep[2];
  99.     char    co_tmsep[2];
  100.     char    co_currstyle;
  101.     char    co_digits;
  102.     char    co_time;
  103.     long    co_case;
  104.     char    co_dasep[2];
  105.     char    co_fill[10];
  106. };
  107.  
  108. struct  dfree   {
  109.     unsigned df_avail;
  110.     unsigned df_total;
  111.     unsigned df_bsec;
  112.     unsigned df_sclus;
  113. };
  114.  
  115. struct  diskfree_t {
  116.     unsigned total_clusters;
  117.     unsigned avail_clusters;
  118.     unsigned sectors_per_cluster;
  119.     unsigned bytes_per_sector;
  120. };
  121.  
  122. struct  time    {
  123.     unsigned char   ti_min;     /* Minutes */
  124.     unsigned char   ti_hour;    /* Hours */
  125.     unsigned char   ti_hund;    /* Hundredths of seconds */
  126.     unsigned char   ti_sec;     /* Seconds */
  127. };
  128.  
  129. struct  dostime_t {
  130.     unsigned char hour;         /* Hours */
  131.     unsigned char minute;       /* Minutes */
  132.     unsigned char second;       /* Seconds */
  133.     unsigned char hsecond;      /* Hundredths of seconds */
  134. };
  135.  
  136. struct  date    {
  137.     int         da_year;    /* Year - 1980 */
  138.     char        da_day;     /* Day of the month */
  139.     char        da_mon;     /* Month (1 = Jan) */
  140. };
  141.  
  142. struct  dosdate_t {
  143.     unsigned char day;      /* 1-31 */
  144.     unsigned char month;    /* 1-12 */
  145.     unsigned int  year;     /* 1980 - 2099 */
  146.     unsigned char dayofweek;/* 0 - 6 (0=Sunday) */
  147. };
  148.  
  149. #ifndef _FFBLK_DEF
  150. #define _FFBLK_DEF
  151. struct  ffblk   {
  152.     long            ff_reserved;
  153.     long            ff_fsize;
  154.     unsigned long   ff_attrib;
  155.     unsigned short  ff_ftime;
  156.     unsigned short  ff_fdate;
  157.     char            ff_name[256];
  158. };
  159. #endif  /* __FFBLK_DEF */
  160.  
  161. /* The MSC find_t structure corresponds exactly to the ffblk structure */
  162. struct  find_t {
  163.     long            reserved;
  164.     long            size;              /* size of file */
  165.     unsigned long   attrib;            /* attribute byte for matched file */
  166.     unsigned short  wr_time;           /* time of last write to file */
  167.     unsigned short  wr_date;           /* date of last write to file */
  168.     char            name[256];         /* asciiz name of matched file */
  169. };
  170.  
  171.  
  172. #define SEEK_CUR    1
  173. #define SEEK_END    2
  174. #define SEEK_SET    0
  175.  
  176.  
  177. #ifdef __cplusplus
  178. extern "C" {
  179. #endif
  180.  
  181. struct COUNTRY * _RTLENTRY _EXPFUNC country( int __xcode, struct COUNTRY *__cp);
  182. long        _RTLENTRY _EXPFUNC dostounix( struct date *__d, struct time *__t );
  183.  
  184. unsigned    _RTLENTRY _EXPFUNC _dos_close( int __fd );
  185. unsigned    _RTLENTRY _EXPFUNC _dos_creat( const char * __pathP, unsigned __attr, int * __fd );
  186. unsigned    _RTLENTRY _EXPFUNC _dos_creatnew( const char * __pathP, unsigned __attr, int * __fd );
  187. unsigned    _RTLENTRY _EXPFUNC _dos_findfirst( const char * __path, unsigned __attrib, struct find_t *__finfo );
  188. unsigned    _RTLENTRY _EXPFUNC _dos_findnext( struct find_t *__finfo );
  189. void        _RTLENTRY _EXPFUNC _dos_getdate( struct dosdate_t *__datep );
  190. unsigned    _RTLENTRY _EXPFUNC _dos_getdiskfree( unsigned __drive, struct diskfree_t *__dtable );
  191. void        _RTLENTRY _EXPFUNC _dos_getdrive( unsigned *__drive );
  192. unsigned    _RTLENTRY _EXPFUNC _dos_getfileattr( const char * __filename, unsigned *__attrib );
  193. unsigned    _RTLENTRY _EXPFUNC _dos_getftime( int __fd, unsigned *__date, unsigned *__time );
  194. void        _RTLENTRY _EXPFUNC _dos_gettime( struct dostime_t *__timep );
  195. unsigned    _RTLENTRY _EXPFUNC _dos_open( const char * __pathP, unsigned __oflag, int * __fd );
  196. unsigned    _RTLENTRY _EXPFUNC _dos_read( int __fd, void * __buf, unsigned __len, unsigned *__nread );
  197. unsigned    _RTLENTRY _EXPFUNC _dos_setdate( struct dosdate_t *__datep );
  198. void        _RTLENTRY _EXPFUNC _dos_setdrive( unsigned __drive, unsigned *__ndrives );
  199. unsigned    _RTLENTRY _EXPFUNC _dos_setfileattr( const char * __filename, unsigned __attrib );
  200. unsigned    _RTLENTRY _EXPFUNC _dos_setftime( int __fd, unsigned __date, unsigned __time );
  201. unsigned    _RTLENTRY _EXPFUNC _dos_settime( struct dostime_t *__timep );
  202. unsigned    _RTLENTRY _EXPFUNC _dos_write( int __fd, void * __buf, unsigned __len, unsigned *__nread );
  203.  
  204. #if !defined(RC_INVOKED)
  205. #pragma obsolete _dos_close
  206. #pragma obsolete _dos_creat
  207. #pragma obsolete _dos_creatnew
  208. #pragma obsolete _dos_findfirst
  209. #pragma obsolete _dos_findnext
  210. #pragma obsolete _dos_getdate
  211. #pragma obsolete _dos_getdiskfree
  212. #pragma obsolete _dos_getdrive
  213. #pragma obsolete _dos_getfileattr
  214. #pragma obsolete _dos_getftime
  215. #pragma obsolete _dos_gettime
  216. #pragma obsolete _dos_open
  217. #pragma obsolete _dos_read
  218. #pragma obsolete _dos_setdate
  219. #pragma obsolete _dos_setdrive
  220. #pragma obsolete _dos_setfileattr
  221. #pragma obsolete _dos_setftime
  222. #pragma obsolete _dos_settime
  223. #pragma obsolete _dos_write
  224. #endif
  225.  
  226. void        _RTLENTRYF _EXPFUNC getdate( struct date *__datep );
  227. void        _RTLENTRY _EXPFUNC getdfree( unsigned char __drive,
  228.                  struct dfree*__dtable );
  229. int         _RTLENTRY _EXPFUNC _getdrive( void );
  230. void        _RTLENTRYF _EXPFUNC gettime( struct time *__timep );
  231. int         _RTLENTRY _EXPFUNC getverify( void );
  232.  
  233. void        _RTLENTRY _EXPFUNC setdate( struct date *__datep );
  234. void        _RTLENTRY _EXPFUNC settime( struct time *__timep );
  235. void        _RTLENTRY _EXPFUNC setverify( int __value );
  236.  
  237. void        _RTLENTRY _EXPFUNC _sleep( unsigned __seconds );
  238.  
  239. void        _RTLENTRY _EXPFUNC unixtodos( long __time, struct date *__d,
  240.                               struct time *__t );
  241. int         _RTLENTRYF _EXPFUNC unlink( const char * __path );
  242.  
  243. #define sleep(unsigned) _sleep(unsigned)
  244.  
  245. /* Inline functions.
  246.  */
  247. void                 __int__( int __interruptnum );
  248.  
  249. #define disable( ) __emit__( (unsigned char )( 0xfa ) ) /* MSC name */
  250. #define enable( )  __emit__( (unsigned char )( 0xfb ) ) /* MSC name */
  251. #define _disable( ) __emit__( (unsigned char )( 0xfa ) ) /* MSC name */
  252. #define _enable( )  __emit__( (unsigned char )( 0xfb ) ) /* MSC name */
  253.  
  254. #define geninterrupt( i ) __int__( i )      /* Interrupt instruction */
  255.  
  256. #ifdef __cplusplus
  257. }
  258. #endif
  259.  
  260. #if !defined(RC_INVOKED)
  261. #pragma option -a. /* restore default packing */
  262. #endif
  263.  
  264.  
  265.  
  266. #if !defined(RC_INVOKED)
  267.  
  268. #if defined(__STDC__)
  269. #pragma warn .nak
  270. #endif
  271.  
  272. #endif  /* !RC_INVOKED */
  273.  
  274.  
  275. #endif  /* __DOS_H */
  276.