Named-output-formats.xhtml 6.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135
  1. <?xml version="1.0" encoding="UTF-8" standalone="no"?>
  2. <!DOCTYPE html><html xmlns="http://www.w3.org/1999/xhtml" xmlns:epub="http://www.idpf.org/2007/ops" xmlns:m="http://www.w3.org/1998/Math/MathML" xmlns:pls="http://www.w3.org/2005/01/pronunciation-lexicon" xmlns:ssml="http://www.w3.org/2001/10/synthesis" xmlns:svg="http://www.w3.org/2000/svg">
  3. <head>
  4. <title>Named output formats</title>
  5. <link rel="stylesheet" type="text/css" href="docbook-epub.css"/>
  6. <link rel="stylesheet" type="text/css" href="kawa.css"/>
  7. <script src="kawa-ebook.js" type="text/javascript"/>
  8. <meta name="generator" content="DocBook XSL-NS Stylesheets V1.79.1"/>
  9. <link rel="prev" href="Input-Output.xhtml" title="Input, output, and file handling"/>
  10. <link rel="next" href="Paths.xhtml" title="Paths - file name, URLs, and URIs"/>
  11. </head>
  12. <body>
  13. <header/>
  14. <section class="sect1" title="Named output formats" epub:type="subchapter" id="Named-output-formats">
  15. <div class="titlepage">
  16. <div>
  17. <div>
  18. <h2 class="title" style="clear: both">Named output formats</h2>
  19. </div>
  20. </div>
  21. </div>
  22. <p>The <code class="literal">--output-format</code> (or <code class="literal">--format</code>) command-line switch
  23. can be used to override the default format for how values are
  24. printed on the standard output. This format is used for values printed
  25. by the read-eval-print interactive interface. It is also used to
  26. control how values are printed when Kawa evaluates a file named on the
  27. command line (using the <code class="literal">-f</code> flag or just a script name).
  28. (It also affects applications compiled with the <code class="literal">--main</code> flag.)
  29. It currently affects how values are printed by a <code class="literal">load</code>,
  30. though that may change.
  31. </p>
  32. <p>The default format depends on the current programming language.
  33. For Scheme, the default is <code class="literal">scheme</code> for read-eval-print
  34. interaction, and <code class="literal">ignore</code> for files that are loaded.
  35. </p>
  36. <p>The formats currently supported include the following:
  37. </p>
  38. <div class="variablelist" epub:type="list">
  39. <dl class="variablelist">
  40. <dt class="term"><code class="literal">scheme</code>
  41. </dt>
  42. <dd>
  43. <p>Values are printed in a format matching the Scheme programming language,
  44. as if using <code class="literal">display</code>. "Groups" or "elements" are written as lists.
  45. </p>
  46. </dd>
  47. <dt class="term"><code class="literal">readable-scheme</code>
  48. </dt>
  49. <dd>
  50. <p>Like <code class="literal">scheme</code>, as if using <code class="literal">write</code>:
  51. Values are generally printed in a way that they can
  52. be read back by a Scheme reader. For example, strings have quotation marks,
  53. and character values are written like ‘<code class="literal">#\A</code>’.
  54. </p>
  55. </dd>
  56. <dt class="term"><code class="literal">elisp</code>
  57. </dt>
  58. <dd>
  59. <p>Values are printed in a format matching the Emacs Lisp programming language.
  60. Mostly the same as <code class="literal">scheme</code>.
  61. </p>
  62. </dd>
  63. <dt class="term"><code class="literal">readable-elisp</code>
  64. </dt>
  65. <dd>
  66. <p>Like <code class="literal">elisp</code>, but values are generally printed in a way that they can
  67. be read back by an Emacs Lisp reader. For example, strings have quotation
  68. marks, and character values are written like ‘<code class="literal">?A</code>’.
  69. </p>
  70. </dd>
  71. <dt class="term"><code class="literal">clisp</code>
  72. </dt>
  73. <dt class="term"><code class="literal">commonlisp</code>
  74. </dt>
  75. <dd>
  76. <p>Values are printed in a format matching the Common Lisp programming language,
  77. as if written by <code class="literal">princ</code>.
  78. Mostly the same as <code class="literal">scheme</code>.
  79. </p>
  80. </dd>
  81. <dt class="term"><code class="literal">readable-clisp</code>
  82. </dt>
  83. <dt class="term"><code class="literal">readable-commonlisp</code>
  84. </dt>
  85. <dd>
  86. <p>Like <code class="literal">clisp</code>, but as if written by <code class="literal">prin1</code>: values are generally
  87. printed in a way that they can be read back by a Common Lisp reader.
  88. For example, strings have quotation marks, and character values are
  89. written like ‘<code class="literal">#\A</code>’.
  90. </p>
  91. </dd>
  92. <dt class="term"><code class="literal">xml</code>
  93. </dt>
  94. <dt class="term"><code class="literal">xhtml</code>
  95. </dt>
  96. <dt class="term"><code class="literal">html</code>
  97. </dt>
  98. <dd>
  99. <p>Values are printed in XML, XHTML, or HTML format.
  100. This is discussed in more detail in <a class="link" href="Formatting-XML.xhtml" title="Formatting XML">Formatting XML</a>.
  101. </p>
  102. </dd>
  103. <dt class="term"><code class="literal">cgi</code>
  104. </dt>
  105. <dd>
  106. <p>The output should follow the CGI standards. I.e. assume that this
  107. script is invoked by a web server as a CGI script/program, and that the
  108. output should start with some response header,
  109. followed by the actual response data.
  110. To generate the response headers, use the <code class="literal">response-header</code> function.
  111. If the <code class="literal">Content-type</code> response header has not been specified, and
  112. it is required by the CGI standard, Kawa will attempt
  113. to infer an appropriate <code class="literal">Content-type</code> depending on the following value.
  114. </p>
  115. </dd>
  116. <dt class="term"><code class="literal">ignore</code>
  117. </dt>
  118. <dd>
  119. <p>Top-level values are ignored, instead of printed.
  120. </p>
  121. </dd>
  122. </dl>
  123. </div>
  124. </section>
  125. <footer>
  126. <div class="navfooter">
  127. <p>
  128. Up: <a accesskey="u" href="Input-Output.xhtml">Input, output, and file handling</a></p>
  129. <p>
  130. Next: <a accesskey="n" href="Paths.xhtml">Paths - file name, URLs, and URIs</a></p>
  131. </div>
  132. </footer>
  133. </body>
  134. </html>