File: usermanual_10.html

package info (click to toggle)
ucblogo 6.0%2Bdfsg-2
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 7,636 kB
  • sloc: ansic: 16,989; cpp: 3,818; makefile: 186; perl: 3
file content (217 lines) | stat: -rw-r--r-- 11,866 bytes parent folder | download | duplicates (2)
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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html401/loose.dtd">
<html>
<!-- Created on September, 3 2008 by texi2html 1.78 -->
<!--
Written by: Lionel Cons <Lionel.Cons@cern.ch> (original author)
            Karl Berry  <karl@freefriends.org>
            Olaf Bachmann <obachman@mathematik.uni-kl.de>
            and many others.
Maintained by: Many creative people.
Send bugs and suggestions to <texi2html-bug@nongnu.org>

-->
<head>
<title>BERKELEY LOGO 6.0: 10. Error Processing</title>

<meta name="description" content="BERKELEY LOGO 6.0: 10. Error Processing">
<meta name="keywords" content="BERKELEY LOGO 6.0: 10. Error Processing">
<meta name="resource-type" content="document">
<meta name="distribution" content="global">
<meta name="Generator" content="texi2html 1.78">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<style type="text/css">
<!--
a.summary-letter {text-decoration: none}
pre.display {font-family: serif}
pre.format {font-family: serif}
pre.menu-comment {font-family: serif}
pre.menu-preformatted {font-family: serif}
pre.smalldisplay {font-family: serif; font-size: smaller}
pre.smallexample {font-size: smaller}
pre.smallformat {font-family: serif; font-size: smaller}
pre.smalllisp {font-size: smaller}
span.roman {font-family:serif; font-weight:normal;}
span.sansserif {font-family:sans-serif; font-weight:normal;}
ul.toc {list-style: none}
-->
</style>


</head>

<body lang="en" bgcolor="#FFFFFF" text="#000000" link="#0000FF" vlink="#800080" alink="#FF0000">

<a name="ERROR-PROCESSING"></a>
<a name="SEC371"></a>
<table cellpadding="1" cellspacing="1" border="0">
<tr><td valign="middle" align="left">[<a href="usermanual_9.html#SEC370" title="Previous section in reading order"> &lt; </a>]</td>
<td valign="middle" align="left">[<a href="#SEC372" title="Next section in reading order"> &gt; </a>]</td>
<td valign="middle" align="left"> &nbsp; </td>
<td valign="middle" align="left">[<a href="usermanual_9.html#SEC366" title="Beginning of this chapter or previous chapter"> &lt;&lt; </a>]</td>
<td valign="middle" align="left">[<a href="usermanual.html#Top" title="Up section"> Up </a>]</td>
<td valign="middle" align="left">[<a href="usermanual_11.html#SEC373" title="Next chapter"> &gt;&gt; </a>]</td>
<td valign="middle" align="left"> &nbsp; </td>
<td valign="middle" align="left"> &nbsp; </td>
<td valign="middle" align="left"> &nbsp; </td>
<td valign="middle" align="left"> &nbsp; </td>
<td valign="middle" align="left">[<a href="usermanual.html#Top" title="Cover (top) of document">Top</a>]</td>
<td valign="middle" align="left">[<a href="usermanual_toc.html#SEC_Contents" title="Table of contents">Contents</a>]</td>
<td valign="middle" align="left">[<a href="usermanual_13.html#SEC391" title="Index">Index</a>]</td>
<td valign="middle" align="left">[<a href="usermanual_abt.html#SEC_About" title="About (help)"> ? </a>]</td>
</tr></table>
<h1 class="chapter"> 10. Error Processing </h1>

<table class="menu" border="0" cellspacing="0">
<tr><td align="left" valign="top"><a href="#SEC372">10.1 Error Codes</a></td><td>&nbsp;&nbsp;</td><td align="left" valign="top">                 
</td></tr>
</table>

