RecompExternalPython for N64Recompiled 2.0.0
Loading...
Searching...
No Matches

Macros

#define REPY_FN_EVAL(code_handle)
 Evaluates a Python expression code object within the current inline execution scope, and returns the result.
#define REPY_FN_EVAL_BOOL(code_handle)
 Evaluates a Python expression code object within the current inline execution scope, and returns the result as a bool.
#define REPY_FN_EVAL_U8(code_handle)
 Evaluates a Python expression code object within the current inline execution scope, and returns the result as a u8.
#define REPY_FN_EVAL_S8(code_handle)
 Evaluates a Python expression code object within the current inline execution scope, and returns the result as a s8.
#define REPY_FN_EVAL_U16(code_handle)
 Evaluates a Python expression code object within the current inline execution scope, and returns the result as a u16.
#define REPY_FN_EVAL_S16(code_handle)
 Evaluates a Python expression code object within the current inline execution scope, and returns the result as a s16.
#define REPY_FN_EVAL_U32(code_handle)
 Evaluates a Python expression code object within the current inline execution scope, and returns the result as a u32.
#define REPY_FN_EVAL_S32(code_handle)
 Evaluates a Python expression code object within the current inline execution scope, and returns the result as a s32.
#define REPY_FN_EVAL_F32(code_handle)
 Evaluates a Python expression code object within the current inline execution scope, and returns the result as a f32.
#define REPY_FN_EVAL_U64(code_handle)
 Evaluates a Python expression code object within the current inline execution scope, and returns the result as a u64.
#define REPY_FN_EVAL_S64(code_handle)
 Evaluates a Python expression code object within the current inline execution scope, and returns the result as a s64.
#define REPY_FN_EVAL_F64(code_handle)
 Evaluates a Python expression code object within the current inline execution scope, and returns the result as a f64.
#define REPY_FN_EVAL_STR(code_handle)
 Evaluates a Python expression code object within the current inline execution scope, and returns the result as a char* C string.
#define REPY_FN_EVAL_BYTESTR(code_handle)
 Evaluates a Python expression code object within the current inline execution scope, and returns the result as a char* C string.
#define REPY_FN_EVAL_CSTR(code_str)
 Evaluates a Python expression code string within the current inline execution scope, and returns the result.
#define REPY_FN_EVAL_CSTR_BOOL(code_str)
 Evaluates a Python expression code string within the current inline execution scope, and returns the result as a bool.
#define REPY_FN_EVAL_CSTR_U8(code_str)
 Evaluates a Python expression code string within the current inline execution scope, and returns the result as a u8.
#define REPY_FN_EVAL_CSTR_S8(code_str)
 Evaluates a Python expression code string within the current inline execution scope, and returns the result as a s8.
#define REPY_FN_EVAL_CSTR_U16(code_str)
 Evaluates a Python expression code string within the current inline execution scope, and returns the result as a u16.
#define REPY_FN_EVAL_CSTR_S16(code_str)
 Evaluates a Python expression code string within the current inline execution scope, and returns the result as a s16.
#define REPY_FN_EVAL_CSTR_U32(code_str)
 Evaluates a Python expression code string within the current inline execution scope, and returns the result as a u32.
#define REPY_FN_EVAL_CSTR_S32(code_str)
 Evaluates a Python expression code string within the current inline execution scope, and returns the result as a s32.
#define REPY_FN_EVAL_CSTR_F32(code_str)
 Evaluates a Python expression code string within the current inline execution scope, and returns the result as a f32.
#define REPY_FN_EVAL_CSTR_U64(code_str)
 Evaluates a Python expression code string within the current inline execution scope, and returns the result as a u64.
#define REPY_FN_EVAL_CSTR_S64(code_str)
 Evaluates a Python expression code string within the current inline execution scope, and returns the result as a s64.
#define REPY_FN_EVAL_CSTR_F64(code_str)
 Evaluates a Python expression code string within the current inline execution scope, and returns the result as a f64.
#define REPY_FN_EVAL_CSTR_STR(code_str)
 Evaluates a Python expression code string within the current inline execution scope, and returns the result as a char*.
#define REPY_FN_EVAL_CSTR_BYTESTR(code_str)
 Evaluates a Python expression code string within the current inline execution scope, and returns the result as a char*.
#define REPY_FN_EVAL_CACHE(bytecode_identifier, code_str, out_var)
 Evaluate a Python expression code string within the current inline execution scope, compiling it the first time it's run and caching the bytecode for subsequent uses, and storing its result as a REPY_Handle.
#define REPY_FN_EVAL_CACHE_BOOL(bytecode_identifier, code_str, out_var)
 Evaluate a Python expression code string within the current inline execution scope, compiling it the first time it's run and caching the bytecode for subsequent uses, and storing its result as a bool.
#define REPY_FN_EVAL_CACHE_U8(bytecode_identifier, code_str, out_var)
 Evaluate a Python expression code string within the current inline execution scope, compiling it the first time it's run and caching the bytecode for subsequent uses, and storing its result as a u8.
#define REPY_FN_EVAL_CACHE_S8(bytecode_identifier, code_str, out_var)
 Evaluate a Python expression code string within the current inline execution scope, compiling it the first time it's run and caching the bytecode for subsequent uses, and storing its result as a s8.
#define REPY_FN_EVAL_CACHE_U16(bytecode_identifier, code_str, out_var)
 Evaluate a Python expression code string within the current inline execution scope, compiling it the first time it's run and caching the bytecode for subsequent uses, and storing its result as a u16.
#define REPY_FN_EVAL_CACHE_S16(bytecode_identifier, code_str, out_var)
 Evaluate a Python expression code string within the current inline execution scope, compiling it the first time it's run and caching the bytecode for subsequent uses, and storing its result as a s16.
#define REPY_FN_EVAL_CACHE_U32(bytecode_identifier, code_str, out_var)
 Evaluate a Python expression code string within the current inline execution scope, compiling it the first time it's run and caching the bytecode for subsequent uses, and storing its result as a u32.
