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
|
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
|
-
+
+
+
+
+
+
+
-
+
|
(comment-rx _ (loop (read-line inp) curr-section-name))
(blank-l-rx _ (loop (read-line inp) curr-section-name))
(include-rx ( x include-file ) (begin
(read-config include-file res)
(loop (read-line inp) curr-section-name)))
(section-rx ( x section-name ) (loop (read-line inp) section-name))
(key-sys-pr ( x key cmd ) (let ((alist (hash-table-ref/default res curr-section-name '()))
(val (let ((res (car (cmd-run->list cmd))))
(val (let* ((cmdres (cmd-run->list cmd))
(status (cadr cmdres))
(res (car cmdres)))
(if (not (eq? status 0))
(begin
(print "ERROR: problem with " inl ", return code not 0")
(exit 1)))
(if (null? res)
""
(string-intersperse res " ")))))
(hash-table-set! res curr-section-name
(config:assoc-safe-add alist key val))
;; (append alist (list (list key val))))
(loop (read-line inp) curr-section-name)))
(key-val-pr ( x key val ) (let ((alist (hash-table-ref/default res curr-section-name '())))
(hash-table-set! res curr-section-name
(config:assoc-safe-add alist key val))
;; (append alist (list (list key val))))
(loop (read-line inp) curr-section-name)))
(else (print "ERROR: Should not get here,\n \"" inl "\"")
(else (print "ERROR: problem parsing " path ",\n \"" inl "\"")
(loop (read-line inp) curr-section-name))))))))
(define (find-and-read-config fname)
(let* ((curr-dir (current-directory))
(configinfo (find-config fname))
(toppath (car configinfo))
(configfile (cadr configinfo)))
|