68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
|
(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 "\"")
(loop (read-line inp) curr-section-name))))))))
(define (find-and-read-config fname)
(let* ((configinfo (find-config fname))
(toppath (car configinfo))
(configfile (cadr configinfo))
(configdat (if configfile (read-config configfile) #f))) ;; (make-hash-table))))
(list configdat toppath configfile fname)))
(define (config-lookup cfgdat section var)
(let ((sectdat (hash-table-ref/default cfgdat section '())))
(if (null? sectdat)
#f
(let ((match (assoc var sectdat)))
(if match
|
>
|
|
>
|
>
|
|
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
|
(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 "\"")
(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)))
(if toppath (change-directory toppath))
(let ((configdat (if configfile (read-config configfile) #f))) ;; (make-hash-table))))
(if toppath (change-directory curr-dir))
(list configdat toppath configfile fname))))
(define (config-lookup cfgdat section var)
(let ((sectdat (hash-table-ref/default cfgdat section '())))
(if (null? sectdat)
#f
(let ((match (assoc var sectdat)))
(if match
|