#define REPY_FN_EVAL_CACHE_S32(bytecode_identifier, code_str, out_var)
 Evaluate a Python expression code string within the current inline execution scope, compiling it the first time it's run and caching the bytecode for subsequent uses, and storing its result as a s32.
#define REPY_FN_EVAL_CACHE_F32(bytecode_identifier, code_str, out_var)
 Evaluate a Python expression code string within the current inline execution scope, compiling it the first time it's run and caching the bytecode for subsequent uses, and storing its result as a f32.
#define REPY_FN_EVAL_CACHE_U64(bytecode_identifier, code_str, out_var)
 Evaluate a Python expression code string within the current inline execution scope, compiling it the first time it's run and caching the bytecode for subsequent uses, and storing its result as a u64.
#define REPY_FN_EVAL_CACHE_S64(bytecode_identifier, code_str, out_var)
 Evaluate a Python expression code string within the current inline execution scope, compiling it the first time it's run and caching the bytecode for subsequent uses, and storing its result as a s64.
#define REPY_FN_EVAL_CACHE_F64(bytecode_identifier, code_str, out_var)
 Evaluate a Python expression code string within the current inline execution scope, compiling it the first time it's run and caching the bytecode for subsequent uses, and storing its result as a f64.
#define REPY_FN_EVAL_CACHE_STR(bytecode_identifier, code_str, out_var)
 Evaluate a Python expression code string within the current inline execution scope, compiling it the first time it's run and caching the bytecode for subsequent uses, and storing its result as a char*.
#define REPY_FN_EVAL_CACHE_BYTESTR(bytecode_identifier, code_str, out_var)
 Evaluate a Python expression code string within the current inline execution scope, compiling it the first time it's run and caching the bytecode for subsequent uses, and storing its result as a char*.

Detailed Description

Evaluate Python code expressions and get the results. For convienience, many common casting operations have their own dedicated variant macro.

Macro Definition Documentation

◆ REPY_FN_EVAL

#define REPY_FN_EVAL ( code_handle)
Value:
REPY_Handle REPY_Eval(REPY_Handle code, REPY_Handle global_scope_nullable, REPY_Handle local_scope_nullable)
Evaluate a Python code expression from a REPY_Handle. Optionally provide dict objects to serve as a s...
#define REPY_FN_GLOBAL_SCOPE
The variable name for inline execution global scopes.
Definition repy_api.h:750
#define REPY_FN_LOCAL_SCOPE
The variable name for inline execution local scopes.
Definition repy_api.h:756

Evaluates a Python expression code object within the current inline execution scope, and returns the result.

The expression to evaluate should already be a Python object. A precompiled bytecode object is recommended for performance reasons, but a Python str object will also work.

Parameters
code_handleThe Python expression to evaluate. Should be a REPY_Handle to a valid code object.
Returns
a REPY_Handle for the resultant Python object. Will be REPY_NO_OBJECT if an error has occured.

◆ REPY_FN_EVAL_BOOL

#define REPY_FN_EVAL_BOOL ( code_handle)
Value:
REPY_Handle REPY_MakeSUH(REPY_Handle py_handle_no_release)
Convienience function that marks a REPY_Handle as Single-Use and then returns the value of the provid...
REPY_bool REPY_CastBool(REPY_Handle object)
Casts a Python object to a C bool.

Evaluates a Python expression code object within the current inline execution scope, and returns the result as a bool.

The expression to evaluate should already be a Python object. A precompiled bytecode object is recommended for performance reasons, but a Python str object will also work.

Parameters
code_handleThe Python expression to evaluate. Should be a REPY_Handle to a valid code object.
Returns
The resultant Python object, cast to bool.

◆ REPY_FN_EVAL_BYTESTR

#define REPY_FN_EVAL_BYTESTR ( code_handle)
Value:
char * REPY_CastByteStr(REPY_Handle object)
Casts a Python object to a NULL-terminated C string. Intended to be used with a Python bytes.

Evaluates a Python expression code object within the current inline execution scope, and returns the result as a char* C string.

The expression to evaluate should already be a Python object. A precompiled bytecode object is recommended for performance reasons, but a Python str object will also work.

Intended to be used when the result of the evaluation is a Python bytes object.

The C string returned by this macro will need to be freed with recomp_free. Failure to do so will result in a memory leak.

Parameters
code_handleThe Python expression to evaluate. Should be a REPY_Handle to a valid code object.
Returns
The resultant Python object, cast to char*.

◆ REPY_FN_EVAL_CACHE

#define REPY_FN_EVAL_CACHE ( bytecode_identifier,
code_str,
out_var )
Value:
REPY_INLINE_COMPILE_CACHE_BLOCK("REPY_FN_EVAL_CACHE", bytecode_identifier, REPY_CODE_EVAL, code_str) \
REPY_Handle out_var = REPY_FN_EVAL(bytecode_identifier)
#define REPY_FN_EVAL(code_handle)
Evaluates a Python expression code object within the current inline execution scope,...
Definition repy_api.h:967
unsigned int REPY_Handle
Represents a Python object in REPY API functions.
Definition repy_api.h:201
#define REPY_INLINE_COMPILE_CACHE_BLOCK(category, bytecode_identifier, code_mode, code_str)
Inside a function, construct a code block that compiles to bytecode a Python code string the first ti...
Definition repy_api.h:619
@ REPY_CODE_EVAL
Equivalent to eval.
Definition repy_api.h:146

Evaluate a Python expression code string within the current inline execution scope, compiling it the first time it's run and caching the bytecode for subsequent uses, and storing its result as a REPY_Handle.

The various REPY_FN_EVAL_CACHE macros are the recommended method of inlining Python expression evaluations inside of functions. The performance difference made by not having to recompile the code strings into bytecode for every run is substantial.

