def_os2.h

Go to the documentation of this file.
00001 /*      SCCS Id: @(#)def_os2.h  3.4     1993/01/19      */
00002 /* Copyright (c) Timo Hakulinen, 1990, 1991, 1992, 1993.          */
00003 /* NetHack may be freely redistributed.  See license for details. */
00004 
00005 /*
00006  *      Only a small portion of all OS/2 defines are needed, so the
00007  *      actual include files often need not be used.  In fact,
00008  *      including the full headers may stall the compile in DOS.
00009  */
00010 
00011 #ifdef OS2_USESYSHEADERS
00012 
00013 # define INCL_NOPMAPI
00014 # define INCL_DOSFILEMGR
00015 # define INCL_DOS
00016 # define INCL_SUB
00017 
00018 #include <os2.h>
00019 
00020 #else
00021 
00022 typedef char CHAR;
00023 typedef void VOID;
00024 
00025 typedef unsigned char UCHAR;
00026 typedef unsigned short USHORT;
00027 typedef unsigned int UINT;
00028 typedef unsigned long ULONG;
00029 typedef unsigned char BYTE;
00030 
00031 # ifdef OS2_32BITAPI
00032 
00033 typedef unsigned long SHANDLE;
00034 typedef USHORT HKBD;
00035 typedef USHORT HVIO;
00036 
00037 #  define CCHMAXPATHCOMP 256
00038 
00039 #  ifdef OS2_CSET2
00040 #   define API16 _Far16 _Pascal
00041 #   define DAT16
00042 #   define API32 _System
00043 #   define KbdGetStatus KBD16GETSTATUS
00044 #   define KbdSetStatus KBD16SETSTATUS
00045 #   define KbdCharIn    KBD16CHARIN
00046 #   define KbdPeek      KBD16PEEK
00047 #   define VioGetMode   VIO16GETMODE
00048 #   define VioSetCurPos VIO16SETCURPOS
00049 #  else
00050 #   define API16
00051 #   define DAT16
00052 #   define API32
00053 #  endif
00054 
00055 #  define DAT
00056 
00057 # else /* OS2_32BITAPI */
00058 
00059 typedef unsigned short SHANDLE;
00060 typedef SHANDLE HKBD;
00061 typedef SHANDLE HVIO;
00062 
00063 #  define CCHMAXPATHCOMP 13
00064 
00065 #  ifdef OS2_MSC
00066 #   define API16 pascal far
00067 #   define DAT16
00068 #  endif
00069 
00070 #  define DAT DAT16
00071 
00072 # endif /* OS2_32BITAPI */
00073 
00074 typedef USHORT * DAT16 PUSHORT;
00075 typedef BYTE * DAT16 PBYTE;
00076 typedef ULONG * DAT PULONG;
00077 typedef VOID * DAT PVOID;
00078 
00079 typedef SHANDLE HDIR;
00080 typedef HDIR * DAT PHDIR;
00081 
00082 typedef char * DAT16 PCH;
00083 typedef char * DAT PSZ;
00084 
00085 /* all supported compilers understand this */
00086 
00087 # pragma pack(2)
00088 
00089 typedef struct {
00090         UCHAR  chChar;
00091         UCHAR  chScan;
00092         UCHAR  fbStatus;
00093         UCHAR  bNlsShift;
00094         USHORT fsState;
00095         ULONG  time;
00096 } KBDKEYINFO;
00097 
00098 typedef KBDKEYINFO * DAT16 PKBDKEYINFO;
00099 
00100 /* File time and date types */
00101 
00102 typedef struct {
00103         UINT twosecs : 5;
00104         UINT minutes : 6;
00105         UINT hours   : 5;
00106 } FTIME;
00107 
00108 typedef struct {
00109         UINT day     : 5;
00110         UINT month   : 4;
00111         UINT year    : 7;
00112 } FDATE;
00113 
00114 # ifdef OS2_32BITAPI
00115 
00116 typedef struct {
00117         ULONG oNextEntryOffset;
00118         FDATE fdateCreation;
00119         FTIME ftimeCreation;
00120         FDATE fdateLastAccess;
00121         FTIME ftimeLastAccess;
00122         FDATE fdateLastWrite;
00123         FTIME ftimeLastWrite;
00124         ULONG cbFile;
00125         ULONG cbFileAlloc;
00126         ULONG attrFile;
00127         UCHAR cchName;
00128         CHAR  achName[CCHMAXPATHCOMP];
00129 } FILEFINDBUF3;
00130 
00131 # else
00132 
00133 typedef struct {
00134         FDATE  fdateCreation;
00135         FTIME  ftimeCreation;
00136         FDATE  fdateLastAccess;
00137         FTIME  ftimeLastAccess;
00138         FDATE  fdateLastWrite;
00139         FTIME  ftimeLastWrite;
00140         ULONG  cbFile;
00141         ULONG  cbFileAlloc;
00142         USHORT attrFile;
00143         UCHAR  cchName;
00144         CHAR   achName[CCHMAXPATHCOMP];
00145 } FILEFINDBUF;
00146 
00147 typedef FILEFINDBUF * DAT16 PFILEFINDBUF;
00148 
00149 # endif /* OS2_32BITAPI */
00150 
00151 typedef struct {
00152         ULONG  idFileSystem;
00153         ULONG  cSectorUnit;
00154         ULONG  cUnit;
00155         ULONG  cUnitAvail;
00156         USHORT cbSector;
00157 } FSALLOCATE;
00158 
00159 typedef struct {
00160         USHORT cb;
00161         USHORT fsMask;
00162         USHORT chTurnAround;
00163         USHORT fsInterim;
00164         USHORT fsState;
00165 } KBDINFO;
00166 
00167 typedef KBDINFO * DAT16 PKBDINFO;
00168 
00169 typedef struct {
00170         USHORT cb;
00171         UCHAR  fbType;
00172         UCHAR  color;
00173         USHORT col;
00174         USHORT row;
00175         USHORT hres;
00176         USHORT vres;
00177         UCHAR  fmt_ID;
00178         UCHAR  attrib;
00179         ULONG  buf_addr;
00180         ULONG  buf_length;
00181         ULONG  full_length;
00182         ULONG  partial_length;
00183         PCH    ext_data_addr;
00184 } VIOMODEINFO;
00185 
00186 typedef VIOMODEINFO * DAT16 PVIOMODEINFO;
00187 
00188 # pragma pack()
00189 
00190 /* OS2 API functions */
00191 
00192 USHORT API16 KbdGetStatus(PKBDINFO, HKBD);
00193 USHORT API16 KbdSetStatus(PKBDINFO, HKBD);
00194 USHORT API16 KbdCharIn(PKBDKEYINFO, USHORT, HKBD);
00195 USHORT API16 KbdPeek(PKBDKEYINFO, HKBD);
00196 
00197 USHORT API16 VioGetMode(PVIOMODEINFO, HVIO);
00198 USHORT API16 VioSetCurPos(USHORT, USHORT, HVIO);
00199 
00200 # ifdef OS2_32BITAPI
00201 ULONG API32 DosQueryFSInfo(ULONG, ULONG, PVOID, ULONG);
00202 ULONG API32 DosFindFirst(PSZ, PHDIR, ULONG, PVOID, ULONG, PULONG, ULONG);
00203 ULONG API32 DosFindNext(HDIR, PVOID, ULONG, PULONG);
00204 ULONG API32 DosSetDefaultDisk(ULONG);
00205 # else
00206 USHORT API16 DosQFSInfo(USHORT, USHORT, PBYTE, USHORT);
00207 USHORT API16 DosFindFirst(PSZ, PHDIR, USHORT, PFILEFINDBUF, USHORT, PUSHORT, ULONG);
00208 USHORT API16 DosFindNext(HDIR, PFILEFINDBUF, USHORT, PUSHORT);
00209 USHORT API16 DosSelectDisk(USHORT);
00210 # endif /* OS2_32BITAPI */
00211 
00212 #endif /* OS2_USESYSHEADERS */