From: Bruno Haible Date: Mon, 29 Jun 2009 21:31:33 +0000 (+0200) Subject: New module 'unicase/cased'. X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=1111a3b8dc022eee7fc87b371c00ac9da498e38e;p=pspp New module 'unicase/cased'. --- diff --git a/ChangeLog b/ChangeLog index b65a5d7a1c..710507d240 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,10 @@ 2009-06-29 Bruno Haible + 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. diff --git a/lib/unicase/cased.c b/lib/unicase/cased.c new file mode 100644 index 0000000000..1dc19c5001 --- /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 , 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 . */ + +#include + +/* 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)); +} diff --git a/lib/unicase/caseprop.h b/lib/unicase/caseprop.h new file mode 100644 index 0000000000..f84453ece8 --- /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 , 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 . */ + +#include +#include "unitypes.h" + +/* Determine whether a character is "cased" according to the Unicode Standard, + , 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, + , section 3.13, + definition D121. */ +extern bool + uc_is_case_ignorable (ucs4_t uc); diff --git a/modules/unicase/cased b/modules/unicase/cased new file mode 100644 index 0000000000..e679235b9c --- /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 +