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

  1. /* @(#) 1.44 src/somk/somapi.h, somk.api, som3.0 5/31/96 17:54:14 [12/24/96 07:40:17] */
  2.  
  3. /*
  4.  * 96F8647, 96F8648, 96F8850 (C) Copyright IBM Corp. 1992, 1994
  5.  * All Rights Reserved
  6.  * Licensed Materials - Property of IBM
  7.  */
  8.  
  9. /*
  10.  *  SOMAPI.H
  11.  *
  12.  *  This file documents the public data structures and functions
  13.  *  of the SOM API (Application Programming Interface). Primitive data
  14.  *  types are defined in sombtype.h, and the public methods provided by
  15.  *  the SOM kernel are declared in somobj.idl, somcls.idl and somcm.idl.
  16.  *  An important header file for language bindings is somdefs.h, which
  17.  *  defines the SOMLINK symbol used in various emitter outputs.
  18.  *
  19.  *  Note: typedefs & prototypes in this file explicitly show pointers
  20.  *  to objects that support an interface described by IDL. These are
  21.  *  C/C++ typedefs that reflect the implementation of object references
  22.  *  in SOM as pointers to structures in memory.
  23.  */
  24.  
  25.  /*
  26.   * HISTORY [04/19/96] #21264 nsk Temproary ADD WIN32 Code
  27.   */
  28.  
  29.  
  30. #ifndef somapi_h
  31. #define somapi_h
  32.  
  33. #if !defined(SOM_DLL_som)
  34. #define SOMAPI_IMPORT SOMDLLIMPORT
  35. #else
  36. #define SOMAPI_IMPORT
  37. #endif
  38.  
  39. /*  SOM Version Numbers  */
  40. SOMEXTERN SOMAPI_IMPORT long SOMDLINK SOM_MajorVersion;
  41. SOMEXTERN SOMAPI_IMPORT long SOMDLINK SOM_MinorVersion;
  42.  
  43. /*  SOM Thread Support  */
  44. SOMEXTERN SOMAPI_IMPORT long SOMDLINK SOM_MaxThreads;
  45.  
  46. /*----------------------------------------
  47.  * Typedefs for pointers to functions
  48.  *----------------------------------------*/
  49.  
  50. typedef int SOMLINK somTD_SOMOutCharRoutine (IN char);
  51. typedef int SOMLINK somTD_SOMLoadModule (
  52.     IN string /* className */,
  53.     IN string /* fileName */,
  54.     IN string /* functionName */,
  55.     IN long   /* majorVersion */,
  56.     IN long   /* minorVersion */,
  57.     OUT somToken * /* modHandle */);
  58. typedef int SOMLINK somTD_SOMDeleteModule (IN somToken /* modHandle */);
  59. typedef string SOMLINK somTD_SOMClassInitFuncName (void);
  60. typedef somToken SOMLINK somTD_SOMMalloc (IN size_t /* nbytes */);
  61. typedef somToken SOMLINK somTD_SOMCalloc (
  62.     IN size_t /* element_count */,
  63.     IN size_t /* element_size */);
  64. typedef somToken SOMLINK somTD_SOMRealloc (
  65.     IN somToken /* memory */,
  66.     IN size_t   /* nbytes */);
  67. typedef void SOMLINK somTD_SOMFree (IN somToken /* memory */);
  68. typedef void SOMLINK somTD_SOMError (
  69.     IN int     /* code */,
  70.     IN string  /* fileName */,
  71.     IN int     /* lineNum */);
  72.  
  73.  
  74. typedef unsigned long SOMLINK somTD_SOMCreateMutexSem (OUT somToken *sem);
  75. typedef unsigned long SOMLINK somTD_SOMRequestMutexSem (IN somToken sem);
  76. typedef unsigned long SOMLINK somTD_SOMReleaseMutexSem (IN somToken sem);
  77. typedef unsigned long SOMLINK somTD_SOMDestroyMutexSem (IN somToken sem);
  78. typedef unsigned long SOMLINK somTD_SOMGetThreadId (void);
  79.  
  80.  
  81. /*----------------------------------------------------------------------
  82.  * SOM Environment Initialization Section
  83.  *---------------------------------------------------------------------*/
  84.  
  85. /*
  86.  *  Create and initialize the SOM environment.
  87.  *
  88.  *  This function is idempotent (may be invoked redundantly)
  89.  *
  90.  *  Will be called automatically when first object (including a class
  91.  *  object) is created, if it has not already been done.
  92.  *
  93.  *  Returns the SOMClassMgrObject
  94.  */
  95. SOMEXTERN SOMClassMgr * SOMLINK somEnvironmentNew (void);
  96.  
  97. SOMEXTERN void          SOMLINK somEnvironmentEnd (void);
  98. SOMEXTERN SOMClassMgr * SOMLINK somMainProgram (void);
  99. SOMEXTERN boolean       SOMLINK somAbnormalEnd (void);
  100.  
  101. /*
  102.  *  Replaceable SOM Memory Management Interfaces
  103.  *
  104.  *  External procedure variables SOMCalloc, SOMFree, SOMMalloc, SOMRealloc
  105.  *  have the same interface as their standard C-library analogs.
  106.  */
  107. SOMEXTERN SOMAPI_IMPORT somTD_SOMCalloc  * SOMDLINK SOMCalloc;
  108. SOMEXTERN SOMAPI_IMPORT somTD_SOMFree    * SOMDLINK SOMFree;
  109. SOMEXTERN SOMAPI_IMPORT somTD_SOMMalloc  * SOMDLINK SOMMalloc;
  110. SOMEXTERN SOMAPI_IMPORT somTD_SOMRealloc * SOMDLINK SOMRealloc;
  111.  
  112. /*
  113.  *  Replaceable SOM Error handler
  114.  */
  115. SOMEXTERN SOMAPI_IMPORT somTD_SOMError * SOMDLINK SOMError;
  116.  
  117. /*
  118.  *  Replaceable SOM Semaphore Operations
  119.  *
  120.  *  These operations are used by the SOM Kernel to make thread-safe
  121.  *  state changes to internal resources and for synchronization between
  122.  *  the SOM services process and client SOM processes.
  123.  */
  124. SOMEXTERN SOMAPI_IMPORT somTD_SOMCreateMutexSem  * SOMDLINK SOMCreateMutexSem;
  125. SOMEXTERN SOMAPI_IMPORT somTD_SOMRequestMutexSem * SOMDLINK SOMRequestMutexSem;
  126. SOMEXTERN SOMAPI_IMPORT somTD_SOMReleaseMutexSem * SOMDLINK SOMReleaseMutexSem;
  127. SOMEXTERN SOMAPI_IMPORT somTD_SOMDestroyMutexSem * SOMDLINK SOMDestroyMutexSem;
  128.  
  129. /*
  130.  * 18260 -- other thread-related routines used by the kernel were
  131.  * moved to somkp.h, to keep them local to the kernel.
  132.  */
  133.  
  134. /*
  135.  *  Replaceable SOM Thread Identifier Operation
  136.  *
  137.  *  This operation is used by the SOM Kernel to index data unique to the
  138.  *  currently executing thread.  It must return a small integer that
  139.  *  uniquely represents the current thread within the current process.
  140.  */
  141. SOMEXTERN SOMAPI_IMPORT somTD_SOMGetThreadId * SOMDLINK SOMGetThreadId;
  142.  
  143.  
  144. /*----------------------------------------------------------------------
  145.  * SOM Class Manager Section
  146.  *---------------------------------------------------------------------*/
  147.  
  148. /*
  149.  * Global class manager object
  150.  */
  151. SOMEXTERN SOMAPI_IMPORT SOMClassMgr * SOMDLINK SOMClassMgrObject;
  152.  
  153. /*
  154.  * The somRegisterClassLibrary function is provided for use in SOM class
  155.  * libraries on platforms that have loader-invoked entry points
  156.  * associated with shared libraries (DLLs).
  157.  *
  158.  * This function registers a SOM Class Library with the SOM Kernel.
  159.  * The library is identified by its file name and a pointer to its
  160.  * initialization routine.  Since this call may occur prior to the
  161.  * invocation of somEnvironmentNew, its actions are deferred until the
  162.  * SOM environment has been initialized.  At that time, the
  163.  * SOMClassMgrObject is informed of all pending library initializations
  164.  * via the _somRegisterClassLibrary method.  The actual invocation of
  165.  * the library's initialization routine will occur during the execution
  166.  * of the SOM_MainProgram macro (for statically linked libraries), or
  167.  * during the _somFindClass method (for libraries that are dynamically
  168.  * loaded).
  169.  */
  170. SOMEXTERN void SOMLINK somRegisterClassLibrary (
  171.     string libraryName,
  172.     somMethodProc *libraryInitRtn);
  173. SOMEXTERN void SOMLINK somUnregisterClassLibrary (string libraryName);
  174.  
  175. /*
  176.  * Pointers to routines used to do dynamic code loading and deleting
  177.  */
  178. SOMEXTERN SOMAPI_IMPORT somTD_SOMLoadModule        * SOMDLINK SOMLoadModule;
  179. SOMEXTERN SOMAPI_IMPORT somTD_SOMDeleteModule      * SOMDLINK SOMDeleteModule;
  180. SOMEXTERN SOMAPI_IMPORT somTD_SOMClassInitFuncName * SOMDLINK SOMClassInitFuncName;
  181.  
  182.  
  183. /*----------------------------------------------------------------------
  184.  * SOM Stream Output Section
  185.  *---------------------------------------------------------------------*/
  186.  
  187. /*
  188.  * Uses <SOMOutCharRoutine> to output its arguments under control of the
  189.  * ANSI C style format.  Returns the number of characters output.
  190.  */
  191. SOMEXTERN int SOMLINK somPrintf (string fmt, ...);
  192.  
  193. /*
  194.  * vprint form of somPrintf
  195.  */
  196. SOMEXTERN int SOMLINK somVprintf (string fmt, va_list ap);
  197.  
  198. /*
  199.  * Outputs (via somPrintf) blanks to prefix a line at the indicated level
  200.  */
  201. SOMEXTERN void SOMLINK somPrefixLevel (long level);
  202.  
  203. /*
  204.  * Combines somPrefixLevel and somPrintf
  205.  */
  206. SOMEXTERN int SOMLINK somLPrintf (int level, string fmt, ...);
  207.  
  208. /*
  209.  * Specify a thread-specific user-defined SOMOutCharRoutine
  210.  */
  211. SOMEXTERN void SOMLINK somSetOutChar (somTD_SOMOutCharRoutine *outch);
  212.  
  213. /*
  214.  *  Replaceable character output handler.
  215.  *  Points to the character output routine to be used in development
  216.  *  support.  Initialized to <somOutChar>, but may be reset at anytime.
  217.  *  Should return 0 (false) if an error occurs and 1 (true) otherwise.
  218.  */
  219. SOMEXTERN SOMAPI_IMPORT somTD_SOMOutCharRoutine * SOMDLINK SOMOutCharRoutine;
  220.  
  221.  
  222. /*--------------
  223.  * Initializers
  224.  *--------------*/
  225.  
  226. #ifndef SOM_CTI_DEFINED
  227. /*
  228.  * C++-style constructors are called initializers in SOM. Initializers
  229.  * are methods that receive a pointer to a somCtrlStruct as an argument.
  230.  * Language bindings hide details associated with manipulating the following
  231.  * data structures.
  232.  */
  233. typedef  struct  {
  234.     SOMClass      *cls; /* class whose introduced data is to be initialized */
  235.     somMethodProc *defaultInit;
  236.     somMethodProc *defaultCopyInit;
  237.     somMethodProc *defaultConstCopyInit;
  238.     somMethodProc *defaultNCArgCopyInit;
  239.     long          dataOffset;
  240.     somMethodProc *legacyInit;
  241. } somInitInfo;
  242.  
  243. typedef struct {
  244.     SOMClass      *cls; /* class whose introduced data is to be destroyed */
  245.     somMethodProc *defaultDestruct;
  246.     long          dataOffset;
  247.     somMethodProc *legacyUninit;
  248. } somDestructInfo;
  249.  
  250. typedef struct {
  251.     SOMClass      *cls; /* class whose introduced data is to be assigned */
  252.     somMethodProc *defaultAssign;
  253.     somMethodProc *defaultConstAssign;
  254.     somMethodProc *defaultNCArgAssign;
  255.     somMethodProc *udaAssign;
  256.     somMethodProc *udaConstAssign;
  257.     long          dataOffset;
  258. } somAssignInfo;
  259.  
  260. typedef octet *somBooleanVector;
  261. typedef somToken somCtrlInfo;
  262.  
  263. typedef struct somInitCtrlStruct {
  264.     somBooleanVector mask; /* an array of booleans to control ancestor calls */
  265.     somInitInfo     *info; /* an array of structs */
  266.     int              infoSize; /* increment for info access */
  267.     somCtrlInfo      ctrlInfo;
  268. } somInitCtrl,som3InitCtrl;
  269.  
  270. typedef struct somDestructCtrlStruct {
  271.     somBooleanVector  mask; /* an array of booleans to control ancestor calls */
  272.     somDestructInfo  *info; /* an array of structs */
  273.     int               infoSize; /* increment for info access */
  274.     somCtrlInfo       ctrlInfo;
  275. } somDestructCtrl,som3DestructCtrl;
  276.  
  277. typedef struct somAssignCtrlStruct {
  278.     somBooleanVector  mask; /* an array of booleans to control ancestor calls */
  279.     somAssignInfo    *info; /* an array of structs */
  280.     int               infoSize; /* increment for info access */
  281.     somCtrlInfo       ctrlInfo;
  282. } somAssignCtrl,som3AssignCtrl;
  283. #endif
  284.  
  285. /*-----------------------------------------------
  286.  * Common Typedefs & Data Structures for SOM
  287.  *----------------------------------------------*/
  288.  
  289. /*
  290.  *  The Method Table Structure
  291.  */
  292. #ifndef SOM_MTAB_DEFINED
  293. /* -- to specify an embedded object (or array of objects). */
  294. typedef struct {
  295.     SOMClass     **copp; /* address of class object ptr */
  296.     long         cnt;    /* object count */
  297.     long         offset; /* Offset to pointer (to embedded objs) */
  298. } somEmbeddedObjStruct, *somEmbeddedObjStructPtr;
  299.  
  300. #ifndef SOM_CLASSINFO_DEFINED
  301. typedef somToken somClassInfo;
  302. #endif
  303.  
  304. #ifndef SOM_MDT_DEFINED
  305. /* -- Method/Data Tokens -- For locating methods and data members. */
  306. typedef somToken somMToken;
  307. typedef somToken somDToken;
  308. #endif
  309.  
  310. typedef struct somMethodTabStruct {
  311.     SOMClass        *classObject;
  312.     somClassInfo    *classInfo;
  313.     char            *className;
  314.     long            instanceSize; /* free */
  315.     long            dataAlignment;
  316.     long            mtabSize; /* free */
  317.     long            protectedDataOffset; /* from class's introduced data */
  318.     somDToken       protectedDataToken;
  319.     somEmbeddedObjStruct *embeddedObjs;
  320.     /* remaining structure is opaque */
  321.     somMethodProc* entries[1];
  322. } somMethodTab, *somMethodTabPtr;
  323. #endif
  324.  
  325. /* -- For building lists of class objects */
  326. typedef struct somClassList {
  327.     SOMClass   *cls;
  328.     struct somClassList *next;
  329. } somClassList, *somClasses;
  330.  
  331.  
  332. /* -- For building lists of objects */
  333. typedef struct somObjectList {
  334.     SOMObject   *obj;
  335.     struct somObjectList *next;
  336. } somObjectList, *somObjects;
  337.  
  338. #ifndef SOM_CLASSDATA_DEFINED
  339. /*
  340.  * The Class Data Structures -- these are used to implement static
  341.  * method and data interfaces to SOM objects.
  342.  */
  343. /* -- (Generic) Class data Structure */
  344. typedef struct somClassDataStruct {
  345.     SOMClass *classObject; /* changed by shadowing */
  346.     somToken tokens[1];    /* method tokens, etc. */
  347. } somClassDataStructure, *somClassDataStructurePtr;
  348.  
  349.  
  350. /*
  351.  * A special info access structure pointed to by
  352.  * the parentMtab entry of somCClassDataStructure.
  353.  */
  354. typedef void SOMLINK somTP_somRenewNoInitNoZeroThunk(void*);
  355. typedef somTP_somRenewNoInitNoZeroThunk *somTD_somRenewNoInitNoZeroThunk;
  356. struct SOM_CIB;
  357. typedef struct som3ClassDetailsStruct {
  358.     somMethodTab    *mtab; /* this class' mtab -- changed by shadowing */
  359.     somMethodTabPtr *next; /* parentMtabs array */
  360.     struct SOM_CIB  *cib;
  361.     somTD_somRenewNoInitNoZeroThunk somRenewNoInitNoZeroThunk; /* changed by shadowing */
  362.     long            instanceSize;   /* changed by shadowing */
  363.     somMethodProc   **resolvedInits;/* resolved initializers in releaseorder */
  364.     somClassDataStructurePtr resolvedMTokens;   /* resolved methods for ABI2 */
  365.     somInitCtrl     initCtrl;
  366.     somDestructCtrl destructCtrl;
  367.     somAssignCtrl   assignCtrl;
  368.     long            layoutVersion;
  369.     void*           extension;
  370.     somDToken       publicDataToken;
  371.     somDToken       protectedDataToken;
  372.     long            instanceAlignment;
  373. } som3ClassDetails, *som3ClassDetailsPtr, *somMethodTabs,
  374.     *somParentMtabStructPtr; /* 22552 */
  375.  
  376. typedef struct som3ClassInfoStruct {
  377.     SOMClass             *classObject;
  378.     som3ClassDetailsPtr  classDetails;
  379. } som3ClassInfoStruct, *som3ClassInfoStructPtr;
  380.  
  381.  
  382. /*
  383.  * (Generic) Auxiliary Class Data Structure
  384.  */
  385. typedef struct somCClassDataStruct {
  386.     som3ClassDetailsPtr parentMtab; /* so named for historical reasons */
  387.     somDToken              instanceDataToken;
  388.     somMethodProc          *wrappers[1]; /* for valist methods */
  389. } somCClassDataStructure, *somCClassDataStructurePtr;
  390. #endif
  391.  
  392.  
  393. /*---------------------------------
  394.  * Method & Data Resolution
  395.  *--------------------------------*/
  396.  
  397. /*
  398.  * Offset-based method resolution functions
  399.  */
  400. SOMEXTERN somMethodProc * SOMLINK somResolve (SOMObject *obj,
  401.                                               somMToken mdata);
  402. SOMEXTERN somMethodProc * SOMLINK somPCallResolve(SOMObject *obj,
  403.                                                   SOMClass *callingCls,
  404.                                                   somMToken method);
  405. SOMEXTERN somMethodProc * SOMLINK somParentResolve (somMethodTabs parentMtabs,
  406.                                                     somMToken mToken);
  407. SOMEXTERN somMethodProc * SOMLINK somParentNumResolve (somMethodTabs parentMtabs,
  408.                                                        int parentNum,
  409.                                                        somMToken mToken);
  410. SOMEXTERN somMethodProc * SOMLINK somClassResolve (SOMClass *,
  411.                                                    somMToken mdata);
  412. SOMEXTERN somMethodProc * SOMLINK somResolveTerminal (SOMClass *,
  413.                                                       somMToken mdata);
  414. SOMEXTERN somMethodProc * SOMLINK somAncestorResolve (SOMObject *obj,/* the object */
  415.                                                       somCClassDataStructure *ccds, /* id the ancestor */
  416.                                                       somMToken mToken);
  417. SOMEXTERN somMethodProc * SOMLINK somResolveByName (SOMObject *obj,
  418.                                                     char *methodName);
  419.  
  420. /*
  421.  * Offset-based data resolution functions
  422.  */
  423. SOMEXTERN somToken SOMLINK somDataResolve (
  424.     SOMObject *obj,
  425.     somDToken dataId);
  426. SOMEXTERN somToken SOMLINK somDataResolveChk (
  427.     SOMObject *obj,
  428.     somDToken dataId);
  429.  
  430.  
  431. /*-----------------------------------
  432.  * Method Stubs -- Signature Support
  433.  *-----------------------------------*/
  434.  
  435. /*
  436.  * Moved from somplatf.h - was here originally
  437.  *
  438.  * This section defines the structures used to pass method signature
  439.  * info to the runtime. This supports selection of generic apply stubs
  440.  * and runtime generation of redispatchstubs when these are needed. The
  441.  * information is registered with the runtime when methods are defined.
  442.  *
  443.  * When calling somAddStaticMethod, if the redispatchStub is -1, then a
  444.  * pointer to a struct of type somApRdInfo is passed as the applyStub.
  445.  * Otherwise, the passed redispatchstub and applystub are taken as given.
  446.  * When calling somAddDynamicMethod, an actual apply stub must be passed.
  447.  * Redispatch stubs for dynamic methods are not available, nor is
  448.  * automated support for dynamic method apply stubs. The following
  449.  * atructures only appropriate in relation to static methods.
  450.  *
  451.  * In SOMr2, somAddStaticMethod can be called with an actual redispatchstub
  452.  * and applystub *ONLY* if the method doesn't return a structure. Recall
  453.  * that no SOMr1 methods returned structures, so SOMr1 binaries obey this
  454.  * restriction. The reason for this rule is that SOMr2 *may* use thunks,
  455.  * and thunks need to know if a structure is returned. We therefore assume
  456.  * that if no signature information is provided for a method through the
  457.  * somAddStaticMethod interface, then the method returns a scalar.
  458.  *
  459.  * If a structure is returned, then a -1 *must* be passed to
  460.  * somAddStaticMethod as a redispatchstub. In any case, if a -1 is passed,
  461.  * then this means that the applystub actually points to a structure of type
  462.  * somApRdInfo. This structure is used to hold and access signature
  463.  * information encoded as follows.
  464.  *
  465.  * If the somApRdInfo pointer is NULL, then, if the runtime was built with
  466.  * SOM_METHOD_STUBS defined, a default signature is assumed (no more than
  467.  * a specified number of arguments, and no structure returned -- see below);
  468.  * otherwise, the stubs are taken as somDefaultMethod (which produces a
  469.  * runtime error when used) if dynamic stubs are not available.
  470.  *
  471.  * If the somApRdInfo pointer is not NULL, then the structure it points to can
  472.  * either include (non-null) redispatch and applystubs (the method is then
  473.  * assumed to return a structure), or null stubs followed by information needed
  474.  * to generate necessary stubs dynamically.
  475.  */
  476.  
  477. typedef unsigned long somRdAppType; /* method signature code -- see def below */
  478. typedef unsigned long somFloatMap[13]; /* float map -- see def below */
  479. typedef struct somMethodInfoStruct {
  480.     somRdAppType       callType;
  481.     long               va_listSize;
  482.     somFloatMap        *float_map;
  483. } somMethodInfo, *somMethodInfoPtr;
  484.  
  485. typedef struct somApRdInfoStruct {
  486.     somMethodProc *rdStub;
  487.     somMethodProc *apStub;
  488.     somMethodInfo *stubInfo;
  489. } somApRdInfo;
  490.  
  491. /*
  492.  * Values for somRdAppType are generated by summing one from column A
  493.  * and one from column B of the following constants:
  494.  */
  495.  
  496. /* Column A: return type */
  497. #define SOMRdRetsimple     0 /* Return type is a non-float fullword */
  498. #define SOMRdRetfloat      2 /* Return type is (single) float */
  499. #define SOMRdRetdouble     4 /* Return type is double */
  500. #define SOMRdRetlongdouble 6 /* Return type is long double */
  501. #define SOMRdRetaggregate  8 /* Return type is struct or union */
  502. #define SOMRdRetbyte      10 /* Return type is a byte */
  503. #define SOMRdRethalf      12 /* Return type is a (2 byte) halfword */
  504. #define SOMRdRetsmallaggregate      14 /* Return type is a small struct or union */
  505.  
  506. /* Column B: are there any floating point scalar arguments? */
  507. #define SOMRdNoFloatArgs   0
  508. #define SOMRdFloatArgs     1
  509.  
  510. /*
  511.  * The float map is an array of offsets for up to the first 13 floating point
  512.  * arguments.  If there are fewer than 13 floating point arguments, then there
  513.  * will be zero entries following the non-zero entries which represent the
  514.  * float args.  A non-zero entry signals either a single- or a double-precision
  515.  * floating point argument.  For a double-precision argument, the entry is the
  516.  * stack frame offset.  For a single-precision argument the entry is the stack
  517.  * frame offset + 1.  For the final floating point argument, add 2 to the
  518.  * code that would otherwise be used.
  519.  */
  520. #define SOMFMSingle 1        /* add to indicate single-precision */
  521. #define SOMFMLast   2        /* add to indicate last floating point arg */
  522.  
  523.  
  524.  
  525. /*----------
  526.  * somApply
  527.  *----------*/
  528.  
  529. /*
  530.  * somApply replaces direct use of applyStubs in SOM 1.0. The reason
  531.  * for the replacement is that the SOM 1.0 style of applyStub is not
  532.  * generally available in SOM 2.0, which uses a fixed set of applyStubs
  533.  * according to method information in the somMethodData. In particular,
  534.  * neither the redispatch stub nor the apply stub found in the method
  535.  * data structure are necessarily useful as such. The method somGetRdStub
  536.  * is now the way to get a redispatch stub, and somApply is now the
  537.  * way to call an apply stub. If an appropriate apply stub for the
  538.  * method indicated by md is available, then this is invoked and TRUE is
  539.  * returned; otherwise FALSE is returned.
  540.  *
  541.  * The va_list passed to somApply *must* include the target object (often
  542.  * named somSelf) as its first entry, and any single precision floating point
  543.  * arguments being passed to the the method procedure must be represented on
  544.  * the va_list using double precision values (i.e. ANSI standard widening
  545.  * must have been done). retVal cannot be NULL even for methods that return void.
  546.  */
  547.  
  548. #ifndef SOM_MD_DEFINED
  549. typedef somToken somSharedMethodData;
  550.  
  551. typedef struct somMethodDataStruct {
  552.     somId id;
  553.     unsigned long type;            /* see method types below */
  554.     somId descriptor;              /* for use with IR interfaces */
  555.     somMToken mToken;              /* NULL for dynamic methods */
  556.     somMethodPtr method;           /* depends on resolution context */
  557.     somSharedMethodData *shared;   /* opaque pointer */
  558. } somMethodData, *somMethodDataPtr;
  559. #endif
  560.  
  561. SOMEXTERN boolean SOMLINK somApply (
  562.     SOMObject *somSelf,
  563.     somToken *retVal,
  564.     somMethodDataPtr mdPtr,
  565.     va_list ap);
  566. /*
  567.  * The somMethodData structure is used to specify a method to somApply, or
  568.  * simply to provide information to a user about a method. The class methods
  569.  * somGetMethodData and somGetNthMethodData load a somMethodData structure
  570.  * pointed to by an "out" paramter.
  571.  *
  572.  * Here is a discussion of the different types of method in SOM. To aid
  573.  * understanding, we compare with C++.
  574.  *
  575.  *       SOM                      C++                       Comments
  576.  *       ~~~                      ~~~                       ~~~~~~~~
  577.  *  dynamic method          < not available >           Dynamically Resolved (1)
  578.  *  static method           virtual member function     Dynamically Resolved (2)
  579.  *  nonstatic method        nonstatic member function   Statically Resolved  (3)
  580.  *  direct call procedure   static member function      Statically Resolved  (4)
  581.  *
  582.  * (1) Dynamic methods are resolved using name lookup -- by searching all
  583.  *     ancestors of a class in postorder -- to locate an implementation.
  584.  * (2) Static methods are resolved through the instance method table of a class
  585.  *     using a method token. The token for a static method may be located statically
  586.  *     based on the introducing class, or by using name lookup. A static method can
  587.  *     have only one entry in a method table, and only its introducing class can
  588.  *     provide a method token to select this entry.
  589.  * (3) Nonstatic methods are resolved through the instance method table of a
  590.  *     class using a method token. The method token can be located statically based
  591.  *     on the "closest" class that provides a token for the method, or name lookup
  592.  *     can be used. In general, a nonstatic method will have multiple entries in a
  593.  *     method table. Different method tokens select different entries (with
  594.  *     different implementations). In IDL, "reintroduce" is used to provide a new
  595.  *     token for the method. In DTS C++, the class implementor reintroduces a
  596.  *     nonstatic member function.
  597.  * (4) Direct call procedures are resolved statically by using a static symbol
  598.  *     provided by the "closest" class that provides the procedure. In IDL,
  599.  *     "reintroduce" is used to provide a new implementation for the procedure; in
  600.  *     DTS C++, the class implementation reintroduces a static member function.
  601.  *
  602.  * Direct call procedures are not registered with SOM classes, so only the
  603.  * first three categories are provided in somMethodData. Bit 0 of the type
  604.  * field is set if and only if the method is dynamic. For non-dynamic methods,
  605.  * bit 1 is set if and only if the method is nonstatic.
  606.  *
  607.  */
  608. #define SOM_IsDynamicMethod(md_type) ((md_type) & 1)
  609. #define SOM_IsNonstaticMethod(md_type) ((md_type) & 2)
  610. #define SOM_IsStaticMethod(md_type) \
  611.     (!(SOM_IsDynamicMethod(md_type) || SOM_IsNonstaticMethod(md_type)))
  612.  
  613. /*-----------------------
  614.  * Utility Functions
  615.  *----------------------*/
  616.  
  617. /*
  618.  * Test whether <obj> is a valid SOM object.  This test is based solely
  619.  * on the fact that (on this architecture) the first word of a SOM
  620.  * object is a pointer to its method table.  The test is therefore most
  621.  * correctly understood as returning true if and only if <obj> is a
  622.  * pointer to a pointer to a valid SOM method table.  If so, then
  623.  * methods can be invoked on <obj>.
  624.  */
  625. SOMEXTERN boolean SOMLINK somIsObj (somToken obj);
  626.  
  627. /*
  628.  * Verifies that the passed object is a valid instance of the passed
  629.  * class.  A detected failure generates an error message and causes
  630.  * program termination.  This call is automatically employed as part
  631.  * of the C method resolution macros if the preprocessor variable
  632.  * SOM_TestOn is defined.
  633.  */
  634. SOMEXTERN SOMObject * SOMLINK somTestCls (
  635.     SOMObject *obj,
  636.     SOMClass *classObj,
  637.     string fileName,
  638.     int lineNumber);
  639.  
  640. /*
  641.  * Return the class that introduced the method represented by a given
  642.  * method token.
  643.  */
  644. SOMEXTERN SOMClass* SOMLINK somGetClassFromMToken (somMToken mToken);
  645.  
  646.  
  647. /*----------------------------------------------------------------------
  648.  *  SOM Id Manager Section
  649.  *---------------------------------------------------------------------*/
  650.  
  651. /*
  652.  * typedef char* somId; // the "public" somId type (in sombtype.h)
  653.  *
  654.  * This above definition prevents users from building assumptions about
  655.  * how somIds are implemented into their programs. However, a little more
  656.  * information is useful to understand the different alternatives for
  657.  * creating somIds.
  658.  *
  659.  * All somIds point to something called an idKey. The content of the
  660.  * idKey for a somId depends on whether the somId has been registered.
  661.  *
  662.  * The idKey for an unregistered somId is a char* that points to a
  663.  * null-terminated array of chars that is called the id name.
  664.  *
  665.  * When a somId is registered, the idKey it points to is changed to
  666.  * point to a special structure whose representation is not made public.
  667.  * Among other things, of course, this structure contains the address of
  668.  * the id name. Normally the id name for a registered somId will be a copy
  669.  * of the originally indicated name, but copying strings is expensive
  670.  * because it requires dynamic memory allocation. As an alternative, to
  671.  * speed up creation of somIds and minimize memory use, you can use
  672.  * somBeginPersistentIds and somEndPersistentIds to bracket registration
  673.  * of somIds. If you do this, you must use somRelocateIds before the
  674.  * names for any of the "persistent" somIds that you create are changed
  675.  * (or perhaps destroyed as a result of program termination).
  676.  *
  677.  * There are basically two different ways to create registered somIds:
  678.  * from unregistered somIds, or from id names. To create registered
  679.  * somIds from unregistered somIds, you pass the address of an idKey
  680.  * to either somRegisterId or somCheckId; or, to register multiple
  681.  * somIds in one step, you can pass the address of an array of idKeys
  682.  * to somRegisterIds. To create registered somIds from id names, you
  683.  * pass the address of the id name to either somIdFromString or
  684.  * somIdFromStringNoFree. These routines are declared below.
  685.  */
  686.  
  687. /*
  688.  * Register a somId. Returns 1 (true) if the id is a new one, and
  689.  * 0 (false) otherwise. An id is new if no previously-registered id
  690.  * has the same name (where name comparison is case-insensitive).
  691.  */
  692. SOMEXTERN int SOMLINK somRegisterId (somId id);
  693.  
  694. /*
  695.  * Like somRegisterId, but it returns the somId as its result.
  696.  */
  697. SOMEXTERN somId SOMLINK somCheckId (somId id);
  698.  
  699. /*
  700.  * Tell the id manager to register ids for an array of idKeys.
  701.  * The id argument points to an idKey array of length idCount.
  702.  * If idCount is zero, then the array is assumed to be terminated
  703.  * by a null pointer.
  704.  */
  705. SOMEXTERN void SOMLINK somRegisterIds(somId idKeys, long idCount);
  706.  
  707. /*
  708.  * Return a somId that must be freed (using SOMFree) when the user
  709.  * has finished with it.
  710.  */
  711. SOMEXTERN somId SOMLINK somIdFromString (string aString);
  712.  
  713. /*
  714.  * Return a somId that must *not* be freed when the user
  715.  * has finished with it. This function is more efficient
  716.  * than the previous one.
  717.  */
  718. SOMEXTERN somId SOMLINK somIdFromStringNoFree(string aString);
  719.  
  720. /*
  721.  * Return a string that must never be freed or modified.
  722.  */
  723. SOMEXTERN string SOMLINK somStringFromId (somId id);
  724.  
  725. /*
  726.  * Returns true (1) if the two ids are equal, else false (0).
  727.  */
  728. SOMEXTERN int SOMLINK somCompareIds (somId id1, somId id2);
  729.  
  730. /*
  731.  * Return the total number of ids that have been registered so far, you
  732.  * can use this to advise the SOM runtime concerning expected number of
  733.  * ids in later executions of your program, via a call to
  734.  * somSetExpectedIds defined below
  735.  */
  736. SOMEXTERN unsigned long SOMLINK somTotalRegIds (void);
  737.  
  738. /*
  739.  * Tell the SOM runtime how many unique ids you expect to use during
  740.  * the execution of your program, this can improve space and time
  741.  * utilization slightly, this routine must be called before the SOM
  742.  * environment is created to have any effect
  743.  */
  744. SOMEXTERN void SOMLINK somSetExpectedIds (unsigned long numIds);
  745.  
  746. /*
  747.  * Return the unique key for this id. This is the key used for
  748.  * comparing somIds.
  749.  */
  750. SOMEXTERN unsigned long SOMLINK somUniqueKey (somId id);
  751.  
  752. /*
  753.  * Signal the beginning of an interval during which the id manager
  754.  * need not copy strings when registering new ids (because the caller
  755.  * knows that these strings will not be destroyed or modified without
  756.  * first calling somRelocateIds for each "persistent" id registered
  757.  * during the interval).
  758.  */
  759. SOMEXTERN void SOMLINK somBeginPersistentIds (void);
  760.  
  761. /*
  762.  * End the interval started with somBeginPersistentIds. Tells the
  763.  * id manager that strings for any new ids subsequently registered
  764.  * may be freed or otherwise modified without first calling somRelocateIds.
  765.  * Therefore the id manager must copy the strings remember the name of an
  766.  * id.
  767.  */
  768. SOMEXTERN void SOMLINK somEndPersistentIds (void);
  769.  
  770. /*
  771.  * Tell the id manager to replace the names for the specified registered
  772.  * ids with dynamically allocated copies. The id argument points to an
  773.  * array of char* variables of length idCount. If idCount is zero,
  774.  * then the array is assumed to be terminated by a null pointer.
  775.  */
  776. SOMEXTERN void SOMLINK somRelocateIds(somId id, long idCount);
  777.  
  778.  
  779. /*----------------------------------------------------------------------
  780.  * SOM Class Construction Section
  781.  
  782.  -- somBuildClass  introduced by SOM 2.0, SCI augmented for SOM 2.1
  783.  -- somBuildClass2 introduced by SOM 3.0
  784.  
  785.  *---------------------------------------------------------------------*/
  786.  
  787. /* -- somBuildClass
  788.  *
  789.  * somBuildClass automates construction of a new class object. A variety of
  790.  * special structures are used to allow language bindings to statically define
  791.  * the information necessary to specify a class. Pointers to these static
  792.  * structures are accumulated into an overall "static class information"
  793.  * structure or SCI, passed to somBuildClass. The SCI has evolved over time.
  794.  * The current version is defined here.
  795.  *
  796.  * The arguments to somBuildClass are as follows:
  797.  *
  798.  *   inherit_vars: a bit mask used to control inheritance of
  799.  *                 implementation. Implementation is inherited from
  800.  *                 parent i iff the bit 1<<i is on, or i>=32.
  801.  *
  802.  *   sci:          the somStaticClassInfo defined below.
  803.  *
  804.  *   majorVersion, minorVersion: the version of the class implementation.
  805.  */
  806.  
  807. /* to specify a new static method */
  808. typedef struct somStaticMethodStruct {
  809.     somMToken *classData;
  810.     somId *methodId; /* this must be a simple name (no colons) */
  811.     somId *methodDescriptor;
  812.     somMethodProc *method;
  813.     somMethodProc *redispatchStub;
  814.     somMethodProc *applyStub;
  815. } somStaticMethod_t;
  816.  
  817. /* to specify an overridden method */
  818. typedef struct somOverideMethodStruct {
  819.     somId *methodId; /* this can be a method descriptor */
  820.     somMethodProc *method;
  821. } somOverrideMethod_t;
  822.  
  823. /* to inherit a specific parent's method implementation */
  824. typedef struct somInheritedMethodStruct {
  825.     somId     *methodId;  /* identify the method */
  826.     long parentNum;       /* identify the parent */
  827.     somMToken *mToken;    /* for parentNumresolve */
  828. } somInheritedMethod_t;
  829.  
  830. /* to register a method that has been moved from this */
  831. /* class <cls> upwards in the class hierachy to class <dest> */
  832. typedef struct somMigratedMethodStruct {
  833.     somMToken *clsMToken; /* points into the <cls> classdata structure */
  834.                           /* the method token in <dest> will copied here */
  835.     somMToken *destMToken;/* points into the <dest> classdata structure */
  836.                           /* the method token here will be copied to <cls> */
  837. } somMigratedMethod_t;
  838.  
  839. /* to specify non-internal data */
  840. typedef struct somNonInternalDataStruct {
  841.     somDToken *classData;
  842.     char *basisForDataOffset;
  843. } somNonInternalData_t;
  844.  
  845. /* to specify a "procedure" or "staticdata" */
  846. typedef struct somProcMethodsStruct {
  847.     somMethodProc **classData, *pEntry;
  848. } somProcMethods_t;
  849.  
  850. /*
  851.  * to specify a general method "action" using somMethodStruct. The
  852.  * type of action is specified in the type field of somMethodStruct.
  853.  *
  854.  * action (in type & 0xFF)
  855.  *  0: static -- (i.e., virtual) uses somAddStaticMethod
  856.  *  1: dynamic -- uses somAddDynamicMethod (classData==0)
  857.  *  2: nonstatic -- (i.e., nonvirtual) uses somAddMethod
  858.  *  3: udaAssign -- registers a method as the udaAssign
  859.  *                  (but doesn't add the method)
  860.  *  4: udaConstAssign -- like 3, this doesn't add the method
  861.  *  5: somClassResolve Override (using the class pointed to by *classData)
  862.  *  6: somMToken Override (using the method token pointed to by methodId)
  863.  *                        (note: classData==0 for this)
  864.  *  7: classAllocate -- indicates the default heap allocator for this class.
  865.  *                 If classData == 0, then method is the code address (or NULL)
  866.  *                 If classData != 0, then *classData is the code address.
  867.  *                 No other info required (or used)
  868.  *  8: classDeallocate -- like 7, but indicates the default heap deallocator.
  869.  *  9: classAllocator -- indicates a non default heap allocator for this class.
  870.  *                       like 7, but a methodDescriptor can be given.
  871.  *
  872.  */
  873.  
  874. typedef struct somMethodStruct {
  875.     unsigned long type;
  876.     somMToken *classData;
  877.     somId *methodId;
  878.     somId *methodDescriptor;
  879.     somMethodProc *method;
  880.     somMethodProc *redispatchStub;
  881.     somMethodProc *applyStub;
  882. } somMethods_t;
  883.  
  884. /* to specify a varargs function */
  885. typedef struct somVarargsFuncsStruct {
  886.     somMethodProc **classData, *vEntry;
  887. } somVarargsFuncs_t;
  888.  
  889. /* to specify dynamically computed information (incl. embbeded objs) */
  890. typedef struct {
  891.     int   version;                      /* 1 for now */
  892.     long  instanceDataSize;             /* true size (incl. embedded objs) */
  893.     long  dataAlignment;                /* true alignment */
  894.     somEmbeddedObjStruct *embeddedObjs; /* array end == null copp */
  895. } somDynamicSCI;
  896.  
  897. /*
  898.  * to specify a DTS class, use the somDTSClass entry in the following
  899.  * data structure. This entry is a bit vector interpreted as follows:
  900.  *
  901.  * (somDTSClass & 0x0001) == the class is a DTS C++ class
  902.  */
  903.  
  904. /*
  905.  *  The Static Class Info Structure passed to somBuildClass
  906.  */
  907. typedef struct somStaticClassInfoStruct {
  908.     unsigned long layoutVersion;  /* 3 */
  909.     unsigned long numStaticMethods;   /* count of smt entries */
  910.     unsigned long numStaticOverrides; /* count of omt entries */
  911.     unsigned long numNonInternalData; /* count of nit entries */
  912.     unsigned long numProcMethods;     /* count of pmt entries */
  913.     unsigned long numVarargsFuncs;    /* count of vft entries */
  914.     unsigned long majorVersion;
  915.     unsigned long minorVersion;
  916.     unsigned long instanceDataSize;   /* instance data introduced by this class */
  917.     unsigned long maxMethods;         /* count numStaticMethods and numMethods */
  918.     unsigned long numParents;
  919.     somId    classId;
  920.     somId    explicitMetaId;
  921.     long implicitParentMeta;
  922.     somId                  *parents;
  923.     somClassDataStructure  *cds;
  924.     somCClassDataStructure *ccds;
  925.     somStaticMethod_t      *smt; /* basic "static" methods for mtab */
  926.     somOverrideMethod_t    *omt; /* overrides for mtab */
  927.     char                   *nitReferenceBase;
  928.     somNonInternalData_t   *nit; /* datatokens for instance data */
  929.     somProcMethods_t       *pmt; /* Arbitrary ClassData members */
  930.     somVarargsFuncs_t      *vft; /* varargs stubs */
  931.     somTP_somClassInitFunc *cif; /* class init function */
  932.     /* end of layout version 1 */
  933.  
  934.     /* begin layout version 2 extensions */
  935.     long dataAlignment; /* the desired byte alignment for instance data */
  936.     /* end of layout version 2 */
  937.  
  938. #define SOMSCIVERSION 1
  939.  
  940.     /* begin layout version 3 extensions */
  941.     long numDirectInitClasses;
  942.     somId *directInitClasses;
  943.     unsigned long numMethods; /* general (including nonstatic) methods for mtab */
  944.     somMethods_t       *mt;
  945.     unsigned long protectedDataOffset; /* access = resolve(instanceDataToken) + offset */
  946.     unsigned long somSCIVersion;  /* used during development. currently = 1 */
  947.     unsigned long numInheritedMethods;
  948.     somInheritedMethod_t *imt; /* inherited method implementations */
  949.     unsigned long numClassDataEntries; /* should always be filled in */
  950.     somId *classDataEntryNames; /* either NULL or ptr to an array of somIds */
  951.     unsigned long numMigratedMethods;
  952.     somMigratedMethod_t *mmt; /* migrated method implementations */
  953.     unsigned long numInitializers; /* the initializers for this class */
  954.     somId *initializers;     /* in order of release */
  955.     unsigned long somDTSClass; /* used to identify a DirectToSOM class */
  956.     somDynamicSCI *dsci;  /* used to register dynamically computed info */
  957.     /* end of layout version 3 */
  958.  
  959. } somStaticClassInfo, *somStaticClassInfoPtr;
  960.  
  961. SOMEXTERN SOMClass * SOMLINK somBuildClass(IN long inherit_vars,
  962.                                            IN somStaticClassInfo *sci,
  963.                                            IN long majorVersion,
  964.                                            IN long minorVersion);
  965.  
  966.  
  967. /*
  968.  * -- somBuildClass2
  969.  *
  970.  * somBuildClass2 was added in SOM 3.0 to allow reuse of static class
  971.  * information to hold a class's instance variables. This speeds class
  972.  * creation, and reduces the need for dynamically allocated memory. The
  973.  * static class information structures are accumulated into a CIB (class
  974.  * initialization block) instead of the SCI structure used with
  975.  * somBuildClass.
  976.  */
  977.  
  978. /*
  979.  * to register a method that has been moved from this
  980.  * class <orig> upwards in the class hierachy to class <dest>
  981.  */
  982. typedef struct somMigratedMethodStruct_t2 {
  983.     somId  methodId;           /* id of the method being migrated */
  984.     somMToken *abi2TokenAddr;   /* if abi2, this class's classData field addr */
  985.     somToken  *abi3SymbolAddr;   /* if abi3, this class's method symbol addr */
  986. } somMigratedMethod_t2;
  987.  
  988. /*
  989.  * to select a specific ancestor's implementation for an inherited method
  990.  */
  991. typedef struct somInheritedMethodStruct_t2 {
  992.     somId methodId;
  993.     long  parentNum;
  994.     SOMClass ** ancestorClass;
  995. } somInheritedMethod_t2;
  996.  
  997. /*
  998.  * to register a normal method override
  999.  */
  1000. typedef struct somOverideMethodStruct_t2 {
  1001.     somId methodId;
  1002.     somMethodPtr *pcall;
  1003.     somMethodPtr pcallResolve;
  1004.     somMethodPtr methodProc;
  1005. } somOverrideMethod_t2;
  1006.  
  1007. typedef struct {
  1008.     somMethodData  md;
  1009.     somMethodProc* dispatchFcn;
  1010.     /* ... arbitrary remaining structure known to dispatchFcn */
  1011. } somRedispatchInfo, *somRedispatchInfoPtr;
  1012.  
  1013. /*
  1014.  * to register information for a new method
  1015.  */
  1016. #ifndef SOM_MD_DEFINED
  1017. typedef struct {
  1018.     unsigned long  type;
  1019.     somId descriptor;
  1020.     somMToken mToken; /* address of method symbol if one exists */
  1021.     somMethodPtr method; /* address of method proc */
  1022.     somMethodPtr redispatchStub;    /* either these 2 */
  1023.     somMethodPtr applyStub;
  1024.     somMethodInfoPtr methodInfo;    /* or this 1 */
  1025.     somMToken *tokenLoc;          /* address of ClassData field */
  1026.     somRedispatchInfoPtr redispatchInfo; /* rdstub desired (we'll fill in md) */
  1027.     long layoutVersion;
  1028. } somMethodDefn, *somMethodDefnPtr;
  1029. #endif
  1030.  
  1031.  
  1032. /*
  1033.  * class variables that don't change after class intialization
  1034.  */
  1035. typedef struct somClassVars1Struct {
  1036.     long layoutVersion; /* 1 */
  1037.     void* extension;
  1038.     long dataSize;
  1039.     long dataAlignment;
  1040.     somMethodProc       *classAllocate;
  1041.     somMethodProc       *classDeallocate;
  1042. } somClassVars1, *somClassVars1Ptr;
  1043.  
  1044.  
  1045. /*
  1046.  * storage addressed by a method symbol
  1047.  */
  1048. typedef struct somMethodSymbolBindingStruct {
  1049.     char content[4];
  1050. } somMethodSymbol, *somMethodSymbolBinding;
  1051.  
  1052. /*
  1053.  * Overrides for SOMObject Specials
  1054.  */
  1055. typedef struct somSpecialOverridesStruct {
  1056.     somMethodSymbolBinding ctorThunk;
  1057.     somMethodSymbolBinding resolvedThunk; /* #13082 */
  1058.     somMethodPtr      methodProc;
  1059. } somSpecialOverrides, *somSpecialOverridesPtr;
  1060.  
  1061. /*
  1062.  * (non-SOMObject) initializer symbols (#13082)
  1063.  */
  1064. typedef struct somInitSymbolsStruct {
  1065.     somId methodId;
  1066.     somMethodSymbolBinding ctorThunk;
  1067.     somMethodSymbolBinding resolvedThunk;
  1068. } somInitSymbols, *somInitSymbolsPtr;
  1069.  
  1070.  
  1071. /*
  1072.  * CIB
  1073.  */
  1074.  
  1075. typedef struct SOM_CIB {
  1076.     long                    layoutVersion;
  1077.     somClassVars1Ptr        classVars1;
  1078.     void**                  unsharedVars;
  1079.     long                    majorVersion;
  1080.     long                    minorVersion;
  1081.     unsigned long           constFlags;
  1082.     unsigned long           inheritVars;
  1083.     SOMClass**              classMeta;
  1084.     somMethodPtr            classInit;
  1085.     somMethodPtr            classUninit;
  1086.     somMethodPtr            legacyInit;
  1087.     somMethodPtr            legacyUninit;
  1088.     somMethodPtr            udaAssign;
  1089.     somMethodPtr            udaConstAssign;
  1090.     long                    protectedDataOffset;
  1091.     long                    numEmbeddedObjs;
  1092.     somEmbeddedObjStructPtr embeddedObjs;
  1093.     long                    numRegIds;
  1094.     char**                  regIds;
  1095.     long                    numClassDataEntries;
  1096.     somClassDataStructurePtr  somClassData;
  1097.     somCClassDataStructurePtr somCClassData;
  1098.     som3ClassInfoStructPtr    som3ClassInfo;
  1099.     long                    numParents;
  1100.     SOMClass***             parents;
  1101.     long                    numDirectInitClasses;
  1102.     SOMClass***             directInitClasses;
  1103.     long                    numNewInitializers;
  1104.     somInitSymbolsPtr       newInitializerSymbols;
  1105.     long                    numOvInitializers;
  1106.     somInitSymbolsPtr       ovInitializerSymbols;
  1107.     somSpecialOverridesPtr  specialOverrides;
  1108.     long                    maxNDMethods;
  1109.     somMethodDefn*          newNDMethods;
  1110.     long                    numOverrides;
  1111.     somOverrideMethod_t2*   overrides;
  1112.     long                    numInheritedSelections;
  1113.     somInheritedMethod_t2*  inheritedSelections;
  1114.     long                    numMigratedMethods;
  1115.     somMigratedMethod_t2*   migratedMethods;
  1116. } SOM_CIB, *SOM_CIBPtr;
  1117.  
  1118.  
  1119. SOMEXTERN SOMClass * SOMLINK somBuildClass2(SOM_CIBPtr cib,
  1120.                                             long requestedMajorVersion,
  1121.                                             long requestedMinorVersion);
  1122.  
  1123. /*
  1124.  *  Used by old single-inheritance emitters to make class creation
  1125.  *  an atomic operation. Kept for backwards compatability only.
  1126.  */
  1127. typedef void     SOMLINK somTD_classInitRoutine  (
  1128.     IN SOMClass * /* parent class */,
  1129.     IN SOMClass * /* metaclass */);
  1130. SOMEXTERN void SOMLINK somConstructClass (
  1131.     IN somTD_classInitRoutine *classInitRoutine,
  1132.     IN SOMClass *parentClass,
  1133.     IN SOMClass *metaClass,
  1134.     IN somClassDataStructure *cds);
  1135.  
  1136. /*
  1137.  * somRegisterLibraryClasses - the parameters are defined as follows:
  1138.  * 1. libHandle is the operating system-dependent library handle that
  1139.  *    is returned by the operating system's "load library" function.
  1140.  *    See somplatf.h for the definition of the somLibraryHandle type.
  1141.  * 2. numClasses is the number of SOM classes in the library.
  1142.  * 3. classInfoStructs is a pointer to an array of pointers to
  1143.  *    som3ClassInfoStruct (one for each class in the library).
  1144.  *    The array must be a static variable, so the pointer to this
  1145.  *    array will be valid after the call has completed.
  1146.  * 4. userInitRoutine may either be NULL or the address of an
  1147.  *    initialization function to be called.
  1148.  */
  1149. typedef void SOMLINK userInitTermProc (somLibraryHandle, unsigned long);
  1150.  
  1151. SOMEXTERN long SOMLINK
  1152. somRegisterLibraryClasses(
  1153.                           somLibraryHandle       libHandle,
  1154.                           long                   numClasses,
  1155.                           som3ClassInfoStructPtr classInfoStructs[],
  1156.                           userInitTermProc*      userInitTermRoutine );
  1157. SOMEXTERN long SOMLINK somUnregisterLibraryClasses (somLibraryHandle libHandle);
  1158.  
  1159. #endif /* somapi_h */
  1160.  
  1161.