23 retval = (
char*) malloc( (len+2)*
sizeof (char) );
34 return compiling_name;
42 PyRun_SimpleFile( fp, temp );
43 Python::reseterrors();
51 Python::reseterrors();
52 PyCodeObject *retval = compiled_python.
Get( name );
53 Python::reseterrors();
58 fprintf( stdout,
"Compiling python module %s\n", name.c_str() );
61 char *temp = strdup( compiling_name.c_str() );
63 retval = (PyCodeObject*) Py_CompileString( str, temp, Py_file_input );
65 compiled_python.
Put( name, retval );
76 Python::reseterrors();
78 Python::reseterrors();
79 if (CompiledProgram) {
81 static char main_str[16] =
"__main__";
82 if ( ( m = PyImport_AddModule( main_str ) ) != NULL ) {
83 PyObject *localdict = PyDict_New();
84 if ( ( d = PyModule_GetDict( m ) ) != NULL ) {
85 PyObject *exe = PyEval_EvalCode( CompiledProgram, d, localdict );
89 Py_XDECREF( localdict );
93 Python::reseterrors();
95 Python::reseterrors();
99 PyObject *
CreateTuple(
const std::vector< PythonBasicType > &values )
101 PyObject *retval = PyTuple_New( values.size() );
102 for (
unsigned int i = 0;
i < values.size();
i++) {
103 PyObject *val = values[
i].NewObject();
105 PyTuple_SET_ITEM( retval,
i, val );
160 if ( (k ==
DOWN || k ==
UP) && s.
data.length() ) {