Cython has moved to github.

pyrex

view Tests/Bugs/devan/Reference/devan1.c @ 104:955ec491fcfc

Fix hex compile-time constants
author Gregory Ewing <greg.ewing@canterbury.ac.nz>
date Wed Aug 27 19:05:46 2008 +1200 (3 years ago)
parents
children 3b20cb4923eb
line source
1 /* Generated by Pyrex 0.9.8.4 on Wed Aug 27 19:03:43 2008 */
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 #if !defined(WIN32) && !defined(MS_WINDOWS)
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_PrintItem(PyObject *); /*proto*/
41 static int __Pyx_PrintNewline(void); /*proto*/
43 static int __Pyx_InitStrings(__Pyx_StringTabEntry *t); /*proto*/
45 static void __Pyx_AddTraceback(char *funcname); /*proto*/
47 /* Declarations from devan1 */
50 /* Declarations from implementation of devan1 */
56 static __Pyx_StringTabEntry __pyx_string_tab[] = {
57 {0, 0, 0, 0}
58 };
62 /* Implementation of devan1 */
64 static PyObject *__pyx_f_6devan1_print_constants(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
65 static PyObject *__pyx_f_6devan1_print_constants(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
66 PyObject *__pyx_r;
67 PyObject *__pyx_1 = 0;
68 static char *__pyx_argnames[] = {0};
69 if (!PyArg_ParseTupleAndKeywords(__pyx_args, __pyx_kwds, "", __pyx_argnames)) return 0;
71 /* "/Local/Projects/D/Pyrex/Source/Tests/Bugs/devan/devan1.pyx":6 */
72 __pyx_1 = PyInt_FromLong(2); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 6; goto __pyx_L1;}
73 if (__Pyx_PrintItem(__pyx_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 6; goto __pyx_L1;}
74 Py_DECREF(__pyx_1); __pyx_1 = 0;
75 if (__Pyx_PrintNewline() < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 6; goto __pyx_L1;}
77 /* "/Local/Projects/D/Pyrex/Source/Tests/Bugs/devan/devan1.pyx":7 */
78 __pyx_1 = PyInt_FromLong(16); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 7; goto __pyx_L1;}
79 if (__Pyx_PrintItem(__pyx_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 7; goto __pyx_L1;}
80 Py_DECREF(__pyx_1); __pyx_1 = 0;
81 if (__Pyx_PrintNewline() < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 7; goto __pyx_L1;}
83 /* "/Local/Projects/D/Pyrex/Source/Tests/Bugs/devan/devan1.pyx":8 */
84 __pyx_1 = PyInt_FromLong(32); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 8; goto __pyx_L1;}
85 if (__Pyx_PrintItem(__pyx_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 8; goto __pyx_L1;}
86 Py_DECREF(__pyx_1); __pyx_1 = 0;
87 if (__Pyx_PrintNewline() < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 8; goto __pyx_L1;}
89 __pyx_r = Py_None; Py_INCREF(Py_None);
90 goto __pyx_L0;
91 __pyx_L1:;
92 Py_XDECREF(__pyx_1);
93 __Pyx_AddTraceback("devan1.print_constants");
94 __pyx_r = 0;
95 __pyx_L0:;
96 return __pyx_r;
97 }
99 static struct PyMethodDef __pyx_methods[] = {
100 {"print_constants", (PyCFunction)__pyx_f_6devan1_print_constants, METH_VARARGS|METH_KEYWORDS, 0},
101 {0, 0, 0, 0}
102 };
104 static void __pyx_init_filenames(void); /*proto*/
106 PyMODINIT_FUNC initdevan1(void); /*proto*/
107 PyMODINIT_FUNC initdevan1(void) {
108 __pyx_init_filenames();
109 __pyx_m = Py_InitModule4("devan1", __pyx_methods, 0, 0, PYTHON_API_VERSION);
110 if (!__pyx_m) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; goto __pyx_L1;};
111 Py_INCREF(__pyx_m);
112 __pyx_b = PyImport_AddModule("__builtin__");
113 if (!__pyx_b) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; goto __pyx_L1;};
114 if (PyObject_SetAttrString(__pyx_m, "__builtins__", __pyx_b) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; goto __pyx_L1;};
115 if (__Pyx_InitStrings(__pyx_string_tab) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; goto __pyx_L1;};
117 /* "/Local/Projects/D/Pyrex/Source/Tests/Bugs/devan/devan1.pyx":5 */
118 return;
119 __pyx_L1:;
120 __Pyx_AddTraceback("devan1");
121 }
123 static char *__pyx_filenames[] = {
124 "devan1.pyx",
125 };
127 /* Runtime support code */
129 static void __pyx_init_filenames(void) {
130 __pyx_f = __pyx_filenames;
131 }
133 static PyObject *__Pyx_GetStdout(void) {
134 PyObject *f = PySys_GetObject("stdout");
135 if (!f) {
136 PyErr_SetString(PyExc_RuntimeError, "lost sys.stdout");
137 }
138 return f;
139 }
141 static int __Pyx_PrintItem(PyObject *v) {
142 PyObject *f;
144 if (!(f = __Pyx_GetStdout()))
145 return -1;
146 if (PyFile_SoftSpace(f, 1)) {
147 if (PyFile_WriteString(" ", f) < 0)
148 return -1;
149 }
150 if (PyFile_WriteObject(v, f, Py_PRINT_RAW) < 0)
151 return -1;
152 if (PyString_Check(v)) {
153 char *s = PyString_AsString(v);
154 Py_ssize_t len = PyString_Size(v);
155 if (len > 0 &&
156 isspace(Py_CHARMASK(s[len-1])) &&
157 s[len-1] != ' ')
158 PyFile_SoftSpace(f, 0);
159 }
160 return 0;
161 }
163 static int __Pyx_PrintNewline(void) {
164 PyObject *f;
166 if (!(f = __Pyx_GetStdout()))
167 return -1;
168 if (PyFile_WriteString("\n", f) < 0)
169 return -1;
170 PyFile_SoftSpace(f, 0);
171 return 0;
172 }
174 static int __Pyx_InitStrings(__Pyx_StringTabEntry *t) {
175 while (t->p) {
176 *t->p = PyString_FromStringAndSize(t->s, t->n - 1);
177 if (!*t->p)
178 return -1;
179 if (t->i)
180 PyString_InternInPlace(t->p);
181 ++t;
182 }
183 return 0;
184 }
186 #include "compile.h"
187 #include "frameobject.h"
188 #include "traceback.h"
190 static void __Pyx_AddTraceback(char *funcname) {
191 PyObject *py_srcfile = 0;
192 PyObject *py_funcname = 0;
193 PyObject *py_globals = 0;
194 PyObject *empty_tuple = 0;
195 PyObject *empty_string = 0;
196 PyCodeObject *py_code = 0;
197 PyFrameObject *py_frame = 0;
199 py_srcfile = PyString_FromString(__pyx_filename);
200 if (!py_srcfile) goto bad;
201 py_funcname = PyString_FromString(funcname);
202 if (!py_funcname) goto bad;
203 py_globals = PyModule_GetDict(__pyx_m);
204 if (!py_globals) goto bad;
205 empty_tuple = PyTuple_New(0);
206 if (!empty_tuple) goto bad;
207 empty_string = PyString_FromString("");
208 if (!empty_string) goto bad;
209 py_code = PyCode_New(
210 0, /*int argcount,*/
211 0, /*int nlocals,*/
212 0, /*int stacksize,*/
213 0, /*int flags,*/
214 empty_string, /*PyObject *code,*/
215 empty_tuple, /*PyObject *consts,*/
216 empty_tuple, /*PyObject *names,*/
217 empty_tuple, /*PyObject *varnames,*/
218 empty_tuple, /*PyObject *freevars,*/
219 empty_tuple, /*PyObject *cellvars,*/
220 py_srcfile, /*PyObject *filename,*/
221 py_funcname, /*PyObject *name,*/
222 __pyx_lineno, /*int firstlineno,*/
223 empty_string /*PyObject *lnotab*/
224 );
225 if (!py_code) goto bad;
226 py_frame = PyFrame_New(
227 PyThreadState_Get(), /*PyThreadState *tstate,*/
228 py_code, /*PyCodeObject *code,*/
229 py_globals, /*PyObject *globals,*/
230 0 /*PyObject *locals*/
231 );
232 if (!py_frame) goto bad;
233 py_frame->f_lineno = __pyx_lineno;
234 PyTraceBack_Here(py_frame);
235 bad:
236 Py_XDECREF(py_srcfile);
237 Py_XDECREF(py_funcname);
238 Py_XDECREF(empty_tuple);
239 Py_XDECREF(empty_string);
240 Py_XDECREF(py_code);
241 Py_XDECREF(py_frame);
242 }