| parrotcode: FileHandle utility functions | |
| Contents | C |

src/io/filehandle.c - FileHandle utility functions

This file defines a set of utility functions for the FileHandle PMC used by all operating systems. For the primary public I/O API, see src/io/api.c.

INTVAL Parrot_io_parse_open_flagsr for read,
w for write,
a for append,
and p for pipe) and returns the combined generic bit flags.
STRING *Parrot_io_make_stringbuf parameter can:
strstart tells this function to allocate the STRING memory.
void Parrot_io_set_os_handleos_handle attribute of the FileHandle object,
which stores the low-level filehandle for the OS.Currently,
this pokes directly into the C struct of the FileHandle PMC.
This needs to change to a general interface that can be used by all subclasses and polymorphic equivalents of FileHandle.
For now,
hiding it behind a function,
so it can be cleanly changed later.Possibly,
this function should reset some characteristics of the object (like buffer and file positions) to their default values.
PIOHANDLE Parrot_io_get_os_handleos_handle attribute of the FileHandle object,
which stores the low-level filehandle for the OS.Currently,
this pokes directly into the C struct of the FileHandle PMC.
This needs to change to a general interface that can be used by all subclasses and polymorphic equivalents of FileHandle.
For now,
hiding it behind a function,
so it can be cleanly changed later.
void Parrot_io_set_flagsflags attribute of the FileHandle object,
which stores bitwise flags marking filehandle characteristics.Currently,
this pokes directly into the C struct of the FileHandle PMC.
This needs to change to a general interface that can be used by all subclasses and polymorphic equivalents of FileHandle.
For now,
hiding it behind a function,
so it can be cleanly changed later.
INTVAL Parrot_io_get_flagsflags attribute of the FileHandle object,
which stores bitwise flags marking filehandle characteristics.Currently,
this pokes directly into the C struct of the FileHandle PMC.
This needs to change to a general interface that can be used by all subclasses and polymorphic equivalents of FileHandle.
For now,
hiding it behind a function,
so it can be cleanly changed later.
void Parrot_io_set_file_sizefile_size attribute of the FileHandle object,
which stores the current file size.Currently,
this pokes directly into the C struct of the FileHandle PMC.
This needs to change to a general interface that can be used by all subclasses and polymorphic equivalents of FileHandle.
For now,
hiding it behind a function,
so it can be cleanly changed later.
PIOOFF_T Parrot_io_get_file_sizefile_size attribute of the FileHandle object,
which stores the current file size.Currently,
this pokes directly into the C struct of the FileHandle PMC.
This needs to change to a general interface that can be used by all subclasses and polymorphic equivalents of FileHandle.
For now,
hiding it behind a function,
so it can be cleanly changed later.
void Parrot_io_set_buffer_startbuffer_start attribute of the FileHandle object,
which stores the position of the start of the buffer.Currently,
this pokes directly into the C struct of the FileHandle PMC.
This needs to change to a general interface that can be used by all subclasses and polymorphic equivalents of FileHandle.
For now,
hiding it behind a function,
so it can be cleanly changed later.
unsigned char *Parrot_io_get_buffer_startbuffer_start attribute of the FileHandle object,
which stores the position of the start of the buffer.Currently,
this pokes directly into the C struct of the FileHandle PMC.
This needs to change to a general interface that can be used by all subclasses and polymorphic equivalents of FileHandle.
For now,
hiding it behind a function,
so it can be cleanly changed later.
unsigned char *Parrot_io_get_buffer_nextbuffer_next attribute of the FileHandle object,
which stores the current position within the buffer.Currently,
this pokes directly into the C struct of the FileHandle PMC.
This needs to change to a general interface that can be used by all subclasses and polymorphic equivalents of FileHandle.
For now,
hiding it behind a function,
so it can be cleanly changed later.
void Parrot_io_set_buffer_nextbuffer_next attribute of the FileHandle object,
which stores the current position within the buffer.Currently,
this pokes directly into the C struct of the FileHandle PMC.
This needs to change to a general interface that can be used by all subclasses and polymorphic equivalents of FileHandle.
For now,
hiding it behind a function,
so it can be cleanly changed later.
unsigned char *Parrot_io_get_buffer_endbuffer_end attribute of the FileHandle object,
which stores the position of the end of the buffer.Currently,
this pokes directly into the C struct of the FileHandle PMC.
This needs to change to a general interface that can be used by all subclasses and polymorphic equivalents of FileHandle.
For now,
hiding it behind a function,
so it can be cleanly changed later.
void Parrot_io_set_buffer_endbuffer_end attribute of the FileHandle object,
which stores the position of the end of the buffer.Currently,
this pokes directly into the C struct of the FileHandle PMC.
This needs to change to a general interface that can be used by all subclasses and polymorphic equivalents of FileHandle.
For now,
hiding it behind a function,
so it can be cleanly changed later.
INTVAL Parrot_io_get_buffer_flagsbuffer_flags attribute of the FileHandle object,
which stores a collection of flags specific to the buffer.Currently,
this pokes directly into the C struct of the FileHandle PMC.
This needs to change to a general interface that can be used by all subclasses and polymorphic equivalents of FileHandle.
For now,
hiding it behind a function,
so it can be cleanly changed later.
void Parrot_io_set_buffer_flagsbuffer_flags attribute of the FileHandle object,
which stores a collection of flags specific to the buffer.Currently,
this pokes directly into the C struct of the FileHandle PMC.
This needs to change to a general interface that can be used by all subclasses and polymorphic equivalents of FileHandle.
For now,
hiding it behind a function,
so it can be cleanly changed later.
size_t Parrot_io_get_buffer_sizebuffer_size attribute of the FileHandle object,
which stores the size of the buffer (in bytes).Currently,
this pokes directly into the C struct of the FileHandle PMC.
This needs to change to a general interface that can be used by all subclasses and polymorphic equivalents of FileHandle.
For now,
hiding it behind a function,
so it can be cleanly changed later.
void Parrot_io_set_buffer_sizebuffer_size attribute of the FileHandle object,
which stores the size of the buffer (in bytes).Currently,
this pokes directly into the C struct of the FileHandle PMC.
This needs to change to a general interface that can be used by all subclasses and polymorphic equivalents of FileHandle.
For now,
hiding it behind a function,
so it can be cleanly changed later.
void Parrot_io_clear_bufferPIOOFF_T Parrot_io_get_file_positionfile_pos attribute of the FileHandle object,
which stores the current file position of the filehandle.Currently,
this pokes directly into the C struct of the FileHandle PMC.
This needs to change to a general interface that can be used by all subclasses and polymorphic equivalents of FileHandle.
For now,
hiding it behind a function,
so it can be cleanly changed later.
PIOOFF_T Parrot_io_get_last_file_positionfile_pos attribute of the FileHandle object,
which stores the current file position of the filehandle.Currently,
this pokes directly into the C struct of the FileHandle PMC.
This needs to change to a general interface that can be used by all subclasses and polymorphic equivalents of FileHandle.
For now,
hiding it behind a function,
so it can be cleanly changed later.
void Parrot_io_set_file_positionfile_pos attribute of the FileHandle object,
which stores the current file position of the filehandle.
Also set the last_pos attribute to the previous value of file_pos.Currently,
this pokes directly into the C struct of the FileHandle PMC.
This needs to change to a general interface that can be used by all subclasses and polymorphic equivalents of FileHandle.
For now,
hiding it behind a function,
so it can be cleanly changed later.
INTVAL Parrot_io_is_encodingINTVAL Parrot_io_close_filehandleFileHandle PMC *pmc,
but leaves the object intact to be reused or collected.
INTVAL Parrot_io_is_closed_filehandlevoid Parrot_io_flush_filehandleFileHandle PMC *pmc.
src/io/unix.c, src/io/win32.c, src/io/stdio.c, src/io/io_private.h.
|
|
|