29 PyObject *data::globals;
30 PyObject *python::module;
33 PyObject *get_py_obj (
void *instance,
const char* class_name);
64 sprintf ( buf,
"import sys ; sys.path.insert(0, \"%s\")", name );
65 PyRun_SimpleString ( buf );
77 PyRun_SimpleString(s);
89 cerr <<
"exec_file: " << filename <<
" load failed: " << endl;
105 if ( PyErr_Occurred() )
115 PyObject *result = PyImport_ImportModule ((
char *) filename.c_str ());
126 string class_ptr = string(class_name) +
"*";
127 return get_py_obj (instance, class_ptr.c_str());
136 tuple = PyTuple_New (l);
138 for (
u_int32 i = 0; i < l; i++)
150 PyTuple_SetItem (tuple, i, PyString_FromString (ms.c_str ()));
156 PyTuple_SetItem (tuple, i, PyInt_FromLong (j));
165 u_int32 l = PyTuple_Size (tuple);
167 for (
u_int32 i = 0; i < l; i++)
170 PyObject * item = PyTuple_GetItem (tuple, i);
174 if (PyString_Check (item))
177 char * s = PyString_AsString (item);
182 else if (PyInt_Check (item))
185 u_int32 li = PyInt_AsLong (item);