~ubuntu-branches/ubuntu/gutsy/sip4-qt3/gutsy

« back to all changes in this revision

Viewing changes to sipgen/sip.h

  • Committer: Bazaar Package Importer
  • Author(s): Steve Kowalik
  • Date: 2007-05-24 23:38:46 UTC
  • mfrom: (1.1.5 upstream)
  • Revision ID: james.westby@ubuntu.com-20070524233846-1qx27pdt889yg9t5
Tags: 4.6-1ubuntu1
* Merge from Debian unstable.
* Remaining Ubuntu changes:
  - Build a python-sip4-dbg package.
  - Build the normal extension with -O2, the debug extension with -O0.
  - Set Ubuntu maintainer address.
* Ubuntu changes dropped:
  - python2.5 support.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
/*
2
2
 * The main header file for SIP.
3
3
 *
4
 
 * Copyright (c) 2006
 
4
 * Copyright (c) 2007
5
5
 *      Riverbank Computing Limited <info@riverbankcomputing.co.uk>
6
6
 * 
7
7
 * This file is part of SIP.
40
40
 
41
41
/* For convenience. */
42
42
 
43
 
#define classBaseName(cd)   ((cd) -> iff -> name -> text)
44
 
#define classFQCName(cd)    ((cd) -> iff -> fqcname)
 
43
#define classBaseName(cd)   ((cd)->iff->name->text)
 
44
#define classFQCName(cd)    ((cd)->iff->fqcname)
45
45
 
46
46
 
47
47
/* Handle module flags. */
48
48
 
49
49
#define MOD_HAS_DELAYED_DTORS   0x0001  /* It has a class with a delayed dtor. */
50
 
#define MOD_IS_ORDERED      0x0002  /* Set if the module has been ordered. */
51
50
 
52
 
#define hasDelayedDtors(m)  ((m) -> modflags & MOD_HAS_DELAYED_DTORS)
53
 
#define setHasDelayedDtors(m)   ((m) -> modflags |= MOD_HAS_DELAYED_DTORS)
54
 
#define isOrdered(m)        ((m) -> modflags & MOD_IS_ORDERED)
55
 
#define setIsOrdered(m)     ((m) -> modflags |= MOD_IS_ORDERED)
 
51
#define hasDelayedDtors(m)  ((m)->modflags & MOD_HAS_DELAYED_DTORS)
 
52
#define setHasDelayedDtors(m)   ((m)->modflags |= MOD_HAS_DELAYED_DTORS)
56
53
 
57
54
 
58
55
/* Handle section flags. */
59
56
 
60
 
#define SECT_IS_PUBLIC      0x0001  /* It is public. */
61
 
#define SECT_IS_PROT        0x0002  /* It is protected. */
62
 
#define SECT_IS_PRIVATE     0x0004  /* It is private. */
63
 
#define SECT_IS_SLOT        0x0008  /* It is a slot. */
64
 
#define SECT_IS_SIGNAL      0x0010  /* It is a signal. */
65
 
#define SECT_MASK           0x001f  /* The mask of all flags. */
66
 
 
67
 
 
68
 
/* Handle class flags. */
69
 
 
70
 
#define CLASS_HAS_ENUMS     0x00010000  /* It has enums. */
71
 
#define CLASS_HAS_SIGSLOTS  0x00020000  /* It has signals or slots. */
72
 
#define CLASS_IS_ABSTRACT   0x00040000  /* It is an abstract class. */
73
 
#define CLASS_HAS_SHADOW    0x00080000  /* It is has a shadow class. */
74
 
#define CLASS_IS_OPAQUE     0x00100000  /* It is opaque. */
75
 
#define CLASS_HAS_VAR_HANDLERS  0x00200000  /* It has variable handlers. */
76
 
#define CLASS_DTOR_RELEASE_GIL  0x00400000  /* The dtor releases the GIL. */
77
 
#define CLASS_IS_PROTECTED  0x00800000  /* It is protected. */
78
 
#define CLASS_IS_PROTECTED_SAV  0x01000000  /* It is protected (saved). */
79
 
#define CLASS_IS_RENAMED    0x02000000  /* It has a different Python name. */
80
 
#define CLASS_IS_INCOMPLETE 0x04000000  /* The specification is incomplete. */
81
 
#define CLASS_CAN_CREATE    0x08000000  /* It has usable ctors. */
82
 
#define CLASS_IS_EXTERNAL   0x10000000  /* It is external. */
83
 
#define CLASS_IS_DELAYED_DTOR   0x20000000  /* The dtor is delayed. */
84
 
#define CLASS_NO_DEFAULT_CTORS  0x40000000  /* Don't create default ctors. */
85
 
 
86
 
#define hasEnums(cd)        ((cd) -> classflags & CLASS_HAS_ENUMS)
87
 
#define setHasEnums(cd)     ((cd) -> classflags |= CLASS_HAS_ENUMS)
88
 
#define hasSigSlots(cd)     ((cd) -> classflags & CLASS_HAS_SIGSLOTS)
89
 
#define setHasSigSlots(cd)  ((cd) -> classflags |= CLASS_HAS_SIGSLOTS)
90
 
#define isAbstractClass(cd) ((cd) -> classflags & CLASS_IS_ABSTRACT)
91
 
#define setIsAbstractClass(cd)  ((cd) -> classflags |= CLASS_IS_ABSTRACT)
92
 
#define hasShadow(cd)       ((cd) -> classflags & CLASS_HAS_SHADOW)
93
 
#define setHasShadow(cd)    ((cd) -> classflags |= CLASS_HAS_SHADOW)
94
 
#define resetHasShadow(cd)  ((cd) -> classflags &= ~CLASS_HAS_SHADOW)
95
 
#define isOpaque(cd)        ((cd) -> classflags & CLASS_IS_OPAQUE)
96
 
#define setIsOpaque(cd)     ((cd) -> classflags |= CLASS_IS_OPAQUE)
97
 
#define hasVarHandlers(cd)  ((cd) -> classflags & CLASS_HAS_VAR_HANDLERS)
98
 
#define setHasVarHandlers(cd)   ((cd) -> classflags |= CLASS_HAS_VAR_HANDLERS)
99
 
#define isProtectedClass(cd)    ((cd) -> classflags & CLASS_IS_PROTECTED)
100
 
#define setIsProtectedClass(cd) ((cd) -> classflags |= CLASS_IS_PROTECTED)
101
 
#define resetIsProtectedClass(cd)   ((cd) -> classflags &= ~CLASS_IS_PROTECTED)
102
 
#define wasProtectedClass(cd)   ((cd) -> classflags & CLASS_IS_PROTECTED_SAV)
103
 
#define setWasProtectedClass(cd)    ((cd) -> classflags |= CLASS_IS_PROTECTED_SAV)
104
 
#define resetWasProtectedClass(cd)  ((cd) -> classflags &= ~CLASS_IS_PROTECTED_SAV)
105
 
#define isReleaseGILDtor(c) ((cd) -> classflags & CLASS_DTOR_RELEASE_GIL)
106
 
#define setIsReleaseGILDtor(c)  ((cd) -> classflags |= CLASS_DTOR_RELEASE_GIL)
107
 
#define isRenamedClass(cd)  ((cd) -> classflags & CLASS_IS_RENAMED)
108
 
#define setIsRenamedClass(cd)   ((cd) -> classflags |= CLASS_IS_RENAMED)
109
 
#define isIncomplete(cd)    ((cd) -> classflags & CLASS_IS_INCOMPLETE)
110
 
#define setIsIncomplete(cd) ((cd) -> classflags |= CLASS_IS_INCOMPLETE)
111
 
#define canCreate(cd)       ((cd) -> classflags & CLASS_CAN_CREATE)
112
 
#define setCanCreate(cd)    ((cd) -> classflags |= CLASS_CAN_CREATE)
113
 
#define resetCanCreate(cd)  ((cd) -> classflags &= ~CLASS_CAN_CREATE)
114
 
#define isExternal(cd)      ((cd) -> classflags & CLASS_IS_EXTERNAL)
115
 
#define setIsExternal(cd)   ((cd) -> classflags |= CLASS_IS_EXTERNAL)
116
 
#define isDelayedDtor(cd)   ((cd) -> classflags & CLASS_IS_DELAYED_DTOR)
117
 
#define setIsDelayedDtor(cd)    ((cd) -> classflags |= CLASS_IS_DELAYED_DTOR)
118
 
#define noDefaultCtors(cd)  ((cd) -> classflags & CLASS_NO_DEFAULT_CTORS)
119
 
#define setNoDefaultCtors(cd)   ((cd) -> classflags |= CLASS_NO_DEFAULT_CTORS)
120
 
 
121
 
#define isPublicDtor(cd)    ((cd) -> classflags & SECT_IS_PUBLIC)
122
 
#define setIsPublicDtor(cd) ((cd) -> classflags |= SECT_IS_PUBLIC)
123
 
#define isProtectedDtor(cd) ((cd) -> classflags & SECT_IS_PROT)
124
 
#define isPrivateDtor(cd)   ((cd) -> classflags & SECT_IS_PRIVATE)
125
 
 
126
 
#define isDtor(cd)      ((cd) -> classflags & (SECT_IS_PUBLIC | SECT_IS_PROT | SECT_IS_PRIVATE))
127
 
 
128
 
 
129
 
/* Handle ctor flags. */
130
 
 
131
 
#define CTOR_RELEASE_GIL    0x00010000  /* The ctor releases the GIL. */
132
 
#define CTOR_EXPLICIT       0x00020000  /* The ctor is explicit. */
133
 
#define CTOR_CAST           0x00040000  /* The ctor is a cast. */
134
 
 
135
 
#define isPublicCtor(c)     ((c) -> ctorflags & SECT_IS_PUBLIC)
136
 
#define setIsPublicCtor(c)  ((c) -> ctorflags |= SECT_IS_PUBLIC)
137
 
#define isProtectedCtor(c)  ((c) -> ctorflags & SECT_IS_PROT)
138
 
#define setIsProtectedCtor(c)   ((c) -> ctorflags |= SECT_IS_PROT)
139
 
#define isPrivateCtor(c)    ((c) -> ctorflags & SECT_IS_PRIVATE)
140
 
#define setIsPrivateCtor(c) ((c) -> ctorflags |= SECT_IS_PRIVATE)
141
 
 
142
 
#define isReleaseGILCtor(c) ((c) -> ctorflags & CTOR_RELEASE_GIL)
143
 
#define setIsReleaseGILCtor(c)  ((c) -> ctorflags |= CTOR_RELEASE_GIL)
144
 
