Options.xhtml 43 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904
  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>Command-line arguments</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="Running.xhtml" title="How to start up and run Kawa"/>
  10. <link rel="next" href="Scripts.xhtml" title="Running Command Scripts"/>
  11. </head>
  12. <body>
  13. <header/>
  14. <section class="sect1" title="Command-line arguments" epub:type="subchapter" id="Options">
  15. <div class="titlepage">
  16. <div>
  17. <div>
  18. <h2 class="title" style="clear: both">Command-line arguments</h2>
  19. </div>
  20. </div>
  21. </div>
  22. <a id="idm139667880310992" class="indexterm"/>
  23. <p>You can pass various flags to Kawa, for example:
  24. </p>
  25. <pre class="screen">kawa -e '(display (+ 12 4))(newline)'
  26. </pre>
  27. <p>or:
  28. </p>
  29. <pre class="screen">java kawa.repl -e '(display (+ 12 4))(newline)'
  30. </pre>
  31. <p>Either causes Kawa to print ‘<code class="literal">16</code>’, and then exit.
  32. </p>
  33. <p>At startup, Kawa executes an init file from the user’s home
  34. directory.
  35. The init file is named <code class="literal">.kawarc.scm</code> on Unix-like systems
  36. (those for which the file separator is <code class="literal">'/'</code>),
  37. and <code class="literal">kawarc.scm</code> on other systems.
  38. This is done before the read-eval-print loop
  39. or before the first <code class="literal">-f</code> or <code class="literal">-c</code> argument. (It is not run
  40. for a <code class="literal">-e</code> command, to allow you to set options to override
  41. the defaults.)
  42. </p>
  43. <section class="sect2" title="Argument processing" epub:type="division" id="idm139667880304720">
  44. <div class="titlepage">
  45. <div>
  46. <div>
  47. <h3 class="title">Argument processing</h3>
  48. </div>
  49. </div>
  50. </div>
  51. <p>Kawa processes the command-line arguments in order.
  52. Options (which either start with ‘<code class="literal">-</code>’ or contain a ‘<code class="literal">=</code>’)
  53. may “use up” one or more command arguments.
  54. Some of the options (‘<code class="literal">-c</code>’, ‘<code class="literal">-e</code>’, ‘<code class="literal">-f</code>’, ‘<code class="literal">-s</code>’,
  55. ‘<code class="literal">-C</code>’, <code class="literal">-w</code>, ‘<code class="literal">--</code>’, <code class="literal">--browse-manual</code>)
  56. are <em class="firstterm">action options</em>; others set various properties.
  57. </p>
  58. <p>When all the command-line arguments have been “used up”
  59. and if no action options have been seen,
  60. then Kawa enters an interactive read-eval-print loop.
  61. (If an action option has been seen, we’re done.)
  62. </p>
  63. <p>If the next command-line argument is not an option
  64. (does not start with ‘<code class="literal">-</code>’ nor contains a ‘<code class="literal">=</code>’)
  65. then we’re done if we’ve seen an action option (and the
  66. last action option wasn’t preceded by <code class="literal">--with-arg-count</code>).
  67. (Presumably any remaining arguments were command-line-arguments
  68. used by the action option.)
  69. </p>
  70. <p>Otherwise, the first remaining argument names either a
  71. file that is read and evaluated, or a compiled class.
  72. In the former case, the whole file is read and compiled as a module
  73. before being loaded (unlike the <code class="literal">-f</code> flag which reads and
  74. evaluates the file command by command.)
  75. If the argument is the fully-qualified name of a class,
  76. then the class is loaded, an instance allocated,
  77. and its <code class="literal">run</code> method invoked. If the class was compiled from
  78. a Kawa Scheme module, then invoking <code class="literal">run</code> has the
  79. effect of evaluating the module body.
  80. The <code class="literal">command-line-arguments</code> vector is set to any remaining
  81. arguments after the file/class name.
  82. (This can be overridden with the <code class="literal">--with-arg-count</code> option.
  83. Command-line processing continues if there are any further arguments.)
  84. </p>
  85. </section>
  86. <section class="sect2" title="General options" epub:type="division" id="idm139667880292032">
  87. <div class="titlepage">
  88. <div>
  89. <div>
  90. <h3 class="title">General options</h3>
  91. </div>
  92. </div>
  93. </div>
  94. <div class="variablelist" epub:type="list">
  95. <dl class="variablelist">
  96. <dt class="term"><code class="literal">-e <em class="replaceable"><code>expr</code></em></code>
  97. </dt>
  98. <dd>
  99. <p>Kawa evaluates <em class="replaceable"><code>expr</code></em>, which contains one or more Scheme expressions.
  100. Does not cause the <code class="literal">~/.kawarc.scm</code> init file to be run.
  101. </p>
  102. </dd>
  103. <dt class="term"><code class="literal">-c <em class="replaceable"><code>expr</code></em></code>
  104. </dt>
  105. <dd>
  106. <p>Same as ‘<code class="literal">-e <em class="replaceable"><code>expr</code></em></code>’, except that it
  107. does cause the <code class="literal">~/.kawarc.scm</code> init file to be run.
  108. </p>
  109. </dd>
  110. <dt class="term"><code class="literal">-f <em class="replaceable"><code>filename-or-url</code></em></code>
  111. </dt>
  112. <dd>
  113. <p>Kawa reads and evaluates expressions from the file named
  114. by <em class="replaceable"><code>filename-or-url</code></em>. If the latter is ‘<code class="literal">-</code>’,
  115. standard input is read (with no prompting). Otherwise,
  116. it is equivalent to evaluating ‘<code class="literal">(load "<em class="replaceable"><code>filename-or-url</code></em>")</code>’.
  117. The <em class="replaceable"><code>filename-or-url</code></em> is interpreted as a URL
  118. if it is absolute - it starts with a "URI scheme" like <code class="literal">http:</code>.
  119. </p>
  120. </dd>
  121. <dt class="term"><code class="literal">-s</code>
  122. </dt>
  123. <dt class="term"><code class="literal">--</code>
  124. </dt>
  125. <dd>
  126. <p>The remaining arguments (if any) are passed to ‘<code class="literal">command-line-arguments</code>’
  127. and (the <code class="literal">cdr</code> of) <code class="literal">(command-line</code>),
  128. and an interactive read-eval-print loop is started.
  129. This uses the same "console" as where you started up Kawa;
  130. use ‘<code class="literal">-w</code>’ to get a new window.
  131. </p>
  132. </dd>
  133. <dt class="term"><code class="literal">--script <em class="replaceable"><code>filename-or-url</code></em></code>
  134. </dt>
  135. <dt class="term"><code class="literal">--script<em class="replaceable"><code>N</code></em> <em class="replaceable"><code>filename-or-url</code></em></code>
  136. </dt>
  137. <dd>
  138. <p>The global variable ‘<code class="literal">command-line-arguments</code>’ is set to the remaining
  139. arguments (if any).
  140. Kawa reads and evaluates expressions from the file named
  141. by <em class="replaceable"><code>filename-or-url</code></em>.
  142. If <code class="literal">script</code> is followed by an integer <em class="replaceable"><code>N</code></em>,
  143. then <em class="replaceable"><code>N</code></em> lines are skipped first.
  144. </p>
  145. <p>Skipping some initial lines is useful if you want to have a non-Kawa
  146. preamble before the actual Kawa code.
  147. One use for this is for Kawa shell scripts (see <a class="link" href="Scripts.xhtml" title="Running Command Scripts">Scripts</a>).
  148. </p>
  149. </dd>
  150. <dt class="term"><code class="literal">-w</code>
  151. </dt>
  152. <dt class="term"><code class="literal">-w<em class="replaceable"><code>sub-option</code></em></code>
  153. </dt>
  154. <dd>
  155. <p>Creates a new top-level window, and runs an interactive read-eval-print
  156. in the new window. See <a class="link" href="REPL-Console.xhtml#New-Window">New-Window</a>.
  157. Same as <code class="literal">-e (scheme-window #t)</code>.
  158. You can specify multiple ‘<code class="literal">-w</code>’ options, and also use ‘<code class="literal">-s</code>’.
  159. </p>
  160. </dd>
  161. <dt class="term"><code class="literal">--help</code>
  162. </dt>
  163. <dd>
  164. <p>Prints out some help.
  165. </p>
  166. </dd>
  167. <dt class="term"><code class="literal">--version</code>
  168. </dt>
  169. <dd>
  170. <p>Prints out the Kawa version number, and then exits.
  171. </p>
  172. <p>If Kawa was built with a <code class="literal">.git</code> repository present,
  173. also prints the result of <code class="literal">git describe</code>.
  174. <span id="browse-manual-option"/></p>
  175. </dd>
  176. <dt class="term"><code class="literal">--browse-manual</code>
  177. </dt>
  178. <dt class="term"><code class="literal">--browse-manual=<em class="replaceable"><code>command</code></em></code>
  179. </dt>
  180. <dd>
  181. <p>Browse a local copy of the documentation (this manual).
  182. </p>
  183. <p>This creates a mini web-server that reads
  184. from <code class="literal">doc/kawa-manual.epub</code>, which is
  185. included in the binary distributions, but not built by default from source.
  186. </p>
  187. <p>If no <em class="replaceable"><code>command</code></em> is specified, creates a new window or tab
  188. in your default web browser.
  189. If <em class="replaceable"><code>command</code></em> is a string containing <code class="literal">%U</code>,
  190. then Kawa replaces <code class="literal">%U</code> with a URL that references itself,
  191. and then executes the resulting command.
  192. If <em class="replaceable"><code>command</code></em> does not contain <code class="literal">%U</code>, then
  193. <em class="replaceable"><code>command</code></em> becomes <em class="replaceable"><code>command</code></em><code class="literal">" %U"</code>.
  194. For example to use the Firefox browser to browse the manual do either of:
  195. </p>
  196. <pre class="screen">kawa --browse-manual=firefox
  197. kawa --browse-manual="firefox %U"
  198. </pre>
  199. </dd>
  200. <dt class="term"><code class="literal">--server <em class="replaceable"><code>portnum</code></em></code>
  201. </dt>
  202. <dd>
  203. <p>Start a server listening from connections on the specified <em class="replaceable"><code>portnum</code></em>.
  204. Each connection using the Telnet protocol causes a new read-eval-print-loop
  205. to start. This option allows you to connect using any
  206. Telnet client program to a remote "Kawa server".
  207. </p>
  208. </dd>
  209. <dt class="term"><code class="literal">--with-arg-count=<em class="replaceable"><code>argc</code></em></code>
  210. </dt>
  211. <dd>
  212. <p>This option is used before an action option (such as <code class="literal">-f</code>).
  213. The <em class="replaceable"><code>argc</code></em> arguments after the action become the
  214. value of the <code class="literal">command-line-arguments</code> during the action.
  215. When the action is finished, command-line-processing resumes
  216. after skipping the <em class="replaceable"><code>argc</code></em> arguments.
  217. </p>
  218. <p>For example:
  219. </p>
  220. <pre class="screen">$ kawa -f a.scm -f b.scm x y
  221. </pre>
  222. <p>When evaluating <code class="literal">a.scm</code> the <code class="literal">command-line-arguments</code>
  223. by default is <span class="emphasis"><em>all</em></span> the remaining arguments: <code class="literal">["-f" "b.scm" "x" "y"]</code>.
  224. Then <code class="literal">b.scm</code> is evaluated with <code class="literal">command-line-arguments</code>
  225. set to <code class="literal">["x" "y"]</code>
  226. </p>
  227. <pre class="screen">$ kawa --with-arg-count=0 -f a.scm -f b.scm x y
  228. </pre>
  229. <p>In this case <code class="literal">a.scm</code> is evaluated with <code class="literal">command-line-arguments</code>
  230. set to the empty vector <code class="literal">[]</code>, and then <code class="literal">b.scm</code> is evaluated with <code class="literal">command-line-arguments</code>
  231. set to <code class="literal">["x" "y"]</code>
  232. </p>
  233. <pre class="screen">$ kawa --with-arg-count=4 -f a.scm -f b.scm x y
  234. </pre>
  235. <p>In this case <code class="literal">a.scm</code> is evaluated with <code class="literal">command-line-arguments</code>
  236. set to <code class="literal">["-f" "b.scm" "x" "y"]</code>. Since command-line processing
  237. skips the arguments specified by <code class="literal">--with-arg-count=4</code>,
  238. in this case <code class="literal">b.scm</code> is not evaluated.
  239. </p>
  240. </dd>
  241. </dl>
  242. </div>
  243. </section>
  244. <section class="sect2" title="Options for language selection" epub:type="division" id="idm139667880239696">
  245. <div class="titlepage">
  246. <div>
  247. <div>
  248. <h3 class="title">Options for language selection</h3>
  249. </div>
  250. </div>
  251. </div>
  252. <div class="variablelist" epub:type="list">
  253. <dl class="variablelist">
  254. <dt class="term"><code class="literal">--scheme</code>
  255. </dt>
  256. <dd>
  257. <p>Set the default language to Scheme.
  258. (This is the default unless you select another language,
  259. or you name a file with a known extension on the command-line.)
  260. </p>
  261. </dd>
  262. <dt class="term"><code class="literal">--r5rs</code>
  263. </dt>
  264. <dt class="term"><code class="literal">--r6rs</code>
  265. </dt>
  266. <dt class="term"><code class="literal">--r7rs</code>
  267. </dt>
  268. <dd>
  269. <p>Provide better compatibility with the specified Scheme standards.
  270. (This is a work-in-progress.)
  271. For example <code class="literal">--r6rs</code> aims to disable Kawa extensions
  272. that conflict with R6RS. It does not aim to disable all extensions,
  273. only incompatible extensions.
  274. These extensions disable the colon operator and keyword literals,
  275. as well as the use of initial ‘<code class="literal">@</code>’ as a splicing operator.
  276. The “<code class="literal">l</code>” exponent suffix of a number literal creates a
  277. floating-point double, rather than a <code class="literal">BigInteger</code>.
  278. Selecting <code class="literal">--r5rs</code> makes symbols by default
  279. case-insensitive.
  280. </p>
  281. </dd>
  282. <dt class="term"><code class="literal">--elisp</code>
  283. </dt>
  284. <dt class="term"><code class="literal">--emacs</code>
  285. </dt>
  286. <dt class="term"><code class="literal">--emacs-lisp</code>
  287. </dt>
  288. <dd>
  289. <p>Set the default language to Emacs Lisp.
  290. (The implementation is quite incomplete.)
  291. </p>
  292. </dd>
  293. <dt class="term"><code class="literal">--lisp</code>
  294. </dt>
  295. <dt class="term"><code class="literal">--clisp</code>
  296. </dt>
  297. <dt class="term"><code class="literal">--clisp</code>
  298. </dt>
  299. <dt class="term"><code class="literal">--commonlisp</code>
  300. </dt>
  301. <dt class="term"><code class="literal">--common-lisp</code>
  302. </dt>
  303. <dd>
  304. <p>Set the default language to CommonLisp.
  305. (The implementation is <span class="emphasis"><em>very</em></span> incomplete.)
  306. </p>
  307. </dd>
  308. <dt class="term"><code class="literal">--krl</code>
  309. </dt>
  310. <dd>
  311. <p>Set the default language to KRL. See <a class="link" href="XML-beyond-Scheme.xhtml#KRL" title="KRL - The Kawa Report Language for generating XML/HTML">KRL</a>.
  312. </p>
  313. </dd>
  314. <dt class="term"><code class="literal">--brl</code>
  315. </dt>
  316. <dd>
  317. <p>Set the default language to KRL, in BRL-compatibility mode. See <a class="link" href="XML-beyond-Scheme.xhtml#KRL" title="KRL - The Kawa Report Language for generating XML/HTML">KRL</a>.
  318. </p>
  319. </dd>
  320. <dt class="term"><code class="literal">--xquery</code>
  321. </dt>
  322. <dd>
  323. <p>Set the default language to the draft XML Query language.
  324. See the <a class="ulink" href="http://www.gnu.org/software/qexo/" target="_top">Kawa-XQuery page</a>
  325. for more information.
  326. </p>
  327. </dd>
  328. <dt class="term"><code class="literal">--xslt</code>
  329. </dt>
  330. <dd>
  331. <p>Set the default language to XSLT (XML Stylesheet Language Transformations).
  332. (The implementation is <span class="emphasis"><em>very</em></span> incomplete.)
  333. See the <a class="ulink" href="http://www.gnu.org/software/qexo/xslt.html" target="_top">Kawa-XSLT page</a>
  334. for more information.
  335. </p>
  336. </dd>
  337. <dt class="term"><code class="literal">--pedantic</code>
  338. </dt>
  339. <dd>
  340. <p>Try to follow the approprate language specification to the letter,
  341. even in corner cases, and even if it means giving up some
  342. Kawa convenience features. This flag so far only affects
  343. the XQuery parser, but that will hopefully change.
  344. </p>
  345. </dd>
  346. </dl>
  347. </div>
  348. </section>
  349. <section class="sect2" title="Options for warnings and errors" epub:type="division" id="idm139667880216944">
  350. <div class="titlepage">
  351. <div>
  352. <div>
  353. <h3 class="title">Options for warnings and errors</h3>
  354. </div>
  355. </div>
  356. </div>
  357. <div class="variablelist" epub:type="list">
  358. <a id="idm139667880215856" class="indexterm"/>
  359. <a id="idm139667880214656" class="indexterm"/>
  360. <a id="idm139667880213456" class="indexterm"/>
  361. <dl class="variablelist">
  362. <dt class="term"><code class="literal">--warn-undefined-variable</code>
  363. </dt>
  364. <dd>
  365. <p>Emit a warning if the code references a variable which is neither in
  366. lexical scope nor in the compile-time dynamic (global) environment.
  367. This is useful for catching typos.
  368. (A <code class="literal">define-variable</code> form can be used to silence warnings.
  369. It declares to the compiler that a variable is to be resolved dynamically.)
  370. This defaults to on;
  371. to turn it off use the <code class="literal">--no-warn-undefined-variable</code> flag.
  372. <a id="idm139667880210224" class="indexterm"/>
  373. </p>
  374. </dd>
  375. <dt class="term"><code class="literal">--warn-unknown-member</code>
  376. </dt>
  377. <dd>
  378. <p>Emit a warning if the code references a named member (field or method)
  379. for which there is no match in the compile-time type of the receiver.
  380. This defaults to on;
  381. to turn it off use the <code class="literal">--no-warn-unknown-member</code> flag.
  382. <a id="idm139667880207712" class="indexterm"/>
  383. </p>
  384. </dd>
  385. <dt class="term"><code class="literal">--warn-invoke-unknown-method</code>
  386. </dt>
  387. <dd>
  388. <p>Emit a warning if the <code class="literal">invoke</code> function calls a named method
  389. for which there is no matching method in the compile-time type of the receiver.
  390. This defaults to the value of <code class="literal">--warn-unknown-member</code>,
  391. to turn it off use the <code class="literal">--no-warn-invoke-unknown-method</code> flag.
  392. <a id="idm139667880204304" class="indexterm"/>
  393. </p>
  394. </dd>
  395. <dt class="term"><code class="literal">--warn-unused</code>
  396. </dt>
  397. <dd>
  398. <p>Emit a warning if a variable is unused or code never executed. This defaults
  399. to on; to turn it off use the <code class="literal">--no-warn-unused</code> flag.
  400. <a id="idm139667880201888" class="indexterm"/>
  401. </p>
  402. </dd>
  403. <dt class="term"><code class="literal">--warn-unreachable</code>
  404. </dt>
  405. <dd>
  406. <p>Emit a warning if the code can never be executed. This defaults to on;
  407. to turn it off use the <code class="literal">--no-warn-unreachable</code> flag.
  408. <a id="idm139667880199488" class="indexterm"/>
  409. </p>
  410. </dd>
  411. <dt class="term"><code class="literal">--warn-void-used</code>
  412. </dt>
  413. <dd>
  414. <p>Emit a warning if an expression depends on an expression
  415. that is void (always has zero values), including call to <code class="literal">void</code>
  416. functions and method. Also warn if an expression depends on a
  417. conditional (<code class="literal">if</code>) that has no “else” clause.
  418. Examples include using the value of <code class="literal">set-car!</code> as
  419. an argument to a function, or to initialize a variable.
  420. This defaults to on;
  421. to turn it off use the <code class="literal">--no-warn-void-used</code> flag.
  422. <a id="idm139667880195456" class="indexterm"/>
  423. </p>
  424. </dd>
  425. <dt class="term"><code class="literal">--warn-as-error</code>
  426. </dt>
  427. <dd>
  428. <p>Treat a compilation warning as if it were an error and halt compilation.
  429. </p>
  430. </dd>
  431. </dl>
  432. </div>
  433. <p>An option can be followed by a value, as
  434. in <code class="literal">--warn-invoke-unknown-method=no</code>.
  435. For boolean options, the values <code class="literal">yes</code>, <code class="literal">true</code>, <code class="literal">on</code>, or <code class="literal">1</code>
  436. enable the option, while <code class="literal">no</code>, <code class="literal">false</code>, <code class="literal">off</code>,
  437. or <code class="literal">0</code> disable it.
  438. You can also negate an option by prefixing it with <code class="literal">no-</code>:
  439. The option <code class="literal">--no-warn-unknown-member</code>
  440. is the same as <code class="literal">--warn-unknown-member=no</code>.
  441. </p>
  442. <p>These options can also be used in the module source, using
  443. <code class="literal">module-compile-options</code> or <code class="literal">with-compile-options</code>.
  444. (In that case they override the options on the command line.)
  445. </p>
  446. </section>
  447. <section class="sect2" title="Options for setting variables" epub:type="division" id="idm139667880186288">
  448. <div class="titlepage">
  449. <div>
  450. <div>
  451. <h3 class="title">Options for setting variables</h3>
  452. </div>
  453. </div>
  454. </div>
  455. <div class="variablelist" epub:type="list">
  456. <dl class="variablelist">
  457. <dt class="term"><code class="literal"><em class="replaceable"><code>name</code></em>=<em class="replaceable"><code>value</code></em></code>
  458. </dt>
  459. <dd>
  460. <p>Set the global variable with the specified <em class="replaceable"><code>name</code></em> to the given <em class="replaceable"><code>value</code></em>.
  461. The type of the <em class="replaceable"><code>value</code></em> is currently unspecified; the plan is for it
  462. to be like XQuery’s <em class="firstterm">untyped atomic</em> which can be coerced as needed.
  463. </p>
  464. </dd>
  465. <dt class="term"><code class="literal">{<em class="replaceable"><code>namespace-uri</code></em>}<em class="replaceable"><code>local-name</code></em>=<em class="replaceable"><code>value</code></em></code>
  466. </dt>
  467. <dd>
  468. <p>Set the global variable with the specified namespace uri and
  469. namespace-local name to the given value.
  470. </p>
  471. </dd>
  472. </dl>
  473. </div>
  474. <p>These options are processed when invoking the <code class="literal">kawa</code>
  475. application (i.e. the <code class="literal">kawa.repl</code> application).
  476. If you want a Kawa application compiled with <code class="literal">--main</code>
  477. to process these these assignments, call the
  478. <code class="literal">process-command-line-assignments</code> utility function.
  479. </p>
  480. <div class="variablelist" epub:type="list">
  481. <dl class="variablelist">
  482. <dt class="term"><code class="literal">-D<em class="replaceable"><code>variable-name</code></em>=<em class="replaceable"><code>variable-value</code></em></code>
  483. </dt>
  484. <dd>
  485. <p>Sets the JVM property <em class="replaceable"><code>variable-name</code></em> to <em class="replaceable"><code>variable-value</code></em>,
  486. using the <code class="literal">setProperty</code> method of <code class="literal">java.lang.System</code>.
  487. </p>
  488. </dd>
  489. </dl>
  490. </div>
  491. </section>
  492. <section class="sect2" title="Options for the REPL console" epub:type="division" id="idm139667880172992">
  493. <div class="titlepage">
  494. <div>
  495. <div>
  496. <h3 class="title">Options for the REPL console</h3>
  497. </div>
  498. </div>
  499. </div>
  500. <div class="variablelist" epub:type="list">
  501. <dl class="variablelist">
  502. <dt class="term"><code class="literal">--console</code>
  503. </dt>
  504. <dt class="term"><code class="literal">--no-console</code>
  505. </dt>
  506. <dd>
  507. <p>Usually Kawa can detect when the standard input port is a “console”
  508. or “terminal”, but these are useful for overriding that detection.
  509. The <code class="literal">--console</code> flag is useful when the standard input is a pipe,
  510. but you want to direct Kawa to treat it as an interactive terminal.
  511. The <code class="literal">--no-console</code> flag was useful for older pre-Java-6
  512. implementations that did not have the <code class="literal">java.lang.Console</code> class.
  513. </p>
  514. </dd>
  515. <dt class="term"><code class="literal">console:type=</code><em class="replaceable"><code>console-types</code></em>
  516. </dt>
  517. <dt class="term"><code class="literal">console:use-jline=</code>[<code class="literal">yes</code>|<code class="literal">no</code>]
  518. </dt>
  519. <dt class="term"><code class="literal">console:jline-mouse=</code>[<code class="literal">yes</code>|<code class="literal">no</code>]
  520. </dt>
  521. <dd>
  522. <p>See the <a class="link" href="REPL-Console.xhtml" title="The REPL (read-eval-print-loop) console">REPL Console</a> section.
  523. </p>
  524. </dd>
  525. <dt class="term"><code class="literal">console:prompt1=<em class="replaceable"><code>prompt1</code></em></code>
  526. </dt>
  527. <dt class="term"><code class="literal">console:prompt2=<em class="replaceable"><code>prompt2</code></em></code>
  528. </dt>
  529. <dd>
  530. <p>Initialize <a class="link" href="Ports.xhtml#input-prompt1"><code class="literal">input-promp1</code> and <code class="literal">input-prompt2</code></a>, respectively.
  531. </p>
  532. </dd>
  533. </dl>
  534. </div>
  535. <p>See also the <code class="literal">--output-format</code> flag.
  536. </p>
  537. </section>
  538. <section class="sect2" title="Options for controlling output formatting" epub:type="division" id="idm139667880159184">
  539. <div class="titlepage">
  540. <div>
  541. <div>
  542. <h3 class="title">Options for controlling output formatting</h3>
  543. </div>
  544. </div>
  545. </div>
  546. <a id="idm139667880158208" class="indexterm"/>
  547. <div class="variablelist" epub:type="list">
  548. <dl class="variablelist">
  549. <dt class="term"><code class="literal">--output-format <em class="replaceable"><code>format</code></em></code>
  550. </dt>
  551. <dt class="term"><code class="literal">--format <em class="replaceable"><code>format</code></em></code>
  552. </dt>
  553. <dd>
  554. <p>Change the default output format to that specified by <em class="replaceable"><code>format</code></em>.
  555. See <a class="link" href="Named-output-formats.xhtml" title="Named output formats">Named output formats</a> for more information and a list.
  556. </p>
  557. </dd>
  558. </dl>
  559. </div>
  560. <div class="variablelist" epub:type="list">
  561. <dl class="variablelist">
  562. <dt class="term"><code class="literal">out:base=<em class="replaceable"><code>integer</code></em></code>
  563. </dt>
  564. <dd>
  565. <p>The number base (radix) to use by default when printing rational numbers.
  566. Must be an integer between 2 and 36, and the default is of course 10.
  567. For example the option <code class="literal">out:base=16</code> produces hexadecimal output.
  568. Equivalent to setting the <code class="literal">*print-base*</code> variable.
  569. </p>
  570. </dd>
  571. <dt class="term"><code class="literal">out:radix=no|yes</code>
  572. </dt>
  573. <dd>
  574. <p>If true, prints an indicator of the radix used when printing rational numbers.
  575. The default is <code class="literal">no</code>.
  576. Equivalent to setting the <code class="literal">*print-radix*</code> variable.
  577. </p>
  578. </dd>
  579. <dt class="term"><code class="literal">out:doctype-system=<em class="replaceable"><code>system-identifier</code></em></code>
  580. </dt>
  581. <dd>
  582. <p>If <code class="literal">out:doctype-system</code> is specified then a <code class="literal">DOCTYPE</code> declaration
  583. is written before writing a top-level XML element, using
  584. the specified <em class="replaceable"><code>system-identifier</code></em>.
  585. </p>
  586. </dd>
  587. <dt class="term"><code class="literal">out:doctype-public=<em class="replaceable"><code>public-identifier</code></em></code>
  588. </dt>
  589. <dd>
  590. <p>Ignored unless <code class="literal">out:doctype-system</code> is also specified,
  591. in which case the <em class="replaceable"><code>public-identifier</code></em> is written
  592. as the public identifiers of the <code class="literal">DOCTYPE</code> declaration.
  593. </p>
  594. </dd>
  595. <dt class="term"><code class="literal">out:xml-indent=<em class="replaceable"><code>kind</code></em></code>
  596. </dt>
  597. <dd>
  598. <p>Controls whether extra line breaks and indentation are added
  599. when printing XML.
  600. If <em class="replaceable"><code>kind</code></em> is <code class="literal">always</code> or <code class="literal">yes</code> then newlines and
  601. appropriate indentation are added before and after each element.
  602. If <em class="replaceable"><code>kind</code></em> is <code class="literal">pretty</code> then the pretty-printer is used
  603. to only add new lines when an element otherwise won’t fit on a single line.
  604. If <em class="replaceable"><code>kind</code></em> is <code class="literal">no</code> (the default) then no extra line breaks
  605. or indentation are added.
  606. </p>
  607. </dd>
  608. <dt class="term"><code class="literal">out:line-length=<em class="replaceable"><code>columns</code></em></code>
  609. </dt>
  610. <dt class="term"><code class="literal">out:right-margin=<em class="replaceable"><code>columns</code></em></code>
  611. </dt>
  612. <dd>
  613. <p>Specifies the maximum number of number of columns in a line
  614. when the pretty-printer decides where to break a line.
  615. (The two options are equivalent.)
  616. </p>
  617. </dd>
  618. </dl>
  619. </div>
  620. </section>
  621. <section class="sect2" title="Options for compiling and optimizing" epub:type="division" id="idm139667880136112">
  622. <div class="titlepage">
  623. <div>
  624. <div>
  625. <h3 class="title">Options for compiling and optimizing</h3>
  626. </div>
  627. </div>
  628. </div>
  629. <div class="variablelist" epub:type="list">
  630. <dl class="variablelist">
  631. <dt class="term"><code class="literal">--target <em class="replaceable"><code>version</code></em></code>
  632. </dt>
  633. <dd>
  634. <p>The <em class="replaceable"><code>version</code></em> can be a JDK or Java specification version:
  635. <code class="literal">5</code>, <code class="literal">6</code>, or <code class="literal">7</code>.
  636. The JDK versions <code class="literal">1.5</code> and <code class="literal">1.6</code> are equivalent to <code class="literal">5</code>
  637. or <code class="literal">6</code>, respectively.
  638. Specify a JVM (classfile) version to target. This is useful
  639. if (for example) you use Java 6, but want to create <code class="literal">.class</code> files
  640. that can run on Java 5. In that case specify <code class="literal">--target 5</code>.
  641. </p>
  642. </dd>
  643. </dl>
  644. </div>
  645. <p>The following options control which calling conventions are used:
  646. </p>
  647. <div class="variablelist" epub:type="list">
  648. <dl class="variablelist">
  649. <dt class="term"><code class="literal">--full-tailcalls</code>
  650. </dt>
  651. <dd>
  652. <p>Use a calling convention that supports proper tail recursion.
  653. </p>
  654. </dd>
  655. <dt class="term"><code class="literal">--no-full-tailcalls</code>
  656. </dt>
  657. <dd>
  658. <p>Use a calling convention that does not support proper tail recursion.
  659. Self-tail-recursion (i.e. a recursive call to the current function)
  660. is still implemented correctly, assuming that the called function
  661. is known at compile time.
  662. </p>
  663. </dd>
  664. <dt class="term"><code class="literal">--no-inline</code>
  665. </dt>
  666. <dd>
  667. <p>Disable inlining of known functions and methods.
  668. The generated code runs slower, but you can more reliably trace procedures.
  669. Normally Kawa will assume that a procedure <code class="literal">fn</code>
  670. declared using a <code class="literal">(define (fn args) body)</code> form is constant,
  671. assuming it isn’t modified in the current module. However, it is
  672. possible some other module might modify the binding of <code class="literal">fn</code>.
  673. You can use the <code class="literal">--no-inline</code> to disable the assumption that <code class="literal">fn</code>
  674. is constant.
  675. </p>
  676. </dd>
  677. </dl>
  678. </div>
  679. <p>The default is currently <code class="literal">--no-full-tailcalls</code> because
  680. it is usually faster.
  681. It is also closer to the Java call model, so may be better for people
  682. primarily interested in using Kawa for scripting Java systems.
  683. </p>
  684. <p>Both calling conventions can co-exist: Code compiled
  685. with <code class="literal">--full-tailcalls</code> can call code compiled
  686. with <code class="literal">--no-full-tailcalls</code> and vice versa.
  687. </p>
  688. <p>These options can also be used in the module source, using
  689. <code class="literal">module-compile-options</code> or <code class="literal">with-compile-options</code>.
  690. (In that case they override the options on the command line.)
  691. </p>
  692. <p>The options ‘<code class="literal">-C</code>’, ‘<code class="literal">-d</code>’, ‘<code class="literal">-T</code>’, ‘<code class="literal">-P</code>’, ‘<code class="literal">--main</code>’
  693. ‘<code class="literal">--applet</code>’, and <code class="literal">--servlet</code> are used to compile a Scheme file;
  694. see <a class="link" href="Compiling.xhtml#Files-compilation" title="Compiling to a set of .class files">Files compilation</a>.
  695. The options ‘<code class="literal">--module-static</code>’, <code class="literal">--module-nonstatic</code>,
  696. <code class="literal">--no-module-static</code>, and <code class="literal">--module-static-run</code>
  697. control how a module is mapped to a Java class; see <a class="link" href="Module-classes.xhtml#static-or-non-modules">static-or-non-modules</a>.
  698. The option ‘<code class="literal">--connect <em class="replaceable"><code>portnum</code></em></code>’ is only used by
  699. the ‘<code class="literal">kawa</code>’ front-end program.
  700. </p>
  701. </section>
  702. <section class="sect2" title="Options for debugging" epub:type="division" id="idm139667880110352">
  703. <div class="titlepage">
  704. <div>
  705. <div>
  706. <h3 class="title">Options for debugging</h3>
  707. </div>
  708. </div>
  709. </div>
  710. <p>The following options are useful if you want to debug or understand
  711. how Kawa works.
  712. </p>
  713. <div class="variablelist" epub:type="list">
  714. <dl class="variablelist">
  715. <dt class="term"><code class="literal">--debug-dump-zip</code>
  716. </dt>
  717. <dd>
  718. <p>Normally, when Kawa loads a source file, or evaluates a non-trivial expression,
  719. it generates new internal Java classes but does not write them out. This
  720. option asks it to write out generated classes in a ‘<code class="literal">.zip</code>’ archive
  721. whose name has the prefix ‘<code class="literal">kawa-zip-dump-</code>’.
  722. </p>
  723. </dd>
  724. <dt class="term"><code class="literal">--debug-print-expr</code>
  725. </dt>
  726. <dd>
  727. <p>Kawa translates source language forms into an internal <code class="literal">Expression</code>
  728. data structure. This option causes that data structure to be written out
  729. in a readable format to the standard output.
  730. </p>
  731. </dd>
  732. <dt class="term"><code class="literal">--debug-print-final-expr</code>
  733. </dt>
  734. <dd>
  735. <p>Similar to the previous option, but prints out the <code class="literal">Expression</code> after
  736. various transformations and optimizations have been done, and just before
  737. code generation.
  738. </p>
  739. </dd>
  740. <dt class="term"><code class="literal">--debug-syntax-pattern-match</code>
  741. </dt>
  742. <dd>
  743. <p>Prints logging information to standard error when a <code class="literal">syntax-rules</code>
  744. or <code class="literal">syntax-case</code> pattern matches.
  745. </p>
  746. </dd>
  747. <dt class="term"><code class="literal">--debug-error-prints-stack-trace</code>
  748. </dt>
  749. <dd>
  750. <p>Prints a stack trace with any error found during compilation.
  751. </p>
  752. </dd>
  753. <dt class="term"><code class="literal">--debug-warning-prints-stack-trace</code>
  754. </dt>
  755. <dd>
  756. <p>Prints a stack trace with any warning found during compilation.
  757. </p>
  758. </dd>
  759. </dl>
  760. </div>
  761. </section>
  762. <section class="sect2" title="Options for web servers" epub:type="division" id="idm139667880098544">
  763. <div class="titlepage">
  764. <div>
  765. <div>
  766. <h3 class="title">Options for web servers</h3>
  767. </div>
  768. </div>
  769. </div>
  770. <p>JDK 6 (or later) includes a complete web server library.
  771. </p>
  772. <div class="variablelist" epub:type="list">
  773. <dl class="variablelist">
  774. <dt class="term"><code class="literal">--http-auto-handler <em class="replaceable"><code>context-path</code></em> <em class="replaceable"><code>appdir</code></em></code>
  775. </dt>
  776. <dd>
  777. <p>Register a web application handler that uses files
  778. in the directory <em class="replaceable"><code>appdir</code></em> to handle HTTP (web) requests
  779. containing the given <em class="replaceable"><code>context-path</code></em>. That is it handles
  780. requests that start with <code class="literal">http://localhost:<em class="replaceable"><code>port</code></em><em class="replaceable"><code>context-path</code></em></code>.
  781. (This assumes the <em class="replaceable"><code>context-path</code></em> starts with a <code class="literal">/</code>.)
  782. See <a class="link" href="Self-configuring-page-scripts.xhtml" title="Self-configuring web page scripts">Self-configuring page scripts</a>.
  783. </p>
  784. </dd>
  785. <dt class="term"><code class="literal">--http-start <em class="replaceable"><code>port</code></em></code>
  786. </dt>
  787. <dd>
  788. <p>Start the web server, listing on the specified <em class="replaceable"><code>port</code></em>.
  789. </p>
  790. </dd>
  791. </dl>
  792. </div>
  793. </section>
  794. <section class="sect2" title="Options for the JVM" epub:type="division" id="idm139667880089520">
  795. <div class="titlepage">
  796. <div>
  797. <div>
  798. <h3 class="title">Options for the JVM</h3>
  799. </div>
  800. </div>
  801. </div>
  802. <p>The <code class="literal">kawa</code> front-end can pass options to the <code class="literal">java</code> launcher,
  803. using <code class="literal">-J</code> or <code class="literal">-D</code> options.
  804. These must be given <span class="emphasis"><em>before</em></span> any other arguments.
  805. For example:
  806. </p>
  807. <pre class="screen">kawa -J-Xms48m -Dkawa.command.name=foo foo.scm
  808. </pre>
  809. <p>is equivalent to (ignoring classpath issues):
  810. </p>
  811. <pre class="screen">java -Xms48m -Dkawa.command.name=foo kawa.repl foo.scm
  812. </pre>
  813. <p>You can also pass a <code class="literal">-D</code> option (but not a <code class="literal">-J</code> option) after the
  814. class name, in which case it is processed by the Kawa command-line processor
  815. rather than the <code class="literal">java</code> launcher. The effect is normally the same.
  816. </p>
  817. <div class="variablelist" epub:type="list">
  818. <dl class="variablelist">
  819. <dt class="term"><code class="literal">-J<em class="replaceable"><code>jvm-option</code></em></code>
  820. </dt>
  821. <dd>
  822. <p>Passes the <em class="replaceable"><code>jvm-option</code></em> to the <code class="literal">java</code> command,
  823. before the class-name (<code class="literal">kawa.repl</code>) and Kawa options.
  824. </p>
  825. </dd>
  826. <dt class="term"><code class="literal">-D<em class="replaceable"><code>variable-name</code></em>=<em class="replaceable"><code>variable-value</code></em></code>
  827. </dt>
  828. <dd>
  829. <p>Sets the JVM property <em class="replaceable"><code>variable-name</code></em> to <em class="replaceable"><code>variable-value</code></em>.
  830. Equivalent to <code class="literal">-J-D<em class="replaceable"><code>variable-name</code></em>=<em class="replaceable"><code>variable-value</code></em></code>.
  831. </p>
  832. </dd>
  833. </dl>
  834. </div>
  835. </section>
  836. </section>
  837. <footer>
  838. <div class="navfooter">
  839. <ul>
  840. <li>
  841. <b class="toc">
  842. <a href="Options.xhtml#idm139667880304720">Argument processing</a>
  843. </b>
  844. </li>
  845. <li>
  846. <b class="toc">
  847. <a href="Options.xhtml#idm139667880292032">General options</a>
  848. </b>
  849. </li>
  850. <li>
  851. <b class="toc">
  852. <a href="Options.xhtml#idm139667880239696">Options for language selection</a>
  853. </b>
  854. </li>
  855. <li>
  856. <b class="toc">
  857. <a href="Options.xhtml#idm139667880216944">Options for warnings and errors</a>
  858. </b>
  859. </li>
  860. <li>
  861. <b class="toc">
  862. <a href="Options.xhtml#idm139667880186288">Options for setting variables</a>
  863. </b>
  864. </li>
  865. <li>
  866. <b class="toc">
  867. <a href="Options.xhtml#idm139667880172992">Options for the REPL console</a>
  868. </b>
  869. </li>
  870. <li>
  871. <b class="toc">
  872. <a href="Options.xhtml#idm139667880159184">Options for controlling output formatting</a>
  873. </b>
  874. </li>
  875. <li>
  876. <b class="toc">
  877. <a href="Options.xhtml#idm139667880136112">Options for compiling and optimizing</a>
  878. </b>
  879. </li>
  880. <li>
  881. <b class="toc">
  882. <a href="Options.xhtml#idm139667880110352">Options for debugging</a>
  883. </b>
  884. </li>
  885. <li>
  886. <b class="toc">
  887. <a href="Options.xhtml#idm139667880098544">Options for web servers</a>
  888. </b>
  889. </li>
  890. <li>
  891. <b class="toc">
  892. <a href="Options.xhtml#idm139667880089520">Options for the JVM</a>
  893. </b>
  894. </li>
  895. </ul>
  896. <p>
  897. Up: <a accesskey="u" href="Running.xhtml">How to start up and run Kawa</a></p>
  898. <p>
  899. Next: <a accesskey="n" href="Scripts.xhtml">Running Command Scripts</a></p>
  900. </div>
  901. </footer>
  902. </body>
  903. </html>