Cython has moved to github.
pyrex
view Tests/3/Reference/if.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 void __Pyx_AddTraceback(char *funcname); /*proto*/
43 /* Declarations from if */
47 static __Pyx_StringTabEntry __pyx_string_tab[] = {
48 {0, 0, 0, 0}
49 };
51 /* Implementation of if */
53 static PyObject *__pyx_f_2if_f(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
54 static PyObject *__pyx_f_2if_f(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
55 PyObject *__pyx_v_a = 0;
56 PyObject *__pyx_v_b = 0;
57 PyObject *__pyx_v_x;
58 PyObject *__pyx_r;
59 int __pyx_1;
60 PyObject *__pyx_2 = 0;
61 static char *__pyx_argnames[] = {"a","b",0};
62 if (!PyArg_ParseTupleAndKeywords(__pyx_args, __pyx_kwds, "OO", __pyx_argnames, &__pyx_v_a, &__pyx_v_b)) return 0;
63 Py_INCREF(__pyx_v_a);
64 Py_INCREF(__pyx_v_b);
65 __pyx_v_x = Py_None; Py_INCREF(Py_None);
67 /* "/Local/Projects/D/Pyrex/Source/Tests/3/if.pyx":2 */
68 __pyx_1 = PyObject_IsTrue(__pyx_v_a); if (__pyx_1 < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2; goto __pyx_L1;}
69 if (__pyx_1) {
70 __pyx_2 = PyInt_FromLong(1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3; goto __pyx_L1;}
71 Py_DECREF(__pyx_v_x);
72 __pyx_v_x = __pyx_2;
73 __pyx_2 = 0;
74 goto __pyx_L2;
75 }
76 __pyx_L2:;
78 /* "/Local/Projects/D/Pyrex/Source/Tests/3/if.pyx":5 */
79 __pyx_2 = PyNumber_Add(__pyx_v_a, __pyx_v_b); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 5; goto __pyx_L1;}
80 __pyx_1 = PyObject_IsTrue(__pyx_2); if (__pyx_1 < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 5; goto __pyx_L1;}
81 Py_DECREF(__pyx_2); __pyx_2 = 0;
82 if (__pyx_1) {
83 __pyx_2 = PyInt_FromLong(1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 6; goto __pyx_L1;}
84 Py_DECREF(__pyx_v_x);
85 __pyx_v_x = __pyx_2;
86 __pyx_2 = 0;
87 goto __pyx_L3;
88 }
89 __pyx_L3:;
91 /* "/Local/Projects/D/Pyrex/Source/Tests/3/if.pyx":8 */
92 __pyx_1 = PyObject_IsTrue(__pyx_v_a); if (__pyx_1 < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 8; goto __pyx_L1;}
93 if (__pyx_1) {
94 __pyx_2 = PyInt_FromLong(1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 9; goto __pyx_L1;}
95 Py_DECREF(__pyx_v_x);
96 __pyx_v_x = __pyx_2;
97 __pyx_2 = 0;
98 goto __pyx_L4;
99 }
100 __pyx_1 = PyObject_IsTrue(__pyx_v_b); if (__pyx_1 < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 10; goto __pyx_L1;}
101 if (__pyx_1) {
102 __pyx_2 = PyInt_FromLong(2); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 11; goto __pyx_L1;}
103 Py_DECREF(__pyx_v_x);
104 __pyx_v_x = __pyx_2;
105 __pyx_2 = 0;
106 goto __pyx_L4;
107 }
108 __pyx_L4:;
110 /* "/Local/Projects/D/Pyrex/Source/Tests/3/if.pyx":13 */
111 __pyx_1 = PyObject_IsTrue(__pyx_v_a); if (__pyx_1 < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 13; goto __pyx_L1;}
112 if (__pyx_1) {
113 __pyx_2 = PyInt_FromLong(1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 14; goto __pyx_L1;}
114 Py_DECREF(__pyx_v_x);
115 __pyx_v_x = __pyx_2;
116 __pyx_2 = 0;
117 goto __pyx_L5;
118 }
119 __pyx_1 = PyObject_IsTrue(__pyx_v_b); if (__pyx_1 < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 15; goto __pyx_L1;}
120 if (__pyx_1) {
121 __pyx_2 = PyInt_FromLong(2); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 16; goto __pyx_L1;}
122 Py_DECREF(__pyx_v_x);
123 __pyx_v_x = __pyx_2;
124 __pyx_2 = 0;
125 goto __pyx_L5;
126 }
127 /*else*/ {
128 __pyx_2 = PyInt_FromLong(3); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 18; goto __pyx_L1;}
129 Py_DECREF(__pyx_v_x);
130 __pyx_v_x = __pyx_2;
131 __pyx_2 = 0;
132 }
133 __pyx_L5:;
135 __pyx_r = Py_None; Py_INCREF(Py_None);
136 goto __pyx_L0;
137 __pyx_L1:;
138 Py_XDECREF(__pyx_2);
139 __Pyx_AddTraceback("if.f");
140 __pyx_r = 0;
141 __pyx_L0:;
142 Py_DECREF(__pyx_v_x);
143 Py_DECREF(__pyx_v_a);
144 Py_DECREF(__pyx_v_b);
145 return __pyx_r;
146 }
148 static struct PyMethodDef __pyx_methods[] = {
149 {"f", (PyCFunction)__pyx_f_2if_f, METH_VARARGS|METH_KEYWORDS, 0},
150 {0, 0, 0, 0}
151 };
153 static void __pyx_init_filenames(void); /*proto*/
155 PyMODINIT_FUNC initif(void); /*proto*/
156 PyMODINIT_FUNC initif(void) {
157 __pyx_init_filenames();
158 __pyx_m = Py_InitModule4("if", __pyx_methods, 0, 0, PYTHON_API_VERSION);
159 if (!__pyx_m) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; goto __pyx_L1;};
160 Py_INCREF(__pyx_m);
161 __pyx_b = PyImport_AddModule("__builtin__");
162 if (!__pyx_b) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; goto __pyx_L1;};
163 if (PyObject_SetAttrString(__pyx_m, "__builtins__", __pyx_b) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; goto __pyx_L1;};
164 if (__Pyx_InitStrings(__pyx_string_tab) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; goto __pyx_L1;};
165 return;
166 __pyx_L1:;
167 __Pyx_AddTraceback("if");
168 }
170 static char *__pyx_filenames[] = {
171 "if.pyx",
172 };
174 /* Runtime support code */
176 static void __pyx_init_filenames(void) {
177 __pyx_f = __pyx_filenames;
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 }