#define isExplicitCtor(c)   ((c) -> ctorflags & CTOR_EXPLICIT)
145
 
#define setIsExplicitCtor(c)    ((c) -> ctorflags |= CTOR_EXPLICIT)
146
 
#define isCastCtor(c)       ((c) -> ctorflags & CTOR_CAST)
 
57
#define SECT_IS_PUBLIC      0x01        /* It is public. */
 
58
#define SECT_IS_PROT        0x02        /* It is protected. */
 
59
#define SECT_IS_PRIVATE     0x04        /* It is private. */
 
60
#define SECT_IS_SLOT        0x08        /* It is a slot. */
 
61
#define SECT_IS_SIGNAL      0x10        /* It is a signal. */
 
62
#define SECT_MASK           0x1f        /* The mask of all flags. */
 
63
 
 
64
 
 
65
/* Handle class flags.  These are combined with the section flags. */
 
66
 
 
67
#define CLASS_HAS_ENUMS     0x00000100  /* It has enums. */
 
68
#define CLASS_HAS_SIGSLOTS  0x00000200  /* It has signals or slots. */
 
69
#define CLASS_IS_ABSTRACT   0x00000400  /* It is an abstract class. */
 
70
#define CLASS_HAS_SHADOW    0x00000800  /* It is has a shadow class. */
 
71
#define CLASS_IS_OPAQUE     0x00001000  /* It is opaque. */
 
72
#define CLASS_HAS_VAR_HANDLERS  0x00002000  /* It has variable handlers. */
 
73
#define CLASS_DTOR_RELEASE_GIL  0x00004000  /* The dtor releases the GIL. */
 
74
#define CLASS_IS_PROTECTED  0x00008000  /* It is protected. */
 
75
#define CLASS_IS_PROTECTED_SAV  0x00010000  /* It is protected (saved). */
 
76
#define CLASS_IS_RENAMED    0x00020000  /* It has a different Python name. */
 
77
#define CLASS_IS_INCOMPLETE 0x00040000  /* The specification is incomplete. */
 
78
#define CLASS_CAN_CREATE    0x00080000  /* It has usable ctors. */
 
79
#define CLASS_IS_EXTERNAL   0x00100000  /* It is external. */
 
80
#define CLASS_IS_DELAYED_DTOR   0x00200000  /* The dtor is delayed. */
 
81
#define CLASS_NO_DEFAULT_CTORS  0x00400000  /* Don't create default ctors. */
 
82
#define CLASS_QOBJECT_SUB   0x00800000  /* It is derived from QObject. */
 
83
#define CLASS_DTOR_HOLD_GIL 0x01000000  /* The dtor holds the GIL. */
 
84
 
 
85
#define hasEnums(cd)        ((cd)->classflags & CLASS_HAS_ENUMS)
 
86
#define setHasEnums(cd)     ((cd)->classflags |= CLASS_HAS_ENUMS)
 
87
#define hasSigSlots(cd)     ((cd)->classflags & CLASS_HAS_SIGSLOTS)
 
88
#define setHasSigSlots(cd)  ((cd)->classflags |= CLASS_HAS_SIGSLOTS)
 
89
#define isAbstractClass(cd) ((cd)->classflags & CLASS_IS_ABSTRACT)
 
90
#define setIsAbstractClass(cd)  ((cd)->classflags |= CLASS_IS_ABSTRACT)
 
91
#define hasShadow(cd)       ((cd)->classflags & CLASS_HAS_SHADOW)
 
92
#define setHasShadow(cd)    ((cd)->classflags |= CLASS_HAS_SHADOW)
 
93
#define resetHasShadow(cd)  ((cd)->classflags &= ~CLASS_HAS_SHADOW)
 
94
#define isOpaque(cd)        ((cd)->classflags & CLASS_IS_OPAQUE)
 
95
#define setIsOpaque(cd)     ((cd)->classflags |= CLASS_IS_OPAQUE)
 
96
#define hasVarHandlers(cd)  ((cd)->classflags & CLASS_HAS_VAR_HANDLERS)
 
97
#define setHasVarHandlers(cd)   ((cd)->classflags |= CLASS_HAS_VAR_HANDLERS)
 
98
#define isProtectedClass(cd)    ((cd)->classflags & CLASS_IS_PROTECTED)
 
99
#define setIsProtectedClass(cd) ((cd)->classflags |= CLASS_IS_PROTECTED)
 
100
#define resetIsProtectedClass(cd)   ((cd)->classflags &= ~CLASS_IS_PROTECTED)
 
101
#define wasProtectedClass(cd)   ((cd)->classflags & CLASS_IS_PROTECTED_SAV)
 
102
#define setWasProtectedClass(cd)    ((cd)->classflags |= CLASS_IS_PROTECTED_SAV)
 
103
#define resetWasProtectedClass(cd)  ((cd)->classflags &= ~CLASS_IS_PROTECTED_SAV)
 
104
#define isReleaseGILDtor(c) ((cd)->classflags & CLASS_DTOR_RELEASE_GIL)
 
105
#define setIsReleaseGILDtor(c)  ((cd)->classflags |= CLASS_DTOR_RELEASE_GIL)
 
106
#define isRenamedClass(cd)  ((cd)->classflags & CLASS_IS_RENAMED)
 
107
#define setIsRenamedClass(cd)   ((cd)->classflags |= CLASS_IS_RENAMED)
 
108
#define isIncomplete(cd)    ((cd)->classflags & CLASS_IS_INCOMPLETE)
 
109
#define setIsIncomplete(cd) ((cd)->classflags |= CLASS_IS_INCOMPLETE)
 
110
#define canCreate(cd)       ((cd)->classflags & CLASS_CAN_CREATE)
 
111
#define setCanCreate(cd)    ((cd)->classflags |= CLASS_CAN_CREATE)
 
112
#define resetCanCreate(cd)  ((cd)->classflags &= ~CLASS_CAN_CREATE)
 
113
#define isExternal(cd)      ((cd)->classflags & CLASS_IS_EXTERNAL)
 
114
#define setIsExternal(cd)   ((cd)->classflags |= CLASS_IS_EXTERNAL)
 
115
#define isDelayedDtor(cd)   ((cd)->classflags & CLASS_IS_DELAYED_DTOR)
 
116
#define setIsDelayedDtor(cd)    ((cd)->classflags |= CLASS_IS_DELAYED_DTOR)
 
117
#define noDefaultCtors(cd)  ((cd)->classflags & CLASS_NO_DEFAULT_CTORS)
 
118
#define setNoDefaultCtors(cd)   ((cd)->classflags |= CLASS_NO_DEFAULT_CTORS)
 
119
#define isQObjectSubClass(cd)   ((cd)->classflags & CLASS_QOBJECT_SUB)
 
120
#define setIsQObjectSubClass(cd)    ((cd)->classflags |= CLASS_QOBJECT_SUB)
 
121
#define isHoldGILDtor(c)    ((cd)->classflags & CLASS_DTOR_HOLD_GIL)
 
122
#define setIsHoldGILDtor(c) ((cd)->classflags |= CLASS_DTOR_HOLD_GIL)
 
123
 
 
124
#define isPublicDtor(cd)    ((cd)->classflags & SECT_IS_PUBLIC)
 
125
#define setIsPublicDtor(cd) ((cd)->classflags |= SECT_IS_PUBLIC)
 
126
#define isProtectedDtor(cd) ((cd)->classflags & SECT_IS_PROT)
 
127
#define isPrivateDtor(cd)   ((cd)->classflags & SECT_IS_PRIVATE)
 
128
 
 
129
#define isDtor(cd)          ((cd)->classflags & (SECT_IS_PUBLIC | SECT_IS_PROT | SECT_IS_PRIVATE))
 
130
 
 
131
 
 
132
/* Handle ctor flags.  These are combined with the section flags. */
 
133
 
 
134
#define CTOR_RELEASE_GIL    0x00000100  /* The ctor releases the GIL. */
 
135
#define CTOR_EXPLICIT       0x00000200  /* The ctor is explicit. */
 
136
#define CTOR_CAST           0x00000400  /* The ctor is a cast. */
 
137
#define CTOR_HOLD_GIL       0x00000800  /* The ctor holds the GIL. */
 
138
 
 
139
#define isPublicCtor(c)     ((c)->ctorflags & SECT_IS_PUBLIC)
 
140
#define setIsPublicCtor(c)  ((c)->ctorflags |= SECT_IS_PUBLIC)
 
141
#define isProtectedCtor(c)  ((c)->ctorflags & SECT_IS_PROT)
 
142
#define setIsProtectedCtor(c)   ((c)->ctorflags |= SECT_IS_PROT)
 
143
#define isPrivateCtor(c)    ((c)->ctorflags & SECT_IS_PRIVATE)
 
144
#define setIsPrivateCtor(c) ((c)->ctorflags |= SECT_IS_PRIVATE)
 
145
 
 
146
#define isReleaseGILCtor(c) ((c)->ctorflags & CTOR_RELEASE_GIL)
 
147
#define setIsReleaseGILCtor(c)  ((c)->ctorflags |= CTOR_RELEASE_GIL)
 
148
#define isExplicitCtor(c)   ((c)->ctorflags & CTOR_EXPLICIT)
 
149
#define setIsExplicitCtor(c)    ((c)->ctorflags |= CTOR_EXPLICIT)
 
150
#define isCastCtor(c)       ((c)->ctorflags & CTOR_CAST)
 
151
#define isHoldGILCtor(c)    ((c)->ctorflags & CTOR_HOLD_GIL)
 
152
#define setIsHoldGILCtor(c) ((c)->ctorflags |= CTOR_HOLD_GIL)
147
153
 
148
154
 
149
155
/* Handle member flags. */
150
156
 
151
157
#define MEMBR_NUMERIC       0x0001      /* It is a numeric slot. */
152
158
 
153
 
#define isNumeric(m)        ((m) -> memberflags & MEMBR_NUMERIC)
154
 
#define setIsNumeric(m)     ((m) -> memberflags |= MEMBR_NUMERIC)
155
 
 
156
 
 
157
 
/* Handle enum flags. */
158
 
 
159
 
#define ENUM_WAS_PROT       0x00010000  /* It was defined as protected. */
160
 
#define ENUM_IS_RENAMED     0x00020000  /* It has been renamed. */
161
 
 
162
 
#define isProtectedEnum(e)  ((e) -> enumflags & SECT_IS_PROT)
163
 
#define setIsProtectedEnum(e)   ((e) -> enumflags |= SECT_IS_PROT)
164
 
