home *** CD-ROM | disk | FTP | other *** search
/ Power-Programmierung / CD1.mdf / magazine / msysjour / vol04 / 01b / macsl / os2def.h < prev    next >
C/C++ Source or Header  |  1988-09-21  |  11KB  |  403 lines

  1. /***************************************************************************\
  2. *
  3. * Module Name: OS2DEF.H
  4. *
  5. * OS/2 Common Definitions file - Macintosh version
  6. *
  7. * Copyright (c) 1987  IBM Corporation
  8. * Copyright (c) 1987  Microsoft Corporation
  9. *
  10. \***************************************************************************/
  11.  
  12. #define PASCAL
  13. #define FAR
  14. #define NEAR
  15. #define VOID    void
  16.  
  17. #define far
  18. #define near
  19.  
  20. typedef unsigned short SHANDLE;
  21. typedef void far      *LHANDLE;
  22.  
  23. #define EXPENTRY PASCAL FAR
  24. #define APIENTRY PASCAL FAR
  25.  
  26. #define CHAR    char            /* ch  */
  27. #define SHORT   short           /* s   */
  28. #define LONG    long            /* l   */
  29. #define INT     int             /* i   */
  30.  
  31. #ifndef NULL
  32. #ifdef M_I86L
  33. #define NULL    0L
  34. #else
  35. #define NULL    0
  36. #endif
  37. #endif
  38.  
  39. typedef unsigned char UCHAR;    /* uch */
  40. typedef unsigned short USHORT;  /* us  */
  41. typedef unsigned long ULONG;    /* ul  */
  42. typedef unsigned int  UINT;     /* ui  */
  43.  
  44. typedef unsigned char BYTE;     /* b   */
  45.  
  46. typedef char far  *PSZ;
  47. typedef char near *NPSZ;
  48.  
  49. typedef char far  *PCH;
  50. typedef char near *NPCH;
  51.  
  52. typedef int   (PASCAL far  *PFN)();
  53. typedef int   (PASCAL near *NPFN)();
  54. typedef PFN far *PPFN;
  55.  
  56. typedef BYTE   FAR  *PBYTE;
  57. typedef BYTE   near *NPBYTE;
  58.  
  59. typedef CHAR   FAR *PCHAR;
  60. typedef SHORT  FAR *PSHORT;
  61. typedef LONG   FAR *PLONG;
  62. typedef INT    FAR *PINT;
  63.  
  64. typedef UCHAR  FAR *PUCHAR;
  65. typedef USHORT FAR *PUSHORT;
  66. typedef ULONG  FAR *PULONG;
  67. typedef UINT   FAR *PUINT;
  68.  
  69. typedef VOID   FAR *PVOID;
  70.  
  71. typedef unsigned short BOOL;    /* f   */
  72. typedef BOOL FAR *PBOOL;
  73.  
  74. #define FALSE   0
  75. #define TRUE    1
  76.  
  77. #ifndef INCL_SAADEFS
  78. typedef unsigned short SEL;     /* sel */
  79. typedef SEL FAR *PSEL;
  80.  
  81. /*** Useful Helper Macros */
  82.  
  83. /* Create untyped far pointer from selector and offset */
  84. #define MAKEP(sel, off)     ((PVOID)MAKEULONG(off, sel))
  85.  
  86. /* Extract selector or offset from far pointer */
  87. #define SELECTOROF(p)       (((PUSHORT)&(p))[1])
  88. #define OFFSETOF(p)         (((PUSHORT)&(p))[0])
  89. #endif  /* !INCL_SAADEFS */
  90.  
  91. /* Cast any variable to an instance of the specified type. */
  92. #define MAKETYPE(v, type)   (*((type far *)&v))
  93.  
  94. /* Calculate the byte offset of a field in a structure of type type. */
  95. #define FIELDOFFSET(type, field)    ((SHORT)&(((type *)0)->field))
  96.  
  97. /* Combine l & h to form a 32 bit quantity. */
  98. #define MAKEULONG(l, h)  ((ULONG)(((USHORT)(l)) | ((ULONG)((USHORT)(h))) << 16))
  99. #define MAKELONG(l, h)   ((LONG)MAKEULONG(l, h))
  100.  
  101. /* Combine l & h to form a 16 bit quantity. */
  102. #define MAKEUSHORT(l, h) (((USHORT)(l)) | ((USHORT)(h)) << 8)
  103. #define MAKESHORT(l, h)  ((SHORT)MAKEUSHORT(l, h))
  104.  
  105. /* Extract high and low order parts of 16 and 32 bit quantity */
  106. #define LOBYTE(w)       LOUCHAR(w)
  107. #define HIBYTE(w)       HIUCHAR(w)
  108. #define LOUCHAR(w)      ((UCHAR)(w))
  109. #define HIUCHAR(w)      ((UCHAR)(((USHORT)(w) >> 8) & 0xff))
  110. #define LOUSHORT(l)     ((USHORT)(l))
  111. #define HIUSHORT(l)     ((USHORT)(((ULONG)(l) >> 16) & 0xffff))
  112.  
  113. /*** Common Error definitions ****/
  114.  
  115. typedef ULONG ERRORID;  /* errid */
  116. typedef ERRORID FAR *PERRORID;
  117.  
  118. /* Combine severity and error code to produce ERRORID */
  119. #define MAKEERRORID(sev, error) (ERRORID)(MAKEULONG((error), (sev)))
  120.  
  121. /* Severity codes */
  122. #define SEVERITY_NOERROR                    0x0000
  123. #define SEVERITY_WARNING                    0x0004
  124. #define SEVERITY_ERROR                      0x0008
  125. #define SEVERITY_SEVERE                     0x000C
  126. #define SEVERITY_UNRECOVERABLE              0x0010
  127.  
  128. /* Base component error values */
  129.  
  130. #define WINERR_BASE     0x1000  /* Window Manager                  */
  131. #define GPIERR_BASE     0x2000  /* Graphics Presentation Interface */
  132. #define DEVERR_BASE     0x3000  /* Device Manager                  */
  133. #define SPLERR_BASE     0x4000  /* Spooler                         */
  134.  
  135. /*** Common types used across components */
  136.  
  137. /*** Common DOS types */
  138.  
  139. typedef USHORT    HMODULE;  /* hmod */
  140. typedef HMODULE FAR *PHMODULE;
  141.  
  142. #ifndef INCL_SAADEFS
  143. typedef USHORT    PID;      /* pid  */
  144. typedef PID FAR *PPID;
  145.  
  146. typedef USHORT    TID;      /* tid  */
  147. typedef TID FAR *PTID;
  148.  
  149. typedef VOID FAR *HSEM;     /* hsem */
  150. typedef HSEM FAR *PHSEM;
  151. #endif  /* !INCL_SAADEFS */
  152.  
  153. /*** Common SUP types */
  154.  
  155. typedef LHANDLE   HAB;      /* hab  */
  156. typedef HAB FAR *PHAB;
  157.  
  158. /*** Common GPI/DEV types */
  159.  
  160. typedef LHANDLE   HPS;      /* hps  */
  161. typedef HPS FAR *PHPS;
  162.  
  163. typedef LHANDLE   HDC;      /* hdc  */
  164. typedef HDC FAR *PHDC;
  165.  
  166. typedef LHANDLE   HRGN;     /* hrgn */
  167. typedef HRGN FAR *PHRGN;
  168.  
  169. #ifndef INCL_SAADEFS
  170. typedef LHANDLE   HBITMAP;  /* hbm  */
  171. typedef HBITMAP FAR *PHBITMAP;
  172. #endif  /* !INCL_SAADEFS */
  173.  
  174. typedef LHANDLE   HMF;      /* hmf  */
  175. typedef HMF FAR *PHMF;
  176.  
  177. typedef LONG     COLOR;    /* clr  */
  178. typedef COLOR FAR *PCOLOR;
  179.  
  180. typedef struct _POINTL  {    /* ptl  */
  181.     LONG  x;
  182.     LONG  y;
  183. } POINTL;
  184. typedef POINTL  FAR  *PPOINTL;
  185. typedef POINTL  near *NPPOINTL;
  186.  
  187. typedef struct _RECTL {      /* rcl */
  188.     LONG  xLeft;
  189.     LONG  yBottom;
  190.     LONG  xRight;
  191.     LONG  yTop;
  192. } RECTL;
  193. typedef RECTL FAR  *PRECTL;
  194. typedef RECTL near *NPRECTL;
  195.  
  196. typedef CHAR STR8[8];      /* str8 */
  197. typedef STR8 FAR *PSTR8;
  198.  
  199. #ifndef INCL_SAADEFS
  200. /* common DOS/SHL types */
  201.  
  202. /* File time and date types */
  203.  
  204. typedef struct _FTIME {         /* ftime */
  205.     unsigned twosecs : 5;
  206.     unsigned minutes : 6;
  207.     unsigned hours   : 5;
  208. } FTIME;
  209. typedef FTIME FAR *PFTIME;
  210.  
  211. typedef struct _FDATE {         /* fdate */
  212.     unsigned day     : 5;
  213.     unsigned month   : 4;
  214.     unsigned year    : 7;
  215. } FDATE;
  216. typedef FDATE FAR *PFDATE;
  217.  
  218. typedef struct _FILEFINDBUF {   /* findbuf */
  219.     FDATE  fdateCreation;
  220.     FTIME  ftimeCreation;
  221.     FDATE  fdateLastAccess;
  222.     FTIME  ftimeLastAccess;
  223.     FDATE  fdateLastWrite;
  224.     FTIME  ftimeLastWrite;
  225.     ULONG  cbFile;
  226.     ULONG  cbFileAlloc;
  227.     USHORT attrFile;
  228.     UCHAR  cchName;
  229.     CHAR   achName[13];
  230. } FILEFINDBUF;
  231. typedef FILEFINDBUF FAR *PFILEFINDBUF;
  232. #endif  /* !INCL_SAADEFS */
  233.  
  234. /*** common DEV/SPL types */
  235.  
  236. /* structure for Device Driver data */
  237.  
  238. typedef struct _DRIVDATA {      /* driv */
  239.     LONG    cb;
  240.     LONG    lVersion;
  241.     CHAR    szDeviceName[32];
  242.     CHAR    abGeneralData[1];
  243. } DRIVDATA;
  244. typedef DRIVDATA far *PDRIVDATA;
  245.  
  246. /* array indices for array parameter for DevOpenDC, SplQmOpen or SplQpOpen */
  247.  
  248. #define ADDRESS          0
  249. #ifndef INCL_SAADEFS
  250. #define DRIVER_NAME      1
  251. #define DRIVER_DATA      2
  252. #define DATA_TYPE        3
  253. #define COMMENT          4
  254. #define PROC_NAME        5
  255. #define PROC_PARAMS      6
  256. #define SPL_PARAMS       7
  257. #define NETWORK_PARAMS   8
  258.  
  259. /* structure definition as an alternative of the array parameter */
  260.  
  261. typedef struct _DEVOPENSTRUC {    /* dop */
  262.     PSZ        pszLogAddress;
  263.     PSZ        pszDriverName;
  264.     PDRIVDATA  pdriv;
  265.     PSZ        pszDataType;
  266.     PSZ        pszComment;
  267.     PSZ        pszQueueProcName;
  268.     PSZ        pszQueueProcParams;
  269.     PSZ        pszSpoolerParams;
  270.     PSZ        pszNetworkParams;
  271. } DEVOPENSTRUC;
  272. typedef DEVOPENSTRUC FAR *PDEVOPENSTRUC;
  273. #endif  /* !INCL_SAADEFS */
  274.  
  275. /*** common AVIO/GPI types */
  276.  
  277. /* values of fsSelection field of FATTRS structure */
  278. #define FATTR_SEL_ITALIC        0x0001
  279. #define FATTR_SEL_UNDERSCORE    0x0002
  280. #define FATTR_SEL_STRIKEOUT     0x0010
  281. #define FATTR_SEL_BOLD          0x0020
  282.  
  283. /* values of fsType field of FATTRS structure */
  284. #define FATTR_TYPE_FIXED        0x0002
  285. #define FATTR_TYPE_KERNING      0x0004
  286.  
  287. /* values of sQuality field of FATTRS structure */
  288. #define FATTR_QUALITY_DEFAULT   0
  289. #define FATTR_QUALITY_DRAFT     1
  290. #define FATTR_QUALITY_PROOF     2
  291.  
  292. /* values of fsFontUse field of FATTRS structure */
  293. #define FATTR_FONTUSE_NOMIX         0x0002
  294. #define FATTR_FONTUSE_OUTLINE       0x0004
  295. #define FATTR_FONTUSE_TRANSFORMABLE 0x0008
  296. /* size for fields in the font structures */
  297.  
  298. #define FACESIZE 32
  299.  
  300. /* font struct for Vio/GpiCreateLogFont */
  301.  
  302. typedef struct _FATTRS {          /* fat */
  303.     USHORT  usRecordLength;
  304.     USHORT  fsSelection;
  305.     LONG    lMatch;
  306.     CHAR    szFaceName[FACESIZE];
  307.     USHORT  idRegistry;
  308.     USHORT  usCodePage;
  309.     LONG    lMaxBaselineExt;
  310.     LONG    lAveCharWidth;
  311.     USHORT  fsType;
  312.     SHORT   sQuality;
  313.     USHORT  fsFontUse;
  314. } FATTRS;
  315. typedef FATTRS far *PFATTRS;
  316.  
  317. /* font metrics returned by GpiQueryFonts and others */
  318.  
  319. typedef struct _FONTMETRICS {   /* fm */
  320.     CHAR    szFamilyname[FACESIZE];
  321.     CHAR    szFacename[FACESIZE];
  322.     SHORT   idRegistry;
  323.     SHORT   usCodePage;
  324.     LONG    lEmHeight;
  325.     LONG    lXHeight;
  326.     LONG    lMaxAscender;
  327.     LONG    lMaxDescender;
  328.     LONG    lLowerCaseAscent;
  329.     LONG    lLowerCaseDescent;
  330.     LONG    lInternalLeading;
  331.     LONG    lExternalLeading;
  332.     LONG    lAveCharWidth;
  333.     LONG    lMaxCharInc;
  334.     LONG    lEmInc;
  335.     LONG    lMaxBaselineExt;
  336.     SHORT   sCharSlope;
  337.     SHORT   sInlineDir;
  338.     SHORT   sCharRot;
  339.     USHORT  usWeightClass;
  340.     USHORT  usWidthClass;
  341.     SHORT   sXDeviceRes;
  342.     SHORT   sYDeviceRes;
  343.     SHORT   sFirstChar;
  344.     SHORT   sLastChar;
  345.     SHORT   sDefaultChar;
  346.     SHORT   sBreakChar;
  347.     SHORT   sNominalPointSize;
  348.     SHORT   sMinimumPointSize;
  349.     SHORT   sMaximumPointSize;
  350.     USHORT  fsType;
  351.     USHORT  fsDefn;
  352.     USHORT  fsSelection;
  353.     USHORT  fsCapabilities;
  354.     LONG    lSubscriptXSize;
  355.     LONG    lSubscriptYSize;
  356.     LONG    lSubscriptXOffset;
  357.     LONG    lSubscriptYOffset;
  358.     LONG    lSuperscriptXSize;
  359.     LONG    lSuperscriptYSize;
  360.     LONG    lSuperscriptXOffset;
  361.     LONG    lSuperscriptYOffset;
  362.     LONG    lUnderscoreSize;
  363.     LONG    lUnderscorePosition;
  364.     LONG    lStrikeoutSize;
  365.     LONG    lStrikeoutPosition;
  366.     SHORT   sKerningPairs;
  367.     SHORT   sReserved;
  368.     LONG    lMatch;
  369. } FONTMETRICS;
  370. typedef FONTMETRICS far *PFONTMETRICS;
  371.  
  372. /*** Common WIN types */
  373.  
  374. #ifdef MACPM_INTERNAL
  375.   typedef struct _MYWND **HWND;
  376. #else
  377.   typedef LHANDLE HWND;      /* hwnd */
  378. #endif
  379.  
  380. typedef HWND FAR *PHWND;
  381.  
  382. typedef struct _WRECT {    /* wrc */
  383.     SHORT xLeft;
  384.     SHORT dummy1;
  385.     SHORT yBottom;
  386.     SHORT dummy2;
  387.     SHORT xRight;
  388.     SHORT dummy3;
  389.     SHORT yTop;
  390.     SHORT dummy4;
  391. } WRECT;
  392. typedef WRECT FAR *PWRECT;
  393. typedef WRECT near *NPWRECT;
  394.  
  395. typedef struct _WPOINT {   /* wpt */
  396.     SHORT x;
  397.     SHORT dummy1;
  398.     SHORT y;
  399.     SHORT dummy2;
  400. } WPOINT;
  401. typedef WPOINT FAR *PWPOINT;
  402. typedef WPOINT near *NPWPOINT;
  403.