spec

Software for Diffraction

files

conventions for file/device output

BUILT-IN FUNCTIONS

With this group of functions, the name "tty", when used for file_name, is special and refers to the user's terminal.

open()
Lists all open files. Returns zero.
open(file_name)
Makes file_name, which is a string constant or expression, available for output. Files are opened to append. Returns zero for success, -1 if the file can not be opened or if there are too many open files.
close(file_name)
Closes file_name and removes it from the table of files available for output. Returns zero for success, -1 if the file wasn't open. Any open file should be closed before attempting to modify the file with other UNIX utilities. Otherwise the file may be corrupted if two processes are writing to the file.
on()
Lists all open files and indicates which ones are currently turned on for output.
on(file_name)
Turns on file_name for output. All messages, except for some error and debugging messages, but including all print and printf() output, are sent to all turned-on devices. If file_name has not been made available for output with the open() function, it will be opened. Returns zero for success, -1 if the file can't be opened or if there are too many open files.
off(file_name)
Turns off output to file_name, but keeps it in the list of files available for output. If this was the last turned-on file or device, tty is turned back on automatically. Returns zero for success, -1 if the file wasn't open.

If the user changes spec's current directory, open files may be referenced either by the name with which the files were opened or by the correct path name relative to the current directory.

Errors during parsing or execution of commands, or typing a ^C turns off all open files except log files. (A log file is a file with a name beginning with the characters log.)

Files should be closed before attempting to edit them outside of spec.

GLOBALS

DATAFILE
Global variable, holds name of data file.

MACROS

ond
turns DATAFILE on.
offd
turns DATAFILE off.
ont
turns "tty" on.
offt
turns "tty" off.

SEE ALSO

newfile startup