Cython has moved to github.

pyrex

view Tests/3/Reference/import.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 PyObject *__Pyx_Import(PyObject *name, PyObject *from_list); /*proto*/
43 static int __Pyx_InternStrings(__Pyx_InternTabEntry *t); /*proto*/
45 static int __Pyx_InitStrings(__Pyx_StringTabEntry *t); /*proto*/
47 static void __Pyx_AddTraceback(char *funcname); /*proto*/
49 /* Declarations from import */
53 static __Pyx_StringTabEntry __pyx_string_tab[] = {
54 {&__pyx_n_eggs, 1, __pyx_k1, sizeof(__pyx_k1)},
55 {&__pyx_n_ham, 1, __pyx_k2, sizeof(__pyx_k2)},
56 {&__pyx_n_spam, 1, __pyx_k3, sizeof(__pyx_k3)},
57 {&__pyx_k1p, 0, __pyx_k1, sizeof(__pyx_k1)},
58 {0, 0, 0, 0}
59 };
61 /* Implementation of import */
66 static PyObject *__pyx_f_6import_f(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
67 static PyObject *__pyx_f_6import_f(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
68 PyObject *__pyx_v_spam;
69 PyObject *__pyx_v_eggs;
70 PyObject *__pyx_v_ham;
71 PyObject *__pyx_v_tasty;
72 PyObject *__pyx_r;
73 PyObject *__pyx_1 = 0;
74 static char *__pyx_argnames[] = {0};
75 if (!PyArg_ParseTupleAndKeywords(__pyx_args, __pyx_kwds, "", __pyx_argnames)) return 0;
76 __pyx_v_spam = Py_None; Py_INCREF(Py_None);
77 __pyx_v_eggs = Py_None; Py_INCREF(Py_None);
78 __pyx_v_ham = Py_None; Py_INCREF(Py_None);
79 __pyx_v_tasty = Py_None; Py_INCREF(Py_None);
81 /* "/Local/Projects/D/Pyrex/Source/Tests/3/import.pyx":2 */
82 __pyx_1 = __Pyx_Import(__pyx_n_spam, 0); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2; goto __pyx_L1;}
83 Py_DECREF(__pyx_v_spam);
84 __pyx_v_spam = __pyx_1;
85 __pyx_1 = 0;
87 /* "/Local/Projects/D/Pyrex/Source/Tests/3/import.pyx":3 */
88 __pyx_1 = __Pyx_Import(__pyx_k2p, 0); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3; goto __pyx_L1;}
89 Py_DECREF(__pyx_v_spam);
90 __pyx_v_spam = __pyx_1;
91 __pyx_1 = 0;
93 /* "/Local/Projects/D/Pyrex/Source/Tests/3/import.pyx":4 */
94 __pyx_1 = __Pyx_Import(__pyx_n_spam, 0); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4; goto __pyx_L1;}
95 Py_DECREF(__pyx_v_spam);
96 __pyx_v_spam = __pyx_1;
97 __pyx_1 = 0;
99 /* "/Local/Projects/D/Pyrex/Source/Tests/3/import.pyx":4 */
100 __pyx_1 = __Pyx_Import(__pyx_n_eggs, 0); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4; goto __pyx_L1;}
101 Py_DECREF(__pyx_v_eggs);
102 __pyx_v_eggs = __pyx_1;
103 __pyx_1 = 0;
105 /* "/Local/Projects/D/Pyrex/Source/Tests/3/import.pyx":4 */
106 __pyx_1 = __Pyx_Import(__pyx_n_ham, 0); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4; goto __pyx_L1;}
107 Py_DECREF(__pyx_v_ham);
108 __pyx_v_ham = __pyx_1;
109 __pyx_1 = 0;
111 /* "/Local/Projects/D/Pyrex/Source/Tests/3/import.pyx":5 */
112 __pyx_1 = __Pyx_Import(__pyx_n_spam, 0); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 5; goto __pyx_L1;}
113 Py_DECREF(__pyx_v_tasty);
114 __pyx_v_tasty = __pyx_1;
115 __pyx_1 = 0;
117 __pyx_r = Py_None; Py_INCREF(Py_None);
118 goto __pyx_L0;
119 __pyx_L1:;
120 Py_XDECREF(__pyx_1);
121 __Pyx_AddTraceback("import.f");
122 __pyx_r = 0;
123 __pyx_L0:;
124 Py_DECREF(__pyx_v_spam);
125 Py_DECREF(__pyx_v_eggs);
126 Py_DECREF(__pyx_v_ham);
127 Py_DECREF(__pyx_v_tasty);
128 return __pyx_r;
129 }
133 static struct PyMethodDef __pyx_methods[] = {
134 {"f", (PyCFunction)__pyx_f_6import_f, METH_VARARGS|METH_KEYWORDS, 0},
135 {0, 0, 0, 0}
136 };
138 static void __pyx_init_filenames(void); /*proto*/
140 PyMODINIT_FUNC initimport(void); /*proto*/
141 PyMODINIT_FUNC initimport(void) {
142 __pyx_init_filenames();
143 __pyx_m = Py_InitModule4("import", __pyx_methods, 0, 0, PYTHON_API_VERSION);
144 if (!__pyx_m) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; goto __pyx_L1;};
145 Py_INCREF(__pyx_m);
146 __pyx_b = PyImport_AddModule("__builtin__");
147 if (!__pyx_b) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; goto __pyx_L1;};
148 if (PyObject_SetAttrString(__pyx_m, "__builtins__", __pyx_b) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; goto __pyx_L1;};
149 if (__Pyx_InitStrings(__pyx_string_tab) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; goto __pyx_L1;};
150 return;
151 __pyx_L1:;
152 __Pyx_AddTraceback("import");
153 }
155 static char *__pyx_filenames[] = {
156 "import.pyx",
157 };
159 /* Runtime support code */
161 static void __pyx_init_filenames(void) {
162 __pyx_f = __pyx_filenames;
163 }
165 static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list) {
166 PyObject *__import__ = 0;
167 PyObject *empty_list = 0;
168 PyObject *module = 0;
169 PyObject *global_dict = 0;
170 PyObject *empty_dict = 0;
171 PyObject *list;
172 __import__ = PyObject_GetAttrString(__pyx_b, "__import__");
173 if (!__import__)
174 goto bad;
175 if (from_list)
176 list = from_list;
177 else {
178 empty_list = PyList_New(0);
179 if (!empty_list)
180 goto bad;
181 list = empty_list;
182 }
183 global_dict = PyModule_GetDict(__pyx_m);
184 if (!global_dict)
185 goto bad;
186 empty_dict = PyDict_New();
187 if (!empty_dict)
188 goto bad;
189 module = PyObject_CallFunction(__import__, "OOOO",
190 name, global_dict, empty_dict, list);
191 bad:
192 Py_XDECREF(empty_list);
193 Py_XDECREF(__import__);
194 Py_XDECREF(empty_dict);
195 return module;
196 }
198 static int __Pyx_InternStrings(__Pyx_InternTabEntry *t) {
199 while (t->p) {
200 *t->p = PyString_InternFromString(t->s);
201 if (!*t->p)
202 return -1;
203 ++t;
204 }
205 return 0;
206 }
208 static int __Pyx_InitStrings(__Pyx_StringTabEntry *t) {
209 while (t->p) {
210 *t->p = PyString_FromStringAndSize(t->s, t->n - 1);
211 if (!*t->p)
212 return -1;
213 ++t;
214 }
215 return 0;
216 }
218 #include "compile.h"
219 #include "frameobject.h"
220 #include "traceback.h"
222 static void __Pyx_AddTraceback(char *funcname) {
223 PyObject *py_srcfile = 0;
224 PyObject *py_funcname = 0;
225 PyObject *py_globals = 0;
226 PyObject *empty_tuple = 0;
227 PyObject *empty_string = 0;
228 PyCodeObject *py_code = 0;
229 PyFrameObject *py_frame = 0;
231 py_srcfile = PyString_FromString(__pyx_filename);
232 if (!py_srcfile) goto bad;
233 py_funcname = PyString_FromString(funcname);
234 if (!py_funcname) goto bad;
235 py_globals = PyModule_GetDict(__pyx_m);
236 if (!py_globals) goto bad;
237 empty_tuple = PyTuple_New(0);
238 if (!empty_tuple) goto bad;
239 empty_string = PyString_FromString("");
240 if (!empty_string) goto bad;
241 py_code = PyCode_New(
242 0, /*int argcount,*/
243 0, /*int nlocals,*/
244 0, /*int stacksize,*/
245 0, /*int flags,*/
246 empty_string, /*PyObject *code,*/
247 empty_tuple, /*PyObject *consts,*/
248 empty_tuple, /*PyObject *names,*/
249 empty_tuple, /*PyObject *varnames,*/
250 empty_tuple, /*PyObject *freevars,*/
251 empty_tuple, /*PyObject *cellvars,*/
252 py_srcfile, /*PyObject *filename,*/
253 py_funcname, /*PyObject *name,*/
254 __pyx_lineno, /*int firstlineno,*/
255 empty_string /*PyObject *lnotab*/
256 );
257 if (!py_code) goto bad;
258 py_frame = PyFrame_New(
259 PyThreadState_Get(), /*PyThreadState *tstate,*/
260 py_code, /*PyCodeObject *code,*/
261 py_globals, /*PyObject *globals,*/
262 0 /*PyObject *locals*/
263 );
264 if (!py_frame) goto bad;
265 py_frame->f_lineno = __pyx_lineno;
266 PyTraceBack_Here(py_frame);
267 bad:
268 Py_XDECREF(py_srcfile);
269 Py_XDECREF(py_funcname);
270 Py_XDECREF(empty_tuple);
271 Py_XDECREF(empty_string);
272 Py_XDECREF(py_code);
273 Py_XDECREF(py_frame);
274 }