next up previous contents index
Next: Unix-Related Facilities Up: System Predicates Previous: Meta Level

Input/Output

In this section, non-ground variables will either be printed with a specified name (like that in the argument of dump/1), or if one is not specified they are printed in one of the following formats:

_h%d

Heap variable.
_s%d

Local stack variable.
_t%d

Parametric variable in solver.
_S%d

Slack variable in solver.

Input/Output facilities are as follows.

dump(+L)

  List the collection of current constraints on the current output stream, projected with respect to the target variables in the list L. The list L must be explicitly supplied, that is, it is written syntactically as the argument of dump. The ordering of variables in the list is used to represent the priority of the target variables (see Section 3.5.2).

dump(+L1, +L2)

  A more flexible version of dump/1, without its syntactic restriction. Its first argument L1 represents the target variables, and its second argument L2, which must be ground, represents the new names to be used in the output. The elements of these two lists can be arbitrary terms. (See Section 3.5.2 for further explanation.) Note that dump/2 does not change the current collection of constraints.

nl

  Send a newline character to the current output stream.

print(?T)

 

write(?T)

  Print the term T, according to op declarations, on the current output stream.

writeln(?T)

  The same as write(T), nl.

printf(+F,+L)

  Print the terms in the list L on the current output stream in the format given by the string F. The behavior is similar to the printf library function in C. Every character except for the special escape or argument patterns will be printed unchanged on the output. The special escape characters begin with a `` tex2html_wrap_inline4547 '' and are:

tabular1129

The argument patterns all begin with ``%'' and are used to denote the formatting for each of corresponding terms in the list L. A ``%%'' denotes a single percent. Otherwise the format takes the form of an optional field width and optional precision followed by one of the C printf conversion characters. More precisely this can be described with the regular expression:

 
		%[[-][0-9]*][ tex2html_wrap_inline4547 .[0-9]*][fegdoxcus%]

bsphackfloatpenalty -Mii floatpenalty-Miii parmoderrfloatpenalty@ nextcurrboxfreelist currbox-2floatpenalty@ fltovf currboxtempboxa tempboxa @floatesphackbsphackfloatpenalty -Mii floatpenalty-Miii parmoderrfloatpenalty@ nextcurrboxfreelist currbox-3floatpenalty@ fltovf currboxtempboxa tempboxa @floatesphack The integral specifiers will print the real number, which has been rounded to an integer using the ``even'' rounding rule. bsphackfloatpenalty -Mii floatpenalty-Miii parmoderrfloatpenalty@ nextcurrboxfreelist currbox-4floatpenalty@ fltovf currboxtempboxa tempboxa @floatesphack An empty list is needed if no variables are to be printed. As a convenience, a single ``%'' may be used instead of a specific argument format and a default format appropriate to that particular argument will be used (with numbers the default is printf format ``%g''). For example,


printf("X = % Y =%3.2g tex2html_wrap_inline4547 n", [X, Y]).

bsphackfloatpenalty -Mii floatpenalty-Miii parmoderrfloatpenalty@ nextcurrboxfreelist currbox-2floatpenalty@ fltovf currboxtempboxa tempboxa @floatesphackbsphackfloatpenalty -Mii floatpenalty-Miii parmoderrfloatpenalty@ nextcurrboxfreelist currbox-3floatpenalty@ fltovf currboxtempboxa tempboxa @floatesphack

printf_to_atom(?A, +F, +L)

  Like printf/2 except that instead of being printed A is equated with an atom whose string is the same as what would otherwise be printed. bsphackfloatpenalty -Mii floatpenalty-Miii parmoderrfloatpenalty@ nextcurrboxfreelist currbox-4floatpenalty@ fltovf currboxtempboxa tempboxa @floatesphack

read(-X)

  Read a term from the current input and bind the variable X to it. Any variables in the input term are deemed to be disjoint from variables appearing in the rule. If an end of file is read, the term ?-(end) is returned. Finally, the term obtained is in quoted form. That is, any arithmetic operators are treated syntactically.

see(+F)

  Make F the current input file.

seeing(?F)

  True when F is the current input file.

seen

  Close current input file. Revert to ``user'' (standard input).

tell(+F)

  Make F the current output file.

telling(?F)

  True when F is the current output file.

told

  Close current output file. Revert to ``user'' (standard output).

flush

  Flush the buffer associated with the current output file.


next up previous contents index
Next: Unix-Related Facilities Up: System Predicates Previous: Meta Level

Alan Borning
Fri Oct 8 12:51:18 PDT 1999