annotate lib/swig/swigwin-2.0.11/Lib/swiginit.swg @ 2540:abc6a9d079b9

.
author a.parshin
date Sat, 09 May 2015 12:55:58 +0200
parents b3009adc0e2f
children
rev   line source
1899
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
1 /* -----------------------------------------------------------------------------
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
2 * Type initialization:
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
3 * This problem is tough by the requirement that no dynamic
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
4 * memory is used. Also, since swig_type_info structures store pointers to
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
5 * swig_cast_info structures and swig_cast_info structures store pointers back
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
6 * to swig_type_info structures, we need some lookup code at initialization.
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
7 * The idea is that swig generates all the structures that are needed.
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
8 * The runtime then collects these partially filled structures.
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
9 * The SWIG_InitializeModule function takes these initial arrays out of
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
10 * swig_module, and does all the lookup, filling in the swig_module.types
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
11 * array with the correct data and linking the correct swig_cast_info
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
12 * structures together.
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
13 *
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
14 * The generated swig_type_info structures are assigned staticly to an initial
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
15 * array. We just loop through that array, and handle each type individually.
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
16 * First we lookup if this type has been already loaded, and if so, use the
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
17 * loaded structure instead of the generated one. Then we have to fill in the
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
18 * cast linked list. The cast data is initially stored in something like a
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
19 * two-dimensional array. Each row corresponds to a type (there are the same
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
20 * number of rows as there are in the swig_type_initial array). Each entry in
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
21 * a column is one of the swig_cast_info structures for that type.
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
22 * The cast_initial array is actually an array of arrays, because each row has
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
23 * a variable number of columns. So to actually build the cast linked list,
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
24 * we find the array of casts associated with the type, and loop through it
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
25 * adding the casts to the list. The one last trick we need to do is making
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
26 * sure the type pointer in the swig_cast_info struct is correct.
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
27 *
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
28 * First off, we lookup the cast->type name to see if it is already loaded.
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
29 * There are three cases to handle:
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
30 * 1) If the cast->type has already been loaded AND the type we are adding
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
31 * casting info to has not been loaded (it is in this module), THEN we
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
32 * replace the cast->type pointer with the type pointer that has already
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
33 * been loaded.
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
34 * 2) If BOTH types (the one we are adding casting info to, and the
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
35 * cast->type) are loaded, THEN the cast info has already been loaded by
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
36 * the previous module so we just ignore it.
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
37 * 3) Finally, if cast->type has not already been loaded, then we add that
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
38 * swig_cast_info to the linked list (because the cast->type) pointer will
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
39 * be correct.
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
40 * ----------------------------------------------------------------------------- */
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
41
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
42 #ifdef __cplusplus
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
43 extern "C" {
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
44 #if 0
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
45 } /* c-mode */
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
46 #endif
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
47 #endif
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
48
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
49 #if 0
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
50 #define SWIGRUNTIME_DEBUG
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
51 #endif
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
52
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
53
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
54 SWIGRUNTIME void
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
55 SWIG_InitializeModule(void *clientdata) {
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
56 size_t i;
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
57 swig_module_info *module_head, *iter;
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
58 int found, init;
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
59
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
60 /* check to see if the circular list has been setup, if not, set it up */
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
61 if (swig_module.next==0) {
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
62 /* Initialize the swig_module */
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
63 swig_module.type_initial = swig_type_initial;
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
64 swig_module.cast_initial = swig_cast_initial;
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
65 swig_module.next = &swig_module;
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
66 init = 1;
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
67 } else {
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
68 init = 0;
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
69 }
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
70
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
71 /* Try and load any already created modules */
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
72 module_head = SWIG_GetModule(clientdata);
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
73 if (!module_head) {
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
74 /* This is the first module loaded for this interpreter */
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
75 /* so set the swig module into the interpreter */
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
76 SWIG_SetModule(clientdata, &swig_module);
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
77 module_head = &swig_module;
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
78 } else {
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
79 /* the interpreter has loaded a SWIG module, but has it loaded this one? */
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
80 found=0;
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
81 iter=module_head;
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
82 do {
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
83 if (iter==&swig_module) {
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
84 found=1;
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
85 break;
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
86 }
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
87 iter=iter->next;
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
88 } while (iter!= module_head);
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
89
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
90 /* if the is found in the list, then all is done and we may leave */
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
91 if (found) return;
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
92 /* otherwise we must add out module into the list */
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
93 swig_module.next = module_head->next;
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
94 module_head->next = &swig_module;
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
95 }
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
96
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
97 /* When multiple interpreters are used, a module could have already been initialized in
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
98 a different interpreter, but not yet have a pointer in this interpreter.
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
99 In this case, we do not want to continue adding types... everything should be
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
100 set up already */
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
101 if (init == 0) return;
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
102
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
103 /* Now work on filling in swig_module.types */
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
104 #ifdef SWIGRUNTIME_DEBUG
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
105 printf("SWIG_InitializeModule: size %d\n", swig_module.size);
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
106 #endif
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
107 for (i = 0; i < swig_module.size; ++i) {
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
108 swig_type_info *type = 0;
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
109 swig_type_info *ret;
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
110 swig_cast_info *cast;
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
111
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
112 #ifdef SWIGRUNTIME_DEBUG
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
113 printf("SWIG_InitializeModule: type %d %s\n", i, swig_module.type_initial[i]->name);
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
114 #endif
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
115
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
116 /* if there is another module already loaded */
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
117 if (swig_module.next != &swig_module) {
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
118 type = SWIG_MangledTypeQueryModule(swig_module.next, &swig_module, swig_module.type_initial[i]->name);
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
119 }
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
120 if (type) {
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
121 /* Overwrite clientdata field */
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
122 #ifdef SWIGRUNTIME_DEBUG
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
123 printf("SWIG_InitializeModule: found type %s\n", type->name);
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
124 #endif
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
125 if (swig_module.type_initial[i]->clientdata) {
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
126 type->clientdata = swig_module.type_initial[i]->clientdata;
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
127 #ifdef SWIGRUNTIME_DEBUG
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
128 printf("SWIG_InitializeModule: found and overwrite type %s \n", type->name);
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
129 #endif
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
130 }
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
131 } else {
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
132 type = swig_module.type_initial[i];
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
133 }
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
134
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
135 /* Insert casting types */
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
136 cast = swig_module.cast_initial[i];
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
137 while (cast->type) {
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
138
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
139 /* Don't need to add information already in the list */
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
140 ret = 0;
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
141 #ifdef SWIGRUNTIME_DEBUG
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
142 printf("SWIG_InitializeModule: look cast %s\n", cast->type->name);
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
143 #endif
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
144 if (swig_module.next != &swig_module) {
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
145 ret = SWIG_MangledTypeQueryModule(swig_module.next, &swig_module, cast->type->name);
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
146 #ifdef SWIGRUNTIME_DEBUG
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
147 if (ret) printf("SWIG_InitializeModule: found cast %s\n", ret->name);
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
148 #endif
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
149 }
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
150 if (ret) {
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
151 if (type == swig_module.type_initial[i]) {
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
152 #ifdef SWIGRUNTIME_DEBUG
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
153 printf("SWIG_InitializeModule: skip old type %s\n", ret->name);
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
154 #endif
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
155 cast->type = ret;
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
156 ret = 0;
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
157 } else {
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
158 /* Check for casting already in the list */
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
159 swig_cast_info *ocast = SWIG_TypeCheck(ret->name, type);
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
160 #ifdef SWIGRUNTIME_DEBUG
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
161 if (ocast) printf("SWIG_InitializeModule: skip old cast %s\n", ret->name);
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
162 #endif
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
163 if (!ocast) ret = 0;
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
164 }
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
165 }
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
166
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
167 if (!ret) {
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
168 #ifdef SWIGRUNTIME_DEBUG
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
169 printf("SWIG_InitializeModule: adding cast %s\n", cast->type->name);
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
170 #endif
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
171 if (type->cast) {
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
172 type->cast->prev = cast;
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
173 cast->next = type->cast;
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
174 }
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
175 type->cast = cast;
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
176 }
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
177 cast++;
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
178 }
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
179 /* Set entry in modules->types array equal to the type */
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
180 swig_module.types[i] = type;
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
181 }
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
182 swig_module.types[i] = 0;
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
183
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
184 #ifdef SWIGRUNTIME_DEBUG
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
185 printf("**** SWIG_InitializeModule: Cast List ******\n");
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
186 for (i = 0; i < swig_module.size; ++i) {
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
187 int j = 0;
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
188 swig_cast_info *cast = swig_module.cast_initial[i];
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
189 printf("SWIG_InitializeModule: type %d %s\n", i, swig_module.type_initial[i]->name);
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
190 while (cast->type) {
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
191 printf("SWIG_InitializeModule: cast type %s\n", cast->type->name);
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
192 cast++;
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
193 ++j;
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
194 }
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
195 printf("---- Total casts: %d\n",j);
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
196 }
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
197 printf("**** SWIG_InitializeModule: Cast List ******\n");
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
198 #endif
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
199 }
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
200
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
201 /* This function will propagate the clientdata field of type to
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
202 * any new swig_type_info structures that have been added into the list
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
203 * of equivalent types. It is like calling
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
204 * SWIG_TypeClientData(type, clientdata) a second time.
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
205 */
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
206 SWIGRUNTIME void
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
207 SWIG_PropagateClientData(void) {
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
208 size_t i;
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
209 swig_cast_info *equiv;
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
210 static int init_run = 0;
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
211
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
212 if (init_run) return;
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
213 init_run = 1;
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
214
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
215 for (i = 0; i < swig_module.size; i++) {
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
216 if (swig_module.types[i]->clientdata) {
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
217 equiv = swig_module.types[i]->cast;
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
218 while (equiv) {
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
219 if (!equiv->converter) {
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
220 if (equiv->type && !equiv->type->clientdata)
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
221 SWIG_TypeClientData(equiv->type, swig_module.types[i]->clientdata);
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
222 }
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
223 equiv = equiv->next;
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
224 }
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
225 }
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
226 }
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
227 }
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
228
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
229 #ifdef __cplusplus
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
230 #if 0
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
231 { /* c-mode */
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
232 #endif
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
233 }
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
234 #endif