banterpixra
Check-in [4e9baf7538]
Not logged in

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Report on symbols defined and used, but only once.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1:4e9baf7538725eb556350a893c6db6a594d0bcaf
User & Date: alaric 2013-07-13 12:55:50
Context
2019-11-10
22:52
Rebuilt banterpixra.svg Leaf check-in: 8b7b07502c user: alaric tags: trunk
2013-07-13
12:55
Report on symbols defined and used, but only once. check-in: 4e9baf7538 user: alaric tags: trunk
09:38
Symbol usage reporting to stderr check-in: d3e21eafae user: alaric tags: trunk
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to banterpixra.scm.

77
78
79
80
81
82
83

84
85
86
87






88
89

90
91
92

93
94
95

96
97
98

99
100
101
102
103

104
105
106
107
108
109
110
            (make-symbol-stats #f 1))))

(define (report-on-symbols port)
  (let ((stats
         (hash-table-fold
          *symbols*
          (lambda (sym ss acc)

            (let ((defined-used (vector-ref acc 0))
                  (defined-unused (vector-ref acc 1))
                  (undefined-used (vector-ref acc 2)))
              (if (symbol-defined? ss)






                  (if (> (symbol-uses ss) 0)
                      (vector (cons sym defined-used)

                              defined-unused
                              undefined-used)
                      (vector defined-used

                              (cons sym defined-unused)
                              undefined-used))
                  (vector defined-used

                          defined-unused
                          (cons sym undefined-used)))))
          (vector '() '() '()))))

    (let ((defined-used (vector-ref stats 0))
          (defined-unused (vector-ref stats 1))
          (undefined-used (vector-ref stats 2)))

      (fprintf port "Defined and used: ~A\n" defined-used)

      (fprintf port "Defined but not used: ~A\n" defined-unused)
      (fprintf port "Undefined, but used: ~A\n" undefined-used))))

;; GRAPHICS FORMATTING STUFF

(define *debug-mode* #f)








>
|
|
|

>
>
>
>
>
>
|
|
>
|
|
|
>
|
|
|
>


|
>
|
|
|

|
>







77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
            (make-symbol-stats #f 1))))

(define (report-on-symbols port)
  (let ((stats
         (hash-table-fold
          *symbols*
          (lambda (sym ss acc)
            (let ((defined-used-once (vector-ref acc 0))
                  (defined-used (vector-ref acc 1))
                  (defined-unused (vector-ref acc 2))
                  (undefined-used (vector-ref acc 3)))
              (if (symbol-defined? ss)
                  (cond
                   ((> (symbol-uses ss) 1)
                         (vector defined-used-once
                                 (cons sym defined-used)
                                 defined-unused
                                 undefined-used))
                   ((> (symbol-uses ss) 0)
                         (vector (cons sym defined-used-once)
                                 defined-used
                                 defined-unused
                                 undefined-used))
                   (else (vector defined-used-once
                                 defined-used
                                 (cons sym defined-unused)
                                 undefined-used)))
                  (vector defined-used-once
                          defined-used
                          defined-unused
                          (cons sym undefined-used)))))
          (vector '() '() '() '()))))
    (let ((defined-used-once (vector-ref stats 0))
          (defined-used (vector-ref stats 1))
          (defined-unused (vector-ref stats 2))
          (undefined-used (vector-ref stats 3)))

      (fprintf port "Defined and used repeatedly: ~A\n" defined-used)
      (fprintf port "Defined and used only once: ~A\n" defined-used-once)
      (fprintf port "Defined but not used: ~A\n" defined-unused)
      (fprintf port "Undefined, but used: ~A\n" undefined-used))))

;; GRAPHICS FORMATTING STUFF

(define *debug-mode* #f)