Cython has moved to github.

pyrex

view Tests/5/docstrings.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 char __pyx_mdoc[] = "Welcome to the parrot module. It is currently resting.";
42 static int __Pyx_InitStrings(__Pyx_StringTabEntry *t); /*proto*/
44 static PyObject *__Pyx_CreateClass(PyObject *bases, PyObject *dict, PyObject *name, char *modname); /*proto*/
46 static void __Pyx_AddTraceback(char *funcname); /*proto*/
48 /* Declarations from docstrings */
51 /* Declarations from implementation of docstrings */
53 struct __pyx_obj_10docstrings_SuperParrot {
54 PyObject_HEAD
55 };
58 static PyTypeObject *__pyx_ptype_10docstrings_SuperParrot = 0;
60 static char __pyx_k1[] = "Parrot";
61 static char __pyx_k2[] = "Standard Norwegian Blue.";
62 static char __pyx_k3[] = "admire_plumage";
64 static PyObject *__pyx_n_Parrot;
65 static PyObject *__pyx_n_admire_plumage;
67 static PyObject *__pyx_k2p;
69 static __Pyx_StringTabEntry __pyx_string_tab[] = {
70 {&__pyx_n_Parrot, 1, __pyx_k1, sizeof(__pyx_k1)},
71 {&__pyx_n_admire_plumage, 1, __pyx_k3, sizeof(__pyx_k3)},
72 {&__pyx_k2p, 0, __pyx_k2, sizeof(__pyx_k2)},
73 {0, 0, 0, 0}
74 };
78 /* Implementation of docstrings */
80 static PyObject *__pyx_f_10docstrings_zap(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
81 static char __pyx_doc_10docstrings_zap[] = "Wake up polly.";
82 static PyObject *__pyx_f_10docstrings_zap(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
83 PyObject *__pyx_v_polly = 0;
84 PyObject *__pyx_v_volts = 0;
85 PyObject *__pyx_r;
86 static char *__pyx_argnames[] = {"polly","volts",0};
87 if (!PyArg_ParseTupleAndKeywords(__pyx_args, __pyx_kwds, "OO", __pyx_argnames, &__pyx_v_polly, &__pyx_v_volts)) return 0;
88 Py_INCREF(__pyx_v_polly);
89 Py_INCREF(__pyx_v_volts);
91 __pyx_r = Py_None; Py_INCREF(Py_None);
92 Py_DECREF(__pyx_v_polly);
93 Py_DECREF(__pyx_v_volts);
94 return __pyx_r;
95 }
97 static PyObject *__pyx_f_10docstrings_6Parrot_admire_plumage(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
98 static char __pyx_doc_10docstrings_6Parrot_admire_plumage[] = "Lovely, ain't it?";
99 static PyMethodDef __pyx_mdef_10docstrings_6Parrot_admire_plumage = {"admire_plumage", (PyCFunction)__pyx_f_10docstrings_6Parrot_admire_plumage, METH_VARARGS|METH_KEYWORDS, __pyx_doc_10docstrings_6Parrot_admire_plumage};
100 static PyObject *__pyx_f_10docstrings_6Parrot_admire_plumage(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
101 PyObject *__pyx_v_self = 0;
102 PyObject *__pyx_r;
103 static char *__pyx_argnames[] = {"self",0};
104 if (!PyArg_ParseTupleAndKeywords(__pyx_args, __pyx_kwds, "O", __pyx_argnames, &__pyx_v_self)) return 0;
105 Py_INCREF(__pyx_v_self);
107 __pyx_r = Py_None; Py_INCREF(Py_None);
108 Py_DECREF(__pyx_v_self);
109 return __pyx_r;
110 }
112 static PyObject *__pyx_tp_new_10docstrings_SuperParrot(PyTypeObject *t, PyObject *a, PyObject *k) {
113 PyObject *o = (*t->tp_alloc)(t, 0);
114 if (!o) return 0;
115 return o;
116 }
118 static void __pyx_tp_dealloc_10docstrings_SuperParrot(PyObject *o) {
119 (*o->ob_type->tp_free)(o);
120 }
122 static struct PyMethodDef __pyx_methods_10docstrings_SuperParrot[] = {
123 {0, 0, 0, 0}
124 };
126 static PyNumberMethods __pyx_tp_as_number_SuperParrot = {
127 0, /*nb_add*/
128 0, /*nb_subtract*/
129 0, /*nb_multiply*/
130 0, /*nb_divide*/
131 0, /*nb_remainder*/
132 0, /*nb_divmod*/
133 0, /*nb_power*/
134 0, /*nb_negative*/
135 0, /*nb_positive*/
136 0, /*nb_absolute*/
137 0, /*nb_nonzero*/
138 0, /*nb_invert*/
139 0, /*nb_lshift*/
140 0, /*nb_rshift*/
141 0, /*nb_and*/
142 0, /*nb_xor*/
143 0, /*nb_or*/
144 0, /*nb_coerce*/
145 0, /*nb_int*/
146 0, /*nb_long*/
147 0, /*nb_float*/
148 0, /*nb_oct*/
149 0, /*nb_hex*/
150 0, /*nb_inplace_add*/
151 0, /*nb_inplace_subtract*/
152 0, /*nb_inplace_multiply*/
153 0, /*nb_inplace_divide*/
154 0, /*nb_inplace_remainder*/
155 0, /*nb_inplace_power*/
156 0, /*nb_inplace_lshift*/
157 0, /*nb_inplace_rshift*/
158 0, /*nb_inplace_and*/
159 0, /*nb_inplace_xor*/
160 0, /*nb_inplace_or*/
161 0, /*nb_floor_divide*/
162 0, /*nb_true_divide*/
163 0, /*nb_inplace_floor_divide*/
164 0, /*nb_inplace_true_divide*/
165 #if Py_TPFLAGS_DEFAULT & Py_TPFLAGS_HAVE_INDEX
166 0, /*nb_index*/
167 #endif
168 };
170 static PySequenceMethods __pyx_tp_as_sequence_SuperParrot = {
171 0, /*sq_length*/
172 0, /*sq_concat*/
173 0, /*sq_repeat*/
174 0, /*sq_item*/
175 0, /*sq_slice*/
176 0, /*sq_ass_item*/
177 0, /*sq_ass_slice*/
178 0, /*sq_contains*/
179 0, /*sq_inplace_concat*/
180 0, /*sq_inplace_repeat*/
181 };
183 static PyMappingMethods __pyx_tp_as_mapping_SuperParrot = {
184 0, /*mp_length*/
185 0, /*mp_subscript*/
186 0, /*mp_ass_subscript*/
187 };
189 static PyBufferProcs __pyx_tp_as_buffer_SuperParrot = {
190 0, /*bf_getreadbuffer*/
191 0, /*bf_getwritebuffer*/
192 0, /*bf_getsegcount*/
193 0, /*bf_getcharbuffer*/
194 };
196 PyTypeObject __pyx_type_10docstrings_SuperParrot = {
197 PyObject_HEAD_INIT(0)
198 0, /*ob_size*/
199 "docstrings.SuperParrot", /*tp_name*/
200 sizeof(struct __pyx_obj_10docstrings_SuperParrot), /*tp_basicsize*/
201 0, /*tp_itemsize*/
202 __pyx_tp_dealloc_10docstrings_SuperParrot, /*tp_dealloc*/
203 0, /*tp_print*/
204 0, /*tp_getattr*/
205 0, /*tp_setattr*/
206 0, /*tp_compare*/
207 0, /*tp_repr*/
208 &__pyx_tp_as_number_SuperParrot, /*tp_as_number*/
209 &__pyx_tp_as_sequence_SuperParrot, /*tp_as_sequence*/
210 &__pyx_tp_as_mapping_SuperParrot, /*tp_as_mapping*/
211 0, /*tp_hash*/
212 0, /*tp_call*/
213 0, /*tp_str*/
214 0, /*tp_getattro*/
215 0, /*tp_setattro*/
216 &__pyx_tp_as_buffer_SuperParrot, /*tp_as_buffer*/
217 Py_TPFLAGS_DEFAULT|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_BASETYPE, /*tp_flags*/
218 "Special high-performance model.", /*tp_doc*/
219 0, /*tp_traverse*/
220 0, /*tp_clear*/
221 0, /*tp_richcompare*/
222 0, /*tp_weaklistoffset*/
223 0, /*tp_iter*/
224 0, /*tp_iternext*/
225 __pyx_methods_10docstrings_SuperParrot, /*tp_methods*/
226 0, /*tp_members*/
227 0, /*tp_getset*/
228 0, /*tp_base*/
229 0, /*tp_dict*/
230 0, /*tp_descr_get*/
231 0, /*tp_descr_set*/
232 0, /*tp_dictoffset*/
233 0, /*tp_init*/
234 0, /*tp_alloc*/
235 __pyx_tp_new_10docstrings_SuperParrot, /*tp_new*/
236 0, /*tp_free*/
237 0, /*tp_is_gc*/
238 0, /*tp_bases*/
239 0, /*tp_mro*/
240 0, /*tp_cache*/
241 0, /*tp_subclasses*/
242 0, /*tp_weaklist*/
243 };
245 static struct PyMethodDef __pyx_methods[] = {
246 {"zap", (PyCFunction)__pyx_f_10docstrings_zap, METH_VARARGS|METH_KEYWORDS, __pyx_doc_10docstrings_zap},
247 {0, 0, 0, 0}
248 };
250 static void __pyx_init_filenames(void); /*proto*/
252 PyMODINIT_FUNC initdocstrings(void); /*proto*/
253 PyMODINIT_FUNC initdocstrings(void) {
254 PyObject *__pyx_1 = 0;
255 PyObject *__pyx_2 = 0;
256 PyObject *__pyx_3 = 0;
257 PyObject *__pyx_4 = 0;
258 __pyx_init_filenames();
259 __pyx_m = Py_InitModule4("docstrings", __pyx_methods, __pyx_mdoc, 0, PYTHON_API_VERSION);
260 if (!__pyx_m) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; goto __pyx_L1;};
261 Py_INCREF(__pyx_m);
262 __pyx_b = PyImport_AddModule("__builtin__");
263 if (!__pyx_b) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; goto __pyx_L1;};
264 if (PyObject_SetAttrString(__pyx_m, "__builtins__", __pyx_b) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; goto __pyx_L1;};
265 if (__Pyx_InitStrings(__pyx_string_tab) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; goto __pyx_L1;};
266 if (PyType_Ready(&__pyx_type_10docstrings_SuperParrot) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 12; goto __pyx_L1;}
267 if (PyObject_SetAttrString(__pyx_m, "SuperParrot", (PyObject *)&__pyx_type_10docstrings_SuperParrot) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 12; goto __pyx_L1;}
268 __pyx_ptype_10docstrings_SuperParrot = &__pyx_type_10docstrings_SuperParrot;
270 /* "/Local/Projects/D/Pyrex/Source/Tests/5/docstrings.pyx":6 */
271 __pyx_1 = PyDict_New(); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 6; goto __pyx_L1;}
272 __pyx_2 = PyTuple_New(0); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 6; goto __pyx_L1;}
273 if (PyDict_SetItemString(__pyx_1, "__doc__", __pyx_k2p) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 6; goto __pyx_L1;}
274 __pyx_3 = __Pyx_CreateClass(__pyx_2, __pyx_1, __pyx_n_Parrot, "docstrings"); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 6; goto __pyx_L1;}
275 Py_DECREF(__pyx_2); __pyx_2 = 0;
276 __pyx_2 = PyCFunction_New(&__pyx_mdef_10docstrings_6Parrot_admire_plumage, 0); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 9; goto __pyx_L1;}
277 __pyx_4 = PyMethod_New(__pyx_2, 0, __pyx_3); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 9; goto __pyx_L1;}
278 Py_DECREF(__pyx_2); __pyx_2 = 0;
279 if (PyObject_SetAttr(__pyx_3, __pyx_n_admire_plumage, __pyx_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 9; goto __pyx_L1;}
280 Py_DECREF(__pyx_4); __pyx_4 = 0;
281 if (PyObject_SetAttr(__pyx_m, __pyx_n_Parrot, __pyx_3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 6; goto __pyx_L1;}
282 Py_DECREF(__pyx_3); __pyx_3 = 0;
283 Py_DECREF(__pyx_1); __pyx_1 = 0;
285 /* "/Local/Projects/D/Pyrex/Source/Tests/5/docstrings.pyx":12 */
286 return;
287 __pyx_L1:;
288 Py_XDECREF(__pyx_1);
289 Py_XDECREF(__pyx_2);
290 Py_XDECREF(__pyx_3);
291 Py_XDECREF(__pyx_4);
292 __Pyx_AddTraceback("docstrings");
293 }
295 static char *__pyx_filenames[] = {
296 "docstrings.pyx",
297 };
299 /* Runtime support code */
301 static void __pyx_init_filenames(void) {
302 __pyx_f = __pyx_filenames;
303 }
305 static int __Pyx_InitStrings(__Pyx_StringTabEntry *t) {
306 while (t->p) {
307 *t->p = PyString_FromStringAndSize(t->s, t->n - 1);
308 if (!*t->p)
309 return -1;
310 if (t->i)
311 PyString_InternInPlace(t->p);
312 ++t;
313 }
314 return 0;
315 }
317 static PyObject *__Pyx_CreateClass(
318 PyObject *bases, PyObject *dict, PyObject *name, char *modname)
319 {
320 PyObject *py_modname;
321 PyObject *result = 0;
323 py_modname = PyString_FromString(modname);
324 if (!py_modname)
325 goto bad;
326 if (PyDict_SetItemString(dict, "__module__", py_modname) < 0)
327 goto bad;
328 result = PyClass_New(bases, dict, name);
329 bad:
330 Py_XDECREF(py_modname);
331 return result;
332 }
334 #include "compile.h"
335 #include "frameobject.h"
336 #include "traceback.h"
338 static void __Pyx_AddTraceback(char *funcname) {
339 PyObject *py_srcfile = 0;
340 PyObject *py_funcname = 0;
341 PyObject *py_globals = 0;
342 PyObject *empty_tuple = 0;
343 PyObject *empty_string = 0;
344 PyCodeObject *py_code = 0;
345 PyFrameObject *py_frame = 0;
347 py_srcfile = PyString_FromString(__pyx_filename);
348 if (!py_srcfile) goto bad;
349 py_funcname = PyString_FromString(funcname);
350 if (!py_funcname) goto bad;
351 py_globals = PyModule_GetDict(__pyx_m);
352 if (!py_globals) goto bad;
353 empty_tuple = PyTuple_New(0);
354 if (!empty_tuple) goto bad;
355 empty_string = PyString_FromString("");
356 if (!empty_string) goto bad;
357 py_code = PyCode_New(
358 0, /*int argcount,*/
359 0, /*int nlocals,*/
360 0, /*int stacksize,*/
361 0, /*int flags,*/
362 empty_string, /*PyObject *code,*/
363 empty_tuple, /*PyObject *consts,*/
364 empty_tuple, /*PyObject *names,*/
365 empty_tuple, /*PyObject *varnames,*/
366 empty_tuple, /*PyObject *freevars,*/
367 empty_tuple, /*PyObject *cellvars,*/
368 py_srcfile, /*PyObject *filename,*/
369 py_funcname, /*PyObject *name,*/
370 __pyx_lineno, /*int firstlineno,*/
371 empty_string /*PyObject *lnotab*/
372 );
373 if (!py_code) goto bad;
374 py_frame = PyFrame_New(
375 PyThreadState_Get(), /*PyThreadState *tstate,*/
376 py_code, /*PyCodeObject *code,*/
377 py_globals, /*PyObject *globals,*/
378 0 /*PyObject *locals*/
379 );
380 if (!py_frame) goto bad;
381 py_frame->f_lineno = __pyx_lineno;
382 PyTraceBack_Here(py_frame);
383 bad:
384 Py_XDECREF(py_srcfile);
385 Py_XDECREF(py_funcname);
386 Py_XDECREF(empty_tuple);
387 Py_XDECREF(empty_string);
388 Py_XDECREF(py_code);
389 Py_XDECREF(py_frame);
390 }