Mercurial > hg > octave-nkf > gnulib-hg
changeset 11663:328bb9352b98
New module 'unicase/cased'.
author | Bruno Haible <bruno@clisp.org> |
---|---|
date | Mon, 29 Jun 2009 23:31:33 +0200 |
parents | 8e561c7cff21 |
children | ebdc03071f2c |
files | ChangeLog lib/unicase/cased.c lib/unicase/caseprop.h modules/unicase/cased |
diffstat | 4 files changed, 101 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,10 @@ 2009-06-29 Bruno Haible <bruno@clisp.org> + New module 'unicase/cased'. + * lib/unicase/caseprop.h: New file. + * lib/unicase/cased.c: New file. + * modules/unicase/cased: New file. + New functions for case mapping of substrings. * lib/unicase.h (casing_prefix_context_t): New type. (unicase_empty_prefix_context): New variable.
new file mode 100644 --- /dev/null +++ b/lib/unicase/cased.c @@ -0,0 +1,35 @@ +/* Test whether a Unicode character is cased. + Copyright (C) 2009 Free Software Foundation, Inc. + Written by Bruno Haible <bruno@clisp.org>, 2009. + + This program 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 program 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 program. If not, see <http://www.gnu.org/licenses/>. */ + +#include <config.h> + +/* Specification. */ +#include "caseprop.h" + +#include "unictype.h" + +bool +uc_is_cased (ucs4_t uc) +{ + /* Quoting the Unicode standard: + Definition: A character is defined to be "cased" if it has the Lowercase + or Uppercase property or has a General_Category value of + Titlecase_Letter. */ + return (uc_is_property_lowercase (uc) + || uc_is_property_uppercase (uc) + || uc_is_general_category (uc, UC_TITLECASE_LETTER)); +}
new file mode 100644 --- /dev/null +++ b/lib/unicase/caseprop.h @@ -0,0 +1,32 @@ +/* Case related properties of Unicode characters. + Copyright (C) 2009 Free Software Foundation, Inc. + Written by Bruno Haible <bruno@clisp.org>, 2009. + + This program 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 program 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 program. If not, see <http://www.gnu.org/licenses/>. */ + +#include <stdbool.h> +#include "unitypes.h" + +/* Determine whether a character is "cased" according to the Unicode Standard, + <http://www.unicode.org/versions/Unicode5.0.0/ch03.pdf>, section 3.13, + definition D120. */ +extern bool + uc_is_cased (ucs4_t uc); + +/* Determine whether a character is "case-ignorable" + according to the Unicode Standard, + <http://www.unicode.org/versions/Unicode5.0.0/ch03.pdf>, section 3.13, + definition D121. */ +extern bool + uc_is_case_ignorable (ucs4_t uc);
new file mode 100644 --- /dev/null +++ b/modules/unicase/cased @@ -0,0 +1,29 @@ +Description: +Test whether a Unicode character is "cased". + +Files: +lib/unicase/caseprop.h +lib/unicase/cased.c + +Depends-on: +unictype/category-test +unictype/category-Lt +unictype/property-lowercase +unictype/property-uppercase +unitypes +stdbool + +configure.ac: + +Makefile.am: +lib_SOURCES += unicase/cased.c + +Include: +"unicase/caseprop.h" + +License: +LGPL + +Maintainer: +Bruno Haible +