File: _star_STANDARD-CO_star_.html

package info (click to toggle)
acl2 3.1-1
  • links: PTS
  • area: main
  • in suites: etch, etch-m68k
  • size: 36,712 kB
  • ctags: 38,396
  • sloc: lisp: 464,023; makefile: 5,470; sh: 86; csh: 47; cpp: 25; ansic: 22
file content (43 lines) | stat: -rw-r--r-- 2,875 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
<html>
<head><title>_star_STANDARD-CO_star_.html  --  ACL2 Version 3.1</title></head>
<body text=#000000 bgcolor="#FFFFFF">
<h2>*STANDARD-CO*</h2>the ACL2 analogue of CLTL's <code>*standard-output*</code>
<pre>Major Section:  <a href="PROGRAMMING.html">PROGRAMMING</a>
</pre><p>

The value of the ACL2 constant <code>*standard-co*</code> is an open character
output channel that is synonymous to Common Lisp's
<code>*standard-output*</code>.
<p>
ACL2 character output to <code>*standard-co*</code> will go to the stream named
by Common Lisp's <code>*standard-output*</code>.  That is, by changing the
setting of <code>*standard-output*</code> in raw Common Lisp you can change the
actual destination of ACL2 output on the channel named by
<code>*standard-co*</code>.  Observe that this happens without changing the
logical value of <code>*standard-co*</code> (which is some channel symbol).
Changing the setting of <code>*standard-output*</code> in raw Common Lisp
essentially just changes the map that relates ACL2 to the physical
world of terminals, files, etc.<p>

To see the value of this observation, consider the following.
Suppose you write an ACL2 function which does character output to
the constant channel <code>*standard-co*</code>.  During testing you see that the
output actually goes to your terminal.  Can you use the function to
output to a file?  Yes, if you are willing to do a little work in
raw Common Lisp: open a stream to the file in question, set
<code>*standard-output*</code> to that stream, call your ACL2 function, and then
close the stream and restore <code>*standard-output*</code> to its nominal value.
Similar observations can be made about the two ACL2 input channels,
<code><a href="_star_STANDARD-OI_star_.html">*standard-oi*</a></code> and <code><a href="_star_STANDARD-CI_star_.html">*standard-ci*</a></code>, which are analogues of
<code>*standard-input*</code>.<p>

Another reason you might have for wanting to change the actual
streams associated with <code><a href="_star_STANDARD-OI_star_.html">*standard-oi*</a></code> and <code>*standard-co*</code> is to drive
the ACL2 top-level loop, <code><a href="LD.html">ld</a></code>, on alternative input and output
streams.  This end can be accomplished easily within ACL2 by either
calling <code><a href="LD.html">ld</a></code> on the desired channels or file names or by resetting the
ACL2 <code><a href="STATE.html">state</a></code> global variables <code>'</code><code><a href="STANDARD-OI.html">standard-oi</a></code> and <code>'</code><code><a href="STANDARD-CO.html">standard-co</a></code> which are
used by <code><a href="LD.html">ld</a></code>.  See <a href="STANDARD-OI.html">standard-oi</a> and see <a href="STANDARD-CO.html">standard-co</a>.
<br><br><br><a href="acl2-doc.html"><img src="llogo.gif"></a> <a href="acl2-doc-index.html"><img src="index.gif"></a>
</body>
</html>