home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / tolkit45.zip / os2tk45 / som / include / somtc.hh < prev    next >
Text File  |  1999-02-22  |  6KB  |  157 lines

  1. /*
  2.  *   COMPONENT_NAME: somc
  3.  *
  4.  *   ORIGINS: 27
  5.  *
  6.  *
  7.  *    25H7912  (C)  COPYRIGHT International Business Machines Corp. 1992,1996,1996  
  8. 1994
  9.  *   All Rights Reserved
  10.  *   Licensed Materials - Property of IBM
  11.  *   US Government Users Restricted Rights - Use, duplication or
  12.  *   disclosure restricted by GSA ADP Schedule Contract with IBM Corp.
  13.  */
  14.  
  15.  
  16. /*
  17.  * somtc.hh DTS C++ include
  18.  * Typedefs, structs, & enums in support of CORBA TypeCodes
  19.  * and sequences for use with SOM 
  20.  */
  21.  
  22. #ifndef SOMTC_hh_DTS_INCLUDE
  23. #define SOMTC_hh_DTS_INCLUDE
  24.  
  25. #include <som.hh>
  26.  
  27. #pragma SOMAsDefault (off)
  28.  
  29. /*
  30.  * Operations supported by TypeCodes
  31.  *
  32.  */
  33. SOMEXTERN short    SOMLINK tcAlignment (TypeCode t,Environment *ev);
  34. SOMEXTERN TypeCode SOMLINK tcCopy      (TypeCode t,Environment *ev);
  35. SOMEXTERN boolean  SOMLINK tcEqual     (TypeCode x,Environment *ev,TypeCode y);
  36. SOMEXTERN void       SOMLINK tcFree      (TypeCode t,Environment *ev);
  37. SOMEXTERN TCKind   SOMLINK tcKind      (TypeCode t,Environment *ev);
  38. SOMEXTERN long       SOMLINK tcParmCount (TypeCode t,Environment *ev);
  39. SOMEXTERN any       SOMLINK tcParameter (TypeCode t,Environment *ev,long index);
  40. SOMEXTERN void       SOMLINK tcPrint     (TypeCode t,Environment *ev);
  41. SOMEXTERN void       SOMLINK tcSetAlignment (TypeCode t,Environment *ev, short a);
  42. SOMEXTERN long       SOMLINK tcSize      (TypeCode t,Environment *ev);
  43.  
  44. /*
  45.  * Variable argument sequences for tcNew:
  46.  * (based on CORBA 7.6.1 Table 16 pp 139-140)
  47.  *
  48.  *  char     *interfaceId, *name, *mbrName, *enumId;
  49.  *  char     *structOrUnionName, *typeName, *context;
  50.  *  long     maxLength, length, labelFlag, labelValue;
  51.  *  TypeCode swTC, mbrTC, seqTC, arrayTC, ptrTC;
  52.  *  TCKind   tk_<xxx>;
  53.  *
  54.  *  tcNew (tk_<xxx>);
  55.  *  tcNew (tk_objref interfaceId);
  56.  *  tcNew (tk_string, maxLength);
  57.  *  tcNew (tk_sequence, seqTC, maxLength);
  58.  *  tcNew (tk_array, arrayTC, length);
  59.  *  tcNew (tk_pointer, ptrTC);                     <---[SOM extension]
  60.  *  tcNew (tk_self, structOrUnionName);            <---[SOM extension]
  61.  *  tcNew (tk_foreign, typeName, context, length); <---[SOM extension]
  62.  *
  63.  *  tcNew (tk_struct, name, mbrName, mbrTC, [...,] NULL);
  64.  *      [mbrName & TypeCode repeat as needed]
  65.  *
  66.  *  tcNew (tk_union, name, swTC, 
  67.  *      labelFlag, labelValue, mbrName, mbrTC, [...,] NULL);
  68.  *      [labelFlag, labelValue, mbrName & TypeCode repeat as needed]
  69.  *      labelFlag has the following meanings:
  70.  *        TCREGULAR_CASE - regular labelValue, cast as a long, follows,
  71.  *        TCDEFAULT_CASE - default case, with 0L for labelValue follows.
  72.  *
  73.  *  tcNew (tk_enum, name, enumId, [...,] NULL);
  74.  *    [enumId repeats as needed]
  75.  *
  76.  *  NULL is returned if tcNew detects an error or an attempt
  77.  *  to construct an illegal TypeCode
  78.  *
  79.  *  TypeCodes are assigned default alignment attributes appropriate 
  80.  *  to their constituent types.  The default alignment associated with  
  81.  *  the TypeCode as a whole is the greatest alignment associated with
  82.  *  any of its subordinate TypeCodes or primitive elements.  Note that
  83.  *  alignment information is platform-specific.  Default alignment
  84.  *  information can be overridden using the tcSetAlignment function,
  85.  *  where an argument value of zero means use default alignment, 
  86.  *  1 = byte alignment, n = alignment to an address boundary divisible 
  87.  *  by n.
  88.  *
  89.  *  TypeCodes created by tcNew do not hold references to any of the
  90.  *  passed strings, which are assumed to be owned by the caller.
  91.  *  This is not the case for the "TypeCode" arguments. They become
  92.  *  directly imbedded in the new TypeCode.  If you need to retain
  93.  *  ownership of passed TypeCodes, pass them using tcCopy.  Note that
  94.  *  TypeCode constants (TC_<xxx>) can be freely passed as arguments to
  95.  *  tcNew without using tcCopy.
  96.  *
  97.  *  All TypeCodes created by tcNew can be freed using tcFree.
  98.  */
  99. SOMEXTERN TypeCode SOMLINK tcNew (TCKind tag, ...);
  100.  
  101. /*  The following special variant on tcNew can be used when the
  102.  *  arguments are not known at compile-time and must be constructed
  103.  *  dynamically as a va_list.
  104.  */
  105. SOMEXTERN TypeCode SOMLINK tcNewVL (TCKind tag, va_list ap);
  106.  
  107. /*
  108.  *  Following constants used with tcNew to create union TypeCodes.
  109.  *  See calling sequences above.
  110.  */
  111. #define TCREGULAR_CASE 1L
  112. #define TCDEFAULT_CASE 2L
  113.  
  114. SOMEXTERN GENERIC_SEQUENCE * SOMLINK tcSequenceNew (TypeCode t,
  115.                             unsigned long max);
  116. #ifndef _IDL_SEQUENCE_string_defined
  117. #define _IDL_SEQUENCE_string_defined
  118. SOM_SEQUENCE_TYPEDEF (string);
  119. #endif /* _IDL_SEQUENCE_string_defined */
  120.  
  121. SOMEXTERN sequence(string) SOMLINK tcSeqFromListString (string s);
  122.  
  123. /* CORBA function names for TypeCodes, per CORBA 7.6.1, p.139 */
  124. #define TypeCode_kind          tcKind
  125. #define TypeCode_equal          tcEqual
  126. #define TypeCode_param_count  tcParmCount
  127. #define TypeCode_parameter    tcParameter
  128. /*
  129.  *  The following are IBM TypeCode extensions
  130.  */
  131. #define TypeCode_alignment    tcAlignment
  132. #define TypeCode_copy          tcCopy
  133. #define TypeCode_free          tcFree
  134. #define TypeCode_print          tcPrint
  135. #define TypeCode_setAlignment tcSetAlignment
  136. #define TypeCode_size          tcSize
  137.  
  138. #define TypeCodeNew           tcNew
  139. #define TypeCodeNewVL         tcNewVL
  140.  
  141. /* somVaBuf support #18052 */
  142. #ifndef SOMVABUF
  143. #define SOMVABUF
  144. typedef somToken somVaBuf;
  145.  
  146. SOMEXTERN void*  SOMLINK  somVaBuf_create(char *, int);
  147. SOMEXTERN void SOMLINK    somVaBuf_get_valist(void *, va_list *);
  148. SOMEXTERN void SOMLINK    somVaBuf_destroy(void *);
  149. SOMEXTERN long SOMLINK    somVaBuf_add(void * , char *, int);
  150. SOMEXTERN unsigned long SOMLINK   somvalistGetTarget(va_list);
  151. SOMEXTERN void   SOMLINK  somvalistSetTarget(va_list, unsigned long);
  152. #endif /* SOMVABUF */
  153.  
  154. #pragma SOMAsDefault (pop)
  155.  
  156. #endif /* SOMTC_hh */
  157.