Cython has moved to github.
pyrex
view Tests/7/Reference/cstringmeth.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 PyObject *__Pyx_GetName(PyObject *dict, PyObject *name); /*proto*/
43 static int __Pyx_InternStrings(__Pyx_InternTabEntry *t); /*proto*/
45 static void __Pyx_AddTraceback(char *funcname); /*proto*/
47 /* Declarations from cstringmeth */
51 static __Pyx_StringTabEntry __pyx_string_tab[] = {
52 {&__pyx_n_foo, 1, __pyx_k1, sizeof(__pyx_k1)},
53 {&__pyx_n_join, 1, __pyx_k2, sizeof(__pyx_k2)},
54 {&__pyx_n_x, 1, __pyx_k3, sizeof(__pyx_k3)},
55 {&__pyx_n_y, 1, __pyx_k4, sizeof(__pyx_k4)},
56 {0, 0, 0, 0}
57 };
59 /* Implementation of cstringmeth */
64 static struct PyMethodDef __pyx_methods[] = {
65 {0, 0, 0, 0}
66 };
68 static void __pyx_init_filenames(void); /*proto*/
70 PyMODINIT_FUNC initcstringmeth(void); /*proto*/
71 PyMODINIT_FUNC initcstringmeth(void) {
72 PyObject *__pyx_1 = 0;
73 PyObject *__pyx_2 = 0;
74 PyObject *__pyx_3 = 0;
75 __pyx_init_filenames();
76 __pyx_m = Py_InitModule4("cstringmeth", __pyx_methods, 0, 0, PYTHON_API_VERSION);
77 if (!__pyx_m) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; goto __pyx_L1;};
78 Py_INCREF(__pyx_m);
79 __pyx_b = PyImport_AddModule("__builtin__");
80 if (!__pyx_b) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; goto __pyx_L1;};
81 if (PyObject_SetAttrString(__pyx_m, "__builtins__", __pyx_b) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; goto __pyx_L1;};
82 if (__Pyx_InitStrings(__pyx_string_tab) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; goto __pyx_L1;};
83 __pyx_1 = PyObject_GetAttr(__pyx_n_foo, __pyx_n_join); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; goto __pyx_L1;}
84 __pyx_2 = __Pyx_GetName(__pyx_b, __pyx_n_y); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; goto __pyx_L1;}
85 __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; goto __pyx_L1;}
86 PyTuple_SET_ITEM(__pyx_3, 0, __pyx_2);
87 __pyx_2 = 0;
88 __pyx_2 = PyObject_CallObject(__pyx_1, __pyx_3); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; goto __pyx_L1;}
89 Py_DECREF(__pyx_1); __pyx_1 = 0;
90 Py_DECREF(__pyx_3); __pyx_3 = 0;
91 if (PyObject_SetAttr(__pyx_m, __pyx_n_x, __pyx_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; goto __pyx_L1;}
92 Py_DECREF(__pyx_2); __pyx_2 = 0;
93 return;
94 __pyx_L1:;
95 Py_XDECREF(__pyx_1);
96 Py_XDECREF(__pyx_2);
97 Py_XDECREF(__pyx_3);
98 __Pyx_AddTraceback("cstringmeth");
99 }
101 static char *__pyx_filenames[] = {
102 "cstringmeth.pyx",
103 };
105 /* Runtime support code */
107 static void __pyx_init_filenames(void) {
108 __pyx_f = __pyx_filenames;
109 }
111 static PyObject *__Pyx_GetName(PyObject *dict, PyObject *name) {
112 PyObject *result;
113 result = PyObject_GetAttr(dict, name);
114 if (!result)
115 PyErr_SetObject(PyExc_NameError, name);
116 return result;
117 }
119 static int __Pyx_InternStrings(__Pyx_InternTabEntry *t) {
120 while (t->p) {
121 *t->p = PyString_InternFromString(t->s);
122 if (!*t->p)
123 return -1;
124 ++t;
125 }
126 return 0;
127 }
129 #include "compile.h"
130 #include "frameobject.h"
131 #include "traceback.h"
133 static void __Pyx_AddTraceback(char *funcname) {
134 PyObject *py_srcfile = 0;
135 PyObject *py_funcname = 0;
136 PyObject *py_globals = 0;
137 PyObject *empty_tuple = 0;
138 PyObject *empty_string = 0;
139 PyCodeObject *py_code = 0;
140 PyFrameObject *py_frame = 0;
142 py_srcfile = PyString_FromString(__pyx_filename);
143 if (!py_srcfile) goto bad;
144 py_funcname = PyString_FromString(funcname);
145 if (!py_funcname) goto bad;
146 py_globals = PyModule_GetDict(__pyx_m);
147 if (!py_globals) goto bad;
148 empty_tuple = PyTuple_New(0);
149 if (!empty_tuple) goto bad;
150 empty_string = PyString_FromString("");
151 if (!empty_string) goto bad;
152 py_code = PyCode_New(
153 0, /*int argcount,*/
154 0, /*int nlocals,*/
155 0, /*int stacksize,*/
156 0, /*int flags,*/
157 empty_string, /*PyObject *code,*/
158 empty_tuple, /*PyObject *consts,*/
159 empty_tuple, /*PyObject *names,*/
160 empty_tuple, /*PyObject *varnames,*/
161 empty_tuple, /*PyObject *freevars,*/
162 empty_tuple, /*PyObject *cellvars,*/
163 py_srcfile, /*PyObject *filename,*/
164 py_funcname, /*PyObject *name,*/
165 __pyx_lineno, /*int firstlineno,*/
166 empty_string /*PyObject *lnotab*/
167 );
168 if (!py_code) goto bad;
169 py_frame = PyFrame_New(
170 PyThreadState_Get(), /*PyThreadState *tstate,*/
171 py_code, /*PyCodeObject *code,*/
172 py_globals, /*PyObject *globals,*/
173 0 /*PyObject *locals*/
174 );
175 if (!py_frame) goto bad;
176 py_frame->f_lineno = __pyx_lineno;
177 PyTraceBack_Here(py_frame);
178 bad:
179 Py_XDECREF(py_srcfile);
180 Py_XDECREF(py_funcname);
181 Py_XDECREF(empty_tuple);
182 Py_XDECREF(empty_string);
183 Py_XDECREF(py_code);
184 Py_XDECREF(py_frame);
185 }
