Megatest

Diff
Login

Differences From Artifact [c034045a40]:

To Artifact [881a699c98]:


651
652
653
654
655
656
657

658



659
660


661
662

663
664
665
666











667
668
669
670
671
672
673
651
652
653
654
655
656
657
658
659
660
661
662


663
664
665
666
667




668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685







+

+
+
+
-
-
+
+


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







  (let ((ht (make-hash-table)))
    (for-each
     (lambda (section)
       (hash-table-set! ht (car section)(cdr section)))
     adat)
    ht))

;; if 
(define (configf:read-alist fname)
  (handle-exceptions
      exn
      #f
  (configf:alist->config
   (with-input-from-file fname read)))
    (configf:alist->config
     (with-input-from-file fname read))))

(define (configf:write-alist cdat fname)
  (let ((dat  (configf:config->alist cdat)))
  (with-output-to-file fname
    (lambda ()
      (pp (configf:config->alist cdat)))))
     
    (with-output-to-file fname ;; first write out the file
      (lambda ()
	(pp dat)))
    (if (file-exists? fname)   ;; now verify it is readable
	(if (configf:read-alist fname)
	    #t ;; data is good.
	    (begin
	      (delete-file fname)
	      (debug:print 0 *default-log-port* "WARNING: content " dat " for cache " fname " is not readable. Deleting generated file.")
	      #f))
	#f)))

;; convert hierarchial list to ini format
;;
(define (configf:config->ini data)
  (map 
   (lambda (section)
     (let ((section-name (car section))