1
0
mirror of https://gitlab.gnome.org/GNOME/libxml2.git synced 2024-12-25 23:21:26 +03:00

Justin Fletcher found some parts of the code needing cleanup Fixed the

* parserInternals.c valid.c: Justin Fletcher found some parts
  of the code needing cleanup
* libxml.spec.in python/Makefile.am python/generator.py
  python/libxml.c python/libxml.py: Fixed the python Makefiles
  corrected a bug showing up on ia64, changed the name of the
  python internal module too
Daniel
This commit is contained in:
Daniel Veillard 2002-02-09 18:03:01 +00:00
parent b6c1e2f936
commit 5e5c2d0a93
8 changed files with 84 additions and 64 deletions

View File

@ -1,3 +1,12 @@
Sat Feb 9 18:59:23 CET 2002 Daniel Veillard <daniel@veillard.com>
* parserInternals.c valid.c: Justin Fletcher found some parts
of the code needing cleanup
* libxml.spec.in python/Makefile.am python/generator.py
python/libxml.c python/libxml.py: Fixed the python Makefiles
corrected a bug showing up on ia64, changed the name of the
python internal module too
Fri Feb 8 15:19:28 CET 2002 Daniel Veillard <daniel@veillard.com>
* Makefile.am: applied patch from Andris Pavenis for binary

View File

@ -143,7 +143,7 @@ rm -rf $RPM_BUILD_ROOT
%doc AUTHORS ChangeLog NEWS README Copyright
%{prefix}/lib/python*/site-packages/libxml2.py
%{prefix}/lib/python*/site-packages/_libxml.so
%{prefix}/lib/python*/site-packages/libxml2mod.so
%doc python/TODO
%doc python/libxml2class.txt
%doc python/tests/*.py

View File

@ -1074,7 +1074,7 @@ xmlParserInputShrink(xmlParserInputPtr in) {
xmlParserInputBufferRead(in->buf, 2 * INPUT_CHUNK);
if (in->base != in->buf->buffer->content) {
/*
* the buffer has been ereallocated
* the buffer has been reallocated
*/
indx = in->cur - in->base;
in->base = in->buf->buffer->content;

View File

@ -1,11 +1,14 @@
# Makefile for libxml2 python library
AUTOMAKE_OPTIONS = 1.4 foreign
SUBDIRS= . tests
LIBS=-L../.libs -L.. $(XML_LIBS)
INCLUDES=-I/usr/include/python$(PYTHON_VERSION) -I$(PYTHON_INCLUDES) -I$(top_srcdir)/include
SHCFLAGS=$(INCLUDES) -Wall -fPIC -g
LINK_FLAGS= -shared
DOCS_DIR = $(prefix)/share/doc/libxml2-python-$(LIBXML_VERSION)
INCLUDES = \
-I/usr/include/python$(PYTHON_VERSION) \
-I$(PYTHON_INCLUDES) \
-I$(top_srcdir)/include
DOCS_DIR = $(prefix)/share/doc/libxml2-python-$(LIBXML_VERSION)
DOCS = TODO libxml2class.txt
EXTRA_DIST = \
@ -18,31 +21,37 @@ EXTRA_DIST = \
$(DOCS)
if WITH_PYTHON
all: _libxml.so libxml2.py
mylibs = \
$(top_builddir)/libxml2.la
all: libxml2mod.so libxml2.py
LDADD = -lxml2
CFLAGS = -Wall -g
pythondir = $(prefix)/lib/python${PYTHON_VERSION}/site-packages
python_PROGRAMS = libxml2mod.so
libxml2mod_so_SOURCES =
libxml2mod_so_LDFLAGS = $(mylibs) $(LIBS) -shared -Wl,-soname,libxml2mod.so
noinst_LTLIBRARIES = libxmlmodule.la
libxmlmodule_la_SOURCES = libxml.c types.c libxml2-py.c
libxml2mod.so: $(libxmlmodule_la_OBJECTS)
$(LINK) -o $@ $(libxmlmodule_la_OBJECTS) $(libxml2mod_so_LDFLAGS)
libxml2.py: $(srcdir)/libxml.py libxml2class.py
cat $(srcdir)/libxml.py libxml2class.py > libxml2.py
_libxml.so: libxml.o libxml2-py.o types.o
$(CC) $(LINK_FLAGS) libxml.o libxml2-py.o types.o $(LIBS) -o _libxml.so
install-data-local:
$(mkinstalldirs) $(DESTDIR)$(PYTHON_SITE_PACKAGES)
-@INSTALL@ -m 0644 libxml2.py $(DESTDIR)$(PYTHON_SITE_PACKAGES)
-@INSTALL@ -m 0755 _libxml.so $(DESTDIR)$(PYTHON_SITE_PACKAGES)
$(mkinstalldirs) $(DESTDIR)$(DOCS_DIR)
-@(for doc in $(DOCS) ; \
do @INSTALL@ -m 0644 $$doc $(DESTDIR)$(DOCS_DIR) ; done)
libxml.o: libxml.c libxml2-export.c libxml_wrap.h
$(CC) $(SHCFLAGS) -c -o libxml.o $(srcdir)/libxml.c
types.o: types.c libxml_wrap.h
$(CC) $(SHCFLAGS) -c -o types.o $(srcdir)/types.c
libxml2-py.o: libxml2-py.c libxml2-py.h libxml_wrap.h
$(CC) $(SHCFLAGS) -c -o libxml2-py.o $(srcdir)/libxml2-py.c
GENERATE = generator.py
API_DESC = $(top_srcdir)/doc/libxml2-api.xml $(srcdir)/libxml2-python-api.xml
GENERATED= $(srcdir)/libxml2class.py \

