91 lines
13 KiB
HTML
91 lines
13 KiB
HTML
<!-- Common Lisp HyperSpec (TM), version 7.0 generated by Kent M. Pitman on Mon, 11-Apr-2005 2:31am EDT -->
|
|
<HTML>
|
|
<HEAD>
|
|
<TITLE>CLHS: Variable *DEBUG-IO*, *ERROR-OUTPUT*...</TITLE>
|
|
<LINK HREF="../Data/clhs.css" REL="stylesheet" TYPE="text/css" />
|
|
<META HTTP-EQUIV="Author" CONTENT="Kent M. Pitman">
|
|
<META HTTP-EQUIV="Organization" CONTENT="LispWorks Ltd.">
|
|
<LINK REL=TOP HREF="../Front/index.htm">
|
|
<LINK REL=COPYRIGHT HREF="../Front/Help.htm#Legal">
|
|
<LINK REL=DISCLAIMER HREF="../Front/Help.htm#Disclaimer">
|
|
<LINK REL=PREV HREF="m_w_out_.htm">
|
|
<LINK REL=UP HREF="c_stream.htm">
|
|
<LINK REL=NEXT HREF="v_termin.htm">
|
|
</HEAD>
|
|
<BODY>
|
|
<H1><A REV=MADE HREF="http://www.lispworks.com/"><IMG WIDTH=80 HEIGHT=65 ALT="[LISPWORKS]" SRC="../Graphics/LWSmall.gif" ALIGN=Bottom></A><A REL=TOP HREF="../Front/index.htm"><IMG WIDTH=237 HEIGHT=65 ALT="[Common Lisp HyperSpec (TM)]" SRC="../Graphics/CLHS_Sm.gif" ALIGN=Bottom></A> <A REL=PREV HREF="m_w_out_.htm"><IMG WIDTH=40 HEIGHT=40 ALT="[Previous]" SRC="../Graphics/Prev.gif" ALIGN=Bottom></A><A REL=UP HREF="c_stream.htm"><IMG WIDTH=40 HEIGHT=40 ALT="[Up]" SRC="../Graphics/Up.gif" ALIGN=Bottom></A><A REL=NEXT HREF="v_termin.htm"><IMG WIDTH=40 HEIGHT=40 ALT="[Next]" SRC="../Graphics/Next.gif" ALIGN=Bottom></A></H1>
|
|
|
|
<HR>
|
|
|
|
<A NAME="STdebug-ioST"><A NAME="STerror-outputST"><A NAME="STquery-ioST"><A NAME="STstandard-inputST"><A NAME="STstandard-outputST"><A NAME="STtrace-outputST"><I>Variable</I> <B>*DEBUG-IO*, *ERROR-OUTPUT*, *QUERY-IO*, *STANDARD-INPUT*, *STANDARD-OUTPUT*, *TRACE-OUTPUT*</B></A></A></A></A></A></A> <P>
|
|
<P><B>Value Type:</B><P>
|
|
<P>
|
|
For <A REL=DEFINITION HREF="#STstandard-inputST"><B>*standard-input*</B></A>: an <A REL=DEFINITION HREF="26_glo_i.htm#input"><I>input</I></A> <A REL=DEFINITION HREF="26_glo_s.htm#stream"><I>stream</I></A> <P>
|
|
For <A REL=DEFINITION HREF="#STerror-outputST"><B>*error-output*</B></A>, <A REL=DEFINITION HREF="#STstandard-outputST"><B>*standard-output*</B></A>, and <A REL=DEFINITION HREF="#STtrace-outputST"><B>*trace-output*</B></A>: an <A REL=DEFINITION HREF="26_glo_o.htm#output"><I>output</I></A> <A REL=DEFINITION HREF="26_glo_s.htm#stream"><I>stream</I></A>. <P>
|
|
For <A REL=DEFINITION HREF="#STdebug-ioST"><B>*debug-io*</B></A>, <A REL=DEFINITION HREF="#STquery-ioST"><B>*query-io*</B></A>: a <A REL=DEFINITION HREF="26_glo_b.htm#bidirectional"><I>bidirectional</I></A> <A REL=DEFINITION HREF="26_glo_s.htm#stream"><I>stream</I></A>. <P>
|
|
<P><B>Initial Value:</B><P>
|
|
<P>
|
|
<A REL=DEFINITION HREF="26_glo_i.htm#implementation-dependent"><I>implementation-dependent</I></A>, but it must be an <A REL=DEFINITION HREF="26_glo_o.htm#open"><I>open</I></A> <A REL=DEFINITION HREF="26_glo_s.htm#stream"><I>stream</I></A> that is not a <A REL=DEFINITION HREF="26_glo_g.htm#generalized_synonym_stream"><I>generalized synonym stream</I></A> to an <A REL=DEFINITION HREF="26_glo_i.htm#iSLo_customization_variable"><I>I/O customization variables</I></A> but that might be a <A REL=DEFINITION HREF="26_glo_g.htm#generalized_synonym_stream"><I>generalized synonym stream</I></A> to the value of some <A REL=DEFINITION HREF="26_glo_i.htm#iSLo_customization_variable"><I>I/O customization variable</I></A>. The initial value might also be a <A REL=DEFINITION HREF="26_glo_g.htm#generalized_synonym_stream"><I>generalized synonym stream</I></A> to either the <A REL=DEFINITION HREF="26_glo_s.htm#symbol"><I>symbol</I></A> <A REL=DEFINITION HREF="v_termin.htm#STterminal-ioST"><B>*terminal-io*</B></A> or to the <A REL=DEFINITION HREF="26_glo_s.htm#stream"><I>stream</I></A> that is its <A REL=DEFINITION HREF="26_glo_v.htm#value"><I>value</I></A>. <P>
|
|
<P><B>Description:</B><P>
|
|
<P>
|
|
These <A REL=DEFINITION HREF="26_glo_v.htm#variable"><I>variables</I></A> are collectively called the <A REL=DEFINITION HREF="26_glo_s.htm#standardized"><I>standardized</I></A> <A REL=DEFINITION HREF="26_glo_i.htm#iSLo_customization_variable"><I>I/O customization variables</I></A>. They can be <A REL=DEFINITION HREF="26_glo_b.htm#bound"><I>bound</I></A> or <I>assigned</I> in order to change the default destinations for input and/or output used by various <A REL=DEFINITION HREF="26_glo_s.htm#standardized"><I>standardized</I></A> <A REL=DEFINITION HREF="26_glo_o.htm#operator"><I>operators</I></A> and facilities. <P>
|
|
The <A REL=DEFINITION HREF="26_glo_v.htm#value"><I>value</I></A> of <A REL=DEFINITION HREF="#STdebug-ioST"><B>*debug-io*</B></A>, called <A REL=DEFINITION HREF="26_glo_d.htm#debug_iSLo"><I>debug I/O</I></A>, is a <A REL=DEFINITION HREF="26_glo_s.htm#stream"><I>stream</I></A> to be used for interactive debugging purposes. <P>
|
|
The <A REL=DEFINITION HREF="26_glo_v.htm#value"><I>value</I></A> of <A REL=DEFINITION HREF="#STerror-outputST"><B>*error-output*</B></A>, called <A REL=DEFINITION HREF="26_glo_e.htm#error_output"><I>error output</I></A>, is a <A REL=DEFINITION HREF="26_glo_s.htm#stream"><I>stream</I></A> to which warnings and non-interactive error messages should be sent. <P>
|
|
The <A REL=DEFINITION HREF="26_glo_v.htm#value"><I>value</I></A> of <A REL=DEFINITION HREF="#STquery-ioST"><B>*query-io*</B></A>, called <A REL=DEFINITION HREF="26_glo_q.htm#query_iSLo"><I>query I/O</I></A>, is a <A REL=DEFINITION HREF="26_glo_b.htm#bidirectional"><I>bidirectional</I></A> <A REL=DEFINITION HREF="26_glo_s.htm#stream"><I>stream</I></A> to be used when asking questions of the user. The question should be output to this <A REL=DEFINITION HREF="26_glo_s.htm#stream"><I>stream</I></A>, and the answer read from it. <P>
|
|
The <A REL=DEFINITION HREF="26_glo_v.htm#value"><I>value</I></A> of <A REL=DEFINITION HREF="#STstandard-inputST"><B>*standard-input*</B></A>, called <A REL=DEFINITION HREF="26_glo_s.htm#standard_input"><I>standard input</I></A>, is a <A REL=DEFINITION HREF="26_glo_s.htm#stream"><I>stream</I></A> that is used by many <A REL=DEFINITION HREF="26_glo_o.htm#operator"><I>operators</I></A> as a default source of input when no specific <A REL=DEFINITION HREF="26_glo_i.htm#input"><I>input</I></A> <A REL=DEFINITION HREF="26_glo_s.htm#stream"><I>stream</I></A> is explicitly supplied. <P>
|
|
The <A REL=DEFINITION HREF="26_glo_v.htm#value"><I>value</I></A> of <A REL=DEFINITION HREF="#STstandard-outputST"><B>*standard-output*</B></A>, called <A REL=DEFINITION HREF="26_glo_s.htm#standard_output"><I>standard output</I></A>, is a <A REL=DEFINITION HREF="26_glo_s.htm#stream"><I>stream</I></A> that is used by many <A REL=DEFINITION HREF="26_glo_o.htm#operator"><I>operators</I></A> as a default destination for output when no specific <A REL=DEFINITION HREF="26_glo_o.htm#output"><I>output</I></A> <A REL=DEFINITION HREF="26_glo_s.htm#stream"><I>stream</I></A> is explicitly supplied. <P>
|
|
The <A REL=DEFINITION HREF="26_glo_v.htm#value"><I>value</I></A> of <A REL=DEFINITION HREF="#STtrace-outputST"><B>*trace-output*</B></A>, called <A REL=DEFINITION HREF="26_glo_t.htm#trace_output"><I>trace output</I></A>, is the <A REL=DEFINITION HREF="26_glo_s.htm#stream"><I>stream</I></A> on which traced functions (see <A REL=DEFINITION HREF="m_tracec.htm#trace"><B>trace</B></A>) and the <A REL=DEFINITION HREF="m_time.htm#time"><B>time</B></A> <A REL=DEFINITION HREF="26_glo_m.htm#macro"><I>macro</I></A> print their output. <P>
|
|
<P><B>Examples:</B><P>
|
|
<P>
|
|
<PRE>
|
|
(with-output-to-string (*error-output*)
|
|
(warn "this string is sent to *error-output*"))
|
|
=> "Warning: this string is sent to *error-output*
|
|
" ;The exact format of this string is <A REL=DEFINITION HREF="26_glo_i.htm#implementation-dependent">implementation-dependent</A>.
|
|
|
|
(with-input-from-string (*standard-input* "1001")
|
|
(+ 990 (read))) => 1991
|
|
|
|
(progn (setq out (with-output-to-string (*standard-output*)
|
|
(print "print and format t send things to")
|
|
(format t "*standard-output* now going to a string")))
|
|
:done)
|
|
=> :DONE
|
|
out
|
|
=> "
|
|
\"print and format t send things to\" *standard-output* now going to a string"
|
|
|
|
(defun fact (n) (if (< n 2) 1 (* n (fact (- n 1)))))
|
|
=> FACT
|
|
(trace fact)
|
|
=> (FACT)
|
|
;; Of course, the format of traced output is implementation-dependent.
|
|
(with-output-to-string (*trace-output*)
|
|
(fact 3))
|
|
=> "
|
|
1 Enter FACT 3
|
|
| 2 Enter FACT 2
|
|
| 3 Enter FACT 1
|
|
| 3 Exit FACT 1
|
|
| 2 Exit FACT 2
|
|
1 Exit FACT 6"
|
|
</PRE>
|
|
</TT> <P>
|
|
<P><B>See Also:</B><P>
|
|
<P>
|
|
<A REL=DEFINITION HREF="v_termin.htm#STterminal-ioST"><B>*terminal-io*</B></A>, <A REL=DEFINITION HREF="t_syn_st.htm#synonym-stream"><B>synonym-stream</B></A>, <A REL=DEFINITION HREF="m_time.htm#time"><B>time</B></A>, <A REL=DEFINITION HREF="m_tracec.htm#trace"><B>trace</B></A>, <A REL=CHILD HREF="09_.htm">Section 9 (Conditions)</A>, <A REL=CHILD HREF="23_.htm">Section 23 (Reader)</A>, <A REL=CHILD HREF="22_.htm">Section 22 (Printer)</A> <P>
|
|
<P><B>Notes:</B><P>
|
|
<P>
|
|
The intent of the constraints on the initial <A REL=DEFINITION HREF="26_glo_v.htm#value"><I>value</I></A> of the <A REL=DEFINITION HREF="26_glo_i.htm#iSLo_customization_variable"><I>I/O customization variables</I></A> is to ensure that it is always safe to <A REL=DEFINITION HREF="26_glo_b.htm#bind"><I>bind</I></A> or <A REL=DEFINITION HREF="26_glo_a.htm#assign"><I>assign</I></A> such a <A REL=DEFINITION HREF="26_glo_v.htm#variable"><I>variable</I></A> to the <A REL=DEFINITION HREF="26_glo_v.htm#value"><I>value</I></A> of another <A REL=DEFINITION HREF="26_glo_i.htm#iSLo_customization_variable"><I>I/O customization variable</I></A>, without unduly restricting <A REL=DEFINITION HREF="26_glo_i.htm#implementation"><I>implementation</I></A> flexibility. <P>
|
|
It is common for an <A REL=DEFINITION HREF="26_glo_i.htm#implementation"><I>implementation</I></A> to make the initial <A REL=DEFINITION HREF="26_glo_v.htm#value"><I>values</I></A> of <A REL=DEFINITION HREF="#STdebug-ioST"><B>*debug-io*</B></A> and <A REL=DEFINITION HREF="#STquery-ioST"><B>*query-io*</B></A> be the <A REL=DEFINITION HREF="26_glo_s.htm#same"><I>same</I></A> <A REL=DEFINITION HREF="26_glo_s.htm#stream"><I>stream</I></A>, and to make the initial <A REL=DEFINITION HREF="26_glo_v.htm#value"><I>values</I></A> of <A REL=DEFINITION HREF="#STerror-outputST"><B>*error-output*</B></A> and <A REL=DEFINITION HREF="#STstandard-outputST"><B>*standard-output*</B></A> be the <A REL=DEFINITION HREF="26_glo_s.htm#same"><I>same</I></A> <A REL=DEFINITION HREF="26_glo_s.htm#stream"><I>stream</I></A>. <P>
|
|
The functions <A REL=DEFINITION HREF="f_y_or_n.htm#y-or-n-p"><B>y-or-n-p</B></A> and <A REL=DEFINITION HREF="f_y_or_n.htm#yes-or-no-p"><B>yes-or-no-p</B></A> use <A REL=DEFINITION HREF="26_glo_q.htm#query_iSLo"><I>query I/O</I></A> for their input and output. <P>
|
|
In the normal <A REL=DEFINITION HREF="26_glo_l.htm#lisp_read-eval-print_loop"><I>Lisp read-eval-print loop</I></A>, input is read from <A REL=DEFINITION HREF="26_glo_s.htm#standard_input"><I>standard input</I></A>. Many input functions, including <A REL=DEFINITION HREF="f_rd_rd.htm#read"><B>read</B></A> and <A REL=DEFINITION HREF="f_rd_cha.htm#read-char"><B>read-char</B></A>, take a <A REL=DEFINITION HREF="26_glo_s.htm#stream"><I>stream</I></A> argument that defaults to <A REL=DEFINITION HREF="26_glo_s.htm#standard_input"><I>standard input</I></A>. <P>
|
|
In the normal <A REL=DEFINITION HREF="26_glo_l.htm#lisp_read-eval-print_loop"><I>Lisp read-eval-print loop</I></A>, output is sent to <A REL=DEFINITION HREF="26_glo_s.htm#standard_output"><I>standard output</I></A>. Many output functions, including <A REL=DEFINITION HREF="f_wr_pr.htm#print"><B>print</B></A> and <A REL=DEFINITION HREF="f_wr_cha.htm#write-char"><B>write-char</B></A>, take a <A REL=DEFINITION HREF="26_glo_s.htm#stream"><I>stream</I></A> argument that defaults to <A REL=DEFINITION HREF="26_glo_s.htm#standard_output"><I>standard output</I></A>. <P>
|
|
A program that wants, for example, to divert output to a file should do so by <A REL=DEFINITION HREF="26_glo_b.htm#binding"><I>binding</I></A> <A REL=DEFINITION HREF="#STstandard-outputST"><B>*standard-output*</B></A>; that way error messages sent to <A REL=DEFINITION HREF="#STerror-outputST"><B>*error-output*</B></A> can still get to the user by going through <A REL=DEFINITION HREF="v_termin.htm#STterminal-ioST"><B>*terminal-io*</B></A> (if <A REL=DEFINITION HREF="#STerror-outputST"><B>*error-output*</B></A> is bound to <A REL=DEFINITION HREF="v_termin.htm#STterminal-ioST"><B>*terminal-io*</B></A>), which is usually what is desired. <P>
|
|
<P><HR>The following <A REL=META HREF="../Front/X3J13Iss.htm">X3J13 cleanup issue</A>, <I>not part of the specification</I>, applies to this section:<P><UL><LI> <A REL=CHILD HREF="../Issues/iss323.htm">STANDARD-INPUT-INITIAL-BINDING:DEFINED-CONTRACTS</A><P></UL><HR>
|
|
|
|
<A REL=NAVIGATOR HREF="../Front/StartPts.htm"><IMG WIDTH=80 HEIGHT=40 ALT="[Starting Points]" SRC="../Graphics/StartPts.gif" ALIGN=Bottom></A><A REL=TOC HREF="../Front/Contents.htm"><IMG WIDTH=80 HEIGHT=40 ALT="[Contents]" SRC="../Graphics/Contents.gif" ALIGN=Bottom></A><A REL=INDEX HREF="../Front/X_Master.htm"><IMG WIDTH=80 HEIGHT=40 ALT="[Index]" SRC="../Graphics/Index.gif" ALIGN=Bottom></A><A REL=INDEX HREF="../Front/X_Symbol.htm"><IMG WIDTH=80 HEIGHT=40 ALT="[Symbols]" SRC="../Graphics/Symbols.gif" ALIGN=Bottom></A><A REL=GLOSSARY HREF="../Body/26_a.htm"><IMG WIDTH=80 HEIGHT=40 ALT="[Glossary]" SRC="../Graphics/Glossary.gif" ALIGN=Bottom></A><A HREF="../Front/X3J13Iss.htm"><IMG WIDTH=80 HEIGHT=40 ALT="[Issues]" SRC="../Graphics/Issues.gif" ALIGN=Bottom></A><BR>
|
|
|
|
<A REL=COPYRIGHT HREF="../Front/Help.htm#Legal"><I>Copyright 1996-2005, LispWorks Ltd. All rights reserved.</I></A><P>
|
|
</BODY>
|
|
</HTML>
|