Commit | Line | Data |
---|---|---|
94953250 JG |
1 | ;;; unicode.scm --- The R6RS Unicode library |
2 | ||
3 | ;; Copyright (C) 2010 Free Software Foundation, Inc. | |
4 | ;; | |
5 | ;; This library is free software; you can redistribute it and/or | |
6 | ;; modify it under the terms of the GNU Lesser General Public | |
7 | ;; License as published by the Free Software Foundation; either | |
8 | ;; version 3 of the License, or (at your option) any later version. | |
9 | ;; | |
10 | ;; This library is distributed in the hope that it will be useful, | |
11 | ;; but WITHOUT ANY WARRANTY; without even the implied warranty of | |
12 | ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
13 | ;; Lesser General Public License for more details. | |
14 | ;; | |
15 | ;; You should have received a copy of the GNU Lesser General Public | |
16 | ;; License along with this library; if not, write to the Free Software | |
17 | ;; Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA | |
18 | \f | |
19 | ||
20 | (library (rnrs unicode (6)) | |
21 | (export char-upcase | |
22 | char-downcase | |
23 | char-titlecase | |
24 | char-foldcase | |
25 | ||
26 | char-ci=? | |
27 | char-ci<? | |
28 | char-ci>? | |
29 | char-ci<=? | |
30 | char-ci>=? | |
31 | ||
32 | char-alphabetic? | |
33 | char-numeric? | |
34 | char-whitespace? | |
35 | char-upper-case? | |
36 | char-lower-case? | |
37 | char-title-case? | |
38 | ||
39 | char-general-category | |
40 | ||
41 | string-upcase | |
42 | string-downcase | |
43 | string-titlecase | |
44 | string-foldcase | |
45 | ||
46 | string-ci=? | |
47 | string-ci<? | |
48 | string-ci>? | |
49 | string-ci<=? | |
50 | string-ci>=? | |
51 | ||
52 | string-normalize-nfd | |
53 | string-normalize-nfkd | |
54 | string-normalize-nfc | |
55 | string-normalize-nfkc) | |
56 | (import (only (guile) char-upcase | |
57 | char-downcase | |
58 | char-titlecase | |
59 | ||
60 | char-ci=? | |
61 | char-ci<? | |
62 | char-ci>? | |
63 | char-ci<=? | |
64 | char-ci>=? | |
65 | ||
66 | char-alphabetic? | |
67 | char-numeric? | |
68 | char-whitespace? | |
69 | char-upper-case? | |
70 | char-lower-case? | |
71 | ||
72 | char-set-contains? | |
73 | char-set:title-case | |
74 | ||
75 | char-general-category | |
76 | ||
77 | char-upcase | |
78 | char-downcase | |
79 | char-titlecase | |
80 | ||
81 | string-upcase | |
82 | string-downcase | |
83 | string-titlecase | |
84 | ||
85 | string-ci=? | |
86 | string-ci<? | |
87 | string-ci>? | |
88 | string-ci<=? | |
89 | string-ci>=? | |
90 | ||
91 | string-normalize-nfd | |
92 | string-normalize-nfkd | |
93 | string-normalize-nfc | |
94 | string-normalize-nfkc) | |
95 | (rnrs base (6))) | |
96 | ||
97 | (define (char-foldcase char) | |
98 | (if (or (eqv? char #\460) (eqv? char #\461)) | |
99 | char (char-downcase (char-upcase char)))) | |
100 | ||
101 | (define (char-title-case? char) (char-set-contains? char-set:title-case char)) | |
102 | ||
103 | (define (string-foldcase str) (string-downcase (string-upcase str))) | |
104 | ) |