View File

@ -378,7 +378,8 @@ def print_function_wrapper(name, output, export, include):
include.write("PyObject * ")
include.write("libxml_%s(PyObject *self, PyObject *args);\n" % (name))
export.write(" { \"%s\", libxml_%s, METH_VARARGS },\n" % (name, name))
export.write(" { \"%s\", libxml_%s, METH_VARARGS, NULL },\n" %
(name, name))
if file == "python":
# Those have been manually generated
@ -726,7 +727,7 @@ if function_classes.has_key("None"):
classes.write(" ret = ");
else:
classes.write(" ");
classes.write("_libxml.%s(" % name)
classes.write("libxml2mod.%s(" % name)
n = 0
for arg in args:
if n != 0:
@ -775,7 +776,7 @@ for classname in classes_list:
if classes_destructors.has_key(classname):
classes.write(" def __del__(self):\n")
classes.write(" if self._o != None:\n")
classes.write(" _libxml.%s(self._o)\n" %
classes.write(" libxml2mod.%s(self._o)\n" %
classes_destructors[classname]);
classes.write(" self._o = None\n\n");
flist = function_classes[classname]
@ -816,7 +817,7 @@ for classname in classes_list:
classes.write(" ret = ");
else:
classes.write(" ");
classes.write("_libxml.%s(" % name)
classes.write("libxml2mod.%s(" % name)
n = 0
for arg in args:
if n != 0:

View File

@ -1351,20 +1351,21 @@ libxml_xmlNodeGetNs(PyObject *self, PyObject *args) {
************************************************************************/
static PyMethodDef libxmlMethods[] = {
#include "libxml2-export.c"
{ "name", libxml_name, METH_VARARGS },
{ "children", libxml_children, METH_VARARGS },
{ "properties", libxml_properties, METH_VARARGS },
{ "last", libxml_last, METH_VARARGS },
{ "prev", libxml_prev, METH_VARARGS },
{ "next", libxml_next, METH_VARARGS },
{ "parent", libxml_parent, METH_VARARGS },
{ "type", libxml_type, METH_VARARGS },
{ "doc", libxml_doc, METH_VARARGS },
{ "name", libxml_name, METH_VARARGS, NULL },
{ "children", libxml_children, METH_VARARGS, NULL },
{ "properties", libxml_properties, METH_VARARGS, NULL },
{ "last", libxml_last, METH_VARARGS, NULL },
{ "prev", libxml_prev, METH_VARARGS, NULL },
{ "next", libxml_next, METH_VARARGS, NULL },
{ "parent", libxml_parent, METH_VARARGS, NULL },
{ "type", libxml_type, METH_VARARGS, NULL },
{ "doc", libxml_doc, METH_VARARGS, NULL },
{ NULL, NULL, NULL, NULL}
};
void init_libxml(void) {
void initlibxml2mod(void) {
PyObject *m;
m = Py_InitModule("_libxml", libxmlMethods);
m = Py_InitModule("libxml2mod", libxmlMethods);
libxml_xmlErrorInitialize();
}

View File

@ -1,4 +1,4 @@
import _libxml
import libxml2mod
#
# This class is the ancestor of all the Node classes. It provides
@ -15,43 +15,43 @@ class xmlCore:
def __getattr__(self, attr):
if attr == "parent":
ret = _libxml.parent(self._o)
ret = libxml2mod.parent(self._o)
if ret == None:
return None
return xmlNode(_obj=ret)
elif attr == "properties":
ret = _libxml.properties(self._o)
ret = libxml2mod.properties(self._o)
if ret == None:
return None
return xmlAttr(_obj=ret)
elif attr == "children":
ret = _libxml.children(self._o)
ret = libxml2mod.children(self._o)
if ret == None:
return None
return xmlNode(_obj=ret)
elif attr == "last":
ret = _libxml.last(self._o)
ret = libxml2mod.last(self._o)
if ret == None:
return None
return xmlNode(_obj=ret)
elif attr == "next":
ret = _libxml.next(self._o)
ret = libxml2mod.next(self._o)
if ret == None:
return None
return xmlNode(_obj=ret)
elif attr == "prev":
ret = _libxml.prev(self._o)
ret = libxml2mod.prev(self._o)
if ret == None:
return None
return xmlNode(_obj=ret)
elif attr == "content":
return _libxml.xmlNodeGetContent(self._o)
return libxml2mod.xmlNodeGetContent(self._o)
elif attr == "name":
return _libxml.name(self._o)
return libxml2mod.name(self._o)
elif attr == "type":
return _libxml.type(self._o)
return libxml2mod.type(self._o)
elif attr == "doc":
ret = _libxml.doc(self._o)
ret = libxml2mod.doc(self._o)
if ret == None:
return None
return xmlDoc(_doc=ret)
@ -61,62 +61,62 @@ class xmlCore:
# Those are common attributes to nearly all type of nodes
#
def get_parent(self):
ret = _libxml.parent(self._o)
ret = libxml2mod.parent(self._o)
if ret == None:
return None
return xmlNode(_obj=ret)
def get_children(self):
ret = _libxml.children(self._o)
ret = libxml2mod.children(self._o)
if ret == None:
return None
return xmlNode(_obj=ret)
def get_last(self):
ret = _libxml.last(self._o)
ret = libxml2mod.last(self._o)
if ret == None:
return None
return xmlNode(_obj=ret)
def get_next(self):
ret = _libxml.next(self._o)
ret = libxml2mod.next(self._o)
if ret == None:
return None
return xmlNode(_obj=ret)
def get_properties(self):
ret = _libxml.properties(self._o)
ret = libxml2mod.properties(self._o)
if ret == None:
return None
return xmlAttr(_obj=ret)
def get_doc(self):
ret = _libxml.doc(self._o)
ret = libxml2mod.doc(self._o)
if ret == None:
return None
return xmlDoc(_obj=ret)
def get_prev(self):
ret = _libxml.prev(self._o)
ret = libxml2mod.prev(self._o)
if ret == None:
return None
return xmlNode(_obj=ret)
def get_content(self):
return _libxml.xmlNodeGetContent(self._o)
return libxml2mod.xmlNodeGetContent(self._o)
def getContent(self):
return _libxml.xmlNodeGetContent(self._o)
return libxml2mod.xmlNodeGetContent(self._o)
def get_name(self):
return _libxml.name(self._o)
return libxml2mod.name(self._o)
def get_type(self):
return _libxml.type(self._o)
return libxml2mod.type(self._o)
def get_doc(self):
ret = _libxml.doc(self._o)
ret = libxml2mod.doc(self._o)
if ret == None:
return None
return xmlDoc(_doc=ret)
def free(self):
_libxml.freeDoc(self._o)
libxml2mod.freeDoc(self._o)
#
# converters to present a nicer view of the XPath returns
#
def nodeWrap(o):
# TODO try to cast to the most appropriate node class
name = _libxml.name(o)
name = libxml2mod.name(o)
if name == "element" or name == "text":
return xmlNode(_obj=o)
if name == "attribute":
@ -145,7 +145,7 @@ def xpathObjectRet(o):
# register an XPath function
#
def registerXPathFunction(ctxt, name, ns_uri, f):
ret = _libxml.xmlRegisterXPathFunction(ctxt, name, ns_uri, f)
ret = libxml2mod.xmlRegisterXPathFunction(ctxt, name, ns_uri, f)
#
# Everything below this point is automatically generated

View File

@ -4349,7 +4349,7 @@ xmlValidateOneElement(xmlValidCtxtPtr ctxt, xmlDocPtr doc,
}
if (cont == NULL) {
VERROR(ctxt->userData,
"Element %s is not declared in %s list of possible childs\n",
"Element %s is not declared in %s list of possible children\n",
name, elem->name);
ret = 0;
}
@ -4935,7 +4935,7 @@ xmlValidGetValidElements(xmlNode *prev, xmlNode *next, const xmlChar **list,
int nb_valid_elements = 0;
const xmlChar *elements[256];
int nb_elements = 0, i;
xmlChar *name;
const xmlChar *name;
xmlNode *ref_node;
xmlNode *parent;