Because this macro expands to a block of code, rather than a single funtion call, the evaluation is stored in a REPY_Handle variable named using the out_var argument. If out_var is REPY_NO_OBJECT, a Python error has occured.

Parameters
bytecode_identifierThe name for a static variable that will hold the Python bytecode handle once created.
code_strThe Python expression to evaluate. Should be a NULL-terminated C-string such as a string literal. This code string will only be parsed and compiled once.
out_varThe name of a REPY_Handle argument that will hold the expression result.

◆ REPY_FN_EVAL_CACHE_BOOL

#define REPY_FN_EVAL_CACHE_BOOL ( bytecode_identifier,
code_str,
out_var )
Value:
REPY_INLINE_COMPILE_CACHE_BLOCK("REPY_FN_EVAL_CACHE_BOOL", bytecode_identifier, REPY_CODE_EVAL, code_str) \
bool out_var = REPY_FN_EVAL_BOOL(bytecode_identifier)
#define REPY_FN_EVAL_BOOL(code_handle)
Evaluates a Python expression code object within the current inline execution scope,...
Definition repy_api.h:979

Evaluate a Python expression code string within the current inline execution scope, compiling it the first time it's run and caching the bytecode for subsequent uses, and storing its result as a bool.

The various REPY_FN_EVAL_CACHE macros are the recommended method of inlining Python expression evaluations inside of functions. The performance difference made by not having to recompile the code strings into bytecode for every run is substantial.

Because this macro expands to a block of code, rather than a single funtion call, the evaluation is stored in a bool variable named using the out_var argument.

Parameters
bytecode_identifierThe name for a static variable that will hold the Python bytecode handle once created.
code_strThe Python expression to evaluate. Should be a NULL-terminated C-string such as a string literal. This code string will only be parsed and compiled once.
out_varThe name of a bool argument that will hold the expression result.

◆ REPY_FN_EVAL_CACHE_BYTESTR

#define REPY_FN_EVAL_CACHE_BYTESTR ( bytecode_identifier,
code_str,
out_var )
Value:
REPY_INLINE_COMPILE_CACHE_BLOCK("REPY_FN_EVAL_CACHE_BYTESTR", bytecode_identifier, REPY_CODE_EVAL, code_str) \
char* out_var = REPY_FN_EVAL_BYTESTR(bytecode_identifier)
#define REPY_FN_EVAL_BYTESTR(code_handle)
Evaluates a Python expression code object within the current inline execution scope,...
Definition repy_api.h:1132

Evaluate a Python expression code string within the current inline execution scope, compiling it the first time it's run and caching the bytecode for subsequent uses, and storing its result as a char*.

The various REPY_FN_EVAL_CACHE macros are the recommended method of inlining Python expression evaluations inside of functions. The performance difference made by not having to recompile the code strings into bytecode for every run is substantial.

Because this macro expands to a block of code, rather than a single funtion call, the evaluation is stored in a char* variable named using the out_var argument. The C string stored in out_var will need to be freed with recomp_free. Failure to do so will result in a memory leak.

Intended to be used when the result of the evaluation is a Python bytes object.

Parameters
bytecode_identifierThe name for a static variable that will hold the Python bytecode handle once created.
code_strThe Python expression to evaluate. Should be a NULL-terminated C-string such as a string literal. This code string will only be parsed and compiled once.
out_varThe name of a char* argument that will hold the expression result.

◆ REPY_FN_EVAL_CACHE_F32

#define REPY_FN_EVAL_CACHE_F32 ( bytecode_identifier,
code_str,
out_var )
Value:
REPY_INLINE_COMPILE_CACHE_BLOCK("REPY_FN_EVAL_CACHE_F32", bytecode_identifier, REPY_CODE_EVAL, code_str) \
REPY_f32 out_var = REPY_FN_EVAL_F32(bytecode_identifier)
#define REPY_FN_EVAL_F32(code_handle)
Evaluates a Python expression code object within the current inline execution scope,...
Definition repy_api.h:1063
float REPY_f32
A 32-bit floating point value compatible with libultra's f32.
Definition repy_api.h:119

Evaluate a Python expression code string within the current inline execution scope, compiling it the first time it's run and caching the bytecode for subsequent uses, and storing its result as a f32.

The various REPY_FN_EVAL_CACHE macros are the recommended method of inlining Python expression evaluations inside of functions. The performance difference made by not having to recompile the code strings into bytecode for every run is substantial.

Because this macro expands to a block of code, rather than a single funtion call, the evaluation is stored in a f32 variable named using the out_var argument.

Parameters
bytecode_identifierThe name for a static variable that will hold the Python bytecode handle once created.
code_strThe Python expression to evaluate. Should be a NULL-terminated C-string such as a string literal. This code string will only be parsed and compiled once.
out_varThe name of a f32 argument that will hold the expression result.

◆ REPY_FN_EVAL_CACHE_F64

#define REPY_FN_EVAL_CACHE_F64 ( bytecode_identifier,
code_str,
out_var )
Value:
REPY_INLINE_COMPILE_CACHE_BLOCK("REPY_FN_EVAL_CACHE_F64", bytecode_identifier, REPY_CODE_EVAL, code_str) \
REPY_f64 out_var = REPY_FN_EVAL_F64(bytecode_identifier)
#define REPY_FN_EVAL_F64(code_handle)
Evaluates a Python expression code object within the current inline execution scope,...
Definition repy_api.h:1099
double REPY_f64
A 64-bit floating point value compatible with libultra's f64.
Definition repy_api.h:126

Evaluate a Python expression code string within the current inline execution scope, compiling it the first time it's run and caching the bytecode for subsequent uses, and storing its result as a f64.

The various REPY_FN_EVAL_CACHE macros are the recommended method of inlining Python expression evaluations inside of functions. The performance difference made by not having to recompile the code strings into bytecode for every run is substantial.

