List of I/O modes

From the SETL Wiki

Jump to: navigation, search

The table below contains a summary of all supported I/O modes (i.e valid values for the how parameter to the open primitive) in all known versions of SETL.

Notes:

  • Mode names are case-insensitive, although unix-style mode names are shown here in lowercase and others in uppercase.


Compatibility:

GREEN - GNU SETL only.
BLUE - GNU SETL and CIMS SETL only.
BLACK - GNU SETL, CIMS SETL and SETL2.
BROWN - GNU SETL and SETL2.

Recommended mode names Alternate mode names Description Notes
a

ab
APPEND
BINARY-APPEND
CODED-APPEND
OUTPUT-APPEND
PRINT-APPEND
TEXT-APPEND

Stream output at end of file

a+

a+b
ab+

Random access read/write, initial position at end of file

IGNORE

IGNORE-SIGNAL
SIGNAL-IGNORE

No I/O, but blocks the specified signal until closed.

"path" must be a signal name. See Signal handling in GNU SETL.

n

BINARY-NEW
CODED-NEW
nb
NEW
NEW-BINARY
NEW-CODED
NEW-TEXT
NEW-w
TEXT-NEW

Text stream output to new file (fails if the file already exists.)

Text/binary distinction is irrelevant because these modes are defined only in GNU SETL which has no binary mode (all values are represented as strings.)

n+

BINARY-DIRECT-NEW
BINARY-RANDOM-NEW
DIRECT-BINARY-NEW
DIRECT-NEW
n+b
nb+
NEW+
NEW-BINARY-DIRECT
NEW-BINARY-RANDOM
NEW-DIRECT
NEW-DIRECT-BINARY
NEW-r+
NEW-RANDOM
NEW-RANDOM-BINARY
NEW-w+
RANDOM-BINARY-NEW
RANDOM-NEW

Create a new file for random read/write access (fails if the file already exists.)

PIPE-FROM PIPE-IN Read from command's standard output. "path" must be a shell command. See also filter and popen.
PIPE-TO PIPE-OUT Write to command's standard input

r
BINARY-IN

BINARY
INPUT
rb

Binary stream input (not human-readable)

"path" can be an existing file descriptor, e.g. one inherited from the C program that invoked the SETL interpreter.
GNU SETL does not distinguish between text and binary streams, thus these modes are all equivalent.

TEXT-IN

TEXT
CODED
CODED-IN

Text stream input

r+
RANDOM

BINARY-DIRECT
BINARY-RANDOM
DIRECT
DIRECT-BINARY
r+b
RANDOM-BINARY
rb+

Random-access read-write; Create if absent; Initially read from the start of the file if it exists.

rw

BIDIRECTIONAL
INPUT-OUTPUT
READ-WRITE
TWO-WAY
TWOWAY

Read/write access, typically a device such as a serial port or named pipe.

"path" can be an existing file descriptor, e.g. one inherited from the C program that invoked the SETL interpreter.

SERVER-SOCKET TCP-SERVER-SOCKET TCP server socket "path" must be a string containing either:
  • A port number in decimal, or
  • A service name listed in /etc/services
SIGNAL SIGNAL-IN

Catch signal; deliver a newline on the input stream whenever the specified signal is received by this process.

"path" must be a signal name. See Signal handling in GNU SETL.

SOCKET

CLIENT-SOCKET
TCP-CLIENT-SOCKET

TCP client socket "path" must be a string in the form host:port, where host is a hostname or IPV4 address and port is either a decimal port number or service name from /etc/services.
TTY-PUMP LINE-PUMP Bidirectional pump to child process's standard input and output, via a pseudo-tty "path" must be a shell command. See also filter and popen.

TEXT-OUT

CODED-OUT

Text stream output

"path" can be an existing file descriptor, e.g. one inherited from the C program that invoked the SETL interpreter.
GNU SETL does not distinguish between text and binary streams, thus these modes are all equivalent. All SETL values are converted to text form (using str.)
The PRINT stream type is implemented only in CIMS SETL and inserts extra printer formatting characters into the output stream. GNU SETL treats this as equivalent to TEXT-OUT.

w
BINARY-OUT

OUTPUT
wb

Binary stream output (not human-readable)

PRINT

Formatted output

w+

w+b
wb+

Random access read/write; Initially create or truncate file.

REAL-MS

Timer; Deliver a newline on the input stream every N milliseconds.

The "path" argument must be a string containing the value of N in decimal.

Personal tools