Cython has moved to github.

pyrex

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