home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / warptlk3.zip / TOOLKIT / SOM / INCLUDE / SOMTC.H < prev    next >
C/C++ Source or Header  |  1995-08-24  |  6KB  |  163 lines

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