parrotcode: IO Layer Handling | |
Contents | C |
src/io/io_layers.c - IO Layer Handling
The Parrot IO subsystem uses a per-interpreter stack to provide a layer-based approach to IO.
Each layer implements a subset of the ParrotIOLayerAPI
vtable.
To find an IO function the layer stack is searched downwards until a non-NULL
function pointer is found for that particular slot.
PARROT_API PARROT_MALLOC PARROT_CANNOT_RETURN_NULL ParrotIOLayer *PIO_base_new_layer(NULLOK(ParrotIOLayer *proto))
ParrotIOLayer
.
If a prototype *proto
is supplied then its values will be copied to the new instance.PARROT_API void PIO_base_delete_layer(NULLOK(ParrotIOLayer *layer))
*layer
.PARROT_API INTVAL PIO_push_layer(PARROT_INTERP, NULLOK(PMC *pmc), NULLOK(ParrotIOLayer *layer))
*pmc
) or the default stack.PARROT_WARN_UNUSED_RESULT PARROT_CAN_RETURN_NULL PARROT_API ParrotIOLayer *PIO_get_layer(SHIM_INTERP, NOTNULL(const char *name))
void PIO_push_layer_str(PARROT_INTERP, NOTNULL(PMC *pmc), NULLOK(STRING *ls))
*pmc
).PARROT_API PARROT_IGNORABLE_RESULT PARROT_CAN_RETURN_NULL ParrotIOLayer *PIO_pop_layer(PARROT_INTERP, NULLOK(PMC *pmc))
*pmc
) or the default stack.PARROT_IGNORABLE_RESULT PARROT_CANNOT_RETURN_NULL STRING *PIO_pop_layer_str(PARROT_INTERP, NOTNULL(PMC *pmc))
*pmc
) and return the name of the popped layer.
The layer gets freed.PARROT_API PARROT_IGNORABLE_RESULT PARROT_CANNOT_RETURN_NULL ParrotIOLayer *PIO_copy_stack(NULLOK(ParrotIOLayer *stack))
|