source: trunk/nom/include/nomapi.h

Last change on this file was 326, checked in by cinc, 17 years ago

Portability patches for Windows, Linux, Darwin by Bird.

File size: 8.7 KB
RevLine 
[94]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>.
[250]18* Portions created by the Initial Developer are Copyright (C) 2005-2007
[94]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. */
39typedef nomToken nomMToken;
40typedef nomToken nomDToken;
41
42
43#ifndef NOM_CLASSINFO_DEFINED
44#define NOM_CLASSINFO_DEFINED
45typedef nomToken nomClassInfo;
46#endif
47
48typedef 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.) */
[294]55 nomId classNomId; /* The unique ID of this class */
[94]56 nomMethodProc* entries[1];
57} nomMethodTab, *nomMethodTabPtr;
58
59typedef struct nomMethodTabList {
60 nomMethodTab *mtab;
61 struct nomMethodTabList *next;
62} nomMethodTabList, *nomMethodTabs;
63
64typedef struct {
65 nomMethodTab *mtab; /* This class' mtab */
66 nomMethodTabs next; /* The parent mtabs */
67 NOMClass *nomClassObject;
68 gulong ulInstanceSize;
69} nomParentMtabStruct, *nomParentMtabStructPtr;
70
71typedef struct {
72 NOMClass *nomClassObject;
73 nomToken nomTokens[1]; /* method tokens, etc. */
74} nomClassDataStructure, *NomClassDataStructurePtr;
75
[251]76/**
77 Structure describing the parameters of a static method. The information
78 is used for runtime type information.
79 */
[250]80typedef struct nomParmInfoStruct {
81 gulong ulNumParms; /* The number of parameters for this method */
82 gchar* pReturnType;
[251]83 gchar* pParm[]; /* Parameter types */
[250]84}nomParmInfo;
85
86/**
87 This structure defines the method introduced by a class. The IDL compiler
88 puts an array of such structs into the *.ih file which is used by the NOM
89 kernel to build the class.
90 */
[94]91typedef struct nomStaticMethodDescStruct {
[250]92 nomMToken *nomMAddressInClassData; /* Method token in class data struct */
[326]93 nomID nomMethodId; /* This is a 'gchar**' pointing to something like
[250]94 "wpQueryContainerHandle" */
95 char** chrMethodDescriptor; /* This points to something like:
96 "WPFolderWindow:wpQueryContainerHandle" */
[326]97 nomMethodProc *nomMethod; /* Address of the function implementing this
[250]98 method. */
99 nomParmInfo *pParamInfo; /* Information about the parameter types */
[94]100} nomStaticMethodDesc;
101
[250]102/**
103 Structure describing an overriden method. An array of these structures
104 is put into the *.ih file.
105 */
[94]106typedef struct nomOverridenMethodDescStruct {
107 nomID nomMethodId;
108 nomMethodProc *nomMethod;
109 nomMethodProc **nomParentMethod;
110} nomOverridenMethodDesc;
111
112typedef struct {
113 nomParentMtabStructPtr parentMtab;
114 nomDToken instanceDataToken;
115} nomCClassDataStructure, *nomCClassDataStructurePtr;
116
117
118/* This struct carries quite some dead entries (for us)... */
119typedef struct nomStaticClassInfoStruct {
120 gulong ulVersion;
121 gulong ulNumStaticMethods;
122 gulong ulNumStaticOverrides;
123 gulong ulMajorVersion;
124 gulong ulMinorVersion;
125 gulong ulInstanceDataSize;
126 gulong ulNumParents; /* Used for multiple inheritance */
127 nomID nomClassId;
128 nomID nomExplicitMetaId;
129
130 nomClassDataStructure *nomCds;
131 nomCClassDataStructure *ccds;
132 nomStaticMethodDesc* nomSMethods;
133 nomID *nomIdAllParents;
134 char** chrParentClassNames;
135 gulong ulNumParentsInChain;
136 nomOverridenMethodDesc* nomOverridenMethods;
137} nomStaticClassInfo, *nomStaticClassInfoPtr;
138
139
140typedef struct
141{
[326]142 gulong thunk[4];
[94]143}nomMethodThunk;
144
[210]145#define NOM_FLG_IS_METACLASS 0x00000001
146#define NOM_FLG_NOMUNINIT_OVERRIDEN 0x00000002
147
[251]148/* This structure holds additional informationen about a class not to be found in nomMethodTab.
[94]149 It holds the default method table of the class and the thunking code necessary to access
[251]150 data and methods. Note that the name may be slightly misleading. This structure is not
151 limited to objects/classes which are related to NOMClass. It's a structure used by every NOM
[326]152 class (be it a normal class or a meta class).
[94]153*/
[326]154typedef struct
[94]155{
156 nomMethodTab *mtab; /* This is the mtab for this class it points to thisMtab at the
[251]157 end. This is not an mtab for objects created by a meta class.
158 Meta classes store the pointer to a NOMClassPriv which specify
159 the objects they may create in a private instance variable. */
[94]160 gulong ulClassSize; /* The size of an instance (mtab+ instance vars) */
161 gulong ulPrivClassSize; /* The size of this private struct including mtab (not pointr but
162 real filled structure. Do we need this? */
[210]163 gulong ulClassFlags; /* Set to 1 if this is a metaclass */
[94]164 nomStaticClassInfo *sci; /* Class description */
[251]165 /* FIXME: the following list may be obsolete maybe when we just use the parentMtabStruc?? */
[326]166 nomMethodTabList mtabList; /* The (private) internal list of mtabs we maintain
[94]167 struct nomMethodTabList {
168 nomMethodTab *mtab; /mtab for this class
169 struct nomMethodTabList *next; / parents
170 } nomMethodTabList, *nomMethodTabs; */
171 nomParentMtabStruct parentMtabStruct; /* used for method lookup and other stuff */
172 gulong thunk[3]; /* Thunking code to get the address of an instance var */
173 nomMethodThunk *mThunk; /* The thunk code to call the methods of this class */
174 NOMClass** entries0; /* Address where our part of the mtab starts (classObject pointer) */
175 nomMethodTab thisMtab; /* mtab structure of this class */
176}NOMClassPriv;
177
178/* For holding a list of class objects */
179typedef struct nomClassList {
180 NOMClass *cls;
181 struct nomClassList *next;
182} nomClassList, *nomClasses;
183
[255]184
185#define NOMENV_FLG_DONT_CHECK_OBJECT 0x00000001
186
187typedef struct
188{
189 gulong fFlags;
190 gpointer pReserved1;
[326]191 gpointer pReserved2;
[255]192}nomEnvironment;
193
194typedef nomEnvironment CORBA_Environment;
195
[94]196NOMEXTERN NOMClass * NOMLINK nomBuildClass (gulong ulReserved,
197 nomStaticClassInfo *sci,
198 gulong ulMajorVersion,
199 gulong ulMinorVersion);
[185]200
[94]201#endif /* NOMAPI_H_INCLUDED */
202
Note: See TracBrowser for help on using the repository browser.