|
resonance 1.0.1
|
#include "os/hxstr.h"
Go to the source code of this file.
Functions | |
| void | RegisterScriptCallTemplates () |
| Register every script call template. | |
| void | GetPythonScriptHost () |
| Create the interpreter host on first use and run the master script. | |
| void | DestroyPythonScriptHost () |
| Destroy the interpreter host and clear the global. | |
| void | InvokeMasterInitScript () |
| Run the master script against the existing host. | |
| void | CallScriptTemplate (int nTemplate,...) |
| Call one registered script template as a statement. | |
| void | RunScript (const HxStr &script) |
| Run one piece of script text as a statement. | |
| HxStr | GetPythonErrorText () |
| Describe the pending Python error as text. | |
Variables | |
| constexpr int | kScriptTemplateAutoexec = 0xc9 |
| Identifier of the autoexec() call template, which Application::Run() invokes once the services exist. | |
| void RegisterScriptCallTemplates | ( | ) |
Register every script call template.
The routine registers 132 templates against integer identifiers, among them autoexec(), get_screen_config()[0], and level_list['s'].stage, plus the two exception messages for Application::Run() and Application::ExitInstance(). The European release drops the get_met_string('s') and get_met_stringList('s') templates and registers 130.
| void GetPythonScriptHost | ( | ) |
Create the interpreter host on first use and run the master script.
The host is created with twelve bytes of storage, constructed, handed to PyShell::RunMasterInitScript(), and only then stored in g_pPyShell, so the master script runs against a host the global does not yet publish. Application::Run() invokes this for the creation.
The routine returns nothing. Its early exit and its creation path disagree about what the result register holds, so the value is scratch rather than a return.
| void DestroyPythonScriptHost | ( | ) |
Destroy the interpreter host and clear the global.
The destructor is inlined here rather than called, so the body repeats PyShell's teardown.
| void InvokeMasterInitScript | ( | ) |
Run the master script against the existing host.
A second entry point onto PyShell::RunMasterInitScript(), separate from the one GetPythonScriptHost() takes during creation.
| void CallScriptTemplate | ( | int | nTemplate, |
| ... ) |
Call one registered script template as a statement.
The identifier selects a template, and the remaining arguments fill its format placeholders. The formatted text runs with Py_file_input.
The routine is variadic, and the register homing in its prologue is not the only evidence for that. The homed block's address is passed on to the formatter as the argument list, which is what proves the arguments are read rather than merely reserved.
| nTemplate | The template identifier. |
| void RunScript | ( | const HxStr & | script | ) |
Run one piece of script text as a statement.
The result is discarded. ScriptSink uses this for the text a ScriptMsg supplies.
| script | The text to run. |
| HxStr GetPythonErrorText | ( | ) |
Describe the pending Python error as text.
The routine reports the error through PyShell::ReportError() with an empty context, which halts the machine, so the text it returns is unreachable on the normal path. The plain return is no python exception found. A std::exception escaping the report is caught and its what() text returned after the prefix python error: . The handler matches the type_info that 0x004ad6b8 builds for std::exception, and it calls the vtable entry at +0x10, the what() slot in the g++ 2.9x layout.
|
constexpr |
Identifier of the autoexec() call template, which Application::Run() invokes once the services exist.