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