mirror of
https://git.savannah.gnu.org/git/guile.git
synced 2025-07-03 16:20:39 +02:00
* libguile/srfi-14.c: * module/srfi/srfi-14.scm: Arrange to define bindings here instead of in the default environment. * libguile/init.c: * libguile/srfi-14.h: Fix so that srfi-14 can register an extension to be loaded later. * libguile/unidata_to_charset.awk: Rename private cs_letter_plus_digit to cs_letter_and_digit. * module/ice-9/deprecated.scm: Add deprecation trampolines for srfi-14. * module/ice-9/sandbox.scm: * module/language/elisp/lexer.scm: * module/language/scheme/decompile-tree-il.scm: * module/rnrs/unicode.scm: * module/sxml/simple.scm: * module/system/base/syntax.scm: * module/system/repl/server.scm: * module/texinfo/serialize.scm: * module/texinfo/string-utils.scm: * module/web/http.scm: * module/web/uri.scm: * test-suite/tests/strings.test: * test-suite/tests/tree-il.test: Adapt for srfi-14 being in a module.
104 lines
2.3 KiB
Scheme
104 lines
2.3 KiB
Scheme
;;; unicode.scm --- The R6RS Unicode library
|
||
|
||
;; Copyright (C) 2010, 2025 Free Software Foundation, Inc.
|
||
;;
|
||
;; This library is free software; you can redistribute it and/or
|
||
;; modify it under the terms of the GNU Lesser General Public
|
||
;; License as published by the Free Software Foundation; either
|
||
;; version 3 of the License, or (at your option) any later version.
|
||
;;
|
||
;; This library is distributed in the hope that it will be useful,
|
||
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||
;; Lesser General Public License for more details.
|
||
;;
|
||
;; You should have received a copy of the GNU Lesser General Public
|
||
;; License along with this library; if not, write to the Free Software
|
||
;; Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||
|
||
|
||
(library (rnrs unicode (6))
|
||
(export char-upcase
|
||
char-downcase
|
||
char-titlecase
|
||
char-foldcase
|
||
|
||
char-ci=?
|
||
char-ci<?
|
||
char-ci>?
|
||
char-ci<=?
|
||
char-ci>=?
|
||
|
||
char-alphabetic?
|
||
char-numeric?
|
||
char-whitespace?
|
||
char-upper-case?
|
||
char-lower-case?
|
||
char-title-case?
|
||
|
||
char-general-category
|
||
|
||
string-upcase
|
||
string-downcase
|
||
string-titlecase
|
||
string-foldcase
|
||
|
||
string-ci=?
|
||
string-ci<?
|
||
string-ci>?
|
||
string-ci<=?
|
||
string-ci>=?
|
||
|
||
string-normalize-nfd
|
||
string-normalize-nfkd
|
||
string-normalize-nfc
|
||
string-normalize-nfkc)
|
||
(import (only (guile) char-upcase
|
||
char-downcase
|
||
char-titlecase
|
||
|
||
char-ci=?
|
||
char-ci<?
|
||
char-ci>?
|
||
char-ci<=?
|
||
char-ci>=?
|
||
|
||
char-alphabetic?
|
||
char-numeric?
|
||
char-whitespace?
|
||
char-upper-case?
|
||
char-lower-case?
|
||
|
||
char-general-category
|
||
|
||
char-upcase
|
||
char-downcase
|
||
char-titlecase
|
||
|
||
string-upcase
|
||
string-downcase
|
||
string-titlecase
|
||
|
||
string-ci=?
|
||
string-ci<?
|
||
string-ci>?
|
||
string-ci<=?
|
||
string-ci>=?
|
||
|
||
string-normalize-nfd
|
||
string-normalize-nfkd
|
||
string-normalize-nfc
|
||
string-normalize-nfkc)
|
||
(only (srfi srfi-14)
|
||
char-set-contains?
|
||
char-set:title-case)
|
||
(rnrs base (6)))
|
||
|
||
(define (char-foldcase char)
|
||
(if (or (eqv? char #\460) (eqv? char #\461))
|
||
char (char-downcase (char-upcase char))))
|
||
|
||
(define (char-title-case? char) (char-set-contains? char-set:title-case char))
|
||
|
||
(define (string-foldcase str) (string-downcase (string-upcase str)))
|
||
)
|