Because this macro expands to a block of code, rather than a single funtion call, the evaluation is stored in a f64 variable named using the out_var argument.

Parameters
bytecode_identifierThe name for a static variable that will hold the Python bytecode handle once created.
code_strThe Python expression to evaluate. Should be a NULL-terminated C-string such as a string literal. This code string will only be parsed and compiled once.
out_varThe name of a f64 argument that will hold the expression result.

◆ REPY_FN_EVAL_CACHE_S16

#define REPY_FN_EVAL_CACHE_S16 ( bytecode_identifier,
code_str,
out_var )
Value:
REPY_INLINE_COMPILE_CACHE_BLOCK("REPY_FN_EVAL_CACHE_S16", bytecode_identifier, REPY_CODE_EVAL, code_str) \
REPY_s16 out_var = REPY_FN_EVAL_S16(bytecode_identifier)
#define REPY_FN_EVAL_S16(code_handle)
Evaluates a Python expression code object within the current inline execution scope,...
Definition repy_api.h:1027
signed short int REPY_s16
A signed, 16-bit integer compatible with libultra's s16.
Definition repy_api.h:77

Evaluate a Python expression code string within the current inline execution scope, compiling it the first time it's run and caching the bytecode for subsequent uses, and storing its result as a s16.

The various REPY_FN_EVAL_CACHE macros are the recommended method of inlining Python expression evaluations inside of functions. The performance difference made by not having to recompile the code strings into bytecode for every run is substantial.

Because this macro expands to a block of code, rather than a single funtion call, the evaluation is stored in a s16 variable named using the out_var argument.

Parameters
bytecode_identifierThe name for a static variable that will hold the Python bytecode handle once created.
code_strThe Python expression to evaluate. Should be a NULL-terminated C-string such as a string literal. This code string will only be parsed and compiled once.
out_varThe name of a s16 argument that will hold the expression result.

◆ REPY_FN_EVAL_CACHE_S32

#define REPY_FN_EVAL_CACHE_S32 ( bytecode_identifier,
code_str,
out_var )
Value:
REPY_INLINE_COMPILE_CACHE_BLOCK("REPY_FN_EVAL_CACHE_S32", bytecode_identifier, REPY_CODE_EVAL, code_str) \
REPY_s32 out_var = REPY_FN_EVAL_S32(bytecode_identifier)
#define REPY_FN_EVAL_S32(code_handle)
Evaluates a Python expression code object within the current inline execution scope,...
Definition repy_api.h:1051
signed long REPY_s32
A signed, 32-bit integer compatible with libultra's s32.
Definition repy_api.h:91

Evaluate a Python expression code string within the current inline execution scope, compiling it the first time it's run and caching the bytecode for subsequent uses, and storing its result as a s32.

The various REPY_FN_EVAL_CACHE macros are the recommended method of inlining Python expression evaluations inside of functions. The performance difference made by not having to recompile the code strings into bytecode for every run is substantial.

Because this macro expands to a block of code, rather than a single funtion call, the evaluation is stored in a s32 variable named using the out_var argument.

Parameters
bytecode_identifierThe name for a static variable that will hold the Python bytecode handle once created.
code_strThe Python expression to evaluate. Should be a NULL-terminated C-string such as a string literal. This code string will only be parsed and compiled once.
out_varThe name of a s32 argument that will hold the expression result.

◆ REPY_FN_EVAL_CACHE_S64

#define REPY_FN_EVAL_CACHE_S64 ( bytecode_identifier,
code_str,
out_var )
Value:
REPY_INLINE_COMPILE_CACHE_BLOCK("REPY_FN_EVAL_CACHE_S64", bytecode_identifier, REPY_CODE_EVAL, code_str) \
REPY_s64 out_var = REPY_FN_EVAL_S64(bytecode_identifier)
#define REPY_FN_EVAL_S64(code_handle)
Evaluates a Python expression code object within the current inline execution scope,...
Definition repy_api.h:1087
signed long long int REPY_s64
A signed, 64-bit integer compatible with libultra's s64.
Definition repy_api.h:105

Evaluate a Python expression code string within the current inline execution scope, compiling it the first time it's run and caching the bytecode for subsequent uses, and storing its result as a s64.

The various REPY_FN_EVAL_CACHE macros are the recommended method of inlining Python expression evaluations inside of functions. The performance difference made by not having to recompile the code strings into bytecode for every run is substantial.

Because this macro expands to a block of code, rather than a single funtion call, the evaluation is stored in a s64 variable named using the out_var argument.

Parameters
bytecode_identifierThe name for a static variable that will hold the Python bytecode handle once created.
code_strThe Python expression to evaluate. Should be a NULL-terminated C-string such as a string literal. This code string will only be parsed and compiled once.
out_varThe name of a s64 argument that will hold the expression result.

◆ REPY_FN_EVAL_CACHE_S8

#define REPY_FN_EVAL_CACHE_S8 ( bytecode_identifier,
code_str,
out_var )
Value:
REPY_INLINE_COMPILE_CACHE_BLOCK("REPY_FN_EVAL_CACHE_S8", bytecode_identifier, REPY_CODE_EVAL, code_str) \
REPY_s8 out_var = REPY_FN_EVAL_S8(bytecode_identifier)
#define REPY_FN_EVAL_S8(code_handle)
Evaluates a Python expression code object within the current inline execution scope,...
Definition repy_api.h:1003
signed char REPY_s8
A signed, 8-bit integer compatible with libultra's s8.
Definition repy_api.h:63

Evaluate a Python expression code string within the current inline execution scope, compiling it the first time it's run and caching the bytecode for subsequent uses, and storing its result as a s8.

The various REPY_FN_EVAL_CACHE macros are the recommended method of inlining Python expression evaluations inside of functions. The performance difference made by not having to recompile the code strings into bytecode for every run is substantial.

Because this macro expands to a block of code, rather than a single funtion call, the evaluation is stored in a s8 variable named using the out_var argument.

