home *** CD-ROM | disk | FTP | other *** search
/ Stars of Shareware: Programmierung / SOURCE.mdf / programm / msdos / c / txcl552 / inc / tcxldos.h < prev    next >
Encoding:
C/C++ Source or Header  |  1991-03-15  |  11.2 KB  |  180 lines

  1. /*=====[ The TesSeRact(TM) CXL User Interface Development System ]======*
  2.  | Copyright (c) 1987-1991, Innovative Data Concepts, Inc.
  3.  | All Rights Reserved.
  4.  |
  5.  | This Library is part of IDC's TesSeRact Development Tools product
  6.  | line. For information about other IDC products, call  1-215-443-9705.
  7.  *-V--------------------------------------------------------------------*
  8.  | $Header:   tcxldos.h     552.0   17 Mar 1991 18:27:02  $
  9.  |
  10.  | $Log:   tcxldos.h    $
  11.  *-D--------------------------------------------------------------------*
  12.  | <TCXLdos.h> : Definition and prototypes for internal TCXL MS-DOS and
  13.  | iApx86 interface functions.
  14.  *-N-----------------------[ Notes and Caveats ]------------------------*
  15.  | 1) Most of these are compiler-independent implementations of common
  16.  |    functions and data objects.
  17.  | 2) The critical error functions are courtesy of John Loper, of
  18.  |    Tominy, Inc.
  19.  *======================================================================*/
  20. #ifndef  _TCXLdos_
  21. #  define   _TCXLdos_ 1                /* Only once!                    */
  22. #  ifndef   _TCXLdef_
  23. #     include  <TCXLdef.h>             /* Standard definitions          */
  24. #  endif
  25.                                        /*- MS-DOS File attributes ------*/
  26. #define  FA_RDO      0x01              /* Read only                     */
  27. #define  FA_HID      0x02              /* Hidden                        */
  28. #define  FA_SYS      0x04              /* System                        */
  29. #define  FA_VOL      0x08              /* Volume label                  */
  30. #define  FA_DIR      0x10              /* Directory                     */
  31. #define  FA_ARC      0x20              /* Archive                       */
  32. #define  FA_DEV      0x40              /* Device *UNDOC*                */
  33.  
  34. /*------------------[ Data objects and access macros ]------------------*/
  35.  
  36. TYP   union    _Cax  _CaxT;            /* Object, pointer types         */
  37. TYP   union    _Cdi  _CdiT;
  38. TYP   struct   _Dev  _DevT, *_DevP, FAR *_DevFP;
  39. TYP   struct   _Dtm  _DtmT, *_DtmP;
  40. TYP   struct   _Ffb  _FfbT, *_FfbP;
  41.  
  42. union    _Cax                 /*-[ Critical error [AX] overlay bitmap ]-*/
  43. {  WrdT     cax;              /*                                        */
  44.    struct                     /*                                        */
  45.    {  BitT  cdrv  : 8;        /* _CaxDrv : Drive code [0=A, 1=B, ...]   */
  46.       BitT  crdw  : 1;        /* _CaxRdw : Read/write                   */
  47.       BitT  cloc  : 2;        /* _CaxLoc : Error Locus                  */
  48.       BitT  cfai  : 1;        /* _CaxFai : FAIL action permitted        */
  49.       BitT  cret  : 1;        /* _CaxRet : RETRY action permitted       */
  50.       BitT  cign  : 1;        /* _CaxIgn : IGNORE action permitted      */
  51.       BitT        : 1;        /*                                        */
  52.       BitT  cdsk  : 1;        /* _CaxDsk : 0 if disk error, else 1      */
  53.   }   cab;                    /*                                        */
  54. };                            /*----------------------------------------*/
  55. #define  _CaxDrv(a)  ((a).cab.cdrv)             /* Drive code           */
  56. #define  _CaxRd(a)   (0 == (a).cab.crdw)        /* Read error           */
  57. #define  _CaxWr(a)   (0 != (a).cab.crdw)        /* Write error          */
  58. #define  _CaxLoc(a)  ((a).cab.cdrv)             /* Error Locus          */
  59. #define  _CaxSys(a)  (0 == _CaxLoc(a))             /* DOS system area   */
  60. #define  _CaxFat(a)  (1 == _CaxLoc(a))             /* FAT area          */
  61. #define  _CaxDir(a)  (2 == _CaxLoc(a))             /* Directory         */
  62. #define  _CaxDat(a)  (3 == _CaxLoc(a))             /* Data area         */
  63. #define  _CaxFai(a)  (0 != (a).cab.cfai)        /* FAIL permitted       */
  64. #define  _CaxRet(a)  (0 != (a).cab.cret)        /* RETRY permitted      */
  65. #define  _CaxIgn(a)  (0 != (a).cab.cign)        /* IGNORE permitted     */
  66. #define  _CaxDsk(a)  (0 == (a).cab.cdsk)        /* Disk error           */
  67.  
  68.  
  69. union    _Cdi                 /*-[ Critical error [DI] overlay ]--------*/
  70. {  WrdT     cdi;              /*                                        */
  71.    struct                     /*                                        */
  72.    {  BytT  cerr;             /* _CdiErr : Error code in low half       */
  73.       BytT  cdih;             /*                                        */
  74.    }  clh;                    /*                                        */
  75. };                            /*----------------------------------------*/
  76. #define  _CdiErr(d)  ((d).clh.cerr)             /* Error code           */
  77.  
  78. struct   _Dev                 /*-[ MS-DOS device-driver header ]--------*/
  79. {  DwdT     dnxt;             /* 00|00 : _DevNxt : Next header          */
  80.    WrdT     datr;             /* 04|04 : _DevAtr : Attributes           */
  81.    WrdT     dstr;             /* 06|06 : _DevStr : Strategy entry       */
  82.    WrdT     dint;             /* 08|08 : _DevInt : Interrupt entry      */
  83.    ChrT     dnam[8];          /* 0A|0A : _DevNam : Device name          */
  84. };                            /* 12|12 ]--------------------------------*/
  85. #define  _DevNxt(d)  ((d)->dnxt)                /* Next header          */
  86. #define  _DevAtr(d)  ((d)->datr)                /* Attributes           */
  87. #define  _DevStr(d)  ((d)->dstr)                /* Strategy entry       */
  88. #define  _DevInt(d)  ((d)->dint)                /* Interrupt entry      */
  89. #define  _DevNam(d)  ((d)->dnam)                /* Device name          */
  90.  
  91. struct   _Dtm                 /*-[ System date/time object ]------------*/
  92. {  WrdT  dyr;                 /* 00|00 : _DtmYr  : Year (1980-2099)     */
  93.    BytT  dmon;                /* 02|02 : _DtmMon : Month (1=Jan)        */
  94.    BytT  dday;                /* 03|03 : _DtmDay : Day of month (1..31) */
  95.    BytT  ddow;                /* 04|04 : _DtmDow : Day of week (0=Sun)  */
  96.    BytT  dhr;                 /* 05|05 : _DtmHr  : Hour (0..23)         */
  97.    BytT  dmin;                /* 06|06 : _DtmMin : Minute (0..59)       */
  98.    BytT  dsec;                /* 07|07 : _DtmSec : Second (0..59)       */
  99.    BytT  ddec;                /* 08|08 : _DtmDec : Hundredth (0..99)    */
  100.    BytT  dpad;                /* 09|09 : Pad to even word boundary      */
  101. };                            /* 0A|0A ]--------------------------------*/
  102.  
  103. GBL   _DtmT _DatTim;          /*- Global date/time object --------------*/
  104. #define  _DtmYr   (_DatTim.dyr)                 /* Year                 */
  105. #define  _DtmMon  (_DatTim.dmon)                /* Month                */
  106. #define  _DtmDay  (_DatTim.dday)                /* Day of month         */
  107. #define  _DtmDow  (_DatTim.ddow)                /* Day of week          */
  108. #define  _DtmHr   (_DatTim.dhr)                 /* Hour                 */
  109. #define  _DtmMin  (_DatTim.dmin)                /* Minute               */
  110. #define  _DtmSec  (_DatTim.dsec)                /* Second               */
  111. #define  _DtmDec  (_DatTim.ddec)                /* Hundredth            */
  112.  
  113. struct   _Ffb                 /*- MS-DOS findfirst/findnext DTA --------*/
  114. {  BytT  fdos[21];            /* 00|00 : _FfbDos : DOS reserved         */
  115.    BytT  fatr;                /* 15|15 : _FfBAtr : File attribute       */
  116.    WrdT  ftim;                /* 16|16 : _FfbTim : Packed file time     */
  117.    WrdT  fdat;                /* 18|18 : _FfbDat : Packed file date     */
  118.    LngT  fsiz;                /* 1A|1A : _FfbSiz : File size            */
  119.    ChrT  fnam[13];            /* 1E|1E : _FfbNam : Filename             */
  120.    BytT  fpad;                /* 2B:2B : Pad to word boundary           */
  121. };                            /* 2C:2C ]--------------------------------*/
  122. #define  _FfbDos(f)  ((f).fdos)                 /* DOS-reserved         */
  123. #define  _FfbAtr(f)  ((f).fatr)                 /* File attribute       */
  124. #define  _FfbRdo(f)  (0 != ((f).fatr & FA_RDO))    /* Read-only         */
  125. #define  _FfbHid(f)  (0 != ((f).fatr & FA_HID))    /* Hidden            */
  126. #define  _FfbSys(f)  (0 != ((f).fatr & FA_SYS))    /* System            */
  127. #define  _FfbVol(f)  (0 != ((f).fatr & FA_VOL))    /* Volume            */
  128. #define  _FfbDir(f)  (0 != ((f).fatr & FA_DIR))    /* Directory         */
  129. #define  _FfbArc(f)  (0 != ((f).fatr & FA_ARC))    /* Archive           */
  130. #define  _FfbDev(f)  (0 != ((f).fatr & FA_DEV))    /* Device (UnDoc)    */
  131. #define  _FfbTim(f)  ((f).ftim)                 /* Packed time          */
  132. #define  _FfbDat(f)  ((f).fdat)                 /* Packed date          */
  133. #define  _FfbSiz(f)  ((f).fsiz)                 /* File size            */
  134. #define  _FfbNam(f)  ((f).fnam)                 /* File name            */
  135. #define  _FfbDot(f)  ((f).fnam[0]=='.')            /* '.' or '..'       */
  136. #define  _FfbPar(f)  (_FfbDot(f) && ((f).fnam[1] == '.')) /* parent dir */
  137.  
  138. /*------------------------[ Function prototypes ]-----------------------*/
  139.                                        /* Critical error handler        */
  140. TYP   IntT  (FAR CTYP *IffpCP)(WrdT, WrdT, WrdT, WrdT);
  141.  
  142. #ifdef   __cplusplus                   /* No mangling, please           */
  143.    #define  _IFFPCP(f)   (IffpCP)(f)   /* crufty cast for C++           */
  144.    extern   "C"   {
  145. #else
  146.    #define  _IFFPCP(f)   (f)           /* no crufty cast for C          */
  147. #endif
  148.                                        /*- Critical error handling -----*/
  149. VOID  CTYP  _CerrOut(NOARG);           /* Uninstall TCXL CritErr trap   */
  150. IntT  CTYP  _CerrPush(IffpCP fa);      /* Push new CritErr handler      */
  151. IntT  CTYP  _CerrPop(NOARG);           /* Pop last CritErr handler      */
  152. IntT  CTYP  _CerrSet(IffpCP fa);       /* Overwrite current handler     */
  153. IffpCP CTYP _CerrGet(NOARG);           /* Get last CritErr handler addr */
  154. IntT  FAR   CTYP  _DefCrit(WrdT rsi,   /* Default handler               */
  155.    WrdT rbp, WrdT rdi, WrdT rax);
  156. IntT  FAR   CTYP  _AltCrit(WrdT rsi,   /* Alternate (verbose) handler   */
  157.    WrdT rbp, WrdT rdi, WrdT rax);
  158.                                        /*- MS-DOS interface ------------*/
  159. FlgT  PAS   _ChgDir(ChrP p);           /* Change directory              */
  160. ChrT  PAS   _ChgDrv(ChrT d);           /* Change current drive          */
  161. IntT  CTYP  _FilFnd(ChrP p, ChrP b);   /* Find file along PATH          */
  162. FlgT  PAS   _FndFst(ChrP p, _FfbP f,   /* Find first file               */
  163.    IntT a);
  164. FlgT  PAS   _FndNxt(_FfbP f);          /* Find next file                */
  165. IntT  PAS   _GetDir(ChrT d, ChrP p);   /* Get current dir               */
  166. VOID  PAS   _GetDtm(NOARG);            /* Get system date/time          */
  167. ChrT  PAS   _GetDrv(NOARG);            /* Get current drive             */
  168. WrdT  PAS   _GetSys(NOARG);            /* Get system version            */
  169.                                        /*- iApx86 interface ------------*/
  170. BytT  PAS   _InpByt(WrdT p);           /* Input byte                    */
  171. WrdT  PAS   _InpWrd(WrdT p);           /* Input word                    */
  172. VOID  PAS   _IntDis(NOARG);            /* Disable interrupts            */
  173. VOID  PAS   _IntEna(NOARG);            /* Enable interrupts             */
  174. VOID  PAS   _OutByt(WrdT p, BytT b);   /* Output byte                   */
  175. VOID  PAS   _OutWrd(WrdT p, WrdT w);   /* Output word                   */
  176. #ifdef __cplusplus
  177.    }
  178. #endif
  179. #endif   /*- _TCXLdos_ : End of TCXLdos.h ------------------------------*/
  180.