Cython has moved to github.

pyrex

view Tests/3/Reference/simpcall.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 simpcall */
49 static void __pyx_f_8simpcall_g(int,float,char *); /*proto*/
50 static PyObject *__pyx_f_8simpcall_h(int,PyObject *); /*proto*/
53 static __Pyx_StringTabEntry __pyx_string_tab[] = {
54 {&__pyx_n_eggs, 1, __pyx_k1, sizeof(__pyx_k1)},
55 {&__pyx_n_f, 1, __pyx_k2, sizeof(__pyx_k2)},
56 {0, 0, 0, 0}
57 };
59 /* Implementation of simpcall */
61 static PyObject *__pyx_f_8simpcall_f(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
62 static PyObject *__pyx_f_8simpcall_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 }
80 static void __pyx_f_8simpcall_g(int __pyx_v_i,float __pyx_v_f,char *__pyx_v_p) {
81 __pyx_v_f = __pyx_v_i;
83 }
85 static PyObject *__pyx_f_8simpcall_h(int __pyx_v_i,PyObject *__pyx_v_obj) {
86 PyObject *__pyx_r;
87 int __pyx_1;
88 Py_INCREF(__pyx_v_obj);
89 __pyx_1 = PyInt_AsLong(__pyx_v_obj); if (PyErr_Occurred()) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 8; goto __pyx_L1;}
90 __pyx_v_i = __pyx_1;
92 __pyx_r = Py_None; Py_INCREF(Py_None);
93 goto __pyx_L0;
94 __pyx_L1:;
95 __Pyx_AddTraceback("simpcall.h");
96 __pyx_r = 0;
97 __pyx_L0:;
98 Py_DECREF(__pyx_v_obj);
99 return __pyx_r;
100 }
104 static PyObject *__pyx_f_8simpcall_z(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
105 static PyObject *__pyx_f_8simpcall_z(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
106 PyObject *__pyx_v_a = 0;
107 PyObject *__pyx_v_b = 0;
108 PyObject *__pyx_v_c = 0;
109 PyObject *__pyx_r;
110 PyObject *__pyx_1 = 0;
111 PyObject *__pyx_2 = 0;
112 PyObject *__pyx_3 = 0;
113 int __pyx_4;
114 float __pyx_5;
115 char *__pyx_6;
116 static char *__pyx_argnames[] = {"a","b","c",0};
117 if (!PyArg_ParseTupleAndKeywords(__pyx_args, __pyx_kwds, "OOO", __pyx_argnames, &__pyx_v_a, &__pyx_v_b, &__pyx_v_c)) return 0;
118 Py_INCREF(__pyx_v_a);
119 Py_INCREF(__pyx_v_b);
120 Py_INCREF(__pyx_v_c);
122 /* "/Local/Projects/D/Pyrex/Source/Tests/3/simpcall.pyx":11 */
123 __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_n_f); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 11; goto __pyx_L1;}
124 __pyx_2 = PyObject_CallObject(__pyx_1, 0); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 11; goto __pyx_L1;}
125 Py_DECREF(__pyx_1); __pyx_1 = 0;
126 Py_DECREF(__pyx_2); __pyx_2 = 0;
128 /* "/Local/Projects/D/Pyrex/Source/Tests/3/simpcall.pyx":12 */
129 __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_n_f); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 12; goto __pyx_L1;}
130 __pyx_2 = PyTuple_New(1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 12; goto __pyx_L1;}
131 Py_INCREF(__pyx_v_a);
132 PyTuple_SET_ITEM(__pyx_2, 0, __pyx_v_a);
133 __pyx_3 = PyObject_CallObject(__pyx_1, __pyx_2); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 12; goto __pyx_L1;}
134 Py_DECREF(__pyx_1); __pyx_1 = 0;
135 Py_DECREF(__pyx_2); __pyx_2 = 0;
136 Py_DECREF(__pyx_3); __pyx_3 = 0;
138 /* "/Local/Projects/D/Pyrex/Source/Tests/3/simpcall.pyx":13 */
139 __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_n_f); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 13; goto __pyx_L1;}
140 __pyx_2 = PyTuple_New(2); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 13; goto __pyx_L1;}
141 Py_INCREF(__pyx_v_a);
142 PyTuple_SET_ITEM(__pyx_2, 0, __pyx_v_a);
143 Py_INCREF(__pyx_v_b);
144 PyTuple_SET_ITEM(__pyx_2, 1, __pyx_v_b);
145 __pyx_3 = PyObject_CallObject(__pyx_1, __pyx_2); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 13; goto __pyx_L1;}
146 Py_DECREF(__pyx_1); __pyx_1 = 0;
147 Py_DECREF(__pyx_2); __pyx_2 = 0;
148 Py_DECREF(__pyx_3); __pyx_3 = 0;
150 /* "/Local/Projects/D/Pyrex/Source/Tests/3/simpcall.pyx":14 */
151 __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_n_f); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 14; goto __pyx_L1;}
152 __pyx_2 = PyTuple_New(2); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 14; goto __pyx_L1;}
153 Py_INCREF(__pyx_v_a);
154 PyTuple_SET_ITEM(__pyx_2, 0, __pyx_v_a);
155 Py_INCREF(__pyx_v_b);
156 PyTuple_SET_ITEM(__pyx_2, 1, __pyx_v_b);
157 __pyx_3 = PyObject_CallObject(__pyx_1, __pyx_2); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 14; goto __pyx_L1;}
158 Py_DECREF(__pyx_1); __pyx_1 = 0;
159 Py_DECREF(__pyx_2); __pyx_2 = 0;
160 Py_DECREF(__pyx_3); __pyx_3 = 0;
162 /* "/Local/Projects/D/Pyrex/Source/Tests/3/simpcall.pyx":15 */
163 __pyx_f_8simpcall_g(1,2.0,__pyx_k1);
165 /* "/Local/Projects/D/Pyrex/Source/Tests/3/simpcall.pyx":16 */
166 __pyx_4 = PyInt_AsLong(__pyx_v_a); if (PyErr_Occurred()) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 16; goto __pyx_L1;}
167 __pyx_5 = PyFloat_AsDouble(__pyx_v_b); if (PyErr_Occurred()) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 16; goto __pyx_L1;}
168 __pyx_6 = PyString_AsString(__pyx_v_c); if (!__pyx_6) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 16; goto __pyx_L1;}
169 __pyx_f_8simpcall_g(__pyx_4,__pyx_5,__pyx_6);
171 /* "/Local/Projects/D/Pyrex/Source/Tests/3/simpcall.pyx":17 */
172 __pyx_1 = __pyx_f_8simpcall_h(42,__pyx_n_eggs); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 17; goto __pyx_L1;}
173 Py_DECREF(__pyx_1); __pyx_1 = 0;
175 __pyx_r = Py_None; Py_INCREF(Py_None);
176 goto __pyx_L0;
177 __pyx_L1:;
178 Py_XDECREF(__pyx_1);
179 Py_XDECREF(__pyx_2);
180 Py_XDECREF(__pyx_3);
181 __Pyx_AddTraceback("simpcall.z");
182 __pyx_r = 0;
183 __pyx_L0:;
184 Py_DECREF(__pyx_v_a);
185 Py_DECREF(__pyx_v_b);
186 Py_DECREF(__pyx_v_c);
187 return __pyx_r;
188 }
191 static struct PyMethodDef __pyx_methods[] = {
192 {"f", (PyCFunction)__pyx_f_8simpcall_f, METH_VARARGS|METH_KEYWORDS, 0},
193 {"z", (PyCFunction)__pyx_f_8simpcall_z, METH_VARARGS|METH_KEYWORDS, 0},
194 {0, 0, 0, 0}
195 };
197 static void __pyx_init_filenames(void); /*proto*/
199 PyMODINIT_FUNC initsimpcall(void); /*proto*/
200 PyMODINIT_FUNC initsimpcall(void) {
201 __pyx_init_filenames();
202 __pyx_m = Py_InitModule4("simpcall", __pyx_methods, 0, 0, PYTHON_API_VERSION);
203 if (!__pyx_m) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; goto __pyx_L1;};
204 Py_INCREF(__pyx_m);
205 __pyx_b = PyImport_AddModule("__builtin__");
206 if (!__pyx_b) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; goto __pyx_L1;};
207 if (PyObject_SetAttrString(__pyx_m, "__builtins__", __pyx_b) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; goto __pyx_L1;};
208 if (__Pyx_InitStrings(__pyx_string_tab) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; goto __pyx_L1;};
210 /* "/Local/Projects/D/Pyrex/Source/Tests/3/simpcall.pyx":10 */
211 return;
212 __pyx_L1:;
213 __Pyx_AddTraceback("simpcall");
214 }
216 static char *__pyx_filenames[] = {
217 "simpcall.pyx",
218 };
220 /* Runtime support code */
222 static void __pyx_init_filenames(void) {
223 __pyx_f = __pyx_filenames;
224 }
226 static PyObject *__Pyx_GetName(PyObject *dict, PyObject *name) {
227 PyObject *result;
228 result = PyObject_GetAttr(dict, name);
229 if (!result)
230 PyErr_SetObject(PyExc_NameError, name);
231 return result;
232 }
234 static int __Pyx_InternStrings(__Pyx_InternTabEntry *t) {
235 while (t->p) {
236 *t->p = PyString_InternFromString(t->s);
237 if (!*t->p)
238 return -1;
239 ++t;
240 }
241 return 0;
242 }
244 #include "compile.h"
245 #include "frameobject.h"
246 #include "traceback.h"
248 static void __Pyx_AddTraceback(char *funcname) {
249 PyObject *py_srcfile = 0;
250 PyObject *py_funcname = 0;
251 PyObject *py_globals = 0;
252 PyObject *empty_tuple = 0;
253 PyObject *empty_string = 0;
254 PyCodeObject *py_code = 0;
255 PyFrameObject *py_frame = 0;
257 py_srcfile = PyString_FromString(__pyx_filename);
258 if (!py_srcfile) goto bad;
259 py_funcname = PyString_FromString(funcname);
260 if (!py_funcname) goto bad;
261 py_globals = PyModule_GetDict(__pyx_m);
262 if (!py_globals) goto bad;
263 empty_tuple = PyTuple_New(0);
264 if (!empty_tuple) goto bad;
265 empty_string = PyString_FromString("");
266 if (!empty_string) goto bad;
267 py_code = PyCode_New(
268 0, /*int argcount,*/
269 0, /*int nlocals,*/
270 0, /*int stacksize,*/
271 0, /*int flags,*/
272 empty_string, /*PyObject *code,*/
273 empty_tuple, /*PyObject *consts,*/
274 empty_tuple, /*PyObject *names,*/
275 empty_tuple, /*PyObject *varnames,*/
276 empty_tuple, /*PyObject *freevars,*/
277 empty_tuple, /*PyObject *cellvars,*/
278 py_srcfile, /*PyObject *filename,*/
279 py_funcname, /*PyObject *name,*/
280 __pyx_lineno, /*int firstlineno,*/
281 empty_string /*PyObject *lnotab*/
282 );
283 if (!py_code) goto bad;
284 py_frame = PyFrame_New(
285 PyThreadState_Get(), /*PyThreadState *tstate,*/
286 py_code, /*PyCodeObject *code,*/
287 py_globals, /*PyObject *globals,*/
288 0 /*PyObject *locals*/
289 );
290 if (!py_frame) goto bad;
291 py_frame->f_lineno = __pyx_lineno;
292 PyTraceBack_Here(py_frame);
293 bad:
294 Py_XDECREF(py_srcfile);
295 Py_XDECREF(py_funcname);
296 Py_XDECREF(empty_tuple);
297 Py_XDECREF(empty_string);
298 Py_XDECREF(py_code);
299 Py_XDECREF(py_frame);
300 }