Parameters
bytecode_identifierThe name for a static variable that will hold the Python bytecode handle once created.
code_strThe Python expression to evaluate. Should be a NULL-terminated C-string such as a string literal. This code string will only be parsed and compiled once.
out_varThe name of a s8 argument that will hold the expression result.

◆ REPY_FN_EVAL_CACHE_STR

#define REPY_FN_EVAL_CACHE_STR ( bytecode_identifier,
code_str,
out_var )
Value:
REPY_INLINE_COMPILE_CACHE_BLOCK("REPY_FN_EVAL_CACHE_STR", bytecode_identifier, REPY_CODE_EVAL, code_str) \
char* out_var = REPY_FN_EVAL_STR(bytecode_identifier)
#define REPY_FN_EVAL_STR(code_handle)
Evaluates a Python expression code object within the current inline execution scope,...
Definition repy_api.h:1115

Evaluate a Python expression code string within the current inline execution scope, compiling it the first time it's run and caching the bytecode for subsequent uses, and storing its result as a char*.

The various REPY_FN_EVAL_CACHE macros are the recommended method of inlining Python expression evaluations inside of functions. The performance difference made by not having to recompile the code strings into bytecode for every run is substantial.

Because this macro expands to a block of code, rather than a single funtion call, the evaluation is stored in a char* variable named using the out_var argument. The C string stored in out_var will need to be freed with recomp_free. Failure to do so will result in a memory leak.

Intended to be used when the result of the evaluation is a Python str object.

Parameters
bytecode_identifierThe name for a static variable that will hold the Python bytecode handle once created.
code_strThe Python expression to evaluate. Should be a NULL-terminated C-string such as a string literal. This code string will only be parsed and compiled once.
out_varThe name of a char* argument that will hold the expression result.

◆ REPY_FN_EVAL_CACHE_U16

#define REPY_FN_EVAL_CACHE_U16 ( bytecode_identifier,
code_str,
out_var )
Value:
REPY_INLINE_COMPILE_CACHE_BLOCK("REPY_FN_EVAL_CACHE_U16", bytecode_identifier, REPY_CODE_EVAL, code_str) \
REPY_u16 out_var = REPY_FN_EVAL_U16(bytecode_identifier)
#define REPY_FN_EVAL_U16(code_handle)
Evaluates a Python expression code object within the current inline execution scope,...
Definition repy_api.h:1015
unsigned short int REPY_u16
An unsigned, 16-bit integer compatible with libultra's u16.
Definition repy_api.h:84

Evaluate a Python expression code string within the current inline execution scope, compiling it the first time it's run and caching the bytecode for subsequent uses, and storing its result as a u16.

The various REPY_FN_EVAL_CACHE macros are the recommended method of inlining Python expression evaluations inside of functions. The performance difference made by not having to recompile the code strings into bytecode for every run is substantial.

Because this macro expands to a block of code, rather than a single funtion call, the evaluation is stored in a u16 variable named using the out_var argument.

Parameters
bytecode_identifierThe name for a static variable that will hold the Python bytecode handle once created.
code_strThe Python expression to evaluate. Should be a NULL-terminated C-string such as a string literal. This code string will only be parsed and compiled once.
out_varThe name of a u16 argument that will hold the expression result.

◆ REPY_FN_EVAL_CACHE_U32

#define REPY_FN_EVAL_CACHE_U32 ( bytecode_identifier,
code_str,
out_var )
Value:
REPY_INLINE_COMPILE_CACHE_BLOCK("REPY_FN_EVAL_CACHE_U32", bytecode_identifier, REPY_CODE_EVAL, code_str) \
REPY_u32 out_var = REPY_FN_EVAL_U32(bytecode_identifier)
#define REPY_FN_EVAL_U32(code_handle)
Evaluates a Python expression code object within the current inline execution scope,...
Definition repy_api.h:1039
unsigned long REPY_u32
An unsigned, 13-bit integer compatible with libultra's u32.
Definition repy_api.h:98

Evaluate a Python expression code string within the current inline execution scope, compiling it the first time it's run and caching the bytecode for subsequent uses, and storing its result as a u32.

The various REPY_FN_EVAL_CACHE macros are the recommended method of inlining Python expression evaluations inside of functions. The performance difference made by not having to recompile the code strings into bytecode for every run is substantial.

Because this macro expands to a block of code, rather than a single funtion call, the evaluation is stored in a u32 variable named using the out_var argument.

Parameters
bytecode_identifierThe name for a static variable that will hold the Python bytecode handle once created.
code_strThe Python expression to evaluate. Should be a NULL-terminated C-string such as a string literal. This code string will only be parsed and compiled once.
out_varThe name of a u32 argument that will hold the expression result.

◆ REPY_FN_EVAL_CACHE_U64

#define REPY_FN_EVAL_CACHE_U64 ( bytecode_identifier,
code_str,
out_var )
Value:
REPY_INLINE_COMPILE_CACHE_BLOCK("REPY_FN_EVAL_CACHE_U64", bytecode_identifier, REPY_CODE_EVAL, code_str) \
REPY_u64 out_var = REPY_FN_EVAL_U64(bytecode_identifier)
#define REPY_FN_EVAL_U64(code_handle)
Evaluates a Python expression code object within the current inline execution scope,...
Definition repy_api.h:1075
unsigned long long int REPY_u64
An unsigned, 64-bit integer compatible with libultra's u64.
Definition repy_api.h:112

Evaluate a Python expression code string within the current inline execution scope, compiling it the first time it's run and caching the bytecode for subsequent uses, and storing its result as a u64.

The various REPY_FN_EVAL_CACHE macros are the recommended method of inlining Python expression evaluations inside of functions. The performance difference made by not having to recompile the code strings into bytecode for every run is substantial.

Because this macro expands to a block of code, rather than a single funtion call, the evaluation is stored in a u64 variable named using the out_var argument.

Parameters
bytecode_identifierThe name for a static variable that will hold the Python bytecode handle once created.
code_strThe Python expression to evaluate. Should be a NULL-terminated C-string such as a string literal. This code string will only be parsed and compiled once.
out_varThe name of a u64 argument that will hold the expression result.

◆ REPY_FN_EVAL_CACHE_U8

#define REPY_FN_EVAL_CACHE_U8 ( bytecode_identifier,
code_str,
out_var )
Value:
REPY_INLINE_COMPILE_CACHE_BLOCK("REPY_FN_EVAL_CACHE_U8", bytecode_identifier, REPY_CODE_EVAL, code_str) \
REPY_u8 out_var = REPY_FN_EVAL_U8(bytecode_identifier)
#define REPY_FN_EVAL_U8(code_handle)
Evaluates a Python expression code object within the current inline execution scope,...
Definition repy_api.h:991
unsigned char REPY_u8
An unsigned, 8-bit integer compatible with libultra's u8.
Definition repy_api.h:70

Evaluate a Python expression code string within the current inline execution scope, compiling it the first time it's run and caching the bytecode for subsequent uses, and storing its result as a u8.

The various REPY_FN_EVAL_CACHE macros are the recommended method of inlining Python expression evaluations inside of functions. The performance difference made by not having to recompile the code strings into bytecode for every run is substantial.

Because this macro expands to a block of code, rather than a single funtion call, the evaluation is stored in a u8 variable named using the out_var argument.

Parameters
bytecode_identifierThe name for a static variable that will hold the Python bytecode handle once created.
code_strThe Python expression to evaluate. Should be a NULL-terminated C-string such as a string literal. This code string will only be parsed and compiled once.
out_varThe name of a u8 argument that will hold the expression result.

◆ REPY_FN_EVAL_CSTR

#define REPY_FN_EVAL_CSTR ( code_str)
Value:
REPY_Handle REPY_EvalCStr(const char *code, REPY_Handle global_scope_nullable, REPY_Handle local_scope_nullable)
Evaluate a Python code expression from a NULL-terminated C string. Optionally provide dict objects to...

Evaluates a Python expression code string within the current inline execution scope, and returns the result.

Not generally recommended, since this will require recompiling the Python code string every time it's run, which will result in significant slowdown. It is technically faster than REPY_FN_EVAL_CACHE for code that is only used once (since one fewer handle lookup is involved), but the difference is so marginal that it really doesn't matter.

Parameters
code_strThe Python expression to evaluate. Should be a REPY_Handle to a valid code object.
Returns
a REPY_Handle for the resultant Python object. Will be REPY_NO_OBJECT if an error has occured.

◆ REPY_FN_EVAL_CSTR_BOOL

#define REPY_FN_EVAL_CSTR_BOOL ( code_str)
Value:

Evaluates a Python expression code string within the current inline execution scope, and returns the result as a bool.

Not generally recommended, since this will require recompiling the Python code string every time it's run, which will result in significant slowdown. It is technically faster than REPY_FN_EVAL_CACHE_BOOL for code that is only used once (since one fewer handle lookup is involved), but the difference is so marginal that it really doesn't matter.

Parameters
code_strThe Python expression to evaluate. Should be a REPY_Handle to a valid code object.
Returns
The resultant Python object, cast to bool.

◆ REPY_FN_EVAL_CSTR_BYTESTR

#define REPY_FN_EVAL_CSTR_BYTESTR ( code_str)
Value:

Evaluates a Python expression code string within the current inline execution scope, and returns the result as a char*.

Not generally recommended, since this will require recompiling the Python code string every time it's run, which will result in significant slowdown. It is technically faster than REPY_FN_EVAL_CACHE_BYTESTR for code that is only used once (since one fewer handle lookup is involved), but the difference is so marginal that it really doesn't matter.

Intended to be used when the result of the evaluation is a Python bytes object.

The C string returned by this macro will need to be freed with recomp_free. Failure to do so will result in a memory leak.

Parameters
code_strThe Python expression to evaluate. Should be a REPY_Handle to a valid code object.
Returns
The resultant Python object, cast to char*.

◆ REPY_FN_EVAL_CSTR_F32

#define REPY_FN_EVAL_CSTR_F32 ( code_str)
Value:
REPY_f32 REPY_CastF32(REPY_Handle object)
Casts a Python object to a C f32.

Evaluates a Python expression code string within the current inline execution scope, and returns the result as a f32.

Not generally recommended, since this will require recompiling the Python code string every time it's run, which will result in significant slowdown. It is technically faster than REPY_FN_EVAL_CACHE_F32 for code that is only used once (since one fewer handle lookup is involved), but the difference is so marginal that it really doesn't matter.

Parameters
code_strThe Python expression to evaluate. Should be a REPY_Handle to a valid code object.
Returns
The resultant Python object, cast to f32.

◆ REPY_FN_EVAL_CSTR_F64

#define REPY_FN_EVAL_CSTR_F64 ( code_str)
Value:
REPY_f64 REPY_CastF64(REPY_Handle object)
Casts a Python object to a C u8.

Evaluates a Python expression code string within the current inline execution scope, and returns the result as a f64.

Not generally recommended, since this will require recompiling the Python code string every time it's run, which will result in significant slowdown. It is technically faster than REPY_FN_EVAL_CACHE_F64 for code that is only used once (since one fewer handle lookup is involved), but the difference is so marginal that it really doesn't matter.

Parameters
code_strThe Python expression to evaluate. Should be a REPY_Handle to a valid code object.
Returns
The resultant Python object, cast to f64.

◆ REPY_FN_EVAL_CSTR_S16

#define REPY_FN_EVAL_CSTR_S16 ( code_str)
Value:
REPY_s16 REPY_CastS16(REPY_Handle object)
Casts a Python object to a C s16.

Evaluates a Python expression code string within the current inline execution scope, and returns the result as a s16.

Not generally recommended, since this will require recompiling the Python code string every time it's run, which will result in significant slowdown. It is technically faster than REPY_FN_EVAL_CACHE_S16 for code that is only used once (since one fewer handle lookup is involved), but the difference is so marginal that it really doesn't matter.

Parameters
code_strThe Python expression to evaluate. Should be a REPY_Handle to a valid code object.
Returns
The resultant Python object, cast to s16.

◆ REPY_FN_EVAL_CSTR_S32

#define REPY_FN_EVAL_CSTR_S32 ( code_str)
Value:
REPY_s32 REPY_CastS32(REPY_Handle object)
Casts a Python object to a C s32.

Evaluates a Python expression code string within the current inline execution scope, and returns the result as a s32.

Not generally recommended, since this will require recompiling the Python code string every time it's run, which will result in significant slowdown. It is technically faster than REPY_FN_EVAL_CACHE_S32 for code that is only used once (since one fewer handle lookup is involved), but the difference is so marginal that it really doesn't matter.

Parameters
code_strThe Python expression to evaluate. Should be a REPY_Handle to a valid code object.
Returns
The resultant Python object, cast to s32.

◆ REPY_FN_EVAL_CSTR_S64

#define REPY_FN_EVAL_CSTR_S64 ( code_str)
Value:
REPY_s64 REPY_CastS64(REPY_Handle object)
Casts a Python object to a C s64.

Evaluates a Python expression code string within the current inline execution scope, and returns the result as a s64.

Not generally recommended, since this will require recompiling the Python code string every time it's run, which will result in significant slowdown. It is technically faster than REPY_FN_EVAL_CACHE_S64 for code that is only used once (since one fewer handle lookup is involved), but the difference is so marginal that it really doesn't matter.

Parameters
code_strThe Python expression to evaluate. Should be a REPY_Handle to a valid code object.
Returns
The resultant Python object, cast to s64.

◆ REPY_FN_EVAL_CSTR_S8

#define REPY_FN_EVAL_CSTR_S8 ( code_str)
Value:
REPY_s8 REPY_CastS8(REPY_Handle object)
Casts a Python object to a C s8.

Evaluates a Python expression code string within the current inline execution scope, and returns the result as a s8.

Not generally recommended, since this will require recompiling the Python code string every time it's run, which will result in significant slowdown. It is technically faster than REPY_FN_EVAL_CACHE_S8 for code that is only used once (since one fewer handle lookup is involved), but the difference is so marginal that it really doesn't matter.

Parameters
code_strThe Python expression to evaluate. Should be a REPY_Handle to a valid code object.
Returns
The resultant Python object, cast to s8.

◆ REPY_FN_EVAL_CSTR_STR

#define REPY_FN_EVAL_CSTR_STR ( code_str)
Value:
char * REPY_CastStr(REPY_Handle object)
Casts a Python object to NULL-terminated C string. Intended to be used with a Python str.

Evaluates a Python expression code string within the current inline execution scope, and returns the result as a char*.

Not generally recommended, since this will require recompiling the Python code string every time it's run, which will result in significant slowdown. It is technically faster than REPY_FN_EVAL_CACHE_STR for code that is only used once (since one fewer handle lookup is involved), but the difference is so marginal that it really doesn't matter.

Intended to be used when the result of the evaluation is a Python str.

The C string returned by this macro will need to be freed with recomp_free. Failure to do so will result in a memory leak.

Parameters
code_strThe Python expression to evaluate. Should be a REPY_Handle to a valid code object.
Returns
The resultant Python object, cast to bool.

◆ REPY_FN_EVAL_CSTR_U16

#define REPY_FN_EVAL_CSTR_U16 ( code_str)
Value:
REPY_u16 REPY_CastU16(REPY_Handle object)
Casts a Python object to a C u16.

Evaluates a Python expression code string within the current inline execution scope, and returns the result as a u16.

Not generally recommended, since this will require recompiling the Python code string every time it's run, which will result in significant slowdown. It is technically faster than REPY_FN_EVAL_CACHE_U16 for code that is only used once (since one fewer handle lookup is involved), but the difference is so marginal that it really doesn't matter.

Parameters
code_strThe Python expression to evaluate. Should be a REPY_Handle to a valid code object.
Returns
The resultant Python object, cast to u16.

◆ REPY_FN_EVAL_CSTR_U32

#define REPY_FN_EVAL_CSTR_U32 ( code_str)
Value:
REPY_u32 REPY_CastU32(REPY_Handle object)
Casts a Python object to a C u32.

Evaluates a Python expression code string within the current inline execution scope, and returns the result as a u32.

Not generally recommended, since this will require recompiling the Python code string every time it's run, which will result in significant slowdown. It is technically faster than REPY_FN_EVAL_CACHE_U32 for code that is only used once (since one fewer handle lookup is involved), but the difference is so marginal that it really doesn't matter.

Parameters
code_strThe Python expression to evaluate. Should be a REPY_Handle to a valid code object.
Returns
The resultant Python object, cast to u32.

◆ REPY_FN_EVAL_CSTR_U64

#define REPY_FN_EVAL_CSTR_U64 ( code_str)
Value:
REPY_u64 REPY_CastU64(REPY_Handle object)
Casts a Python object to a C u64.

Evaluates a Python expression code string within the current inline execution scope, and returns the result as a u64.

Not generally recommended, since this will require recompiling the Python code string every time it's run, which will result in significant slowdown. It is technically faster than REPY_FN_EVAL_CACHE_U64 for code that is only used once (since one fewer handle lookup is involved), but the difference is so marginal that it really doesn't matter.

Parameters
code_strThe Python expression to evaluate. Should be a REPY_Handle to a valid code object.
Returns
The resultant Python object, cast to u64.

◆ REPY_FN_EVAL_CSTR_U8

#define REPY_FN_EVAL_CSTR_U8 ( code_str)
Value:
REPY_u8 REPY_CastU8(REPY_Handle object)
Casts a Python object to a C u8.

Evaluates a Python expression code string within the current inline execution scope, and returns the result as a u8.

Not generally recommended, since this will require recompiling the Python code string every time it's run, which will result in significant slowdown. It is technically faster than REPY_FN_EVAL_CACHE_U8 for code that is only used once (since one fewer handle lookup is involved), but the difference is so marginal that it really doesn't matter.

Parameters
code_strThe Python expression to evaluate. Should be a REPY_Handle to a valid code object.
Returns
The resultant Python object, cast to u8.

◆ REPY_FN_EVAL_F32

#define REPY_FN_EVAL_F32 ( code_handle)
Value:

Evaluates a Python expression code object within the current inline execution scope, and returns the result as a f32.

The expression to evaluate should already be a Python object. A precompiled bytecode object is recommended for performance reasons, but a Python str object will also work.

Parameters
code_handleThe Python expression to evaluate. Should be a REPY_Handle to a valid code object.
Returns
The resultant Python object, cast to f32.

◆ REPY_FN_EVAL_F64

#define REPY_FN_EVAL_F64 ( code_handle)
Value:

Evaluates a Python expression code object within the current inline execution scope, and returns the result as a f64.

The expression to evaluate should already be a Python object. A precompiled bytecode object is recommended for performance reasons, but a Python str object will also work.

Parameters
code_handleThe Python expression to evaluate. Should be a REPY_Handle to a valid code object.
Returns
The resultant Python object, cast to f64.

◆ REPY_FN_EVAL_S16

#define REPY_FN_EVAL_S16 ( code_handle)
Value:

Evaluates a Python expression code object within the current inline execution scope, and returns the result as a s16.

The expression to evaluate should already be a Python object. A precompiled bytecode object is recommended for performance reasons, but a Python str object will also work.

Parameters
code_handleThe Python expression to evaluate. Should be a REPY_Handle to a valid code object.
Returns
The resultant Python object, cast to s16.

◆ REPY_FN_EVAL_S32

#define REPY_FN_EVAL_S32 ( code_handle)
Value:

Evaluates a Python expression code object within the current inline execution scope, and returns the result as a s32.

The expression to evaluate should already be a Python object. A precompiled bytecode object is recommended for performance reasons, but a Python str object will also work.

Parameters
code_handleThe Python expression to evaluate. Should be a REPY_Handle to a valid code object.
Returns
The resultant Python object, cast to s32.

◆ REPY_FN_EVAL_S64

#define REPY_FN_EVAL_S64 ( code_handle)
Value:

Evaluates a Python expression code object within the current inline execution scope, and returns the result as a s64.

The expression to evaluate should already be a Python object. A precompiled bytecode object is recommended for performance reasons, but a Python str object will also work.

Parameters
code_handleThe Python expression to evaluate. Should be a REPY_Handle to a valid code object.
Returns
The resultant Python object, cast to s64.

◆ REPY_FN_EVAL_S8

#define REPY_FN_EVAL_S8 ( code_handle)
Value:

Evaluates a Python expression code object within the current inline execution scope, and returns the result as a s8.

The expression to evaluate should already be a Python object. A precompiled bytecode object is recommended for performance reasons, but a Python str object will also work.

Parameters
code_handleThe Python expression to evaluate. Should be a REPY_Handle to a valid code object.
Returns
The resultant Python object, cast to s8.

◆ REPY_FN_EVAL_STR

#define REPY_FN_EVAL_STR ( code_handle)
Value:

Evaluates a Python expression code object within the current inline execution scope, and returns the result as a char* C string.

The expression to evaluate should already be a Python object. A precompiled bytecode object is recommended for performance reasons, but a Python str object will also work.

Intended to be used when the result of the evaluation is a Python str.

The C string returned by this macro will need to be freed with recomp_free. Failure to do so will result in a memory leak.

Parameters
code_handleThe Python expression to evaluate. Should be a REPY_Handle to a valid code object.
Returns
The resultant Python object, cast to char*.

◆ REPY_FN_EVAL_U16

#define REPY_FN_EVAL_U16 ( code_handle)
Value:

Evaluates a Python expression code object within the current inline execution scope, and returns the result as a u16.

The expression to evaluate should already be a Python object. A precompiled bytecode object is recommended for performance reasons, but a Python str object will also work.

Parameters
code_handleThe Python expression to evaluate. Should be a REPY_Handle to a valid code object.
Returns
The resultant Python object, cast to u16.

◆ REPY_FN_EVAL_U32

#define REPY_FN_EVAL_U32 ( code_handle)
Value:

Evaluates a Python expression code object within the current inline execution scope, and returns the result as a u32.

The expression to evaluate should already be a Python object. A precompiled bytecode object is recommended for performance reasons, but a Python str object will also work.

Parameters
code_handleThe Python expression to evaluate. Should be a REPY_Handle to a valid code object.
Returns
The resultant Python object, cast to u32.

◆ REPY_FN_EVAL_U64

#define REPY_FN_EVAL_U64 ( code_handle)
Value:

Evaluates a Python expression code object within the current inline execution scope, and returns the result as a u64.

The expression to evaluate should already be a Python object. A precompiled bytecode object is recommended for performance reasons, but a Python str object will also work.

Parameters
code_handleThe Python expression to evaluate. Should be a REPY_Handle to a valid code object.
Returns
The resultant Python object, cast to u64.

◆ REPY_FN_EVAL_U8

#define REPY_FN_EVAL_U8 ( code_handle)
Value:

Evaluates a Python expression code object within the current inline execution scope, and returns the result as a u8.

The expression to evaluate should already be a Python object. A precompiled bytecode object is recommended for performance reasons, but a Python str object will also work.

Parameters
code_handleThe Python expression to evaluate. Should be a REPY_Handle to a valid code object.
Returns
The resultant Python object, cast to u8.