Megatest

Diff
Login

Differences From Artifact [fc6b8a9e1d]:

To Artifact [9db483f300]:


36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58

59



60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76

77
78
79
80
81
82
83
84

85
86
87
88
89
90
91
(define unituses-rx (regexp "^\\(declare \\((unit|uses) ([^\\(\\)]+)\\).*"))

(define (print-err . data)
  (with-output-to-port (current-error-port)
    (lambda ()
      (apply print data))))

(define (process-file ignores fname)
  (with-input-from-file fname
    (lambda ()
      (let loop ((modname "DUMMYMOD"))
	(let* ((inl (read-line)))
	  (if (eof-object? inl)
	      #t
	      (match (string-search unituses-rx inl)
 	         ((_ dtype unitname)
		  (if (equal? dtype "unit")
		      (loop unitname)
		      (begin
			(if (equal? dtype "uses")
			    (if (not (or (member modname '("DUMMYMOD"))
					 (member modname ignores)
					 (member unitname ignores)))

				(print "  \""unitname"\" -> \""modname"\";"))



			    (print-err "ERROR: bad declare line \""inl"\""))
			(loop modname))))
		 (else
		  (loop modname)))))))))

;; ./utils/plot-uses todot portlogger,stml2,debugprint,mtargs
;; apimod.scm commonmod.scm configfmod.scm dbmod.scm megatestmod.scm
;; mtmod.scm processmod.scm rmtmod.scm servermod.scm
;; tcp-transportmod.scm > uses.dot

;; dot uses.dot -Tpdf -o uses.pdf


(define (main)
  (match (command-line-arguments)
    (("todot" ignoreunits . files)
     (let* ((ignores (string-split ignoreunits ",")))

       (print-err "Making graph for files: " (string-intersperse files ", "))
       (print "digraph uses_unit {")
       (for-each
	(lambda (fname)
	  (print "// Filename: "fname)
	  (process-file ignores fname))
	files)
       (print "}")))

    (else
     (print-err "Usage: plot-uses todot u1,u2... file1.scm ...")
     (print-err "    where u1,u2... are units to ignore and file1.scm... are the files to process."))))

(main)

)







|







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












|
>





|

|
>







36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
(define unituses-rx (regexp "^\\(declare \\((unit|uses) ([^\\(\\)]+)\\).*"))

(define (print-err . data)
  (with-output-to-port (current-error-port)
    (lambda ()
      (apply print data))))

(define (process-file ignores fname oup)
  (with-input-from-file fname
    (lambda ()
      (let loop ((modname "DUMMYMOD"))
	(let* ((inl (read-line)))
	  (if (eof-object? inl)
	      #t
	      (match (string-search unituses-rx inl)
 	        ((_ dtype unitname)
		 (if (equal? dtype "unit")
		     (loop unitname)
		     (begin
		       (if (equal? dtype "uses")
			   (if (not (or (member modname '("DUMMYMOD"))
					(member modname ignores)
					(member unitname ignores)))
			       (begin
				 (print "  \""unitname"\" -> \""modname"\";")
				 (with-output-to-port oup
				   (lambda ()
				     (print "mofiles/"modname".o : mofiles/"unitname".o")))))
			   (print-err "ERROR: bad declare line \""inl"\""))
		       (loop modname))))
		(else
		 (loop modname)))))))))

;; ./utils/plot-uses todot portlogger,stml2,debugprint,mtargs
;; apimod.scm commonmod.scm configfmod.scm dbmod.scm megatestmod.scm
;; mtmod.scm processmod.scm rmtmod.scm servermod.scm
;; tcp-transportmod.scm > uses.dot

;; dot uses.dot -Tpdf -o uses.pdf


(define (main)
  (match (command-line-arguments)
    (("todot" ignoreunits . files)
     (let* ((ignores (string-split ignoreunits ","))
	    (oup     (open-output-file "make.inc")))
       (print-err "Making graph for files: " (string-intersperse files ", "))
       (print "digraph uses_unit {")
       (for-each
	(lambda (fname)
	  (print "// Filename: "fname)
	  (process-file ignores fname oup))
	files)
       (print "}")
       (close-output-port oup)))
    (else
     (print-err "Usage: plot-uses todot u1,u2... file1.scm ...")
     (print-err "    where u1,u2... are units to ignore and file1.scm... are the files to process."))))

(main)

)