Cython has moved to github.
pyrex
view Tests/Bugs/wyatt/Reference/point.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 PyTypeObject *__Pyx_ImportType(char *module_name, char *class_name, long size); /*proto*/
43 static PyObject *__Pyx_ImportModule(char *name); /*proto*/
45 static void __Pyx_AddTraceback(char *funcname); /*proto*/
47 /* Declarations from vector */
49 struct __pyx_obj_6vector_Vector {
50 PyObject_HEAD
51 float x;
52 float y;
53 float z;
54 float w;
55 };
58 static PyTypeObject *__pyx_ptype_6vector_Vector = 0;
60 /* Declarations from point */
62 struct __pyx_obj_5point_Point {
63 struct __pyx_obj_6vector_Vector __pyx_base;
64 };
67 static PyTypeObject *__pyx_ptype_5point_Point = 0;
70 static __Pyx_StringTabEntry __pyx_string_tab[] = {
71 {0, 0, 0, 0}
72 };
74 /* Implementation of point */
76 static PyObject *__pyx_tp_new_5point_Point(PyTypeObject *t, PyObject *a, PyObject *k) {
77 PyObject *o = __pyx_ptype_6vector_Vector->tp_new(t, a, k);
78 if (!o) return 0;
79 return o;
80 }
82 static void __pyx_tp_dealloc_5point_Point(PyObject *o) {
83 __pyx_ptype_6vector_Vector->tp_dealloc(o);
84 }
86 static struct PyMethodDef __pyx_methods_5point_Point[] = {
87 {0, 0, 0, 0}
88 };
90 static PyNumberMethods __pyx_tp_as_number_Point = {
91 0, /*nb_add*/
92 0, /*nb_subtract*/
93 0, /*nb_multiply*/
94 0, /*nb_divide*/
95 0, /*nb_remainder*/
96 0, /*nb_divmod*/
97 0, /*nb_power*/
98 0, /*nb_negative*/
99 0, /*nb_positive*/
100 0, /*nb_absolute*/
101 0, /*nb_nonzero*/
102 0, /*nb_invert*/
103 0, /*nb_lshift*/
104 0, /*nb_rshift*/
105 0, /*nb_and*/
106 0, /*nb_xor*/
107 0, /*nb_or*/
108 0, /*nb_coerce*/
109 0, /*nb_int*/
110 0, /*nb_long*/
111 0, /*nb_float*/
112 0, /*nb_oct*/
113 0, /*nb_hex*/
114 0, /*nb_inplace_add*/
115 0, /*nb_inplace_subtract*/
116 0, /*nb_inplace_multiply*/
117 0, /*nb_inplace_divide*/
118 0, /*nb_inplace_remainder*/
119 0, /*nb_inplace_power*/
120 0, /*nb_inplace_lshift*/
121 0, /*nb_inplace_rshift*/
122 0, /*nb_inplace_and*/
123 0, /*nb_inplace_xor*/
124 0, /*nb_inplace_or*/
125 0, /*nb_floor_divide*/
126 0, /*nb_true_divide*/
127 0, /*nb_inplace_floor_divide*/
128 0, /*nb_inplace_true_divide*/
129 #if Py_TPFLAGS_DEFAULT & Py_TPFLAGS_HAVE_INDEX
130 0, /*nb_index*/
131 #endif
132 };
134 static PySequenceMethods __pyx_tp_as_sequence_Point = {
135 0, /*sq_length*/
136 0, /*sq_concat*/
137 0, /*sq_repeat*/
138 0, /*sq_item*/
139 0, /*sq_slice*/
140 0, /*sq_ass_item*/
141 0, /*sq_ass_slice*/
142 0, /*sq_contains*/
143 0, /*sq_inplace_concat*/
144 0, /*sq_inplace_repeat*/
145 };
147 static PyMappingMethods __pyx_tp_as_mapping_Point = {
148 0, /*mp_length*/
149 0, /*mp_subscript*/
150 0, /*mp_ass_subscript*/
151 };
153 static PyBufferProcs __pyx_tp_as_buffer_Point = {
154 0, /*bf_getreadbuffer*/
155 0, /*bf_getwritebuffer*/
156 0, /*bf_getsegcount*/
157 0, /*bf_getcharbuffer*/
158 };
160 PyTypeObject __pyx_type_5point_Point = {
161 PyObject_HEAD_INIT(0)
162 0, /*ob_size*/
163 "point.Point", /*tp_name*/
164 sizeof(struct __pyx_obj_5point_Point), /*tp_basicsize*/
165 0, /*tp_itemsize*/
166 __pyx_tp_dealloc_5point_Point, /*tp_dealloc*/
167 0, /*tp_print*/
168 0, /*tp_getattr*/
169 0, /*tp_setattr*/
170 0, /*tp_compare*/
171 0, /*tp_repr*/
172 &__pyx_tp_as_number_Point, /*tp_as_number*/
173 &__pyx_tp_as_sequence_Point, /*tp_as_sequence*/
174 &__pyx_tp_as_mapping_Point, /*tp_as_mapping*/
175 0, /*tp_hash*/
176 0, /*tp_call*/
177 0, /*tp_str*/
178 0, /*tp_getattro*/
179 0, /*tp_setattro*/
180 &__pyx_tp_as_buffer_Point, /*tp_as_buffer*/
181 Py_TPFLAGS_DEFAULT|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_BASETYPE, /*tp_flags*/
182 0, /*tp_doc*/
183 0, /*tp_traverse*/
184 0, /*tp_clear*/
185 0, /*tp_richcompare*/
186 0, /*tp_weaklistoffset*/
187 0, /*tp_iter*/
188 0, /*tp_iternext*/
189 __pyx_methods_5point_Point, /*tp_methods*/
190 0, /*tp_members*/
191 0, /*tp_getset*/
192 0, /*tp_base*/
193 0, /*tp_dict*/
194 0, /*tp_descr_get*/
195 0, /*tp_descr_set*/
196 0, /*tp_dictoffset*/
197 0, /*tp_init*/
198 0, /*tp_alloc*/
199 __pyx_tp_new_5point_Point, /*tp_new*/
200 0, /*tp_free*/
201 0, /*tp_is_gc*/
202 0, /*tp_bases*/
203 0, /*tp_mro*/
204 0, /*tp_cache*/
205 0, /*tp_subclasses*/
206 0, /*tp_weaklist*/
207 };
209 static struct PyMethodDef __pyx_methods[] = {
210 {0, 0, 0, 0}
211 };
213 static void __pyx_init_filenames(void); /*proto*/
215 PyMODINIT_FUNC initpoint(void); /*proto*/
216 PyMODINIT_FUNC initpoint(void) {
217 __pyx_init_filenames();
218 __pyx_m = Py_InitModule4("point", __pyx_methods, 0, 0, PYTHON_API_VERSION);
219 if (!__pyx_m) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; goto __pyx_L1;};
220 Py_INCREF(__pyx_m);
221 __pyx_b = PyImport_AddModule("__builtin__");
222 if (!__pyx_b) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; goto __pyx_L1;};
223 if (PyObject_SetAttrString(__pyx_m, "__builtins__", __pyx_b) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; goto __pyx_L1;};
224 if (__Pyx_InitStrings(__pyx_string_tab) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; goto __pyx_L1;};
225 __pyx_ptype_6vector_Vector = __Pyx_ImportType("vector", "Vector", sizeof(struct __pyx_obj_6vector_Vector)); if (!__pyx_ptype_6vector_Vector) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; goto __pyx_L1;}
226 __pyx_type_5point_Point.tp_base = __pyx_ptype_6vector_Vector;
227 if (PyType_Ready(&__pyx_type_5point_Point) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; goto __pyx_L1;}
228 if (PyObject_SetAttrString(__pyx_m, "Point", (PyObject *)&__pyx_type_5point_Point) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; goto __pyx_L1;}
229 __pyx_ptype_5point_Point = &__pyx_type_5point_Point;
230 return;
231 __pyx_L1:;
232 __Pyx_AddTraceback("point");
233 }
235 static char *__pyx_filenames[] = {
236 "point.pyx",
237 };
239 /* Runtime support code */
241 static void __pyx_init_filenames(void) {
242 __pyx_f = __pyx_filenames;
243 }
245 #ifndef __PYX_HAVE_RT_ImportType
246 #define __PYX_HAVE_RT_ImportType
247 static PyTypeObject *__Pyx_ImportType(char *module_name, char *class_name,
248 long size)
249 {
250 PyObject *py_module = 0;
251 PyObject *result = 0;
253 py_module = __Pyx_ImportModule(module_name);
254 if (!py_module)
255 goto bad;
256 result = PyObject_GetAttrString(py_module, class_name);
257 if (!result)
258 goto bad;
259 if (!PyType_Check(result)) {
260 PyErr_Format(PyExc_TypeError,
261 "%s.%s is not a type object",
262 module_name, class_name);
263 goto bad;
264 }
265 if (((PyTypeObject *)result)->tp_basicsize != size) {
266 PyErr_Format(PyExc_ValueError,
267 "%s.%s does not appear to be the correct type object",
268 module_name, class_name);
269 goto bad;
270 }
271 return (PyTypeObject *)result;
272 bad:
273 Py_XDECREF(result);
274 return 0;
275 }
276 #endif
278 #ifndef __PYX_HAVE_RT_ImportModule
279 #define __PYX_HAVE_RT_ImportModule
280 static PyObject *__Pyx_ImportModule(char *name) {
281 PyObject *py_name = 0;
283 py_name = PyString_FromString(name);
284 if (!py_name)
285 goto bad;
286 return PyImport_Import(py_name);
287 bad:
288 Py_XDECREF(py_name);
289 return 0;
290 }
291 #endif
293 #include "compile.h"
294 #include "frameobject.h"
295 #include "traceback.h"
297 static void __Pyx_AddTraceback(char *funcname) {
298 PyObject *py_srcfile = 0;
299 PyObject *py_funcname = 0;
300 PyObject *py_globals = 0;
301 PyObject *empty_tuple = 0;
302 PyObject *empty_string = 0;
303 PyCodeObject *py_code = 0;
304 PyFrameObject *py_frame = 0;
306 py_srcfile = PyString_FromString(__pyx_filename);
307 if (!py_srcfile) goto bad;
308 py_funcname = PyString_FromString(funcname);
309 if (!py_funcname) goto bad;
310 py_globals = PyModule_GetDict(__pyx_m);
311 if (!py_globals) goto bad;
312 empty_tuple = PyTuple_New(0);
313 if (!empty_tuple) goto bad;
314 empty_string = PyString_FromString("");
315 if (!empty_string) goto bad;
316 py_code = PyCode_New(
317 0, /*int argcount,*/
318 0, /*int nlocals,*/
319 0, /*int stacksize,*/
320 0, /*int flags,*/
321 empty_string, /*PyObject *code,*/
322 empty_tuple, /*PyObject *consts,*/
323 empty_tuple, /*PyObject *names,*/
324 empty_tuple, /*PyObject *varnames,*/
325 empty_tuple, /*PyObject *freevars,*/
326 empty_tuple, /*PyObject *cellvars,*/
327 py_srcfile, /*PyObject *filename,*/
328 py_funcname, /*PyObject *name,*/
329 __pyx_lineno, /*int firstlineno,*/
330 empty_string /*PyObject *lnotab*/
331 );
332 if (!py_code) goto bad;
333 py_frame = PyFrame_New(
334 PyThreadState_Get(), /*PyThreadState *tstate,*/
335 py_code, /*PyCodeObject *code,*/
336 py_globals, /*PyObject *globals,*/
337 0 /*PyObject *locals*/
338 );
339 if (!py_frame) goto bad;
340 py_frame->f_lineno = __pyx_lineno;
341 PyTraceBack_Here(py_frame);
342 bad:
343 Py_XDECREF(py_srcfile);
344 Py_XDECREF(py_funcname);
345 Py_XDECREF(empty_tuple);
346 Py_XDECREF(empty_string);
347 Py_XDECREF(py_code);
348 Py_XDECREF(py_frame);
349 }
