summaryrefslogtreecommitdiffstats
path: root/Modules/unicodedatabase.c
diff options
context:
space:
mode:
Diffstat (limited to 'Modules/unicodedatabase.c')
-rw-r--r--Modules/unicodedatabase.c20
1 files changed, 18 insertions, 2 deletions
diff --git a/Modules/unicodedatabase.c b/Modules/unicodedatabase.c
index f2f753c..80a36cb 100644
--- a/Modules/unicodedatabase.c
+++ b/Modules/unicodedatabase.c
@@ -4,9 +4,10 @@
Data was extracted from the Unicode 3.0 UnicodeData.txt file.
-Written by Marc-Andre Lemburg (mal@lemburg.com).
+ Written by Marc-Andre Lemburg (mal@lemburg.com).
+ Rewritten for Python 2.0 by Fredrik Lundh (fredrik@pythonware.com)
-Copyright (c) Corporation for National Research Initiatives.
+ Copyright (c) Corporation for National Research Initiatives.
------------------------------------------------------------------------ */
@@ -29,3 +30,18 @@ _PyUnicode_Database_GetRecord(int code)
}
return &_PyUnicode_Database_Records[index];
}
+
+const char *
+_PyUnicode_Database_GetDecomposition(int code)
+{
+ int index;
+
+ if (code < 0 || code >= 65536)
+ index = 0;
+ else {
+ index = decomp_index1[(code>>DECOMP_SHIFT)];
+ index = decomp_index2[(index<<DECOMP_SHIFT)+
+ (code&((1<<DECOMP_SHIFT)-1))];
+ }
+ return decomp_data[index];
+}