File: link-debug.scm

package info (click to toggle)
scsh-0.6 0.6.7-3
  • links: PTS
  • area: main
  • in suites: etch, etch-m68k
  • size: 15,124 kB
  • ctags: 16,788
  • sloc: lisp: 82,839; ansic: 23,112; sh: 3,116; makefile: 829
file content (36 lines) | stat: -rw-r--r-- 1,147 bytes parent folder | download | duplicates (6)
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
; Copyright (c) 1993-1999 by Richard Kelsey and Jonathan Rees. See file COPYING.




; Stuff for debugging new images:

(define (ev form package)
  (invoke-template (compile-form form package)
		   (package-uid package)))

; If desired, this definition of invoke-template can be replaced by
; something that starts up a different virtual machine.

(define (invoke-template template env . args)
  (apply (make-closure template env)
	 args))

; Utility for tracking down uses of variables

(define (who-uses name proc)
  (let recur ((tem (closure-template proc))
              (path '()))
    (let loop ((i 0))
      (if (< i (template-length tem))
          (let ((thing (template-ref tem i))
                (down (lambda (tem)
                        (recur tem (cons (or (template-ref tem 1) i) path)))))
            (cond ((template? thing)
                   (down thing))
                  ((location? thing)
                   (if (eq? (location-name thing) name)
                       (begin (write path) (newline))))
                  ((closure? thing)
                   (down (closure-template thing))))
            (loop (+ i 1)))))))