The first group of functions operate on stdin and stdout for interactiion with the user. The scan input functions with throw a run-time exception upon conversion failure.
Prints all arguments sequentially to stdout. The print variant includes a terminating newline, while the others do not.Prints all arguments sequentially to stderr. The printerr variant includes a terminating newline, while the others do not.
Read an integer from stdin. Use with caution, because events in the simulator are relatively asynchronous. The `d' in the dzscan command alias is for decimal, base-10. See also zscan_prompt.
Same as zscan, but takes a prompt string str as an argument and prints it to prompt the user.
Reads an integer, expected in binary, containing only 0's and 1's. Input should exclude any “0b” prefix.
Reads an integer, expected in hexadecimal. Input may include an optional “0x” prefix.
Read a boolean (0 or 1) from stdin. Use with caution, because events in the simulator are relatively asynchronous. See also bscan_prompt.
Same as bscan, but takes a prompt string str as an argument and prints it to prompt the user.
Same as sscan, but takes a prompt string str as an argument and prints it to prompt the user.
TODO: rscan is not yet available, but is trivial to add.
I/O can also operate on file streams.
Open file file for writing, overwrite previous contents. Subsequent calls to fprint will still continue to append to the file. If the file stream is already open, do nothing. Return true if the stream is opened successfully (or was already open).
Like fopen, except file is first opened in append mode, to not overwrite existing file. Call this before fprint to append to file.
Print args to file file by appending. Throw run-time exception if opening file fails. File streams are automatically closed and flushed upon library closing.
Read the next integer from input file file. Expects integer in decimal. Automatically opens new input file stream when referenced first time.
Read the next boolean from input file file. Automatically opens new input file stream when referenced first time.
Read the next boolean from input file file. Automatically opens new input file stream when referenced first time.
The following variants automatically restart a file stream once it reaches the end.
Read the next integer from input file file. Re-opens file to beginning after EOF is reached.