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