home *** CD-ROM | disk | FTP | other *** search
- /*=====[ The TesSeRact(TM) CXL User Interface Development System ]======*
- | Copyright (c) 1987-1991, Innovative Data Concepts, Inc.
- | All Rights Reserved.
- |
- | This Library is part of IDC's TesSeRact Development Tools product
- | line. For information about other IDC products, call 1-215-443-9705.
- *-V--------------------------------------------------------------------*
- | $Header: tcxldos.h 552.0 17 Mar 1991 18:27:02 $
- |
- | $Log: tcxldos.h $
- *-D--------------------------------------------------------------------*
- | <TCXLdos.h> : Definition and prototypes for internal TCXL MS-DOS and
- | iApx86 interface functions.
- *-N-----------------------[ Notes and Caveats ]------------------------*
- | 1) Most of these are compiler-independent implementations of common
- | functions and data objects.
- | 2) The critical error functions are courtesy of John Loper, of
- | Tominy, Inc.
- *======================================================================*/
- #ifndef _TCXLdos_
- # define _TCXLdos_ 1 /* Only once! */
- # ifndef _TCXLdef_
- # include <TCXLdef.h> /* Standard definitions */
- # endif
- /*- MS-DOS File attributes ------*/
- #define FA_RDO 0x01 /* Read only */
- #define FA_HID 0x02 /* Hidden */
- #define FA_SYS 0x04 /* System */
- #define FA_VOL 0x08 /* Volume label */
- #define FA_DIR 0x10 /* Directory */
- #define FA_ARC 0x20 /* Archive */
- #define FA_DEV 0x40 /* Device *UNDOC* */
-
- /*------------------[ Data objects and access macros ]------------------*/
-
- TYP union _Cax _CaxT; /* Object, pointer types */
- TYP union _Cdi _CdiT;
- TYP struct _Dev _DevT, *_DevP, FAR *_DevFP;
- TYP struct _Dtm _DtmT, *_DtmP;
- TYP struct _Ffb _FfbT, *_FfbP;
-
- union _Cax /*-[ Critical error [AX] overlay bitmap ]-*/
- { WrdT cax; /* */
- struct /* */
- { BitT cdrv : 8; /* _CaxDrv : Drive code [0=A, 1=B, ...] */
- BitT crdw : 1; /* _CaxRdw : Read/write */
- BitT cloc : 2; /* _CaxLoc : Error Locus */
- BitT cfai : 1; /* _CaxFai : FAIL action permitted */
- BitT cret : 1; /* _CaxRet : RETRY action permitted */
- BitT cign : 1; /* _CaxIgn : IGNORE action permitted */
- BitT : 1; /* */
- BitT cdsk : 1; /* _CaxDsk : 0 if disk error, else 1 */
- } cab; /* */
- }; /*----------------------------------------*/
- #define _CaxDrv(a) ((a).cab.cdrv) /* Drive code */
- #define _CaxRd(a) (0 == (a).cab.crdw) /* Read error */
- #define _CaxWr(a) (0 != (a).cab.crdw) /* Write error */
- #define _CaxLoc(a) ((a).cab.cdrv) /* Error Locus */
- #define _CaxSys(a) (0 == _CaxLoc(a)) /* DOS system area */
- #define _CaxFat(a) (1 == _CaxLoc(a)) /* FAT area */
- #define _CaxDir(a) (2 == _CaxLoc(a)) /* Directory */
- #define _CaxDat(a) (3 == _CaxLoc(a)) /* Data area */
- #define _CaxFai(a) (0 != (a).cab.cfai) /* FAIL permitted */
- #define _CaxRet(a) (0 != (a).cab.cret) /* RETRY permitted */
- #define _CaxIgn(a) (0 != (a).cab.cign) /* IGNORE permitted */
- #define _CaxDsk(a) (0 == (a).cab.cdsk) /* Disk error */
-
-
- union _Cdi /*-[ Critical error [DI] overlay ]--------*/
- { WrdT cdi; /* */
- struct /* */
- { BytT cerr; /* _CdiErr : Error code in low half */
- BytT cdih; /* */
- } clh; /* */
- }; /*----------------------------------------*/
- #define _CdiErr(d) ((d).clh.cerr) /* Error code */
-
- struct _Dev /*-[ MS-DOS device-driver header ]--------*/
- { DwdT dnxt; /* 00|00 : _DevNxt : Next header */
- WrdT datr; /* 04|04 : _DevAtr : Attributes */
- WrdT dstr; /* 06|06 : _DevStr : Strategy entry */
- WrdT dint; /* 08|08 : _DevInt : Interrupt entry */
- ChrT dnam[8]; /* 0A|0A : _DevNam : Device name */
- }; /* 12|12 ]--------------------------------*/
- #define _DevNxt(d) ((d)->dnxt) /* Next header */
- #define _DevAtr(d) ((d)->datr) /* Attributes */
- #define _DevStr(d) ((d)->dstr) /* Strategy entry */
- #define _DevInt(d) ((d)->dint) /* Interrupt entry */
- #define _DevNam(d) ((d)->dnam) /* Device name */
-
- struct _Dtm /*-[ System date/time object ]------------*/
- { WrdT dyr; /* 00|00 : _DtmYr : Year (1980-2099) */
- BytT dmon; /* 02|02 : _DtmMon : Month (1=Jan) */
- BytT dday; /* 03|03 : _DtmDay : Day of month (1..31) */
- BytT ddow; /* 04|04 : _DtmDow : Day of week (0=Sun) */
- BytT dhr; /* 05|05 : _DtmHr : Hour (0..23) */
- BytT dmin; /* 06|06 : _DtmMin : Minute (0..59) */
- BytT dsec; /* 07|07 : _DtmSec : Second (0..59) */
- BytT ddec; /* 08|08 : _DtmDec : Hundredth (0..99) */
- BytT dpad; /* 09|09 : Pad to even word boundary */
- }; /* 0A|0A ]--------------------------------*/
-
- GBL _DtmT _DatTim; /*- Global date/time object --------------*/
- #define _DtmYr (_DatTim.dyr) /* Year */
- #define _DtmMon (_DatTim.dmon) /* Month */
- #define _DtmDay (_DatTim.dday) /* Day of month */
- #define _DtmDow (_DatTim.ddow) /* Day of week */
- #define _DtmHr (_DatTim.dhr) /* Hour */
- #define _DtmMin (_DatTim.dmin) /* Minute */
- #define _DtmSec (_DatTim.dsec) /* Second */
- #define _DtmDec (_DatTim.ddec) /* Hundredth */
-
- struct _Ffb /*- MS-DOS findfirst/findnext DTA --------*/
- { BytT fdos[21]; /* 00|00 : _FfbDos : DOS reserved */
- BytT fatr; /* 15|15 : _FfBAtr : File attribute */
- WrdT ftim; /* 16|16 : _FfbTim : Packed file time */
- WrdT fdat; /* 18|18 : _FfbDat : Packed file date */
- LngT fsiz; /* 1A|1A : _FfbSiz : File size */
- ChrT fnam[13]; /* 1E|1E : _FfbNam : Filename */
- BytT fpad; /* 2B:2B : Pad to word boundary */
- }; /* 2C:2C ]--------------------------------*/
- #define _FfbDos(f) ((f).fdos) /* DOS-reserved */
- #define _FfbAtr(f) ((f).fatr) /* File attribute */
- #define _FfbRdo(f) (0 != ((f).fatr & FA_RDO)) /* Read-only */
- #define _FfbHid(f) (0 != ((f).fatr & FA_HID)) /* Hidden */
- #define _FfbSys(f) (0 != ((f).fatr & FA_SYS)) /* System */
- #define _FfbVol(f) (0 != ((f).fatr & FA_VOL)) /* Volume */
- #define _FfbDir(f) (0 != ((f).fatr & FA_DIR)) /* Directory */
- #define _FfbArc(f) (0 != ((f).fatr & FA_ARC)) /* Archive */
- #define _FfbDev(f) (0 != ((f).fatr & FA_DEV)) /* Device (UnDoc) */
- #define _FfbTim(f) ((f).ftim) /* Packed time */
- #define _FfbDat(f) ((f).fdat) /* Packed date */
- #define _FfbSiz(f) ((f).fsiz) /* File size */
- #define _FfbNam(f) ((f).fnam) /* File name */
- #define _FfbDot(f) ((f).fnam[0]=='.') /* '.' or '..' */
- #define _FfbPar(f) (_FfbDot(f) && ((f).fnam[1] == '.')) /* parent dir */
-
- /*------------------------[ Function prototypes ]-----------------------*/
- /* Critical error handler */
- TYP IntT (FAR CTYP *IffpCP)(WrdT, WrdT, WrdT, WrdT);
-
- #ifdef __cplusplus /* No mangling, please */
- #define _IFFPCP(f) (IffpCP)(f) /* crufty cast for C++ */
- extern "C" {
- #else
- #define _IFFPCP(f) (f) /* no crufty cast for C */
- #endif
- /*- Critical error handling -----*/
- VOID CTYP _CerrOut(NOARG); /* Uninstall TCXL CritErr trap */
- IntT CTYP _CerrPush(IffpCP fa); /* Push new CritErr handler */
- IntT CTYP _CerrPop(NOARG); /* Pop last CritErr handler */
- IntT CTYP _CerrSet(IffpCP fa); /* Overwrite current handler */
- IffpCP CTYP _CerrGet(NOARG); /* Get last CritErr handler addr */
- IntT FAR CTYP _DefCrit(WrdT rsi, /* Default handler */
- WrdT rbp, WrdT rdi, WrdT rax);
- IntT FAR CTYP _AltCrit(WrdT rsi, /* Alternate (verbose) handler */
- WrdT rbp, WrdT rdi, WrdT rax);
- /*- MS-DOS interface ------------*/
- FlgT PAS _ChgDir(ChrP p); /* Change directory */
- ChrT PAS _ChgDrv(ChrT d); /* Change current drive */
- IntT CTYP _FilFnd(ChrP p, ChrP b); /* Find file along PATH */
- FlgT PAS _FndFst(ChrP p, _FfbP f, /* Find first file */
- IntT a);
- FlgT PAS _FndNxt(_FfbP f); /* Find next file */
- IntT PAS _GetDir(ChrT d, ChrP p); /* Get current dir */
- VOID PAS _GetDtm(NOARG); /* Get system date/time */
- ChrT PAS _GetDrv(NOARG); /* Get current drive */
- WrdT PAS _GetSys(NOARG); /* Get system version */
- /*- iApx86 interface ------------*/
- BytT PAS _InpByt(WrdT p); /* Input byte */
- WrdT PAS _InpWrd(WrdT p); /* Input word */
- VOID PAS _IntDis(NOARG); /* Disable interrupts */
- VOID PAS _IntEna(NOARG); /* Enable interrupts */
- VOID PAS _OutByt(WrdT p, BytT b); /* Output byte */
- VOID PAS _OutWrd(WrdT p, WrdT w); /* Output word */
- #ifdef __cplusplus
- }
- #endif
- #endif /*- _TCXLdos_ : End of TCXLdos.h ------------------------------*/