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

Macros

#define REPY_FN_IMPORT(module_name)
 Inserts a Python module into the local scope.
#define REPY_FN_GET(var_name)
 Gets a variable from the local scope.
#define REPY_FN_SET(var_name, py_object)
 Sets a variable in the the local scope, using a REPY_Handle for the value.
#define REPY_FN_GET_BOOL(var_name)
 Gets a variable from the local scope and casts it to a bool.
#define REPY_FN_SET_BOOL(var_name, value)
 Sets a variable of the Python type bool in the the local scope, using a bool for the value.
#define REPY_FN_GET_U8(var_name)
 Gets a variable from the local scope and casts it to a u8.
#define REPY_FN_SET_U8(var_name, value)
 Sets a variable of the Python type int in the the local scope, using a u8 for the value.
#define REPY_FN_GET_S8(var_name)
 Gets a variable from the local scope and casts it to a s8.
#define REPY_FN_SET_S8(var_name, value)
 Sets a variable of the Python type int in the the local scope, using a s8 for the value.
#define REPY_FN_GET_U16(var_name)
 Gets a variable from the local scope and casts it to a u16.
#define REPY_FN_SET_U16(var_name, value)
 Sets a variable of the Python type int in the the local scope, using a u16 for the value.
#define REPY_FN_GET_S16(var_name)
 Gets a variable from the local scope and casts it to a s16.
#define REPY_FN_SET_S16(var_name, value)
 Sets a variable of the Python type int in the the local scope, using a s16 for the value.
#define REPY_FN_GET_U32(var_name)
 Gets a variable from the local scope and casts it to a u32.
#define REPY_FN_SET_U32(var_name, value)
 Sets a variable of the Python type int in the the local scope, using a u32 for the value.
#define REPY_FN_GET_S32(var_name)
 Gets a variable from the local scope and casts it to a s32.
#define REPY_FN_SET_S32(var_name, value)
 Sets a variable of the Python type int in the the local scope, using a s32 for the value.
#define REPY_FN_GET_F32(var_name)
 Gets a variable from the local scope and casts it to a f32.
#define REPY_FN_SET_F32(var_name, value)
 Sets a variable of the Python type float in the the local scope, using a f32 for the value.
#define REPY_FN_GET_U64(var_name)
 Gets a variable from the local scope and casts it to a u64.
#define REPY_FN_SET_U64(var_name, value)
 Sets a variable of the Python type int in the the local scope, using a u64 for the value.
#define REPY_FN_GET_S64(var_name)
 Gets a variable from the local scope and casts it to a s64.
#define REPY_FN_SET_S64(var_name, value)
 Sets a variable of the Python type int in the the local scope, using a s64 for the value.
#define REPY_FN_GET_F64(var_name)
 Gets a variable from the local scope and casts it to a f64.
#define REPY_FN_SET_F64(var_name, value)
 Sets a variable of the Python type float in the the local scope, using a f64 for the value.
#define REPY_FN_GET_STR(var_name)
 Gets a variable from the local scope and casts it to a char*. Intended to be used when the variable object is a Python str.
#define REPY_FN_SET_STR(var_name, value)
 Sets a variable of the Python type str in the the local scope, using a NULL-terminated C string.
#define REPY_FN_SET_STR_N(var_name, value, len)
 Sets a variable of the Python type str in the the local scope, using char array of N length for the value.
#define REPY_FN_GET_BYTESTR(var_name)
 Gets a variable from the local scope and casts it to a char*. Intended to be used when the variable object is a Python bytes.
#define REPY_FN_SET_BYTESTR(var_name, value)
 Sets a variable of the Python type str in the the local scope, using a NULL-terminated C string.
#define REPY_FN_SET_BYTESTR_N(var_name, value, len)
 Sets a variable of the Python type bytes in the the local scope, using char array of N length for the value.

Detailed Description

Add variables to the Python scope, and retrieve handles and values. For convenience, many common casting operations have their own variant macros.

Macro Definition Documentation

◆ REPY_FN_GET

