|
Last change
on this file was 2, checked in by Yuri Dario, 15 years ago |
|
Initial import for vendor code.
|
-
Property svn:eol-style
set to
native
|
|
File size:
1.7 KB
|
| Line | |
|---|
| 1 | #include <Python.h>
|
|---|
| 2 |
|
|---|
| 3 | typedef struct {
|
|---|
| 4 | PyObject_HEAD
|
|---|
| 5 | /* Type-specific fields go here. */
|
|---|
| 6 | } noddy_NoddyObject;
|
|---|
| 7 |
|
|---|
| 8 | static PyTypeObject noddy_NoddyType = {
|
|---|
| 9 | PyObject_HEAD_INIT(NULL)
|
|---|
| 10 | 0, /*ob_size*/
|
|---|
| 11 | "noddy.Noddy", /*tp_name*/
|
|---|
| 12 | sizeof(noddy_NoddyObject), /*tp_basicsize*/
|
|---|
| 13 | 0, /*tp_itemsize*/
|
|---|
| 14 | 0, /*tp_dealloc*/
|
|---|
| 15 | 0, /*tp_print*/
|
|---|
| 16 | 0, /*tp_getattr*/
|
|---|
| 17 | 0, /*tp_setattr*/
|
|---|
| 18 | 0, /*tp_compare*/
|
|---|
| 19 | 0, /*tp_repr*/
|
|---|
| 20 | 0, /*tp_as_number*/
|
|---|
| 21 | 0, /*tp_as_sequence*/
|
|---|
| 22 | 0, /*tp_as_mapping*/
|
|---|
| 23 | 0, /*tp_hash */
|
|---|
| 24 | 0, /*tp_call*/
|
|---|
| 25 | 0, /*tp_str*/
|
|---|
| 26 | 0, /*tp_getattro*/
|
|---|
| 27 | 0, /*tp_setattro*/
|
|---|
| 28 | 0, /*tp_as_buffer*/
|
|---|
| 29 | Py_TPFLAGS_DEFAULT, /*tp_flags*/
|
|---|
| 30 | "Noddy objects", /* tp_doc */
|
|---|
| 31 | };
|
|---|
| 32 |
|
|---|
| 33 | static PyMethodDef noddy_methods[] = {
|
|---|
| 34 | {NULL} /* Sentinel */
|
|---|
| 35 | };
|
|---|
| 36 |
|
|---|
| 37 | #ifndef PyMODINIT_FUNC /* declarations for DLL import/export */
|
|---|
| 38 | #define PyMODINIT_FUNC void
|
|---|
| 39 | #endif
|
|---|
| 40 | PyMODINIT_FUNC
|
|---|
| 41 | initnoddy(void)
|
|---|
| 42 | {
|
|---|
| 43 | PyObject* m;
|
|---|
| 44 |
|
|---|
| 45 | noddy_NoddyType.tp_new = PyType_GenericNew;
|
|---|
| 46 | if (PyType_Ready(&noddy_NoddyType) < 0)
|
|---|
| 47 | return;
|
|---|
| 48 |
|
|---|
| 49 | m = Py_InitModule3("noddy", noddy_methods,
|
|---|
| 50 | "Example module that creates an extension type.");
|
|---|
| 51 |
|
|---|
| 52 | Py_INCREF(&noddy_NoddyType);
|
|---|
| 53 | PyModule_AddObject(m, "Noddy", (PyObject *)&noddy_NoddyType);
|
|---|
| 54 | }
|
|---|
Note:
See
TracBrowser
for help on using the repository browser.