Cython has moved to github.

pyrex

view Tests/2/unop.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 unop */
47 /* Declarations from implementation of unop */
53 static __Pyx_StringTabEntry __pyx_string_tab[] = {
54 {0, 0, 0, 0}
55 };
59 /* Implementation of unop */
61 static PyObject *__pyx_f_4unop_f(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
62 static PyObject *__pyx_f_4unop_f(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
63 PyObject *__pyx_v_obj1 = 0;
64 PyObject *__pyx_v_obj2 = 0;
65 PyObject *__pyx_v_obj3 = 0;
66 int __pyx_v_bool1;
67 int __pyx_v_bool2;
68 int __pyx_v_int1;
69 int __pyx_v_int2;
70 char *__pyx_v_str1;
71 PyObject *__pyx_r;
72 int __pyx_1;
73 PyObject *__pyx_2 = 0;
74 static char *__pyx_argnames[] = {"obj1","obj2","obj3",0};
75 if (!PyArg_ParseTupleAndKeywords(__pyx_args, __pyx_kwds, "OOO", __pyx_argnames, &__pyx_v_obj1, &__pyx_v_obj2, &__pyx_v_obj3)) return 0;
76 Py_INCREF(__pyx_v_obj1);
77 Py_INCREF(__pyx_v_obj2);
78 Py_INCREF(__pyx_v_obj3);
80 /* "/Local/Projects/D/Pyrex/Source/Tests/2/unop.pyx":5 */
81 __pyx_v_bool1 = (!__pyx_v_bool2);
83 /* "/Local/Projects/D/Pyrex/Source/Tests/2/unop.pyx":6 */
84 __pyx_1 = PyObject_IsTrue(__pyx_v_obj2); if (__pyx_1 < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 6; goto __pyx_L1;}
85 __pyx_2 = PyInt_FromLong((!__pyx_1)); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 6; goto __pyx_L1;}
86 Py_DECREF(__pyx_v_obj1);
87 __pyx_v_obj1 = __pyx_2;
88 __pyx_2 = 0;
90 /* "/Local/Projects/D/Pyrex/Source/Tests/2/unop.pyx":7 */
91 __pyx_v_bool1 = (!(__pyx_v_str1 != 0));
93 /* "/Local/Projects/D/Pyrex/Source/Tests/2/unop.pyx":8 */
94 __pyx_v_int1 = __pyx_v_int2;
96 /* "/Local/Projects/D/Pyrex/Source/Tests/2/unop.pyx":9 */
97 __pyx_2 = PyNumber_Positive(__pyx_v_obj2); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 9; goto __pyx_L1;}
98 Py_DECREF(__pyx_v_obj1);
99 __pyx_v_obj1 = __pyx_2;
100 __pyx_2 = 0;
102 /* "/Local/Projects/D/Pyrex/Source/Tests/2/unop.pyx":10 */
103 __pyx_v_int1 = (-__pyx_v_int2);
105 /* "/Local/Projects/D/Pyrex/Source/Tests/2/unop.pyx":11 */
106 __pyx_2 = PyNumber_Negative(__pyx_v_obj2); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 11; goto __pyx_L1;}
107 Py_DECREF(__pyx_v_obj1);
108 __pyx_v_obj1 = __pyx_2;
109 __pyx_2 = 0;
111 /* "/Local/Projects/D/Pyrex/Source/Tests/2/unop.pyx":12 */
112 __pyx_v_int1 = (~__pyx_v_int2);
114 /* "/Local/Projects/D/Pyrex/Source/Tests/2/unop.pyx":13 */
115 __pyx_2 = PyNumber_Invert(__pyx_v_obj2); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 13; goto __pyx_L1;}
116 Py_DECREF(__pyx_v_obj1);
117 __pyx_v_obj1 = __pyx_2;
118 __pyx_2 = 0;
120 __pyx_r = Py_None; Py_INCREF(Py_None);
121 goto __pyx_L0;
122 __pyx_L1:;
123 Py_XDECREF(__pyx_2);
124 __Pyx_AddTraceback("unop.f");
125 __pyx_r = 0;
126 __pyx_L0:;
127 Py_DECREF(__pyx_v_obj1);
128 Py_DECREF(__pyx_v_obj2);
129 Py_DECREF(__pyx_v_obj3);
130 return __pyx_r;
131 }
133 static struct PyMethodDef __pyx_methods[] = {
134 {"f", (PyCFunction)__pyx_f_4unop_f, METH_VARARGS|METH_KEYWORDS, 0},
135 {0, 0, 0, 0}
136 };
138 static void __pyx_init_filenames(void); /*proto*/
140 PyMODINIT_FUNC initunop(void); /*proto*/
141 PyMODINIT_FUNC initunop(void) {
142 __pyx_init_filenames();
143 __pyx_m = Py_InitModule4("unop", __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("unop");
153 }
155 static char *__pyx_filenames[] = {
156 "unop.pyx",
157 };
159 /* Runtime support code */
161 static void __pyx_init_filenames(void) {
162 __pyx_f = __pyx_filenames;
163 }
165 static int __Pyx_InitStrings(__Pyx_StringTabEntry *t) {
166 while (t->p) {
167 *t->p = PyString_FromStringAndSize(t->s, t->n - 1);
168 if (!*t->p)
169 return -1;
170 if (t->i)
171 PyString_InternInPlace(t->p);
172 ++t;
173 }
174 return 0;
175 }
177 #include "compile.h"
178 #include "frameobject.h"
179 #include "traceback.h"
181 static void __Pyx_AddTraceback(char *funcname) {
182 PyObject *py_srcfile = 0;
183 PyObject *py_funcname = 0;
184 PyObject *py_globals = 0;
185 PyObject *empty_tuple = 0;
186 PyObject *empty_string = 0;
187 PyCodeObject *py_code = 0;
188 PyFrameObject *py_frame = 0;
190 py_srcfile = PyString_FromString(__pyx_filename);
191 if (!py_srcfile) goto bad;
192 py_funcname = PyString_FromString(funcname);
193 if (!py_funcname) goto bad;
194 py_globals = PyModule_GetDict(__pyx_m);
195 if (!py_globals) goto bad;
196 empty_tuple = PyTuple_New(0);
197 if (!empty_tuple) goto bad;
198 empty_string = PyString_FromString("");
199 if (!empty_string) goto bad;
200 py_code = PyCode_New(
201 0, /*int argcount,*/
202 0, /*int nlocals,*/
203 0, /*int stacksize,*/
204 0, /*int flags,*/
205 empty_string, /*PyObject *code,*/
206 empty_tuple, /*PyObject *consts,*/
207 empty_tuple, /*PyObject *names,*/
208 empty_tuple, /*PyObject *varnames,*/
209 empty_tuple, /*PyObject *freevars,*/
210 empty_tuple, /*PyObject *cellvars,*/
211 py_srcfile, /*PyObject *filename,*/
212 py_funcname, /*PyObject *name,*/
213 __pyx_lineno, /*int firstlineno,*/
214 empty_string /*PyObject *lnotab*/
215 );
216 if (!py_code) goto bad;
217 py_frame = PyFrame_New(
218 PyThreadState_Get(), /*PyThreadState *tstate,*/
219 py_code, /*PyCodeObject *code,*/
220 py_globals, /*PyObject *globals,*/
221 0 /*PyObject *locals*/
222 );
223 if (!py_frame) goto bad;
224 py_frame->f_lineno = __pyx_lineno;
225 PyTraceBack_Here(py_frame);
226 bad:
227 Py_XDECREF(py_srcfile);
228 Py_XDECREF(py_funcname);
229 Py_XDECREF(empty_tuple);
230 Py_XDECREF(empty_string);
231 Py_XDECREF(py_code);
232 Py_XDECREF(py_frame);
233 }