#define REPY_FN_GET ( var_name)
Value:
REPY_Handle REPY_DictGetCStr(REPY_Handle dict, char *key)
Get an entry from a Python dict, using a NULL-terminated C string for the key.
#define REPY_FN_LOCAL_SCOPE
The variable name for inline execution local scopes.
Definition repy_api.h:756

Gets a variable from the local scope.

Note that this macro will not retrieve global variables.

Parameters
var_nameThe name of the variable. Should be a NULL-terminated C string.
Returns
The value of the variable as a REPY_Handle.

◆ REPY_FN_GET_BOOL

#define REPY_FN_GET_BOOL ( var_name)
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.

Gets a variable from the local scope and casts it to a bool.

Note that this macro will not retrieve global variables.

Parameters
var_nameThe name of the variable. Should be a NULL-terminated C string.
Returns
The value of the variable as a bool.

◆ REPY_FN_GET_BYTESTR

#define REPY_FN_GET_BYTESTR ( var_name)
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.

Gets a variable from the local scope and casts it to a char*. Intended to be used when the variable object is a Python bytes.

Note that this macro will not retrieve global variables.

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
var_nameThe name of the variable. Should be a NULL-terminated C string.
Returns
The value of the variable as a char*.

◆ REPY_FN_GET_F32

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

Gets a variable from the local scope and casts it to a f32.

Note that this macro will not retrieve global variables.

Parameters
var_nameThe name of the variable. Should be a NULL-terminated C string.
Returns
The value of the variable as a f32.

◆ REPY_FN_GET_F64

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

Gets a variable from the local scope and casts it to a f64.

Note that this macro will not retrieve global variables.

Parameters
var_nameThe name of the variable. Should be a NULL-terminated C string.
Returns
The value of the variable as a f64.

◆ REPY_FN_GET_S16

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

Gets a variable from the local scope and casts it to a s16.

Note that this macro will not retrieve global variables.

Parameters
var_nameThe name of the variable. Should be a NULL-terminated C string.
Returns
The value of the variable as a s16.

◆ REPY_FN_GET_S32

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

Gets a variable from the local scope and casts it to a s32.

Note that this macro will not retrieve global variables.

Parameters
var_nameThe name of the variable. Should be a NULL-terminated C string.
Returns
The value of the variable as a s32.

◆ REPY_FN_GET_S64

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

Gets a variable from the local scope and casts it to a s64.

Note that this macro will not retrieve global variables.

Parameters
var_nameThe name of the variable. Should be a NULL-terminated C string.
Returns
The value of the variable as a s64.

◆ REPY_FN_GET_S8

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

Gets a variable from the local scope and casts it to a s8.

Note that this macro will not retrieve global variables.

Parameters
var_nameThe name of the variable. Should be a NULL-terminated C string.
Returns
The value of the variable as a s8.

◆ REPY_FN_GET_STR

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

Gets a variable from the local scope and casts it to a char*. Intended to be used when the variable object is a Python str.

Note that this macro will not retrieve global variables.

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
var_nameThe name of the variable. Should be a NULL-terminated C string.
Returns
The value of the variable as a char*.

◆ REPY_FN_GET_U16

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

Gets a variable from the local scope and casts it to a u16.

Note that this macro will not retrieve global variables.

Parameters
var_nameThe name of the variable. Should be a NULL-terminated C string.
Returns
The value of the variable as a u16.

◆ REPY_FN_GET_U32

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

Gets a variable from the local scope and casts it to a u32.

Note that this macro will not retrieve global variables.

Parameters
var_nameThe name of the variable. Should be a NULL-terminated C string.
Returns
The value of the variable as a u32.

◆ REPY_FN_GET_U64

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

Gets a variable from the local scope and casts it to a u64.

Note that this macro will not retrieve global variables.

Parameters
var_nameThe name of the variable. Should be a NULL-terminated C string.
Returns
The value of the variable as a u64.

◆ REPY_FN_GET_U8

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

Gets a variable from the local scope and casts it to a u8.

Note that this macro will not retrieve global variables.

Parameters
var_nameThe name of the variable. Should be a NULL-terminated C string.
Returns
The value of the variable as a u8.

◆ REPY_FN_IMPORT

#define REPY_FN_IMPORT ( module_name)
Value:
void REPY_DictSetCStr(REPY_Handle dict, char *key, REPY_Handle value)
Sets/adds a Python object to a Python dict, using a NULL-terminated C string for the key.
REPY_Handle REPY_ImportModule(const char *identifier)
Imports a Python module by name and returns a handle to it.

Inserts a Python module into the local scope.

The variable name for the module will be the same as the module name.

Parameters
module_nameThe name of the Python module as a C string.

◆ REPY_FN_SET

#define REPY_FN_SET ( var_name,
py_object )
Value:

Sets a variable in the the local scope, using a REPY_Handle for the value.

Note that the global scope will be unaffected.

Parameters
var_nameThe name of the variable. Should be a NULL-terminated C string.
py_objectThe python object to insert. Should be a REPY_Handle.

◆ REPY_FN_SET_BOOL

#define REPY_FN_SET_BOOL ( var_name,
value )
Value:
REPY_Handle REPY_CreateBool(REPY_bool value)
Returns a REPY_Handle for a Python bool object, based on a C bool.

Sets a variable of the Python type bool in the the local scope, using a bool for the value.

Note that the global scope will be unaffected.

Parameters
var_nameThe name of the variable. Should be a NULL-terminated C string.
valueThe python object to insert. Should be a bool.

◆ REPY_FN_SET_BYTESTR

#define REPY_FN_SET_BYTESTR ( var_name,
value )
Value:
REPY_Handle REPY_CreateByteStr(const char *string)
Returns a REPY_Handle for a Python bytes object, based on a NULL-terminated C string.

Sets a variable of the Python type str in the the local scope, using a NULL-terminated C string.

Note that the global scope will be unaffected.

Parameters
var_nameThe name of the variable. Should be a NULL-terminated C string.
valueThe value of the Python str. Should be a NULL-terminated C string.

◆ REPY_FN_SET_BYTESTR_N

#define REPY_FN_SET_BYTESTR_N ( var_name,
value,
len )
Value:
REPY_Handle REPY_CreateByteStrN(const char *string, REPY_u32 len)
Returns a REPY_Handle for a Python bytes object, based on a char array.

Sets a variable of the Python type bytes in the the local scope, using char array of N length for the value.

Note that the global scope will be unaffected.

Parameters
var_nameThe name of the variable. Should be a NULL-terminated C string.
valueThe content of the Python bytes. Should be a char*.
lenThe length of value in bytes.

◆ REPY_FN_SET_F32

#define REPY_FN_SET_F32 ( var_name,
value )
Value:
REPY_Handle REPY_CreateF32(REPY_f32 value)
Returns a REPY_Handle for a Python float object, based on a C f32.

Sets a variable of the Python type float in the the local scope, using a f32 for the value.

Note that the global scope will be unaffected.

Parameters
var_nameThe name of the variable. Should be a NULL-terminated C string.
valueThe value of the Python float. Should be a f32.

◆ REPY_FN_SET_F64

#define REPY_FN_SET_F64 ( var_name,
value )
Value:
REPY_Handle REPY_CreateF64(REPY_f64 value)
Returns a REPY_Handle for a Python int object, based on a C u8.

Sets a variable of the Python type float in the the local scope, using a f64 for the value.

Note that the global scope will be unaffected.

Parameters
var_nameThe name of the variable. Should be a NULL-terminated C string.
valueThe value of the Python float. Should be a f64.

◆ REPY_FN_SET_S16

#define REPY_FN_SET_S16 ( var_name,
value )
Value:
REPY_Handle REPY_CreateS16(REPY_s16 value)
Returns a REPY_Handle for a Python int object, based on a C s16.

Sets a variable of the Python type int in the the local scope, using a s16 for the value.

Note that the global scope will be unaffected.

Parameters
var_nameThe name of the variable. Should be a NULL-terminated C string.
valueThe value of the Python int. Should be a s16.

◆ REPY_FN_SET_S32

#define REPY_FN_SET_S32 ( var_name,
value )
Value:
REPY_Handle REPY_CreateS32(REPY_s32 value)
Returns a REPY_Handle for a Python int object, based on a C s32.

Sets a variable of the Python type int in the the local scope, using a s32 for the value.

Note that the global scope will be unaffected.

Parameters
var_nameThe name of the variable. Should be a NULL-terminated C string.
valueThe value of the Python int. Should be a s32.

◆ REPY_FN_SET_S64

#define REPY_FN_SET_S64 ( var_name,
value )
Value:
REPY_Handle REPY_CreateS64(REPY_s64 value)
Returns a REPY_Handle for a Python int object, based on a C s64.

Sets a variable of the Python type int in the the local scope, using a s64 for the value.

Note that the global scope will be unaffected.

Parameters
var_nameThe name of the variable. Should be a NULL-terminated C string.
valueThe value of the Python int. Should be a s64.

◆ REPY_FN_SET_S8

#define REPY_FN_SET_S8 ( var_name,
value )
Value:
REPY_Handle REPY_CreateS8(REPY_s8 value)
Returns a REPY_Handle for a Python int object, based on a C s8.

Sets a variable of the Python type int in the the local scope, using a s8 for the value.

Note that the global scope will be unaffected.

Parameters
var_nameThe name of the variable. Should be a NULL-terminated C string.
valueThe value of the Python int. Should be a s8.

◆ REPY_FN_SET_STR

#define REPY_FN_SET_STR ( var_name,
value )
Value:
REPY_Handle REPY_CreateStr(const char *string)
Returns a REPY_Handle for a Python str object, based on a NULL-terminated C string.

Sets a variable of the Python type str in the the local scope, using a NULL-terminated C string.

Note that the global scope will be unaffected.

Parameters
var_nameThe name of the variable. Should be a NULL-terminated C string.
valueThe value of the Python str. Should be a NULL-terminated C string.

◆ REPY_FN_SET_STR_N

#define REPY_FN_SET_STR_N ( var_name,
value,
len )
Value:
REPY_Handle REPY_CreateStrN(const char *string, REPY_u32 len)
Returns a REPY_Handle for a Python str object, based on char array.

Sets a variable of the Python type str in the the local scope, using char array of N length for the value.

Note that the global scope will be unaffected.

Parameters
var_nameThe name of the variable. Should be a NULL-terminated C string.
valueThe content of the Python str. Should be a char*.
lenThe length of value in bytes.

◆ REPY_FN_SET_U16

#define REPY_FN_SET_U16 ( var_name,
value )
Value:
REPY_Handle REPY_CreateU16(REPY_u16 value)
Returns a REPY_Handle for a Python int object, based on a C u16.

Sets a variable of the Python type int in the the local scope, using a u16 for the value.

Note that the global scope will be unaffected.

Parameters
var_nameThe name of the variable. Should be a NULL-terminated C string.
valueThe value of the Python int. Should be a u16.

◆ REPY_FN_SET_U32

#define REPY_FN_SET_U32 ( var_name,
value )
Value:
REPY_Handle REPY_CreateU32(REPY_u32 value)
Returns a REPY_Handle for a Python int object, based on a C u32.

Sets a variable of the Python type int in the the local scope, using a u32 for the value.

Note that the global scope will be unaffected.

Parameters
var_nameThe name of the variable. Should be a NULL-terminated C string.
valueThe value of the Python int. Should be a u32.

◆ REPY_FN_SET_U64

#define REPY_FN_SET_U64 ( var_name,
value )
Value:
REPY_Handle REPY_CreateU64(REPY_u64 value)
Returns a REPY_Handle for a Python int object, based on a C u64.

Sets a variable of the Python type int in the the local scope, using a u64 for the value.

Note that the global scope will be unaffected.

Parameters
var_nameThe name of the variable. Should be a NULL-terminated C string.
valueThe value of the Python int. Should be a u64.

◆ REPY_FN_SET_U8

#define REPY_FN_SET_U8 ( var_name,
value )
Value:
REPY_Handle REPY_CreateU8(REPY_u8 value)
Returns a REPY_Handle for a Python int object, based on a C u8.

Sets a variable of the Python type int in the the local scope, using a u8 for the value.

Note that the global scope will be unaffected.

Parameters
var_nameThe name of the variable. Should be a NULL-terminated C string.
valueThe value of the Python int. Should be a u8.