File: def_os2.h

package info (click to toggle)
gnomehack 1.0.5-1.1
  • links: PTS
  • area: main
  • in suites: potato
  • size: 10,256 kB
  • ctags: 12,966
  • sloc: ansic: 119,783; yacc: 2,002; sh: 610; lex: 417; makefile: 397
file content (212 lines) | stat: -rw-r--r-- 4,249 bytes parent folder | download | duplicates (6)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
/*	SCCS Id: @(#)def_os2.h	3.2	93/01/19	*/
/* Copyright (c) Timo Hakulinen, 1990, 1991, 1992, 1993.	  */
/* NetHack may be freely redistributed.  See license for details. */

/*
 *	Only a small portion of all OS/2 defines are needed, so the
 *	actual include files often need not be used.  In fact,
 *	including the full headers may stall the compile in DOS.
 */

#ifdef OS2_USESYSHEADERS

# define INCL_NOPMAPI
# define INCL_DOSFILEMGR
# define INCL_DOS
# define INCL_SUB

#include <os2.h>

#else

typedef char CHAR;
typedef void VOID;

typedef unsigned char UCHAR;
typedef unsigned short USHORT;
typedef unsigned int UINT;
typedef unsigned long ULONG;
typedef unsigned char BYTE;

# ifdef OS2_32BITAPI

typedef unsigned long SHANDLE;
typedef USHORT HKBD;
typedef USHORT HVIO;

#  define CCHMAXPATHCOMP 256

#  ifdef OS2_CSET2
#   define API16 _Far16 _Pascal
#   define DAT16
#   define API32 _System
#   define KbdGetStatus KBD16GETSTATUS
#   define KbdSetStatus KBD16SETSTATUS
#   define KbdCharIn    KBD16CHARIN
#   define KbdPeek      KBD16PEEK
#   define VioGetMode   VIO16GETMODE
#   define VioSetCurPos VIO16SETCURPOS
#  else
#   define API16
#   define DAT16
#   define API32
#  endif

#  define DAT

# else /* OS2_32BITAPI */

typedef unsigned short SHANDLE;
typedef SHANDLE HKBD;
typedef SHANDLE HVIO;

#  define CCHMAXPATHCOMP 13

#  ifdef OS2_MSC
#   define API16 pascal far
#   define DAT16
#  endif

#  define DAT DAT16

# endif /* OS2_32BITAPI */

typedef USHORT * DAT16 PUSHORT;
typedef BYTE * DAT16 PBYTE;
typedef ULONG * DAT PULONG;
typedef VOID * DAT PVOID;

typedef SHANDLE HDIR;
typedef HDIR * DAT PHDIR;

typedef char * DAT16 PCH;
typedef char * DAT PSZ;

/* all supported compilers understand this */

# pragma pack(2)

typedef struct {
	UCHAR  chChar;
	UCHAR  chScan;
	UCHAR  fbStatus;
	UCHAR  bNlsShift;
	USHORT fsState;
	ULONG  time;
} KBDKEYINFO;

typedef KBDKEYINFO * DAT16 PKBDKEYINFO;

/* File time and date types */

typedef struct {
	UINT twosecs : 5;
	UINT minutes : 6;
	UINT hours   : 5;
} FTIME;

typedef struct {
	UINT day     : 5;
	UINT month   : 4;
	UINT year    : 7;
} FDATE;

# ifdef OS2_32BITAPI

typedef struct {
	ULONG oNextEntryOffset;
	FDATE fdateCreation;
	FTIME ftimeCreation;
	FDATE fdateLastAccess;
	FTIME ftimeLastAccess;
	FDATE fdateLastWrite;
	FTIME ftimeLastWrite;
	ULONG cbFile;
	ULONG cbFileAlloc;
	ULONG attrFile;
	UCHAR cchName;
	CHAR  achName[CCHMAXPATHCOMP];
} FILEFINDBUF3;

# else

typedef struct {
	FDATE  fdateCreation;
	FTIME  ftimeCreation;
	FDATE  fdateLastAccess;
	FTIME  ftimeLastAccess;
	FDATE  fdateLastWrite;
	FTIME  ftimeLastWrite;
	ULONG  cbFile;
	ULONG  cbFileAlloc;
	USHORT attrFile;
	UCHAR  cchName;
	CHAR   achName[CCHMAXPATHCOMP];
} FILEFINDBUF;

typedef FILEFINDBUF * DAT16 PFILEFINDBUF;

# endif /* OS2_32BITAPI */

typedef struct {
	ULONG  idFileSystem;
	ULONG  cSectorUnit;
	ULONG  cUnit;
	ULONG  cUnitAvail;
	USHORT cbSector;
} FSALLOCATE;

typedef struct {
	USHORT cb;
	USHORT fsMask;
	USHORT chTurnAround;
	USHORT fsInterim;
	USHORT fsState;
} KBDINFO;

typedef KBDINFO * DAT16 PKBDINFO;

typedef struct {
	USHORT cb;
	UCHAR  fbType;
	UCHAR  color;
	USHORT col;
	USHORT row;
	USHORT hres;
	USHORT vres;
	UCHAR  fmt_ID;
	UCHAR  attrib;
	ULONG  buf_addr;
	ULONG  buf_length;
	ULONG  full_length;
	ULONG  partial_length;
	PCH    ext_data_addr;
} VIOMODEINFO;

typedef VIOMODEINFO * DAT16 PVIOMODEINFO;

# pragma pack()

/* OS2 API functions */

USHORT API16 KbdGetStatus(PKBDINFO, HKBD);
USHORT API16 KbdSetStatus(PKBDINFO, HKBD);
USHORT API16 KbdCharIn(PKBDKEYINFO, USHORT, HKBD);
USHORT API16 KbdPeek(PKBDKEYINFO, HKBD);

USHORT API16 VioGetMode(PVIOMODEINFO, HVIO);
USHORT API16 VioSetCurPos(USHORT, USHORT, HVIO);

# ifdef OS2_32BITAPI
ULONG API32 DosQueryFSInfo(ULONG, ULONG, PVOID, ULONG);
ULONG API32 DosFindFirst(PSZ, PHDIR, ULONG, PVOID, ULONG, PULONG, ULONG);
ULONG API32 DosFindNext(HDIR, PVOID, ULONG, PULONG);
ULONG API32 DosSetDefaultDisk(ULONG);
# else
USHORT API16 DosQFSInfo(USHORT, USHORT, PBYTE, USHORT);
USHORT API16 DosFindFirst(PSZ, PHDIR, USHORT, PFILEFINDBUF, USHORT, PUSHORT, ULONG);
USHORT API16 DosFindNext(HDIR, PFILEFINDBUF, USHORT, PUSHORT);
USHORT API16 DosSelectDisk(USHORT);
# endif /* OS2_32BITAPI */

#endif /* OS2_USESYSHEADERS */