<p>If an error occurs, Logo takes the following steps.  First, if there is an
available variable named <code>ERRACT</code>, Logo takes its value as an
instructionlist and runs the instructions.  The operation <code>ERROR</code> may be
used within the instructions (once) to examine the error condition.  If the
instructionlist invokes <code>PAUSE</code>, the error message is printed before the
pause happens.  Certain errors are <em>recoverable</em>; for one of those errors,
if the instructionlist outputs a value, that value is used in place of the
expression that caused the error.  (If <code>ERRACT</code> invokes <code>PAUSE</code> and
the user then invokes <code>CONTINUE</code> with an input, that input becomes the
output from <code>PAUSE</code> and therefore the output from the <code>ERRACT</code>
instructionlist.)
</p>
<p>It is possible for an <code>ERRACT</code> instructionlist to produce an
inappropriate value or no value where one is needed.  As a result, the same
error condition could recur forever because of this mechanism.  To avoid that
danger, if the same error condition occurs twice in a row from an
<code>ERRACT</code> instructionlist without user interaction, the message
&lsquo;<samp>Erract loop</samp>&rsquo; is printed and control returns to toplevel.  &quot;Without user
interaction&quot; means that if <code>ERRACT</code> invokes <code>PAUSE</code> and the user
provides an incorrect value, this loop prevention mechanism does not take
effect and the user gets to try again.
</p>
<p>During the running of the <code>ERRACT</code> instructionlist, <code>ERRACT</code> is
locally unbound, so an error in the <code>ERRACT</code> instructions themselves will
not cause a loop.  In particular, an error during a pause will not cause a
pause-within-a-pause unless the user reassigns the value <code>[PAUSE]</code> to
<code>ERRACT</code> during the pause.  But such an error will not return to
toplevel; it will remain within the original pause loop.
</p>
<p>If there is no available <code>ERRACT</code> value, Logo handles the error by
generating an internal <tt>THROW &quot;ERROR</tt>.  (A user program can also
generate an error condition deliberately by invoking <code>THROW</code>.)  If this
throw is not caught by a <tt>CATCH &quot;ERROR</tt> in the user program, it is
eventually caught either by the toplevel instruction loop or by a pause loop,
which prints the error message. An invocation of <tt>CATCH &quot;ERROR</tt> in a
user program locally unbinds <code>ERRACT</code>, so the effect is that whichever of
<code>ERRACT</code> and <tt>CATCH &quot;ERROR</tt> is more local will take precedence.
</p>
<p>If a floating point overflow occurs during an arithmetic operation, or a
two-input mathematical function (like <code>POWER</code>) is invoked with an illegal
combination of inputs, the &lsquo;<samp>doesn't like</samp>&rsquo; message refers to the second
operand, but should be taken as meaning the combination.
</p>
<p>See section <a href="usermanual_11.html#SEC378">erract</a> ,
<a href="usermanual_8.html#SEC335">throw</a> ,
<a href="usermanual_8.html#SEC336">error</a> ,
<a href="usermanual_8.html#SEC334">catch</a> ,
<a href="usermanual_8.html#SEC337">pause</a> ,
<a href="usermanual_8.html#SEC338">continue</a> .
</p>
<hr size="6">
<a name="ERROR-CODES"></a>
<a name="SEC372"></a>
<table cellpadding="1" cellspacing="1" border="0">
<tr><td valign="middle" align="left">[<a href="#SEC371" title="Previous section in reading order"> &lt; </a>]</td>
<td valign="middle" align="left">[<a href="usermanual_11.html#SEC373" title="Next section in reading order"> &gt; </a>]</td>
<td valign="middle" align="left"> &nbsp; </td>
<td valign="middle" align="left">[<a href="#SEC371" title="Beginning of this chapter or previous chapter"> &lt;&lt; </a>]</td>
<td valign="middle" align="left">[<a href="#SEC371" title="Up section"> Up </a>]</td>
<td valign="middle" align="left">[<a href="usermanual_11.html#SEC373" title="Next chapter"> &gt;&gt; </a>]</td>
<td valign="middle" align="left"> &nbsp; </td>
<td valign="middle" align="left"> &nbsp; </td>
<td valign="middle" align="left"> &nbsp; </td>
<td valign="middle" align="left"> &nbsp; </td>
<td valign="middle" align="left">[<a href="usermanual.html#Top" title="Cover (top) of document">Top</a>]</td>
<td valign="middle" align="left">[<a href="usermanual_toc.html#SEC_Contents" title="Table of contents">Contents</a>]</td>
<td valign="middle" align="left">[<a href="usermanual_13.html#SEC391" title="Index">Index</a>]</td>
<td valign="middle" align="left">[<a href="usermanual_abt.html#SEC_About" title="About (help)"> ? </a>]</td>
</tr></table>
<h2 class="section"> 10.1 Error Codes </h2>

<p>Here are the numeric codes that appear as the first member of the list
output by <code>ERROR</code> when an error is caught, with the corresponding messages.
Some messages may have two different codes depending on whether or not
the error is recoverable (that is, a substitute value can be provided
through the <code>ERRACT</code> mechanism) in the specific context.  Some messages are
warnings rather than errors; these will not be caught.  Errors 0 and 32 are
so bad that Logo exits immediately.
</p>
<table><tr><td>&nbsp;</td><td><pre class="example">  0	Fatal internal error&nbsp;&nbsp;<span class="roman">(can't be caught)</span>
  1	Out of memory
  2	Stack overflow
  3	Turtle out of bounds
  4	<var>proc</var> doesn't like <var>datum</var> as input&nbsp;&nbsp;<span class="roman">(not recoverable)</span>
  5	<var>proc</var> didn't output to <var>proc</var>
  6	Not enough inputs to <var>proc</var>
  7	<code>proc</code> doesn't like <code>datum</code> as input&nbsp;&nbsp;<span class="roman">(recoverable)</span>
  8	Too much inside ()'s
  9 	You don't say what to do with <var>datum</var>
 10	')' not found
 11	<var>var</var> has no value
 12	Unexpected ')'
 13	I don't know how to <var>proc</var>&nbsp;&nbsp;<span class="roman">(recoverable)</span>
 14	Can't find catch tag for <var>throwtag</var>
 15	<var>proc</var> is already defined
 16	Stopped
 17	Already dribbling
 18	File system error
 19	Assuming you mean IFELSE, not IF&nbsp;&nbsp;<span class="roman">(warning only)</span>
 20	<var>var</var> shadowed by local in procedure call&nbsp;&nbsp;<span class="roman">(warning only)</span>
 21	Throw &quot;Error
 22	<var>proc</var> is a primitive
 23	Can't use TO inside a procedure
 24	I don't know how to <var>proc</var>&nbsp;&nbsp;<span class="roman">(not recoverable)</span>
 25	IFTRUE/IFFALSE without TEST
 26	Unexpected ']'
 27	Unexpected '}'
 28	Couldn't initialize graphics
 29	Macro returned <var>value</var> instead of a list
 30	You don't say what to do with <var>value</var>
 31	Can only use STOP or OUTPUT inside a procedure
 32	APPLY doesn't like <var>badthing</var> as input
 33	END inside multi-line instruction
 34	Really out of memory&nbsp;&nbsp;<span class="roman">(can't be caught)</span>
 35	user-generated error message (THROW &quot;ERROR <var>message</var>)
 36	END inside multi-line instruction
 37	Bad default expression for optional input: <var>expr</var>
 38	Can't use OUTPUT or STOP inside RUNRESULT
 39 	Assuming you meant 'FD 100', not FD100&nbsp;&nbsp;<span class="roman">(or similar)</span>
 40	I can't open file <var>filename</var>
 41	File <var>filename</var> already open
 42	File <var>filename</var> not open
 43	Runlist [<var>expr</var> <var>expr</var>] has more than one expression.
</pre></td></tr></table>


<hr size="6">
<table cellpadding="1" cellspacing="1" border="0">
<tr><td valign="middle" align="left">[<a href="#SEC371" title="Beginning of this chapter or previous chapter"> &lt;&lt; </a>]</td>
<td valign="middle" align="left">[<a href="usermanual_11.html#SEC373" title="Next chapter"> &gt;&gt; </a>]</td>
<td valign="middle" align="left"> &nbsp; </td>
<td valign="middle" align="left"> &nbsp; </td>
<td valign="middle" align="left"> &nbsp; </td>
<td valign="middle" align="left"> &nbsp; </td>
<td valign="middle" align="left"> &nbsp; </td>
<td valign="middle" align="left">[<a href="usermanual.html#Top" title="Cover (top) of document">Top</a>]</td>
<td valign="middle" align="left">[<a href="usermanual_toc.html#SEC_Contents" title="Table of contents">Contents</a>]</td>
<td valign="middle" align="left">[<a href="usermanual_13.html#SEC391" title="Index">Index</a>]</td>
<td valign="middle" align="left">[<a href="usermanual_abt.html#SEC_About" title="About (help)"> ? </a>]</td>
</tr></table>
<p>
 <font size="-1">
  This document was generated by <em>Brian Harvey</em> on <em>September, 3 2008</em> using <a href="http://www.nongnu.org/texi2html/"><em>texi2html 1.78</em></a>.
 </font>
 <br>

</p>
</body>
</html>