home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / bpos2i.zip / OS2DEF.PAS < prev    next >
Pascal/Delphi Source File  |  1994-05-31  |  10KB  |  396 lines

  1. (* ====================================================== *)
  2. (*                        OS2DEF.PAS                      *)
  3. (*  Declaration of types and constants for OS/2 (16-Bit)  *)
  4. (*           Translation to Pascal by jb/toolbox mag      *)
  5. (* ====================================================== *)
  6. {$IFNDEF OS2}
  7.   Error: Wrong Target!/Compiler not patched
  8. {$ENDIF}
  9.  
  10. UNIT Os2Def;
  11.  
  12. INTERFACE
  13.  
  14. CONST
  15.   NULL = 0;
  16.  
  17. TYPE
  18.   HFile     = INTEGER; (* <-------  That's definitely wrong! *)
  19.  
  20. (* A semphore is defined as the address of a LONGINT.  *)
  21. (* System semaphores are shared by multiple processes  *)
  22. (* and must be gotten by DosCreateSem or DosOpenSem.   *)
  23. (* Ram sempahores are simply the address of a longint  *)
  24. (* in the in memory.  The longint must be initialized  *)
  25. (* to 0 before it is used.  When calling semphore      *)
  26. (* functions with a Ram semphore, be sure to use       *)
  27. (* Addr(li) if li is the longint, since the semphore   *)
  28. (* calls need the addres of the longword rather than   *)
  29. (* the value                                           *)
  30.   SemaPhore = ^LongInt;
  31.  
  32.   LHandle   = ^LongInt;
  33.   HAB       =  LHandle;
  34.  
  35. { SHandle   = INTEGER;          }
  36. { USHORT    = WORD;             }
  37.   BOOL      = INTEGER;
  38. { ULONG     = LongInt;          }
  39.   hPs       =  LHandle;
  40.   pHPS      = ^hPs;
  41.   hDC       =  LHandle;
  42.   pHDC      = ^hDC;
  43.   HRGN      = LHandle;
  44.   pHRGN     = ^HRGN;
  45. { UChar     = BYTE;             }
  46. { UInt      = WORD;             }
  47.  
  48. { pSZ     = Pointer;            }
  49.   PPSZ    = ^pChar;
  50.   pCh     = Pointer;
  51.  
  52.   pFN     = FUNCTION : INTEGER;  (* ptr to fun *)
  53.   pPFN    = ^pFN;
  54.  
  55.   pBYTE   = ^BYTE;   (* short ptr *)
  56.   nPByte  = ^BYTE;
  57.   pShort  = ^INTEGER;
  58.   pLong   = ^LongInt;
  59.   pInt    = ^INTEGER;
  60.  
  61.   pUChar  = ^BYTE;
  62.   pUShort = ^WORD;
  63.   pULong  = ^LongInt;
  64.   pUInt   = ^INTEGER;
  65.   pVoid   = Pointer;
  66.  
  67.   pBool   = ^BOOL;
  68.  
  69.   Sel     = INTEGER;
  70.   pHAB    = ^HAB;
  71.  
  72.   pSel    = ^Sel;
  73.  
  74.   ErrorId  = LongInt;
  75.   pErrorId = ^ErrorId;
  76.  
  77.  
  78. (* Severity codes *)
  79. CONST
  80.   SEVERITY_NOERROR       = $00000;
  81.   SEVERITY_WARNING       = $00004;
  82.   SEVERITY_ERROR         = $00008;
  83.   SEVERITY_SEVERE        = $0000C;
  84.   SEVERITY_UNRECOVERABLE = $00010;
  85.  
  86. (* Base component error values *)
  87.  
  88.   WINERR_BASE            = $01000;  (* Window Manager                  *)
  89.   GPIERR_BASE            = $02000;  (* Graphics Presentation Interface *)
  90.   DEVERR_BASE            = $03000;  (* Device Manager                  *)
  91.   SPLERR_BASE            = $04000;  (* Spooler                         *)
  92.  
  93. TYPE
  94.   hModule  = WORD;
  95.   pHModule = ^hModule;
  96.  
  97.   pID      = WORD;
  98.   pPID     = ^pID;
  99.   tId      = WORD;
  100.   pTID     = ^tId;
  101.  
  102.   hSEM     = Pointer;
  103.   pHSEM    = ^hSEM;
  104.  
  105. (*** Common SUP types *)
  106.  
  107. (*** Common GPI/DEV types *)
  108.   hBitmap  = LHandle;  (* hbm  *)
  109.   pHBitmap = ^hBitmap;
  110.  
  111.   hMF      = LHandle;
  112.   pHMF     = ^hMF;
  113.  
  114.   Color    = LongInt;
  115.   pColor   = ^Color;
  116.  
  117.   PointL   = RECORD     (* ptl  *)
  118.     x : LongInt;
  119.     y : LongInt;
  120.   END;
  121.   pPointL  = ^PointL;
  122.   npPointL = ^PointL;    (* short ptr *)
  123.  
  124.   Points   = RECORD  (* pts *)
  125.     x : INTEGER;
  126.     y : INTEGER;
  127.   END;
  128.   pPoints  = ^Points;
  129.  
  130.   RectL    = RECORD       (* rcl *)
  131.     xLeft   : LongInt;
  132.     yBottom : LongInt;
  133.     xRight  : LongInt;
  134.     yTop    : LongInt;
  135.   END;
  136.   pRectl   = ^RectL;
  137.  
  138.   npRectl  = ^RectL;   (* short ptr *)
  139.   Str8     = ARRAY [0..7] OF CHAR;
  140.  
  141. (***
  142. typedef CHAR STR8[8];       { str8 }
  143. typedef STR8 FAR *PSTR8;
  144. ***)
  145.  
  146. (* common DOS/SHL types *)
  147.  
  148. (* File time and date types *)
  149.  
  150.   fTime    = RECORD         (* ftime *)
  151.     Data: WORD;
  152.       (**
  153.        unsigned twosecs : 5;
  154.        unsigned minutes : 6;
  155.        unsigned hours   : 5;
  156.       **)
  157.   END;
  158.   pFTime   = ^fTime;
  159.  
  160.   fDate    = RECORD
  161.     Data : WORD;        (* fdate *)
  162.       (**
  163.        unsigned day     : 5;
  164.        unsigned month   : 4;
  165.        unsigned year    : 7;
  166.       **)
  167.   END;
  168.   pFDate = ^fDate;
  169.  
  170.   FileFindBuf = RECORD
  171.     fDateCreation   : fDate;
  172.     fTimeCreation   : fTime;
  173.     fDateLastAccess : fDate;
  174.     fTimeLastAccess : fTime;
  175.     fDateLastWrite  : fDate;
  176.     fTimeLastWrite  : fTime;
  177.     cbFile          : LongInt;
  178.     cbFileAlloc     : LongInt;
  179.     attrFile        : WORD;
  180.     cchName         : BYTE;
  181.     achName         : ARRAY [0..12] OF CHAR;
  182.   END;
  183.   pFileFindBuf = ^FileFindBuf;
  184.  
  185. (*** common DEV/SPL types *)
  186.  
  187. (* structure for Device Driver data *)
  188.   DrivData = RECORD
  189.     cb            : LongInt;
  190.     lVersion      : LongInt;
  191.     szDeviceName  : ARRAY [0..31] OF CHAR;
  192.     abGeneralData : CHAR;
  193.   END;
  194.   pDrivData = ^DrivData;
  195.  
  196. (* array indices for array parameter for
  197.    DevOpenDC, SplQmOpen or SplQpOpen    *)
  198.  
  199. CONST
  200.   Address        = 0;
  201.   Driver_Name    = 1;
  202.   Driver_Data    = 2;
  203.   DATA_TYPE      = 3;
  204.   Comment        = 4;
  205.   Proc_Name      = 5;
  206.   Proc_Params    = 6;
  207.   SPL_Params     = 7;
  208.   Network_Params = 8;
  209.  
  210. (* structure definition as an alternative
  211.    of the array parameter                 *)
  212.  
  213. TYPE
  214.   DevOpenStruc = RECORD     (* dop *)
  215.     pszLogAddress      : pChar;
  216.     pszDriverName      : pChar;
  217.     pdriv              : pDrivData;
  218.     pszDataType        : pChar;
  219.     pszComment         : pChar;
  220.     pszQueueProcName   : pChar;
  221.     pszQueueProcParams : pChar;
  222.     pszSpoolerParams   : pChar;
  223.     pszNetworkParams   : pChar;
  224.   END;
  225.   pDevOpenStruc = ^DevOpenStruc;
  226.  
  227. (*** common AVIO/GPI types *)
  228.  
  229. (* values of fsSelection field of FATTRS structure *)
  230. CONST
  231.   FATTR_SEL_ITALIC     = $00001;
  232.   FATTR_SEL_UNDERSCORE = $00002;
  233.   FATTR_SEL_STRIKEOUT  = $00010;
  234.   FATTR_SEL_BOLD       = $00020;
  235.  
  236. (* values of fsType field of FATTRS structure *)
  237.  
  238.   FATTR_TYPE_FIXED     = $00002;
  239.   FATTR_TYPE_KERNING   = $00004;
  240.  
  241. (* values of fsFontUse field of FATTRS structure *)
  242.  
  243.   FATTR_FONTUSE_NOMIX         = $00002;
  244.   FATTR_FONTUSE_OUTLINE       = $00004;
  245.   FATTR_FONTUSE_TRANSFORMABLE = $00008;
  246.  
  247. (* size for fields in the font structures *)
  248.  
  249.   FACESIZE = 32;
  250.  
  251. (* font struct for Vio/GpiCreateLogFont *)
  252.  
  253. TYPE
  254.   fAttrs = RECORD          (* fat *)
  255.     usRecordLength         : WORD;
  256.     fsSelection            : WORD;
  257.     lMatch                 : LongInt;
  258.     szFacename             : ARRAY[0..FACESIZE-1] OF CHAR;
  259.     idRegistry             : WORD;
  260.     usCodePage             : WORD;
  261.     lMaxBaselineExt        : LongInt;
  262.     lAveCharWidth          : LongInt;
  263.     fsType                 : WORD;
  264.     fsFontUse              : WORD;
  265.   END;
  266.   pFAttrs = ^fAttrs;
  267.  
  268. (* font metrics returned by GpiQueryFonts and others *)
  269. TYPE
  270.   FontMetrics = RECORD    (* fm *)
  271.     szFamilyname       : ARRAY[0..FACESIZE-1] OF CHAR;
  272.     szFacename         : ARRAY[0..FACESIZE-1] OF CHAR;
  273.     idRegistry         : WORD;
  274.     usCodePage         : WORD;
  275.     lEmHeight          : LongInt;
  276.     lXHeight           : LongInt;
  277.     lMaxAscender       : LongInt;
  278.     lMaxDescender      : LongInt;
  279.     lLowerCaseAscent   : LongInt;
  280.     lLowerCaseDescent  : LongInt;
  281.     lInternalLeading   : LongInt;
  282.     lExternalLeading   : LongInt;
  283.     lAveCharWidth      : LongInt;
  284.     lMaxCharInc        : LongInt;
  285.     lEmInc             : LongInt;
  286.     lMaxBaselineExt    : LongInt;
  287.     sCharSlope         : INTEGER;
  288.     sInlineDir         : INTEGER;
  289.     sCharRot           : INTEGER;
  290.     usWeightClass      : WORD;
  291.     usWidthClass       : WORD;
  292.     sXDeviceRes        : INTEGER;
  293.     sYDeviceRes        : INTEGER;
  294.     sFirstChar         : INTEGER;
  295.     sLastChar          : INTEGER;
  296.     sDefaultChar       : INTEGER;
  297.     sBreakChar         : INTEGER;
  298.     sNominalPointSize  : INTEGER;
  299.     sMinimumPointSize  : INTEGER;
  300.     sMaximumPointSize  : INTEGER;
  301.     fsType             : WORD;
  302.     fsDefn             : WORD;
  303.     fsSelection        : WORD;
  304.     fsCapabilities     : WORD;
  305.     lSubscriptXSize    : LongInt;
  306.     lSubscriptYSize    : LongInt;
  307.     lSubscriptXOffset  : LongInt;
  308.     lSubscriptYOffset  : LongInt;
  309.     lSuperscriptXSize  : LongInt;
  310.     lSuperscriptYSize  : LongInt;
  311.     lSuperscriptXOffset: LongInt;
  312.     lSuperscriptYOffset: LongInt;
  313.     lUnderscoreSize    : LongInt;
  314.     lUnderscorePosition: LongInt;
  315.     lStrikeoutSize     : LongInt;
  316.     lStrikeoutPosition : LongInt;
  317.     sKerningPairs      : INTEGER;
  318.     sReserved          : INTEGER;
  319.     lMatch             : LongInt;
  320.   END;
  321.   pFontMetrics = ^FontMetrics;
  322.  
  323. (*** Common WIN types *)
  324. TYPE
  325.   hWnd  = LHandle;      (* hwnd *)
  326.   pHWnd = ^hWnd;
  327.  
  328. TYPE
  329.   WRect = RECORD     (* wrc *)
  330.     xLeft  : INTEGER;
  331.     dummy1 : INTEGER;
  332.     yBottom: INTEGER;
  333.     dummy2 : INTEGER;
  334.     xRight : INTEGER;
  335.     dummy3 : INTEGER;
  336.     yTop   : INTEGER;
  337.     dummy4 : INTEGER;
  338.   END;
  339.   pWRect  = ^WRect;
  340.   npWRect = ^WRect;   (* short ptr *)
  341.  
  342. TYPE
  343.   wPoint = RECORD    (* wpt *)
  344.     x      : INTEGER;
  345.     dummy1 : INTEGER;
  346.     y      : INTEGER;
  347.     dummy2 : INTEGER;
  348.   END;
  349.   pWPoint = ^wPoint;
  350.   npWPoint = ^wPoint;  (* short ptr *)
  351.  
  352.  
  353. TYPE
  354.    mParam = RECORD
  355.      CASE INTEGER OF
  356.        1: (b1, b2, b3, b4 : BYTE);
  357.        2: (w1, w2         : WORD);
  358.        4: (l              : LongInt);
  359.      END;
  360.    pMParam  = ^mParam;
  361.    mResult  = Pointer;
  362.    pMResult = ^mResult;
  363.  
  364. FUNCTION MakeLong(LowWord, HiWord : WORD) : LongInt;
  365. FUNCTION LoWord(l: LongInt): WORD;
  366. FUNCTION HiWord(l: LongInt): WORD;
  367.  
  368. IMPLEMENTATION
  369.  
  370.   FUNCTION MakeLong(LowWord, HiWord: WORD) : LongInt;
  371.   BEGIN
  372.     MakeLong := LongInt(HiWord SHL 16) + LowWord;
  373.   END;
  374.  
  375.   FUNCTION LoWord(l: LongInt): WORD;
  376.   VAR
  377.     lR : RECORD
  378.            Lo, Hi : WORD;
  379.          END ABSOLUTE l;
  380.   BEGIN
  381.     LoWord := lR.Lo;
  382.   END;
  383.  
  384.   FUNCTION HiWord(l: LongInt): WORD;
  385.   VAR
  386.     lR : RECORD
  387.            Lo, Hi : WORD;
  388.          END ABSOLUTE l;
  389.   BEGIN
  390.     HiWord := lR.Hi;
  391.   END;
  392.  
  393. END.
  394.  
  395. (* ====================================================== *)
  396.