From c9ef4e2a98106c9b98c89a358b2b7473d8ff79cf Mon Sep 17 00:00:00 2001 From: Chris Hanson Date: Tue, 21 Feb 2017 00:57:00 -0800 Subject: [PATCH] Eliminate references to char-set-member?. --- doc/ref-manual/io.texi | 4 ++-- src/compiler/machines/C/cout.scm | 4 ++-- src/compiler/machines/C/cutl.scm | 4 ++-- src/edwin/dosfile.scm | 4 ++-- src/edwin/rfc822.scm | 4 ++-- src/imail/imail-imap.scm | 2 +- src/imail/imap-syntax.scm | 6 +++--- src/runtime/chrset.scm | 2 +- src/runtime/error.scm | 3 +-- src/runtime/html-form-codec.scm | 2 +- src/runtime/http-syntax.scm | 9 ++++----- src/runtime/input.scm | 4 ++-- src/runtime/mime-codec.scm | 2 +- src/runtime/parse.scm | 4 ++-- src/runtime/parser-buffer.scm | 3 --- src/runtime/regsexp.scm | 4 ++-- src/runtime/rfc2822-headers.scm | 6 +++--- src/runtime/url.scm | 4 ++-- src/runtime/version.scm | 5 ++--- src/xml/rdf-nt.scm | 2 +- src/xml/xml-output.scm | 4 ++-- src/xml/xml-parser.scm | 2 +- src/xml/xml-struct.scm | 2 +- 23 files changed, 40 insertions(+), 46 deletions(-) diff --git a/doc/ref-manual/io.texi b/doc/ref-manual/io.texi index f68b14aba..eac40d75a 100644 --- a/doc/ref-manual/io.texi +++ b/doc/ref-manual/io.texi @@ -821,7 +821,7 @@ following equivalent code using @code{peek-char} and @code{read-char}: (list->string (let loop ((char char)) (if (or (eof-object? char) - (char-set-member? char-set char)) + (char-in-set? char char-set)) '() (begin (read-char port) @@ -2237,7 +2237,7 @@ if the character @emph{doesn't} match @var{char}. @deffn procedure match-parser-buffer-char-in-set buffer char-set @deffnx procedure match-parser-buffer-char-in-set-no-advance buffer char-set These procedures compare the next character in @var{buffer} against -@var{char-set} using @code{char-set-member?}. +@var{char-set} using @code{char-in-set?}. @end deffn @deffn procedure match-parser-buffer-string buffer string diff --git a/src/compiler/machines/C/cout.scm b/src/compiler/machines/C/cout.scm index 9ec590bd4..83a06dcb6 100644 --- a/src/compiler/machines/C/cout.scm +++ b/src/compiler/machines/C/cout.scm @@ -566,13 +566,13 @@ USA. ;; convention for the named characters when they appear in strings. (define (C-quotify-string-char char next) - (cond ((char-set-member? char-set:C-named-chars char) + (cond ((char-in-set? char char-set:C-named-chars) (let ((result (write-to-string (string char)))) (substring result 1 (-1+ (string-length result))))) ((char=? char #\NUL) ;; Avoid ambiguities (if (or (not next) - (not (char-set-member? char-set:numeric next))) + (not (char-in-set? next char-set:numeric))) "\\0" "\\000")) ((char=? char #\?) diff --git a/src/compiler/machines/C/cutl.scm b/src/compiler/machines/C/cutl.scm index 75d4e54d7..8add3804c 100644 --- a/src/compiler/machines/C/cutl.scm +++ b/src/compiler/machines/C/cutl.scm @@ -368,7 +368,7 @@ USA. 1 0))) (if (fix:< i n) - (and (char-set-member? c:decimal-chars (string-ref e i)) + (and (char-in-set? (string-ref e i) c:decimal-chars) (loop (fix:+ i 1))) #t)))) @@ -449,7 +449,7 @@ USA. (let ((n (string-length e))) (let loop ((i 0)) (if (fix:< i n) - (and (char-set-member? c:identifier-chars (string-ref e i)) + (and (char-in-set? (string-ref e i) c:identifier-chars) (loop (fix:+ i 1))) #t)))) diff --git a/src/edwin/dosfile.scm b/src/edwin/dosfile.scm index 64057c46b..ac2236088 100644 --- a/src/edwin/dosfile.scm +++ b/src/edwin/dosfile.scm @@ -371,7 +371,7 @@ Switches may be concatenated, e.g. `-lt' is equivalent to `-l -t'." (string-set! copy i (let ((char (string-ref name i))) - (if (char-set-member? valid-chars char) + (if (char-in-set? char valid-chars) char #\_)))) copy)))) @@ -382,7 +382,7 @@ Switches may be concatenated, e.g. `-lt' is equivalent to `-l -t'." (let loop ((chars (string->list (buffer-name buffer)))) (cond ((null? chars) '()) - ((char-set-member? valid-chars (car chars)) + ((char-in-set? (car chars) valid-chars) (cons (car chars) (loop (cdr chars)))) (else (loop (cdr chars)))))))) diff --git a/src/edwin/rfc822.scm b/src/edwin/rfc822.scm index d50a862ec..ebd28d30a 100644 --- a/src/edwin/rfc822.scm +++ b/src/edwin/rfc822.scm @@ -387,8 +387,8 @@ USA. (let ((atom-chars (char-set-difference (ascii-range->char-set #x21 #x7F) special-chars))) - (define (special-char? char) (char-set-member? special-chars char)) - (define (atom-char? char) (char-set-member? atom-chars char)) + (define (special-char? char) (char-in-set? char special-chars)) + (define (atom-char? char) (char-in-set? char atom-chars)) (define (lose chars char-count) (list (cons 'UNTERMINATED diff --git a/src/imail/imail-imap.scm b/src/imail/imail-imap.scm index 8d5fe5c14..ef7573792 100644 --- a/src/imail/imail-imap.scm +++ b/src/imail/imail-imap.scm @@ -2088,7 +2088,7 @@ USA. (do ((i 0 (fix:+ i 1))) ((fix:= i n)) (let ((char (string-ref string i))) - (cond ((char-set-member? char-set:cache-namestring-safe char) + (cond ((char-in-set? char char-set:cache-namestring-safe) (write-char char port)) ((char=? char #\/) (write-char #\# port)) diff --git a/src/imail/imap-syntax.scm b/src/imail/imap-syntax.scm index f1148cd1b..61acb9403 100644 --- a/src/imail/imap-syntax.scm +++ b/src/imail/imap-syntax.scm @@ -64,13 +64,13 @@ USA. (char-set-union url:char-set:unreserved (string->char-set "&=~"))) (define (imap:atom-char? char) - (char-set-member? imap:char-set:atom-char char)) + (char-in-set? char imap:char-set:atom-char)) (define (imap:quoted-special? char) - (char-set-member? imap:char-set:quoted-specials char)) + (char-in-set? char imap:char-set:quoted-specials)) (define (imap:quoted-char? char) - (char-set-member? imap:char-set:quoted-char char)) + (char-in-set? char imap:char-set:quoted-char)) (define ((string-matching-procedure matcher) string) (matcher (string->parser-buffer string))) diff --git a/src/runtime/chrset.scm b/src/runtime/chrset.scm index 605172dc6..e248b6172 100644 --- a/src/runtime/chrset.scm +++ b/src/runtime/chrset.scm @@ -407,7 +407,7 @@ USA. (define (char-set-predicate char-set) (guarantee char-set? char-set 'CHAR-SET-PREDICATE) (lambda (char) - (char-set-member? char-set char))) + (char-in-set? char char-set))) (define (char-set=? char-set . char-sets) (every (lambda (char-set*) diff --git a/src/runtime/error.scm b/src/runtime/error.scm index 4a3feea9c..445d9cadb 100644 --- a/src/runtime/error.scm +++ b/src/runtime/error.scm @@ -841,8 +841,7 @@ USA. (string-prefix-ci? "a " type) (string-prefix-ci? "an " type))) (write-string - (if (char-set-member? char-set:vowels - (string-ref type 0)) + (if (char-in-set? (string-ref type 0) char-set:vowels) "an " "a ") port)) diff --git a/src/runtime/html-form-codec.scm b/src/runtime/html-form-codec.scm index 581114986..9d2d2d485 100644 --- a/src/runtime/html-form-codec.scm +++ b/src/runtime/html-form-codec.scm @@ -144,7 +144,7 @@ USA. (write-char (digit->char (fix:and octet #x0F) 16) port))))) (define (char-unreserved? char) - (char-set-member? char-set:unreserved char)) + (char-in-set? char char-set:unreserved)) (define char-set:unreserved) diff --git a/src/runtime/http-syntax.scm b/src/runtime/http-syntax.scm index 1f6175c41..f567a7f30 100644 --- a/src/runtime/http-syntax.scm +++ b/src/runtime/http-syntax.scm @@ -329,7 +329,7 @@ USA. (do ((i 0 (fix:+ i 1))) ((not (fix:< i n))) (let ((char (string-ref string i))) - (if (not (char-set-member? unquoted char)) + (if (not (char-in-set? char unquoted)) (write-char #\\ port)) (write-char char port))))) @@ -835,7 +835,7 @@ USA. (define (separator-token? object) (and (char? object) - (char-set-member? char-set:http-separators object))) + (char-in-set? object char-set:http-separators))) (define (separator-token->char token) token) @@ -984,7 +984,7 @@ USA. ((char=? char #\\) (fifo (rc)) (loop level)) - ((char-set-member? char-set:http-text char) + ((char-in-set? char char-set:http-text) (fifo char) (loop level)) (else @@ -1468,8 +1468,7 @@ USA. (let ((end (string-length s))) (do ((i 0 (+ i 1))) ((not (< i end))) - (if (not (char-set-member? char-set:http-token - (string-ref s i))) + (if (not (char-in-set? (string-ref s i) char-set:http-token)) (string-set! s i #\_)))) s)))) diff --git a/src/runtime/input.scm b/src/runtime/input.scm index 45df00691..35db1af7b 100644 --- a/src/runtime/input.scm +++ b/src/runtime/input.scm @@ -79,7 +79,7 @@ USA. (if (builder 'empty?) char (builder))) - ((char-set-member? delimiters char) + ((char-in-set? char delimiters) (input-port/unread-char port char) (builder)) (else @@ -94,7 +94,7 @@ USA. (let ((char (read-char port))) (cond ((eof-object? char) unspecific) - ((char-set-member? delimiters char) + ((char-in-set? char delimiters) (input-port/unread-char port char)) (else (loop))))))))) diff --git a/src/runtime/mime-codec.scm b/src/runtime/mime-codec.scm index 35596ae28..3f41c4602 100644 --- a/src/runtime/mime-codec.scm +++ b/src/runtime/mime-codec.scm @@ -94,7 +94,7 @@ USA. (let ((char (string-ref string start)) (start (fix:+ start 1))) (cond ((not (char-lwsp? char)) - (if (char-set-member? char-set:qp-encoded char) + (if (char-in-set? char char-set:qp-encoded) (write-qp-encoded context char) (write-qp-clear context char)) (loop start)) diff --git a/src/runtime/parse.scm b/src/runtime/parse.scm index e63698bb5..824f652f9 100644 --- a/src/runtime/parse.scm +++ b/src/runtime/parse.scm @@ -798,8 +798,8 @@ USA. (lambda () (let ((char (%peek-char port db))) (or (eof-object? char) - (char-set-member? (db-atom-delimiters db) char)))))) - (if (or (char-set-member? (db-atom-delimiters db) char) + (char-in-set? char (db-atom-delimiters db))))))) + (if (or (char-in-set? char (db-atom-delimiters db)) (at-end?)) char (name->char diff --git a/src/runtime/parser-buffer.scm b/src/runtime/parser-buffer.scm index bf468fbb9..23502368b 100644 --- a/src/runtime/parser-buffer.scm +++ b/src/runtime/parser-buffer.scm @@ -212,9 +212,6 @@ USA. (define (match-parser-buffer-char-not-in-set-no-advance buffer set) (match-char-not-no-advance buffer set char-in-set?)) -(define-integrable (char-in-set? char set) - (char-set-member? set char)) - (define-integrable (match-char buffer reference compare) (and (guarantee-buffer-chars buffer 1) (let ((char diff --git a/src/runtime/regsexp.scm b/src/runtime/regsexp.scm index 4187524b2..ef40f6009 100644 --- a/src/runtime/regsexp.scm +++ b/src/runtime/regsexp.scm @@ -298,7 +298,7 @@ USA. (lambda (position groups fail) (if (let ((char (next-char position))) (and char - (char-set-member? char-set char))) + (char-in-set? char char-set))) (succeed (next-position position) groups fail) (fail))))) @@ -307,7 +307,7 @@ USA. (lambda (position groups fail) (if (let ((char (next-char position))) (and char - (not (char-set-member? char-set char)))) + (not (char-in-set? char char-set)))) (succeed (next-position position) groups fail) (fail))))) diff --git a/src/runtime/rfc2822-headers.scm b/src/runtime/rfc2822-headers.scm index e59554891..2d8535c9e 100644 --- a/src/runtime/rfc2822-headers.scm +++ b/src/runtime/rfc2822-headers.scm @@ -64,7 +64,7 @@ USA. (let ((end (string-length string))) (let loop ((i 0)) (if (fix:< i end) - (and (char-set-member? char-set (string-ref string i)) + (and (char-in-set? (string-ref string i) char-set) (loop (fix:+ i 1))) #t)))) @@ -210,10 +210,10 @@ USA. (if quote? (string-append "\"" s "\"") s))) - ((char-set-member? char-set:rfc2822-qtext char) + ((char-in-set? char char-set:rfc2822-qtext) (write-char char output) (loop quote?)) - ((char-set-member? char-set:rfc2822-text char) + ((char-in-set? char char-set:rfc2822-text) (write-char #\\ output) (write-char char output) (loop #t)) diff --git a/src/runtime/url.scm b/src/runtime/url.scm index f9055092f..5848e834e 100644 --- a/src/runtime/url.scm +++ b/src/runtime/url.scm @@ -641,7 +641,7 @@ USA. (do ((i start (fix:+ i 1))) ((not (fix:< i end))) (let ((char (string-ref string i))) - (if (char-set-member? unescaped char) + (if (char-in-set? char unescaped) (write-char char port) (begin (write-char #\% port) @@ -1032,7 +1032,7 @@ USA. ((fix:= 1 (string-length (symbol->string key))) `(CHAR=? CHAR ,(string-ref (symbol->string key) 0))) (else - `(CHAR-SET-MEMBER? ,(symbol 'CHAR-SET:URI- key) CHAR))) + `(CHAR-in-SET? CHAR ,(symbol 'CHAR-SET:URI- key)))) ,@(map (lambda (action) (cond ((action:push? action) (expand:push action)) ((action:set? action) (expand:set action)) diff --git a/src/runtime/version.scm b/src/runtime/version.scm index fe6636680..04d1737e3 100644 --- a/src/runtime/version.scm +++ b/src/runtime/version.scm @@ -161,14 +161,13 @@ warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.") (define (skip-white i) (if (and (fix:< i end) - (char-set-member? char-set:whitespace (string-ref text i))) + (char-in-set? (string-ref text i) char-set:whitespace)) (skip-white (fix:+ i 1)) i)) (define (skip-non-white i) (if (and (fix:< i end) - (not (char-set-member? char-set:whitespace - (string-ref text i)))) + (not (char-in-set? (string-ref text i) char-set:whitespace))) (skip-non-white (fix:+ i 1)) i)) diff --git a/src/xml/rdf-nt.scm b/src/xml/rdf-nt.scm index 4a13b2b1c..2f1602c3a 100644 --- a/src/xml/rdf-nt.scm +++ b/src/xml/rdf-nt.scm @@ -239,7 +239,7 @@ USA. (write-string "\"" port))) (define (write-literal-char char port) - (if (char-set-member? char-set:unescaped char) + (if (char-in-set? char char-set:unescaped) (write-char char port) (begin (write-char #\\ port) diff --git a/src/xml/xml-output.scm b/src/xml/xml-output.scm index 252ac3e07..d4c5e8c4a 100644 --- a/src/xml/xml-output.scm +++ b/src/xml/xml-output.scm @@ -163,8 +163,8 @@ USA. (let ((text (xml-processing-instructions-text pi))) (if (fix:> (string-length text) 0) (begin - (if (not (char-set-member? char-set:xml-whitespace - (string-ref text 0))) + (if (not (char-in-set? (string-ref text 0) + char-set:xml-whitespace)) (emit-string " " ctx)) (emit-string text ctx)))) (emit-string "?>" ctx)) diff --git a/src/xml/xml-parser.scm b/src/xml/xml-parser.scm index c2b58363a..04ecfc5ec 100644 --- a/src/xml/xml-parser.scm +++ b/src/xml/xml-parser.scm @@ -670,7 +670,7 @@ USA. (if (not (unicode-scalar-value? n)) (perror p "Invalid code point" n)) (let ((char (integer->char n))) - (if (not (char-set-member? char-set:xml-char char)) + (if (not (char-in-set? char char-set:xml-char)) (perror p "Disallowed Unicode character" char)) (call-with-output-string (lambda (port) diff --git a/src/xml/xml-struct.scm b/src/xml/xml-struct.scm index fb15cc9a9..043bcb043 100644 --- a/src/xml/xml-struct.scm +++ b/src/xml/xml-struct.scm @@ -129,7 +129,7 @@ USA. (define (substring-composed-of? string start end char-set) (let loop ((index start)) (or (fix:= index end) - (and (char-set-member? char-set (string-ref string index)) + (and (char-in-set? (string-ref string index) char-set) (loop (fix:+ index 1)))))) (define-xml-type declaration -- 2.25.1