home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / sd386v50.zip / sd386src.zip / $$TYPES.H < prev    next >
Text File  |  1996-04-15  |  25KB  |  511 lines

  1. /*****************************************************************************/
  2. /* File:                                             IBM INTERNAL USE ONLY813*/
  3. /*   $$type.h                                                                */
  4. /*                                                                           */
  5. /* Description:                                                              */
  6. /*   Record types for $$TYPES segment                                        */
  7. /*                                                                           */
  8. /* History:                                                                  */
  9. /*                                                                           */
  10. /*   02/08/91 Creation of 32-bit SD86, from 16-bit version.                  */
  11. /*                                                                           */
  12. /*...Release 1.00                                                            */
  13. /*...                                                                        */
  14. /*... 02/08/91  100   made changes for 32-bit compilation.                   */
  15. /*...                                                                        */
  16. /*...Release 1.00 (Pre-release 108 12/05/91)                                 */
  17. /*...                                                                        */
  18. /*... 02/07/92  512   Srinivas  Handle Toronto "C" userdefs.                 */
  19. /*...                                                                        */
  20. /*...Release 1.02                                                            */
  21. /*...                                                                        */
  22. /*... 03/01/93  813   Selwyn    Changes for HL02/HL03.                       */
  23. /*****************************************************************************/
  24.  
  25. /*****************************************************************************/
  26. /* Compatibility garbage.                                                    */
  27. /*****************************************************************************/
  28.  
  29. #define TG_UNKNOWN  0
  30. #define TG_SCALAR   1
  31. #define TG_POINTER  2
  32. #define TG_STRUCT   3
  33. #define TG_ARRAY    4
  34. #define TG_ENUM     5
  35. #define TG_BITFLD   6
  36. #define TG_CONSTANT 7                   /* constant                       243*/
  37. #define TG_CLASS    8
  38. #define TG_REF      9
  39.  
  40. #define ADDRESS_CONSTANT   0xFFFF       /* fake value to tell addr const     */
  41. #define VALUE_CONSTANT     0xFFFE       /* fake value to tell value const    */
  42.  
  43. #define TFLD_UINT   0x7C
  44. #define TFLD_INT    0x7D
  45. #define TFLD_CHAR   0x6F
  46.  
  47. #define FLDID_VOID       0x81
  48.  
  49. /*****************************************************************************/
  50. /* Macros for type record handling.                                          */
  51. /*****************************************************************************/
  52. #define NextTrec(p) ((Trec *) ((char *)(p) + ((Trec *)(p))->RecLen + 2))
  53. #define PrimitiveType(t) ((t)&0x9F)
  54.  
  55. #define MD_BITS        0x60
  56. #define TYP_BITS       0x1C
  57. #define SZ_BITS        0x03
  58. #define PRIMITIVE_PTR  MD_BITS
  59.  
  60. /*****************************************************************************/
  61. /* Values come from the TD_POINTER flags byte. Note that we do not           */
  62. /* support a 16:32 pointer. We map it away since we can't do anything        */
  63. /* with it anyway.                                                           */
  64. /*****************************************************************************/
  65. #define PTR_0_16    0
  66. #define PTR_0_32    1
  67. #define PTR_16_16   2
  68.  
  69. /*****************************************************************************/
  70. /*                      RECORD TYPE DEFINITIONS                              */
  71. /*****************************************************************************/
  72.  
  73. #define T_SCALAR    0x51
  74. #define T_BITFLD    0x5C
  75. #define T_TYPDEF    0x5D
  76. #define T_PROC      0x75
  77. #define T_ENTRY     0x53
  78. #define T_FUNCTION  0x54
  79. #define T_ARRAY     0x78
  80. #define T_STRUCT    0x79
  81. #define T_PTR       0x7A
  82. #define T_ENUM      0x7B
  83. #define T_LIST      0x7F
  84. #define T_NULL      0x80
  85. #define T_SKIP      0x90
  86. #define T_CLASS     0x40
  87. #define T_MEMFNC    0x45
  88. #define T_CLSMEM    0x46
  89. #define T_BSECLS    0x41
  90. #define T_REF       0x48
  91. #define T_CLSDEF    0x43
  92. #define T_FRIEND    0x42
  93.  
  94. /*****************************************************************************/
  95. /* Primitive types;                                                         */
  96. /*****************************************************************************/
  97. #define TYPE_CHAR      0x80             /* 8-bit  signed.                    */
  98. #define TYPE_SHORT     0x81             /* 16-bit signed.                    */
  99. #define TYPE_LONG      0x82             /* 32-bit signed.                    */
  100. #define TYPE_UCHAR     0x84             /* 8-bit  unsigned.                  */
  101. #define TYPE_USHORT    0x85             /* 16-bit unsigned.                  */
  102. #define TYPE_ULONG     0x86             /* 32-bit unsigned.                  */
  103. #define TYPE_FLOAT     0x88             /* 32-bit real.                      */
  104. #define TYPE_DOUBLE    0x89             /* 64-bit real.                      */
  105. #define TYPE_LDOUBLE   0x8A             /* 80-bit real.                      */
  106. #define TYPE_VOID      0x97             /* void.                             */
  107.  
  108. /*****************************************************************************/
  109. /* Primitive near pointer 0:32 definitions.                                  */
  110. /*****************************************************************************/
  111. #define TYPE_PCHAR      0xA0            /* 0:32 near ptr to 8-bit  signed.   */
  112. #define TYPE_PSHORT     0xA1            /* 0:32 near ptr to 16-bit signed.   */
  113. #define TYPE_PLONG      0xA2            /* 0:32 near ptr to 32-bit signed.   */
  114. #define TYPE_PUCHAR     0xA4            /* 0:32 near ptr to 8-bit  unsigned. */
  115. #define TYPE_PUSHORT    0xA5            /* 0:32 near ptr to 16-bit unsigned. */
  116. #define TYPE_PULONG     0xA6            /* 0:32 near ptr to 32-bit unsigned. */
  117. #define TYPE_PFLOAT     0xA8            /* 0:32 near ptr to 32-bit real.     */
  118. #define TYPE_PDOUBLE    0xA9            /* 0:32 near ptr to 64-bit real.     */
  119. #define TYPE_PLDOUBLE   0xAA            /* 0:32 near ptr to 80-bit real.     */
  120. #define TYPE_PVOID      0xB7            /* 0:32 near ptr to void.            */
  121.  
  122. /*****************************************************************************/
  123. /* Primitive far pointer definitions.                                        */
  124. /*****************************************************************************/
  125. #define TYPE_FPCHAR     0xC0            /* far ptr to 8-bit  signed.         */
  126. #define TYPE_FPSHORT    0xC1            /* far ptr to 16-bit signed.         */
  127. #define TYPE_FPLONG     0xC2            /* far ptr to 32-bit signed.         */
  128. #define TYPE_FPUCHAR    0xC4            /* far ptr to 8-bit  unsigned.       */
  129. #define TYPE_FPUSHORT   0xC5            /* far ptr to 16-bit unsigned.       */
  130. #define TYPE_FPULONG    0xC6            /* far ptr to 32-bit unsigned.       */
  131. #define TYPE_FPFLOAT    0xC8            /* far ptr to 32-bit real.           */
  132. #define TYPE_FPDOUBLE   0xC9            /* far ptr to 64-bit real.           */
  133. #define TYPE_FPLDOUBLE  0xCA            /* far ptr to 80-bit real.           */
  134. #define TYPE_FPVOID     0xD7            /* far ptr to void.                  */
  135.  
  136. /*****************************************************************************/
  137. /* Primitive near pointer 0:16 definitions. ( Using MS huge model bits. )    */
  138. /*****************************************************************************/
  139. #define TYPE_N16PCHAR    0xE0           /* 0:16 near ptr to 8-bit  signed.   */
  140. #define TYPE_N16PSHORT   0xE1           /* 0:16 near ptr to 16-bit signed.   */
  141. #define TYPE_N16PLONG    0xE2           /* 0:16 near ptr to 32-bit signed.   */
  142. #define TYPE_N16PUCHAR   0xE4           /* 0:16 near ptr to 8-bit  unsigned. */
  143. #define TYPE_N16PUSHORT  0xE5           /* 0:16 near ptr to 16-bit unsigned. */
  144. #define TYPE_N16PULONG   0xE6           /* 0:16 near ptr to 32-bit unsigned. */
  145. #define TYPE_N16PFLOAT   0xE8           /* 0:16 near ptr to 32-bit real.     */
  146. #define TYPE_N16PDOUBLE  0xE9           /* 0:16 near ptr to 64-bit real.     */
  147. #define TYPE_N16PLDOUBLE 0xEA           /* 0:16 near ptr to 80-bit real.     */
  148. #define TYPE_N16PVOID    0xF7           /* 0:16 near ptr to void.            */
  149.  
  150. /*****************************************************************************/
  151. /* Prefix structure of all type records.                                     */
  152. /*****************************************************************************/
  153. typedef struct
  154. {
  155.   USHORT RecLen;
  156.   UCHAR  RecType;
  157. } Trec;
  158.  
  159. /*****************************************************************************/
  160. /* Null record.                                                              */
  161. /*****************************************************************************/
  162. typedef struct                          /* Type Number : 0x80                */
  163. {
  164.   USHORT RecLen;
  165.   UCHAR  RecType;
  166. } TD_NULL;
  167.  
  168. /*****************************************************************************/
  169. /* STRUCTURE Record.                                                         */
  170. /* - "Packed" field from the Microsoft format are not mapped to internals.   */
  171. /*****************************************************************************/
  172. typedef struct                          /* Type Number : 0x79                */
  173. {
  174.   USHORT  RecLen;
  175.   UCHAR   RecType;
  176.   ULONG   ByteSize;
  177.   USHORT  NumMembers;
  178.   USHORT  TypeListIndex;
  179.   USHORT  NameListIndex;
  180.   USHORT  NameLen;
  181.   CHAR    Name[1];
  182. } TD_STRUCT;
  183.  
  184. /*****************************************************************************/
  185. /* CLASS Record.                                                             */
  186. /* - "Packed" field from the Microsoft format are not mapped to internals.   */
  187. /*****************************************************************************/
  188. typedef struct                          /* Type Number : 0x40                */
  189. {
  190.   USHORT  RecLen;
  191.   UCHAR   RecType;
  192.   UCHAR   TypeQual;
  193.   ULONG   ByteSize;
  194.   USHORT  NumMembers;
  195.   USHORT  ItemListIndex;
  196.   USHORT  NameLen;
  197.   CHAR    Name[1];
  198. } TD_CLASS;
  199.  
  200. /*****************************************************************************/
  201. /* Member Function Record                                                    */
  202. /*****************************************************************************/
  203. #define FUNCTYPE_REGULAR 0
  204. #define FUNCTYPE_CTOR    1
  205. #define FUNCTYPE_DTOR    2
  206.  
  207. #define FUNCQUAL_STATIC  0x01
  208. #define FUNCQUAL_CONST   0x04
  209.  
  210. typedef struct                          /* Type Number : 0x45                */
  211. {
  212.   USHORT  RecLen;
  213.   UCHAR   RecType;
  214.   UCHAR   TypeQual;
  215.   UCHAR   Protection;
  216.   UCHAR   FuncType;
  217.   USHORT  SubRecIndex;
  218.   ULONG   vTableIndex;
  219.   USHORT  NameLen;
  220.   CHAR    Name[1];
  221. } TD_MEMFNC;
  222.  
  223. /*****************************************************************************/
  224. /* Class Member Record.                                                      */
  225. /*****************************************************************************/
  226. typedef struct                          /* Type Number : 0x46                */
  227. {
  228.   USHORT  RecLen;
  229.   UCHAR   RecType;
  230.   UCHAR   TypeQual;
  231.   UCHAR   Protection;
  232.   USHORT  TypeIndex;
  233.   ULONG   Offset;
  234.   USHORT  NameLen;                      /* Optional Static Name followed by  */
  235.   CHAR    Name[1];                      /* a member name.                    */
  236. } TD_CLSMEM;
  237.  
  238. /*****************************************************************************/
  239. /* Base Class Record.                                                        */
  240. /*****************************************************************************/
  241. typedef struct                          /* Type Number : 0x41                */
  242. {
  243.   USHORT  RecLen;
  244.   UCHAR   RecType;
  245.   UCHAR   TypeQual;
  246.   UCHAR   Protection;
  247.   USHORT  TypeIndex;
  248.   ULONG   Offset;
  249. } TD_BSECLS;
  250.  
  251. /*****************************************************************************/
  252. /* ClassDef Record.                                                          */
  253. /*****************************************************************************/
  254. typedef struct                          /* Type Number : 0x43                */
  255. {
  256.   USHORT  RecLen;
  257.   UCHAR   RecType;
  258.   UCHAR   TypeQual;
  259.   UCHAR   Protection;
  260.   USHORT  TypeIndex;
  261.   USHORT  ClassType;
  262. } TD_CLSDEF;
  263.  
  264. /*****************************************************************************/
  265. /* Reference Record.                                                         */
  266. /*****************************************************************************/
  267. typedef struct                          /* Type Number : 0x48                */
  268. {
  269.   USHORT  RecLen;
  270.   UCHAR   RecType;
  271.   USHORT  TypeIndex;
  272. } TD_REF;
  273.  
  274. /*****************************************************************************/
  275. /* FRIEND Record.                                                            */
  276. /*****************************************************************************/
  277. typedef struct                          /* Type Number : 0x42                */
  278. {
  279.   USHORT  RecLen;
  280.   UCHAR   RecType;
  281.   UCHAR   TypeQual;
  282.   USHORT  TypeIndex;
  283.   USHORT  NameLen;
  284.   CHAR    Name[1];
  285. } TD_FRIEND;
  286.  
  287. /*****************************************************************************/
  288. /* BIT FIELD Record.                                                         */
  289. /* - Flags definition                                                        */
  290. /*   ---------                                                               */
  291. /*   4 3 2 1 0 <-bit                                                         */
  292. /*   ---------                                                               */
  293. /*   x x x x 0 - Non-varying                                                 */
  294. /*   x x x x 1 - Varying                                                     */
  295. /*   x x x 0 x - Unsigned                                                    */
  296. /*   x x x 1 x - Signed                                                      */
  297. /*   x x 0 x x - Byte alignment                                              */
  298. /*   x x 1 x x - Word alignment                                              */
  299. /*   x 0 x x x - Display as string of 0 and 1                                */
  300. /*   x 1 x x x - Display as a value                                          */
  301. /*   0 x x x x - No descriptor required                                      */
  302. /*   1 x x x x - Descriptor required                                         */
  303. /*                                                                           */
  304. /*****************************************************************************/
  305. typedef struct                          /* Type Number : 0x5C                */
  306. {
  307.   USHORT  RecLen;
  308.   UCHAR   RecType;
  309.   UCHAR   Flags;
  310.   CHAR    Offset;
  311.   CHAR    BitSize;
  312.   CHAR    BaseType;
  313. } TD_BITFLD;
  314. #define DISPLAY_AS_VALUE 0x08
  315.  
  316. /*****************************************************************************/
  317. /* TYPEDEF/USERDEF Record.                                                   */
  318. /*****************************************************************************/
  319. typedef struct                          /* Type Number : 0x5D                */
  320. {
  321.   USHORT  RecLen;
  322.   UCHAR   RecType;
  323.   USHORT  TypeIndex;
  324.   USHORT  NameLen;
  325.   CHAR    Name[1];
  326. } TD_USERDEF;
  327.  
  328. /*****************************************************************************/
  329. /* POINTER Record.                                                           */
  330. /* - Flags Definition  (Pointer Model).                                      */
  331. /*   ---                                                                     */
  332. /*   1 0 <-bit                                                               */
  333. /*   ---                                                                     */
  334. /*   x 0 - 16 Bit      (The Flags leaf is a combination of the IBM "type     */
  335. /*   x 1 - 32 Bit       qualifier" and Microsoft "Model" leaf).              */
  336. /*   0 x - Near                                                              */
  337. /*   1 x - Far                                                               */
  338. /*****************************************************************************/
  339. typedef struct                          /* Type Number : 0x7A                */
  340. {
  341.   USHORT  RecLen;
  342.   UCHAR   RecType;
  343.   UCHAR   Flags;
  344.   USHORT  TypeIndex;
  345.   USHORT  NameLen;
  346.   CHAR    Name[1];
  347. } TD_POINTER;
  348.  
  349. /*****************************************************************************/
  350. /* ENUM Record.                                                              */
  351. /* - Microsoft scalar records are mapped to internal enum records except a   */
  352. /*   special case which is mapped to internal scalar record.                 */
  353. /*                                                                           */
  354. /* - The variable length fields "Lower Bound" and "Upper Bound" are allocted */
  355. /*   a maximum (4 bytes) in the internal format.                             */
  356. /*****************************************************************************/
  357. typedef struct                          /* Type Number : 0x7B                */
  358. {
  359.   USHORT  RecLen;
  360.   UCHAR   RecType;
  361.   USHORT  DataType;
  362.   USHORT  NameListIndex;
  363.   LONG    LBound;
  364.   LONG    UBound;
  365.   USHORT  NameLen;
  366.   CHAR    Name[1];
  367. } TD_ENUM;
  368.  
  369. /*****************************************************************************/
  370. /* SCALAR Record.                                                            */
  371. /* - The IBM format supports a Scalar (0x51) type in addition an enum type.  */
  372. /*   We ignore all other fields except the "DataType" field in the record.   */
  373. /*                                                                           */
  374. /* - Microsoft supports a special type of scalar record which is only three  */
  375. /*   bytes in length. This is mapped to our internal scalar record.          */
  376. /*****************************************************************************/
  377. typedef struct                          /* Type Number : 0x51                */
  378. {
  379.   USHORT  RecLen;
  380.   UCHAR   RecType;
  381.   USHORT  DataType;
  382. } TD_SCALAR;
  383.  
  384. /*****************************************************************************/
  385. /* ARRAY Record.                                                             */
  386. /* - We assume that the "indexing method" specified in the Microsoft format  */
  387. /*   is always "int" so we will ignore this field.                           */
  388. /*                                                                           */
  389. /* - In the IBM records, there will be a name leaf;however, it will have a   */
  390. /*   zero length.                                                            */
  391. /*                                                                           */
  392. /* - Flags Definition (Type qualifier in IBM format).                        */
  393. /*   -----                                                                   */
  394. /*   2 1 0 <-bit                                                             */
  395. /*   -----                                                                   */
  396. /*   x x 0 - Row major                                                       */
  397. /*   x x 1 - Column major                                                    */
  398. /*   x 0 x - Unpacked                                                        */
  399. /*   x 1 x - Packed                                                          */
  400. /*   0 x x - No descriptor required                                          */
  401. /*   1 x x - Descriptor provided                                             */
  402. /*****************************************************************************/
  403. typedef struct                          /* Type Number : 0x78                */
  404. {
  405.   USHORT  RecLen;
  406.   UCHAR   RecType;
  407.   UCHAR   Flags;
  408.   ULONG   ByteSize;
  409.   USHORT  BoundsTypeIndex;
  410.   USHORT  ElemType;
  411.   USHORT  NameLen;
  412.   CHAR    Name[1];
  413. } TD_ARRAY;
  414.  
  415. /*****************************************************************************/
  416. /* TYPE LIST Record.                                                         */
  417. /*****************************************************************************/
  418. typedef struct                          /* Type Number : 0x7F                */
  419. {
  420.   USHORT  RecLen;
  421.   UCHAR   RecType;
  422.   UCHAR   Flags;
  423.   USHORT  TypeIndex[1];
  424. } TD_TYPELIST;
  425.  
  426. /*****************************************************************************/
  427. /* NAME LIST Record.                                                         */
  428. /*****************************************************************************/
  429. #define NAME         0
  430. #define MEMBEROFFSET 1
  431. #define VALUEINDEX   2
  432. #define VERIFYVALUE  3
  433. #define MEMBERTYPE   4
  434.  
  435. /*****************************************************************************/
  436. /* PROCEDURE/FUNCTION Record.                                                */
  437. /* - Flags Definition (Type qualifier in IBM format).                        */
  438. /*   -----------                                                             */
  439. /*   5 4 3 2 1 0 <-bit                                                       */
  440. /*   -----------                                                             */
  441. /*   x x x x x 0 - Args pushed left to right                                 */
  442. /*   x x x x x 1 - Args pushed right to left                                 */
  443. /*   x x x x 0 x - Callee pops                                               */
  444. /*   x x x x 1 x - Caller pops                                               */
  445. /*   x x x 0 x x - 16 bit function                                           */
  446. /*   x x x 1 x x - 32 bit function                                           */
  447. /*   x x 0 x x x - Near                                                      */
  448. /*   x x 1 x x x - Far                                                       */
  449. /*   x 0 x x x x - Fixed parms                                               */
  450. /*   x 1 x x x x - Variable parms                                            */
  451. /*   0 x x x x x - OS/2 calling convention                                   */
  452. /*   1 x x x x x - Private calling convention                                */
  453. /*                                                                           */
  454. /* - Microsoft calling convention is mapped to the IBM qualifier type.       */
  455. /*                                                                           */
  456. /* - Microsoft "Null" leaf is not mapped.                                    */
  457. /*****************************************************************************/
  458. typedef struct                          /* Type Number : 0x75                */
  459. {
  460.   USHORT  RecLen;
  461.   UCHAR   RecType;
  462.   UCHAR   Flags;
  463.   USHORT  NumParams;
  464.   USHORT  MaxParams;
  465.   USHORT  ReturnType;
  466.   USHORT  ParmListIndex;
  467. } TD_PROC;
  468.  
  469. /*****************************************************************************/
  470. /* SKIP Record.  (Not supported in IBM format).                              */
  471. /*****************************************************************************/
  472. typedef struct                          /* Type Number : 0x90                */
  473. {
  474.   USHORT  RecLen;
  475.   UCHAR   RecType;
  476.   USHORT  NewIndex;
  477. } TD_SKIP;
  478.  
  479. /*****************************************************************************/
  480. /* - type qualifier masks and mnemonics for Class Member records.            */
  481. /*****************************************************************************/
  482. #define CLSMEM_PRIVATE      0x00
  483. #define CLSMEM_PROTECTED    0x01
  484. #define CLSMEM_PUBLIC       0x02
  485.  
  486. #define SCLSMEM_PRIVATE     "Pri"
  487. #define SCLSMEM_PROTECTED   "Pro"
  488. #define SCLSMEM_PUBLIC      "Pub"
  489.  
  490. #define CLSMEM_STATIC       0x01
  491. #define CLSMEM_VTABLE       0x02
  492. #define CLSMEM_VBASE        0x04
  493. #define CLSMEM_CONST        0x08
  494. #define CLSMEM_VOL          0x10
  495. #define CLSMEM_SELF         0x20
  496.  
  497. #define SCLSMEM_STATIC      "St"
  498. #define SCLSMEM_VTABLE      "Vt"
  499. #define SCLSMEM_VBASE       "Vb"
  500. #define SCLSMEM_CONST       "Co"
  501. #define SCLSMEM_VOL         "Vo"
  502. #define SCLSMEM_SELF        "Se"
  503.  
  504. /*****************************************************************************/
  505. /* - type qualifier and masks for friend class/function records.             */
  506. /*****************************************************************************/
  507. #define FRIEND_CLASS        0x01
  508.  
  509. #define SFRIEND_FUNCTION    "FriendFnc"
  510. #define SFRIEND_CLASS       "FriendCls"
  511.