Cython has moved to github.

pyrex

view Tests/3/gencall.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 PyObject *__Pyx_GetName(PyObject *dict, PyObject *name); /*proto*/
42 static int __Pyx_InitStrings(__Pyx_StringTabEntry *t); /*proto*/
44 static void __Pyx_AddTraceback(char *funcname); /*proto*/
46 /* Declarations from gencall */
49 /* Declarations from implementation of gencall */
52 static char __pyx_k1[] = "f";
53 static char __pyx_k2[] = "x";
54 static char __pyx_k3[] = "y";
55 static char __pyx_k4[] = "spam";
57 static PyObject *__pyx_n_f;
58 static PyObject *__pyx_n_spam;
59 static PyObject *__pyx_n_x;
60 static PyObject *__pyx_n_y;
63 static __Pyx_StringTabEntry __pyx_string_tab[] = {
64 {&__pyx_n_f, 1, __pyx_k1, sizeof(__pyx_k1)},
65 {&__pyx_n_spam, 1, __pyx_k4, sizeof(__pyx_k4)},
66 {&__pyx_n_x, 1, __pyx_k2, sizeof(__pyx_k2)},
67 {&__pyx_n_y, 1, __pyx_k3, sizeof(__pyx_k3)},
68 {0, 0, 0, 0}
69 };
73 /* Implementation of gencall */
75 static PyObject *__pyx_f_7gencall_f(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
76 static PyObject *__pyx_f_7gencall_f(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
77 PyObject *__pyx_v_x = 0;
78 PyObject *__pyx_v_y = 0;
79 PyObject *__pyx_r;
80 static char *__pyx_argnames[] = {"x","y",0};
81 if (!PyArg_ParseTupleAndKeywords(__pyx_args, __pyx_kwds, "OO", __pyx_argnames, &__pyx_v_x, &__pyx_v_y)) return 0;
82 Py_INCREF(__pyx_v_x);
83 Py_INCREF(__pyx_v_y);
84 Py_INCREF(__pyx_v_y);
85 Py_DECREF(__pyx_v_x);
86 __pyx_v_x = __pyx_v_y;
88 __pyx_r = Py_None; Py_INCREF(Py_None);
89 Py_DECREF(__pyx_v_x);
90 Py_DECREF(__pyx_v_y);
91 return __pyx_r;
92 }
94 static PyObject *__pyx_f_7gencall_z(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
95 static PyObject *__pyx_f_7gencall_z(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
96 PyObject *__pyx_v_a = 0;
97 PyObject *__pyx_v_b = 0;
98 PyObject *__pyx_v_c = 0;
99 PyObject *__pyx_r;
100 PyObject *__pyx_1 = 0;
101 PyObject *__pyx_2 = 0;
102 PyObject *__pyx_3 = 0;
103 PyObject *__pyx_4 = 0;
104 static char *__pyx_argnames[] = {"a","b","c",0};
105 if (!PyArg_ParseTupleAndKeywords(__pyx_args, __pyx_kwds, "OOO", __pyx_argnames, &__pyx_v_a, &__pyx_v_b, &__pyx_v_c)) return 0;
106 Py_INCREF(__pyx_v_a);
107 Py_INCREF(__pyx_v_b);
108 Py_INCREF(__pyx_v_c);
110 /* "/Local/Projects/D/Pyrex/Source/Tests/3/gencall.pyx":5 */
111 __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_n_f); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 5; goto __pyx_L1;}
112 __pyx_2 = PyTuple_New(0); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 5; goto __pyx_L1;}
113 __pyx_3 = PyDict_New(); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 5; goto __pyx_L1;}
114 __pyx_4 = PyInt_FromLong(42); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 5; goto __pyx_L1;}
115 if (PyDict_SetItem(__pyx_3, __pyx_n_x, __pyx_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 5; goto __pyx_L1;}
116 Py_DECREF(__pyx_4); __pyx_4 = 0;
117 if (PyDict_SetItem(__pyx_3, __pyx_n_y, __pyx_n_spam) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 5; goto __pyx_L1;}
118 __pyx_4 = PyEval_CallObjectWithKeywords(__pyx_1, __pyx_2, __pyx_3); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 5; goto __pyx_L1;}
119 Py_DECREF(__pyx_1); __pyx_1 = 0;
120 Py_DECREF(__pyx_2); __pyx_2 = 0;
121 Py_DECREF(__pyx_3); __pyx_3 = 0;
122 Py_DECREF(__pyx_4); __pyx_4 = 0;
124 /* "/Local/Projects/D/Pyrex/Source/Tests/3/gencall.pyx":6 */
125 __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_n_f); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 6; goto __pyx_L1;}
126 __pyx_2 = PySequence_Tuple(__pyx_v_a); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 6; goto __pyx_L1;}
127 __pyx_3 = PyObject_CallObject(__pyx_1, __pyx_2); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 6; goto __pyx_L1;}
128 Py_DECREF(__pyx_1); __pyx_1 = 0;
129 Py_DECREF(__pyx_2); __pyx_2 = 0;
130 Py_DECREF(__pyx_3); __pyx_3 = 0;
132 /* "/Local/Projects/D/Pyrex/Source/Tests/3/gencall.pyx":7 */
133 __pyx_4 = __Pyx_GetName(__pyx_m, __pyx_n_f); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 7; goto __pyx_L1;}
134 __pyx_1 = PyTuple_New(0); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 7; goto __pyx_L1;}
135 __pyx_2 = PyEval_CallObjectWithKeywords(__pyx_4, __pyx_1, __pyx_v_b); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 7; goto __pyx_L1;}
136 Py_DECREF(__pyx_4); __pyx_4 = 0;
137 Py_DECREF(__pyx_1); __pyx_1 = 0;
138 Py_DECREF(__pyx_2); __pyx_2 = 0;
140 /* "/Local/Projects/D/Pyrex/Source/Tests/3/gencall.pyx":8 */
141 __pyx_3 = __Pyx_GetName(__pyx_m, __pyx_n_f); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 8; goto __pyx_L1;}
142 __pyx_4 = PyTuple_New(0); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 8; goto __pyx_L1;}
143 __pyx_1 = PyDict_New(); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 8; goto __pyx_L1;}
144 __pyx_2 = PyInt_FromLong(42); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 8; goto __pyx_L1;}
145 if (PyDict_SetItem(__pyx_1, __pyx_n_x, __pyx_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 8; goto __pyx_L1;}
146 Py_DECREF(__pyx_2); __pyx_2 = 0;
147 if (PyDict_Update(__pyx_1, __pyx_v_b) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 8; goto __pyx_L1;}
148 __pyx_2 = PyEval_CallObjectWithKeywords(__pyx_3, __pyx_4, __pyx_1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 8; goto __pyx_L1;}
149 Py_DECREF(__pyx_3); __pyx_3 = 0;
150 Py_DECREF(__pyx_4); __pyx_4 = 0;
151 Py_DECREF(__pyx_1); __pyx_1 = 0;
152 Py_DECREF(__pyx_2); __pyx_2 = 0;
154 /* "/Local/Projects/D/Pyrex/Source/Tests/3/gencall.pyx":9 */
155 __pyx_3 = __Pyx_GetName(__pyx_m, __pyx_n_f); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 9; goto __pyx_L1;}
156 __pyx_4 = PyTuple_New(1); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 9; goto __pyx_L1;}
157 Py_INCREF(__pyx_v_a);
158 PyTuple_SET_ITEM(__pyx_4, 0, __pyx_v_a);
159 __pyx_1 = PySequence_Tuple(__pyx_v_b); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 9; goto __pyx_L1;}
160 __pyx_2 = PyNumber_Add(__pyx_4, __pyx_1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 9; goto __pyx_L1;}
161 Py_DECREF(__pyx_4); __pyx_4 = 0;
162 Py_DECREF(__pyx_1); __pyx_1 = 0;
163 __pyx_4 = PyObject_CallObject(__pyx_3, __pyx_2); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 9; goto __pyx_L1;}
164 Py_DECREF(__pyx_3); __pyx_3 = 0;
165 Py_DECREF(__pyx_2); __pyx_2 = 0;
166 Py_DECREF(__pyx_4); __pyx_4 = 0;
168 /* "/Local/Projects/D/Pyrex/Source/Tests/3/gencall.pyx":10 */
169 __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_n_f); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 10; goto __pyx_L1;}
170 __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 10; goto __pyx_L1;}
171 Py_INCREF(__pyx_v_a);
172 PyTuple_SET_ITEM(__pyx_3, 0, __pyx_v_a);
173 __pyx_2 = PySequence_Tuple(__pyx_v_b); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 10; goto __pyx_L1;}
174 __pyx_4 = PyNumber_Add(__pyx_3, __pyx_2); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 10; goto __pyx_L1;}
175 Py_DECREF(__pyx_3); __pyx_3 = 0;
176 Py_DECREF(__pyx_2); __pyx_2 = 0;
177 __pyx_3 = PyDict_New(); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 10; goto __pyx_L1;}
178 __pyx_2 = PyInt_FromLong(42); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 10; goto __pyx_L1;}
179 if (PyDict_SetItem(__pyx_3, __pyx_n_x, __pyx_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 10; goto __pyx_L1;}
180 Py_DECREF(__pyx_2); __pyx_2 = 0;
181 if (PyDict_Update(__pyx_3, __pyx_v_c) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 10; goto __pyx_L1;}
182 __pyx_2 = PyEval_CallObjectWithKeywords(__pyx_1, __pyx_4, __pyx_3); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 10; goto __pyx_L1;}
183 Py_DECREF(__pyx_1); __pyx_1 = 0;
184 Py_DECREF(__pyx_4); __pyx_4 = 0;
185 Py_DECREF(__pyx_3); __pyx_3 = 0;
186 Py_DECREF(__pyx_2); __pyx_2 = 0;
188 __pyx_r = Py_None; Py_INCREF(Py_None);
189 goto __pyx_L0;
190 __pyx_L1:;
191 Py_XDECREF(__pyx_1);
192 Py_XDECREF(__pyx_2);
193 Py_XDECREF(__pyx_3);
194 Py_XDECREF(__pyx_4);
195 __Pyx_AddTraceback("gencall.z");
196 __pyx_r = 0;
197 __pyx_L0:;
198 Py_DECREF(__pyx_v_a);
199 Py_DECREF(__pyx_v_b);
200 Py_DECREF(__pyx_v_c);
201 return __pyx_r;
202 }
204 static struct PyMethodDef __pyx_methods[] = {
205 {"f", (PyCFunction)__pyx_f_7gencall_f, METH_VARARGS|METH_KEYWORDS, 0},
206 {"z", (PyCFunction)__pyx_f_7gencall_z, METH_VARARGS|METH_KEYWORDS, 0},
207 {0, 0, 0, 0}
208 };
210 static void __pyx_init_filenames(void); /*proto*/
212 PyMODINIT_FUNC initgencall(void); /*proto*/
213 PyMODINIT_FUNC initgencall(void) {
214 __pyx_init_filenames();
215 __pyx_m = Py_InitModule4("gencall", __pyx_methods, 0, 0, PYTHON_API_VERSION);
216 if (!__pyx_m) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; goto __pyx_L1;};
217 Py_INCREF(__pyx_m);
218 __pyx_b = PyImport_AddModule("__builtin__");
219 if (!__pyx_b) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; goto __pyx_L1;};
220 if (PyObject_SetAttrString(__pyx_m, "__builtins__", __pyx_b) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; goto __pyx_L1;};
221 if (__Pyx_InitStrings(__pyx_string_tab) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; goto __pyx_L1;};
223 /* "/Local/Projects/D/Pyrex/Source/Tests/3/gencall.pyx":4 */
224 return;
225 __pyx_L1:;
226 __Pyx_AddTraceback("gencall");
227 }
229 static char *__pyx_filenames[] = {
230 "gencall.pyx",
231 };
233 /* Runtime support code */
235 static void __pyx_init_filenames(void) {
236 __pyx_f = __pyx_filenames;
237 }
239 static PyObject *__Pyx_GetName(PyObject *dict, PyObject *name) {
240 PyObject *result;
241 result = PyObject_GetAttr(dict, name);
242 if (!result)
243 PyErr_SetObject(PyExc_NameError, name);
244 return result;
245 }
247 static int __Pyx_InitStrings(__Pyx_StringTabEntry *t) {
248 while (t->p) {
249 *t->p = PyString_FromStringAndSize(t->s, t->n - 1);
250 if (!*t->p)
251 return -1;
252 if (t->i)
253 PyString_InternInPlace(t->p);
254 ++t;
255 }
256 return 0;
257 }
259 #include "compile.h"
260 #include "frameobject.h"
261 #include "traceback.h"
263 static void __Pyx_AddTraceback(char *funcname) {
264 PyObject *py_srcfile = 0;
265 PyObject *py_funcname = 0;
266 PyObject *py_globals = 0;
267 PyObject *empty_tuple = 0;
268 PyObject *empty_string = 0;
269 PyCodeObject *py_code = 0;
270 PyFrameObject *py_frame = 0;
272 py_srcfile = PyString_FromString(__pyx_filename);
273 if (!py_srcfile) goto bad;
274 py_funcname = PyString_FromString(funcname);
275 if (!py_funcname) goto bad;
276 py_globals = PyModule_GetDict(__pyx_m);
277 if (!py_globals) goto bad;
278 empty_tuple = PyTuple_New(0);
279 if (!empty_tuple) goto bad;
280 empty_string = PyString_FromString("");
281 if (!empty_string) goto bad;
282 py_code = PyCode_New(
283 0, /*int argcount,*/
284 0, /*int nlocals,*/
285 0, /*int stacksize,*/
286 0, /*int flags,*/
287 empty_string, /*PyObject *code,*/
288 empty_tuple, /*PyObject *consts,*/
289 empty_tuple, /*PyObject *names,*/
290 empty_tuple, /*PyObject *varnames,*/
291 empty_tuple, /*PyObject *freevars,*/
292 empty_tuple, /*PyObject *cellvars,*/
293 py_srcfile, /*PyObject *filename,*/
294 py_funcname, /*PyObject *name,*/
295 __pyx_lineno, /*int firstlineno,*/
296 empty_string /*PyObject *lnotab*/
297 );
298 if (!py_code) goto bad;
299 py_frame = PyFrame_New(
300 PyThreadState_Get(), /*PyThreadState *tstate,*/
301 py_code, /*PyCodeObject *code,*/
302 py_globals, /*PyObject *globals,*/
303 0 /*PyObject *locals*/
304 );
305 if (!py_frame) goto bad;
306 py_frame->f_lineno = __pyx_lineno;
307 PyTraceBack_Here(py_frame);
308 bad:
309 Py_XDECREF(py_srcfile);
310 Py_XDECREF(py_funcname);
311 Py_XDECREF(empty_tuple);
312 Py_XDECREF(empty_string);
313 Py_XDECREF(py_code);
314 Py_XDECREF(py_frame);
315 }