| parrotcode: Parrot I/O API | |
| Contents | C |

src/io/api.c - Parrot I/O API

The Parrot I/O subsystem provides the core I/O functionality for all parts of Parrot. This file implements the public interface to the I/O subsystem. Common utility functions that aren't part of the public interface are defined in src/io/common.c and utility functions for a specific platform are in src/io/unix.c, src/io/win32.c, or src/io/portable.c. The platform is selected in include/parrot/io.h, based on #defines from the configuration process.
The FileHandle PMC provides the class-based interface for filehandles that is used in Parrot ops.

PMC *Parrot_io_new_pmcflags is set in the returned PMC.PMC *Parrot_io_openFileHandle PMC for a given string path and flags.PMC *Parrot_io_fdopenFileHandle PMC for a given set of flags on an existing,
open file descriptor.STD* IO handles onto the OS IO handles (0,
1,
2).INTVAL Parrot_io_closeParrotIO PMC *pmc.INTVAL Parrot_io_is_closedvoid Parrot_io_flushParrotIO PMC *pmc.STRING *Parrot_io_readsSTRING* holding up to len bytes.INTVAL Parrot_io_readlen bytes from *pmc and copies them into *buffer.INTVAL Parrot_io_writelen bytes from *buffer to *pmc.PIOOFF_T Parrot_io_seek*pmc to offset bytes from the position indicated by w.
Typically w will be 0 for the start of the file,
1 for the current position,
and 2 for the end.PIOOFF_T Parrot_io_tell*pmc.INTVAL Parrot_io_peekINTVAL Parrot_io_eof*pmc's current read/write position is EOF.INTVAL Parrot_io_puts*s tp *pmc.
C string version.INTVAL Parrot_io_putps*s to *pmc.
Parrot string version.INTVAL Parrot_io_fprintf*pmc.INTVAL Parrot_io_printfstdout.INTVAL Parrot_io_eprintfstderr.PIOHANDLE Parrot_io_getfd*pmc's file descriptor,
or 0 if it is not defined.INTVAL Parrot_io_is_tty*pmc is a console/tty.Parrot_io_STD* Functions 
PMC *Parrot_io_STDINFileHandle PMC for stdin.PMC *Parrot_io_STDOUTFileHandle PMC for stdout.PMC *Parrot_io_STDERRFileHandle PMC for stderr.
These are used to create offsets for the seek op.
PIOOFF_T Parrot_io_make_offsetoffset.PIOOFF_T Parrot_io_make_offset32hi is shifted 32 bytes to the left and ored together with lo.
This allows 64-bit seeks with only 32-bit INTVALS.PIOOFF_T Parrot_io_make_offset_pmcget_integer vtable method on *pmc.
io/unix.c, io/win32.c, io/portable.c, io/io_private.h.

Hey! The above document had some coding errors, which are explained below:
|
|
|