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