home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / som30tk.zip / som30os2.zip / include / somcsr.h < prev    next >
C/C++ Source or Header  |  1996-12-24  |  6KB  |  179 lines

  1. /*
  2.  *    @(#) 1.10 src/somk/somcsr.h, somk.api, som3.0 9/25/96 17:03:04 [12/24/96 08:01:33]
  3.  */
  4. /*
  5.  *   COMPONENT_NAME: somk
  6.  *
  7.  *   ORIGINS: 27
  8.  *
  9.  *
  10.  *    25H7912  (C)  COPYRIGHT International Business Machines Corp. 1992,1996,1996  
  11.  *   All Rights Reserved
  12.  *   Licensed Materials - Property of IBM
  13.  *   US Government Users Restricted Rights - Use, duplication or
  14.  *   disclosure restricted by GSA ADP Schedule Contract with IBM Corp.
  15.  */
  16.  
  17. #ifndef somcsr_included
  18. #define somcsr_included
  19.  
  20. /**********************************************************************/
  21. /* Here we define structures actually needed at emit time to emit an  */
  22. /* initialized marshal plan (csr).  Definitions needed only to        */
  23. /* generate and analyze a csr are in cpct_csr.h.  All names intro-    */
  24. /* duced in this file should begin with som or SOM since they will    */
  25. /* be present in .ih and .xih files that are included in class im-    */
  26. /* plementations.                                                     */
  27. /**********************************************************************/
  28.  
  29. /* A length-counted TDC stream */
  30. struct somcsr_tdcstream {
  31.     long tdcstream_len;
  32.     octet *tdcs;
  33. };
  34.  
  35. /* User exception attribute structures */
  36.  
  37. struct somcsr_exception_entry {
  38.     char *exn_string_ident;
  39.     struct somcsr_tdcstream exn_tdcs;
  40. };
  41.  
  42. struct somcsr_Exception_Attributes {
  43.     long num_exns;
  44.     struct somcsr_exception_entry *exns;
  45. };
  46.  
  47. /* Context attribute structure */
  48.  
  49. struct somcsr_Context_Attributes {
  50.   char **fields;
  51. };
  52.  
  53. /* Union attribute structures */
  54.  
  55. /* [case_val] is the value of the case, and [case_tdc/len] is
  56.    the actual TDC stream. */
  57.  
  58. struct somcsr_union_case {
  59.   long case_val;
  60.   struct somcsr_tdcstream case_tdcs;
  61. };
  62.  
  63. /* [default_index] is the index of the default case in the
  64.    [cases] array.  If it is [-1], then there is no default case */
  65.  
  66. struct somcsr_Union_Attributes {
  67.   long default_index;
  68.   long num_cases;
  69.   struct somcsr_union_case *cases;
  70. };
  71.  
  72. /* Foreign Marshaler attribute structures                             */
  73. /* NOTE: The values used for the direction and function arguments below
  74.    must come from the enumerations defined in datmarsh.idl. */
  75.  
  76. typedef void SOMLINK somcsr_Static_foreign_marshaler
  77.   (void * latent_param,
  78.    char * foreign_addr,
  79.    unsigned long direction,
  80.    unsigned long function,
  81.    void * stream,
  82.    Environment *ev);
  83.  
  84. /*
  85.  * The next typedef is needed prior to the macro redefinition below because
  86.  * the explicit pointer qualification in somcsr_Static_foreign_marshaler *
  87.  * will result in a syntax error (after macro expansion).  Pointers to
  88.  * static foreign marshaler * functions must be declared with the
  89.  * somcsr_Static_foreign_marshal_ptr to avoid this error.  See marshfun below
  90.  * for an example.
  91.  */
  92. typedef somcsr_Static_foreign_marshaler * somcsr_Static_foreign_marshal_ptr;
  93.  
  94. /*
  95.  * The type definition for somcsr_Static_foreign_marshaler specifies
  96.  * system linkage, but the C Set++ compiler doesn't apply this correctly
  97.  * when somcsr_Static_foreign_marshaler is used in a second or subsequent
  98.  * declaration for a function.  We work around this compiler problem by
  99.  * redefining the type name for the function to include an explicit _System
  100.  * keyword.  This problem doesn't occur with VisualAge C++.
  101.  */
  102. #if (defined(__IBMC__) && __IBMC__ < 300) || \
  103.     (defined(__IBMCPP__) && __IBMCPP__ < 300)
  104. #define somcsr_Static_foreign_marshaler somcsr_Static_foreign_marshaler _System
  105. #endif
  106.  
  107. SOMEXTERN somcsr_Static_foreign_marshaler somcsr_static_foreign_octet_marshaler;
  108.  
  109. struct somcsr_ForeignStatic_Attributes {
  110.   char *marshfun_name;
  111.   somcsr_Static_foreign_marshal_ptr marshfun;
  112.   char *latent_param_name;
  113.   void *latent_param;
  114. };
  115. struct somcsr_ForeignDynamic_Attributes {
  116.   char *class_name;
  117.   long vers_major;
  118.   long vers_minor;
  119.   char *latent_param;
  120. };
  121.  
  122. /* attrKind exists as a check; it records whether the attribute structure
  123.    was converted dynamically or compiled into a DLL; a ForeignStatic marshaler
  124.    only legal in the latter case */
  125.  
  126.  
  127. enum attrKind {somcsr_Converted, somcsr_Compiled}; /* #21904 */
  128.  
  129. struct somcsr_Foreign_Attributes {
  130.   enum attrKind attrKind;      /* #21904 */
  131.   boolean is_static;
  132.   struct somcsr_ForeignStatic_Attributes *_static;
  133.   struct somcsr_ForeignDynamic_Attributes *_dynamic;
  134.  
  135. };
  136.  
  137. /**********************************************************************/
  138. /* Marshal Plan Rows                                                  */
  139. /**********************************************************************/
  140.  
  141. /* All marshal plan rows begin with the following standard header */
  142.  
  143. typedef struct somMpRowStruct {
  144.    struct somMpRowStruct * next;
  145.    unsigned long rowtype;
  146. } somMpRow;
  147.  
  148. /* The following rowtypes are defined                                 */
  149.  
  150. /* The `long return' rowtype is present for methods returning
  151.    aggregate (struct or union) results, where the length of the result is
  152.   too large to be represented in a short varint (eg, greater than 127
  153.   bytes).  This is expected to be very rare; however, correctness
  154.   dictates that we check for this case and do the right thing.
  155. */
  156.  
  157. typedef struct somMpRowLongretStruct {
  158.   somMpRow hdr;  /* rowtype == 0 */
  159.   unsigned long rlvaluelen;
  160. } somMpRowLongret;
  161.  
  162. #define SOM_MP_ROWTYPE_LONGRET 0
  163.  
  164. /* The `redispatch/apply' rowtype exists as a transition aid for carrying
  165.    forward the SOM 2.x style somMethodInfo structure while reusing the
  166.    emitted fields that used to point to somMethodInfo.  What we do is to
  167.    incorporate somMethodInfo as a marshal plan row.  Eventually, we can get
  168.    rid of somMethodInfo entirely, since it is possible to support redispatch
  169.    and apply stubs based only on information in the csr. */
  170.  
  171. typedef struct somMpRowMethodInfoStruct {
  172.   somMpRow hdr;  /* rowtype == 1 */
  173.   somMethodInfo minfo;
  174. } somMpRowMethodInfo;
  175.  
  176. #define SOM_MP_ROWTYPE_METHODINFO 1
  177.  
  178. #endif /* somcsr_included */
  179.