|
resonance 1.0.1
|
Script entry points whose result is a Python handle. More...
#include "script/cxx/object.h"
Go to the source code of this file.
Namespaces | |
| namespace | Py |
| C++ wrappers for the embedded Python interpreter's objects, types, and extension modules. | |
Functions | |
| Py::Object | EvalScriptTemplate (int nTemplate,...) |
| Call one registered script template as an expression and take its value. | |
| Py::Object | EvalScriptExpression (const HxStr &expression) |
| Run one piece of script text as an expression and take its value. | |
| Py::Object | CallScriptFunction (const HxStr &name, Py::Tuple args) |
| Call a function the scripts define at module level, by name. | |
Variables | |
| PyShell * | g_pPyShell |
| Single interpreter host, null until GetPythonScriptHost() creates it. | |
Script entry points whose result is a Python handle.
These sit apart from script/scripthost.h so that a caller wanting only RunScript() or one of the void entry points does not pull the interpreter headers in through PyCXX. ScriptSink and Application are both such callers.
| Py::Object EvalScriptTemplate | ( | int | nTemplate, |
| ... ) |
Call one registered script template as an expression and take its value.
The same shape as CallScriptTemplate(), running with Py_eval_input and returning the result.
| nTemplate | The template identifier. |
| Py::Object EvalScriptExpression | ( | const HxStr & | expression | ) |
Run one piece of script text as an expression and take its value.
| expression | The text to evaluate. |
| Py::Object CallScriptFunction | ( | const HxStr & | name, |
| Py::Tuple | args ) |
Call a function the scripts define at module level, by name.
The name is looked up in PyShell::mDict. A name the dictionary does not have leaves the callee None, and the call then raises inside the interpreter. The lookup and the item fetch are released PyCXX's inline hasKey() and getItem(), expanded in place. No call site survives in the shipped program, and the name is inferred.
| name | The function name. |
| args | The positional arguments, taken by value. |
|
extern |
Single interpreter host, null until GetPythonScriptHost() creates it.
Every free entry point of the script layer reads this global directly rather than through the accessor, so a call made before creation dereferences null. Application::Run() creates the host early enough that no recovered caller does that.