From ccb4d41c13bea3c81cf074ed43b84bd686c7d124 Mon Sep 17 00:00:00 2001 From: Daniel Veillard Date: Tue, 23 Aug 2005 13:41:17 +0000 Subject: [PATCH] regenerated fixed a compilation problem some cleanups and one bug fix * elfgcchack.h testapi.c doc/*: regenerated * schematron.c: fixed a compilation problem * xmlregexp.c include/libxml/xmlregexp.h: some cleanups and one bug fix * result/expr/base: slightly changes the number of Cons. Daniel --- ChangeLog | 7 +++ doc/APIchunk10.html | 4 ++ doc/APIchunk11.html | 1 + doc/APIchunk12.html | 9 ++- doc/APIchunk14.html | 3 + doc/APIchunk17.html | 1 + doc/APIchunk18.html | 11 +++- doc/APIchunk19.html | 3 +- doc/APIchunk21.html | 3 + doc/APIchunk23.html | 8 +++ doc/APIchunk24.html | 1 + doc/APIchunk25.html | 2 + doc/APIchunk26.html | 6 +- doc/APIchunk4.html | 3 + doc/APIconstructors.html | 4 ++ doc/APIfiles.html | 4 ++ doc/APIfunctions.html | 8 +++ doc/APIsymbols.html | 4 ++ doc/html/libxml-xmlregexp.html | 16 ++++- doc/libxml2-api.xml | 41 +++++++++++- doc/libxml2-refs.xml | 91 +++++++++++++++++++++++++++ elfgcchack.h | 48 ++++++++++++++ include/libxml/xmlregexp.h | 17 +++++ result/expr/base | 2 +- schematron.c | 2 + testapi.c | 46 +++++++++++++- win32/libxml2.def.src | 12 ++++ xmlregexp.c | 112 +++++++++++++++++++++++++++++---- 28 files changed, 447 insertions(+), 22 deletions(-) diff --git a/ChangeLog b/ChangeLog index 162ed432..42746c62 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +Tue Aug 23 15:38:46 CEST 2005 Daniel Veillard + + * elfgcchack.h testapi.c doc/*: regenerated + * schematron.c: fixed a compilation problem + * xmlregexp.c include/libxml/xmlregexp.h: some cleanups and one bug fix + * result/expr/base: slightly changes the number of Cons. + Mon Aug 22 23:19:50 CEST 2005 Daniel Veillard * elfgcchack.h testapi.c doc/*: rescanned code and rebuilt diff --git a/doc/APIchunk10.html b/doc/APIchunk10.html index e4dba2d9..161b4ef2 100644 --- a/doc/APIchunk10.html +++ b/doc/APIchunk10.html @@ -517,6 +517,10 @@
assuming
xmlSaveFileTo
xmlSaveFormatFileTo
assure
xmlGetUTF8Char
+
atom
xmlExpNewAtom
+xmlExpNewOr
+xmlExpNewRange
+xmlExpNewSeq
atomic
xmlGcMemGet
xmlGcMemSetup
attached
xmlTextReaderGetRemainder
diff --git a/doc/APIchunk11.html b/doc/APIchunk11.html index c1be6327..763623ff 100644 --- a/doc/APIchunk11.html +++ b/doc/APIchunk11.html @@ -187,6 +187,7 @@ xmlStrEqual
xmlXPathCompareValues
xmlXPathIntersection
+
bound
xmlExpNewRange
boundaries
_xmlParserCtxt
xmlSearchNs
boundary
xmlParseElementChildrenContentDecl
diff --git a/doc/APIchunk12.html b/doc/APIchunk12.html index a0771d6b..e818ee7e 100644 --- a/doc/APIchunk12.html +++ b/doc/APIchunk12.html @@ -237,7 +237,8 @@
childs
_xmlNode
xmlIsMixedElement
xmlValidGetValidElements
-
choice
xmlExpParse
+
choice
xmlExpNewOr
+xmlExpParse
xmlParseElementChildrenContentDecl
choices
xmlParseElementMixedContentDecl
choices:
xmlParseNotationDecl
@@ -598,6 +599,9 @@ isolat1ToUTF8
xmlCharEncodingInputFunc
xmlCharEncodingOutputFunc
+xmlExpNewOr
+xmlExpNewRange
+xmlExpNewSeq
xmlGetUTF8Char
xmlParserInputBufferRead
xmlSchemaNewNOTATIONValue
@@ -827,6 +831,9 @@
cshema
XML_SCHEMAS_FINAL_DEFAULT_LIST
ctrio
xmlXPathIsInf
xmlXPathIsNaN
+
ctxt
xmlExpNewOr
+xmlExpNewRange
+xmlExpNewSeq
ctxt-
docbFreeParserCtxt
htmlFreeParserCtxt
xmlFreeParserCtxt
diff --git a/doc/APIchunk14.html b/doc/APIchunk14.html index 246bbbb9..78fd4a81 100644 --- a/doc/APIchunk14.html +++ b/doc/APIchunk14.html @@ -302,6 +302,9 @@ xmlXPtrEval
evaulation
xmlRegFreeExecCtxt
even
_xmlParserInput
+xmlExpNewOr
+xmlExpNewRange
+xmlExpNewSeq
xmlNodeGetBase
xmlParseBalancedChunkMemoryRecover
xmlTextWriterFullEndElement
diff --git a/doc/APIchunk17.html b/doc/APIchunk17.html index afaff842..b797ffda 100644 --- a/doc/APIchunk17.html +++ b/doc/APIchunk17.html @@ -247,6 +247,7 @@ xmlParsePEReference
xmlParserHandlePEReference
infinite
xmlExpExpDerive
+xmlExpNewRange
xmlExpParse
infinity
xmlXPathCeilingFunction
xmlXPathFloorFunction
diff --git a/doc/APIchunk18.html b/doc/APIchunk18.html index 40fc604e..f02b4d03 100644 --- a/doc/APIchunk18.html +++ b/doc/APIchunk18.html @@ -54,7 +54,10 @@ xmlXPathNewParserContext
xmlXPathNextSelf
xmlXPtrNewContext
-

Letter k:

keep
xmlParseURIRaw
+

Letter k:

keep
xmlExpNewOr
+xmlExpNewRange
+xmlExpNewSeq
+xmlParseURIRaw
xmlParserInputGrow
xmlSubstituteEntitiesDefault
xmlTextReaderPreserve
@@ -147,7 +150,9 @@ xmlXPathStringFunction
least
xmlDetectCharEncoding
xmlXPathStringFunction
-
left
xmlTextReaderGetRemainder
+
left
xmlExpNewOr
+xmlExpNewSeq
+xmlTextReaderGetRemainder
legacy
htmlNodeStatus
len
xmlBufferAdd
xmlBufferAddHead
@@ -166,6 +171,7 @@ xmlUTF8Strsize
lenght
xmlExpGetLanguage
xmlExpGetStart
+xmlExpNewAtom
xmlRelaxNGValidatePushCData
xmlSplitQName3
xmlValidatePushCData
@@ -384,6 +390,7 @@
lossless
xmlOutputBufferWrite
xmlOutputBufferWriteEscape
xmlOutputBufferWriteString
+
lower
xmlExpNewRange
lowercase
htmlTagLookup
xmlIsRef

A-B diff --git a/doc/APIchunk19.html b/doc/APIchunk19.html index c6184780..ade66183 100644 --- a/doc/APIchunk19.html +++ b/doc/APIchunk19.html @@ -149,7 +149,8 @@ xmlExpMaxToken
xmlExpNewCtxt
xmlPatternMaxDepth
-
means
xmlSetGenericErrorFunc
+
means
xmlExpNewRange
+xmlSetGenericErrorFunc
xmlSetStructuredErrorFunc
xmlStreamPush
xmlStreamPushAttr
diff --git a/doc/APIchunk21.html b/doc/APIchunk21.html index fc2c3760..6789f9d3 100644 --- a/doc/APIchunk21.html +++ b/doc/APIchunk21.html @@ -190,6 +190,9 @@ xmlParserInputBufferPush
operation
xmlBuildRelativeURI
xmlCatalogSetDebug
+xmlExpNewOr
+xmlExpNewRange
+xmlExpNewSeq
xmlTextReaderConstValue
xmlXPathAddValues
xmlXPathCompareValues
diff --git a/doc/APIchunk23.html b/doc/APIchunk23.html index 709c7807..8b31bf50 100644 --- a/doc/APIchunk23.html +++ b/doc/APIchunk23.html @@ -73,6 +73,7 @@ xmlBufferAdd
xmlBufferAddHead
xmlCharInRange
+xmlExpNewRange
xmlTextReaderNormalization
xmlXPathNodeSetItem
xmlXPtrLocationSetAdd
@@ -328,6 +329,9 @@
release
xmlClearNodeInfoSeq
xmlClearParserCtxt
xmlDecodeEntities
+xmlExpNewOr
+xmlExpNewRange
+xmlExpNewSeq
xmlUnlockLibrary
releases
xmlTextReaderClose
reliable
xmlSaveToFilename
@@ -379,6 +383,8 @@
removing
xmlLoadSGMLSuperCatalog
rename
_xmlError
repeat
xmlXPathAxisFunc
+
repeated
xmlExpNewRange
+
repetition
xmlExpNewRange
replace
XML_SCHEMAS_FACET_REPLACE
XML_SCHEMAS_TYPE_WHITESPACE_REPLACE
_xmlParserCtxt
@@ -564,6 +570,8 @@
rewrite
xmlTextReaderGetRemainder
right
xmlAutomataNewCounterTrans
xmlCheckFilename
+xmlExpNewOr
+xmlExpNewSeq
xmlParseCharData
xmlSetListDoc
xmlSetTreeDoc
diff --git a/doc/APIchunk24.html b/doc/APIchunk24.html index 49df4bac..0ce15fbb 100644 --- a/doc/APIchunk24.html +++ b/doc/APIchunk24.html @@ -192,6 +192,7 @@ xmlCharEncOutFunc
xmlClearNodeInfoSeq
xmlCurrentChar
+xmlExpNewSeq
xmlExpParse
xmlGetUTF8Char
xmlInitNodeInfoSeq
diff --git a/doc/APIchunk25.html b/doc/APIchunk25.html index 27153389..98b46a80 100644 --- a/doc/APIchunk25.html +++ b/doc/APIchunk25.html @@ -139,6 +139,8 @@ xmlXPathValueFlipSign
them
xmlExpGetLanguage
xmlExpGetStart
+xmlExpNewOr
+xmlExpNewSeq
xmlNanoFTPRead
xmlNanoHTTPRead
xmlParseAttValue
diff --git a/doc/APIchunk26.html b/doc/APIchunk26.html index 1afcc10c..cff6ce40 100644 --- a/doc/APIchunk26.html +++ b/doc/APIchunk26.html @@ -89,6 +89,9 @@ xmlUCSIsCat
unless
htmlSAXParseDoc
htmlSAXParseFile
+xmlExpNewOr
+xmlExpNewRange
+xmlExpNewSeq
xmlGetNoNsProp
xmlGetNsProp
xmlGetProp
@@ -172,7 +175,8 @@ xmlSplitQName2
upon
checkNamespace
xlinkNodeDetectFunc
-
upper
xmlIsRef
+
upper
xmlExpNewRange
+xmlIsRef
uri
xmlNormalizeWindowsPath
usage
xmlGetBufferAllocationScheme
xmlSetBufferAllocationScheme
diff --git a/doc/APIchunk4.html b/doc/APIchunk4.html index 19521d99..b6dce455 100644 --- a/doc/APIchunk4.html +++ b/doc/APIchunk4.html @@ -298,6 +298,9 @@ xmlDocDumpFormatMemoryEnc
xmlDocDumpMemoryEnc
xmlDocFormatDump
+xmlExpNewOr
+xmlExpNewRange
+xmlExpNewSeq
xmlHasNsProp
xmlNanoHTTPContentLength
xmlNodeDump
diff --git a/doc/APIconstructors.html b/doc/APIconstructors.html index d2c89070..9598e49b 100644 --- a/doc/APIconstructors.html +++ b/doc/APIconstructors.html @@ -327,6 +327,10 @@ xmlGetLastError

Type xmlExpCtxtPtr:

xmlExpNewCtxt

Type xmlExpNodePtr:

xmlExpExpDerive
+xmlExpNewAtom
+xmlExpNewOr
+xmlExpNewRange
+xmlExpNewSeq
xmlExpParse
xmlExpStringDerive

Type xmlExternalEntityLoader:

xmlGetExternalEntityLoader
diff --git a/doc/APIfiles.html b/doc/APIfiles.html index 9bd4181d..35c224bb 100644 --- a/doc/APIfiles.html +++ b/doc/APIfiles.html @@ -2673,7 +2673,11 @@ xmlExpGetStart
xmlExpIsNillable
xmlExpMaxToken
+xmlExpNewAtom
xmlExpNewCtxt
+xmlExpNewOr
+xmlExpNewRange
+xmlExpNewSeq
xmlExpNode
xmlExpNodePtr
xmlExpNodeType
diff --git a/doc/APIfunctions.html b/doc/APIfunctions.html index 639de114..9b25ce2d 100644 --- a/doc/APIfunctions.html +++ b/doc/APIfunctions.html @@ -221,6 +221,7 @@ xmlEncodeEntities
xmlEncodeEntitiesReentrant
xmlEncodeSpecialChars
+xmlExpNewAtom
xmlExpStringDerive
xmlGetDocEntity
xmlGetDtdAttrDesc
@@ -1268,6 +1269,10 @@ xmlExpFreeCtxt
xmlExpGetLanguage
xmlExpGetStart
+xmlExpNewAtom
+xmlExpNewOr
+xmlExpNewRange
+xmlExpNewSeq
xmlExpParse
xmlExpStringDerive
xmlExpSubsume
@@ -1278,6 +1283,9 @@ xmlExpGetStart
xmlExpIsNillable
xmlExpMaxToken
+xmlExpNewOr
+xmlExpNewRange
+xmlExpNewSeq
xmlExpRef
xmlExpStringDerive
xmlExpSubsume
diff --git a/doc/APIsymbols.html b/doc/APIsymbols.html index a3ec3a69..faa8d7bf 100644 --- a/doc/APIsymbols.html +++ b/doc/APIsymbols.html @@ -1887,7 +1887,11 @@ xmlExpGetStart
xmlExpIsNillable
xmlExpMaxToken
+xmlExpNewAtom
xmlExpNewCtxt
+xmlExpNewOr
+xmlExpNewRange
+xmlExpNewSeq
xmlExpNode
xmlExpNodePtr
xmlExpNodeType
diff --git a/doc/html/libxml-xmlregexp.html b/doc/html/libxml-xmlregexp.html index 5b2bd9db..761e1055 100644 --- a/doc/html/libxml-xmlregexp.html +++ b/doc/html/libxml-xmlregexp.html @@ -33,7 +33,11 @@

int	xmlExpGetStart			(xmlExpCtxtPtr ctxt, 
xmlExpNodePtr exp,
const xmlChar ** list,
int len)
int	xmlExpIsNillable		(xmlExpNodePtr exp)
int	xmlExpMaxToken			(xmlExpNodePtr expr)
+
xmlExpNodePtr	xmlExpNewAtom		(xmlExpCtxtPtr ctxt, 
const xmlChar * name,
int len)
xmlExpCtxtPtr	xmlExpNewCtxt		(int maxNodes, 
xmlDictPtr dict)
+
xmlExpNodePtr	xmlExpNewOr		(xmlExpCtxtPtr ctxt, 
xmlExpNodePtr left,
xmlExpNodePtr right)
+
xmlExpNodePtr	xmlExpNewRange		(xmlExpCtxtPtr ctxt, 
xmlExpNodePtr subset,
int min,
int max)
+
xmlExpNodePtr	xmlExpNewSeq		(xmlExpCtxtPtr ctxt, 
xmlExpNodePtr left,
xmlExpNodePtr right)
xmlExpNodePtr	xmlExpParse		(xmlExpCtxtPtr ctxt, 
const char * expr)
void	xmlExpRef			(xmlExpNodePtr exp)
xmlExpNodePtr	xmlExpStringDerive	(xmlExpCtxtPtr ctxt, 
xmlExpNodePtr exp,
const xmlChar * str,
int len)
@@ -89,9 +93,17 @@

Structure xmlExpCtxt

Finds if the expression is nillable, i.e. if it accepts the empty sequqnce

exp:the expression
Returns:1 if nillable, 0 if not and -1 in case of error

Function: xmlExpMaxToken

int	xmlExpMaxToken			(xmlExpNodePtr expr)

Indicate the maximum number of input a expression can accept

-
expr:a compiled expression
Returns:the maximum length or -1 in case of error

Function: xmlExpNewCtxt

xmlExpCtxtPtr	xmlExpNewCtxt		(int maxNodes, 
xmlDictPtr dict)
+
expr:a compiled expression
Returns:the maximum length or -1 in case of error

Function: xmlExpNewAtom

xmlExpNodePtr	xmlExpNewAtom		(xmlExpCtxtPtr ctxt, 
const xmlChar * name,
int len)
+

Get the atom associated to this name from that context

+
ctxt:the expression context
name:the atom name
len:the atom name lenght in byte (or -1);
Returns:the node or NULL in case of error

Function: xmlExpNewCtxt

xmlExpCtxtPtr	xmlExpNewCtxt		(int maxNodes, 
xmlDictPtr dict)

Creates a new context for manipulating expressions

-
maxNodes:the maximum number of nodes
dict:optional dictionnary to use internally
Returns:the context or NULL in case of error

Function: xmlExpParse

xmlExpNodePtr	xmlExpParse		(xmlExpCtxtPtr ctxt, 
const char * expr)
+
maxNodes:the maximum number of nodes
dict:optional dictionnary to use internally
Returns:the context or NULL in case of error

Function: xmlExpNewOr

xmlExpNodePtr	xmlExpNewOr		(xmlExpCtxtPtr ctxt, 
xmlExpNodePtr left,
xmlExpNodePtr right)
+

Get the atom associated to the choice @left | @right Note that @left and @right are consumed in the operation, to keep an handle on them use xmlExpRef() and use xmlExpFree() to release them, this is true even in case of failure (unless ctxt == NULL).

+
ctxt:the expression context
left:left expression
right:right expression
Returns:the node or NULL in case of error

Function: xmlExpNewRange

xmlExpNodePtr	xmlExpNewRange		(xmlExpCtxtPtr ctxt, 
xmlExpNodePtr subset,
int min,
int max)
+

Get the atom associated to the range (@subset){@min, @max} Note that @subset is consumed in the operation, to keep an handle on it use xmlExpRef() and use xmlExpFree() to release it, this is true even in case of failure (unless ctxt == NULL).

+
ctxt:the expression context
subset:the expression to be repeated
min:the lower bound for the repetition
max:the upper bound for the repetition, -1 means infinite
Returns:the node or NULL in case of error

Function: xmlExpNewSeq

xmlExpNodePtr	xmlExpNewSeq		(xmlExpCtxtPtr ctxt, 
xmlExpNodePtr left,
xmlExpNodePtr right)
+

Get the atom associated to the sequence @left , @right Note that @left and @right are consumed in the operation, to keep an handle on them use xmlExpRef() and use xmlExpFree() to release them, this is true even in case of failure (unless ctxt == NULL).

+
ctxt:the expression context
left:left expression
right:right expression
Returns:the node or NULL in case of error

Function: xmlExpParse

xmlExpNodePtr	xmlExpParse		(xmlExpCtxtPtr ctxt, 
const char * expr)

Minimal parser for regexps, it understand the following constructs - string terminals - choice operator | - sequence operator , - subexpressions (...) - usual cardinality operators + * and ? - finite sequences { min, max } - infinite sequences { min, * } There is minimal checkings made especially no checking on strings values

ctxt:the expressions context
expr:the 0 terminated string
Returns:a new expression or NULL in case of failure

Function: xmlExpRef

void	xmlExpRef			(xmlExpNodePtr exp)

Increase the reference count of the expression

diff --git a/doc/libxml2-api.xml b/doc/libxml2-api.xml index d5274675..38c15fd2 100644 --- a/doc/libxml2-api.xml +++ b/doc/libxml2-api.xml @@ -2852,6 +2852,7 @@ + @@ -2865,17 +2866,20 @@ + + + - + - + @@ -9315,6 +9319,14 @@ actually an xmlCharEncoding'/> + + defined(LIBXML_REGEXP_ENABLED) && defined(LIBXML_EXPR_ENABLED) + Get the atom associated to this name from that context + + + + + defined(LIBXML_REGEXP_ENABLED) && defined(LIBXML_EXPR_ENABLED) Creates a new context for manipulating expressions @@ -9322,6 +9334,31 @@ actually an xmlCharEncoding'/> + + defined(LIBXML_REGEXP_ENABLED) && defined(LIBXML_EXPR_ENABLED) + Get the atom associated to the choice @left | @right Note that @left and @right are consumed in the operation, to keep an handle on them use xmlExpRef() and use xmlExpFree() to release them, this is true even in case of failure (unless ctxt == NULL). + + + + + + + defined(LIBXML_REGEXP_ENABLED) && defined(LIBXML_EXPR_ENABLED) + Get the atom associated to the range (@subset){@min, @max} Note that @subset is consumed in the operation, to keep an handle on it use xmlExpRef() and use xmlExpFree() to release it, this is true even in case of failure (unless ctxt == NULL). + + + + + + + + defined(LIBXML_REGEXP_ENABLED) && defined(LIBXML_EXPR_ENABLED) + Get the atom associated to the sequence @left , @right Note that @left and @right are consumed in the operation, to keep an handle on them use xmlExpRef() and use xmlExpFree() to release them, this is true even in case of failure (unless ctxt == NULL). + + + + + defined(LIBXML_REGEXP_ENABLED) && defined(LIBXML_EXPR_ENABLED) Minimal parser for regexps, it understand the following constructs - string terminals - choice operator | - sequence operator , - subexpressions (...) - usual cardinality operators + * and ? - finite sequences { min, max } - infinite sequences { min, * } There is minimal checkings made especially no checking on strings values diff --git a/doc/libxml2-refs.xml b/doc/libxml2-refs.xml index 95cf1238..39b02c8b 100644 --- a/doc/libxml2-refs.xml +++ b/doc/libxml2-refs.xml @@ -1881,7 +1881,11 @@ + + + + @@ -5346,7 +5350,11 @@ + + + + @@ -7280,6 +7288,10 @@ + + + + @@ -7876,6 +7888,7 @@ + @@ -9063,6 +9076,10 @@ + + + + @@ -9075,6 +9092,9 @@ + + + @@ -13020,7 +13040,11 @@ + + + + @@ -16193,6 +16217,9 @@ + + + @@ -18731,6 +18758,12 @@ + + + + + + @@ -19018,6 +19051,9 @@ + + + @@ -19435,6 +19471,7 @@ + @@ -19976,6 +20013,9 @@ + + + @@ -20294,6 +20334,11 @@ + + + + + @@ -21541,6 +21586,9 @@ + + + @@ -23026,6 +23074,7 @@ + @@ -23459,6 +23508,9 @@ + + + @@ -23596,6 +23648,8 @@ + + @@ -23621,6 +23675,7 @@ + @@ -23938,6 +23993,9 @@ + + + @@ -24125,6 +24183,7 @@ + @@ -25022,6 +25081,9 @@ + + + @@ -26054,6 +26116,7 @@ + @@ -26435,6 +26498,9 @@ + + + @@ -26515,6 +26581,12 @@ + + + + + + @@ -26793,6 +26865,8 @@ + + @@ -27095,6 +27169,7 @@ + @@ -28256,6 +28331,8 @@ + + @@ -28727,6 +28804,9 @@ + + + @@ -28846,6 +28926,7 @@ + @@ -29641,6 +29722,16 @@ + + + + + + + + + + diff --git a/elfgcchack.h b/elfgcchack.h index 93f9c7e8..1a101fc1 100644 --- a/elfgcchack.h +++ b/elfgcchack.h @@ -3227,6 +3227,18 @@ extern __typeof (xmlExpMaxToken) xmlExpMaxToken__internal_alias __attribute((vis #endif #endif +#if defined(LIBXML_REGEXP_ENABLED) && defined(LIBXML_EXPR_ENABLED) +#ifdef bottom_xmlregexp +#undef xmlExpNewAtom +extern __typeof (xmlExpNewAtom) xmlExpNewAtom __attribute((alias("xmlExpNewAtom__internal_alias"))); +#else +#ifndef xmlExpNewAtom +extern __typeof (xmlExpNewAtom) xmlExpNewAtom__internal_alias __attribute((visibility("hidden"))); +#define xmlExpNewAtom xmlExpNewAtom__internal_alias +#endif +#endif +#endif + #if defined(LIBXML_REGEXP_ENABLED) && defined(LIBXML_EXPR_ENABLED) #ifdef bottom_xmlregexp #undef xmlExpNewCtxt @@ -3239,6 +3251,42 @@ extern __typeof (xmlExpNewCtxt) xmlExpNewCtxt__internal_alias __attribute((visib #endif #endif +#if defined(LIBXML_REGEXP_ENABLED) && defined(LIBXML_EXPR_ENABLED) +#ifdef bottom_xmlregexp +#undef xmlExpNewOr +extern __typeof (xmlExpNewOr) xmlExpNewOr __attribute((alias("xmlExpNewOr__internal_alias"))); +#else +#ifndef xmlExpNewOr +extern __typeof (xmlExpNewOr) xmlExpNewOr__internal_alias __attribute((visibility("hidden"))); +#define xmlExpNewOr xmlExpNewOr__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_REGEXP_ENABLED) && defined(LIBXML_EXPR_ENABLED) +#ifdef bottom_xmlregexp +#undef xmlExpNewRange +extern __typeof (xmlExpNewRange) xmlExpNewRange __attribute((alias("xmlExpNewRange__internal_alias"))); +#else +#ifndef xmlExpNewRange +extern __typeof (xmlExpNewRange) xmlExpNewRange__internal_alias __attribute((visibility("hidden"))); +#define xmlExpNewRange xmlExpNewRange__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_REGEXP_ENABLED) && defined(LIBXML_EXPR_ENABLED) +#ifdef bottom_xmlregexp +#undef xmlExpNewSeq +extern __typeof (xmlExpNewSeq) xmlExpNewSeq __attribute((alias("xmlExpNewSeq__internal_alias"))); +#else +#ifndef xmlExpNewSeq +extern __typeof (xmlExpNewSeq) xmlExpNewSeq__internal_alias __attribute((visibility("hidden"))); +#define xmlExpNewSeq xmlExpNewSeq__internal_alias +#endif +#endif +#endif + #if defined(LIBXML_REGEXP_ENABLED) && defined(LIBXML_EXPR_ENABLED) #ifdef bottom_xmlregexp #undef xmlExpParse diff --git a/include/libxml/xmlregexp.h b/include/libxml/xmlregexp.h index 27a36f99..63ae1a03 100644 --- a/include/libxml/xmlregexp.h +++ b/include/libxml/xmlregexp.h @@ -156,6 +156,23 @@ XMLPUBFUN void XMLCALL XMLPUBFUN xmlExpNodePtr XMLCALL xmlExpParse (xmlExpCtxtPtr ctxt, const char *expr); +XMLPUBFUN xmlExpNodePtr XMLCALL + xmlExpNewAtom (xmlExpCtxtPtr ctxt, + const xmlChar *name, + int len); +XMLPUBFUN xmlExpNodePtr XMLCALL + xmlExpNewOr (xmlExpCtxtPtr ctxt, + xmlExpNodePtr left, + xmlExpNodePtr right); +XMLPUBFUN xmlExpNodePtr XMLCALL + xmlExpNewSeq (xmlExpCtxtPtr ctxt, + xmlExpNodePtr left, + xmlExpNodePtr right); +XMLPUBFUN xmlExpNodePtr XMLCALL + xmlExpNewRange (xmlExpCtxtPtr ctxt, + xmlExpNodePtr subset, + int min, + int max); /* * The really interesting APIs */ diff --git a/result/expr/base b/result/expr/base index b682818d..9ab0d199 100644 --- a/result/expr/base +++ b/result/expr/base @@ -82,4 +82,4 @@ Subexp: a{0,100},(a|c) => accept, Ok Subexp: a{0,101},(a|c) => reject, Ok Expression: (a, ((b, c, d){0,5}, e{0,1}){0,4}, f) Subexp: (a, b, (c, d, b){2,3}, c, d, e, f) => accept, Ok -Ops: 0 nodes, 205 cons +Ops: 0 nodes, 221 cons diff --git a/schematron.c b/schematron.c index 67f97b66..9cb50271 100644 --- a/schematron.c +++ b/schematron.c @@ -1724,4 +1724,6 @@ main(void) return (0); } #endif +#define bottom_schematron +#include "elfgcchack.h" #endif /* LIBXML_SCHEMATRON_ENABLED */ diff --git a/testapi.c b/testapi.c index 2f448a11..35358b50 100644 --- a/testapi.c +++ b/testapi.c @@ -32204,6 +32204,16 @@ test_xmlExpMaxToken(void) { } +static int +test_xmlExpNewAtom(void) { + int test_ret = 0; + + + /* missing type support */ + return(test_ret); +} + + static int test_xmlExpNewCtxt(void) { int test_ret = 0; @@ -32214,6 +32224,36 @@ test_xmlExpNewCtxt(void) { } +static int +test_xmlExpNewOr(void) { + int test_ret = 0; + + + /* missing type support */ + return(test_ret); +} + + +static int +test_xmlExpNewRange(void) { + int test_ret = 0; + + + /* missing type support */ + return(test_ret); +} + + +static int +test_xmlExpNewSeq(void) { + int test_ret = 0; + + + /* missing type support */ + return(test_ret); +} + + static int test_xmlExpParse(void) { int test_ret = 0; @@ -32705,7 +32745,7 @@ static int test_xmlregexp(void) { int test_ret = 0; - if (quiet == 0) printf("Testing xmlregexp : 16 of 26 functions ...\n"); + if (quiet == 0) printf("Testing xmlregexp : 16 of 30 functions ...\n"); test_ret += test_xmlExpCtxtNbCons(); test_ret += test_xmlExpCtxtNbNodes(); test_ret += test_xmlExpDump(); @@ -32714,7 +32754,11 @@ test_xmlregexp(void) { test_ret += test_xmlExpGetStart(); test_ret += test_xmlExpIsNillable(); test_ret += test_xmlExpMaxToken(); + test_ret += test_xmlExpNewAtom(); test_ret += test_xmlExpNewCtxt(); + test_ret += test_xmlExpNewOr(); + test_ret += test_xmlExpNewRange(); + test_ret += test_xmlExpNewSeq(); test_ret += test_xmlExpParse(); test_ret += test_xmlExpRef(); test_ret += test_xmlExpStringDerive(); diff --git a/win32/libxml2.def.src b/win32/libxml2.def.src index cf6cc4e7..99efa4c9 100644 --- a/win32/libxml2.def.src +++ b/win32/libxml2.def.src @@ -815,9 +815,21 @@ xmlExpIsNillable xmlExpMaxToken #endif #ifdef LIBXML_REGEXP_ENABLED +xmlExpNewAtom +#endif +#ifdef LIBXML_REGEXP_ENABLED xmlExpNewCtxt #endif #ifdef LIBXML_REGEXP_ENABLED +xmlExpNewOr +#endif +#ifdef LIBXML_REGEXP_ENABLED +xmlExpNewRange +#endif +#ifdef LIBXML_REGEXP_ENABLED +xmlExpNewSeq +#endif +#ifdef LIBXML_REGEXP_ENABLED xmlExpParse #endif #ifdef LIBXML_REGEXP_ENABLED diff --git a/xmlregexp.c b/xmlregexp.c index 3c975f03..45b917b9 100644 --- a/xmlregexp.c +++ b/xmlregexp.c @@ -5957,13 +5957,6 @@ xmlExpFree(xmlExpCtxtPtr ctxt, xmlExpNodePtr exp) { if ((exp == NULL) || (exp == forbiddenExp) || (exp == emptyExp)) return; exp->ref--; -#if 0 - if (exp->ref == 0) { - printf("Freeing "); PRINT_EXP(exp) - } else { - printf("Dec to %d ", exp->ref); PRINT_EXP(exp) - } -#endif if (exp->ref == 0) { unsigned short key; @@ -6007,6 +6000,97 @@ xmlExpRef(xmlExpNodePtr exp) { exp->ref++; } +/** + * xmlExpNewAtom: + * @ctxt: the expression context + * @name: the atom name + * @len: the atom name lenght in byte (or -1); + * + * Get the atom associated to this name from that context + * + * Returns the node or NULL in case of error + */ +xmlExpNodePtr +xmlExpNewAtom(xmlExpCtxtPtr ctxt, const xmlChar *name, int len) { + if ((ctxt == NULL) || (name == NULL)) + return(NULL); + name = xmlDictLookup(ctxt->dict, name, len); + if (name == NULL) + return(NULL); + return(xmlExpHashGetEntry(ctxt, XML_EXP_ATOM, NULL, NULL, name, 0, 0)); +} + +/** + * xmlExpNewOr: + * @ctxt: the expression context + * @left: left expression + * @right: right expression + * + * Get the atom associated to the choice @left | @right + * Note that @left and @right are consumed in the operation, to keep + * an handle on them use xmlExpRef() and use xmlExpFree() to release them, + * this is true even in case of failure (unless ctxt == NULL). + * + * Returns the node or NULL in case of error + */ +xmlExpNodePtr +xmlExpNewOr(xmlExpCtxtPtr ctxt, xmlExpNodePtr left, xmlExpNodePtr right) { + if ((ctxt == NULL) || (left == NULL) || (right == NULL)) { + xmlExpFree(ctxt, left); + xmlExpFree(ctxt, right); + return(NULL); + } + return(xmlExpHashGetEntry(ctxt, XML_EXP_OR, left, right, NULL, 0, 0)); +} + +/** + * xmlExpNewSeq: + * @ctxt: the expression context + * @left: left expression + * @right: right expression + * + * Get the atom associated to the sequence @left , @right + * Note that @left and @right are consumed in the operation, to keep + * an handle on them use xmlExpRef() and use xmlExpFree() to release them, + * this is true even in case of failure (unless ctxt == NULL). + * + * Returns the node or NULL in case of error + */ +xmlExpNodePtr +xmlExpNewSeq(xmlExpCtxtPtr ctxt, xmlExpNodePtr left, xmlExpNodePtr right) { + if ((ctxt == NULL) || (left == NULL) || (right == NULL)) { + xmlExpFree(ctxt, left); + xmlExpFree(ctxt, right); + return(NULL); + } + return(xmlExpHashGetEntry(ctxt, XML_EXP_SEQ, left, right, NULL, 0, 0)); +} + +/** + * xmlExpNewRange: + * @ctxt: the expression context + * @subset: the expression to be repeated + * @min: the lower bound for the repetition + * @max: the upper bound for the repetition, -1 means infinite + * + * Get the atom associated to the range (@subset){@min, @max} + * Note that @subset is consumed in the operation, to keep + * an handle on it use xmlExpRef() and use xmlExpFree() to release it, + * this is true even in case of failure (unless ctxt == NULL). + * + * Returns the node or NULL in case of error + */ +xmlExpNodePtr +xmlExpNewRange(xmlExpCtxtPtr ctxt, xmlExpNodePtr subset, int min, int max) { + if ((ctxt == NULL) || (subset == NULL) || (min < 0) || (max < -1) || + ((max >= 0) && (min > max))) { + xmlExpFree(ctxt, subset); + return(NULL); + } + return(xmlExpHashGetEntry(ctxt, XML_EXP_COUNT, subset, + NULL, NULL, min, max)); +} + /************************************************************************ * * * Public API for operations on expressions * @@ -6748,6 +6832,16 @@ xmlExpExpDeriveInt(xmlExpCtxtPtr ctxt, xmlExpNodePtr exp, xmlExpNodePtr sub) { } } +#ifdef DEBUG_DERIV + printf("Fallback to derivative\n"); +#endif + if (IS_NILLABLE(sub)) { + if (!(IS_NILLABLE(exp))) + return(forbiddenExp); + else + ret = emptyExp; + } else + ret = NULL; /* * here the structured derivation made no progress so * we use the default token based derivation to force one more step @@ -6761,9 +6855,6 @@ xmlExpExpDeriveInt(xmlExpCtxtPtr ctxt, xmlExpNodePtr exp, xmlExpNodePtr sub) { return(NULL); } -#ifdef DEBUG_DERIV - printf("Fallback to derivative\n"); -#endif /* * collect all the strings accepted by the subexpression on input */ @@ -6780,7 +6871,6 @@ xmlExpExpDeriveInt(xmlExpCtxtPtr ctxt, xmlExpNodePtr exp, xmlExpNodePtr sub) { ctxt->tabSize *= 2; len = xmlExpGetStartInt(ctxt, sub, tab, ctxt->tabSize, 0); } - ret = NULL; for (i = 0;i < len;i++) { tmp = xmlExpStringDeriveInt(ctxt, exp, tab[i]); if ((tmp == NULL) || (tmp == forbiddenExp)) {