Chris@0
|
1 /* -*- c-basic-offset: 4 indent-tabs-mode: nil -*- vi:set ts=8 sts=4 sw=4: */
|
Chris@0
|
2
|
Chris@26
|
3 /*
|
Chris@26
|
4 VampyHost
|
Chris@26
|
5
|
Chris@26
|
6 Use Vamp audio analysis plugins in Python
|
Chris@26
|
7
|
Chris@26
|
8 Gyorgy Fazekas and Chris Cannam
|
Chris@26
|
9 Centre for Digital Music, Queen Mary, University of London
|
Chris@26
|
10 Copyright 2008-2014 Queen Mary, University of London
|
Chris@26
|
11
|
Chris@26
|
12 Permission is hereby granted, free of charge, to any person
|
Chris@26
|
13 obtaining a copy of this software and associated documentation
|
Chris@26
|
14 files (the "Software"), to deal in the Software without
|
Chris@26
|
15 restriction, including without limitation the rights to use, copy,
|
Chris@26
|
16 modify, merge, publish, distribute, sublicense, and/or sell copies
|
Chris@26
|
17 of the Software, and to permit persons to whom the Software is
|
Chris@26
|
18 furnished to do so, subject to the following conditions:
|
Chris@26
|
19
|
Chris@26
|
20 The above copyright notice and this permission notice shall be
|
Chris@26
|
21 included in all copies or substantial portions of the Software.
|
Chris@26
|
22
|
Chris@26
|
23 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
Chris@26
|
24 EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
Chris@26
|
25 MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
Chris@26
|
26 NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR
|
Chris@26
|
27 ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
|
Chris@26
|
28 CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
Chris@26
|
29 WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
Chris@26
|
30
|
Chris@26
|
31 Except as contained in this notice, the names of the Centre for
|
Chris@26
|
32 Digital Music; Queen Mary, University of London; and the authors
|
Chris@26
|
33 shall not be used in advertising or otherwise to promote the sale,
|
Chris@26
|
34 use or other dealings in this Software without prior written
|
Chris@26
|
35 authorization.
|
Chris@26
|
36 */
|
Chris@26
|
37
|
Chris@31
|
38 #include "PyPluginObject.h"
|
Chris@14
|
39
|
Chris@14
|
40 // define a unique API pointer
|
Chris@27
|
41 #define PY_ARRAY_UNIQUE_SYMBOL VAMPYHOST_ARRAY_API
|
Chris@14
|
42 #define NPY_NO_DEPRECATED_API NPY_1_7_API_VERSION
|
Chris@31
|
43 #define NO_IMPORT_ARRAY
|
Chris@14
|
44 #include "numpy/arrayobject.h"
|
Chris@14
|
45
|
Chris@33
|
46 #include "structmember.h"
|
Chris@33
|
47
|
Chris@29
|
48 #include "VectorConversion.h"
|
Chris@16
|
49 #include "PyRealTime.h"
|
Chris@0
|
50
|
Chris@0
|
51 #include <string>
|
Chris@31
|
52 #include <vector>
|
Chris@33
|
53 #include <cstddef>
|
Chris@0
|
54
|
Chris@0
|
55 using namespace std;
|
Chris@0
|
56 using namespace Vamp;
|
Chris@0
|
57
|
Chris@2
|
58 PyDoc_STRVAR(xx_foo_doc, "Some description"); //!!!
|
Chris@0
|
59
|
Chris@28
|
60 //!!! todo: conv errors
|
Chris@28
|
61
|
Chris@31
|
62 static
|
Chris@21
|
63 PyPluginObject *
|
Chris@21
|
64 getPluginObject(PyObject *pyPluginHandle)
|
Chris@21
|
65 {
|
Chris@21
|
66 cerr << "getPluginObject" << endl;
|
Chris@0
|
67
|
Chris@21
|
68 PyPluginObject *pd = 0;
|
Chris@21
|
69 if (PyPlugin_Check(pyPluginHandle)) {
|
Chris@21
|
70 pd = (PyPluginObject *)pyPluginHandle;
|
Chris@16
|
71 }
|
Chris@16
|
72 if (!pd || !pd->plugin) {
|
Chris@16
|
73 PyErr_SetString(PyExc_AttributeError,
|
Chris@16
|
74 "Invalid or already deleted plugin handle.");
|
Chris@16
|
75 return 0;
|
Chris@0
|
76 } else {
|
Chris@16
|
77 return pd;
|
Chris@0
|
78 }
|
Chris@0
|
79 }
|
Chris@0
|
80
|
Chris@34
|
81 static
|
Chris@34
|
82 PyObject *
|
Chris@34
|
83 pystr(const string &s)
|
Chris@34
|
84 {
|
Chris@34
|
85 return PyString_FromString(s.c_str());
|
Chris@34
|
86 }
|
Chris@34
|
87
|
Chris@31
|
88 PyObject *
|
Chris@31
|
89 PyPluginObject_From_Plugin(Plugin *plugin)
|
Chris@0
|
90 {
|
Chris@31
|
91 PyPluginObject *pd =
|
Chris@31
|
92 (PyPluginObject *)PyType_GenericAlloc(&Plugin_Type, 0);
|
Chris@21
|
93 pd->plugin = plugin;
|
Chris@21
|
94 pd->isInitialised = false;
|
Chris@21
|
95 pd->channels = 0;
|
Chris@21
|
96 pd->blockSize = 0;
|
Chris@21
|
97 pd->stepSize = 0;
|
Chris@34
|
98
|
Chris@34
|
99 PyObject *infodict = PyDict_New();
|
Chris@34
|
100 PyDict_SetItemString
|
Chris@34
|
101 (infodict, "apiVersion", PyInt_FromLong(plugin->getVampApiVersion()));
|
Chris@34
|
102 PyDict_SetItemString
|
Chris@34
|
103 (infodict, "pluginVersion", PyInt_FromLong(plugin->getPluginVersion()));
|
Chris@34
|
104 PyDict_SetItemString
|
Chris@34
|
105 (infodict, "identifier", pystr(plugin->getIdentifier()));
|
Chris@34
|
106 PyDict_SetItemString
|
Chris@34
|
107 (infodict, "name", pystr(plugin->getName()));
|
Chris@34
|
108 PyDict_SetItemString
|
Chris@34
|
109 (infodict, "description", pystr(plugin->getDescription()));
|
Chris@34
|
110 PyDict_SetItemString
|
Chris@34
|
111 (infodict, "maker", pystr(plugin->getMaker()));
|
Chris@34
|
112 PyDict_SetItemString
|
Chris@34
|
113 (infodict, "copyright", pystr(plugin->getCopyright()));
|
Chris@34
|
114 pd->info = infodict;
|
Chris@34
|
115
|
Chris@34
|
116 pd->inputDomain = plugin->getInputDomain();
|
Chris@34
|
117
|
Chris@34
|
118 Plugin::ParameterList pl = plugin->getParameterDescriptors();
|
Chris@34
|
119
|
Chris@34
|
120 PyObject *params = PyList_New(pl.size());
|
Chris@34
|
121
|
Chris@34
|
122 VectorConversion conv;
|
Chris@34
|
123
|
Chris@34
|
124 for (int i = 0; i < (int)pl.size(); ++i) {
|
Chris@34
|
125 PyObject *paramdict = PyDict_New();
|
Chris@34
|
126 PyDict_SetItemString
|
Chris@34
|
127 (paramdict, "identifier", pystr(pl[i].identifier));
|
Chris@34
|
128 PyDict_SetItemString
|
Chris@34
|
129 (paramdict, "name", pystr(pl[i].name));
|
Chris@34
|
130 PyDict_SetItemString
|
Chris@34
|
131 (paramdict, "description", pystr(pl[i].description));
|
Chris@34
|
132 PyDict_SetItemString
|
Chris@34
|
133 (paramdict, "unit", pystr(pl[i].unit));
|
Chris@34
|
134 PyDict_SetItemString
|
Chris@34
|
135 (paramdict, "minValue", PyFloat_FromDouble(pl[i].minValue));
|
Chris@34
|
136 PyDict_SetItemString
|
Chris@34
|
137 (paramdict, "maxValue", PyFloat_FromDouble(pl[i].maxValue));
|
Chris@34
|
138 PyDict_SetItemString
|
Chris@34
|
139 (paramdict, "defaultValue", PyFloat_FromDouble(pl[i].defaultValue));
|
Chris@34
|
140 if (pl[i].isQuantized) {
|
Chris@34
|
141 PyDict_SetItemString
|
Chris@34
|
142 (paramdict, "isQuantized", Py_True);
|
Chris@34
|
143 PyDict_SetItemString
|
Chris@34
|
144 (paramdict, "quantizeStep", PyFloat_FromDouble(pl[i].quantizeStep));
|
Chris@34
|
145 if (!pl[i].valueNames.empty()) {
|
Chris@34
|
146 PyDict_SetItemString
|
Chris@34
|
147 (paramdict, "valueNames", conv.PyValue_From_StringVector(pl[i].valueNames));
|
Chris@34
|
148 }
|
Chris@34
|
149 } else {
|
Chris@34
|
150 PyDict_SetItemString
|
Chris@34
|
151 (paramdict, "isQuantized", Py_False);
|
Chris@34
|
152 }
|
Chris@34
|
153
|
Chris@34
|
154 PyList_SET_ITEM(params, i, paramdict);
|
Chris@34
|
155 }
|
Chris@34
|
156
|
Chris@34
|
157 pd->parameters = params;
|
Chris@34
|
158
|
Chris@21
|
159 return (PyObject *)pd;
|
Chris@0
|
160 }
|
Chris@0
|
161
|
Chris@33
|
162 static void
|
Chris@33
|
163 PyPluginObject_dealloc(PyPluginObject *self)
|
Chris@33
|
164 {
|
Chris@33
|
165 cerr << "PyPluginObject_dealloc" << endl;
|
Chris@33
|
166 delete self->plugin;
|
Chris@33
|
167 PyObject_Del(self);
|
Chris@33
|
168 }
|
Chris@33
|
169
|
Chris@0
|
170 static PyObject *
|
Chris@0
|
171 vampyhost_initialise(PyObject *self, PyObject *args)
|
Chris@0
|
172 {
|
Chris@21
|
173 cerr << "vampyhost_initialise" << endl;
|
Chris@21
|
174
|
luis@7
|
175 size_t channels, blockSize, stepSize;
|
Chris@0
|
176
|
Chris@23
|
177 if (!PyArg_ParseTuple (args, "nnn",
|
luis@7
|
178 (size_t) &channels,
|
luis@7
|
179 (size_t) &stepSize,
|
Chris@23
|
180 (size_t) &blockSize)) {
|
Chris@0
|
181 PyErr_SetString(PyExc_TypeError,
|
Chris@23
|
182 "initialise() takes channel count, step size, and block size arguments");
|
Chris@16
|
183 return 0;
|
Chris@0
|
184 }
|
Chris@0
|
185
|
Chris@23
|
186 PyPluginObject *pd = getPluginObject(self);
|
Chris@16
|
187 if (!pd) return 0;
|
Chris@0
|
188
|
Chris@16
|
189 pd->channels = channels;
|
Chris@16
|
190 pd->stepSize = stepSize;
|
Chris@16
|
191 pd->blockSize = blockSize;
|
Chris@0
|
192
|
Chris@16
|
193 if (!pd->plugin->initialise(channels, stepSize, blockSize)) {
|
Chris@17
|
194 cerr << "Failed to initialise native plugin adapter with channels = " << channels << ", stepSize = " << stepSize << ", blockSize = " << blockSize << " and ADAPT_ALL_SAFE set" << endl;
|
Chris@0
|
195 PyErr_SetString(PyExc_TypeError,
|
Chris@17
|
196 "Plugin initialization failed");
|
Chris@16
|
197 return 0;
|
Chris@6
|
198 }
|
Chris@0
|
199
|
Chris@16
|
200 pd->isInitialised = true;
|
luis@7
|
201
|
Chris@0
|
202 return Py_True;
|
Chris@0
|
203 }
|
Chris@0
|
204
|
Chris@0
|
205 static PyObject *
|
Chris@23
|
206 vampyhost_reset(PyObject *self, PyObject *)
|
Chris@18
|
207 {
|
Chris@21
|
208 cerr << "vampyhost_reset" << endl;
|
Chris@21
|
209
|
Chris@23
|
210 PyPluginObject *pd = getPluginObject(self);
|
Chris@18
|
211 if (!pd) return 0;
|
Chris@18
|
212
|
Chris@18
|
213 if (!pd->isInitialised) {
|
Chris@18
|
214 PyErr_SetString(PyExc_StandardError,
|
Chris@18
|
215 "Plugin has not been initialised");
|
Chris@18
|
216 return 0;
|
Chris@18
|
217 }
|
Chris@18
|
218
|
Chris@18
|
219 pd->plugin->reset();
|
Chris@18
|
220 return Py_True;
|
Chris@18
|
221 }
|
Chris@18
|
222
|
Chris@18
|
223 static PyObject *
|
Chris@20
|
224 vampyhost_getParameter(PyObject *self, PyObject *args)
|
Chris@20
|
225 {
|
Chris@21
|
226 cerr << "vampyhost_getParameter" << endl;
|
Chris@21
|
227
|
Chris@20
|
228 PyObject *pyParam;
|
Chris@20
|
229
|
Chris@23
|
230 if (!PyArg_ParseTuple(args, "S", &pyParam)) {
|
Chris@20
|
231 PyErr_SetString(PyExc_TypeError,
|
Chris@23
|
232 "getParameter() takes parameter id (string) argument");
|
Chris@20
|
233 return 0; }
|
Chris@20
|
234
|
Chris@23
|
235 PyPluginObject *pd = getPluginObject(self);
|
Chris@20
|
236 if (!pd) return 0;
|
Chris@20
|
237
|
Chris@20
|
238 float value = pd->plugin->getParameter(PyString_AS_STRING(pyParam));
|
Chris@20
|
239 return PyFloat_FromDouble(double(value));
|
Chris@20
|
240 }
|
Chris@20
|
241
|
Chris@20
|
242 static PyObject *
|
Chris@20
|
243 vampyhost_setParameter(PyObject *self, PyObject *args)
|
Chris@20
|
244 {
|
Chris@21
|
245 cerr << "vampyhost_setParameter" << endl;
|
Chris@21
|
246
|
Chris@20
|
247 PyObject *pyParam;
|
Chris@20
|
248 float value;
|
Chris@20
|
249
|
Chris@23
|
250 if (!PyArg_ParseTuple(args, "Sf", &pyParam, &value)) {
|
Chris@20
|
251 PyErr_SetString(PyExc_TypeError,
|
Chris@23
|
252 "setParameter() takes parameter id (string), and value (float) arguments");
|
Chris@20
|
253 return 0; }
|
Chris@20
|
254
|
Chris@23
|
255 PyPluginObject *pd = getPluginObject(self);
|
Chris@20
|
256 if (!pd) return 0;
|
Chris@20
|
257
|
Chris@20
|
258 pd->plugin->setParameter(PyString_AS_STRING(pyParam), value);
|
Chris@20
|
259 return Py_True;
|
Chris@20
|
260 }
|
Chris@20
|
261
|
Chris@20
|
262 static PyObject *
|
Chris@0
|
263 vampyhost_process(PyObject *self, PyObject *args)
|
Chris@0
|
264 {
|
Chris@21
|
265 cerr << "vampyhost_process" << endl;
|
Chris@21
|
266
|
Chris@0
|
267 PyObject *pyBuffer;
|
Chris@0
|
268 PyObject *pyRealTime;
|
Chris@0
|
269
|
Chris@23
|
270 if (!PyArg_ParseTuple(args, "OO",
|
Chris@0
|
271 &pyBuffer, // Audio data
|
Chris@0
|
272 &pyRealTime)) { // TimeStamp
|
Chris@0
|
273 PyErr_SetString(PyExc_TypeError,
|
Chris@17
|
274 "process() takes plugin handle (object), buffer (2D array of channels * samples floats) and timestamp (RealTime) arguments");
|
Chris@16
|
275 return 0; }
|
Chris@0
|
276
|
Chris@0
|
277 if (!PyRealTime_Check(pyRealTime)) {
|
Chris@0
|
278 PyErr_SetString(PyExc_TypeError,"Valid timestamp required.");
|
Chris@16
|
279 return 0; }
|
Chris@0
|
280
|
Chris@17
|
281 if (!PyList_Check(pyBuffer)) {
|
Chris@17
|
282 PyErr_SetString(PyExc_TypeError, "List of NumPy Array required for process input.");
|
Chris@17
|
283 return 0;
|
Chris@17
|
284 }
|
Chris@17
|
285
|
Chris@23
|
286 PyPluginObject *pd = getPluginObject(self);
|
Chris@16
|
287 if (!pd) return 0;
|
Chris@0
|
288
|
Chris@0
|
289 if (!pd->isInitialised) {
|
Chris@0
|
290 PyErr_SetString(PyExc_StandardError,
|
Chris@0
|
291 "Plugin has not been initialised.");
|
Chris@16
|
292 return 0;
|
Chris@16
|
293 }
|
Chris@0
|
294
|
Chris@12
|
295 int channels = pd->channels;
|
Chris@0
|
296
|
Chris@4
|
297 if (PyList_GET_SIZE(pyBuffer) != channels) {
|
Chris@17
|
298 cerr << "Wrong number of channels: got " << PyList_GET_SIZE(pyBuffer) << ", expected " << channels << endl;
|
Chris@4
|
299 PyErr_SetString(PyExc_TypeError, "Wrong number of channels");
|
Chris@16
|
300 return 0;
|
Chris@4
|
301 }
|
Chris@0
|
302
|
Chris@4
|
303 float **inbuf = new float *[channels];
|
Chris@0
|
304
|
Chris@29
|
305 VectorConversion typeConv;
|
Chris@17
|
306
|
Chris@12
|
307 vector<vector<float> > data;
|
Chris@4
|
308 for (int c = 0; c < channels; ++c) {
|
Chris@4
|
309 PyObject *cbuf = PyList_GET_ITEM(pyBuffer, c);
|
Chris@17
|
310 data.push_back(typeConv.PyValue_To_FloatVector(cbuf));
|
Chris@12
|
311 }
|
Chris@12
|
312
|
Chris@12
|
313 for (int c = 0; c < channels; ++c) {
|
Chris@17
|
314 if (data[c].size() != pd->blockSize) {
|
Chris@17
|
315 cerr << "Wrong number of samples on channel " << c << ": expected " << pd->blockSize << " (plugin's block size), got " << data[c].size() << endl;
|
Chris@17
|
316 PyErr_SetString(PyExc_TypeError, "Wrong number of samples");
|
Chris@17
|
317 return 0;
|
Chris@17
|
318 }
|
Chris@12
|
319 inbuf[c] = &data[c][0];
|
Chris@4
|
320 }
|
Chris@0
|
321
|
Chris@12
|
322 RealTime timeStamp = *PyRealTime_AsRealTime(pyRealTime);
|
Chris@0
|
323
|
Chris@18
|
324 Plugin::FeatureSet fs = pd->plugin->process(inbuf, timeStamp);
|
Chris@0
|
325
|
Chris@4
|
326 delete[] inbuf;
|
Chris@0
|
327
|
Chris@29
|
328 VectorConversion conv;
|
Chris@18
|
329
|
Chris@18
|
330 PyObject *pyFs = PyDict_New();
|
Chris@0
|
331
|
Chris@18
|
332 for (Plugin::FeatureSet::const_iterator fsi = fs.begin();
|
Chris@18
|
333 fsi != fs.end(); ++fsi) {
|
Chris@18
|
334
|
Chris@18
|
335 int fno = fsi->first;
|
Chris@18
|
336 const Plugin::FeatureList &fl = fsi->second;
|
Chris@18
|
337
|
Chris@18
|
338 if (!fl.empty()) {
|
Chris@18
|
339
|
Chris@18
|
340 PyObject *pyFl = PyList_New(fl.size());
|
Chris@18
|
341
|
Chris@18
|
342 for (int fli = 0; fli < (int)fl.size(); ++fli) {
|
Chris@18
|
343
|
Chris@18
|
344 const Plugin::Feature &f = fl[fli];
|
Chris@18
|
345 PyObject *pyF = PyDict_New();
|
Chris@18
|
346
|
Chris@18
|
347 if (f.hasTimestamp) {
|
Chris@18
|
348 PyDict_SetItemString
|
Chris@18
|
349 (pyF, "timestamp", PyRealTime_FromRealTime(f.timestamp));
|
Chris@18
|
350 }
|
Chris@18
|
351 if (f.hasDuration) {
|
Chris@18
|
352 PyDict_SetItemString
|
Chris@18
|
353 (pyF, "duration", PyRealTime_FromRealTime(f.duration));
|
Chris@18
|
354 }
|
Chris@18
|
355
|
Chris@18
|
356 PyDict_SetItemString
|
Chris@34
|
357 (pyF, "label", pystr(f.label));
|
Chris@18
|
358
|
Chris@18
|
359 if (!f.values.empty()) {
|
Chris@18
|
360 PyDict_SetItemString
|
Chris@28
|
361 (pyF, "values", conv.PyArray_From_FloatVector(f.values));
|
Chris@18
|
362 }
|
Chris@18
|
363
|
Chris@18
|
364 PyList_SET_ITEM(pyFl, fli, pyF);
|
Chris@18
|
365 }
|
Chris@18
|
366
|
Chris@18
|
367 PyObject *pyN = PyInt_FromLong(fno);
|
Chris@18
|
368 PyDict_SetItem(pyFs, pyN, pyFl);
|
Chris@18
|
369 }
|
Chris@18
|
370 }
|
Chris@18
|
371
|
Chris@18
|
372 return pyFs;
|
Chris@0
|
373 }
|
Chris@0
|
374
|
Chris@23
|
375 static PyObject *
|
Chris@23
|
376 vampyhost_unload(PyObject *self, PyObject *)
|
Chris@23
|
377 {
|
Chris@23
|
378 cerr << "vampyhost_unloadPlugin" << endl;
|
Chris@23
|
379
|
Chris@23
|
380 PyPluginObject *pd = getPluginObject(self);
|
Chris@23
|
381 if (!pd) return 0;
|
Chris@23
|
382
|
Chris@23
|
383 delete pd->plugin;
|
Chris@32
|
384 pd->plugin = 0; // This is checked by getPluginObject, so we avoid
|
Chris@32
|
385 // blowing up if called repeatedly
|
Chris@23
|
386
|
Chris@23
|
387 return Py_True;
|
Chris@23
|
388 }
|
Chris@23
|
389
|
Chris@33
|
390 static PyMemberDef PyPluginObject_members[] =
|
Chris@33
|
391 {
|
Chris@34
|
392 {(char *)"info", T_OBJECT, offsetof(PyPluginObject, info), READONLY,
|
Chris@34
|
393 xx_foo_doc},
|
Chris@34
|
394
|
Chris@34
|
395 {(char *)"inputDomain", T_INT, offsetof(PyPluginObject, inputDomain), READONLY,
|
Chris@34
|
396 xx_foo_doc},
|
Chris@34
|
397
|
Chris@34
|
398 {(char *)"parameters", T_OBJECT, offsetof(PyPluginObject, parameters), READONLY,
|
Chris@34
|
399 xx_foo_doc},
|
Chris@33
|
400
|
Chris@33
|
401 {0, 0}
|
Chris@33
|
402 };
|
Chris@33
|
403
|
Chris@21
|
404 static PyMethodDef PyPluginObject_methods[] =
|
Chris@21
|
405 {
|
Chris@23
|
406 {"getParameter", vampyhost_getParameter, METH_VARARGS,
|
Chris@23
|
407 xx_foo_doc}, //!!! fix all these!
|
Chris@23
|
408
|
Chris@23
|
409 {"setParameter", vampyhost_setParameter, METH_VARARGS,
|
Chris@23
|
410 xx_foo_doc},
|
Chris@33
|
411
|
Chris@23
|
412 {"initialise", vampyhost_initialise, METH_VARARGS,
|
Chris@23
|
413 xx_foo_doc},
|
Chris@23
|
414
|
Chris@23
|
415 {"reset", vampyhost_reset, METH_NOARGS,
|
Chris@23
|
416 xx_foo_doc},
|
Chris@23
|
417
|
Chris@23
|
418 {"process", vampyhost_process, METH_VARARGS,
|
Chris@23
|
419 xx_foo_doc},
|
Chris@23
|
420
|
Chris@23
|
421 {"unload", vampyhost_unload, METH_NOARGS,
|
Chris@23
|
422 xx_foo_doc},
|
Chris@23
|
423
|
Chris@21
|
424 {0, 0}
|
Chris@21
|
425 };
|
Chris@21
|
426
|
Chris@21
|
427 /* Doc:: 10.3 Type Objects */ /* static */
|
Chris@21
|
428 PyTypeObject Plugin_Type =
|
Chris@21
|
429 {
|
Chris@21
|
430 PyObject_HEAD_INIT(NULL)
|
Chris@21
|
431 0, /*ob_size*/
|
Chris@21
|
432 "vampyhost.Plugin", /*tp_name*/
|
Chris@21
|
433 sizeof(PyPluginObject), /*tp_basicsize*/
|
Chris@21
|
434 0, /*tp_itemsize*/
|
Chris@21
|
435 (destructor)PyPluginObject_dealloc, /*tp_dealloc*/
|
Chris@21
|
436 0, /*tp_print*/
|
Chris@33
|
437 0, /*tp_getattr*/
|
Chris@33
|
438 0, /*tp_setattr*/
|
Chris@21
|
439 0, /*tp_compare*/
|
Chris@21
|
440 0, /*tp_repr*/
|
Chris@21
|
441 0, /*tp_as_number*/
|
Chris@21
|
442 0, /*tp_as_sequence*/
|
Chris@21
|
443 0, /*tp_as_mapping*/
|
Chris@21
|
444 0, /*tp_hash*/
|
Chris@21
|
445 0, /*tp_call*/
|
Chris@21
|
446 0, /*tp_str*/
|
Chris@33
|
447 PyObject_GenericGetAttr, /*tp_getattro*/
|
Chris@33
|
448 PyObject_GenericSetAttr, /*tp_setattro*/
|
Chris@21
|
449 0, /*tp_as_buffer*/
|
Chris@21
|
450 Py_TPFLAGS_DEFAULT, /*tp_flags*/
|
Chris@21
|
451 "Plugin Object", /*tp_doc*/
|
Chris@21
|
452 0, /*tp_traverse*/
|
Chris@21
|
453 0, /*tp_clear*/
|
Chris@21
|
454 0, /*tp_richcompare*/
|
Chris@21
|
455 0, /*tp_weaklistoffset*/
|
Chris@21
|
456 0, /*tp_iter*/
|
Chris@21
|
457 0, /*tp_iternext*/
|
Chris@21
|
458 PyPluginObject_methods, /*tp_methods*/
|
Chris@33
|
459 PyPluginObject_members, /*tp_members*/
|
Chris@21
|
460 0, /*tp_getset*/
|
Chris@21
|
461 0, /*tp_base*/
|
Chris@21
|
462 0, /*tp_dict*/
|
Chris@21
|
463 0, /*tp_descr_get*/
|
Chris@21
|
464 0, /*tp_descr_set*/
|
Chris@21
|
465 0, /*tp_dictoffset*/
|
Chris@21
|
466 0, /*tp_init*/
|
Chris@21
|
467 PyType_GenericAlloc, /*tp_alloc*/
|
Chris@21
|
468 0, /*tp_new*/
|
Chris@21
|
469 PyObject_Del, /*tp_free*/
|
Chris@21
|
470 0, /*tp_is_gc*/
|
Chris@21
|
471 };
|
Chris@0
|
472
|