[Wisp-cvs] wisp/src/builtin filing.wisp,1.104,1.105 pack.wisp,1.9,1.10 parser.wisp,1.119,1.120 strin
Status: Alpha
Brought to you by:
digg
Update of /cvsroot/wisp/wisp/src/builtin In directory usw-pr-cvs1:/tmp/cvs-serv6288/src/builtin Modified Files: filing.wisp pack.wisp parser.wisp strings.wisp symbols.wisp sys.wisp tostring.wisp Log Message: Made the builtin library avoid |string-length| in favour of |length|. Index: filing.wisp =================================================================== RCS file: /cvsroot/wisp/wisp/src/builtin/filing.wisp,v retrieving revision 1.104 retrieving revision 1.105 diff -u -d -r1.104 -r1.105 --- filing.wisp 26 Aug 2002 16:18:23 -0000 1.104 +++ filing.wisp 7 Sep 2002 22:00:40 -0000 1.105 @@ -52,20 +52,20 @@ (lambda (count (block? #t)) (my lim (+ start count) (let (loop) - (if (< (string-length buffer) lim) + (if (< (length buffer) lim) (begin (string-move! buffer 0 buffer start (- stop start)) (decr! stop start) (decr! lim start) (set! start 0) - (if (< (string-length buffer) lim) + (if (< (length buffer) lim) (my new-buf (make-string lim) - (string-move! new-buf 0 buffer 0 (string-length buffer)) + (string-move! new-buf 0 buffer 0 (length buffer)) (set! buffer new-buf))))) (if (>= (- stop start) count) '#t ; success (my r (raw-read-string port buffer stop - (- (string-length buffer) stop)) + (- (length buffer) stop)) (cond ((zero? r) ; EOF (set! eof? #t) @@ -128,7 +128,7 @@ (friend (port-read-string port amount block?) (my s (port-peek-string port amount block?) (if (string? s) - (incr! start (string-length s))) + (incr! start (length s))) s)) (friend (port-peek-string port amount block?) (my e (ensure-in-buffer amount block?) @@ -158,7 +158,7 @@ (raw-seek port whence delta)) (friend (port-write-string port s) (drop-buffer port) - (raw-write-string port s 0 (string-length s))) + (raw-write-string port s 0 (length s))) (friend (close-input-port port) (set! raw-read-string raise-unreadable-port) (hold Index: pack.wisp =================================================================== RCS file: /cvsroot/wisp/wisp/src/builtin/pack.wisp,v retrieving revision 1.9 retrieving revision 1.10 diff -u -d -r1.9 -r1.10 --- pack.wisp 26 Aug 2002 16:18:24 -0000 1.9 +++ pack.wisp 7 Sep 2002 22:00:41 -0000 1.10 @@ -9,7 +9,7 @@ (define (unpack-be-integer s) (let ((res 0) (i 0) - (l (string-length s))) + (l (length s))) (while (< i l) (set! res (+ (* res 256) (char->integer s[i]))) (incr! i)) @@ -17,7 +17,7 @@ (define (unpack-le-integer s) (let ((res 0) - (i (string-length s))) + (i (length s))) (while (not (zero? i)) (decr! i) (set! res (+ (* res 256) (char->integer s[i])))) @@ -52,7 +52,7 @@ (if (negative? n) (raise 'range n)) (my s (integer->string n 2) - (if (>= i (string-length s)) + (if (>= i (length s)) (set! s (string-append (make-string i #\0) s))) (set! s[(- -1 i)] (if v #\1 #\0)) (string->integer s 2))) Index: parser.wisp =================================================================== RCS file: /cvsroot/wisp/wisp/src/builtin/parser.wisp,v retrieving revision 1.119 retrieving revision 1.120 diff -u -d -r1.119 -r1.120 --- parser.wisp 4 Sep 2002 14:39:37 -0000 1.119 +++ parser.wisp 7 Sep 2002 22:00:41 -0000 1.120 @@ -46,28 +46,28 @@ (define (parse-character-body s) (cond - ((= (string-length s) 1) (my c s[0] - ; FIXME: use |char-printable?| - (and (char>? c #\U+20) - c))) - ((and (= (string-length s) 2) - (char=? s[0] #\^)) (char->control-char s[1])) + ((= (length s) 1) (my c s[0] + ; FIXME: use |char-printable?| + (and (char>? c #\U+20) + c))) + ((and (= (length s) 2) + (char=? s[0] #\^)) (char->control-char s[1])) ((and - (> (string-length s) 2) + (> (length s) 2) (char=? (char-upcase s[0]) #\U) (char=? s[1] #\+) (string->integer - s[2 ...] 16)) => (lambda (c) - (try (integer->char c) - (except () - #f)))) + s[2 ...] 16)) => (lambda (c) + (try (integer->char c) + (except () + #f)))) ((string->symbol - (string-downcase s)) => (lambda (name) - (and (assq name char-names) - => cdr))) - (else #f))) ; failure + (string-downcase s)) => (lambda (name) + (and (assq name char-names) + => cdr))) + (else #f))) ; failure (define (read-character-body port) (my c (peek-char port) Index: strings.wisp =================================================================== RCS file: /cvsroot/wisp/wisp/src/builtin/strings.wisp,v retrieving revision 1.100 retrieving revision 1.101 diff -u -d -r1.100 -r1.101 --- strings.wisp 26 Aug 2002 16:18:24 -0000 1.100 +++ strings.wisp 7 Sep 2002 22:00:41 -0000 1.101 @@ -13,7 +13,7 @@ ((asm NN_prstring2symbol) s))) (define (string->list s (start #f) (end #f)) - (my sl (string-length s) + (my sl (length s) (set! start (if start (reduce-index start sl) 0)) (set! end (if end (reduce-index end sl) sl))) (my l '() @@ -24,7 +24,7 @@ l)) (define (string-upcase! str (start #f) (end #f)) - (my sl (string-length str) + (my sl (length str) (set! start (if start (reduce-index start sl) 0)) (set! end (if end (reduce-index end sl) sl))) (my i start @@ -34,7 +34,7 @@ (begin)) (define (string-downcase! str (start #f) (end #f)) - (my sl (string-length str) + (my sl (length str) (set! start (if start (reduce-index start sl) 0)) (set! end (if end (reduce-index end sl) sl))) (my i start @@ -67,7 +67,7 @@ (string-copy str start end)) (define (string-copy s (start #f) (end #f)) - (my sl (string-length s) + (my sl (length s) (set! start (if start (reduce-index start sl) 0)) (set! end (if end (reduce-index end sl) sl))) (my amount (- end start) @@ -79,14 +79,14 @@ new-string))) (define (string->c8string old-string - (start 0) (end (string-length old-string))) + (start 0) (end (length old-string))) (my amount (- end start) (my new-string (make-c8string amount) (string-move! new-string 0 old-string start amount) new-string))) (define (string->c16string old-string - (start 0) (end (string-length old-string))) + (start 0) (end (length old-string))) (my amount (- end start) (my new-string (make-c16string amount) (string-move! new-string 0 old-string start amount) @@ -96,7 +96,7 @@ (my total-length 0 (for-each (lambda (x) - (incr! total-length (if (char? x) 1 (string-length x)))) + (incr! total-length (if (char? x) 1 (length x)))) strings) (let ((result ((case width ((char8 c8 c8string 8 \8 @@ -114,7 +114,7 @@ (begin (set! result[p] s) (incr! p)) - (my l (string-length s) + (my l (length s) (string-move! result p s 0 l) (incr! p l)))) strings) @@ -180,10 +180,10 @@ (set! buf[ptr] emitee) (incr! ptr)) ((string? emitee) - (my l (string-length emitee) + (my l (length emitee) (if (>= l bufsize) (begin - (set! (string-length buf) ptr) + (set! (length buf) ptr) (emit buf) (emit emitee) (set! buf (make-string bufsize)) @@ -224,7 +224,7 @@ (else (raise 'string-join-grammar? grammar))))))) (define (split-by-char ch s (max-cuts 0)) - (my l (string-length s) + (my l (length s) (if (zero? l) '() ; The code is doubled for inlining purposes. @@ -257,13 +257,13 @@ (raise 'char? ch)))))) (define (string-null? s) - (zero? (string-length s))) + (zero? (length s))) (define (utf-8->c16string s) (collect-string \c16string (lambda (emit) (my sp 0 - (while (< sp (string-length s)) + (while (< sp (length s)) (my c s[sp] (incr! sp) (if (char>? c #\U+7F) Index: symbols.wisp =================================================================== RCS file: /cvsroot/wisp/wisp/src/builtin/symbols.wisp,v retrieving revision 1.5 retrieving revision 1.6 diff -u -d -r1.5 -r1.6 --- symbols.wisp 26 Aug 2002 16:13:00 -0000 1.5 +++ symbols.wisp 7 Sep 2002 22:00:41 -0000 1.6 @@ -13,7 +13,7 @@ (%symbol->string s)[i]) (define (symbol-length s) - (string-length (%symbol->string s))) + (length (%symbol->string s))) (define (symbol-prefix s) (symbol-ref s 0)) Index: sys.wisp =================================================================== RCS file: /cvsroot/wisp/wisp/src/builtin/sys.wisp,v retrieving revision 1.110 retrieving revision 1.111 diff -u -d -r1.110 -r1.111 --- sys.wisp 7 Sep 2002 21:59:27 -0000 1.110 +++ sys.wisp 7 Sep 2002 22:00:41 -0000 1.111 @@ -219,7 +219,7 @@ ((cc) (set! cc (cdr datum))))) data) (set! cc (string-copy cc)) - (if (not (= (string-length cc) (system-constant 'termios 'NCCS))) + (if (not (= (length cc) (system-constant 'termios 'NCCS))) (raise 'invalid cc)) (my buffer (string-append (pack-le-integer iflag 4) Index: tostring.wisp =================================================================== RCS file: /cvsroot/wisp/wisp/src/builtin/tostring.wisp,v retrieving revision 1.77 retrieving revision 1.78 diff -u -d -r1.77 -r1.78 --- tostring.wisp 7 Sep 2002 21:59:27 -0000 1.77 +++ tostring.wisp 7 Sep 2002 22:00:41 -0000 1.78 @@ -18,7 +18,7 @@ (define (stringify-address obj) (my adr (integer->string (address-of obj) 16) - "[$,(make-string (- 8 (string-length adr)) #\0)$,[adr]]")) + "[$,(make-string (- 8 (length adr)) #\0)$,[adr]]")) (define (topocopy s (full-analysis? #f)) (let ((seen '()) @@ -163,7 +163,7 @@ (emit "#\\U+") (my c (string-upcase (integer->string (char->integer s) 16)) - (my d (- 4 (string-length c)) + (my d (- 4 (length c)) (if (positive? d) (emit (make-string d #\0)))) (emit c))))) @@ -172,7 +172,7 @@ ((c8string? s)) ((c16string? s) (emit "#c16"))) (emit #\") - (my l (string-length s) + (my l (length s) (my i 0 (while (< i l) (case s[i] ch @@ -194,7 +194,7 @@ (my c (string-upcase (integer->string (char->integer ch) 16)) - (case (string-length c) + (case (length c) ((1 3) (emit #\0)) ((2 4))) (emit c) |