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

Method functions to operate on REPY_IfStmtChain objects. More...

Functions

REPY_IfStmtChainREPY_IfStmtChain_Create (char *expr_string, char *filename, char *function_name, REPY_u32 line_number, char *identifier)
 Creates a new link in a REPY_IfStmtChain if statement chain.
void REPY_IfStmtChain_Destroy (REPY_IfStmtChain *chain)
 Destructs a REPY_IfStmtChain object from the heap, recursively destructs and all additional links down the chain.
REPY_IfStmtChainREPY_IfStmtChain_BorrowNext (REPY_IfStmtChain *chain)
 Returns a pointer to the next IfStmtChain in the series.
void REPY_IfStmtChain_StealNext (REPY_IfStmtChain *chain, REPY_IfStmtChain *next)
 Sets the next REPY_IfStmtChain in a series.
REPY_Handle REPY_IfStmtChain_BorrowEvalBytecode (REPY_IfStmtChain *chain)
 Retrieves the evaluated bytecode expression for this REPY_IfStmtChain as a REPY_Handle.
void REPY_IfStmtChain_StealEvalBytecode (REPY_IfStmtChain *chain, REPY_Handle eval_bytecode)
 Sets.

Detailed Description

Method functions to operate on REPY_IfStmtChain objects.

Function Documentation

◆ REPY_IfStmtChain_BorrowEvalBytecode()

REPY_Handle REPY_IfStmtChain_BorrowEvalBytecode ( REPY_IfStmtChain * chain)

Retrieves the evaluated bytecode expression for this REPY_IfStmtChain as a REPY_Handle.

The term Borrow is used because the lifetime of the returned REPY_Handle is managed by the REPY_IfStmtChain specified in the chain argument. If the parent is destroyed (using REPY_IfStmtChain_Destroy), this pointer will no longer be valid. Additionally, you should not release this handle yourself, as REPY_IfStmtHelper_Step will not regenerate it.

Parameters
chainThe REPY_IfStmtChain to get the expression bytecode from.
Returns
The REPY_Handle for expression bytecode.

◆ REPY_IfStmtChain_BorrowNext()

REPY_IfStmtChain * REPY_IfStmtChain_BorrowNext ( REPY_IfStmtChain * chain)

Returns a pointer to the next IfStmtChain in the series.

The term Borrow is used because the lifetime of the returned IfStmtChain is managed by it's parent (the chain argument). If the parent is destroyed (using REPY_IfStmtChain_Destroy), this pointer will no longer be valid.

Destroying the returned IfStmtChain manually is not catastrophic so long as you set the parent's next link to NULL, as this signals to REPY_IfStmtHelper_Step to simply regenerate the link. However, there isn't much benefit to doing so. Chains are meant to be preserved as a means of code caching.

Parameters
chainThe REPY_IfStmtChain to get the next element from.
Returns
A pointer to the next element in the chain.

◆ REPY_IfStmtChain_Create()

REPY_IfStmtChain * REPY_IfStmtChain_Create ( char * expr_string,
char * filename,
char * function_name,
REPY_u32 line_number,
char * identifier )

Creates a new link in a REPY_IfStmtChain if statement chain.

Invoked as part of REPY_IfStmtHelper operations, but exposed for manual use here.

Parameters
expr_stringThe Python expression to evaluate. Should be a NULL-terminated C string. Will be compiled into Python bytecode immediately.
filenameA C filename to associate with the Python expression. Usually _FILE_NAME__.
function_nameThe name of C function to associate with the Python expression. Usually __func__.
line_numberA line number in a C file to associate with the Python expression. Usually __LINE__.
identifierAn identifiying string for the Python expression. Usually the bytecode identifier from the C file.
Returns
A pointer to the new REPY_IfStmtChain object.

◆ REPY_IfStmtChain_Destroy()

void REPY_IfStmtChain_Destroy ( REPY_IfStmtChain * chain)

Destructs a REPY_IfStmtChain object from the heap, recursively destructs and all additional links down the chain.

Exists for completeness sake. Since REPY_IfStmtChain pointers should usualy be static in their own functions, this doesn't really get much use.

Parameters
chainA pointer to the REPY_IfStmtChain to recursively destroy.

◆ REPY_IfStmtChain_StealEvalBytecode()

void REPY_IfStmtChain_StealEvalBytecode ( REPY_IfStmtChain * chain,
REPY_Handle eval_bytecode )

Sets.

Retrieves the evaluated bytecode expression for this REPY_IfStmtChain.

The term Steal is used because the REPY_IfStmtHelper represented by the chain argument (IE, the parent) assumes ownership of the REPY_Handle passed in as eval_bytecode. Ergo, you shouldn't release eval_bytecode youself after this.

Parameters
chainThe REPY_IfStmtChain to set the expression bytecode for.
eval_bytecodeA REPY_Handle to be the new expression bytecode.

◆ REPY_IfStmtChain_StealNext()

void REPY_IfStmtChain_StealNext ( REPY_IfStmtChain * chain,
REPY_IfStmtChain * next )

Sets the next REPY_IfStmtChain in a series.

The term Steal is used because the REPY_IfStmtHelper represented by the chain argument (IE, the parent) assumes ownership of the REPY_IfStmtHelper represented by next. Ergo, you shouldn't destroy next youself without setting the next link of chain to NULL.

Parameters
chainThe REPY_IfStmtChain to set the next element for.
nextThe REPY_IfStmtChain to be the next element in the chain.