Megatest

Diff
Login

Differences From Artifact [d8e2b456f3]:

To Artifact [0b01b34b8c]:


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
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
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






-
+

+
+
+
+
+
+
+



-
-
-
+
+
+
+
+
+
+
+
+

-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+

+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+







;; #!/bin/bash

(module extract
	*

(import  scheme
	 chicken
	 chicken)

(use	 srfi-1
	 srfi-69
	 extras
	 posix
	 regex
	 matchable
	 data-structures
	 )

(define (get-norefs)
  (with-input-from-pipe
   "grep 'Warning: refer' typescript |tr '`' ' '|tr "'" " "|awk '{print $7}'"
   read-lines))
  (let* ((indat (with-input-from-pipe
		 "grep 'Warning: refer' typescript"
		 read-lines)))
    (filter string?
	    (map (lambda (instr)
		   (match (string-search "`(\\S+)'" instr)
			  ((full thematch) thematch)
			  (else #f)))
		 indat))))

(define (get-parent-file noref)
  (with-input-from-pipe
   "grep $fn *mod.scm|grep define|cut -d: -f1"
   read-lines))
(define (get-parent-files noref)
  (let ((scmfiles (with-input-from-pipe
		   "ls *scm|grep -v import"
		   read-lines))
	(resultht (make-hash-table)))
    (for-each
     (lambda (scmfile)
       (let ((lines (with-input-from-pipe
		     (conc "grep '"noref"' "scmfile"|egrep '^.define'")
		     read-lines)))
	 (if (not (null? lines))
	     (hash-table-set! resultht scmfile #t))))
     scmfiles)
    (hash-table-keys resultht)))

(define (main)
  (let ((data (make-hash-table))
	(fns  (get-norefs)))
    (for-each
     (lambda (fn)
       (let ((parents (get-parent-files fn)))
	 ;; (print fn": "parents)
	 (for-each
	  (lambda (parent)
	    (hash-table-set! data parent (cons fn (hash-table-ref/default data parent '()))))
	  parents)))
     fns)
    (for-each
     (lambda (f)
       (let ((fns (hash-table-ref data f)))
	 (print "\n"f)
	 (map print fns)))
     (hash-table-keys data))))

(main)
)

;; 
;; LAST_PARENT=foobar
;; 
;; for fn in $(grep 'Warning: refer' typescript |tr '`' ' '|tr "'" " "|awk '{print $7}');do
;;     PARENT=$(grep $fn *mod.scm|grep define|cut -d: -f1)
;;     if [[ $PARENT != $LAST_PARENT ]];then