diff --git a/ChangeLog b/ChangeLog index 49942010..d22e1ef2 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,15 @@ +Sat Oct 18 12:46:02 HKT 2003 William Brack + + * genChRanges.py, chvalid.c, include/libxml/chvalid.h, + include/libxml/parserInternals.h: enhanced macros to avoid + breaking ABI from previous versions. + * catalog.c, parser.c, tree.c: modified to use IS_* macros + defined in parserInternals.h. Makes maintenance much easier. + * testHTML.c, testSAX.c, python/libxml.c: minor fixes to avoid + compilation warnings + * configuration.in: fixed pushHTML test error; enhanced for + better devel (me) testing + Fri Oct 17 14:38:54 CEST 2003 Daniel Veillard * legacy.c: remove the warning for startDocument(), as it is used by diff --git a/catalog.c b/catalog.c index 4375ebb0..89cb4cfd 100644 --- a/catalog.c +++ b/catalog.c @@ -2029,7 +2029,7 @@ xmlParseSGMLCatalogPubid(const xmlChar *cur, xmlChar **id) { xmlCatalogErrMemory("allocating public ID"); return(NULL); } - while (xmlIsPubidChar(*cur) || (*cur == '?')) { + while (xmlIsPubidCharQ(*cur) || (*cur == '?')) { if ((*cur == stop) && (stop != ' ')) break; if ((stop == ' ') && (IS_BLANK(*cur))) diff --git a/chvalid.c b/chvalid.c index 212d0521..8ffcb733 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: Sun Oct 12 18:17:45 2003 + * Generation date: Sat Oct 18 09:01:24 2003 * Sources: chvalid.def * William Brack */ @@ -195,3 +195,43 @@ xmlCharInRange (unsigned int val, xmlChRangeGroupPtr rptr) { return 0; } +int +xmlIsBaseChar(unsigned int ch) { + return(xmlIsBaseCharQ(ch)); +} + +int +xmlIsBlank(unsigned int ch) { + return(xmlIsBlankQ(ch)); +} + +int +xmlIsChar(unsigned int ch) { + return(xmlIsCharQ(ch)); +} + +int +xmlIsCombining(unsigned int ch) { + return(xmlIsCombiningQ(ch)); +} + +int +xmlIsDigit(unsigned int ch) { + return(xmlIsDigitQ(ch)); +} + +int +xmlIsExtender(unsigned int ch) { + return(xmlIsExtenderQ(ch)); +} + +int +xmlIsIdeographic(unsigned int ch) { + return(xmlIsIdeographicQ(ch)); +} + +int +xmlIsPubidChar(unsigned int ch) { + return(xmlIsPubidCharQ(ch)); +} + diff --git a/configure.in b/configure.in index c8483ff4..6f23db60 100644 --- a/configure.in +++ b/configure.in @@ -416,7 +416,9 @@ dnl dnl specific tests to setup DV's devel environment with debug etc ... dnl (-Wunreachable-code) dnl -if test "${LOGNAME}" = "veillard" -a "`pwd`" = "/u/veillard/XML" ; then +if [[ "${LOGNAME}" = "veillard" -a "`pwd`" = "/u/veillard/XML" ]] || \ + [[ "${LOGNAME}" = "bill" -a "`pwd`" = "/home/bill/gnomecvs/xmltest" ]] + then if test "$with_minimum" != "yes" then if test "${with_mem_debug}" = "" ; then @@ -686,7 +688,7 @@ else WITH_HTML=1 HTML_OBJ="HTMLparser.o HTMLtree.o" TEST_HTML=HTMLtests - if "$with_push" != "no" ; then + if test "$with_push" != "no" ; then TEST_PHTML=HTMLPushtests else TEST_PHTML= diff --git a/genChRanges.py b/genChRanges.py index 07f46f8c..9f940f30 100755 --- a/genChRanges.py +++ b/genChRanges.py @@ -8,6 +8,12 @@ # 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 string @@ -215,6 +221,8 @@ header.write( #ifndef __XML_CHVALID_H__ #define __XML_CHVALID_H__ +#include + #ifdef __cplusplus extern "C" { #endif @@ -247,7 +255,8 @@ struct _xmlChRangeGroup { }; /* Range checking routine */ -int xmlCharInRange(unsigned int val, const xmlChRangeGroupPtr group); +XMLPUBFUN int XMLCALL + xmlCharInRange(unsigned int val, const xmlChRangeGroupPtr group); """ % (date, sources)); output.write( @@ -297,7 +306,7 @@ for f in fkeys: rangeTable = makeRange(Functs[f][0]) numRanges = len(rangeTable) if numRanges >= minTableSize: # table is worthwhile - header.write("extern unsigned char %s_tab[256];\n" % f) + header.write("XMLPUBVAR unsigned char %s_tab[256];\n" % f) header.write("#define %s_ch(c)\t(%s_tab[(c)])\n" % (f, f)) # write the constant data to the code file @@ -342,7 +351,7 @@ for f in fkeys: pline += ")\n" header.write(pline) - pline = "#define %s(c)" % f + pline = "#define %sQ(c)" % f ntab = 4 - (len(pline)) / 8 if ntab < 0: ntab = 0 @@ -380,7 +389,7 @@ for f in fkeys: if len(Functs[f][1]) > 0: - header.write("extern xmlChRangeGroup %sGroup;\n" % f) + header.write("XMLPUBVAR xmlChRangeGroup %sGroup;\n" % f) # @@ -429,18 +438,6 @@ for f in fkeys: pline += ", (xmlChLRangePtr)0" output.write(pline + "};\n\n") -# -# Run complete - write trailers and close the output files -# - -header.write(""" -#ifdef __cplusplus -} -#endif -#endif /* __XML_CHVALID_H__ */ -"""); - -header.close() output.write( """ @@ -492,4 +489,23 @@ xmlCharInRange (unsigned int val, xmlChRangeGroupPtr rptr) { """); +# +# finally, generate the ABI compatibility functions +# +for f in fkeys: + output.write("int\n%s(unsigned int ch) {\n return(%sQ(ch));\n}\n\n" % (f,f)) + header.write("XMLPUBFUN int XMLCALL\n\t\t%s(unsigned int ch);\n" % f); +# +# Run complete - write trailers and close the output files +# + +header.write(""" +#ifdef __cplusplus +} +#endif +#endif /* __XML_CHVALID_H__ */ +"""); + +header.close() output.close() + diff --git a/include/libxml/chvalid.h b/include/libxml/chvalid.h index e9e5c670..79362ab3 100644 --- a/include/libxml/chvalid.h +++ b/include/libxml/chvalid.h @@ -5,7 +5,7 @@ * This file is automatically generated from the cvs source * definition files using the genChRanges.py Python script * - * Generation date: Sun Oct 12 18:17:45 2003 + * Generation date: Sat Oct 18 09:01:24 2003 * Sources: chvalid.def * William Brack */ @@ -13,6 +13,8 @@ #ifndef __XML_CHVALID_H__ #define __XML_CHVALID_H__ +#include + #ifdef __cplusplus extern "C" { #endif @@ -45,63 +47,80 @@ struct _xmlChRangeGroup { }; /* Range checking routine */ -int xmlCharInRange(unsigned int val, const xmlChRangeGroupPtr group); +XMLPUBFUN int XMLCALL + xmlCharInRange(unsigned int val, const xmlChRangeGroupPtr group); #define xmlIsBaseChar_ch(c) (((0x41 <= (c)) && ((c) <= 0x5a)) || \ ((0x61 <= (c)) && ((c) <= 0x7a)) || \ ((0xc0 <= (c)) && ((c) <= 0xd6)) || \ ((0xd8 <= (c)) && ((c) <= 0xf6)) || \ ((0xf8 <= (c)) && ((c) <= 0xff))) -#define xmlIsBaseChar(c) (((c) < 0x100) ? \ +#define xmlIsBaseCharQ(c) (((c) < 0x100) ? \ xmlIsBaseChar_ch((c)) : \ xmlCharInRange((c), &xmlIsBaseCharGroup)) -extern xmlChRangeGroup xmlIsBaseCharGroup; +XMLPUBVAR xmlChRangeGroup xmlIsBaseCharGroup; #define xmlIsBlank_ch(c) (((c) == 0x20) || \ ((0x9 <= (c)) && ((c) <= 0xa)) || \ ((c) == 0xd)) -#define xmlIsBlank(c) (((c) < 0x100) ? \ +#define xmlIsBlankQ(c) (((c) < 0x100) ? \ xmlIsBlank_ch((c)) : 0) #define xmlIsChar_ch(c) (((0x9 <= (c)) && ((c) <= 0xa)) || \ ((c) == 0xd) || \ ((0x20 <= (c)) && ((c) <= 0xff))) -#define xmlIsChar(c) (((c) < 0x100) ? \ +#define xmlIsCharQ(c) (((c) < 0x100) ? \ xmlIsChar_ch((c)) :\ (((0x100 <= (c)) && ((c) <= 0xd7ff)) || \ ((0xe000 <= (c)) && ((c) <= 0xfffd)) || \ ((0x10000 <= (c)) && ((c) <= 0x10ffff)))) -extern xmlChRangeGroup xmlIsCharGroup; -#define xmlIsCombining(c) (((c) < 0x100) ? \ +XMLPUBVAR xmlChRangeGroup xmlIsCharGroup; +#define xmlIsCombiningQ(c) (((c) < 0x100) ? \ 0 : \ xmlCharInRange((c), &xmlIsCombiningGroup)) -extern xmlChRangeGroup xmlIsCombiningGroup; +XMLPUBVAR xmlChRangeGroup xmlIsCombiningGroup; #define xmlIsDigit_ch(c) (((0x30 <= (c)) && ((c) <= 0x39))) -#define xmlIsDigit(c) (((c) < 0x100) ? \ +#define xmlIsDigitQ(c) (((c) < 0x100) ? \ xmlIsDigit_ch((c)) : \ xmlCharInRange((c), &xmlIsDigitGroup)) -extern xmlChRangeGroup xmlIsDigitGroup; +XMLPUBVAR xmlChRangeGroup xmlIsDigitGroup; #define xmlIsExtender_ch(c) (((c) == 0xb7)) -#define xmlIsExtender(c) (((c) < 0x100) ? \ +#define xmlIsExtenderQ(c) (((c) < 0x100) ? \ xmlIsExtender_ch((c)) : \ xmlCharInRange((c), &xmlIsExtenderGroup)) -extern xmlChRangeGroup xmlIsExtenderGroup; -#define xmlIsIdeographic(c) (((c) < 0x100) ? \ +XMLPUBVAR xmlChRangeGroup xmlIsExtenderGroup; +#define xmlIsIdeographicQ(c) (((c) < 0x100) ? \ 0 :\ (((0x4e00 <= (c)) && ((c) <= 0x9fa5)) || \ ((c) == 0x3007) || \ ((0x3021 <= (c)) && ((c) <= 0x3029)))) -extern xmlChRangeGroup xmlIsIdeographicGroup; -extern unsigned char xmlIsPubidChar_tab[256]; +XMLPUBVAR xmlChRangeGroup xmlIsIdeographicGroup; +XMLPUBVAR unsigned char xmlIsPubidChar_tab[256]; #define xmlIsPubidChar_ch(c) (xmlIsPubidChar_tab[(c)]) -#define xmlIsPubidChar(c) (((c) < 0x100) ? \ +#define xmlIsPubidCharQ(c) (((c) < 0x100) ? \ xmlIsPubidChar_ch((c)) : 0) +XMLPUBFUN int XMLCALL + xmlIsBaseChar(unsigned int ch); +XMLPUBFUN int XMLCALL + xmlIsBlank(unsigned int ch); +XMLPUBFUN int XMLCALL + xmlIsChar(unsigned int ch); +XMLPUBFUN int XMLCALL + xmlIsCombining(unsigned int ch); +XMLPUBFUN int XMLCALL + xmlIsDigit(unsigned int ch); +XMLPUBFUN int XMLCALL + xmlIsExtender(unsigned int ch); +XMLPUBFUN int XMLCALL + xmlIsIdeographic(unsigned int ch); +XMLPUBFUN int XMLCALL + xmlIsPubidChar(unsigned int ch); #ifdef __cplusplus } diff --git a/include/libxml/parserInternals.h b/include/libxml/parserInternals.h index e66863b8..f1585310 100644 --- a/include/libxml/parserInternals.h +++ b/include/libxml/parserInternals.h @@ -70,7 +70,7 @@ XMLPUBVAR unsigned int xmlParserMaxDepth; * | [#x10000-#x10FFFF] * any Unicode character, excluding the surrogate blocks, FFFE, and FFFF. */ -#define IS_CHAR(c) xmlIsChar(c) +#define IS_CHAR(c) xmlIsCharQ(c) /** * IS_BLANK: @@ -80,7 +80,7 @@ XMLPUBVAR unsigned int xmlParserMaxDepth; * * [3] S ::= (#x20 | #x9 | #xD | #xA)+ */ -#define IS_BLANK(c) xmlIsBlank(c) +#define IS_BLANK(c) xmlIsBlankQ(c) /** * IS_BASECHAR: @@ -90,7 +90,7 @@ XMLPUBVAR unsigned int xmlParserMaxDepth; * * [85] BaseChar ::= ... long list see REC ... */ -#define IS_BASECHAR(c) xmlIsBaseChar(c) +#define IS_BASECHAR(c) xmlIsBaseCharQ(c) /** * IS_DIGIT: @@ -100,7 +100,7 @@ XMLPUBVAR unsigned int xmlParserMaxDepth; * * [88] Digit ::= ... long list see REC ... */ -#define IS_DIGIT(c) xmlIsDigit(c) +#define IS_DIGIT(c) xmlIsDigitQ(c) /** * IS_COMBINING: @@ -110,7 +110,7 @@ XMLPUBVAR unsigned int xmlParserMaxDepth; * * [87] CombiningChar ::= ... long list see REC ... */ -#define IS_COMBINING(c) xmlIsCombining(c) +#define IS_COMBINING(c) xmlIsCombiningQ(c) /** * IS_EXTENDER: @@ -123,7 +123,7 @@ XMLPUBVAR unsigned int xmlParserMaxDepth; * #x0E46 | #x0EC6 | #x3005 | [#x3031-#x3035] | * [#x309D-#x309E] | [#x30FC-#x30FE] */ -#define IS_EXTENDER(c) xmlIsExtender(c) +#define IS_EXTENDER(c) xmlIsExtenderQ(c) /** * IS_IDEOGRAPHIC: @@ -134,7 +134,7 @@ XMLPUBVAR unsigned int xmlParserMaxDepth; * * [86] Ideographic ::= [#x4E00-#x9FA5] | #x3007 | [#x3021-#x3029] */ -#define IS_IDEOGRAPHIC(c) xmlIsIdeographic(c) +#define IS_IDEOGRAPHIC(c) xmlIsIdeographicQ(c) /** * IS_LETTER: @@ -157,7 +157,7 @@ XMLPUBVAR unsigned int xmlParserMaxDepth; * * [13] PubidChar ::= #x20 | #xD | #xA | [a-zA-Z0-9] | [-'()+,./:=?;!*#@$_%] */ -#define IS_PUBIDCHAR(c) xmlIsPubidChar(c) +#define IS_PUBIDCHAR(c) xmlIsPubidCharQ(c) /** * SKIP_EOL: diff --git a/parser.c b/parser.c index 9c51cdc6..17b8b1c8 100644 --- a/parser.c +++ b/parser.c @@ -1457,7 +1457,7 @@ xmlParseCharRef(xmlParserCtxtPtr ctxt) { * Characters referred to using character references must match the * production for Char. */ - if (xmlIsChar(val)) { + if (IS_CHAR(val)) { return(val); } else { xmlFatalErrMsgInt(ctxt, XML_ERR_INVALID_CHAR, @@ -1541,7 +1541,7 @@ xmlParseStringCharRef(xmlParserCtxtPtr ctxt, const xmlChar **str) { * Characters referred to using character references must match the * production for Char. */ - if (xmlIsChar(val)) { + if (IS_CHAR(val)) { return(val); } else { xmlFatalErrMsgInt(ctxt, XML_ERR_INVALID_CHAR, @@ -2817,11 +2817,11 @@ xmlParseNameComplex(xmlParserCtxtPtr ctxt) { } while ((c != ' ') && (c != '>') && (c != '/') && /* test bigname.xml */ - ((xmlIsLetter(c)) || (xmlIsDigit(c)) || + ((IS_LETTER(c)) || (IS_DIGIT(c)) || (c == '.') || (c == '-') || (c == '_') || (c == ':') || - (xmlIsCombining(c)) || - (xmlIsExtender(c)))) { + (IS_COMBINING(c)) || + (IS_EXTENDER(c)))) { if (count++ > 100) { count = 0; GROW; @@ -2859,16 +2859,16 @@ xmlParseStringName(xmlParserCtxtPtr ctxt, const xmlChar** str) { int c; c = CUR_SCHAR(cur, l); - if (!xmlIsLetter(c) && (c != '_') && + if (!IS_LETTER(c) && (c != '_') && (c != ':')) { return(NULL); } - while ((xmlIsLetter(c)) || (xmlIsDigit(c)) || /* test bigentname.xml */ + while ((IS_LETTER(c)) || (IS_DIGIT(c)) || /* test bigentname.xml */ (c == '.') || (c == '-') || (c == '_') || (c == ':') || - (xmlIsCombining(c)) || - (xmlIsExtender(c))) { + (IS_COMBINING(c)) || + (IS_EXTENDER(c))) { COPY_BUF(l,buf,len,c); cur += l; c = CUR_SCHAR(cur, l); @@ -2886,12 +2886,12 @@ xmlParseStringName(xmlParserCtxtPtr ctxt, const xmlChar** str) { return(NULL); } memcpy(buffer, buf, len); - while ((xmlIsLetter(c)) || (xmlIsDigit(c)) || + while ((IS_LETTER(c)) || (IS_DIGIT(c)) || /* test bigentname.xml */ (c == '.') || (c == '-') || (c == '_') || (c == ':') || - (xmlIsCombining(c)) || - (xmlIsExtender(c))) { + (IS_COMBINING(c)) || + (IS_EXTENDER(c))) { if (len + 10 > max) { max *= 2; buffer = (xmlChar *) xmlRealloc(buffer, @@ -2937,11 +2937,11 @@ xmlParseNmtoken(xmlParserCtxtPtr ctxt) { GROW; c = CUR_CHAR(l); - while ((xmlIsLetter(c)) || (xmlIsDigit(c)) || /* test bigtoken.xml */ + while ((IS_LETTER(c)) || (IS_DIGIT(c)) || /* test bigtoken.xml */ (c == '.') || (c == '-') || (c == '_') || (c == ':') || - (xmlIsCombining(c)) || - (xmlIsExtender(c))) { + (IS_COMBINING(c)) || + (IS_EXTENDER(c))) { if (count++ > 100) { count = 0; GROW; @@ -2963,11 +2963,11 @@ xmlParseNmtoken(xmlParserCtxtPtr ctxt) { return(NULL); } memcpy(buffer, buf, len); - while ((xmlIsLetter(c)) || (xmlIsDigit(c)) || /* test bigtoken.xml */ + while ((IS_LETTER(c)) || (IS_DIGIT(c)) || /* test bigtoken.xml */ (c == '.') || (c == '-') || (c == '_') || (c == ':') || - (xmlIsCombining(c)) || - (xmlIsExtender(c))) { + (IS_COMBINING(c)) || + (IS_EXTENDER(c))) { if (count++ > 100) { count = 0; GROW; @@ -3048,7 +3048,7 @@ xmlParseEntityValue(xmlParserCtxtPtr ctxt, xmlChar **orig) { * In practice it means we stop the loop only when back at parsing * the initial entity and the quote is found */ - while ((xmlIsChar(c)) && ((c != stop) || /* checked */ + while ((IS_CHAR(c)) && ((c != stop) || /* checked */ (ctxt->input != input))) { if (len + 5 >= size) { size *= 2; @@ -3402,7 +3402,7 @@ xmlParseSystemLiteral(xmlParserCtxtPtr ctxt) { } ctxt->instate = XML_PARSER_SYSTEM_LITERAL; cur = CUR_CHAR(l); - while ((xmlIsChar(cur)) && (cur != stop)) { /* checked */ + while ((IS_CHAR(cur)) && (cur != stop)) { /* checked */ if (len + 5 >= size) { size *= 2; buf = (xmlChar *) xmlRealloc(buf, size * sizeof(xmlChar)); @@ -3428,7 +3428,7 @@ xmlParseSystemLiteral(xmlParserCtxtPtr ctxt) { } buf[len] = 0; ctxt->instate = (xmlParserInputState) state; - if (!xmlIsChar(cur)) { + if (!IS_CHAR(cur)) { xmlFatalErr(ctxt, XML_ERR_LITERAL_NOT_FINISHED, NULL); } else { NEXT; @@ -3636,7 +3636,7 @@ xmlParseCharDataComplex(xmlParserCtxtPtr ctxt, int cdata) { cur = CUR_CHAR(l); while ((cur != '<') && /* checked */ (cur != '&') && - (xmlIsChar(cur))) /* test also done in xmlCurrentChar() */ { + (IS_CHAR(cur))) /* test also done in xmlCurrentChar() */ { if ((cur == ']') && (NXT(1) == ']') && (NXT(2) == '>')) { if (cdata) break; @@ -3821,7 +3821,7 @@ xmlParseComment(xmlParserCtxtPtr ctxt) { if (cur == 0) goto not_terminated; len = 0; - while (xmlIsChar(cur) && /* checked */ + while (IS_CHAR(cur) && /* checked */ ((cur != '>') || (r != '-') || (q != '-'))) { if ((r == '-') && (q == '-')) { @@ -3856,7 +3856,7 @@ xmlParseComment(xmlParserCtxtPtr ctxt) { } } buf[len] = 0; - if (!xmlIsChar(cur)) { + if (!IS_CHAR(cur)) { xmlFatalErrMsgStr(ctxt, XML_ERR_COMMENT_NOT_FINISHED, "Comment not terminated \n