home *** CD-ROM | disk | FTP | other *** search
/ The Developer Connection…ice Driver Kit for OS/2 3 / DEV3-D1.ISO / devtools / os2tk21j / c / os2h / os2def.h__ / os2def.h
Encoding:
C/C++ Source or Header  |  1993-03-22  |  15.4 KB  |  570 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.    #ifdef _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 unsigned char BYTE;     /* b   */
  96.  
  97. typedef unsigned char *PSZ;
  98. typedef unsigned char *NPSZ;
  99.  
  100. typedef unsigned char *PCH;
  101. typedef unsigned 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.    /* Warning:the selectorof macro should not be used*/
  165.    /* for 32 bit objects                             */
  166.    #define SELECTOROF(ptr)     ((((ULONG)(ptr))>>13)|7)
  167.    #define OFFSETOF(p)         (((PUSHORT)&(p))[0])
  168. #endif  /* !INCL_SAADEFS */
  169.  
  170. /* Cast any variable to an instance of the specified type. */
  171. #define MAKETYPE(v, type)   (*((type *)&v))
  172.  
  173. /* Calculate the byte offset of a field in a structure of type type. */
  174. #define FIELDOFFSET(type, field)    ((SHORT)&(((type *)0)->field))
  175.  
  176. /* Combine l & h to form a 32 bit quantity. */
  177. #define MAKEULONG(l, h)  ((ULONG)(((USHORT)(l)) | ((ULONG)((USHORT)(h))) << 16))
  178. #define MAKELONG(l, h)   ((LONG)MAKEULONG(l, h))
  179.  
  180. /* Combine l & h to form a 16 bit quantity. */
  181. #define MAKEUSHORT(l, h) (((USHORT)(l)) | ((USHORT)(h)) << 8)
  182. #define MAKESHORT(l, h)  ((SHORT)MAKEUSHORT(l, h))
  183.  
  184. /* Extract high and low order parts of 16 and 32 bit quantity */
  185. #define LOBYTE(w)       LOUCHAR(w)
  186. #define HIBYTE(w)       HIUCHAR(w)
  187. #define LOUCHAR(w)      ((UCHAR)(w))
  188. #define HIUCHAR(w)      ((UCHAR)(((USHORT)(w) >> 8) & 0xff))
  189. #define LOUSHORT(l)     ((USHORT)((ULONG)l))
  190. #define HIUSHORT(l)     ((USHORT)(((ULONG)(l) >> 16) & 0xffff))
  191.  
  192. /*** Common Error definitions ****/
  193.  
  194. typedef ULONG ERRORID;  /* errid */
  195. typedef ERRORID *PERRORID;
  196.  
  197. /* Combine severity and error code to produce ERRORID */
  198. #define MAKEERRORID(sev, error) (ERRORID)(MAKEULONG((error), (sev)))
  199.  
  200. /* Extract error number from an errorid */
  201. #define ERRORIDERROR(errid)            (LOUSHORT(errid))
  202.  
  203. /* Extract severity from an errorid */
  204. #define ERRORIDSEV(errid)              (HIUSHORT(errid))
  205.  
  206. /* Severity codes */
  207. #define SEVERITY_NOERROR                    0x0000
  208. #define SEVERITY_WARNING                    0x0004
  209. #define SEVERITY_ERROR                      0x0008
  210. #define SEVERITY_SEVERE                     0x000C
  211. #define SEVERITY_UNRECOVERABLE              0x0010
  212.  
  213. /* Base component error values */
  214.  
  215. #define WINERR_BASE     0x1000  /* Window Manager                  */
  216. #define GPIERR_BASE     0x2000  /* Graphics Presentation Interface */
  217. #define DEVERR_BASE     0x3000  /* Device Manager                  */
  218. #define SPLERR_BASE     0x4000  /* Spooler                         */
  219.  
  220. /*** Common types used across components */
  221.  
  222. /*** Common DOS types */
  223.  
  224. typedef LHANDLE HMODULE;        /* hmod */
  225. typedef LHANDLE PID;            /* pid  */
  226. typedef LHANDLE TID;            /* tid  */
  227.  
  228. #ifndef INCL_SAADEFS
  229.    typedef USHORT  SGID;        /* sgid */
  230. #endif  /* !INCL_SAADEFS */
  231.  
  232. typedef HMODULE *PHMODULE;
  233. typedef PID *PPID;
  234. typedef TID *PTID;
  235.  
  236. #ifndef INCL_SAADEFS
  237.    #ifndef __HSEM__
  238.        #define __HSEM__
  239.        typedef VOID *HSEM;      /* hsem */
  240.        typedef HSEM *PHSEM;
  241.    #endif
  242. #endif  /* !INCL_SAADEFS */
  243.  
  244. /*** Common SUP types */
  245.  
  246. typedef LHANDLE   HAB;         /* hab  */
  247. typedef HAB *PHAB;
  248.  
  249. /*** Common GPI/DEV types */
  250.  
  251. typedef LHANDLE   HPS;         /* hps  */
  252. typedef HPS *PHPS;
  253.  
  254. typedef LHANDLE   HDC;         /* hdc  */
  255. typedef HDC *PHDC;
  256.  
  257. typedef LHANDLE   HRGN;        /* hrgn */
  258. typedef HRGN *PHRGN;
  259.  
  260. typedef LHANDLE   HBITMAP;     /* hbm  */
  261. typedef HBITMAP *PHBITMAP;
  262.  
  263. typedef LHANDLE   HMF;         /* hmf  */
  264. typedef HMF *PHMF;
  265.  
  266. typedef LHANDLE   HPAL;        /* hpal */
  267. typedef HPAL *PHPAL;
  268.  
  269. typedef LONG     COLOR;        /* clr  */
  270. typedef COLOR *PCOLOR;
  271.  
  272. typedef struct _POINTL         /* ptl  */
  273. {
  274.    LONG  x;
  275.    LONG  y;
  276. } POINTL;
  277. typedef POINTL *PPOINTL;
  278. typedef POINTL *NPPOINTL;
  279.  
  280. typedef struct _POINTS         /* pts */
  281. {
  282.    SHORT x;
  283.    SHORT y;
  284. } POINTS;
  285. typedef POINTS *PPOINTS;
  286.  
  287. typedef struct _RECTL          /* rcl */
  288. {
  289.    LONG  xLeft;
  290.    LONG  yBottom;
  291.    LONG  xRight;
  292.    LONG  yTop;
  293. } RECTL;
  294. typedef RECTL *PRECTL;
  295. typedef RECTL *NPRECTL;
  296.  
  297. typedef CHAR STR8[8];          /* str8 */
  298. typedef STR8 *PSTR8;
  299.  
  300. /*** common DEV/SPL types */
  301.  
  302. /* structure for Device Driver data */
  303.  
  304. typedef struct _DRIVDATA       /* driv */
  305. {
  306.    LONG    cb;
  307.    LONG    lVersion;
  308.    CHAR    szDeviceName[32];
  309.    CHAR    abGeneralData[1];
  310. } DRIVDATA;
  311. typedef DRIVDATA *PDRIVDATA;
  312.  
  313. /* pointer data for DevOpenDC */
  314.  
  315. typedef PSZ *PDEVOPENDATA;
  316.  
  317. /* array indices for array parameter for DevOpenDC, SplQmOpen or SplQpOpen */
  318.  
  319. #define ADDRESS          0
  320. #ifndef INCL_SAADEFS
  321.    #define DRIVER_NAME      1
  322.    #define DRIVER_DATA      2
  323.    #define DATA_TYPE        3
  324.    #define COMMENT          4
  325.    #define PROC_NAME        5
  326.    #define PROC_PARAMS      6
  327.    #define SPL_PARAMS       7
  328.    #define NETWORK_PARAMS   8
  329.  
  330.    /* structure definition as an alternative of the array parameter */
  331.  
  332.    typedef struct _DEVOPENSTRUC      /* dop */
  333.    {
  334.       PSZ        pszLogAddress;
  335.       PSZ        pszDriverName;
  336.       PDRIVDATA  pdriv;
  337.       PSZ        pszDataType;
  338.       PSZ        pszComment;
  339.       PSZ        pszQueueProcName;
  340.       PSZ        pszQueueProcParams;
  341.       PSZ        pszSpoolerParams;
  342.       PSZ        pszNetworkParams;
  343.    } DEVOPENSTRUC;
  344.    typedef DEVOPENSTRUC *PDEVOPENSTRUC;
  345. #endif  /* !INCL_SAADEFS */
  346.  
  347. /* common PMWP object and PMSTDDLG drag data */
  348.  
  349. typedef struct _PRINTDEST     /* prntdst */
  350. {
  351.    ULONG        cb;
  352.    LONG         lType;
  353.    PSZ          pszToken;
  354.    LONG         lCount;
  355.    PDEVOPENDATA pdopData;
  356.    ULONG        fl;
  357.    PSZ          pszPrinter;
  358. } PRINTDEST;
  359. typedef PRINTDEST *PPRINTDEST;
  360.  
  361. #define PD_JOB_PROPERTY   0x0001      /* Flags for .fl field           */
  362.  
  363. /*** common AVIO/GPI types */
  364.  
  365. /* values of fsSelection field of FATTRS structure */
  366. #define FATTR_SEL_ITALIC        0x0001
  367. #define FATTR_SEL_UNDERSCORE    0x0002
  368. #define FATTR_SEL_OUTLINE       0x0008
  369. #define FATTR_SEL_STRIKEOUT     0x0010
  370. #define FATTR_SEL_BOLD          0x0020
  371.  
  372. /* values of fsType field of FATTRS structure */
  373. #define FATTR_TYPE_KERNING      0x0004
  374. #define FATTR_TYPE_MBCS         0x0008
  375. #define FATTR_TYPE_DBCS         0x0010
  376. #define FATTR_TYPE_ANTIALIASED  0x0020
  377.  
  378. /* values of fsFontUse field of FATTRS structure */
  379. #define FATTR_FONTUSE_NOMIX         0x0002
  380. #define FATTR_FONTUSE_OUTLINE       0x0004
  381. #define FATTR_FONTUSE_TRANSFORMABLE 0x0008
  382. /* size for fields in the font structures */
  383.  
  384. #define FACESIZE 32
  385.  
  386. /* font struct for Vio/GpiCreateLogFont */
  387.  
  388. typedef struct _FATTRS            /* fat */
  389. {
  390.    USHORT  usRecordLength;
  391.    USHORT  fsSelection;
  392.    LONG    lMatch;
  393.    CHAR    szFacename[FACESIZE];
  394.    USHORT  idRegistry;
  395.    USHORT  usCodePage;
  396.    LONG    lMaxBaselineExt;
  397.    LONG    lAveCharWidth;
  398.    USHORT  fsType;
  399.    USHORT  fsFontUse;
  400. } FATTRS;
  401. typedef FATTRS *PFATTRS;
  402.  
  403. /* values of fsType field of FONTMETRICS structure */
  404. #define FM_TYPE_FIXED           0x0001
  405. #define FM_TYPE_LICENSED        0x0002
  406. #define FM_TYPE_KERNING         0x0004
  407. #define FM_TYPE_DBCS            0x0010
  408. #define FM_TYPE_MBCS            0x0018
  409. #define FM_TYPE_64K             0x8000
  410. #define FM_TYPE_ATOMS           0x4000
  411. #define FM_TYPE_FAMTRUNC        0x2000
  412. #define FM_TYPE_FACETRUNC       0x1000
  413.  
  414. /* values of fsDefn field of FONTMETRICS structure */
  415. #define FM_DEFN_OUTLINE         0x0001
  416. #define FM_DEFN_IFI             0x0002
  417. #define FM_DEFN_WIN             0x0004
  418. #define FM_DEFN_GENERIC         0x8000
  419.  
  420. /* values of fsSelection field of FONTMETRICS structure */
  421. #define FM_SEL_ITALIC           0x0001
  422. #define FM_SEL_UNDERSCORE       0x0002
  423. #define FM_SEL_NEGATIVE         0x0004
  424. #define FM_SEL_OUTLINE          0x0008          /* Hollow Outline Font */
  425. #define FM_SEL_STRIKEOUT        0x0010
  426. #define FM_SEL_BOLD             0x0020
  427. #define FM_SEL_ISO9241_TESTED   0x0040
  428.  
  429. /* ISO 9241 is an international standard covering health and safety      */
  430. /* in the work place for users of visual display terminals. Part 3 of    */
  431. /* this standard covers clarity and legibility of text displayed on      */
  432. /* computer screens, it places requirements on minimum sizes and         */
  433. /* luminance contrast. The presence of FM_SEL_ISO9241_TESTED flag in the */
  434. /* font metrics indicates that the font has been tested for compliance   */
  435. /* to the standard. The FM_ISO_XXX flags indicate the results of the     */
  436. /* test on the IBM 9515, 9517 and 9518 color displays at the supported   */
  437. /* dimensions of 640x480 and 1024x768. To ensure compliance the          */
  438. /* sXDeviceRes and sYDeviceRes must also match the target display        */
  439. /* resolution.                                                           */
  440.  
  441. /* values of fbPassed/FailedISO field in the PANOSE structure */
  442. #define FM_ISO_9518_640        0x01
  443. #define FM_ISO_9515_640        0x02
  444. #define FM_ISO_9515_1024       0x04
  445. #define FM_ISO_9517_640        0x08
  446. #define FM_ISO_9517_1024       0x10
  447.  
  448. /* values of fsCapabilities field of FONTMETRICS structure */
  449. #define FM_CAP_NOMIX            0x0001
  450.  
  451. /* font metrics returned by GpiQueryFonts and others */
  452.  
  453. typedef struct _PANOSE   /* panose */
  454. {
  455.    BYTE    bFamilyType;
  456.    BYTE    bSerifStyle;
  457.    BYTE    bWeight;
  458.    BYTE    bProportion;
  459.    BYTE    bContrast;
  460.    BYTE    bStrokeVariation;
  461.    BYTE    bArmStyle;
  462.    BYTE    bLetterform;
  463.    BYTE    bMidline;
  464.    BYTE    bXHeight;
  465.    BYTE    fbPassedISO;
  466.    BYTE    fbFailedISO;
  467. } PANOSE;
  468.  
  469. typedef struct _FONTMETRICS     /* fm */
  470. {
  471.    CHAR    szFamilyname[FACESIZE];
  472.    CHAR    szFacename[FACESIZE];
  473.    USHORT  idRegistry;
  474.    USHORT  usCodePage;
  475.    LONG    lEmHeight;
  476.    LONG    lXHeight;
  477.    LONG    lMaxAscender;
  478.    LONG    lMaxDescender;
  479.    LONG    lLowerCaseAscent;
  480.    LONG    lLowerCaseDescent;
  481.    LONG    lInternalLeading;
  482.    LONG    lExternalLeading;
  483.    LONG    lAveCharWidth;
  484.    LONG    lMaxCharInc;
  485.    LONG    lEmInc;
  486.    LONG    lMaxBaselineExt;
  487.    SHORT   sCharSlope;
  488.    SHORT   sInlineDir;
  489.    SHORT   sCharRot;
  490.    USHORT  usWeightClass;
  491.    USHORT  usWidthClass;
  492.    SHORT   sXDeviceRes;
  493.    SHORT   sYDeviceRes;
  494.    SHORT   sFirstChar;
  495.    SHORT   sLastChar;
  496.    SHORT   sDefaultChar;
  497.    SHORT   sBreakChar;
  498.    SHORT   sNominalPointSize;
  499.    SHORT   sMinimumPointSize;
  500.    SHORT   sMaximumPointSize;
  501.    USHORT  fsType;
  502.    USHORT  fsDefn;
  503.    USHORT  fsSelection;
  504.    USHORT  fsCapabilities;
  505.    LONG    lSubscriptXSize;
  506.    LONG    lSubscriptYSize;
  507.    LONG    lSubscriptXOffset;
  508.    LONG    lSubscriptYOffset;
  509.    LONG    lSuperscriptXSize;
  510.    LONG    lSuperscriptYSize;
  511.    LONG    lSuperscriptXOffset;
  512.    LONG    lSuperscriptYOffset;
  513.    LONG    lUnderscoreSize;
  514.    LONG    lUnderscorePosition;
  515.    LONG    lStrikeoutSize;
  516.    LONG    lStrikeoutPosition;
  517.    SHORT   sKerningPairs;
  518.    SHORT   sFamilyClass;
  519.    LONG    lMatch;
  520.    LONG    FamilyNameAtom;
  521.    LONG    FaceNameAtom;
  522.    PANOSE  panose;
  523. } FONTMETRICS;
  524. typedef FONTMETRICS *PFONTMETRICS;
  525.  
  526. /*** Common WIN types */
  527.  
  528. typedef LHANDLE HWND;      /* hwnd */
  529. typedef HWND *PHWND;
  530.  
  531. typedef LHANDLE HMQ;       /* hmq */
  532. typedef LHANDLE *PHMQ;
  533.  
  534. /* NOINC */
  535. #define WRECT RECTL
  536. #define PWRECT PRECTL
  537. #define NPWRECT NPRECTL
  538.  
  539. #define WPOINT POINTL
  540. #define PWPOINT PPOINTL
  541. #define NPWPOINT NPPOINTL
  542. /* INC */
  543.  
  544. typedef struct _ICONINFO {  /* icninf */
  545.    ULONG   cb;                  /* size of ICONINFO structure */
  546.    ULONG   fFormat;
  547.    PSZ     pszFileName;         /* use when fFormat = ICON_FILE */
  548.    HMODULE hmod;                /* use when fFormat = ICON_RESOURCE */
  549.    ULONG   resid;               /* use when fFormat = ICON_RESOURCE */
  550.    ULONG   cbIconData;          /* use when fFormat = ICON_DATA     */
  551.    PVOID   pIconData;           /* use when fFormat = ICON_DATA     */
  552. } ICONINFO;
  553. typedef ICONINFO FAR *PICONINFO;
  554.  
  555. #define ICON_FILE     1         /* flags for fFormat */
  556. #define ICON_RESOURCE 2
  557. #define ICON_DATA     3
  558. #define ICON_CLEAR    4
  559.  
  560. #endif /* __OS2DEF__ */
  561.  
  562. #ifdef __IBMC__
  563. #pragma checkout( suspend )
  564. #ifndef __CHKHDR__
  565.    #pragma checkout( resume )
  566. #endif
  567. #pragma checkout( resume )
  568. #endif
  569. /**************************** end of file **********************************/
  570.