/[slime]/slime/swank-backend.lisp
ViewVC logotype

Contents of /slime/swank-backend.lisp

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.30 - (hide annotations)
Mon Feb 16 21:39:39 2004 UTC (10 years, 2 months ago) by heller
Branch: MAIN
Changes since 1.29: +24 -1 lines
(compile-system-for-emacs): Add default implementation.

(compiler-condition): New slot short-message.
1 lgorrie 1.1 ;;;; -*- Mode: lisp; indent-tabs-mode: nil; outline-regexp: ";;;;;*" -*-
2     ;;;
3 lgorrie 1.13 ;;; slime-backend.lisp --- SLIME backend interface.
4 lgorrie 1.1 ;;;
5 lgorrie 1.13 ;;; Created by James Bielman in 2003. Released into the public domain.
6 lgorrie 1.1 ;;;
7 lgorrie 1.13 ;;; This file defines the functions that must be implemented
8     ;;; separately for each Lisp. Each is declared as a generic function
9     ;;; for which swank-<implementation>.lisp provides methods.
10 lgorrie 1.1
11     (defpackage :swank
12     (:use :common-lisp)
13 lgorrie 1.3 (:nicknames #:swank-backend)
14 lgorrie 1.9 (:export #:*sldb-pprint-frames*
15     #:apropos-list-for-emacs
16     #:arglist-string
17     #:backtrace
18     #:call-with-I/O-lock
19     #:call-with-conversation-lock
20 heller 1.5 #:compiler-notes-for-emacs
21 lgorrie 1.9 #:completions
22 lgorrie 1.13 #:create-server
23 lgorrie 1.9 #:create-swank-server
24 lgorrie 1.21 #:describe-definition
25 lgorrie 1.9 #:describe-symbol
26 lgorrie 1.21 #:describe-symbol-for-emacs
27 heller 1.30 #:describe-function
28 lgorrie 1.9 #:disassemble-symbol
29 heller 1.5 #:documentation-symbol
30 lgorrie 1.9 #:eval-in-frame
31 heller 1.22 #:return-from-frame
32     #:restart-frame
33 lgorrie 1.9 #:eval-string
34     #:eval-string-in-frame
35 heller 1.30 #:oneway-eval-string
36 heller 1.7 #:find-function-locations
37 heller 1.5 #:frame-catch-tags
38 lgorrie 1.9 #:frame-locals
39     #:frame-source-location-for-emacs
40 heller 1.5 #:frame-source-position
41 lgorrie 1.9 #:getpid
42     #:give-goahead
43     #:give-gohead
44     #:init-inspector
45     #:inspect-in-frame
46     #:inspect-nth-part
47     #:inspector-next
48 heller 1.5 #:inspector-pop
49 heller 1.30 #:describe-inspectee
50 lgorrie 1.9 #:interactive-eval
51     #:interactive-eval-region
52 heller 1.5 #:invoke-nth-restart
53 lgorrie 1.10 #:invoke-nth-restart-for-emacs
54 lgorrie 1.9 #:list-all-package-names
55     #:list-callees
56     #:list-callers
57     #:listener-eval
58     #:load-file
59     #:pprint-eval
60 heller 1.5 #:pprint-eval-string-in-frame
61 lgorrie 1.9 #:quit-inspector
62     #:re-evaluate-defvar
63     #:set-default-directory
64     #:set-package
65 heller 1.5 #:sldb-abort
66 lgorrie 1.10 #:sldb-break-with-default-debugger
67 heller 1.5 #:sldb-continue
68 heller 1.30 #:sldb-disassemble
69     #:sldb-step
70 lgorrie 1.9 #:slime-debugger-function
71 heller 1.27 #:debugger-info-for-emacs
72 lgorrie 1.9 #:start-server
73     #:startup-multiprocessing
74     #:swank-compile-file
75     #:swank-compile-string
76 heller 1.30 #:swank-load-system
77 lgorrie 1.9 #:swank-macroexpand
78     #:swank-macroexpand-1
79     #:swank-macroexpand-all
80 heller 1.5 #:take-input
81 lgorrie 1.9 #:thread-id
82     #:thread-name
83     #:throw-to-toplevel
84     #:toggle-trace-fdefinition
85     #:untrace-all
86 heller 1.23 #:profile
87     #:unprofile
88     #:unprofile-all
89     #:profiled-functions
90     #:profile-report
91     #:profile-reset
92     #:profile-package
93 heller 1.30 #:toggle-profile-fdefinition
94 lgorrie 1.9 #:wait-goahead
95 lgorrie 1.21 #:warn-unimplemented-interfaces
96 lgorrie 1.9 #:who-binds
97     #:who-calls
98     #:who-macroexpands
99     #:who-references
100     #:who-sets
101 heller 1.30 #:who-specializes
102     #:list-threads
103     #:quit-thread-browser
104     #:ed-in-emacs
105 heller 1.5 ))
106 lgorrie 1.1
107     (in-package :swank)
108    
109    
110 lgorrie 1.21 ;;;; Metacode
111    
112     (defparameter *interface-functions* '()
113     "The names of all interface functions.")
114    
115     (defparameter *unimplemented-interfaces* '()
116     "List of interface functions that are not implemented.
117     DEFINTERFACE adds to this list and DEFIMPLEMENTATION removes.")
118    
119     (defmacro definterface (name args documentation &body default-body)
120     "Define an interface function for the backend to implement.
121     A generic function is defined with NAME, ARGS, and DOCUMENTATION.
122    
123     If a DEFAULT-BODY is supplied then NO-APPLICABLE-METHOD is specialized
124     to execute the body if the backend doesn't provide a specific
125     implementation.
126    
127     Backends implement these functions using DEFIMPLEMENTATION."
128     (flet ((gen-default-impl ()
129     (let ((received-args (gensym "ARGS-")))
130     `(defmethod no-applicable-method ((#:method
131     (eql (function ,name)))
132     &rest ,received-args)
133     (destructuring-bind ,args ,received-args
134     ,@default-body)))))
135 heller 1.25 `(progn (defgeneric ,name ,args (:documentation ,documentation))
136 lgorrie 1.21 (pushnew ',name *interface-functions*)
137     ,(if (null default-body)
138     `(pushnew ',name *unimplemented-interfaces*)
139 heller 1.25 (gen-default-impl))
140     ',name)))
141 lgorrie 1.21
142     (defmacro defimplementation (name args &body body)
143     ;; Is this a macro no-no -- should it be pushed out of macroexpansion?
144 heller 1.25 `(progn (defmethod ,name ,args ,@body)
145     (if (member ',name *interface-functions*)
146     (setq *unimplemented-interfaces*
147     (remove ',name *unimplemented-interfaces*))
148     (warn "DEFIMPLEMENTATION of undefined interface (~S)" ',name))
149     ',name))
150 lgorrie 1.21
151     (defun warn-unimplemented-interfaces ()
152     "Warn the user about unimplemented backend features.
153     The portable code calls this function at startup."
154     (warn "These Swank interfaces are unimplemented:~% ~A"
155     (sort (copy-list *unimplemented-interfaces*) #'string<)))
156    
157    
158 lgorrie 1.13 ;;;; TCP server
159    
160 heller 1.29 (definterface create-socket (host port)
161     "Create a listening TCP socket on interface HOST and port PORT .")
162 lgorrie 1.13
163 lgorrie 1.21 (definterface local-port (socket)
164     "Return the local port number of SOCKET.")
165 lgorrie 1.1
166 lgorrie 1.21 (definterface close-socket (socket)
167     "Close the socket SOCKET.")
168 lgorrie 1.1
169 lgorrie 1.21 (definterface accept-connection (socket)
170 heller 1.16 "Accept a client connection on the listening socket SOCKET. Return
171 lgorrie 1.21 a stream for the new connection.")
172 heller 1.16
173 lgorrie 1.21 (definterface add-input-handler (socket fn)
174     "Call FN whenever SOCKET is readable.")
175 heller 1.16
176 lgorrie 1.21 (definterface remove-input-handlers (socket)
177     "Remove all input handlers for SOCKET.")
178 heller 1.18
179 lgorrie 1.13 ;;; Base condition for networking errors.
180     (define-condition network-error (error) ())
181    
182 lgorrie 1.21 (definterface emacs-connected ()
183 lgorrie 1.13 "Hook called when the first connection from Emacs is established.
184     Called from the INIT-FN of the socket server that accepts the
185     connection.
186 lgorrie 1.1
187 lgorrie 1.13 This is intended for setting up extra context, e.g. to discover
188 lgorrie 1.21 that the calling thread is the one that interacts with Emacs."
189     nil)
190 lgorrie 1.1
191    
192 heller 1.20 ;;;; Unix signals
193    
194     (defconstant +sigint+ 2)
195    
196     (defgeneric call-without-interrupts (fn)
197     (:documentation "Call FN in a context where interrupts are disabled."))
198    
199     (defgeneric getpid ()
200     (:documentation "Return the (Unix) process ID of this superior Lisp."))
201    
202    
203 lgorrie 1.1 ;;;; Compilation
204 dbarlow 1.8
205 lgorrie 1.21 (definterface call-with-compilation-hooks (func)
206     "Call FUNC with hooks to trigger SLDB on compiler errors.")
207 lgorrie 1.13
208 vsedach 1.14 (defmacro with-compilation-hooks ((&rest ignore) &body body)
209     (declare (ignore ignore))
210 dbarlow 1.8 `(call-with-compilation-hooks (lambda () (progn ,@body))))
211 lgorrie 1.1
212 lgorrie 1.21 (definterface compile-string-for-emacs (string &key buffer position)
213 lgorrie 1.1 "Compile source from STRING. During compilation, compiler
214     conditions must be trapped and resignalled as COMPILER-CONDITIONs.
215    
216     If supplied, BUFFER and POSITION specify the source location in Emacs.
217    
218     Additionally, if POSITION is supplied, it must be added to source
219 lgorrie 1.21 positions reported in compiler conditions.")
220 lgorrie 1.1
221 mbaringer 1.26 (definterface compile-system-for-emacs (system-name)
222     "Compile and load SYSTEM-NAME, During compilation compiler
223     conditions must be trapped and resignalled as
224 heller 1.30 COMPILER-CONDITION ala compile-string-for-emacs."
225     (with-compilation-hooks ()
226     (cond ((member :asdf *features*)
227     (let ((operate (find-symbol (string :operate) :asdf))
228     (load-op (find-symbol (string :load-op) :asdf)))
229     (funcall operate load-op system-name)))
230     (t (error "ASDF not loaded")))))
231 mbaringer 1.26
232 lgorrie 1.21 (definterface compile-file-for-emacs (filename load-p)
233 lgorrie 1.1 "Compile FILENAME signalling COMPILE-CONDITIONs.
234 lgorrie 1.21 If LOAD-P is true, load the file after compilation.")
235 lgorrie 1.1
236 lgorrie 1.13 (deftype severity () '(member :error :warning :style-warning :note))
237    
238     ;; Base condition type for compiler errors, warnings and notes.
239     (define-condition compiler-condition (condition)
240     ((original-condition
241     ;; The original condition thrown by the compiler if appropriate.
242     ;; May be NIL if a compiler does not report using conditions.
243     :type (or null condition)
244     :initarg :original-condition
245     :accessor original-condition)
246    
247     (severity :type severity
248     :initarg :severity
249     :accessor severity)
250    
251     (message :initarg :message
252     :accessor message)
253    
254 heller 1.30 (short-message :initarg :short-message
255     :initform nil
256     :accessor short-message)
257    
258 lgorrie 1.13 (location :initarg :location
259     :accessor location)))
260 heller 1.30
261    
262 lgorrie 1.13
263 lgorrie 1.17
264 lgorrie 1.13 ;;;; Streams
265    
266 lgorrie 1.21 (definterface make-fn-streams (input-fn output-fn)
267 lgorrie 1.13 "Return character input and output streams backended by functions.
268     When input is needed, INPUT-FN is called with no arguments to
269     return a string.
270     When output is ready, OUTPUT-FN is called with the output as its
271     argument.
272    
273     Output should be forced to OUTPUT-FN before calling INPUT-FN.
274    
275 lgorrie 1.21 The streams are returned as two values.")
276 lgorrie 1.13
277 lgorrie 1.1
278     ;;;; Documentation
279    
280 lgorrie 1.21 (definterface arglist-string (function-name)
281 lgorrie 1.1 "Return the argument for FUNCTION-NAME as a string.
282 lgorrie 1.21 The result should begin and end with parenthesis.")
283 lgorrie 1.1
284 lgorrie 1.21 (definterface macroexpand-all (form)
285 lgorrie 1.1 "Recursively expand all macros in FORM.
286 lgorrie 1.21 Return the resulting form.")
287 lgorrie 1.1
288 lgorrie 1.21 (definterface describe-symbol-for-emacs (symbol)
289 lgorrie 1.1 "Return a property list describing SYMBOL.
290    
291     The property list has an entry for each interesting aspect of the
292     symbol. The recognised keys are:
293    
294     :VARIABLE :FUNCTION :SETF :TYPE :CLASS :MACRO :COMPILER-MACRO
295     :ALIEN-TYPE :ALIEN-STRUCT :ALIEN-UNION :ALIEN-ENUM
296    
297     The value of each property is the corresponding documentation string,
298     or :NOT-DOCUMENTED. It is legal to include keys not listed here.
299    
300     Properties should be included if and only if they are applicable to
301     the symbol. For example, only (and all) fbound symbols should include
302     the :FUNCTION property.
303    
304     Example:
305     \(describe-symbol-for-emacs 'vector)
306     => (:CLASS :NOT-DOCUMENTED
307     :TYPE :NOT-DOCUMENTED
308 lgorrie 1.21 :FUNCTION \"Constructs a simple-vector from the given objects.\")")
309    
310     (definterface describe-definition (name type)
311     "Describe the definition NAME of TYPE.
312     TYPE can be any value returned by DESCRIBE-SYMBOL-FOR-EMACS.
313    
314     Return a documentation string, or NIL if none is available.")
315 lgorrie 1.2
316    
317     ;;;; Debugging
318    
319 lgorrie 1.21 (definterface call-with-debugging-environment (debugger-loop-fn)
320 lgorrie 1.2 "Call DEBUGGER-LOOP-FN in a suitable debugging environment.
321    
322     This function is called recursively at each debug level to invoke the
323     debugger loop. The purpose is to setup any necessary environment for
324     other debugger callbacks that will be called within the debugger loop.
325    
326     For example, this is a reasonable place to compute a backtrace, switch
327 lgorrie 1.21 to safe reader/printer settings, and so on.")
328 lgorrie 1.2
329     (define-condition sldb-condition (condition)
330     ((original-condition
331     :initarg :original-condition
332 heller 1.5 :accessor original-condition))
333 lgorrie 1.2 (:documentation
334     "Wrapper for conditions that should not be debugged.
335    
336     When a condition arises from the internals of the debugger, it is not
337     desirable to debug it -- we'd risk entering an endless loop trying to
338     debug the debugger! Instead, such conditions can be reported to the
339     user without (re)entering the debugger by wrapping them as
340     `sldb-condition's."))
341    
342 lgorrie 1.21 (definterface debugger-info-for-emacs (start end)
343 lgorrie 1.2 "Return debugger state, with stack frames from START to END.
344     The result is a list:
345 heller 1.12 (condition ({restart}*) ({stack-frame}*)
346 lgorrie 1.2 where
347 heller 1.12 condition ::= (description type)
348 lgorrie 1.2 restart ::= (name description)
349     stack-frame ::= (number description)
350    
351 heller 1.12 condition---a pair of strings: message, and type.
352 lgorrie 1.2
353     restart---a pair of strings: restart name, and description.
354    
355     stack-frame---a number from zero (the top), and a printed
356     representation of the frame's call.
357    
358     Below is an example return value. In this case the condition was a
359     division by zero (multi-line description), and only one frame is being
360     fetched (start=0, end=1).
361    
362 heller 1.12 ((\"Arithmetic error DIVISION-BY-ZERO signalled.
363     Operation was KERNEL::DIVISION, operands (1 0).\"
364     \"[Condition of type DIVISION-BY-ZERO]\")
365 lgorrie 1.2 ((\"ABORT\" \"Return to Slime toplevel.\")
366     (\"ABORT\" \"Return to Top-Level.\"))
367 lgorrie 1.21 ((0 \"(KERNEL::INTEGER-/-INTEGER 1 0)\")))")
368 lgorrie 1.1
369 lgorrie 1.21 (definterface backtrace (start end)
370 lgorrie 1.3 "Return a list containing a backtrace of the condition current
371     being debugged. The results are unspecified if this function is
372     called outside the dynamic contour of a debugger hook defined by
373     DEFINE-DEBUGGER-HOOK.
374    
375     START and END are zero-based indices constraining the number of
376     frames returned. Frame zero is defined as the frame which invoked
377     the debugger.
378    
379     The backtrace is returned as a list of tuples of the form
380     \(FRAME-NUMBER FRAME-DESCRIPTION), where FRAME-NUMBER is the
381     index of the frame, defined like START/END, and FRAME-DESCRIPTION
382     is a string containing text to display in the debugger for this
383     frame.
384    
385     An example return value:
386    
387     ((0 \"(HELLO \"world\")\")
388     (1 \"(RUN-EXCITING-LISP-DEMO)\")
389 lgorrie 1.21 (2 \"(SYS::%TOPLEVEL #<SYS::ENVIRONMENT #x394834>)\"))")
390 lgorrie 1.3
391 lgorrie 1.21 (definterface frame-source-location-for-emacs (frame-number)
392     "Return the source location for FRAME-NUMBER.")
393 lgorrie 1.3
394 lgorrie 1.21 (definterface frame-catch-tags (frame-number)
395 lgorrie 1.3 "Return a list of XXX list of what? catch tags for a debugger
396     stack frame. The results are undefined unless this is called
397     within the dynamic contour of a function defined by
398 lgorrie 1.21 DEFINE-DEBUGGER-HOOK.")
399 lgorrie 1.3
400 lgorrie 1.21 (definterface frame-locals (frame-number)
401 lgorrie 1.3 "Return a list of XXX local variable designators define me
402     for a debugger stack frame. The results are undefined unless
403     this is called within the dynamic contour of a function defined
404 lgorrie 1.21 by DEFINE-DEBUGGER-HOOK.")
405 lgorrie 1.3
406 lgorrie 1.21 (definterface eval-in-frame (form frame-number)
407 lgorrie 1.3 "Evaluate a Lisp form in the lexical context of a stack frame
408     in the debugger. The results are undefined unless called in the
409     dynamic contour of a function defined by DEFINE-DEBUGGER-HOOK.
410    
411     FRAME-NUMBER must be a positive integer with 0 indicating the
412     frame which invoked the debugger.
413    
414     The return value is the result of evaulating FORM in the
415 lgorrie 1.21 appropriate context.")
416 heller 1.22
417     (definterface return-from-frame (frame-number form)
418     "Unwind the stack to the frame FRAME-NUMBER and return the value(s)
419     produced by evaluating FORM in the frame context to its caller.
420    
421     Execute any clean-up code from unwind-protect forms above the frame
422     during unwinding.
423    
424     Return a string describing the error if it's not possible to return
425     from the frame.")
426    
427     (definterface restart-frame (frame-number)
428     "Restart execution of the frame FRAME-NUMBER with the same arguments
429     as it was called originally.")
430 lgorrie 1.3
431    
432 heller 1.23 ;;;; Profiling
433    
434     ;;; The following functions define a minimal profiling interface.
435    
436     (definterface profile (fname)
437     "Marks symbol FNAME for profiling.")
438    
439     (definterface profiled-functions ()
440     "Returns a list of profiled functions.")
441    
442     (definterface unprofile (fname)
443     "Marks symbol FNAME as not profiled.")
444    
445     (definterface unprofile-all ()
446     "Marks all currently profiled functions as not profiled."
447     (dolist (f (profiled-functions))
448     (unprofile f)))
449    
450     (definterface profile-report ()
451     "Prints profile report.")
452    
453     (definterface profile-reset ()
454     "Resets profile counters.")
455    
456     (definterface profile-package (package callers-p methods)
457     "Wrap profiling code around all functions in PACKAGE. If a function
458     is already profiled, then unprofile and reprofile (useful to notice
459     function redefinition.)
460    
461     If CALLERS-P is T names have counts of the most common calling
462     functions recorded.
463    
464     When called with arguments :METHODS T, profile all methods of all
465     generic functions having names in the given package. Generic functions
466     themselves, that is, their dispatch functions, are left alone.")
467    
468    
469 lgorrie 1.3 ;;;; Queries
470    
471 heller 1.7 #+(or)
472     ;;; This is probably a better interface than find-function-locations.
473 lgorrie 1.21 (definterface find-definitions (name)
474 heller 1.7 "Return a list of (LABEL . LOCATION) pairs for NAME's definitions.
475 lgorrie 1.3
476 heller 1.7 NAME is string denoting a symbol or \"definition specifier\".
477    
478     LABEL is a string describing the definition, e.g., \"foo\" or
479     \"(method foo (string number))\" or \"(variable bar)\".
480    
481     LOCATION is a source location of the form:
482    
483     <location> ::= (:location <buffer> <position>)
484     | (:error <message>)
485    
486     <buffer> ::= (:file <filename>)
487     | (:buffer <buffername>)
488     | (:source-form <string>)
489    
490     <position> ::= (:position <fixnum> [<align>]) ; 1 based
491     | (:function-name <string>)
492 lgorrie 1.21 ")
493 heller 1.7
494 lgorrie 1.21 (definterface find-function-locations (name)
495 heller 1.7 "Return a list (LOCATION LOCATION ...) for NAME's definitions.
496    
497     LOCATION is a source location of the form:
498    
499     <location> ::= (:location <buffer> <position>)
500     | (:error <message>)
501    
502     <buffer> ::= (:file <filename>)
503     | (:buffer <buffername>)
504     | (:source-form <string>)
505    
506     <position> ::= (:position <fixnum> [<align>]) ; 1 based
507 heller 1.12 | (:line <fixnum> [<fixnum>])
508     | (:function-name <string>)
509     | (:source-path <list> <start-position>)
510 lgorrie 1.21 ")
511 lgorrie 1.9
512    
513 heller 1.19 ;;;; Inspector
514    
515     (defgeneric inspected-parts (object)
516     (:documentation
517     "Return a short description and a list of (LABEL . VALUE) pairs."))
518    
519 heller 1.29 (definterface describe-primitive-type (object)
520     "Return a string describing the primitive type of object.")
521 heller 1.19
522    
523 lgorrie 1.9 ;;;; Multiprocessing
524 lgorrie 1.21 ;;;
525     ;;; The default implementations are sufficient for non-multiprocessing
526     ;;; implementations.
527 lgorrie 1.9
528 lgorrie 1.21 (definterface startup-multiprocessing ()
529 lgorrie 1.9 "Initialize multiprocessing, if necessary.
530    
531     This function is called directly through the listener, not in an RPC
532     from Emacs. This is to support interfaces such as CMUCL's
533     MP::STARTUP-IDLE-AND-TOP-LEVEL-LOOPS which does not return like a
534 lgorrie 1.21 normal function."
535     nil)
536 lgorrie 1.9
537 lgorrie 1.21 (definterface spawn (fn &key name)
538     "Create a new thread to call FN.")
539 lgorrie 1.17
540 heller 1.28 (definterface thread-name (thread)
541     "Return the name of THREAD.
542 lgorrie 1.9
543     Thread names are be single-line strings and are meaningful to the
544 lgorrie 1.21 user. They do not have to be unique."
545 heller 1.28 (declare (ignore thread))
546 lgorrie 1.21 "The One True Thread")
547 lgorrie 1.9
548 heller 1.28 (definterface thread-status (thread)
549     "Return a string describing THREAD's state."
550     (declare (ignore thread))
551     "")
552    
553 lgorrie 1.21 (definterface make-lock (&key name)
554 lgorrie 1.17 "Make a lock for thread synchronization.
555 lgorrie 1.21 Only one thread may hold the lock (via CALL-WITH-LOCK-HELD) at a time."
556 heller 1.23 (declare (ignore name))
557 lgorrie 1.21 :null-lock)
558 lgorrie 1.9
559 lgorrie 1.21 (definterface call-with-lock-held (lock function)
560     "Call FUNCTION with LOCK held, queueing if necessary."
561 heller 1.24 (declare (ignore lock)
562     (type function function))
563 lgorrie 1.21 (funcall function))
564 heller 1.25
565     (definterface current-thread ()
566     "Return the currently executing thread."
567     0)
568 heller 1.28
569     (definterface all-threads ()
570     "Return a list of all threads.")
571    
572     (definterface thread-alive-p (thread)
573     "Test if THREAD is termintated.")
574 heller 1.25
575     (definterface interrupt-thread (thread fn)
576     "Cause THREAD to execute FN.")
577    
578     (definterface send (thread object)
579     "Send OBJECT to thread THREAD.")
580    
581     (definterface receive ()
582     "Return the next message from current thread's mailbox.")
583 lgorrie 1.9
584 lgorrie 1.13
585 lgorrie 1.21 ;;;; XREF
586 lgorrie 1.9
587 lgorrie 1.21 (definterface who-calls (function-name)
588     "Return the call sites of FUNCTION-NAME (a string).
589     The results are grouped together by filename:
590     <result> ::= (<file>*)
591     <file> ::= (<filename> . (<reference>*))
592     <reference> ::= (<label> . <location>)
593     <label> ::= string
594     <location> ::= source-location")
595    
596     (definterface who-references (variable-name)
597     "Return the locations where VARIABLE-NAME (a string) is referenced.
598     See WHO-CALLS for a description of the return value.")
599    
600     (definterface who-binds (variable-name)
601     "Return the locations where VARIABLE-NAME (a string) is bound.
602     See WHO-CALLS for a description of the return value.")
603    
604     (definterface who-sets (variable-name)
605     "Return the locations where VARIABLE-NAME (a string) is set.
606     See WHO-CALLS for a description of the return value.")
607    
608     (definterface who-macroexpands (macro-name)
609     "Return the locations where MACRO-NAME (a string) is expanded.
610     See WHO-CALLS for a description of the return value.")
611    
612     (definterface who-specializes (class-name)
613     "Return the locations where CLASS-NAME (a string) is specialized.
614     See WHO-CALLS for a description of the return value.")
615    
616     ;;; Simpler variants.
617    
618     (definterface list-callers (function-name)
619     "List the callers of FUNCTION-NAME.
620     This function is like WHO-CALLS except that it is expected to use
621     lower-level means. Whereas WHO-CALLS is usually implemented with
622     special compiler support, LIST-CALLERS is usually implemented by
623     groveling for constants in function objects throughout the heap.
624    
625     The return value is as for WHO-CALLS.")
626    
627     (definterface list-callees (function-name)
628     "List the functions called by FUNCTION-NAME.
629     See LIST-CALLERS for a description of the return value.")
630 lgorrie 1.1

  ViewVC Help
Powered by ViewVC 1.1.5