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