Named output formats

The --output-format (or --format) command-line switch can be used to override the default format for how values are printed on the standard output. This format is used for values printed by the read-eval-print interactive interface. It is also used to control how values are printed when Kawa evaluates a file named on the command line (using the -f flag or a just a script name). (It also effects applications compiled with the --main flag.) It currently effects how values are printed by a load, though that may change.

The default format depends on the current programming language. For Scheme, the default is --scheme for read-eval-print interaction, and --ignore for files that are loaded.

The formats currently supported include the following:

scheme

Values are printed in a format matching the Scheme programming language, as if using display. "Groups" or "elements" are written as lists.

readable-scheme

Like scheme, as if using write: Values are generally printed in a way that they can be read back by a Scheme reader. For example, strings have quotation marks, and character values are written like ‘#\A’.

elisp

Values are printed in a format matching the Emacs Lisp programming language. Mostly the same as scheme.

readable-elisp

Like elisp, but values are generally printed in a way that they can be read back by an Emacs Lisp reader. For example, strings have quotation marks, and character values are written like ‘?A’.

clisp
commonlisp

Values are printed in a format matching the Common Lisp programming language, as if written by princ. Mostly the same as scheme.

readable-clisp
readable-commonlisp

Like clisp, but as if written by prin1: values are generally printed in a way that they can be read back by a Common Lisp reader. For example, strings have quotation marks, and character values are written like ‘#\A’.

xml

Values are printed in XML format. "Groups" or "elements" are written as using xml element syntax. Plain characters (such as ‘<’) are escaped (such as ‘&lt;’).

xhtml

Same as xml, but follows the xhtml compatibility guidelines.

html

Values are printed in HTML format. Mostly same as xml format, but certain element without body, are written without a closing tag. For example <img> is written without </img>, which would be illegal for html, but required for xml. Plain characters (such as ‘<’) are not escaped inside <script> or <style> elements.

cgi

The output should be a follow the CGI standards. I.e. assume that this script is invoked by a web server as a CGI script/program, and that the output should start with some response header, followed by the actual response data. To generate the response headers, use the response-header function. If the Content-type response header has not been specified, and it is required by the CGI standard, Kawa will attempt to infer an appropriate Content-ty[e depending on the following value.

ignore

Top-level values are ignored, instead of printed.