svn: r4379
This commit is contained in:
Matthew Flatt 2006-09-19 00:39:51 +00:00
parent 77f16ca00b
commit d3b96f936e
28 changed files with 9289 additions and 7255 deletions

View File

@ -1,708 +1,39 @@
;pregexp.ss
;Portable regular expressions for Scheme
;Dorai Sitaram
;http://www.ccs.neu.edu/~dorai/pregexp/pregexp.html
;; Originally:
;; ;Portable regular expressions for Scheme
;; ;Dorai Sitaram
;; ;http://www.ccs.neu.edu/~dorai/pregexp/pregexp.html
;; but `pregexp' functionality is now built into MzScheme, so
;; this is mostly a wrapper module.
(module pregexp mzscheme
(provide pregexp
pregexp-match-positions
pregexp-match
pregexp-split
pregexp-replace
pregexp-replace*
pregexp-quote
*pregexp-comment-char*)
(require (lib "string.ss")
(lib "kw.ss"))
(provide pregexp
pregexp-match-positions
pregexp-match
pregexp-split
pregexp-replace
pregexp-replace*
(rename regexp-quote pregexp-quote))
;Configured for Scheme dialect plt by scmxlate, v 2004-09-08,
;(c) Dorai Sitaram,
;http://www.ccs.neu.edu/~dorai/scmxlate/scmxlate.html
(define *pregexp-version* 20050502)
(define *pregexp-comment-char* #\;)
(define *pregexp-space-sensitive?* #t)
(define pregexp-error
(lambda whatever
(display "Error:")
(for-each (lambda (x) (display #\space) (write x)) whatever)
(newline)
(error "pregexp-error")))
(define pregexp-read-pattern
(lambda (s i n)
(if (>= i n)
(list (list ':or (list ':seq)) i)
(let loop ((branches '()) (i i))
(if (or (>= i n) (char=? (string-ref s i) #\)))
(list (cons ':or (reverse! branches)) i)
(let ((vv
(pregexp-read-branch
s
(if (char=? (string-ref s i) #\|) (+ i 1) i)
n)))
(loop (cons (car vv) branches) (cadr vv))))))))
(define pregexp-read-branch
(lambda (s i n)
(let loop ((pieces '()) (i i))
(cond
((>= i n) (list (cons ':seq (reverse! pieces)) i))
((let ((c (string-ref s i))) (or (char=? c #\|) (char=? c #\))))
(list (cons ':seq (reverse! pieces)) i))
(else
(let ((vv (pregexp-read-piece s i n)))
(loop (cons (car vv) pieces) (cadr vv))))))))
(define pregexp-read-piece
(lambda (s i n)
(let ((c (string-ref s i)))
(case c
((#\^) (list ':bos (+ i 1)))
((#\$) (list ':eos (+ i 1)))
((#\.) (pregexp-wrap-quantifier-if-any (list ':any (+ i 1)) s n))
((#\[)
(let ((i+1 (+ i 1)))
(pregexp-wrap-quantifier-if-any
(case (and (< i+1 n) (string-ref s i+1))
((#\^)
(let ((vv (pregexp-read-char-list s (+ i 2) n)))
(list (list ':neg-char (car vv)) (cadr vv))))
(else (pregexp-read-char-list s i+1 n)))
s
n)))
((#\()
(pregexp-wrap-quantifier-if-any
(pregexp-read-subpattern s (+ i 1) n)
s
n))
((#\\)
(pregexp-wrap-quantifier-if-any
(cond
((pregexp-read-escaped-number s i n)
=>
(lambda (num-i) (list (list ':backref (car num-i)) (cadr num-i))))
((pregexp-read-escaped-char s i n)
=>
(lambda (char-i) (list (car char-i) (cadr char-i))))
(else (pregexp-error 'pregexp-read-piece 'backslash)))
s
n))
(else
(if (or *pregexp-space-sensitive?*
(and (not (char-whitespace? c))
(not (char=? c *pregexp-comment-char*))))
(pregexp-wrap-quantifier-if-any (list c (+ i 1)) s n)
(let loop ((i i) (in-comment? #f))
(if (>= i n)
(list ':empty i)
(let ((c (string-ref s i)))
(cond
(in-comment? (loop (+ i 1) (not (char=? c #\newline))))
((char-whitespace? c) (loop (+ i 1) #f))
((char=? c *pregexp-comment-char*) (loop (+ i 1) #t))
(else (list ':empty i))))))))))))
(define pregexp-read-escaped-number
(lambda (s i n)
(and (< (+ i 1) n)
(let ((c (string-ref s (+ i 1))))
(and (char-numeric? c)
(let loop ((i (+ i 2)) (r (list c)))
(if (>= i n)
(list (string->number (list->string (reverse! r))) i)
(let ((c (string-ref s i)))
(if (char-numeric? c)
(loop (+ i 1) (cons c r))
(list
(string->number (list->string (reverse! r)))
i))))))))))
(define pregexp-read-escaped-char
(lambda (s i n)
(and (< (+ i 1) n)
(let ((c (string-ref s (+ i 1))))
(case c
((#\b) (list ':wbdry (+ i 2)))
((#\B) (list ':not-wbdry (+ i 2)))
((#\d) (list ':digit (+ i 2)))
((#\D) (list '(:neg-char :digit) (+ i 2)))
((#\n) (list #\newline (+ i 2)))
((#\r) (list #\return (+ i 2)))
((#\s) (list ':space (+ i 2)))
((#\S) (list '(:neg-char :space) (+ i 2)))
((#\t) (list #\tab (+ i 2)))
((#\w) (list ':word (+ i 2)))
((#\W) (list '(:neg-char :word) (+ i 2)))
(else (list c (+ i 2))))))))
(define pregexp-read-posix-char-class
(lambda (s i n)
(let ((neg? #f))
(let loop ((i i) (r (list #\:)))
(if (>= i n)
(pregexp-error 'pregexp-read-posix-char-class)
(let ((c (string-ref s i)))
(cond
((char=? c #\^) (set! neg? #t) (loop (+ i 1) r))
((char-alphabetic? c) (loop (+ i 1) (cons c r)))
((char=? c #\:)
(if (or (>= (+ i 1) n) (not (char=? (string-ref s (+ i 1)) #\])))
(pregexp-error 'pregexp-read-posix-char-class)
(let ((posix-class
(string->symbol (list->string (reverse! r)))))
(list
(if neg? (list ':neg-char posix-class) posix-class)
(+ i 2)))))
(else (pregexp-error 'pregexp-read-posix-char-class)))))))))
(define pregexp-read-cluster-type
(lambda (s i n)
(let ((c (string-ref s i)))
(case c
((#\?)
(let ((i (+ i 1)))
(case (string-ref s i)
((#\:) (list '() (+ i 1)))
((#\=) (list '(:lookahead) (+ i 1)))
((#\!) (list '(:neg-lookahead) (+ i 1)))
((#\>) (list '(:no-backtrack) (+ i 1)))
((#\<)
(list
(case (string-ref s (+ i 1))
((#\=) '(:lookbehind))
((#\!) '(:neg-lookbehind))
(else (pregexp-error 'pregexp-read-cluster-type)))
(+ i 2)))
(else
(let loop ((i i) (r '()) (inv? #f))
(let ((c (string-ref s i)))
(case c
((#\-) (loop (+ i 1) r #t))
((#\i)
(loop
(+ i 1)
(cons (if inv? ':case-sensitive ':case-insensitive) r)
#f))
((#\x)
(set! *pregexp-space-sensitive?* inv?)
(loop (+ i 1) r #f))
((#\:) (list r (+ i 1)))
(else (pregexp-error 'pregexp-read-cluster-type)))))))))
(else (list '(:sub) i))))))
(define pregexp-read-subpattern
(lambda (s i n)
(let* ((remember-space-sensitive? *pregexp-space-sensitive?*)
(ctyp-i (pregexp-read-cluster-type s i n))
(ctyp (car ctyp-i))
(i (cadr ctyp-i))
(vv (pregexp-read-pattern s i n)))
(set! *pregexp-space-sensitive?* remember-space-sensitive?)
(let ((vv-re (car vv)) (vv-i (cadr vv)))
(if (and (< vv-i n) (char=? (string-ref s vv-i) #\)))
(list
(let loop ((ctyp ctyp) (re vv-re))
(if (null? ctyp) re (loop (cdr ctyp) (list (car ctyp) re))))
(+ vv-i 1))
(pregexp-error 'pregexp-read-subpattern))))))
(define pregexp-wrap-quantifier-if-any
(lambda (vv s n)
(let ((re (car vv)))
(let loop ((i (cadr vv)))
(if (>= i n)
vv
(let ((c (string-ref s i)))
(if (and (char-whitespace? c) (not *pregexp-space-sensitive?*))
(loop (+ i 1))
(case c
((#\* #\+ #\? #\{)
(let* ((new-re
(list ':between 'minimal? 'at-least 'at-most re))
(new-vv (list new-re 'next-i)))
(case c
((#\*)
(set-car! (cddr new-re) 0)
(set-car! (cdddr new-re) #f))
((#\+)
(set-car! (cddr new-re) 1)
(set-car! (cdddr new-re) #f))
((#\?)
(set-car! (cddr new-re) 0)
(set-car! (cdddr new-re) 1))
((#\{)
(let ((pq (pregexp-read-nums s (+ i 1) n)))
(if (not pq)
(pregexp-error
'pregexp-wrap-quantifier-if-any
'left-brace-must-be-followed-by-number))
(set-car! (cddr new-re) (car pq))
(set-car! (cdddr new-re) (cadr pq))
(set! i (caddr pq)))))
(let loop ((i (+ i 1)))
(if (>= i n)
(begin
(set-car! (cdr new-re) #f)
(set-car! (cdr new-vv) i))
(let ((c (string-ref s i)))
(cond
((and (char-whitespace? c)
(not *pregexp-space-sensitive?*))
(loop (+ i 1)))
((char=? c #\?)
(set-car! (cdr new-re) #t)
(set-car! (cdr new-vv) (+ i 1)))
(else
(set-car! (cdr new-re) #f)
(set-car! (cdr new-vv) i))))))
new-vv))
(else vv)))))))))
(define pregexp-read-nums
(lambda (s i n)
(let loop ((p '()) (q '()) (k i) (reading 1))
(if (>= k n) (pregexp-error 'pregexp-read-nums))
(let ((c (string-ref s k)))
(cond
((char-numeric? c)
(if (= reading 1)
(loop (cons c p) q (+ k 1) 1)
(loop p (cons c q) (+ k 1) 2)))
((and (char-whitespace? c) (not *pregexp-space-sensitive?*))
(loop p q (+ k 1) reading))
((and (char=? c #\,) (= reading 1)) (loop p q (+ k 1) 2))
((char=? c #\})
(let ((p (string->number (list->string (reverse! p))))
(q (string->number (list->string (reverse! q)))))
(cond
((and (not p) (= reading 1)) (list 0 #f k))
((= reading 1) (list p p k))
(else (list p q k)))))
(else #f))))))
(define pregexp-invert-char-list
(lambda (vv) (set-car! (car vv) ':none-of-chars) vv))
(define pregexp-read-char-list
(lambda (s i n)
(let loop ((r '()) (i i))
(if (>= i n)
(pregexp-error 'pregexp-read-char-list 'character-class-ended-too-soon)
(let ((c (string-ref s i)))
(case c
((#\])
(if (null? r)
(loop (cons c r) (+ i 1))
(list (cons ':one-of-chars (reverse! r)) (+ i 1))))
((#\\)
(let ((char-i (pregexp-read-escaped-char s i n)))
(if char-i
(loop (cons (car char-i) r) (cadr char-i))
(pregexp-error 'pregexp-read-char-list 'backslash))))
((#\-)
(if (or (null? r)
(let ((i+1 (+ i 1)))
(and (< i+1 n) (char=? (string-ref s i+1) #\]))))
(loop (cons c r) (+ i 1))
(let ((c-prev (car r)))
(if (char? c-prev)
(loop
(cons
(list ':char-range c-prev (string-ref s (+ i 1)))
(cdr r))
(+ i 2))
(loop (cons c r) (+ i 1))))))
((#\[)
(if (char=? (string-ref s (+ i 1)) #\:)
(let ((posix-char-class-i
(pregexp-read-posix-char-class s (+ i 2) n)))
(loop
(cons (car posix-char-class-i) r)
(cadr posix-char-class-i)))
(loop (cons c r) (+ i 1))))
(else (loop (cons c r) (+ i 1)))))))))
(define pregexp-string-match
(lambda (s1 s i n sk fk)
(let ((n1 (string-length s1)))
(if (> n1 n)
(fk)
(let loop ((j 0) (k i))
(cond
((>= j n1) (sk k))
((>= k n) (fk))
((char=? (string-ref s1 j) (string-ref s k)) (loop (+ j 1) (+ k 1)))
(else (fk))))))))
(define pregexp-char-word?
(lambda (c) (or (char-alphabetic? c) (char-numeric? c) (char=? c #\_))))
(define pregexp-at-word-boundary?
(lambda (s i n)
(or (= i 0)
(>= i n)
(let ((c/i (string-ref s i)) (c/i-1 (string-ref s (- i 1))))
(let ((c/i/w? (pregexp-check-if-in-char-class? c/i ':word))
(c/i-1/w? (pregexp-check-if-in-char-class? c/i-1 ':word)))
(or (and c/i/w? (not c/i-1/w?)) (and (not c/i/w?) c/i-1/w?)))))))
(define pregexp-check-if-in-char-class?
(lambda (c char-class)
(case char-class
((:any) (not (char=? c #\newline)))
((:alnum) (or (char-alphabetic? c) (char-numeric? c)))
((:alpha) (char-alphabetic? c))
((:ascii) (< (char->integer c) 128))
((:blank) (or (char=? c #\space) (char=? c #\tab)))
((:cntrl) (< (char->integer c) 32))
((:digit) (char-numeric? c))
((:graph) (and (>= (char->integer c) 32) (not (char-whitespace? c))))
((:lower) (char-lower-case? c))
((:print) (>= (char->integer c) 32))
((:punct)
(and (>= (char->integer c) 32)
(not (char-whitespace? c))
(not (char-alphabetic? c))
(not (char-numeric? c))))
((:space) (char-whitespace? c))
((:upper) (char-upper-case? c))
((:word) (or (char-alphabetic? c) (char-numeric? c) (char=? c #\_)))
((:xdigit)
(or (char-numeric? c)
(char-ci=? c #\a)
(char-ci=? c #\b)
(char-ci=? c #\c)
(char-ci=? c #\d)
(char-ci=? c #\e)
(char-ci=? c #\f)))
(else (pregexp-error 'pregexp-check-if-in-char-class?)))))
(define pregexp-list-ref
(lambda (s i)
(let loop ((s s) (k 0))
(cond ((null? s) #f) ((= k i) (car s)) (else (loop (cdr s) (+ k 1)))))))
(define pregexp-make-backref-list
(lambda (re)
(let sub ((re re))
(if (pair? re)
(let ((car-re (car re)) (sub-cdr-re (sub (cdr re))))
(if (eqv? car-re ':sub)
(cons (cons re #f) sub-cdr-re)
(append (sub car-re) sub-cdr-re)))
'()))))
(define pregexp-match-positions-aux
(lambda (re s sn start n i)
(let ((identity (lambda (x) x))
(backrefs (pregexp-make-backref-list re))
(case-sensitive? #t))
(let sub ((re re) (i i) (sk identity) (fk (lambda () #f)))
(cond
((eqv? re ':bos) (if (= i start) (sk i) (fk)))
((eqv? re ':eos) (if (>= i n) (sk i) (fk)))
((eqv? re ':empty) (sk i))
((eqv? re ':wbdry) (if (pregexp-at-word-boundary? s i n) (sk i) (fk)))
((eqv? re ':not-wbdry)
(if (pregexp-at-word-boundary? s i n) (fk) (sk i)))
((and (char? re) (< i n))
(if ((if case-sensitive? char=? char-ci=?) (string-ref s i) re)
(sk (+ i 1))
(fk)))
((and (not (pair? re)) (< i n))
(if (pregexp-check-if-in-char-class? (string-ref s i) re)
(sk (+ i 1))
(fk)))
((and (pair? re) (eqv? (car re) ':char-range) (< i n))
(let ((c (string-ref s i)))
(if (let ((c< (if case-sensitive? char<=? char-ci<=?)))
(and (c< (cadr re) c) (c< c (caddr re))))
(sk (+ i 1))
(fk))))
((pair? re)
(case (car re)
((:char-range)
(if (>= i n) (fk) (pregexp-error 'pregexp-match-positions-aux)))
((:one-of-chars)
(if (>= i n)
(fk)
(let loup-one-of-chars ((chars (cdr re)))
(if (null? chars)
(fk)
(sub
(car chars)
i
sk
(lambda () (loup-one-of-chars (cdr chars))))))))
((:neg-char)
(if (>= i n)
(fk)
(sub (cadr re) i (lambda (i1) (fk)) (lambda () (sk (+ i 1))))))
((:seq)
(let loup-seq ((res (cdr re)) (i i))
(if (null? res)
(sk i)
(sub (car res) i (lambda (i1) (loup-seq (cdr res) i1)) fk))))
((:or)
(let loup-or ((res (cdr re)))
(if (null? res)
(fk)
(sub
(car res)
i
(lambda (i1) (or (sk i1) (loup-or (cdr res))))
(lambda () (loup-or (cdr res)))))))
((:backref)
(let* ((c (pregexp-list-ref backrefs (cadr re)))
(backref
(cond
(c => cdr)
(else
(pregexp-error
'pregexp-match-positions-aux
'non-existent-backref
re)
#f))))
(if backref
(pregexp-string-match
(substring s (car backref) (cdr backref))
s
i
n
(lambda (i) (sk i))
fk)
(sk i))))
((:sub)
(sub
(cadr re)
i
(lambda (i1) (set-cdr! (assv re backrefs) (cons i i1)) (sk i1))
fk))
((:lookahead)
(let ((found-it? (sub (cadr re) i identity (lambda () #f))))
(if found-it? (sk i) (fk))))
((:neg-lookahead)
(let ((found-it? (sub (cadr re) i identity (lambda () #f))))
(if found-it? (fk) (sk i))))
((:lookbehind)
(let ((n-actual n) (sn-actual sn))
(set! n i)
(set! sn i)
(let ((found-it?
(sub
(list ':seq '(:between #f 0 #f :any) (cadr re) ':eos)
0
identity
(lambda () #f))))
(set! n n-actual)
(set! sn sn-actual)
(if found-it? (sk i) (fk)))))
((:neg-lookbehind)
(let ((n-actual n) (sn-actual sn))
(set! n i)
(set! sn i)
(let ((found-it?
(sub
(list ':seq '(:between #f 0 #f :any) (cadr re) ':eos)
0
identity
(lambda () #f))))
(set! n n-actual)
(set! sn sn-actual)
(if found-it? (fk) (sk i)))))
((:no-backtrack)
(let ((found-it? (sub (cadr re) i identity (lambda () #f))))
(if found-it? (sk found-it?) (fk))))
((:case-sensitive :case-insensitive)
(let ((old case-sensitive?))
(set! case-sensitive? (eqv? (car re) ':case-sensitive))
(sub
(cadr re)
i
(lambda (i1) (set! case-sensitive? old) (sk i1))
(lambda () (set! case-sensitive? old) (fk)))))
((:between)
(let* ((maximal? (not (cadr re)))
(p (caddr re))
(q (cadddr re))
(could-loop-infinitely? (and maximal? (not q)))
(re (car (cddddr re))))
(let loup-p ((k 0) (i i))
(if (< k p)
(sub
re
i
(lambda (i1)
(if (and could-loop-infinitely? (= i1 i))
(pregexp-error
'pregexp-match-positions-aux
'greedy-quantifier-operand-could-be-empty))
(loup-p (+ k 1) i1))
fk)
(let ((q (and q (- q p))))
(let loup-q ((k 0) (i i))
(let ((fk (lambda () (sk i))))
(if (and q (>= k q))
(fk)
(if maximal?
(sub
re
i
(lambda (i1)
(if (and could-loop-infinitely? (= i1 i))
(pregexp-error
'pregexp-match-positions-aux
'greedy-quantifier-operand-could-be-empty))
(or (loup-q (+ k 1) i1) (fk)))
fk)
(or (fk)
(sub
re
i
(lambda (i1) (loup-q (+ k 1) i1))
fk)))))))))))
(else (pregexp-error 'pregexp-match-positions-aux))))
((>= i n) (fk))
(else (pregexp-error 'pregexp-match-positions-aux))))
(let ((backrefs (map cdr backrefs))) (and (car backrefs) backrefs)))))
(define pregexp-replace-aux
(lambda (str ins n backrefs)
(let loop ((i 0) (r ""))
(if (>= i n)
r
(let ((c (string-ref ins i)))
(if (char=? c #\\)
(let* ((br-i (pregexp-read-escaped-number ins i n))
(br
(if br-i
(car br-i)
(if (char=? (string-ref ins (+ i 1)) #\&) 0 #f)))
(i (if br-i (cadr br-i) (if br (+ i 2) (+ i 1)))))
(if (not br)
(let ((c2 (string-ref ins i)))
(loop
(+ i 1)
(if (char=? c2 #\$) r (string-append r (string c2)))))
(loop
i
(let ((backref (pregexp-list-ref backrefs br)))
(if backref
(string-append
r
(substring str (car backref) (cdr backref)))
r)))))
(loop (+ i 1) (string-append r (string c)))))))))
(define pregexp
(lambda (s)
(set! *pregexp-space-sensitive?* #t)
(list ':sub (car (pregexp-read-pattern s 0 (string-length s))))))
(define pregexp-match-positions
(lambda (pat str . opt-args)
(define (pattern->pregexp pattern)
(cond
((string? pat) (set! pat (pregexp pat)))
((pair? pat) #t)
(else
(pregexp-error
'pregexp-match-positions
'pattern-must-be-compiled-or-string-regexp
pat)))
(let* ((str-len (string-length str))
(start
(if (null? opt-args)
0
(let ((start (car opt-args)))
(set! opt-args (cdr opt-args))
start)))
(end (if (null? opt-args) str-len (car opt-args))))
(let loop ((i start))
(and (<= i end)
(or (pregexp-match-positions-aux pat str str-len start end i)
(loop (+ i 1))))))))
[(bytes? pattern) (byte-pregexp pattern)]
[(string? pattern) (pregexp pattern)]
[else pattern]))
(define pregexp-match
(lambda (pat str . opt-args)
(let ((ix-prs (apply pregexp-match-positions pat str opt-args)))
(and ix-prs
(map
(lambda (ix-pr)
(and ix-pr (substring str (car ix-pr) (cdr ix-pr))))
ix-prs)))))
(define/kw (pregexp-match pattern input #:optional [start-k 0] [end-k #f] [output-port #f])
(regexp-match (pattern->pregexp pattern) input start-k end-k output-port))
(define pregexp-split
(lambda (pat str)
(let ((n (string-length str)))
(let loop ((i 0) (r '()) (picked-up-one-undelimited-char? #f))
(cond
((>= i n) (reverse! r))
((pregexp-match-positions pat str i n)
=>
(lambda (y)
(let ((jk (car y)))
(let ((j (car jk)) (k (cdr jk)))
(cond
((= j k) (loop (+ k 1) (cons (substring str i (+ j 1)) r) #t))
((and (= j i) picked-up-one-undelimited-char?) (loop k r #f))
(else (loop k (cons (substring str i j) r) #f)))))))
(else (loop n (cons (substring str i n) r) #f)))))))
(define/kw (pregexp-match-positions pattern input #:optional [start-k 0] [end-k #f] [output-port #f])
(regexp-match (pattern->pregexp pattern) input start-k end-k output-port))
(define/kw (pregexp-split pattern string #:optional [start 0] [end #f])
(pregexp-split (pattern->pregexp pattern) string start end))
(define pregexp-replace
(lambda (pat str ins)
(let* ((n (string-length str)) (pp (pregexp-match-positions pat str 0 n)))
(if (not pp)
str
(let ((m-i (caar pp)) (m-n (cdar pp)))
(string-append
(substring str 0 m-i)
(if (procedure? ins)
(apply ins
(map (lambda (p)
(substring str (car p) (cdr p)))
pp))
(pregexp-replace-aux str ins (string-length ins) pp))
(substring str m-n n)))))))
(define/kw (pregexp-replace pattern input insert)
(regexp-replace (pattern->pregexp pattern) input insert))
(define pregexp-replace*
(lambda (pat str ins)
(let ((pat (if (string? pat) (pregexp pat) pat))
(n (string-length str))
(ins-len (and (string? ins)
(string-length ins))))
(let loop ((i 0) (r ""))
(if (>= i n)
r
(let ((pp (pregexp-match-positions pat str i n)))
(if (not pp)
(if (= i 0) str (string-append r (substring str i n)))
(loop
(cdar pp)
(string-append
r
(substring str i (caar pp))
(if (procedure? ins)
(apply ins
(map (lambda (p)
(substring str (car p) (cdr p)))
pp))
(pregexp-replace-aux str ins ins-len pp)))))))))))
(define pregexp-quote
(lambda (s)
(let loop ((i (- (string-length s) 1)) (r '()))
(if (< i 0)
(list->string r)
(loop
(- i 1)
(let ((c (string-ref s i)))
(if (memv
c
'(#\\ #\. #\? #\* #\+ #\| #\^ #\$ #\[ #\] #\{ #\} #\( #\)))
(cons #\\ (cons c r))
(cons c r))))))))
)
(define/kw (pregexp-replace* pattern input insert)
(regexp-replace* (pattern->pregexp pattern) input insert)))

View File

@ -302,9 +302,14 @@
/************** x86/FreeBSD with gcc ****************/
# if defined(__FreeBSD__) && defined(i386)
# if defined(__FreeBSD__) && (defined(i386) || defined(__x86_64__))
#if defined(i386)
# define SCHEME_PLATFORM_LIBRARY_SUBPATH "i386-freebsd"
#endif
#if defined(__x86_64__)
# define SCHEME_PLATFORM_LIBRARY_SUBPATH "x86_64-freebsd"
#endif
# include "uconfig.h"
# undef HAS_STANDARD_IOB
@ -318,7 +323,6 @@
# define USE_UNDERSCORE_SETJMP
# define USE_IEEE_FP_PREDS
# define FREEBSD_CONTROL_387
# define POW_HANDLES_INF_CORRECTLY
# define USE_DYNAMIC_FDSET_SIZE
@ -329,8 +333,13 @@
# define REGISTER_POOR_MACHINE
#if defined(__x86_64__)
# define MZ_USE_JIT_X86_64
# define MZ_JIT_USE_MPROTECT
#else
# define MZ_USE_JIT_I386
# define MZ_JIT_USE_MPROTECT
#endif
# define FLAGS_ALREADY_SET
@ -1126,15 +1135,15 @@
'387 with Microsoft-style _control87. DONT_IGNORE_PIPE_SIGNAL can
be on or off. */
/* FREEBSD_CONTROL_387 controls the floating-point processor under i386
FreeBSD */
/* LINUX_CONTROL_387 controls the floating-point processor under i386
Linux using __setfpucw(). libc 6.1 doesn't export __setfpucw() and
it doesn't matter; for Linux 2.0 and up, the default FP behavior
is the one we want. This flag might be needed for older versions
of Linux. */
/* FREEBSD_CONTROL_387 controls the floating-point processor under i386
FreeBSD. As for Linux, this does not appear necessary anymore. */
/* APLHA_CONTROL_FP controls the floating-point processor for Alpha
OSF1 */

View File

@ -291,7 +291,7 @@ read.@LTO@: $(srcdir)/schpriv.h $(srcdir)/schexn.h $(SCONFIG) $(srcdir)/../inclu
$(srcdir)/../src/schcpt.h $(srcdir)/schvers.h $(srcdir)/schminc.h \
$(srcdir)/../src/stypes.h $(srcdir)/mzmark.c
regexp.@LTO@: $(srcdir)/schpriv.h $(srcdir)/schexn.h $(SCONFIG) $(srcdir)/../include/scheme.h \
$(srcdir)/../src/stypes.h $(srcdir)/mzmark.c
$(srcdir)/../src/stypes.h $(srcdir)/mzmark.c $(srcdir)/schrx.h
setjmpup.@LTO@: $(srcdir)/schpriv.h $(srcdir)/schexn.h $(SCONFIG) $(srcdir)/../include/scheme.h \
$(srcdir)/../src/stypes.h $(srcdir)/schmach.h
string.@LTO@: $(srcdir)/schpriv.h $(srcdir)/schexn.h $(SCONFIG) $(srcdir)/../include/scheme.h \

File diff suppressed because it is too large Load Diff

View File

@ -33,10 +33,7 @@ int scheme_hash_iteration_count;
#ifdef MZ_PRECISE_GC
static short keygen;
XFORM_NONGCING static
#ifndef NO_INLINE_KEYWORD
MSC_IZE(inline)
#endif
XFORM_NONGCING static MZ_INLINE
long PTR_TO_LONG(Scheme_Object *o)
{
short v;
@ -257,32 +254,115 @@ static Scheme_Object *do_hash(Scheme_Hash_Table *table, Scheme_Object *key, int
return val;
}
static Scheme_Object *do_hash_set(Scheme_Hash_Table *table, Scheme_Object *key, Scheme_Object *val)
{
Scheme_Object *tkey, **keys;
hash_v_t h, h2, useme = 0;
unsigned long mask;
unsigned long lkey;
int set = 2;
mask = table->size - 1;
lkey = (unsigned long)PTR_TO_LONG((Scheme_Object *)key);
h = (lkey >> 2) & mask;
h2 = (lkey >> 3) & mask;
h2 |= 1;
keys = table->keys;
scheme_hash_request_count++;
while ((tkey = keys[h])) {
if (SAME_PTR(tkey, key)) {
table->vals[h] = val;
if (!val) {
keys[h] = GONE;
--table->count;
}
return val;
} else if (SAME_PTR(tkey, GONE)) {
if (set > 1) {
useme = h;
set = 1;
}
}
scheme_hash_iteration_count++;
h = (h + h2) & mask;
}
if (set == 1)
h = useme;
else if (table->mcount * FILL_FACTOR >= table->size) {
/* Use slow path to grow table: */
return do_hash(table, key, 2, val);
} else {
table->mcount++;
}
table->count++;
table->keys[h] = key;
table->vals[h] = val;
return val;
}
static Scheme_Object *do_hash_get(Scheme_Hash_Table *table, Scheme_Object *key)
{
Scheme_Object *tkey, **keys;
hash_v_t h, h2;
unsigned long mask;
unsigned long lkey;
mask = table->size - 1;
lkey = (unsigned long)PTR_TO_LONG((Scheme_Object *)key);
h = (lkey >> 2) & mask;
h2 = (lkey >> 3) & mask;
h2 |= 1;
keys = table->keys;
scheme_hash_request_count++;
while ((tkey = keys[h])) {
if (SAME_PTR(tkey, key)) {
return table->vals[h];
}
scheme_hash_iteration_count++;
h = (h + h2) & mask;
}
return NULL;
}
void scheme_hash_set(Scheme_Hash_Table *table, Scheme_Object *key, Scheme_Object *val)
{
if (!table->vals) {
Scheme_Object **ba;
table->size = 8;
ba = MALLOC_N(Scheme_Object *, table->size);
table->vals = ba;
ba = MALLOC_N(Scheme_Object *, table->size);
table->keys = ba;
}
do_hash(table, key, 2, val);
if (table->make_hash_indices)
do_hash(table, key, 2, val);
else
do_hash_set(table, key, val);
}
Scheme_Object *scheme_hash_get(Scheme_Hash_Table *table, Scheme_Object *key)
{
Scheme_Object *val;
if (!table->vals)
val = NULL;
return NULL;
else if (table->make_hash_indices)
return do_hash(table, key, 0, NULL);
else
val = do_hash(table, key, 0, NULL);
return val;
return do_hash_get(table, key);
}
int scheme_hash_table_equal(Scheme_Hash_Table *t1, Scheme_Hash_Table *t2)

View File

@ -491,11 +491,7 @@ static void emit_indentation(mz_jit_state *jitter)
/* run time */
/*========================================================================*/
static
#ifndef NO_INLINE_KEYWORD
MSC_IZE(inline)
#endif
Scheme_Object *do_make_native_closure(Scheme_Native_Closure_Data *code, int size)
static MZ_INLINE Scheme_Object *do_make_native_closure(Scheme_Native_Closure_Data *code, int size)
{
Scheme_Native_Closure *o;

View File

@ -1537,19 +1537,22 @@ int scheme_is_hash_table_equal(Scheme_Object *o)
static Scheme_Object *hash_table_put(int argc, Scheme_Object *argv[])
{
if (!(SCHEME_HASHTP(argv[0]) && SCHEME_MUTABLEP(argv[0])) && !SCHEME_BUCKTP(argv[0]))
scheme_wrong_type("hash-table-put!", "mutable hash-table", 0, argc, argv);
Scheme_Object *v = argv[0];
if (SCHEME_BUCKTP(argv[0])) {
Scheme_Bucket_Table *t = (Scheme_Bucket_Table *)argv[0];
if (SCHEME_BUCKTP(v)) {
Scheme_Bucket_Table *t = (Scheme_Bucket_Table *)v;
if (t->mutex) scheme_wait_sema(t->mutex,0);
scheme_add_to_table(t, (char *)argv[1], (void *)argv[2], 0);
if (t->mutex) scheme_post_sema(t->mutex);
} else{
Scheme_Hash_Table *t = (Scheme_Hash_Table *)argv[0];
if (t->mutex) scheme_wait_sema(t->mutex, 0);
} else if (!SCHEME_HASHTP(v) || !SCHEME_MUTABLEP(v)) {
scheme_wrong_type("hash-table-put!", "mutable hash-table", 0, argc, argv);
} else if (((Scheme_Hash_Table *)v)->mutex) {
Scheme_Hash_Table *t = (Scheme_Hash_Table *)v;
scheme_wait_sema(t->mutex, 0);
scheme_hash_set(t, argv[1], argv[2]);
if (t->mutex) scheme_post_sema(t->mutex);
scheme_post_sema(t->mutex);
} else {
scheme_hash_set((Scheme_Hash_Table *)v, argv[1], argv[2]);
}
return scheme_void;
@ -1559,19 +1562,23 @@ static Scheme_Object *hash_table_get(int argc, Scheme_Object *argv[])
{
Scheme_Object *v;
if (!(SCHEME_HASHTP(argv[0]) || SCHEME_BUCKTP(argv[0])))
scheme_wrong_type("hash-table-get", "hash-table", 0, argc, argv);
v = argv[0];
if (SCHEME_BUCKTP(argv[0])){
Scheme_Bucket_Table *t = (Scheme_Bucket_Table *)argv[0];
if (SCHEME_BUCKTP(v)) {
Scheme_Bucket_Table *t = (Scheme_Bucket_Table *)v;
if (t->mutex) scheme_wait_sema(t->mutex, 0);
v = (Scheme_Object *)scheme_lookup_in_table(t, (char *)argv[1]);
if (t->mutex) scheme_post_sema(t->mutex);
} else {
Scheme_Hash_Table *t = (Scheme_Hash_Table *)argv[0];
if (t->mutex) scheme_wait_sema(t->mutex, 0);
} else if (!SCHEME_HASHTP(v)) {
scheme_wrong_type("hash-table-get", "hash-table", 0, argc, argv);
return NULL;
} else if (((Scheme_Hash_Table *)v)->mutex) {
Scheme_Hash_Table *t = (Scheme_Hash_Table *)v;
scheme_wait_sema(t->mutex, 0);
v = scheme_hash_get(t, argv[1]);
if (t->mutex) scheme_post_sema(t->mutex);
scheme_post_sema(t->mutex);
} else {
v = scheme_hash_get((Scheme_Hash_Table *)v, argv[1]);
}
if (v)

View File

@ -54,13 +54,22 @@
(indirect cases (list up down title fold combining) 256))
(define general-categories (make-hash-table 'equal))
(hash-table-put! general-categories "Cn" 0)
(define (combine-cat cat)
(hash-table-get general-categories cat
(lambda ()
(let ([v (hash-table-count general-categories)])
(hash-table-put! general-categories cat v)
v))))
;; So they're in order:
(with-input-from-file "schgencat.h"
(lambda ()
(let loop ()
(let ([l (read-line)])
(unless (eof-object? l)
(let ([m (regexp-match #rx"mzu_([A-Z][a-z])" l)])
(when m
(combine-cat (cadr m))))
(loop))))))
(define hexes (map char->integer (string->list "0123456789abcdefABCDEF")))

View File

@ -2,7 +2,7 @@
(define re:start "^START ([a-z]+);")
(define re:end "^END ([a-z]+);")
(define re:form "^([a-zA-Z0-9_]+) {")
(define re:form "^([a-zA-Z0-9_]+) [{]")
(define re:mark "^ mark:")
(define re:size "^ size:")

View File

@ -4231,6 +4231,7 @@ static int mark_regexp_SIZE(void *p) {
static int mark_regexp_MARK(void *p) {
regexp *r = (regexp *)p;
gcMARK(r->source);
gcMARK(r->regstart);
return
gcBYTES_TO_WORDS((sizeof(regexp) + r->regsize));
}
@ -4238,6 +4239,7 @@ static int mark_regexp_MARK(void *p) {
static int mark_regexp_FIXUP(void *p) {
regexp *r = (regexp *)p;
gcFIXUP(r->source);
gcFIXUP(r->regstart);
return
gcBYTES_TO_WORDS((sizeof(regexp) + r->regsize));
}
@ -4258,7 +4260,9 @@ static int mark_regwork_MARK(void *p) {
gcMARK(r->port);
gcMARK(r->unless_evt);
gcMARK(r->startp);
gcMARK(r->maybep);
gcMARK(r->endp);
gcMARK(r->counters);
gcMARK(r->peekskip);
return
gcBYTES_TO_WORDS(sizeof(Regwork));
@ -4271,7 +4275,9 @@ static int mark_regwork_FIXUP(void *p) {
gcFIXUP(r->port);
gcFIXUP(r->unless_evt);
gcFIXUP(r->startp);
gcFIXUP(r->maybep);
gcFIXUP(r->endp);
gcFIXUP(r->counters);
gcFIXUP(r->peekskip);
return
gcBYTES_TO_WORDS(sizeof(Regwork));

View File

@ -1708,6 +1708,7 @@ mark_regexp {
regexp *r = (regexp *)p;
mark:
gcMARK(r->source);
gcMARK(r->regstart);
size:
gcBYTES_TO_WORDS((sizeof(regexp) + r->regsize));
}
@ -1720,7 +1721,9 @@ mark_regwork {
gcMARK(r->port);
gcMARK(r->unless_evt);
gcMARK(r->startp);
gcMARK(r->maybep);
gcMARK(r->endp);
gcMARK(r->counters);
gcMARK(r->peekskip);
size:
gcBYTES_TO_WORDS(sizeof(Regwork));

View File

@ -612,11 +612,7 @@ double scheme_real_to_double(Scheme_Object *r)
return 0.0;
}
static
#ifndef NO_INLINE_KEYWORD
MSC_IZE(inline)
#endif
int minus_zero_p(double d)
static MZ_INLINE int minus_zero_p(double d)
{
return (1 / d) < 0;
}

View File

@ -82,21 +82,13 @@ void scheme_init_numcomp(Scheme_Env *env)
}
/* Prototype needed for 3m conversion: */
static
#ifndef NO_INLINE_KEYWORD
MSC_IZE(inline)
#endif
Scheme_Object *force_rat(Scheme_Object *n, Small_Rational *sr);
static MZ_INLINE Scheme_Object *force_rat(Scheme_Object *n, Small_Rational *sr);
#ifdef MZ_XFORM
START_XFORM_SKIP;
#endif
static
#ifndef NO_INLINE_KEYWORD
MSC_IZE(inline)
#endif
Scheme_Object *force_rat(Scheme_Object *n, Small_Rational *sr)
static MZ_INLINE Scheme_Object *force_rat(Scheme_Object *n, Small_Rational *sr)
{
Scheme_Type t = SCHEME_TYPE(n);
if (t == scheme_rational_type)

View File

@ -2247,10 +2247,7 @@ long scheme_get_char_string(const char *who,
}
}
static
#ifndef NO_INLINE_KEYWORD
MSC_IZE(inline)
#endif
static MZ_INLINE
long get_one_byte(const char *who,
Scheme_Object *port,
char *buffer, long offset,

View File

@ -1827,7 +1827,10 @@ print(Scheme_Object *obj, int notdisplay, int compact, Scheme_Hash_Table *ht,
Scheme_Object *src;
src = scheme_regexp_source(obj);
if (src) {
print_utf8_string(pp, "#rx", 0, 3);
if (scheme_is_pregexp(obj))
print_utf8_string(pp, "#px", 0, 3);
else
print_utf8_string(pp, "#rx", 0, 3);
print(src, 1, 0, ht,symtab, rnht, pp);
} else if (compact || !pp->print_unreadable)
cannot_print(pp, notdisplay, obj, ht, compact);

View File

@ -87,11 +87,7 @@ static Scheme_Object *print_honu(int, Scheme_Object *[]);
#define RETURN_FOR_DELIM 0x4
#define RETURN_FOR_COMMENT 0x8
static
#ifndef NO_INLINE_KEYWORD
MSC_IZE(inline)
#endif
long SPAN(Scheme_Object *port, long pos) {
static MZ_INLINE long SPAN(Scheme_Object *port, long pos) {
long cpos;
scheme_tell_all(port, NULL, NULL, &cpos);
return cpos - pos + 1;
@ -1254,7 +1250,9 @@ read_inner_inner(Scheme_Object *port, Scheme_Object *stxsrc, Scheme_Hash_Table *
}
break;
case 'r':
case 'p':
if (!params->honu_mode) {
int orig_ch = ch;
int cnt = 0, is_byte = 0;
char *expect;
@ -1280,11 +1278,13 @@ read_inner_inner(Scheme_Object *port, Scheme_Object *stxsrc, Scheme_Hash_Table *
if (stxsrc)
str = SCHEME_STX_VAL(str);
str = scheme_make_regexp(str, is_byte, &is_err);
str = scheme_make_regexp(str, is_byte, (orig_ch == 'p'), &is_err);
if (is_err) {
scheme_read_err(port, stxsrc, line, col, pos, 2, 0, indentation,
"read: bad regexp string: %s", (char *)str);
"read: bad %sregexp string: %s",
(orig_ch == 'r') ? "" : "p",
(char *)str);
return NULL;
}
@ -1293,7 +1293,7 @@ read_inner_inner(Scheme_Object *port, Scheme_Object *stxsrc, Scheme_Hash_Table *
return str;
}
} else if (ch == 'e') {
} else if ((orig_ch == 'r') && (ch == 'e')) {
expect = "eader";
cnt++;
while (expect[cnt]) {
@ -1336,8 +1336,8 @@ read_inner_inner(Scheme_Object *port, Scheme_Object *stxsrc, Scheme_Hash_Table *
scheme_read_err(port, stxsrc, line, col, pos, SPAN(port, pos),
ch, indentation,
"read: bad syntax `#r%u'",
a, cnt);
"read: bad syntax `#%c%u'",
orig_ch, a, cnt);
return NULL;
}
}

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,34 @@
enum {
mzu_Cn, /* this one should be first */
mzu_Cc,
mzu_Cf,
mzu_Cs,
mzu_Co,
mzu_Ll,
mzu_Lu,
mzu_Lt,
mzu_Lm,
mzu_Lo,
mzu_Nd,
mzu_Nl,
mzu_No,
mzu_Ps,
mzu_Pe,
mzu_Pi,
mzu_Pf,
mzu_Pc,
mzu_Pd,
mzu_Po,
mzu_Mn,
mzu_Mc,
mzu_Me,
mzu_Sc,
mzu_Sk,
mzu_Sm,
mzu_So,
mzu_Zl,
mzu_Zp,
mzu_Zs
};
#define mzu_LAST mzu_Zs

View File

@ -13,7 +13,7 @@
#define USE_COMPILED_STARTUP 1
#define EXPECTED_PRIM_COUNT 866
#define EXPECTED_PRIM_COUNT 871
#ifdef MZSCHEME_SOMETHING_OMITTED
# undef USE_COMPILED_STARTUP

View File

@ -116,6 +116,12 @@ void scheme_clear_ephemerons(void);
#define BITS_PER_MZSHORT (8 * sizeof(mzshort))
#ifndef NO_INLINE_KEYWORD
# define MZ_INLINE MSC_IZE(inline)
#else
# define MZ_INLINE /* empty */
#endif
/*========================================================================*/
/* initialization */
/*========================================================================*/
@ -2545,7 +2551,9 @@ void scheme_reset_hash_table(Scheme_Hash_Table *ht, int *history);
Scheme_Object *scheme_regexp_source(Scheme_Object *re);
int scheme_regexp_is_byte(Scheme_Object *re);
Scheme_Object *scheme_make_regexp(Scheme_Object *str, int byte, int * volatile result_is_err_string);
Scheme_Object *scheme_make_regexp(Scheme_Object *str, int byte, int pcre, int * volatile result_is_err_string);
int scheme_is_pregexp(Scheme_Object *o);
void scheme_clear_rx_buffers(void);
unsigned short * scheme_ucs4_to_utf16(const mzchar *text, int start, int end,
unsigned short *buf, int bufsize,
long *ulen, int term_size);

231
src/mzscheme/src/schrx.h Normal file
View File

@ -0,0 +1,231 @@
/* The INDIRECT_TO_PROGRAM mode can be useful for debugging
in 3m to ensure that a regexp "program" is not misinterpreted
as a pointer by the conservative collector. (This was a problem
once, anyway.) */
/* #define INDIRECT_TO_PROGRAM */
typedef long rxpos;
struct Regwork;
typedef int (*Scheme_Regexp_Matcher)(struct Regwork *rw);
typedef struct regexp {
Scheme_Type type;
MZ_HASH_KEY_EX
Scheme_Object *source;
long nsubexp, ncounter, maxlookback;
long regsize;
short flags;
unsigned char *regstart; /* Infor about required starting bytes */
long regmust; /* pointer relative to self to required starting string */
long regmlen; /* length of the string at regmust */
#ifdef INDIRECT_TO_PROGRAM
char *program;
#else
char program[1]; /* Unwarranted chumminess with compiler. */
#endif
} regexp;
#define REGEXP_IS_UTF8 0x01
#define REGEXP_IS_PCRE 0x02
#define REGEXP_ANCH 0x04
#define REGEXP_MUST_CI 0x08
#define REGEXP_JIT 0x10
#ifdef INDIRECT_TO_PROGRAM
# define N_ITO_DELTA(prog, extra, re) extra
# define N_ITO_SPACE(v) 0
# define ITO(x, y) x
#else
# define N_ITO_DELTA(prog, extra, re) ((prog+extra) - re)
# define N_ITO_SPACE(v) v
# define ITO(x, y) y
#endif
/* 156 is octal 234: */
#define MAGIC 156
/*
* The "internal use only" fields in regexp.h are present to pass info from
* compile to execute that permits the execute phase to run lots faster on
* simple cases. They are:
*
* regstart bitmap for chars that must begin a match; NULL if none obvious
* reganch is the match anchored (at beginning-of-line only)?
* regmust string (pointer into program) that match must include, or NULL
* regmlen length of regmust string
*
* Regstart and reganch permit very fast decisions on suitable starting points
* for a match, cutting down the work a lot. Regmust permits fast rejection
* of lines that cannot possibly match. The regmust tests are costly enough
* that regcomp() supplies a regmust only if the r.e. contains something
* potentially expensive (at present, the only such thing detected is * or +
* at the start of the r.e., which can involve a lot of backup). Regmlen is
* supplied because the test in regexec() needs it and regcomp() is computing
* it anyway.
*/
/*
* Structure for regexp "program". This is essentially a linear encoding
* of a nondeterministic finite-state machine (aka syntax charts or
* "railroad normal form" in parsing technology). Each node is an opcode
* plus a "next" pointer, possibly plus an operand. "Next" pointers of
* all nodes except BRANCH implement concatenation; a "next" pointer with
* a BRANCH on both ends of it is connecting two alternatives. (Here we
* have one of the subtle syntax dependencies: an individual BRANCH (as
* opposed to a collection of them) is never concatenated with anything
* because of operator precedence.) The operand of some types of node is
* a literal string; for others, it is a node leading into a sub-FSM. In
* particular, the operand of a BRANCH node is the first node of the branch.
* (NB this is *not* a tree structure: the tail of the branch connects
* to the thing following the set of BRANCHes.) The opcodes are:
*/
/* definition number opnd? meaning */
#define END 0 /* no End of program. */
#define BOI 1 /* no Match "" at beginning of input. */
#define EOI 2 /* no Match "" at end of input. */
#define ANY 3 /* no Match any one character. */
#define ANYL 4 /* no Anything but a linefeed */
#define ANYOF 5 /* bitmap Match any character in the bitmap. */
#define EXACTLY1 6 /* byte Match the character. */
#define RANGE 7 /* byte,byte Match any character in this range. */
#define NOTRANGE 8 /* byte,byte Match any character not in this range. */
#define BRANCH 9 /* node Match this alternative, or the next... */
#define BACK 10 /* no Match "", "next" ptr points backward. */
#define EXACTLY 11 /* str Match this string. */
#define EXACTLY_CI 12 /* str Match this string. */
#define NOTHING 13 /* no Match empty string. */
#define STAR 14 /* node Match this (simple) thing 0 or more times. */
#define PLUS 15 /* node Match this (simple) thing 1 or more times. */
#define STAR2 16 /* non-greedy star. */
#define PLUS2 17 /* non-greedy plus. */
#define STAR3 18 /* 2 nos Like STAR, but with numeric quantifiers */
#define STAR4 19 /* 2 nos non-greedy STAR3 */
#define OPENN 20 /* like OPEN, but with an n >= 50, or n == 0 means (?:...) */
#define CLOSEN 21 /* like CLOSE, but with an n >= 50 */
#define LOOKT 22 /* (?=...) or (?<=...)*/
#define LOOKF 23 /* (?!...) or (?<!...) */
#define LOOKTX 24 /* (?>...) */
#define LOOKBT 25 /* (?<=...)*/
#define LOOKBF 26 /* (?<!...) */
#define LOOKE 27 /* ender for LOOK* */
#define BACKREF 28 /* \<n>, to match exactly the result for cluster <n> */
#define BACKREF_CI 29 /* case-insensitive version */
#define COUNTINIT 30
#define COUNTOVER 31
#define COUNTUNDER 32
#define COUNTBACK 33
#define COUNTBACKFAIL 34
#define SAVECONST 35 /* no no Save position and count */
#define MAYBECONST 36 /* no no Save position and count */
#define WORDBOUND 37
#define NOTWORDBOUND 38
#define BOL 39 /* no Match "" at beginning of line. */
#define EOL 40 /* no Match "" at end of line. */
#define UNIPROP 41
#define CONDITIONAL 42
#define OPEN 43 /* no Mark this point in input as start of #n. */
/* OPEN+1 is number 1, etc. */
#define CLOSE 77 /* no Analogous to OPEN. */
# define OPSTR(o) (o + 2)
# define OPSTRx(o) (o + 1)
# define OPLEN(o, regstr) ((int)(((unsigned char *)regstr)[o] << 8) | (((unsigned char *)regstr)[o+1]))
# define OPRNGS(o, regstr) ((int)(((unsigned char *)regstr)[o]))
/*
* Opcode notes:
*
* BRANCH The set of branches constituting a single choice are hooked
* together with their "next" pointers, since precedence prevents
* anything being concatenated to any individual branch. The
* "next" pointer of the last BRANCH in a choice points to the
* thing following the whole choice. This is also where the
* final "next" pointer of each individual branch points; each
* branch starts with the operand node of a BRANCH node.
*
* BACK Normal "next" pointers all implicitly point forward; BACK
* exists to make loop structures possible.
*
* STAR,PLUS '?', and complex '*' and '+', are implemented as circular
* BRANCH structures using BACK. Simple cases (one character
* per match) are implemented with STAR and PLUS for speed
* and to minimize recursive plunges.
*
* OPEN,CLOSE ...are numbered at compile time.
*/
/*
* A node is one char of opcode followed by two chars of "next" pointer.
* "Next" pointers are stored as two 8-bit pieces, high order first. The
* value is a positive offset from the opcode of the node containing it.
* An operand, if any, simply follows the node. (Note that much of the
* code generation knows about this implicit relationship.)
*
* Using two bytes for the "next" pointer is vast overkill for most things,
* but allows patterns to get big without disasters.
*/
#define OP(p, regstr) (regstr[p])
#define NEXT(p, regstr) (((((unsigned char *)regstr)[(p)+1]&255)<<8) + (((unsigned char *)regstr)[(p)+2]&255))
#define OPERAND(p) ((p) + 3)
#define OPERAND2(p) ((p) + 5)
#define OPERAND3(p) ((p) + 7)
#define OPERAND4(p) ((p) + 9)
/*
* See regmagic.h for one further detail of program structure.
*/
/*
* Utility definitions.
*/
#define UCHAR(v) ((unsigned char)(v))
#define ISMULT(c, parse_flags) ((c) == '*' || (c) == '+' || (c) == '?' || ((parse_flags & PARSE_PCRE) && ((c) == '{')))
#define META "^$.[()|?+*\\"
#define PCRE_META "^$.[()|?+*\\{}]"
/*
* Flags to be passed up and down.
*/
#define HASWIDTH 0x01 /* Known never to match null string. */
#define SIMPLE 0x02 /* Simple enough to be STAR/PLUS operand. */
#define SPSTART 0x04 /* Starts with * or +. */
#define SPFIXED 0x08 /* Always matches a particular length */
#define NEEDSAVECONST 0x10 /* Fixed-size thing inside (), lift out save in case of repeat. */
#define SPNOTHING 0x20 /* Unconditionally matches nothing. */
#define WORST 0 /* Worst case. */
/* Parser flags: */
#define PARSE_CASE_SENS 0x1
#define PARSE_PCRE 0x2
#define PARSE_SINGLE_LINE 0x4
#define rx_tolower(c) (((c >= 'A') && (c <= 'Z')) ? (c + ('a' - 'A')) : c)
#define rx_toupper(c) (((c >= 'a') && (c <= 'z')) ? (c - ('a' - 'A')) : c)
#define rx_isword(c) (((c >= 'a') && (c <= 'z')) || ((c >= 'A') && (c <= 'Z')) || ((c >= '0') && (c <= '9')) || (c == '_'))
/*
* Work variables for regtry().
*/
typedef struct Regwork {
MZTAG_IF_REQUIRED
char *str; /* copy of regstr; used only to protect before thread swaps */
char *instr;
Scheme_Object *port;
Scheme_Object *unless_evt;
short nonblock, aborted;
rxpos instr_size; /* For port reads */
rxpos input_maxend; /* For port reads */
rxpos input, input_end, input_start; /* String-input pointer. */
rxpos boi, bol; /* Beginning of input/line, for ^ check. */
rxpos *startp; /* Pointer to startp array. */
rxpos *maybep; /* Pointer to tentative startp array. */
rxpos *endp; /* Ditto for endp. */
int *counters; /* For {} counters */
Scheme_Object *peekskip;
} Regwork;

File diff suppressed because it is too large Load Diff

View File

