|
|
1.1 root 1: /***************************************************************************\
2: *
3: * Module Name: OS2DEF.H
4: *
5: * OS/2 Common Definitions file
6: *
7: * Copyright (c) 1987 IBM Corporation
8: * Copyright (c) 1987 Microsoft Corporation
9: *
10: \***************************************************************************/
11:
12: #define PASCAL pascal
13: #define FAR far
14: #define NEAR near
15: #define VOID void
16:
17: typedef unsigned short SHANDLE;
18: typedef void far *LHANDLE;
19:
20: #define EXPENTRY pascal far
21: #define APIENTRY pascal far
22:
23: #define CHAR char /* ch */
24: #define SHORT short /* s */
25: #define LONG long /* l */
26: #define INT int /* i */
27:
28: #ifndef NULL
29: #ifdef M_I86L
30: #define NULL 0L
31: #else
32: #define NULL 0
33: #endif
34: #endif
35:
36: typedef unsigned char UCHAR; /* uch */
37: typedef unsigned short USHORT; /* us */
38: typedef unsigned long ULONG; /* ul */
39: typedef unsigned int UINT; /* ui */
40:
41: typedef unsigned char BYTE; /* b */
42:
43: typedef char far *PSZ;
44: typedef char near *NPSZ;
45:
46: typedef char far *PCH;
47: typedef char near *NPCH;
48:
49: typedef int (pascal far *PFN)();
50: typedef int (pascal near *NPFN)();
51: typedef PFN far *PPFN;
52:
53: typedef BYTE FAR *PBYTE;
54: typedef BYTE near *NPBYTE;
55:
56: typedef CHAR FAR *PCHAR;
57: typedef SHORT FAR *PSHORT;
58: typedef LONG FAR *PLONG;
59: typedef INT FAR *PINT;
60:
61: typedef UCHAR FAR *PUCHAR;
62: typedef USHORT FAR *PUSHORT;
63: typedef ULONG FAR *PULONG;
64: typedef UINT FAR *PUINT;
65:
66: typedef VOID FAR *PVOID;
67:
68: typedef unsigned short BOOL; /* f */
69: typedef BOOL FAR *PBOOL;
70:
71: #define FALSE 0
72: #define TRUE 1
73:
74: #ifndef INCL_SAADEFS
75: typedef unsigned short SEL; /* sel */
76: typedef SEL FAR *PSEL;
77:
78: /*** Useful Helper Macros */
79:
80: /* Create untyped far pointer from selector and offset */
81: #define MAKEP(sel, off) ((PVOID)MAKEULONG(off, sel))
82:
83: /* Extract selector or offset from far pointer */
84: #define SELECTOROF(p) (((PUSHORT)&(p))[1])
85: #define OFFSETOF(p) (((PUSHORT)&(p))[0])
86: #endif /* !INCL_SAADEFS */
87:
88: /* Cast any variable to an instance of the specified type. */
89: #define MAKETYPE(v, type) (*((type far *)&v))
90:
91: /* Calculate the byte offset of a field in a structure of type type. */
92: #define FIELDOFFSET(type, field) ((SHORT)&(((type *)0)->field))
93:
94: /* Combine l & h to form a 32 bit quantity. */
95: #define MAKEULONG(l, h) ((ULONG)(((USHORT)(l)) | ((ULONG)((USHORT)(h))) << 16))
96: #define MAKELONG(l, h) ((LONG)MAKEULONG(l, h))
97:
98: /* Combine l & h to form a 16 bit quantity. */
99: #define MAKEUSHORT(l, h) (((USHORT)(l)) | ((USHORT)(h)) << 8)
100: #define MAKESHORT(l, h) ((SHORT)MAKEUSHORT(l, h))
101:
102: /* Extract high and low order parts of 16 and 32 bit quantity */
103: #define LOBYTE(w) LOUCHAR(w)
104: #define HIBYTE(w) HIUCHAR(w)
105: #define LOUCHAR(w) ((UCHAR)(w))
106: #define HIUCHAR(w) ((UCHAR)(((USHORT)(w) >> 8) & 0xff))
107: #define LOUSHORT(l) ((USHORT)(l))
108: #define HIUSHORT(l) ((USHORT)(((ULONG)(l) >> 16) & 0xffff))
109:
110: /*** Common Error definitions ****/
111:
112: typedef ULONG ERRORID; /* errid */
113: typedef ERRORID FAR *PERRORID;
114:
115: /* Combine severity and error code to produce ERRORID */
116: #define MAKEERRORID(sev, error) (ERRORID)(MAKEULONG((error), (sev)))
117:
118: /* Severity codes */
119: #define SEVERITY_NOERROR 0x0000
120: #define SEVERITY_WARNING 0x0004
121: #define SEVERITY_ERROR 0x0008
122: #define SEVERITY_SEVERE 0x000C
123: #define SEVERITY_UNRECOVERABLE 0x0010
124:
125: /* Base component error values */
126:
127: #define WINERR_BASE 0x1000 /* Window Manager */
128: #define GPIERR_BASE 0x2000 /* Graphics Presentation Interface */
129: #define DEVERR_BASE 0x3000 /* Device Manager */
130: #define SPLERR_BASE 0x4000 /* Spooler */
131:
132: /*** Common types used across components */
133:
134: /*** Common DOS types */
135:
136: typedef USHORT HMODULE; /* hmod */
137: typedef HMODULE FAR *PHMODULE;
138:
139: #ifndef INCL_SAADEFS
140: typedef USHORT PID; /* pid */
141: typedef PID FAR *PPID;
142:
143: typedef USHORT TID; /* tid */
144: typedef TID FAR *PTID;
145:
146: typedef VOID FAR *HSEM; /* hsem */
147: typedef HSEM FAR *PHSEM;
148: #endif /* !INCL_SAADEFS */
149:
150: /*** Common SUP types */
151:
152: typedef LHANDLE HAB; /* hab */
153: typedef HAB FAR *PHAB;
154:
155: /*** Common GPI/DEV types */
156:
157: typedef LHANDLE HPS; /* hps */
158: typedef HPS FAR *PHPS;
159:
160: typedef LHANDLE HDC; /* hdc */
161: typedef HDC FAR *PHDC;
162:
163: typedef LHANDLE HRGN; /* hrgn */
164: typedef HRGN FAR *PHRGN;
165:
166: #ifndef INCL_SAADEFS
167: typedef LHANDLE HBITMAP; /* hbm */
168: typedef HBITMAP FAR *PHBITMAP;
169: #endif /* !INCL_SAADEFS */
170:
171: typedef LHANDLE HMF; /* hmf */
172: typedef HMF FAR *PHMF;
173:
174: typedef LONG COLOR; /* clr */
175: typedef COLOR FAR *PCOLOR;
176:
177: typedef struct _POINTL { /* ptl */
178: LONG x;
179: LONG y;
180: } POINTL;
181: typedef POINTL FAR *PPOINTL;
182: typedef POINTL near *NPPOINTL;
183:
184: typedef struct _RECTL { /* rcl */
185: LONG xLeft;
186: LONG yBottom;
187: LONG xRight;
188: LONG yTop;
189: } RECTL;
190: typedef RECTL FAR *PRECTL;
191: typedef RECTL near *NPRECTL;
192:
193: typedef CHAR STR8[8]; /* str8 */
194: typedef STR8 FAR *PSTR8;
195:
196: #ifndef INCL_SAADEFS
197: /* common DOS/SHL types */
198:
199: /* File time and date types */
200:
201: typedef struct _FTIME { /* ftime */
202: unsigned twosecs : 5;
203: unsigned minutes : 6;
204: unsigned hours : 5;
205: } FTIME;
206: typedef FTIME FAR *PFTIME;
207:
208: typedef struct _FDATE { /* fdate */
209: unsigned day : 5;
210: unsigned month : 4;
211: unsigned year : 7;
212: } FDATE;
213: typedef FDATE FAR *PFDATE;
214:
215: typedef struct _FILEFINDBUF { /* findbuf */
216: FDATE fdateCreation;
217: FTIME ftimeCreation;
218: FDATE fdateLastAccess;
219: FTIME ftimeLastAccess;
220: FDATE fdateLastWrite;
221: FTIME ftimeLastWrite;
222: ULONG cbFile;
223: ULONG cbFileAlloc;
224: USHORT attrFile;
225: UCHAR cchName;
226: CHAR achName[13];
227: } FILEFINDBUF;
228: typedef FILEFINDBUF FAR *PFILEFINDBUF;
229: #endif /* !INCL_SAADEFS */
230:
231: /*** common DEV/SPL types */
232:
233: /* structure for Device Driver data */
234:
235: typedef struct _DRIVDATA { /* driv */
236: LONG cb;
237: LONG lVersion;
238: CHAR szDeviceName[32];
239: CHAR abGeneralData[1];
240: } DRIVDATA;
241: typedef DRIVDATA far *PDRIVDATA;
242:
243: /* array indices for array parameter for DevOpenDC, SplQmOpen or SplQpOpen */
244:
245: #define ADDRESS 0
246: #ifndef INCL_SAADEFS
247: #define DRIVER_NAME 1
248: #define DRIVER_DATA 2
249: #define DATA_TYPE 3
250: #define COMMENT 4
251: #define PROC_NAME 5
252: #define PROC_PARAMS 6
253: #define SPL_PARAMS 7
254: #define NETWORK_PARAMS 8
255:
256: /* structure definition as an alternative of the array parameter */
257:
258: typedef struct _DEVOPENSTRUC { /* dop */
259: PSZ pszLogAddress;
260: PSZ pszDriverName;
261: PDRIVDATA pdriv;
262: PSZ pszDataType;
263: PSZ pszComment;
264: PSZ pszQueueProcName;
265: PSZ pszQueueProcParams;
266: PSZ pszSpoolerParams;
267: PSZ pszNetworkParams;
268: } DEVOPENSTRUC;
269: typedef DEVOPENSTRUC FAR *PDEVOPENSTRUC;
270: #endif /* !INCL_SAADEFS */
271:
272: /*** common AVIO/GPI types */
273:
274: /* values of fsSelection field of FATTRS structure */
275: #define FATTR_SEL_ITALIC 0x0001
276: #define FATTR_SEL_UNDERSCORE 0x0002
277: #define FATTR_SEL_STRIKEOUT 0x0010
278: #define FATTR_SEL_BOLD 0x0020
279:
280: /* values of fsType field of FATTRS structure */
281: #define FATTR_TYPE_FIXED 0x0002
282: #define FATTR_TYPE_KERNING 0x0004
283:
284: /* values of sQuality field of FATTRS structure */
285: #define FATTR_QUALITY_DEFAULT 0
286: #define FATTR_QUALITY_DRAFT 1
287: #define FATTR_QUALITY_PROOF 2
288:
289: /* values of fsFontUse field of FATTRS structure */
290: #define FATTR_FONTUSE_NOMIX 0x0002
291: #define FATTR_FONTUSE_OUTLINE 0x0004
292: #define FATTR_FONTUSE_TRANSFORMABLE 0x0008
293: /* size for fields in the font structures */
294:
295: #define FACESIZE 32
296:
297: /* font struct for Vio/GpiCreateLogFont */
298:
299: typedef struct _FATTRS { /* fat */
300: USHORT usRecordLength;
301: USHORT fsSelection;
302: LONG lMatch;
303: CHAR szFaceName[FACESIZE];
304: USHORT idRegistry;
305: USHORT usCodePage;
306: LONG lMaxBaselineExt;
307: LONG lAveCharWidth;
308: USHORT fsType;
309: SHORT sQuality;
310: USHORT fsFontUse;
311: } FATTRS;
312: typedef FATTRS far *PFATTRS;
313:
314: /* font metrics returned by GpiQueryFonts and others */
315:
316: typedef struct _FONTMETRICS { /* fm */
317: CHAR szFamilyname[FACESIZE];
318: CHAR szFacename[FACESIZE];
319: SHORT idRegistry;
320: SHORT usCodePage;
321: LONG lEmHeight;
322: LONG lXHeight;
323: LONG lMaxAscender;
324: LONG lMaxDescender;
325: LONG lLowerCaseAscent;
326: LONG lLowerCaseDescent;
327: LONG lInternalLeading;
328: LONG lExternalLeading;
329: LONG lAveCharWidth;
330: LONG lMaxCharInc;
331: LONG lEmInc;
332: LONG lMaxBaselineExt;
333: SHORT sCharSlope;
334: SHORT sInlineDir;
335: SHORT sCharRot;
336: USHORT usWeightClass;
337: USHORT usWidthClass;
338: SHORT sXDeviceRes;
339: SHORT sYDeviceRes;
340: SHORT sFirstChar;
341: SHORT sLastChar;
342: SHORT sDefaultChar;
343: SHORT sBreakChar;
344: SHORT sNominalPointSize;
345: SHORT sMinimumPointSize;
346: SHORT sMaximumPointSize;
347: USHORT fsType;
348: USHORT fsDefn;
349: USHORT fsSelection;
350: USHORT fsCapabilities;
351: LONG lSubscriptXSize;
352: LONG lSubscriptYSize;
353: LONG lSubscriptXOffset;
354: LONG lSubscriptYOffset;
355: LONG lSuperscriptXSize;
356: LONG lSuperscriptYSize;
357: LONG lSuperscriptXOffset;
358: LONG lSuperscriptYOffset;
359: LONG lUnderscoreSize;
360: LONG lUnderscorePosition;
361: LONG lStrikeoutSize;
362: LONG lStrikeoutPosition;
363: SHORT sKerningPairs;
364: SHORT sReserved;
365: LONG lMatch;
366: } FONTMETRICS;
367: typedef FONTMETRICS far *PFONTMETRICS;
368:
369: /*** Common WIN types */
370:
371: typedef LHANDLE HWND; /* hwnd */
372: typedef HWND FAR *PHWND;
373:
374: typedef struct _WRECT { /* wrc */
375: SHORT xLeft;
376: SHORT dummy1;
377: SHORT yBottom;
378: SHORT dummy2;
379: SHORT xRight;
380: SHORT dummy3;
381: SHORT yTop;
382: SHORT dummy4;
383: } WRECT;
384: typedef WRECT FAR *PWRECT;
385: typedef WRECT near *NPWRECT;
386:
387: typedef struct _WPOINT { /* wpt */
388: SHORT x;
389: SHORT dummy1;
390: SHORT y;
391: SHORT dummy2;
392: } WPOINT;
393: typedef WPOINT FAR *PWPOINT;
394: typedef WPOINT near *NPWPOINT;
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.