Method functions to operate on REPY_IfStmtChain objects. More...
Functions | |
| 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. | |
| 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_IfStmtChain * | REPY_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. | |
Method functions to operate on REPY_IfStmtChain objects.
| 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.
| chain | The REPY_IfStmtChain to get the expression bytecode from. |
| 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.
| chain | The REPY_IfStmtChain to get the next element from. |
| 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.
| expr_string | The Python expression to evaluate. Should be a NULL-terminated C string. Will be compiled into Python bytecode immediately. |
| filename | A C filename to associate with the Python expression. Usually _FILE_NAME__. |
| function_name | The name of C function to associate with the Python expression. Usually __func__. |
| line_number | A line number in a C file to associate with the Python expression. Usually __LINE__. |
| identifier | An identifiying string for the Python expression. Usually the bytecode identifier from the C file. |
| 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.
| chain | A pointer to the REPY_IfStmtChain to recursively destroy. |
| 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.
| chain | The REPY_IfStmtChain to set the expression bytecode for. |
| eval_bytecode | A REPY_Handle to be the new expression bytecode. |
| 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.
| chain | The REPY_IfStmtChain to set the next element for. |
| next | The REPY_IfStmtChain to be the next element in the chain. |