minor bugfixes; changes to html
[clqr.git] / clqr-input-output.tex
blob7eab787f9842c4e7d7b76c9942edfdb5e93b29dd
1 % Copyright (C) 2008 Bert Burgemeister
3 % Permission is granted to copy, distribute and/or modify this
4 % document under the terms of the GNU Free Documentation License,
5 % Version 1.2 or any later version published by the Free Software
6 % Foundation; with no Invariant Sections, no Front-Cover Texts and
7 % no Back-Cover Texts. For details see file COPYING.
10 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11 \section{Input/Output}
12 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
14 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
15 \subsection{Predicates}
16 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
18 \begin{LIST}{1cm}
20 \IT{\arrGOO{(\FU*{STREAMP} \VAR{ foo})\\
21 (\FU*{PATHNAMEP} \VAR{ foo})\\
22 (\FU*{READTABLEP} \VAR{ foo})}{.}}
24 \retval{\T} if \VAR{foo} is of indicated type.
27 \IT{\arrGOO{(\FU*{INPUT-STREAM-P} \VAR{ stream})\\
28 (\FU*{OUTPUT-STREAM-P} \VAR{ stream})\\
29 (\FU*{INTERACTIVE-STREAM-P} \VAR{ stream})\\
30 (\FU*{OPEN-STREAM-P} \VAR{ stream})}{.}}
32 Return \retval{\T} if \VAR{stream} is for input, for output,
33 interactive, or open, respectively.
36 \IT{(\FU*{PATHNAME-MATCH-P} \VAR{path} \VAR{wildcard})}
38 \retval{\T} if \VAR{path} matches \VAR{wildcard}.
41 \IT{(\FU*{WILD-PATHNAME-P} \VAR{path}
42 \OP{\Goo{\kwd{:host}\XOR
43 \kwd{:device}\XOR
44 \kwd{:directory}\XOR
45 \kwd{:name}\XOR
46 \kwd{:type}\XOR
47 \kwd{:version}\XOR\NIL}})}
49 Return \retval{\T} if indicated component in \VAR{path} is
50 wildcard. (\NIL\ indicates any component.)
53 \end{LIST}
56 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
57 \subsection{Reader}
58 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
60 \begin{LIST}{1cm}
62 \IT{(\xorGOO{\FU*{Y-OR-N-P}\\
63 \FU*{YES-OR-NO-P}}{\}} \Op{\VAR{control} \OPn{\VAR{arg}}})}
65 Ask user a question and return \retval{\T} or \retval{\NIL}
66 depending on their answer. See p.\ \pageref{section:Format},
67 \FU{format}, for \VAR{control} and \VAR{arg}s.
70 \IT{(\MC*{WITH-STANDARD-IO-SYNTAX} \PROGN{\VAR{form}})}
72 Evaluate \VAR{form}s with standard behaviour of reader and
73 printer. Return \retval{values of \VAR{form}s}.
76 \IT{(\xorGOO{\FU*{READ}\\
77 \FU*{READ-PRESERVING-WHITESPACE}}{\}}
78 \OP{\DES{\VAR{stream}}\DF{\V{\A standard-input\A}} % standard-input not explicitly in standard
79 \OP{\VAR{eof-err}\DF{\T}
80 \Op{\VAR{eof-val}\DF{\NIL} \Op{\VAR{recursive}\DF{\NIL}}}}})}
82 Read printed representation of \retval{object}.
85 \IT{(\FU*{READ-FROM-STRING} \VAR{string}
86 \OP{\VAR{eof-error}\DF{\T}
87 \OP{\VAR{eof-val}\DF{\NIL}
88 \OP{\orGOO{%
89 \kwd{:start}\VAR{ start}\DF{\LIT{0}}\\
90 \kwd{:end}\VAR{ end}\DF{\NIL}\\
91 \kwd{:preserve-whitespace}\VAR{ bool}\DF{\NIL}}{\}}}}})}
93 Return \retval{object} read from string and zero-indexed \retvalii{position} of
94 next character.
97 \IT{(\FU*{READ-DELIMITED-LIST} \VAR{char}
98 \OP{\DES{\VAR{stream}}\DF{\V{\A standard-input\A}}
99 \Op{\VAR{recursive}\DF{\NIL}}})}
101 Continue reading until encountering \VAR{char}. Return \retval{list}
102 of objects read. Signal error if no \VAR{char} is found in stream.
105 \IT{(\FU*{READ-CHAR} \OP{\DES{\VAR{stream}}\DF{\V{\A standard-input\A}}
106 \OP{\VAR{eof-err}\DF{\T} \Op{\VAR{eof-val}\DF{\NIL}
107 \Op{\VAR{recursive}\DF{\NIL}}}}})}
109 Return \retval{next character} from \VAR{stream}.
112 \IT{(\FU*{READ-CHAR-NO-HANG}
113 \OP{\DES{\VAR{stream}}\DF{\V{\A standard-input\A}}
114 \OP{\VAR{eof-error}\DF{\T} \Op{\VAR{eof-val}\DF{\NIL}
115 \Op{\VAR{recursive}\DF{\NIL}}}}})}
117 \retval{Next character} from \VAR{stream} or \retval{\NIL} if none
118 is available.
121 \IT{(\FU*{PEEK-CHAR}
122 \OP{\VAR{mode}\DF{\NIL} \OP{\DES{\VAR{stream}}\DF{\V{\A standard-input\A}}
123 \OP{\VAR{eof-error}\DF{\T} \Op{\VAR{eof-val}\DF{\NIL}
124 \Op{\VAR{recursive}\DF{\NIL}}}}}})}
126 Next, or if \VAR{mode} is \T, next non-whitespace
127 \retval{character}, or if \VAR{mode} is a character, \retval{next instance}
128 of it, from stream without removing it there.
131 \IT{(\FU*{UNREAD-CHAR} \VAR{character}
132 \Op{\DES{\VAR{stream}}\DF{\V{\A standard-input\A}}})}
134 Put last \FU{read-char}ed \VAR{character} back into \VAR{stream}; return
135 \retval{\NIL}.
138 \IT{(\FU*{READ-BYTE} \DES{\VAR{stream}} \OP{\VAR{eof-err}\DF{\T}
139 \Op{\VAR{eof-val}\DF{\NIL}}})}
141 Read \retval{next byte} from binary \VAR{stream}.
144 \IT{(\FU*{READ-LINE} \OP{\DES{\VAR{stream}}\DF{\V{\A standard-input\A}}
145 \OP{\VAR{eof-err}\DF{\T} \Op{\VAR{eof-val}\DF{\NIL}
146 \Op{\VAR{recursive}\DF{\NIL}}}}})}
148 Return a \retval{line of text} from \VAR{stream} and
149 \retvalii{\T} if line has been ended by end of file.
152 \IT{(\FU*{READ-SEQUENCE} \DES{\VAR{sequence}} \DES{\VAR{stream}}
153 \Op{\kwd{:start} \VAR{start}\DF{\LIT{0}}}\Op{\kwd{:end}
154 \VAR{end}\DF{\NIL}})}
156 Replace elements of \VAR{sequence} between \VAR{start} and \VAR{end}
157 with elements from \VAR{stream}. Return \retval{index} of
158 \VAR{sequence}'s first unmodified
159 element.
162 \IT{(\FU*{READTABLE-CASE} \VAR{readtable})\DF{\kwd{:upcase}}}
164 \retval{Case sensitivity attribute} (one of \kwd{:upcase},
165 \kwd{:downcase}, \kwd{:preserve}, \kwd{:invert}) of
166 \VAR{readtable}. \kwd{setf}able.
169 \IT{(\FU*{COPY-READTABLE} \OP{\VAR{from-readtable}\DF{\V{\A readtable\A}}
170 \Op{\DES{\VAR{to-readtable}}\DF{\NIL}}})}
172 Return \retval{copy of \VAR{from-readtable}}.
175 \IT{(\FU*{SET-SYNTAX-FROM-CHAR} \VAR{to-char} \VAR{from-char}
176 \OP{\DES{\VAR{to-readtable}}\DF{\V{\A readtable\A}}
177 \Op{\VAR{from-readtable}\DF{standard readtable}}})}
179 Copy syntax of \VAR{from-char} to \VAR{to-readtable}. Return \retval{\T}.
182 \IT{\V{\A readtable\A}}
183 {\index{*READTABLE*@\A READTABLE\A}
184 Current readtable.
187 \IT{\V{\A read-base\A}\DF{\LIT{10}}}
188 {\index{*READ-BASE*@\A READ-BASE\A}
189 Radix for reading \kwd{integer}s and \kwd{ratio}s.
192 \IT{\V{\A read-default-float-format\A}\DF{\kwd{single-float}}}
193 {\index{*READ-DEFAULT-FLOAT-FORMAT*@\A READ-DEFAULT-FLOAT-FORMAT\A}
194 Floating point format to use when not indicated in the number read.
197 \IT{(\FU*{SET-MACRO-CHARACTER} \VAR{char} \VAR{function}
198 \OP{\VAR{non-term-p}\DF{\NIL}
199 \Op{\DES{\VAR{rt}}\DF{\V{\A readtable\A}}}})}
201 Make \VAR{char} a macro character associated with
202 \VAR{function}. Return \retval{\T}.
205 \IT{(\FU*{GET-MACRO-CHARACTER} \VAR{char}
206 \Op{\VAR{rt}\DF{\V{\A readtable\A}}})}
208 \retval{Reader macro function} associated with \VAR{char}, and
209 \retvalii{\T} if \VAR{char} is a non-terminating macro character.
212 \IT{(\FU*{MAKE-DISPATCH-MACRO-CHARACTER} \VAR{char}
213 \OP{\VAR{non-term-p}\DF{\NIL}
214 \Op{\VAR{rt}\DF{\V{\A readtable\A}}}})}
216 Make \VAR{char} a dispatching macro character. Return \retval{\T}.
219 \IT{(\FU*{SET-DISPATCH-MACRO-CHARACTER} \VAR{char} \VAR{sub-char} \VAR{function}
220 \Op{\DES{\VAR{rt}}\DF{\V{\A readtable\A}}})}
222 Make \VAR{function} a dispatch function of \VAR{char} followed by
223 \VAR{sub-char}. Return \retval{\T}.
226 \IT{(\FU*{GET-DISPATCH-MACRO-CHARACTER} \VAR{char} \VAR{sub-char}
227 \Op{\VAR{rt}\DF{\V{\A readtable\A}}})}
229 \retval{Dispatch function} associated with \VAR{char} followed by \VAR{sub-char}.
232 \end{LIST}
234 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
235 \subsection[Macro Chars]{Macro Characters and Escapes}
236 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
238 \begin{LIST}{1cm}
240 \IT{\arrGOO{%
241 \KWD{\#\boldmath$|$ }\OPn{\VAR{multi-line-comment}}\KWD{ \boldmath$|$\#}\\
242 \KWD*{; }\OPn{\VAR{one-line-comment}}}{.}}
243 {\index{\#{$"|$}{$"|$}\#}
244 Comments. There are conventions:
246 \begin{LIST}{.5cm}
247 \IT{\KWD{;;;;} \VAR{title}\qquad\qquad}
248 {Short title for a block of code.}
250 \IT{\KWD{;;;} \VAR{intro}\qquad\qquad}
251 {Description before a block of code.}
253 \IT{\KWD{;;} \VAR{state}\qquad\qquad}
254 {State of program or of following code.}
256 \IT{\KWD{;} \VAR{explanation}}
257 {Regarding line on which it appears.}
259 \end{LIST}
261 \IT{\KWD*{(}\qquad\quad}
263 Initiate reading of a list.
266 \IT{\KWD{"}\qquad\quad}
267 {\index{""}
268 Begin and end of a string.
271 \IT{\KWD*{'}\VAR{foo}\qquad\quad}
273 (\SO{quote} \VAR{foo}); \VAR{foo} unevaluated
276 \IT{\KWD{\char18}(\Op{\VAR{foo}} \Op{\KWD*{,}\VAR{bar}} \Op{\KWD{,@}\VAR{baz}}
277 \Op{\KWD*{,.}\DES{\VAR{quux}}} \Op{\VAR{bing}})}
278 {\index{,"@}\index{`@\char18}
279 Backquote. \SO{quote} \VAR{foo} and \VAR{bing}; evaluate \VAR{bar}
280 and splice the lists \VAR{baz} and \VAR{quux} into their
281 elements. When nested, outermost commas inside the innermost
282 backquote expression belong to this backquote.
285 \IT{\KWD{\#\boldmath{$\backslash$}}\VAR{c}\qquad\qquad\qquad}
287 (\FU{character} \LIT{"}\VAR{c}\LIT{"}), the character \VAR{c}.
289 \index{\#@\#$\backslash$}%
291 \IT{\KWD*{\#b}; \KWD*{\#o}; \KWD*{\#x}; \KWD{\#}\VAR{n}\KWD{R}}
293 \index{\#R}%
294 Number of radix 2, 8, 16, or \VAR{n}.
297 \IT{\KWD*{\#C(}\VAR{a b}\kwd{)}\qquad\qquad}
299 (\FU{complex} \VAR{a} \VAR{b}), the complex number $\VAR{a}+\VAR{b}\text{i}$.
302 \IT{\KWD*{\#'}\VAR{foo}\qquad\qquad}
304 (\SO{function} \VAR{foo}); the function named \VAR{foo}.
307 \IT{\KWD{\#}\VAR{n}\KWD{A}\VAR{sequence}}
309 \index{\#A}%
310 \VAR{n}-dimensional array.
313 \IT{\KWD{\#}\Op{\VAR{n}}\kwd{(}\OPn{\VAR{foo}}\kwd{)}}
315 \index{\#(}%
316 Vector of some (or \VAR{n})
317 \VAR{foo}s filled with last \VAR{foo} if necessary.
320 \IT{\KWD{\#}\Op{\VAR{n}}\kwd{\A}\OPn{\VAR{b}}}
322 \index{\#*@\#\A}%
323 Bit vector of some (or \VAR{n})
324 \VAR{b}s filled with last \VAR{b} if necessary.
327 \IT{\KWD*{\#S(}\VAR{type} \Goos{\VAR{slot} \VAR{value}}\kwd{)}}
329 Structure of \VAR{type}.
332 \IT{\KWD*{\#P}\VAR{string}\qquad\qquad}
334 A pathname.
337 \IT{\KWD*{\#:}\VAR{foo}\qquad\qquad\qquad}
339 Uninterned symbol \VAR{foo}.
342 \IT{\KWD*{\#.}\VAR{form}\qquad\qquad}
344 Read-time value of \VAR{form}.
347 \IT{\V{\A read-eval\A}\DF{\T}}
348 {\index{*READ-EVAL*@\A READ-EVAL\A}
349 If \NIL, a \kwd{reader-error} is signalled by \kwd{\#.}.
352 \IT{\KWD{\#}\VAR{int}\kwd{=} \VAR{foo}\qquad\quad}
354 \index{\#=}%
355 Give \VAR{foo} the label \VAR{int}.
358 \IT{\KWD{\#}\VAR{int}\kwd{\#}\qquad\qquad}
360 \index{\#\#}%
361 Object labelled \VAR{int}.
364 \IT{\KWD{\#\boldmath$<$}\qquad\qquad\qquad}
366 \index{\#<@\#$<$}%
367 Have the reader signal \kwd{reader-error}.
370 \IT{\arrGOO{\KWD*{\#+}\VAR{feature } \VAR{when-feature}\\
371 \KWD*{\#--}\VAR{feature } \VAR{unless-feature}}{.}}
373 Means \VAR{when-feature} if \VAR{feature} is \T, means
374 \VAR{unless-feature} if \VAR{feature} is \NIL. \VAR{feature} is a
375 symbol from \V{\A features\A}, or (\Goo{\kwd{AND}\XOR\kwd{OR}}
376 \OPn{\VAR{feature}}), or (\kwd{NOT} \VAR{feature}).
379 \IT{\V{\A features\A}}
380 {\index{*FEATURES*@\A FEATURES\A}
381 List of symbols denoting implementation-dependent features.
384 \IT{\kwd{\boldmath$|$}\OPn{\VAR{c}}\kwd{\boldmath$|$};
385 \kwd{\boldmath$\backslash$}\VAR{c}}
387 Treat arbitrary character(s) \VAR{c} as alphabetic preserving case.
389 \index{\@{$\backslash$}}%
390 \index{\textbar\textbar@{$"|$}{$"|$}}%
392 \end{LIST}
395 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
396 \subsection{Printer}
397 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
400 \begin{LIST}{1cm}
402 \IT{(\xorGOO{\FU*{PRIN1}\\
403 \FU*{PRINT}\\
404 \FU*{PPRINT}\\
405 \FU*{PRINC}}{\}}
406 \VAR{foo} \Op{\DES{\VAR{stream}}\DF{\V{\A standard-output\A}}})}
408 Print \VAR{foo} to \VAR{stream} \FU{read}ably,
409 \FU{read}ably between a newline and a space,
410 \FU{read}ably after a newline, or human-readably without any extra
411 characters, respectively. \FU{prin1}, \FU{print} and \FU{princ}
412 return \retval{\VAR{foo}}.
415 \IT{\arrGOO{(\FU*{PRIN1-TO-STRING} \VAR{ foo})\\
416 (\FU*{PRINC-TO-STRING} \VAR{ foo})}{.}}
418 Print \VAR{foo} to \retval{\VAR{string}} \FU{read}ably or
419 human-readably, respectively.
422 \IT{(\GFU*{PRINT-OBJECT} \VAR{object} \DES{\VAR{stream}})}
424 Print \retval{\VAR{object}} to \VAR{stream}. Called by the Lisp
425 printer.
428 \IT{(\MC*{PRINT-UNREADABLE-OBJECT} (\VAR{foo} \DES{\VAR{stream}}
429 \orGOO{\kwd{:type } \VAR{bool}\DF{\NIL}\\
430 \kwd{:identity } \VAR{bool}\DF{\NIL}}{\}})
431 \PROGN{\VAR{form}})}
433 Enclosed in \kwd{\#\boldmath$<$} and \kwd{\boldmath$>$}, print
434 \VAR{foo} by means of \VAR{form}s to \VAR{stream}. Return \retval{\NIL}.
437 \IT{(\FU*{TERPRI} \Op{\DES{\VAR{stream}}\DF{\V{\A standard-output\A}}})}
439 Output a newline to \VAR{stream}. Return \retval{\NIL}.
442 \IT{(\FU*{FRESH-LINE})
443 \Op{\DES{\VAR{stream}}\DF{\V{\A standard-output\A}}}}
445 Output a newline to \VAR{stream} and return \retval{\T} unless \VAR{stream}
446 is already at the start of a line.
449 \IT{(\FU*{WRITE-CHAR} \VAR{char}
450 \Op{\DES{\VAR{stream}}\DF{\V{\A standard-output\A}}})}
452 Output \retval{\VAR{char}} to \VAR{stream}.
455 \IT{(\xorGOO{\FU*{WRITE-STRING}\\
456 \FU*{WRITE-LINE}}{\}} \VAR{string}
457 \OP{\DES{\VAR{stream}}\DF{\V{\A standard-output\A}}
458 \OP{\orGOO{\kwd{:start} \VAR{ start}\DF{\LIT{0}}\\\kwd{:end} \VAR{
459 end}\DF{\NIL}}{\}}}})}
461 Write \retval{\VAR{string}} to \VAR{stream} without/with a trailing newline.
464 \IT{(\FU*{WRITE-BYTE} \VAR{byte} \DES{\VAR{stream}})}
466 Write \retval{\VAR{byte}} to binary \VAR{stream}.
469 \IT{(\FU*{WRITE-SEQUENCE} \VAR{sequence}
470 \DES{\VAR{stream}} \orGOO{\kwd{:start}\VAR{ start}\DF{\LIT{0}}\\
471 \kwd{:end} \VAR{ end}\DF{\NIL}}{\}})}
473 Write elements of \retval{\VAR{sequence}} to \VAR{stream}.
476 \IT{(\xorGOO{\FU*{WRITE}\\
477 \FU*{WRITE-TO-STRING}}{\}} \VAR{foo} \orGOO{%
478 \kwd{:array} \VAR{ bool}\\
479 \kwd{:base} \VAR{ radix}\\
480 \kwd{:case } \xorGOO{\kwd{:upcase}\\
481 \kwd{:downcase}\\
482 \kwd{:capitalize}}{.}\\
483 \kwd{:circle} \VAR{ bool}\\
484 \kwd{:escape} \VAR{ bool}\\
485 \kwd{:gensym} \VAR{ bool}\\
486 \kwd{:length } \Goo{\VAR{int}\XOR\NIL}\\
487 \kwd{:level } \Goo{\VAR{int}\XOR\NIL}\\
488 \kwd{:lines } \Goo{\VAR{int}\XOR\NIL}\\
489 \kwd{:miser-width } \Goo{\VAR{int}\XOR\NIL}\\
490 \kwd{:pprint-dispatch} \VAR{ dispatch-table}\\
491 \kwd{:pretty} \VAR{ bool}\\
492 \kwd{:radix} \VAR{ bool}\\
493 \kwd{:readably} \VAR{ bool}\\
494 \kwd{:right-margin } \Goo{\VAR{int}\XOR\NIL}\\
495 \kwd{:stream } \DES{\VAR{stream}}\DF{\V{\A standard-output\A}}%
496 }{\}})}
498 Print \VAR{foo} to \VAR{stream} and return \retval{\VAR{foo}}, or print \VAR{foo} into
499 \retval{string}, respectively, after dynamically setting printer variables
500 corresponding to keyword parameters (\kwd{\A print-}\VAR{bar}\kwd{\A} becoming
501 \kwd{:}\VAR{bar}). (\kwd{:stream} keyword with \FU{write} only.)
504 \IT{\arrGOO{%
505 (\FU*{PPRINT-FILL } \DES{\VAR{stream}} \VAR{ foo }
506 \OP{\VAR{parenthesis}\DF{\T} \text{ } \Op{\VAR{noop}}})\\
507 (\FU*{PPRINT-TABULAR } \DES{\VAR{stream}} \VAR{ foo }
508 \OP{\VAR{parenthesis}\DF{\T} \text{ } \Op{\VAR{noop} \text{ }
509 \Op{\VAR{n}\DF{\LIT{16}}}}})\\
510 (\FU*{PPRINT-LINEAR} \DES{\VAR{stream}} \VAR{ foo }
511 \OP{\VAR{parenthesis}\DF{\T} \text{ } \Op{\VAR{noop}}})\\
512 }{.}}
514 Print \VAR{foo} to \VAR{stream}. If \VAR{foo} is a list, print as
515 many elements per line as possible; do the same in a table with
516 a column width of \VAR{n} ems; or print either all elements on
517 one line or each on its own line, respectively. Return
518 \retval{\NIL}. Usable with \FU{format} directive \KWD{\TLD//}.
521 \IT{(\MC*{PPRINT-LOGICAL-BLOCK} (\DES{\VAR{stream}} \VAR{list}
522 \orGOO{\xorGOO{\kwd{:prefix} \VAR{ string}\\
523 \kwd{:per-line-prefix} \VAR{ string}}{\}}\\
524 \kwd{:suffix} \VAR{ string}\DF{\LIT{""}}}{\}})
525 \OPn{(\kwd{declare} \OPn{\NEV{\VAR{decl}}})} \PROGN{\VAR{form}})}
527 Evaluate \VAR{form}s, which should print \VAR{list}, with
528 \VAR{stream} locally bound to a pretty
529 printing stream which outputs to the original \VAR{stream}. If
530 \VAR{list} is in fact not a list, it is printed by
531 \FU{write}. Return \retval{\NIL}.
534 \begin{LIST}{.5cm}
536 \IT{(\MC*{PPRINT-POP})}
538 Take \retval{next element} off \VAR{list}. If there is no remaining
539 list in \VAR{list}, or \V{\A print-length\A} or \V{\A print-circle\A} indicate
540 printing should end, send element together with an appropriate
541 indicator to \VAR{stream}.
544 \IT{(\FU*{PPRINT-TAB} \xorGOO{\kwd{:line}\\
545 \kwd{:line-relative}\\
546 \kwd{:section}\\
547 \kwd{:section-relative}}{\}} \VAR{c}
548 \VAR{i} \Op{\DES{\VAR{stream}}\DF{\V{\A standard-output\A}}})}
550 Move cursor forward to column number $c + ki$, $k \geq 0$ being as small
551 as possible.
554 \IT{(\FU*{PPRINT-INDENT} \xorGOO{%
555 \kwd{:block}\\
556 \kwd{:current}}{\}} \VAR{n}
557 \OP{\DES{\VAR{stream}}\DF{\V{\A standard-output\A}}})}
559 Specify indentation for innermost logical block relative to
560 leftmost position/to current position. Return \retval{\NIL}.
563 \IT{(\MC*{PPRINT-EXIT-IF-LIST-EXHAUSTED})}
565 If \VAR{list} is empty, terminate logical block. Return
566 \retval{\NIL} otherwise.
569 \end{LIST}
571 \IT{(\FU*{PPRINT-NEWLINE} \xorGOO{%
572 \kwd{:linear}\\
573 \kwd{:fill}\\
574 \kwd{:miser}\\
575 \kwd{:mandatory}}{\}}
576 \OP{\DES{\VAR{stream}}\DF{\V{\A standard-output\A}}})}
578 Print a conditional newline if \VAR{stream} is a pretty printing
579 stream. Return \retval{\NIL}.
582 \IT{\V{\A print-array\A}}
583 {\index{*PRINT-ARRAY*@\A PRINT-ARRAY\A}
584 If \T, print arrays \FU{read}ably.
587 \IT{\V{\A print-base\A}\DF{\LIT{10}}}
588 {\index{*PRINT-BASE*@\A PRINT-BASE\A}
589 Radix for printing rationals, from 2 to 36.
592 \IT{\V{\A print-case\A}\DF{\kwd{:upcase}}}
593 {\index{*PRINT-CASE*@\A PRINT-CASE\A}
594 Print symbol names all uppercase (\kwd{:upcase}), all lowercase
595 (\kwd{:downcase}), capitalized (\kwd{:capitalize}).
598 \IT{\V{\A print-circle\A}\DF{\NIL}}
599 {\index{*PRINT-CIRCLE*@\A PRINT-CIRCLE\A}
600 If \T, avoid indefinite recursion while printing circular
601 structure.
604 \IT{\V{\A print-escape\A}\DF{\T}}
605 {\index{*PRINT-ESCAPE*@\A PRINT-ESCAPE\A}
606 If \NIL, do not print escape characters and package prefixes.
609 \IT{\V{\A print-gensym\A}\DF{\T}}
610 {\index{*PRINT-GENSYM*@\A PRINT-GENSYM\A}
611 If \T, print \kwd{\#:} before uninterned symbols.
614 \IT{\arrGOO{\V{\A print-length\A}\DF{\NIL}\\
615 \V{\A print-level\A}\DF{\NIL}\\
616 \V{\A print-lines\A}\DF{\NIL}
617 }{.}}
618 {\index{*PRINT-LENGTH*@\A PRINT-LENGTH\A}\index{*PRINT-LEVEL*@\A PRINT-LEVEL\A}\index{*PRINT-LINES*@\A PRINT-LINES\A}
619 If integer, restrict printing of objects to that number of elements per
620 level/to that depth/to that number of lines.
623 \IT{\V{\A print-miser-width\A}}
624 {\index{*PRINT-MISER-WIDTH*@\A PRINT-MISER-WIDTH\A}
625 Width below which a compact pretty-printing style is used.
628 \IT{\V{\A print-pretty\A}}
629 {\index{*PRINT-PRETTY*@\A PRINT-PRETTY\A}
630 If \T, print pretty.
633 \IT{\V{\A print-radix\A}\DF{\NIL}}
634 {\index{*PRINT-RADIX*@\A PRINT-RADIX\A}
635 If \T, print rationals with a radix indicator.
638 \IT{\V{\A print-readably\A}\DF{\NIL}}
639 {\index{*PRINT-READABLY*@\A PRINT-READABLY\A}
640 If \T, print \FU{read}ably or signal error
641 \kwd{print-not-readable}.
644 \IT{\V{\A print-right-margin\A}\DF{\NIL}}
645 {\index{*PRINT-RIGHT-MARGIN*@\A PRINT-RIGHT-MARGIN\A}
646 Right margin width in ems while pretty-printing.
649 \IT{(\FU*{SET-PPRINT-DISPATCH} \VAR{type} \VAR{function}
650 \OP{\VAR{priority}\DF{\LIT{0}}
651 \Op{\VAR{table}\DF{\V{\A print-pprint-dispatch\A}}}})}
653 Install entry comprising \VAR{function} of arguments stream and
654 object to print; and \VAR{priority} as
655 \VAR{type} into \VAR{table}. If \VAR{function}
656 is \NIL, remove \VAR{type} from \VAR{table}. Return \retval{\NIL}.
659 \IT{(\FU*{PPRINT-DISPATCH} \VAR{foo}
660 \Op{\VAR{table}\DF{\V{\A print-pprint-dispatch\A}}})}
662 Return highest priority \retval{\VAR{function}} associated with type of
663 \VAR{foo} and \retvalii{\T} if there was a matching type specifier
664 in \VAR{table}.
667 \IT{(\FU*{COPY-PPRINT-DISPATCH}
668 \Op{\VAR{table}\DF{\V{\A print-pprint-dispatch\A}}})}
670 Return \retval{copy of \VAR{table}} or, if \VAR{table} is \NIL,
671 initial value of \V{\A print-pprint-dispatch\A}.
674 \IT{\V{\A print-pprint-dispatch\A}}
675 {\index{*PRINT-PPRINT-DISPATCH*@\A PRINT-PPRINT-DISPATCH\A}
676 Current pretty print dispatch table.
679 \IT{\V{\A read-suppress\A}\DF{\NIL}}
680 {\index{*READ-SUPPRESS*@\A READ-SUPPRESS\A}
681 If \T, reader is syntactically more tolerant.
684 \end{LIST}
688 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
689 \subsection{Format}
690 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
691 \label{section:Format}
693 \begin{LIST}{1cm}
695 \IT{(\MC*{FORMATTER} \NEV{\VAR{control}})}
697 Return \retval{function} of stream and a \kwd{\&rest} argument applying \FU{format} to
698 stream, \VAR{control}, and the \kwd{\&rest} argument
699 returning \NIL\ or any excess arguments.
702 \IT{(\FU*{FORMAT} \Goo{\T\XOR\NIL\XOR\VAR{out-string}\XOR\VAR{out-stream}}
703 \VAR{control} \OPn{\VAR{arg}})}
705 Output string \VAR{control} which may
706 contain \kwd{\TLD} directives possibly taking some
707 \VAR{arg}s. Alternatively, \VAR{control} can be a function returned
708 by \MC{formatter} which is then applied to \VAR{out-stream} and \OPn{\VAR{arg}}.
709 Output to \VAR{out-string}, \VAR{out-stream} or, if first
710 argument is \T, to \V{\A standard-output\A}. Return \retval{\NIL}. If
711 first argument is \NIL, return \retval{formatted output}.
714 \begin{LIST}{.5cm}
716 \IT{\KWD{\TLD}\OP{\VAR{min-col}\DF{\LIT{0}} \OP{\KWD{,}\Op{\VAR{col-inc}\DF{\LIT{1}}}
717 \OP{\KWD{,}\Op{\VAR{min-pad}\DF{\LIT{0}}}
718 \OP{\KWD{,}\VAR{pad-char}\DF{\kwd{'}\textvisiblespace}}}}}
719 \KWD{\Op{:}\Op{@}\Goo{A\XOR S}}}
720 {\index{\~S@$\sim$S}\index{\~A@$\sim$A}
721 Print argument of any type for consumption by humans/by the
722 reader, respectively. With \kwd{:}, print \NIL\ as \LIT{()} rather
723 than \LIT{nil}; with \kwd{@}, add \VAR{pad-char}s on the left
724 rather than on the right.
727 \IT{\KWD{\TLD}\OP{\VAR{radix}\DF{\LIT{10}} \OP{\KWD{,}\Op{\VAR{width}}
728 \OP{\KWD{,}\Op{\VAR{pad-char}\DF{\kwd{'}\textvisiblespace}}
729 \OP{\KWD{,}\Op{\VAR{comma-char}\DF{\kwd{'}\LIT{,}}}
730 \OP{\KWD{,}\VAR{comma-interval}\DF{\LIT{3}}}}}}}
731 \KWD{\Op{:}\Op{@}R}}
732 {\index{\~R@$\sim$R}
733 Print argument as number; with \KWD{:}, group digits
734 \VAR{comma-interval} each; with \kwd{@}, always prepend a sign.
737 \IT{\Goo{\KWD{\TLD R}\XOR\KWD{\TLD :R}\XOR\KWD{\TLD
738 @R}\XOR\KWD{\TLD @:R}}}
740 Take argument as number and print it as English cardinal number,
741 as English ordinal number, as Roman numeral, or as old Roman
742 numeral, respectively.
745 \IT{\KWD{\TLD}\OP{\VAR{width}
746 \OP{\KWD{,}\Op{\VAR{pad-char}\DF{\kwd{'}\textvisiblespace}}
747 \OP{\KWD{,}\Op{\VAR{comma-char}\DF{\kwd{'}\LIT{,}}}
748 \OP{\KWD{,}\VAR{comma-interval}\DF{\LIT{3}}}}}}
749 \KWD{\Op{:}\Op{@}\Goo{D\XOR B\XOR O\XOR X}}}
750 {\index{\~D@$\sim$D}\index{\~B@$\sim$B}\index{\~O@$\sim$O}\index{\~X@$\sim$X}
751 Print integer argument as number (decimal, binary, octal, or
752 hexadecimal, respectively). With \kwd{:} group digits
753 \VAR{comma-interval} each; with \kwd{@}, always prepend a sign.
756 \IT{\KWD{\TLD}\OP{\VAR{width} \OP{\KWD{,}\Op{\VAR{dec-digits}} \OP{\KWD{,}\Op{\VAR{shift}\DF{\LIT{0}}}
757 \OP{\KWD{,}\Op{\VAR{overflow-char}}
758 \OP{\KWD{,}\VAR{pad-char}\DF{\kwd{'}\textvisiblespace}}}}}}
759 \KWD{\Op{@}F}}
760 {\index{\~F@$\sim$F}
761 Print argument as fixed-format floating-point number. With
762 \kwd{@}, always prepend a sign.
765 \IT{\KWD{\TLD}\OP{\VAR{width} \OP{\KWD{,}\Op{\VAR{int-digits}}
766 \OP{\KWD{,}\Op{\VAR{exp-digits}}
767 \OP{\KWD{,}\Op{\VAR{scale-factor}\DF{\LIT{1}}}
768 \OP{\KWD{,}\Op{\VAR{overflow-char}}
769 \OP{\KWD{,}\Op{\VAR{pad-char}\DF{\kwd{'}\textvisiblespace}}
770 \OP{\KWD{,}\VAR{exp-char}}}}}}}}
771 \KWD{\Op{@}\Goo{E\XOR G}}}
772 {\index{\~E@$\sim$E}\index{\~G@$\sim$G}
773 Print argument as floating-point number with \VAR{int-digits}
774 before decimal point and \VAR{exp-digits} in the signed
775 exponent. With \KWD{\TLD G}, choose either \KWD{\TLD E} or
776 \KWD{\TLD F}. With \KWD{@}, always prepend a sign.
779 \IT{\Goo{\KWD{\TLD C}\XOR\KWD{\TLD :C}\XOR\KWD{\TLD
780 @C}\XOR\KWD{\TLD @:C}}}
781 {\index{\~C@$\sim$C}
782 Print, spell out, print in \kwd{\#$\backslash$} syntax, or tell how to type, respectively, argument as
783 (possibly non-printing) character.
786 \IT{\KWD{\TLD}\OP{\VAR{dec-digits}\DF{\LIT{2}}
787 \OP{\KWD{,}\Op{\VAR{int-digits}\DF{\LIT{1}}}
788 \OP{\KWD{,}\Op{\VAR{width}\DF{\LIT{0}}}
789 \OP{\KWD{,}\VAR{pad-char}\DF{\kwd{'}\textvisiblespace}}}}}
790 \Op{\KWD{:}}\Op{\kwd{@}}\KWD{\$}}
791 {\index{\~\$@$\sim$\$}
792 Print argument as fixed-format floating-point number. With \KWD{:},
793 put sign before any padding; with \KWD{@}, always prepend a sign.}
795 \IT{\Goo{%
796 \KWD{\TLD(}\VAR{text}\KWD{\TLD)}\XOR
797 \KWD{\TLD:(}\VAR{text}\KWD{\TLD)}\XOR
798 \KWD{\TLD @(}\VAR{text}\KWD{\TLD)}\XOR
799 \KWD{\TLD:@(}\VAR{text}\KWD{\TLD)}}}
800 {\index{\~(\~)@$\sim$( $\sim$)}
801 Convert to lowercase, convert first letter of each word to
802 uppercase, capitalize first word and convert
803 the rest to lowercase, or convert to uppercase, respectively.
806 \IT{\Goo{\KWD{\TLD P}\XOR\KWD{\TLD:P}
807 \XOR\KWD{\TLD @P}\XOR\KWD{\TLD:@P}}}
808 {\index{\~P@$\sim$P}
809 If argument \kwd{eql} \LIT{1} print nothing, otherwise print \LIT{s};
810 do the same for the previous argument; if argument \kwd{eql} \LIT{1}
811 print \LIT{y}, otherwise print \LIT{ies}; do the same for the
812 previous argument, respectively.
815 \IT{\KWD{\TLD}\Op{\VAR{n}\DF{\LIT{1}}}\KWD{\%}}
816 {\index{\~\%@$\sim$\%}
817 Print \VAR{n} newlines.
820 \IT{\KWD{\TLD}\Op{\VAR{n}\DF{\LIT{1}}}\KWD{\&}}
821 {\index{\~\&@$\sim$\&}
822 Print $n-1$ newlines if output stream is at the
823 beginning of a line, or \VAR{n} newlines otherwise.
826 \IT{\Goo{\KWD{\TLD\_}\XOR\KWD{\TLD:\_}\XOR\KWD{\TLD@\_}\XOR\KWD{\TLD:@\_}}}
827 {\index{\~\_{}@$\sim$\_{}}
828 Print newline like \kwd{pprint-newline} with argument
829 \kwd{:linear}, \kwd{:fill}, \kwd{:miser}, or \kwd{:mandatory}, respectively.
832 \IT{\KWD{\TLD}\Op{\KWD{:}}\Op{\KWD{@}}\KWD{\boldmath{$<$}}
833 \OP{\Goo{\VAR{prefix}\DF{\LIT{""}}\KWD{\TLD;}}\XOR\Goo{\VAR{per-line-prefix}\KWD{\TLD@;}}}
834 \VAR{body}\OP{\KWD{\TLD;}\VAR{suffix}\DF{\LIT{""}}}\KWD{\TLD:}\Op{\KWD{@}}\KWD{\boldmath{$>$}}}
835 {\index{\~<\~:>@$\sim$$<$ $\sim$:$>$}
836 Act like \kwd{pprint-logical-block} using \VAR{body} as \MC{format}
837 control string on the elements of the list argument or, with \KWD{@},
838 on the remaining arguments, which are extracted by
839 \kwd{pprint-pop}. With \KWD{:}, \VAR{prefix} and \VAR{suffix}
840 default to \LIT{(} and \LIT{)}. When closed by
841 \KWD{\TLD:@\boldmath{$>$}}, spaces in body are replaced with
842 conditional newlines.
845 \IT{\KWD{\TLD}\Op{\KWD{:}}\Op{\KWD{@}}$\hookleftarrow$}
847 (Tilde-newline) Ignore newline and following
848 whitespace. With \kwd{:}, ignore only newline; with \kwd{@},
849 ignore only following whitespace.
852 \IT{\KWD{\TLD}\Op{\VAR{n}\DF{\LIT{1}}}\KWD{\boldmath$|$}}
853 {\index{\~\textbar@$\sim${$"|$}}
854 Print \VAR{n} page separators.
857 \IT{\KWD{\TLD}\Op{\VAR{n}\DF{\LIT{1}}}\KWD{\TLD}}
858 {\index{\~\~@$\sim$$\sim$}
859 Print \VAR{n} tildes.
862 \IT{\KWD{\TLD}\OP{\VAR{min-col}\DF{\LIT{0}}
863 \OP{\KWD{,}\Op{\VAR{col-inc}\DF{\LIT{1}}}
864 \OP{\KWD{,}\Op{\VAR{min-pad}\DF{\LIT{0}}}
865 \OP{\KWD{,}\VAR{pad-char}\DF{\kwd{'}\textvisiblespace}}}}}
866 \KWD{\Op{:}\Op{@}\boldmath{$<$}}
867 \OP{\VAR{nl-text}\KWD{\TLD}\Op{\VAR{spare}\DF{\LIT{0}}\Op{,\VAR{width}}}\kwd{:;}}
868 \Goos{\VAR{text}\KWD{\TLD;}}\VAR{text} \KWD{\TLD\boldmath{$>$}}}
869 {\index{\~<\~>@$\sim$$<$ $\sim$$>$}
870 Justify text produced by \VAR{text}s in a field of at least
871 \VAR{min-col} columns. With \kwd{:}, right justify; with \kwd{@},
872 left justify. If this would leave less than \VAR{spare} characters
873 on the current line, output \VAR{nl-text} first.
876 \IT{\KWD{\TLD}\OP{\VAR{c}\DF{\LIT{1}}\OP{\KWD{,}\VAR{i}\DF{\LIT{1}}}}\Op{\KWD{:}}\Op{\KWD{@}}\KWD{T}}
877 {\index{\~T@$\sim$T}
878 Move cursor forward to column number $c + ki$, $k \geq 0$ being as small
879 as possible. With \kwd{:}, calculate column numbers relative to
880 the immediately enclosing section. With \kwd{@}, move to column
881 number $c_0 + c + ki$ where $c_0$ is the current position.
884 \IT{\Goo{\KWD{\TLD}\Op{\VAR{n}\DF{\LIT{0}}}\kwd{I}\XOR\KWD{\TLD}\Op{\VAR{n}\DF{\LIT{0}}}\kwd{:I}}}
885 {\index{\~I@$\sim$I}
886 Set indentation to \VAR{n} relative to leftmost/to current
887 position.
890 \IT{\Goo{%
891 \KWD{\TLD}\Op{\VAR{m}\DF{\LIT{1}}}\KWD{\A}\XOR
892 \KWD{\TLD}\Op{\VAR{m}\DF{\LIT{1}}}\KWD{:}\KWD{\A}\XOR
893 \KWD{\TLD}\Op{\VAR{n}\DF{\LIT{0}}}\KWD{@}\KWD{\A}}}
894 {\index{\~*@$\sim$\A}
895 Jump \VAR{m} arguments forward, or backward, or to argument \VAR{n}.
898 \IT{\KWD{\TLD}\Op{\VAR{limit}}\Op{\KWD{{:}}}\Op{\kwd{@}}%
899 \KWD{\boldmath{$\{$}}\VAR{text}\KWD{\TLD\boldmath{$\}$}}}
900 {\index{\~\{\~\}@$\sim$$\{$ $\sim\}$}
901 \VAR{text} is used repeatedly, up to \VAR{limit}, as control
902 string for the elements of the list argument or (with
903 \kwd{@}) for the remaining arguments. With \kwd{:} or \kwd{:@},
904 list elements or remaining arguments should be
905 lists of which a new one is used at each iteration step.
908 \IT{\KWD{\TLD}\OP{\VAR{x} \OP{\kwd{,}\VAR{y} \Op{\kwd{,}\VAR{z}}}}\KWD{\^{}}}
909 {\index{\~\^{}@$\sim$\^{}}
910 Leave immediately \kwd{\TLD\boldmath{$<$} \TLD\boldmath{$>$}},
911 \kwd{\TLD\boldmath{$<$} \TLD:\boldmath{$>$}},
912 \kwd{\TLD\boldmath{$\{$} \TLD\boldmath{$\}$}}, \kwd{\TLD?}, or the
913 entire \FU{format} operation. With one to three prefixes, act only
914 if $x=0$, $x=y$, or $x\leq y \leq z$, respectively.
917 \IT{\KWD{\TLD}\Op{\VAR{i}}\Op{\KWD{:}}\Op{\KWD{@}}\KWD{[}\Op{\Goos{\VAR{text}\KWD{\TLD;}}\VAR{text}}\Op{\kwd{\TLD:;}\VAR{default}}\KWD{\TLD]}}
918 {\index{\~[\~]@$\sim$[ $\sim$]}
919 The \VAR{text}s are format control subclauses the zero-indexed argumenth (or the
920 \VAR{i}th if given) of which is chosen. With \kwd{:}, the argument
921 is boolean and takes first \VAR{text} for \NIL\ and second
922 \VAR{text} for \T. With \kwd{@}, the argument is boolean and if \T, takes
923 the only \VAR{text} and remains to be read; no \VAR{text} is
924 chosen and the argument is used up if it is \NIL.
927 \IT{\KWD{\TLD\Op{@}?}}
928 {\index{\~?@$\sim$?}
929 Process two arguments as \FU{format} string and argument list. With
930 \kwd{@}, take one argument as \FU{format} string and use then the
931 rest oft the original arguments.
934 \IT{\KWD{\TLD}\OP{\VAR{prefix}\Goos{\kwd{,} \VAR{prefix}}}\Op{\kwd{:}}\Op{\kwd{@}}\KWD{/}\VAR{function}\KWD{/}}
935 {\index{\~//@$\sim$//}
936 Call \VAR{function} with the arguments stream, format-ar\-gu\-ment,
937 colon-p, at-sign-p and \VAR{prefix}es for printing format-argument.
940 \IT{\KWD{\TLD\Op{:}\Op{@}W}}
941 {\index{\~W@$\sim$W}
942 Print argument of any type obeying every printer control variable. With \kwd{:},
943 pretty-print. With \kwd{@}, print without limits on length or depth.
946 \IT{\Goo{\KWD{V}\XOR\KWD{\#}}}
947 {\index{V}\index{\#}
948 In place of the comma-separated prefix parameters: use next
949 argument or number of remaining unprocessed arguments, respectively.
952 \end{LIST}
954 \end{LIST}
957 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
958 \subsection{Streams}
959 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
961 \begin{LIST}{1cm}
963 \IT{(\FU*{OPEN} \VAR{path}
964 \orGOO{\kwd{:direction} \xorGOO{\kwd{:input}\\
965 \kwd{:output}\\
966 \kwd{:io}\\
967 \kwd{:probe}}{\}}\DF{\kwd{:input}}\\
968 \kwd{:element-type} \VAR{ type}\DF{\kwd{character}}\\
969 \kwd{:if-exists}
970 \xorGOO{\kwd{:new-version}\\
971 \kwd{:error}\\
972 \kwd{:rename}\\
973 \kwd{:rename-and-delete}\\
974 \kwd{:overwrite}\\
975 \kwd{:append}\\
976 \kwd{:supersede}\\
977 \NIL}{.}\\
978 \kwd{:if-does-not exist} \xorGOO{\kwd{:error}\\
979 \kwd{:create}\\
980 \NIL}{.}\\
981 \kwd{:external-format } \VAR{format}\DF{\kwd{:default}}%
982 }{\}})}
984 Open \retval{\kwd{file-stream} to \VAR{path}}.
987 \IT{\arrGOO{%
988 (\FU*{MAKE-CONCATENATED-STREAM } \OPn{\VAR{input-stream}})\\
989 (\FU*{MAKE-BROADCAST-STREAM } \OPn{\VAR{output-stream}})\\
990 (\FU*{MAKE-TWO-WAY-STREAM } \VAR{input-stream-part } \VAR{output-stream-part})\\
991 (\FU*{MAKE-ECHO-STREAM } \VAR{from-input-stream } \VAR{to-output-stream})\\
992 (\FU*{MAKE-SYNONYM-STREAM } \VAR{variable-bound-to-stream})}{.}}
994 Return \retval{stream} of indicated type.
997 \IT{(\FU*{MAKE-STRING-INPUT-STREAM} \VAR{string}
998 \OP{\VAR{start}\DF{\LIT{0}}
999 \Op{\VAR{end}\DF{\NIL}}})}
1001 Return a \retval{\kwd{string-stream}} supplying the characters from \VAR{string}.
1004 \IT{(\FU*{MAKE-STRING-OUTPUT-STREAM} \Op{\kwd{:element-type}
1005 \VAR{type}\DF{\kwd{character}}})}
1007 Return a \retval{\kwd{string-stream}} accepting characters
1008 (available via \FU{get-output-stream-string}).
1011 \IT{\arrGOO{(\FU*{CONCATENATED-STREAM-STREAMS } \VAR{concatenated-stream})\\
1012 (\FU*{BROADCAST-STREAM-STREAMS } \VAR{broadcast-stream})}{.}}
1014 Return \retval{list of streams} \VAR{concatenated-stream} still
1015 has to read from/\VAR{broadcast-stream} is
1016 broadcasting to.
1019 \IT{\arrGOO{%
1020 (\FU*{TWO-WAY-STREAM-INPUT-STREAM} \VAR{ two-way-stream})\\
1021 (\FU*{TWO-WAY-STREAM-OUTPUT-STREAM} \VAR{ two-way-stream})\\
1022 (\FU*{ECHO-STREAM-INPUT-STREAM} \VAR{ echo-stream})\\
1023 (\FU*{ECHO-STREAM-OUTPUT-STREAM} \VAR{ echo-stream})}{.}}
1025 Return \retval{source stream} or \retval{sink stream} of
1026 \VAR{two-way-stream}\slash\VAR{echo-stream}, respectively.
1029 \IT{(\FU*{SYNONYM-STREAM-SYMBOL} \VAR{synonym-stream})}
1031 Return \retval{symbol} of \VAR{synonym-stream}.
1034 \IT{(\FU*{GET-OUTPUT-STREAM-STRING} \DES{\VAR{string-stream}})}
1036 Clear and return as a \retval{string} characters on \VAR{string-stream}.
1039 \IT{(\FU*{LISTEN} \Op{\VAR{stream}\DF{\V{\A standard-input\A}}})}
1041 \retval{\T} if there is a character in input \VAR{stream}.
1044 \IT{(\FU*{CLEAR-INPUT}
1045 \Op{\DES{\VAR{stream}}\DF{\V{\A standard-input\A}}})}
1047 Clear input from \VAR{stream}, return \retval{\NIL}.
1050 \IT{(\xorGOO{\FU*{CLEAR-OUTPUT}\\
1051 \FU*{FORCE-OUTPUT}\\
1052 \FU*{FINISH-OUTPUT}}{\}}
1053 \Op{\DES{\VAR{stream}}\DF{\V{\A standard-output\A}}})}
1055 End output to \VAR{stream} and return \retval{\NIL} immediately,
1056 after initiating flushing of buffers, or after flushing of buffers,
1057 respectively.
1060 \IT{(\FU*{CLOSE} \DES{\VAR{stream}} \Op{\kwd{:abort}
1061 \VAR{bool}\DF{\NIL}})}
1063 Close \VAR{stream}. Return \retval{\T} if \VAR{stream} had been
1064 open. If \kwd{:abort} is \T, delete associated file.
1067 \IT{(\MC*{WITH-OPEN-STREAM} (\VAR{foo} \DES{\VAR{stream}})
1068 \OPn{(\kwd{declare} \OPn{\NEV{\VAR{decl}}})} \PROGN{\VAR{form}})}
1070 Evaluate \VAR{form}s with \VAR{foo} locally bound to
1071 \VAR{stream}. Return \retval{values of \VAR{form}s}.
1074 \IT{(\MC*{WITH-INPUT-FROM-STRING} (\VAR{foo} \VAR{string}
1075 \orGOO{\kwd{:index } \DES{\VAR{index}}\\
1076 \kwd{:start} \VAR{ start}\DF{\LIT{0}}\\
1077 \kwd{:end} \VAR{ end}\DF{\NIL}}{\}}) \OPn{(\kwd{declare}
1078 \OPn{\NEV{\VAR{decl}}})} \PROGN{\VAR{form}})}
1080 Evaluate \VAR{form}s with \VAR{foo} locally bound to input \kwd{string-stream}
1081 from \VAR{string}. Return \retval{values of \VAR{form}s}; store next
1082 reading position into \VAR{index}.
1085 \IT{(\MC*{WITH-OUTPUT-TO-STRING} (\VAR{foo}
1086 \Op{\DES{\VAR{string}}\DF{\NIL}} \Op{\kwd{:element-type}
1087 \VAR{type}\DF{\kwd{character}}}) \OPn{(\kwd{declare}
1088 \OPn{\NEV{\VAR{decl}}})} \PROGN{\VAR{form}})}
1090 Evaluate \VAR{form}s with \VAR{foo} locally bound to an output
1091 \kwd{string-stream}. Append output to \VAR{string} and return
1092 \retval{values of \VAR{form}s} if \VAR{string} is given. Return
1093 \retval{string containing output} otherwise.
1096 \IT{(\FU*{STREAM-EXTERNAL-FORMAT} \VAR{stream})}
1098 \retval{External file format designator}.
1101 \IT{\V{\A terminal-io\A}}
1102 {\index{*TERMINAL-IO*@\A TERMINAL-IO\A}
1103 Bidirectional stream to user terminal.
1106 \IT{\arrGOO{\V{\A standard-input\A}\\
1107 \V{\A standard-output\A}\\
1108 \V{\A error-output\A}}{.}}
1109 {\index{*STANDARD-INPUT*@\A STANDARD-INPUT\A}\index{*STANDARD-OUTPUT*@\A STANDARD-OUTPUT\A}\index{*ERROR-OUTPUT*@\A ERROR-OUTPUT\A}
1110 Standard input stream, standard output stream,
1111 or standard error output stream, respectively.
1114 \IT{\arrGOO{\V{\A debug-io\A}\\
1115 \V{\A query-io\A}}{.}}
1116 {\index{*DEBUG-IO*@\A DEBUG-IO\A}\index{*QUERY-IO*@\A QUERY-IO\A}
1117 Bidirectional streams for debugging and user interaction.
1120 \end{LIST}
1123 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1124 \subsection{Files}
1125 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1127 \begin{LIST}{1cm}
1129 \IT{(\FU*{MAKE-PATHNAME}
1130 \orGOO{\kwd{:host} \VAR{ host}\\
1131 \kwd{:device} \VAR{ dev}\\
1132 \kwd{:directory} \VAR{ dir}\\
1133 \kwd{:name} \VAR{ name}\\
1134 \kwd{:type} \VAR{ type}\\
1135 \kwd{:version} \VAR{ ver}\\
1136 \kwd{:defaults} \VAR{ path}\\
1137 \kwd{:case
1138 \Goo{\kwd{:local}\XOR\kwd{:common}}\DF{\kwd{:local}}}}{\}})}
1140 Construct \retval{pathname}.
1143 \IT{(\FU*{MERGE-PATHNAMES} \VAR{pathname}
1144 \OP{\VAR{default-pathname}\DF{\V{\A default-pathname-defaults\A}}
1145 \Op{\VAR{default-version}\DF{\kwd{:newest}}}})}
1147 Return \retval{\VAR{pathname}} after filling in missing parts from defaults.
1150 \IT{\V{\A default-pathname-defaults\A}}
1151 {\index{*DEFAULT-PATHNAME-DEFAULTS*@\A DEFAULT-PATHNAME-DEFAULTS\A}
1152 Pathname to use if one is needed and none supplied.
1155 \IT{(\FU*{PATHNAME} \VAR{path})}
1157 \retval{Pathname} of \VAR{path}.
1160 \IT{(\FU*{ENOUGH-NAMESTRING} \VAR{path}
1161 \Op{\VAR{root-path}\DF{\V{\A default-pathname-defaults\A}}})}
1163 Return \retval{minimal path string} to sufficiently describe
1164 \VAR{path} relative to \VAR{root-path.}
1167 \IT{\arrGOO{(\FU*{NAMESTRING}\VAR{ path})\\
1168 (\FU*{FILE-NAMESTRING}\VAR{ path})\\
1169 (\FU*{DIRECTORY-NAMESTRING}\VAR{ path})\\
1170 (\FU*{HOST-NAMESTRING}\VAR{ path})}{.}}
1172 Return string representing \retval{full pathname}; \retval{name, type, and version};
1173 \retval{directory name}; or \retval{host name}, respectively, of \VAR{path}.
1176 \IT{(\FU*{PARSE-NAMESTRING} \VAR{foo}
1177 \OP{\VAR{host}
1178 \OP{\VAR{default-pathname}\DF{\V{\A default-pathname-defaults\A}}
1179 \OP{\orGOO{\kwd{:start} \VAR{ start}\DF{\LIT{0}}\\
1180 \kwd{:end} \VAR{ end}\DF{\NIL}\\
1181 \kwd{:junk-allowed} \VAR{ bool}\DF{\NIL}}{\}}}}})}
1183 Return \retval{pathname} converted from
1184 string, pathname, or stream \VAR{foo}; and \retvalii{position}
1185 where parsing stopped.
1188 \IT{\arrGOO{%
1189 (\xorGOO{\FU*{PATHNAME-HOST}\\
1190 \FU*{PATHNAME-DEVICE}\\
1191 \FU*{PATHNAME-DIRECTORY}\\
1192 \FU*{PATHNAME-NAME}\\
1193 \FU*{PATHNAME-TYPE}}{\}}
1194 \VAR{path }
1195 \Op{\kwd{:case } \xorGOO{\kwd{:local}\\
1196 \kwd{:common}}{\}}\DF{\kwd{:local}}})\\
1197 (\FU*{PATHNAME-VERSION } \VAR{path})}{.}}
1199 Return \retval{pathname component}.
1202 \IT{(\FU*{LOGICAL-PATHNAME} \VAR{path})}
1204 \retval{Logical name} of \VAR{path}.
1207 \IT{(\FU*{TRANSLATE-PATHNAME} \VAR{path-a} \VAR{path-b}
1208 \VAR{path-c})}
1210 Translate \VAR{path-a} from wildcard \VAR{path-b} into wildcard
1211 \VAR{path-c}. Return \retval{new path}.
1214 \IT{(\FU*{LOGICAL-PATHNAME-TRANSLATIONS} \VAR{host})}
1216 \retval{\VAR{host}'s list of translations}. \kwd{setf}able.
1219 \IT{(\FU*{LOAD-LOGICAL-PATHNAME-TRANSLATIONS} \VAR{host})}
1221 Load \VAR{host}'s translations. Return \retval{\NIL} if already
1222 loaded, return \retval{\T} if successful.
1225 \IT{(\FU*{TRANSLATE-LOGICAL-PATHNAME} \VAR{path})}
1227 Physical \retval{pathname} of \VAR{path}.
1230 \IT{\arrGOO{(\FU*{PROBE-FILE} \VAR{ file})\\
1231 (\FU*{TRUENAME} \VAR{ file})}{.}}
1233 \retval{Canonical name} of \VAR{file}. If \VAR{file} does not exist,
1234 return \retval{\NIL}/signal \kwd{file-error}, respectively.
1237 \IT{(\FU*{FILE-WRITE-DATE} \VAR{file})}
1239 \retval{Time} at which \VAR{file} was last written.
1242 \IT{(\FU*{FILE-AUTHOR} \VAR{file})}
1244 Return \retval{name of \VAR{file} owner}.
1247 \IT{(\FU*{FILE-LENGTH} \VAR{stream})}
1249 Return \retval{length of \VAR{stream}}.
1252 \IT{(\FU*{FILE-POSITION} \VAR{stream} \Op{\xorGOO{\kwd{:start}\\
1253 \kwd{:end}\\
1254 \VAR{position}}{\}}})}
1256 Return \retval{position within stream}, or set it to
1257 \retval{\VAR{position}} and return \retval{\T} on success.
1260 \IT{(\FU*{FILE-STRING-LENGTH} \VAR{stream} \VAR{foo})}
1262 \retval{Length} \VAR{foo} would have in \VAR{stream}.
1265 \IT{(\FU*{RENAME-FILE} \VAR{foo} \VAR{bar})}
1267 Rename file \VAR{foo} to \VAR{bar}. Unspecified parts of path
1268 \VAR{bar} default to those of \VAR{foo}. Return \retval{new
1269 pathname}, \retvalii{old file name}, and \retvaliii{new file name}.
1272 \IT{(\FU*{DELETE-FILE} \VAR{file})}
1274 Delete \VAR{file}, return \retval{\T}.
1277 \IT{(\FU*{DIRECTORY} \VAR{path})}
1279 Return \retval{list of pathnames}.
1282 \IT{(\FU*{ENSURE-DIRECTORIES-EXIST} \VAR{path} \Op{\kwd{:verbose}
1283 \VAR{bool}})}
1285 Create parts of \retval{\VAR{path}} if necessary. Second return value is
1286 \retvalii{\T} if something has been created.
1289 \IT{(\MC*{WITH-OPEN-FILE} (\VAR{stream} \VAR{path}
1290 \OPn{\VAR{open-arg}}) \OPn{(\kwd{declare} \OPn{\NEV{\VAR{decl}}})}
1291 \PROGN{\VAR{form}})}
1293 Use \FU{OPEN} with \VAR{open-arg}s to temporarily
1294 create \VAR{stream} to \VAR{path}; return \retval{values of \VAR{form}s}.
1297 \IT{(\FU*{USER-HOMEDIR-PATHNAME} \Op{\VAR{host}})}
1299 User's \retval{home directory}.
1303 \end{LIST}
1307 % LocalWords: ies argumenth ar gu ment
1309 %%% Local Variables:
1310 %%% mode: latex
1311 %%% TeX-master: "clqr"
1312 %%% End: