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