home *** CD-ROM | disk | FTP | other *** search
/ Liren Large Software Subsidy 7 / 07.iso / c / c034 / 7.ddi / INCLUDE / OS2DEF.H$ / OS2DEF.bin
Encoding:
Text File  |  1989-12-18  |  10.2 KB  |  419 lines

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