Cython has moved to github.

pyrex

view Tests/2/tuple.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 tuple */
47 /* Declarations from implementation of tuple */
53 static __Pyx_StringTabEntry __pyx_string_tab[] = {
54 {0, 0, 0, 0}
55 };
59 /* Implementation of tuple */
61 static PyObject *__pyx_f_5tuple_f(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
62 static PyObject *__pyx_f_5tuple_f(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
63 PyObject *__pyx_v_obj1 = 0;
64 PyObject *__pyx_v_obj2 = 0;
65 PyObject *__pyx_v_obj3 = 0;
66 PyObject *__pyx_v_obj4 = 0;
67 PyObject *__pyx_v_obj5 = 0;
68 PyObject *__pyx_r;
69 PyObject *__pyx_1 = 0;
70 PyObject *__pyx_2 = 0;
71 PyObject *__pyx_3 = 0;
72 PyObject *__pyx_4 = 0;
73 static char *__pyx_argnames[] = {"obj1","obj2","obj3","obj4","obj5",0};
74 if (!PyArg_ParseTupleAndKeywords(__pyx_args, __pyx_kwds, "OOOOO", __pyx_argnames, &__pyx_v_obj1, &__pyx_v_obj2, &__pyx_v_obj3, &__pyx_v_obj4, &__pyx_v_obj5)) return 0;
75 Py_INCREF(__pyx_v_obj1);
76 Py_INCREF(__pyx_v_obj2);
77 Py_INCREF(__pyx_v_obj3);
78 Py_INCREF(__pyx_v_obj4);
79 Py_INCREF(__pyx_v_obj5);
81 /* "/Local/Projects/D/Pyrex/Source/Tests/2/tuple.pyx":2 */
82 __pyx_1 = PyTuple_New(0); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2; goto __pyx_L1;}
83 Py_DECREF(__pyx_v_obj1);
84 __pyx_v_obj1 = __pyx_1;
85 __pyx_1 = 0;
87 /* "/Local/Projects/D/Pyrex/Source/Tests/2/tuple.pyx":3 */
88 __pyx_1 = PyTuple_New(1); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3; goto __pyx_L1;}
89 Py_INCREF(__pyx_v_obj2);
90 PyTuple_SET_ITEM(__pyx_1, 0, __pyx_v_obj2);
91 Py_DECREF(__pyx_v_obj1);
92 __pyx_v_obj1 = __pyx_1;
93 __pyx_1 = 0;
95 /* "/Local/Projects/D/Pyrex/Source/Tests/2/tuple.pyx":4 */
96 __pyx_1 = PyTuple_New(2); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4; goto __pyx_L1;}
97 Py_INCREF(__pyx_v_obj2);
98 PyTuple_SET_ITEM(__pyx_1, 0, __pyx_v_obj2);
99 Py_INCREF(__pyx_v_obj3);
100 PyTuple_SET_ITEM(__pyx_1, 1, __pyx_v_obj3);
101 Py_DECREF(__pyx_v_obj1);
102 __pyx_v_obj1 = __pyx_1;
103 __pyx_1 = 0;
105 /* "/Local/Projects/D/Pyrex/Source/Tests/2/tuple.pyx":5 */
106 __pyx_1 = PyTuple_New(3); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 5; goto __pyx_L1;}
107 Py_INCREF(__pyx_v_obj2);
108 PyTuple_SET_ITEM(__pyx_1, 0, __pyx_v_obj2);
109 Py_INCREF(__pyx_v_obj3);
110 PyTuple_SET_ITEM(__pyx_1, 1, __pyx_v_obj3);
111 Py_INCREF(__pyx_v_obj4);
112 PyTuple_SET_ITEM(__pyx_1, 2, __pyx_v_obj4);
113 Py_DECREF(__pyx_v_obj1);
114 __pyx_v_obj1 = __pyx_1;
115 __pyx_1 = 0;
117 /* "/Local/Projects/D/Pyrex/Source/Tests/2/tuple.pyx":6 */
118 __pyx_1 = PyTuple_New(3); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 6; goto __pyx_L1;}
119 Py_INCREF(__pyx_v_obj2);
120 PyTuple_SET_ITEM(__pyx_1, 0, __pyx_v_obj2);
121 Py_INCREF(__pyx_v_obj3);
122 PyTuple_SET_ITEM(__pyx_1, 1, __pyx_v_obj3);
123 Py_INCREF(__pyx_v_obj4);
124 PyTuple_SET_ITEM(__pyx_1, 2, __pyx_v_obj4);
125 Py_DECREF(__pyx_v_obj1);
126 __pyx_v_obj1 = __pyx_1;
127 __pyx_1 = 0;
129 /* "/Local/Projects/D/Pyrex/Source/Tests/2/tuple.pyx":7 */
130 __pyx_1 = PyInt_FromLong(17); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 7; goto __pyx_L1;}
131 __pyx_2 = PyInt_FromLong(42); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 7; goto __pyx_L1;}
132 __pyx_3 = PyInt_FromLong(88); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 7; goto __pyx_L1;}
133 __pyx_4 = PyTuple_New(3); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 7; goto __pyx_L1;}
134 PyTuple_SET_ITEM(__pyx_4, 0, __pyx_1);
135 PyTuple_SET_ITEM(__pyx_4, 1, __pyx_2);
136 PyTuple_SET_ITEM(__pyx_4, 2, __pyx_3);
137 __pyx_1 = 0;
138 __pyx_2 = 0;
139 __pyx_3 = 0;
140 Py_DECREF(__pyx_v_obj1);
141 __pyx_v_obj1 = __pyx_4;
142 __pyx_4 = 0;
144 __pyx_r = Py_None; Py_INCREF(Py_None);
145 goto __pyx_L0;
146 __pyx_L1:;
147 Py_XDECREF(__pyx_1);
148 Py_XDECREF(__pyx_2);
149 Py_XDECREF(__pyx_3);
150 Py_XDECREF(__pyx_4);
151 __Pyx_AddTraceback("tuple.f");
152 __pyx_r = 0;
153 __pyx_L0:;
154 Py_DECREF(__pyx_v_obj1);
155 Py_DECREF(__pyx_v_obj2);
156 Py_DECREF(__pyx_v_obj3);
157 Py_DECREF(__pyx_v_obj4);
158 Py_DECREF(__pyx_v_obj5);
159 return __pyx_r;
160 }
162 static struct PyMethodDef __pyx_methods[] = {
163 {"f", (PyCFunction)__pyx_f_5tuple_f, METH_VARARGS|METH_KEYWORDS, 0},
164 {0, 0, 0, 0}
165 };
167 static void __pyx_init_filenames(void); /*proto*/
169 PyMODINIT_FUNC inittuple(void); /*proto*/
170 PyMODINIT_FUNC inittuple(void) {
171 __pyx_init_filenames();
172 __pyx_m = Py_InitModule4("tuple", __pyx_methods, 0, 0, PYTHON_API_VERSION);
173 if (!__pyx_m) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; goto __pyx_L1;};
174 Py_INCREF(__pyx_m);
175 __pyx_b = PyImport_AddModule("__builtin__");
176 if (!__pyx_b) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; goto __pyx_L1;};
177 if (PyObject_SetAttrString(__pyx_m, "__builtins__", __pyx_b) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; goto __pyx_L1;};
178 if (__Pyx_InitStrings(__pyx_string_tab) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; goto __pyx_L1;};
179 return;
180 __pyx_L1:;
181 __Pyx_AddTraceback("tuple");
182 }
184 static char *__pyx_filenames[] = {
185 "tuple.pyx",
186 };
188 /* Runtime support code */
190 static void __pyx_init_filenames(void) {
191 __pyx_f = __pyx_filenames;
192 }
194 static int __Pyx_InitStrings(__Pyx_StringTabEntry *t) {
195 while (t->p) {
196 *t->p = PyString_FromStringAndSize(t->s, t->n - 1);
197 if (!*t->p)
198 return -1;
199 if (t->i)
200 PyString_InternInPlace(t->p);
201 ++t;
202 }
203 return 0;
204 }
206 #include "compile.h"
207 #include "frameobject.h"
208 #include "traceback.h"
210 static void __Pyx_AddTraceback(char *funcname) {
211 PyObject *py_srcfile = 0;
212 PyObject *py_funcname = 0;
213 PyObject *py_globals = 0;
214 PyObject *empty_tuple = 0;
215 PyObject *empty_string = 0;
216 PyCodeObject *py_code = 0;
217 PyFrameObject *py_frame = 0;
219 py_srcfile = PyString_FromString(__pyx_filename);
220 if (!py_srcfile) goto bad;
221 py_funcname = PyString_FromString(funcname);
222 if (!py_funcname) goto bad;
223 py_globals = PyModule_GetDict(__pyx_m);
224 if (!py_globals) goto bad;
225 empty_tuple = PyTuple_New(0);
226 if (!empty_tuple) goto bad;
227 empty_string = PyString_FromString("");
228 if (!empty_string) goto bad;
229 py_code = PyCode_New(
230 0, /*int argcount,*/
231 0, /*int nlocals,*/
232 0, /*int stacksize,*/
233 0, /*int flags,*/
234 empty_string, /*PyObject *code,*/
235 empty_tuple, /*PyObject *consts,*/
236 empty_tuple, /*PyObject *names,*/
237 empty_tuple, /*PyObject *varnames,*/
238 empty_tuple, /*PyObject *freevars,*/
239 empty_tuple, /*PyObject *cellvars,*/
240 py_srcfile, /*PyObject *filename,*/
241 py_funcname, /*PyObject *name,*/
242 __pyx_lineno, /*int firstlineno,*/
243 empty_string /*PyObject *lnotab*/
244 );
245 if (!py_code) goto bad;
246 py_frame = PyFrame_New(
247 PyThreadState_Get(), /*PyThreadState *tstate,*/
248 py_code, /*PyCodeObject *code,*/
249 py_globals, /*PyObject *globals,*/
250 0 /*PyObject *locals*/
251 );
252 if (!py_frame) goto bad;
253 py_frame->f_lineno = __pyx_lineno;
254 PyTraceBack_Here(py_frame);
255 bad:
256 Py_XDECREF(py_srcfile);
257 Py_XDECREF(py_funcname);
258 Py_XDECREF(empty_tuple);
259 Py_XDECREF(empty_string);
260 Py_XDECREF(py_code);
261 Py_XDECREF(py_frame);
262 }