Cython has moved to github.

pyrex

view Tests/10/intindex.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 37554acbb702
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 PyObject *__Pyx_GetItemInt(PyObject *o, Py_ssize_t i); /*proto*/
42 static int __Pyx_SetItemInt(PyObject *o, Py_ssize_t i, PyObject *v); /*proto*/
44 static int __Pyx_InitStrings(__Pyx_StringTabEntry *t); /*proto*/
46 static void __Pyx_AddTraceback(char *funcname); /*proto*/
48 /* Declarations from intindex */
51 /* Declarations from implementation of intindex */
53 static int __pyx_f_8intindex_f(void); /*proto*/
58 static __Pyx_StringTabEntry __pyx_string_tab[] = {
59 {0, 0, 0, 0}
60 };
64 /* Implementation of intindex */
66 static int __pyx_f_8intindex_f(void) {
67 PyObject *__pyx_v_x;
68 PyObject *__pyx_v_y;
69 PyObject *__pyx_v_z;
70 int __pyx_v_i;
71 int __pyx_r;
72 PyObject *__pyx_1 = 0;
73 __pyx_v_x = Py_None; Py_INCREF(Py_None);
74 __pyx_v_y = Py_None; Py_INCREF(Py_None);
75 __pyx_v_z = Py_None; Py_INCREF(Py_None);
77 /* "/Local/Projects/D/Pyrex/Source/Tests/10/intindex.pyx":4 */
78 __pyx_1 = PyObject_GetItem(__pyx_v_x, __pyx_v_y); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4; goto __pyx_L1;}
79 Py_DECREF(__pyx_v_z);
80 __pyx_v_z = __pyx_1;
81 __pyx_1 = 0;
83 /* "/Local/Projects/D/Pyrex/Source/Tests/10/intindex.pyx":5 */
84 __pyx_1 = __Pyx_GetItemInt(__pyx_v_x, __pyx_v_i); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 5; goto __pyx_L1;}
85 Py_DECREF(__pyx_v_z);
86 __pyx_v_z = __pyx_1;
87 __pyx_1 = 0;
89 /* "/Local/Projects/D/Pyrex/Source/Tests/10/intindex.pyx":6 */
90 if (PyObject_SetItem(__pyx_v_x, __pyx_v_y, __pyx_v_z) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 6; goto __pyx_L1;}
92 /* "/Local/Projects/D/Pyrex/Source/Tests/10/intindex.pyx":7 */
93 if (__Pyx_SetItemInt(__pyx_v_x, __pyx_v_i, __pyx_v_z) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 7; goto __pyx_L1;}
95 __pyx_r = 0;
96 goto __pyx_L0;
97 __pyx_L1:;
98 Py_XDECREF(__pyx_1);
99 __Pyx_AddTraceback("intindex.f");
100 __pyx_r = (-1);
101 __pyx_L0:;
102 Py_DECREF(__pyx_v_x);
103 Py_DECREF(__pyx_v_y);
104 Py_DECREF(__pyx_v_z);
105 return __pyx_r;
106 }
108 static struct PyMethodDef __pyx_methods[] = {
109 {0, 0, 0, 0}
110 };
112 static void __pyx_init_filenames(void); /*proto*/
114 PyMODINIT_FUNC initintindex(void); /*proto*/
115 PyMODINIT_FUNC initintindex(void) {
116 __pyx_init_filenames();
117 __pyx_m = Py_InitModule4("intindex", __pyx_methods, 0, 0, PYTHON_API_VERSION);
118 if (!__pyx_m) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; goto __pyx_L1;};
119 Py_INCREF(__pyx_m);
120 __pyx_b = PyImport_AddModule("__builtin__");
121 if (!__pyx_b) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; goto __pyx_L1;};
122 if (PyObject_SetAttrString(__pyx_m, "__builtins__", __pyx_b) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; goto __pyx_L1;};
123 if (__Pyx_InitStrings(__pyx_string_tab) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; goto __pyx_L1;};
124 return;
125 __pyx_L1:;
126 __Pyx_AddTraceback("intindex");
127 }
129 static char *__pyx_filenames[] = {
130 "intindex.pyx",
131 };
133 /* Runtime support code */
135 static void __pyx_init_filenames(void) {
136 __pyx_f = __pyx_filenames;
137 }
139 static PyObject *__Pyx_GetItemInt(PyObject *o, Py_ssize_t i) {
140 PyTypeObject *t = o->ob_type;
141 PyObject *r;
142 if (t->tp_as_sequence && t->tp_as_sequence->sq_item)
143 r = PySequence_GetItem(o, i);
144 else {
145 PyObject *j = PyInt_FromLong(i);
146 if (!j)
147 return 0;
148 r = PyObject_GetItem(o, j);
149 Py_DECREF(j);
150 }
151 return r;
152 }
154 static int __Pyx_SetItemInt(PyObject *o, Py_ssize_t i, PyObject *v) {
155 PyTypeObject *t = o->ob_type;
156 int r;
157 if (t->tp_as_sequence && t->tp_as_sequence->sq_item)
158 r = PySequence_SetItem(o, i, v);
159 else {
160 PyObject *j = PyInt_FromLong(i);
161 if (!j)
162 return -1;
163 r = PyObject_SetItem(o, j, v);
164 Py_DECREF(j);
165 }
166 return r;
167 }
169 static int __Pyx_InitStrings(__Pyx_StringTabEntry *t) {
170 while (t->p) {
171 *t->p = PyString_FromStringAndSize(t->s, t->n - 1);
172 if (!*t->p)
173 return -1;
174 if (t->i)
175 PyString_InternInPlace(t->p);
176 ++t;
177 }
178 return 0;
179 }
181 #include "compile.h"
182 #include "frameobject.h"
183 #include "traceback.h"
185 static void __Pyx_AddTraceback(char *funcname) {
186 PyObject *py_srcfile = 0;
187 PyObject *py_funcname = 0;
188 PyObject *py_globals = 0;
189 PyObject *empty_tuple = 0;
190 PyObject *empty_string = 0;
191 PyCodeObject *py_code = 0;
192 PyFrameObject *py_frame = 0;
194 py_srcfile = PyString_FromString(__pyx_filename);
195 if (!py_srcfile) goto bad;
196 py_funcname = PyString_FromString(funcname);
197 if (!py_funcname) goto bad;
198 py_globals = PyModule_GetDict(__pyx_m);
199 if (!py_globals) goto bad;
200 empty_tuple = PyTuple_New(0);
201 if (!empty_tuple) goto bad;
202 empty_string = PyString_FromString("");
203 if (!empty_string) goto bad;
204 py_code = PyCode_New(
205 0, /*int argcount,*/
206 0, /*int nlocals,*/
207 0, /*int stacksize,*/
208 0, /*int flags,*/
209 empty_string, /*PyObject *code,*/
210 empty_tuple, /*PyObject *consts,*/
211 empty_tuple, /*PyObject *names,*/
212 empty_tuple, /*PyObject *varnames,*/
213 empty_tuple, /*PyObject *freevars,*/
214 empty_tuple, /*PyObject *cellvars,*/
215 py_srcfile, /*PyObject *filename,*/
216 py_funcname, /*PyObject *name,*/
217 __pyx_lineno, /*int firstlineno,*/
218 empty_string /*PyObject *lnotab*/
219 );
220 if (!py_code) goto bad;
221 py_frame = PyFrame_New(
222 PyThreadState_Get(), /*PyThreadState *tstate,*/
223 py_code, /*PyCodeObject *code,*/
224 py_globals, /*PyObject *globals,*/
225 0 /*PyObject *locals*/
226 );
227 if (!py_frame) goto bad;
228 py_frame->f_lineno = __pyx_lineno;
229 PyTraceBack_Here(py_frame);
230 bad:
231 Py_XDECREF(py_srcfile);
232 Py_XDECREF(py_funcname);
233 Py_XDECREF(empty_tuple);
234 Py_XDECREF(empty_string);
235 Py_XDECREF(py_code);
236 Py_XDECREF(py_frame);
237 }