Cython has moved to github.

pyrex

view Tests/Bugs/doda/doda1.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_TypeTest(PyObject *obj, PyTypeObject *type); /*proto*/
42 static int __Pyx_InitStrings(__Pyx_StringTabEntry *t); /*proto*/
44 static void __Pyx_AddTraceback(char *funcname); /*proto*/
46 /* Declarations from doda1 */
49 /* Declarations from implementation of doda1 */
51 struct __pyx_obj_5doda1_Spam {
52 PyObject_HEAD
53 };
56 static PyTypeObject *__pyx_ptype_5doda1_Spam = 0;
57 static struct __pyx_obj_5doda1_Spam *__pyx_f_5doda1_foo(void); /*proto*/
58 static PyObject *__pyx_f_5doda1_blarg(void); /*proto*/
63 static __Pyx_StringTabEntry __pyx_string_tab[] = {
64 {0, 0, 0, 0}
65 };
69 /* Implementation of doda1 */
71 static struct __pyx_obj_5doda1_Spam *__pyx_f_5doda1_foo(void) {
72 struct __pyx_obj_5doda1_Spam *__pyx_r;
73 PyObject *__pyx_1 = 0;
74 __pyx_1 = __pyx_f_5doda1_blarg(); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 5; goto __pyx_L1;}
75 if (!__Pyx_TypeTest(__pyx_1, __pyx_ptype_5doda1_Spam)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 5; goto __pyx_L1;}
76 __pyx_r = ((struct __pyx_obj_5doda1_Spam *)__pyx_1);
77 __pyx_1 = 0;
78 goto __pyx_L0;
80 __pyx_r = ((struct __pyx_obj_5doda1_Spam *)Py_None); Py_INCREF(Py_None);
81 goto __pyx_L0;
82 __pyx_L1:;
83 Py_XDECREF(__pyx_1);
84 __Pyx_AddTraceback("doda1.foo");
85 __pyx_r = 0;
86 __pyx_L0:;
87 return __pyx_r;
88 }
90 static PyObject *__pyx_f_5doda1_blarg(void) {
91 PyObject *__pyx_r;
93 __pyx_r = Py_None; Py_INCREF(Py_None);
94 return __pyx_r;
95 }
97 static PyObject *__pyx_tp_new_5doda1_Spam(PyTypeObject *t, PyObject *a, PyObject *k) {
98 PyObject *o = (*t->tp_alloc)(t, 0);
99 if (!o) return 0;
100 return o;
101 }
103 static void __pyx_tp_dealloc_5doda1_Spam(PyObject *o) {
104 (*o->ob_type->tp_free)(o);
105 }
107 static struct PyMethodDef __pyx_methods_5doda1_Spam[] = {
108 {0, 0, 0, 0}
109 };
111 static PyNumberMethods __pyx_tp_as_number_Spam = {
112 0, /*nb_add*/
113 0, /*nb_subtract*/
114 0, /*nb_multiply*/
115 0, /*nb_divide*/
116 0, /*nb_remainder*/
117 0, /*nb_divmod*/
118 0, /*nb_power*/
119 0, /*nb_negative*/
120 0, /*nb_positive*/
121 0, /*nb_absolute*/
122 0, /*nb_nonzero*/
123 0, /*nb_invert*/
124 0, /*nb_lshift*/
125 0, /*nb_rshift*/
126 0, /*nb_and*/
127 0, /*nb_xor*/
128 0, /*nb_or*/
129 0, /*nb_coerce*/
130 0, /*nb_int*/
131 0, /*nb_long*/
132 0, /*nb_float*/
133 0, /*nb_oct*/
134 0, /*nb_hex*/
135 0, /*nb_inplace_add*/
136 0, /*nb_inplace_subtract*/
137 0, /*nb_inplace_multiply*/
138 0, /*nb_inplace_divide*/
139 0, /*nb_inplace_remainder*/
140 0, /*nb_inplace_power*/
141 0, /*nb_inplace_lshift*/
142 0, /*nb_inplace_rshift*/
143 0, /*nb_inplace_and*/
144 0, /*nb_inplace_xor*/
145 0, /*nb_inplace_or*/
146 0, /*nb_floor_divide*/
147 0, /*nb_true_divide*/
148 0, /*nb_inplace_floor_divide*/
149 0, /*nb_inplace_true_divide*/
150 #if Py_TPFLAGS_DEFAULT & Py_TPFLAGS_HAVE_INDEX
151 0, /*nb_index*/
152 #endif
153 };
155 static PySequenceMethods __pyx_tp_as_sequence_Spam = {
156 0, /*sq_length*/
157 0, /*sq_concat*/
158 0, /*sq_repeat*/
159 0, /*sq_item*/
160 0, /*sq_slice*/
161 0, /*sq_ass_item*/
162 0, /*sq_ass_slice*/
163 0, /*sq_contains*/
164 0, /*sq_inplace_concat*/
165 0, /*sq_inplace_repeat*/
166 };
168 static PyMappingMethods __pyx_tp_as_mapping_Spam = {
169 0, /*mp_length*/
170 0, /*mp_subscript*/
171 0, /*mp_ass_subscript*/
172 };
174 static PyBufferProcs __pyx_tp_as_buffer_Spam = {
175 0, /*bf_getreadbuffer*/
176 0, /*bf_getwritebuffer*/
177 0, /*bf_getsegcount*/
178 0, /*bf_getcharbuffer*/
179 };
181 PyTypeObject __pyx_type_5doda1_Spam = {
182 PyObject_HEAD_INIT(0)
183 0, /*ob_size*/
184 "doda1.Spam", /*tp_name*/
185 sizeof(struct __pyx_obj_5doda1_Spam), /*tp_basicsize*/
186 0, /*tp_itemsize*/
187 __pyx_tp_dealloc_5doda1_Spam, /*tp_dealloc*/
188 0, /*tp_print*/
189 0, /*tp_getattr*/
190 0, /*tp_setattr*/
191 0, /*tp_compare*/
192 0, /*tp_repr*/
193 &__pyx_tp_as_number_Spam, /*tp_as_number*/
194 &__pyx_tp_as_sequence_Spam, /*tp_as_sequence*/
195 &__pyx_tp_as_mapping_Spam, /*tp_as_mapping*/
196 0, /*tp_hash*/
197 0, /*tp_call*/
198 0, /*tp_str*/
199 0, /*tp_getattro*/
200 0, /*tp_setattro*/
201 &__pyx_tp_as_buffer_Spam, /*tp_as_buffer*/
202 Py_TPFLAGS_DEFAULT|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_BASETYPE, /*tp_flags*/
203 0, /*tp_doc*/
204 0, /*tp_traverse*/
205 0, /*tp_clear*/
206 0, /*tp_richcompare*/
207 0, /*tp_weaklistoffset*/
208 0, /*tp_iter*/
209 0, /*tp_iternext*/
210 __pyx_methods_5doda1_Spam, /*tp_methods*/
211 0, /*tp_members*/
212 0, /*tp_getset*/
213 0, /*tp_base*/
214 0, /*tp_dict*/
215 0, /*tp_descr_get*/
216 0, /*tp_descr_set*/
217 0, /*tp_dictoffset*/
218 0, /*tp_init*/
219 0, /*tp_alloc*/
220 __pyx_tp_new_5doda1_Spam, /*tp_new*/
221 0, /*tp_free*/
222 0, /*tp_is_gc*/
223 0, /*tp_bases*/
224 0, /*tp_mro*/
225 0, /*tp_cache*/
226 0, /*tp_subclasses*/
227 0, /*tp_weaklist*/
228 };
230 static struct PyMethodDef __pyx_methods[] = {
231 {0, 0, 0, 0}
232 };
234 static void __pyx_init_filenames(void); /*proto*/
236 PyMODINIT_FUNC initdoda1(void); /*proto*/
237 PyMODINIT_FUNC initdoda1(void) {
238 __pyx_init_filenames();
239 __pyx_m = Py_InitModule4("doda1", __pyx_methods, 0, 0, PYTHON_API_VERSION);
240 if (!__pyx_m) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; goto __pyx_L1;};
241 Py_INCREF(__pyx_m);
242 __pyx_b = PyImport_AddModule("__builtin__");
243 if (!__pyx_b) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; goto __pyx_L1;};
244 if (PyObject_SetAttrString(__pyx_m, "__builtins__", __pyx_b) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; goto __pyx_L1;};
245 if (__Pyx_InitStrings(__pyx_string_tab) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; goto __pyx_L1;};
246 if (PyType_Ready(&__pyx_type_5doda1_Spam) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; goto __pyx_L1;}
247 if (PyObject_SetAttrString(__pyx_m, "Spam", (PyObject *)&__pyx_type_5doda1_Spam) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; goto __pyx_L1;}
248 __pyx_ptype_5doda1_Spam = &__pyx_type_5doda1_Spam;
250 /* "/Local/Projects/D/Pyrex/Source/Tests/Bugs/doda/doda1.pyx":10 */
251 return;
252 __pyx_L1:;
253 __Pyx_AddTraceback("doda1");
254 }
256 static char *__pyx_filenames[] = {
257 "doda1.pyx",
258 };
260 /* Runtime support code */
262 static void __pyx_init_filenames(void) {
263 __pyx_f = __pyx_filenames;
264 }
266 static int __Pyx_TypeTest(PyObject *obj, PyTypeObject *type) {
267 if (!type) {
268 PyErr_Format(PyExc_SystemError, "Missing type object");
269 return 0;
270 }
271 if (obj == Py_None || PyObject_TypeCheck(obj, type))
272 return 1;
273 PyErr_Format(PyExc_TypeError, "Cannot convert %s to %s",
274 obj->ob_type->tp_name, type->tp_name);
275 return 0;
276 }
278 static int __Pyx_InitStrings(__Pyx_StringTabEntry *t) {
279 while (t->p) {
280 *t->p = PyString_FromStringAndSize(t->s, t->n - 1);
281 if (!*t->p)
282 return -1;
283 if (t->i)
284 PyString_InternInPlace(t->p);
285 ++t;
286 }
287 return 0;
288 }
290 #include "compile.h"
291 #include "frameobject.h"
292 #include "traceback.h"
294 static void __Pyx_AddTraceback(char *funcname) {
295 PyObject *py_srcfile = 0;
296 PyObject *py_funcname = 0;
297 PyObject *py_globals = 0;
298 PyObject *empty_tuple = 0;
299 PyObject *empty_string = 0;
300 PyCodeObject *py_code = 0;
301 PyFrameObject *py_frame = 0;
303 py_srcfile = PyString_FromString(__pyx_filename);
304 if (!py_srcfile) goto bad;
305 py_funcname = PyString_FromString(funcname);
306 if (!py_funcname) goto bad;
307 py_globals = PyModule_GetDict(__pyx_m);
308 if (!py_globals) goto bad;
309 empty_tuple = PyTuple_New(0);
310 if (!empty_tuple) goto bad;
311 empty_string = PyString_FromString("");
312 if (!empty_string) goto bad;
313 py_code = PyCode_New(
314 0, /*int argcount,*/
315 0, /*int nlocals,*/
316 0, /*int stacksize,*/
317 0, /*int flags,*/
318 empty_string, /*PyObject *code,*/
319 empty_tuple, /*PyObject *consts,*/
320 empty_tuple, /*PyObject *names,*/
321 empty_tuple, /*PyObject *varnames,*/
322 empty_tuple, /*PyObject *freevars,*/
323 empty_tuple, /*PyObject *cellvars,*/
324 py_srcfile, /*PyObject *filename,*/
325 py_funcname, /*PyObject *name,*/
326 __pyx_lineno, /*int firstlineno,*/
327 empty_string /*PyObject *lnotab*/
328 );
329 if (!py_code) goto bad;
330 py_frame = PyFrame_New(
331 PyThreadState_Get(), /*PyThreadState *tstate,*/
332 py_code, /*PyCodeObject *code,*/
333 py_globals, /*PyObject *globals,*/
334 0 /*PyObject *locals*/
335 );
336 if (!py_frame) goto bad;
337 py_frame->f_lineno = __pyx_lineno;
338 PyTraceBack_Here(py_frame);
339 bad:
340 Py_XDECREF(py_srcfile);
341 Py_XDECREF(py_funcname);
342 Py_XDECREF(empty_tuple);
343 Py_XDECREF(empty_string);
344 Py_XDECREF(py_code);
345 Py_XDECREF(py_frame);
346 }