Cython has moved to github.

pyrex

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