306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
|
(define help
(conc "Usage: refdb action params ...
Note: refdbdir is a path to the directory containg sheet-names.cfg
import filename.gnumeric refdbdir : Import a gnumeric file into a txt db directory
edit refdbdir : Edit a refdbdir using gnumeric.
lookup refdbdir sheetname row col : Look up a value in the text db
ls refdbdir : List the keys for specified level
Part of the Megatest tool suite. Learn more at http://www.kiatoa.com/fossils/megatest"))
(define (list-sheets path)
;; (cond
;; ((and path (not sheet)(not row)(not col))
(if (file-exists? path)
|
>
|
>
|
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
|
(define help
(conc "Usage: refdb action params ...
Note: refdbdir is a path to the directory containg sheet-names.cfg
import filename.gnumeric refdbdir : Import a gnumeric file into a txt db directory
edit refdbdir : Edit a refdbdir using gnumeric.
ls refdbdir : List the keys for specified level
lookup refdbdir sheetname row col : Look up a value in the text db
getrownames refdb sheetname : Get a list of row titles
getcolnames refdb sheetname : Get a list of column titles
Part of the Megatest tool suite. Learn more at http://www.kiatoa.com/fossils/megatest"))
(define (list-sheets path)
;; (cond
;; ((and path (not sheet)(not row)(not col))
(if (file-exists? path)
|
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
|
;; call with proc = car to get row names
;; call with proc = cadr to get col names
(define (get-rowcol-names path sheet proc)
(let ((fname (conc path "/" sheet ".dat")))
(if (file-exists? fname)
(let ((dat (read-dat fname)))
(if (null? dat)
#f
(let loop ((hed (car dat))
(tal (cdr dat))
(res '()))
(let* ((row-name (proc hed))
(newres (if (not (member row-name res))
(cons row-name res)
res)))
(if (null? tal)
(reverse newres)
(loop (car tal)(cdr tal) newres))))))
#f)))
(define (get-col-names path sheet)
(let ((fname (conc path "/" sheet ".dat")))
(if (file-exists? fname)
(let ((dat (read-dat fname)))
(if (null? dat)
#f
|
<
>
|
|
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
|
;; call with proc = car to get row names
;; call with proc = cadr to get col names
(define (get-rowcol-names path sheet proc)
(let ((fname (conc path "/" sheet ".dat")))
(if (file-exists? fname)
(let ((dat (read-dat fname)))
(if (null? dat)
'()
(let loop ((hed (car dat))
(tal (cdr dat))
(res '()))
(let* ((row-name (proc hed))
(newres (if (not (member row-name res))
(cons row-name res)
res)))
(if (null? tal)
(reverse newres)
(loop (car tal)(cdr tal) newres))))))
'())))
(define (get-col-names path sheet)
(let ((fname (conc path "/" sheet ".dat")))
(if (file-exists? fname)
(let ((dat (read-dat fname)))
(if (null? dat)
#f
|