|
@@ -7,8 +7,7 @@
|
|
|
:cl)
|
|
|
(:import-from #:parse-number
|
|
|
#:parse-number)
|
|
|
- (:export open-configuration-file
|
|
|
- write-configuration-file))
|
|
|
+ (:export open-configuration-file))
|
|
|
|
|
|
(in-package #:config-parser)
|
|
|
|
|
@@ -93,41 +92,3 @@
|
|
|
until (eq char 'foo)
|
|
|
collect char)))))
|
|
|
|
|
|
-(defun write-identifier (identifier alist stream)
|
|
|
- (format stream "~a" (getf alist identifier)))
|
|
|
-
|
|
|
-(defun write-string-out (string stream)
|
|
|
- (format stream "\"~a\"" string))
|
|
|
-
|
|
|
-(defun write-block-title (identifier alist stream)
|
|
|
- (format stream "~%[")
|
|
|
- (write-identifier identifier alist stream)
|
|
|
- (format stream "]~&"))
|
|
|
-
|
|
|
-(defun write-path (id1 id2 alist stream)
|
|
|
- (write-identifier id1 alist stream)
|
|
|
- (format stream "/")
|
|
|
- (write-identifier id2 alist stream))
|
|
|
-
|
|
|
-(defun write-expression (lhs rhs alist stream)
|
|
|
- (format stream "~&")
|
|
|
- (write-identifier lhs alist stream)
|
|
|
- (format stream " = ")
|
|
|
- (if (typep rhs 'string)
|
|
|
- (write-string-out rhs stream)
|
|
|
- (if (typep rhs 'list)
|
|
|
- (write-path (car rhs) (cadr rhs) alist stream)
|
|
|
- (format stream "~a" rhs)))
|
|
|
- (format stream "~&"))
|
|
|
-
|
|
|
-(defun write-correct (stream alist toplevel-p config-list)
|
|
|
- (if toplevel-p
|
|
|
- (if (listp (car config-list))
|
|
|
- (write-correct stream alist nil (cdr config-list))
|
|
|
- (write-block-title (car config) alist stream))
|
|
|
- (loop for (lhs rhs) in config-list
|
|
|
- do (write-expression lhs rhs alist config-list))))
|
|
|
-
|
|
|
-(defun write-configuration-file (filename config key-to-text-alist)
|
|
|
- (with-open-file (output-file filename :direction :output :if-exists :overwrite :if-does-not-exist :create)
|
|
|
- (write-correct output-file key-to-text-alist t config)))
|