Cython has moved to github.

pyrex

view Tests/Bugs/chapman/mitch_chapman_3.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_PrintItem(PyObject *); /*proto*/
41 static int __Pyx_PrintNewline(void); /*proto*/
43 static int __Pyx_InitStrings(__Pyx_StringTabEntry *t); /*proto*/
45 static void __Pyx_AddTraceback(char *funcname); /*proto*/
47 /* Declarations from mitch_chapman_3 */
50 /* Declarations from implementation of mitch_chapman_3 */
53 static char __pyx_k1[] = "Done.";
56 static PyObject *__pyx_k1p;
58 static __Pyx_StringTabEntry __pyx_string_tab[] = {
59 {&__pyx_k1p, 0, __pyx_k1, sizeof(__pyx_k1)},
60 {0, 0, 0, 0}
61 };
65 /* Implementation of mitch_chapman_3 */
67 static PyObject *__pyx_f_15mitch_chapman_3_cannotIterate(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
68 static PyObject *__pyx_f_15mitch_chapman_3_cannotIterate(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
69 PyObject *__pyx_v_l;
70 PyObject *__pyx_v_item;
71 PyObject *__pyx_r;
72 PyObject *__pyx_1 = 0;
73 PyObject *__pyx_2 = 0;
74 PyObject *__pyx_3 = 0;
75 PyObject *__pyx_4 = 0;
76 PyObject *__pyx_5 = 0;
77 static char *__pyx_argnames[] = {0};
78 if (!PyArg_ParseTupleAndKeywords(__pyx_args, __pyx_kwds, "", __pyx_argnames)) return 0;
79 __pyx_v_l = Py_None; Py_INCREF(Py_None);
80 __pyx_v_item = Py_None; Py_INCREF(Py_None);
82 /* "/Local/Projects/D/Pyrex/Source/Tests/Bugs/chapman/mitch_chapman_3.pyx":2 */
83 __pyx_1 = PyInt_FromLong(1); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2; goto __pyx_L1;}
84 __pyx_2 = PyInt_FromLong(2); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2; goto __pyx_L1;}
85 __pyx_3 = PyInt_FromLong(3); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2; goto __pyx_L1;}
86 __pyx_4 = PyInt_FromLong(4); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2; goto __pyx_L1;}
87 __pyx_5 = PyList_New(4); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2; goto __pyx_L1;}
88 PyList_SET_ITEM(__pyx_5, 0, __pyx_1);
89 PyList_SET_ITEM(__pyx_5, 1, __pyx_2);
90 PyList_SET_ITEM(__pyx_5, 2, __pyx_3);
91 PyList_SET_ITEM(__pyx_5, 3, __pyx_4);
92 __pyx_1 = 0;
93 __pyx_2 = 0;
94 __pyx_3 = 0;
95 __pyx_4 = 0;
96 Py_DECREF(__pyx_v_l);
97 __pyx_v_l = __pyx_5;
98 __pyx_5 = 0;
100 /* "/Local/Projects/D/Pyrex/Source/Tests/Bugs/chapman/mitch_chapman_3.pyx":3 */
101 __pyx_1 = PyObject_GetIter(__pyx_v_l); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3; goto __pyx_L1;}
102 for (;;) {
103 __pyx_2 = PyIter_Next(__pyx_1);
104 if (!__pyx_2) {
105 if (PyErr_Occurred()) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3; goto __pyx_L1;}
106 break;
107 }
108 Py_DECREF(__pyx_v_item);
109 __pyx_v_item = __pyx_2;
110 __pyx_2 = 0;
111 if (__Pyx_PrintItem(__pyx_v_item) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4; goto __pyx_L1;}
112 if (__Pyx_PrintNewline() < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4; goto __pyx_L1;}
113 }
114 Py_DECREF(__pyx_1); __pyx_1 = 0;
116 /* "/Local/Projects/D/Pyrex/Source/Tests/Bugs/chapman/mitch_chapman_3.pyx":5 */
117 if (__Pyx_PrintItem(__pyx_k1p) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 5; goto __pyx_L1;}
118 if (__Pyx_PrintNewline() < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 5; goto __pyx_L1;}
120 __pyx_r = Py_None; Py_INCREF(Py_None);
121 goto __pyx_L0;
122 __pyx_L1:;
123 Py_XDECREF(__pyx_1);
124 Py_XDECREF(__pyx_2);
125 Py_XDECREF(__pyx_3);
126 Py_XDECREF(__pyx_4);
127 Py_XDECREF(__pyx_5);
128 __Pyx_AddTraceback("mitch_chapman_3.cannotIterate");
129 __pyx_r = 0;
130 __pyx_L0:;
131 Py_DECREF(__pyx_v_l);
132 Py_DECREF(__pyx_v_item);
133 return __pyx_r;
134 }
136 static struct PyMethodDef __pyx_methods[] = {
137 {"cannotIterate", (PyCFunction)__pyx_f_15mitch_chapman_3_cannotIterate, METH_VARARGS|METH_KEYWORDS, 0},
138 {0, 0, 0, 0}
139 };
141 static void __pyx_init_filenames(void); /*proto*/
143 PyMODINIT_FUNC initmitch_chapman_3(void); /*proto*/
144 PyMODINIT_FUNC initmitch_chapman_3(void) {
145 __pyx_init_filenames();
146 __pyx_m = Py_InitModule4("mitch_chapman_3", __pyx_methods, 0, 0, PYTHON_API_VERSION);
147 if (!__pyx_m) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; goto __pyx_L1;};
148 Py_INCREF(__pyx_m);
149 __pyx_b = PyImport_AddModule("__builtin__");
150 if (!__pyx_b) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; goto __pyx_L1;};
151 if (PyObject_SetAttrString(__pyx_m, "__builtins__", __pyx_b) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; goto __pyx_L1;};
152 if (__Pyx_InitStrings(__pyx_string_tab) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; goto __pyx_L1;};
153 return;
154 __pyx_L1:;
155 __Pyx_AddTraceback("mitch_chapman_3");
156 }
158 static char *__pyx_filenames[] = {
159 "mitch_chapman_3.pyx",
160 };
162 /* Runtime support code */
164 static void __pyx_init_filenames(void) {
165 __pyx_f = __pyx_filenames;
166 }
168 static PyObject *__Pyx_GetStdout(void) {
169 PyObject *f = PySys_GetObject("stdout");
170 if (!f) {
171 PyErr_SetString(PyExc_RuntimeError, "lost sys.stdout");
172 }
173 return f;
174 }
176 static int __Pyx_PrintItem(PyObject *v) {
177 PyObject *f;
179 if (!(f = __Pyx_GetStdout()))
180 return -1;
181 if (PyFile_SoftSpace(f, 1)) {
182 if (PyFile_WriteString(" ", f) < 0)
183 return -1;
184 }
185 if (PyFile_WriteObject(v, f, Py_PRINT_RAW) < 0)
186 return -1;
187 if (PyString_Check(v)) {
188 char *s = PyString_AsString(v);
189 Py_ssize_t len = PyString_Size(v);
190 if (len > 0 &&
191 isspace(Py_CHARMASK(s[len-1])) &&
192 s[len-1] != ' ')
193 PyFile_SoftSpace(f, 0);
194 }
195 return 0;
196 }
198 static int __Pyx_PrintNewline(void) {
199 PyObject *f;
201 if (!(f = __Pyx_GetStdout()))
202 return -1;
203 if (PyFile_WriteString("\n", f) < 0)
204 return -1;
205 PyFile_SoftSpace(f, 0);
206 return 0;
207 }
209 static int __Pyx_InitStrings(__Pyx_StringTabEntry *t) {
210 while (t->p) {
211 *t->p = PyString_FromStringAndSize(t->s, t->n - 1);
212 if (!*t->p)
213 return -1;
214 if (t->i)
215 PyString_InternInPlace(t->p);
216 ++t;
217 }
218 return 0;
219 }
221 #include "compile.h"
222 #include "frameobject.h"
223 #include "traceback.h"
225 static void __Pyx_AddTraceback(char *funcname) {
226 PyObject *py_srcfile = 0;
227 PyObject *py_funcname = 0;
228 PyObject *py_globals = 0;
229 PyObject *empty_tuple = 0;
230 PyObject *empty_string = 0;
231 PyCodeObject *py_code = 0;
232 PyFrameObject *py_frame = 0;
234 py_srcfile = PyString_FromString(__pyx_filename);
235 if (!py_srcfile) goto bad;
236 py_funcname = PyString_FromString(funcname);
237 if (!py_funcname) goto bad;
238 py_globals = PyModule_GetDict(__pyx_m);
239 if (!py_globals) goto bad;
240 empty_tuple = PyTuple_New(0);
241 if (!empty_tuple) goto bad;
242 empty_string = PyString_FromString("");
243 if (!empty_string) goto bad;
244 py_code = PyCode_New(
245 0, /*int argcount,*/
246 0, /*int nlocals,*/
247 0, /*int stacksize,*/
248 0, /*int flags,*/
249 empty_string, /*PyObject *code,*/
250 empty_tuple, /*PyObject *consts,*/
251 empty_tuple, /*PyObject *names,*/
252 empty_tuple, /*PyObject *varnames,*/
253 empty_tuple, /*PyObject *freevars,*/
254 empty_tuple, /*PyObject *cellvars,*/
255 py_srcfile, /*PyObject *filename,*/
256 py_funcname, /*PyObject *name,*/
257 __pyx_lineno, /*int firstlineno,*/
258 empty_string /*PyObject *lnotab*/
259 );
260 if (!py_code) goto bad;
261 py_frame = PyFrame_New(
262 PyThreadState_Get(), /*PyThreadState *tstate,*/
263 py_code, /*PyCodeObject *code,*/
264 py_globals, /*PyObject *globals,*/
265 0 /*PyObject *locals*/
266 );
267 if (!py_frame) goto bad;
268 py_frame->f_lineno = __pyx_lineno;
269 PyTraceBack_Here(py_frame);
270 bad:
271 Py_XDECREF(py_srcfile);
272 Py_XDECREF(py_funcname);
273 Py_XDECREF(empty_tuple);
274 Py_XDECREF(empty_string);
275 Py_XDECREF(py_code);
276 Py_XDECREF(py_frame);
277 }