Megatest

Diff
Login

Differences From Artifact [25e7738e04]:

To Artifact [e97ed0b788]:


83
84
85
86
87
88
89

90
91


92
93
94

95
96
97
98



99
100
101

102
103
104
105
106
107
108
83
84
85
86
87
88
89
90


91
92



93




94
95
96



97
98
99
100
101
102
103
104







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







			   ;; (debug:print 0 "x: " x " val: " val)
			   (if (not val)
			       ;; (debug:print 0 "WARNING: missing key " x ". Specified in database but not on command line, using \"unk\"")
			       (set! val "default"))
			   (if withkey (list x val) (list val))))
		       argkeys))))
  
;; Given a list of keys (list of vectors) return an alist ((key argval) ...)
;; (define (keys->alist keys)
;;   (let* ((keynames   (map key:get-fieldname keys))
(define (keys->alist keys defaultval)
  (let* ((keynames   (map key:get-fieldname keys))
;; 	 (argkeys    (map (lambda (k)(conc ":" k)) keynames))
;; 	 (withkey    (not (null? withkey)))
;; 	 (newremargs (args:get-args (cons "blah" remargs) argkeys '() args:arg-hash 0))) ;; the cons blah works around a bug in args
	 (newremargs (args:get-args (cons "blah" remargs) (map (lambda (k)(conc ":" k)) keynames) '() args:arg-hash 0))) ;; the cons blah works around a bug in args
;;     (debug:print 0 "remargs: " remargs " newremargs: " newremargs)
;;     (apply append (map (lambda (x)
;; 			 (let ((val (args:get-arg x)))
;; 			   (if (not val)
    (map (lambda (key)
	   (let ((val (args:get-arg (conc ":" key))))
	     (list key (if val val defaultval))))
;; 			       (debug:print 0 "ERROR: Ignoring key " x " found in database but not on command line"))
;; 			   (if withkey (list x val) (list val))))
;; 		       argkeys))))
	 keynames)))

(define (keystring->keys keystring)
  (map (lambda (x)
	 (let ((xlst (string-split x ":")))
	   (list->vector (if (> (length xlst) 1) xlst (append (car xlst)(list "TEXT"))))))
       (delete-duplicates (string-split keystring ","))))