Megatest

Check-in [d3164a445d]
Login
Overview
Comment:update util to show dead code
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | v1.64
Files: files | file ages | folders
SHA1: d3164a445d1ca16cc2cb26b89f7a21a22d1f6875
User & Date: bb on 2017-08-16 01:25:42
Other Links: branch diff | manifest | tags
Context
2017-08-16
11:11
fixed bug in show-uncalled-procedures.scm check-in: b4d839d5b8 user: bjbarcla tags: v1.64
01:25
update util to show dead code check-in: d3164a445d user: bb tags: v1.64
01:24
add util to trackback procedure calls check-in: fc5bec0c9f user: bb tags: v1.64
Changes

Modified show-uncalled-procedures.scm from [0604c01fa9] to [0b3bf4b4d7].

127
128
129
130
131
132
133
134

135
136
137
138
139
140
141












142




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







-
+







+
+
+
+
+
+
+
+
+
+
+
+
-
+
+
+
+
                                        #f))
                                  atoms))))
                   (list proc file calls)))
               all-procs+file+atoms))
         (callers (get-callers-alist all-procs+file+calls))) ;; this is a handy cross-reference of callees to callers.  could be used elsewhere
    callers))

(define (main)
(define (show-danglers)
  (let* ((all-scm-files (glob "*.scm"))
         (xref (get-xref all-scm-files))
         (dangling-procs
          (map car (filter (lambda (x) (equal? 1 (length x))) xref))))
    (for-each print dangling-procs) ;; our product.
    ))

(define (traceback-proc procname)
  (let* ((all-scm-files (glob "*.scm"))
         (xref (get-xref all-scm-files))
         (lookup (lambda (path procname depth)
                   (let* ((upcone (alist-ref procname xref equal? '()))
                          (uppath (conc procname "/" path))
                          (updepth (add1 depth)))
                     (if (null? upcode) (print uppath))
                     (for-each (lambda (x)
                                 (lookup uppath x updepth) )
                               upcone)))))
    (lookup "." procname 0)))
(main)


;(traceback-proc "run:run-tests")