Cython has moved to github.

pyrex

view Tests/10/circularcimport2/foo.c @ 86:da6e97bb7e6d

Multiple compilation fixed
author Gregory Ewing <greg.ewing@canterbury.ac.nz>
date Sat May 24 15:50:12 2008 +1200 (4 years ago)
parents 12072e0e4fd5
children 94d46b3c5354
line source
1 /* Generated by Pyrex */
3 #define PY_SSIZE_T_CLEAN
4 #include "Python.h"
5 #include "structmember.h"
6 #ifndef PY_LONG_LONG
7 #define PY_LONG_LONG LONG_LONG
8 #endif
9 #if PY_VERSION_HEX < 0x02050000
10 typedef int Py_ssize_t;
11 #define PY_SSIZE_T_MAX INT_MAX
12 #define PY_SSIZE_T_MIN INT_MIN
13 #define PyInt_FromSsize_t(z) PyInt_FromLong(z)
14 #define PyInt_AsSsize_t(o) PyInt_AsLong(o)
15 #endif
16 #ifndef WIN32
17 #ifndef __stdcall
18 #define __stdcall
19 #endif
20 #ifndef __cdecl
21 #define __cdecl
22 #endif
23 #endif
24 #ifdef __cplusplus
25 #define __PYX_EXTERN_C extern "C"
26 #else
27 #define __PYX_EXTERN_C extern
28 #endif
29 #include <math.h>
32 typedef struct {PyObject **p; int i; char *s; long n;} __Pyx_StringTabEntry; /*proto*/
34 static PyObject *__pyx_m;
35 static PyObject *__pyx_b;
36 static int __pyx_lineno;
37 static char *__pyx_filename;
38 static char **__pyx_f;
40 static int __Pyx_InitStrings(__Pyx_StringTabEntry *t); /*proto*/
42 static PyTypeObject *__Pyx_ImportType(char *module_name, char *class_name, long size); /*proto*/
44 static PyObject *__Pyx_ImportModule(char *name); /*proto*/
46 static void __Pyx_AddTraceback(char *funcname); /*proto*/
48 /* Declarations from blarg */
50 union __pyx_t_5blarg_Eggs {
51 struct __pyx_t_3foo_Spam *spam;
52 };
54 struct __pyx_obj_5blarg_Blarg {
55 PyObject_HEAD
56 PyObject *name;
57 struct __pyx_obj_3foo_Foo *foo;
58 };
61 static PyTypeObject *__pyx_ptype_5blarg_Blarg = 0;
63 /* Declarations from foo */
65 struct __pyx_t_3foo_Spam {
66 union __pyx_t_5blarg_Eggs *eggs;
67 };
69 struct __pyx_obj_3foo_Foo {
70 PyObject_HEAD
71 PyObject *name;
72 struct __pyx_obj_5blarg_Blarg *blarg;
73 };
76 static PyTypeObject *__pyx_ptype_3foo_Foo = 0;
78 /* Declarations from implementation of foo */
84 static __Pyx_StringTabEntry __pyx_string_tab[] = {
85 {0, 0, 0, 0}
86 };
90 /* Implementation of foo */
92 static PyObject *__pyx_tp_new_3foo_Foo(PyTypeObject *t, PyObject *a, PyObject *k) {
93 struct __pyx_obj_3foo_Foo *p;
94 PyObject *o = (*t->tp_alloc)(t, 0);
95 if (!o) return 0;
96 p = ((struct __pyx_obj_3foo_Foo *)o);
97 p->name = Py_None; Py_INCREF(Py_None);
98 p->blarg = ((struct __pyx_obj_5blarg_Blarg *)Py_None); Py_INCREF(Py_None);
99 return o;
100 }
102 static void __pyx_tp_dealloc_3foo_Foo(PyObject *o) {
103 struct __pyx_obj_3foo_Foo *p = (struct __pyx_obj_3foo_Foo *)o;
104 Py_XDECREF(p->name);
105 Py_XDECREF(((PyObject *)p->blarg));
106 (*o->ob_type->tp_free)(o);
107 }
109 static int __pyx_tp_traverse_3foo_Foo(PyObject *o, visitproc v, void *a) {
110 int e;
111 struct __pyx_obj_3foo_Foo *p = (struct __pyx_obj_3foo_Foo *)o;
112 if (p->name) {
113 e = (*v)(p->name, a); if (e) return e;
114 }
115 if (p->blarg) {
116 e = (*v)(((PyObject*)p->blarg), a); if (e) return e;
117 }
118 return 0;
119 }
121 static int __pyx_tp_clear_3foo_Foo(PyObject *o) {
122 struct __pyx_obj_3foo_Foo *p = (struct __pyx_obj_3foo_Foo *)o;
123 PyObject *t;
124 t = p->name;
125 p->name = Py_None; Py_INCREF(Py_None);
126 Py_XDECREF(t);
127 t = ((PyObject *)p->blarg);
128 p->blarg = ((struct __pyx_obj_5blarg_Blarg *)Py_None); Py_INCREF(Py_None);
129 Py_XDECREF(t);
130 return 0;
131 }
133 static struct PyMethodDef __pyx_methods_3foo_Foo[] = {
134 {0, 0, 0, 0}
135 };
137 static PyNumberMethods __pyx_tp_as_number_Foo = {
138 0, /*nb_add*/
139 0, /*nb_subtract*/
140 0, /*nb_multiply*/
141 0, /*nb_divide*/
142 0, /*nb_remainder*/
143 0, /*nb_divmod*/
144 0, /*nb_power*/
145 0, /*nb_negative*/
146 0, /*nb_positive*/
147 0, /*nb_absolute*/
148 0, /*nb_nonzero*/
149 0, /*nb_invert*/
150 0, /*nb_lshift*/
151 0, /*nb_rshift*/
152 0, /*nb_and*/
153 0, /*nb_xor*/
154 0, /*nb_or*/
155 0, /*nb_coerce*/
156 0, /*nb_int*/
157 0, /*nb_long*/
158 0, /*nb_float*/
159 0, /*nb_oct*/
160 0, /*nb_hex*/
161 0, /*nb_inplace_add*/
162 0, /*nb_inplace_subtract*/
163 0, /*nb_inplace_multiply*/
164 0, /*nb_inplace_divide*/
165 0, /*nb_inplace_remainder*/
166 0, /*nb_inplace_power*/
167 0, /*nb_inplace_lshift*/
168 0, /*nb_inplace_rshift*/
169 0, /*nb_inplace_and*/
170 0, /*nb_inplace_xor*/
171 0, /*nb_inplace_or*/
172 0, /*nb_floor_divide*/
173 0, /*nb_true_divide*/
174 0, /*nb_inplace_floor_divide*/
175 0, /*nb_inplace_true_divide*/
176 #if Py_TPFLAGS_DEFAULT & Py_TPFLAGS_HAVE_INDEX
177 0, /*nb_index*/
178 #endif
179 };
181 static PySequenceMethods __pyx_tp_as_sequence_Foo = {
182 0, /*sq_length*/
183 0, /*sq_concat*/
184 0, /*sq_repeat*/
185 0, /*sq_item*/
186 0, /*sq_slice*/
187 0, /*sq_ass_item*/
188 0, /*sq_ass_slice*/
189 0, /*sq_contains*/
190 0, /*sq_inplace_concat*/
191 0, /*sq_inplace_repeat*/
192 };
194 static PyMappingMethods __pyx_tp_as_mapping_Foo = {
195 0, /*mp_length*/
196 0, /*mp_subscript*/
197 0, /*mp_ass_subscript*/
198 };
200 static PyBufferProcs __pyx_tp_as_buffer_Foo = {
201 0, /*bf_getreadbuffer*/
202 0, /*bf_getwritebuffer*/
203 0, /*bf_getsegcount*/
204 0, /*bf_getcharbuffer*/
205 };
207 PyTypeObject __pyx_type_3foo_Foo = {
208 PyObject_HEAD_INIT(0)
209 0, /*ob_size*/
210 "foo.Foo", /*tp_name*/
211 sizeof(struct __pyx_obj_3foo_Foo), /*tp_basicsize*/
212 0, /*tp_itemsize*/
213 __pyx_tp_dealloc_3foo_Foo, /*tp_dealloc*/
214 0, /*tp_print*/
215 0, /*tp_getattr*/
216 0, /*tp_setattr*/
217 0, /*tp_compare*/
218 0, /*tp_repr*/
219 &__pyx_tp_as_number_Foo, /*tp_as_number*/
220 &__pyx_tp_as_sequence_Foo, /*tp_as_sequence*/
221 &__pyx_tp_as_mapping_Foo, /*tp_as_mapping*/
222 0, /*tp_hash*/
223 0, /*tp_call*/
224 0, /*tp_str*/
225 0, /*tp_getattro*/
226 0, /*tp_setattro*/
227 &__pyx_tp_as_buffer_Foo, /*tp_as_buffer*/
228 Py_TPFLAGS_DEFAULT|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
229 0, /*tp_doc*/
230 __pyx_tp_traverse_3foo_Foo, /*tp_traverse*/
231 __pyx_tp_clear_3foo_Foo, /*tp_clear*/
232 0, /*tp_richcompare*/
233 0, /*tp_weaklistoffset*/
234 0, /*tp_iter*/
235 0, /*tp_iternext*/
236 __pyx_methods_3foo_Foo, /*tp_methods*/
237 0, /*tp_members*/
238 0, /*tp_getset*/
239 0, /*tp_base*/
240 0, /*tp_dict*/
241 0, /*tp_descr_get*/
242 0, /*tp_descr_set*/
243 0, /*tp_dictoffset*/
244 0, /*tp_init*/
245 0, /*tp_alloc*/
246 __pyx_tp_new_3foo_Foo, /*tp_new*/
247 0, /*tp_free*/
248 0, /*tp_is_gc*/
249 0, /*tp_bases*/
250 0, /*tp_mro*/
251 0, /*tp_cache*/
252 0, /*tp_subclasses*/
253 0, /*tp_weaklist*/
254 };
256 static struct PyMethodDef __pyx_methods[] = {
257 {0, 0, 0, 0}
258 };
260 static void __pyx_init_filenames(void); /*proto*/
262 PyMODINIT_FUNC initfoo(void); /*proto*/
263 PyMODINIT_FUNC initfoo(void) {
264 __pyx_init_filenames();
265 __pyx_m = Py_InitModule4("foo", __pyx_methods, 0, 0, PYTHON_API_VERSION);
266 if (!__pyx_m) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; goto __pyx_L1;};
267 Py_INCREF(__pyx_m);
268 __pyx_b = PyImport_AddModule("__builtin__");
269 if (!__pyx_b) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; goto __pyx_L1;};
270 if (PyObject_SetAttrString(__pyx_m, "__builtins__", __pyx_b) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; goto __pyx_L1;};
271 if (__Pyx_InitStrings(__pyx_string_tab) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; goto __pyx_L1;};
272 __pyx_type_3foo_Foo.tp_free = _PyObject_GC_Del;
273 if (PyType_Ready(&__pyx_type_3foo_Foo) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; goto __pyx_L1;}
274 if (PyObject_SetAttrString(__pyx_m, "Foo", (PyObject *)&__pyx_type_3foo_Foo) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; goto __pyx_L1;}
275 __pyx_ptype_3foo_Foo = &__pyx_type_3foo_Foo;
276 __pyx_ptype_5blarg_Blarg = __Pyx_ImportType("blarg", "Blarg", sizeof(struct __pyx_obj_5blarg_Blarg)); if (!__pyx_ptype_5blarg_Blarg) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 6; goto __pyx_L1;}
277 return;
278 __pyx_L1:;
279 __Pyx_AddTraceback("foo");
280 }
282 static char *__pyx_filenames[] = {
283 "foo.pyx",
284 "blarg.pxd",
285 };
287 /* Runtime support code */
289 static void __pyx_init_filenames(void) {
290 __pyx_f = __pyx_filenames;
291 }
293 static int __Pyx_InitStrings(__Pyx_StringTabEntry *t) {
294 while (t->p) {
295 *t->p = PyString_FromStringAndSize(t->s, t->n - 1);
296 if (!*t->p)
297 return -1;
298 if (t->i)
299 PyString_InternInPlace(t->p);
300 ++t;
301 }
302 return 0;
303 }
305 #ifndef __PYX_HAVE_RT_ImportType
306 #define __PYX_HAVE_RT_ImportType
307 static PyTypeObject *__Pyx_ImportType(char *module_name, char *class_name,
308 long size)
309 {
310 PyObject *py_module = 0;
311 PyObject *result = 0;
313 py_module = __Pyx_ImportModule(module_name);
314 if (!py_module)
315 goto bad;
316 result = PyObject_GetAttrString(py_module, class_name);
317 if (!result)
318 goto bad;
319 if (!PyType_Check(result)) {
320 PyErr_Format(PyExc_TypeError,
321 "%s.%s is not a type object",
322 module_name, class_name);
323 goto bad;
324 }
325 if (((PyTypeObject *)result)->tp_basicsize != size) {
326 PyErr_Format(PyExc_ValueError,
327 "%s.%s does not appear to be the correct type object",
328 module_name, class_name);
329 goto bad;
330 }
331 return (PyTypeObject *)result;
332 bad:
333 Py_XDECREF(result);
334 return 0;
335 }
336 #endif
338 #ifndef __PYX_HAVE_RT_ImportModule
339 #define __PYX_HAVE_RT_ImportModule
340 static PyObject *__Pyx_ImportModule(char *name) {
341 PyObject *py_name = 0;
343 py_name = PyString_FromString(name);
344 if (!py_name)
345 goto bad;
346 return PyImport_Import(py_name);
347 bad:
348 Py_XDECREF(py_name);
349 return 0;
350 }
351 #endif
353 #include "compile.h"
354 #include "frameobject.h"
355 #include "traceback.h"
357 static void __Pyx_AddTraceback(char *funcname) {
358 PyObject *py_srcfile = 0;
359 PyObject *py_funcname = 0;
360 PyObject *py_globals = 0;
361 PyObject *empty_tuple = 0;
362 PyObject *empty_string = 0;
363 PyCodeObject *py_code = 0;
364 PyFrameObject *py_frame = 0;
366 py_srcfile = PyString_FromString(__pyx_filename);
367 if (!py_srcfile) goto bad;
368 py_funcname = PyString_FromString(funcname);
369 if (!py_funcname) goto bad;
370 py_globals = PyModule_GetDict(__pyx_m);
371 if (!py_globals) goto bad;
372 empty_tuple = PyTuple_New(0);
373 if (!empty_tuple) goto bad;
374 empty_string = PyString_FromString("");
375 if (!empty_string) goto bad;
376 py_code = PyCode_New(
377 0, /*int argcount,*/
378 0, /*int nlocals,*/
379 0, /*int stacksize,*/
380 0, /*int flags,*/
381 empty_string, /*PyObject *code,*/
382 empty_tuple, /*PyObject *consts,*/
383 empty_tuple, /*PyObject *names,*/
384 empty_tuple, /*PyObject *varnames,*/
385 empty_tuple, /*PyObject *freevars,*/
386 empty_tuple, /*PyObject *cellvars,*/
387 py_srcfile, /*PyObject *filename,*/
388 py_funcname, /*PyObject *name,*/
389 __pyx_lineno, /*int firstlineno,*/
390 empty_string /*PyObject *lnotab*/
391 );
392 if (!py_code) goto bad;
393 py_frame = PyFrame_New(
394 PyThreadState_Get(), /*PyThreadState *tstate,*/
395 py_code, /*PyCodeObject *code,*/
396 py_globals, /*PyObject *globals,*/
397 0 /*PyObject *locals*/
398 );
399 if (!py_frame) goto bad;
400 py_frame->f_lineno = __pyx_lineno;
401 PyTraceBack_Here(py_frame);
402 bad:
403 Py_XDECREF(py_srcfile);
404 Py_XDECREF(py_funcname);
405 Py_XDECREF(empty_tuple);
406 Py_XDECREF(empty_string);
407 Py_XDECREF(py_code);
408 Py_XDECREF(py_frame);
409 }