Cython has moved to github.
pyrex
view Tests/3/Reference/while.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 void __Pyx_AddTraceback(char *funcname); /*proto*/
43 /* Declarations from while */
47 static __Pyx_StringTabEntry __pyx_string_tab[] = {
48 {0, 0, 0, 0}
49 };
51 /* Implementation of while */
53 static PyObject *__pyx_f_5while_f(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
54 static PyObject *__pyx_f_5while_f(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
55 PyObject *__pyx_v_a = 0;
56 PyObject *__pyx_v_b = 0;
57 int __pyx_v_i;
58 PyObject *__pyx_v_x;
59 PyObject *__pyx_r;
60 int __pyx_1;
61 PyObject *__pyx_2 = 0;
62 static char *__pyx_argnames[] = {"a","b",0};
63 if (!PyArg_ParseTupleAndKeywords(__pyx_args, __pyx_kwds, "OO", __pyx_argnames, &__pyx_v_a, &__pyx_v_b)) return 0;
64 Py_INCREF(__pyx_v_a);
65 Py_INCREF(__pyx_v_b);
66 __pyx_v_x = Py_None; Py_INCREF(Py_None);
68 /* "/Local/Projects/D/Pyrex/Source/Tests/3/while.pyx":4 */
69 while (1) {
70 __pyx_1 = PyObject_IsTrue(__pyx_v_a); if (__pyx_1 < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4; goto __pyx_L1;}
71 if (!__pyx_1) break;
72 __pyx_2 = PyInt_FromLong(1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 5; goto __pyx_L1;}
73 Py_DECREF(__pyx_v_x);
74 __pyx_v_x = __pyx_2;
75 __pyx_2 = 0;
76 }
78 /* "/Local/Projects/D/Pyrex/Source/Tests/3/while.pyx":7 */
79 while (1) {
80 __pyx_2 = PyNumber_Add(__pyx_v_a, __pyx_v_b); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 7; goto __pyx_L1;}
81 __pyx_1 = PyObject_IsTrue(__pyx_2); if (__pyx_1 < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 7; goto __pyx_L1;}
82 Py_DECREF(__pyx_2); __pyx_2 = 0;
83 if (!__pyx_1) break;
84 __pyx_2 = PyInt_FromLong(1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 8; goto __pyx_L1;}
85 Py_DECREF(__pyx_v_x);
86 __pyx_v_x = __pyx_2;
87 __pyx_2 = 0;
88 }
90 /* "/Local/Projects/D/Pyrex/Source/Tests/3/while.pyx":10 */
91 while (1) {
92 __pyx_1 = __pyx_v_i;
93 if (!__pyx_1) break;
94 __pyx_2 = PyInt_FromLong(1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 11; goto __pyx_L1;}
95 Py_DECREF(__pyx_v_x);
96 __pyx_v_x = __pyx_2;
97 __pyx_2 = 0;
98 }
99 /*else*/ {
100 __pyx_2 = PyInt_FromLong(2); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 13; goto __pyx_L1;}
101 Py_DECREF(__pyx_v_x);
102 __pyx_v_x = __pyx_2;
103 __pyx_2 = 0;
104 }
106 /* "/Local/Projects/D/Pyrex/Source/Tests/3/while.pyx":15 */
107 while (1) {
108 __pyx_1 = __pyx_v_i;
109 if (!__pyx_1) break;
111 /* "/Local/Projects/D/Pyrex/Source/Tests/3/while.pyx":16 */
112 __pyx_2 = PyInt_FromLong(1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 16; goto __pyx_L1;}
113 Py_DECREF(__pyx_v_x);
114 __pyx_v_x = __pyx_2;
115 __pyx_2 = 0;
117 /* "/Local/Projects/D/Pyrex/Source/Tests/3/while.pyx":17 */
118 goto __pyx_L9;
120 /* "/Local/Projects/D/Pyrex/Source/Tests/3/while.pyx":18 */
121 __pyx_2 = PyInt_FromLong(2); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 18; goto __pyx_L1;}
122 Py_DECREF(__pyx_v_x);
123 __pyx_v_x = __pyx_2;
124 __pyx_2 = 0;
125 }
126 /*else*/ {
127 __pyx_2 = PyInt_FromLong(3); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 20; goto __pyx_L1;}
128 Py_DECREF(__pyx_v_x);
129 __pyx_v_x = __pyx_2;
130 __pyx_2 = 0;
131 }
132 __pyx_L9:;
134 /* "/Local/Projects/D/Pyrex/Source/Tests/3/while.pyx":22 */
135 while (1) {
136 __pyx_1 = __pyx_v_i;
137 if (!__pyx_1) break;
139 /* "/Local/Projects/D/Pyrex/Source/Tests/3/while.pyx":23 */
140 __pyx_2 = PyInt_FromLong(1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 23; goto __pyx_L1;}
141 Py_DECREF(__pyx_v_x);
142 __pyx_v_x = __pyx_2;
143 __pyx_2 = 0;
145 /* "/Local/Projects/D/Pyrex/Source/Tests/3/while.pyx":24 */
146 goto __pyx_L10;
148 /* "/Local/Projects/D/Pyrex/Source/Tests/3/while.pyx":25 */
149 __pyx_2 = PyInt_FromLong(2); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 25; goto __pyx_L1;}
150 Py_DECREF(__pyx_v_x);
151 __pyx_v_x = __pyx_2;
152 __pyx_2 = 0;
153 __pyx_L10:;
154 }
156 __pyx_r = Py_None; Py_INCREF(Py_None);
157 goto __pyx_L0;
158 __pyx_L1:;
159 Py_XDECREF(__pyx_2);
160 __Pyx_AddTraceback("while.f");
161 __pyx_r = 0;
162 __pyx_L0:;
163 Py_DECREF(__pyx_v_x);
164 Py_DECREF(__pyx_v_a);
165 Py_DECREF(__pyx_v_b);
166 return __pyx_r;
167 }
169 static struct PyMethodDef __pyx_methods[] = {
170 {"f", (PyCFunction)__pyx_f_5while_f, METH_VARARGS|METH_KEYWORDS, 0},
171 {0, 0, 0, 0}
172 };
174 static void __pyx_init_filenames(void); /*proto*/
176 PyMODINIT_FUNC initwhile(void); /*proto*/
177 PyMODINIT_FUNC initwhile(void) {
178 __pyx_init_filenames();
179 __pyx_m = Py_InitModule4("while", __pyx_methods, 0, 0, PYTHON_API_VERSION);
180 if (!__pyx_m) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; goto __pyx_L1;};
181 Py_INCREF(__pyx_m);
182 __pyx_b = PyImport_AddModule("__builtin__");
183 if (!__pyx_b) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; goto __pyx_L1;};
184 if (PyObject_SetAttrString(__pyx_m, "__builtins__", __pyx_b) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; goto __pyx_L1;};
185 if (__Pyx_InitStrings(__pyx_string_tab) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; goto __pyx_L1;};
186 return;
187 __pyx_L1:;
188 __Pyx_AddTraceback("while");
189 }
191 static char *__pyx_filenames[] = {
192 "while.pyx",
193 };
195 /* Runtime support code */
197 static void __pyx_init_filenames(void) {
198 __pyx_f = __pyx_filenames;
199 }
201 #include "compile.h"
202 #include "frameobject.h"
203 #include "traceback.h"
205 static void __Pyx_AddTraceback(char *funcname) {
206 PyObject *py_srcfile = 0;
207 PyObject *py_funcname = 0;
208 PyObject *py_globals = 0;
209 PyObject *empty_tuple = 0;
210 PyObject *empty_string = 0;
211 PyCodeObject *py_code = 0;
212 PyFrameObject *py_frame = 0;
214 py_srcfile = PyString_FromString(__pyx_filename);
215 if (!py_srcfile) goto bad;
216 py_funcname = PyString_FromString(funcname);
217 if (!py_funcname) goto bad;
218 py_globals = PyModule_GetDict(__pyx_m);
219 if (!py_globals) goto bad;
220 empty_tuple = PyTuple_New(0);
221 if (!empty_tuple) goto bad;
222 empty_string = PyString_FromString("");
223 if (!empty_string) goto bad;
224 py_code = PyCode_New(
225 0, /*int argcount,*/
226 0, /*int nlocals,*/
227 0, /*int stacksize,*/
228 0, /*int flags,*/
229 empty_string, /*PyObject *code,*/
230 empty_tuple, /*PyObject *consts,*/
231 empty_tuple, /*PyObject *names,*/
232 empty_tuple, /*PyObject *varnames,*/
233 empty_tuple, /*PyObject *freevars,*/
234 empty_tuple, /*PyObject *cellvars,*/
235 py_srcfile, /*PyObject *filename,*/
236 py_funcname, /*PyObject *name,*/
237 __pyx_lineno, /*int firstlineno,*/
238 empty_string /*PyObject *lnotab*/
239 );
240 if (!py_code) goto bad;
241 py_frame = PyFrame_New(
242 PyThreadState_Get(), /*PyThreadState *tstate,*/
243 py_code, /*PyCodeObject *code,*/
244 py_globals, /*PyObject *globals,*/
245 0 /*PyObject *locals*/
246 );
247 if (!py_frame) goto bad;
248 py_frame->f_lineno = __pyx_lineno;
249 PyTraceBack_Here(py_frame);
250 bad:
251 Py_XDECREF(py_srcfile);
252 Py_XDECREF(py_funcname);
253 Py_XDECREF(empty_tuple);
254 Py_XDECREF(empty_string);
255 Py_XDECREF(py_code);
256 Py_XDECREF(py_frame);
257 }
