Source:NetHack 3.4.3/include/def os2.h

From NetHackWiki
Jump to: navigation, search

Below is the full text to include/def_os2.h from NetHack 3.4.3. To link to a particular line, write [[def_os2.h#line123]], for example.

  1. /*	SCCS Id: @(#)def_os2.h	3.4	1993/01/19	*/
  2. /* Copyright (c) Timo Hakulinen, 1990, 1991, 1992, 1993.	  */
  3. /* NetHack may be freely redistributed.  See license for details. */

The NetHack General Public License applies to screenshots, source code and other content from NetHack.

This content was modified from the original NetHack source code distribution (by splitting up NetHack content between wiki pages, and possibly further editing). See the page history for a list of who changed it, and on what dates.

  1. /*
  2. *	Only a small portion of all OS/2 defines are needed, so the
  3. *	actual include files often need not be used.  In fact,
  4. *	including the full headers may stall the compile in DOS.
  5. */
  6.  
  7. #ifdef OS2_USESYSHEADERS
  8.  
  9. # define INCL_NOPMAPI
  10. # define INCL_DOSFILEMGR
  11. # define INCL_DOS
  12. # define INCL_SUB
  13.  
  14. #include <os2.h>
  15.  
  16. #else
  17.  
  18. typedef char CHAR;
  19. typedef void VOID;
  20.  
  21. typedef unsigned char UCHAR;
  22. typedef unsigned short USHORT;
  23. typedef unsigned int UINT;
  24. typedef unsigned long ULONG;
  25. typedef unsigned char BYTE;
  26.  
  27. # ifdef OS2_32BITAPI
  28.  
  29. typedef unsigned long SHANDLE;
  30. typedef USHORT HKBD;
  31. typedef USHORT HVIO;
  32.  
  33. #  define CCHMAXPATHCOMP 256
  34.  
  35. #  ifdef OS2_CSET2
  36. #   define API16 _Far16 _Pascal
  37. #   define DAT16
  38. #   define API32 _System
  39. #   define KbdGetStatus KBD16GETSTATUS
  40. #   define KbdSetStatus KBD16SETSTATUS
  41. #   define KbdCharIn    KBD16CHARIN
  42. #   define KbdPeek      KBD16PEEK
  43. #   define VioGetMode   VIO16GETMODE
  44. #   define VioSetCurPos VIO16SETCURPOS
  45. #  else
  46. #   define API16
  47. #   define DAT16
  48. #   define API32
  49. #  endif
  50.  
  51. #  define DAT
  52.  
  53. # else /* OS2_32BITAPI */
  54.  
  55. typedef unsigned short SHANDLE;
  56. typedef SHANDLE HKBD;
  57. typedef SHANDLE HVIO;
  58.  
  59. #  define CCHMAXPATHCOMP 13
  60.  
  61. #  ifdef OS2_MSC
  62. #   define API16 pascal far
  63. #   define DAT16
  64. #  endif
  65.  
  66. #  define DAT DAT16
  67.  
  68. # endif /* OS2_32BITAPI */
  69.  
  70. typedef USHORT * DAT16 PUSHORT;
  71. typedef BYTE * DAT16 PBYTE;
  72. typedef ULONG * DAT PULONG;
  73. typedef VOID * DAT PVOID;
  74.  
  75. typedef SHANDLE HDIR;
  76. typedef HDIR * DAT PHDIR;
  77.  
  78. typedef char * DAT16 PCH;
  79. typedef char * DAT PSZ;
  80.  
  81. /* all supported compilers understand this */
  82.  
  83. # pragma pack(2)
  84.  
  85. typedef struct {
  86. 	UCHAR  chChar;
  87. 	UCHAR  chScan;
  88. 	UCHAR  fbStatus;
  89. 	UCHAR  bNlsShift;
  90. 	USHORT fsState;
  91. 	ULONG  time;
  92. } KBDKEYINFO;
  93.  
  94. typedef KBDKEYINFO * DAT16 PKBDKEYINFO;
  95.  
  96. /* File time and date types */
  97.  
  98. typedef struct {
  99. 	UINT twosecs : 5;
  100. 	UINT minutes : 6;
  101. 	UINT hours   : 5;
  102. } FTIME;
  103.  
  104. typedef struct {
  105. 	UINT day     : 5;
  106. 	UINT month   : 4;
  107. 	UINT year    : 7;
  108. } FDATE;
  109.  
  110. # ifdef OS2_32BITAPI
  111.  
  112. typedef struct {
  113. 	ULONG oNextEntryOffset;
  114. 	FDATE fdateCreation;
  115. 	FTIME ftimeCreation;
  116. 	FDATE fdateLastAccess;
  117. 	FTIME ftimeLastAccess;
  118. 	FDATE fdateLastWrite;
  119. 	FTIME ftimeLastWrite;
  120. 	ULONG cbFile;
  121. 	ULONG cbFileAlloc;
  122. 	ULONG attrFile;
  123. 	UCHAR cchName;
  124. 	CHAR  achName[CCHMAXPATHCOMP];
  125. } FILEFINDBUF3;
  126.  
  127. # else
  128.  
  129. typedef struct {
  130. 	FDATE  fdateCreation;
  131. 	FTIME  ftimeCreation;
  132. 	FDATE  fdateLastAccess;
  133. 	FTIME  ftimeLastAccess;
  134. 	FDATE  fdateLastWrite;
  135. 	FTIME  ftimeLastWrite;
  136. 	ULONG  cbFile;
  137. 	ULONG  cbFileAlloc;
  138. 	USHORT attrFile;
  139. 	UCHAR  cchName;
  140. 	CHAR   achName[CCHMAXPATHCOMP];
  141. } FILEFINDBUF;
  142.  
  143. typedef FILEFINDBUF * DAT16 PFILEFINDBUF;
  144.  
  145. # endif /* OS2_32BITAPI */
  146.  
  147. typedef struct {
  148. 	ULONG  idFileSystem;
  149. 	ULONG  cSectorUnit;
  150. 	ULONG  cUnit;
  151. 	ULONG  cUnitAvail;
  152. 	USHORT cbSector;
  153. } FSALLOCATE;
  154.  
  155. typedef struct {
  156. 	USHORT cb;
  157. 	USHORT fsMask;
  158. 	USHORT chTurnAround;
  159. 	USHORT fsInterim;
  160. 	USHORT fsState;
  161. } KBDINFO;
  162.  
  163. typedef KBDINFO * DAT16 PKBDINFO;
  164.  
  165. typedef struct {
  166. 	USHORT cb;
  167. 	UCHAR  fbType;
  168. 	UCHAR  color;
  169. 	USHORT col;
  170. 	USHORT row;
  171. 	USHORT hres;
  172. 	USHORT vres;
  173. 	UCHAR  fmt_ID;
  174. 	UCHAR  attrib;
  175. 	ULONG  buf_addr;
  176. 	ULONG  buf_length;
  177. 	ULONG  full_length;
  178. 	ULONG  partial_length;
  179. 	PCH    ext_data_addr;
  180. } VIOMODEINFO;
  181.  
  182. typedef VIOMODEINFO * DAT16 PVIOMODEINFO;
  183.  
  184. # pragma pack()
  185.  
  186. /* OS2 API functions */
  187.  
  188. USHORT API16 KbdGetStatus(PKBDINFO, HKBD);
  189. USHORT API16 KbdSetStatus(PKBDINFO, HKBD);
  190. USHORT API16 KbdCharIn(PKBDKEYINFO, USHORT, HKBD);
  191. USHORT API16 KbdPeek(PKBDKEYINFO, HKBD);
  192.  
  193. USHORT API16 VioGetMode(PVIOMODEINFO, HVIO);
  194. USHORT API16 VioSetCurPos(USHORT, USHORT, HVIO);
  195.  
  196. # ifdef OS2_32BITAPI
  197. ULONG API32 DosQueryFSInfo(ULONG, ULONG, PVOID, ULONG);
  198. ULONG API32 DosFindFirst(PSZ, PHDIR, ULONG, PVOID, ULONG, PULONG, ULONG);
  199. ULONG API32 DosFindNext(HDIR, PVOID, ULONG, PULONG);
  200. ULONG API32 DosSetDefaultDisk(ULONG);
  201. # else
  202. USHORT API16 DosQFSInfo(USHORT, USHORT, PBYTE, USHORT);
  203. USHORT API16 DosFindFirst(PSZ, PHDIR, USHORT, PFILEFINDBUF, USHORT, PUSHORT, ULONG);
  204. USHORT API16 DosFindNext(HDIR, PFILEFINDBUF, USHORT, PUSHORT);
  205. USHORT API16 DosSelectDisk(USHORT);
  206. # endif /* OS2_32BITAPI */
  207.  
  208. #endif /* OS2_USESYSHEADERS */