source: trunk/nom/include/nomapi.h@ 250

Last change on this file since 250 was 250, checked in by cinc, 18 years ago

Improvements for the documentation.

File size: 7.9 KB
Line 
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-2007
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.) */
55 nomMethodProc* entries[1];
56} nomMethodTab, *nomMethodTabPtr;
57
58typedef struct nomMethodTabList {
59 nomMethodTab *mtab;
60 struct nomMethodTabList *next;
61} nomMethodTabList, *nomMethodTabs;
62
63typedef struct {
64 nomMethodTab *mtab; /* This class' mtab */
65 nomMethodTabs next; /* The parent mtabs */
66 NOMClass *nomClassObject;
67 gulong ulInstanceSize;
68} nomParentMtabStruct, *nomParentMtabStructPtr;
69
70typedef struct {
71 NOMClass *nomClassObject;
72 nomToken nomTokens[1]; /* method tokens, etc. */
73} nomClassDataStructure, *NomClassDataStructurePtr;
74
75typedef struct nomParmInfoStruct {
76 gulong ulNumParms; /* The number of parameters for this method */
77 gchar* pReturnType;
78 gchar* pParm[]; /* Parameter types */
79}nomParmInfo;
80
81/**
82 This structure defines the method introduced by a class. The IDL compiler
83 puts an array of such structs into the *.ih file which is used by the NOM
84 kernel to build the class.
85 */
86typedef struct nomStaticMethodDescStruct {
87 nomMToken *nomMAddressInClassData; /* Method token in class data struct */
88 nomID nomMethodId; /* This is a 'gchar**' pointing to something like
89 "wpQueryContainerHandle" */
90 char** chrMethodDescriptor; /* This points to something like:
91 "WPFolderWindow:wpQueryContainerHandle" */
92 nomMethodProc *nomMethod; /* Address of the function implementing this
93 method. */
94 nomParmInfo *pParamInfo; /* Information about the parameter types */
95} nomStaticMethodDesc;
96
97/**
98 Structure describing an overriden method. An array of these structures
99 is put into the *.ih file.
100 */
101typedef struct nomOverridenMethodDescStruct {
102 nomID nomMethodId;
103 nomMethodProc *nomMethod;
104 nomMethodProc **nomParentMethod;
105} nomOverridenMethodDesc;
106
107typedef struct {
108 nomParentMtabStructPtr parentMtab;
109 nomDToken instanceDataToken;
110} nomCClassDataStructure, *nomCClassDataStructurePtr;
111
112
113/* This struct carries quite some dead entries (for us)... */
114typedef struct nomStaticClassInfoStruct {
115 gulong ulVersion;
116 gulong ulNumStaticMethods;
117 gulong ulNumStaticOverrides;
118 gulong ulMajorVersion;
119 gulong ulMinorVersion;
120 gulong ulInstanceDataSize;
121 gulong ulNumParents; /* Used for multiple inheritance */
122 nomID nomClassId;
123 nomID nomExplicitMetaId;
124
125 nomClassDataStructure *nomCds;
126 nomCClassDataStructure *ccds;
127 nomStaticMethodDesc* nomSMethods;
128 nomID *nomIdAllParents;
129 char** chrParentClassNames;
130 gulong ulNumParentsInChain;
131 nomOverridenMethodDesc* nomOverridenMethods;
132} nomStaticClassInfo, *nomStaticClassInfoPtr;
133
134
135typedef struct
136{
137 ULONG thunk[4];
138}nomMethodThunk;
139
140#define NOM_FLG_IS_METACLASS 0x00000001
141#define NOM_FLG_NOMUNINIT_OVERRIDEN 0x00000002
142
143/* This structure holds additional informationen about class not to be found in nomMethodTab.
144 It holds the default method table of the class and the thunking code necessary to access
145 data and methods.
146*/
147typedef struct
148{
149 nomMethodTab *mtab; /* This is the mtab for this class it points to thisMtab at the
150 end (not mtab for objects created by this meta class) */
151 gulong ulClassSize; /* The size of an instance (mtab+ instance vars) */
152 gulong ulPrivClassSize; /* The size of this private struct including mtab (not pointr but
153 real filled structure. Do we need this? */
154 // gulong ulIsMetaClass; /* Set to 1 if this is a metaclass */
155 gulong ulClassFlags; /* Set to 1 if this is a metaclass */
156 nomStaticClassInfo *sci; /* Class description */
157 nomMethodTabList mtabList; /* The (private) internal list of mtabs we maintain
158 struct nomMethodTabList {
159 nomMethodTab *mtab; /mtab for this class
160 struct nomMethodTabList *next; / parents
161 } nomMethodTabList, *nomMethodTabs; */
162 nomParentMtabStruct parentMtabStruct; /* used for method lookup and other stuff */
163 gulong thunk[3]; /* Thunking code to get the address of an instance var */
164 nomMethodThunk *mThunk; /* The thunk code to call the methods of this class */
165 NOMClass** entries0; /* Address where our part of the mtab starts (classObject pointer) */
166 nomMethodTab thisMtab; /* mtab structure of this class */
167}NOMClassPriv;
168
169/* For holding a list of class objects */
170typedef struct nomClassList {
171 NOMClass *cls;
172 struct nomClassList *next;
173} nomClassList, *nomClasses;
174
175NOMEXTERN NOMClass * NOMLINK nomBuildClass (gulong ulReserved,
176 nomStaticClassInfo *sci,
177 gulong ulMajorVersion,
178 gulong ulMinorVersion);
179
180//#define nomIsObj(a) ((a)!= 0)
181#endif /* NOMAPI_H_INCLUDED */
182
Note: See TracBrowser for help on using the repository browser.