som.pas 59 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528
  1. {
  2. $Id$
  3. Copyright (c) 1994-1996 by International Business Machines Corporation
  4. Copyright (c) 1997 Antony T Curtis.
  5. Copyright (c) 2002-2003 by Yuri Prokushev ([email protected])
  6. System Object Model Run-time library API (SOM.DLL)
  7. This program is free software; you can redistribute it and/or modify it
  8. under the terms of the GNU Library General Public License (LGPL) as
  9. published by the Free Software Foundation; either version 2 of the
  10. License, or (at your option) any later version. This program is
  11. distributed in the hope that it will be useful, but WITHOUT ANY
  12. WARRANTY; without even the implied warranty of MERCHANTABILITY or
  13. FITNESS FOR A PARTICULAR PURPOSE.
  14. See the GNU Library General Public License for more details. You should
  15. have received a copy of the GNU Library General Public License along
  16. with this program; if not, write to the Free Software Foundation, Inc.,
  17. 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
  18. **********************************************************************}
  19. Unit SOM;
  20. Interface
  21. {$mode objfpc}
  22. {$warning This units doesn't work because FPC/2 doesn't implements external vars}
  23. {$warning This code is alpha!}
  24. //uses
  25. // SOMTypes;
  26. var
  27. {$warning support of external vars required}
  28. SOM_MajorVersion, SOM_MinorVersion :Longint; (* SOM Version Numbers *)
  29. //³ 00070 ³ SOM_MajorVersion
  30. //³ 00071 ³ SOM_MinorVersion
  31. {$warning support of external vars required}
  32. SOM_MaxThreads :Longint; // ³ 00095 ³ SOM_MaxThreads (* SOM Thread Support *)
  33. type
  34. Flags =Longint;
  35. type
  36. SOMObjectType = Pointer;
  37. SOMClassType = Pointer;
  38. SOMMSingleInstanceType = Pointer;
  39. SOMClassMgrType = Pointer;
  40. SOMClassPtr = ^SOMClassType;
  41. SOMObjectPtr = ^SOMObjectType;
  42. CORBAObjectType = SOMObjectType; (* in SOM, a CORBA object is a SOM object *)
  43. somToken =Pointer; (* Uninterpretted value *)
  44. somId =^PChar;
  45. somIdPtr =^somId;
  46. somMToken =somToken;
  47. somDToken =somToken;
  48. somMTokenPtr =^somMToken;
  49. somDTokenPtr =^somDToken;
  50. type
  51. ImplId =^PChar;
  52. RepositoryId = PChar;
  53. AttributeDef_AttributeMode = Cardinal;
  54. OperationDef_OperationMode = Longint;
  55. ParameterDef_ParameterMode = Cardinal;
  56. somMethodPtr =Pointer;
  57. somBooleanVector =^Byte;
  58. somCtrlInfo =somToken;
  59. somSharedMethodData =somToken;
  60. somSharedMethodDataPtr=^somSharedMethodData;
  61. somClassInfoPtr =^somClassInfo;
  62. somClassInfo =somToken;
  63. Identifier =PChar; (* CORBA 7.5.1, p. 129 *)
  64. TypeCode = pointer;
  65. (* CORBA 5.7, p.89 *)
  66. any = record
  67. _type : TypeCode;
  68. _value : Pointer;
  69. end;
  70. NamedValue =record
  71. name : Identifier;
  72. argument : any;
  73. len : Longint;
  74. arg_modes : Flags;
  75. end;
  76. (* -- Method/Data Tokens -- For locating methods and data members. *)
  77. somRdAppType =LongInt; (* method signature code -- see def below *)
  78. somFloatMap =Array[0..13] of LongInt; (* float map -- see def below *)
  79. somFloatMapPtr =^somFloatMapPtr;
  80. somMethodInfoStruct =record
  81. callType :somRdAppType;
  82. va_listSize :Longint;
  83. float_map :somFloatMapPtr;
  84. end;
  85. somMethodInfo =somMethodInfoStruct;
  86. somMethodInfoPtr =^somMethodInfo;
  87. somMethodDataStruct =record
  88. id :somId;
  89. ctype :Longint; (* 0=static, 1=dynamic 2=nonstatic *)
  90. descriptor :somId; (* for use with IR interfaces *)
  91. mToken :somMToken; (* NULL for dynamic methods *)
  92. method :somMethodPtr; (* depends on resolution context *)
  93. shared :somSharedMethodDataPtr;
  94. end;
  95. somMethodData =somMethodDataStruct;
  96. somMethodDataPtr =^somMethodDataStruct;
  97. somMethodProc =Procedure(somSelf:SOMObjectType);
  98. somMethodProcPtr =^somMethodProc;
  99. (*---------------------------------------------------------------------
  100. * C++-style constructors are called initializers in SOM. Initializers
  101. * are methods that receive a pointer to a somCtrlStruct as an argument.
  102. *)
  103. somInitInfo =record
  104. cls :SOMClassType;(* the class whose introduced data is to be initialized *)
  105. defaultInit :somMethodProc;
  106. defaultCopyInit :somMethodProc;
  107. defaultConstCopyInit:somMethodProc;
  108. defaultNCArgCopyInit:somMethodProc;
  109. dataOffset :Longint;
  110. legacyInit :somMethodProc;
  111. end;
  112. somDestructInfo =record
  113. cls :SOMClassType;(* the class whose introduced data is to be destroyed *)
  114. defaultDestruct :somMethodProc;
  115. dataOffset :Longint;
  116. legacyUninit :somMethodProc;
  117. end;
  118. somAssignInfo =record
  119. cls :SOMClassType;(* the class whose introduced data is to be assigned *)
  120. defaultAssign :somMethodProc;
  121. defaultConstAssign :somMethodProc;
  122. defaultNCArgAssign :somMethodProc;
  123. udaAssign :somMethodProc;
  124. udaConstAssign :somMethodProc;
  125. dataOffset :Longint;
  126. end;
  127. _IDL_SEQUENCE_octet = record
  128. _maximum : Cardinal;
  129. _length : Cardinal;
  130. _buffer : ^Byte;
  131. end;
  132. ReferenceData =_IDL_SEQUENCE_octet;
  133. (*
  134. * A special info access structure pointed to by
  135. * the parentMtab entry of somCClassDataStructure.
  136. *)
  137. somTD_somRenewNoInitNoZeroThunk =Procedure(var buf); cdecl;
  138. somInitInfoPtr =^somInitInfo;
  139. somInitCtrlStruct =record
  140. mask :somBooleanVector;(* an array of booleans to control ancestor calls *)
  141. info :somInitInfoPtr; (* an array of structs *)
  142. infoSize :Longint; (* increment for info access *)
  143. ctrlInfo :somCtrlInfo;
  144. end;
  145. somInitCtrl =somInitCtrlStruct;
  146. som3InitCtrl =somInitCtrlStruct;
  147. somDestructInfoPtr =^somDestructInfo;
  148. somDestructCtrlStruct =record
  149. mask :somBooleanVector;(* an array of booleans to control ancestor calls *)
  150. info :somDestructInfoPtr;(* an array of structs *)
  151. infoSize :Longint; (* increment for info access *)
  152. ctrlInfo :somCtrlInfo;
  153. end;
  154. somDestructCtrl =somDestructCtrlStruct;
  155. som3DestructCtrl =somDestructCtrlStruct;
  156. somAssignInfoPtr =^somAssignInfo;
  157. somAssignCtrlStruct =record
  158. mask :somBooleanVector;(* an array of booleans to control ancestor calls *)
  159. info :somAssignInfoPtr;(* an array of structs *)
  160. infoSize :Longint; (* increment for info access *)
  161. ctrlInfo :somCtrlInfo;
  162. end;
  163. somAssignCtrl =somAssignCtrlStruct;
  164. som3AssignCtrl =somAssignCtrlStruct;
  165. (*----------------------------------------------------------------------
  166. * The Class Data Structures -- these are used to implement static
  167. * method and data interfaces to SOM objects.
  168. *)
  169. type
  170. (* -- (Generic) Class data Structure *)
  171. somClassDataStructure =record
  172. classObject :SOMClassType; (* changed by shadowing *)
  173. tokens :Array[0..0] of somToken; (* method tokens, etc. *)
  174. end;
  175. somClassDataStructurePtr=^somClassDataStructure;
  176. somInitCtrlPtr =^somInitCtrl;
  177. somDestructCtrlPtr =^somDestructCtrl;
  178. somAssignCtrlPtr =^somAssignCtrl;
  179. (* -- For building lists of method tables *)
  180. somMethodTabPtr =^somMethodTab;
  181. somMethodTabs =^somMethodTabList;
  182. somMethodTabList =record
  183. mtab :somMethodTabPtr;
  184. next :somMethodTabs;
  185. end;
  186. somParentMtabStruct =record
  187. mtab :somMethodTabPtr; (* this class' mtab -- changed by shadowing *)
  188. next :somMethodTabs; (* the parent mtabs -- unchanged by shadowing *)
  189. classObject :SOMClassType; (* unchanged by shadowing *)
  190. somRenewNoInitNoZeroThunk:somTD_somRenewNoInitNoZeroThunk; (* changed by shadowing *)
  191. instanceSize :Longint; (* changed by shadowing *)
  192. initializers :somMethodProcPtr; (* resolved initializer array in releaseorder *)
  193. resolvedMTokens :somMethodProcPtr; (* resolved methods *)
  194. initCtrl :somInitCtrl; (* these fields are filled in if somDTSClass&2 is on *)
  195. destructCtrl :somDestructCtrl;
  196. assignCtrl :somAssignCtrl;
  197. embeddedTotalCount :Longint;
  198. hierarchyTotalCount :Longint;
  199. unused :Longint;
  200. end;
  201. somParentMtabStructPtr=^somParentMtabStruct;
  202. (*
  203. * (Generic) Auxiliary Class Data Structure
  204. *)
  205. somCClassDataStructure=record
  206. parentMtab :somParentMtabStructPtr;
  207. instanceDataToken :somDToken;
  208. wrappers :Array[0..0] of somMethodProc; (* for valist methods *)
  209. end;
  210. somCClassDataStructurePtr=^somCClassDataStructure;
  211. (*----------------------------------------------------------------------
  212. * The Method Table Structure
  213. *)
  214. (* -- to specify an embedded object (or array of objects). *)
  215. somEmbeddedObjStructPtr=^somEmbeddedObjStruct;
  216. somEmbeddedObjStruct =record
  217. copp :SOMClassType; (* address of class of object ptr *)
  218. cnt :Longint; (* object count *)
  219. offset :Longint; (* Offset to pointer (to embedded objs) *)
  220. end;
  221. somMethodTabStruct =record
  222. classObject :SOMClassType;
  223. classInfo :somClassInfoPtr;
  224. className :PChar;
  225. instanceSize :Longint;
  226. dataAlignment :Longint;
  227. mtabSize :Longint;
  228. protectedDataOffset :Longint; (* from class's introduced data *)
  229. protectedDataToken :somDToken;
  230. embeddedObjs :somEmbeddedObjStructPtr;
  231. (* remaining structure is opaque *)
  232. entries :Array[0..0] of somMethodProc;
  233. end;
  234. somMethodTab =somMethodTabStruct;
  235. (* -- For building lists of class objects *)
  236. somClasses =^somClassList;
  237. somClassList =record
  238. cls :SOMClassType;
  239. next :somClasses;
  240. end;
  241. (* -- For building lists of objects *)
  242. somObjects =^somObjectList;
  243. somObjectList =record
  244. obj :SOMObjectType;
  245. next :somObjects;
  246. end;
  247. (*----------------------------------------------------------------------
  248. * Method Stubs -- Signature Support
  249. *
  250. *
  251. * This section defines the structures used to pass method signature
  252. * ingo to the runtime. This supports selection of generic apply stubs
  253. * and runtime generation of redispatchstubs when these are needed. The
  254. * information is registered with the runtime when methods are defined.
  255. *
  256. * When calling somAddStaticMethod, if the redispatchStub is -1, then a
  257. * pointer to a struct of type somApRdInfo is passed as the applyStub.
  258. * Otherwise, the passed redispatchstub and applystub are taken as given.
  259. * When calling somAddDynamicMethod, an actual apply stub must be passed.
  260. * Redispatch stubs for dynamic methods are not available, nor is
  261. * automated support for dynamic method apply stubs. The following
  262. * atructures only appropriate in relation to static methods.
  263. *
  264. * In SOMr2, somAddStaticMethod can be called with an actual redispatchstub
  265. * and applystub *ONLY* if the method doesn't return a structure. Recall
  266. * that no SOMr1 methods returned structures, so SOMr1 binaries obey this
  267. * restriction. The reason for this rule is that SOMr2 *may* use thunks,
  268. * and thunks need to know if a structure is returned. We therefore assume
  269. * that if no signature information is provided for a method through the
  270. * somAddStaticMethod interface, then the method returns a scalar.
  271. *
  272. * If a structure is returned, then a -1 *must* be passed to
  273. * somAddStaticMethod as a redispatchstub. In any case, if a -1 is passed,
  274. * then this means that the applystub actually points to a structure of type
  275. * somApRdInfo. This structure is used to hold and access signature
  276. * information encoded as follows.
  277. *
  278. * If the somApRdInfo pointer is NULL, then, if the runtime was built with
  279. * SOM_METHOD_STUBS defined, a default signature is assumed (no arguments,
  280. * and no structure returned); otherwise, the stubs are taken as
  281. * somDefaultMethod (which produces a runtime error when used) if dynamic
  282. * stubs are not available.
  283. *
  284. * If the somApRdInfo pointer is not NULL, then the structure it points to can
  285. * either include (non-null) redispatch and applystubs (the method is then
  286. * assumed to return a structure), or null stubs followed by information needed
  287. * to generate necessary stubs dynamically.
  288. *)
  289. somApRdInfoStruct =record
  290. rdStub :somMethodProc;
  291. apStub :somMethodProc;
  292. stubInfo :somMethodInfoPtr;
  293. end;
  294. somApRdInfo =somApRdInfoStruct;
  295. (*
  296. * Values for somRdAppType are generated by summing one from column A and one
  297. * from column B of the following constants:
  298. *)
  299. (* Column A: return type *)
  300. const
  301. SOMRdRetsimple = 0; (* Return type is a non-float fullword *)
  302. SOMRdRetfloat = 2; (* Return type is (single) float *)
  303. SOMRdRetdouble = 4; (* Return type is double *)
  304. SOMRdRetlongdouble = 6; (* Return type is long double *)
  305. SOMRdRetaggregate = 8; (* Return type is struct or union *)
  306. SOMRdRetbyte =10; (* Return type is a byte *)
  307. SOMRdRethalf =12; (* Return type is a (2 byte) halfword *)
  308. (* Column B: are there any floating point scalar arguments? *)
  309. SOMRdNoFloatArgs = 0;
  310. SOMRdFloatArgs = 1;
  311. (* A somFloatMap is only needed on RS/6000 *)
  312. (*
  313. * This is an array of offsets for up to the first 13 floating point arguments.
  314. * If there are fewer than 13 floating point arguments, then there will be
  315. * zero entries following the non-zero entries which represent the float args.
  316. * A non-zero entry signals either a single- or a double-precision floating point
  317. * argument. For a double-precision argument, the entry is the stack
  318. * frame offset. For a single-precision argument the entry is the stack
  319. * frame offset + 1. For the final floating point argument, add 2 to the
  320. * code that would otherwise be used.
  321. *)
  322. SOMFMSingle = 1; (* add to indicate single-precision *)
  323. SOMFMLast = 2; (* add to indicate last floating point arg *)
  324. const
  325. SOM_SCILEVEL = 4;
  326. (* The SCI includes the following information:
  327. *
  328. * The address of a class's ClassData structure is passed.
  329. * This structure should have the external name,
  330. * <className>ClassData. The classObject field should be NULL
  331. * (if it is not NULL, then a new class will not be built). somBuildClass will
  332. * set this field to the address of the new class object when it is built.
  333. *
  334. * The address of the class's auxiliary ClassData structure is passed.
  335. * Thi structure should have the external name,
  336. * <className>CClassData. The parentMtab field will be set by somBuildClass.
  337. * This field often allows method calls to a class object to be avoided.
  338. *
  339. * The other structures referenced by the static class information (SCI)
  340. * are used to:
  341. *)
  342. (*
  343. * to specify a static method. The methodId used here must be
  344. * a simple name (i.e., no colons). In all other cases,
  345. * where a somId is used to identify a registered method,
  346. * the somId can include explicit scoping. An explicitly-scoped
  347. * method name is called a method descriptor. For example,
  348. * the method introduced by SOMObjectType as somGetClass has the
  349. * method descriptor "SOMObjectType::somGetClass". When a
  350. * class is contained in an IDL module, the descriptor syntax
  351. * <moduleName>::<className>::<methodName> can be used. Method
  352. * descriptors can be useful when a class supports different methods
  353. * that have the same name (note: IDL prevents this from occuring
  354. * statically, but SOM itself has no problems with this).
  355. *)
  356. type
  357. somStaticMethodStruct =record
  358. classData :somMTokenPtr;
  359. methodId :somIdPtr; (* this must be a simple name (no colons) *)
  360. methodDescriptor :somIdPtr;
  361. method :somMethodPtr;//somMethodProc;
  362. redispatchStub :somMethodPtr;//somMethodProc;
  363. applyStub :somMethodPtr;//somMethodProc;
  364. end;
  365. somStaticMethod_t =somStaticMethodStruct;
  366. somStaticMethod_p =^somStaticMethod_t;
  367. (* to specify an overridden method *)
  368. somOverideMethodStruct=record
  369. methodId :somIdPtr; (* this can be a method descriptor *)
  370. method :somMethodPtr;//somMethodProc;
  371. end;
  372. somOverrideMethod_t =somOverideMethodStruct;
  373. somOverrideMethod_p =^somOverrideMethod_t;
  374. (* to inherit a specific parent's method implementation *)
  375. somInheritedMethodStruct=record
  376. methodId :somIdPtr; (* identify the method *)
  377. parentNum :Longint; (* identify the parent *)
  378. mToken :somMTokenPtr; (* for parentNumresolve *)
  379. end;
  380. somInheritedMethod_t =somInheritedMethodStruct;
  381. somInheritedMethod_p =^somInheritedMethod_t;
  382. (* to register a method that has been moved from this *)
  383. (* class <cls> upwards in the class hierachy to class <dest> *)
  384. somMigratedMethodStruct=record
  385. clsMToken :somMTokenPtr;
  386. (* points into the <cls> classdata structure *)
  387. (* the method token in <dest> will copied here *)
  388. destMToken :somMTokenPtr;
  389. (* points into the <dest> classdata structure *)
  390. (* the method token here will be copied to <cls> *)
  391. end;
  392. somMigratedMethod_t =somMigratedMethodStruct;
  393. somMigratedMethod_p =^somMigratedMethod_t;
  394. (* to specify non-internal data *)
  395. somNonInternalDataStruct=record
  396. classData :somDTokenPtr;
  397. basisForDataOffset :PChar;
  398. end;
  399. somNonInternalData_t =somNonInternalDataStruct;
  400. somNonInternalData_p =^somNonInternalData_t;
  401. (* to specify a "procedure" or "classdata" *)
  402. somProcMethodsStruct =record
  403. classData :somMethodProcPtr;
  404. pEntry :somMethodProc;
  405. end;
  406. somProcMethods_t =somProcMethodsStruct;
  407. somProcMethods_p =^somProcMethods_t;
  408. (* to specify a general method "action" using somMethodStruct *)
  409. (*
  410. the type of action is specified by loading the type field of the
  411. somMethodStruct. There are three bit fields in the overall type:
  412. action (in type & 0xFF)
  413. 0: static -- (i.e., virtual) uses somAddStaticMethod
  414. 1: dynamic -- uses somAddDynamicMethod (classData==0)
  415. 2: nonstatic -- (i.e., nonvirtual) uses somAddMethod
  416. 3: udaAssign -- registers a method as the udaAssign (but doesn't add the method)
  417. 4: udaConstAssign -- like 3, this doesn't add the method
  418. 5: somClassResolve Override (using the class pointed to by *classData)
  419. 6: somMToken Override (using the method token pointed to by methodId)
  420. (note: classData==0 for this)
  421. 7: classAllocate -- indicates the default heap allocator for this class.
  422. If classData == 0, then method is the code address (or NULL)
  423. If classData != 0, then *classData is the code address.
  424. No other info required (or used)
  425. 8: classDeallocate -- like 7, but indicates the default heap deallocator.
  426. 9: classAllocator -- indicates a non default heap allocator for this class.
  427. like 7, but a methodDescriptor can be given.
  428. === the following is not currently supported ===
  429. binary data access -- in (type & 0x100), valid for actions 0,1,2,5,6
  430. 0: the method procedure doesn't want binary data access
  431. 1: the method procedure does want binary data access
  432. aggregate return -- in (type & 0x200), used when binary data access requested
  433. 0: method procedure doesn't return a structure
  434. 1: method procedure does return a structure
  435. *)
  436. somMethodStruct =record
  437. mtype :Longint;
  438. classData :somMTokenPtr;
  439. methodId :somIdPtr;
  440. methodDescriptor :somIdPtr;
  441. method :somMethodProc;
  442. redispatchStub :somMethodProc;
  443. applyStub :somMethodProc;
  444. end;
  445. somMethods_t =somMethodStruct;
  446. somMethods_p =^somMethods_t;
  447. (* to specify a varargs function *)
  448. somVarargsFuncsStruct =record
  449. classData :somMethodProcPtr;
  450. vEntry :somMethodProc;
  451. end;
  452. somVarargsFuncs_t =somVarargsFuncsStruct;
  453. somVarargsFuncs_p =^somVarargsFuncs_t;
  454. (* to specify dynamically computed information (incl. embbeded objs) *)
  455. somDynamicSCIPtr =^somDynamicSciPtr;
  456. somDynamicSCI =record
  457. version :Longint; (* 1 for now *)
  458. instanceDataSize :Longint; (* true size (incl. embedded objs) *)
  459. dataAlignment :Longint; (* true alignment *)
  460. embeddedObjs :somEmbeddedObjStructPtr; (* array end == null copp *)
  461. end;
  462. (*
  463. to specify a DTS class, use the somDTSClass entry in the following
  464. data structure. This entry is a bit vector interpreted as follows:
  465. (somDTSClass & 0x0001) == the class is a DTS C++ class
  466. (somDTSClass & 0x0002) == the class wants the initCtrl entries
  467. of the somParentMtabStruct filled in.
  468. *)
  469. (*
  470. * The Static Class Info Structure passed to somBuildClass
  471. *)
  472. somStaticClassInfoStruct=record
  473. layoutVersion :Longint; (* this struct defines layout version SOM_SCILEVEL *)
  474. numStaticMethods :Longint; (* count of smt entries *)
  475. numStaticOverrides :Longint; (* count of omt entries *)
  476. numNonInternalData :Longint; (* count of nit entries *)
  477. numProcMethods :Longint; (* count of pmt entries *)
  478. numVarargsFuncs :Longint; (* count of vft entries *)
  479. majorVersion :Longint;
  480. minorVersion :Longint;
  481. instanceDataSize :Longint; (* instance data introduced by this class *)
  482. maxMethods :Longint; (* count numStaticMethods and numMethods *)
  483. numParents :Longint;
  484. classId :somId;
  485. explicitMetaId :somId;
  486. implicitParentMeta :Longint;
  487. parents :somIdPtr;
  488. cds :somClassDataStructurePtr;
  489. ccds :somCClassDataStructurePtr;
  490. smt :somStaticMethod_p; (* basic "static" methods for mtab *)
  491. omt :somOverrideMethod_p; (* overrides for mtab *)
  492. nitReferenceBase :PChar;
  493. nit :somNonInternalData_p; (* datatokens for instance data *)
  494. pmt :somProcMethods_p; (* Arbitrary ClassData members *)
  495. vft :somVarargsFuncs_p; (* varargs stubs *)
  496. cif :pointer{^somTP_somClassInitFunc}; (* class init function *)
  497. (* end of layout version 1 *)
  498. (* begin layout version 2 extensions *)
  499. dataAlignment :Longint; (* the desired byte alignment for instance data *)
  500. (* end of layout version 2 *)
  501. //#define SOMSCIVERSION 1
  502. (* begin layout version 3 extensions *)
  503. numDirectInitClasses:Longint;
  504. directInitClasses :somIdPtr;
  505. numMethods :Longint; (* general (including nonstatic) methods for mtab *)
  506. mt :somMethods_p;
  507. protectedDataOffset :Longint; (* access = resolve(instanceDataToken) + offset *)
  508. somSCIVersion :Longint; (* used during development. currently = 1 *)
  509. numInheritedMethods :Longint;
  510. imt :somInheritedMethod_p; (* inherited method implementations *)
  511. numClassDataEntries :Longint; (* should always be filled in *)
  512. classDataEntryNames :somIdPtr; (* either NULL or ptr to an array of somIds *)
  513. numMigratedMethods :Longint;
  514. mmt :somMigratedMethod_p; (* migrated method implementations *)
  515. numInitializers :Longint; (* the initializers for this class *)
  516. initializers :somIdPtr; (* in order of release *)
  517. somDTSClass :Longint; (* used to identify a DirectToSOM class *)
  518. dsci :somDynamicSCIPtr; (* used to register dynamically computed info *)
  519. (* end of layout version 3 *)
  520. end;
  521. somStaticClassInfo =somStaticClassInfoStruct;
  522. somStaticClassInfoPtr =^somStaticClassInfoStruct;
  523. type
  524. (*----------------------------------------------------------------------
  525. * Typedefs for pointers to functions
  526. *)
  527. Contained_Description = record
  528. name : Identifier;
  529. value : any;
  530. end;
  531. InterfaceDef_FullInterfaceDescription = record
  532. name : Identifier;
  533. id, defined_in : RepositoryId;
  534. {operation : IDL_SEQUENCE_OperationDef_OperationDescription;
  535. attributes : IDL_SEQUENCE_AttributeDef_AttributeDescription;}
  536. end;
  537. InterfaceDef_InterfaceDescription = record
  538. name : Identifier;
  539. id, defined_in : RepositoryId;
  540. end;
  541. (* CORBA 7.6.1, p.139 plus 5.7, p.89 enum Data Type Mapping *)
  542. type
  543. TCKind = Cardinal;
  544. const
  545. TypeCode_tk_null = 1;
  546. TypeCode_tk_void = 2;
  547. TypeCode_tk_short = 3;
  548. TypeCode_tk_long = 4;
  549. TypeCode_tk_ushort = 5;
  550. TypeCode_tk_ulong = 6;
  551. TypeCode_tk_float = 7;
  552. TypeCode_tk_double = 8;
  553. TypeCode_tk_boolean = 9;
  554. TypeCode_tk_char = 10;
  555. TypeCode_tk_octet = 11;
  556. TypeCode_tk_any = 12;
  557. TypeCode_tk_TypeCode = 13;
  558. TypeCode_tk_Principal = 14;
  559. TypeCode_tk_objref = 15;
  560. TypeCode_tk_struct = 16;
  561. TypeCode_tk_union = 17;
  562. TypeCode_tk_enum = 18;
  563. TypeCode_tk_string = 19;
  564. TypeCode_tk_sequence = 20;
  565. TypeCode_tk_array = 21;
  566. TypeCode_tk_pointer = 101; (* SOM extension *)
  567. TypeCode_tk_self = 102; (* SOM extension *)
  568. TypeCode_tk_foreign = 103; (* SOM extension *)
  569. (* Short forms of tk_<x> enumerators *)
  570. tk_null = TypeCode_tk_null;
  571. tk_void = TypeCode_tk_void;
  572. tk_short = TypeCode_tk_short;
  573. tk_long = TypeCode_tk_long;
  574. tk_ushort = TypeCode_tk_ushort;
  575. tk_ulong = TypeCode_tk_ulong;
  576. tk_float = TypeCode_tk_float;
  577. tk_double = TypeCode_tk_double;
  578. tk_boolean = TypeCode_tk_boolean;
  579. tk_char = TypeCode_tk_char;
  580. tk_octet = TypeCode_tk_octet;
  581. tk_any = TypeCode_tk_any;
  582. tk_TypeCode = TypeCode_tk_TypeCode;
  583. tk_Principal = TypeCode_tk_Principal;
  584. tk_objref = TypeCode_tk_objref;
  585. tk_struct = TypeCode_tk_struct;
  586. tk_union = TypeCode_tk_union;
  587. tk_enum = TypeCode_tk_enum;
  588. tk_string = TypeCode_tk_string;
  589. tk_sequence = TypeCode_tk_sequence;
  590. tk_array = TypeCode_tk_array;
  591. tk_pointer = TypeCode_tk_pointer;
  592. tk_self = TypeCode_tk_self;
  593. tk_foreign = TypeCode_tk_foreign;
  594. type
  595. SOMClass_somOffsets = record
  596. cls : SOMClassType;
  597. offset : Longint;
  598. end;
  599. _IDL_SEQUENCE_SOMClass = record
  600. _maximum : Cardinal;
  601. _length : Cardinal;
  602. _buffer : SOMClassPtr;
  603. end;
  604. _IDL_SEQUENCE_SOMObject = record
  605. _maximum : Cardinal;
  606. _length : Cardinal;
  607. _buffer : SOMObjectPtr;
  608. end;
  609. SOMClass_SOMClassSequence = _IDL_SEQUENCE_SOMClass;
  610. (*----------------------------------------------------------------------
  611. * Windows extra procedures:
  612. *)
  613. (*
  614. * Replaceable character output handler.
  615. * Points to the character output routine to be used in development
  616. * support. Initialized to <somOutChar>, but may be reset at anytime.
  617. * Should return 0 (false) if an error occurs and 1 (true) otherwise.
  618. *)
  619. type
  620. somTD_SOMOutCharRoutine =Function(ch:Char):Longint; cdecl;
  621. var
  622. {$warning support of external vars required}
  623. SOMOutCharRoutine :somTD_SOMOutCharRoutine;//³ 00015 ³ SOMOutCharRoutine
  624. Procedure somSetOutChar(outch:somTD_SOMOutCharRoutine); cdecl;
  625. external 'som' name 'somSetOutChar'; {index 85}
  626. Function somMainProgram:SOMClassMgrType; cdecl;
  627. external 'som' name 'somMainProgram'; {index 88}
  628. Procedure somEnvironmentEnd; cdecl;
  629. external 'som' name 'somEnvironmentEnd'; {index 83}
  630. Function somAbnormalEnd:Boolean; cdecl;
  631. external 'som' name 'somAbnormalEnd'; {index 84}
  632. (*--------------------------------------------------------*)
  633. (*---------------------------------------------------------------------
  634. * Offset-based method resolution.
  635. *)
  636. Function somResolve(obj:SOMObjectType; mdata:somMToken):{somMethodProc}pointer; cdecl;
  637. external 'som' name 'somResolve'; {index 37}
  638. Function somParentResolve(parentMtabs:somMethodTabs;
  639. mToken:somMToken):somMethodProc; cdecl;
  640. external 'som' name 'somParentResolve'; {index 33}
  641. Function somParentNumResolve(parentMtabs:somMethodTabs;
  642. parentNum:Longint;mToken:somMToken):{somMethodProc}pointer; cdecl;
  643. external 'som' name 'somParentNumResolve'; {index 50}
  644. Function somClassResolve(obj:SOMClassType; mdata:somMToken):{somMethodProc}pointer; cdecl;
  645. external 'som' name 'somClassResolve'; {index 48}
  646. Function somAncestorResolve(obj:SOMObjectType; (* the object *)
  647. var ccds:somCClassDataStructure; (* id the ancestor *)
  648. mToken:somMToken):{somMethodProc}pointer; cdecl;
  649. external 'som' name 'somAncestorResolve'; {index 74}
  650. Function somResolveByName(obj:SOMObjectType;
  651. methodName:PChar):{somMethodProc}pointer; cdecl;
  652. external 'som' name 'somResolveByName'; {index 61}
  653. (*------------------------------------------------------------------------------
  654. * Offset-based data resolution
  655. *)
  656. Function somDataResolve(obj:SOMObjectType; dataId:somDToken):somToken; cdecl;
  657. external 'som' name 'somDataResolve'; {index 47}
  658. Function somDataResolveChk(obj:SOMObjectType; dataId:somDToken):somToken; cdecl;
  659. external 'som' name 'somDataResolveChk'; {index 72}
  660. (*----------------------------------------------------------------------
  661. * Misc. procedures:
  662. *)
  663. (*
  664. * Create and initialize the SOM environment
  665. *
  666. * Can be called repeatedly
  667. *
  668. * Will be called automatically when first object (including a class
  669. * object) is created, if it has not already been done.
  670. *
  671. * Returns the SOMClassMgrObject
  672. *)
  673. Function somEnvironmentNew:SOMClassMgrType; cdecl;
  674. external 'som' name 'somEnvironmentNew'; {index 30}
  675. (*
  676. * Test whether <obj> is a valid SOM object. This test is based solely on
  677. * the fact that (on this architecture) the first word of a SOM object is a
  678. * pointer to its method table. The test is therefore most correctly understood
  679. * as returning true if and only if <obj> is a pointer to a pointer to a
  680. * valid SOM method table. If so, then methods can be invoked on <obj>.
  681. *)
  682. Function somIsObj(obj:somToken):Boolean; cdecl;
  683. external 'som' name 'somIsObj'; {index 60}
  684. (*
  685. * Return the class that introduced the method represented by a given method token.
  686. *)
  687. Function somGetClassFromMToken(mToken:somMToken):SOMClassType; cdecl;
  688. external 'som' name 'somGetClassFromMToken'; {index 82}
  689. (*----------------------------------------------------------------------
  690. * String Manager: stem <somsm>
  691. *)
  692. Function somCheckID(id:somId):somId; cdecl;
  693. external 'som' name 'somCheckId'; {index 26}
  694. (* makes sure that the id is registered and in normal form, returns *)
  695. (* the id *)
  696. Function somRegisterId(id:somId):Longint; cdecl;
  697. external 'som' name 'somRegisterId'; {index 36}
  698. (* Same as somCheckId except returns 1 (true) if this is the first *)
  699. (* time the string associated with this id has been registered, *)
  700. (* returns 0 (false) otherwise *)
  701. Function somIDFromString(aString:PChar):somId; cdecl;
  702. external 'som' name 'somIdFromString'; {index 31}
  703. (* caller is responsible for freeing the returned id with SOMFree *)
  704. // Not found
  705. //Function somIdFromStringNoFree(aString:PChar):somId; cdecl;
  706. (* call is responsible for *not* freeing the returned id *)
  707. Function somStringFromId(id:somId):PChar; cdecl;
  708. external 'som' name 'somStringFromId'; {index 40}
  709. Function somCompareIds(id1,id2:somId):Longint; cdecl;
  710. external 'som' name 'somCompareIds'; {index 27}
  711. (* returns true (1) if the two ids are equal, else false (0) *)
  712. Function somTotalRegIds:Longint; cdecl;
  713. external 'som' name 'somTotalRegIds'; {index 43}
  714. (* Returns the total number of ids that have been registered so far, *)
  715. (* you can use this to advise the SOM runtime concerning expected *)
  716. (* number of ids in later executions of your program, via a call to *)
  717. (* somSetExpectedIds defined below *)
  718. Procedure somSetExpectedIds(numIds:Longint{ulong}); cdecl;
  719. external 'som' name 'somSetExpectedIds'; {index 39}
  720. (* Tells the SOM runtime how many unique ids you expect to use during *)
  721. (* the execution of your program, this can improve space and time *)
  722. (* utilization slightly, this routine must be called before the SOM *)
  723. (* environment is created to have any effect *)
  724. Function somUniqueKey(id:somId):Longint{ulong}; cdecl;
  725. external 'som' name 'somUniqueKey'; {index 44}
  726. (* Returns the unique key for this id, this key will be the same as the *)
  727. (* key in another id if and only if the other id refers to the same *)
  728. (* name as this one *)
  729. Procedure somBeginPersistentIds; cdecl;
  730. external 'som' name 'somBeginPersistentIds'; {index 24}
  731. (* Tells the id manager that strings for any new ids that are *)
  732. (* registered will never be freed or otherwise modified. This allows *)
  733. (* the id manager to just use a pointer to the string in the *)
  734. (* unregistered id as the master copy of the ids string. Thus saving *)
  735. (* space *)
  736. (* Under normal use (where ids are static varibles) the string *)
  737. (* associated with an id would only be freed if the code module in *)
  738. (* which it occured was unloaded *)
  739. Procedure somEndPersistentIds; cdecl;
  740. external 'som' name 'somEndPersistentIds'; {index 29}
  741. (* Tells the id manager that strings for any new ids that are *)
  742. (* registered may be freed or otherwise modified. Therefore the id *)
  743. (* manager must copy the strings inorder to remember the name of an *)
  744. (* id. *)
  745. (*----------------------------------------------------------------------
  746. * Class Manager: SOMClassMgrType, stem <somcm>
  747. *)
  748. (* Global class manager object *)
  749. var
  750. {$warning support of external vars required}
  751. SOMClassMgrObject : SOMClassMgrType;//³ 00007 ³ SOMClassMgrObject
  752. //Function SOMClassMgrObject:SOMClassMgrType;
  753. (* The somRegisterClassLibrary function is provided for use
  754. * in SOM class libraries on platforms that have loader-invoked
  755. * entry points associated with shared libraries (DLLs).
  756. *
  757. * This function registers a SOM Class Library with the SOM Kernel.
  758. * The library is identified by its file name and a pointer
  759. * to its initialization routine. Since this call may occur
  760. * prior to the invocation of somEnvironmentNew, its actions
  761. * are deferred until the SOM environment has been initialized.
  762. * At that time, the SOMClassMgrObject is informed of all
  763. * pending library initializations via the _somRegisterClassLibrary
  764. * method. The actual invocation of the library's initialization
  765. * routine will occur during the execution of the SOM_MainProgram
  766. * macro (for statically linked libraries), or during the _somFindClass
  767. * method (for libraries that are dynamically loaded).
  768. *)
  769. Procedure somRegisterClassLibrary(libraryName:PChar;
  770. libraryInitRun:somMethodProc); cdecl;
  771. external 'som' name 'somRegisterClassLibrary'; {index 86}
  772. (*----------------------------------------------------------------------
  773. * -- somApply --
  774. *
  775. * This routine replaces direct use of applyStubs in SOMr1. The reason
  776. * for the replacement is that the SOMr1 style of applyStub is not
  777. * generally available in SOMr2, which uses a fixed set of applyStubs,
  778. * according to method information in the somMethodData. In particular,
  779. * neither the redispatch stub nor the apply stub found in the method
  780. * data structure are necessarily useful as such. The method somGetRdStub
  781. * is the way to get a redispatch stub, and the above function is the
  782. * way to call an apply stub. If an appropriate apply stub for the
  783. * method indicated by md is available, then this is invoked and TRUE is
  784. * returned; otherwise FALSE is returned.
  785. *
  786. * The va_list passed to somApply *must* include the target object,
  787. * somSelf, as its first entry, and any single precision floating point
  788. * arguments being passed to the the method procedure must be
  789. * represented on the va_list using double precision values. retVal cannot
  790. * be NULL.
  791. *)
  792. Function somApply(var somSelf:SOMObjectType;
  793. var retVal:somToken;
  794. mdPtr:somMethodDataPtr;
  795. var ap):Boolean; cdecl;
  796. external 'som' name 'somApply'; {index 69}
  797. (*---------------------------------------------------------------------
  798. * -- somBuildClass --
  799. *
  800. * This procedure automates construction of a new class object. A variety of
  801. * special structures are used to allow language bindings to statically define
  802. * the information necessary to specify a class. Pointers to these static
  803. * structures are accumulated into an overall "static class information"
  804. * structure or SCI, passed to somBuildClass. The SCI has evolved over time.
  805. * The current version is defined here.
  806. *)
  807. Function somBuildClass(inherit_vars:Longint;
  808. var sci:somStaticClassInfo;
  809. majorVersion,minorVersion:Longint):SOMClassType; cdecl;
  810. external 'som' name 'somBuildClass'; {index 49}
  811. (*
  812. The arguments to somBuildClass are as follows:
  813. inherit_vars: a bit mask used to control inheritance of implementation
  814. Implementation is inherited from parent i iff the bit 1<<i is on, or i>=32.
  815. sci: the somStaticClassInfo defined above.
  816. majorVersion, minorVersion: the version of the class implementation.
  817. *)
  818. (*---------------------------------------------------------------------
  819. * Used by old single-inheritance emitters to make class creation
  820. * an atomic operation. Kept for backwards compatability.
  821. *)
  822. type
  823. somTD_classInitRoutine=Procedure(var a,b:SOMClassType); cdecl;
  824. Procedure somConstructClass(classInitRoutine:somTD_ClassInitRoutine;
  825. parentClass,metaClass:SOMClassType;
  826. var cds :somClassDataStructure); cdecl;
  827. external 'som' name 'somConstructClass'; {index 28}
  828. (*
  829. * Uses <SOMOutCharRoutine> to output its arguments under control of the ANSI C
  830. * style format. Returns the number of characters output.
  831. *)
  832. Function somPrintf(fnt:PChar;buf:pointer):Longint; cdecl;
  833. external 'som' name 'somPrintf'; {index 35}
  834. // vprint form of somPrintf
  835. Function somVPrintf(fnt:PChar;var ap):Longint; cdecl;
  836. external 'som' name 'somVprintf'; {index 45}
  837. // Outputs (via somPrintf) blanks to prefix a line at the indicated level
  838. Procedure somPrefixLevel(level:Longint); cdecl;
  839. external 'som' name 'somPrefixLevel'; {index 34}
  840. // Combines somPrefixLevel and somPrintf
  841. Procedure somLPrintf(level:Longint;fmt:PChar;var buf); cdecl;
  842. external 'som' name 'somLPrintf'; {index 32}
  843. Function SOMObjectNewClass(majorVersion,minorVersion:Longint):SOMClassType; cdecl;
  844. external 'som' name 'SOMObjectNewClass'; {index 22}
  845. Function SOMClassNewClass(majorVersion,minorVersion:Longint):SOMClassType; cdecl;
  846. external 'som' name 'SOMClassNewClass'; {index 21}
  847. Function SOMClassMgrNewClass(majorVersion,minorVersion:Longint):SOMClassType; cdecl;
  848. external 'som' name 'SOMClassMgrNewClass'; {index 20}
  849. (*----------------------------------------------------------------------
  850. * Pointers to routines used to do dynamic code loading and deleting
  851. *)
  852. type
  853. somTD_SOMLoadModule =Function({IN}Module:PChar (* className *);
  854. {IN}FileName:PChar (* fileName *);
  855. {IN}FuncName:PChar (* functionName *);
  856. {IN}MajorVer:Longint (* majorVersion *);
  857. {IN}MinorVer:Longint (* minorVersion *);
  858. {OUT}var ref:somToken (* modHandle *)):Longint; cdecl;
  859. somTD_SOMDeleteModule =Function({IN} ref:somToken (* modHandle *)):Longint; cdecl;
  860. somTD_SOMClassInitFuncName =Function:PChar; cdecl;
  861. var
  862. {$warning support of external vars required}
  863. SOMLoadModule :somTD_SOMLoadModule;//³ 00011 ³ SOMLoadModule
  864. {$warning support of external vars required}
  865. SOMDeleteModule :somTD_SOMDeleteModule;//³ 00008 ³ SOMDeleteModule
  866. {$warning support of external vars required}
  867. SOMClassInitFuncName :somTD_SOMClassInitFuncName; //³ 00004 ³ SOMClassInitFuncName
  868. (*----------------------------------------------------------------------
  869. * Replaceable SOM Memory Management Interface
  870. *
  871. * External procedure variables SOMCalloc, SOMFree, SOMMalloc, SOMRealloc
  872. * have the same interface as their standard C-library analogs.
  873. *)
  874. type
  875. somTD_SOMMalloc =Function({IN} size_t:Longint (* nbytes *)):somToken; cdecl;
  876. somTD_SOMCalloc =Function({IN} size_c:Longint (* element_count *);
  877. {IN} size_e:Longint (* element_size *)):somToken; cdecl;
  878. somTD_SOMRealloc =Function({IN} ref:somToken (* memory *);
  879. {IN} size:Longint (* nbytes *)):somToken; cdecl;
  880. somTD_SOMFree =Procedure({IN} ref:somToken (* memory *)); cdecl;
  881. var
  882. {$warning support of external vars required}
  883. SOMCalloc :somTD_SOMCalloc; // ³ 00001 ³ SOMCalloc
  884. {$warning support of external vars required}
  885. SOMFree :somTD_SOMFree; //³ 00010 ³ SOMFree
  886. {$warning support of external vars required}
  887. SOMMalloc :somTD_SOMMalloc;//³ 00012 ³ SOMMalloc
  888. {$warning support of external vars required}
  889. SOMRealloc :somTD_SOMRealloc;//³ 00016 ³ SOMRealloc
  890. (*----------------------------------------------------------------------
  891. * Replaceable SOM Error handler
  892. *)
  893. type
  894. somTD_SOMError =Procedure({IN} code:Longint (* code *);
  895. {IN} fn:PChar (* fileName *);
  896. {IN} ln:Longint (* linenum *)); cdecl;
  897. var
  898. {$warning support of external vars required}
  899. SOMError :somTD_SOMError;//³ 00009 ³ SOMError
  900. (*----------------------------------------------------------------------
  901. * Replaceable SOM Semaphore Operations
  902. *
  903. * These operations are used by the SOM Kernel to make thread-safe
  904. * state changes to internal resources.
  905. *)
  906. type
  907. somTD_SOMCreateMutexSem =Function({OUT}var sem:somToken ):Longint; cdecl;
  908. somTD_SOMRequestMutexSem =Function({IN}sem:somToken ):Longint; cdecl;
  909. somTD_SOMReleaseMutexSem =Function({IN}sem:somToken ):Longint; cdecl;
  910. somTD_SOMDestroyMutexSem =Function({IN}sem:somToken ):Longint; cdecl;
  911. var
  912. {$warning support of external vars required}
  913. SOMCreateMutexSem :somTD_SOMCreateMutexSem;//³ 00090 ³ SOMCreateMutexSem
  914. {$warning support of external vars required}
  915. SOMRequestMutexSem :somTD_SOMRequestMutexSem;//³ 00091 ³ SOMRequestMutexSem
  916. {$warning support of external vars required}
  917. SOMReleaseMutexSem :somTD_SOMReleaseMutexSem;//³ 00092 ³ SOMReleaseMutexSem
  918. {$warning support of external vars required}
  919. SOMDestroyMutexSem :somTD_SOMDestroyMutexSem;//³ 00093 ³ SOMDestroyMutexSem
  920. (*----------------------------------------------------------------------
  921. * Replaceable SOM Thread Identifier Operation
  922. *
  923. * This operation is used by the SOM Kernel to index data unique to the
  924. * currently executing thread. It must return a small integer that
  925. * uniquely represents the current thread within the current process.
  926. *)
  927. type
  928. somTD_SOMGetThreadId =Function:Longint; cdecl;
  929. var
  930. {$warning support of external vars required}
  931. SOMGetThreadId :somTD_SOMGetThreadId;//³ 00094 ³ SOMGetThreadId
  932. (*----------------------------------------------------------------------
  933. * Externals used in the implementation of SOM, but not part of the
  934. * SOM API.
  935. *)
  936. Function somTestCls(obj:SOMObjectType; classObj:SOMClassType;
  937. fileName:PChar; lineNumber:Longint):SOMObjectType; cdecl;
  938. external 'som' name 'somTestCls'; {index 42}
  939. Procedure somTest(condition,severity:Longint;fileName:PChar;
  940. lineNum:Longint;msg:PChar); cdecl;
  941. external 'som' name 'somTest'; {index 41}
  942. Procedure somAssert(condition,ecode:Longint;
  943. fileName:PChar;lineNum:Longint;msg:PChar); cdecl;
  944. external 'som' name 'somAssert'; {index 23}
  945. type
  946. exception_type = (NO_EXCEPTION, USER_EXCEPTION, SYSTEM_EXCEPTION);
  947. completion_status = (YES, NO, MAYBE);
  948. StExcep = record
  949. minot : Cardinal;
  950. completed : completion_status;
  951. end;
  952. Environment =^EnvironmentType;
  953. EnvironmentType = record
  954. _major : exception_type;
  955. exception : record
  956. _exception_name : PChar;
  957. _params : Pointer;
  958. end;
  959. _somdAnchor : pointer;
  960. end;
  961. Function somExceptionId(ev:Environment):PChar; cdecl;
  962. external 'som' name 'somExceptionId'; {index 52}
  963. Function somExceptionValue(ev:Environment):Pointer; cdecl;
  964. external 'som' name 'somExceptionValue'; {index 53}
  965. Procedure somExceptionFree(ev:Environment); cdecl;
  966. external 'som' name 'somExceptionFree'; {index 54}
  967. Procedure somSetException(ev:Environment;major:exception_type;exception_name:PChar;params:pointer); cdecl;
  968. external 'som' name 'somSetException'; {index 55}
  969. Function somGetGlobalEnvironment:Environment; cdecl;
  970. external 'som' name 'somGetGlobalEnvironment'; {index 58}
  971. (* Exception function names per CORBA 5.19, p.99 *)
  972. Function exception_id(ev:Environment):PChar; cdecl;
  973. Function exception_value(ev:Environment):Pointer; cdecl;
  974. Procedure exception_free(ev:Environment); cdecl;
  975. (* Convenience macros for manipulating environment structures
  976. *
  977. * SOM_CreateLocalEnvironment returns a pointer to an Environment.
  978. * The other 3 macros all expect a single argument that is also
  979. * a pointer to an Environment. Use the create/destroy forms for
  980. * a dynamic local environment and the init/uninit forms for a stack-based
  981. * local environment.
  982. *
  983. * For example
  984. *
  985. * Environment *ev;
  986. * ev = SOM_CreateLocalEnvironment ();
  987. * ... Use ev in methods
  988. * SOM_DestroyLocalEnvironment (ev);
  989. *
  990. * or
  991. *
  992. * Environment ev;
  993. * SOM_InitEnvironment (&ev);
  994. * ... Use &ev in methods
  995. * SOM_UninitEnvironment (&ev);
  996. *)
  997. Function SOM_CreateLocalEnvironment:Environment; cdecl;
  998. Procedure SOM_DestroyLocalEnvironment(ev:Environment); cdecl;
  999. Procedure SOM_InitEnvironment(ev:Environment); cdecl;
  1000. Procedure SOM_UninitEnvironment(ev:Environment); cdecl;
  1001. (*----------------------------------------------------------------------
  1002. * Macros are used in the C implementation of SOM... However, Pascal
  1003. * doesn't have macro capability... (from SOMCDEV.H)
  1004. *)
  1005. { Change SOM_Resolve(o,ocn,mn) to...
  1006. somTD_ocn_mn(somResolve(SOM_TestCls(o, ocnClassData.classObject), ocnClassData.mn)))
  1007. Change SOM_ResolveNoCheck(o,ocn,mn) to...
  1008. somTD_ocn_mn(somResolve(o,ocnClassData,mn))
  1009. Change SOM_ParentNumResolveCC(pcn,pcp,ocn,mn) to...
  1010. somTD_pcn_mn(somParentNumResolve(ocn_CClassData.parentMtab,pcp,pcnClassData.mn))
  1011. Change SOM_ParentNumResolve(pcn,pcp,mtabs,mn) to...
  1012. somTD_pcn_mn(somParentNumResolve(mtabs,pcp,pcnClassData.mn))
  1013. Change SOM_ClassResolve(cn,class,mn) to...
  1014. somTD_cn_mn(somClassResolve(class,cnClassData.mn))
  1015. Change SOM_ResolveD(o,tdc,cdc,mn) to...
  1016. somTD_tdc_mn(somResolve(SOM_TestCls(o,cdcClassData.classObject), cdcClassData.mn)))
  1017. Change SOM_ParentResolveE(pcn,mtbls,mn) to...
  1018. somTD_pcn_mn(somParentResolve(mtbls,pcnClassData.mn))
  1019. Change SOM_DataResolve(obj,dataId) to...
  1020. somDataResolve(obj, dataId)
  1021. Change SOM_ClassLibrary(name) to...
  1022. somRegisterClassLibrary(name,somMethodProc(SOMInitModule))
  1023. }
  1024. type
  1025. SOMClassCClassDataStructure = record
  1026. parentMtab : somMethodTabs;
  1027. instanceDataToken : somDToken;
  1028. end;
  1029. var
  1030. {$warning support of external vars required}
  1031. SOMClassCClassData : SOMClassCClassDataStructure;//³ 00002 ³ SOMClassCClassData
  1032. type
  1033. SOMClassClassDataStructure = record
  1034. classObject : SOMClassType;
  1035. somNew : somMToken;
  1036. somRenew : somMToken;
  1037. somInitClass : somMToken;
  1038. somClassReady : somMToken;
  1039. somGetName : somMToken;
  1040. somGetParent : somMToken;
  1041. somDescendedFrom : somMToken;
  1042. somCheckVersion : somMToken;
  1043. somFindMethod : somMToken;
  1044. somFindMethodOk : somMToken;
  1045. somSupportsMethod : somMToken;
  1046. somGetNumMethods : somMToken;
  1047. somGetInstanceSize : somMToken;
  1048. somGetInstanceOffset : somMToken;
  1049. somGetInstancePartSize : somMToken;
  1050. somGetMethodIndex : somMToken;
  1051. somGetNumStaticMethods : somMToken;
  1052. somGetPClsMtab : somMToken;
  1053. somGetClassMtab : somMToken;
  1054. somAddStaticMethod : somMToken;
  1055. somOverrideSMethod : somMToken;
  1056. somAddDynamicMethod : somMToken;
  1057. somcPrivate0 : somMToken;
  1058. somGetApplyStub : somMToken;
  1059. somFindSMethod : somMToken;
  1060. somFindSMethodOk : somMToken;
  1061. somGetMethodDescriptor : somMToken;
  1062. somGetNthMethodInfo : somMToken;
  1063. somSetClassData : somMToken;
  1064. somGetClassData : somMToken;
  1065. somNewNoInit : somMToken;
  1066. somRenewNoInit : somMToken;
  1067. somGetInstanceToken : somMToken;
  1068. somGetMemberToken : somMToken;
  1069. somSetMethodDescriptor : somMToken;
  1070. somGetMethodData : somMToken;
  1071. somOverrideMtab : somMToken;
  1072. somGetMethodToken : somMToken;
  1073. somGetParents : somMToken;
  1074. somGetPClsMtabs : somMToken;
  1075. somInitMIClass : somMToken;
  1076. somGetVersionNumbers : somMToken;
  1077. somLookupMethod : somMToken;
  1078. _get_somInstanceDataOffsets : somMToken;
  1079. somRenewNoZero : somMToken;
  1080. somRenewNoInitNoZero : somMToken;
  1081. somAllocate : somMToken;
  1082. somDeallocate : somMToken;
  1083. somGetRdStub : somMToken;
  1084. somGetNthMethodData : somMToken;
  1085. somcPrivate1 : somMToken;
  1086. somcPrivate2 : somMToken;
  1087. _get_somDirectInitClasses : somMToken;
  1088. _set_somDirectInitClasses : somMToken;
  1089. somGetInstanceInitMask : somMToken;
  1090. somGetInstanceDestructionMask : somMToken;
  1091. somcPrivate3 : somMToken;
  1092. somcPrivate4 : somMToken;
  1093. somcPrivate5 : somMToken;
  1094. somcPrivate6 : somMToken;
  1095. somcPrivate7 : somMToken;
  1096. somDefinedMethod : somMToken;
  1097. somcPrivate8 : somMToken;
  1098. somcPrivate9 : somMToken;
  1099. somcPrivate10 : somMToken;
  1100. somcPrivate11 : somMToken;
  1101. somcPrivate12 : somMToken;
  1102. somcPrivate13 : somMToken;
  1103. somcPrivate14 : somMToken;
  1104. somcPrivate15 : somMToken;
  1105. _get_somDataAlignment : somMToken;
  1106. somGetInstanceAssignmentMask : somMToken;
  1107. somcPrivate16 : somMToken;
  1108. somcPrivate17 : somMToken;
  1109. _get_somClassAllocate : somMToken;
  1110. _get_somClassDeallocate : somMToken;
  1111. end;
  1112. var
  1113. {$warning support of external vars required}
  1114. SOMClassClassData : SOMClassClassDataStructure;//³ 00003 ³ SOMClassClassData
  1115. {$warning support of external vars required}
  1116. SOMClassMgrCClassData : somCClassDataStructure;//³ 00005 ³ SOMClassMgrCClassData
  1117. type
  1118. SOMClassMgrClassDataStructure = record
  1119. classObject : SOMClassType;
  1120. somFindClsInFile : somMToken;
  1121. somFindClass : somMToken;
  1122. somClassFromId : somMToken;
  1123. somRegisterClass : somMToken;
  1124. somUnregisterClass : somMToken;
  1125. somLocateClassFile : somMToken;
  1126. somLoadClassFile : somMToken;
  1127. somUnloadClassFile : somMToken;
  1128. somGetInitFunction : somMToken;
  1129. somMergeInto : somMToken;
  1130. somGetRelatedClasses : somMToken;
  1131. somSubstituteClass : somMToken;
  1132. _get_somInterfaceRepository : somMToken;
  1133. _set_somInterfaceRepository : somMToken;
  1134. _get_somRegisteredClasses : somMToken;
  1135. somBeginPersistentClasses : somMToken;
  1136. somEndPersistentClasses : somMToken;
  1137. somcmPrivate1 : somMToken;
  1138. somcmPrivate2 : somMToken;
  1139. somRegisterClassLibrary : somMToken;
  1140. somJoinAffinityGroup : somMToken;
  1141. end;
  1142. var
  1143. {$warning support of external vars required}
  1144. SOMClassMgrClassData : SOMClassMgrClassDataStructure;//³ 00006 ³ SOMClassMgrClassData
  1145. type
  1146. SOMObjectCClassDataStructure = record
  1147. parentMtab :somMethodTabs;
  1148. instanceDataToken :somDToken;
  1149. end;
  1150. var
  1151. {$warning support of external vars required}
  1152. SOMObjectCClassData : SOMObjectCClassDataStructure;//³ 00013 ³ SOMObjectCClassData
  1153. type
  1154. SOMObjectClassDataStructure = record
  1155. classObject : SOMClassType;
  1156. somInit : somMToken;
  1157. somUninit : somMToken;
  1158. somFree : somMToken;
  1159. somDefaultVCopyInit : somMToken;
  1160. somGetClassName : somMToken;
  1161. somGetClass : somMToken;
  1162. somIsA : somMToken;
  1163. somRespondsTo : somMToken;
  1164. somIsInstanceOf : somMToken;
  1165. somGetSize : somMToken;
  1166. somDumpSelf : somMToken;
  1167. somDumpSelfInt : somMToken;
  1168. somPrintSelf : somMToken;
  1169. somDefaultConstVCopyInit : somMToken;
  1170. somDispatchV : somMToken;
  1171. somDispatchL : somMToken;
  1172. somDispatchA : somMToken;
  1173. somDispatchD : somMToken;
  1174. somDispatch : somMToken;
  1175. somClassDispatch : somMToken;
  1176. somCastObj : somMToken;
  1177. somResetObj : somMToken;
  1178. somDefaultInit : somMToken;
  1179. somDestruct : somMToken;
  1180. somPrivate1 : somMToken;
  1181. somPrivate2 : somMToken;
  1182. somDefaultCopyInit : somMToken;
  1183. somDefaultConstCopyInit : somMToken;
  1184. somDefaultAssign : somMToken;
  1185. somDefaultConstAssign : somMToken;
  1186. somDefaultVAssign : somMToken;
  1187. somDefaultConstVAssign : somMToken;
  1188. end;
  1189. var
  1190. {$warning support of external vars required}
  1191. SOMObjectClassData : SOMObjectClassDataStructure;//³ 00014 ³ SOMObjectClassData
  1192. (* Another not ported vars *)
  1193. // Control the printing of method and procedure entry messages,
  1194. // 0-none, 1-user, 2-core&user */
  1195. //SOMEXTERN int SOMDLINK SOM_TraceLevel;
  1196. //³ 00018 ³ SOM_TraceLevel
  1197. // Control the printing of warning messages, 0-none, 1-all
  1198. //SOMEXTERN int SOMDLINK SOM_WarnLevel;
  1199. //³ 00019 ³ SOM_WarnLevel
  1200. // Control the printing of successful assertions, 0-none, 1-user,
  1201. // 2-core&user
  1202. //SOMEXTERN int SOMDLINK SOM_AssertLevel;
  1203. //³ 00017 ³ SOM_AssertLevel
  1204. Implementation
  1205. Function exception_id(ev:Environment):PChar; cdecl;
  1206. begin
  1207. Result := somExceptionId(ev)
  1208. end;
  1209. Function exception_value(ev:Environment):Pointer; cdecl;
  1210. begin
  1211. Result := somExceptionValue(ev)
  1212. end;
  1213. Procedure exception_free(ev:Environment); cdecl;
  1214. begin
  1215. somExceptionFree(ev)
  1216. end;
  1217. Function SOM_CreateLocalEnvironment:Environment; cdecl;
  1218. begin
  1219. Result:=SOMCalloc(1, sizeof(EnvironmentType))
  1220. end;
  1221. Procedure SOM_DestroyLocalEnvironment(ev:Environment); cdecl;
  1222. begin
  1223. somExceptionFree(ev);
  1224. if somGetGlobalEnvironment<>ev then SOMFree(ev);
  1225. end;
  1226. Procedure SOM_InitEnvironment(ev:Environment); cdecl;
  1227. begin
  1228. if somGetGlobalEnvironment<>ev then FillChar(ev^,sizeof(EnvironmentType),0);
  1229. end;
  1230. Procedure SOM_UninitEnvironment(ev:Environment); cdecl;
  1231. begin
  1232. somExceptionFree(ev);
  1233. end;
  1234. End.
  1235. (*
  1236. SOMEXTERN void SOMLINK somCheckArgs(int argc, zString argv[]);
  1237. ³ 00025 ³ somCheckArgs
  1238. ³ 00038 ³ somSaveMetrics // not found
  1239. ³ 00046 ³ somWriteMetrics // not found
  1240. ³ 00051 ³ somCreateDynamicClass // not found
  1241. ³ 00056 ³ SOM_IdTable // not found
  1242. ³ 00057 ³ SOM_IdTableSize // not found
  1243. ³ 00062 ³ somStartCriticalSection // not found
  1244. ³ 00063 ³ somEndCriticalSection // not found
  1245. void* va_SOMObject_somDispatchA(SOMObject *somSelf,
  1246. somId methodId,
  1247. somId descriptor,
  1248. ...)
  1249. ³ 00064 ³ va_SOMObject_somDispatchA
  1250. double va_SOMObject_somDispatchD(SOMObject *somSelf,
  1251. somId methodId,
  1252. somId descriptor,
  1253. ...)
  1254. ³ 00065 ³ va_SOMObject_somDispatchD
  1255. long va_SOMObject_somDispatchL(SOMObject *somSelf,
  1256. somId methodId,
  1257. somId descriptor,
  1258. ...)
  1259. ³ 00066 ³ va_SOMObject_somDispatchL
  1260. void va_SOMObject_somDispatchV(SOMObject *somSelf,
  1261. somId methodId,
  1262. somId descriptor,
  1263. ...)
  1264. ³ 00067 ³ va_SOMObject_somDispatchV
  1265. boolean va_SOMObject_somDispatch(SOMObject *somSelf,
  1266. somToken* retValue,
  1267. somId methodId,
  1268. ...)
  1269. ³ 00068 ³ va_SOMObject_somDispatch
  1270. ³ 00080 ³ somfixMsgTemplate // not found
  1271. ³ 00087 ³ SOMParentDerivedMetaclassClassData // not found
  1272. SOMEXTERN void SOMLINK somUnregisterClassLibrary (string libraryName);
  1273. ³ 00089 ³ somUnregisterClassLibrary
  1274. void* SOMLINK somva_SOMObject_somDispatchA(SOMObject *somSelf,
  1275. somId methodId,
  1276. somId descriptor,
  1277. ...)
  1278. ³ 00096 ³ somva_SOMObject_somDispatchA
  1279. double SOMLINK somva_SOMObject_somDispatchD(SOMObject *somSelf,
  1280. somId methodId,
  1281. somId descriptor,
  1282. ...)
  1283. ³ 00097 ³ somva_SOMObject_somDispatchD
  1284. long SOMLINK somva_SOMObject_somDispatchL(SOMObject *somSelf,
  1285. somId methodId,
  1286. somId descriptor,
  1287. ...)
  1288. ³ 00098 ³ somva_SOMObject_somDispatchL
  1289. void SOMLINK somva_SOMObject_somDispatchV(SOMObject *somSelf,
  1290. somId methodId,
  1291. somId descriptor,
  1292. ...)
  1293. ³ 00099 ³ somva_SOMObject_somDispatchV
  1294. boolean SOMLINK somva_SOMObject_somDispatch(SOMObject *somSelf,
  1295. somToken* retValue,
  1296. somId methodId,
  1297. ...)
  1298. ³ 00100 ³ somva_SOMObject_somDispatch
  1299. boolean SOMLINK somva_SOMObject_somClassDispatch(SOMObject *somSelf,
  1300. SOMClass* clsObj,
  1301. somToken* retValue,
  1302. somId methodId,
  1303. ...)
  1304. ³ 00101 ³ somva_SOMObject_somClassDispatch
  1305. ³ 00132 ³ somFreeThreadData // not found
  1306. SOMEXTERN somMethodProc * SOMLINK somResolveTerminal(SOMClass *, somMToken mdata);
  1307. ³ 00133 ³ somResolveTerminal
  1308. ³ 00135 ³ somIdMarshal // not found
  1309. ³ 00361 ³ somMakeUserRdStub // Not found
  1310. SOMEXTERN somMethodProc * SOMLINK somPCallResolve(SOMObject *obj,
  1311. SOMClass *callingCls,
  1312. somMToken method);
  1313. Ã 00362 Á somPCallResolve
  1314. *)
  1315. {
  1316. $Log$
  1317. Revision 1.1 2003-09-22 13:52:59 yuri
  1318. + Initial import. Mostly backup.
  1319. }