2.4.2.5. - Text Output
print a [, b ... ]-
Prints the string value of each argument, adding a space between each
string.
If the argument is an associative array, each element of the array is
printed in a list, as in:
1.FOURC> print mA mA["0"] = 2
mA["1"] = 0
mA["2"] = 1
mA["3"] = 3
2.FOURC> If the argument is a data array, the contents of the array are printed
in a compressed format, as in:
1.FOURC> array data[64][64]; data[0] = 1; data[1] = 2 2.FOURC> print data {{1 <64 repeats>}, {2 <64 repeats>}, {0 <64 repeats>} <62 repeats>}
3.FOURC>
eprint a [, b ... ]-
As above, except that if an error-log file is open, the generated
string will also be written to that file prefixed by the
#E characters.
printf(format [, a ... ])-
Does formatted
printing on the turned-on output
devices.
format
contains the format specifications for any following arguments.
See the description of
printf()
in any C-language manual.
Returns
true .
eprintf(format [, a ... ])-
As above, except that if an error-log file is open, the generated
string will also be written to that file prefixed by the
#E characters.
fprintf(file_name, format [, a ... ])-
Does formatted printing on
file_name.
All other devices (except
log
files)
are turned off while the string is printed.
The specified file is opened, if necessary,
and remains open until closed with
the
close()
function.
tty_cntl(cmd)-
Sends terminal-specific escape sequences to the display.
The sequences are only written to the
"tty" device and only if it is turned on for output.
The sequences are obtained from the system terminal-capability
data base using the value of the environmental variable
TERM. The following values for
cmd
are recognized:
"ho" - Move the cursor to the home position (upper left corner).
"cl" - Clear the screen.
"ce" - Clear to the end of the line.
"cd" - Clear from current position to the end of the screen.
"so" - Start text stand-out mode.
"se" - End text stand-out mode.
"md" - Start bold (intensified) mode.
"me" - End bold mode.
"us" - Start underline mode.
"ue" - End underline mode.
"mb" - Start blink mode. (Note, xterms don't blink.)
"mh" - Start half-bright mode.
"mr" - Start reverse video mode.
"up" - Move cursor up one line.
"do" - Move cursor down one line.
"le" - Move cursor left one space.
"nd" - Move cursor right one space (nondestructive).
"resized?" - A special option that
updates the
ROWS and
COLS variables in the event the window size has changed and returns
a nonzero value if the window size has changed since the last call
to
tty_cntl("resized?").
Returns
true if cmd
is recognized, otherwise returns
false .
tty_move(x, y [, string ])-
Moves the cursor to column
x
and row
y
of the display,
where column 0, row 0 is the upper left corner of the screen.
If the third argument
string
is present, it is written as a label at the given position.
The sequences and string are only written to the
"tty" device and only if it is turned on for output.
Special tty control sequences of the form
\[xx],
where
xx
is one of the codes listed for the
tty_cntl()
function above,
can be used with
string.
Negative
x
or
y
position the cursor relative to the left or bottom edges of the screen,
respectively.
Relative moves are possible by
adding ±1000 to
x
or
y
position arguments.
Both coordinates must specify either relative or absolute
moves.
If one coordinate specifies a relative move, the absolute move
in the other coordinate will be ignored.
Please note, not all terminal types support relative moves.
Returns
true .
tty_fmt(x, y, wid, string)-
Writes the string
string
to the screen starting at
column
x
and row
y,
where column 0, row 0 is the upper left corner of the screen.
The string is only written to the
"tty" device and only if it is turned on for output.
If
string
is longer than the width given by
wid,
the string is split at space characters such that no line is longer
then
wid.
Newlines in the string are retained, however.
The function will truncate words that are wider than
wid
and drop lines that would go off the bottom of the screen.
Special tty control sequences of the form
\[xx],
where
xx
is one of the codes listed for the
tty_cntl()
function above,
can be used with
string.
Negative
x
or
y
position the cursor relative to the left or bottom edges of the screen,
respectively.
The function returns the number of lines written.
|