Cython has moved to github.
pyrex
view Tests/8/Reference/pkg.cimport.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 PyTypeObject *__Pyx_ImportType(char *module_name, char *class_name, long size); /*proto*/
43 static PyObject *__Pyx_ImportModule(char *name); /*proto*/
45 static void __Pyx_AddTraceback(char *funcname); /*proto*/
47 /* Declarations from spam */
49 struct __pyx_t_4spam_Spam {
50 int i;
51 char *s;
52 };
54 __PYX_EXTERN_C float tons;
55 __PYX_EXTERN_C DL_EXPORT(void) eat(struct __pyx_t_4spam_Spam); /*proto*/
57 /* Declarations from pkg.eggs */
59 struct __pyx_obj_3pkg_4eggs_Eggs {
60 PyObject_HEAD
61 };
64 static PyTypeObject *__pyx_ptype_3pkg_4eggs_Eggs = 0;
66 /* Declarations from pkg.cimport */
68 __PYX_EXTERN_C struct __pyx_t_4spam_Spam yummy;
69 static struct __pyx_obj_3pkg_4eggs_Eggs *__pyx_v_3pkg_7cimport_fried;
72 static __Pyx_StringTabEntry __pyx_string_tab[] = {
73 {0, 0, 0, 0}
74 };
76 /* Implementation of pkg.cimport */
78 static struct PyMethodDef __pyx_methods[] = {
79 {0, 0, 0, 0}
80 };
82 static void __pyx_init_filenames(void); /*proto*/
84 PyMODINIT_FUNC initcimport(void); /*proto*/
85 PyMODINIT_FUNC initcimport(void) {
86 __pyx_init_filenames();
87 __pyx_m = Py_InitModule4("cimport", __pyx_methods, 0, 0, PYTHON_API_VERSION);
88 if (!__pyx_m) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; goto __pyx_L1;};
89 Py_INCREF(__pyx_m);
90 __pyx_b = PyImport_AddModule("__builtin__");
91 if (!__pyx_b) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; goto __pyx_L1;};
92 if (PyObject_SetAttrString(__pyx_m, "__builtins__", __pyx_b) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; goto __pyx_L1;};
93 if (__Pyx_InitStrings(__pyx_string_tab) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; goto __pyx_L1;};
94 __pyx_v_3pkg_7cimport_fried = ((struct __pyx_obj_3pkg_4eggs_Eggs *)Py_None); Py_INCREF(Py_None);
95 __pyx_ptype_3pkg_4eggs_Eggs = __Pyx_ImportType("pkg.eggs", "Eggs", sizeof(struct __pyx_obj_3pkg_4eggs_Eggs)); if (!__pyx_ptype_3pkg_4eggs_Eggs) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 1; goto __pyx_L1;}
97 /* "/Local/Projects/D/Pyrex/Source/Tests/8/pkg.cimport.pyx":6 */
98 Py_INCREF(Py_None);
99 Py_DECREF(((PyObject *)__pyx_v_3pkg_7cimport_fried));
100 __pyx_v_3pkg_7cimport_fried = ((struct __pyx_obj_3pkg_4eggs_Eggs *)Py_None);
101 return;
102 __pyx_L1:;
103 __Pyx_AddTraceback("pkg.cimport");
104 }
106 static char *__pyx_filenames[] = {
107 "pkg.cimport.pyx",
108 "pkg.eggs.pxd",
109 };
111 /* Runtime support code */
113 static void __pyx_init_filenames(void) {
114 __pyx_f = __pyx_filenames;
115 }
117 #ifndef __PYX_HAVE_RT_ImportType
118 #define __PYX_HAVE_RT_ImportType
119 static PyTypeObject *__Pyx_ImportType(char *module_name, char *class_name,
120 long size)
121 {
122 PyObject *py_module = 0;
123 PyObject *result = 0;
125 py_module = __Pyx_ImportModule(module_name);
126 if (!py_module)
127 goto bad;
128 result = PyObject_GetAttrString(py_module, class_name);
129 if (!result)
130 goto bad;
131 if (!PyType_Check(result)) {
132 PyErr_Format(PyExc_TypeError,
133 "%s.%s is not a type object",
134 module_name, class_name);
135 goto bad;
136 }
137 if (((PyTypeObject *)result)->tp_basicsize != size) {
138 PyErr_Format(PyExc_ValueError,
139 "%s.%s does not appear to be the correct type object",
140 module_name, class_name);
141 goto bad;
142 }
143 return (PyTypeObject *)result;
144 bad:
145 Py_XDECREF(result);
146 return 0;
147 }
148 #endif
150 #ifndef __PYX_HAVE_RT_ImportModule
151 #define __PYX_HAVE_RT_ImportModule
152 static PyObject *__Pyx_ImportModule(char *name) {
153 PyObject *py_name = 0;
155 py_name = PyString_FromString(name);
156 if (!py_name)
157 goto bad;
158 return PyImport_Import(py_name);
159 bad:
160 Py_XDECREF(py_name);
161 return 0;
162 }
163 #endif
165 #include "compile.h"
166 #include "frameobject.h"
167 #include "traceback.h"
169 static void __Pyx_AddTraceback(char *funcname) {
170 PyObject *py_srcfile = 0;
171 PyObject *py_funcname = 0;
172 PyObject *py_globals = 0;
173 PyObject *empty_tuple = 0;
174 PyObject *empty_string = 0;
175 PyCodeObject *py_code = 0;
176 PyFrameObject *py_frame = 0;
178 py_srcfile = PyString_FromString(__pyx_filename);
179 if (!py_srcfile) goto bad;
180 py_funcname = PyString_FromString(funcname);
181 if (!py_funcname) goto bad;
182 py_globals = PyModule_GetDict(__pyx_m);
183 if (!py_globals) goto bad;
184 empty_tuple = PyTuple_New(0);
185 if (!empty_tuple) goto bad;
186 empty_string = PyString_FromString("");
187 if (!empty_string) goto bad;
188 py_code = PyCode_New(
189 0, /*int argcount,*/
190 0, /*int nlocals,*/
191 0, /*int stacksize,*/
192 0, /*int flags,*/
193 empty_string, /*PyObject *code,*/
194 empty_tuple, /*PyObject *consts,*/
195 empty_tuple, /*PyObject *names,*/
196 empty_tuple, /*PyObject *varnames,*/
197 empty_tuple, /*PyObject *freevars,*/
198 empty_tuple, /*PyObject *cellvars,*/
199 py_srcfile, /*PyObject *filename,*/
200 py_funcname, /*PyObject *name,*/
201 __pyx_lineno, /*int firstlineno,*/
202 empty_string /*PyObject *lnotab*/
203 );
204 if (!py_code) goto bad;
205 py_frame = PyFrame_New(
206 PyThreadState_Get(), /*PyThreadState *tstate,*/
207 py_code, /*PyCodeObject *code,*/
208 py_globals, /*PyObject *globals,*/
209 0 /*PyObject *locals*/
210 );
211 if (!py_frame) goto bad;
212 py_frame->f_lineno = __pyx_lineno;
213 PyTraceBack_Here(py_frame);
214 bad:
215 Py_XDECREF(py_srcfile);
216 Py_XDECREF(py_funcname);
217 Py_XDECREF(empty_tuple);
218 Py_XDECREF(empty_string);
219 Py_XDECREF(py_code);
220 Py_XDECREF(py_frame);
221 }
