home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Professional Developers Kit 1992 November / Disc01 / Disc01.mdf / cppbeta / inclf / os2def.h__ / OS2DEF.H
Encoding:
C/C++ Source or Header  |  1992-11-02  |  13.4 KB  |  531 lines

  1. /****************************** Module Header ******************************\
  2. *
  3. * Module Name: OS2DEF.H
  4. *
  5. * OS/2 Common Definitions file
  6. *
  7. * Copyright (c) International Business Machines Corporation 1981, 1988-1992
  8. *
  9. * ===========================================================================
  10. *
  11. * Comments at the end of each typedef line give the name tags used in
  12. * the assembler include version of this file.
  13. *
  14. * The assembler include version of this file excludes lines between NOINC
  15. * and INC comments.
  16. *
  17. \***************************************************************************/
  18.  
  19. #ifdef __IBMC__
  20. #pragma checkout( suspend )
  21. #ifndef __CHKHDR__
  22.    #pragma checkout( suspend )
  23. #endif
  24. #pragma checkout( resume )
  25. #endif
  26.  
  27. #ifndef __OS2DEF__
  28. #define __OS2DEF__
  29.  
  30. #define OS2DEF_INCLUDED
  31.  
  32.  
  33.  
  34. /* NOINC */
  35. #define FAR         /* this will be deleted shortly */
  36. #define NEAR        /* this will be deleted shortly */
  37.  
  38. #define APIENTRY    _System
  39. #define EXPENTRY    _System
  40.  
  41. #define APIENTRY16  _Far16 _Pascal
  42. #define PASCAL16    _Far16 _Pascal
  43. #define CDECL16     _Far16 _Cdecl
  44.  
  45. #define VOID        void
  46. /* INC */
  47.  
  48. typedef unsigned long  APIRET;
  49. typedef unsigned short APIRET16;
  50. typedef unsigned long  APIRET32;
  51.  
  52. #ifndef FALSE
  53.    #define FALSE   0
  54. #endif
  55.  
  56. #ifndef TRUE
  57.    #define TRUE    1
  58. #endif
  59.  
  60. #ifndef NULL
  61.    #if __cplusplus
  62.       #define NULL (0)
  63.    #else
  64.       #define NULL ((void *)0)
  65.    #endif
  66. #endif
  67.  
  68. typedef unsigned short   SHANDLE;
  69. typedef unsigned long    LHANDLE;
  70.  
  71. #define NULLHANDLE    ( (LHANDLE) 0)
  72. #define NULLSHANDLE   ( (SHANDLE) 0)
  73.  
  74. /* NOINC */
  75. #define CHAR    char            /* ch  */
  76. #define SHORT   short           /* s   */
  77. #define LONG    long            /* l   */
  78.  
  79. #ifndef INCL_SAADEFS
  80.    #define INT  int             /* i   */
  81. #endif /* !INCL_SAADEFS */
  82. /* INC */
  83.  
  84. typedef unsigned char  UCHAR;   /* uch */
  85. typedef unsigned short USHORT;  /* us  */
  86. typedef unsigned long  ULONG;   /* ul  */
  87.  
  88. #ifndef INCL_SAADEFS
  89.    typedef unsigned int UINT;   /* ui  */
  90. #endif /* !INCL_SAADEFS */
  91.  
  92. typedef UCHAR     * _Seg16 PUCHAR16;
  93. typedef CHAR      * _Seg16 PCHAR16;
  94.  
  95. typedef char BYTE;     /* b   */
  96.  
  97. typedef char *PSZ;
  98. typedef char *NPSZ;
  99.  
  100. typedef char *PCH;
  101. typedef char *NPCH;
  102.  
  103. typedef int ( APIENTRY _PFN)  ();
  104. typedef _PFN    *PFN;
  105. typedef int ( APIENTRY _NPFN)  ();
  106. typedef _NPFN   *NPFN;
  107.  
  108.  
  109. typedef BYTE *PBYTE;
  110. typedef BYTE *NPBYTE;
  111.  
  112. typedef CHAR *PCHAR;
  113. typedef SHORT *PSHORT;
  114. typedef LONG *PLONG;
  115.  
  116. #ifndef INCL_SAADEFS
  117.    typedef INT *PINT;
  118. #endif /* !INCL_SAADEFS */
  119.  
  120. typedef UCHAR *PUCHAR;
  121. typedef USHORT *PUSHORT;
  122. typedef ULONG *PULONG;
  123.  
  124. #ifndef INCL_SAADEFS
  125.    typedef UINT *PUINT;
  126. #endif /* !INCL_SAADEFS */
  127.  
  128. typedef VOID   *PVOID;
  129. typedef PVOID  *PPVOID;
  130. typedef VOID   * _Seg16  PVOID16;
  131.  
  132. typedef unsigned long BOOL;     /* f   */
  133. typedef BOOL *PBOOL;
  134.  
  135. typedef unsigned short  BOOL16;
  136. typedef BOOL16     * _Seg16 PBOOL16;
  137.  
  138. /* NOINC */
  139. #define BOOL32    BOOL
  140. #define PBOOL32   PBOOL
  141. /* INC */
  142.  
  143. /* Quad-word */
  144. /* NOINC */
  145. typedef struct _QWORD          /* qword */
  146. {
  147.    ULONG   ulLo;
  148.    ULONG   ulHi;
  149. } QWORD;
  150. typedef QWORD *PQWORD;
  151. /* INC */
  152.  
  153. #ifndef INCL_SAADEFS
  154.    typedef unsigned short SEL;     /* sel */
  155.    typedef SEL *PSEL;
  156.  
  157.    /*** Useful Helper Macros */
  158.  
  159.    /* Create untyped far pointer from selector and offset */
  160.    #define MAKEP( sel,off ) (( void * )( void * _Seg16 )( (sel) << 16 | (off) ))
  161.    #define MAKE16P( sel,off ) (( void * _Seg16 )( (sel) << 16 | (off) ))
  162.  
  163.    /* Extract selector or offset from far pointer */
  164.    #define SELECTOROF(ptr)     ((((ULONG)(ptr))>>13)|7)
  165.    #define OFFSETOF(p)         (((PUSHORT)&(p))[0])
  166. #endif  /* !INCL_SAADEFS */
  167.  
  168. /* Cast any variable to an instance of the specified type. */
  169. #define MAKETYPE(v, type)   (*((type *)&v))
  170.  
  171. /* Calculate the byte offset of a field in a structure of type type. */
  172. #define FIELDOFFSET(type, field)    ((SHORT)&(((type *)0)->field))
  173.  
  174. /* Combine l & h to form a 32 bit quantity. */
  175. #define MAKEULONG(l, h)  ((ULONG)(((USHORT)(l)) | ((ULONG)((USHORT)(h))) << 16))
  176. #define MAKELONG(l, h)   ((LONG)MAKEULONG(l, h))
  177.  
  178. /* Combine l & h to form a 16 bit quantity. */
  179. #define MAKEUSHORT(l, h) (((USHORT)(l)) | ((USHORT)(h)) << 8)
  180. #define MAKESHORT(l, h)  ((SHORT)MAKEUSHORT(l, h))
  181.  
  182. /* Extract high and low order parts of 16 and 32 bit quantity */
  183. #define LOBYTE(w)       LOUCHAR(w)
  184. #define HIBYTE(w)       HIUCHAR(w)
  185. #define LOUCHAR(w)      ((UCHAR)(w))
  186. #define HIUCHAR(w)      ((UCHAR)(((USHORT)(w) >> 8) & 0xff))
  187. #define LOUSHORT(l)     ((USHORT)((ULONG)l))
  188. #define HIUSHORT(l)     ((USHORT)(((ULONG)(l) >> 16) & 0xffff))
  189.  
  190. /*** Common Error definitions ****/
  191.  
  192. typedef ULONG ERRORID;  /* errid */
  193. typedef ERRORID *PERRORID;
  194.  
  195. /* Combine severity and error code to produce ERRORID */
  196. #define MAKEERRORID(sev, error) (ERRORID)(MAKEULONG((error), (sev)))
  197.  
  198. /* Extract error number from an errorid */
  199. #define ERRORIDERROR(errid)            (LOUSHORT(errid))
  200.  
  201. /* Extract severity from an errorid */
  202. #define ERRORIDSEV(errid)              (HIUSHORT(errid))
  203.  
  204. /* Severity codes */
  205. #define SEVERITY_NOERROR                    0x0000
  206. #define SEVERITY_WARNING                    0x0004
  207. #define SEVERITY_ERROR                      0x0008
  208. #define SEVERITY_SEVERE                     0x000C
  209. #define SEVERITY_UNRECOVERABLE              0x0010
  210.  
  211. /* Base component error values */
  212.  
  213. #define WINERR_BASE     0x1000  /* Window Manager                  */
  214. #define GPIERR_BASE     0x2000  /* Graphics Presentation Interface */
  215. #define DEVERR_BASE     0x3000  /* Device Manager                  */
  216. #define SPLERR_BASE     0x4000  /* Spooler                         */
  217.  
  218. /*** Common types used across components */
  219.  
  220. /*** Common DOS types */
  221.  
  222. typedef LHANDLE HMODULE;        /* hmod */
  223. typedef LHANDLE PID;            /* pid  */
  224. typedef LHANDLE TID;            /* tid  */
  225.  
  226. #ifndef INCL_SAADEFS
  227.    typedef USHORT  SGID;        /* sgid */
  228. #endif  /* !INCL_SAADEFS */
  229.  
  230. typedef HMODULE *PHMODULE;
  231. typedef PID *PPID;
  232. typedef TID *PTID;
  233.  
  234. #ifndef INCL_SAADEFS
  235.    #ifndef __HSEM__
  236.        #define __HSEM__
  237.        typedef VOID *HSEM;      /* hsem */
  238.        typedef HSEM *PHSEM;
  239.    #endif
  240. #endif  /* !INCL_SAADEFS */
  241.  
  242. /*** Common SUP types */
  243.  
  244. typedef LHANDLE   HAB;         /* hab  */
  245. typedef HAB *PHAB;
  246.  
  247. /*** Common GPI/DEV types */
  248.  
  249. typedef LHANDLE   HPS;         /* hps  */
  250. typedef HPS *PHPS;
  251.  
  252. typedef LHANDLE   HDC;         /* hdc  */
  253. typedef HDC *PHDC;
  254.  
  255. typedef LHANDLE   HRGN;        /* hrgn */
  256. typedef HRGN *PHRGN;
  257.  
  258. typedef LHANDLE   HBITMAP;     /* hbm  */
  259. typedef HBITMAP *PHBITMAP;
  260.  
  261. typedef LHANDLE   HMF;         /* hmf  */
  262. typedef HMF *PHMF;
  263.  
  264. typedef LHANDLE   HPAL;        /* hpal */
  265. typedef HPAL *PHPAL;
  266.  
  267. typedef LONG     COLOR;        /* clr  */
  268. typedef COLOR *PCOLOR;
  269.  
  270. typedef struct _POINTL         /* ptl  */
  271. {
  272.    LONG  x;
  273.    LONG  y;
  274. } POINTL;
  275. typedef POINTL *PPOINTL;
  276. typedef POINTL *NPPOINTL;
  277.  
  278. typedef struct _POINTS         /* pts */
  279. {
  280.    SHORT x;
  281.    SHORT y;
  282. } POINTS;
  283. typedef POINTS *PPOINTS;
  284.  
  285. typedef struct _RECTL          /* rcl */
  286. {
  287.    LONG  xLeft;
  288.    LONG  yBottom;
  289.    LONG  xRight;
  290.    LONG  yTop;
  291. } RECTL;
  292. typedef RECTL *PRECTL;
  293. typedef RECTL *NPRECTL;
  294.  
  295. typedef CHAR STR8[8];          /* str8 */
  296. typedef STR8 *PSTR8;
  297.  
  298. /*** common DEV/SPL types */
  299.  
  300. /* structure for Device Driver data */
  301.  
  302. typedef struct _DRIVDATA       /* driv */
  303. {
  304.    LONG    cb;
  305.    LONG    lVersion;
  306.    CHAR    szDeviceName[32];
  307.    CHAR    abGeneralData[1];
  308. } DRIVDATA;
  309. typedef DRIVDATA *PDRIVDATA;
  310.  
  311. /* pointer data for DevOpenDC */
  312.  
  313. typedef PSZ *PDEVOPENDATA;
  314.  
  315. /* array indices for array parameter for DevOpenDC, SplQmOpen or SplQpOpen */
  316.  
  317. #define ADDRESS          0
  318. #ifndef INCL_SAADEFS
  319.    #define DRIVER_NAME      1
  320.    #define DRIVER_DATA      2
  321.    #define DATA_TYPE        3
  322.    #define COMMENT          4
  323.    #define PROC_NAME        5
  324.    #define PROC_PARAMS      6
  325.    #define SPL_PARAMS       7
  326.    #define NETWORK_PARAMS   8
  327.  
  328.    /* structure definition as an alternative of the array parameter */
  329.  
  330.    typedef struct _DEVOPENSTRUC      /* dop */
  331.    {
  332.       PSZ        pszLogAddress;
  333.       PSZ        pszDriverName;
  334.       PDRIVDATA  pdriv;
  335.       PSZ        pszDataType;
  336.       PSZ        pszComment;
  337.       PSZ        pszQueueProcName;
  338.       PSZ        pszQueueProcParams;
  339.       PSZ        pszSpoolerParams;
  340.       PSZ        pszNetworkParams;
  341.    } DEVOPENSTRUC;
  342.    typedef DEVOPENSTRUC *PDEVOPENSTRUC;
  343. #endif  /* !INCL_SAADEFS */
  344.  
  345. /* common PMWP object and PMSTDDLG drag data */
  346.  
  347. typedef struct _PRINTDEST     /* prntdst */
  348. {
  349.    ULONG        cb;
  350.    LONG         lType;
  351.    PSZ          pszToken;
  352.    LONG         lCount;
  353.    PDEVOPENDATA pdopData;
  354.    ULONG        fl;
  355.    PSZ          pszPrinter;
  356. } PRINTDEST;
  357. typedef PRINTDEST *PPRINTDEST;
  358.  
  359. #define PD_JOB_PROPERTY   0x0001      /* Flags for .fl field           */
  360.  
  361. /*** common AVIO/GPI types */
  362.  
  363. /* values of fsSelection field of FATTRS structure */
  364. #define FATTR_SEL_ITALIC        0x0001
  365. #define FATTR_SEL_UNDERSCORE    0x0002
  366. #define FATTR_SEL_OUTLINE       0x0008
  367. #define FATTR_SEL_STRIKEOUT     0x0010
  368. #define FATTR_SEL_BOLD          0x0020
  369.  
  370. /* values of fsType field of FATTRS structure */
  371. #define FATTR_TYPE_KERNING      0x0004
  372. #define FATTR_TYPE_MBCS         0x0008
  373. #define FATTR_TYPE_DBCS         0x0010
  374. #define FATTR_TYPE_ANTIALIASED  0x0020
  375.  
  376. /* values of fsFontUse field of FATTRS structure */
  377. #define FATTR_FONTUSE_NOMIX         0x0002
  378. #define FATTR_FONTUSE_OUTLINE       0x0004
  379. #define FATTR_FONTUSE_TRANSFORMABLE 0x0008
  380. /* size for fields in the font structures */
  381.  
  382. #define FACESIZE 32
  383.  
  384. /* font struct for Vio/GpiCreateLogFont */
  385.  
  386. typedef struct _FATTRS            /* fat */
  387. {
  388.    USHORT  usRecordLength;
  389.    USHORT  fsSelection;
  390.    LONG    lMatch;
  391.    CHAR    szFacename[FACESIZE];
  392.    USHORT  idRegistry;
  393.    USHORT  usCodePage;
  394.    LONG    lMaxBaselineExt;
  395.    LONG    lAveCharWidth;
  396.    USHORT  fsType;
  397.    USHORT  fsFontUse;
  398. } FATTRS;
  399. typedef FATTRS *PFATTRS;
  400.  
  401. /* values of fsType field of FONTMETRICS structure */
  402. #define FM_TYPE_FIXED           0x0001
  403. #define FM_TYPE_LICENSED        0x0002
  404. #define FM_TYPE_KERNING         0x0004
  405. #define FM_TYPE_DBCS            0x0010
  406. #define FM_TYPE_MBCS            0x0018
  407. #define FM_TYPE_64K             0x8000
  408. #define FM_TYPE_ATOMS           0x4000
  409. #define FM_TYPE_FAMTRUNC        0x2000
  410. #define FM_TYPE_FACETRUNC       0x1000
  411.  
  412. /* values of fsDefn field of FONTMETRICS structure */
  413. #define FM_DEFN_OUTLINE         0x0001
  414. #define FM_DEFN_IFI             0x0002
  415. #define FM_DEFN_WIN             0x0004
  416. #define FM_DEFN_GENERIC         0x8000
  417.  
  418. /* values of fsSelection field of FONTMETRICS structure */
  419. #define FM_SEL_ITALIC           0x0001
  420. #define FM_SEL_UNDERSCORE       0x0002
  421. #define FM_SEL_NEGATIVE         0x0004
  422. #define FM_SEL_OUTLINE          0x0008          /* Hollow Outline Font */
  423. #define FM_SEL_STRIKEOUT        0x0010
  424. #define FM_SEL_BOLD             0x0020
  425.  
  426. /* values of fsCapabilities field of FONTMETRICS structure */
  427. #define FM_CAP_NOMIX            0x0001
  428.  
  429. /* font metrics returned by GpiQueryFonts and others */
  430.  
  431. typedef struct _PANOSE   /* panose */
  432. {
  433.    BYTE    bFamilyType;
  434.    BYTE    bSerifStyle;
  435.    BYTE    bWeight;
  436.    BYTE    bProportion;
  437.    BYTE    bContrast;
  438.    BYTE    bStrokeVariation;
  439.    BYTE    bArmStyle;
  440.    BYTE    bLetterform;
  441.    BYTE    bMidline;
  442.    BYTE    bXHeight;
  443.    BYTE    abReserved[2];
  444. } PANOSE;
  445.  
  446. typedef struct _FONTMETRICS     /* fm */
  447. {
  448.    CHAR    szFamilyname[FACESIZE];
  449.    CHAR    szFacename[FACESIZE];
  450.    USHORT  idRegistry;
  451.    USHORT  usCodePage;
  452.    LONG    lEmHeight;
  453.    LONG    lXHeight;
  454.    LONG    lMaxAscender;
  455.    LONG    lMaxDescender;
  456.    LONG    lLowerCaseAscent;
  457.    LONG    lLowerCaseDescent;
  458.    LONG    lInternalLeading;
  459.    LONG    lExternalLeading;
  460.    LONG    lAveCharWidth;
  461.    LONG    lMaxCharInc;
  462.    LONG    lEmInc;
  463.    LONG    lMaxBaselineExt;
  464.    SHORT   sCharSlope;
  465.    SHORT   sInlineDir;
  466.    SHORT   sCharRot;
  467.    USHORT  usWeightClass;
  468.    USHORT  usWidthClass;
  469.    SHORT   sXDeviceRes;
  470.    SHORT   sYDeviceRes;
  471.    SHORT   sFirstChar;
  472.    SHORT   sLastChar;
  473.    SHORT   sDefaultChar;
  474.    SHORT   sBreakChar;
  475.    SHORT   sNominalPointSize;
  476.    SHORT   sMinimumPointSize;
  477.    SHORT   sMaximumPointSize;
  478.    USHORT  fsType;
  479.    USHORT  fsDefn;
  480.    USHORT  fsSelection;
  481.    USHORT  fsCapabilities;
  482.    LONG    lSubscriptXSize;
  483.    LONG    lSubscriptYSize;
  484.    LONG    lSubscriptXOffset;
  485.    LONG    lSubscriptYOffset;
  486.    LONG    lSuperscriptXSize;
  487.    LONG    lSuperscriptYSize;
  488.    LONG    lSuperscriptXOffset;
  489.    LONG    lSuperscriptYOffset;
  490.    LONG    lUnderscoreSize;
  491.    LONG    lUnderscorePosition;
  492.    LONG    lStrikeoutSize;
  493.    LONG    lStrikeoutPosition;
  494.    SHORT   sKerningPairs;
  495.    SHORT   sFamilyClass;
  496.    LONG    lMatch;
  497.    LONG    FamilyNameAtom;
  498.    LONG    FaceNameAtom;
  499.    PANOSE  panose;
  500. } FONTMETRICS;
  501. typedef FONTMETRICS *PFONTMETRICS;
  502.  
  503. /*** Common WIN types */
  504.  
  505. typedef LHANDLE HWND;      /* hwnd */
  506. typedef HWND *PHWND;
  507.  
  508. typedef LHANDLE HMQ;       /* hmq */
  509. typedef LHANDLE *PHMQ;
  510.  
  511. /* NOINC */
  512. #define WRECT RECTL
  513. #define PWRECT PRECTL
  514. #define NPWRECT NPRECTL
  515.  
  516. #define WPOINT POINTL
  517. #define PWPOINT PPOINTL
  518. #define NPWPOINT NPPOINTL
  519. /* INC */
  520.  
  521. #endif /* __OS2DEF__ */
  522.  
  523. #ifdef __IBMC__
  524. #pragma checkout( suspend )
  525. #ifndef __CHKHDR__
  526.    #pragma checkout( resume )
  527. #endif
  528. #pragma checkout( resume )
  529. #endif
  530. /**************************** end of file **********************************/
  531.