generated from sethub/template
[libxml2]Add libxml2 library
This commit is contained in:
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,66 @@
|
||||
static const char xmlEscapeContent[] = {
|
||||
8, '&', '#', 'x', 'F', 'F', 'F', 'D', ';', 4, '&', '#',
|
||||
'9', ';', 5, '&', '#', '1', '0', ';', 5, '&', '#', '1',
|
||||
'3', ';', 6, '&', 'q', 'u', 'o', 't', ';', 5, '&', 'a',
|
||||
'm', 'p', ';', 4, '&', 'l', 't', ';', 4, '&', 'g', 't',
|
||||
';',
|
||||
};
|
||||
|
||||
static const signed char xmlEscapeTab[128] = {
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, -1, -1, 0, 0, 20, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
-1, -1, -1, -1, -1, -1, 33, -1, -1, -1, -1, -1, -1, -1, -1, -1,
|
||||
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 39, -1, 44, -1,
|
||||
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
|
||||
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
|
||||
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
|
||||
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
|
||||
};
|
||||
|
||||
static const signed char xmlEscapeTabQuot[128] = {
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, -1, -1, 0, 0, 20, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
-1, -1, 26, -1, -1, -1, 33, -1, -1, -1, -1, -1, -1, -1, -1, -1,
|
||||
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 39, -1, 44, -1,
|
||||
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
|
||||
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
|
||||
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
|
||||
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
|
||||
};
|
||||
|
||||
static const signed char xmlEscapeTabAttr[128] = {
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 9, 14, 0, 0, 20, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
-1, -1, 26, -1, -1, -1, 33, -1, -1, -1, -1, -1, -1, -1, -1, -1,
|
||||
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 39, -1, 44, -1,
|
||||
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
|
||||
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
|
||||
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
|
||||
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
|
||||
};
|
||||
|
||||
#ifdef LIBXML_HTML_ENABLED
|
||||
|
||||
static const signed char htmlEscapeTab[128] = {
|
||||
0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
|
||||
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
|
||||
-1, -1, -1, -1, -1, -1, 33, -1, -1, -1, -1, -1, -1, -1, -1, -1,
|
||||
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 39, -1, 44, -1,
|
||||
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
|
||||
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
|
||||
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
|
||||
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
|
||||
};
|
||||
|
||||
static const signed char htmlEscapeTabAttr[128] = {
|
||||
0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
|
||||
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
|
||||
-1, -1, 26, -1, -1, -1, 33, -1, -1, -1, -1, -1, -1, -1, -1, -1,
|
||||
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 39, -1, 44, -1,
|
||||
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
|
||||
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
|
||||
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
|
||||
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
|
||||
};
|
||||
|
||||
#endif /* LIBXML_HTML_ENABLED */
|
||||
@@ -0,0 +1,379 @@
|
||||
#!/usr/bin/env python3
|
||||
|
||||
def printHexTable(out, width, data):
|
||||
s = ''
|
||||
|
||||
for i in range(len(data)):
|
||||
if i % 8 == 0:
|
||||
s += ' '
|
||||
else:
|
||||
s += ' '
|
||||
|
||||
s += f'0x{data[i]:{f"0{width}x"}},'
|
||||
|
||||
if i % 8 == 7:
|
||||
out.write(s + '\n')
|
||||
s = ''
|
||||
|
||||
def genTranscodeTable(out, name, chars):
|
||||
# For two-byte sequences, we look up a row with 64 entries.
|
||||
row_ids = [ 0 ] * 32
|
||||
# For three-byte sequences, we look up a plane with 64 entries,
|
||||
# indexing into rows.
|
||||
plane_ids = [ 0 ] * 16
|
||||
data = [ 0 ] * 64
|
||||
|
||||
o = 0x80
|
||||
for cp in chars:
|
||||
if cp != 0:
|
||||
if cp < 0x0800:
|
||||
# The lower five bits of the first byte in a
|
||||
# two-byte sequence are used to find the row.
|
||||
i = cp // 64
|
||||
index = row_ids[i]
|
||||
if index == 0:
|
||||
index = len(data) // 64
|
||||
data += [ 0 ] * 64
|
||||
row_ids[i] = index
|
||||
else:
|
||||
# The lower four bits of the first byte in a
|
||||
# three-byte sequence are used to find the plane.
|
||||
i = cp // (64 * 64)
|
||||
index2 = plane_ids[i]
|
||||
if index2 == 0:
|
||||
index2 = len(data) // 64
|
||||
data += [ 0 ] * 64
|
||||
plane_ids[i] = index2
|
||||
|
||||
# The lower six bits of the second byte in a
|
||||
# three-byte sequence are used to find the row.
|
||||
i = index2 * 64 + cp // 64 % 64
|
||||
index = data[i]
|
||||
if index == 0:
|
||||
index = len(data) // 64
|
||||
data += [ 0 ] * 64
|
||||
data[i] = index
|
||||
|
||||
# The lower six bits in the last byte are
|
||||
# used to lookup the codepoint.
|
||||
data[index * 64 + cp % 64] = o
|
||||
|
||||
o += 1
|
||||
|
||||
out.write('static const unsigned short ')
|
||||
out.write(f'xmlunicodetable_{name} [128] = {{\n')
|
||||
printHexTable(out, 4, chars)
|
||||
out.write('};\n\n')
|
||||
|
||||
num_chunks = len(data) // 64
|
||||
out.write('static const unsigned char ')
|
||||
out.write(f'xmltranscodetable_{name} [48 + {num_chunks} * 64] = {{\n')
|
||||
printHexTable(out, 2, row_ids)
|
||||
printHexTable(out, 2, plane_ids)
|
||||
printHexTable(out, 2, data)
|
||||
out.write('};\n\n')
|
||||
|
||||
out = open(f'codegen/charset.inc', 'w')
|
||||
|
||||
out.write('''/*
|
||||
* Lookup tables for transcoding of 8-bit character sets.
|
||||
*
|
||||
* Generated with tools/genTranscode.py.
|
||||
*/
|
||||
|
||||
''')
|
||||
|
||||
genTranscodeTable(out, 'windows_1252', [
|
||||
0x20ac, 0x0081, 0x201a, 0x0192, 0x201e, 0x2026, 0x2020, 0x2021,
|
||||
0x02c6, 0x2030, 0x0160, 0x2039, 0x0152, 0x008d, 0x017d, 0x008f,
|
||||
0x0090, 0x2018, 0x2019, 0x201c, 0x201d, 0x2022, 0x2013, 0x2014,
|
||||
0x02dc, 0x2122, 0x0161, 0x203a, 0x0153, 0x009d, 0x017e, 0x0178,
|
||||
0x00a0, 0x00a1, 0x00a2, 0x00a3, 0x00a4, 0x00a5, 0x00a6, 0x00a7,
|
||||
0x00a8, 0x00a9, 0x00aa, 0x00ab, 0x00ac, 0x00ad, 0x00ae, 0x00af,
|
||||
0x00b0, 0x00b1, 0x00b2, 0x00b3, 0x00b4, 0x00b5, 0x00b6, 0x00b7,
|
||||
0x00b8, 0x00b9, 0x00ba, 0x00bb, 0x00bc, 0x00bd, 0x00be, 0x00bf,
|
||||
0x00c0, 0x00c1, 0x00c2, 0x00c3, 0x00c4, 0x00c5, 0x00c6, 0x00c7,
|
||||
0x00c8, 0x00c9, 0x00ca, 0x00cb, 0x00cc, 0x00cd, 0x00ce, 0x00cf,
|
||||
0x00d0, 0x00d1, 0x00d2, 0x00d3, 0x00d4, 0x00d5, 0x00d6, 0x00d7,
|
||||
0x00d8, 0x00d9, 0x00da, 0x00db, 0x00dc, 0x00dd, 0x00de, 0x00df,
|
||||
0x00e0, 0x00e1, 0x00e2, 0x00e3, 0x00e4, 0x00e5, 0x00e6, 0x00e7,
|
||||
0x00e8, 0x00e9, 0x00ea, 0x00eb, 0x00ec, 0x00ed, 0x00ee, 0x00ef,
|
||||
0x00f0, 0x00f1, 0x00f2, 0x00f3, 0x00f4, 0x00f5, 0x00f6, 0x00f7,
|
||||
0x00f8, 0x00f9, 0x00fa, 0x00fb, 0x00fc, 0x00fd, 0x00fe, 0x00ff,
|
||||
])
|
||||
|
||||
out.write(r'''#if !defined(LIBXML_ICONV_ENABLED) && \
|
||||
!defined(LIBXML_ICU_ENABLED) && \
|
||||
defined(LIBXML_ISO8859X_ENABLED)
|
||||
|
||||
''')
|
||||
|
||||
genTranscodeTable(out, 'ISO8859_2', [
|
||||
0x0080, 0x0081, 0x0082, 0x0083, 0x0084, 0x0085, 0x0086, 0x0087,
|
||||
0x0088, 0x0089, 0x008a, 0x008b, 0x008c, 0x008d, 0x008e, 0x008f,
|
||||
0x0090, 0x0091, 0x0092, 0x0093, 0x0094, 0x0095, 0x0096, 0x0097,
|
||||
0x0098, 0x0099, 0x009a, 0x009b, 0x009c, 0x009d, 0x009e, 0x009f,
|
||||
0x00a0, 0x0104, 0x02d8, 0x0141, 0x00a4, 0x013d, 0x015a, 0x00a7,
|
||||
0x00a8, 0x0160, 0x015e, 0x0164, 0x0179, 0x00ad, 0x017d, 0x017b,
|
||||
0x00b0, 0x0105, 0x02db, 0x0142, 0x00b4, 0x013e, 0x015b, 0x02c7,
|
||||
0x00b8, 0x0161, 0x015f, 0x0165, 0x017a, 0x02dd, 0x017e, 0x017c,
|
||||
0x0154, 0x00c1, 0x00c2, 0x0102, 0x00c4, 0x0139, 0x0106, 0x00c7,
|
||||
0x010c, 0x00c9, 0x0118, 0x00cb, 0x011a, 0x00cd, 0x00ce, 0x010e,
|
||||
0x0110, 0x0143, 0x0147, 0x00d3, 0x00d4, 0x0150, 0x00d6, 0x00d7,
|
||||
0x0158, 0x016e, 0x00da, 0x0170, 0x00dc, 0x00dd, 0x0162, 0x00df,
|
||||
0x0155, 0x00e1, 0x00e2, 0x0103, 0x00e4, 0x013a, 0x0107, 0x00e7,
|
||||
0x010d, 0x00e9, 0x0119, 0x00eb, 0x011b, 0x00ed, 0x00ee, 0x010f,
|
||||
0x0111, 0x0144, 0x0148, 0x00f3, 0x00f4, 0x0151, 0x00f6, 0x00f7,
|
||||
0x0159, 0x016f, 0x00fa, 0x0171, 0x00fc, 0x00fd, 0x0163, 0x02d9,
|
||||
])
|
||||
|
||||
genTranscodeTable(out, 'ISO8859_3', [
|
||||
0x0080, 0x0081, 0x0082, 0x0083, 0x0084, 0x0085, 0x0086, 0x0087,
|
||||
0x0088, 0x0089, 0x008a, 0x008b, 0x008c, 0x008d, 0x008e, 0x008f,
|
||||
0x0090, 0x0091, 0x0092, 0x0093, 0x0094, 0x0095, 0x0096, 0x0097,
|
||||
0x0098, 0x0099, 0x009a, 0x009b, 0x009c, 0x009d, 0x009e, 0x009f,
|
||||
0x00a0, 0x0126, 0x02d8, 0x00a3, 0x00a4, 0x0000, 0x0124, 0x00a7,
|
||||
0x00a8, 0x0130, 0x015e, 0x011e, 0x0134, 0x00ad, 0x0000, 0x017b,
|
||||
0x00b0, 0x0127, 0x00b2, 0x00b3, 0x00b4, 0x00b5, 0x0125, 0x00b7,
|
||||
0x00b8, 0x0131, 0x015f, 0x011f, 0x0135, 0x00bd, 0x0000, 0x017c,
|
||||
0x00c0, 0x00c1, 0x00c2, 0x0000, 0x00c4, 0x010a, 0x0108, 0x00c7,
|
||||
0x00c8, 0x00c9, 0x00ca, 0x00cb, 0x00cc, 0x00cd, 0x00ce, 0x00cf,
|
||||
0x0000, 0x00d1, 0x00d2, 0x00d3, 0x00d4, 0x0120, 0x00d6, 0x00d7,
|
||||
0x011c, 0x00d9, 0x00da, 0x00db, 0x00dc, 0x016c, 0x015c, 0x00df,
|
||||
0x00e0, 0x00e1, 0x00e2, 0x0000, 0x00e4, 0x010b, 0x0109, 0x00e7,
|
||||
0x00e8, 0x00e9, 0x00ea, 0x00eb, 0x00ec, 0x00ed, 0x00ee, 0x00ef,
|
||||
0x0000, 0x00f1, 0x00f2, 0x00f3, 0x00f4, 0x0121, 0x00f6, 0x00f7,
|
||||
0x011d, 0x00f9, 0x00fa, 0x00fb, 0x00fc, 0x016d, 0x015d, 0x02d9,
|
||||
])
|
||||
|
||||
genTranscodeTable(out, 'ISO8859_4', [
|
||||
0x0080, 0x0081, 0x0082, 0x0083, 0x0084, 0x0085, 0x0086, 0x0087,
|
||||
0x0088, 0x0089, 0x008a, 0x008b, 0x008c, 0x008d, 0x008e, 0x008f,
|
||||
0x0090, 0x0091, 0x0092, 0x0093, 0x0094, 0x0095, 0x0096, 0x0097,
|
||||
0x0098, 0x0099, 0x009a, 0x009b, 0x009c, 0x009d, 0x009e, 0x009f,
|
||||
0x00a0, 0x0104, 0x0138, 0x0156, 0x00a4, 0x0128, 0x013b, 0x00a7,
|
||||
0x00a8, 0x0160, 0x0112, 0x0122, 0x0166, 0x00ad, 0x017d, 0x00af,
|
||||
0x00b0, 0x0105, 0x02db, 0x0157, 0x00b4, 0x0129, 0x013c, 0x02c7,
|
||||
0x00b8, 0x0161, 0x0113, 0x0123, 0x0167, 0x014a, 0x017e, 0x014b,
|
||||
0x0100, 0x00c1, 0x00c2, 0x00c3, 0x00c4, 0x00c5, 0x00c6, 0x012e,
|
||||
0x010c, 0x00c9, 0x0118, 0x00cb, 0x0116, 0x00cd, 0x00ce, 0x012a,
|
||||
0x0110, 0x0145, 0x014c, 0x0136, 0x00d4, 0x00d5, 0x00d6, 0x00d7,
|
||||
0x00d8, 0x0172, 0x00da, 0x00db, 0x00dc, 0x0168, 0x016a, 0x00df,
|
||||
0x0101, 0x00e1, 0x00e2, 0x00e3, 0x00e4, 0x00e5, 0x00e6, 0x012f,
|
||||
0x010d, 0x00e9, 0x0119, 0x00eb, 0x0117, 0x00ed, 0x00ee, 0x012b,
|
||||
0x0111, 0x0146, 0x014d, 0x0137, 0x00f4, 0x00f5, 0x00f6, 0x00f7,
|
||||
0x00f8, 0x0173, 0x00fa, 0x00fb, 0x00fc, 0x0169, 0x016b, 0x02d9,
|
||||
])
|
||||
|
||||
genTranscodeTable(out, 'ISO8859_5', [
|
||||
0x0080, 0x0081, 0x0082, 0x0083, 0x0084, 0x0085, 0x0086, 0x0087,
|
||||
0x0088, 0x0089, 0x008a, 0x008b, 0x008c, 0x008d, 0x008e, 0x008f,
|
||||
0x0090, 0x0091, 0x0092, 0x0093, 0x0094, 0x0095, 0x0096, 0x0097,
|
||||
0x0098, 0x0099, 0x009a, 0x009b, 0x009c, 0x009d, 0x009e, 0x009f,
|
||||
0x00a0, 0x0401, 0x0402, 0x0403, 0x0404, 0x0405, 0x0406, 0x0407,
|
||||
0x0408, 0x0409, 0x040a, 0x040b, 0x040c, 0x00ad, 0x040e, 0x040f,
|
||||
0x0410, 0x0411, 0x0412, 0x0413, 0x0414, 0x0415, 0x0416, 0x0417,
|
||||
0x0418, 0x0419, 0x041a, 0x041b, 0x041c, 0x041d, 0x041e, 0x041f,
|
||||
0x0420, 0x0421, 0x0422, 0x0423, 0x0424, 0x0425, 0x0426, 0x0427,
|
||||
0x0428, 0x0429, 0x042a, 0x042b, 0x042c, 0x042d, 0x042e, 0x042f,
|
||||
0x0430, 0x0431, 0x0432, 0x0433, 0x0434, 0x0435, 0x0436, 0x0437,
|
||||
0x0438, 0x0439, 0x043a, 0x043b, 0x043c, 0x043d, 0x043e, 0x043f,
|
||||
0x0440, 0x0441, 0x0442, 0x0443, 0x0444, 0x0445, 0x0446, 0x0447,
|
||||
0x0448, 0x0449, 0x044a, 0x044b, 0x044c, 0x044d, 0x044e, 0x044f,
|
||||
0x2116, 0x0451, 0x0452, 0x0453, 0x0454, 0x0455, 0x0456, 0x0457,
|
||||
0x0458, 0x0459, 0x045a, 0x045b, 0x045c, 0x00a7, 0x045e, 0x045f,
|
||||
])
|
||||
|
||||
genTranscodeTable(out, 'ISO8859_6', [
|
||||
0x0080, 0x0081, 0x0082, 0x0083, 0x0084, 0x0085, 0x0086, 0x0087,
|
||||
0x0088, 0x0089, 0x008a, 0x008b, 0x008c, 0x008d, 0x008e, 0x008f,
|
||||
0x0090, 0x0091, 0x0092, 0x0093, 0x0094, 0x0095, 0x0096, 0x0097,
|
||||
0x0098, 0x0099, 0x009a, 0x009b, 0x009c, 0x009d, 0x009e, 0x009f,
|
||||
0x00a0, 0x0000, 0x0000, 0x0000, 0x00a4, 0x0000, 0x0000, 0x0000,
|
||||
0x0000, 0x0000, 0x0000, 0x0000, 0x060c, 0x00ad, 0x0000, 0x0000,
|
||||
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
|
||||
0x0000, 0x0000, 0x0000, 0x061b, 0x0000, 0x0000, 0x0000, 0x061f,
|
||||
0x0000, 0x0621, 0x0622, 0x0623, 0x0624, 0x0625, 0x0626, 0x0627,
|
||||
0x0628, 0x0629, 0x062a, 0x062b, 0x062c, 0x062d, 0x062e, 0x062f,
|
||||
0x0630, 0x0631, 0x0632, 0x0633, 0x0634, 0x0635, 0x0636, 0x0637,
|
||||
0x0638, 0x0639, 0x063a, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
|
||||
0x0640, 0x0641, 0x0642, 0x0643, 0x0644, 0x0645, 0x0646, 0x0647,
|
||||
0x0648, 0x0649, 0x064a, 0x064b, 0x064c, 0x064d, 0x064e, 0x064f,
|
||||
0x0650, 0x0651, 0x0652, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
|
||||
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
|
||||
])
|
||||
|
||||
genTranscodeTable(out, 'ISO8859_7', [
|
||||
0x0080, 0x0081, 0x0082, 0x0083, 0x0084, 0x0085, 0x0086, 0x0087,
|
||||
0x0088, 0x0089, 0x008a, 0x008b, 0x008c, 0x008d, 0x008e, 0x008f,
|
||||
0x0090, 0x0091, 0x0092, 0x0093, 0x0094, 0x0095, 0x0096, 0x0097,
|
||||
0x0098, 0x0099, 0x009a, 0x009b, 0x009c, 0x009d, 0x009e, 0x009f,
|
||||
0x00a0, 0x2018, 0x2019, 0x00a3, 0x0000, 0x0000, 0x00a6, 0x00a7,
|
||||
0x00a8, 0x00a9, 0x0000, 0x00ab, 0x00ac, 0x00ad, 0x0000, 0x2015,
|
||||
0x00b0, 0x00b1, 0x00b2, 0x00b3, 0x0384, 0x0385, 0x0386, 0x00b7,
|
||||
0x0388, 0x0389, 0x038a, 0x00bb, 0x038c, 0x00bd, 0x038e, 0x038f,
|
||||
0x0390, 0x0391, 0x0392, 0x0393, 0x0394, 0x0395, 0x0396, 0x0397,
|
||||
0x0398, 0x0399, 0x039a, 0x039b, 0x039c, 0x039d, 0x039e, 0x039f,
|
||||
0x03a0, 0x03a1, 0x0000, 0x03a3, 0x03a4, 0x03a5, 0x03a6, 0x03a7,
|
||||
0x03a8, 0x03a9, 0x03aa, 0x03ab, 0x03ac, 0x03ad, 0x03ae, 0x03af,
|
||||
0x03b0, 0x03b1, 0x03b2, 0x03b3, 0x03b4, 0x03b5, 0x03b6, 0x03b7,
|
||||
0x03b8, 0x03b9, 0x03ba, 0x03bb, 0x03bc, 0x03bd, 0x03be, 0x03bf,
|
||||
0x03c0, 0x03c1, 0x03c2, 0x03c3, 0x03c4, 0x03c5, 0x03c6, 0x03c7,
|
||||
0x03c8, 0x03c9, 0x03ca, 0x03cb, 0x03cc, 0x03cd, 0x03ce, 0x0000,
|
||||
])
|
||||
|
||||
genTranscodeTable(out, 'ISO8859_8', [
|
||||
0x0080, 0x0081, 0x0082, 0x0083, 0x0084, 0x0085, 0x0086, 0x0087,
|
||||
0x0088, 0x0089, 0x008a, 0x008b, 0x008c, 0x008d, 0x008e, 0x008f,
|
||||
0x0090, 0x0091, 0x0092, 0x0093, 0x0094, 0x0095, 0x0096, 0x0097,
|
||||
0x0098, 0x0099, 0x009a, 0x009b, 0x009c, 0x009d, 0x009e, 0x009f,
|
||||
0x00a0, 0x0000, 0x00a2, 0x00a3, 0x00a4, 0x00a5, 0x00a6, 0x00a7,
|
||||
0x00a8, 0x00a9, 0x00d7, 0x00ab, 0x00ac, 0x00ad, 0x00ae, 0x00af,
|
||||
0x00b0, 0x00b1, 0x00b2, 0x00b3, 0x00b4, 0x00b5, 0x00b6, 0x00b7,
|
||||
0x00b8, 0x00b9, 0x00f7, 0x00bb, 0x00bc, 0x00bd, 0x00be, 0x0000,
|
||||
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
|
||||
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
|
||||
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
|
||||
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x2017,
|
||||
0x05d0, 0x05d1, 0x05d2, 0x05d3, 0x05d4, 0x05d5, 0x05d6, 0x05d7,
|
||||
0x05d8, 0x05d9, 0x05da, 0x05db, 0x05dc, 0x05dd, 0x05de, 0x05df,
|
||||
0x05e0, 0x05e1, 0x05e2, 0x05e3, 0x05e4, 0x05e5, 0x05e6, 0x05e7,
|
||||
0x05e8, 0x05e9, 0x05ea, 0x0000, 0x0000, 0x200e, 0x200f, 0x0000,
|
||||
])
|
||||
|
||||
genTranscodeTable(out, 'ISO8859_9', [
|
||||
0x0080, 0x0081, 0x0082, 0x0083, 0x0084, 0x0085, 0x0086, 0x0087,
|
||||
0x0088, 0x0089, 0x008a, 0x008b, 0x008c, 0x008d, 0x008e, 0x008f,
|
||||
0x0090, 0x0091, 0x0092, 0x0093, 0x0094, 0x0095, 0x0096, 0x0097,
|
||||
0x0098, 0x0099, 0x009a, 0x009b, 0x009c, 0x009d, 0x009e, 0x009f,
|
||||
0x00a0, 0x00a1, 0x00a2, 0x00a3, 0x00a4, 0x00a5, 0x00a6, 0x00a7,
|
||||
0x00a8, 0x00a9, 0x00aa, 0x00ab, 0x00ac, 0x00ad, 0x00ae, 0x00af,
|
||||
0x00b0, 0x00b1, 0x00b2, 0x00b3, 0x00b4, 0x00b5, 0x00b6, 0x00b7,
|
||||
0x00b8, 0x00b9, 0x00ba, 0x00bb, 0x00bc, 0x00bd, 0x00be, 0x00bf,
|
||||
0x00c0, 0x00c1, 0x00c2, 0x00c3, 0x00c4, 0x00c5, 0x00c6, 0x00c7,
|
||||
0x00c8, 0x00c9, 0x00ca, 0x00cb, 0x00cc, 0x00cd, 0x00ce, 0x00cf,
|
||||
0x011e, 0x00d1, 0x00d2, 0x00d3, 0x00d4, 0x00d5, 0x00d6, 0x00d7,
|
||||
0x00d8, 0x00d9, 0x00da, 0x00db, 0x00dc, 0x0130, 0x015e, 0x00df,
|
||||
0x00e0, 0x00e1, 0x00e2, 0x00e3, 0x00e4, 0x00e5, 0x00e6, 0x00e7,
|
||||
0x00e8, 0x00e9, 0x00ea, 0x00eb, 0x00ec, 0x00ed, 0x00ee, 0x00ef,
|
||||
0x011f, 0x00f1, 0x00f2, 0x00f3, 0x00f4, 0x00f5, 0x00f6, 0x00f7,
|
||||
0x00f8, 0x00f9, 0x00fa, 0x00fb, 0x00fc, 0x0131, 0x015f, 0x00ff,
|
||||
])
|
||||
|
||||
genTranscodeTable(out, 'ISO8859_10', [
|
||||
0x0080, 0x0081, 0x0082, 0x0083, 0x0084, 0x0085, 0x0086, 0x0087,
|
||||
0x0088, 0x0089, 0x008a, 0x008b, 0x008c, 0x008d, 0x008e, 0x008f,
|
||||
0x0090, 0x0091, 0x0092, 0x0093, 0x0094, 0x0095, 0x0096, 0x0097,
|
||||
0x0098, 0x0099, 0x009a, 0x009b, 0x009c, 0x009d, 0x009e, 0x009f,
|
||||
0x00a0, 0x0104, 0x0112, 0x0122, 0x012a, 0x0128, 0x0136, 0x00a7,
|
||||
0x013b, 0x0110, 0x0160, 0x0166, 0x017d, 0x00ad, 0x016a, 0x014a,
|
||||
0x00b0, 0x0105, 0x0113, 0x0123, 0x012b, 0x0129, 0x0137, 0x00b7,
|
||||
0x013c, 0x0111, 0x0161, 0x0167, 0x017e, 0x2015, 0x016b, 0x014b,
|
||||
0x0100, 0x00c1, 0x00c2, 0x00c3, 0x00c4, 0x00c5, 0x00c6, 0x012e,
|
||||
0x010c, 0x00c9, 0x0118, 0x00cb, 0x0116, 0x00cd, 0x00ce, 0x00cf,
|
||||
0x00d0, 0x0145, 0x014c, 0x00d3, 0x00d4, 0x00d5, 0x00d6, 0x0168,
|
||||
0x00d8, 0x0172, 0x00da, 0x00db, 0x00dc, 0x00dd, 0x00de, 0x00df,
|
||||
0x0101, 0x00e1, 0x00e2, 0x00e3, 0x00e4, 0x00e5, 0x00e6, 0x012f,
|
||||
0x010d, 0x00e9, 0x0119, 0x00eb, 0x0117, 0x00ed, 0x00ee, 0x00ef,
|
||||
0x00f0, 0x0146, 0x014d, 0x00f3, 0x00f4, 0x00f5, 0x00f6, 0x0169,
|
||||
0x00f8, 0x0173, 0x00fa, 0x00fb, 0x00fc, 0x00fd, 0x00fe, 0x0138,
|
||||
])
|
||||
|
||||
genTranscodeTable(out, 'ISO8859_11', [
|
||||
0x0080, 0x0081, 0x0082, 0x0083, 0x0084, 0x0085, 0x0086, 0x0087,
|
||||
0x0088, 0x0089, 0x008a, 0x008b, 0x008c, 0x008d, 0x008e, 0x008f,
|
||||
0x0090, 0x0091, 0x0092, 0x0093, 0x0094, 0x0095, 0x0096, 0x0097,
|
||||
0x0098, 0x0099, 0x009a, 0x009b, 0x009c, 0x009d, 0x009e, 0x009f,
|
||||
0x00a0, 0x0e01, 0x0e02, 0x0e03, 0x0e04, 0x0e05, 0x0e06, 0x0e07,
|
||||
0x0e08, 0x0e09, 0x0e0a, 0x0e0b, 0x0e0c, 0x0e0d, 0x0e0e, 0x0e0f,
|
||||
0x0e10, 0x0e11, 0x0e12, 0x0e13, 0x0e14, 0x0e15, 0x0e16, 0x0e17,
|
||||
0x0e18, 0x0e19, 0x0e1a, 0x0e1b, 0x0e1c, 0x0e1d, 0x0e1e, 0x0e1f,
|
||||
0x0e20, 0x0e21, 0x0e22, 0x0e23, 0x0e24, 0x0e25, 0x0e26, 0x0e27,
|
||||
0x0e28, 0x0e29, 0x0e2a, 0x0e2b, 0x0e2c, 0x0e2d, 0x0e2e, 0x0e2f,
|
||||
0x0e30, 0x0e31, 0x0e32, 0x0e33, 0x0e34, 0x0e35, 0x0e36, 0x0e37,
|
||||
0x0e38, 0x0e39, 0x0e3a, 0x0000, 0x0000, 0x0000, 0x0000, 0x0e3f,
|
||||
0x0e40, 0x0e41, 0x0e42, 0x0e43, 0x0e44, 0x0e45, 0x0e46, 0x0e47,
|
||||
0x0e48, 0x0e49, 0x0e4a, 0x0e4b, 0x0e4c, 0x0e4d, 0x0e4e, 0x0e4f,
|
||||
0x0e50, 0x0e51, 0x0e52, 0x0e53, 0x0e54, 0x0e55, 0x0e56, 0x0e57,
|
||||
0x0e58, 0x0e59, 0x0e5a, 0x0e5b, 0x0000, 0x0000, 0x0000, 0x0000,
|
||||
])
|
||||
|
||||
genTranscodeTable(out, 'ISO8859_13', [
|
||||
0x0080, 0x0081, 0x0082, 0x0083, 0x0084, 0x0085, 0x0086, 0x0087,
|
||||
0x0088, 0x0089, 0x008a, 0x008b, 0x008c, 0x008d, 0x008e, 0x008f,
|
||||
0x0090, 0x0091, 0x0092, 0x0093, 0x0094, 0x0095, 0x0096, 0x0097,
|
||||
0x0098, 0x0099, 0x009a, 0x009b, 0x009c, 0x009d, 0x009e, 0x009f,
|
||||
0x00a0, 0x201d, 0x00a2, 0x00a3, 0x00a4, 0x201e, 0x00a6, 0x00a7,
|
||||
0x00d8, 0x00a9, 0x0156, 0x00ab, 0x00ac, 0x00ad, 0x00ae, 0x00c6,
|
||||
0x00b0, 0x00b1, 0x00b2, 0x00b3, 0x201c, 0x00b5, 0x00b6, 0x00b7,
|
||||
0x00f8, 0x00b9, 0x0157, 0x00bb, 0x00bc, 0x00bd, 0x00be, 0x00e6,
|
||||
0x0104, 0x012e, 0x0100, 0x0106, 0x00c4, 0x00c5, 0x0118, 0x0112,
|
||||
0x010c, 0x00c9, 0x0179, 0x0116, 0x0122, 0x0136, 0x012a, 0x013b,
|
||||
0x0160, 0x0143, 0x0145, 0x00d3, 0x014c, 0x00d5, 0x00d6, 0x00d7,
|
||||
0x0172, 0x0141, 0x015a, 0x016a, 0x00dc, 0x017b, 0x017d, 0x00df,
|
||||
0x0105, 0x012f, 0x0101, 0x0107, 0x00e4, 0x00e5, 0x0119, 0x0113,
|
||||
0x010d, 0x00e9, 0x017a, 0x0117, 0x0123, 0x0137, 0x012b, 0x013c,
|
||||
0x0161, 0x0144, 0x0146, 0x00f3, 0x014d, 0x00f5, 0x00f6, 0x00f7,
|
||||
0x0173, 0x0142, 0x015b, 0x016b, 0x00fc, 0x017c, 0x017e, 0x2019,
|
||||
])
|
||||
|
||||
genTranscodeTable(out, 'ISO8859_14', [
|
||||
0x0080, 0x0081, 0x0082, 0x0083, 0x0084, 0x0085, 0x0086, 0x0087,
|
||||
0x0088, 0x0089, 0x008a, 0x008b, 0x008c, 0x008d, 0x008e, 0x008f,
|
||||
0x0090, 0x0091, 0x0092, 0x0093, 0x0094, 0x0095, 0x0096, 0x0097,
|
||||
0x0098, 0x0099, 0x009a, 0x009b, 0x009c, 0x009d, 0x009e, 0x009f,
|
||||
0x00a0, 0x1e02, 0x1e03, 0x00a3, 0x010a, 0x010b, 0x1e0a, 0x00a7,
|
||||
0x1e80, 0x00a9, 0x1e82, 0x1e0b, 0x1ef2, 0x00ad, 0x00ae, 0x0178,
|
||||
0x1e1e, 0x1e1f, 0x0120, 0x0121, 0x1e40, 0x1e41, 0x00b6, 0x1e56,
|
||||
0x1e81, 0x1e57, 0x1e83, 0x1e60, 0x1ef3, 0x1e84, 0x1e85, 0x1e61,
|
||||
0x00c0, 0x00c1, 0x00c2, 0x00c3, 0x00c4, 0x00c5, 0x00c6, 0x00c7,
|
||||
0x00c8, 0x00c9, 0x00ca, 0x00cb, 0x00cc, 0x00cd, 0x00ce, 0x00cf,
|
||||
0x0174, 0x00d1, 0x00d2, 0x00d3, 0x00d4, 0x00d5, 0x00d6, 0x1e6a,
|
||||
0x00d8, 0x00d9, 0x00da, 0x00db, 0x00dc, 0x00dd, 0x0176, 0x00df,
|
||||
0x00e0, 0x00e1, 0x00e2, 0x00e3, 0x00e4, 0x00e5, 0x00e6, 0x00e7,
|
||||
0x00e8, 0x00e9, 0x00ea, 0x00eb, 0x00ec, 0x00ed, 0x00ee, 0x00ef,
|
||||
0x0175, 0x00f1, 0x00f2, 0x00f3, 0x00f4, 0x00f5, 0x00f6, 0x1e6b,
|
||||
0x00f8, 0x00f9, 0x00fa, 0x00fb, 0x00fc, 0x00fd, 0x0177, 0x00ff,
|
||||
])
|
||||
|
||||
genTranscodeTable(out, 'ISO8859_15', [
|
||||
0x0080, 0x0081, 0x0082, 0x0083, 0x0084, 0x0085, 0x0086, 0x0087,
|
||||
0x0088, 0x0089, 0x008a, 0x008b, 0x008c, 0x008d, 0x008e, 0x008f,
|
||||
0x0090, 0x0091, 0x0092, 0x0093, 0x0094, 0x0095, 0x0096, 0x0097,
|
||||
0x0098, 0x0099, 0x009a, 0x009b, 0x009c, 0x009d, 0x009e, 0x009f,
|
||||
0x00a0, 0x00a1, 0x00a2, 0x00a3, 0x20ac, 0x00a5, 0x0160, 0x00a7,
|
||||
0x0161, 0x00a9, 0x00aa, 0x00ab, 0x00ac, 0x00ad, 0x00ae, 0x00af,
|
||||
0x00b0, 0x00b1, 0x00b2, 0x00b3, 0x017d, 0x00b5, 0x00b6, 0x00b7,
|
||||
0x017e, 0x00b9, 0x00ba, 0x00bb, 0x0152, 0x0153, 0x0178, 0x00bf,
|
||||
0x00c0, 0x00c1, 0x00c2, 0x00c3, 0x00c4, 0x00c5, 0x00c6, 0x00c7,
|
||||
0x00c8, 0x00c9, 0x00ca, 0x00cb, 0x00cc, 0x00cd, 0x00ce, 0x00cf,
|
||||
0x00d0, 0x00d1, 0x00d2, 0x00d3, 0x00d4, 0x00d5, 0x00d6, 0x00d7,
|
||||
0x00d8, 0x00d9, 0x00da, 0x00db, 0x00dc, 0x00dd, 0x00de, 0x00df,
|
||||
0x00e0, 0x00e1, 0x00e2, 0x00e3, 0x00e4, 0x00e5, 0x00e6, 0x00e7,
|
||||
0x00e8, 0x00e9, 0x00ea, 0x00eb, 0x00ec, 0x00ed, 0x00ee, 0x00ef,
|
||||
0x00f0, 0x00f1, 0x00f2, 0x00f3, 0x00f4, 0x00f5, 0x00f6, 0x00f7,
|
||||
0x00f8, 0x00f9, 0x00fa, 0x00fb, 0x00fc, 0x00fd, 0x00fe, 0x00ff,
|
||||
])
|
||||
|
||||
genTranscodeTable(out, 'ISO8859_16', [
|
||||
0x0080, 0x0081, 0x0082, 0x0083, 0x0084, 0x0085, 0x0086, 0x0087,
|
||||
0x0088, 0x0089, 0x008a, 0x008b, 0x008c, 0x008d, 0x008e, 0x008f,
|
||||
0x0090, 0x0091, 0x0092, 0x0093, 0x0094, 0x0095, 0x0096, 0x0097,
|
||||
0x0098, 0x0099, 0x009a, 0x009b, 0x009c, 0x009d, 0x009e, 0x009f,
|
||||
0x00a0, 0x0104, 0x0105, 0x0141, 0x20ac, 0x201e, 0x0160, 0x00a7,
|
||||
0x0161, 0x00a9, 0x0218, 0x00ab, 0x0179, 0x00ad, 0x017a, 0x017b,
|
||||
0x00b0, 0x00b1, 0x010c, 0x0142, 0x017d, 0x201d, 0x00b6, 0x00b7,
|
||||
0x017e, 0x010d, 0x0219, 0x00bb, 0x0152, 0x0153, 0x0178, 0x017c,
|
||||
0x00c0, 0x00c1, 0x00c2, 0x0102, 0x00c4, 0x0106, 0x00c6, 0x00c7,
|
||||
0x00c8, 0x00c9, 0x00ca, 0x00cb, 0x00cc, 0x00cd, 0x00ce, 0x00cf,
|
||||
0x0110, 0x0143, 0x00d2, 0x00d3, 0x00d4, 0x0150, 0x00d6, 0x015a,
|
||||
0x0170, 0x00d9, 0x00da, 0x00db, 0x00dc, 0x0118, 0x021a, 0x00df,
|
||||
0x00e0, 0x00e1, 0x00e2, 0x0103, 0x00e4, 0x0107, 0x00e6, 0x00e7,
|
||||
0x00e8, 0x00e9, 0x00ea, 0x00eb, 0x00ec, 0x00ed, 0x00ee, 0x00ef,
|
||||
0x0111, 0x0144, 0x00f2, 0x00f3, 0x00f4, 0x0151, 0x00f6, 0x015b,
|
||||
0x0171, 0x00f9, 0x00fa, 0x00fb, 0x00fc, 0x0119, 0x021b, 0x00ff,
|
||||
])
|
||||
|
||||
out.write('#endif /* LIBXML_ISO8859X_ENABLED */\n')
|
||||
|
||||
out.close()
|
||||
@@ -0,0 +1,69 @@
|
||||
#!/usr/bin/env python3
|
||||
|
||||
entities = [
|
||||
[ '', '�' ],
|
||||
[ '\t', '	' ],
|
||||
[ '\n', ' ' ],
|
||||
[ '\r', ' ' ],
|
||||
[ '"', '"' ],
|
||||
[ '&', '&' ],
|
||||
[ '<', '<' ],
|
||||
[ '>', '>' ],
|
||||
]
|
||||
|
||||
offset = [ None ] * 128
|
||||
|
||||
def gen_content(out):
|
||||
pos = 0
|
||||
r = ''
|
||||
|
||||
for rec in entities:
|
||||
char, repl = rec
|
||||
|
||||
if char:
|
||||
offset[ord(char)] = pos
|
||||
|
||||
if pos % 12 == 0: r += '\n '
|
||||
else: r += ' '
|
||||
r += '%3d,' % len(repl)
|
||||
pos += 1
|
||||
|
||||
for c in repl:
|
||||
if pos % 12 == 0: r += '\n '
|
||||
else: r += ' '
|
||||
r += "'%s'," % c
|
||||
pos += 1
|
||||
|
||||
out.write('static const char xmlEscapeContent[] = {%s\n};\n\n' % r)
|
||||
|
||||
def gen_tab(out, name, escape, is_xml):
|
||||
r = ''
|
||||
|
||||
for i in range(0x80):
|
||||
|
||||
if chr(i) in escape:
|
||||
v = offset[i]
|
||||
elif i == 0:
|
||||
v = 0
|
||||
elif is_xml and i < 32 and i != 9 and i != 10:
|
||||
v = 0
|
||||
else:
|
||||
v = -1
|
||||
|
||||
if i % 16 == 0: r += '\n '
|
||||
else: r += ' '
|
||||
r += '%2d,' % v
|
||||
|
||||
out.write('static const signed char %s[128] = {%s\n};\n\n' % (name, r))
|
||||
|
||||
with open('codegen/escape.inc', 'w') as out:
|
||||
gen_content(out)
|
||||
|
||||
gen_tab(out, 'xmlEscapeTab', '\r&<>', True)
|
||||
gen_tab(out, 'xmlEscapeTabQuot', '\r"&<>', True)
|
||||
gen_tab(out, 'xmlEscapeTabAttr', '\t\n\r"&<>', True)
|
||||
|
||||
out.write('#ifdef LIBXML_HTML_ENABLED\n\n')
|
||||
gen_tab(out, 'htmlEscapeTab', '&<>', False)
|
||||
gen_tab(out, 'htmlEscapeTabAttr', '"&<>', False)
|
||||
out.write('#endif /* LIBXML_HTML_ENABLED */\n')
|
||||
@@ -0,0 +1,170 @@
|
||||
#!/usr/bin/env python3
|
||||
|
||||
import json
|
||||
import sys
|
||||
from dataclasses import dataclass
|
||||
|
||||
# The basic idea is to find named character references using binary
|
||||
# search. Since entity strings may not have a terminator, this doesn't
|
||||
# work if one entity string is a prefix of another. In this case,
|
||||
# we branch to a subtable after matching the prefix.
|
||||
#
|
||||
# We create separate initial tables based on the first character
|
||||
# of the entity name.
|
||||
#
|
||||
# The following tables are generated:
|
||||
#
|
||||
# htmlEntAlpha: start and end of initial tables, indexing into
|
||||
# htmlEntValues
|
||||
# htmlEntValues: concatenation of all table values, which index into
|
||||
# htmlEntStrings
|
||||
# htmlEntStrings: variable sized records containing entity name,
|
||||
# replacement and optionally the position of a
|
||||
# subtable
|
||||
|
||||
try:
|
||||
with open('entities.json') as json_data:
|
||||
ents = json.load(json_data)
|
||||
except FileNotFoundError:
|
||||
print('entities.json not found, try curl -LJO',
|
||||
'https://html.spec.whatwg.org/entities.json')
|
||||
sys.exit(1)
|
||||
|
||||
def to_cchars(s):
|
||||
r = []
|
||||
|
||||
for c in s.encode():
|
||||
if c >= 0x20 and c <= 0x7E and c != ord("'") and c != ord('\\'):
|
||||
v = f"'{chr(c)}'"
|
||||
else:
|
||||
v = c
|
||||
r += [ v ]
|
||||
|
||||
return r
|
||||
|
||||
@dataclass
|
||||
class PrefixStackEntry:
|
||||
prefix: str
|
||||
table_id: int
|
||||
|
||||
@dataclass
|
||||
class AlphaFixup:
|
||||
table_id: int
|
||||
char: int
|
||||
|
||||
@dataclass
|
||||
class StringFixup:
|
||||
table_id: int
|
||||
string_index: int
|
||||
super_table_id: int
|
||||
super_offset: int
|
||||
|
||||
# Remove entity strings without trailing semicolon
|
||||
keys = (key for key in ents.keys() if key.endswith(';'))
|
||||
|
||||
# Sort entity strings
|
||||
keys = sorted(keys, key=lambda k: k[1:-1])
|
||||
|
||||
strings = []
|
||||
tables = []
|
||||
prefix_stack = []
|
||||
alpha_fixups = []
|
||||
string_fixups = []
|
||||
for i in range(64):
|
||||
tables.append([])
|
||||
|
||||
for i, key in enumerate(keys):
|
||||
name = key[1:-1]
|
||||
|
||||
next_name = None
|
||||
if i + 1 < len(keys):
|
||||
next_name = keys[i+1][1:-1]
|
||||
|
||||
while prefix_stack and not name.startswith(prefix_stack[-1].prefix):
|
||||
prefix_stack.pop()
|
||||
|
||||
# First character is initial prefix
|
||||
if not prefix_stack:
|
||||
table_id = len(tables)
|
||||
tables.append([])
|
||||
|
||||
prefix_stack.append(PrefixStackEntry(name[0], table_id))
|
||||
alpha_fixups.append(AlphaFixup(table_id, ord(name[0]) % 64))
|
||||
|
||||
string_index = len(strings)
|
||||
table = tables[prefix_stack[-1].table_id]
|
||||
table_index = len(table)
|
||||
table.append(string_index)
|
||||
|
||||
name_offset = len(prefix_stack[-1].prefix)
|
||||
name_chars = to_cchars(name[name_offset:])
|
||||
repl_chars = to_cchars(ents[key]['characters'])
|
||||
semicolon_flag = 0
|
||||
if key[:-1] in ents:
|
||||
semicolon_flag = 0x80
|
||||
|
||||
if next_name and next_name.startswith(name):
|
||||
# Create subtable
|
||||
|
||||
strings += [
|
||||
len(name_chars) | semicolon_flag | 0x40, *name_chars,
|
||||
0, 0, # subtable position, to be fixed up
|
||||
len(repl_chars), *repl_chars,
|
||||
]
|
||||
|
||||
table_id = len(tables)
|
||||
tables.append([])
|
||||
|
||||
fixup_index = string_index + 1 + len(name_chars)
|
||||
string_fixups.append(StringFixup(
|
||||
table_id, fixup_index, prefix_stack[-1].table_id, table_index,
|
||||
))
|
||||
|
||||
prefix_stack.append(PrefixStackEntry(name, table_id))
|
||||
else:
|
||||
strings += [
|
||||
len(name_chars) | semicolon_flag, *name_chars,
|
||||
len(repl_chars), *repl_chars,
|
||||
]
|
||||
|
||||
# Concat tables and record ranges
|
||||
ranges = [ 0 ]
|
||||
values = []
|
||||
for table in tables:
|
||||
values += table
|
||||
ranges.append(len(values))
|
||||
|
||||
# Create alpha table
|
||||
alpha = [ 0 ] * (59 * 3)
|
||||
for fixup in alpha_fixups:
|
||||
table_id, c = fixup.table_id, fixup.char
|
||||
start = ranges[table_id]
|
||||
end = ranges[table_id+1]
|
||||
alpha[c*3:c*3+3] = [ start & 0xFF, start >> 8, end - start ]
|
||||
|
||||
# Fix up subtable positions
|
||||
for fixup in string_fixups:
|
||||
table_id, i = fixup.table_id, fixup.string_index
|
||||
start = ranges[table_id]
|
||||
end = ranges[table_id+1]
|
||||
super_index = ranges[fixup.super_table_id] + fixup.super_offset
|
||||
strings[i:i+2] = [ start - super_index, end - start ]
|
||||
|
||||
# Print tables
|
||||
|
||||
def gen_table(ctype, cname, values, fmt, elems_per_line):
|
||||
count = len(values)
|
||||
r = ''
|
||||
|
||||
for i in range(count):
|
||||
if i != 0: r += ','
|
||||
if i % elems_per_line == 0: r += '\n '
|
||||
else: r += ' '
|
||||
r += fmt % values[i]
|
||||
|
||||
return f'static const {ctype} {cname}[{count}] = {{{r}\n}};\n\n'
|
||||
|
||||
with open('codegen/html5ent.inc', 'w') as out:
|
||||
out.write(gen_table('unsigned char', 'htmlEntAlpha', alpha, '%3d', 15))
|
||||
out.write(gen_table('unsigned short', 'htmlEntValues', values, '%5d', 10))
|
||||
out.write(gen_table('unsigned char', 'htmlEntStrings', strings, '%3s', 15))
|
||||
@@ -0,0 +1,93 @@
|
||||
#!/usr/bin/env python3
|
||||
|
||||
import glob
|
||||
import json
|
||||
import re
|
||||
|
||||
state_map = {
|
||||
'Data state': 0,
|
||||
'RCDATA state': 1,
|
||||
'RAWTEXT state': 2,
|
||||
'PLAINTEXT state': 3,
|
||||
'Script data state': 4,
|
||||
'CDATA section state': 5,
|
||||
}
|
||||
|
||||
for filename in sorted(glob.glob('../html5lib-tests/tokenizer/*.test')):
|
||||
match = re.search('/([^/]*).test$', filename)
|
||||
if match is None:
|
||||
continue
|
||||
testname = match[1]
|
||||
if testname == 'xmlViolation':
|
||||
continue
|
||||
|
||||
with open(filename) as json_data:
|
||||
root = json.load(json_data)
|
||||
|
||||
test_out = open(f'test/html-tokenizer/{testname}.test', 'w')
|
||||
result_out = open(f'result/html-tokenizer/{testname}.test', 'w')
|
||||
|
||||
counter = 0
|
||||
|
||||
for tests in root.values():
|
||||
for test in tests:
|
||||
input = test['input']
|
||||
|
||||
# Skip surrogate tests
|
||||
if re.search(r'\\uD[89A-F]', input, re.I):
|
||||
continue
|
||||
|
||||
input = re.sub(r'\\u([A-Fa-f0-9]{4})',
|
||||
lambda m: chr(int(m[1], 16)),
|
||||
input)
|
||||
|
||||
output = ''
|
||||
for token in test['output']:
|
||||
if token[1] == '\0':
|
||||
continue
|
||||
|
||||
output += token[0] + '\n'
|
||||
|
||||
if token[0] == 'DOCTYPE':
|
||||
for i in range(1, 4):
|
||||
if token[i] is None:
|
||||
output += '<none>\n'
|
||||
else:
|
||||
output += token[i] + '\n'
|
||||
else:
|
||||
output += token[1]
|
||||
if token[0] == 'StartTag':
|
||||
for name, value in token[2].items():
|
||||
output += f' {name}={value}'
|
||||
output += '\n'
|
||||
|
||||
output = re.sub(r'\\u([A-Fa-f0-9]{4})',
|
||||
lambda m: chr(int(m[1], 16)),
|
||||
output)
|
||||
|
||||
# The HTML5 spec splits handling of U+0000 across
|
||||
# tokenizer and tree builder. We already ignore
|
||||
# U+0000 in body text when tokenizing.
|
||||
output = re.sub(r'\x00', '', output)
|
||||
|
||||
for state in test.get('initialStates', ['Data state']):
|
||||
state_no = state_map.get(state)
|
||||
if state_no is None:
|
||||
raise Exception(f'{filename}: unknown state: {state}')
|
||||
if state_no == 5:
|
||||
continue
|
||||
|
||||
start_tag = test.get('lastStartTag', '-')
|
||||
|
||||
test_out.write(f'{counter} {start_tag} {state_no} '
|
||||
f'{len(input.encode())}\n')
|
||||
test_out.write(input)
|
||||
test_out.write('\n')
|
||||
|
||||
result_out.write(f'{counter}\n')
|
||||
result_out.write(output)
|
||||
|
||||
counter += 1
|
||||
|
||||
test_out.close()
|
||||
result_out.close()
|
||||
@@ -0,0 +1,222 @@
|
||||
#!/usr/bin/env python3
|
||||
#
|
||||
# Portions of this script have been (shamelessly) stolen from the
|
||||
# prior work of Daniel Veillard (genUnicode.py)
|
||||
#
|
||||
# I, however, take full credit for any bugs, errors or difficulties :-)
|
||||
#
|
||||
# William Brack
|
||||
# October 2003
|
||||
#
|
||||
# 18 October 2003
|
||||
# Modified to maintain binary compatibility with previous library versions
|
||||
# by adding a suffix 'Q' ('quick') to the macro generated for the original,
|
||||
# function, and adding generation of a function (with the original name) which
|
||||
# instantiates the macro.
|
||||
#
|
||||
|
||||
import sys
|
||||
import rangetab
|
||||
|
||||
#
|
||||
# A routine to take a list of yes/no (1, 0) values and turn it
|
||||
# into a list of ranges. This will later be used to determine whether
|
||||
# to generate single-byte lookup tables, or inline comparisons
|
||||
#
|
||||
def makeRange(lst):
|
||||
ret = []
|
||||
pos = 0
|
||||
while pos < len(lst):
|
||||
try: # index generates exception if not present
|
||||
s = lst[pos:].index(1) # look for start of next range
|
||||
except:
|
||||
break # if no more, finished
|
||||
pos += s # pointer to start of possible range
|
||||
try:
|
||||
e = lst[pos:].index(0) # look for end of range
|
||||
e += pos
|
||||
except: # if no end, set to end of list
|
||||
e = len(lst)
|
||||
ret.append((pos, e-1)) # append range tuple to list
|
||||
pos = e + 1 # ready to check for next range
|
||||
return ret
|
||||
|
||||
# minTableSize gives the minimum number of ranges which must be present
|
||||
# before a 256-byte lookup table is produced. If there are less than this
|
||||
# number, a macro with inline comparisons is generated
|
||||
minTableSize = 6
|
||||
|
||||
# dictionary of functions, key=name, element contains char-map and range-list
|
||||
Functs = {}
|
||||
|
||||
state = 0
|
||||
|
||||
try:
|
||||
defines = open("codegen/ranges.def", "r")
|
||||
except:
|
||||
print("Missing codegen/ranges.def, aborting ...")
|
||||
sys.exit(1)
|
||||
|
||||
#
|
||||
# The lines in the .def file have three types:-
|
||||
# name: Defines a new function block
|
||||
# ur: Defines individual or ranges of unicode values
|
||||
# end: Indicates the end of the function block
|
||||
#
|
||||
# These lines are processed below.
|
||||
#
|
||||
for line in defines.readlines():
|
||||
# ignore blank lines, or lines beginning with '#'
|
||||
if line[0] == '#':
|
||||
continue
|
||||
line = line.strip()
|
||||
if line == '':
|
||||
continue
|
||||
# split line into space-separated fields, then split on type
|
||||
try:
|
||||
fields = line.split(' ')
|
||||
#
|
||||
# name line:
|
||||
# validate any previous function block already ended
|
||||
# validate this function not already defined
|
||||
# initialize an entry in the function dicitonary
|
||||
# including a mask table with no values yet defined
|
||||
#
|
||||
if fields[0] == 'name':
|
||||
name = fields[1]
|
||||
if state != 0:
|
||||
print("'name' %s found before previous name" \
|
||||
"completed" % (fields[1]))
|
||||
continue
|
||||
state = 1
|
||||
if name in Functs:
|
||||
print("name '%s' already present - may give" \
|
||||
" wrong results" % (name))
|
||||
else:
|
||||
# dict entry with two list elements (chdata, rangedata)
|
||||
Functs[name] = [ [], [] ]
|
||||
for v in range(256):
|
||||
Functs[name][0].append(0)
|
||||
#
|
||||
# end line:
|
||||
# validate there was a preceding function name line
|
||||
# set state to show no current function active
|
||||
#
|
||||
elif fields[0] == 'end':
|
||||
if state == 0:
|
||||
print("'end' found outside of function block")
|
||||
continue
|
||||
state = 0
|
||||
|
||||
#
|
||||
# ur line:
|
||||
# validate function has been defined
|
||||
# process remaining fields on the line, which may be either
|
||||
# individual unicode values or ranges of values
|
||||
#
|
||||
elif fields[0] == 'ur':
|
||||
if state != 1:
|
||||
raise Exception("'ur' found outside of 'name' block")
|
||||
for el in fields[1:]:
|
||||
pos = el.find('..')
|
||||
# pos <=0 means not a range, so must be individual value
|
||||
if pos <= 0:
|
||||
# cheap handling of hex or decimal values
|
||||
if el[0:2] == '0x':
|
||||
value = int(el[2:],16)
|
||||
elif el[0] == "'":
|
||||
value = ord(el[1])
|
||||
else:
|
||||
value = int(el)
|
||||
if ((value < 0) | (value > 0x1fffff)):
|
||||
raise Exception('Illegal value (%s) in ch for'\
|
||||
' name %s' % (el,name))
|
||||
# for ur we have only ranges (makes things simpler),
|
||||
# so convert val to range
|
||||
currange = (value, value)
|
||||
# pos > 0 means this is a range, so isolate/validate
|
||||
# the interval
|
||||
else:
|
||||
# split the range into it's first-val, last-val
|
||||
(first, last) = el.split("..")
|
||||
# convert values from text into binary
|
||||
if first[0:2] == '0x':
|
||||
start = int(first[2:],16)
|
||||
elif first[0] == "'":
|
||||
start = ord(first[1])
|
||||
else:
|
||||
start = int(first)
|
||||
if last[0:2] == '0x':
|
||||
end = int(last[2:],16)
|
||||
elif last[0] == "'":
|
||||
end = ord(last[1])
|
||||
else:
|
||||
end = int(last)
|
||||
if (start < 0) | (end > 0x1fffff) | (start > end):
|
||||
raise Exception("Invalid range '%s'" % el)
|
||||
currange = (start, end)
|
||||
# common path - 'currange' has the range, now take care of it
|
||||
# We split on single-byte values vs. multibyte
|
||||
if currange[1] < 0x100: # single-byte
|
||||
for ch in range(currange[0],currange[1]+1):
|
||||
# validate that value not previously defined
|
||||
if Functs[name][0][ch]:
|
||||
msg = "Duplicate ch value '%s' for name '%s'" % (el, name)
|
||||
raise Exception(msg)
|
||||
Functs[name][0][ch] = 1
|
||||
else: # multi-byte
|
||||
if currange in Functs[name][1]:
|
||||
raise Exception("range already defined in" \
|
||||
" function")
|
||||
else:
|
||||
Functs[name][1].append(currange)
|
||||
|
||||
except:
|
||||
print("Failed to process line: %s" % (line))
|
||||
raise
|
||||
|
||||
try:
|
||||
output = open("codegen/ranges.inc", "w")
|
||||
except:
|
||||
print("Failed to open codegen/ranges.inc")
|
||||
sys.exit(1)
|
||||
|
||||
#
|
||||
# Now output the generated data.
|
||||
#
|
||||
|
||||
fkeys = sorted(Functs.keys())
|
||||
|
||||
for f in fkeys:
|
||||
|
||||
# First we convert the specified single-byte values into a group of ranges.
|
||||
if max(Functs[f][0]) > 0: # only check if at least one entry
|
||||
rangeTable = makeRange(Functs[f][0])
|
||||
numRanges = len(rangeTable)
|
||||
if numRanges >= minTableSize: # table is worthwhile
|
||||
# write the constant data to the code file
|
||||
output.write("const unsigned char %s_tab[256] = {\n" % f)
|
||||
pline = " "
|
||||
for n in range(255):
|
||||
pline += " 0x%02x," % Functs[f][0][n]
|
||||
if len(pline) > 72:
|
||||
output.write(pline + "\n")
|
||||
pline = " "
|
||||
output.write(pline + " 0x%02x };\n\n" % Functs[f][0][255])
|
||||
|
||||
#
|
||||
# Next we do the unicode ranges
|
||||
#
|
||||
|
||||
for f in fkeys:
|
||||
if len(Functs[f][1]) > 0: # only generate if unicode ranges present
|
||||
rangeTable = Functs[f][1]
|
||||
rangeTable.sort() # ascending tuple sequence
|
||||
group = rangetab.gen_range_tables(output, f, '_srng', '_lrng',
|
||||
rangeTable)
|
||||
|
||||
output.write("const xmlChRangeGroup %sGroup =\n\t%s;\n\n" %
|
||||
(f, group))
|
||||
|
||||
output.close()
|
||||
|
||||
@@ -0,0 +1,285 @@
|
||||
#!/usr/bin/env python3
|
||||
#
|
||||
# generate a test program for the API
|
||||
#
|
||||
|
||||
import xml.etree.ElementTree as etree
|
||||
import os
|
||||
import re
|
||||
import sys
|
||||
|
||||
import xmlmod
|
||||
|
||||
# Globals
|
||||
|
||||
dtors = {
|
||||
'htmlDoc *': 'xmlFreeDoc',
|
||||
'htmlParserCtxt *': 'htmlFreeParserCtxt',
|
||||
'xmlAutomata *': 'xmlFreeAutomata',
|
||||
'xmlBuffer *': 'xmlBufferFree',
|
||||
'xmlCatalog *': 'xmlFreeCatalog',
|
||||
'xmlChar *': 'xmlFree',
|
||||
'xmlDOMWrapCtxt *': 'xmlDOMWrapFreeCtxt',
|
||||
'xmlDict *': 'xmlDictFree',
|
||||
'xmlDoc *': 'xmlFreeDoc',
|
||||
'xmlDtd *': 'xmlFreeDtd',
|
||||
'xmlEntitiesTable *': 'xmlFreeEntitiesTable',
|
||||
'xmlElementContent *': 'xmlFreeElementContent',
|
||||
'xmlEnumeration *': 'xmlFreeEnumeration',
|
||||
'xmlList *': 'xmlListDelete',
|
||||
'xmlModule *': 'xmlModuleFree',
|
||||
'xmlMutex *': 'xmlFreeMutex',
|
||||
'xmlNode *': 'xmlFreeNode',
|
||||
'xmlNodeSet *': 'xmlXPathFreeNodeSet',
|
||||
'xmlNs *': 'xmlFreeNs',
|
||||
'xmlOutputBuffer *': 'xmlOutputBufferClose',
|
||||
'xmlParserCtxt *': 'xmlFreeParserCtxt',
|
||||
'xmlParserInputBuffer *': 'xmlFreeParserInputBuffer',
|
||||
'xmlParserInput *': 'xmlFreeInputStream',
|
||||
'xmlRMutex *': 'xmlFreeRMutex',
|
||||
'xmlRelaxNGValidCtxt *': 'xmlRelaxNGFreeValidCtxt',
|
||||
'xmlSaveCtxt *': 'xmlSaveClose',
|
||||
'xmlSchemaFacet *': 'xmlSchemaFreeFacet',
|
||||
'xmlSchemaVal *': 'xmlSchemaFreeValue',
|
||||
'xmlSchemaValidCtxt *': 'xmlSchemaFreeValidCtxt',
|
||||
'xmlTextWriter *': 'xmlFreeTextWriter',
|
||||
'xmlURI *': 'xmlFreeURI',
|
||||
'xmlValidCtxt *': 'xmlFreeValidCtxt',
|
||||
'xmlXPathContext *': 'xmlXPathFreeContext',
|
||||
'xmlXPathParserContext *': 'xmlXPathFreeParserContext',
|
||||
'xmlXPathObject *': 'xmlXPathFreeObject',
|
||||
}
|
||||
|
||||
blockList = {
|
||||
# init/cleanup
|
||||
'xmlCleanupParser': True,
|
||||
'xmlInitParser': True,
|
||||
|
||||
# arg must be non-NULL
|
||||
'xmlMemStrdupLoc': True,
|
||||
'xmlMemoryStrdup': True,
|
||||
|
||||
# Returns void pointer which must be freed
|
||||
'xmlMallocAtomicLoc': True,
|
||||
'xmlMallocLoc': True,
|
||||
'xmlMemMalloc': True,
|
||||
'xmlMemRealloc': True,
|
||||
'xmlReallocLoc': True,
|
||||
|
||||
# Would reset the error handler
|
||||
'xmlSetStructuredErrorFunc': True,
|
||||
|
||||
# Prints errors
|
||||
'xmlCatalogGetPublic': True,
|
||||
'xmlCatalogGetSystem': True,
|
||||
'xmlDebugDumpDTD': True,
|
||||
'xmlDebugDumpDocument': True,
|
||||
'xmlDebugDumpNode': True,
|
||||
'xmlDebugDumpString': True,
|
||||
'xmlParserError': True,
|
||||
'xmlParserWarning': True,
|
||||
'xmlParserValidityError': True,
|
||||
'xmlParserValidityWarning': True,
|
||||
|
||||
# Internal parser unctions, ctxt must be non-NULL
|
||||
'xmlParseAttribute': True,
|
||||
'xmlParseAttributeListDecl': True,
|
||||
'xmlParseAttributeType': True,
|
||||
'xmlParseCDSect': True,
|
||||
'xmlParseCharData': True,
|
||||
'xmlParseCharRef': True,
|
||||
'xmlParseComment': True,
|
||||
'xmlParseDefaultDecl': True,
|
||||
'xmlParseDocTypeDecl': True,
|
||||
'xmlParseEndTag': True,
|
||||
'xmlParseElement': True,
|
||||
'xmlParseElementChildrenContentDecl': True,
|
||||
'xmlParseElementContentDecl': True,
|
||||
'xmlParseElementDecl': True,
|
||||
'xmlParseElementMixedContentDecl': True,
|
||||
'xmlParseEncName': True,
|
||||
'xmlParseEncodingDecl': True,
|
||||
'xmlParseEntityDecl': True,
|
||||
'xmlParseEntityValue': True,
|
||||
'xmlParseEnumeratedType': True,
|
||||
'xmlParseEnumerationType': True,
|
||||
'xmlParseExternalID': True,
|
||||
'xmlParseExternalSubset': True,
|
||||
'xmlParseMarkupDecl': True,
|
||||
'xmlParseMisc': True,
|
||||
'xmlParseName': True,
|
||||
'xmlParseNmtoken': True,
|
||||
'xmlParseNotationDecl': True,
|
||||
'xmlParseNotationType': True,
|
||||
'xmlParsePEReference': True,
|
||||
'xmlParsePI': True,
|
||||
'xmlParsePITarget': True,
|
||||
'xmlParsePubidLiteral': True,
|
||||
'xmlParseReference': True,
|
||||
'xmlParseSDDecl': True,
|
||||
'xmlParseStartTag': True,
|
||||
'xmlParseSystemLiteral': True,
|
||||
'xmlParseTextDecl': True,
|
||||
'xmlParseVersionInfo': True,
|
||||
'xmlParseVersionNum': True,
|
||||
'xmlParseXMLDecl': True,
|
||||
'xmlParserHandlePEReference': True,
|
||||
'xmlSkipBlankChars': True,
|
||||
|
||||
# reads from stdin
|
||||
'htmlReadFd': True,
|
||||
'xmlReadFd': True,
|
||||
'xmlReaderForFd': True,
|
||||
}
|
||||
|
||||
# Parse document
|
||||
|
||||
if len(sys.argv) > 1:
|
||||
buildDir = sys.argv[1]
|
||||
else:
|
||||
buildDir = '.'
|
||||
|
||||
xmlDocDir = buildDir + '/doc/xml'
|
||||
|
||||
filenames = {}
|
||||
functions = {}
|
||||
|
||||
for file in os.listdir(xmlDocDir):
|
||||
if not file.endswith('_8h.xml'):
|
||||
continue
|
||||
|
||||
doc = etree.parse(xmlDocDir + '/' + file)
|
||||
|
||||
compound = doc.find('compounddef')
|
||||
module = compound.find('compoundname').text
|
||||
if not module.endswith('.h'):
|
||||
continue
|
||||
module = module[:-2]
|
||||
|
||||
for section in compound.findall('sectiondef'):
|
||||
if section.get('kind') != 'func':
|
||||
continue
|
||||
|
||||
for func in section.findall('memberdef'):
|
||||
name = func.find('name').text
|
||||
if name in blockList:
|
||||
continue
|
||||
|
||||
module1, module2 = xmlmod.findModules(module, name)
|
||||
|
||||
cargs = []
|
||||
skip = False
|
||||
for arg in func.findall('param'):
|
||||
atype = etree.tostring(arg.find('type'),
|
||||
method='text', encoding='unicode').rstrip()
|
||||
if atype == 'void':
|
||||
continue
|
||||
if atype == 'va_list':
|
||||
skip = True
|
||||
break
|
||||
if re.search(r'(Ptr|\*)$', atype):
|
||||
cargs.append('NULL')
|
||||
else:
|
||||
cargs.append('0')
|
||||
|
||||
if skip:
|
||||
continue
|
||||
|
||||
mfunc = functions.get(module1)
|
||||
if mfunc is None:
|
||||
mfunc = {}
|
||||
functions[module1] = mfunc
|
||||
|
||||
mmfunc = mfunc.get(module2)
|
||||
if mmfunc is None:
|
||||
mmfunc = {}
|
||||
mfunc[module2] = mmfunc
|
||||
|
||||
code = f'{name}({', '.join(cargs)})'
|
||||
|
||||
rtype = etree.tostring(func.find('type'),
|
||||
method='text', encoding='unicode').rstrip()
|
||||
dtor = dtors.get(rtype)
|
||||
if dtor is not None:
|
||||
code = f'{dtor}({code})'
|
||||
elif rtype == 'xmlHashTable *':
|
||||
code = f'xmlHashFree({code}, NULL)'
|
||||
|
||||
mmfunc[name] = f' {code};\n'
|
||||
|
||||
# Write output
|
||||
|
||||
test = open('testapi.c', 'w')
|
||||
|
||||
test.write("""/*
|
||||
* testapi.c: libxml2 API tester program.
|
||||
*
|
||||
* Automatically generated by gentest.py
|
||||
*
|
||||
* See Copyright for the status of this software.
|
||||
*/
|
||||
|
||||
/* Disable deprecation warnings */
|
||||
#define XML_DEPRECATED
|
||||
|
||||
#include "libxml.h"
|
||||
#include <libxml/HTMLparser.h>
|
||||
#include <libxml/HTMLtree.h>
|
||||
#include <libxml/c14n.h>
|
||||
#include <libxml/catalog.h>
|
||||
#include <libxml/debugXML.h>
|
||||
#include <libxml/parserInternals.h>
|
||||
#include <libxml/pattern.h>
|
||||
#include <libxml/relaxng.h>
|
||||
#include <libxml/schematron.h>
|
||||
#include <libxml/uri.h>
|
||||
#include <libxml/xinclude.h>
|
||||
#include <libxml/xlink.h>
|
||||
#include <libxml/xmlmodule.h>
|
||||
#include <libxml/xmlreader.h>
|
||||
#include <libxml/xmlsave.h>
|
||||
#include <libxml/xmlschemas.h>
|
||||
#include <libxml/xmlschemastypes.h>
|
||||
#include <libxml/xmlwriter.h>
|
||||
#include <libxml/xpathInternals.h>
|
||||
#include <libxml/xpointer.h>
|
||||
|
||||
static void
|
||||
ignoreError(void *userData ATTRIBUTE_UNUSED,
|
||||
const xmlError *error ATTRIBUTE_UNUSED) {
|
||||
}
|
||||
|
||||
int
|
||||
main(int argc ATTRIBUTE_UNUSED, char **argv ATTRIBUTE_UNUSED) {
|
||||
xmlInitParser();
|
||||
xmlSetStructuredErrorFunc(NULL, ignoreError);
|
||||
|
||||
""")
|
||||
|
||||
for module1 in sorted(functions.keys()):
|
||||
mfunc = functions[module1]
|
||||
|
||||
if module1 != '':
|
||||
test.write(f'#ifdef LIBXML_{module1}_ENABLED\n')
|
||||
|
||||
for module2 in sorted(mfunc.keys()):
|
||||
mmfunc = mfunc[module2]
|
||||
|
||||
if module2 != '':
|
||||
test.write(f'#ifdef LIBXML_{module2}_ENABLED\n')
|
||||
|
||||
for name in sorted(mmfunc.keys()):
|
||||
test.write(mmfunc[name])
|
||||
|
||||
if module2 != '':
|
||||
test.write(f'#endif /* LIBXML_{module2}_ENABLED */\n')
|
||||
|
||||
if module1 != '':
|
||||
test.write(f'#endif /* LIBXML_{module1}_ENABLED */\n')
|
||||
|
||||
test.write('\n')
|
||||
|
||||
test.write(""" xmlCleanupParser();
|
||||
return 0;
|
||||
}
|
||||
""")
|
||||
@@ -0,0 +1,252 @@
|
||||
#!/usr/bin/env python3
|
||||
#
|
||||
# Original script modified in November 2003 to take advantage of
|
||||
# the character-validation range routines, and updated to the
|
||||
# current Unicode information (Version 4.0.1)
|
||||
#
|
||||
# NOTE: there is an 'alias' facility for blocks which are not present in
|
||||
# the current release, but are needed for ABI compatibility. This
|
||||
# must be accomplished MANUALLY! Please see the comments below under
|
||||
# 'blockAliases'
|
||||
#
|
||||
import sys
|
||||
import string
|
||||
import rangetab
|
||||
|
||||
#
|
||||
# blockAliases is a small hack - it is used for mapping block names which
|
||||
# were were used in the 3.1 release, but are missing or changed in the current
|
||||
# release. The format is "OldBlockName:NewBlockName1[,NewBlockName2[,...]]"
|
||||
blockAliases = []
|
||||
blockAliases.append("CombiningMarksforSymbols:CombiningDiacriticalMarksforSymbols")
|
||||
blockAliases.append("Greek:GreekandCoptic")
|
||||
blockAliases.append("PrivateUse:PrivateUseArea,SupplementaryPrivateUseArea-A," +
|
||||
"SupplementaryPrivateUseArea-B")
|
||||
|
||||
# minTableSize gives the minimum number of ranges which must be present
|
||||
# before a range table is produced. If there are less than this
|
||||
# number, inline comparisons are generated
|
||||
minTableSize = 8
|
||||
|
||||
blockfile = "Blocks-4.0.1.txt"
|
||||
catfile = "UnicodeData-4.0.1.txt"
|
||||
|
||||
|
||||
#
|
||||
# Now process the "blocks" file, reducing it to a dictionary
|
||||
# indexed by blockname, containing a tuple with the applicable
|
||||
# block range
|
||||
#
|
||||
BlockNames = {}
|
||||
try:
|
||||
blocks = open(blockfile, "r")
|
||||
except:
|
||||
print("Missing %s, aborting ..." % blockfile)
|
||||
sys.exit(1)
|
||||
|
||||
for line in blocks.readlines():
|
||||
if line[0] == '#':
|
||||
continue
|
||||
line = line.strip()
|
||||
if line == '':
|
||||
continue
|
||||
try:
|
||||
fields = line.split(';')
|
||||
range = fields[0].strip()
|
||||
(start, end) = range.split("..")
|
||||
name = fields[1].strip()
|
||||
name = name.replace(' ', '')
|
||||
except:
|
||||
print("Failed to process line: %s" % (line))
|
||||
continue
|
||||
start = int(start, 16)
|
||||
end = int(end, 16)
|
||||
try:
|
||||
BlockNames[name].append((start, end))
|
||||
except:
|
||||
BlockNames[name] = [(start, end)]
|
||||
blocks.close()
|
||||
print("Parsed %d blocks descriptions" % (len(BlockNames.keys())))
|
||||
|
||||
for block in blockAliases:
|
||||
alias = block.split(':')
|
||||
alist = alias[1].split(',')
|
||||
for comp in alist:
|
||||
if comp in BlockNames:
|
||||
if alias[0] not in BlockNames:
|
||||
BlockNames[alias[0]] = []
|
||||
for r in BlockNames[comp]:
|
||||
BlockNames[alias[0]].append(r)
|
||||
else:
|
||||
print("Alias %s: %s not in Blocks" % (alias[0], comp))
|
||||
continue
|
||||
|
||||
#
|
||||
# Next process the Categories file. This is more complex, since
|
||||
# the file is in code sequence, and we need to invert it. We use
|
||||
# a dictionary with index category-name, with each entry containing
|
||||
# all the ranges (codepoints) of that category. Note that category
|
||||
# names comprise two parts - the general category, and the "subclass"
|
||||
# within that category. Therefore, both "general category" (which is
|
||||
# the first character of the 2-character category-name) and the full
|
||||
# (2-character) name are entered into this dictionary.
|
||||
#
|
||||
try:
|
||||
data = open(catfile, "r")
|
||||
except:
|
||||
print("Missing %s, aborting ..." % catfile)
|
||||
sys.exit(1)
|
||||
|
||||
nbchar = 0;
|
||||
Categories = {}
|
||||
for line in data.readlines():
|
||||
if line[0] == '#':
|
||||
continue
|
||||
line = line.strip()
|
||||
if line == '':
|
||||
continue
|
||||
try:
|
||||
fields = line.split(';')
|
||||
point = fields[0].strip()
|
||||
value = 0
|
||||
while point != '':
|
||||
value = value * 16
|
||||
if point[0] >= '0' and point[0] <= '9':
|
||||
value = value + ord(point[0]) - ord('0')
|
||||
elif point[0] >= 'A' and point[0] <= 'F':
|
||||
value = value + 10 + ord(point[0]) - ord('A')
|
||||
elif point[0] >= 'a' and point[0] <= 'f':
|
||||
value = value + 10 + ord(point[0]) - ord('a')
|
||||
point = point[1:]
|
||||
name = fields[2]
|
||||
except:
|
||||
print("Failed to process line: %s" % (line))
|
||||
continue
|
||||
|
||||
nbchar = nbchar + 1
|
||||
# update entry for "full name"
|
||||
try:
|
||||
Categories[name].append(value)
|
||||
except:
|
||||
try:
|
||||
Categories[name] = [value]
|
||||
except:
|
||||
print("Failed to process line: %s" % (line))
|
||||
# update "general category" name
|
||||
try:
|
||||
Categories[name[0]].append(value)
|
||||
except:
|
||||
try:
|
||||
Categories[name[0]] = [value]
|
||||
except:
|
||||
print("Failed to process line: %s" % (line))
|
||||
|
||||
data.close()
|
||||
print("Parsed %d char generating %d categories" % (nbchar, len(Categories.keys())))
|
||||
|
||||
#
|
||||
# The data is now all read. Time to process it into a more useful form.
|
||||
#
|
||||
# reduce the number list into ranges
|
||||
for cat in Categories.keys():
|
||||
list = Categories[cat]
|
||||
start = -1
|
||||
prev = -1
|
||||
end = -1
|
||||
ranges = []
|
||||
for val in list:
|
||||
if start == -1:
|
||||
start = val
|
||||
prev = val
|
||||
continue
|
||||
elif val == prev + 1:
|
||||
prev = val
|
||||
continue
|
||||
elif prev == start:
|
||||
ranges.append((prev, prev))
|
||||
start = val
|
||||
prev = val
|
||||
continue
|
||||
else:
|
||||
ranges.append((start, prev))
|
||||
start = val
|
||||
prev = val
|
||||
continue
|
||||
if prev == start:
|
||||
ranges.append((prev, prev))
|
||||
else:
|
||||
ranges.append((start, prev))
|
||||
Categories[cat] = ranges
|
||||
|
||||
#
|
||||
# Assure all data is in alphabetic order, since we will be doing binary
|
||||
# searches on the tables.
|
||||
#
|
||||
bkeys = sorted(BlockNames.keys())
|
||||
|
||||
ckeys = sorted(Categories.keys())
|
||||
|
||||
#
|
||||
# Generate the resulting files
|
||||
#
|
||||
try:
|
||||
output = open("codegen/unicode.inc", "w")
|
||||
except:
|
||||
print("Failed to open codegen/unicode.inc")
|
||||
sys.exit(1)
|
||||
|
||||
#
|
||||
# For any categories with more than minTableSize ranges we generate
|
||||
# a range table suitable for xmlCharInRange
|
||||
#
|
||||
for name in ckeys:
|
||||
if len(Categories[name]) <= minTableSize or name == 'Cs':
|
||||
continue
|
||||
ranges = Categories[name]
|
||||
group = rangetab.gen_range_tables(output, 'xml' + name, 'S', 'L', ranges)
|
||||
output.write("static const xmlChRangeGroup xml%sG = %s;\n\n" %
|
||||
(name, group))
|
||||
|
||||
for name in ckeys:
|
||||
if name == 'Cs':
|
||||
continue
|
||||
ranges = Categories[name]
|
||||
output.write("static int\nxmlUCSIsCat%s(int code) {\n" % name)
|
||||
if len(Categories[name]) > minTableSize:
|
||||
output.write(" return(xmlCharInRange((unsigned int)code, &xml%sG)"
|
||||
% name)
|
||||
else:
|
||||
start = 1
|
||||
for range in ranges:
|
||||
(begin, end) = range;
|
||||
if start:
|
||||
output.write(" return(");
|
||||
start = 0
|
||||
else:
|
||||
output.write(" ||\n ");
|
||||
if (begin == end):
|
||||
output.write("(code == %s)" % (hex(begin)))
|
||||
else:
|
||||
output.write("((code >= %s) && (code <= %s))" % (
|
||||
hex(begin), hex(end)))
|
||||
output.write(");\n}\n\n")
|
||||
|
||||
#
|
||||
# Range tables for blocks
|
||||
#
|
||||
|
||||
blockGroups = ''
|
||||
for block in bkeys:
|
||||
name = block.replace('-', '')
|
||||
ranges = BlockNames[block]
|
||||
group = rangetab.gen_range_tables(output, 'xml' + name, 'S', 'L', ranges)
|
||||
output.write("\n")
|
||||
if blockGroups != '':
|
||||
blockGroups += ",\n"
|
||||
blockGroups += ' {"%s",\n %s}' % (block, group)
|
||||
|
||||
output.write("static const xmlUnicodeRange xmlUnicodeBlocks[] = {\n")
|
||||
output.write(blockGroups)
|
||||
output.write("\n};\n\n")
|
||||
|
||||
output.close()
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,361 @@
|
||||
name xmlIsChar
|
||||
ur 0x9
|
||||
ur 0xA
|
||||
ur 0xD
|
||||
ur 0x20..0xFF
|
||||
ur 0x0100..0xD7FF
|
||||
ur 0xE000..0xFFFD
|
||||
ur 0x10000..0x10FFFF
|
||||
end xmlIsChar
|
||||
|
||||
name xmlIsPubidChar
|
||||
ur 0x20 0x0d 0x0a 'a'..'z' 'A'..'Z' '0'..'9'
|
||||
ur '-' 0x27 '(' ')' '+' ',' '.' '/'
|
||||
ur ':' '=' '?' ';' '!' '*' '#' '@'
|
||||
ur '$' '_' '%'
|
||||
end
|
||||
|
||||
name xmlIsBlank
|
||||
ur 0x09 0x0a 0x0d 0x20
|
||||
end xmlIsBlank
|
||||
|
||||
name xmlIsBaseChar
|
||||
ur 0x0041..0x005A
|
||||
ur 0x0061..0x007A
|
||||
ur 0x00C0..0x00D6
|
||||
ur 0x00D8..0x00F6
|
||||
ur 0x00F8..0x00FF
|
||||
ur 0x0100..0x0131
|
||||
ur 0x0134..0x013E
|
||||
ur 0x0141..0x0148
|
||||
ur 0x014A..0x017E
|
||||
ur 0x0180..0x01C3
|
||||
ur 0x01CD..0x01F0
|
||||
ur 0x01F4..0x01F5
|
||||
ur 0x01FA..0x0217
|
||||
ur 0x0250..0x02A8
|
||||
ur 0x02BB..0x02C1
|
||||
ur 0x0386
|
||||
ur 0x0388..0x038A
|
||||
ur 0x038C
|
||||
ur 0x038E..0x03A1
|
||||
ur 0x03A3..0x03CE
|
||||
ur 0x03D0..0x03D6
|
||||
ur 0x03DA
|
||||
ur 0x03DC
|
||||
ur 0x03DE
|
||||
ur 0x03E0
|
||||
ur 0x03E2..0x03F3
|
||||
ur 0x0401..0x040C
|
||||
ur 0x040E..0x044F
|
||||
ur 0x0451..0x045C
|
||||
ur 0x045E..0x0481
|
||||
ur 0x0490..0x04C4
|
||||
ur 0x04C7..0x04C8
|
||||
ur 0x04CB..0x04CC
|
||||
ur 0x04D0..0x04EB
|
||||
ur 0x04EE..0x04F5
|
||||
ur 0x04F8..0x04F9
|
||||
ur 0x0531..0x0556
|
||||
ur 0x0559
|
||||
ur 0x0561..0x0586
|
||||
ur 0x05D0..0x05EA
|
||||
ur 0x05F0..0x05F2
|
||||
ur 0x0621..0x063A
|
||||
ur 0x0641..0x064A
|
||||
ur 0x0671..0x06B7
|
||||
ur 0x06BA..0x06BE
|
||||
ur 0x06C0..0x06CE
|
||||
ur 0x06D0..0x06D3
|
||||
ur 0x06D5
|
||||
ur 0x06E5..0x06E6
|
||||
ur 0x0905..0x0939
|
||||
ur 0x093D
|
||||
ur 0x0958..0x0961
|
||||
ur 0x0985..0x098C
|
||||
ur 0x098F..0x0990
|
||||
ur 0x0993..0x09A8
|
||||
ur 0x09AA..0x09B0
|
||||
ur 0x09B2
|
||||
ur 0x09B6..0x09B9
|
||||
ur 0x09DC..0x09DD
|
||||
ur 0x09DF..0x09E1
|
||||
ur 0x09F0..0x09F1
|
||||
ur 0x0A05..0x0A0A
|
||||
ur 0x0A0F..0x0A10
|
||||
ur 0x0A13..0x0A28
|
||||
ur 0x0A2A..0x0A30
|
||||
ur 0x0A32..0x0A33
|
||||
ur 0x0A35..0x0A36
|
||||
ur 0x0A38..0x0A39
|
||||
ur 0x0A59..0x0A5C
|
||||
ur 0x0A5E
|
||||
ur 0x0A72..0x0A74
|
||||
ur 0x0A85..0x0A8B
|
||||
ur 0x0A8D
|
||||
ur 0x0A8F..0x0A91
|
||||
ur 0x0A93..0x0AA8
|
||||
ur 0x0AAA..0x0AB0
|
||||
ur 0x0AB2..0x0AB3
|
||||
ur 0x0AB5..0x0AB9
|
||||
ur 0x0ABD
|
||||
ur 0x0AE0
|
||||
ur 0x0B05..0x0B0C
|
||||
ur 0x0B0F..0x0B10
|
||||
ur 0x0B13..0x0B28
|
||||
ur 0x0B2A..0x0B30
|
||||
ur 0x0B32..0x0B33
|
||||
ur 0x0B36..0x0B39
|
||||
ur 0x0B3D
|
||||
ur 0x0B5C..0x0B5D
|
||||
ur 0x0B5F..0x0B61
|
||||
ur 0x0B85..0x0B8A
|
||||
ur 0x0B8E..0x0B90
|
||||
ur 0x0B92..0x0B95
|
||||
ur 0x0B99..0x0B9A
|
||||
ur 0x0B9C
|
||||
ur 0x0B9E..0x0B9F
|
||||
ur 0x0BA3..0x0BA4
|
||||
ur 0x0BA8..0x0BAA
|
||||
ur 0x0BAE..0x0BB5
|
||||
ur 0x0BB7..0x0BB9
|
||||
ur 0x0C05..0x0C0C
|
||||
ur 0x0C0E..0x0C10
|
||||
ur 0x0C12..0x0C28
|
||||
ur 0x0C2A..0x0C33
|
||||
ur 0x0C35..0x0C39
|
||||
ur 0x0C60..0x0C61
|
||||
ur 0x0C85..0x0C8C
|
||||
ur 0x0C8E..0x0C90
|
||||
ur 0x0C92..0x0CA8
|
||||
ur 0x0CAA..0x0CB3
|
||||
ur 0x0CB5..0x0CB9
|
||||
ur 0x0CDE
|
||||
ur 0x0CE0..0x0CE1
|
||||
ur 0x0D05..0x0D0C
|
||||
ur 0x0D0E..0x0D10
|
||||
ur 0x0D12..0x0D28
|
||||
ur 0x0D2A..0x0D39
|
||||
ur 0x0D60..0x0D61
|
||||
ur 0x0E01..0x0E2E
|
||||
ur 0x0E30
|
||||
ur 0x0E32..0x0E33
|
||||
ur 0x0E40..0x0E45
|
||||
ur 0x0E81..0x0E82
|
||||
ur 0x0E84
|
||||
ur 0x0E87..0x0E88
|
||||
ur 0x0E8A
|
||||
ur 0x0E8D
|
||||
ur 0x0E94..0x0E97
|
||||
ur 0x0E99..0x0E9F
|
||||
ur 0x0EA1..0x0EA3
|
||||
ur 0x0EA5
|
||||
ur 0x0EA7
|
||||
ur 0x0EAA..0x0EAB
|
||||
ur 0x0EAD..0x0EAE
|
||||
ur 0x0EB0
|
||||
ur 0x0EB2..0x0EB3
|
||||
ur 0x0EBD
|
||||
ur 0x0EC0..0x0EC4
|
||||
ur 0x0F40..0x0F47
|
||||
ur 0x0F49..0x0F69
|
||||
ur 0x10A0..0x10C5
|
||||
ur 0x10D0..0x10F6
|
||||
ur 0x1100
|
||||
ur 0x1102..0x1103
|
||||
ur 0x1105..0x1107
|
||||
ur 0x1109
|
||||
ur 0x110B..0x110C
|
||||
ur 0x110E..0x1112
|
||||
ur 0x113C
|
||||
ur 0x113E
|
||||
ur 0x1140
|
||||
ur 0x114C
|
||||
ur 0x114E
|
||||
ur 0x1150
|
||||
ur 0x1154..0x1155
|
||||
ur 0x1159
|
||||
ur 0x115F..0x1161
|
||||
ur 0x1163
|
||||
ur 0x1165
|
||||
ur 0x1167
|
||||
ur 0x1169
|
||||
ur 0x116D..0x116E
|
||||
ur 0x1172..0x1173
|
||||
ur 0x1175
|
||||
ur 0x119E
|
||||
ur 0x11A8
|
||||
ur 0x11AB
|
||||
ur 0x11AE..0x11AF
|
||||
ur 0x11B7..0x11B8
|
||||
ur 0x11BA
|
||||
ur 0x11BC..0x11C2
|
||||
ur 0x11EB
|
||||
ur 0x11F0
|
||||
ur 0x11F9
|
||||
ur 0x1E00..0x1E9B
|
||||
ur 0x1EA0..0x1EF9
|
||||
ur 0x1F00..0x1F15
|
||||
ur 0x1F18..0x1F1D
|
||||
ur 0x1F20..0x1F45
|
||||
ur 0x1F48..0x1F4D
|
||||
ur 0x1F50..0x1F57
|
||||
ur 0x1F59
|
||||
ur 0x1F5B
|
||||
ur 0x1F5D
|
||||
ur 0x1F5F..0x1F7D
|
||||
ur 0x1F80..0x1FB4
|
||||
ur 0x1FB6..0x1FBC
|
||||
ur 0x1FBE
|
||||
ur 0x1FC2..0x1FC4
|
||||
ur 0x1FC6..0x1FCC
|
||||
ur 0x1FD0..0x1FD3
|
||||
ur 0x1FD6..0x1FDB
|
||||
ur 0x1FE0..0x1FEC
|
||||
ur 0x1FF2..0x1FF4
|
||||
ur 0x1FF6..0x1FFC
|
||||
ur 0x2126
|
||||
ur 0x212A..0x212B
|
||||
ur 0x212E
|
||||
ur 0x2180..0x2182
|
||||
ur 0x3041..0x3094
|
||||
ur 0x30A1..0x30FA
|
||||
ur 0x3105..0x312C
|
||||
ur 0xAC00..0xD7A3
|
||||
end xmlIsBaseChar
|
||||
|
||||
name xmlIsIdeographic
|
||||
ur 0x4E00..0x9FA5
|
||||
ur 0x3007
|
||||
ur 0x3021..0x3029
|
||||
end xmlIsIdeographic
|
||||
|
||||
name xmlIsCombining
|
||||
ur 0x0300..0x0345
|
||||
ur 0x0360..0x0361
|
||||
ur 0x0483..0x0486
|
||||
ur 0x0591..0x05A1
|
||||
ur 0x05A3..0x05B9
|
||||
ur 0x05BB..0x05BD
|
||||
ur 0x05BF
|
||||
ur 0x05C1..0x05C2
|
||||
ur 0x05C4
|
||||
ur 0x064B..0x0652
|
||||
ur 0x0670
|
||||
ur 0x06D6..0x06DC
|
||||
ur 0x06DD..0x06DF
|
||||
ur 0x06E0..0x06E4
|
||||
ur 0x06E7..0x06E8
|
||||
ur 0x06EA..0x06ED
|
||||
ur 0x0901..0x0903
|
||||
ur 0x093C
|
||||
ur 0x093E..0x094C
|
||||
ur 0x094D
|
||||
ur 0x0951..0x0954
|
||||
ur 0x0962..0x0963
|
||||
ur 0x0981..0x0983
|
||||
ur 0x09BC
|
||||
ur 0x09BE
|
||||
ur 0x09BF
|
||||
ur 0x09C0..0x09C4
|
||||
ur 0x09C7..0x09C8
|
||||
ur 0x09CB..0x09CD
|
||||
ur 0x09D7
|
||||
ur 0x09E2..0x09E3
|
||||
ur 0x0A02
|
||||
ur 0x0A3C
|
||||
ur 0x0A3E
|
||||
ur 0x0A3F
|
||||
ur 0x0A40..0x0A42
|
||||
ur 0x0A47..0x0A48
|
||||
ur 0x0A4B..0x0A4D
|
||||
ur 0x0A70..0x0A71
|
||||
ur 0x0A81..0x0A83
|
||||
ur 0x0ABC
|
||||
ur 0x0ABE..0x0AC5
|
||||
ur 0x0AC7..0x0AC9
|
||||
ur 0x0ACB..0x0ACD
|
||||
ur 0x0B01..0x0B03
|
||||
ur 0x0B3C
|
||||
ur 0x0B3E..0x0B43
|
||||
ur 0x0B47..0x0B48
|
||||
ur 0x0B4B..0x0B4D
|
||||
ur 0x0B56..0x0B57
|
||||
ur 0x0B82..0x0B83
|
||||
ur 0x0BBE..0x0BC2
|
||||
ur 0x0BC6..0x0BC8
|
||||
ur 0x0BCA..0x0BCD
|
||||
ur 0x0BD7
|
||||
ur 0x0C01..0x0C03
|
||||
ur 0x0C3E..0x0C44
|
||||
ur 0x0C46..0x0C48
|
||||
ur 0x0C4A..0x0C4D
|
||||
ur 0x0C55..0x0C56
|
||||
ur 0x0C82..0x0C83
|
||||
ur 0x0CBE..0x0CC4
|
||||
ur 0x0CC6..0x0CC8
|
||||
ur 0x0CCA..0x0CCD
|
||||
ur 0x0CD5..0x0CD6
|
||||
ur 0x0D02..0x0D03
|
||||
ur 0x0D3E..0x0D43
|
||||
ur 0x0D46..0x0D48
|
||||
ur 0x0D4A..0x0D4D
|
||||
ur 0x0D57
|
||||
ur 0x0E31
|
||||
ur 0x0E34..0x0E3A
|
||||
ur 0x0E47..0x0E4E
|
||||
ur 0x0EB1
|
||||
ur 0x0EB4..0x0EB9
|
||||
ur 0x0EBB..0x0EBC
|
||||
ur 0x0EC8..0x0ECD
|
||||
ur 0x0F18..0x0F19
|
||||
ur 0x0F35
|
||||
ur 0x0F37
|
||||
ur 0x0F39
|
||||
ur 0x0F3E
|
||||
ur 0x0F3F
|
||||
ur 0x0F71..0x0F84
|
||||
ur 0x0F86..0x0F8B
|
||||
ur 0x0F90..0x0F95
|
||||
ur 0x0F97
|
||||
ur 0x0F99..0x0FAD
|
||||
ur 0x0FB1..0x0FB7
|
||||
ur 0x0FB9
|
||||
ur 0x20D0..0x20DC
|
||||
ur 0x20E1
|
||||
ur 0x302A..0x302F
|
||||
ur 0x3099
|
||||
ur 0x309A
|
||||
end xmlIsCombining
|
||||
|
||||
name xmlIsDigit
|
||||
ur 0x0030..0x0039
|
||||
ur 0x0660..0x0669
|
||||
ur 0x06F0..0x06F9
|
||||
ur 0x0966..0x096F
|
||||
ur 0x09E6..0x09EF
|
||||
ur 0x0A66..0x0A6F
|
||||
ur 0x0AE6..0x0AEF
|
||||
ur 0x0B66..0x0B6F
|
||||
ur 0x0BE7..0x0BEF
|
||||
ur 0x0C66..0x0C6F
|
||||
ur 0x0CE6..0x0CEF
|
||||
ur 0x0D66..0x0D6F
|
||||
ur 0x0E50..0x0E59
|
||||
ur 0x0ED0..0x0ED9
|
||||
ur 0x0F20..0x0F29
|
||||
end xmlIsDigit
|
||||
|
||||
name xmlIsExtender
|
||||
ur 0x00B7
|
||||
ur 0x02D0
|
||||
ur 0x02D1
|
||||
ur 0x0387
|
||||
ur 0x0640
|
||||
ur 0x0E46
|
||||
ur 0x0EC6
|
||||
ur 0x3005
|
||||
ur 0x3031..0x3035
|
||||
ur 0x309D..0x309E
|
||||
ur 0x30FC..0x30FE
|
||||
end xmlIsExtender
|
||||
@@ -0,0 +1,131 @@
|
||||
const unsigned char xmlIsPubidChar_tab[256] = {
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00,
|
||||
0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x01, 0x00, 0x01,
|
||||
0x01, 0x01, 0x00, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
|
||||
0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
|
||||
0x00, 0x01, 0x00, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
|
||||
0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
|
||||
0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x00, 0x00, 0x00, 0x00, 0x01,
|
||||
0x00, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
|
||||
0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
|
||||
0x01, 0x01, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00 };
|
||||
|
||||
static const xmlChSRange xmlIsBaseChar_srng[] = {{0x100, 0x131},
|
||||
{0x134, 0x13e}, {0x141, 0x148}, {0x14a, 0x17e}, {0x180, 0x1c3},
|
||||
{0x1cd, 0x1f0}, {0x1f4, 0x1f5}, {0x1fa, 0x217}, {0x250, 0x2a8},
|
||||
{0x2bb, 0x2c1}, {0x386, 0x386}, {0x388, 0x38a}, {0x38c, 0x38c},
|
||||
{0x38e, 0x3a1}, {0x3a3, 0x3ce}, {0x3d0, 0x3d6}, {0x3da, 0x3da},
|
||||
{0x3dc, 0x3dc}, {0x3de, 0x3de}, {0x3e0, 0x3e0}, {0x3e2, 0x3f3},
|
||||
{0x401, 0x40c}, {0x40e, 0x44f}, {0x451, 0x45c}, {0x45e, 0x481},
|
||||
{0x490, 0x4c4}, {0x4c7, 0x4c8}, {0x4cb, 0x4cc}, {0x4d0, 0x4eb},
|
||||
{0x4ee, 0x4f5}, {0x4f8, 0x4f9}, {0x531, 0x556}, {0x559, 0x559},
|
||||
{0x561, 0x586}, {0x5d0, 0x5ea}, {0x5f0, 0x5f2}, {0x621, 0x63a},
|
||||
{0x641, 0x64a}, {0x671, 0x6b7}, {0x6ba, 0x6be}, {0x6c0, 0x6ce},
|
||||
{0x6d0, 0x6d3}, {0x6d5, 0x6d5}, {0x6e5, 0x6e6}, {0x905, 0x939},
|
||||
{0x93d, 0x93d}, {0x958, 0x961}, {0x985, 0x98c}, {0x98f, 0x990},
|
||||
{0x993, 0x9a8}, {0x9aa, 0x9b0}, {0x9b2, 0x9b2}, {0x9b6, 0x9b9},
|
||||
{0x9dc, 0x9dd}, {0x9df, 0x9e1}, {0x9f0, 0x9f1}, {0xa05, 0xa0a},
|
||||
{0xa0f, 0xa10}, {0xa13, 0xa28}, {0xa2a, 0xa30}, {0xa32, 0xa33},
|
||||
{0xa35, 0xa36}, {0xa38, 0xa39}, {0xa59, 0xa5c}, {0xa5e, 0xa5e},
|
||||
{0xa72, 0xa74}, {0xa85, 0xa8b}, {0xa8d, 0xa8d}, {0xa8f, 0xa91},
|
||||
{0xa93, 0xaa8}, {0xaaa, 0xab0}, {0xab2, 0xab3}, {0xab5, 0xab9},
|
||||
{0xabd, 0xabd}, {0xae0, 0xae0}, {0xb05, 0xb0c}, {0xb0f, 0xb10},
|
||||
{0xb13, 0xb28}, {0xb2a, 0xb30}, {0xb32, 0xb33}, {0xb36, 0xb39},
|
||||
{0xb3d, 0xb3d}, {0xb5c, 0xb5d}, {0xb5f, 0xb61}, {0xb85, 0xb8a},
|
||||
{0xb8e, 0xb90}, {0xb92, 0xb95}, {0xb99, 0xb9a}, {0xb9c, 0xb9c},
|
||||
{0xb9e, 0xb9f}, {0xba3, 0xba4}, {0xba8, 0xbaa}, {0xbae, 0xbb5},
|
||||
{0xbb7, 0xbb9}, {0xc05, 0xc0c}, {0xc0e, 0xc10}, {0xc12, 0xc28},
|
||||
{0xc2a, 0xc33}, {0xc35, 0xc39}, {0xc60, 0xc61}, {0xc85, 0xc8c},
|
||||
{0xc8e, 0xc90}, {0xc92, 0xca8}, {0xcaa, 0xcb3}, {0xcb5, 0xcb9},
|
||||
{0xcde, 0xcde}, {0xce0, 0xce1}, {0xd05, 0xd0c}, {0xd0e, 0xd10},
|
||||
{0xd12, 0xd28}, {0xd2a, 0xd39}, {0xd60, 0xd61}, {0xe01, 0xe2e},
|
||||
{0xe30, 0xe30}, {0xe32, 0xe33}, {0xe40, 0xe45}, {0xe81, 0xe82},
|
||||
{0xe84, 0xe84}, {0xe87, 0xe88}, {0xe8a, 0xe8a}, {0xe8d, 0xe8d},
|
||||
{0xe94, 0xe97}, {0xe99, 0xe9f}, {0xea1, 0xea3}, {0xea5, 0xea5},
|
||||
{0xea7, 0xea7}, {0xeaa, 0xeab}, {0xead, 0xeae}, {0xeb0, 0xeb0},
|
||||
{0xeb2, 0xeb3}, {0xebd, 0xebd}, {0xec0, 0xec4}, {0xf40, 0xf47},
|
||||
{0xf49, 0xf69}, {0x10a0, 0x10c5}, {0x10d0, 0x10f6}, {0x1100, 0x1100},
|
||||
{0x1102, 0x1103}, {0x1105, 0x1107}, {0x1109, 0x1109}, {0x110b, 0x110c},
|
||||
{0x110e, 0x1112}, {0x113c, 0x113c}, {0x113e, 0x113e}, {0x1140, 0x1140},
|
||||
{0x114c, 0x114c}, {0x114e, 0x114e}, {0x1150, 0x1150}, {0x1154, 0x1155},
|
||||
{0x1159, 0x1159}, {0x115f, 0x1161}, {0x1163, 0x1163}, {0x1165, 0x1165},
|
||||
{0x1167, 0x1167}, {0x1169, 0x1169}, {0x116d, 0x116e}, {0x1172, 0x1173},
|
||||
{0x1175, 0x1175}, {0x119e, 0x119e}, {0x11a8, 0x11a8}, {0x11ab, 0x11ab},
|
||||
{0x11ae, 0x11af}, {0x11b7, 0x11b8}, {0x11ba, 0x11ba}, {0x11bc, 0x11c2},
|
||||
{0x11eb, 0x11eb}, {0x11f0, 0x11f0}, {0x11f9, 0x11f9}, {0x1e00, 0x1e9b},
|
||||
{0x1ea0, 0x1ef9}, {0x1f00, 0x1f15}, {0x1f18, 0x1f1d}, {0x1f20, 0x1f45},
|
||||
{0x1f48, 0x1f4d}, {0x1f50, 0x1f57}, {0x1f59, 0x1f59}, {0x1f5b, 0x1f5b},
|
||||
{0x1f5d, 0x1f5d}, {0x1f5f, 0x1f7d}, {0x1f80, 0x1fb4}, {0x1fb6, 0x1fbc},
|
||||
{0x1fbe, 0x1fbe}, {0x1fc2, 0x1fc4}, {0x1fc6, 0x1fcc}, {0x1fd0, 0x1fd3},
|
||||
{0x1fd6, 0x1fdb}, {0x1fe0, 0x1fec}, {0x1ff2, 0x1ff4}, {0x1ff6, 0x1ffc},
|
||||
{0x2126, 0x2126}, {0x212a, 0x212b}, {0x212e, 0x212e}, {0x2180, 0x2182},
|
||||
{0x3041, 0x3094}, {0x30a1, 0x30fa}, {0x3105, 0x312c}, {0xac00, 0xd7a3}};
|
||||
const xmlChRangeGroup xmlIsBaseCharGroup =
|
||||
{197,0,xmlIsBaseChar_srng,NULL};
|
||||
|
||||
static const xmlChSRange xmlIsChar_srng[] = {{0x100, 0xd7ff},
|
||||
{0xe000, 0xfffd}};
|
||||
static const xmlChLRange xmlIsChar_lrng[] = {{0x10000, 0x10ffff}};
|
||||
const xmlChRangeGroup xmlIsCharGroup =
|
||||
{2,1,xmlIsChar_srng,xmlIsChar_lrng};
|
||||
|
||||
static const xmlChSRange xmlIsCombining_srng[] = {{0x300, 0x345},
|
||||
{0x360, 0x361}, {0x483, 0x486}, {0x591, 0x5a1}, {0x5a3, 0x5b9},
|
||||
{0x5bb, 0x5bd}, {0x5bf, 0x5bf}, {0x5c1, 0x5c2}, {0x5c4, 0x5c4},
|
||||
{0x64b, 0x652}, {0x670, 0x670}, {0x6d6, 0x6dc}, {0x6dd, 0x6df},
|
||||
{0x6e0, 0x6e4}, {0x6e7, 0x6e8}, {0x6ea, 0x6ed}, {0x901, 0x903},
|
||||
{0x93c, 0x93c}, {0x93e, 0x94c}, {0x94d, 0x94d}, {0x951, 0x954},
|
||||
{0x962, 0x963}, {0x981, 0x983}, {0x9bc, 0x9bc}, {0x9be, 0x9be},
|
||||
{0x9bf, 0x9bf}, {0x9c0, 0x9c4}, {0x9c7, 0x9c8}, {0x9cb, 0x9cd},
|
||||
{0x9d7, 0x9d7}, {0x9e2, 0x9e3}, {0xa02, 0xa02}, {0xa3c, 0xa3c},
|
||||
{0xa3e, 0xa3e}, {0xa3f, 0xa3f}, {0xa40, 0xa42}, {0xa47, 0xa48},
|
||||
{0xa4b, 0xa4d}, {0xa70, 0xa71}, {0xa81, 0xa83}, {0xabc, 0xabc},
|
||||
{0xabe, 0xac5}, {0xac7, 0xac9}, {0xacb, 0xacd}, {0xb01, 0xb03},
|
||||
{0xb3c, 0xb3c}, {0xb3e, 0xb43}, {0xb47, 0xb48}, {0xb4b, 0xb4d},
|
||||
{0xb56, 0xb57}, {0xb82, 0xb83}, {0xbbe, 0xbc2}, {0xbc6, 0xbc8},
|
||||
{0xbca, 0xbcd}, {0xbd7, 0xbd7}, {0xc01, 0xc03}, {0xc3e, 0xc44},
|
||||
{0xc46, 0xc48}, {0xc4a, 0xc4d}, {0xc55, 0xc56}, {0xc82, 0xc83},
|
||||
{0xcbe, 0xcc4}, {0xcc6, 0xcc8}, {0xcca, 0xccd}, {0xcd5, 0xcd6},
|
||||
{0xd02, 0xd03}, {0xd3e, 0xd43}, {0xd46, 0xd48}, {0xd4a, 0xd4d},
|
||||
{0xd57, 0xd57}, {0xe31, 0xe31}, {0xe34, 0xe3a}, {0xe47, 0xe4e},
|
||||
{0xeb1, 0xeb1}, {0xeb4, 0xeb9}, {0xebb, 0xebc}, {0xec8, 0xecd},
|
||||
{0xf18, 0xf19}, {0xf35, 0xf35}, {0xf37, 0xf37}, {0xf39, 0xf39},
|
||||
{0xf3e, 0xf3e}, {0xf3f, 0xf3f}, {0xf71, 0xf84}, {0xf86, 0xf8b},
|
||||
{0xf90, 0xf95}, {0xf97, 0xf97}, {0xf99, 0xfad}, {0xfb1, 0xfb7},
|
||||
{0xfb9, 0xfb9}, {0x20d0, 0x20dc}, {0x20e1, 0x20e1}, {0x302a, 0x302f},
|
||||
{0x3099, 0x3099}, {0x309a, 0x309a}};
|
||||
const xmlChRangeGroup xmlIsCombiningGroup =
|
||||
{95,0,xmlIsCombining_srng,NULL};
|
||||
|
||||
static const xmlChSRange xmlIsDigit_srng[] = {{0x660, 0x669},
|
||||
{0x6f0, 0x6f9}, {0x966, 0x96f}, {0x9e6, 0x9ef}, {0xa66, 0xa6f},
|
||||
{0xae6, 0xaef}, {0xb66, 0xb6f}, {0xbe7, 0xbef}, {0xc66, 0xc6f},
|
||||
{0xce6, 0xcef}, {0xd66, 0xd6f}, {0xe50, 0xe59}, {0xed0, 0xed9},
|
||||
{0xf20, 0xf29}};
|
||||
const xmlChRangeGroup xmlIsDigitGroup =
|
||||
{14,0,xmlIsDigit_srng,NULL};
|
||||
|
||||
static const xmlChSRange xmlIsExtender_srng[] = {{0x2d0, 0x2d0},
|
||||
{0x2d1, 0x2d1}, {0x387, 0x387}, {0x640, 0x640}, {0xe46, 0xe46},
|
||||
{0xec6, 0xec6}, {0x3005, 0x3005}, {0x3031, 0x3035}, {0x309d, 0x309e},
|
||||
{0x30fc, 0x30fe}};
|
||||
const xmlChRangeGroup xmlIsExtenderGroup =
|
||||
{10,0,xmlIsExtender_srng,NULL};
|
||||
|
||||
static const xmlChSRange xmlIsIdeographic_srng[] = {{0x3007, 0x3007},
|
||||
{0x3021, 0x3029}, {0x4e00, 0x9fa5}};
|
||||
const xmlChRangeGroup xmlIsIdeographicGroup =
|
||||
{3,0,xmlIsIdeographic_srng,NULL};
|
||||
|
||||
@@ -0,0 +1,34 @@
|
||||
def gen_range_tables(out, name, s_suffix, l_suffix, ranges):
|
||||
numshort = 0
|
||||
numlong = 0
|
||||
sptr = "NULL"
|
||||
lptr = "NULL"
|
||||
|
||||
for range in ranges:
|
||||
(low, high) = range
|
||||
if high < 0x10000:
|
||||
if numshort == 0:
|
||||
sptr = name + s_suffix
|
||||
pline = "static const xmlChSRange %s[] = {" % sptr
|
||||
else:
|
||||
pline += ","
|
||||
numshort += 1
|
||||
else:
|
||||
if numlong == 0:
|
||||
if numshort > 0:
|
||||
out.write(pline + "};\n")
|
||||
lptr = name + l_suffix
|
||||
pline = "static const xmlChLRange %s[] = {" % lptr
|
||||
else:
|
||||
pline += ","
|
||||
numlong += 1
|
||||
if len(pline) > 60:
|
||||
out.write(pline + "\n")
|
||||
pline = " "
|
||||
elif pline[-1:] == ",":
|
||||
pline += " "
|
||||
pline += "{%s, %s}" % (hex(low), hex(high))
|
||||
|
||||
out.write(pline + "};\n")
|
||||
|
||||
return "{%s,%s,%s,%s}" % (numshort, numlong, sptr, lptr)
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,146 @@
|
||||
# Symbol to module mapping
|
||||
#
|
||||
# This relies on a few tables and some regexes.
|
||||
|
||||
import re
|
||||
|
||||
moduleMap = {
|
||||
'HTMLtree': 'HTML',
|
||||
'HTMLparser': 'HTML',
|
||||
'c14n': 'C14N',
|
||||
'catalog': 'CATALOG',
|
||||
'debugXML': 'DEBUG',
|
||||
'nanohttp': 'HTTP',
|
||||
'pattern': 'PATTERN',
|
||||
'relaxng': 'RELAXNG',
|
||||
'schemasInternals': 'SCHEMAS',
|
||||
'schematron': 'SCHEMATRON',
|
||||
'xinclude': 'XINCLUDE',
|
||||
'xlink': 'XPTR',
|
||||
'xmlautomata': 'REGEXP',
|
||||
'xmlmodule': 'MODULES',
|
||||
'xmlreader': 'READER',
|
||||
'xmlregexp': 'REGEXP',
|
||||
'xmlsave': 'OUTPUT',
|
||||
'xmlschemas': 'SCHEMAS',
|
||||
'xmlschemastypes': 'SCHEMAS',
|
||||
'xmlwriter': 'WRITER',
|
||||
'xpath': 'XPATH',
|
||||
'xpathInternals': 'XPATH',
|
||||
'xpointer': 'XPTR',
|
||||
}
|
||||
|
||||
symbolMap1 = {
|
||||
# not VALID
|
||||
'xmlValidateNCName': '',
|
||||
'xmlValidateNMToken': '',
|
||||
'xmlValidateName': '',
|
||||
'xmlValidateQName': '',
|
||||
|
||||
'htmlDefaultSAXHandlerInit': 'HTML',
|
||||
'xmlSAX2InitHtmlDefaultSAXHandler': 'HTML',
|
||||
|
||||
'xmlRegisterHTTPPostCallbacks': 'HTTP',
|
||||
|
||||
'__xmlOutputBufferCreateFilename': 'OUTPUT',
|
||||
'xmlAttrSerializeTxtContent': 'OUTPUT',
|
||||
'xmlUTF8ToIsolat1': 'OUTPUT',
|
||||
'xmlSprintfElementContent': 'OUTPUT',
|
||||
|
||||
'xmlCreatePushParserCtxt': 'PUSH',
|
||||
'xmlParseChunk': 'PUSH',
|
||||
|
||||
'xmlParseBalancedChunkMemory': 'SAX1',
|
||||
'xmlParseBalancedChunkMemoryRecover': 'SAX1',
|
||||
'xmlParseDoc': 'SAX1',
|
||||
'xmlParseEntity': 'SAX1',
|
||||
'xmlParseExternalEntity': 'SAX1',
|
||||
'xmlParseFile': 'SAX1',
|
||||
'xmlParseMemory': 'SAX1',
|
||||
'xmlSAXDefaultVersion': 'SAX1',
|
||||
'xmlSetupParserForBuffer': 'SAX1',
|
||||
|
||||
'xmlCtxtGetValidCtxt': 'VALID',
|
||||
'xmlFreeValidCtxt': 'VALID',
|
||||
'xmlNewValidCtxt': 'VALID',
|
||||
|
||||
'xmlCatalogConvert': 'SGML_CATALOG',
|
||||
'xmlConvertSGMLCatalog': 'SGML_CATALOG',
|
||||
'xmlLoadSGMLSuperCatalog': 'SGML_CATALOG',
|
||||
}
|
||||
|
||||
symbolMap2 = {
|
||||
# not OUTPUT (should be fixed in xmlIO.h)
|
||||
'xmlOutputBufferCreateFilenameDefault': '',
|
||||
|
||||
'xmlXPathDebugDumpCompExpr': 'DEBUG',
|
||||
'xmlXPathDebugDumpObject': 'DEBUG',
|
||||
'xmlSchemaDump': 'DEBUG',
|
||||
'xmlRelaxNGDump': 'DEBUG',
|
||||
|
||||
'xmlACatalogDump': 'OUTPUT',
|
||||
'xmlCatalogDump': 'OUTPUT',
|
||||
'xmlIOHTTPOpenW': 'OUTPUT',
|
||||
'xmlNanoHTTPSave': 'OUTPUT',
|
||||
'xmlRegisterHTTPPostCallbacks': 'OUTPUT',
|
||||
'xmlRelaxNGDumpTree': 'OUTPUT',
|
||||
|
||||
'xmlTextReaderPreservePattern': 'PATTERN',
|
||||
|
||||
'htmlCreatePushParserCtxt': 'PUSH',
|
||||
'htmlParseChunk': 'PUSH',
|
||||
|
||||
'xmlValidBuildContentModel': 'REGEXP',
|
||||
'xmlValidatePopElement': 'REGEXP',
|
||||
'xmlValidatePushCData': 'REGEXP',
|
||||
'xmlValidatePushElement': 'REGEXP',
|
||||
|
||||
'xmlTextReaderRelaxNGSetSchema': 'RELAXNG',
|
||||
'xmlTextReaderRelaxNGValidate': 'RELAXNG',
|
||||
'xmlTextReaderRelaxNGValidateCtxt': 'RELAXNG',
|
||||
|
||||
'xmlTextReaderSchemaValidate': 'SCHEMAS',
|
||||
'xmlTextReaderSchemaValidateCtxt': 'SCHEMAS',
|
||||
'xmlTextReaderSetSchema': 'SCHEMAS',
|
||||
|
||||
'xmlTextReaderReadInnerXml': 'WRITER',
|
||||
'xmlTextReaderReadOuterXml': 'WRITER',
|
||||
}
|
||||
|
||||
outputRegex = '|'.join((
|
||||
'^(html|xml(Buf)?)(Doc(Content|Format)?|Elem|Node)Dump',
|
||||
'^(html|xml)Save(Format)?File',
|
||||
'^xmlDump.*(Decl|Table)',
|
||||
'^xml(Alloc)?OutputBuffer',
|
||||
'^xml.*OutputCallbacks',
|
||||
))
|
||||
|
||||
def findModules(filename, symbol):
|
||||
module1 = symbolMap1.get(symbol)
|
||||
|
||||
if module1 is None:
|
||||
module1 = moduleMap.get(filename)
|
||||
|
||||
if module1 is None:
|
||||
if re.search('^xml(Ctxt)?Valid|Parse(DTD|Dtd)', symbol):
|
||||
module1 = 'VALID'
|
||||
elif re.search('^xml(Recover|SAX(User)?Parse)', symbol):
|
||||
module1 = 'SAX1'
|
||||
elif re.search('^xmlIOHTTP', symbol):
|
||||
module1 = 'HTTP'
|
||||
|
||||
module2 = symbolMap2.get(symbol)
|
||||
|
||||
if module2 is None:
|
||||
if re.search(outputRegex, symbol):
|
||||
if module1 is None:
|
||||
module1 = 'OUTPUT'
|
||||
else:
|
||||
module2 = 'OUTPUT'
|
||||
|
||||
if module1 is None:
|
||||
module1 = ''
|
||||
if module2 is None:
|
||||
module2 = ''
|
||||
|
||||
return module1, module2
|
||||
Reference in New Issue
Block a user