io.ops - Extended I/O Dynops
A richer I/O API than that available in core Parrot.
Stat the file. Return stat element $3 for file $2 into $1. The queryable items currently are:
EXISTS 0 FILESIZE 1 ISDIR 2 ISDEV 3 CREATETIME 4 (Time file was created) ACCESSTIME 5 (Time file was last accessed) MODIFYTIME 6 (Time file data was changed) CHANGETIME 7 (Time file metadata was changed) BACKUPTIME 8 (Time of last backup) UID 9 GID 10
Read up to N bytes from standard input stream
Read up to N bytes from IO PMC stream.
Read a line up to EOL from filehandle $2. This switches the filehandle to linebuffer-mode.
Print $1 to standard error.
seek: Set file position to offset $2 on IO stream $1. 'whence' is indicated by the value in $3. The valid values for 'whence' are:
Value Meaning 0 Seek from the beginning of the file 1 Seek from the current position 2 Seek from the end of the file
[ Note: the above values for 'whence' is just an educated guess at this point ]
64bit seek: Set file position to offset ($2 << 32 | $3) on IO stream $1. 'whence' is indicated by the value in $4. This allows 64-bit seeks with only 32-bit INTVALS.
tell: Get the current file position of stream $2 and store it in $1. On systems where INTVAL is 32bit the result will be truncated if the position is beyond 2 GiB
64bit tell: Get the current file position of stream $3 in two parts of 32-bit each ($1 = pos >> 32, $2 = pos & 0xffffffff).
Returns the next byte from standard input, but does not remove it from the stream.
Reads the next byte from an IO PMC, but does not remove it from the stream.
Open URL (file, address, database, in core image) named $2 with a mode string in $3 and create an IO object in $1.
The mode consists of a string of characters specified in any order:
r : read w : write a : append (Note: you must specify "wa", not just "a") p : pipe
Open URL (file, address, database, in core image) named $2 with read mode and create an IO object in $1.
Close IO object $1
Create ParrotIO object in $1 as a copy of file descriptor $2.
Sets the standard input for a bare
read op to go to the supplied PMC. Call
getstdin first if you care about retaining the previous PMC.
Sets the standard output for a bare
getstdout first if you care about retaining the previous PMC.
Sets the standard error for a bare
printerr op to go to the supplied PMC. Call
getstderr first if you care about retaining the previous PMC.