mirror of
https://git.savannah.gnu.org/git/guile.git
synced 2025-06-22 11:34:09 +02:00
Improved support for Unicode title case in Guile's string and character APIs.
* doc/ref/api-data.texi (Characters): Documentation for `char-titlecase'. * doc/ref/api-i18n.texi (Character Case Mapping): Documentation for `char-locale-titlecase' and `string-locale-titlecase'. * libguile/chars.c, libguile/chars.h (scm_char_titlecase, scm_c_titlecase): New functions. * libguile/i18n.c, libguile/i18n.h (chr_to_case, scm_char_locale_titlecase, str_to_case, scm_string_locale_titlecase): New functions. * libguile/i18n.c (scm_char_locale_downcase, scm_char_locale_upcase, scm_string_locale_downcase, scm_string_locale_upcase): Refactor to share code via chr_to_case and str_to_case, as appropriate. * module/ice-9/i18n.scm (char-locale-title-case, string-locale-titlecase): New functions. * libguile/srfi-13.c (string_titlecase_x): Use uc_totitle instead of uc_toupper. * test-suite/tests/chars.test: Tests for `char-titlecase'. * test-suite/tests/i18n.test: Tests for `char-locale-titlecase' and `string-locale-titlecase'. * test-suite/tests/srfi-13.test: Tests for `string-titlecase'.
This commit is contained in:
parent
9b5a0d8460
commit
820f33aaed
11 changed files with 227 additions and 103 deletions
|
@ -1901,6 +1901,19 @@ Return the uppercase character version of @var{chr}.
|
|||
Return the lowercase character version of @var{chr}.
|
||||
@end deffn
|
||||
|
||||
@rnindex char-titlecase
|
||||
@deffn {Scheme Procedure} char-titlecase chr
|
||||
@deffnx {C Function} scm_char_titlecase (chr)
|
||||
Return the titlecase character version of @var{chr} if one exists;
|
||||
otherwise return the uppercase version.
|
||||
|
||||
For most characters these will be the same, but the Unicode Standard
|
||||
includes certain digraph compatibility characters, such as @code{U+01F3}
|
||||
``dz'', for which the uppercase and titlecase characters are different
|
||||
(@code{U+01F1} ``DZ'' and @code{U+01F2} ``Dz'' in this case,
|
||||
respectively).
|
||||
@end deffn
|
||||
|
||||
@node Character Sets
|
||||
@subsection Character Sets
|
||||
|
||||
|
|
|
@ -197,6 +197,12 @@ Return the uppercase character that corresponds to @var{chr} according
|
|||
to either @var{locale} or the current locale.
|
||||
@end deffn
|
||||
|
||||
@deffn {Scheme Procedure} char-locale-titlecase chr [locale]
|
||||
@deffnx {C Function} scm_char_locale_titlecase (chr, locale)
|
||||
Return the titlecase character that corresponds to @var{chr} according
|
||||
to either @var{locale} or the current locale.
|
||||
@end deffn
|
||||
|
||||
@deffn {Scheme Procedure} string-locale-upcase str [locale]
|
||||
@deffnx {C Function} scm_string_locale_upcase (str, locale)
|
||||
Return a new string that is the uppercase version of @var{str}
|
||||
|
@ -209,6 +215,12 @@ Return a new string that is the down-case version of @var{str}
|
|||
according to either @var{locale} or the current locale.
|
||||
@end deffn
|
||||
|
||||
@deffn {Scheme Procedure} string-locale-titlecase str [locale]
|
||||
@deffnx {C Function} scm_string_locale_titlecase (str, locale)
|
||||
Return a new string that is the titlecase version of @var{str}
|
||||
according to either @var{locale} or the current locale.
|
||||
@end deffn
|
||||
|
||||
Note that in the current implementation Guile has no notion of
|
||||
multibyte characters and in a multibyte locale characters may not be
|
||||
converted correctly.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue