1 |
|
#include <iostream> |
2 |
|
#include <cctype> |
3 |
#include "circus/PyModule.h" |
#include "circus/PyModule.h" |
4 |
|
|
5 |
|
PyModule::PyModule(char *mod_name){ |
6 |
|
char *lowerd = new char[strlen(mod_name) + 1]; |
7 |
|
|
8 |
|
// fire up Python and import module |
9 |
|
cout << "This is the string: " << s << endl; |
10 |
|
cout << "This is the lower string: " << s2 << endl; |
11 |
|
|
12 |
|
// Py_Initialize(); |
13 |
|
|
14 |
|
// sprintf(cmd, "from %s.%s import MyModule", s, strtolower(s)); |
15 |
|
// cout << cmd << endl; |
16 |
|
// PyRun_SimpleString(cmd); |
17 |
|
//this->pModule = PyImport_Import(PyString_FromString(s)); |
18 |
|
|
19 |
|
} |
20 |
|
|
21 |
|
int PyModule::load() const{ |
22 |
|
// call module._load() method |
23 |
|
/* |
24 |
|
PyObject *pDict, *pFunc, *pValue, *pClass, *pInst; |
25 |
|
pDict = PyModule_GetDict(this->pModule); |
26 |
|
cout << PyModule_Check(this->pModule) << endl; |
27 |
|
pClass = PyDict_GetItemString(pDict, "test"); |
28 |
|
pInst PyInstance_New(pClass, PyObject *arg, PyObject *kw) |
29 |
|
cout << PyInstance_Check(pClass) << endl; |
30 |
|
*/ |
31 |
|
|
32 |
|
|
33 |
|
|
34 |
|
return 0; |
35 |
|
} |
36 |
|
|
37 |
|
int PyModule::unload() const{ |
38 |
|
// import module and call its _unload() method |
39 |
|
return 0; |
40 |
|
} |
41 |
|
|
42 |
|
int PyModule::registerEvents() const{ |
43 |
|
// loop through my_events and regsiter each with Ringmaster |
44 |
|
return 0; |
45 |
|
} |
46 |
|
|