#define resetIsProtectedEnum(e) ((e) -> enumflags &= ~SECT_IS_PROT)
165
 
 
166
 
#define wasProtectedEnum(e) ((e) -> enumflags & ENUM_WAS_PROT)
167
 
#define setWasProtectedEnum(e)  ((e) -> enumflags |= ENUM_WAS_PROT)
168
 
#define resetWasProtectedEnum(e)    ((e) -> enumflags &= ~ENUM_WAS_PROT)
169
 
#define isRenamedEnum(e)    ((e) -> enumflags & ENUM_IS_RENAMED)
170
 
#define setIsRenamedEnum(e) ((e) -> enumflags |= ENUM_IS_RENAMED)
 
159
#define isNumeric(m)        ((m)->memberflags & MEMBR_NUMERIC)
 
160
#define setIsNumeric(m)     ((m)->memberflags |= MEMBR_NUMERIC)
 
161
 
 
162
 
 
163
/* Handle enum flags.  These are combined with the section flags. */
 
164
 
 
165
#define ENUM_WAS_PROT       0x00000100  /* It was defined as protected. */
 
166
#define ENUM_IS_RENAMED     0x00000200  /* It has been renamed. */
 
167
 
 
168
#define isProtectedEnum(e)  ((e)->enumflags & SECT_IS_PROT)
 
169
#define setIsProtectedEnum(e)   ((e)->enumflags |= SECT_IS_PROT)
 
170
#define resetIsProtectedEnum(e) ((e)->enumflags &= ~SECT_IS_PROT)
 
171
 
 
172
#define wasProtectedEnum(e) ((e)->enumflags & ENUM_WAS_PROT)
 
173
#define setWasProtectedEnum(e)  ((e)->enumflags |= ENUM_WAS_PROT)
 
174
#define resetWasProtectedEnum(e)    ((e)->enumflags &= ~ENUM_WAS_PROT)
 
175
#define isRenamedEnum(e)    ((e)->enumflags & ENUM_IS_RENAMED)
 
176
#define setIsRenamedEnum(e) ((e)->enumflags |= ENUM_IS_RENAMED)
171
177
 
172
178
 
173
179
/* Handle hierarchy flags. */
175
181
#define HIER_IS_DUPLICATE   0x0001      /* It is a super class duplicate. */
176
182
#define HIER_HAS_DUPLICATE  0x0002      /* It has a super class duplicate. */
177
183
 
178
 
#define isDuplicateSuper(m) ((m) -> mroflags & HIER_IS_DUPLICATE)
179
 
#define setIsDuplicateSuper(m)  ((m) -> mroflags |= HIER_IS_DUPLICATE)
180
 
#define hasDuplicateSuper(m)    ((m) -> mroflags & HIER_HAS_DUPLICATE)
181
 
#define setHasDuplicateSuper(m) ((m) -> mroflags |= HIER_HAS_DUPLICATE)
182
 
 
183
 
 
184
 
/* Handle overload flags. */
185
 
 
186
 
#define OVER_IS_VIRTUAL     0x00010000  /* It is virtual. */
187
 
#define OVER_IS_ABSTRACT    0x00020000  /* It is abstract. */
188
 
#define OVER_IS_CONST       0x00040000  /* It is a const function. */
189
 
#define OVER_IS_STATIC      0x00080000  /* It is a static function. */
190
 
#define OVER_IS_AUTOGEN     0x00100000  /* It is auto-generated. */
191
 
#define OVER_IS_NEW_THREAD  0x00200000  /* It is in a new thread. */
192
 
#define OVER_IS_FACTORY     0x00400000  /* It is a factory method. */
193
 
#define OVER_IS_FACTORY     0x00400000  /* It is a factory method. */
194
 
#define OVER_XFERRED_BACK   0x00800000  /* Ownership is transferred back. */
195
 
#define OVER_RELEASE_GIL    0x01000000  /* The function releases the GIL. */
196
 
#define OVER_IS_VIRTUAL_REIMP   0x02000000  /* It is a re-implementation of a virtual. */
197
 
#define OVER_DONT_DEREF_SELF    0x04000000  /* For comparison operators, don't dereference self. */
198
 
 
199
 
#define isPublic(o)         ((o) -> overflags & SECT_IS_PUBLIC)
200
 
#define setIsPublic(o)      ((o) -> overflags |= SECT_IS_PUBLIC)
201
 
#define isProtected(o)      ((o) -> overflags & SECT_IS_PROT)
202
 
#define setIsProtected(o)   ((o) -> overflags |= SECT_IS_PROT)
203
 
#define isPrivate(o)        ((o) -> overflags & SECT_IS_PRIVATE)
204
 
#define setIsPrivate(o)     ((o) -> overflags |= SECT_IS_PRIVATE)
205
 
#define isSlot(o)           ((o) -> overflags & SECT_IS_SLOT)
206
 
#define setIsSlot(o)        ((o) -> overflags |= SECT_IS_SLOT)
207
 
#define isSignal(o)         ((o) -> overflags & SECT_IS_SIGNAL)
208
 
#define setIsSignal(o)      ((o) -> overflags |= SECT_IS_SIGNAL)
209
 
 
210
 
#define isVirtual(o)        ((o) -> overflags & OVER_IS_VIRTUAL)
211
 
#define setIsVirtual(o)     ((o) -> overflags |= OVER_IS_VIRTUAL)
212
 
#define isAbstract(o)       ((o) -> overflags & OVER_IS_ABSTRACT)
213
 
#define setIsAbstract(o)    ((o) -> overflags |= OVER_IS_ABSTRACT)
214
 
#define isConst(o)          ((o) -> overflags & OVER_IS_CONST)
215
 
#define setIsConst(o)       ((o) -> overflags |= OVER_IS_CONST)
216
 
#define isStatic(o)         ((o) -> overflags & OVER_IS_STATIC)
217
 
#define setIsStatic(o)      ((o) -> overflags |= OVER_IS_STATIC)
218
 
#define isAutoGen(o)        ((o) -> overflags & OVER_IS_AUTOGEN)
219
 
#define setIsAutoGen(o)     ((o) -> overflags |= OVER_IS_AUTOGEN)
220
 
#define resetIsAutoGen(o)   ((o) -> overflags &= ~OVER_IS_AUTOGEN)
221
 
#define isNewThread(o)      ((o) -> overflags & OVER_IS_NEW_THREAD)
222
 
#define setIsNewThread(o)   ((o) -> overflags |= OVER_IS_NEW_THREAD)
223
 
#define isFactory(o)        ((o) -> overflags & OVER_IS_FACTORY)
224
 
#define setIsFactory(o)     ((o) -> overflags |= OVER_IS_FACTORY)
225
 
#define isResultTransferredBack(o)  ((o) -> overflags & OVER_XFERRED_BACK)
226
 
#define setIsResultTransferredBack(o)   ((o) -> overflags |= OVER_XFERRED_BACK)
227
 
#define isReleaseGIL(o)     ((o) -> overflags & OVER_RELEASE_GIL)
228
 
#define setIsReleaseGIL(o)  ((o) -> overflags |= OVER_RELEASE_GIL)
229
 
#define isVirtualReimp(o)   ((o) -> overflags & OVER_IS_VIRTUAL_REIMP)
230
 
#define setIsVirtualReimp(o)    ((o) -> overflags |= OVER_IS_VIRTUAL_REIMP)
231
 
#define dontDerefSelf(o)    ((o) -> overflags & OVER_DONT_DEREF_SELF)
232
 
#define setDontDerefSelf(o) ((o) -> overflags |= OVER_DONT_DEREF_SELF)
 
184
#define isDuplicateSuper(m) ((m)->mroflags & HIER_IS_DUPLICATE)
 
185
#define setIsDuplicateSuper(m)  ((m)->mroflags |= HIER_IS_DUPLICATE)
 
186
#define hasDuplicateSuper(m)    ((m)->mroflags & HIER_HAS_DUPLICATE)
 
187
#define setHasDuplicateSuper(m) ((m)->mroflags |= HIER_HAS_DUPLICATE)
 
188
 
 
189
 
 
190
/* Handle overload flags.  These are combined with the section flags. */
 
191
 
 
192
#define OVER_IS_VIRTUAL     0x00000100  /* It is virtual. */
 
193
#define OVER_IS_ABSTRACT    0x00000200  /* It is abstract. */
 
194
#define OVER_IS_CONST       0x00000400  /* It is a const function. */
 
195
#define OVER_IS_STATIC      0x00000800  /* It is a static function. */
 
196
#define OVER_IS_AUTOGEN     0x00001000  /* It is auto-generated. */
 
197
#define OVER_IS_NEW_THREAD  0x00002000  /* It is in a new thread. */
 
198
#define OVER_IS_FACTORY     0x00004000  /* It is a factory method. */
 
199
#define OVER_XFERRED_BACK   0x00008000  /* Ownership is transferred back. */
 
200
#define OVER_RELEASE_GIL    0x00010000  /* The function releases the GIL. */
 
201
#define OVER_IS_VIRTUAL_REIMP   0x00020000  /* It is a re-implementation of a virtual. */
 
202
#define OVER_DONT_DEREF_SELF    0x00040000  /* For comparison operators, don't dereference self. */
 
203
#define OVER_HOLD_GIL       0x00080000  /* The function holds the GIL. */
 
204
 
 
205
#define isPublic(o)         ((o)->overflags & SECT_IS_PUBLIC)
 
206
#define setIsPublic(o)      ((o)->overflags |= SECT_IS_PUBLIC)
 
207
#define isProtected(o)      ((o)->overflags & SECT_IS_PROT)
 
208
#define setIsProtected(o)   ((o)->overflags |= SECT_IS_PROT)
 
209
#define isPrivate(o)        ((o)->overflags & SECT_IS_PRIVATE)
 
210
#define setIsPrivate(o)     ((o)->overflags |= SECT_IS_PRIVATE)
 
211
#define isSlot(o)           ((o)->overflags & SECT_IS_SLOT)
 
212
#define setIsSlot(o)        ((o)->overflags |= SECT_IS_SLOT)
 
213
#define isSignal(o)         ((o)->overflags & SECT_IS_SIGNAL)
 
214
#define setIsSignal(o)      ((o)->overflags |= SECT_IS_SIGNAL)
 
215
 
 
216
#define isVirtual(o)        ((o)->overflags & OVER_IS_VIRTUAL)
 
217
#define setIsVirtual(o)     ((o)->overflags |= OVER_IS_VIRTUAL)
 
218
#define isAbstract(o)       ((o)->overflags & OVER_IS_ABSTRACT)
 
