fixed a bug in the range search; enhanced range generation (inline code if
* genChRanges.py, chvalid.c, include/libxml/chvalid.h: fixed
a bug in the range search; enhanced range generation (inline code
if a small number of intervals); enhanced the readability of the
output files.
diff --git a/chvalid.c b/chvalid.c
index 830c727..212d052 100755
--- a/chvalid.c
+++ b/chvalid.c
@@ -5,7 +5,7 @@
* This file is automatically generated from the cvs source
* definition files using the genChRanges.py Python script
*
- * Generation date: Sat Oct 11 23:50:20 2003
+ * Generation date: Sun Oct 12 18:17:45 2003
* Sources: chvalid.def
* William Brack <wbrack@mmm.com.hk>
*/
@@ -94,11 +94,13 @@
{0x1fe0, 0x1fec}, {0x1ff2, 0x1ff4}, {0x1ff6, 0x1ffc}, {0x2126, 0x2126},
{0x212a, 0x212b}, {0x212e, 0x212e}, {0x2180, 0x2182}, {0x3041, 0x3094},
{0x30a1, 0x30fa}, {0x3105, 0x312c}, {0xac00, 0xd7a3}};
-xmlChRangeGroup xmlIsBaseCharGroup = {197, 0, xmlIsBaseChar_srng};
+xmlChRangeGroup xmlIsBaseCharGroup =
+ {197, 0, xmlIsBaseChar_srng, (xmlChLRangePtr)0};
static xmlChSRange xmlIsChar_srng[] = { {0x100, 0xd7ff}, {0xe000, 0xfffd}};
static xmlChLRange xmlIsChar_lrng[] = { {0x10000, 0x10ffff}};
-xmlChRangeGroup xmlIsCharGroup = {2, 1, xmlIsChar_srng, xmlIsChar_lrng};
+xmlChRangeGroup xmlIsCharGroup =
+ {2, 1, xmlIsChar_srng, xmlIsChar_lrng};
static xmlChSRange xmlIsCombining_srng[] = { {0x300, 0x345},
{0x360, 0x361}, {0x483, 0x486}, {0x591, 0x5a1}, {0x5a3, 0x5b9},
@@ -125,22 +127,26 @@
{0xf90, 0xf95}, {0xf97, 0xf97}, {0xf99, 0xfad}, {0xfb1, 0xfb7},
{0xfb9, 0xfb9}, {0x20d0, 0x20dc}, {0x20e1, 0x20e1}, {0x302a, 0x302f},
{0x3099, 0x3099}, {0x309a, 0x309a}};
-xmlChRangeGroup xmlIsCombiningGroup = {95, 0, xmlIsCombining_srng};
+xmlChRangeGroup xmlIsCombiningGroup =
+ {95, 0, xmlIsCombining_srng, (xmlChLRangePtr)0};
static 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}};
-xmlChRangeGroup xmlIsDigitGroup = {14, 0, xmlIsDigit_srng};
+xmlChRangeGroup xmlIsDigitGroup =
+ {14, 0, xmlIsDigit_srng, (xmlChLRangePtr)0};
static xmlChSRange xmlIsExtender_srng[] = { {0x2d0, 0x2d0}, {0x2d1, 0x2d1},
{0x387, 0x387}, {0x640, 0x640}, {0xe46, 0xe46}, {0xec6, 0xec6},
{0x3005, 0x3005}, {0x3031, 0x3035}, {0x309d, 0x309e}, {0x30fc, 0x30fe}};
-xmlChRangeGroup xmlIsExtenderGroup = {10, 0, xmlIsExtender_srng};
+xmlChRangeGroup xmlIsExtenderGroup =
+ {10, 0, xmlIsExtender_srng, (xmlChLRangePtr)0};
static xmlChSRange xmlIsIdeographic_srng[] = { {0x3007, 0x3007},
{0x3021, 0x3029}, {0x4e00, 0x9fa5}};
-xmlChRangeGroup xmlIsIdeographicGroup = {3, 0, xmlIsIdeographic_srng};
+xmlChRangeGroup xmlIsIdeographicGroup =
+ {3, 0, xmlIsIdeographic_srng, (xmlChLRangePtr)0};
int
@@ -152,31 +158,38 @@
if (rptr->nbShortRange == 0)
return 0;
low = 0;
- high = rptr->nbShortRange;
+ high = rptr->nbShortRange - 1;
sptr = rptr->shortRange;
while (low <= high) {
mid = (low + high) / 2;
- if ((unsigned short) val < sptr[mid].low)
+ if ((unsigned short) val < sptr[mid].low) {
high = mid - 1;
- else if ((unsigned short) val > sptr[mid].high)
- low = mid + 1;
- else
- return 1;
+ } else {
+ if ((unsigned short) val > sptr[mid].high) {
+ low = mid + 1;
+ } else {
+ return 1;
+ }
+ }
}
} else {
- if (rptr->nbLongRange == 0)
+ if (rptr->nbLongRange == 0) {
return 0;
+ }
low = 0;
- high = rptr->nbLongRange;
+ high = rptr->nbLongRange - 1;
lptr = rptr->longRange;
while (low <= high) {
mid = (low + high) / 2;
- if (val < lptr[mid].low)
+ if (val < lptr[mid].low) {
high = mid - 1;
- else if (val > lptr[mid].high)
- low = mid + 1;
- else
- return 1;
+ } else {
+ if (val > lptr[mid].high) {
+ low = mid + 1;
+ } else {
+ return 1;
+ }
+ }
}
}
return 0;