Cython has moved to github.

pyrex

view Tests/10/builtinlist.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 builtinlist */
47 /* Declarations from implementation of builtinlist */
49 static int __pyx_f_11builtinlist_f(void); /*proto*/
51 static char __pyx_k1[] = "insert";
53 static PyObject *__pyx_n_insert;
56 static __Pyx_StringTabEntry __pyx_string_tab[] = {
57 {&__pyx_n_insert, 1, __pyx_k1, sizeof(__pyx_k1)},
58 {0, 0, 0, 0}
59 };
63 /* Implementation of builtinlist */
65 static int __pyx_f_11builtinlist_f(void) {
66 PyListObject *__pyx_v_l;
67 PyObject *__pyx_v_x;
68 PyObject *__pyx_v_y;
69 PyObject *__pyx_v_z;
70 int __pyx_r;
71 PyObject *__pyx_1 = 0;
72 PyObject *__pyx_2 = 0;
73 int __pyx_3;
74 __pyx_v_l = ((PyListObject *)Py_None); Py_INCREF(Py_None);
75 __pyx_v_x = Py_None; Py_INCREF(Py_None);
76 __pyx_v_y = Py_None; Py_INCREF(Py_None);
77 __pyx_v_z = Py_None; Py_INCREF(Py_None);
79 /* "/Local/Projects/D/Pyrex/Source/Tests/10/builtinlist.pyx":4 */
80 Py_INCREF(((PyObject *)(&PyList_Type)));
81 Py_DECREF(__pyx_v_z);
82 __pyx_v_z = ((PyObject *)(&PyList_Type));
84 /* "/Local/Projects/D/Pyrex/Source/Tests/10/builtinlist.pyx":5 */
85 __pyx_1 = PyTuple_New(1); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 5; goto __pyx_L1;}
86 Py_INCREF(__pyx_v_x);
87 PyTuple_SET_ITEM(__pyx_1, 0, __pyx_v_x);
88 __pyx_2 = PyObject_CallObject(((PyObject *)(&PyList_Type)), __pyx_1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 5; goto __pyx_L1;}
89 Py_DECREF(__pyx_1); __pyx_1 = 0;
90 Py_DECREF(((PyObject *)__pyx_v_l));
91 __pyx_v_l = ((PyListObject *)__pyx_2);
92 __pyx_2 = 0;
94 /* "/Local/Projects/D/Pyrex/Source/Tests/10/builtinlist.pyx":6 */
95 __pyx_1 = PySequence_Tuple(__pyx_v_y); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 6; goto __pyx_L1;}
96 __pyx_2 = PyObject_CallObject(((PyObject *)(&PyList_Type)), __pyx_1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 6; goto __pyx_L1;}
97 Py_DECREF(__pyx_1); __pyx_1 = 0;
98 Py_DECREF(((PyObject *)__pyx_v_l));
99 __pyx_v_l = ((PyListObject *)__pyx_2);
100 __pyx_2 = 0;
102 /* "/Local/Projects/D/Pyrex/Source/Tests/10/builtinlist.pyx":7 */
103 __pyx_1 = PyObject_GetAttr(((PyObject *)__pyx_v_l), __pyx_n_insert); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 7; goto __pyx_L1;}
104 Py_DECREF(__pyx_v_z);
105 __pyx_v_z = __pyx_1;
106 __pyx_1 = 0;
108 /* "/Local/Projects/D/Pyrex/Source/Tests/10/builtinlist.pyx":8 */
109 __pyx_2 = PyInt_FromLong(42); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 8; goto __pyx_L1;}
110 __pyx_3 = PyList_Insert(((PyObject *)__pyx_v_l),17,__pyx_2); if (__pyx_3 == -1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 8; goto __pyx_L1;}
111 Py_DECREF(__pyx_2); __pyx_2 = 0;
113 /* "/Local/Projects/D/Pyrex/Source/Tests/10/builtinlist.pyx":9 */
114 __pyx_1 = PyInt_FromLong(88); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 9; goto __pyx_L1;}
115 __pyx_3 = PyList_Append(((PyObject *)__pyx_v_l),__pyx_1); if (__pyx_3 == -1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 9; goto __pyx_L1;}
116 Py_DECREF(__pyx_1); __pyx_1 = 0;
118 /* "/Local/Projects/D/Pyrex/Source/Tests/10/builtinlist.pyx":10 */
119 __pyx_3 = PyList_Sort(((PyObject *)__pyx_v_l)); if (__pyx_3 == -1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 10; goto __pyx_L1;}
121 /* "/Local/Projects/D/Pyrex/Source/Tests/10/builtinlist.pyx":11 */
122 __pyx_3 = PyList_Reverse(((PyObject *)__pyx_v_l)); if (__pyx_3 == -1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 11; goto __pyx_L1;}
124 /* "/Local/Projects/D/Pyrex/Source/Tests/10/builtinlist.pyx":12 */
125 __pyx_2 = PyList_AsTuple(((PyObject *)__pyx_v_l)); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 12; goto __pyx_L1;}
126 Py_DECREF(__pyx_v_z);
127 __pyx_v_z = __pyx_2;
128 __pyx_2 = 0;
130 __pyx_r = 0;
131 goto __pyx_L0;
132 __pyx_L1:;
133 Py_XDECREF(__pyx_1);
134 Py_XDECREF(__pyx_2);
135 __Pyx_AddTraceback("builtinlist.f");
136 __pyx_r = (-1);
137 __pyx_L0:;
138 Py_DECREF(__pyx_v_l);
139 Py_DECREF(__pyx_v_x);
140 Py_DECREF(__pyx_v_y);
141 Py_DECREF(__pyx_v_z);
142 return __pyx_r;
143 }
145 static struct PyMethodDef __pyx_methods[] = {
146 {0, 0, 0, 0}
147 };
149 static void __pyx_init_filenames(void); /*proto*/
151 PyMODINIT_FUNC initbuiltinlist(void); /*proto*/
152 PyMODINIT_FUNC initbuiltinlist(void) {
153 __pyx_init_filenames();
154 __pyx_m = Py_InitModule4("builtinlist", __pyx_methods, 0, 0, PYTHON_API_VERSION);
155 if (!__pyx_m) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; goto __pyx_L1;};
156 Py_INCREF(__pyx_m);
157 __pyx_b = PyImport_AddModule("__builtin__");
158 if (!__pyx_b) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; goto __pyx_L1;};
159 if (PyObject_SetAttrString(__pyx_m, "__builtins__", __pyx_b) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; goto __pyx_L1;};
160 if (__Pyx_InitStrings(__pyx_string_tab) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; goto __pyx_L1;};
161 return;
162 __pyx_L1:;
163 __Pyx_AddTraceback("builtinlist");
164 }
166 static char *__pyx_filenames[] = {
167 "builtinlist.pyx",
168 };
170 /* Runtime support code */
172 static void __pyx_init_filenames(void) {
173 __pyx_f = __pyx_filenames;
174 }
176 static int __Pyx_InitStrings(__Pyx_StringTabEntry *t) {
177 while (t->p) {
178 *t->p = PyString_FromStringAndSize(t->s, t->n - 1);
179 if (!*t->p)
180 return -1;
181 if (t->i)
182 PyString_InternInPlace(t->p);
183 ++t;
184 }
185 return 0;
186 }
188 #include "compile.h"
189 #include "frameobject.h"
190 #include "traceback.h"
192 static void __Pyx_AddTraceback(char *funcname) {
193 PyObject *py_srcfile = 0;
194 PyObject *py_funcname = 0;
195 PyObject *py_globals = 0;
196 PyObject *empty_tuple = 0;
197 PyObject *empty_string = 0;
198 PyCodeObject *py_code = 0;
199 PyFrameObject *py_frame = 0;
201 py_srcfile = PyString_FromString(__pyx_filename);
202 if (!py_srcfile) goto bad;
203 py_funcname = PyString_FromString(funcname);
204 if (!py_funcname) goto bad;
205 py_globals = PyModule_GetDict(__pyx_m);
206 if (!py_globals) goto bad;
207 empty_tuple = PyTuple_New(0);
208 if (!empty_tuple) goto bad;
209 empty_string = PyString_FromString("");
210 if (!empty_string) goto bad;
211 py_code = PyCode_New(
212 0, /*int argcount,*/
213 0, /*int nlocals,*/
214 0, /*int stacksize,*/
215 0, /*int flags,*/
216 empty_string, /*PyObject *code,*/
217 empty_tuple, /*PyObject *consts,*/
218 empty_tuple, /*PyObject *names,*/
219 empty_tuple, /*PyObject *varnames,*/
220 empty_tuple, /*PyObject *freevars,*/
221 empty_tuple, /*PyObject *cellvars,*/
222 py_srcfile, /*PyObject *filename,*/
223 py_funcname, /*PyObject *name,*/
224 __pyx_lineno, /*int firstlineno,*/
225 empty_string /*PyObject *lnotab*/
226 );
227 if (!py_code) goto bad;
228 py_frame = PyFrame_New(
229 PyThreadState_Get(), /*PyThreadState *tstate,*/
230 py_code, /*PyCodeObject *code,*/
231 py_globals, /*PyObject *globals,*/
232 0 /*PyObject *locals*/
233 );
234 if (!py_frame) goto bad;
235 py_frame->f_lineno = __pyx_lineno;
236 PyTraceBack_Here(py_frame);
237 bad:
238 Py_XDECREF(py_srcfile);
239 Py_XDECREF(py_funcname);
240 Py_XDECREF(empty_tuple);
241 Py_XDECREF(empty_string);
242 Py_XDECREF(py_code);
243 Py_XDECREF(py_frame);
244 }