219
#define setIsAbstract(o)    ((o)->overflags |= OVER_IS_ABSTRACT)
 
220
#define isConst(o)          ((o)->overflags & OVER_IS_CONST)
 
221
#define setIsConst(o)       ((o)->overflags |= OVER_IS_CONST)
 
222
#define isStatic(o)         ((o)->overflags & OVER_IS_STATIC)
 
223
#define setIsStatic(o)      ((o)->overflags |= OVER_IS_STATIC)
 
224
#define isAutoGen(o)        ((o)->overflags & OVER_IS_AUTOGEN)
 
225
#define setIsAutoGen(o)     ((o)->overflags |= OVER_IS_AUTOGEN)
 
226
#define resetIsAutoGen(o)   ((o)->overflags &= ~OVER_IS_AUTOGEN)
 
227
#define isNewThread(o)      ((o)->overflags & OVER_IS_NEW_THREAD)
 
228
#define setIsNewThread(o)   ((o)->overflags |= OVER_IS_NEW_THREAD)
 
229
#define isFactory(o)        ((o)->overflags & OVER_IS_FACTORY)
 
230
#define setIsFactory(o)     ((o)->overflags |= OVER_IS_FACTORY)
 
231
#define isResultTransferredBack(o)  ((o)->overflags & OVER_XFERRED_BACK)
 
232
#define setIsResultTransferredBack(o)   ((o)->overflags |= OVER_XFERRED_BACK)
 
233
#define isReleaseGIL(o)     ((o)->overflags & OVER_RELEASE_GIL)
 
234
#define setIsReleaseGIL(o)  ((o)->overflags |= OVER_RELEASE_GIL)
 
235
#define isVirtualReimp(o)   ((o)->overflags & OVER_IS_VIRTUAL_REIMP)
 
236
#define setIsVirtualReimp(o)    ((o)->overflags |= OVER_IS_VIRTUAL_REIMP)
 
237
#define dontDerefSelf(o)    ((o)->overflags & OVER_DONT_DEREF_SELF)
 
238
#define setDontDerefSelf(o) ((o)->overflags |= OVER_DONT_DEREF_SELF)
 
239
#define isHoldGIL(o)        ((o)->overflags & OVER_HOLD_GIL)
 
240
#define setIsHoldGIL(o)     ((o)->overflags |= OVER_HOLD_GIL)
233
241
 
234
242
 
235
243
/* Handle variable flags. */
237
245
#define VAR_IS_STATIC       0x01    /* It is a static variable. */
238
246
#define VAR_NEEDS_HANDLER   0x02    /* It the variable needs a handler. */
239
247
 
240
 
#define isStaticVar(v)      ((v) -> varflags & VAR_IS_STATIC)
241
 
#define setIsStaticVar(v)   ((v) -> varflags |= VAR_IS_STATIC)
242
 
#define needsHandler(v)     ((v) -> varflags & VAR_NEEDS_HANDLER)
243
 
#define setNeedsHandler(v)  ((v) -> varflags |= VAR_NEEDS_HANDLER)
 
248
#define isStaticVar(v)      ((v)->varflags & VAR_IS_STATIC)
 
249
#define setIsStaticVar(v)   ((v)->varflags |= VAR_IS_STATIC)
 
250
#define needsHandler(v)     ((v)->varflags & VAR_NEEDS_HANDLER)
 
251
#define setNeedsHandler(v)  ((v)->varflags |= VAR_NEEDS_HANDLER)
244
252
 
245
253
 
246
254
/* Handle argument flags. */
247
255
 
248
 
#define ARG_IS_REF      0x0001  /* It is a reference. */
 
256
#define ARG_IS_REF          0x0001  /* It is a reference. */
249
257
#define ARG_IS_CONST        0x0002  /* It is a const. */
250
 
#define ARG_XFERRED     0x0004  /* Ownership is transferred. */
 
258
#define ARG_XFERRED         0x0004  /* Ownership is transferred. */
251
259
#define ARG_THIS_XFERRED    0x0008  /* Ownership of this is transferred. */
252
260
#define ARG_XFERRED_BACK    0x0010  /* Ownership is transferred back. */
253
 
#define ARG_ARRAY       0x0020  /* Used as an array. */
 
261
#define ARG_ARRAY           0x0020  /* Used as an array. */
254
262
#define ARG_ARRAY_SIZE      0x0040  /* Used as an array size. */
255
263
#define ARG_ALLOW_NONE      0x0080  /* Allow None as a value. */
256
264
#define ARG_GET_WRAPPER     0x0100  /* Get the wrapper object. */
257
 
#define ARG_IN          0x0200  /* It passes an argument. */
258
 
#define ARG_OUT         0x0400  /* It returns a result. */
 
265
#define ARG_IN              0x0200  /* It passes an argument. */
 
266
#define ARG_OUT             0x0400  /* It returns a result. */
259
267
#define ARG_CONSTRAINED     0x0800  /* Suppress type conversion. */
260
268
 
261
 
#define isReference(a)      ((a) -> argflags & ARG_IS_REF)
262
 
#define setIsReference(a)   ((a) -> argflags |= ARG_IS_REF)
263
 
#define resetIsReference(a) ((a) -> argflags &= ~ARG_IS_REF)
264
 
#define isConstArg(a)       ((a) -> argflags & ARG_IS_CONST)
265
 
#define setIsConstArg(a)    ((a) -> argflags |= ARG_IS_CONST)
266
 
#define resetIsConstArg(a)  ((a) -> argflags &= ~ARG_IS_CONST)
267
 
#define isTransferred(a)    ((a) -> argflags & ARG_XFERRED)
268
 
#define setIsTransferred(a) ((a) -> argflags |= ARG_XFERRED)
269
 
#define isThisTransferred(a)    ((a) -> argflags & ARG_THIS_XFERRED)
270
 
#define setIsThisTransferred(a) ((a) -> argflags |= ARG_THIS_XFERRED)
271
 
#define isTransferredBack(a)    ((a) -> argflags & ARG_XFERRED_BACK)
272
 
#define setIsTransferredBack(a) ((a) -> argflags |= ARG_XFERRED_BACK)
273
 
#define isArray(a)      ((a) -> argflags & ARG_ARRAY)
274
 
#define setArray(a)     ((a) -> argflags |= ARG_ARRAY)
275
 
#define isArraySize(a)      ((a) -> argflags & ARG_ARRAY_SIZE)
276
 
#define setArraySize(a)     ((a) -> argflags |= ARG_ARRAY_SIZE)
277
 
#define isAllowNone(a)      ((a) -> argflags & ARG_ALLOW_NONE)
278
 
#define setAllowNone(a)     ((a) -> argflags |= ARG_ALLOW_NONE)
279
 
#define isGetWrapper(a)     ((a) -> argflags & ARG_GET_WRAPPER)
280
 
#define setGetWrapper(a)    ((a) -> argflags |= ARG_GET_WRAPPER)
281
 
#define isInArg(a)      ((a) -> argflags & ARG_IN)
282
 
#define setIsInArg(a)       ((a) -> argflags |= ARG_IN)
283
 
#define isOutArg(a)     ((a) -> argflags & ARG_OUT)
284
 
#define setIsOutArg(a)      ((a) -> argflags |= ARG_OUT)
285
 
#define isConstrained(a)    ((a) -> argflags & ARG_CONSTRAINED)
286
 
#define setIsConstrained(a) ((a) -> argflags |= ARG_CONSTRAINED)
287
 
#define resetIsConstrained(a)   ((a) -> argflags &= ~ARG_CONSTRAINED)
 
269
#define isReference(a)      ((a)->argflags & ARG_IS_REF)
 
270
#define setIsReference(a)   ((a)-> argflags |= ARG_IS_REF)
 
271
#define resetIsReference(a) ((a)->argflags &= ~ARG_IS_REF)
 
272
#define isConstArg(a)       ((a)->argflags & ARG_IS_CONST)
 
273
#define setIsConstArg(a)    ((a)->argflags |= ARG_IS_CONST)
 
274
#define resetIsConstArg(a)  ((a)->argflags &= ~ARG_IS_CONST)
 
275
#define isTransferred(a)    ((a)->argflags & ARG_XFERRED)
 
276
#define setIsTransferred(a) ((a)->argflags |= ARG_XFERRED)
 
277
#define isThisTransferred(a)    ((a)->argflags & ARG_THIS_XFERRED)
 
278
#define setIsThisTransferred(a) ((a)->argflags |= ARG_THIS_XFERRED)
 
279
#define isTransferredBack(a)    ((a)->argflags & ARG_XFERRED_BACK)
 
280
#define setIsTransferredBack(a) ((a)->argflags |= ARG_XFERRED_BACK)
 
281
#define isArray(a)          ((a)->argflags & ARG_ARRAY)
 
282
#define setArray(a)         ((a)->argflags |= ARG_ARRAY)
 
283
#define isArraySize(a)      ((a)->argflags & ARG_ARRAY_SIZE)
 
284
#define setArraySize(a)     ((a)->argflags |= ARG_ARRAY_SIZE)
 
285
#define isAllowNone(a)      ((a)->argflags & ARG_ALLOW_NONE)
 
286
#define setAllowNone(a)     ((a)->argflags |= ARG_ALLOW_NONE)
 
287
#define isGetWrapper(a)     ((a)->argflags & ARG_GET_WRAPPER)
 
288
#define setGetWrapper(a)    ((a)->argflags |= ARG_GET_WRAPPER)
 
289
#define isInArg(a)          ((a)->argflags & ARG_IN)
 
290
#define setIsInArg(a)       ((a)->argflags |= ARG_IN)
 
291
#define isOutArg(a)         ((a)->argflags & ARG_OUT)
 
292
#define setIsOutArg(a)      ((a)->argflags |= ARG_OUT)
 
293
#define isConstrained(a)    ((a)->argflags & ARG_CONSTRAINED)
 
294
#define setIsConstrained(a) ((a)->argflags |= ARG_CONSTRAINED)
 
295
#define resetIsConstrained(a)   ((a)->argflags &= ~ARG_CONSTRAINED)
288
296
 
289
297
 
290
298
/* Handle name flags. */
292
300
#define NAME_IS_USED        0x01    /* It is used in the main module. */
293
301
#define NAME_IS_CLASS       0x02    /* It is the name of a class. */
294
302
 
295
 
#define isUsedName(n)       ((n) -> nameflags & NAME_IS_USED)
296
 
#define setIsUsedName(n)    ((n) -> nameflags |= NAME_IS_USED)
297
 
#define resetIsUsedName(n)  ((n) -> nameflags &= ~NAME_IS_USED)
298
 
#define isClassName(n)      ((n) -> nameflags & NAME_IS_CLASS)
299
 
#define setIsClassName(n)   ((n) -> nameflags |= NAME_IS_CLASS)
300
 
#define resetIsClassName(n) ((n) -> nameflags &= ~NAME_IS_CLASS)
 
303
#define isUsedName(n)       ((n)->nameflags & NAME_IS_USED)
 
304
#define setIsUsedName(n)    ((n)->nameflags |= NAME_IS_USED)
 
305
#define resetIsUsedName(n)  ((n)->nameflags &= ~NAME_IS_USED)
 
306
#define isClassName(n)      ((n)->nameflags & NAME_IS_CLASS)
 
307
#define setIsClassName(n)   ((n)->nameflags |= NAME_IS_CLASS)
 
308
#define resetIsClassName(n) ((n)->nameflags &= ~NAME_IS_CLASS)
301
309
 
302
310
 
303
311
/* Handle virtual handler flags. */
305
313
#define VH_IS_DUPLICATE     0x01    /* It is a duplicate. */
306
314
#define VH_TRANSFERS        0x02    /* It transfers ownership of the result. */
307
315
 
308
 
#define isDuplicateVH(vh)   ((vh) -> vhflags & VH_IS_DUPLICATE)
309
 
#define setIsDuplicateVH(vh)    ((vh) -> vhflags |= VH_IS_DUPLICATE)
310
 
#define resetIsDuplicateVH(vh)  ((vh) -> vhflags &= ~VH_IS_DUPLICATE)
311
 
#define isTransferVH(vh)    ((vh) -> vhflags & VH_TRANSFERS)
312
 
#define setIsTransferVH(vh) ((vh) -> vhflags |= VH_TRANSFERS)
 
316
#define isDuplicateVH(vh)   ((vh)->vhflags & VH_IS_DUPLICATE)
 
317
#define setIsDuplicateVH(vh)    ((vh)->vhflags |= VH_IS_DUPLICATE)
 
318
#define resetIsDuplicateVH(vh)  ((vh)->vhflags &= ~VH_IS_DUPLICATE)
 
319
#define isTransferVH(vh)    ((vh)->vhflags & VH_TRANSFERS)
 
320
#define setIsTransferVH(vh) ((vh)->vhflags |= VH_TRANSFERS)
313
321
 
314
322
 
315
323
/* Slot types. */
415
423
    ulonglong_type,
416
424
    anyslot_type,
417
425
    cbool_type,
418
 
    sstring_type
 
426
    sstring_type,
 
427
    wstring_type
419
428
} argType;
420
429
 
421
430
 
453
462
/* A software license. */
454
463
 
455
464
typedef struct {
456
 
    char            *type;      /* The license type. */
457
 
    char            *licensee;  /* The licensee. */
458
 
    char            *timestamp; /* The timestamp. */
459
 
    char            *sig;       /* The signature. */
 
465
    char *type;                         /* The license type. */
 
466
    char *licensee;                     /* The licensee. */
 
467
    char *timestamp;                    /* The timestamp. */
 
468
    char *sig;                          /* The signature. */
460
469
} licenseDef;
461
470
 
462
471
 
463
472
/* A version qualifier. */
464
473
 
465
474
typedef struct _qualDef {
466
 
    char            *name;      /* The qualifier name. */
467
 
    qualType        qtype;      /* The qualifier type. */
468
 
    struct _moduleDef   *module;    /* The defining module. */
469
 
    int         line;       /* Timeline if it is a time. */
470
 
    int         order;      /* Order if it is a time. */
471
 
    struct _qualDef *next;          /* Next in the list. */
 
475
    char *name;                         /* The qualifier name. */
 
476
    qualType qtype;                     /* The qualifier type. */
 
477
    struct _moduleDef *module;          /* The defining module. */
 
478
    int line;                           /* Timeline if it is a time. */
 
479
    int order;                          /* Order if it is a time. */
 
480
    struct _qualDef *next;              /* Next in the list. */
472
481
} qualDef;
473
482
 
474
483
 
475
484
/* A scoped name. */
476
485
 
477
486
typedef struct _scopedNameDef {
478
 
    char            *name;      /* The name. */
479
 
    struct _scopedNameDef   *next;      /* Next in the scope list. */
 
487
    char *name;                         /* The name. */
 
488
    struct _scopedNameDef *next;        /* Next in the scope list. */
480
489
} scopedNameDef;
481
490
 
482
491
 
483
492
/* A name. */
484
493
 
485
494
typedef struct _nameDef {
486
 
    int         nameflags;  /* The name flags. */
487
 
    struct _moduleDef   *module;    /* The main module. */
488
 
    char            *text;      /* The text of the name. */
489
 
    struct _nameDef     *next;      /* Next in the list. */
 
495
    int nameflags;                      /* The name flags. */
 
496
    struct _moduleDef *module;          /* The main module. */
 
497
    char *text;                         /* The text of the name. */
 
498
    struct _nameDef *next;              /* Next in the list. */
490
499
} nameDef;
491
500
 
492
501
 
496
505
 */
497
506
 
498
507
typedef struct _nodeDef {
499
 
    int         ordered;    /* Set if in order. */
500
 
    struct _classDef    *cd;        /* The class. */
501
 
    struct _nodeDef     *parent;    /* The parent. */
502
 
    struct _nodeDef     *child;     /* The first child. */
503
 
    struct _nodeDef     *next;      /* The next sibling. */
 
508
    int ordered;                        /* Set if in order. */
 
509
    struct _classDef *cd;               /* The class. */
 
510
    struct _nodeDef *parent;            /* The parent. */
 
511
    struct _nodeDef *child;             /* The first child. */
 
512
    struct _nodeDef *next;              /* The next sibling. */
504
513
} nodeDef;
505
514
 
506
515
 
507
516
/* A module definition. */
508
517
 
509
518
typedef struct _moduleDef {
510
 
    char            *fullname;  /* The full module name. */
511
 
    char            *name;      /* The module base name. */
512
 
    int         version;    /* The module version. */
513
 
    int         modflags;   /* The module flags. */
514
 
    int         modulenr;   /* The module number. */
515
 
    char            *file;      /* The filename. */
516
 
    qualDef         *qualifiers;    /* The list of qualifiers. */
517
 
    nodeDef         root;       /* Root of class tree. */
518
 
    int         nrtimelines;    /* The nr. of timelines. */
519
 
    int         nrclasses;  /* The nr. of classes. */
520
 
    int         nrexceptions;   /* The nr. of exceptions. */
521
 
    int         nrmappedtypes;  /* The nr. of mapped types. */
522
 
    int         nrenums;    /* The nr. of named enums. */
523
 
    int         nrtypedefs; /* The nr. of typedefs. */
524
 
    int         nrvirthandlers; /* The nr. of virtual handlers. */
525
 
    struct _virtHandlerDef  *virthandlers;  /* The virtual handlers. */
526
 
    licenseDef      *license;   /* The software license. */
527
 
    struct _moduleListDef   *imports;   /* The list of imports. */
528
 
    struct _moduleDef   *next;      /* Next in the list. */
 
519
    char *fullname;                     /* The full module name. */
 
520
    char *name;                         /* The module base name. */
 
521
    int version;                        /* The module version. */
 
522
    int modflags;                       /* The module flags. */
 
523
    int modulenr;                       /* The module number. */
 
524
    char *file;                         /* The filename. */
 
525
    qualDef *qualifiers;                /* The list of qualifiers. */
 
526
    nodeDef root;                       /* Root of class tree. */
 
527
    int nrtimelines;                    /* The nr. of timelines. */
 
528
    int nrclasses;                      /* The nr. of classes. */
 
529
    int nrexceptions;                   /* The nr. of exceptions. */
 
530
    int nrmappedtypes;                  /* The nr. of mapped types. */
 
531
    int nrenums;                        /* The nr. of named enums. */
 
532
    int nrtypedefs;                     /* The nr. of typedefs. */
 
533
    int nrvirthandlers;                 /* The nr. of virtual handlers. */
 
534
    struct _virtHandlerDef *virthandlers;   /* The virtual handlers. */
 
535
    licenseDef *license;                /* The software license. */
 
536
    struct _moduleListDef *allimports;  /* The list of all imports. */
 
537
    struct _moduleListDef *imports;     /* The list of direct imports. */
 
538
    struct _moduleDef *next;            /* Next in the list. */
529
539
} moduleDef;
530
540
 
531
541
 
532
542
/* An entry in a linked module list. */
533
543
 
534
544
typedef struct _moduleListDef {
535
 
    moduleDef       *module;    /* The module itself. */
536
 
    struct _moduleListDef   *next;      /* The next in the list. */
 
545
    moduleDef *module;                  /* The module itself. */
 
546
    struct _moduleListDef *next;        /* The next in the list. */
537
547
} moduleListDef;
538
548
 
539
549
 
540
550
/* A literal code block. */
541
551
 
542
552
typedef struct _codeBlock {
543
 
    char            *frag;      /* The code itself. */
544
 
    char            *filename;  /* The original file. */
545
 
    int         linenr;     /* The line in the file. */
546
 
    struct _codeBlock   *next;      /* Next in the list. */
 
553
    char *frag;                         /* The code itself. */
 
554
    char *filename;                     /* The original file. */
 
555
    int linenr;                         /* The line in the file. */
 
556
    struct _codeBlock *next;            /* Next in the list. */
547
557
} codeBlock;
548
558
 
549
559
 
550
560
/* The arguments to a throw specifier. */
551
561
 
552
562
typedef struct _throwArgs {
553
 
    int         nrArgs;     /* The number of arguments. */
554
 
    struct _exceptionDef    *args[MAX_NR_ARGS]; /* The arguments. */
 
563
    int nrArgs;                         /* The number of arguments. */
 
564
    struct _exceptionDef *args[MAX_NR_ARGS];    /* The arguments. */
555
565
} throwArgs;
556
566
 
557
567
 
558
568
/* An exception. */
559
569
 
