Cython has moved to github.

pyrex

view Tests/Runnable2/l_cfuncexport.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 int __Pyx_ExportFunction(char *n, void *f, char *s); /*proto*/
44 static void __Pyx_AddTraceback(char *funcname); /*proto*/
46 /* Declarations from l_cfuncexport */
48 static int __pyx_f_13l_cfuncexport_f(int); /*proto*/
49 static int __pyx_f_13l_cfuncexport_g(int); /*proto*/
51 /* Declarations from implementation of l_cfuncexport */
57 static __Pyx_StringTabEntry __pyx_string_tab[] = {
58 {0, 0, 0, 0}
59 };
63 /* Implementation of l_cfuncexport */
65 static int __pyx_f_13l_cfuncexport_f(int __pyx_v_x) {
66 int __pyx_r;
67 __pyx_r = (__pyx_v_x * __pyx_v_x);
68 goto __pyx_L0;
70 __pyx_r = 0;
71 __pyx_L0:;
72 return __pyx_r;
73 }
75 static int __pyx_f_13l_cfuncexport_g(int __pyx_v_x) {
76 int __pyx_r;
77 __pyx_r = (5 * __pyx_v_x);
78 goto __pyx_L0;
80 __pyx_r = 0;
81 __pyx_L0:;
82 return __pyx_r;
83 }
85 static struct PyMethodDef __pyx_methods[] = {
86 {0, 0, 0, 0}
87 };
89 static void __pyx_init_filenames(void); /*proto*/
91 PyMODINIT_FUNC initl_cfuncexport(void); /*proto*/
92 PyMODINIT_FUNC initl_cfuncexport(void) {
93 PyObject *__pyx_1 = 0;
94 __pyx_init_filenames();
95 __pyx_m = Py_InitModule4("l_cfuncexport", __pyx_methods, 0, 0, PYTHON_API_VERSION);
96 if (!__pyx_m) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; goto __pyx_L1;};
97 Py_INCREF(__pyx_m);
98 __pyx_b = PyImport_AddModule("__builtin__");
99 if (!__pyx_b) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; goto __pyx_L1;};
100 if (PyObject_SetAttrString(__pyx_m, "__builtins__", __pyx_b) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; goto __pyx_L1;};
101 if (__Pyx_InitStrings(__pyx_string_tab) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; goto __pyx_L1;};
102 if (__Pyx_ExportFunction("f", (void*)__pyx_f_13l_cfuncexport_f, "int (int)") < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; goto __pyx_L1;}
103 if (__Pyx_ExportFunction("g", (void*)__pyx_f_13l_cfuncexport_g, "int (int)") < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; goto __pyx_L1;}
105 /* "/Local/Projects/D/Pyrex/Source/Tests/Runnable2/l_cfuncexport.pyx":4 */
106 return;
107 __pyx_L1:;
108 Py_XDECREF(__pyx_1);
109 __Pyx_AddTraceback("l_cfuncexport");
110 }
112 static char *__pyx_filenames[] = {
113 "l_cfuncexport.pyx",
114 };
116 /* Runtime support code */
118 static void __pyx_init_filenames(void) {
119 __pyx_f = __pyx_filenames;
120 }
122 static int __Pyx_InitStrings(__Pyx_StringTabEntry *t) {
123 while (t->p) {
124 *t->p = PyString_FromStringAndSize(t->s, t->n - 1);
125 if (!*t->p)
126 return -1;
127 if (t->i)
128 PyString_InternInPlace(t->p);
129 ++t;
130 }
131 return 0;
132 }
134 static int __Pyx_ExportFunction(char *n, void *f, char *s) {
135 PyObject *d = 0;
136 PyObject *p = 0;
137 d = PyObject_GetAttrString(__pyx_m, "__pyx_capi__");
138 if (!d) {
139 PyErr_Clear();
140 d = PyDict_New();
141 if (!d)
142 goto bad;
143 Py_INCREF(d);
144 if (PyModule_AddObject(__pyx_m, "__pyx_capi__", d) < 0)
145 goto bad;
146 }
147 p = PyCObject_FromVoidPtrAndDesc(f, s, 0);
148 if (!p)
149 goto bad;
150 if (PyDict_SetItemString(d, n, p) < 0)
151 goto bad;
152 Py_DECREF(d);
153 return 0;
154 bad:
155 Py_XDECREF(p);
156 Py_XDECREF(d);
157 return -1;
158 }
160 #include "compile.h"
161 #include "frameobject.h"
162 #include "traceback.h"
164 static void __Pyx_AddTraceback(char *funcname) {
165 PyObject *py_srcfile = 0;
166 PyObject *py_funcname = 0;
167 PyObject *py_globals = 0;
168 PyObject *empty_tuple = 0;
169 PyObject *empty_string = 0;
170 PyCodeObject *py_code = 0;
171 PyFrameObject *py_frame = 0;
173 py_srcfile = PyString_FromString(__pyx_filename);
174 if (!py_srcfile) goto bad;
175 py_funcname = PyString_FromString(funcname);
176 if (!py_funcname) goto bad;
177 py_globals = PyModule_GetDict(__pyx_m);
178 if (!py_globals) goto bad;
179 empty_tuple = PyTuple_New(0);
180 if (!empty_tuple) goto bad;
181 empty_string = PyString_FromString("");
182 if (!empty_string) goto bad;
183 py_code = PyCode_New(
184 0, /*int argcount,*/
185 0, /*int nlocals,*/
186 0, /*int stacksize,*/
187 0, /*int flags,*/
188 empty_string, /*PyObject *code,*/
189 empty_tuple, /*PyObject *consts,*/
190 empty_tuple, /*PyObject *names,*/
191 empty_tuple, /*PyObject *varnames,*/
192 empty_tuple, /*PyObject *freevars,*/
193 empty_tuple, /*PyObject *cellvars,*/
194 py_srcfile, /*PyObject *filename,*/
195 py_funcname, /*PyObject *name,*/
196 __pyx_lineno, /*int firstlineno,*/
197 empty_string /*PyObject *lnotab*/
198 );
199 if (!py_code) goto bad;
200 py_frame = PyFrame_New(
201 PyThreadState_Get(), /*PyThreadState *tstate,*/
202 py_code, /*PyCodeObject *code,*/
203 py_globals, /*PyObject *globals,*/
204 0 /*PyObject *locals*/
205 );
206 if (!py_frame) goto bad;
207 py_frame->f_lineno = __pyx_lineno;
208 PyTraceBack_Here(py_frame);
209 bad:
210 Py_XDECREF(py_srcfile);
211 Py_XDECREF(py_funcname);
212 Py_XDECREF(empty_tuple);
213 Py_XDECREF(empty_string);
214 Py_XDECREF(py_code);
215 Py_XDECREF(py_frame);
216 }