@ -283,131 +283,131 @@ static unsigned int utable_compose_pairs[] = {
0x30ad3099, 0x30af3099, 0x30b13099, 0x30b33099, 0x30b53099, 0x30b73099, 0x30b93099, 0x30bb3099,
0x30bd3099, 0x30bf3099, 0x30c13099, 0x30c43099, 0x30c63099, 0x30c83099, 0x30cf3099, 0x30cf309a,
0x30d23099, 0x30d2309a, 0x30d53099, 0x30d5309a, 0x30d83099, 0x30d8309a, 0x30db3099, 0x30db309a,
0x30ef3099, 0x30f03099, 0x30f13099, 0x30f23099, 0x30fd3099, 0x20030000, 0xb40000, 0x38f0000,
0x38c0000, 0x600000, 0x38e0000, 0x3b00000, 0x38a0000, 0x3900000, 0x3890000, 0x3880000,
0x3b90000, 0x3860000, 0x3ce0000, 0x3cd0000, 0x3cc0000, 0x3af0000, 0x3ae0000, 0x3ad0000,
0x3ac0000, 0x57170000, 0x5e405bf, 0x5d105bf, 0x5ea05bc, 0x5e805bc, 0x5e605bc, 0x5e405bc,
0x5e305bc, 0x5e105bc, 0x5de05bc, 0x5dc05bc, 0x5db05bc, 0x5d905bc, 0x5d605bc, 0x5d505bc,
0x5d305bc, 0x5d105bc, 0x5d005b8, 0xfb4905c2, 0x5e905c2, 0x5f205b7, 0x5d905b4, 0x9f8e0000,
0x40180000, 0x9b120000, 0x980b0000, 0x97560000, 0x96e30000, 0x92760000, 0x90720000, 0x8d080000,
0x8b390000, 0x8afe0000, 0x8acb0000, 0x8abf0000, 0x89860000, 0x87790000, 0x83520000, 0x7f3e0000,
0x7d5b0000, 0x7bc00000, 0x78cc0000, 0x774a0000, 0x76db0000, 0x761f0000, 0x753b0000, 0x74710000,
0x72af0000, 0x77a70000, 0x701e0000, 0x6ecb0000, 0x6d410000, 0x6b790000, 0x671b0000, 0x66740000,
0x64520000, 0x63c40000, 0x61f20000, 0x618e0000, 0x614e0000, 0x5fad0000, 0x5ed90000, 0x5b280000,
0x59540000, 0x58b30000, 0x55e20000, 0x55550000, 0x52fa0000, 0x51800000, 0x51680000, 0x4e260000,
0x983b0000, 0x97ff0000, 0x90380000, 0x8d080000, 0x8b390000, 0x89960000, 0x84570000, 0x82790000,
0x80050000, 0x7e410000, 0x7df40000, 0x7a810000, 0x798e0000, 0x795d0000, 0x79500000, 0x79490000,
0x78910000, 0x722b0000, 0x6f220000, 0x6d770000, 0x65e20000, 0x654f0000, 0x618e0000, 0x60940000,
0x5c640000, 0x58400000, 0x56060000, 0x53510000, 0x52c90000, 0x50e70000, 0x9db40000, 0x98fc0000,
0x90fd0000, 0x90380000, 0x8af80000, 0x86120000, 0x7fbd0000, 0x7cbe0000, 0x798f0000, 0x795e0000,
0x76ca0000, 0x51de0000, 0x66740000, 0x585a0000, 0x55c00000, 0x898b0000, 0x964d0000, 0x66b40000,
0x6d1e0000, 0x7cd60000, 0x5ea60000, 0x523a0000, 0x4ec00000, 0x70990000, 0x7c920000, 0x7acb0000,
0x6dcb0000, 0x9e9f0000, 0x85fa0000, 0x74980000, 0x541d0000, 0x533f0000, 0x91cc0000, 0x88cf0000,
0x75e20000, 0x6ce50000, 0x674e0000, 0x5c650000, 0x52290000, 0x73870000, 0x61440000, 0x8f2a0000,
0x5d190000, 0x96780000, 0x516d0000, 0x7d100000, 0x75590000, 0x6d410000, 0x677b0000, 0x52890000,
0x66880000, 0x907c0000, 0x76420000, 0x65990000, 0x5c3f0000, 0x50da0000, 0x60e10000, 0x91b40000,
0x4f8b0000, 0x97480000, 0x92340000, 0x74690000, 0x73b20000, 0x5be70000, 0x56f90000, 0x7c3e0000,
0x6bae0000, 0x5ff50000, 0x8aaa0000, 0x70c80000, 0x52170000, 0x934a0000, 0x8f260000, 0x806f0000,
0x79ca0000, 0x71490000, 0x649a0000, 0x61900000, 0x8f620000, 0x66c60000, 0x9e970000, 0x9a6a0000,
0x792a0000, 0x65c50000, 0x59730000, 0x52f50000, 0x826f0000, 0x7ce70000, 0x51c90000, 0x4eae0000,
0x82e50000, 0x62fe0000, 0x8fb00000, 0x8aaa0000, 0x77010000, 0x53c30000, 0x65780000, 0x4e0d0000,
0x78fb0000, 0x53170000, 0x73870000, 0x5be70000, 0x8afe0000, 0x62cf0000, 0x96750000, 0x7dbe0000,
0x51cc0000, 0x808b0000, 0x964b0000, 0x7d2f0000, 0x6dda0000, 0x5c620000, 0x96f70000, 0x78ca0000,
0x7c600000, 0x5f040000, 0x8ad60000, 0x93040000, 0x797f0000, 0x788c0000, 0x9b6f0000, 0x865c0000,
0x80010000, 0x76e70000, 0x64c40000, 0x51b70000, 0x90ce0000, 0x6d6a0000, 0x5eca0000, 0x81d80000,
0x89640000, 0x85cd0000, 0x5d500000, 0x721b0000, 0x6b040000, 0x99f10000, 0x916a0000, 0x70d90000,
0x6a020000, 0x908f0000, 0x863f0000, 0x7f850000, 0x61f60000, 0x55870000, 0x59510000, 0x9f9c0000,
0x4e320000, 0x8cc80000, 0x66f40000, 0x7a4a0000, 0x412f0000, 0x798f0000, 0x78cc0000, 0x784e0000,
0x40960000, 0x778b0000, 0x774a0000, 0x771f0000, 0x76f40000, 0x3ffc0000, 0x5db05bf, 0x75700000,
0x5d505b9, 0x5e905bc, 0x74ca0000, 0x5e705bc, 0x74470000, 0x3eb80000, 0x3eac0000, 0x5e005bc,
0x72800000, 0x72500000, 0x72280000, 0x5da05bc, 0x5d805bc, 0x70ad0000, 0x707d0000, 0x5d405bc,
0x701e0000, 0x5d205bc, 0x5d005bc, 0x6df90000, 0x5d005b7, 0xfb4905c1, 0x6e2f0000, 0x5e905c1,
0x6d780000, 0x6d410000, 0x6d3e0000, 0x6c670000, 0x6cbf0000, 0x6c4e0000, 0x6bbb0000, 0x6b9f0000,
0x3c4e0000, 0x3c180000, 0x69ea0000, 0x69420000, 0x69140000, 0x688e0000, 0x68850000, 0x67850000,
0x3b490000, 0x67530000, 0x67210000, 0x67170000, 0x80ad0000, 0x67000000, 0x51920000, 0x3b080000,
0x3b190000, 0x66f80000, 0x654f0000, 0x64770000, 0x647e0000, 0x3a2e0000, 0x63c50000, 0x63830000,
0x62fc0000, 0x62d40000, 0x625d0000, 0x62100000, 0x61f20000, 0x61af0000, 0x61b20000, 0x617a0000,
0x614e0000, 0x61480000, 0x391c0000, 0x60810000, 0x5fd70000, 0x5f9a0000, 0x5f6b0000, 0x38c70000,
0x5f220000, 0x5efe0000, 0x5eca0000, 0x9f430000, 0x387c0000, 0x40390000, 0x5dfd0000, 0x3b9d0000,
0x5d6e0000, 0x9f9c0000, 0x983b0000, 0x5c6e0000, 0x97ff0000, 0x97db0000, 0x5bff0000, 0x967c0000,
0x91990000, 0x8f380000, 0x8b8a0000, 0x5a660000, 0x8aed0000, 0x8b010000, 0x8af80000, 0x89960000,
0x58f20000, 0x89410000, 0x83ef0000, 0x580d0000, 0x80050000, 0x7df40000, 0x56510000, 0x7c7b0000,
0x7ab10000, 0x55ab0000, 0x77400000, 0x76f40000, 0x55100000, 0x76ca0000, 0x761d0000, 0x549e0000,
0x75060000, 0x732a0000, 0x53ca0000, 0x72350000, 0x716e0000, 0x537d0000, 0x6f220000, 0x6edb0000,
0x53060000, 0x6bba0000, 0x67560000, 0x35150000, 0x67170000, 0x65560000, 0x52030000, 0x641c0000,
0x62340000, 0x51a40000, 0x61600000, 0x61080000, 0x60d80000, 0x5f690000, 0x349e0000, 0x5ed20000,
0x5a620000, 0x4fbb0000, 0x59440000, 0x585a0000, 0x4e3d0000, 0x55990000, 0x559d0000, 0x52c70000,
0x51450000, 0xf9c0fb7, 0x4f800000, 0x51b50000, 0x96e30000, 0x8fb60000, 0x8cd30000, 0x8b010000,
0x89100000, 0x82790000, 0x81ed0000, 0x7f720000, 0x7e090000, 0x7bc00000, 0x7a400000, 0x798d0000,
0x79560000, 0x79480000, 0x793e0000, 0x74220000, 0x716e0000, 0x6e1a0000, 0x68850000, 0x66910000,
0x61f20000, 0x61680000, 0x5c6e0000, 0x58a80000, 0x56680000, 0x559d0000, 0x52e40000, 0x514d0000,
0x4fae0000, 0x99280000, 0x98ef0000, 0x97560000, 0x79650000, 0x793c0000, 0x732a0000, 0x51400000,
0x5ed30000, 0x884c0000, 0x8f3b0000, 0x5b850000, 0x62d30000, 0x52070000, 0x83360000, 0x8b580000,
0x72c00000, 0x7b200000, 0x81e80000, 0x67970000, 0x9c570000, 0x96a30000, 0x71d00000, 0x6eba0000,
0x96e20000, 0x88e10000, 0x7f790000, 0x74060000, 0x68a80000, 0x66130000, 0x540f0000, 0x96860000,
0x68170000, 0x5f8b0000, 0x6dea0000, 0x502b0000, 0x622e0000, 0x985e0000, 0x786b0000, 0x74090000,
0x6e9c0000, 0x67f30000, 0x962e0000, 0x9f8d0000, 0x84fc0000, 0x71ce0000, 0x6a020000, 0x5bee0000,
0x4e860000, 0x96b80000, 0x79ae0000, 0x98180000, 0x96f60000, 0x80460000, 0x7f9a0000, 0x601c0000,
0x5dba0000, 0x4ee40000, 0x73750000, 0x637b0000, 0x5ec90000, 0x88c20000, 0x54bd0000, 0x52a30000,
0x90230000, 0x84ee0000, 0x7df40000, 0x74890000, 0x6f230000, 0x62000000, 0x5e740000, 0x6b770000,
0x529b0000, 0x9ece0000, 0x95ad0000, 0x6ffe0000, 0x5eec0000, 0x54420000, 0x91cf0000, 0x8ad20000,
0x68810000, 0x51690000, 0x75650000, 0x63a00000, 0x6c880000, 0x6bba0000, 0x84490000, 0x585e0000,
0x7d220000, 0x6ccc0000, 0x5fa90000, 0x4fbf0000, 0x75700000, 0x60120000, 0x4e390000, 0x6a020000,
0x8b800000, 0x83f10000, 0x7a1c0000, 0x51dc0000, 0x52d20000, 0x7e370000, 0x6f0f0000, 0x6a130000,
0x58d80000, 0x8cc20000, 0x72620000, 0x807e0000, 0x58df0000, 0x9e7f0000, 0x83c90000, 0x7da00000,
0x9dfa0000, 0x97320000, 0x8def0000, 0x86060000, 0x72100000, 0x6ad30000, 0x52de0000, 0x4f860000,
0x72fc0000, 0x67170000, 0x881f0000, 0x62c90000, 0x6feb0000, 0x9e1e0000, 0x862d0000, 0x53750000,
0x4e820000, 0x843d0000, 0x73de0000, 0x6d1b0000, 0x88f80000, 0x87ba0000, 0x76690000, 0x59480000,
0x91d10000, 0x9f9c0000, 0x53e50000, 0x6ed10000, 0x8eca0000, 0x8c480000, 0x7aee0000, 0x7a4f0000,
0x7a400000, 0x79eb0000, 0x79560000, 0x40e30000, 0x788c0000, 0x40460000, 0x40390000, 0x771f0000,
0x771e0000, 0x40080000, 0x76100000, 0x753e0000, 0x75240000, 0x3f1b0000, 0x74710000, 0x745c0000,
0x3eb80000, 0x73a50000, 0x737a0000, 0x72950000, 0x72350000, 0x719c0000, 0x71450000, 0x70770000,
0x3d960000, 0x701b0000, 0x6fc60000, 0x6f6e0000, 0x6ec70000, 0x3d330000, 0x6e6e0000, 0x6d850000,
0x6d690000, 0x6d770000, 0x6d160000, 0x6ccd0000, 0x6bba0000, 0x6b720000, 0x6b540000, 0x6b210000,
0x6adb0000, 0x6aa80000, 0x69a30000, 0x3b9d0000, 0x681f0000, 0x68520000, 0x67fa0000, 0x675e0000,
0x671b0000, 0x43d90000, 0x669c0000, 0x51950000, 0x3ae40000, 0x66910000, 0x66490000, 0x656c0000,
0x3a6c0000, 0x649d0000, 0x64690000, 0x63a90000, 0x63e40000, 0x63680000, 0x633d0000, 0x63500000,
0x62b10000, 0x621b0000, 0x61f60000, 0x61de0000, 0x61a40000, 0x618e0000, 0x614c0000, 0x614c0000,
0x60c70000, 0x60940000, 0x393a0000, 0x5ff90000, 0x5fcd0000, 0x38e30000, 0x5f620000, 0x5f220000,
0x82010000, 0x5eb30000, 0x38620000, 0x5e3d0000, 0x5e280000, 0x5de20000, 0x5d6b0000, 0x5d430000,
0x5c8d0000, 0x5cc00000, 0x37810000, 0x5f530000, 0x5c060000, 0x5bf30000, 0x5bd80000, 0x5bc30000,
0x5b3e0000, 0x36fc0000, 0x5a270000, 0x59060000, 0x58f70000, 0x58ac0000, 0x578b0000, 0x52070000,
0x56060000, 0x55c20000, 0x55b30000, 0x55840000, 0x55630000, 0x55530000, 0x54a20000, 0x54480000,
0x54380000, 0x53f10000, 0x53df0000, 0x537f0000, 0x537f0000, 0x535a0000, 0x53490000, 0x53170000,
0x52fa0000, 0x52c70000, 0x52720000, 0x523b0000, 0x51ac0000, 0x4ecc0000, 0x51670000, 0x34b90000,
0x51640000, 0x514d0000, 0x50e70000, 0x507a0000, 0x50020000, 0x4f600000, 0x9f3b0000, 0x9f0f0000,
0x9efe0000, 0x4d560000, 0x9cfd0000, 0x9b120000, 0x4bce0000, 0x99c20000, 0x99290000, 0x98e20000,
0x98290000, 0x980b0000, 0x4ab20000, 0xc50000, 0x97e00000, 0x4a6e0000, 0x5db20000, 0x49e60000,
0x95b70000, 0x958b0000, 0x94150000, 0x927c0000, 0x92d70000, 0x911b0000, 0x90940000, 0x8ed40000,
0x8df00000, 0x8dcb0000, 0x8d1b0000, 0x8cab0000, 0x8c550000, 0x8aed0000, 0x46c70000, 0x34bb0000,
0x46350000, 0x88d70000, 0x88630000, 0x45f90000, 0x87e10000, 0x87280000, 0x86e20000, 0x86880000,
0x86690000, 0x865c0000, 0x456b0000, 0x455d0000, 0x85640000, 0x85160000, 0x84f10000, 0x83cc0000,
0x83530000, 0x83e70000, 0x83230000, 0x83630000, 0x82e50000, 0x82e60000, 0x82b30000, 0x52b30000,
0x828b0000, 0x446b0000, 0x82040000, 0x5ab50000, 0x440b0000, 0x80b20000, 0x80050000, 0x7f950000,
0x7f7a0000, 0x43590000, 0x7e450000, 0x7dc70000, 0x7d630000, 0x4b0000, 0x7ce80000, 0x3a90000,
0x7cd20000, 0x7bc60000, 0x42020000, 0x74850000, 0x738b0000, 0xb210b3c, 0x70390000, 0x65e30000,
0x5eb60000, 0x20020000, 0x5eb00000, 0x382f0000, 0x5d7c0000, 0x3850000, 0x9f050000, 0x5c220000,
0x4cce0000, 0xf900fb5, 0x5b080000, 0x36ee0000, 0xfab0fb7, 0x99fe0000, 0xfa60fb7, 0xfa10fb7,
0x59220000, 0x591a0000, 0xf920fb7, 0x57ce0000, 0xa1c0a3c, 0xf710f80, 0xfb30f80, 0xfb20f80,
0xf710f74, 0x55840000, 0xf400fb5, 0x92d80000, 0xf5b0fb7, 0xf560fb7, 0xf510fb7, 0x90f10000,
0xf4c0fb7, 0xf420fb7, 0x53510000, 0x53050000, 0x8d770000, 0x52460000, 0x34df0000, 0x518d0000,
0x51770000, 0x51540000, 0x88010000, 0x50990000, 0x4fae0000, 0x870e0000, 0x86a90000, 0x86500000,
0x9a109bc, 0x84570000, 0x83ad0000, 0x82bd0000, 0x82910000, 0x82010000, 0x81030000, 0x80600000,
0x43340000, 0x7d000000, 0x42270000, 0x92b093c, 0x922093c, 0x91c093c, 0x915093c, 0x704a0000,
0x6ecb0000, 0x9f160000, 0x9ef90000, 0x9ebb0000, 0x4ced0000, 0x64220000, 0x9c400000, 0x99a70000,
0x4b330000, 0x980b0000, 0x4a760000, 0x97230000, 0x96c30000, 0x49950000, 0x93f90000, 0x92380000,
0x91110000, 0x8f380000, 0x5e690000, 0x8dbc0000, 0x5de10000, 0x8cc10000, 0x8b8a0000, 0x5c600000,
0x8aa00000, 0x46be0000, 0x5be70000, 0x5b3e0000, 0x59d80000, 0x59ec0000, 0x87860000, 0x876b0000,
0x59620000, 0x58320000, 0x57f40000, 0x58ee0000, 0x56740000, 0xb220b3c, 0x57160000, 0x84f30000,
0x452b0000, 0x54f60000, 0x83dc0000, 0x54680000, 0x54060000, 0x53eb0000, 0x70700000, 0x831d0000,
0x537f0000, 0x53730000, 0x82b10000, 0x829d0000, 0x52c90000, 0x52770000, 0x51f50000, 0x813e0000,
0x51b50000, 0x2add0338, 0x51970000, 0x80700000, 0x7ffa0000, 0x50cf0000, 0x4e410000, 0x4e380000,
0x7e020000, 0x7ce30000, 0x42a00000, 0x7bc90000, 0xa2b0a3c, 0xa170a3c, 0xa160a3c, 0xa380a3c,
0xa320a3c, 0x9af09bc, 0x9a209bc, 0x6d340000, 0x92f093c, 0x921093c, 0x917093c, 0x916093c,
0x4cf80000, 0x9d670000, 0x88fa0000, 0x88de0000, 0x88600000, 0x45d70000, 0x87790000, 0x86670000,
0x45610000, 0x83ca0000, 0x83bd0000, 0x5a1b0000, 0x58310000, 0x43d50000, 0x55990000, 0x43010000,
0x52e40000, 0xf710f72, 0x3130000, 0x3000000, 0x8f9e0000, 0xb70000, 0x3b0000, 0x2b90000,
0x3080301, 0x3010000, 0x30090000, 0x30080000
0x30ef3099, 0x30f03099, 0x30f13099, 0x30f23099, 0x30fd3099, 0xb40000, 0x38f0000, 0x38c0000,
0x600000, 0x38e0000, 0x3b00000, 0x38a0000, 0x3900000, 0x3890000, 0x3880000, 0x3b90000,
0x3860000, 0x3ce0000, 0x3cd0000, 0x3cc0000, 0x3af0000, 0x3ae0000, 0x3ad0000, 0x3ac0000,
0x5e405bf, 0x5d105bf, 0x5ea05bc, 0x5e805bc, 0x5e605bc, 0x5e405bc, 0x5e305bc, 0x5e005bc,
0x5de05bc, 0x5dc05bc, 0x5db05bc, 0x5d905bc, 0x5d605bc, 0x5d505bc, 0x5d305bc, 0x5d105bc,
0x5d005b8, 0xfb4905c2, 0x5e905c2, 0x5f205b7, 0x5d905b4, 0x9f8e0000, 0x40180000, 0x9b120000,
0x980b0000, 0x97db0000, 0x96e30000, 0x92760000, 0x90720000, 0x8d080000, 0x8b390000, 0x8afe0000,
0x8acb0000, 0x8abf0000, 0x89860000, 0x87790000, 0x83520000, 0x7f3e0000, 0x7d5b0000, 0x7bc00000,
0x78cc0000, 0x774a0000, 0x76db0000, 0x761f0000, 0x753b0000, 0x74710000, 0x72af0000, 0x77a70000,
0x701e0000, 0x6ecb0000, 0x6d410000, 0x6b790000, 0x671b0000, 0x66740000, 0x64520000, 0x63c40000,
0x61f20000, 0x618e0000, 0x614e0000, 0x5fad0000, 0x5ed90000, 0x5b280000, 0x59540000, 0x58b30000,
0x55e20000, 0x55550000, 0x52fa0000, 0x51800000, 0x4f800000, 0x51b50000, 0x983b0000, 0x97ff0000,
0x90380000, 0x8d080000, 0x8b390000, 0x89960000, 0x84570000, 0x82790000, 0x80050000, 0x7e410000,
0x7df40000, 0x7a810000, 0x798e0000, 0x795d0000, 0x79500000, 0x79490000, 0x78910000, 0x722b0000,
0x6e1a0000, 0x6d770000, 0x66910000, 0x654f0000, 0x618e0000, 0x60940000, 0x58a80000, 0x58400000,
0x56060000, 0x53510000, 0x52c90000, 0x50e70000, 0x9db40000, 0x98ef0000, 0x90fd0000, 0x90380000,
0x8af80000, 0x86120000, 0x7fbd0000, 0x7cbe0000, 0x798f0000, 0x795e0000, 0x76ca0000, 0x51de0000,
0x66740000, 0x585a0000, 0x4ced0000, 0x55c00000, 0x5ed30000, 0x964d0000, 0x8f3b0000, 0x6d1e0000,
0x7cd60000, 0x5ea60000, 0x83360000, 0x4ec00000, 0x70990000, 0x7c920000, 0x7acb0000, 0x6dcb0000,
0x9e9f0000, 0x96a30000, 0x71d00000, 0x541d0000, 0x533f0000, 0x91cc0000, 0x88cf0000, 0x75e20000,
0x6ce50000, 0x674e0000, 0x5c650000, 0x52290000, 0x73870000, 0x61440000, 0x6dea0000, 0x5d190000,
0x96780000, 0x516d0000, 0x7d100000, 0x75590000, 0x6d410000, 0x677b0000, 0x52890000, 0x66880000,
0x907c0000, 0x76420000, 0x6a020000, 0x5c3f0000, 0x50da0000, 0x60e10000, 0x91b40000, 0x4f8b0000,
0x97480000, 0x92340000, 0x7f9a0000, 0x73b20000, 0x5dba0000, 0x56f90000, 0x73750000, 0x6bae0000,
0x5ff50000, 0x8aaa0000, 0x70c80000, 0x52a30000, 0x934a0000, 0x84ee0000, 0x806f0000, 0x79ca0000,
0x71490000, 0x649a0000, 0x61900000, 0x8f620000, 0x66c60000, 0x9ece0000, 0x9a6a0000, 0x792a0000,
0x65c50000, 0x59730000, 0x52f50000, 0x826f0000, 0x7ce70000, 0x51c90000, 0x4eae0000, 0x63a00000,
0x62fe0000, 0x6bba0000, 0x84490000, 0x77010000, 0x53c30000, 0x6ccc0000, 0x4e0d0000, 0x4fbf0000,
0x53170000, 0x60120000, 0x4e390000, 0x6a020000, 0x8b800000, 0x83f10000, 0x7dbe0000, 0x51cc0000,
0x808b0000, 0x964b0000, 0x7d2f0000, 0x6dda0000, 0x5c620000, 0x96f70000, 0x78ca0000, 0x807e0000,
0x5f040000, 0x9e7f0000, 0x83c90000, 0x797f0000, 0x788c0000, 0x97320000, 0x865c0000, 0x80010000,
0x76e70000, 0x6ad30000, 0x51b70000, 0x4f860000, 0x72fc0000, 0x67170000, 0x81d80000, 0x89640000,
0x6feb0000, 0x9e1e0000, 0x862d0000, 0x6b040000, 0x4e820000, 0x916a0000, 0x73de0000, 0x6d1b0000,
0x908f0000, 0x87ba0000, 0x7f850000, 0x61f60000, 0x55870000, 0x59510000, 0x9f9c0000, 0x4e320000,
0x8eca0000, 0x8c480000, 0x6c670000, 0x6cbf0000, 0x6c4e0000, 0x6bbb0000, 0x6b9f0000, 0x5db05bf,
0x5d505b9, 0x5e905bc, 0x69ea0000, 0x5e705bc, 0x69140000, 0x688e0000, 0x5e105bc, 0x67850000,
0x3b490000, 0x67530000, 0x67210000, 0x5da05bc, 0x5d805bc, 0x67000000, 0x51920000, 0x3b080000,
0x5d405bc, 0x5d205bc, 0x5d005bc, 0x654f0000, 0x64770000, 0x5d005b7, 0xfb4905c1, 0x5e905c1,
0x63830000, 0x62fc0000, 0x62d40000, 0x625d0000, 0x62100000, 0x61f20000, 0x61af0000, 0x61b20000,
0x617a0000, 0x614e0000, 0x61480000, 0x391c0000, 0x60810000, 0x5fd70000, 0x5f9a0000, 0x5f6b0000,
0x38c70000, 0x5f220000, 0x5efe0000, 0x5eca0000, 0x5eb30000, 0x387c0000, 0x38620000, 0x5e3d0000,
0x5dfd0000, 0x5de20000, 0x5d7c0000, 0x5d6e0000, 0x5d430000, 0x5c8d0000, 0x5c6e0000, 0x37810000,
0x5f530000, 0x5bff0000, 0x5bf30000, 0x5bd80000, 0x5b3e0000, 0x36fc0000, 0x5a660000, 0x5a270000,
0x59ec0000, 0x59220000, 0x59060000, 0x58f20000, 0x58ac0000, 0x58320000, 0x580d0000, 0x57ce0000,
0x52070000, 0x56510000, 0x56060000, 0x55c20000, 0x55ab0000, 0x9f430000, 0x55630000, 0x55100000,
0x40390000, 0x3b9d0000, 0x53ca0000, 0x9f9c0000, 0x983b0000, 0x97ff0000, 0x97560000, 0x53490000,
0x53060000, 0x967c0000, 0x91990000, 0x8f380000, 0x8b8a0000, 0x523b0000, 0x52030000, 0x8aed0000,
0x8b010000, 0x8af80000, 0x89960000, 0x51670000, 0x89410000, 0x83ef0000, 0x80050000, 0x7df40000,
0x507a0000, 0x4fbb0000, 0x7c7b0000, 0x7ab10000, 0x77400000, 0x76f40000, 0x76ca0000, 0x761d0000,
0x75060000, 0x732a0000, 0x72350000, 0x716e0000, 0x6f220000, 0x6edb0000, 0x6bba0000, 0x67560000,
0x67170000, 0x65560000, 0x641c0000, 0x62340000, 0x61600000, 0x61080000, 0x60d80000, 0x5f690000,
0x5ed20000, 0x5a620000, 0x59440000, 0x585a0000, 0x55990000, 0x559d0000, 0x52c70000, 0x51450000,
0x51680000, 0x4e260000, 0x96e30000, 0x8fb60000, 0x8cd30000, 0x8b010000, 0x89100000, 0x82790000,
0x81ed0000, 0x7f720000, 0x7e090000, 0x7bc00000, 0x7a400000, 0x798d0000, 0x79560000, 0x79480000,
0x793e0000, 0x74220000, 0x716e0000, 0x6f220000, 0x68850000, 0x65e20000, 0x61f20000, 0x61680000,
0x5c6e0000, 0x5c640000, 0x56680000, 0x559d0000, 0x52e40000, 0x514d0000, 0x4fae0000, 0x99280000,
0x98fc0000, 0xfb30f80, 0xf710f74, 0x97560000, 0x79650000, 0x793c0000, 0x732a0000, 0x9d670000,
0x51400000, 0x898b0000, 0x884c0000, 0x66b40000, 0x5b850000, 0x62d30000, 0x52070000, 0x523a0000,
0x8b580000, 0x72c00000, 0x7b200000, 0x81e80000, 0x67970000, 0x9c570000, 0x85fa0000, 0x74980000,
0x6eba0000, 0x96e20000, 0x88e10000, 0x7f790000, 0x74060000, 0x68a80000, 0x66130000, 0x540f0000,
0x96860000, 0x68170000, 0x5f8b0000, 0x8f2a0000, 0x502b0000, 0x622e0000, 0x985e0000, 0x786b0000,
0x74090000, 0x6e9c0000, 0x67f30000, 0x962e0000, 0x9f8d0000, 0x84fc0000, 0x71ce0000, 0x65990000,
0x5bee0000, 0x4e860000, 0x96b80000, 0x79ae0000, 0x98180000, 0x96f60000, 0x80460000, 0x74690000,
0x601c0000, 0x5be70000, 0x4ee40000, 0x7c3e0000, 0x637b0000, 0x5ec90000, 0x88c20000, 0x54bd0000,
0x52170000, 0x90230000, 0x8f260000, 0x7df40000, 0x74890000, 0x6f230000, 0x62000000, 0x5e740000,
0x6b770000, 0x529b0000, 0x9e970000, 0x95ad0000, 0x6ffe0000, 0x5eec0000, 0x54420000, 0x91cf0000,
0x8ad20000, 0x68810000, 0x51690000, 0x75650000, 0x82e50000, 0x6c880000, 0x8fb00000, 0x8aaa0000,
0x585e0000, 0x7d220000, 0x65780000, 0x5fa90000, 0x78fb0000, 0x75700000, 0x73870000, 0x5be70000,
0x8afe0000, 0x62cf0000, 0x96750000, 0x7a1c0000, 0x51dc0000, 0x52d20000, 0x7e370000, 0x6f0f0000,
0x6a130000, 0x58d80000, 0x8cc20000, 0x72620000, 0x7c600000, 0x58df0000, 0x8ad60000, 0x93040000,
0x7da00000, 0x9dfa0000, 0x9b6f0000, 0x8def0000, 0x86060000, 0x72100000, 0x64c40000, 0x52de0000,
0x90ce0000, 0x6d6a0000, 0x5eca0000, 0x881f0000, 0x62c90000, 0x85cd0000, 0x5d500000, 0x721b0000,
0x53750000, 0x99f10000, 0x843d0000, 0x70d90000, 0x6a020000, 0x88f80000, 0x863f0000, 0x76690000,
0x59480000, 0x91d10000, 0x9f9c0000, 0x53e50000, 0x6ed10000, 0x8cc80000, 0x66f40000, 0x6d160000,
0x6ccd0000, 0x6bba0000, 0x3c4e0000, 0x3c180000, 0x6adb0000, 0x6aa80000, 0x69420000, 0x3b9d0000,
0x681f0000, 0x68850000, 0x68520000, 0x67fa0000, 0x675e0000, 0x67170000, 0x80ad0000, 0x669c0000,
0x51950000, 0x3ae40000, 0x3b190000, 0x66f80000, 0x656c0000, 0x3a6c0000, 0x647e0000, 0x3a2e0000,
0x63c50000, 0x64220000, 0x63e40000, 0x63680000, 0x633d0000, 0x63500000, 0x62b10000, 0x621b0000,
0x61f60000, 0x61de0000, 0x61a40000, 0x618e0000, 0x614c0000, 0x614c0000, 0x60c70000, 0x60940000,
0x393a0000, 0x5ff90000, 0x5fcd0000, 0x38e30000, 0x5f620000, 0x5f220000, 0x82010000, 0x5eb60000,
0x5eb00000, 0x5e690000, 0x5e280000, 0x382f0000, 0x5de10000, 0x30080000, 0x5d6b0000, 0x5cc00000,
0x5c600000, 0x5c220000, 0x5c060000, 0x5be70000, 0x5bc30000, 0x5b3e0000, 0x5b080000, 0x36ee0000,
0x59d80000, 0x5a1b0000, 0x59620000, 0x591a0000, 0x58f70000, 0x578b0000, 0x57f40000, 0x58ee0000,
0x56740000, 0x57170000, 0x57160000, 0x55b30000, 0x55840000, 0x55840000, 0x55530000, 0x54480000,
0x549e0000, 0x53f10000, 0x53eb0000, 0x53df0000, 0x537f0000, 0x537d0000, 0x535a0000, 0x53510000,
0x53170000, 0x52fa0000, 0x52c90000, 0x35150000, 0x52720000, 0x52460000, 0x34df0000, 0x51ac0000,
0x51a40000, 0x4cf80000, 0x518d0000, 0x34b90000, 0x51640000, 0x9cfd0000, 0x9b120000, 0x514d0000,
0x349e0000, 0x50e70000, 0x50990000, 0x99c20000, 0x50020000, 0x4f600000, 0x980b0000, 0x4ab20000,
0x97e00000, 0x4a6e0000, 0x5db20000, 0x49e60000, 0x95b70000, 0x958b0000, 0x94150000, 0x927c0000,
0x92d70000, 0x911b0000, 0x91110000, 0x8ed40000, 0x8df00000, 0x8cab0000, 0x8c550000, 0x46c70000,
0x34bb0000, 0x88d70000, 0x88630000, 0x45f90000, 0x87e10000, 0x87860000, 0x87280000, 0x86e20000,
0x86880000, 0x86690000, 0x865c0000, 0x456b0000, 0x455d0000, 0x85640000, 0x85160000, 0x84f10000,
0x83cc0000, 0x83530000, 0x83e70000, 0x82e50000, 0x82e60000, 0x82b30000, 0x52b30000, 0x828b0000,
0x446b0000, 0x82040000, 0x5ab50000, 0x440b0000, 0x80050000, 0x7f950000, 0x7f7a0000, 0x43590000,
0x7e450000, 0x7dc70000, 0x7d630000, 0x7d000000, 0x7ce80000, 0x7cd20000, 0x42270000, 0x7bc60000,
0x42020000, 0x7a4a0000, 0x798f0000, 0x78cc0000, 0x784e0000, 0x40960000, 0x778b0000, 0x774a0000,
0x771f0000, 0x3ffc0000, 0x76100000, 0x75700000, 0x753e0000, 0x74ca0000, 0x74710000, 0x74470000,
0x3eb80000, 0x3eac0000, 0x737a0000, 0x72800000, 0x72500000, 0x72280000, 0x719c0000, 0x71450000,
0x70ad0000, 0x707d0000, 0x3d960000, 0x701e0000, 0x6fc60000, 0x6df90000, 0x6ec70000, 0x3d330000,
0x6e2f0000, 0x6d780000, 0x6d410000, 0x6d3e0000, 0x6b720000, 0x6b540000, 0x6b210000, 0x69a30000,
0x4b0000, 0x3a90000, 0x671b0000, 0x43d90000, 0x66910000, 0x66490000, 0x65e30000, 0x649d0000,
0x64690000, 0x63a90000, 0x9f3b0000, 0x9f0f0000, 0x9efe0000, 0x4d560000, 0x9ebb0000, 0x4cce0000,
0x9c400000, 0x4bce0000, 0x99fe0000, 0xb210b3c, 0x98e20000, 0x98290000, 0x4a760000, 0x97230000,
0x96c30000, 0x93f90000, 0x92d80000, 0x58310000, 0x8f380000, 0x8dcb0000, 0x8cc10000, 0x8aed0000,
0x55990000, 0x54a20000, 0x8aa00000, 0x46be0000, 0x88de0000, 0x52e40000, 0x52c70000, 0x52770000,
0x86a90000, 0x86670000, 0x86500000, 0x51f50000, 0x51b50000, 0x4ecc0000, 0x45610000, 0x51970000,
0x51770000, 0x452b0000, 0x51540000, 0x50cf0000, 0x4fae0000, 0x4e410000, 0x4e3d0000, 0x20030000,
0x82bd0000, 0x829d0000, 0x3850000, 0x82010000, 0x813e0000, 0xf900fb5, 0x80600000, 0xfab0fb7,
0xfa60fb7, 0xfa10fb7, 0x43340000, 0xf9c0fb7, 0xf920fb7, 0x43010000, 0xa170a3c, 0xf710f80,
0x42a00000, 0xfb20f80, 0xf710f72, 0xf400fb5, 0x7a4f0000, 0x412f0000, 0xf5b0fb7, 0xf560fb7,
0xf510fb7, 0xf4c0fb7, 0xf420fb7, 0x788c0000, 0x40460000, 0x76f40000, 0x75240000, 0x73a50000,
0x738b0000, 0x9a209bc, 0x70390000, 0x6f6e0000, 0x6d340000, 0x6d850000, 0x9f050000, 0x92f093c,
0x921093c, 0x91c093c, 0x915093c, 0x8b8a0000, 0x46350000, 0x88010000, 0x870e0000, 0x84f30000,
0x83dc0000, 0x83ca0000, 0x84570000, 0x83230000, 0x83630000, 0x831d0000, 0x82b10000, 0x54f60000,
0x8f9e0000, 0x54680000, 0x54380000, 0x54060000, 0x80b20000, 0x43d50000, 0x70700000, 0x537f0000,
0x537f0000, 0x80700000, 0x53730000, 0x53050000, 0x7ce30000, 0x7bc90000, 0x7aee0000, 0x7a400000,
0x4e380000, 0x79eb0000, 0x79560000, 0x40e30000, 0x40390000, 0x771f0000, 0x40080000, 0x3f1b0000,
0x74850000, 0x745c0000, 0x3eb80000, 0x72950000, 0x9f160000, 0xb220b3c, 0x70770000, 0x704a0000,
0x701b0000, 0x6ecb0000, 0x6e6e0000, 0x99290000, 0x4b330000, 0x6d690000, 0x6d770000, 0x980b0000,
0x2add0338, 0x49950000, 0x92380000, 0x90940000, 0x8dbc0000, 0x8d1b0000, 0xa2b0a3c, 0xa1c0a3c,
0xa160a3c, 0x88fa0000, 0xa380a3c, 0xa320a3c, 0x88600000, 0x45d70000, 0x876b0000, 0x87790000,
0x9af09bc, 0x9a109bc, 0x83bd0000, 0x83ad0000, 0x82910000, 0x92b093c, 0x922093c, 0x917093c,
0x916093c, 0x81030000, 0x7ffa0000, 0x7e020000, 0x771e0000, 0x9ef90000, 0x99a70000, 0x72350000,
0x90f10000, 0x8d770000, 0x3010000, 0xb70000, 0x3b0000, 0x2b90000, 0x3080301, 0x3130000,
0x3000000, 0x30090000, 0xc50000, 0x20020000
};
static unsigned int utable_compose_result[] = {
0x226e, 0x2260, 0x226f, 0xc0, 0xc1, 0xc2, 0xc3, 0x100,
@ -533,36 +533,36 @@ static unsigned int utable_compose_result[] = {
the mapped index, negate, then multiply by 2 to find the pair. */
static unsigned int utable_compose_long_pairs[] = {
0x27ed3, 0x0, 0x25249, 0x0, 0x233d5, 0x0, 0x2284a, 0x0,
0x25aa7, 0x0, 0x2597c, 0x0, 0x2569a, 0x0, 0x25626, 0x0,
0x25133, 0x0, 0x250f2, 0x0, 0x24fb8, 0x0, 0x24735, 0x0,
0x21d0b, 0x0, 0x238a7, 0x0, 0x236a3, 0x0, 0x2300a, 0x0,
0x22bf1, 0x0, 0x22b0c, 0x0, 0x226d4, 0x0, 0x261da, 0x0,
0x22331, 0x0, 0x25cd0, 0x0, 0x22844, 0x0, 0x219c8, 0x0,
0x216a8, 0x0, 0x2051c, 0x0, 0x25aa7, 0x0, 0x256c5, 0x0,
0x2541d, 0x0, 0x25119, 0x0, 0x250f3, 0x0, 0x25044, 0x0,
0x2219f, 0x0, 0x24814, 0x0, 0x24608, 0x0, 0x20525, 0x0,
0x23f5e, 0x0, 0x23d1e, 0x0, 0x23cbc, 0x0, 0x23afa, 0x0,
0x23a8d, 0x0, 0x2346d, 0x0, 0x233c3, 0x0, 0x232b8, 0x0,
0x22331, 0x0, 0x2a392, 0x0, 0x216ea, 0x0, 0x20b63, 0x0,
0x20a2c, 0x0, 0x291df, 0x0, 0x2054b, 0x0, 0x2063a, 0x0,
0x1d158, 0x1d165, 0x2a291, 0x0, 0x2a105, 0x0, 0x29145, 0x0,
0x285d2, 0x0, 0x27f2f, 0x0, 0x27966, 0x0, 0x26fb1, 0x0,
0x26cd5, 0x0, 0x26c36, 0x0, 0x2339c, 0x0, 0x267b5, 0x0,
0x2335f, 0x0, 0x265a8, 0x0, 0x26523, 0x0, 0x26228, 0x0,
0x1d1bc, 0x1d16f, 0x1d1bc, 0x1d16e, 0x1d1ba, 0x1d165, 0x1d1b9, 0x1d165,
0x24fa1, 0x0, 0x24c92, 0x0, 0x24c36, 0x0, 0x243ab, 0x0,
0x24263, 0x0, 0x1d15f, 0x1d172, 0x1d15f, 0x1d170, 0x1d15f, 0x1d16e,
0x23f8e, 0x0, 0x23ed1, 0x0, 0x22183, 0x0, 0x2a20e, 0x0,
0x214e4, 0x0, 0x29496, 0x0, 0x2940a, 0x0, 0x208de, 0x0,
0x278ae, 0x0, 0x27667, 0x0, 0x26f2c, 0x0, 0x23393, 0x0,
0x2633e, 0x0, 0x2a600, 0x0, 0x2a0ce, 0x0, 0x29b30, 0x0,
0x295b6, 0x0, 0x2921a, 0x0, 0x28d77, 0x0, 0x28bfa, 0x0,
0x285ed, 0x0, 0x21de6, 0x0, 0x27ca8, 0x0, 0x21b18, 0x0,
0x1d1bb, 0x1d16f, 0x273ca, 0x0, 0x26d6b, 0x0, 0x26b3c, 0x0,
0x264da, 0x0, 0x262d9, 0x0, 0x26247, 0x0, 0x1d15f, 0x1d171,
0x1d15f, 0x1d16f, 0x1d157, 0x1d165, 0x25c80, 0x0, 0x25bab, 0x0,
0x2872e, 0x0, 0x20804, 0x0, 0x270d2, 0x0, 0x21de4, 0x0,
0x25f86, 0x0, 0x20122, 0x0, 0x1d1bb, 0x1d16e, 0x267a7, 0x0
0x21d0b, 0x0, 0x236a3, 0x0, 0x22bf1, 0x0, 0x22b0c, 0x0,
0x226d4, 0x0, 0x261da, 0x0, 0x22331, 0x0, 0x219c8, 0x0,
0x216a8, 0x0, 0x25cd0, 0x0, 0x22844, 0x0, 0x20b63, 0x0,
0x2051c, 0x0, 0x2a291, 0x0, 0x2a105, 0x0, 0x2a0ce, 0x0,
0x23cbc, 0x0, 0x23afa, 0x0, 0x23a8d, 0x0, 0x238a7, 0x0,
0x233c3, 0x0, 0x2300a, 0x0, 0x232b8, 0x0, 0x22331, 0x0,
0x2a392, 0x0, 0x22183, 0x0, 0x21de6, 0x0, 0x21de4, 0x0,
0x21b18, 0x0, 0x216ea, 0x0, 0x214e4, 0x0, 0x20a2c, 0x0,
0x291df, 0x0, 0x2054b, 0x0, 0x29145, 0x0, 0x285d2, 0x0,
0x27f2f, 0x0, 0x27966, 0x0, 0x26fb1, 0x0, 0x26cd5, 0x0,
0x26c36, 0x0, 0x2339c, 0x0, 0x267b5, 0x0, 0x2335f, 0x0,
0x265a8, 0x0, 0x26523, 0x0, 0x26228, 0x0, 0x25aa7, 0x0,
0x2597c, 0x0, 0x2569a, 0x0, 0x25626, 0x0, 0x25133, 0x0,
0x250f2, 0x0, 0x24fb8, 0x0, 0x24735, 0x0, 0x23f5e, 0x0,
0x23d1e, 0x0, 0x2346d, 0x0, 0x1d1bc, 0x1d16e, 0x1d1ba, 0x1d165,
0x1d1b9, 0x1d165, 0x1d15f, 0x1d172, 0x1d15f, 0x1d170, 0x1d15f, 0x1d16e,
0x1d157, 0x1d165, 0x2a20e, 0x0, 0x2921a, 0x0, 0x28d77, 0x0,
0x28bfa, 0x0, 0x208de, 0x0, 0x20804, 0x0, 0x27ca8, 0x0,
0x27667, 0x0, 0x270d2, 0x0, 0x26f2c, 0x0, 0x273ca, 0x0,
0x2063a, 0x0, 0x26b3c, 0x0, 0x23393, 0x0, 0x26247, 0x0,
0x25c80, 0x0, 0x2541d, 0x0, 0x25119, 0x0, 0x243ab, 0x0,
0x23f8e, 0x0, 0x29b30, 0x0, 0x285ed, 0x0, 0x26d6b, 0x0,
0x267a7, 0x0, 0x264da, 0x0, 0x1d1bc, 0x1d16f, 0x2633e, 0x0,
0x262d9, 0x0, 0x25f86, 0x0, 0x25bab, 0x0, 0x25aa7, 0x0,
0x20122, 0x0, 0x256c5, 0x0, 0x250f3, 0x0, 0x25044, 0x0,
0x24fa1, 0x0, 0x2219f, 0x0, 0x24c92, 0x0, 0x24c36, 0x0,
0x1d15f, 0x1d171, 0x1d15f, 0x1d16f, 0x24814, 0x0, 0x24608, 0x0,
0x1d158, 0x1d165, 0x2a600, 0x0, 0x24263, 0x0, 0x20525, 0x0,
0x23ed1, 0x0, 0x29496, 0x0, 0x2940a, 0x0, 0x2872e, 0x0,
0x278ae, 0x0, 0x295b6, 0x0, 0x1d1bb, 0x1d16f, 0x1d1bb, 0x1d16e
};
/* utable_decomp_keys identifies characters that have a canonical decomposition;
@ -862,8 +862,8 @@ static short utable_decomp_indices[] = {
125, 311, 126, 312, 155, 342, 156, 343,
135, 321, 140, 327, 61, 246, 9, 194,
46, 231, 401, 428, 399, 426, 110, 296,
486, 487, 177, 365, 1899, 1905, 1898, 1904,
1903, 1902, 378, 490, 1901, 497, 501, 506,
486, 487, 177, 365, 1904, 1898, 1903, 1902,
1901, 1900, 378, 490, 1899, 497, 501, 506,
513, 518, 524, 577, 509, 521, 531, 539,
543, 549, 580, 552, 566, 557, 563, 571,
583, 584, 589, 591, 588, 585, 599, 595,
@ -874,14 +874,14 @@ static short utable_decomp_indices[] = {
635, 636, 607, 629, 601, 623, 603, 625,
604, 626, 605, 627, 606, 628, 637, 638,
640, 639, 641, 644, 642, 643, 645, 646,
647, 1798, 1879, 1878, 1797, 1877, 1796, 1795,
1876, 648, 649, 1784, 1874, 1873, 1872, 1871,
1870, 1869, 1756, 1868, 651, 650, 652, 1733,
1837, 653, 654, 656, 655, 657, 658, 660,
647, 1810, 1888, 1887, 1809, 1808, 1886, 1885,
1807, 648, 649, 1881, 1801, 1880, 1875, 1874,
1872, 1782, 1871, 1870, 651, 650, 652, 1731,
1853, 653, 654, 656, 655, 657, 658, 660,
661, 659, 662, 663, 665, 664, 666, 667,
669, 668, 1769, 1768, 1766, 1765, 1764, 1762,
1897, 1760, 1759, 1758, 1757, 1754, 1345, 1751,
1750, 1748, 1745, 670, 17, 202, 19, 204,
669, 668, 1794, 1793, 1792, 1791, 1790, 1787,
1786, 1362, 1785, 1361, 1783, 1780, 1779, 1777,
1776, 1775, 1773, 670, 17, 202, 19, 204,
20, 205, 21, 206, 388, 415, 27, 212,
29, 214, 32, 217, 30, 215, 31, 216,
442, 444, 443, 445, 48, 233, 49, 234,
@ -924,167 +924,167 @@ static short utable_decomp_indices[] = {
768, 567, 568, 769, 772, 770, 773, 771,
774, 522, 775, 776, 777, 572, 573, 778,
782, 779, 783, 780, 784, 525, 526, 792,
796, 793, 797, 794, 798, 530, 936, 538,
935, 542, 934, 548, 933, 556, 932, 562,
931, 570, 930, 688, 692, 693, 694, 695,
796, 793, 797, 794, 798, 530, 935, 538,
934, 542, 933, 548, 932, 556, 931, 562,
930, 570, 929, 688, 692, 693, 694, 695,
696, 697, 698, 702, 706, 707, 708, 709,
710, 711, 712, 724, 728, 729, 730, 731,
732, 733, 734, 738, 742, 743, 744, 745,
746, 747, 748, 781, 785, 786, 787, 788,
789, 790, 791, 795, 799, 800, 801, 802,
803, 804, 805, 533, 532, 806, 537, 528,
536, 809, 492, 491, 489, 929, 495, 928,
379, 807, 547, 529, 546, 813, 496, 927,
500, 926, 504, 810, 811, 812, 551, 550,
576, 925, 555, 578, 508, 507, 505, 924,
815, 816, 817, 565, 564, 579, 923, 560,
561, 569, 581, 520, 519, 517, 922, 516,
377, 1741, 921, 808, 575, 582, 574, 814,
512, 920, 523, 919, 527, 918, 1737, 917,
1727, 1725, 1667, 818, 819, 820, 821, 823,
536, 809, 492, 491, 489, 928, 495, 927,
379, 807, 547, 529, 546, 813, 496, 926,
500, 925, 504, 810, 811, 812, 551, 550,
576, 924, 555, 578, 508, 507, 505, 923,
815, 816, 817, 565, 564, 579, 922, 560,
561, 569, 581, 520, 519, 517, 921, 516,
377, 1770, 920, 808, 575, 582, 574, 814,
512, 919, 523, 918, 527, 917, 1907, 1767,
1713, 1712, 1906, 818, 819, 820, 821, 823,
822, 824, 825, 826, 827, 828, 829, 830,
831, 832, 1, 834, 833, 0, 2, 835,
836, 837, 838, 839, 840, 841, 842, 845,
846, 847, 848, 851, 852, 853, 854, 843,
844, 849, 850, 855, 856, 857, 858, 1907,
1906, 1857, 860, 861, 862, 863, 864, 865,
844, 849, 850, 855, 856, 857, 858, 1557,
1905, 1864, 860, 861, 862, 863, 864, 865,
866, 867, 868, 869, 870, 871, 872, 873,
874, 875, 876, 877, 878, 879, 880, 881,
882, 883, 884, 859, 885, 887, 888, 889,
890, 891, 892, 893, 894, 895, 896, 897,
898, 899, 900, 901, 902, 903, 904, 905,
906, 907, 908, 909, 910, 911, 886, 912,
913, 914, 915, 916, 1517, 1186, 1516, 1185,
1515, 1184, 1514, 1183, 1513, 1182, 1512, 1181,
1511, 1180, 1510, 1179, 1178, 1509, 1508, 1177,
1176, 1507, 1175, 1506, 1505, 1174, 1173, 1504,
1503, 1172, 1171, 1502, 1501, 1170, 1500, 1169,
1168, 1499, 1167, 1498, 1166, 1497, 1165, 1496,
1164, 1495, 1163, 1494, 1162, 1493, 1492, 1161,
1160, 1491, 1159, 1490, 1489, 1158, 1488, 1157,
1156, 1487, 1486, 1155, 1485, 1154, 1484, 1153,
1152, 1483, 1482, 1151, 1481, 1150, 1480, 1149,
1479, 1148, 1478, 1147, 1477, 1146, 1476, 1145,
1475, 1144, 1474, 1143, 1473, 1142, 1472, 1141,
1471, 1140, 1470, 1139, 1469, 1138, 1468, 1137,
1136, 1467, 1466, 1135, 1465, 1134, 1464, 1133,
1463, 1132, 1462, 1131, 1461, 1130, 1460, 1129,
1128, 1459, 1458, 1127, 1457, 1126, 1456, 1125,
1124, 1455, 1454, 1123, 1453, 1122, 1452, 1121,
1451, 1120, 1450, 1119, 1118, 1449, 1448, 1117,
1447, 1116, 1446, 1115, 1445, 1114, 1444, 1113,
1443, 1112, 1442, 1111, 1110, 1441, 1440, 1109,
1108, 1439, 1438, 1107, 1437, 1106, 1436, 1105,
1435, 1104, 1103, 1434, 1433, 1102, 1101, 1432,
1431, 1100, 1099, 1430, 1429, 1098, 1428, 1097,
1427, 1096, 1426, 1095, 1425, 1094, 1424, 1093,
1423, 1092, 1091, 1422, 1421, 1090, 1420, 1089,
1419, 1088, 1418, 1087, 1086, 1417, 1085, 1416,
1415, 1084, 1414, 1083, 1413, 1082, 1412, 1081,
1411, 1080, 1410, 1079, 1409, 1078, 1408, 1077,
1407, 1076, 1406, 1075, 1405, 1074, 1404, 1073,
1403, 1072, 1402, 1071, 1401, 1070, 1400, 1069,
1399, 1068, 1398, 1067, 1066, 1397, 1396, 1065,
1395, 1064, 1394, 1063, 1393, 1062, 1392, 1061,
1391, 1060, 1390, 1059, 1389, 1058, 1388, 1057,
1387, 1056, 1055, 1386, 1385, 1054, 1053, 1384,
1383, 1052, 1051, 1050, 1049, 1382, 1048, 1381,
1047, 1380, 1046, 1379, 1045, 1044, 1043, 1042,
1041, 1040, 1378, 1039, 1377, 1038, 1376, 1037,
1375, 1036, 1374, 1035, 1373, 1034, 1372, 1033,
1371, 1032, 1370, 1031, 1369, 1030, 1368, 1029,
1028, 1367, 1366, 1027, 1365, 1026, 1364, 1025,
1363, 1024, 1362, 1023, 1361, 1022, 1360, 1021,
1359, 1020, 1358, 1019, 1357, 1018, 1356, 1017,
1355, 1016, 1354, 1015, 1353, 1014, 1352, 1013,
1351, 1012, 1350, 1011, 1349, 1010, 1348, 1009,
1008, 1007, 1347, 1006, 1346, 1344, 1005, 1343,
1004, 1342, 1003, 1341, 1002, 1339, 1001, 1338,
1000, 1336, 999, 1335, 998, 1333, 997, 1332,
996, 1331, 995, 1330, 994, 1328, 993, 1327,
992, 1325, 991, 1324, 990, 1322, 989, 1321,
988, 1319, 987, 1318, 986, 1316, 985, 1315,
984, 1313, 983, 1312, 982, 1310, 981, 1309,
980, 1307, 979, 1306, 978, 1304, 977, 1303,
976, 1301, 975, 1300, 974, 1298, 973, 1297,
972, 1295, 971, 1294, 970, 1293, 969, 1292,
968, 1290, 967, 1289, 966, 1288, 965, 1287,
964, 963, 1285, 1284, 962, 1282, 961, 1281,
-4, -23, -3, 1279, 960, 1277, -2, -22,
-1, 1275, 959, 958, 957, 1223, 956, 1221,
955, 1220, 954, 1218, 953, 1217, 952, 1215,
951, 950, 1212, 949, 1211, 948, 947, 946,
1207, 945, 944, 943, 942, 1203, 941, 1201,
940, 1200, 939, 1198, 938, -114, -53, -80,
-113, -79, -112, -78, -72, -71, -123, -70,
-105, -69, 1340, 1863, 1862, -122, 1653, 1780,
1337, 1652, 1651, 1779, 1650, 1861, 1334, -52,
1649, 1777, 1648, 1776, -26, 1647, 1646, 1775,
-51, 1858, 1329, 1645, 1644, 1856, -50, 1854,
1326, 1774, 1643, 1773, 1642, 1853, 1323, 1641,
1852, 1896, 1640, 1771, 1320, 1639, 1638, 1770,
1637, 1849, 1317, 1636, 1635, 1848, -49, 1846,
1314, 1634, -48, 1845, 1633, 1844, 1311, 1632,
1631, 1843, 1630, 1841, 1308, 1629, 1628, 1761,
1627, 1894, 1305, 1626, 1625, 1838, 1624, 937,
1302, 1836, 1623, 1835, 1755, 1834, 1299, 1622,
1833, 1892, 1621, -85, 1296, 1620, 1619, 1753,
1752, 1832, -25, -47, 1829, 1891, 1618, 1828,
1291, 1747, 1617, 1746, 1616, 1827, -24, 1615,
1614, 1826, 1613, -104, 1286, 1612, 1611, 1743,
1610, 1823, 1283, 1609, 1608, -120, 1607, -102,
1280, 1606, 1740, 1820, 1605, 1739, 1278, 1604,
1603, 1818, 1602, -83, 1276, 1738, 1601, 1736,
1274, -46, 1273, -45, -21, 1600, 1272, 1599,
1271, -44, -20, 1598, 1270, 1597, 1269, 1596,
1268, 1595, 1267, 1594, 1266, 1593, -19, 1592,
1265, 1591, 1264, 1590, 1263, 1589, 1262, 1588,
1261, 1587, 1260, 1586, 1259, 1585, 1258, 1584,
1257, 1583, -18, 1582, 1256, 1581, 1255, 1580,
-17, 1805, 1254, 1579, 1253, 1578, 1252, 1577,
1251, 1576, 1250, 1575, -16, 1735, 1249, 1574,
1248, 1573, 1247, 1572, 1246, 1571, 1245, 1570,
1244, 1569, 1243, 1568, 1242, 1567, 1241, -43,
1240, 1566, 1239, 1565, 1238, -42, 1237, 1564,
1236, 1563, 1235, 1562, 1234, 1561, -15, 1560,
1233, 1559, -14, 1558, 1232, 1557, 1231, 1556,
1230, -41, -13, -40, 1229, -39, 1228, 1555,
1227, 1554, 1226, 1553, 1225, 1552, 1224, 1551,
-38, 1875, 1222, 1550, 1549, 1800, 1548, -82,
1219, 1547, -37, -81, 1546, 1734, 1216, 1545,
1544, 1799, 1214, 1543, 1213, -36, 1542, -77,
1541, -76, 1210, 1540, 1209, -35, 1208, 1539,
-12, -34, 1538, 1732, 1206, 1537, 1205, 1536,
1204, 1535, 1534, 1731, 1202, 1533, 1532, -75,
1531, -74, 1199, -33, 1530, -73, -11, -32,
1197, 1529, 1196, -31, -10, -30, -9, 1528,
1195, 1527, 1194, 1526, 1193, 1525, 1192, -29,
1191, 1524, 1190, 1523, -8, 1522, -7, -28,
1189, 1521, 1188, 1520, 1187, 1519, -6, -27,
-5, 1518, 1730, -116, 1729, 1867, 1794, -115,
1728, 1866, 1726, 1865, 1793, -121, 1724, 1895,
1723, 1864, 1722, 1792, -68, -111, 1721, -110,
1720, -93, 1719, 1860, 1718, -109, -67, 1791,
-66, 1859, -65, 1893, 1717, 1790, 1716, 1855,
1715, -124, -64, -92, -63, 1789, 1714, 1900,
1713, 1788, 1712, 1851, 1711, 1850, 1710, 1787,
1709, -108, 1708, 1847, 1707, 1786, 1706, 1890,
1705, 1785, 1704, 1889, 1703, 1842, -62, -107,
-61, 1840, 1702, 1839, 1701, -106, 1700, -91,
1699, 1888, -60, -119, 1698, 1783, 1697, 1887,
1696, 1782, 1695, 1781, 1694, 1886, 1693, 1831,
1830, 1885, 1692, 1778, 1691, 1884, 1690, -90,
1689, 1883, 1688, 1882, 1687, -89, -59, 1825,
1686, 1824, 1685, 1822, 1684, -103, 1683, 1821,
1682, 1772, -58, -118, 1681, 1819, 1680, -88,
1679, 1817, -57, -101, 1678, 1767, 1816, -117,
1677, 1815, 1676, 1763, 1675, 1814, 1674, -100,
1673, 1813, 1672, -99, 1671, 1812, 1670, 1811,
-56, -98, 1669, 1810, 1668, -87, 1666, -86,
1665, 1809, 1664, -97, 1663, 1808, 1662, 1807,
1661, 1749, 1660, -96, 1659, 1806, 1658, 1744,
1804, 1881, -95, 1880, -55, -84, -54, 1803,
1657, 1802, 1656, 1742, 1655, 1801, 1654, -94
913, 914, 915, 916, 1185, 1502, 1184, 1501,
1500, 1183, 1499, 1182, 1498, 1181, 1497, 1180,
1496, 1179, 1495, 1178, 1494, 1177, 1493, 1176,
1492, 1175, 1491, 1174, 1490, 1173, 1489, 1172,
1488, 1171, 1487, 1170, 1169, 1486, 1168, 1485,
1167, 1484, 1166, 1483, 1482, 1165, 1481, 1164,
1480, 1163, 1162, 1479, 1478, 1161, 1477, 1160,
1159, 1476, 1158, 1475, 1157, 1474, 1473, 1156,
1155, 1472, 1154, 1471, 1153, 1470, 1469, 1152,
1468, 1151, 1467, 1150, 1466, 1149, 1465, 1148,
1464, 1147, 1463, 1146, 1462, 1145, 1461, 1144,
1460, 1143, 1459, 1142, 1141, 1458, 1140, 1457,
1139, 1456, 1138, 1455, 1137, 1454, 1453, 1136,
1452, 1135, 1451, 1134, 1133, 1450, 1449, 1132,
1448, 1131, 1130, 1447, 1129, 1446, 1445, 1128,
1444, 1127, 1443, 1126, 1442, 1125, 1441, 1124,
1123, 1440, 1439, 1122, 1438, 1121, 1437, 1120,
1436, 1119, 1435, 1118, 1434, 1117, 1433, 1116,
1432, 1115, 1431, 1114, 1430, 1113, 1429, 1112,
1428, 1111, 1427, 1110, 1426, 1109, 1425, 1108,
1424, 1107, 1423, 1106, 1422, 1105, 1421, 1104,
1420, 1103, 1419, 1102, 1418, 1101, 1417, 1100,
1416, 1099, 1415, 1098, 1414, 1097, 1413, 1096,
1412, 1095, 1411, 1094, 1410, 1093, 1409, 1092,
1408, 1091, 1407, 1090, 1406, 1089, 1405, 1088,
1404, 1087, 1403, 1086, 1085, 1402, 1084, 1401,
1400, 1083, 1399, 1082, 1398, 1081, 1397, 1080,
1396, 1079, 1078, 1395, 1394, 1077, 1393, 1076,
1392, 1075, 1391, 1074, 1390, 1073, 1389, 1072,
1388, 1071, 1387, 1070, 1386, 1069, 1385, 1068,
1384, 1067, 1066, 1383, 1382, 1065, 1381, 1064,
1380, 1063, 1379, 1062, 1378, 1061, 1377, 1060,
1376, 1059, 1058, 1375, 1374, 1057, 1373, 1056,
1372, 1055, 1371, 1054, 1370, 1053, 1369, 1052,
1368, 1051, 1049, 1048, 1047, 1366, 1046, 1365,
1045, 1364, 1044, 1363, 1043, 1042, 1041, 1040,
1039, 1038, 1037, 1360, 1359, 1036, 1358, 1035,
1357, 1034, 1356, 1033, 1355, 1032, 1354, 1031,
1030, 1353, 1352, 1029, 1351, 1028, 1350, 1027,
1349, 1026, 1348, 1025, 1024, 1347, 1346, 1023,
1345, 1022, 1344, 1021, 1343, 1020, 1342, 1019,
1341, 1018, 1340, 1017, 1339, 1016, 1338, 1015,
1337, 1014, 1336, 1013, 1335, 1012, 1334, 1011,
1333, 1010, 1332, 1009, 1331, 1008, 1330, 1007,
1006, 1329, 1005, 1328, 1004, 1327, 1003, 1326,
1002, 1325, 1001, 1324, 1000, 1323, 999, 1322,
998, 1321, 997, 1320, 996, 1319, 995, 1318,
994, 1317, 993, 1316, 992, 1315, 991, 1314,
990, 1313, 989, 1312, 988, 1311, 987, 1310,
986, 1309, 985, 1308, 984, 1307, 983, 1306,
982, 1305, 981, 1304, 980, 1303, 979, 1302,
978, 1301, 977, 1300, 976, 1299, 975, 1298,
974, 1295, 973, 1294, 972, 1293, 971, 1292,
970, 1290, 969, 1289, 968, 1288, 967, 1287,
966, 1284, 965, 1283, 964, 1282, 963, 1281,
962, 1278, 961, 1277, 960, 1276, 959, 1275,
-4, -15, -3, 1273, 958, 1272, -2, -14,
-1, 1269, 957, 956, 955, 1215, 954, 1214,
953, 1213, 952, 1210, 951, 1209, 950, 1208,
949, 948, 1204, 947, 1203, 946, 945, 944,
943, 1198, 942, 941, 940, 1195, 939, 1193,
938, 1192, 937, 1191, 936, -69, -113, -68,
-110, -67, -109, -66, -65, -64, -124, -63,
-123, -95, 1766, 1840, 1765, -101, 1613, 1764,
1297, 1612, 1296, 1610, 1609, 1763, 1608, -81,
1607, 1762, 1604, 1760, -17, 1603, 1291, 1602,
-38, 1759, 1600, 1757, 1599, 1756, -37, 1755,
1286, 1598, 1285, 1597, 1596, 1751, 1595, 1750,
1594, 1749, 1593, 1835, 1280, 1592, 1279, 1591,
1590, 1834, 1589, 1832, 1588, 1831, -36, 1830,
1274, 1587, -16, 1586, 1585, 1827, 1584, 1826,
1583, 1825, 1745, 1823, 1271, 1582, 1270, 1581,
1580, 1744, 1268, 1579, 1267, 1578, 1266, 1577,
1265, 1576, 1264, 1575, 1263, 1574, 1262, 1573,
1261, 1739, 1260, -35, 1259, 1572, 1258, 1571,
1257, 1570, -13, -34, 1256, 1569, 1255, 1568,
1254, 1567, 1253, 1566, 1252, 1565, -12, 1564,
1251, 1563, 1250, -33, 1249, 1562, 1248, 1561,
1247, 1560, 1246, 1559, 1245, -32, 1244, -31,
1243, 1558, 1242, 1556, 1241, 1555, 1240, 1554,
1239, 1553, 1238, -30, 1237, 1552, 1236, 1551,
1235, -29, 1234, -28, -11, 1550, 1233, 1549,
1232, -27, -10, 1548, 1231, 1547, 1230, 1546,
1229, 1545, 1228, 1544, 1227, 1543, -9, 1542,
1226, 1541, 1225, 1540, 1224, 1539, 1223, 1538,
1222, 1537, 1221, 1536, 1220, 1535, 1219, 1534,
1218, 1533, -8, 1532, 1217, 1531, 1216, 1530,
-7, 1529, 1528, 1721, 1527, 1720, 1526, 1719,
1212, 1525, 1211, 1524, -26, 1718, 1523, 1717,
1522, 1716, 1207, 1521, 1206, 1520, 1205, 1519,
1518, 1715, 1517, 1714, 1202, 1516, 1201, -25,
1200, 1515, 1199, 1514, 1513, -62, 1197, 1512,
1196, 1511, 1510, 1711, 1194, 1509, -6, 1508,
1507, 1710, -24, 1709, 1506, 1708, 1190, 1505,
1189, -23, -5, -22, 1188, -21, 1187, 1504,
1186, 1503, 1707, 1862, 1706, 1861, 1705, 1805,
-61, 1804, 1704, 1858, 1703, 1857, 1702, -117,
1701, 1803, -60, -89, 1700, 1802, 1699, 1856,
1698, 1855, 1697, 1854, 1696, -116, 1695, -115,
1694, -88, 1693, 1895, 1692, -112, 1691, 1851,
-59, -111, 1690, 1800, 1689, 1799, 1688, 1850,
1687, 1849, 1686, 1848, 1685, 1847, 1798, -108,
1684, -107, 1683, -106, 1682, -105, -58, -104,
1681, 1846, 1797, -103, -57, -87, -56, 1892,
1680, 1845, 1679, 1844, 1678, 1796, 1677, -86,
1676, 1795, 1675, 1843, -55, 1842, -54, -102,
1674, 1841, 1789, 1839, 1673, 1788, -53, -100,
-52, 1838, 1672, -99, 1671, 1837, 1670, -85,
1669, 1784, 1668, 1836, 1667, -98, 1666, 1781,
1665, 1891, 1664, 1778, -51, -84, 1663, -97,
1662, -96, 1661, 1890, 1660, -94, -50, 1774,
-49, 1833, -48, 1829, 1828, 1889, 1659, 1772,
1658, -93, -47, -83, -46, 1771, 1657, 1824,
1656, 1884, 1655, 1769, 1654, 1822, 1653, 1768,
1652, -82, 1651, 1821, 1820, 1883, 1819, 1882,
1650, 1818, 1649, 1817, 1648, 1816, -45, -92,
-44, 1761, 1647, 1815, 1646, -80, 1645, -79,
1644, 1758, -43, -78, 1643, 1754, 1642, 1753,
1641, 1752, 1640, 1814, 1639, 1879, 1638, 1878,
1637, 1877, 1636, 1813, 1635, 1876, 1634, -77,
1633, 1748, 1812, 1873, 1632, -121, -42, 1747,
1631, 1746, 1743, 1811, 1630, -76, 1629, 1742,
1869, 1897, -41, -75, 1741, 1868, 1628, -74,
1627, 1740, -40, -91, 1867, 1896, 1626, -120,
1625, 1866, 1624, 1738, 1623, 1737, 1622, -73,
1621, 1865, 1620, -72, 1619, 1736, 1618, 1735,
-39, -71, 1617, 1734, 1616, -119, 1615, -118,
1614, 1863, 1733, -122, 1732, 1860, 1859, 1894,
1611, 1730, 1729, -90, 1606, 1728, 1605, 1727,
1050, 1367, -20, 1601, -19, -70, -18, 1726,
1725, 1893, 1724, 1806, 1723, 1852, 1722, -114
};
/* utable_kompat_decomp_keys identifies characters that have a compatability decomposition;

View File

@ -9,6 +9,6 @@
#define MZSCHEME_VERSION_MAJOR 352
#define MZSCHEME_VERSION_MINOR 5
#define MZSCHEME_VERSION_MINOR 6
#define MZSCHEME_VERSION "352.5" _MZ_SPECIAL_TAG
#define MZSCHEME_VERSION "352.6" _MZ_SPECIAL_TAG

View File

@ -1334,34 +1334,23 @@
"(ormap(lambda(i)(bound-identifier=? i r)) l))"
"(hash-table-put! ht(syntax-e r)(cons r l)))))))))"
"(if proto-r"
" `(lambda(r src)"
" ,(let((main `(datum->syntax-object(quote-syntax ,(and dest"
"(datum->syntax-object"
" `(lambda(r)"
" ,(let((main(let((build(apply-to-r l)))"
"(if(and(pair? build)"
"(eq?(car build) 'pattern-substitute))"
" build"
"(let((small-dest "
"(and dest(datum->syntax-object"
" dest"
" 'dest"
" #f)))"
" ,(apply-to-r l)"
" src)))"
" dest))))"
" `(datum->syntax-object/shape(quote-syntax ,small-dest)"
" ,build))))))"
"(if(multiple-ellipsis-vars? proto-r)"
" `(let((exnh #f))"
"((let/ec esc"
"(dynamic-wind"
"(lambda()"
"(set! exnh(current-exception-handler))"
"(current-exception-handler"
"(lambda(exn)"
"(esc"
"(lambda()"
"(if(exn:break? exn)"
"(raise exn)"
"(ellipsis-count-error"
" `(catch-ellipsis-error"
"(lambda() ,main)"
"(quote ,p)"
"(quote-syntax ,(datum->syntax-object #f '... p)))))))))"
"(lambda()"
"(let((v ,main))"
"(lambda() v)))"
"(lambda()"
"(current-exception-handler exnh))))))"
"(quote-syntax ,(datum->syntax-object #f '... p)))"
" main)))"
"(apply append(hash-table-map ht(lambda(k v) v))))))"
"(-define(apply-to-r rest)"
@ -1381,27 +1370,72 @@
"(eq?(car t) 'quote-syntax)"
"(eq?(cadr t)(stx-cdr p)))))"
" `(quote-syntax ,p))"
"((syntax? stx)"
"(let((ctx(datum->syntax-object stx 'ctx stx)))"
" `(datum->syntax-object(quote-syntax ,ctx)"
" ,(apply-cons #f h t p) "
"(quote-syntax ,ctx))))"
"((eq? t 'null)"
" `(list-immutable ,h))"
"((and(pair? t)"
"(memq(car t) '(list-immutable list*-immutable)))"
" `(,(car t) ,h ,@(cdr t)))"
"((and(pair? t)"
"(eq?(car t) 'cons-immutable))"
" `(list*-immutable ,h ,@(cdr t)))"
"((and(pair? h)(pair? t)"
"(eq?(car h) 'car)"
"(eq?(car t) 'cdr)"
"(symbol?(cadr h))"
"(eq?(cadr h)(cadr t)))"
"(cadr h))"
"(eq?(car t) 'pattern-substitute))"
"(cond"
"((and(pair? h)"
"(eq?(car h) 'quote-syntax)"
"(eq?(cadr h)(stx-car p)))"
" `(pattern-substitute"
"(quote-syntax ,(let((v(cons(cadr h)(cadadr t))))"
"(if(syntax? stx)"
"(datum->syntax-object stx"
" v"
" stx"
" stx)"
" v)))"
" . ,(cddr t)))"
"((and(pair? h)"
"(eq? 'pattern-substitute(car h)))"
" `(pattern-substitute(quote-syntax ,(let((v(cons(cadadr h)(cadadr t))))"
"(if(syntax? stx)"
"(datum->syntax-object stx"
" v"
" stx"
" stx)"
" v)))"
" ,@(cddr h) "
" . ,(cddr t)))"
"(else"
" `(cons-immutable ,h ,t))))"
"(let*((id(gensym))"
"(expr(cons id(cadadr t)))"
"(expr(if(syntax? stx)"
"(datum->syntax-object stx"
" expr"
" stx"
" stx)"
" expr)))"
" `(pattern-substitute"
"(quote-syntax ,expr)"
" ,id ,h"
" . ,(cddr t))))))"
"((eq? t 'null)"
"(apply-cons stx h "
" `(pattern-substitute(quote-syntax()))"
" p))"
"((and(pair? t)"
"(eq?(car t) 'quote-syntax)"
"(stx-smaller-than?(car t) 10))"
"(apply-cons stx h "
" `(pattern-substitute ,t)"
" p))"
"(else"
"(apply-cons stx h"
"(let((id(gensym)))"
" `(pattern-substitute(quote-syntax ,id)"
" ,id ,t))"
" p))))"
"(-define(stx-smaller-than? stx sz)"
"(sz . > .(stx-size stx(add1 sz))))"
"(-define(stx-size stx up-to)"
"(cond"
"((up-to . < . 1) 0)"
"((syntax? stx)(stx-size(syntax-e stx) up-to))"
"((pair? stx)(let((s1(stx-size(car stx) up-to)))"
"(+ s1(stx-size(cdr stx)(- up-to s1)))))"
"((vector? stx)(stx-size(vector->list stx) up-to))"
"((box? stx)(add1(stx-size(unbox stx)(sub1 up-to))))"
"(else 1)))"
"(-define(apply-list-ref e p use-tail-pos)"
"(cond"
"((and use-tail-pos(= p use-tail-pos))"
@ -1568,14 +1602,126 @@
);
EVAL_ONE_STR(
"(module #%stxcase #%kernel"
"(require #%stx #%small-scheme)"
"(require #%stx #%small-scheme #%paramz)"
"(require-for-syntax #%stx #%small-scheme #%sc #%kernel)"
"(-define(ellipsis-count-error sexp sloc)"
"(-define(datum->syntax-object/shape orig datum)"
"(if(syntax? datum)"
" datum"
"(let((stx(datum->syntax-object orig datum orig)))"
"(let((shape(syntax-property stx 'paren-shape)))"
"(if shape"
"(syntax-property stx 'paren-shape shape)"
" stx)))))"
"(-define(catch-ellipsis-error thunk sexp sloc)"
"((let/ec esc"
"(with-continuation-mark"
" parameterization-key"
"(extend-parameterization"
"(continuation-mark-set-first #f parameterization-key)"
" current-exception-handler"
"(lambda(exn)"
"(esc"
"(lambda()"
"(if(exn:break? exn)"
"(raise exn)"
"(raise-syntax-error"
" 'syntax"
" \"incompatible ellipsis match counts for template\""
" sexp"
" sloc))"
" sloc))))))"
"(let((v(thunk)))"
"(lambda() v))))))"
"(-define substitute-stop 'dummy)"
"(-define-syntax pattern-substitute"
"(lambda(stx)"
"(let((pat(stx-car(stx-cdr stx)))"
"(subs(stx->list(stx-cdr(stx-cdr stx)))))"
"(let((ht-common(make-hash-table 'equal))"
"(ht-map(make-hash-table)))"
"(let loop((subs subs))"
"(unless(null? subs)"
"(let((id(syntax-e(car subs)))"
"(expr(cadr subs)))"
"(when(or(identifier? expr)"
"(and(stx-pair? expr)"
"(memq(syntax-e(stx-car expr))"
" '(car cadr caddr cadddr"
" cdr cddr cdddr cddddr"
" list-ref list-tail))"
"(stx-pair?(stx-cdr expr))"
"(identifier?(stx-car(stx-cdr expr)))))"
"(let((s-expr(syntax-object->datum expr)))"
"(let((new-id(hash-table-get ht-common s-expr #f)))"
"(if new-id"
"(hash-table-put! ht-map id new-id)"
"(hash-table-put! ht-common s-expr id))))))"
"(loop(cddr subs))))"
"(let((new-pattern(if(zero?(hash-table-count ht-map))"
" pat"
"(let loop((stx pat))"
"(cond"
"((pair? stx)"
"(let((a(loop(car stx)))"
"(b(loop(cdr stx))))"
"(if(and(eq? a(car stx))"
"(eq? b(cdr stx)))"
" stx"
"(cons a b))))"
"((symbol? stx)"
"(let((new-id(hash-table-get ht-map stx #f)))"
"(or new-id stx)))"
"((syntax? stx) "
"(let((new-e(loop(syntax-e stx))))"
"(if(eq?(syntax-e stx) new-e)"
" stx"
"(datum->syntax-object stx new-e stx stx))))"
"((vector? stx)"
"(list->vector(map loop(vector->list stx))))"
"((box? stx)(box(loop(unbox stx))))"
"(else stx))))))"
"(datum->syntax-object(quote-syntax here)"
" `(apply-pattern-substitute"
" ,new-pattern"
"(quote ,(let loop((subs subs))"
"(cond"
"((null? subs) null)"
"((hash-table-get ht-map(syntax-e(car subs)) #f)"
"(loop(cddr subs)))"
"(else"
"(cons(car subs)(loop(cddr subs)))))))"
" . ,(let loop((subs subs))"
"(cond"
"((null? subs) null)"
"((hash-table-get ht-map(syntax-e(car subs)) #f)"
"(loop(cddr subs)))"
"(else"
"(cons(cadr subs)(loop(cddr subs)))))))"
" stx))))))"
"(-define apply-pattern-substitute"
"(lambda(stx sub-ids . sub-vals)"
"(let loop((stx stx))"
"(cond"
"((pair? stx)(let((a(loop(car stx)))"
"(b(loop(cdr stx))))"
"(if(and(eq? a(car stx))"
"(eq? b(cdr stx)))"
" stx"
"(cons a b))))"
"((symbol? stx)"
"(let sloop((sub-ids sub-ids)(sub-vals sub-vals))"
"(cond"
"((null? sub-ids) stx)"
"((eq? stx(car sub-ids))(car sub-vals))"
"(else(sloop(cdr sub-ids)(cdr sub-vals))))))"
"((syntax? stx) "
"(let((new-e(loop(syntax-e stx))))"
"(if(eq?(syntax-e stx) new-e)"
" stx"
"(datum->syntax-object/shape stx new-e))))"
"((vector? stx)"
"(list->vector(map loop(vector->list stx))))"
"((box? stx)(box(loop(unbox stx))))"
"(else stx)))))"
"(-define-syntax syntax-case**"
"(lambda(x)"
"(-define l(and(stx-list? x)(cdr(stx->list x))))"
@ -1845,9 +1991,7 @@
"((zero? len)(quote-syntax()))"
"((= len 1)(car r))"
"(else"
"(cons(quote-syntax list*) r))))"
"(list(quote-syntax quote-syntax)"
"(datum->syntax-object #f 'srctag x))))))))))"
"(cons(quote-syntax list*) r))))))))))))"
" x)))"
"(provide syntax-case** syntax))"
);
@ -2672,7 +2816,7 @@
"(and(string? s)"
"(or(relative-path? s)"
"(absolute-path? s)))))"
" (define -re:suffix (byte-regexp #\"([.][^.]*|)$\")) "
" (define -re:suffix #rx#\"([.][^.]*|)$\")"
"(define(path-replace-suffix s sfx)"
"(unless(path-string? s)"
" (raise-type-error 'path-replace-suffix \"path or valid-path string\" 0 s sfx))"
@ -3037,9 +3181,9 @@
"(define(load/use-compiled f)((current-load/use-compiled) f #f))"
"(current-reader-guard(let((default-reader-guard(lambda(path) path)))"
" default-reader-guard))"
" (define -re:dir (byte-regexp #\"(.+?)/+(.*)\"))"
" (define -re:auto (byte-regexp #\"^,\"))"
" (define -re:ok-relpath (byte-regexp #\"^[-a-zA-Z0-9_. ]+(/+[-a-zA-Z0-9_. ]+)*$\"))"
" (define -re:dir #rx#\"(.+?)/+(.*)\")"
" (define -re:auto #rx#\"^,\")"
" (define -re:ok-relpath #rx#\"^[-a-zA-Z0-9_. ]+(/+[-a-zA-Z0-9_. ]+)*$\")"
"(define -module-hash-table-table(make-hash-table 'weak)) "
"(define -path-cache(make-hash-table 'weak 'equal)) "
"(define -loading-filename(gensym))"

View File

@ -1558,36 +1558,24 @@
(ormap (lambda (i) (bound-identifier=? i r)) l))
(hash-table-put! ht (syntax-e r) (cons r l)))))))])
(if proto-r
`(lambda (r src)
,(let ([main `(datum->syntax-object (quote-syntax ,(and dest
;; In case dest has significant structure...
(datum->syntax-object
dest
'dest
#f)))
,(apply-to-r l)
src)])
`(lambda (r)
,(let ([main (let ([build (apply-to-r l)])
(if (and (pair? build)
(eq? (car build) 'pattern-substitute))
build
(let ([small-dest ;; In case dest has significant structure...
(and dest (datum->syntax-object
dest
'dest
dest))])
`(datum->syntax-object/shape (quote-syntax ,small-dest)
,build))))])
(if (multiple-ellipsis-vars? proto-r)
`(let ([exnh #f])
((let/ec esc
(dynamic-wind
(lambda ()
(set! exnh (current-exception-handler))
(current-exception-handler
(lambda (exn)
(esc
(lambda ()
(if (exn:break? exn)
(raise exn)
(ellipsis-count-error
(quote ,p)
;; This is a trick to minimize the syntax structure we keep:
(quote-syntax ,(datum->syntax-object #f '... p)))))))))
(lambda ()
(let ([v ,main])
(lambda () v)))
(lambda ()
(current-exception-handler exnh))))))
`(catch-ellipsis-error
(lambda () ,main)
(quote ,p)
;; This is a trick to minimize the syntax structure we keep:
(quote-syntax ,(datum->syntax-object #f '... p)))
main)))
;; Get list of unique vars:
(apply append (hash-table-map ht (lambda (k v) v))))))
@ -1619,32 +1607,86 @@
(eq? (car t) 'quote-syntax)
(eq? (cadr t) (stx-cdr p)))))
`(quote-syntax ,p)]
[(syntax? stx)
;; Keep context and location information
(let ([ctx (datum->syntax-object stx 'ctx stx)])
`(datum->syntax-object (quote-syntax ,ctx)
,(apply-cons #f h t p)
(quote-syntax ,ctx)))]
;; (cons X null) => (list X)
[(and (pair? t)
(eq? (car t) 'pattern-substitute))
;; fold h into the existing pattern-substitute:
(cond
[(and (pair? h)
(eq? (car h) 'quote-syntax)
(eq? (cadr h) (stx-car p)))
;; Just extend constant part:
`(pattern-substitute
(quote-syntax ,(let ([v (cons (cadr h) (cadadr t))])
;; We exploit the fact that we're
;; building an S-expression to
;; preserve the source's distinction
;; between (x y) and (x . (y)).
(if (syntax? stx)
(datum->syntax-object stx
v
stx
stx)
v)))
. ,(cddr t))]
[(and (pair? h)
(eq? 'pattern-substitute (car h)))
;; Combine two pattern substitutions:
`(pattern-substitute (quote-syntax ,(let ([v (cons (cadadr h) (cadadr t))])
(if (syntax? stx)
(datum->syntax-object stx
v
stx
stx)
v)))
,@(cddr h) ;; <-- WARNING: potential quadratic expansion
. ,(cddr t))]
[else
;; General case: add a substitution:
(let* ([id (gensym)]
[expr (cons id (cadadr t))]
[expr (if (syntax? stx)
(datum->syntax-object stx
expr
stx
stx)
expr)])
`(pattern-substitute
(quote-syntax ,expr)
,id ,h
. ,(cddr t)))])]
[(eq? t 'null)
`(list-immutable ,h)]
;; (cons X (list[*] Y ...)) => (list[*] X Y ...)
(apply-cons stx h
`(pattern-substitute (quote-syntax ()))
p)]
[(and (pair? t)
(memq (car t) '(list-immutable list*-immutable)))
`(,(car t) ,h ,@(cdr t))]
;; (cons X (cons Y Z)) => (list* X Y Z)
[(and (pair? t)
(eq? (car t) 'cons-immutable))
`(list*-immutable ,h ,@(cdr t))]
;; (cons (car X) (cdr X)) => X
[(and (pair? h) (pair? t)
(eq? (car h) 'car)
(eq? (car t) 'cdr)
(symbol? (cadr h))
(eq? (cadr h) (cadr t)))
(cadr h)]
(eq? (car t) 'quote-syntax)
(stx-smaller-than? (car t) 10))
;; Shift into `pattern-substitute' mode with an intitial constant.
;; (Only do this for small constants, so we don't traverse
;; big constants when looking for substitutions.)
(apply-cons stx h
`(pattern-substitute ,t)
p)]
[else
`(cons-immutable ,h ,t)]))
;; Shift into `pattern-substitute' with an initial substitution:
(apply-cons stx h
(let ([id (gensym)])
`(pattern-substitute (quote-syntax ,id)
,id ,t))
p)]))
(-define (stx-smaller-than? stx sz)
(sz . > . (stx-size stx (add1 sz))))
(-define (stx-size stx up-to)
(cond
[(up-to . < . 1) 0]
[(syntax? stx) (stx-size (syntax-e stx) up-to)]
[(pair? stx) (let ([s1 (stx-size (car stx) up-to)])
(+ s1 (stx-size (cdr stx) (- up-to s1))))]
[(vector? stx) (stx-size (vector->list stx) up-to)]
[(box? stx) (add1 (stx-size (unbox stx) (sub1 up-to)))]
[else 1]))
;; Generates a list-ref expression; if use-tail-pos
;; is not #f, then the argument list is really a list*
@ -1845,15 +1887,137 @@
;; syntax-case and syntax
(module #%stxcase #%kernel
(require #%stx #%small-scheme)
(require #%stx #%small-scheme #%paramz)
(require-for-syntax #%stx #%small-scheme #%sc #%kernel)
(-define (ellipsis-count-error sexp sloc)
(raise-syntax-error
'syntax
"incompatible ellipsis match counts for template"
sexp
sloc))
(-define (datum->syntax-object/shape orig datum)
(if (syntax? datum)
datum
(let ([stx (datum->syntax-object orig datum orig)])
(let ([shape (syntax-property stx 'paren-shape)])
(if shape
(syntax-property stx 'paren-shape shape)
stx)))))
(-define (catch-ellipsis-error thunk sexp sloc)
((let/ec esc
(with-continuation-mark
parameterization-key
(extend-parameterization
(continuation-mark-set-first #f parameterization-key)
current-exception-handler
(lambda (exn)
(esc
(lambda ()
(if (exn:break? exn)
(raise exn)
(raise-syntax-error
'syntax
"incompatible ellipsis match counts for template"
sexp
sloc))))))
(let ([v (thunk)])
(lambda () v))))))
(-define substitute-stop 'dummy)
;; pattern-substitute optimizes a pattern substitution by
;; merging variables that look up the same simple mapping
(-define-syntax pattern-substitute
(lambda (stx)
(let ([pat (stx-car (stx-cdr stx))]
[subs (stx->list (stx-cdr (stx-cdr stx)))])
(let ([ht-common (make-hash-table 'equal)]
[ht-map (make-hash-table)])
;; Determine merges:
(let loop ([subs subs])
(unless (null? subs)
(let ([id (syntax-e (car subs))]
[expr (cadr subs)])
(when (or (identifier? expr)
(and (stx-pair? expr)
(memq (syntax-e (stx-car expr))
'(car cadr caddr cadddr
cdr cddr cdddr cddddr
list-ref list-tail))
(stx-pair? (stx-cdr expr))
(identifier? (stx-car (stx-cdr expr)))))
(let ([s-expr (syntax-object->datum expr)])
(let ([new-id (hash-table-get ht-common s-expr #f)])
(if new-id
(hash-table-put! ht-map id new-id)
(hash-table-put! ht-common s-expr id))))))
(loop (cddr subs))))
;; Merge:
(let ([new-pattern (if (zero? (hash-table-count ht-map))
pat
(let loop ([stx pat])
(cond
[(pair? stx)
(let ([a (loop (car stx))]
[b (loop (cdr stx))])
(if (and (eq? a (car stx))
(eq? b (cdr stx)))
stx
(cons a b)))]
[(symbol? stx)
(let ([new-id (hash-table-get ht-map stx #f)])
(or new-id stx))]
[(syntax? stx)
(let ([new-e (loop (syntax-e stx))])
(if (eq? (syntax-e stx) new-e)
stx
(datum->syntax-object stx new-e stx stx)))]
[(vector? stx)
(list->vector (map loop (vector->list stx)))]
[(box? stx) (box (loop (unbox stx)))]
[else stx])))])
(datum->syntax-object (quote-syntax here)
`(apply-pattern-substitute
,new-pattern
(quote ,(let loop ([subs subs])
(cond
[(null? subs) null]
[(hash-table-get ht-map (syntax-e (car subs)) #f)
;; Drop mapped id
(loop (cddr subs))]
[else
(cons (car subs) (loop (cddr subs)))])))
. ,(let loop ([subs subs])
(cond
[(null? subs) null]
[(hash-table-get ht-map (syntax-e (car subs)) #f)
;; Drop mapped id
(loop (cddr subs))]
[else
(cons (cadr subs) (loop (cddr subs)))])))
stx))))))
(-define apply-pattern-substitute
(lambda (stx sub-ids . sub-vals)
(let loop ([stx stx])
(cond
[(pair? stx) (let ([a (loop (car stx))]
[b (loop (cdr stx))])
(if (and (eq? a (car stx))
(eq? b (cdr stx)))
stx
(cons a b)))]
[(symbol? stx)
(let sloop ([sub-ids sub-ids][sub-vals sub-vals])
(cond
[(null? sub-ids) stx]
[(eq? stx (car sub-ids)) (car sub-vals)]
[else (sloop (cdr sub-ids) (cdr sub-vals))]))]
[(syntax? stx)
(let ([new-e (loop (syntax-e stx))])
(if (eq? (syntax-e stx) new-e)
stx
(datum->syntax-object/shape stx new-e)))]
[(vector? stx)
(list->vector (map loop (vector->list stx)))]
[(box? stx) (box (loop (unbox stx)))]
[else stx]))))
(-define-syntax syntax-case**
(lambda (x)
@ -2142,9 +2306,7 @@
[(zero? len) (quote-syntax ())]
[(= len 1) (car r)]
[else
(cons (quote-syntax list*) r)]))
(list (quote-syntax quote-syntax)
(datum->syntax-object #f 'srctag x))))))))))
(cons (quote-syntax list*) r)]))))))))))
x)))
(provide syntax-case** syntax))
@ -3081,7 +3243,7 @@
(or (relative-path? s)
(absolute-path? s)))))
(define -re:suffix (byte-regexp #"([.][^.]*|)$"))
(define -re:suffix #rx#"([.][^.]*|)$")
(define (path-replace-suffix s sfx)
(unless (path-string? s)
(raise-type-error 'path-replace-suffix "path or valid-path string" 0 s sfx))
@ -3472,9 +3634,9 @@
(current-reader-guard (let ([default-reader-guard (lambda (path) path)])
default-reader-guard))
(define -re:dir (byte-regexp #"(.+?)/+(.*)"))
(define -re:auto (byte-regexp #"^,"))
(define -re:ok-relpath (byte-regexp #"^[-a-zA-Z0-9_. ]+(/+[-a-zA-Z0-9_. ]+)*$"))
(define -re:dir #rx#"(.+?)/+(.*)")
(define -re:auto #rx#"^,")
(define -re:ok-relpath #rx#"^[-a-zA-Z0-9_. ]+(/+[-a-zA-Z0-9_. ]+)*$")
(define -module-hash-table-table (make-hash-table 'weak)) ; weak map from namespace to module ht
(define -path-cache (make-hash-table 'weak 'equal)) ; weak map from `lib' path + corrent-library-paths to symbols

View File

@ -269,11 +269,7 @@ XFORM_NONGCING static void WRAP_POS_SET_FIRST(Wrap_Pos *w)
}
}
XFORM_NONGCING static
#ifndef NO_INLINE_KEYWORD
MSC_IZE(inline)
#endif
void DO_WRAP_POS_INC(Wrap_Pos *w)
XFORM_NONGCING static MZ_INLINE void DO_WRAP_POS_INC(Wrap_Pos *w)
{
Scheme_Object *a;
if (w->is_limb && (w->pos + 1 < ((Wrap_Chunk *)SCHEME_CAR(w->l))->len)) {
@ -4073,6 +4069,72 @@ static Scheme_Object *wraps_to_datum(Scheme_Object *w_in,
/* syntax->datum */
/*========================================================================*/
/* This code can convert a syntax object plus its wraps to something
writeable. In that case, the result is a <converted>:
<converted> = (vector <simple converted> <cert>)
| <simple converted>
<simple converted> = <simple converted pair> | ...
<simple converted pair> = (cons (cons <int> (cons <converted> ... <converted>)) <wrap>)
| (cons (cons <converted> ... null) <wrap>)
| (cons (cons #t <s-exp>) <wrap>)
; where <s-exp> has no boxes or vectors, and
; <wrap> is shared in all <s-exp> elements
<simple converted box> = (cons (box <converted>) <wrap>)
<simple converted vector> = (cons (vector <converted> ...) <wrap>)
<simple converted other> = (cons <s-exp> <wrap>)
; where <s-exp> is not a pair, vector, or box
*/
static Scheme_Object *extract_for_common_wrap(Scheme_Object *a, int get_mark, int pair_ok)
{
/* We only share wraps for things constucted with pairs and
atomic (w.r.t. syntax) values, where there are no certificates
on any of the sub-parts. */
Scheme_Object *v;
if (SCHEME_PAIRP(a)) {
v = SCHEME_CAR(a);
if (SCHEME_PAIRP(v)) {
if (pair_ok && SAME_OBJ(SCHEME_CAR(v), scheme_true)) {
/* A pair with shared wraps for its elements */
if (get_mark)
return SCHEME_CDR(a);
else
return SCHEME_CDR(v);
}
} else if (!SCHEME_BOXP(v) && !SCHEME_VECTORP(v)) {
/* It's atomic. */
if (get_mark)
return SCHEME_CDR(a);
else
return v;
}
}
return NULL;
}
static void lift_common_wraps(Scheme_Object *l, Scheme_Object *common_wraps, int cnt, int tail)
{
Scheme_Object *a;
while (cnt--) {
a = SCHEME_CAR(l);
a = extract_for_common_wrap(a, 0, 1);
SCHEME_CAR(l) = a;
if (cnt)
l = SCHEME_CDR(l);
}
if (tail) {
a = SCHEME_CDR(l);
a = extract_for_common_wrap(a, 0, 0);
SCHEME_CDR(l) = a;
}
}
#ifdef DO_STACK_CHECK
static Scheme_Object *syntax_to_datum_inner(Scheme_Object *o,
Scheme_Hash_Table **ht,
@ -4100,7 +4162,7 @@ static Scheme_Object *syntax_to_datum_inner(Scheme_Object *o,
Scheme_Hash_Table *rns)
{
Scheme_Stx *stx = (Scheme_Stx *)o;
Scheme_Object *ph, *v, *result;
Scheme_Object *ph, *v, *result, *converted_wraps = NULL;
#ifdef DO_STACK_CHECK
{
@ -4152,7 +4214,7 @@ static Scheme_Object *syntax_to_datum_inner(Scheme_Object *o,
v = stx->val;
if (SCHEME_PAIRP(v)) {
Scheme_Object *first = NULL, *last = NULL, *p;
Scheme_Object *first = NULL, *last = NULL, *p, *common_wraps = NULL;
int cnt = 0;
while (SCHEME_PAIRP(v)) {
@ -4161,7 +4223,7 @@ static Scheme_Object *syntax_to_datum_inner(Scheme_Object *o,
cnt++;
a = syntax_to_datum_inner(SCHEME_CAR(v), ht, with_marks, rns);
p = CONS(a, scheme_null);
if (last)
@ -4170,12 +4232,35 @@ static Scheme_Object *syntax_to_datum_inner(Scheme_Object *o,
first = p;
last = p;
v = SCHEME_CDR(v);
if (with_marks) {
a = extract_for_common_wrap(a, 1, 1);
if (!common_wraps) {
if (a)
common_wraps = a;
else
common_wraps = scheme_false;
} else if (!a || !SAME_OBJ(common_wraps, a))
common_wraps = scheme_false;
}
}
if (!SCHEME_NULLP(v)) {
v = syntax_to_datum_inner(v, ht, with_marks, rns);
SCHEME_CDR(last) = v;
if (with_marks > 1) {
if (with_marks) {
v = extract_for_common_wrap(v, 1, 0);
if (v && SAME_OBJ(common_wraps, v)) {
converted_wraps = wraps_to_datum(stx->wraps, rns, 0);
if (SAME_OBJ(common_wraps, converted_wraps))
lift_common_wraps(first, common_wraps, cnt, 1);
else
common_wraps = scheme_false;
} else
common_wraps = scheme_false;
}
if ((with_marks > 1) && SCHEME_FALSEP(common_wraps)) {
/* v is likely a pair, and v's car might be a pair,
which means that the datum->syntax part
won't be able to detect that v is a "non-pair"
@ -4183,8 +4268,18 @@ static Scheme_Object *syntax_to_datum_inner(Scheme_Object *o,
length before the terminal to datum->syntax: */
first = scheme_make_pair(scheme_make_integer(cnt), first);
}
} else if (with_marks && SCHEME_TRUEP(common_wraps)) {
converted_wraps = wraps_to_datum(stx->wraps, rns, 0);
if (SAME_OBJ(common_wraps, converted_wraps))
lift_common_wraps(first, common_wraps, cnt, 0);
else
common_wraps = scheme_false;
}
if (with_marks && SCHEME_TRUEP(common_wraps)) {
first = scheme_make_pair(scheme_true, first);
}
result = first;
} else if (SCHEME_BOXP(v)) {
v = syntax_to_datum_inner(SCHEME_BOX_VAL(v), ht, with_marks, rns);
@ -4209,7 +4304,9 @@ static Scheme_Object *syntax_to_datum_inner(Scheme_Object *o,
result = v;
if (with_marks > 1) {
result = CONS(result, wraps_to_datum(stx->wraps, rns, 0));
if (!converted_wraps)
converted_wraps = wraps_to_datum(stx->wraps, rns, 0);
result = CONS(result, converted_wraps);
if (stx->certs) {
Scheme_Object *cert_marks = scheme_null, *icert_marks = scheme_null;
Scheme_Cert *certs;
@ -4226,13 +4323,16 @@ static Scheme_Object *syntax_to_datum_inner(Scheme_Object *o,
icert_marks = scheme_make_pair(certs->mark, icert_marks);
certs = certs->next;
}
v = scheme_make_vector(2, NULL);
SCHEME_VEC_ELS(v)[0] = result;
if (SCHEME_PAIRP(icert_marks))
cert_marks = scheme_make_pair(cert_marks, icert_marks);
SCHEME_VEC_ELS(v)[1] = cert_marks;
result = v;
if (SCHEME_PAIRP(cert_marks)
|| SCHEME_PAIRP(icert_marks)) {
v = scheme_make_vector(2, NULL);
SCHEME_VEC_ELS(v)[0] = result;
if (SCHEME_PAIRP(icert_marks))
cert_marks = scheme_make_pair(cert_marks, icert_marks);
SCHEME_VEC_ELS(v)[1] = cert_marks;
result = v;
}
}
}
@ -4250,6 +4350,33 @@ Scheme_Object *scheme_syntax_to_datum(Scheme_Object *stx, int with_marks,
v = syntax_to_datum_inner(stx, &ht, with_marks, rns);
if (with_marks > 1) {
if (SCHEME_PAIRP(v)
&& SCHEME_SYMBOLP(SCHEME_CAR(v))
&& SCHEME_INTP(SCHEME_CDR(v))) {
/* A symbol+wrap combination is likely to be used multiple
times. This is a relatively minor optimization in .zo size,
since v is already fairly compact, but it also avoids
allocating extra syntax objects at load time. */
Scheme_Hash_Table *reverse_map;
Scheme_Object *code;
reverse_map = (Scheme_Hash_Table *)scheme_hash_get(rns, scheme_undefined);
if (reverse_map) {
code = scheme_hash_get(reverse_map, v);
if (code) {
return code;
} else {
code = scheme_make_integer(rns->count);
scheme_hash_set(rns, code, v);
scheme_hash_set(reverse_map, v, code);
v = scheme_make_vector(2, v);
SCHEME_VEC_ELS(v)[1] = code;
}
}
}
}
if (ht)
v = scheme_resolve_placeholders(v, 0);
@ -4748,10 +4875,11 @@ static Scheme_Object *datum_to_syntax_k(void)
static Scheme_Object *datum_to_syntax_inner(Scheme_Object *o,
Scheme_Stx *stx_src,
Scheme_Stx *stx_wraps, /* or rename table */
Scheme_Stx *stx_wraps, /* or rename table, or boxed precomputed wrap */
Scheme_Hash_Table *ht)
{
Scheme_Object *result, *ph = NULL, *wraps, *cert_marks = NULL;
int do_not_unpack_wraps = 0;
if (SCHEME_STXP(o))
return o;
@ -4803,6 +4931,10 @@ static Scheme_Object *datum_to_syntax_inner(Scheme_Object *o,
return_NULL;
wraps = SCHEME_CDR(o);
o = SCHEME_CAR(o);
} else if (SCHEME_BOXP(stx_wraps)) {
/* Shared wraps, to be used directly everywhere: */
wraps = SCHEME_BOX_VAL(stx_wraps);
do_not_unpack_wraps = 1;
} else
wraps = NULL;
@ -4821,8 +4953,17 @@ static Scheme_Object *datum_to_syntax_inner(Scheme_Object *o,
result = o;
} else {
int cnt = -1;
if (wraps && SCHEME_INTP(SCHEME_CAR(o))) {
Scheme_Stx *sub_stx_wraps = stx_wraps;
if (wraps && !SCHEME_BOXP(stx_wraps) && SAME_OBJ(SCHEME_CAR(o), scheme_true)) {
/* Resolve wraps now, and then share it with
all nested objects (as indicated by a box
for stx_wraps). */
wraps = datum_to_wraps(wraps, (Scheme_Hash_Table *)stx_wraps);
do_not_unpack_wraps = 1;
sub_stx_wraps = (Scheme_Stx *)scheme_box(wraps);
o = SCHEME_CDR(o);
} else if (wraps && !SCHEME_BOXP(stx_wraps) && SCHEME_INTP(SCHEME_CAR(o))) {
/* First element is the number of items
before a non-null terminal: */
cnt = SCHEME_INT_VAL(SCHEME_CAR(o));
@ -4840,7 +4981,7 @@ static Scheme_Object *datum_to_syntax_inner(Scheme_Object *o,
}
}
a = datum_to_syntax_inner(SCHEME_CAR(o), stx_src, stx_wraps, ht);
a = datum_to_syntax_inner(SCHEME_CAR(o), stx_src, sub_stx_wraps, ht);
if (!a) return_NULL;
p = scheme_make_immutable_pair(a, scheme_null);
@ -4855,7 +4996,7 @@ static Scheme_Object *datum_to_syntax_inner(Scheme_Object *o,
--cnt;
}
if (!SCHEME_NULLP(o)) {
o = datum_to_syntax_inner(o, stx_src, stx_wraps, ht);
o = datum_to_syntax_inner(o, stx_src, sub_stx_wraps, ht);
if (!o) return_NULL;
SCHEME_CDR(last) = o;
}
@ -4891,9 +5032,11 @@ static Scheme_Object *datum_to_syntax_inner(Scheme_Object *o,
result = scheme_make_stx(result, stx_src->srcloc, NULL);
if (wraps) {
wraps = datum_to_wraps(wraps, (Scheme_Hash_Table *)stx_wraps);
if (!wraps)
return_NULL;
if (!do_not_unpack_wraps) {
wraps = datum_to_wraps(wraps, (Scheme_Hash_Table *)stx_wraps);
if (!wraps)
return_NULL;
}
((Scheme_Stx *)result)->wraps = wraps;
} else if (SCHEME_FALSEP((Scheme_Object *)stx_wraps)) {
/* wraps already nulled */
@ -4941,7 +5084,7 @@ Scheme_Object *scheme_datum_to_syntax(Scheme_Object *o,
{
Scheme_Hash_Table *ht;
Scheme_Object *v;
Scheme_Object *v, *code = NULL;
if (!SCHEME_FALSEP(stx_src) && !SCHEME_STXP(stx_src))
return o;
@ -4954,6 +5097,19 @@ Scheme_Object *scheme_datum_to_syntax(Scheme_Object *o,
else
ht = NULL;
if (SCHEME_HASHTP(stx_wraps)) {
/* If o is just a number, look it up in the table. */
if (SCHEME_INTP(o))
return scheme_hash_get((Scheme_Hash_Table *)stx_wraps, o);
/* If it's a vector where the second element is a number, we'll need to hash. */
if (SCHEME_VECTORP(o)
&& (SCHEME_VEC_SIZE(o) == 2)
&& SCHEME_INTP(SCHEME_VEC_ELS(o)[1])) {
code = SCHEME_VEC_ELS(o)[1];
o = SCHEME_VEC_ELS(o)[0];
}
}
v = datum_to_syntax_inner(o,
(Scheme_Stx *)stx_src,
(Scheme_Stx *)stx_wraps,
@ -4961,6 +5117,10 @@ Scheme_Object *scheme_datum_to_syntax(Scheme_Object *o,
if (!v) return_NULL; /* only happens with bad wraps from a bad .zo */
if (code) {
scheme_hash_set((Scheme_Hash_Table *)stx_wraps, code, v);
}
if (ht)
v = scheme_resolve_placeholders(v, 1);

View File

@ -1711,13 +1711,7 @@ static void check_current_custodian_allows(const char *who, Scheme_Thread *p)
/* thread sets */
/*========================================================================*/
#define TSET_IL /* */
#ifndef NO_INLINE_KEYWORD
# ifndef DONT_INLINE_NZERO_TEST
# undef TSET_IL
# define TSET_IL MSC_IZE(inline)
# endif
#endif
#define TSET_IL MZ_INLINE
static Scheme_Thread_Set *create_thread_set(Scheme_Thread_Set *parent)
{
@ -5600,8 +5594,7 @@ Scheme_Object *scheme_get_thread_param(Scheme_Config *c, Scheme_Thread_Cell_Tabl
cell = find_param_cell(c, scheme_make_integer(pos), 0);
if (SCHEME_THREAD_CELLP(cell))
return scheme_thread_cell_get(cell, cells);
return
cell;
return cell;
}
Scheme_Object *scheme_get_param(Scheme_Config *c, int pos)
@ -6607,6 +6600,7 @@ static void get_ready_for_GC()
scheme_clear_modidx_cache();
scheme_clear_shift_cache();
scheme_clear_cc_ok();
scheme_clear_rx_buffers();
#ifdef RUNSTACK_IS_GLOBAL
scheme_current_thread->runstack = MZ_RUNSTACK;