560
570
typedef struct _exceptionDef {
561
 
    int         exceptionnr;    /* The exception number. */
562
 
    struct _ifaceFileDef    *iff;       /* The interface file. */
563
 
    char            *pyname;    /* The exception Python name. */
564
 
    struct _classDef    *cd;        /* The exception class. */
565
 
    char            *bibase;    /* The builtin base exception. */
566
 
    struct _exceptionDef    *base;      /* The defined base exception. */
567
 
    codeBlock       *hdrcode;   /* Optional header code. */
568
 
    codeBlock       *raisecode; /* Raise exception code. */
569
 
    struct _exceptionDef    *next;      /* The next in the list. */
 
571
    int exceptionnr;                    /* The exception number. */
 
572
    struct _ifaceFileDef *iff;          /* The interface file. */
 
573
    char *pyname;                       /* The exception Python name. */
 
574
    struct _classDef *cd;               /* The exception class. */
 
575
    char *bibase;                       /* The builtin base exception. */
 
576
    struct _exceptionDef *base;         /* The defined base exception. */
 
577
    codeBlock *hdrcode;                 /* Optional header code. */
 
578
    codeBlock *raisecode;               /* Raise exception code. */
 
579
    struct _exceptionDef *next;         /* The next in the list. */
570
580
} exceptionDef;
571
581
 
572
582
 
573
583
/* A value. */
574
584
 
575
585
typedef struct _valueDef {
576
 
    valueType vtype;            /* The type. */
577
 
    char vunop;                 /* Any unary operator. */
578
 
    char vbinop;                /* Any binary operator. */
 
586
    valueType vtype;                    /* The type. */
 
587
    char vunop;                         /* Any unary operator. */
 
588
    char vbinop;                        /* Any binary operator. */
579
589
    union {
580
 
        char vqchar;            /* Quoted character value. */
581
 
        long vnum;              /* Numeric value. */
582
 
        double vreal;           /* Real value. */
583
 
        char *vstr;             /* String value. */
584
 
        scopedNameDef *vscp;    /* Scoped value. */
585
 
        struct _fcallDef *fcd;  /* Function call. */
 
590
        char vqchar;                    /* Quoted character value. */
 
591
        long vnum;                      /* Numeric value. */
 
592
        double vreal;                   /* Real value. */
 
593
        char *vstr;                     /* String value. */
 
594
        scopedNameDef *vscp;            /* Scoped value. */
 
595
        struct _fcallDef *fcd;          /* Function call. */
586
596
    } u;
587
 
    struct _valueDef *next;     /* Next in the expression. */
 
597
    struct _valueDef *next;             /* Next in the expression. */
588
598
} valueDef;
589
599
 
590
600
 
591
601
/* A member function argument (or result). */
592
602
 
