summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 2b5773d)
raw | patch | inline | side by side (parent: 2b5773d)
author | ishmal <ishmal@users.sourceforge.net> | |
Mon, 30 Jun 2008 20:04:11 +0000 (20:04 +0000) | ||
committer | ishmal <ishmal@users.sourceforge.net> | |
Mon, 30 Jun 2008 20:04:11 +0000 (20:04 +0000) |
src/dom/ucd.cpp | patch | blob | history | |
src/dom/ucd.h | patch | blob | history |
diff --git a/src/dom/ucd.cpp b/src/dom/ucd.cpp
index 602c716306f177af1e2f351eaf85b9453edfbdde..3747334d2b0861f682993c12dbfe47714520e02d 100644 (file)
--- a/src/dom/ucd.cpp
+++ b/src/dom/ucd.cpp
/*
- * Generated by UcdReader at:Tue Jun 24 11:58:24 GMT-06:00 2008
+ * Generated by UcdReader at:Mon Jun 30 13:52:41 GMT-06:00 2008
* block table size:2 (4 bytes)
* plane table size:6 (64 bytes)
*
#define UNI_CODE(ch) (prop[block[plane[(ch>>8)&8191]+((ch>>2)&63)]+(ch&3)])
+/**
+ * Get type part of code
+
+ */
+#define UNI_CODE_TO_TYPE(ch) (ch & 0x1f)
+
/**
* Fetch the category type
*/
-#define UNI_TYPE(ch) (UNI_CODE(ch) & 0x1f)
+#define UNI_TYPE(ch) (UNI_CODE_TO_TYPE(UNI_CODE(ch)))
/**
* Fetch the digit offset
int uni_is_letter(int ch)
{
- int c = UNI_CODE(ch);
+ int c = UNI_TYPE(ch);
return (c>=UNI_UPPERCASE_LETTER && c<=UNI_OTHER_LETTER);
}
int uni_is_letter_or_digit(int ch)
{
- int c = UNI_CODE(ch);
+ int c = UNI_TYPE(ch);
return ((c>=UNI_UPPERCASE_LETTER && c<=UNI_OTHER_LETTER)
|| c==UNI_DECIMAL_DIGIT_NUMBER);
}
int uni_is_space(int ch)
{
- int c = UNI_CODE(ch);
+ int c = UNI_TYPE(ch);
return (c==UNI_SPACE_SEPARATOR || c==UNI_LINE_SEPARATOR
- || c==UNI_PARAGRAPH_SEPARATOR);
+ || c==UNI_PARAGRAPH_SEPARATOR || (ch>= 0x09 && ch <= 0x0d));
}
int uni_to_lower(int ch)
{
int c = UNI_CODE(ch);
- if (c == UNI_LOWERCASE_LETTER)
+ if (UNI_CODE_TO_TYPE(c) == UNI_LOWERCASE_LETTER)
return ch;
ch -= (c>>18) & 0x1ff;
return ch;
int uni_to_upper(int ch)
{
int c = UNI_CODE(ch);
- if (c == UNI_UPPERCASE_LETTER)
+ if (UNI_CODE_TO_TYPE(c) == UNI_UPPERCASE_LETTER)
return ch;
ch += (c>>18) & 0x1ff;
return ch;
int uni_to_title(int ch)
{
int c = UNI_CODE(ch);
- if (c == UNI_TITLECASE_LETTER)
+ if (UNI_CODE_TO_TYPE(c) == UNI_TITLECASE_LETTER)
return ch;
ch += (c>>18) & 0x1ff;
return ch;
diff --git a/src/dom/ucd.h b/src/dom/ucd.h
index d8b301d476d2961314430ffaf6f1b00f673b877b..c4d0ab4e0b54ecaaf1db1c3f9e683a852bf74bc7 100644 (file)
--- a/src/dom/ucd.h
+++ b/src/dom/ucd.h
/**
+ * Phoebe DOM Implementation.
*
- * Inkscape Unicode Character Database (UCD) 5.1.0. Utility
+ * This is a C++ approximation of the W3C DOM model, which follows
+ * fairly closely the specifications in the various .idl files, copies of
+ * which are provided for reference. Most important is this one:
*
+ * http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/idl-definitions.html
+ *
+ * More thorough explanations of the various classes and their algorithms
+ * can be found there.
+ *
*
* Authors:
* Bob Jamison
*
- * Copyright (C) 2008 Bob Jamison
+ * Copyright (C) 2006-2008 Bob Jamison
*
* 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.
+ * version 2.1 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
* 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 St, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
*/
#ifndef __UCD_H__
#define __UCD_H__