1 | /* ***** BEGIN LICENSE BLOCK *****
|
---|
2 | * Version: CDDL 1.0/LGPL 2.1
|
---|
3 | *
|
---|
4 | * The contents of this file are subject to the COMMON DEVELOPMENT AND
|
---|
5 | * DISTRIBUTION LICENSE (CDDL) Version 1.0 (the "License"); you may not use
|
---|
6 | * this file except in compliance with the License. You may obtain a copy of
|
---|
7 | * the License at http://www.sun.com/cddl/
|
---|
8 | *
|
---|
9 | * Software distributed under the License is distributed on an "AS IS" basis,
|
---|
10 | * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
---|
11 | * for the specific language governing rights and limitations under the
|
---|
12 | * License.
|
---|
13 | *
|
---|
14 | * The Original Code is "NOM" Netlabs Object Model
|
---|
15 | *
|
---|
16 | * The Initial Developer of the Original Code is
|
---|
17 | * netlabs.org: Chris Wohlgemuth <cinc-ml@netlabs.org>.
|
---|
18 | * Portions created by the Initial Developer are Copyright (C) 2005-2006
|
---|
19 | * the Initial Developer. All Rights Reserved.
|
---|
20 | *
|
---|
21 | * Contributor(s):
|
---|
22 | *
|
---|
23 | * Alternatively, the contents of this file may be used under the terms of
|
---|
24 | * the GNU Lesser General Public License Version 2.1 (the "LGPL"), in which
|
---|
25 | * case the provisions of the LGPL are applicable instead of those above. If
|
---|
26 | * you wish to allow use of your version of this file only under the terms of
|
---|
27 | * the LGPL, and not to allow others to use your version of this file under
|
---|
28 | * the terms of the CDDL, indicate your decision by deleting the provisions
|
---|
29 | * above and replace them with the notice and other provisions required by the
|
---|
30 | * LGPL. If you do not delete the provisions above, a recipient may use your
|
---|
31 | * version of this file under the terms of any one of the CDDL or the LGPL.
|
---|
32 | *
|
---|
33 | * ***** END LICENSE BLOCK ***** */
|
---|
34 |
|
---|
35 | #ifndef NOMAPI_H_INCLUDED
|
---|
36 | #define NOMAPI_H_INCLUDED
|
---|
37 |
|
---|
38 | /* Method and data Tokens. */
|
---|
39 | typedef nomToken nomMToken;
|
---|
40 | typedef nomToken nomDToken;
|
---|
41 |
|
---|
42 |
|
---|
43 | #ifndef NOM_CLASSINFO_DEFINED
|
---|
44 | #define NOM_CLASSINFO_DEFINED
|
---|
45 | typedef nomToken nomClassInfo;
|
---|
46 | #endif
|
---|
47 |
|
---|
48 | typedef struct nomMethodTabStruct {
|
---|
49 | NOMClass *nomClassObject; /* Pointer to the class object */
|
---|
50 | nomClassInfo *nomClsInfo; /* Pointer to NOMClassPriv. That struct holds
|
---|
51 | thunking code and extended info. */
|
---|
52 | char *nomClassName; /* Pointer to this class' name */
|
---|
53 | gulong ulInstanceSize; /* Size of an instance of this class */
|
---|
54 | gulong mtabSize; /* Size of this mtab (includes method ptrs.) */
|
---|
55 | nomMethodProc* entries[1];
|
---|
56 | } nomMethodTab, *nomMethodTabPtr;
|
---|
57 |
|
---|
58 | typedef struct nomMethodTabList {
|
---|
59 | nomMethodTab *mtab;
|
---|
60 | struct nomMethodTabList *next;
|
---|
61 | } nomMethodTabList, *nomMethodTabs;
|
---|
62 |
|
---|
63 | typedef struct {
|
---|
64 | nomMethodTab *mtab; /* This class' mtab */
|
---|
65 | nomMethodTabs next; /* The parent mtabs */
|
---|
66 | NOMClass *nomClassObject;
|
---|
67 | gulong ulInstanceSize;
|
---|
68 | } nomParentMtabStruct, *nomParentMtabStructPtr;
|
---|
69 |
|
---|
70 | typedef struct {
|
---|
71 | NOMClass *nomClassObject;
|
---|
72 | nomToken nomTokens[1]; /* method tokens, etc. */
|
---|
73 | } nomClassDataStructure, *NomClassDataStructurePtr;
|
---|
74 |
|
---|
75 | typedef struct nomStaticMethodDescStruct {
|
---|
76 | nomMToken *nomMAddressInClassData;
|
---|
77 | nomID nomMethodId;
|
---|
78 | char** chrMethodDescriptor;
|
---|
79 | nomMethodProc *nomMethod;
|
---|
80 | } nomStaticMethodDesc;
|
---|
81 |
|
---|
82 | typedef struct nomOverridenMethodDescStruct {
|
---|
83 | nomID nomMethodId;
|
---|
84 | nomMethodProc *nomMethod;
|
---|
85 | nomMethodProc **nomParentMethod;
|
---|
86 | } nomOverridenMethodDesc;
|
---|
87 |
|
---|
88 | typedef struct {
|
---|
89 | nomParentMtabStructPtr parentMtab;
|
---|
90 | nomDToken instanceDataToken;
|
---|
91 | } nomCClassDataStructure, *nomCClassDataStructurePtr;
|
---|
92 |
|
---|
93 |
|
---|
94 | /* This struct carries quite some dead entries (for us)... */
|
---|
95 | typedef struct nomStaticClassInfoStruct {
|
---|
96 | gulong ulVersion;
|
---|
97 | gulong ulNumStaticMethods;
|
---|
98 | gulong ulNumStaticOverrides;
|
---|
99 | gulong ulMajorVersion;
|
---|
100 | gulong ulMinorVersion;
|
---|
101 | gulong ulInstanceDataSize;
|
---|
102 | gulong ulNumParents; /* Used for multiple inheritance */
|
---|
103 | nomID nomClassId;
|
---|
104 | nomID nomExplicitMetaId;
|
---|
105 |
|
---|
106 | nomClassDataStructure *nomCds;
|
---|
107 | nomCClassDataStructure *ccds;
|
---|
108 | nomStaticMethodDesc* nomSMethods;
|
---|
109 | nomID *nomIdAllParents;
|
---|
110 | char** chrParentClassNames;
|
---|
111 | gulong ulNumParentsInChain;
|
---|
112 | nomOverridenMethodDesc* nomOverridenMethods;
|
---|
113 | } nomStaticClassInfo, *nomStaticClassInfoPtr;
|
---|
114 |
|
---|
115 |
|
---|
116 | typedef struct
|
---|
117 | {
|
---|
118 | ULONG thunk[4];
|
---|
119 | }nomMethodThunk;
|
---|
120 |
|
---|
121 | #define NOM_FLG_IS_METACLASS 0x00000001
|
---|
122 | #define NOM_FLG_NOMUNINIT_OVERRIDEN 0x00000002
|
---|
123 |
|
---|
124 | /* This structure holds additional informationen about class not to be found in nomMethodTab.
|
---|
125 | It holds the default method table of the class and the thunking code necessary to access
|
---|
126 | data and methods.
|
---|
127 | */
|
---|
128 | typedef struct
|
---|
129 | {
|
---|
130 | nomMethodTab *mtab; /* This is the mtab for this class it points to thisMtab at the
|
---|
131 | end (not mtab for objects created by this meta class) */
|
---|
132 | gulong ulClassSize; /* The size of an instance (mtab+ instance vars) */
|
---|
133 | gulong ulPrivClassSize; /* The size of this private struct including mtab (not pointr but
|
---|
134 | real filled structure. Do we need this? */
|
---|
135 | // gulong ulIsMetaClass; /* Set to 1 if this is a metaclass */
|
---|
136 | gulong ulClassFlags; /* Set to 1 if this is a metaclass */
|
---|
137 | nomStaticClassInfo *sci; /* Class description */
|
---|
138 | nomMethodTabList mtabList; /* The (private) internal list of mtabs we maintain
|
---|
139 | struct nomMethodTabList {
|
---|
140 | nomMethodTab *mtab; /mtab for this class
|
---|
141 | struct nomMethodTabList *next; / parents
|
---|
142 | } nomMethodTabList, *nomMethodTabs; */
|
---|
143 | nomParentMtabStruct parentMtabStruct; /* used for method lookup and other stuff */
|
---|
144 | gulong thunk[3]; /* Thunking code to get the address of an instance var */
|
---|
145 | nomMethodThunk *mThunk; /* The thunk code to call the methods of this class */
|
---|
146 | NOMClass** entries0; /* Address where our part of the mtab starts (classObject pointer) */
|
---|
147 | nomMethodTab thisMtab; /* mtab structure of this class */
|
---|
148 | }NOMClassPriv;
|
---|
149 |
|
---|
150 | /* For holding a list of class objects */
|
---|
151 | typedef struct nomClassList {
|
---|
152 | NOMClass *cls;
|
---|
153 | struct nomClassList *next;
|
---|
154 | } nomClassList, *nomClasses;
|
---|
155 |
|
---|
156 | NOMEXTERN NOMClass * NOMLINK nomBuildClass (gulong ulReserved,
|
---|
157 | nomStaticClassInfo *sci,
|
---|
158 | gulong ulMajorVersion,
|
---|
159 | gulong ulMinorVersion);
|
---|
160 |
|
---|
161 | //#define nomIsObj(a) ((a)!= 0)
|
---|
162 | #endif /* NOMAPI_H_INCLUDED */
|
---|
163 |
|
---|