593
603
typedef struct {
594
 
    argType atype;              /* The type. */
595
 
    char *name;                 /* The name. */
596
 
    int argflags;               /* The argument flags. */
597
 
    int nrderefs;               /* Nr. of dereferences. */
598
 
    valueDef *defval;           /* The default value. */
 
604
    argType atype;                      /* The type. */
 
605
    char *name;                         /* The name. */
 
606
    int argflags;                       /* The argument flags. */
 
607
    int nrderefs;                       /* Nr. of dereferences. */
 
608
    valueDef *defval;                   /* The default value. */
599
609
    union {
600
610
        struct _signatureDef *sa;       /* If it is a function. */
601
611
        struct _templateDef *td;        /* If it is a template. */
611
621
 
612
622
/* An entry in a linked argument list. */
613
623
typedef struct _argList {
614
 
    argDef          arg;        /* The argument itself. */
615
 
    struct _argList     *next;      /* Next in the list. */
 
624
    argDef arg;                         /* The argument itself. */
 
625
    struct _argList *next;              /* Next in the list. */
616
626
} argList;
617
627
 
618
628
 
619
629
/* A function call. */
620
630
 
621
631
typedef struct _fcallDef {
622
 
    argDef          type;       /* The type. */
623
 
    int         nrArgs;     /* The number of arguments. */
624
 
    struct _valueDef    *args[MAX_NR_ARGS]; /* The arguments. */
 
632
    argDef type;                        /* The type. */
 
633
    int nrArgs;                         /* The number of arguments. */
 
634
    struct _valueDef *args[MAX_NR_ARGS];    /* The arguments. */
625
635
} fcallDef;
626
636
 
627
637
 
628
638
/* An interface file definition. */
629
639
 
630
640
typedef struct _ifaceFileDef {
631
 
    nameDef         *name;      /* The name. */
632
 
    ifaceFileType       type;       /* Interface file type. */
633
 
    scopedNameDef       *fqcname;   /* The fully qualified C++ name. */
634
 
    moduleDef       *module;    /* The owning module. */
635
 
    struct _ifaceFileList   *used;      /* Interface files used. */
636
 
    struct _ifaceFileDef    *next;      /* Next in the list. */
 
641
    nameDef *name;                      /* The name. */
 
642
    ifaceFileType type;                 /* Interface file type. */
 
643
    scopedNameDef *fqcname;             /* The fully qualified C++ name. */
 
644
    moduleDef *module;                  /* The owning module. */
 
645
    struct _ifaceFileList *used;        /* Interface files used. */
 
646
    struct _ifaceFileDef *next;         /* Next in the list. */
637
647
} ifaceFileDef;
638
648
 
639
649
 
640
650
/* An entry in a linked interface file list. */
641
651
 
642
652
typedef struct _ifaceFileList {
643
 
    ifaceFileDef        *iff;       /* The interface file itself. */
644
 
    int         header;     /* If needed in the .h file. */
645
 
    struct _ifaceFileList   *next;      /* Next in the list. */
 
653
    ifaceFileDef *iff;                  /* The interface file itself. */
 
654
    int header;                         /* If needed in the .h file. */
 
655
    struct _ifaceFileList *next;        /* Next in the list. */
646
656
} ifaceFileList;
647
657
 
648
658
 
649
659
/* A mapped type. */
650
660
 
651
661
typedef struct _mappedTypeDef {
652
 
    argDef          type;       /* The type being mapped. */
653
 
    int         mappednr;   /* The mapped type number. */
654
 
    ifaceFileDef        *iff;       /* The interface file. */
655
 
    codeBlock       *hdrcode;   /* Header code. */
656
 
    codeBlock       *convfromcode;  /* Convert from C++ code. */
657
 
    codeBlock       *convtocode;    /* Convert to C++ code. */
658
 
    struct _mappedTypeDef   *next;      /* Next in the list. */
 
662
    argDef type;                        /* The type being mapped. */
 
663
    int mappednr;                       /* The mapped type number. */
 
664
    ifaceFileDef *iff;                  /* The interface file. */
 
665
    codeBlock *hdrcode;                 /* Header code. */
 
666
    codeBlock *convfromcode;            /* Convert from C++ code. */
 
667
    codeBlock *convtocode;              /* Convert to C++ code. */
 
668
    struct _mappedTypeDef *next;        /* Next in the list. */
659
669
} mappedTypeDef;
660
670
 
661
671
 
662
672
/* A function signature. */
663
673
 
664
674
typedef struct _signatureDef {
665
 
    argDef          result;     /* The result. */
666
 
    int         nrArgs;     /* The number of arguments. */
667
 
    argDef          args[MAX_NR_ARGS];  /* The arguments. */
 
675
    argDef result;                      /* The result. */
 
676
    int nrArgs;                         /* The number of arguments. */
 
677
    argDef args[MAX_NR_ARGS];           /* The arguments. */
668
678
} signatureDef;
669
679
 
670
680
 
671
681
/* A list of function signatures. */
672
682
 
673
683
typedef struct _signatureList {
674
 
    struct _signatureDef    *sd;        /* The signature. */
675
 
    struct _signatureList   *next;      /* Next in the list. */
 
684
    struct _signatureDef *sd;           /* The signature. */
 
685
    struct _signatureList *next;        /* Next in the list. */
676
686
} signatureList;
677
687
 
678
688
 
679
689
/* A template type. */
680
690
 
681
691
typedef struct _templateDef {
682
 
    scopedNameDef       *fqname;    /* The name. */
683
 
    signatureDef        types;      /* The types. */
 
692
    scopedNameDef *fqname;              /* The name. */
 
693
    signatureDef types;                 /* The types. */
684
694
} templateDef;
685
695
 
686
696
 
687
697
/* A list of virtual handlers. */
688
698
 
689
699
typedef struct _virtHandlerDef {
690
 
    int         virthandlernr;  /* The nr. of the virtual handler. */
691
 
    int         vhflags;    /* The virtual handler flags. */
692
 
    signatureDef        *pysig;     /* The Python signature. */
693
 
    signatureDef        *cppsig;    /* The C++ signature. */
694
 
    struct _moduleDef   *module;    /* The defining module. */
695
 
    codeBlock       *virtcode;  /* Virtual handler code. */
696
 
    struct _virtHandlerDef  *next;      /* Next in the list. */
 
700
    int virthandlernr;                  /* The nr. of the virtual handler. */
 
701
    int vhflags;                        /* The virtual handler flags. */
 
702
    signatureDef *pysig;                /* The Python signature. */
 
703
    signatureDef *cppsig;               /* The C++ signature. */
 
704
    struct _moduleDef *module;          /* The defining module. */
 
705
    codeBlock *virtcode;                /* Virtual handler code. */
 
706
    struct _virtHandlerDef *next;       /* Next in the list. */
697
707
} virtHandlerDef;
698
708
 
699
709
 
700
710
/* A typedef definition. */
701
711
 
702
712
typedef struct _typedefDef {
703
 
    scopedNameDef       *fqname;    /* The fully qualified name. */
704
 
    struct _classDef    *ecd;       /* The enclosing class. */
705
 
    moduleDef       *module;    /* The owning module. */
706
 
    argDef          type;       /* The actual type. */
707
 
    struct _typedefDef  *next;      /* Next in the list. */
 
713
    scopedNameDef *fqname;              /* The fully qualified name. */
 
714
    struct _classDef *ecd;              /* The enclosing class. */
 
715
    moduleDef *module;                  /* The owning module. */
 
716
    argDef type;                        /* The actual type. */
 
717
    struct _typedefDef *next;           /* Next in the list. */
708
718
} typedefDef;
709
719
 
710
720
 
711
721
/* A variable definition. */
712
722
 
713
723
typedef struct _varDef {
714
 
    nameDef         *pyname;    /* The variable Python name. */
715
 
    scopedNameDef       *fqcname;   /* The fully qualified C/C++ name. */
716
 
    struct _classDef    *ecd;       /* The enclosing class. */
717
 
    moduleDef       *module;    /* The owning module. */
718
 
    int         varflags;   /* The variable flags. */
719
 
    argDef          type;       /* The actual type. */
720
 
    codeBlock       *accessfunc;    /* The access function. */
721
 
    codeBlock       *getcode;   /* The get code. */
722
 
    codeBlock       *setcode;   /* The set code. */
723
 
    struct _varDef      *next;      /* Next in the list. */
 
724
    nameDef *pyname;                    /* The variable Python name. */
 
725
    scopedNameDef *fqcname;             /* The fully qualified C/C++ name. */
 
726
    struct _classDef *ecd;              /* The enclosing class. */
 
727
    moduleDef *module;                  /* The owning module. */
 
728
    int varflags;                       /* The variable flags. */
 
729
    argDef type;                        /* The actual type. */
 
730
    codeBlock *accessfunc;              /* The access function. */
 
731
    codeBlock *getcode;                 /* The get code. */
 
732
    codeBlock *setcode;                 /* The set code. */
 
733
    struct _varDef *next;               /* Next in the list. */
724
734
} varDef;
725
735
 
726
736
 
727
737
/* An overloaded member function definition. */
728
738
 
729
739
typedef struct _overDef {
730
 
    char            *cppname;   /* The C++ name. */
731
 
    int         overflags;  /* The overload flags. */
732
 
    struct _memberDef   *common;    /* Common parts. */
733
 
    signatureDef        pysig;      /* The Python signature. */
734
 
    signatureDef        *cppsig;    /* The C++ signature. */
735
 
    throwArgs       *exceptions;    /* The exceptions. */
736
 
    codeBlock       *methodcode;    /* Method code. */
737
 
    virtHandlerDef      *virthandler;   /* The virtual handler. */
738
 
    char            *prehook;   /* The pre-hook name. */
739
 
    char            *posthook;  /* The post-hook name. */
740
 
    struct _overDef     *next;      /* Next in the list. */
 
740
    char *cppname;                      /* The C++ name. */
 
741
    int overflags;                      /* The overload flags. */
 
742
    struct _memberDef *common;          /* Common parts. */
 
743
    signatureDef pysig;                 /* The Python signature. */
 
744
    signatureDef *cppsig;               /* The C++ signature. */
 
745
    throwArgs *exceptions;              /* The exceptions. */
 
746
    codeBlock *methodcode;              /* Method code. */
 
747
    virtHandlerDef *virthandler;        /* The virtual handler. */
 
748
    char *prehook;                      /* The pre-hook name. */
 
749
    char *posthook;                     /* The post-hook name. */
 
750
    struct _overDef *next;              /* Next in the list. */
741
751
} overDef;
742
752
 
743
753
 
744
754
/* An overloaded constructor definition. */
745
755
 
746
756
typedef struct _ctorDef {
747
 
    int         ctorflags;  /* The ctor flags. */
748
 
    signatureDef        pysig;      /* The Python signature. */
749
 
    signatureDef        *cppsig;    /* The C++ signature, NULL if /NoDerived/. */
750
 
    throwArgs       *exceptions;    /* The exceptions. */
751
 
    codeBlock       *methodcode;    /* Method code. */
752
 
    char            *prehook;   /* The pre-hook name. */
753
 
    char            *posthook;  /* The post-hook name. */
754
 
    struct _ctorDef     *next;      /* Next in the list. */
 
757
    int ctorflags;                      /* The ctor flags. */
 
758
    signatureDef pysig;                 /* The Python signature. */
 
759
    signatureDef *cppsig;               /* The C++ signature, NULL if /NoDerived/. */
 
760
    throwArgs *exceptions;              /* The exceptions. */
 
761
    codeBlock *methodcode;              /* Method code. */
 
762
    char *prehook;                      /* The pre-hook name. */
 
763
    char *posthook;                     /* The post-hook name. */
 
764
    struct _ctorDef *next;              /* Next in the list. */
755
765
} ctorDef;
756
766
 
757
767
 
758
768
/* An enumerated type member definition. */
759
769
 
760
770
typedef struct _enumMemberDef {
761
 
    nameDef         *pyname;    /* The Python name. */
762
 
    char            *cname;     /* The C/C++ name. */
763
 
    struct _enumDef     *ed;        /* The enclosing enum. */
764
 
    struct _enumMemberDef   *next;      /* Next in the list. */
 
771
    nameDef *pyname;                    /* The Python name. */
 
772
    char *cname;                        /* The C/C++ name. */
 
773
    struct _enumDef *ed;                /* The enclosing enum. */
 
774
    struct _enumMemberDef *next;        /* Next in the list. */
765
775
} enumMemberDef;
766
776
 
767
777
 
768
778
/* An enumerated type definition. */
769
779
 
770
780
typedef struct _enumDef {
771
 
    int         enumflags;  /* The enum flags. */
772
 
    scopedNameDef       *fqcname;   /* The name (may be NULL). */
773
 
    nameDef         *pyname;    /* The Python name (may be NULL). */
774
 
    int         enumnr;     /* The enum number. */
775
 
    struct _classDef    *ecd;       /* The enclosing class. */
776
 
    struct _classDef    *pcd;       /* The publishing class. */
777
 
    moduleDef       *module;    /* The owning module. */
778
 
    enumMemberDef       *members;   /* The list of members. */
779
 
    struct _memberDef   *slots;     /* The list of slots. */
780
 
    struct _overDef     *overs;     /* The list of slot overloads. */
781
 
    struct _enumDef     *next;      /* Next in the list. */
 
781
    int enumflags;                      /* The enum flags. */
 
782
    scopedNameDef *fqcname;             /* The name (may be NULL). */
 
783
    nameDef *pyname;                    /* The Python name (may be NULL). */
 
784
    int enumnr;                         /* The enum number. */
 
785
    struct _classDef *ecd;              /* The enclosing class. */
 
786
    struct _classDef *pcd;              /* The publishing class. */
 
787
    moduleDef *module;                  /* The owning module. */
 
788
    enumMemberDef *members;             /* The list of members. */
 
789
    struct _memberDef *slots;           /* The list of slots. */
 
790
    struct _overDef *overs;             /* The list of slot overloads. */
 
791
    struct _enumDef *next;              /* Next in the list. */
782
792
} enumDef;
783
793
 
784
794
 
785
795
/* An member function definition. */
786
796
 
787
797
typedef struct _memberDef {
788
 
    nameDef         *pyname;    /* The Python name. */
789
 
    int         memberflags;    /* The member flags. */
790
 
    slotType        slot;       /* The slot type. */
791
 
    moduleDef       *module;    /* The owning module. */
792
 
    struct _memberDef   *next;      /* Next in the list. */
 
798
    nameDef *pyname;                    /* The Python name. */
 
799
    int memberflags;                    /* The member flags. */
 
800
    slotType slot;                      /* The slot type. */
 
801
    moduleDef *module;                  /* The owning module. */
 
802
    struct _memberDef *next;            /* Next in the list. */
793
803
} memberDef;
794
804
 
795
805
 
796
806
/* A list of visible member functions. */
797
807
 
798
808
typedef struct _visibleList {
799
 
    memberDef       *m;     /* The member definition. */
800
 
    struct _classDef    *cd;        /* The class. */
801
 
    struct _visibleList *next;      /* Next in the list. */
 
809
    memberDef *m;                       /* The member definition. */
 
810
    struct _classDef *cd;               /* The class. */
 
811
    struct _visibleList *next;          /* Next in the list. */
802
812
} visibleList;
803
813
 
804
814
 
805
815
/* An entry in a linked class list. */
806
816
 
807
817
typedef struct _classList {
808
 
    struct _classDef    *cd;        /* The class itself. */
809
 
    struct _classList   *next;      /* Next in the list. */
 
818
    struct _classDef *cd;               /* The class itself. */
 
819
    struct _classList *next;            /* Next in the list. */
810
820
} classList;
811
821
 
812
822
 
813
823
/* A virtual overload definition. */
814
824
 
815
825
typedef struct _virtOverDef {
816
 
    overDef         o;      /* The overload. */
817
 
    struct _classDef    *scope;     /* The overload scope. */
818
 
    struct _virtOverDef *next;      /* Next in the list. */
 
826
    overDef o;                          /* The overload. */
 
827
    struct _classDef *scope;            /* The overload scope. */
 
828
    struct _virtOverDef *next;          /* Next in the list. */
819
829
} virtOverDef;
820
830
 
821
831
 
822
832
/* A class that appears in a class's hierarchy. */
823
833
 
824
834
typedef struct _mroDef {
825
 
    struct _classDef    *cd;        /* The class. */
826
 
    int         mroflags;       /* The hierarchy flags. */
827
 
    struct _mroDef      *next;      /* The next in the list. */
 
835
    struct _classDef *cd;               /* The class. */
 
836
    int mroflags;                       /* The hierarchy flags. */
 
837
    struct _mroDef *next;               /* The next in the list. */
828
838
} mroDef;
829
839
 
830
840
 
831
841
/* A class definition. */
832
842
 
833
843
typedef struct _classDef {
834
 
    int         classflags; /* The class flags. */
835
 
    int         classnr;    /* The class number. */
836
 
    char            *pyname;    /* The Python name. */
837
 
    ifaceFileDef        *iff;       /* The interface file. */
838
 
    struct _classDef    *ecd;       /* The enclosing scope. */
839
 
    struct _classDef    *real;      /* The real class if this is a proxy or extender. */
840
 
    nodeDef         *node;      /* Position in class tree. */
841
 
    classList       *supers;    /* The parent classes. */
842
 
    mroDef          *mro;       /* The super-class hierarchy. */
843
 
    templateDef     *td;        /* The instantiated template. */
844
 
    ctorDef         *ctors;     /* The constructors. */
845
 
    ctorDef         *defctor;   /* The default ctor. */
846
 
    codeBlock       *dealloccode;   /* Handwritten dealloc code. */
847
 
    codeBlock       *dtorcode;  /* Handwritten dtor code. */
848
 
    throwArgs       *dtorexceptions;    /* The dtor exceptions. */
849
 
    memberDef       *members;   /* The member functions. */
850
 
    overDef         *overs;     /* The overloads. */
851
 
    argList         *casts;     /* The operator casts. */
852
 
    virtOverDef     *vmembers;  /* The virtual members. */
853
 
    visibleList     *visible;   /* The visible members. */
854
 
    codeBlock       *cppcode;   /* Class C++ code. */
855
 
    codeBlock       *hdrcode;   /* Class header code. */
856
 
    codeBlock       *convtosubcode; /* Convert to sub C++ code. */
857
 
    struct _classDef    *subbase;   /* Sub-class base class. */
858
 
    codeBlock       *convtocode;    /* Convert to C++ code. */
859
 
    codeBlock       *travcode;  /* Traverse code. */
860
 
    codeBlock       *clearcode; /* Clear code. */
861
 
    codeBlock       *readbufcode;   /* Read buffer code. */
862
 
    codeBlock       *writebufcode;  /* Write buffer code. */
863
 
    codeBlock       *segcountcode;  /* Segment count code. */
864
 
    codeBlock       *charbufcode;   /* Character buffer code. */
865
 
    struct _classDef    *next;      /* Next in the list. */
 
844
    int classflags;                     /* The class flags. */
 
845
    int userflags;                      /* The user type flags. */
 
846
    int classnr;                        /* The class number. */
 
847
    char *pyname;                       /* The Python name. */
 
848
    ifaceFileDef *iff;                  /* The interface file. */
 
849
    struct _classDef *ecd;              /* The enclosing scope. */
 
850
    struct _classDef *real;             /* The real class if this is a proxy or extender. */
 
851
    nodeDef *node;                      /* Position in class tree. */
 
852
    classList *supers;                  /* The parent classes. */
 
853
    mroDef *mro;                        /* The super-class hierarchy. */
 
854
    templateDef *td;                    /* The instantiated template. */
 
855
    ctorDef *ctors;                     /* The constructors. */
 
856
    ctorDef *defctor;                   /* The default ctor. */
 
857
    codeBlock *dealloccode;             /* Handwritten dealloc code. */
 
858
    codeBlock *dtorcode;                /* Handwritten dtor code. */
 
859
    throwArgs *dtorexceptions;          /* The dtor exceptions. */
 
860
    memberDef *members;                 /* The member functions. */
 
861
    overDef *overs;                     /* The overloads. */
 
862
    argList *casts;                     /* The operator casts. */
 
863
    virtOverDef *vmembers;              /* The virtual members. */
 
864
    visibleList *visible;               /* The visible members. */
 
865
    codeBlock *cppcode;                 /* Class C++ code. */
 
866
    codeBlock *hdrcode;                 /* Class header code. */
 
867
    codeBlock *convtosubcode;           /* Convert to sub C++ code. */
 
868
    struct _classDef *subbase;          /* Sub-class base class. */
 
869
    codeBlock *convtocode;              /* Convert to C++ code. */
 
870
    codeBlock *travcode;                /* Traverse code. */
 
871
    codeBlock *clearcode;               /* Clear code. */
 
872
    codeBlock *readbufcode;             /* Read buffer code. */
 
873
    codeBlock *writebufcode;            /* Write buffer code. */
 
874
    codeBlock *segcountcode;            /* Segment count code. */
 
875
    codeBlock *charbufcode;             /* Character buffer code. */
 
876
    struct _classDef *next;             /* Next in the list. */
866
877
} classDef;
867
878
 
868
879
 
869
880
/* A class template definition. */
870
881
 
871
882
typedef struct _classTmplDef {
872
 
    signatureDef        sig;        /* The template arguments. */
873
 
    classDef        *cd;        /* The class itself. */
874
 
    struct _classTmplDef    *next;      /* The next in the list. */
 
883
    signatureDef sig;                   /* The template arguments. */
 
884
    classDef *cd;                       /* The class itself. */
 
885
    struct _classTmplDef *next;         /* The next in the list. */
875
886
} classTmplDef;
876
887
 
877
888
 
878
889
/* A mapped type template definition. */
879
890
 
880
891
typedef struct _mappedTypeTmplDef {
881
 
    signatureDef        sig;        /* The template arguments. */
882
 
    mappedTypeDef       *mt;        /* The mapped type itself. */
883
 
    struct _mappedTypeTmplDef   *next;  /* The next in the list. */
 
892
    signatureDef sig;                   /* The template arguments. */
 
893
    mappedTypeDef *mt;                  /* The mapped type itself. */
 
894
    struct _mappedTypeTmplDef *next;    /* The next in the list. */
884
895
} mappedTypeTmplDef;
885
896
 
886
897
 
887
898
/* The parse tree corresponding to the specification file. */
888
899
 
889
900
typedef struct {
890
 
    moduleDef       *module;    /* This module. */
891
 
    moduleDef       *modules;   /* The list of modules. */
892
 
    moduleListDef       *allimports;    /* The list of all imports. */
893
 
    nameDef         *namecache; /* The name cache. */
894
 
    ifaceFileDef        *ifacefiles;    /* The list of interface files. */
895
 
    classDef        *classes;   /* The list of classes. */
896
 
    classTmplDef        *classtemplates;    /* The list of class templates. */
897
 
    classDef        *proxies;   /* The list of proxy classes. */
898
 
    exceptionDef        *exceptions;    /* The list of exceptions. */
899
 
    mappedTypeDef       *mappedtypes;   /* The mapped types. */
900
 
    mappedTypeTmplDef   *mappedtypetemplates;   /* The list of mapped type templates. */
901
 
    int         qobjclass;  /* QObject class, -1 if none. */
902
 
    enumDef         *enums;     /* List of enums. */
903
 
    varDef          *vars;      /* List of variables. */
904
 
    memberDef       *othfuncs;  /* List of other functions. */
905
 
    overDef         *overs;     /* Global overloads. */
906
 
    typedefDef      *typedefs;  /* List of typedefs. */
907
 
    codeBlock       *copying;   /* Software license. */
908
 
    codeBlock       *exphdrcode;    /* Exported header code. */
909
 
    codeBlock       *hdrcode;   /* Header code. */
910
 
    codeBlock       *cppcode;   /* Global C++ code. */
911
 
    codeBlock       *docs;      /* Documentation. */
912
 
    codeBlock       *preinitcode;   /* Pre-initialisation code. */
913
 
    codeBlock       *postinitcode;  /* Post-initialisation code. */
914
 
    codeBlock       *unitcode;  /* Compileation unit code. */
915
 
    ifaceFileList       *used;      /* Interface files used. */
916
 
    int         sigslots;   /* Set if signals or slots are used. */
917
 
    int         genc;       /* Set if we are generating C code. */
918
 
    struct _stringList  *options;   /* The list of options. */
 
901
    moduleDef *module;                  /* This module. */
 
902
    moduleDef *modules;                 /* The list of modules. */
 
903
    nameDef *namecache;                 /* The name cache. */
 
904
    ifaceFileDef *ifacefiles;           /* The list of interface files. */
 
905
    classDef *classes;                  /* The list of classes. */
 
906
    classTmplDef *classtemplates;       /* The list of class templates. */
 
907
    classDef *proxies;                  /* The list of proxy classes. */
 
908
    exceptionDef *exceptions;           /* The list of exceptions. */
 
909
    mappedTypeDef *mappedtypes;         /* The mapped types. */
 
910
    mappedTypeTmplDef *mappedtypetemplates; /* The list of mapped type templates. */
 
911
    int qobjclass;                      /* QObject class, -1 if none. */
 
912
    enumDef *enums;                     /* List of enums. */
 
913
    varDef *vars;                       /* List of variables. */
 
914
    memberDef *othfuncs;                /* List of other functions. */
 
915
    overDef *overs;                     /* Global overloads. */
 
916
    typedefDef *typedefs;               /* List of typedefs. */
 
917
    codeBlock *copying;                 /* Software license. */
 
918
    codeBlock *exphdrcode;              /* Exported header code. */
 
919
    codeBlock *hdrcode;                 /* Header code. */
 
920
    codeBlock *cppcode;                 /* Global C++ code. */
 
921
    codeBlock *docs;                    /* Documentation. */
 
922
    codeBlock *preinitcode;             /* Pre-initialisation code. */
 
923
    codeBlock *postinitcode;            /* Post-initialisation code. */
 
924
    codeBlock *unitcode;                /* Compilation unit code. */
 
925
    ifaceFileList *used;                /* Interface files used. */
 
926
    int sigslots;                       /* Set if signals or slots are used. */
 
927
    int genc;                           /* Set if we are generating C code. */
 
928
    struct _stringList *options;        /* The list of options. */
919
929
} sipSpec;
920
930
 
921
931
 
922
932
/* A list of strings. */
923
933
 
924
934
typedef struct _stringList {
925
 
    const char      *s;     /* The string. */
926
 
    struct _stringList  *next;      /* The next in the list. */
 
935
    const char *s;                      /* The string. */
 
936
    struct _stringList *next;           /* The next in the list. */
927
937
} stringList;
928
938
 
929
939
 
930
940
/* File specific context information for the parser. */
931
941
 
932
942
typedef struct _parserContext {
933
 
    int         ifdepth;    /* The depth of nested if's. */
934
 
    moduleDef       *prevmod;   /* The previous module. */
 
943
    int ifdepth;                        /* The depth of nested if's. */
 
944
    moduleDef *prevmod;                 /* The previous module. */
935
945
} parserContext;
936
946
 
937
947
 
938
 
extern char *sipVersion;        /* The version of SIP. */
939
 
extern stringList *includeDirList;  /* The include directory list for SIP files. */
 
948
extern char *sipVersion;                /* The version of SIP. */
 
949
extern stringList *includeDirList;      /* The include directory list for SIP files. */
940
950
 
941
951
 
942
952
void parse(sipSpec *,FILE *,char *,stringList *,stringList *);
982
992
ifaceFileDef *findIfaceFile(sipSpec *pt, moduleDef *mod, scopedNameDef *fqname, ifaceFileType iftype, argDef *ad);
983
993
int optNoEmitters(sipSpec *pt);
984
994
int optRegisterTypes(sipSpec *pt);
 
995
int optQ_OBJECT4(sipSpec *pt);
985
996
void yywarning(char *);
986
997
 
987
998
 
1000
1011
} flagType;
1001
1012
 
1002
1013
typedef struct {
1003
 
    char        *fname;         /* The flag name. */
1004
 
    flagType    ftype;          /* The flag type. */
1005
 
    union {                 /* The flag value. */
1006
 
        char    *sval;          /* A string value. */
1007
 
        long    ival;           /* An integer value. */
 
1014
    char *fname;                        /* The flag name. */
 
1015
    flagType ftype;                     /* The flag type. */
 
1016
    union {                             /* The flag value. */
 
1017
        char *sval;                     /* A string value. */
 
1018
        long ival;                      /* An integer value. */
1008
1019
    } fvalue;
1009
1020
} optFlag;
1010
1021
 
1011
1022
typedef struct {
1012
 
    int     nrFlags;        /* The number of flags. */
1013
 
    optFlag     flags[MAX_NR_FLAGS];    /* Each flag. */
 
1023
    int nrFlags;                        /* The number of flags. */
 
1024
    optFlag flags[MAX_NR_FLAGS];        /* Each flag. */
1014
1025
} optFlags;
1015
1026
 
1016
1027
#endif