home *** CD-ROM | disk | FTP | other *** search
/ The Developer Connection…ice Driver Kit for OS/2 3 / DEV3-D1.ISO / devtools / toolkt21 / c / os2h / somtypes.h < prev    next >
Encoding:
C/C++ Source or Header  |  1993-03-12  |  3.9 KB  |  190 lines

  1. /*
  2.  *    SOMTYPES.H
  3.  *    System Object Model typedefs
  4.  *
  5.  *    Copyright (c) International Business Machines Corporation
  6.  *                  1991, 1992
  7.  *
  8.  *    @(#)somtypes.h 1.20 2/13/92 23:56:53 [2/20/92] (c)IBM Corp. 1992
  9.  */
  10.  
  11. #ifndef somtypes_h
  12. #define somtypes_h
  13.  
  14. #include <stdarg.h>
  15.  
  16. /*--------------------------------------------------------------
  17.  * Base data types
  18.  */
  19.  
  20. #ifndef NULL
  21. #define NULL ((void *) 0)
  22. #endif
  23.  
  24. typedef char integer1;
  25. typedef short integer2;
  26. typedef unsigned short uinteger2;
  27. typedef long integer4;
  28. typedef unsigned long uinteger4;
  29. typedef float float4;
  30. typedef double float8;
  31. typedef char *zString;                 /* NULL terminated string */
  32. typedef char *fString;                 /* non-terminated string  */
  33. typedef char **somId;
  34. typedef void *somToken;                /* Uninterpretted value   */
  35. typedef void *somMToken;               /* Method token           */
  36. typedef void *somDToken;               /* Data token             */
  37.  
  38. typedef integer4 somMOffset;
  39. typedef integer4 somDOffset;
  40. typedef integer4 somMData;
  41.  
  42. /*
  43.  *   Instances
  44.  */
  45.  
  46. typedef struct SOMAny_struct {
  47.     struct somMethodTabStruct *mtab;
  48.     integer1 body[1];
  49. } SOMAny;
  50.  
  51. /*  Define the three startup classes to avoid bootstrap problems */
  52. #define SOMObject SOMAny
  53. #define SOMClass SOMAny
  54. #define SOMClassMgr SOMAny
  55.  
  56. #ifdef __IBMC__
  57.   #pragma linkage( somMethodProc, system )
  58. #endif
  59. typedef integer4 SOMLINK somMethodProc(void);
  60.  
  61. /*
  62.  *   Method Table
  63.  */
  64.  
  65. typedef struct somMethodTabStruct {
  66.     SOMClass *classObject;
  67.     somMethodProc *entries[1];
  68. } somMethodTab;
  69.  
  70. /*
  71.  *   Class data structure
  72.  */
  73.  
  74. typedef struct {
  75.     SOMClass *classObject;
  76. } somClassDataStructure;
  77.  
  78. /*
  79.  *   Trait object structure
  80.  */
  81. typedef struct {
  82.     somMethodTab *mtab;
  83.     SOMAny *target;
  84.     SOMAny *realSelf;
  85. } SOMTraitAny;
  86.  
  87. /*
  88.  *   Method descriptor record
  89.  */
  90.  
  91. typedef struct somMethodDataStruct {
  92.     somId id;
  93.     uinteger4 type;                    /* 0=static, 1=dynamic */
  94.     somId descriptor;
  95.     somMToken offset;                  /* not valid for dynamic methods */
  96.     somMethodProc *method;
  97.     somMethodProc *redispatchStub;
  98.     somMethodProc *applyStub;
  99. } somMethodData;
  100.  
  101. /*
  102.  * Typedef for Static Method table that we generate in the .ih file.
  103.  */
  104.  
  105. typedef struct somStaticMethodStruct {
  106.     somMToken *classData;
  107.     somId *methodId;
  108.     somId *methodDescriptor;
  109.     somMethodProc *method;
  110.     somMethodProc *redispatchStub;
  111.     somMethodProc *applyStub;
  112. } somStaticMethod_t;
  113.  
  114. /*
  115.  * Typedef for Override Method table that we generate in the .ih file.
  116.  */
  117.  
  118. typedef struct somOverideMethodStruct {
  119.     somId *methodId;
  120.     somMethodProc *method;
  121. } somOverrideMethod_t;
  122.  
  123. #define SOM_DynamicMethod  1
  124. #define SOM_StaticMethod   0
  125.  
  126. /*
  127.  *    Comment macros for arguments
  128.  */
  129. #define IN
  130. #define OUT
  131. #define INOUT
  132.  
  133. /*
  134.  *    Old style name support
  135.  */
  136.  
  137. typedef somMethodProc *somMethodPtr;
  138.  
  139. /* The following synonyms provide OS/2-style typedefs */
  140.  
  141. #ifndef FLOAT4
  142. #define FLOAT4                  float4
  143. #endif
  144.  
  145. #ifndef FLOAT8
  146. #define FLOAT8                  double
  147. #endif
  148.  
  149. #ifndef SOMID
  150. #define SOMID                   somId
  151. #endif
  152.  
  153. #ifndef SOMTOKEN
  154. #define SOMTOKEN                somToken
  155. #endif
  156.  
  157. #ifndef SOMANY
  158. #define SOMANY                  SOMAny
  159. #endif
  160.  
  161. #ifndef SOMCLASS
  162. #define SOMCLASS                SOMClass
  163. #endif
  164.  
  165. #ifndef SOMOBJECT
  166. #define SOMOBJECT               SOMObject
  167. #endif
  168.  
  169. #ifndef SOMMETHODTAB
  170. #define SOMMETHODTAB            somMethodTab
  171. #endif
  172.  
  173. #ifndef SOMMETHODDATA
  174. #define SOMMETHODDATA           somMethodData
  175. #endif
  176.  
  177. #ifndef SOMMETHODPTR
  178. #define SOMMETHODPTR            somMethodPtr
  179. #endif
  180.  
  181. #ifndef SOMTRAITANY
  182. #define SOMTRAITANY             SOMTraitAny
  183. #endif
  184.  
  185. #ifndef SOMCLASSDATASTRUCT
  186. #define SOMCLASSDATASTRUCT      somClassDataStructure
  187. #endif
  188.  
  189. #endif  /* somtypes_h */
  190.