NAME ^

src/io/io_layers.c - IO Layer Handling

DESCRIPTION ^

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.

*/

/*

Layer and Stack Functions ^

ParrotIOLayer *PIO_base_new_layer(ParrotIOLayer *proto)

The default IO layer constructor. Creates and returns a new ParrotIOLayer. If a prototype *proto is supplied then it's values will be copied to the new instance.

void PIO_base_delete_layer(ParrotIOLayer *layer)

The default IO layer destructor. Frees the memory associated with *layer.

INTVAL PIO_push_layer(theINTERP, PMC *pmc, ParrotIOLayer *layer)

Push a layer onto an IO object (*pmc) or the default stack.

void PIO_push_layer_str(theINTERP, PMC *pmc, STRING *layer_name)

Push a layer onto an IO object (*pmc).

ParrotIOLayer *PIO_pop_layer(theINTERP, PMC *pmc)

Pop a layer from an IO object (*pmc) or the default stack.

STRING *PIO_pop_layer_str(theINTERP, PMC *pmc)

Pop a layer from an IO object (*pmc) and return the name of the popped layer. The layer gets freed.

ParrotIOLayer *PIO_copy_stack(ParrotIOLayer *stack)

Primarily used to copy the default IO stack for a new IO object. Later we will do some funky copy-on-write stuff.


parrot