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

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

Functions

REPY_IteratorHelperREPY_IteratorHelper_Create (REPY_Handle py_object, REPY_Handle py_scope_nullable, const char *var_name, REPY_bool auto_destroy)
 Create a REPY_IteratorHelper object on the heap.
void REPY_IteratorHelper_Destroy (REPY_IteratorHelper *helper)
 Destructs a REPY_IteratorHelper object from the heap.
REPY_bool REPY_IteratorHelper_Update (REPY_IteratorHelper *helper)
 Makes the REPY_IteratorHelper move on to the next object in the iteration.
REPY_u32 REPY_IteratorHelper_GetIndex (REPY_IteratorHelper *helper)
 Gets the current index of a REPY_IteratorHelper object.
REPY_Handle REPY_IteratorHelper_BorrowCurrent (REPY_IteratorHelper *helper)
 Gets the REPY_Handle for a REPY_IteratorHelper object's current Python object.

Detailed Description

Method functions to operate on REPY_IteratorHelper objects.

Function Documentation

◆ REPY_IteratorHelper_BorrowCurrent()

REPY_Handle REPY_IteratorHelper_BorrowCurrent ( REPY_IteratorHelper * helper)

Gets the REPY_Handle for a REPY_IteratorHelper object's current Python object.

The term Borrow is used because the lifetime of the returned REPY_Handle is managed by the REPY_IteratorHelper itself, and therefore you should not release it manually.

If you need to access this object outside of the current iteration step, use REPY_CopyHandle.

Parameters
helperThe REPY_teratorHelper to get the REPY_Handle from.
Returns
The REPY_Handle referring to the current object from the REPY_IteratorHelper.

◆ REPY_IteratorHelper_Create()

REPY_IteratorHelper * REPY_IteratorHelper_Create ( REPY_Handle py_object,
REPY_Handle py_scope_nullable,
const char * var_name,
REPY_bool auto_destroy )

Create a REPY_IteratorHelper object on the heap.

Used by the REPY_FOREACH and REPY_FN_FOREACH_CACHE macros.

Parameters
py_objecta REPY_Handle for the Python object to iterate through.
py_scope_nullablea REPY_Handle to a Python dict being used a local scope. Can be REPY_NO_OBJECT.
var_namethe variable name for the REPY_IteratorHelper pointer. If py_scope_nullable is set to REPY_NO_OBJECT, use NULL.
auto_destroyIf true, the REPY_IteratorHelper will automatically be destroyed once the loop ends.
Returns
A pointer to the new REPY_IteratorHelper on the heap.

◆ REPY_IteratorHelper_Destroy()

void REPY_IteratorHelper_Destroy ( REPY_IteratorHelper * helper)

Destructs a REPY_IteratorHelper object from the heap.

Used by the various cleanup macros for REPY_FOREACH and REPY_FN_FOREACH_CACHE.

REPY_IteratorHelper_Update can also destroy a REPY_IteratorHelper when it's finished, if auto_destroy is set to true.

Parameters
helperA pointer to the REPY_IteratorHelper to destroy.

◆ REPY_IteratorHelper_GetIndex()

REPY_u32 REPY_IteratorHelper_GetIndex ( REPY_IteratorHelper * helper)

Gets the current index of a REPY_IteratorHelper object.

An index value isn't something intrinsic to Pythonic for loops. Instead, the REPY_IteratorHelper internally counts what index value the iterator is on.

Parameters
helperThe REPY_IteratorHelper to get the index from.
Returns
The index of the iteration as an unsigned int.

◆ REPY_IteratorHelper_Update()

REPY_bool REPY_IteratorHelper_Update ( REPY_IteratorHelper * helper)

Makes the REPY_IteratorHelper move on to the next object in the iteration.

Used by the REPY_FOREACH and REPY_FN_FOREACH_CACHE macros.

Parameters
helperA pointer to the REPY_IteratorHelper to update.
Returns
true if the iteration/loop should continue. false once it's time to end.