home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / dtswps.zip / DTSFILES.ZIP / SOMOBJ.IDL < prev    next >
Text File  |  1996-06-24  |  18KB  |  490 lines

  1. //#
  2. //#   COMPONENT_NAME: somk
  3. //#
  4. //#   ORIGINS: 27
  5. //#
  6. //#
  7. //#    25H7912  (C)  COPYRIGHT International Business Machines Corp. 1992,1994,1996 
  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.27.3.9 src/somk/somobj.idl, somk.so, som2.1 3/25/96 19:45:42 [6/24/96 08:12:14]
  14. //#
  15. //#  SOMObject: System Object Model root class
  16.  
  17. #ifndef somobj_idl
  18. #define somobj_idl
  19.  
  20. interface SOMClass;
  21. interface SOMObject;
  22.  
  23. #ifdef __SOMIDL__
  24. typedef void* somToken;
  25. // A somToken is word-sized data whose type and use is private.
  26. #else
  27. typedef unsigned long somToken
  28. // A somToken is word-sized data whose type and use is private.
  29. #endif
  30.  
  31. //#  We define SOMFOREIGN as an anchor within the IDL type system for
  32. //#  "foreign" types that are not expressible in IDL.  Foreign types
  33. //#  can be used at a class implementer's discretion, but we discourage
  34. //#  their use except within "private" sections of an IDL definition.
  35. //#  If you decide to define a foreign type, you must do so by setting
  36. //#  up a typedef for it and then supplying an "impctx" modifier (within
  37. //#  your implementation section) that designates the implementation
  38. //#  context where your type is understood.  You can also optionally
  39. //#  supply a "length" modifier that indicates the number of bytes
  40. //#  needed to hold an instance of the foreign type.  The FILE type
  41. //#  below is an example of a foreign type useful in C programming.
  42. //#  The impctx modifier is attached to the FILE type in the SOMObject
  43. //#  implementation section.
  44. //#
  45. #ifndef _SOMFOREIGN_DEFINED_
  46.   #define _SOMFOREIGN_DEFINED_
  47.   typedef somToken SOMFOREIGN;
  48. #endif /* !_SOMFOREIGN_DEFINED_ */
  49.  
  50. typedef SOMFOREIGN FILE;
  51. #pragma modifier FILE: impctx = C, length = 0;
  52.  
  53. typedef SOMFOREIGN va_list;
  54. //  "va_list" is used to represent a standard parameter list constructed
  55. //  by a caller for functions or methods that can accept a variable number
  56. //  of arguments.
  57. #pragma modifier va_list: impctx = C;
  58.  
  59. typedef SOMFOREIGN SOMHANDLE;
  60. //  "SOMHANDLE" is used within SOM to represent arguments whose value
  61. //  is uninterpretted.
  62. #pragma modifier SOMHANDLE: impctx = SOM;
  63.  
  64. typedef SOMFOREIGN somId;
  65. #pragma modifier somId: impctx = "SOM,static(somIdMarshal,0)";
  66. //  "somId" is used to refer to the efficient case-insensitive string
  67. //  representation used by many SOM run-time methods.
  68.  
  69. enum TCKind {
  70.     tk_null, tk_void,
  71.     tk_short, tk_long, tk_ushort, tk_ulong,
  72.     tk_float, tk_double, tk_boolean, tk_char,
  73.     tk_octet, tk_any, tk_TypeCode, tk_Principal, tk_objref,
  74.     tk_struct, tk_union, tk_enum, tk_string,
  75.     tk_sequence, tk_array,
  76.  
  77.     /* SOM extensions follow: */
  78.     tk_pointer, /* tk_pointer takes a parameter list with 1 argument:  */
  79.                 /* tk_pointer {TypeCode} - The TypeCode describes the  */
  80.                 /* type that the pointer references.                   */
  81.     tk_self,    /* tk_self takes a parameter list with 1 argument:     */
  82.                 /* tk_self {name} - The name refers to an enclosing    */
  83.                 /* struct or union.  This type, when combined with     */
  84.                 /* tk_pointer above, permits the existence of self-    */
  85.                 /* -referential pointers in a struct or union.         */
  86.     tk_foreign  /* tk_foreign takes a parameter list with 2 arguments: */
  87.                 /* tk_foreign {context, length} - The context is a     */
  88.                 /* string that designates an implementation domain     */
  89.                 /* where the foreign type is understood.  The length   */
  90.                 /* parameter is optional, but if supplied indicates    */
  91.                 /* the size of an instance of the type.                */
  92. };
  93. //  Kinds of TypeCodes, per CORBA 1.1, p.139
  94.  
  95. //#
  96. //# Other useful definitions
  97. //#
  98.  
  99. //#  A value large enough to be used in typedefs for character
  100. //#  arrays that need to be able to hold the largest legal file name.
  101. #define FILENAME_MAX 260
  102.  
  103. typedef octet uchar_t;
  104. //  Provide the type "uchar_t".
  105.  
  106. typedef unsigned long size_t;
  107. //  Provide the type "size_t".
  108.  
  109. typedef octet signed_char;
  110.  
  111. typedef long int;
  112. //  Provide the type "int".
  113. //  Although the mapping of a user-defined type named "int" to the
  114. //  IDL type long, given here, is both binary and source compatible
  115. //  on AIX and OS/2 2.x, it is still bad form, since the C type "int"
  116. //  can vary from platform to platform.  This is here only for migration
  117. //  of OIDL to IDL.  All new IDL files should explicitly select long or
  118. //  short (as appropriate) instead of "int."
  119.  
  120. //#
  121. //#  Types defined only for compatibility with SOM Release 1
  122. //#
  123. typedef char integer1;
  124. typedef short integer2;
  125. typedef unsigned short uinteger2;
  126. typedef long integer4;
  127. typedef unsigned long uinteger4;
  128. typedef float float4;
  129. typedef double float8;
  130. typedef string zString;                 /* NULL terminated string */
  131. typedef string fString;                 /* non-terminated string  */
  132.  
  133. //# The following typedefs are based on somapi.h and somcorba.h, which
  134. //# define the published API form of internal SOM data structures.
  135. //# We provide these typedefs here in their IDL form primarily to
  136. //# satisfy the IDL compiler, which requires that all methods declared
  137. //# using IDL have known argument types. Also, as a result of this
  138. //# approach, the interface repository will contain the "public" types
  139. //# for SOM internal data structures -- not the actual types.
  140.  
  141. // -- Special procedure pointer types */
  142. typedef somToken somMethodProc;
  143. typedef somToken somMethodPtr;
  144.  
  145. struct somMethodTab {
  146.     SOMClass classObject;
  147. };
  148. // -- Public Method Table Structure */
  149.  
  150. struct SOMAny {
  151.     somMethodTab  *mtab;
  152. };
  153. //  -- Public Object Instance Structure */
  154.  
  155. //# -- Public Method and Data Tokens */
  156. typedef somToken somMToken;
  157. typedef somToken somMLocator;
  158. typedef somToken somDToken;
  159. typedef somToken somDLocator;
  160. typedef somToken somClassInfo;
  161. typedef somToken SOMTokBuf;
  162.  
  163. struct somGenericCtrl {
  164.         somToken mask;
  165.         somToken info;
  166.         long     infoSize;
  167.         somToken ctrlInfo;
  168. };
  169. // -- Public InitCtrl Structs -- */
  170. typedef somGenericCtrl som3InitCtrl;
  171. typedef somGenericCtrl som3DestructCtrl;
  172. typedef somGenericCtrl som3AssignCtrl;
  173.  
  174. //# legacy support for old IDL */
  175. typedef somGenericCtrl somInitCtrl;
  176. typedef somGenericCtrl somDestructCtrl;
  177. typedef somGenericCtrl somAssignCtrl;
  178.  
  179. typedef unsigned long somRdAppType; /* method signature encoding */
  180.  
  181. struct somMethodInfo {
  182.     somRdAppType       callType;
  183.     long               va_listSize;
  184.     unsigned long      *float_map;
  185. } ;
  186.  
  187. typedef struct somMethodDataStruct {
  188.     somId id;
  189.     long type;                    /* 0=static, 1=dynamic, 2=nonstatic */
  190.     somId descriptor;             /* for use with IR interfaces */
  191.     somMToken mToken;             /* NULL for dynamic methods */
  192.     somMethodPtr method;          /* depends on resolution context */
  193.     somToken *shared;
  194. } somMethodData;
  195. // -- Public Method descriptor structure */
  196.  
  197. struct somObjectList {
  198.     SOMObject cls;
  199.     somObjectList *next;
  200. };
  201. // -- For building lists of objects */
  202. typedef somObjectList *somObjects;
  203.  
  204. struct somClassList {
  205.     SOMClass cls;
  206.     somClassList *next;
  207. };
  208. // -- For building lists of class objects */
  209. typedef somClassList *somClasses;
  210.  
  211. struct somMethodTabList {
  212.     somMethodTab      *mtab;
  213.     somMethodTabList  *next;
  214. };
  215. // -- For building lists of method tables */
  216. typedef somMethodTabList *somMethodTabs;
  217. typedef somMethodTabList *somParentMtabStructPtr;
  218.  
  219. struct somClassDataStructure {
  220.     SOMClass classObject;
  221.     somToken tokens[1];
  222. };
  223. // -- Generic ClassData structure */
  224.  
  225. struct somCClassDataStructure {
  226.     somMethodTabs parentMtab;
  227.     somDToken instanceDataToken;
  228.     somMethodPtr ptrs[1];
  229. };
  230. // -- Generic Auxiliary Class Data Structure */
  231. typedef somCClassDataStructure *somCClassDataStructurePtr;
  232.  
  233. typedef octet *somBooleanVector;
  234.  
  235. enum exception_type { NO_EXCEPTION, USER_EXCEPTION, SYSTEM_EXCEPTION };
  236. // exception enum constants found in somcorba.h
  237.  
  238. struct Environment {
  239.     exception_type major;  // use somcorba.h exception_type values
  240.     octet opaque_data[12]; // #2990
  241. };
  242.  
  243. //#
  244. //#
  245. //#-------------------------------------------------------------
  246. //# SOMObject Interface Definition
  247. //#
  248.  
  249.  
  250. interface SOMObject
  251. // This is the SOM root class, all SOM classes must be descended from
  252. // <SOMObject>. <SOMObject> has no instance data so there is no
  253. // per-instance cost to to being descended from it.
  254.  
  255. {
  256.  
  257.   //### Typedefs
  258.  
  259.   typedef sequence <SOMObject> SOMObjectSequence;
  260.   // a sequence of SOM Objects
  261.  
  262.   typedef sequence <octet> BooleanSequence;
  263.   // a sequence of booleans.
  264.  
  265.   struct somObjectOffset {
  266.      SOMObject obj;
  267.      long     offset;
  268.   };
  269.   // a structure to describe an object-related offset
  270.   typedef sequence <somObjectOffset> somObjectOffsets;
  271.   // a sequence of object-related offsets
  272.  
  273.  
  274.   //###  Initialization / Termination
  275.  
  276.   void somDefaultInit(in som3InitCtrl *ctrl);
  277.   // A default initializer for a SOM object. Passing a null ctrl
  278.   // indicates to the receiver that its class is the class of the
  279.   // object being initialized, whereby the initializer will determine
  280.   // an appropriate control structure.
  281.  
  282.   void somDestruct(in octet doFree, in som3DestructCtrl *ctrl);
  283.   // The default destructor for a SOM object. A nonzero <doFree>
  284.   // indicates that the object storage should be freed by the
  285.   // object's class (via somDeallocate) after uninitialization.
  286.   // As with somDefaultInit, a null ctrl can be passed.
  287.  
  288.   void somDefaultCopyInit(in som3InitCtrl *ctrl, in SOMObject fromObj);
  289.   // A default copy constructor. Use this to make copies of objects for
  290.   // calling methods with "by-value" argument semantics.
  291.  
  292.   SOMObject somDefaultAssign(in som3AssignCtrl *ctrl, in SOMObject fromObj);
  293.   // A default assignment operator. Use this to "assign" the state of one
  294.   // object to another.
  295.  
  296.   //### etc.
  297.  
  298.   void somDefaultConstCopyInit(in som3InitCtrl *ctrl, in SOMObject fromObj);
  299.   // A default copy constructor that uses a const fromObj.
  300.  
  301.   void somDefaultVCopyInit(in som3InitCtrl *ctrl, in SOMObject fromObj);
  302.   // A default copy constructor that uses a volatile fromObj.
  303.  
  304.   void somDefaultConstVCopyInit(in som3InitCtrl *ctrl, in SOMObject fromObj);
  305.   // A default copy constructor that uses a const volatile fromObj.
  306.  
  307.   SOMObject somDefaultConstAssign(in som3AssignCtrl *ctrl,
  308.                                   in SOMObject fromObj);
  309.   // A default assignment operator that uses a const fromObj.
  310.  
  311.   SOMObject somDefaultVAssign(in som3AssignCtrl *ctrl, in SOMObject fromObj);
  312.   // A default assignment operator that uses a volatile fromObj.
  313.  
  314.   SOMObject somDefaultConstVAssign(in som3AssignCtrl *ctrl,
  315.                                    in SOMObject fromObj);
  316.   // A default assignment operator that uses a const volatile fromObj.
  317.  
  318.   void somInit();
  319.   // Obsolete but still supported. Override somDefaultInit instead of somInit.
  320.  
  321.   void somFree();
  322.   // Use as directed by framework implementations.
  323.  
  324.   void somUninit();
  325.   // Obsolete but still supported. Override somDestruct instead of somUninit.
  326.  
  327.   //### Access
  328.  
  329.   SOMClass somGetClass();
  330.   // Return the receiver's class.
  331.  
  332.   string somGetClassName();
  333.   // Return the name of the receiver's class.
  334.  
  335.   long somGetSize();
  336.   // Return the size of the receiver.
  337.  
  338.   //### Testing Group
  339.  
  340.   boolean somIsA(in SOMClass aClassObj);
  341.   // Returns 1 (true) if the receiver responds to methods
  342.   // introduced by <aClassObj>, and 0 (false) otherwise.
  343.  
  344.   boolean somIsInstanceOf(in SOMClass aClassObj);
  345.   // Returns 1 (true) if the receiver is an instance of
  346.   // <aClassObj> and 0 (false) otherwise.
  347.  
  348.   boolean somRespondsTo(in somId mId);
  349.   // Returns 1 (true) if the indicated method can be invoked
  350.   // on the receiver and 0 (false) otherwise.
  351.  
  352.   //### Dynamic
  353.  
  354.   boolean somDispatch(out somToken retValue,
  355.                    in somId methodId,
  356.                    in va_list ap);
  357.   // This method provides a generic, class-specific dispatch mechanism.
  358.   // It accepts as input <retValue> a pointer to the memory area to be
  359.   // loaded with the result of dispatching the method indicated by
  360.   // <methodId> using the arguments in <ap>. <ap> contains the object
  361.   // on which the method is to be invoked as the first argument.
  362.  
  363.   boolean somClassDispatch(in SOMClass clsObj,
  364.                         out somToken retValue,
  365.                         in somId methodId,
  366.                         in va_list ap);
  367.   // Like somDispatch, but method resolution for static methods is done
  368.   // according to the clsObj instance method table.
  369.  
  370.  
  371.   boolean somCastObj(in SOMClass cls);
  372.   // cast the receiving object to cls (which must be an ancestor of the
  373.   // objects true class. Returns true on success.
  374.  
  375.   boolean somResetObj();
  376.   // reset an object to its true class. Returns true always.
  377.  
  378.  
  379.   void somDispatchV(in somId methodId,
  380.                     in somId descriptor,
  381.                     in va_list ap);
  382.   // Obsolete. Use somDispatch instead.
  383.  
  384.   long somDispatchL(in somId methodId,
  385.                     in somId descriptor,
  386.                     in va_list ap);
  387.   // Obsolete. Use somDispatch instead.
  388.  
  389.   void* somDispatchA(in somId methodId,
  390.                      in somId descriptor,
  391.                      in va_list ap);
  392.   // Obsolete. Use somDispatch instead.
  393.  
  394.   double somDispatchD(in somId methodId,
  395.                       in somId descriptor,
  396.                       in va_list ap);
  397.   // Obsolete. Use somDispatch instead.
  398.  
  399.   //### Development Support
  400.  
  401.   SOMObject somPrintSelf();
  402.   // Uses <SOMOutCharRoutine> to write a brief string with identifying
  403.   // information about this object.  The default implementation just gives
  404.   // the object's class name and its address in memory.
  405.   // <self> is returned.
  406.  
  407.   void somDumpSelf(in long level);
  408.   // Uses <SOMOutCharRoutine> to write a detailed description of this object
  409.   // and its current state.
  410.   //
  411.   // <level> indicates the nesting level for describing compound objects
  412.   // it must be greater than or equal to zero.  All lines in the
  413.   // description will be preceeded by <2*level> spaces.
  414.   //
  415.   // This routine only actually writes the data that concerns the object
  416.   // as a whole, such as class, and uses <somDumpSelfInt> to describe
  417.   // the object's current state.  This approach allows readable
  418.   // descriptions of compound objects to be constructed.
  419.   //
  420.   // Generally it is not necessary to override this method, if it is
  421.   // overriden it generally must be completely replaced.
  422.  
  423.   void somDumpSelfInt(in long level);
  424.   // Uses <SOMOutCharRoutine> to write in the current state of this object.
  425.   // Generally this method will need to be overridden.  When overriding
  426.   // it, begin by calling the parent class form of this method and then
  427.   // write in a description of your class's instance data. This will
  428.   // result in a description of all the object's instance data going
  429.   // from its root ancestor class to its specific class.
  430.  
  431.  
  432. #ifdef __SOMIDL__
  433.   implementation {
  434.     releaseorder: somInit,somUninit,somFree,somDefaultVCopyInit,
  435.                   somGetClassName,somGetClass,somIsA,somRespondsTo,
  436.                   somIsInstanceOf,somGetSize,somDumpSelf,somDumpSelfInt,
  437.                   somPrintSelf,somDefaultConstVCopyInit,somDispatchV,
  438.                   somDispatchL,somDispatchA,
  439.                   somDispatchD,somDispatch,somClassDispatch,
  440.                   somCastObj, somResetObj, somDefaultInit, somDestruct,
  441.                   somPrivate1, somPrivate2,
  442.                   somDefaultCopyInit, somDefaultConstCopyInit, somDefaultAssign,
  443.                   somDefaultConstAssign, somDefaultVAssign,
  444.                   somDefaultConstVAssign;
  445.  
  446.  
  447.     // Class Modifiers
  448.     callstyle = oidl;
  449.     externalstem = somob;
  450.     majorversion = 1;
  451. #ifndef SOMPCALL
  452.     minorversion = 5; // for som2.5 kernel
  453. #else
  454.     minorversion = 6; // for som2.5 kernel with pcall
  455. #endif
  456.     filestem = somobj;
  457.     dllname = "som.dll";
  458.  
  459.     // Public Method Modifiers
  460.     somDefaultInit: init;
  461.     somDefaultCopyInit: init;
  462.     somDefaultConstCopyInit: init;
  463.     somDefaultVCopyInit: init;
  464.     somDefaultConstVCopyInit: init;
  465.  
  466.     somDefaultInit: caller_owns_parameters = "ctrl";
  467.     somDestruct: caller_owns_parameters = "ctrl";
  468.     somDefaultCopyInit: caller_owns_parameters = "ctrl";
  469.     somDefaultAssign: caller_owns_parameters = "ctrl";
  470.     somDefaultConstCopyInit: caller_owns_parameters = "ctrl";
  471.     somDefaultVCopyInit: caller_owns_parameters = "ctrl";
  472.     somDefaultConstVCopyInit: caller_owns_parameters = "ctrl";
  473.     somDefaultConstAssign: caller_owns_parameters = "ctrl";
  474.     somDefaultVAssign: caller_owns_parameters = "ctrl";
  475.     somDefaultConstVAssign: caller_owns_parameters = "ctrl";
  476.     somRespondsTo: caller_owns_parameters = "mId";
  477.     somDispatch: caller_owns_parameters = "methodId, ap";
  478.     somClassDispatch: caller_owns_parameters = "methodId, ap";
  479.     somDispatchV: caller_owns_parameters = "methodId, descriptor, ap";
  480.     somDispatchL: caller_owns_parameters = "methodId, descriptor, ap";
  481.     somDispatchA: caller_owns_parameters = "methodId, descriptor, ap";
  482.     somDispatchD: caller_owns_parameters = "methodId, descriptor, ap";
  483.  
  484.  
  485.   };
  486. #endif /* __SOMIDL__ */
  487. };
  488.  
  489. #endif  /* somobj_idl */
  490.