Cython has moved to github.

pyrex

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