New module 'unicase/cased'.
authorBruno Haible <bruno@clisp.org>
Mon, 29 Jun 2009 21:31:33 +0000 (23:31 +0200)
committerBruno Haible <bruno@clisp.org>
Mon, 29 Jun 2009 21:32:51 +0000 (23:32 +0200)
ChangeLog
lib/unicase/cased.c [new file with mode: 0644]
lib/unicase/caseprop.h [new file with mode: 0644]
modules/unicase/cased [new file with mode: 0644]

index b65a5d7a1cab6ea2f70af2a3859081799c2ce37c..710507d240b58648c5cd55dbe8cd7194b0b6fb80 100644 (file)
--- 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.
diff --git a/lib/unicase/cased.c b/lib/unicase/cased.c
new file mode 100644 (file)
index 0000000..1dc19c5
--- /dev/null
@@ -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));
+}
diff --git a/lib/unicase/caseprop.h b/lib/unicase/caseprop.h
new file mode 100644 (file)
index 0000000..f84453e
--- /dev/null
@@ -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);
diff --git a/modules/unicase/cased b/modules/unicase/cased
new file mode 100644 (file)
index 0000000..e679235
--- /dev/null
@@ -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
+