X-Git-Url: https://pd.if.org/git/?a=blobdiff_plain;f=functions%2Flocale%2FUnicodeData.py;h=42a8f9f3bad916923fe1013ad8afd3ade0863164;hb=3682010e5b8bcd48fd82f3e604829f045c7ada29;hp=b9057c22fdbc0cfea47424defafbb6326185973a;hpb=efab59138e688d20f8bb7cf6526c3474d617ebe5;p=pdclib diff --git a/functions/locale/UnicodeData.py b/functions/locale/UnicodeData.py index b9057c2..42a8f9f 100644 --- a/functions/locale/UnicodeData.py +++ b/functions/locale/UnicodeData.py @@ -7,6 +7,12 @@ """ Converts the character information provdied by Unicode in the UnicodeData.txt file from the Unicode character database into a table for use by PDCLib. + +Usage: Download the UnicodeData.txt file to the same directory as this script +and then run it. Both Python 2 and 3 are supported. + +Download the data from + ftp://ftp.unicode.org/Public/UNIDATA/UnicodeData.txt """ import os @@ -63,9 +69,10 @@ try: * in Exhibit 1 of the Unicode Terms of Use, found at * http://www.unicode.org/copyright.html#Exhibit1 */ + #ifndef REGTEST #include <_PDCLIB_locale.h> - _PDCLIB_wctype_t _PDCLIB_wctype[] = { + _PDCLIB_wcinfo_t _PDCLIB_wcinfo[] = { // { value,\tflags,\tlower,\tupper\t}, // name """) for line in in_file: @@ -84,7 +91,19 @@ try: out_file.write(" { 0x%X,\t0x%X,\t0x%X,\t0x%X }, // %s\n" % ( num, bits, lower_case, upper_case, name)) out_file.write('};\n\n') - out_file.write('size_t _PDCLIB_wctype_size = sizeof(_PDCLIB_wctype) / sizeof(_PDCLIB_wctype[0]);\n\n') + out_file.write(""" +size_t _PDCLIB_wcinfo_size = sizeof(_PDCLIB_wcinfo) / sizeof(_PDCLIB_wcinfo[0]); +#endif + +#ifdef TEST +#include <_PDCLIB_test.h> +int main( void ) +{ + return TEST_RESULTS; +} +#endif + +""") except: in_file.close() out_file.close()