Index: common.scm ================================================================== --- common.scm +++ common.scm @@ -146,10 +146,27 @@ val)) ;;====================================================================== ;; U S E F U L S T U F F ;;====================================================================== + +;; convert things to an alist or assoc list, #f gets converted to "" +;; +(define (common:to-alist dat) + (cond + ((list? dat) (map common:to-alist dat)) + ((vector? dat) + (map common:to-alist (vector->list dat))) + ((pair? dat) + (cons (common:to-alist (car dat)) + (common:to-alist (cdr dat)))) + ((hash-table? dat) + (map common:to-alist (hash-table->alist dat))) + (else + (if dat + dat + "")))) (define (common:low-noise-print waitval . keys) (let* ((key (string-intersperse (map conc keys) "-" )) (lasttime (hash-table-ref/default *common:denoise* key 0)) (currtime (current-seconds))) Index: megatest.scm ================================================================== --- megatest.scm +++ megatest.scm @@ -940,25 +940,10 @@ (if (>= indx (vector-length datavec)) #f ;; index to high, should raise an error I suppose (vector-ref datavec indx)) #f))) -(define (to-alist dat) - (cond - ((list? dat) (map to-alist dat)) - ((vector? dat) - (map to-alist (vector->list dat))) - ((pair? dat) - (cons (to-alist (car dat)) - (to-alist (cdr dat)))) - ((hash-table? dat) - (map to-alist (hash-table->alist dat))) - (else - (if dat - dat - "")))) - ;; NOTE: list-runs and list-db-targets operate on local db!!! ;; (if (or (args:get-arg "-list-runs") (args:get-arg "-list-db-targets")) (if (launch:setup-for-run) @@ -1198,12 +1183,14 @@ "shortdir" "rundir" "uname" ) ) - (newdat (to-alist data)) - (allrundat (car (map cdr newdat))) ;; (car (map cdr (car (map cdr newdat))))) + (newdat (common:to-alist data)) + (allrundat (if (null? newdat) + '() + (car (map cdr newdat)))) ;; (car (map cdr (car (map cdr newdat))))) (runs (append (list "runs" ;; sheetname metadat-fields) (map (lambda (run) ;; (print "run: " run) @@ -1260,21 +1247,21 @@ ;; (pp allrundat) ;; (print "runs:") ;; (pp runs) ;(print "sheets: ") ;; (pp sheets) - (let* ((tempdir (conc "/tmp/" (current-user-name) "/" (random 10000) "_" (current-process-id))) - (outputfile (or (args:get-arg "-o") "out.ods")) - (ouf (if (string-match (regexp "^[/~]+.*") outputfile) ;; full path? - outputfile - (begin - (debug:print 0 "WARNING: path given, " outputfile " is relative, prefixing with current directory") - (conc (current-directory) "/" outputfile))))) - (create-directory tempdir #t) - (if (eq? dmode 'ods)(ods:list->ods tempdir ouf sheets)) - ;; (system (conc "rm -rf " tempdir)) - )) + (if (eq? dmode 'ods) + (let* ((tempdir (conc "/tmp/" (current-user-name) "/" (random 10000) "_" (current-process-id))) + (outputfile (or (args:get-arg "-o") "out.ods")) + (ouf (if (string-match (regexp "^[/~]+.*") outputfile) ;; full path? + outputfile + (begin + (debug:print 0 "WARNING: path given, " outputfile " is relative, prefixing with current directory") + (conc (current-directory) "/" outputfile))))) + (create-directory tempdir #t) + (ods:list->ods tempdir ouf sheets)))) + ;; (system (conc "rm -rf " tempdir)) (set! *didsomething* #t)))) ;; Don't think I need this. Incorporated into -list-runs instead ;; ;; (if (and (args:get-arg "-since")