~ubuntu-branches/ubuntu/vivid/gcl/vivid

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
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
@node User Interface, Doc, Iteration and Tests, Top
@chapter User Interface

@defvr {Special Variable} - 
Package:LISP
Holds the top-level form that GCL is currently evaluating.


@end defvr

@defun - (number &rest more-numbers)
Package:LISP

Subtracts the second and all subsequent NUMBERs from the first NUMBER.
With one arg, negates it.


@end defun

@deffn {Macro} UNTRACE 
Package:LISP

Syntax:
@example
(untrace @{function-name@}*)
@end example

Removes tracing from the specified functions.  With no FUNCTION-NAMEs,
untraces all functions.


@end deffn

@defvar *** 
Package:LISP
Gets the previous value of ** when GCL evaluates a top-level form.


@end defvar

@defun MAKE-STRING-INPUT-STREAM (string &optional (start 0) (end (length string)))
Package:LISP

Returns an input stream which will supply the characters of String between
Start and End in order.


@end defun

@deffn {Macro} STEP 
Package:LISP

Syntax:
@example
(step form)
@end example

Evaluates FORM in the single-step mode and returns the value.


@end deffn

@defvar *BREAK-ENABLE* 
Package:LISP
GCL specific:  When an error occurrs, control enters to the break loop only
if the value of this variable is non-NIL.


@end defvar

@defvr {Special Variable} / 
Package:LISP
Holds a list of the values of the last top-level form.


@end defvr

@defun DESCRIBE (x)
Package:LISP

Prints a description of the object X.


@end defun

@defun ED (&optional x)
Package:LISP

Invokes the editor.  The action depends on the version of GCL.  


@end defun

@defvar *DEBUG-IO* 
Package:LISP
Holds the I/O stream used by the GCL debugger.


@end defvar

@defvar *BREAK-ON-WARNINGS* 
Package:LISP
When the function WARN is called, control enters to the break loop only
if the value of this varialbe is non-NIL.


@end defvar

@defun CERROR (continue-format-string error-format-string &rest args)
Package:LISP

Signals a correctable error.


@end defun

@defvar ** 
Package:LISP
Gets the previous value of * when GCL evaluates a top-level form.


@end defvar

@defvr {Special Variable} +++ 
Package:LISP
Gets the previous value of ++ when GCL evaluates a top-level form.


@end defvr

@defun INSPECT (x)
Package:LISP

Shows the information about the object X in an interactive manner


@end defun

@defvr {Special Variable} // 
Package:LISP
Gets the previous value of / when GCL evaluates a top-level form.


@end defvr

@defvar *TRACE-OUTPUT* 
Package:LISP
The trace output stream.


@end defvar

@defvr {Special Variable} ++ 
Package:LISP
Gets the previous value of + when GCL evaluates a top-level form.


@end defvr

@defvar *ERROR-OUTPUT* 
Package:LISP
Holds the output stream for error messages.


@end defvar

@defun DRIBBLE (&optional pathname)
Package:LISP

If PATHNAME is given, begins to record the interaction to the specified file.
If PATHNAME is not given, ends the recording.


@end defun

@defvar * 
Package:LISP
Holds the value of the last top-level form.


@end defvar

@defvr {Special Variable} /// 
Package:LISP
Gets the previous value of // when GCL evaluates a top-level form.


@end defvr

@defun WARN (format-string &rest args)
Package:LISP

Formats FORMAT-STRING and ARGs to *ERROR-OUTPUT* as a warning message.


@end defun

@defun BREAK (&optional (format-string nil) &rest args)
Package:LISP

Enters a break loop.  If FORMAT-STRING is non-NIL, formats FORMAT-STRING
and ARGS to *ERROR-OUTPUT* before entering a break loop.
Typing :HELP at the break loop will list the break-loop commands.


@end defun

@defvr {Special Variable} + 
Package:LISP
Holds the last top-level form.


@end defvr

@deffn {Macro} TRACE 
Package:LISP

Syntax:
@example
(trace @{function-name@}*)
@end example

Traces the specified functions.  With no FUNCTION-NAMEs, returns a list of
functions currently being traced.

Additional Keywords are allowed in GCL with the
syntax (trace @{fn | (fn @{:kw form@}*)@}*)

For each FN naming a function, traces that function.  Each :KW should
be one of the ones listed below, and FORM should have the
corresponding form.  No :KW may be given more than once for the same
FN.  Returns a list of all FNs now traced which weren't already
traced.


EXAMPLE (Try this with your favorite factorial function FACT):

@example
;; print entry args and exit values

(trace FACT)

;; Break coming out of FACT if the value is bigger than 1000.

(trace (fact :exit
	     (progn
	       (if (> (car values) 1000)(break "big result"))
	       (car values))))

;; Hairy example:

;;make arglist available without the si:: prefix
(import 'si::arglist)

(trace (fact
        :DECLARATIONS
        ((in-string "Here comes input: ")
         (out-string "Here comes output: ")
         all-values
         (silly (+ 3 4)))
        :COND
        (equal (rem (car arglist) 2) 0)
        :ENTRY
        (progn
          (cond
           ((equal (car arglist) 8)
            (princ "Entering FACT on input 8!! ")
            (setq out-string "Here comes output from inside (FACT 8): "))
           (t
            (princ in-string)))
          (car arglist))
        :EXIT
        (progn
          (setq all-values (cons (car values) all-values))
          (princ out-string)
          (when (equal (car arglist) 8)
                ;; reset out-string
                (setq out-string "Here comes output: "))
          (cons 'fact values))
        :ENTRYCOND
        (not (= (car arglist) 6))
        :EXITCOND
        (not (= (car values) (* 6 (car arglist))))
        :DEPTH
        5))
@end example

Syntax is @code{:keyword} @i{form1} @code{:keyword} @i{form2} ...

@table @code
@item :declarations
@example
DEFAULT: NIL
@end example

FORM is ((var1  form1 )(var2  form2 )...), where
the var_i  are symbols distinct from each other and from
all symbols which are similarly declared for currently
traced functions.  Each form  is evaluated immediately.
Upon any invocation of a traced function when not already
inside a traced function call, each var  is bound to
that value of form .

@item :COND
@example
DEFAULT: T
@end example

Here, FORM is any Lisp form to be evaluated (by EVAL)
upon entering a call of FN, in the environment where si::ARGLIST
is bound to the current list of arguments of FN.  Note that
even if the evaluation of FORM changes the value of SI::ARGLIST
(e.g. by evaluation of (SETQ si::ARGLIST ...)), the list of
arguments passed to FN is unchanged.  Users may alter args passed
by destructively modifying the list structure of SI::ARGLIST
however. The call is traced 
(thus invoking the :ENTRYCOND and :EXITCOND forms, at least)
if and only if FORM does not evaluate to NIL.

@item :ENTRYCOND
@example
DEFAULT: T
@end example

This is evaluated (by EVAL) if the :COND form evaluates to
non-NIL, both in an environment where SI::ARGLIST is bound to the
current list of arguments of FN.  If non-NIL, the :ENTRY form
is then evaluated and printed with the trace "prompt".

@item :ENTRY
@example
DEFAULT: (CONS (QUOTE x) SI::ARGLIST),
@end example

where x is the symbol we call FN
If the :COND and :ENTRYCOND forms evaluate to non-NIL,
then the trace "prompt" is printed and then this FORM is
evaluated (by EVAL) in an environment where SI::ARGLIST is bound
to the current list of arguments of FN.  The result is then
printed.

@item :EXITCOND
@example
DEFAULT: T
@end example

This is evaluated (by EVAL) in the environment described
below for the :EXIT form.  The :EXIT form is then evaluated
and printed with the "prompt" if and only if the result here
is non-NIL.

@item :EXIT
@example
DEFAULT: (CONS (QUOTE x) VALUES),
@end example

where x is the symbol we call FN
Upon exit from tracing a given call, this FORM is
evaluated (after the appropriate trace "prompt" is printed),
using EVAL in an environment where SI::ARGLIST is bound to the
current list of arguments of FN and VALUES is bound to the
list of values returned by FN (recalling that Common Lisp
functions may return multiple values).

@item :DEPTH
@example
DEFAULT:  No depth limit
@end example

FORM is simply a positive integer specifying the maximum
nesting of traced calls of FN, i.e. of calls of FN in which
the :COND form evaluated to non-NIL.  For calls of FN in
which this limit is exceeded, even the :COND form is not
evaluated, and the call is not traced.

@end table

@end deffn