Cython has moved to github.

pyrex

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