1 ;;;; srfi-14.test -*- mode:scheme; coding: iso-8859-1 -*-
2 ;;;; --- Test suite for Guile's SRFI-14 functions.
3 ;;;; Martin Grabmueller, 2001-07-16
5 ;;;; Copyright (C) 2001, 2006, 2009, 2010 Free Software Foundation, Inc.
7 ;;;; This library is free software; you can redistribute it and/or
8 ;;;; modify it under the terms of the GNU Lesser General Public
9 ;;;; License as published by the Free Software Foundation; either
10 ;;;; version 3 of the License, or (at your option) any later version.
12 ;;;; This library is distributed in the hope that it will be useful,
13 ;;;; but WITHOUT ANY WARRANTY; without even the implied warranty of
14 ;;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 ;;;; Lesser General Public License for more details.
17 ;;;; You should have received a copy of the GNU Lesser General Public
18 ;;;; License along with this library; if not, write to the Free Software
19 ;;;; Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
21 (define-module (test-suite test-srfi-14)
22 :use-module (srfi srfi-14)
23 :use-module (srfi srfi-1) ;; `every'
24 :use-module (test-suite lib))
27 (define exception:invalid-char-set-cursor
28 (cons 'misc-error "^invalid character set cursor"))
30 (define exception:non-char-return
31 (cons 'misc-error "returned non-char"))
34 (with-test-prefix "char set contents"
38 (char-set->list (char-set))
41 (pass-if "single char"
43 (char-set->list (char-set #\a))
46 (pass-if "contiguous chars"
48 (char-set->list (char-set #\a #\b #\c))
51 (pass-if "discontiguous chars"
53 (char-set->list (char-set #\a #\c #\e))
56 (with-test-prefix "char set additition"
59 (let ((cs (char-set)))
60 (char-set-adjoin! cs #\x)
66 (let ((cs (char-set #\x)))
67 (char-set-adjoin! cs #\y)
73 (let ((cs (char-set #\x)))
74 (char-set-adjoin! cs #\w)
80 (let ((cs (char-set #\x)))
81 (char-set-adjoin! cs #\z)
87 (let ((cs (char-set #\x)))
88 (char-set-adjoin! cs #\v)
94 (let ((cs (char-set #\u #\v)))
95 (char-set-adjoin! cs #\w)
101 (let ((cs (char-set #\u #\v)))
102 (char-set-adjoin! cs #\t)
105 (list #\t #\u #\v))))
108 (let ((cs (char-set #\u #\v)))
109 (char-set-adjoin! cs #\x)
112 (list #\u #\v #\x))))
115 (let ((cs (char-set #\u #\v)))
116 (char-set-adjoin! cs #\s)
119 (list #\s #\u #\v))))
122 (let ((cs (char-set #\u #\v #\x)))
123 (char-set-adjoin! cs #\w)
126 (list #\u #\v #\w #\x))))
129 (let ((cs (char-set #\u #\v #\x)))
130 (char-set-adjoin! cs #\y)
133 (list #\u #\v #\x #\y))))
136 (let ((cs (char-set #\u #\v #\x #\y)))
137 (char-set-adjoin! cs #\w)
140 (list #\u #\v #\w #\x #\y)))))
142 (with-test-prefix "char set union"
143 (pass-if "null U abc"
144 (char-set= (char-set-union (char-set) (->char-set "abc"))
148 (char-set= (char-set-union (->char-set "ab") (->char-set "ab"))
152 (char-set= (char-set-union (->char-set "ab") (->char-set "bc"))
156 (char-set= (char-set-union (->char-set "ab") (->char-set "cd"))
157 (->char-set "abcd")))
160 (char-set= (char-set-union (->char-set "ab") (->char-set "de"))
161 (->char-set "abde")))
164 (char-set= (char-set-union (->char-set "abc") (->char-set "bcd"))
165 (->char-set "abcd")))
167 (pass-if "abdf U abcdefg"
168 (char-set= (char-set-union (->char-set "abdf") (->char-set "abcdefg"))
169 (->char-set "abcdefg")))
172 (char-set= (char-set-union (->char-set "abef") (->char-set "cd"))
173 (->char-set "abcdef")))
176 (char-set= (char-set-union (->char-set "abgh") (->char-set "cd"))
177 (->char-set "abcdgh")))
180 (char-set= (char-set-union (->char-set "bc") (->char-set "ab"))
184 (char-set= (char-set-union (->char-set "cd") (->char-set "ab"))
185 (->char-set "abcd")))
188 (char-set= (char-set-union (->char-set "de") (->char-set "ab"))
189 (->char-set "abde")))
192 (char-set= (char-set-union (->char-set "cd") (->char-set "abc"))
193 (->char-set "abcd")))
196 (char-set= (char-set-union (->char-set "cd") (->char-set "abcd"))
197 (->char-set "abcd")))
199 (pass-if "cde U abcdef"
200 (char-set= (char-set-union (->char-set "cde") (->char-set "abcdef"))
201 (->char-set "abcdef"))))
203 (with-test-prefix "char set xor"
205 (char-set= (char-set-xor (char-set) (char-set #\x #\y))
209 (char-set= (char-set-xor (char-set #\x) (char-set #\x))
213 (char-set= (char-set-xor (char-set #\x #\y) (char-set #\x))
217 (char-set= (char-set-xor (char-set #\x #\y) (char-set #\y))
221 (char-set= (char-set-xor (char-set #\w #\x #\y) (char-set #\w))
225 (char-set= (char-set-xor (char-set #\w #\x #\y) (char-set #\x))
229 (char-set= (char-set-xor (char-set #\w #\x #\y) (char-set #\y))
233 (char-set= (char-set-xor (char-set #\u #\v #\x #\y) (char-set #\u))
234 (char-set #\v #\x #\y)))
237 (char-set= (char-set-xor (char-set #\u #\v #\x #\y) (char-set #\v))
238 (char-set #\u #\x #\y)))
241 (char-set= (char-set-xor (char-set #\u #\v #\x #\y) (char-set #\x))
242 (char-set #\u #\v #\y)))
245 (char-set= (char-set-xor (char-set #\u #\v #\x #\y) (char-set #\y))
246 (char-set #\u #\v #\x)))
249 (char-set= (char-set-xor (char-set #\u #\w #\y) (char-set #\u))
253 (char-set= (char-set-xor (char-set #\u #\w #\y) (char-set #\w))
257 (char-set= (char-set-xor (char-set #\u #\w #\y) (char-set #\y))
261 (char-set= (char-set-xor (char-set #\u #\v #\w #\y) (char-set #\v))
262 (char-set #\u #\w #\y))))
265 (with-test-prefix "char-set?"
267 (pass-if "success on empty set"
268 (char-set? (char-set)))
270 (pass-if "success on non-empty set"
271 (char-set? char-set:printing))
273 (pass-if "failure on empty set"
274 (not (char-set? #t))))
277 (with-test-prefix "char-set="
278 (pass-if "success, no arg"
281 (pass-if "success, one arg"
282 (char-set= char-set:lower-case))
284 (pass-if "success, two args"
285 (char-set= char-set:upper-case char-set:upper-case))
287 (pass-if "failure, first empty"
288 (not (char-set= (char-set) (char-set #\a))))
290 (pass-if "failure, second empty"
291 (not (char-set= (char-set #\a) (char-set))))
293 (pass-if "success, more args"
294 (char-set= char-set:blank char-set:blank char-set:blank))
296 (pass-if "failure, same length, different elements"
297 (not (char-set= (char-set #\a #\b #\d) (char-set #\a #\c #\d)))))
299 (with-test-prefix "char-set<="
300 (pass-if "success, no arg"
303 (pass-if "success, one arg"
304 (char-set<= char-set:lower-case))
306 (pass-if "success, two args"
307 (char-set<= char-set:upper-case char-set:upper-case))
309 (pass-if "success, first empty"
310 (char-set<= (char-set) (char-set #\a)))
312 (pass-if "failure, second empty"
313 (not (char-set<= (char-set #\a) (char-set))))
315 (pass-if "success, more args, equal"
316 (char-set<= char-set:blank char-set:blank char-set:blank))
318 (pass-if "success, more args, not equal"
319 (char-set<= char-set:blank
320 (char-set-adjoin char-set:blank #\F)
321 (char-set-adjoin char-set:blank #\F #\o))))
323 (with-test-prefix "char-set-hash"
324 (pass-if "empty set, bound"
325 (let ((h (char-set-hash char-set:empty 31)))
326 (and h (number? h) (exact? h) (>= h 0) (< h 31))))
328 (pass-if "empty set, no bound"
329 (let ((h (char-set-hash char-set:empty)))
330 (and h (number? h) (exact? h) (>= h 0))))
332 (pass-if "full set, bound"
333 (let ((h (char-set-hash char-set:full 31)))
334 (and h (number? h) (exact? h) (>= h 0) (< h 31))))
336 (pass-if "full set, no bound"
337 (let ((h (char-set-hash char-set:full)))
338 (and h (number? h) (exact? h) (>= h 0))))
340 (pass-if "other set, bound"
341 (let ((h (char-set-hash (char-set #\f #\o #\b #\a #\r) 31)))
342 (and h (number? h) (exact? h) (>= h 0) (< h 31))))
344 (pass-if "other set, no bound"
345 (let ((h (char-set-hash (char-set #\f #\o #\b #\a #\r))))
346 (and h (number? h) (exact? h) (>= h 0)))))
349 (with-test-prefix "char-set cursor"
351 (pass-if-exception "invalid character cursor"
352 exception:wrong-type-arg
353 (let* ((cs (char-set #\B #\r #\a #\z))
354 (cc (char-set-cursor cs)))
355 (char-set-ref cs 1000)))
358 (let* ((cs (char-set #\B #\r #\a #\z))
359 (cc (char-set-cursor cs)))
360 (char? (char-set-ref cs cc))))
362 (pass-if "end of set fails"
363 (let* ((cs (char-set #\a))
364 (cc (char-set-cursor cs)))
365 (not (end-of-char-set? cc))))
367 (pass-if "end of set succeeds, empty set"
368 (let* ((cs (char-set))
369 (cc (char-set-cursor cs)))
370 (end-of-char-set? cc)))
372 (pass-if "end of set succeeds, non-empty set"
373 (let* ((cs (char-set #\a))
374 (cc (char-set-cursor cs))
375 (cc (char-set-cursor-next cs cc)))
376 (end-of-char-set? cc))))
378 (with-test-prefix "char-set-fold"
380 (pass-if "count members"
381 (= (char-set-fold (lambda (c n) (+ n 1)) 0 (char-set #\a #\b)) 2))
384 (= (char-set-size (char-set-fold (lambda (c cs) (char-set-adjoin cs c))
385 (char-set) (char-set #\a #\b))) 2)))
388 (string->char-set (apply string (map integer->char (iota 256)))))
390 (with-test-prefix "char-set-unfold"
392 (pass-if "create char set"
393 (char-set= char-set:256
394 (char-set-unfold (lambda (s) (= s 256)) integer->char
395 (lambda (s) (+ s 1)) 0)))
396 (pass-if "create char set (base set)"
397 (char-set= char-set:256
398 (char-set-unfold (lambda (s) (= s 256)) integer->char
399 (lambda (s) (+ s 1)) 0 char-set:empty))))
401 (with-test-prefix "char-set-unfold!"
403 (pass-if "create char set"
404 (char-set= char-set:256
405 (char-set-unfold! (lambda (s) (= s 256)) integer->char
406 (lambda (s) (+ s 1)) 0
407 (char-set-copy char-set:empty))))
409 (pass-if "create char set"
410 (char-set= char-set:256
411 (char-set-unfold! (lambda (s) (= s 32)) integer->char
412 (lambda (s) (+ s 1)) 0
413 (char-set-copy char-set:256)))))
416 (with-test-prefix "char-set-for-each"
418 (pass-if "copy char set"
419 (= (char-set-size (let ((cs (char-set)))
421 (lambda (c) (char-set-adjoin! cs c))
426 (with-test-prefix "char-set-map"
428 (pass-if "upper case char set 1"
429 (char-set= (char-set-map char-upcase
430 (string->char-set "abcdefghijklmnopqrstuvwxyz"))
431 (string->char-set "ABCDEFGHIJKLMNOPQRSTUVWXYZ")))
433 (pass-if "upper case char set 2"
434 (char-set= (char-set-map char-upcase
435 (string->char-set "àáâãäåæçèéêëìíîïñòóôõöøùúûüýþ"))
436 (string->char-set "ÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÑÒÓÔÕÖØÙÚÛÜÝÞ"))))
438 (with-test-prefix "string->char-set"
440 (pass-if "some char set"
441 (let ((chars '(#\g #\u #\i #\l #\e)))
442 (char-set= (list->char-set chars)
443 (string->char-set (apply string chars))))))
445 (with-test-prefix "char-set->string"
447 (pass-if "some char set"
448 (let ((cs (char-set #\g #\u #\i #\l #\e)))
449 (string=? (char-set->string cs)
452 (with-test-prefix "list->char-set"
454 (pass-if "list->char-set"
455 (char-set= (list->char-set '(#\a #\b #\c))
458 (pass-if "list->char-set!"
459 (let* ((cs (char-set #\a #\z)))
460 (list->char-set! '(#\m #\n) cs)
462 (char-set #\a #\m #\n #\z)))))
464 (with-test-prefix "string->char-set"
466 (pass-if "string->char-set"
467 (char-set= (string->char-set "foobar")
468 (string->char-set "barfoo")))
470 (pass-if "string->char-set cs"
471 (char-set= (string->char-set "foo" (string->char-set "bar"))
472 (string->char-set "barfoo")))
474 (pass-if "string->char-set!"
475 (let ((cs (string->char-set "bar")))
476 (string->char-set! "foo" cs)
478 (string->char-set "barfoo")))))
480 (with-test-prefix "char-set-filter"
482 (pass-if "filter w/o base"
484 (char-set-filter (lambda (c) (char=? c #\x))
485 (->char-set "qrstuvwxyz"))
488 (pass-if "filter w/ base"
490 (char-set-filter (lambda (c) (char=? c #\x))
491 (->char-set "qrstuvwxyz")
497 (let ((cs (->char-set "abc")))
498 (set! cs (char-set-filter! (lambda (c) (char=? c #\x))
499 (->char-set "qrstuvwxyz")
501 (char-set= (string->char-set "abcx")
505 (with-test-prefix "char-set-intersection"
508 (char-set= (char-set-intersection (char-set) (char-set))
511 (pass-if "identical, one element"
512 (char-set= (char-set-intersection (char-set #\a) (char-set #\a))
515 (pass-if "identical, two elements"
516 (char-set= (char-set-intersection (char-set #\a #\b) (char-set #\a #\b))
519 (pass-if "identical, two elements"
520 (char-set= (char-set-intersection (char-set #\a #\c) (char-set #\a #\c))
523 (pass-if "one vs null"
524 (char-set= (char-set-intersection (char-set #\a) (char-set))
527 (pass-if "null vs one"
528 (char-set= (char-set-intersection (char-set) (char-set #\a))
531 (pass-if "no elements shared"
532 (char-set= (char-set-intersection (char-set #\a #\c) (char-set #\b #\d))
535 (pass-if "one elements shared"
536 (char-set= (char-set-intersection (char-set #\a #\c #\d) (char-set #\b #\d))
539 (with-test-prefix "char-set-complement"
541 (pass-if "complement of null"
542 (char-set= (char-set-complement (char-set))
543 (char-set-union (ucs-range->char-set 0 #xd800)
544 (ucs-range->char-set #xe000 #x110000))))
546 (pass-if "complement of null (2)"
547 (char-set= (char-set-complement (char-set))
548 (ucs-range->char-set 0 #x110000)))
550 (pass-if "complement of #\\0"
551 (char-set= (char-set-complement (char-set #\nul))
552 (ucs-range->char-set 1 #x110000)))
554 (pass-if "complement of U+10FFFF"
555 (char-set= (char-set-complement (char-set (integer->char #x10ffff)))
556 (ucs-range->char-set 0 #x10ffff)))
558 (pass-if "complement of 'FOO'"
559 (char-set= (char-set-complement (->char-set "FOO"))
560 (char-set-union (ucs-range->char-set 0 (char->integer #\F))
561 (ucs-range->char-set (char->integer #\G)
563 (ucs-range->char-set (char->integer #\P)
565 (pass-if "complement of #\\a #\\b U+010300"
566 (char-set= (char-set-complement (char-set #\a #\b (integer->char #x010300)))
567 (char-set-union (ucs-range->char-set 0 (char->integer #\a))
568 (ucs-range->char-set (char->integer #\c) #x010300)
569 (ucs-range->char-set #x010301 #x110000)))))
571 (with-test-prefix "ucs-range->char-set"
573 (char-set= (ucs-range->char-set 65 68)
576 (pass-if "char-set w/ base"
577 (char-set= (ucs-range->char-set 65 68 #f (->char-set "DEF"))
578 (->char-set "ABCDEF")))
581 (let ((cs (->char-set "DEF")))
582 (ucs-range->char-set! 65 68 #f cs)
584 (->char-set "ABCDEF")))))
586 (with-test-prefix "char-set-count"
588 (= 0 (char-set-count (lambda (c) #t) (char-set))))
591 (= 5 (char-set-count (lambda (c) #t)
592 (->char-set "guile")))))
594 (with-test-prefix "char-set-contains?"
595 (pass-if "#\\a not in null"
596 (not (char-set-contains? (char-set) #\a)))
598 (pass-if "#\\a is in 'abc'"
599 (char-set-contains? (->char-set "abc") #\a)))
601 (with-test-prefix "any / every"
602 (pass-if "char-set-every #t"
603 (char-set-every (lambda (c) #t)
606 (pass-if "char-set-every #f"
607 (not (char-set-every (lambda (c) (char=? c #\c))
608 (->char-set "abc"))))
610 (pass-if "char-set-any #t"
611 (char-set-any (lambda (c) (char=? c #\c))
614 (pass-if "char-set-any #f"
615 (not (char-set-any (lambda (c) #f)
616 (->char-set "abc")))))
618 (with-test-prefix "char-set-delete"
620 (char-set= (char-set-delete (->char-set "abc") #\a)
624 (char-set= (char-set-delete (->char-set "abc") #\d)
625 (char-set #\a #\b #\c)))
627 (pass-if "delete! abc - a"
628 (let ((cs (char-set #\a #\b #\c)))
629 (char-set-delete! cs #\a)
630 (char-set= cs (char-set #\b #\c)))))
632 (with-test-prefix "char-set-difference"
633 (pass-if "not different"
634 (char-set= (char-set-difference (->char-set "foobar") (->char-set "foobar"))
637 (pass-if "completely different"
638 (char-set= (char-set-difference (->char-set "foo") (->char-set "bar"))
641 (pass-if "partially different"
642 (char-set= (char-set-difference (->char-set "breakfast") (->char-set "breakroom"))
643 (->char-set "fst"))))
645 (with-test-prefix "standard char sets (ASCII)"
647 (pass-if "char-set:lower-case"
648 (char-set<= (string->char-set "abcdefghijklmnopqrstuvwxyz")
649 char-set:lower-case))
651 (pass-if "char-set:upper-case"
652 (char-set<= (string->char-set "ABCDEFGHIJKLMNOPQRSTUVWXYZ")
653 char-set:upper-case))
655 (pass-if "char-set:title-case"
656 (char-set<= (string->char-set "")
657 char-set:title-case))
659 (pass-if "char-set:letter"
660 (char-set<= (char-set-union
661 (string->char-set "abcdefghijklmnopqrstuvwxyz")
662 (string->char-set "ABCDEFGHIJKLMNOPQRSTUVWXYZ"))
665 (pass-if "char-set:digit"
666 (char-set<= (string->char-set "0123456789")
669 (pass-if "char-set:hex-digit"
670 (char-set<= (string->char-set "0123456789abcdefABCDEF")
673 (pass-if "char-set:letter+digit"
674 (char-set<= (char-set-union
675 (string->char-set "abcdefghijklmnopqrstuvwxyz")
676 (string->char-set "ABCDEFGHIJKLMNOPQRSTUVWXYZ")
677 (string->char-set "0123456789"))
678 char-set:letter+digit))
680 (pass-if "char-set:punctuation"
681 (char-set<= (string->char-set "!\"#%&'()*,-./:;?@[\\]_{}")
682 char-set:punctuation))
684 (pass-if "char-set:symbol"
685 (char-set<= (string->char-set "$+<=>^`|~")
688 (pass-if "char-set:graphic"
689 (char-set<= (char-set-union
690 (string->char-set "abcdefghijklmnopqrstuvwxyz")
691 (string->char-set "ABCDEFGHIJKLMNOPQRSTUVWXYZ")
692 (string->char-set "0123456789")
693 (string->char-set "!\"#%&'()*,-./:;?@[\\]_{}")
694 (string->char-set "$+<=>^`|~"))
697 (pass-if "char-set:whitespace"
698 (char-set<= (string->char-set
705 (integer->char #x20)))
706 char-set:whitespace))
708 (pass-if "char-set:printing"
709 (char-set<= (char-set-union
710 (string->char-set "abcdefghijklmnopqrstuvwxyz")
711 (string->char-set "ABCDEFGHIJKLMNOPQRSTUVWXYZ")
712 (string->char-set "0123456789")
713 (string->char-set "!\"#%&'()*,-./:;?@[\\]_{}")
714 (string->char-set "$+<=>^`|~")
715 (string->char-set (string
721 (integer->char #x20))))
724 (pass-if "char-set:ASCII"
725 (char-set= (ucs-range->char-set 0 128)
728 (pass-if "char-set:iso-control"
729 (char-set<= (string->char-set
731 (map integer->char (append
735 char-set:iso-control)))
739 ;;; Non-ASCII codepoints
741 ;;; Here, we only test ISO-8859-1 (Latin-1), notably because behavior of
742 ;;; SRFI-14 for implementations supporting this charset is well-defined.
745 (define (every? pred lst)
746 (not (not (every pred lst))))
748 (define oldlocale #f)
749 (if (defined? 'setlocale)
750 (set! oldlocale (setlocale LC_ALL "")))
752 (with-test-prefix "Latin-1 (8-bit charset)"
754 (pass-if "char-set:lower-case"
755 (char-set<= (string->char-set
756 (string-append "abcdefghijklmnopqrstuvwxyz"
757 "µßàáâãäåæçèéêëìíîïðñòóôõöøùúûüýþÿ")
758 char-set:lower-case)))
760 (pass-if "char-set:upper-case"
761 (char-set<= (string->char-set
762 (string-append "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
763 "ÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖØÙÚÛÜÝÞ")
764 char-set:lower-case)))
766 (pass-if "char-set:title-case"
767 (char-set<= (string->char-set "")
768 char-set:title-case))
770 (pass-if "char-set:letter"
771 (char-set<= (string->char-set
774 "abcdefghijklmnopqrstuvwxyz"
775 "µßàáâãäåæçèéêëìíîïðñòóôõöøùúûüýþÿ"
777 "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
778 "ÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖØÙÚÛÜÝÞ"
783 (pass-if "char-set:digit"
784 (char-set<= (string->char-set "0123456789")
787 (pass-if "char-set:hex-digit"
788 (char-set<= (string->char-set "0123456789abcdefABCDEF")
791 (pass-if "char-set:letter+digit"
792 (char-set<= (char-set-union
795 char-set:letter+digit))
797 (pass-if "char-set:punctuation"
798 (char-set<= (string->char-set
799 (string-append "!\"#%&'()*,-./:;?@[\\]_{}"
801 char-set:punctuation))
803 (pass-if "char-set:symbol"
804 (char-set<= (string->char-set
805 (string-append "$+<=>^`|~"
809 ;; Note that SRFI-14 itself is inconsistent here. Characters that
810 ;; are non-digit numbers (such as category No) are clearly 'graphic'
811 ;; but don't occur in the letter, digit, punct, or symbol charsets.
812 (pass-if "char-set:graphic"
813 (char-set<= (char-set-union
820 (pass-if "char-set:whitespace"
821 (char-set<= (string->char-set
829 (integer->char #xa0)))
830 char-set:whitespace))
832 (pass-if "char-set:printing"
833 (char-set<= (char-set-union char-set:graphic char-set:whitespace)
836 (pass-if "char-set:iso-control"
837 (char-set<= (string->char-set
839 (map integer->char (append
844 (map (lambda (x) (+ #x80 x))
846 char-set:iso-control)))
848 (if (defined? 'setlocale)
849 (setlocale LC_ALL oldlocale))