mirror of
https://gitlab.gnome.org/GNOME/libxml2.git
synced 2024-10-26 12:25:09 +03:00
cleanup always use stdout if output is NULL don't close filedescriptors
* Makefile.am: cleanup * debugXML.c: always use stdout if output is NULL * xmlIO.c: don't close filedescriptors passed to outputBuffers * python/Makefile.am python/generator.py python/libxml2class.txt python/libxml_wrap.h python/types.c: augmented the number of bindings handling FILE * and XPath contexts * python/tests/Makefile.am: avoid a stupid problem due to the use of TEST. Daniel
This commit is contained in:
parent
15a143b36a
commit
7db3871bf5
11
ChangeLog
11
ChangeLog
@ -1,3 +1,14 @@
|
||||
Thu Feb 7 17:33:58 CET 2002 Daniel Veillard <daniel@veillard.com>
|
||||
|
||||
* Makefile.am: cleanup
|
||||
* debugXML.c: always use stdout if output is NULL
|
||||
* xmlIO.c: don't close filedescriptors passed to outputBuffers
|
||||
* python/Makefile.am python/generator.py python/libxml2class.txt
|
||||
python/libxml_wrap.h python/types.c: augmented the number of bindings
|
||||
handling FILE * and XPath contexts
|
||||
* python/tests/Makefile.am: avoid a stupid problem due to the
|
||||
use of TEST.
|
||||
|
||||
Wed Feb 6 23:37:07 CET 2002 Daniel Veillard <daniel@veillard.com>
|
||||
|
||||
* configure.in: fixed stupid bug #70738 found by alfons hoogervorst
|
||||
|
@ -552,8 +552,8 @@ dist-hook: libxml.spec
|
||||
cleantar:
|
||||
@(rm -f libxslt*.tar.gz)
|
||||
|
||||
rpm: cleantar dist
|
||||
rpm -ta $(distdir).tar.gz
|
||||
rpm: cleantar
|
||||
@(unset CDPATH ; $(MAKE) dist && rpm -ta $(distdir).tar.gz)
|
||||
|
||||
## We create xml2Conf.sh here and not from configure because we want
|
||||
## to get the paths expanded correctly. Macros like srcdir are given
|
||||
|
12
debugXML.c
12
debugXML.c
@ -40,6 +40,8 @@ xmlDebugDumpString(FILE * output, const xmlChar * str)
|
||||
{
|
||||
int i;
|
||||
|
||||
if (output == NULL)
|
||||
output = stdout;
|
||||
if (str == NULL) {
|
||||
fprintf(output, "(NULL)");
|
||||
return;
|
||||
@ -558,6 +560,8 @@ xmlDebugDumpAttr(FILE *output, xmlAttrPtr attr, int depth) {
|
||||
void
|
||||
xmlDebugDumpAttrList(FILE * output, xmlAttrPtr attr, int depth)
|
||||
{
|
||||
if (output == NULL)
|
||||
output = stdout;
|
||||
while (attr != NULL) {
|
||||
xmlDebugDumpAttr(output, attr, depth);
|
||||
attr = attr->next;
|
||||
@ -578,6 +582,8 @@ xmlDebugDumpOneNode(FILE * output, xmlNodePtr node, int depth)
|
||||
int i;
|
||||
char shift[100];
|
||||
|
||||
if (output == NULL)
|
||||
output = stdout;
|
||||
for (i = 0; ((i < depth) && (i < 25)); i++)
|
||||
shift[2 * i] = shift[2 * i + 1] = ' ';
|
||||
shift[2 * i] = shift[2 * i + 1] = 0;
|
||||
@ -740,6 +746,8 @@ xmlDebugDumpOneNode(FILE * output, xmlNodePtr node, int depth)
|
||||
void
|
||||
xmlDebugDumpNode(FILE * output, xmlNodePtr node, int depth)
|
||||
{
|
||||
if (output == NULL)
|
||||
output = stdout;
|
||||
if (node == NULL) {
|
||||
int i;
|
||||
char shift[100];
|
||||
@ -768,6 +776,8 @@ xmlDebugDumpNode(FILE * output, xmlNodePtr node, int depth)
|
||||
void
|
||||
xmlDebugDumpNodeList(FILE * output, xmlNodePtr node, int depth)
|
||||
{
|
||||
if (output == NULL)
|
||||
output = stdout;
|
||||
while (node != NULL) {
|
||||
xmlDebugDumpNode(output, node, depth);
|
||||
node = node->next;
|
||||
@ -893,6 +903,8 @@ xmlDebugDumpDocument(FILE * output, xmlDocPtr doc)
|
||||
void
|
||||
xmlDebugDumpDTD(FILE * output, xmlDtdPtr dtd)
|
||||
{
|
||||
if (output == NULL)
|
||||
output = stdout;
|
||||
if (dtd == NULL) {
|
||||
fprintf(output, "DTD is NULL\n");
|
||||
return;
|
||||
|
@ -33,9 +33,6 @@ install-data-local:
|
||||
$(mkinstalldirs) $(DESTDIR)$(DOCS_DIR)
|
||||
-@(for doc in $(DOCS) ; \
|
||||
do @INSTALL@ -m 0644 $$doc $(DESTDIR)$(DOCS_DIR) ; done)
|
||||
else
|
||||
all:
|
||||
endif
|
||||
|
||||
libxml.o: libxml.c libxml2-export.c libxml_wrap.h
|
||||
$(CC) $(SHCFLAGS) -c -o libxml.o $(srcdir)/libxml.c
|
||||
@ -55,6 +52,9 @@ GENERATED= $(srcdir)/libxml2class.py \
|
||||
|
||||
$(GENERATED): $(srcdir)/$(GENERATE) $(API_DESC)
|
||||
cd $(srcdir) && $(PYTHON) $(GENERATE)
|
||||
else
|
||||
all:
|
||||
endif
|
||||
|
||||
tests: all
|
||||
cd tests && $(MAKE) tests
|
||||
|
@ -259,10 +259,13 @@ py_types = {
|
||||
'const htmlNode *': ('O', "xmlNode", "xmlNodePtr", "xmlNodePtr"),
|
||||
'xmlXPathContextPtr': ('O', "xmlXPathContext", "xmlXPathContextPtr", "xmlXPathContextPtr"),
|
||||
'xmlXPathContext *': ('O', "xpathContext", "xmlXPathContextPtr", "xmlXPathContextPtr"),
|
||||
'xmlXPathParserContextPtr': ('O', "xmlXPathParserContext", "xmlXPathParserContextPtr", "xmlXPathParserContextPtr"),
|
||||
'xmlParserCtxtPtr': ('O', "parserCtxt", "xmlParserCtxtPtr", "xmlParserCtxtPtr"),
|
||||
'xmlParserCtxt *': ('O', "parserCtxt", "xmlParserCtxtPtr", "xmlParserCtxtPtr"),
|
||||
'htmlParserCtxtPtr': ('O', "parserCtxt", "xmlParserCtxtPtr", "xmlParserCtxtPtr"),
|
||||
'htmlParserCtxt *': ('O', "parserCtxt", "xmlParserCtxtPtr", "xmlParserCtxtPtr"),
|
||||
'xmlCatalogPtr': ('O', "catalog", "xmlCatalogPtr", "xmlCatalogPtr"),
|
||||
'FILE *': ('O', "File", "FILEPtr", "FILE *"),
|
||||
}
|
||||
|
||||
py_return_types = {
|
||||
@ -459,7 +462,10 @@ wrapper.close()
|
||||
|
||||
print "Generated %d wrapper functions, %d failed, %d skipped\n" % (nb_wrap,
|
||||
failed, skipped);
|
||||
print "Missing type converters: %s" % (unknown_types.keys())
|
||||
print "Missing type converters: "
|
||||
for type in unknown_types.keys():
|
||||
print "%s:%d " % (type, len(unknown_types[type])),
|
||||
print
|
||||
|
||||
#######################################################################
|
||||
#
|
||||
@ -492,8 +498,12 @@ classes_type = {
|
||||
"xmlAttributePtr": ("._o", "xmlAttribute(_obj=%s)", "xmlAttribute"),
|
||||
"xmlAttribute *": ("._o", "xmlAttribute(_obj=%s)", "xmlAttribute"),
|
||||
"xmlXPathContextPtr": ("._o", "xpathContext(_obj=%s)", "xpathContext"),
|
||||
"xmlXPathContext *": ("._o", "xpathContext(_obj=%s)", "xpathContext"),
|
||||
"xmlXPathParserContext *": ("._o", "xpathParserContext(_obj=%s)", "xpathParserContext"),
|
||||
"xmlXPathParserContextPtr": ("._o", "xpathParserContext(_obj=%s)", "xpathParserContext"),
|
||||
"xmlParserCtxtPtr": ("._o", "parserCtxt(_obj=%s)", "parserCtxt"),
|
||||
"xmlParserCtxt *": ("._o", "parserCtxt(_obj=%s)", "parserCtxt"),
|
||||
"xmlCatalogPtr": ("._o", "catalog(_obj=%s)", "catalog"),
|
||||
}
|
||||
|
||||
converter_type = {
|
||||
@ -515,6 +525,7 @@ classes_ancestor = {
|
||||
classes_destructors = {
|
||||
"xpathContext": "xmlXPathFreeContext",
|
||||
"parserCtxt": "xmlFreeParserCtxt",
|
||||
"catalog": "xmlFreeCatalog",
|
||||
}
|
||||
|
||||
function_classes = {}
|
||||
@ -565,6 +576,9 @@ def nameFixup(function, classe, type, file):
|
||||
elif name[0:10] == "xmlNodeGet" and file == "python_accessor":
|
||||
func = name[10:]
|
||||
func = string.lower(func[0:1]) + func[1:]
|
||||
elif name[0:11] == "xmlACatalog":
|
||||
func = name[11:]
|
||||
func = string.lower(func[0:1]) + func[1:]
|
||||
elif name[0:l] == classe:
|
||||
func = name[l:]
|
||||
func = string.lower(func[0:1]) + func[1:]
|
||||
|
@ -23,6 +23,7 @@ htmlNewDocNoDtD()
|
||||
catalogAdd()
|
||||
catalogCleanup()
|
||||
catalogConvert()
|
||||
catalogDump()
|
||||
catalogGetPublic()
|
||||
catalogGetSystem()
|
||||
catalogRemove()
|
||||
@ -32,11 +33,15 @@ catalogResolveSystem()
|
||||
catalogResolveURI()
|
||||
catalogSetDebug()
|
||||
initializeCatalog()
|
||||
loadACatalog()
|
||||
loadCatalog()
|
||||
loadCatalogs()
|
||||
loadSGMLSuperCatalog()
|
||||
newCatalog()
|
||||
parseCatalogFile()
|
||||
|
||||
# functions from module debugXML
|
||||
debugDumpString()
|
||||
shellPrintXPathError()
|
||||
|
||||
# functions from module encoding
|
||||
@ -147,6 +152,9 @@ registerHTTPPostCallbacks()
|
||||
# functions from module xmlversion
|
||||
checkVersion()
|
||||
|
||||
# functions from module xpathInternals
|
||||
valuePop()
|
||||
|
||||
|
||||
#
|
||||
# Set of classes of the module
|
||||
@ -160,7 +168,11 @@ Class xmlNode(xmlCore)
|
||||
nsDefs()
|
||||
|
||||
# functions from module debugXML
|
||||
debugDumpNode()
|
||||
debugDumpNodeList()
|
||||
debugDumpOneNode()
|
||||
lsCountNode()
|
||||
lsOneNode()
|
||||
shellPrintNode()
|
||||
|
||||
# functions from module tree
|
||||
@ -233,6 +245,19 @@ Class xmlNode(xmlCore)
|
||||
# functions from module xpathInternals
|
||||
xpathNewNodeSet()
|
||||
xpathNewValueTree()
|
||||
xpathNextAncestor()
|
||||
xpathNextAncestorOrSelf()
|
||||
xpathNextAttribute()
|
||||
xpathNextChild()
|
||||
xpathNextDescendant()
|
||||
xpathNextDescendantOrSelf()
|
||||
xpathNextFollowing()
|
||||
xpathNextFollowingSibling()
|
||||
xpathNextNamespace()
|
||||
xpathNextParent()
|
||||
xpathNextPreceding()
|
||||
xpathNextPrecedingSibling()
|
||||
xpathNextSelf()
|
||||
|
||||
|
||||
Class xmlDoc(xmlNode)
|
||||
@ -242,12 +267,20 @@ Class xmlDoc(xmlNode)
|
||||
htmlIsAutoClosed()
|
||||
|
||||
# functions from module HTMLtree
|
||||
htmlDocDump()
|
||||
htmlGetMetaEncoding()
|
||||
htmlNodeDumpFile()
|
||||
htmlNodeDumpFileFormat()
|
||||
htmlSaveFile()
|
||||
htmlSaveFileEnc()
|
||||
htmlSaveFileFormat()
|
||||
htmlSetMetaEncoding()
|
||||
|
||||
# functions from module debugXML
|
||||
debugDumpDocument()
|
||||
debugDumpDocumentHead()
|
||||
debugDumpEntities()
|
||||
|
||||
# functions from module entities
|
||||
addDocEntity()
|
||||
addDtdEntity()
|
||||
@ -262,6 +295,8 @@ Class xmlDoc(xmlNode)
|
||||
copyDoc()
|
||||
createIntSubset()
|
||||
docCompressMode()
|
||||
dump()
|
||||
elemDump()
|
||||
freeDoc()
|
||||
getRootElement()
|
||||
intSubset()
|
||||
@ -298,7 +333,7 @@ Class xmlDoc(xmlNode)
|
||||
xpathNewContext()
|
||||
|
||||
|
||||
Class xmlEntity(xmlNode)
|
||||
Class xmlAttribute(xmlNode)
|
||||
|
||||
|
||||
Class xmlNs(xmlNode)
|
||||
@ -311,19 +346,11 @@ Class xmlNs(xmlNode)
|
||||
newNode()
|
||||
|
||||
|
||||
Class xmlAttr(xmlNode)
|
||||
|
||||
# functions from module tree
|
||||
freeProp()
|
||||
freePropList()
|
||||
removeProp()
|
||||
|
||||
|
||||
Class xmlAttribute(xmlNode)
|
||||
|
||||
|
||||
Class xmlDtd(xmlNode)
|
||||
|
||||
# functions from module debugXML
|
||||
debugDumpDTD()
|
||||
|
||||
# functions from module tree
|
||||
copyDtd()
|
||||
freeDtd()
|
||||
@ -333,9 +360,65 @@ Class xmlDtd(xmlNode)
|
||||
dtdElementDesc()
|
||||
dtdQAttrDesc()
|
||||
dtdQElementDesc()
|
||||
Class catalog()
|
||||
|
||||
# functions from module catalog
|
||||
add()
|
||||
catalogIsEmpty()
|
||||
convertSGMLCatalog()
|
||||
dump()
|
||||
freeCatalog()
|
||||
remove()
|
||||
resolve()
|
||||
resolvePublic()
|
||||
resolveSystem()
|
||||
resolveURI()
|
||||
Class xpathParserContext()
|
||||
|
||||
Class xmlElement(xmlNode)
|
||||
# functions from module xpathInternals
|
||||
xpathAddValues()
|
||||
xpathBooleanFunction()
|
||||
xpathCeilingFunction()
|
||||
xpathCompareValues()
|
||||
xpathConcatFunction()
|
||||
xpathContainsFunction()
|
||||
xpathCountFunction()
|
||||
xpathDivValues()
|
||||
xpathEqualValues()
|
||||
xpathEvalExpr()
|
||||
xpathFalseFunction()
|
||||
xpathFloorFunction()
|
||||
xpathFreeParserContext()
|
||||
xpathIdFunction()
|
||||
xpathLangFunction()
|
||||
xpathLastFunction()
|
||||
xpathLocalNameFunction()
|
||||
xpathModValues()
|
||||
xpathMultValues()
|
||||
xpathNamespaceURIFunction()
|
||||
xpathNormalizeFunction()
|
||||
xpathNotFunction()
|
||||
xpathNumberFunction()
|
||||
xpathParseNCName()
|
||||
xpathParseName()
|
||||
xpathPopBoolean()
|
||||
xpathPopNumber()
|
||||
xpathPopString()
|
||||
xpathPositionFunction()
|
||||
xpathRoot()
|
||||
xpathRoundFunction()
|
||||
xpathStartsWithFunction()
|
||||
xpathStringFunction()
|
||||
xpathStringLengthFunction()
|
||||
xpathSubValues()
|
||||
xpathSubstringAfterFunction()
|
||||
xpathSubstringBeforeFunction()
|
||||
xpathSubstringFunction()
|
||||
xpathSumFunction()
|
||||
xpathTranslateFunction()
|
||||
xpathTrueFunction()
|
||||
xpathValueFlipSign()
|
||||
xpatherror()
|
||||
Class parserCtxt()
|
||||
# accessors
|
||||
doc()
|
||||
@ -358,7 +441,6 @@ Class parserCtxt()
|
||||
# functions from module parserInternals
|
||||
decodeEntities()
|
||||
freeParserCtxt()
|
||||
handleEntity()
|
||||
namespaceParseNCName()
|
||||
namespaceParseNSDef()
|
||||
nextChar()
|
||||
@ -403,6 +485,27 @@ Class parserCtxt()
|
||||
scanName()
|
||||
skipBlankChars()
|
||||
stringDecodeEntities()
|
||||
|
||||
|
||||
Class xmlElement(xmlNode)
|
||||
|
||||
|
||||
Class xmlEntity(xmlNode)
|
||||
|
||||
# functions from module parserInternals
|
||||
handleEntity()
|
||||
|
||||
|
||||
Class xmlAttr(xmlNode)
|
||||
|
||||
# functions from module debugXML
|
||||
debugDumpAttr()
|
||||
debugDumpAttrList()
|
||||
|
||||
# functions from module tree
|
||||
freeProp()
|
||||
freePropList()
|
||||
removeProp()
|
||||
Class xpathContext()
|
||||
|
||||
# functions from module python
|
||||
@ -414,6 +517,7 @@ Class xpathContext()
|
||||
|
||||
# functions from module xpathInternals
|
||||
xpathFreeContext()
|
||||
xpathNewParserContext()
|
||||
xpathNsLookup()
|
||||
xpathRegisterAllFunctions()
|
||||
xpathRegisterNs()
|
||||
|
@ -31,6 +31,14 @@ typedef struct {
|
||||
xmlXPathContextPtr obj;
|
||||
} PyxmlXPathContext_Object;
|
||||
|
||||
#define PyxmlXPathParserContext_Get(v) (((v) == Py_None) ? NULL : \
|
||||
(((PyxmlXPathParserContext_Object *)(v))->obj))
|
||||
|
||||
typedef struct {
|
||||
PyObject_HEAD
|
||||
xmlXPathParserContextPtr obj;
|
||||
} PyxmlXPathParserContext_Object;
|
||||
|
||||
#define PyparserCtxt_Get(v) (((v) == Py_None) ? NULL : \
|
||||
(((PyparserCtxt_Object *)(v))->obj))
|
||||
|
||||
@ -39,6 +47,17 @@ typedef struct {
|
||||
xmlParserCtxtPtr obj;
|
||||
} PyparserCtxt_Object;
|
||||
|
||||
#define Pycatalog_Get(v) (((v) == Py_None) ? NULL : \
|
||||
(((Pycatalog_Object *)(v))->obj))
|
||||
|
||||
typedef struct {
|
||||
PyObject_HEAD
|
||||
xmlCatalogPtr obj;
|
||||
} Pycatalog_Object;
|
||||
|
||||
#define PyFile_Get(v) (((v) == Py_None) ? NULL : \
|
||||
(PyFile_Check(v) ? NULL : (PyFile_AsFile(v))))
|
||||
|
||||
PyObject * libxml_intWrap(int val);
|
||||
PyObject * libxml_longWrap(long val);
|
||||
PyObject * libxml_xmlCharPtrWrap(xmlChar *str);
|
||||
@ -54,6 +73,8 @@ PyObject * libxml_xmlElementPtrWrap(xmlElementPtr ns);
|
||||
PyObject * libxml_doubleWrap(double val);
|
||||
PyObject * libxml_xmlXPathContextPtrWrap(xmlXPathContextPtr ctxt);
|
||||
PyObject * libxml_xmlParserCtxtPtrWrap(xmlParserCtxtPtr ctxt);
|
||||
PyObject * libxml_xmlXPathParserContextPtrWrap(xmlXPathParserContextPtr ctxt);
|
||||
PyObject * libxml_xmlXPathObjectPtrWrap(xmlXPathObjectPtr obj);
|
||||
PyObject * libxml_xmlCatalogPtrWrap(xmlCatalogPtr obj);
|
||||
|
||||
xmlXPathObjectPtr libxml_xmlXPathObjectPtrConvert(PyObject * obj);
|
||||
|
@ -1,6 +1,6 @@
|
||||
EXAMPLE_DIR = $(prefix)/share/doc/libxml2-python-$(LIBXML_VERSION)/examples
|
||||
|
||||
TESTS= \
|
||||
PYTESTS= \
|
||||
build.py \
|
||||
tst.py \
|
||||
tstxpath.py \
|
||||
@ -16,12 +16,12 @@ XMLS= \
|
||||
valid.xml \
|
||||
invalid.xml
|
||||
|
||||
EXTRA_DIST = $(TESTS) $(XMLS)
|
||||
EXTRA_DIST = $(TESTSPY) $(XMLS)
|
||||
|
||||
if WITH_PYTHON
|
||||
tests: $(TESTS)
|
||||
tests: $(TESTSPY)
|
||||
-@(PYTHONPATH=".." ; export PYTHONPATH; \
|
||||
for test in $(TESTS) ; do echo "-- $$test" ; $(PYTHON) $$test ; done)
|
||||
for test in $(TESTSPY) ; do echo "-- $$test" ; $(PYTHON) $$test ; done)
|
||||
else
|
||||
tests:
|
||||
endif
|
||||
@ -31,6 +31,6 @@ clean:
|
||||
|
||||
install-data-local:
|
||||
$(mkinstalldirs) $(DESTDIR)$(EXAMPLE_DIR)
|
||||
-(for test in $(TESTS) $(XMLS); \
|
||||
-(for test in $(TESTSPY) $(XMLS); \
|
||||
do @INSTALL@ -m 0644 $$test $(DESTDIR)$(EXAMPLE_DIR) ; done)
|
||||
|
||||
|
@ -214,6 +214,23 @@ libxml_xmlXPathContextPtrWrap(xmlXPathContextPtr ctxt) {
|
||||
return(ret);
|
||||
}
|
||||
|
||||
PyObject *
|
||||
libxml_xmlXPathParserContextPtrWrap(xmlXPathParserContextPtr ctxt)
|
||||
{
|
||||
PyObject *ret;
|
||||
|
||||
#ifdef DEBUG
|
||||
printf("libxml_xmlXPathParserContextPtrWrap: ctxt = %p\n", ctxt);
|
||||
#endif
|
||||
if (ctxt == NULL) {
|
||||
Py_INCREF(Py_None);
|
||||
return (Py_None);
|
||||
}
|
||||
ret = PyCObject_FromVoidPtrAndDesc((void *) ctxt,
|
||||
"xmlXPathParserContextPtr", NULL);
|
||||
return (ret);
|
||||
}
|
||||
|
||||
PyObject *
|
||||
libxml_xmlParserCtxtPtrWrap(xmlParserCtxtPtr ctxt) {
|
||||
PyObject *ret;
|
||||
@ -305,4 +322,19 @@ libxml_xmlXPathObjectPtrConvert(PyObject * obj) {
|
||||
return(ret);
|
||||
}
|
||||
|
||||
PyObject *
|
||||
libxml_xmlCatalogPtrWrap(xmlCatalogPtr catal) {
|
||||
PyObject *ret;
|
||||
|
||||
#ifdef DEBUG
|
||||
printf("libxml_xmlNodePtrWrap: catal = %p\n", catal);
|
||||
#endif
|
||||
if (catal == NULL) {
|
||||
Py_INCREF(Py_None);
|
||||
return(Py_None);
|
||||
}
|
||||
ret = PyCObject_FromVoidPtrAndDesc((void *) catal, "xmlCatalogPtr", NULL);
|
||||
return(ret);
|
||||
}
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user