summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorKonstantin Ritt <ritt.ks@gmail.com>2012-04-23 06:00:16 +0300
committerQt by Nokia <qt-info@nokia.com>2012-04-24 21:45:00 +0200
commitf948bb3c6c6d14f5d5f209f9be720998a81df145 (patch)
treebfad43eee3cda60ae73ec655ecb32152b962da37 /src
parentba0d752c2dcfbbfb9a1ebc40ce01e40c64d21494 (diff)
qunicodetables generator: improve the output and the generated code
better memory usage report; an additional asserts with conditions the implementation is depends on; a namespace for the internal static data; styling fixes Change-Id: Id4048ff6104c56b5f590f9ac6fbf7c0bce79ec47 Reviewed-by: Lars Knoll <lars.knoll@nokia.com> Reviewed-by: Konstantin Ritt <ritt.ks@gmail.com>
Diffstat (limited to 'src')
-rw-r--r--src/corelib/tools/qunicodetables.cpp60
-rw-r--r--src/corelib/tools/qunicodetables_p.h2
2 files changed, 33 insertions, 29 deletions
diff --git a/src/corelib/tools/qunicodetables.cpp b/src/corelib/tools/qunicodetables.cpp
index 9504e7168e..ea61d2090d 100644
--- a/src/corelib/tools/qunicodetables.cpp
+++ b/src/corelib/tools/qunicodetables.cpp
@@ -41,8 +41,12 @@
/* This file is autogenerated from the Unicode 5.0 database. Do not edit */
+#include "qunicodetables_p.h"
+
QT_BEGIN_NAMESPACE
+namespace QUnicodeTables {
+
static const unsigned short uc_property_trie[] = {
// 0 - 0x11000
@@ -3422,9 +3426,9 @@ static const unsigned short uc_property_trie[] = {
: (uc_property_trie[uc_property_trie[((ucs4 - 0x11000)>>8) + 0x880] + (ucs4 & 0xff)]))
#define GET_PROP_INDEX_UCS2(ucs2) \
-(uc_property_trie[uc_property_trie[ucs2>>5] + (ucs2 & 0x1f)])
+ (uc_property_trie[uc_property_trie[ucs2>>5] + (ucs2 & 0x1f)])
-static const QUnicodeTables::Properties uc_properties[] = {
+static const Properties uc_properties[] = {
{ 9, 19, 18, 0, 0, -1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 0, 0 },
{ 9, 15, 8, 0, 0, -1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 0, 3 },
{ 9, 30, 7, 0, 0, -1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 1 },
@@ -4319,38 +4323,37 @@ static const QUnicodeTables::Properties uc_properties[] = {
{ 3, 10, 2, 0, 0, 9, 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 6, 7 },
{ 13, 11, 0, 0, 0, -1, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
{ 18, 12, 0, 0, 0, -1, 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 6 },
- { 12, 11, 0, 0, 0, -1, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
+ { 12, 11, 0, 0, 0, -1, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }
};
-static inline const QUnicodeTables::Properties *qGetProp(uint ucs4)
+static inline const Properties *qGetProp(uint ucs4)
{
- int index = GET_PROP_INDEX(ucs4);
+ const int index = GET_PROP_INDEX(ucs4);
return uc_properties + index;
}
-static inline const QUnicodeTables::Properties *qGetProp(ushort ucs2)
+static inline const Properties *qGetProp(ushort ucs2)
{
- int index = GET_PROP_INDEX_UCS2(ucs2);
+ const int index = GET_PROP_INDEX_UCS2(ucs2);
return uc_properties + index;
}
-Q_CORE_EXPORT const QUnicodeTables::Properties * QT_FASTCALL QUnicodeTables::properties(uint ucs4)
+Q_CORE_EXPORT const Properties * QT_FASTCALL properties(uint ucs4)
{
- int index = GET_PROP_INDEX(ucs4);
- return uc_properties + index;
+ return qGetProp(ucs4);
}
-Q_CORE_EXPORT const QUnicodeTables::Properties * QT_FASTCALL QUnicodeTables::properties(ushort ucs2)
+Q_CORE_EXPORT const Properties * QT_FASTCALL properties(ushort ucs2)
{
- int index = GET_PROP_INDEX_UCS2(ucs2);
- return uc_properties + index;
+ return qGetProp(ucs2);
}
-Q_CORE_EXPORT QUnicodeTables::LineBreakClass QT_FASTCALL QUnicodeTables::lineBreakClass(uint ucs4)
+Q_CORE_EXPORT LineBreakClass QT_FASTCALL lineBreakClass(uint ucs4)
{
- return (QUnicodeTables::LineBreakClass)qGetProp(ucs4)->line_break_class;
+ return (LineBreakClass)qGetProp(ucs4)->line_break_class;
}
+
static const ushort specialCaseMap[] = {
0x0, // placeholder
0x2, 0x53, 0x73,
@@ -4449,7 +4452,7 @@ static const ushort specialCaseMap[] = {
0x3, 0x3a9, 0x342, 0x345,
0x3, 0x3a9, 0x342, 0x399
};
-#define SPECIAL_CASE_MAX_LEN 3
+
static const unsigned short uc_decomposition_trie[] = {
// 0 - 0x3400
@@ -5893,7 +5896,7 @@ static const unsigned short uc_decomposition_trie[] = {
0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff,
0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff,
0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff,
- 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff,
+ 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff
};
#define GET_DECOMPOSITION_INDEX(ucs4) \
@@ -5904,7 +5907,6 @@ static const unsigned short uc_decomposition_trie[] = {
: 0xffff))
static const unsigned short uc_decomposition_map[] = {
-
0x103, 0x20, 0x210, 0x20, 0x308, 0x109, 0x61, 0x210,
0x20, 0x304, 0x109, 0x32, 0x109, 0x33, 0x210, 0x20,
0x301, 0x110, 0x3bc, 0x210, 0x20, 0x327, 0x109, 0x31,
@@ -7608,7 +7610,7 @@ static const unsigned short uc_decomposition_map[] = {
0xdd05, 0x201, 0xd868, 0xde0e, 0x201, 0xd868, 0xde91, 0x101,
0x9ebb, 0x101, 0x4d56, 0x101, 0x9ef9, 0x101, 0x9efe, 0x101,
0x9f05, 0x101, 0x9f0f, 0x101, 0x9f16, 0x101, 0x9f3b, 0x201,
- 0xd869, 0xde00,
+ 0xd869, 0xde00
};
static const unsigned short uc_ligature_trie[] = {
@@ -7766,13 +7768,13 @@ static const unsigned short uc_ligature_trie[] = {
0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff,
0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff,
0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff,
- 0xffff, 0x700, 0x761, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff,
+ 0xffff, 0x700, 0x761, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff
};
-#define GET_LIGATURE_INDEX(u2) (u2 < 0x3100 ? uc_ligature_trie[uc_ligature_trie[u2>>5] + (u2 & 0x1f)] : 0xffff);
+#define GET_LIGATURE_INDEX(u2) \
+ (u2 < 0x3100 ? uc_ligature_trie[uc_ligature_trie[u2>>5] + (u2 & 0x1f)] : 0xffff);
static const unsigned short uc_ligature_map[] = {
-
0x54, 0x41, 0xc0, 0x45, 0xc8, 0x49, 0xcc, 0x4e,
0x1f8, 0x4f, 0xd2, 0x55, 0xd9, 0x57, 0x1e80, 0x59,
0x1ef2, 0x61, 0xe0, 0x65, 0xe8, 0x69, 0xec, 0x6e,
@@ -8011,9 +8013,10 @@ static const unsigned short uc_ligature_map[] = {
0x30f7, 0x30f0, 0x30f8, 0x30f1, 0x30f9, 0x30f2, 0x30fa, 0x30fd,
0x30fe, 0xa, 0x306f, 0x3071, 0x3072, 0x3074, 0x3075, 0x3077,
0x3078, 0x307a, 0x307b, 0x307d, 0x30cf, 0x30d1, 0x30d2, 0x30d4,
- 0x30d5, 0x30d7, 0x30d8, 0x30da, 0x30db, 0x30dd,
+ 0x30d5, 0x30d7, 0x30d8, 0x30da, 0x30db, 0x30dd
};
+
struct NormalizationCorrection {
uint ucs4;
uint old_mapping;
@@ -8032,11 +8035,10 @@ static const NormalizationCorrection uc_normalization_corrections[] = {
enum { NumNormalizationCorrections = 6 };
enum { NormalizationCorrectionsVersionMax = 7 };
+
enum { UnicodeBlockCount = 512 }; // number of unicode blocks
enum { UnicodeBlockSize = 128 }; // size of each block
-namespace QUnicodeTables {
-
static const unsigned char uc_scripts[] = {
Common, /* U+0000-007f */
Common, /* U+0080-00ff */
@@ -9471,9 +9473,7 @@ static const unsigned char uc_scripts[] = {
Common, Common, Common, Common, Common, Common, Common, Common
};
-} // namespace QUnicodeTables
-
-Q_CORE_EXPORT int QT_FASTCALL QUnicodeTables::script(uint ucs4)
+Q_CORE_EXPORT int QT_FASTCALL script(uint ucs4)
{
if (ucs4 > 0xffff)
return Common;
@@ -9485,4 +9485,8 @@ Q_CORE_EXPORT int QT_FASTCALL QUnicodeTables::script(uint ucs4)
return script;
}
+} // namespace QUnicodeTables
+
+using namespace QUnicodeTables;
+
QT_END_NAMESPACE
diff --git a/src/corelib/tools/qunicodetables_p.h b/src/corelib/tools/qunicodetables_p.h
index d8f8340673..50afebdd9c 100644
--- a/src/corelib/tools/qunicodetables_p.h
+++ b/src/corelib/tools/qunicodetables_p.h
@@ -217,7 +217,7 @@ namespace QUnicodeTables {
};
- Q_CORE_EXPORT QUnicodeTables::LineBreakClass QT_FASTCALL lineBreakClass(uint ucs4);
+ Q_CORE_EXPORT LineBreakClass QT_FASTCALL lineBreakClass(uint ucs4);
inline int lineBreakClass(QChar ch)
{ return lineBreakClass(ch.unicode()); }