io.ops
Parrot's IO API
- close(in PMC)
- Close IO object $1
- fdopen(out PMC,
in INT,
in STR)
- Create ParrotIO object in $1 as a copy of file descriptor $2.
- XXX: integral file descriptors may not exist outside of the UNIX platform.
This op needs work.
- getfd(out INT,
in PMC)
- Get the file descriptor out of the ParrotIO object $2 and store it in $1
- XXX: integral file descriptors may not exist outside of the UNIX platform.
- getstdin(out PMC)
- Create a new ParrotIO object for the stdin file descriptor and store it in $1
- getstdout(out PMC)
- Create a new ParrotIO object for the stdout file descriptor and store it in $1
- getstderr(out PMC)
- Create a new ParrotIO object for the stderr file descriptor and store it in $1
- pioctl(out INT,
in PMC,
in INT,
in INT)
- Perform an operation an an IO object.
This is a general purpose hook for setting various flags,
modes,
etc.
Examples: setting the record seperator or setting the buffering
- open(out PMC,
in STR,
in STR)
- Open URL (file,
address,
database,
in core image) named $2 with Perl style mode string in $3 and create an IO object in $1.
- open(out PMC,
in STR)
- Open URL (file,
address,
database,
in core image) named $2 with read/write mode and create an IO object in $1.
- print(in INT)
- print(in NUM)
- print(in PMC)
- print(in STR)
- Print $1 to standard output.
- printerr(in INT)
- printerr(in NUM)
- printerr(in STR)
- printerr(in PMC)
- Print $1 to standard error.
- print(in PMC,
in INT)
- print(in PMC,
in NUM)
- print(in PMC,
in STR)
- print(in PMC,
in PMC)
- Print $2 on the IO stream object $1.
- read(out STR,
in INT)
- Read up to N bytes from standard input stream If stream is linebuffered,
will return at EOL,
for files it will read MIN(MAX(avail,
N),
65535) bytes.
Warning: This is a quick hack.
- read(out STR,
in PMC,
in INT)
- Read up to N bytes from IO PMC stream.
If stream is linebuffered,
will return at EOL,
for files it will read MIN(MAX(avail,
N),
65535) bytes.
Warning: This is a quick hack.
- readline(out STR,
in PMC)
- Read a line up to EOL from filehandle $2.
This switches the filehandle to linebuffer-mode.
- If for some reason the line's longer than 64K you get only 64K
- peek(out STR)
- Returns the next byte from standard input,
but does not remove it from the stream.
- peek(out STR,
in PMC)
- Reads the next byte from an IO PMC,
but does not remove it from the stream.
- stat(out INT,
in STR,
in INT) =item stat(out INT,
in INT,
in INT)
- 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
- seek(in PMC, in INT, in INT)
- seek: Set file position to offset $2 on IO stream $1. 'whence' is indicated by the value in $3.
- seek(in PMC, in INT, in INT, in INT)
- 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(out INT, in PMC)
- 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
- tell(out INT, out INT, in PMC)
- 64bit tell: Get the current file positon of stream $3 in two parts of 32-bit each ($1 = pos >> 32, $2 = pos & 0xffffffff).
- socket(out PMC, in INT, in INT, in INT)
- sockaddr(out STR, in INT, in STR)
- connect(out INT, in PMC, in STR)
- recv(out INT, in PMC, in STR)
- send(out INT, in PMC, in STR)
- poll(out INT, in PMC, in INT, in INT, in INT)
Copyright (C) 2001-2004 The Perl Foundation. All rights reserved.
This program is free software. It is subject to the same license as the Parrot interpreter itself.