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