| parrotcode: Parrot IO | |
| Contents | PMCs |

src/pmc/parrotio.pmc - Parrot IO

These are the vtable functions for Parrot IO.

METHOD INTVAL say(STRING *s)METHOD PMC *open(STRING *file, STRING *mode, STRING *layer)METHOD INTVAL set_readline_interactive(INTVAL)readline isn't configured
The file is not open/not input or not a tty, if turning on interactive.
old interactive setting
METHOD STRING *readline(STRING *prompt)readline opcode (which will be removed anyway).
Interactive mode adds non-empty lines to the readline history. pio = getstdin
$I0 = pio.'set_readline_interactive'(1)
if $I0 >= 0 goto loop
printerr "set_readline_interactive failed: "
...
loop:
s = pio.'readline'('hello polly> ')
if null s goto ex
..
goto loop
ex:
.local pmc cl
cl = getclass 'ParrotIO'
$S0 = cl.'slurp'('the_file')
pio = open 'the_file', '<'
$S0 = pio.'slurp'('')
void class_init()METHOD INTVAL eof()METHOD void flush()METHOD INTVAL setbuf(INTVAL)METHOD INTVAL setlinebuf()void init()void destroy()PMC *clone()ParrotIO object. If we have different IO layers, we might copy data and struct_val.INTVAL get_bool()EOF or not.STRING *get_string_keyed_int(INTVAL n)void push_string (STRING *value)value onto the PIO's layer stack.STRING *pop_string ()
Initial version by leo 2003/06/23.
|
|
|