Macros | |
| #define | REPY_FN_GLOBAL_SCOPE __repy_globals |
| The variable name for inline execution global scopes. | |
| #define | REPY_FN_LOCAL_SCOPE __repy_locals |
| The variable name for inline execution local scopes. | |
| #define | REPY_FN_AUTO_CLEANUP __repy_auto_cleanup |
| The variable name for helper auto-cleanup object. | |
| #define | REPY_FN_SETUP_INTERP(interp_index) |
| Create an inline execution scope for your function without any globals. | |
| #define | REPY_FN_SETUP_INTERP_WITH_GLOBALS(interp_index, globals) |
| Create an inline execution scope for your function, using a pre-defined Python dict as your global scope object, and creating a new Python dict for the local scope. Note that, unless otherwise specified, executing Python code stores variables on the local scope. | |
| #define | REPY_FN_SETUP REPY_FN_SETUP_INTERP(REPY_MAIN_INTERPRETER) |
| Create an inline execution scope for your function without any globals. | |
| #define | REPY_FN_SETUP_WITH_GLOBALS(globals) |
| Create an inline execution scope for your function, using a pre-defined Python dict as your global scope object, and creating a new Python dict for the local scope. Note that, unless otherwise specified, executing Python code stores variables on the local scope. | |
| #define | REPY_FN_CLEANUP |
| Clean up a inline execution scope by releasing the local scope and popping the last interpreter index. | |
| #define | REPY_FN_RETURN(retType, retVal) |
| Clean up a inline scope by releasing the local scope and popping the last interpreter index, then returns. | |
| #define | REPY_FN_DEFER_RELEASE(handle) |
| Registers a REPY_Handle to be released by the REPY_DeferredCleanupHelper for this REPY_FN scope. | |
| #define | REPY_FN_DEFER_RECOMP_FREE(pointer) |
| Registers a void* to be deallocated by the REPY_DeferredCleanupHelper for this REPY_FN scope. | |
| #define REPY_FN_CLEANUP |
Clean up a inline execution scope by releasing the local scope and popping the last interpreter index.
The REPY_DeferredCleanupHelper will perform all queued cleanup tasks at this time.
The global scope is only released if the global and local scopes are the same.
| #define REPY_FN_DEFER_RECOMP_FREE | ( | pointer | ) |
Registers a void* to be deallocated by the REPY_DeferredCleanupHelper for this REPY_FN scope.
This pointer will now be deallocated when the scope is cleaned up. Do not deallocate manually before that point.
Deallocation is handled by calling recomp_free. If this is inapproproate for whatever you want to deallocate, do not use this mechanism.
| pointer | a void* to be released on scope cleanup. |
| #define REPY_FN_DEFER_RELEASE | ( | handle | ) |
Registers a REPY_Handle to be released by the REPY_DeferredCleanupHelper for this REPY_FN scope.
This handle will now be released when the scope is cleaned up. Do not make the handle Single-Use or otherwise release the handle manually before that point.
| handle | a REPY_Handle to be released on scope cleanup. |
| #define REPY_FN_RETURN | ( | retType, | |
| retVal ) |
Clean up a inline scope by releasing the local scope and popping the last interpreter index, then returns.
The REPY_DeferredCleanupHelper will perform all queued cleanup tasks at this time.
Supports returning a value, which is captured before cleanup starts.
The global scope is only released if the global and local scopes are the same.
| #define REPY_FN_SETUP REPY_FN_SETUP_INTERP(REPY_MAIN_INTERPRETER) |
Create an inline execution scope for your function without any globals.
The global and local scope dict objects will the same. Python's built-ins will be added whenever Python code is first executed.
REPY_FN scopes also create a REPY_DeferredCleanupHandler instance, which is used to automatically destroy any helper objects created by other REPY_FN macros. The cleanup handler is also capable of releasing REPY_Handle instances and freeing memory using recomp_free for you as well, but those cases must be declared manually using REPY_FN_DEFER_RELEASE and REPY_FN_DEFER_RECOMP_FREE.
This execution scope will use the main Python interpreter.
| #define REPY_FN_SETUP_INTERP | ( | interp_index | ) |
Create an inline execution scope for your function without any globals.
The global and local scope dict objects will the same. Python's built-ins will be added whenever Python code is first executed.
REPY_FN scopes also create a REPY_DeferredCleanupHandler instance, which is used to automatically destroy any helper objects created by other REPY_FN macros. The cleanup handler is also capable of releasing REPY_Handle instances and freeing memory using recomp_free for you as well, but those cases must be declared manually using REPY_FN_DEFER_RELEASE and REPY_FN_DEFER_RECOMP_FREE.
The Python interpreter to use is defined by the interp_index argument.
| interp_index | a valid interpreter index. Should be of the type REPY_InterpreterIndex. |
| #define REPY_FN_SETUP_INTERP_WITH_GLOBALS | ( | interp_index, | |
| globals ) |
Create an inline execution scope for your function, using a pre-defined Python dict as your global scope object, and creating a new Python dict for the local scope. Note that, unless otherwise specified, executing Python code stores variables on the local scope.
If the global scope dict doesn't have Python's builtins predefined, they will be added to the dict whenever Python code is first executed.
REPY_FN scopes also create a REPY_DeferredCleanupHandler instance, which is used to automatically destroy any helper objects created by other REPY_FN macros. The cleanup handler is also capable of releasing REPY_Handle instances and freeing memory using recomp_free for you as well, but those cases must be declared manually using REPY_FN_DEFER_RELEASE and REPY_FN_DEFER_RECOMP_FREE.
The Python interpreter to use is defined by the interp_index argument.
| interp_index | a valid interpreter index. Should be of the type REPY_InterpreterIndex. |
| globals | The Python dict to use as a global scope. |
| #define REPY_FN_SETUP_WITH_GLOBALS | ( | globals | ) |
Create an inline execution scope for your function, using a pre-defined Python dict as your global scope object, and creating a new Python dict for the local scope. Note that, unless otherwise specified, executing Python code stores variables on the local scope.
If the global scope dict doesn't have Python's builtins predefined, they will be added to the dict whenever Python code is first executed.
REPY_FN scopes also create a REPY_DeferredCleanupHandler instance, which is used to automatically destroy any helper objects created by other REPY_FN macros. The cleanup handler is also capable of releasing REPY_Handle instances and freeing memory using recomp_free for you as well, but those cases must be declared manually using REPY_FN_DEFER_RELEASE and REPY_FN_DEFER_RECOMP_FREE. This execution scope will use the main Python interpreter.
| globals | The Python dict to use as a global scope. |