Grant simplified access to the Python interpreter.
More...
#include <python_class.h>
Static Public Member Functions |
static void | init () |
| Initialise Python and insert the Adonthell include paths.
|
static void | cleanup () |
| Cleanup Python.
|
static void | insert_path (char *name) |
| Adds a directory to Python's include path.
|
static void | exec_string (char *s) |
| Execute Python statements contained in a string.
|
static bool | exec_file (string filename) |
| Executes a Python script.
|
static PyObject * | import_module (string filename) |
| Imports a Python module.
|
static void | show_traceback (void) |
| Dumps any error information to stderr.
|
static PyObject * | pass_instance (void *instance, const char *class_name) |
| Magic function that makes any C object available to Python!
|
static PyObject * | get_tuple (igzstream &file) |
| Loads a Python tuple previously saved with put_tuple ().
|
static void | put_tuple (PyObject *tuple, ogzstream &file) |
| Save a Python tuple into a file.
|
Static Public Attributes |
static PyObject * | module |
Detailed Description
Grant simplified access to the Python interpreter.
Definition at line 41 of file python_class.h.
Member Function Documentation
Initialise Python and insert the Adonthell include paths.
- Returns
- true in case of success, false otherwise.
Definition at line 40 of file python_class.cc.
void python::cleanup |
( |
void |
| ) |
|
|
static |
void python::insert_path |
( |
char * |
name | ) |
|
|
static |
Adds a directory to Python's include path.
- Parameters
-
name | directory to add to Python's include path. |
Definition at line 60 of file python_class.cc.
void python::exec_string |
( |
char * |
s | ) |
|
|
static |
Execute Python statements contained in a string.
- Parameters
-
s | string containing Python statements to execute. |
Definition at line 75 of file python_class.cc.
bool python::exec_file |
( |
string |
filename | ) |
|
|
static |
Executes a Python script.
- Parameters
-
filename | name of the file to execute. |
- Returns
- true in case of success, false otherwise.
Definition at line 83 of file python_class.cc.
PyObject * python::import_module |
( |
string |
filename | ) |
|
|
static |
Imports a Python module.
- Parameters
-
filename | file name of the module to import. |
- Returns
- pointer to the imported module.
Definition at line 113 of file python_class.cc.
void python::show_traceback |
( |
void |
| ) |
|
|
static |
PyObject * python::pass_instance |
( |
void * |
instance, |
|
|
const char * |
class_name |
|
) |
| |
|
static |
Magic function that makes any C object available to Python!
- Parameters
-
instance | pointer to the instance to pass. |
class_name | name of the class of the passed instance. |
- Returns
- pointer to the passed object.
Definition at line 124 of file python_class.cc.
PyObject * python::get_tuple |
( |
igzstream & |
file | ) |
|
|
static |
Loads a Python tuple previously saved with put_tuple ().
- Parameters
-
file | Opened file where to load the tuple from. |
- Returns
- Restored Python tuple.
Definition at line 130 of file python_class.cc.
void python::put_tuple |
( |
PyObject * |
tuple, |
|
|
ogzstream & |
file |
|
) |
| |
|
static |
Save a Python tuple into a file.
- Warning
- The Python tuple MUST ONLY be composed of Python strings or integers!
- Parameters
-
tuple | Python tuple to save. |
file | Opened file where to save the tuple to. |
Definition at line 163 of file python_class.cc.
The documentation for this class was generated from the following files: