[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

who calls me & who do I call

Here are some answers to your questions, collected from a few developers:

    does anyone know how to access the who calls database?

The primitive is si:map-over-callers

    I want the results as a list. 

Here's an example of finding the callers of si:map-over-callers itself.
Evaluate it out of your zmail buffer using c-R to edit the mail and
c-sh-E to evaluate the marked region.

(let ((answer '()))
  (si:map-over-callers 'si:map-over-callers
		       (lambda (caller how)
			 (push (list caller how) answer)))

    I also would like an inverse function which given
    a function spec can return the list of all other function specs
    which it calls. 

si:map-over-compiled-function-callees is the primitive.
  (lambda (caller callee how)
    (when (eq how ':function)
      (format t "~&~S calls ~S as a ~S~%"
	      (sys:function-name caller) callee how)))
  :external-references t :map-over-internal-functions-too t)

    Finally does anyone know of a function which
    can take a Zmacs buffer (or file) and return a list of all
    the specs of all functions (and methods and macros) defined in
    that buffer/file? 

(zwei:buffer-sections <buffer>) will return a list of objects that
respond to the :definition-type and :function-spec messages.
zwei:*interval* is the current buffer and zwei:find-buffer-named
is how you can find a buffer; the variable only is bound inside
of Zmacs, of course.

Here's an example showing how to do it for a file that has been

(send (send #P"SYS:ZWEI;COMA.LISP.NEWEST" :generic-pathname) :get 'si:definitions)

None of this is a documented interface, so it could be changed
incompatibly in a future release.  I do not know of any plans to change
any of it, however.  Your profiling program sounds interesting, I wouldn't
mind seeing it.  Probably it would get a lot of use if donated to the SLUG