Introduce utils module, move exp->string and display-to-string to utils

part of darcs patch Sat Sep 17 17:22:33 EEST 2005  Martin Gasbichler <gasbichl@informatik.uni-tuebingen.de>
This commit is contained in:
eknauel 2005-09-27 08:46:18 +00:00
parent 39ae30681a
commit 4bdb8da41f
3 changed files with 17 additions and 18 deletions

View File

@ -51,12 +51,6 @@
(append result (list (+ count 3)))) (append result (list (+ count 3))))
(loop (+ count 1) result)))))) (loop (+ count 1) result))))))
;;expression as string
(define (exp->string exp)
(let ((exp-port (open-output-string)))
(write exp exp-port)
(get-output-string exp-port)))
(define (sublist l pos k) (define (sublist l pos k)
(let ((tmp (list-tail l pos))) (let ((tmp (list-tail l pos)))
(reverse (list-tail (reverse tmp) (reverse (list-tail (reverse tmp)

View File

@ -8,6 +8,15 @@
(open scheme conditions handle) (open scheme conditions handle)
(files handle-fatal-error)) (files handle-fatal-error))
(define-interface utils-interface
(export display-to-string
exp->string))
(define-structure utils utils-interface
(open scheme
srfi-6)
(files utils))
;;; history data structure ;;; history data structure
(define-interface history-interface (define-interface history-interface
@ -35,7 +44,6 @@
get-marked-positions-1 get-marked-positions-1
get-marked-positions-2 get-marked-positions-2
get-marked-positions-3 get-marked-positions-3
exp->string
sublist sublist
fill-up-string fill-up-string
@ -70,7 +78,6 @@
(define-structure layout layout-interface (define-structure layout layout-interface
(open scheme-with-scsh (open scheme-with-scsh
srfi-6 ;; basic string ports
define-record-types define-record-types
let-opt let-opt
locks locks
@ -144,6 +151,7 @@
pps pps
plugin plugin
layout layout
utils
select-list select-list
tty-debug) tty-debug)
(files process)) (files process))
@ -159,6 +167,7 @@
dirlist-view-plugin dirlist-view-plugin
fs-object fs-object
plugin plugin
utils
layout layout
select-list select-list
(subset focus-table (make-focus-object-reference)) (subset focus-table (make-focus-object-reference))
@ -198,6 +207,7 @@
focus-table focus-table
objects objects
layout layout
utils
fs-object fs-object
select-list select-list
plugin plugin
@ -262,6 +272,7 @@
tty-debug tty-debug
objects objects
utils
layout) layout)
(files std-viewer)) (files std-viewer))
@ -320,7 +331,7 @@
(subset focus-table (make-focus-object-reference)) (subset focus-table (make-focus-object-reference))
tty-debug tty-debug
plugin plugin
layout utils
ncurses) ncurses)
(files select-list)) (files select-list))
@ -367,6 +378,7 @@
focus-table focus-table
ncurses ncurses
layout layout
utils
select-list select-list
tty-debug tty-debug
plugin) plugin)

View File

@ -246,7 +246,7 @@
(define (prepare-selection-for-command-mode infos) (define (prepare-selection-for-command-mode infos)
(string-join (string-join
(map value->string (map display-to-string
(map group-info-element->value infos)))) (map group-info-element->value infos))))
(define (prepare-selection-for-scheme-mode infos) (define (prepare-selection-for-scheme-mode infos)
@ -307,13 +307,6 @@
(else (else
(error "unknown message in make-group-info-browser" message)))))) (error "unknown message in make-group-info-browser" message))))))
(define (value->string val)
(cond ((string? val) val)
((number? val) (number->string val))
((boolean? val) (if val "#t" "#f"))
(else
(error "unknwon value in value->string" val))))
(define (make-user-info-browser ui buffer) (define (make-user-info-browser ui buffer)
(let ((ui ui) (let ((ui ui)
(buffer buffer) (buffer buffer)
@ -335,7 +328,7 @@
(define (prepare-selection-for-command-mode infos) (define (prepare-selection-for-command-mode infos)
(string-join (string-join
(map value->string (map display-to-string
(map user-info-element->value infos)))) (map user-info-element->value infos))))
(define (prepare-selection-for-scheme-mode infos) (define (prepare-selection-for-scheme-mode infos)