Commit 05e9db80 authored by Daniel Veillard's avatar Daniel Veillard

applied patches from Aivars Kalvans to make unicode tables const, fixes

* chvalid.c genChRanges.py genUnicode.py xmlunicode.c
  include/libxml/chvalid.h include/libxml/xmlunicode.h: applied
  patches from Aivars Kalvans to make unicode tables const, fixes
  bug #336096, this also updates to Unicode 4.01 final with a couple
  of character ranges fixes.
Daniel
parent 8ea29c48
Mon Mar 27 11:23:39 CEST 2006 Daniel Veillard <daniel@veillard.com>
* chvalid.c genChRanges.py genUnicode.py xmlunicode.c
include/libxml/chvalid.h include/libxml/xmlunicode.h: applied
patches from Aivars Kalvans to make unicode tables const, fixes
bug #336096, this also updates to Unicode 4.01 final with a couple
of character ranges fixes.
Mon Mar 27 00:51:40 CEST 2006 Daniel Veillard <daniel@veillard.com>
* chvalid.c genChRanges.py include/libxml/chvalid.h: fixed bug
......
This diff is collapsed.
......@@ -252,15 +252,15 @@ typedef xmlChRangeGroup *xmlChRangeGroupPtr;
struct _xmlChRangeGroup {
int nbShortRange;
int nbLongRange;
xmlChSRangePtr shortRange; /* points to an array of ranges */
xmlChLRangePtr longRange;
const xmlChSRange *shortRange; /* points to an array of ranges */
const xmlChLRange *longRange;
};
/**
* Range checking routine
*/
XMLPUBFUN int XMLCALL
xmlCharInRange(unsigned int val, const xmlChRangeGroupPtr group);
xmlCharInRange(unsigned int val, const xmlChRangeGroup *group);
""" % (date, sources));
output.write(
......@@ -424,7 +424,7 @@ for f in fkeys:
if len(Functs[f][1]) > 0:
header.write("XMLPUBVAR xmlChRangeGroup %sGroup;\n" % f)
header.write("XMLPUBVAR const xmlChRangeGroup %sGroup;\n" % f)
#
......@@ -440,7 +440,7 @@ for f in fkeys:
for rg in rangeTable:
if rg[1] < 0x10000: # if short value
if numShort == 0: # first occurence
pline = "static xmlChSRange %s_srng[] = { " % f
pline = "static const xmlChSRange %s_srng[] = { " % f
else:
pline += ", "
numShort += 1
......@@ -452,7 +452,7 @@ for f in fkeys:
if numLong == 0: # first occurence
if numShort > 0: # if there were shorts, finish them off
output.write(pline + "};\n")
pline = "static xmlChLRange %s_lrng[] = { " % f
pline = "static const xmlChLRange %s_lrng[] = { " % f
else:
pline += ", "
numLong += 1
......@@ -462,7 +462,7 @@ for f in fkeys:
pline += "{0x%x, 0x%x}" % (rg[0], rg[1])
output.write(pline + "};\n") # finish off last group
pline = "xmlChRangeGroup %sGroup =\n\t{%d, %d, " % (f, numShort, numLong)
pline = "const xmlChRangeGroup %sGroup =\n\t{%d, %d, " % (f, numShort, numLong)
if numShort > 0:
pline += "%s_srng" % f
else:
......@@ -487,10 +487,10 @@ output.write(
* Returns: true if character valid, false otherwise
*/
int
xmlCharInRange (unsigned int val, const xmlChRangeGroupPtr rptr) {
xmlCharInRange (unsigned int val, const xmlChRangeGroup *rptr) {
int low, high, mid;
xmlChSRangePtr sptr;
xmlChLRangePtr lptr;
const xmlChSRange *sptr;
const xmlChLRange *lptr;
if (rptr == NULL) return(0);
if (val < 0x10000) { /* is val in 'short' or 'long' array? */
......
......@@ -13,8 +13,8 @@ import sys
import string
import time
webpage = "http://www.unicode.org/Public/4.0-Update1/UCD-4.0.1d5b.html"
sources = "Blocks-4.0.1d1b.txt UnicodeData-4.0.1d1b.txt"
webpage = "http://www.unicode.org/Public/4.0-Update1/UCD-4.0.1.html"
sources = "Blocks-4.0.1.txt UnicodeData-4.0.1.txt"
#
# blockAliases is a small hack - it is used for mapping block names which
......@@ -227,6 +227,8 @@ header.write(
#include <libxml/xmlversion.h>
#ifdef LIBXML_UNICODE_ENABLED
#ifdef __cplusplus
extern "C" {
#endif
......@@ -310,7 +312,7 @@ for name in ckeys:
(low, high) = range
if high < 0x10000:
if numshort == 0:
pline = "static xmlChSRange xml%sS[] = {" % name
pline = "static const xmlChSRange xml%sS[] = {" % name
sptr = "xml%sS" % name
else:
pline += ", "
......@@ -319,7 +321,7 @@ for name in ckeys:
if numlong == 0:
if numshort > 0:
output.write(pline + " };\n")
pline = "static xmlChLRange xml%sL[] = {" % name
pline = "static const xmlChLRange xml%sL[] = {" % name
lptr = "xml%sL" % name
else:
pline += ", "
......@@ -333,8 +335,8 @@ for name in ckeys:
output.write(
"""xmlUnicodeNameTable xmlUnicodeBlockTbl = {xmlUnicodeBlocks, %s};
xmlUnicodeNameTable xmlUnicodeCatTbl = {xmlUnicodeCats, %s};
"""static xmlUnicodeNameTable xmlUnicodeBlockTbl = {xmlUnicodeBlocks, %s};
static xmlUnicodeNameTable xmlUnicodeCatTbl = {xmlUnicodeCats, %s};
/**
* xmlUnicodeLookup:
......@@ -350,6 +352,8 @@ static xmlIntFunc
int low, high, mid, cmp;
xmlUnicodeRange *sptr;
if ((tptr == NULL) || (tname == NULL)) return(NULL);
low = 0;
high = tptr->numentries - 1;
sptr = tptr->table;
......@@ -455,7 +459,8 @@ xmlUCSIsCat(int code, const char *cat) {
return (func(code));
}
#define bottom_xmlunicode
#include "elfgcchack.h"
#endif /* LIBXML_UNICODE_ENABLED */
""")
......@@ -463,6 +468,9 @@ header.write("""
#ifdef __cplusplus
}
#endif
#endif /* LIBXML_UNICODE_ENABLED */
#endif /* __XML_UNICODE_H__ */
""");
......
......@@ -6,7 +6,7 @@
* This file is automatically generated from the cvs source
* definition files using the genChRanges.py Python script
*
* Generation date: Mon Mar 27 00:45:29 2006
* Generation date: Mon Mar 27 11:09:48 2006
* Sources: chvalid.def
* Author: William Brack <wbrack@mmm.com.hk>
*/
......@@ -44,15 +44,15 @@ typedef xmlChRangeGroup *xmlChRangeGroupPtr;
struct _xmlChRangeGroup {
int nbShortRange;
int nbLongRange;
xmlChSRangePtr shortRange; /* points to an array of ranges */
xmlChLRangePtr longRange;
const xmlChSRange *shortRange; /* points to an array of ranges */
const xmlChLRange *longRange;
};
/**
* Range checking routine
*/
XMLPUBFUN int XMLCALL
xmlCharInRange(unsigned int val, const xmlChRangeGroupPtr group);
xmlCharInRange(unsigned int val, const xmlChRangeGroup *group);
/**
......@@ -77,7 +77,7 @@ XMLPUBFUN int XMLCALL
xmlIsBaseChar_ch((c)) : \
xmlCharInRange((c), &xmlIsBaseCharGroup))
XMLPUBVAR xmlChRangeGroup xmlIsBaseCharGroup;
XMLPUBVAR const xmlChRangeGroup xmlIsBaseCharGroup;
/**
* xmlIsBlank_ch:
......@@ -121,7 +121,7 @@ XMLPUBVAR xmlChRangeGroup xmlIsBaseCharGroup;
((0xe000 <= (c)) && ((c) <= 0xfffd)) || \
((0x10000 <= (c)) && ((c) <= 0x10ffff))))
XMLPUBVAR xmlChRangeGroup xmlIsCharGroup;
XMLPUBVAR const xmlChRangeGroup xmlIsCharGroup;
/**
* xmlIsCombiningQ:
......@@ -133,7 +133,7 @@ XMLPUBVAR xmlChRangeGroup xmlIsCharGroup;
0 : \
xmlCharInRange((c), &xmlIsCombiningGroup))
XMLPUBVAR xmlChRangeGroup xmlIsCombiningGroup;
XMLPUBVAR const xmlChRangeGroup xmlIsCombiningGroup;
/**
* xmlIsDigit_ch:
......@@ -153,7 +153,7 @@ XMLPUBVAR xmlChRangeGroup xmlIsCombiningGroup;
xmlIsDigit_ch((c)) : \
xmlCharInRange((c), &xmlIsDigitGroup))
XMLPUBVAR xmlChRangeGroup xmlIsDigitGroup;
XMLPUBVAR const xmlChRangeGroup xmlIsDigitGroup;
/**
* xmlIsExtender_ch:
......@@ -173,7 +173,7 @@ XMLPUBVAR xmlChRangeGroup xmlIsDigitGroup;
xmlIsExtender_ch((c)) : \
xmlCharInRange((c), &xmlIsExtenderGroup))
XMLPUBVAR xmlChRangeGroup xmlIsExtenderGroup;
XMLPUBVAR const xmlChRangeGroup xmlIsExtenderGroup;
/**
* xmlIsIdeographicQ:
......@@ -187,7 +187,7 @@ XMLPUBVAR xmlChRangeGroup xmlIsExtenderGroup;
((c) == 0x3007) || \
((0x3021 <= (c)) && ((c) <= 0x3029))))
XMLPUBVAR xmlChRangeGroup xmlIsIdeographicGroup;
XMLPUBVAR const xmlChRangeGroup xmlIsIdeographicGroup;
XMLPUBVAR const unsigned char xmlIsPubidChar_tab[256];
/**
......
......@@ -4,11 +4,11 @@
*
* This file is automatically generated from the
* UCS description files of the Unicode Character Database
* http://www.unicode.org/Public/4.0-Update1/UCD-4.0.1d5b.html
* http://www.unicode.org/Public/4.0-Update1/UCD-4.0.1.html
* using the genUnicode.py Python script.
*
* Generation date: Mon Nov 10 22:35:10 2003
* Sources: Blocks-4.0.1d1b.txt UnicodeData-4.0.1d1b.txt
* Generation date: Mon Mar 27 11:09:52 2006
* Sources: Blocks-4.0.1.txt UnicodeData-4.0.1.txt
* Author: Daniel Veillard
*/
......
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment