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
|
#!/mfs/pkgs/chicken/4.8.0.5/bin/csi -nbq
;; Coming soon (right?) Usage: plot-code file1.scm,file2.scm "fun1,fun2,x*" *.scm > plot.dot
;; Usage: plot-code file1.scm,file2.scm *.scm > plot.dot
;; dot -Tpdf plot.dot > plot.pdf
;; first param is comma separated list of files to include in the map, use - to do all
;; second param is list of regexs for functions to include in the map
;; third param is list of files to scan
(use regex srfi-69 srfi-13)
(define targs #f)
(define files (cddddr (argv)))
(let ((targdat (cadddr (argv))))
(if (equal? targdat "-")
(set! targs files)
(set! targs (string-split targdat ","))))
(define filedat-defns (make-hash-table))
(define filedat-usages (make-hash-table))
(define defn-rx (regexp "^\\s*\\(define\\s+\\(([^\\s\\)]+).*"))
(define all-regexs (make-hash-table))
(define all-fns '())
|
|
>
>
|
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
|
#!/mfs/pkgs/chicken/4.8.0.5/bin/csi -nbq
;; Coming soon (right?) Usage: plot-code file1.scm,file2.scm "fun1,fun2,x*" *.scm > plot.dot
;; Usage: plot-code file1.scm,file2.scm *.scm > plot.dot
;; dot -Tpdf plot.dot > plot.pdf
;; first param is comma separated list of files to include in the map, use - to do all
;; second param is list of regexs for functions to include in the map
;; third param is list of files to scan
(use regex srfi-69 srfi-13)
(define targs #f)
(define files (cdr (cddddr (argv))))
(let ((targdat (cadddr (argv))))
(if (equal? targdat "-")
(set! targs files)
(set! targs (string-split targdat ","))))
(define function-patt (car (cdr (cdddr (argv)))))
(define function-rx (regexp function-patt))
(define filedat-defns (make-hash-table))
(define filedat-usages (make-hash-table))
(define defn-rx (regexp "^\\s*\\(define\\s+\\(([^\\s\\)]+).*"))
(define all-regexs (make-hash-table))
(define all-fns '())
|
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
|
(lambda ()
(let loop ((inl (read-line)))
(if (not (eof-object? inl))
(let ((match (string-match defn-rx inl)))
(if match
(let ((fnname (cadr match)))
;; (print " " fnname)
(set! all-fns (cons fnname all-fns))
(hash-table-set!
filedat-defns
fname
(cons fnname (hash-table-ref/default filedat-defns fname '())))
))
(loop (read-line))))))))
files)
|
>
|
|
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
|
(lambda ()
(let loop ((inl (read-line)))
(if (not (eof-object? inl))
(let ((match (string-match defn-rx inl)))
(if match
(let ((fnname (cadr match)))
;; (print " " fnname)
(if (string-match function-rx fnname)
(set! all-fns (cons fnname all-fns)))
(hash-table-set!
filedat-defns
fname
(cons fnname (hash-table-ref/default filedat-defns fname '())))
))
(loop (read-line))))))))
files)
|