| 1 |
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> |
| 2 |
<html> |
| 3 |
<!-- Created by GNU Texinfo 6.7, http://www.gnu.org/software/texinfo/ --> |
| 4 |
<head> |
| 5 |
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"> |
| 6 |
<title>User Interface (GCL SI Manual)</title> |
| 7 |
|
| 8 |
<meta name="description" content="User Interface (GCL SI Manual)"> |
| 9 |
<meta name="keywords" content="User Interface (GCL SI Manual)"> |
| 10 |
<meta name="resource-type" content="document"> |
| 11 |
<meta name="distribution" content="global"> |
| 12 |
<meta name="Generator" content="makeinfo"> |
| 13 |
<link href="index.html" rel="start" title="Top"> |
| 14 |
<link href="Function-and-Variable-Index.html" rel="index" title="Function and Variable Index"> |
| 15 |
<link href="Function-and-Variable-Index.html#SEC_Contents" rel="contents" title="Table of Contents"> |
| 16 |
<link href="index.html" rel="up" title="Top"> |
| 17 |
<link href="Doc.html" rel="next" title="Doc"> |
| 18 |
<link href="Iteration-and-Tests.html" rel="prev" title="Iteration and Tests"> |
| 19 |
<style type="text/css"> |
| 20 |
<!-- |
| 21 |
a.summary-letter {text-decoration: none} |
| 22 |
blockquote.indentedblock {margin-right: 0em} |
| 23 |
div.display {margin-left: 3.2em} |
| 24 |
div.example {margin-left: 3.2em} |
| 25 |
div.lisp {margin-left: 3.2em} |
| 26 |
kbd {font-style: oblique} |
| 27 |
pre.display {font-family: inherit} |
| 28 |
pre.format {font-family: inherit} |
| 29 |
pre.menu-comment {font-family: serif} |
| 30 |
pre.menu-preformatted {font-family: serif} |
| 31 |
span.nolinebreak {white-space: nowrap} |
| 32 |
span.roman {font-family: initial; font-weight: normal} |
| 33 |
span.sansserif {font-family: sans-serif; font-weight: normal} |
| 34 |
ul.no-bullet {list-style: none} |
| 35 |
--> |
| 36 |
</style> |
| 37 |
|
| 38 |
|
| 39 |
</head> |
| 40 |
|
| 41 |
<body lang="en"> |
| 42 |
<span id="User-Interface"></span><div class="header"> |
| 43 |
<p> |
| 44 |
Next: <a href="Doc.html" accesskey="n" rel="next">Doc</a>, Previous: <a href="Iteration-and-Tests.html" accesskey="p" rel="prev">Iteration and Tests</a>, Up: <a href="index.html" accesskey="u" rel="up">Top</a> [<a href="Function-and-Variable-Index.html#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="Function-and-Variable-Index.html" title="Index" rel="index">Index</a>]</p> |
| 45 |
</div> |
| 46 |
<hr> |
| 47 |
<span id="User-Interface-1"></span><h2 class="chapter">12 User Interface</h2> |
| 48 |
|
| 49 |
<dl> |
| 50 |
<dt id="index-_002d-1">Special Variable: <strong>-</strong></dt> |
| 51 |
<dd><p>Package:LISP |
| 52 |
Holds the top-level form that GCL is currently evaluating. |
| 53 |
</p> |
| 54 |
|
| 55 |
</dd></dl> |
| 56 |
|
| 57 |
<dl> |
| 58 |
<dt id="index-_002d">Function: <strong>-</strong> <em>(number &rest more-numbers)</em></dt> |
| 59 |
<dd><p>Package:LISP |
| 60 |
</p> |
| 61 |
<p>Subtracts the second and all subsequent NUMBERs from the first NUMBER. |
| 62 |
With one arg, negates it. |
| 63 |
</p> |
| 64 |
|
| 65 |
</dd></dl> |
| 66 |
|
| 67 |
<dl> |
| 68 |
<dt id="index-UNTRACE">Macro: <strong>UNTRACE</strong></dt> |
| 69 |
<dd><p>Package:LISP |
| 70 |
</p> |
| 71 |
<p>Syntax: |
| 72 |
</p><div class="example"> |
| 73 |
<pre class="example">(untrace {function-name}*) |
| 74 |
</pre></div> |
| 75 |
|
| 76 |
<p>Removes tracing from the specified functions. With no FUNCTION-NAMEs, |
| 77 |
untraces all functions. |
| 78 |
</p> |
| 79 |
|
| 80 |
</dd></dl> |
| 81 |
|
| 82 |
<dl> |
| 83 |
<dt id="index-_002a_002a_002a">Variable: <strong>***</strong></dt> |
| 84 |
<dd><p>Package:LISP |
| 85 |
Gets the previous value of ** when GCL evaluates a top-level form. |
| 86 |
</p> |
| 87 |
|
| 88 |
</dd></dl> |
| 89 |
|
| 90 |
<dl> |
| 91 |
<dt id="index-MAKE_002dSTRING_002dINPUT_002dSTREAM-1">Function: <strong>MAKE-STRING-INPUT-STREAM</strong> <em>(string &optional (start 0) (end (length string)))</em></dt> |
| 92 |
<dd><p>Package:LISP |
| 93 |
</p> |
| 94 |
<p>Returns an input stream which will supply the characters of String between |
| 95 |
Start and End in order. |
| 96 |
</p> |
| 97 |
|
| 98 |
</dd></dl> |
| 99 |
|
| 100 |
<dl> |
| 101 |
<dt id="index-STEP">Macro: <strong>STEP</strong></dt> |
| 102 |
<dd><p>Package:LISP |
| 103 |
</p> |
| 104 |
<p>Syntax: |
| 105 |
</p><div class="example"> |
| 106 |
<pre class="example">(step form) |
| 107 |
</pre></div> |
| 108 |
|
| 109 |
<p>Evaluates FORM in the single-step mode and returns the value. |
| 110 |
</p> |
| 111 |
|
| 112 |
</dd></dl> |
| 113 |
|
| 114 |
<dl> |
| 115 |
<dt id="index-_002aBREAK_002dENABLE_002a">Variable: <strong>*BREAK-ENABLE*</strong></dt> |
| 116 |
<dd><p>Package:LISP |
| 117 |
GCL specific: When an error occurrs, control enters to the break loop only |
| 118 |
if the value of this variable is non-NIL. |
| 119 |
</p> |
| 120 |
|
| 121 |
</dd></dl> |
| 122 |
|
| 123 |
<dl> |
| 124 |
<dt id="index-_002f-1">Special Variable: <strong>/</strong></dt> |
| 125 |
<dd><p>Package:LISP |
| 126 |
Holds a list of the values of the last top-level form. |
| 127 |
</p> |
| 128 |
|
| 129 |
</dd></dl> |
| 130 |
|
| 131 |
<dl> |
| 132 |
<dt id="index-DESCRIBE">Function: <strong>DESCRIBE</strong> <em>(x)</em></dt> |
| 133 |
<dd><p>Package:LISP |
| 134 |
</p> |
| 135 |
<p>Prints a description of the object X. |
| 136 |
</p> |
| 137 |
|
| 138 |
</dd></dl> |
| 139 |
|
| 140 |
<dl> |
| 141 |
<dt id="index-ED">Function: <strong>ED</strong> <em>(&optional x)</em></dt> |
| 142 |
<dd><p>Package:LISP |
| 143 |
</p> |
| 144 |
<p>Invokes the editor. The action depends on the version of GCL. |
| 145 |
</p> |
| 146 |
|
| 147 |
</dd></dl> |
| 148 |
|
| 149 |
<dl> |
| 150 |
<dt id="index-_002aDEBUG_002dIO_002a">Variable: <strong>*DEBUG-IO*</strong></dt> |
| 151 |
<dd><p>Package:LISP |
| 152 |
Holds the I/O stream used by the GCL debugger. |
| 153 |
</p> |
| 154 |
|
| 155 |
</dd></dl> |
| 156 |
|
| 157 |
<dl> |
| 158 |
<dt id="index-_002aBREAK_002dON_002dWARNINGS_002a">Variable: <strong>*BREAK-ON-WARNINGS*</strong></dt> |
| 159 |
<dd><p>Package:LISP |
| 160 |
When the function WARN is called, control enters to the break loop only |
| 161 |
if the value of this varialbe is non-NIL. |
| 162 |
</p> |
| 163 |
|
| 164 |
</dd></dl> |
| 165 |
|
| 166 |
<dl> |
| 167 |
<dt id="index-CERROR">Function: <strong>CERROR</strong> <em>(continue-format-string error-format-string &rest args)</em></dt> |
| 168 |
<dd><p>Package:LISP |
| 169 |
</p> |
| 170 |
<p>Signals a correctable error. |
| 171 |
</p> |
| 172 |
|
| 173 |
</dd></dl> |
| 174 |
|
| 175 |
<dl> |
| 176 |
<dt id="index-_002a_002a">Variable: <strong>**</strong></dt> |
| 177 |
<dd><p>Package:LISP |
| 178 |
Gets the previous value of * when GCL evaluates a top-level form. |
| 179 |
</p> |
| 180 |
|
| 181 |
</dd></dl> |
| 182 |
|
| 183 |
<dl> |
| 184 |
<dt id="index-_002b_002b_002b">Special Variable: <strong>+++</strong></dt> |
| 185 |
<dd><p>Package:LISP |
| 186 |
Gets the previous value of ++ when GCL evaluates a top-level form. |
| 187 |
</p> |
| 188 |
|
| 189 |
</dd></dl> |
| 190 |
|
| 191 |
<dl> |
| 192 |
<dt id="index-INSPECT">Function: <strong>INSPECT</strong> <em>(x)</em></dt> |
| 193 |
<dd><p>Package:LISP |
| 194 |
</p> |
| 195 |
<p>Shows the information about the object X in an interactive manner |
| 196 |
</p> |
| 197 |
|
| 198 |
</dd></dl> |
| 199 |
|
| 200 |
<dl> |
| 201 |
<dt id="index-_002f_002f">Special Variable: <strong>//</strong></dt> |
| 202 |
<dd><p>Package:LISP |
| 203 |
Gets the previous value of / when GCL evaluates a top-level form. |
| 204 |
</p> |
| 205 |
|
| 206 |
</dd></dl> |
| 207 |
|
| 208 |
<dl> |
| 209 |
<dt id="index-_002aTRACE_002dOUTPUT_002a">Variable: <strong>*TRACE-OUTPUT*</strong></dt> |
| 210 |
<dd><p>Package:LISP |
| 211 |
The trace output stream. |
| 212 |
</p> |
| 213 |
|
| 214 |
</dd></dl> |
| 215 |
|
| 216 |
<dl> |
| 217 |
<dt id="index-_002b_002b">Special Variable: <strong>++</strong></dt> |
| 218 |
<dd><p>Package:LISP |
| 219 |
Gets the previous value of + when GCL evaluates a top-level form. |
| 220 |
</p> |
| 221 |
|
| 222 |
</dd></dl> |
| 223 |
|
| 224 |
<dl> |
| 225 |
<dt id="index-_002aERROR_002dOUTPUT_002a">Variable: <strong>*ERROR-OUTPUT*</strong></dt> |
| 226 |
<dd><p>Package:LISP |
| 227 |
Holds the output stream for error messages. |
| 228 |
</p> |
| 229 |
|
| 230 |
</dd></dl> |
| 231 |
|
| 232 |
<dl> |
| 233 |
<dt id="index-DRIBBLE">Function: <strong>DRIBBLE</strong> <em>(&optional pathname)</em></dt> |
| 234 |
<dd><p>Package:LISP |
| 235 |
</p> |
| 236 |
<p>If PATHNAME is given, begins to record the interaction to the specified file. |
| 237 |
If PATHNAME is not given, ends the recording. |
| 238 |
</p> |
| 239 |
|
| 240 |
</dd></dl> |
| 241 |
|
| 242 |
<dl> |
| 243 |
<dt id="index-_002a-1">Variable: <strong>*</strong></dt> |
| 244 |
<dd><p>Package:LISP |
| 245 |
Holds the value of the last top-level form. |
| 246 |
</p> |
| 247 |
|
| 248 |
</dd></dl> |
| 249 |
|
| 250 |
<dl> |
| 251 |
<dt id="index-_002f_002f_002f">Special Variable: <strong>///</strong></dt> |
| 252 |
<dd><p>Package:LISP |
| 253 |
Gets the previous value of // when GCL evaluates a top-level form. |
| 254 |
</p> |
| 255 |
|
| 256 |
</dd></dl> |
| 257 |
|
| 258 |
<dl> |
| 259 |
<dt id="index-WARN">Function: <strong>WARN</strong> <em>(format-string &rest args)</em></dt> |
| 260 |
<dd><p>Package:LISP |
| 261 |
</p> |
| 262 |
<p>Formats FORMAT-STRING and ARGs to *ERROR-OUTPUT* as a warning message. |
| 263 |
</p> |
| 264 |
|
| 265 |
</dd></dl> |
| 266 |
|
| 267 |
<dl> |
| 268 |
<dt id="index-BREAK">Function: <strong>BREAK</strong> <em>(&optional (format-string nil) &rest args)</em></dt> |
| 269 |
<dd><p>Package:LISP |
| 270 |
</p> |
| 271 |
<p>Enters a break loop. If FORMAT-STRING is non-NIL, formats FORMAT-STRING |
| 272 |
and ARGS to *ERROR-OUTPUT* before entering a break loop. |
| 273 |
Typing :HELP at the break loop will list the break-loop commands. |
| 274 |
</p> |
| 275 |
|
| 276 |
</dd></dl> |
| 277 |
|
| 278 |
<dl> |
| 279 |
<dt id="index-_002b-1">Special Variable: <strong>+</strong></dt> |
| 280 |
<dd><p>Package:LISP |
| 281 |
Holds the last top-level form. |
| 282 |
</p> |
| 283 |
|
| 284 |
</dd></dl> |
| 285 |
|
| 286 |
<dl> |
| 287 |
<dt id="index-TRACE">Macro: <strong>TRACE</strong></dt> |
| 288 |
<dd><p>Package:LISP |
| 289 |
</p> |
| 290 |
<p>Syntax: |
| 291 |
</p><div class="example"> |
| 292 |
<pre class="example">(trace {function-name}*) |
| 293 |
</pre></div> |
| 294 |
|
| 295 |
<p>Traces the specified functions. With no FUNCTION-NAMEs, returns a list of |
| 296 |
functions currently being traced. |
| 297 |
</p> |
| 298 |
<p>Additional Keywords are allowed in GCL with the |
| 299 |
syntax (trace {fn | (fn {:kw form}*)}*) |
| 300 |
</p> |
| 301 |
<p>For each FN naming a function, traces that function. Each :KW should |
| 302 |
be one of the ones listed below, and FORM should have the |
| 303 |
corresponding form. No :KW may be given more than once for the same |
| 304 |
FN. Returns a list of all FNs now traced which weren’t already |
| 305 |
traced. |
| 306 |
</p> |
| 307 |
|
| 308 |
<p>EXAMPLE (Try this with your favorite factorial function FACT): |
| 309 |
</p> |
| 310 |
<div class="example"> |
| 311 |
<pre class="example">;; print entry args and exit values |
| 312 |
|
| 313 |
(trace FACT) |
| 314 |
|
| 315 |
;; Break coming out of FACT if the value is bigger than 1000. |
| 316 |
|
| 317 |
(trace (fact :exit |
| 318 |
(progn |
| 319 |
(if (> (car values) 1000)(break "big result")) |
| 320 |
(car values)))) |
| 321 |
|
| 322 |
;; Hairy example: |
| 323 |
|
| 324 |
;;make arglist available without the si:: prefix |
| 325 |
(import 'si::arglist) |
| 326 |
|
| 327 |
(trace (fact |
| 328 |
:DECLARATIONS |
| 329 |
((in-string "Here comes input: ") |
| 330 |
(out-string "Here comes output: ") |
| 331 |
all-values |
| 332 |
(silly (+ 3 4))) |
| 333 |
:COND |
| 334 |
(equal (rem (car arglist) 2) 0) |
| 335 |
:ENTRY |
| 336 |
(progn |
| 337 |
(cond |
| 338 |
((equal (car arglist) 8) |
| 339 |
(princ "Entering FACT on input 8!! ") |
| 340 |
(setq out-string "Here comes output from inside (FACT 8): ")) |
| 341 |
(t |
| 342 |
(princ in-string))) |
| 343 |
(car arglist)) |
| 344 |
:EXIT |
| 345 |
(progn |
| 346 |
(setq all-values (cons (car values) all-values)) |
| 347 |
(princ out-string) |
| 348 |
(when (equal (car arglist) 8) |
| 349 |
;; reset out-string |
| 350 |
(setq out-string "Here comes output: ")) |
| 351 |
(cons 'fact values)) |
| 352 |
:ENTRYCOND |
| 353 |
(not (= (car arglist) 6)) |
| 354 |
:EXITCOND |
| 355 |
(not (= (car values) (* 6 (car arglist)))) |
| 356 |
:DEPTH |
| 357 |
5)) |
| 358 |
</pre></div> |
| 359 |
|
| 360 |
<p>Syntax is <code>:keyword</code> <i>form1</i> <code>:keyword</code> <i>form2</i> ... |
| 361 |
</p> |
| 362 |
<dl compact="compact"> |
| 363 |
<dt><code>:declarations</code></dt> |
| 364 |
<dd><div class="example"> |
| 365 |
<pre class="example">DEFAULT: NIL |
| 366 |
</pre></div> |
| 367 |
|
| 368 |
<p>FORM is ((var1 form1 )(var2 form2 )...), where |
| 369 |
the var_i are symbols distinct from each other and from |
| 370 |
all symbols which are similarly declared for currently |
| 371 |
traced functions. Each form is evaluated immediately. |
| 372 |
Upon any invocation of a traced function when not already |
| 373 |
inside a traced function call, each var is bound to |
| 374 |
that value of form . |
| 375 |
</p> |
| 376 |
</dd> |
| 377 |
<dt><code>:COND</code></dt> |
| 378 |
<dd><div class="example"> |
| 379 |
<pre class="example">DEFAULT: T |
| 380 |
</pre></div> |
| 381 |
|
| 382 |
<p>Here, FORM is any Lisp form to be evaluated (by EVAL) |
| 383 |
upon entering a call of FN, in the environment where si::ARGLIST |
| 384 |
is bound to the current list of arguments of FN. Note that |
| 385 |
even if the evaluation of FORM changes the value of SI::ARGLIST |
| 386 |
(e.g. by evaluation of (SETQ si::ARGLIST ...)), the list of |
| 387 |
arguments passed to FN is unchanged. Users may alter args passed |
| 388 |
by destructively modifying the list structure of SI::ARGLIST |
| 389 |
however. The call is traced |
| 390 |
(thus invoking the :ENTRYCOND and :EXITCOND forms, at least) |
| 391 |
if and only if FORM does not evaluate to NIL. |
| 392 |
</p> |
| 393 |
</dd> |
| 394 |
<dt><code>:ENTRYCOND</code></dt> |
| 395 |
<dd><div class="example"> |
| 396 |
<pre class="example">DEFAULT: T |
| 397 |
</pre></div> |
| 398 |
|
| 399 |
<p>This is evaluated (by EVAL) if the :COND form evaluates to |
| 400 |
non-NIL, both in an environment where SI::ARGLIST is bound to the |
| 401 |
current list of arguments of FN. If non-NIL, the :ENTRY form |
| 402 |
is then evaluated and printed with the trace "prompt". |
| 403 |
</p> |
| 404 |
</dd> |
| 405 |
<dt><code>:ENTRY</code></dt> |
| 406 |
<dd><div class="example"> |
| 407 |
<pre class="example">DEFAULT: (CONS (QUOTE x) SI::ARGLIST), |
| 408 |
</pre></div> |
| 409 |
|
| 410 |
<p>where x is the symbol we call FN |
| 411 |
If the :COND and :ENTRYCOND forms evaluate to non-NIL, |
| 412 |
then the trace "prompt" is printed and then this FORM is |
| 413 |
evaluated (by EVAL) in an environment where SI::ARGLIST is bound |
| 414 |
to the current list of arguments of FN. The result is then |
| 415 |
printed. |
| 416 |
</p> |
| 417 |
</dd> |
| 418 |
<dt><code>:EXITCOND</code></dt> |
| 419 |
<dd><div class="example"> |
| 420 |
<pre class="example">DEFAULT: T |
| 421 |
</pre></div> |
| 422 |
|
| 423 |
<p>This is evaluated (by EVAL) in the environment described |
| 424 |
below for the :EXIT form. The :EXIT form is then evaluated |
| 425 |
and printed with the "prompt" if and only if the result here |
| 426 |
is non-NIL. |
| 427 |
</p> |
| 428 |
</dd> |
| 429 |
<dt><code>:EXIT</code></dt> |
| 430 |
<dd><div class="example"> |
| 431 |
<pre class="example">DEFAULT: (CONS (QUOTE x) VALUES), |
| 432 |
</pre></div> |
| 433 |
|
| 434 |
<p>where x is the symbol we call FN |
| 435 |
Upon exit from tracing a given call, this FORM is |
| 436 |
evaluated (after the appropriate trace "prompt" is printed), |
| 437 |
using EVAL in an environment where SI::ARGLIST is bound to the |
| 438 |
current list of arguments of FN and VALUES is bound to the |
| 439 |
list of values returned by FN (recalling that Common Lisp |
| 440 |
functions may return multiple values). |
| 441 |
</p> |
| 442 |
</dd> |
| 443 |
<dt><code>:DEPTH</code></dt> |
| 444 |
<dd><div class="example"> |
| 445 |
<pre class="example">DEFAULT: No depth limit |
| 446 |
</pre></div> |
| 447 |
|
| 448 |
<p>FORM is simply a positive integer specifying the maximum |
| 449 |
nesting of traced calls of FN, i.e. of calls of FN in which |
| 450 |
the :COND form evaluated to non-NIL. For calls of FN in |
| 451 |
which this limit is exceeded, even the :COND form is not |
| 452 |
evaluated, and the call is not traced. |
| 453 |
</p> |
| 454 |
</dd> |
| 455 |
</dl> |
| 456 |
|
| 457 |
</dd></dl> |
| 458 |
|
| 459 |
|
| 460 |
|
| 461 |
|
| 462 |
|
| 463 |
|
| 464 |
<hr> |
| 465 |
<div class="header"> |
| 466 |
<p> |
| 467 |
Next: <a href="Doc.html" accesskey="n" rel="next">Doc</a>, Previous: <a href="Iteration-and-Tests.html" accesskey="p" rel="prev">Iteration and Tests</a>, Up: <a href="index.html" accesskey="u" rel="up">Top</a> [<a href="Function-and-Variable-Index.html#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="Function-and-Variable-Index.html" title="Index" rel="index">Index</a>]</p> |
| 468 |
</div> |
| 469 |
|
| 470 |
|
| 471 |
|
| 472 |
</body> |
| 473 |
</html> |