Commit 82be24e8 authored by Niels Möller's avatar Niels Möller
Browse files

* src/scm/make-char-classes.scm: In scsh-0.6, the procedures

ascii-range->char-set and char-set-members are renamed to
ucs-range->char-set and char-set->list.
* src/scm/guile-compat.scm: Renamed the corresponding
compatibility functions

Rev: src/scm/guile-compat.scm:1.3.4.1
Rev: src/scm/make-char-classes.scm:1.3.4.1
parent 7556a87c
......@@ -35,7 +35,7 @@
(define (is-in-charset? set n)
(not (zero? (char->integer (string-ref set n)))))
(define (char-set-members char-set)
(define (char-set->list char-set)
(define (helper n)
(cond ((>= n 256) '())
((is-in-charset? char-set n) (cons (integer->char n)
......@@ -43,7 +43,8 @@
(else (helper (1+ n)))))
(helper 0))
(define (ascii-range->char-set lower upper)
; NOTE: Supports only ascii/latin1
(define (ucs-range->char-set lower upper)
(do ((result (make-string 256 (integer->char 0)))
(i lower (+ i 1)))
((= i upper) result)
......
......@@ -83,7 +83,7 @@
((symbol? o)
(cdr (assq o names)))
((and (pair? o) (not (pair? (cdr o))))
(ascii-range->char-set (->ascii (car o))
(ucs-range->char-set (->ascii (car o))
(+ 1 (->ascii (cdr o)))))
((list? o)
(reduce char-set-union (chars->char-set
......@@ -142,9 +142,9 @@
(if (tree/leaf? tree)
(list 'leaf
(tree/index tree)
(char-set-members (tree/set tree)))
(char-set->list (tree/set tree)))
(list 'node
(char-set-members (tree/set tree))
(char-set->list (tree/set tree))
(tree-describe (tree/left tree))
(tree-describe (tree/right tree)) )))
......@@ -152,13 +152,13 @@
(let ((cache (map (lambda (tree) (cons (tree/set tree) tree))
initial)))
(lambda (set)
(debug "cache: ~s\n" (map (lambda (pair) (char-set-members (car pair)))
(debug "cache: ~s\n" (map (lambda (pair) (char-set->list (car pair)))
cache))
(cond ((char-set-assoc set cache)
=> cdr)
(else
(let ((new (make-tree set)))
(debug "Adding set ~s\n" (char-set-members set))
(debug "Adding set ~s\n" (char-set->list set))
(set! cache (cons (cons set new) cache))
new))))))
......@@ -244,7 +244,7 @@
(let ((flag (tree/index leaf)))
(for-each (lambda (c)
(vector-set! table (char->ascii c) flag))
(char-set-members (tree/set leaf)))))
(char-set->list (tree/set leaf)))))
leafs)
table))
......@@ -333,4 +333,5 @@
(make-char-classes test-2-input))
(define (main . ignored)
(make-char-classes (read)))
(make-char-classes (read))
(exit 0))
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment