mirror of
https://gitlab.gnome.org/GNOME/libxslt
synced 2025-07-31 02:43:06 +03:00
removed tab used spaces preparing 1.0.12 rebuild/updated Daniel
* python/*.py: removed tab used spaces * configure.in libxslt/xsltwin32config.h: preparing 1.0.12 * doc/news.html doc/xslt.html: rebuild/updated Daniel
This commit is contained in:
@ -1,3 +1,9 @@
|
|||||||
|
Mon Feb 11 19:40:34 CET 2002 Daniel Veillard <daniel@veillard.com>
|
||||||
|
|
||||||
|
* python/*.py: removed tab used spaces
|
||||||
|
* configure.in libxslt/xsltwin32config.h: preparing 1.0.12
|
||||||
|
* doc/news.html doc/xslt.html: rebuild/updated
|
||||||
|
|
||||||
Mon Feb 11 16:34:37 CET 2002 Daniel Veillard <daniel@veillard.com>
|
Mon Feb 11 16:34:37 CET 2002 Daniel Veillard <daniel@veillard.com>
|
||||||
|
|
||||||
* tests/docs/Makefile.am tests/docs/bug-73.xml
|
* tests/docs/Makefile.am tests/docs/bug-73.xml
|
||||||
|
@ -6,12 +6,12 @@ dnl libexslt is an extension
|
|||||||
dnl
|
dnl
|
||||||
LIBXSLT_MAJOR_VERSION=1
|
LIBXSLT_MAJOR_VERSION=1
|
||||||
LIBXSLT_MINOR_VERSION=0
|
LIBXSLT_MINOR_VERSION=0
|
||||||
LIBXSLT_MICRO_VERSION=11
|
LIBXSLT_MICRO_VERSION=12
|
||||||
PACKAGE=libxslt
|
PACKAGE=libxslt
|
||||||
LIBEXSLT_MAJOR_VERSION=0
|
LIBEXSLT_MAJOR_VERSION=0
|
||||||
LIBEXSLT_MINOR_VERSION=7
|
LIBEXSLT_MINOR_VERSION=7
|
||||||
LIBEXSLT_MICRO_VERSION=4
|
LIBEXSLT_MICRO_VERSION=4
|
||||||
LIBXML_REQUIRED_VERSION=2.4.14
|
LIBXML_REQUIRED_VERSION=2.4.15
|
||||||
|
|
||||||
|
|
||||||
LIBXSLT_VERSION=$LIBXSLT_MAJOR_VERSION.$LIBXSLT_MINOR_VERSION.$LIBXSLT_MICRO_VERSION
|
LIBXSLT_VERSION=$LIBXSLT_MAJOR_VERSION.$LIBXSLT_MINOR_VERSION.$LIBXSLT_MICRO_VERSION
|
||||||
|
@ -75,6 +75,11 @@ A:link, A:visited, A:active { text-decoration: underline }
|
|||||||
<td valign="top" bgcolor="#8b7765"><table border="0" cellspacing="0" cellpadding="1" width="100%"><tr><td><table border="0" cellspacing="0" cellpadding="1" width="100%" bgcolor="#000000"><tr><td><table border="0" cellpadding="3" cellspacing="1" width="100%"><tr><td bgcolor="#fffacd">
|
<td valign="top" bgcolor="#8b7765"><table border="0" cellspacing="0" cellpadding="1" width="100%"><tr><td><table border="0" cellspacing="0" cellpadding="1" width="100%" bgcolor="#000000"><tr><td><table border="0" cellpadding="3" cellspacing="1" width="100%"><tr><td bgcolor="#fffacd">
|
||||||
<h3>CVS only : check the <a href="http://cvs.gnome.org/lxr/source/libxslt/ChangeLog">Changelog</a> file
|
<h3>CVS only : check the <a href="http://cvs.gnome.org/lxr/source/libxslt/ChangeLog">Changelog</a> file
|
||||||
for a really accurate description</h3>
|
for a really accurate description</h3>
|
||||||
|
<h3>1.0.12: Feb 11 2002</h3>
|
||||||
|
<ul>
|
||||||
|
<li>Fixed the makefiles especially the python module ones</li>
|
||||||
|
<li>half a dozen bugs fixes including 2 old ones</li>
|
||||||
|
</ul>
|
||||||
<h3>1.0.11: Feb 8 2002</h3>
|
<h3>1.0.11: Feb 8 2002</h3>
|
||||||
<ul>
|
<ul>
|
||||||
<li>Change of Licence to the <a href="http://www.opensource.org/licenses/mit-license.html">MIT
|
<li>Change of Licence to the <a href="http://www.opensource.org/licenses/mit-license.html">MIT
|
||||||
|
@ -234,6 +234,12 @@ platform, get in touch with me to upload the package. I will keep them in the
|
|||||||
href="http://cvs.gnome.org/lxr/source/libxslt/ChangeLog">Changelog</a> file
|
href="http://cvs.gnome.org/lxr/source/libxslt/ChangeLog">Changelog</a> file
|
||||||
for a really accurate description</h3>
|
for a really accurate description</h3>
|
||||||
|
|
||||||
|
<h3>1.0.12: Feb 11 2002</h3>
|
||||||
|
<ul>
|
||||||
|
<li>Fixed the makefiles especially the python module ones</li>
|
||||||
|
<li>half a dozen bugs fixes including 2 old ones</li>
|
||||||
|
</ul>
|
||||||
|
|
||||||
<h3>1.0.11: Feb 8 2002</h3>
|
<h3>1.0.11: Feb 8 2002</h3>
|
||||||
<ul>
|
<ul>
|
||||||
<li>Change of Licence to the <a
|
<li>Change of Licence to the <a
|
||||||
|
@ -21,21 +21,21 @@ extern "C" {
|
|||||||
*
|
*
|
||||||
* the version string like "1.2.3"
|
* the version string like "1.2.3"
|
||||||
*/
|
*/
|
||||||
#define LIBXSLT_DOTTED_VERSION "1.0.11"
|
#define LIBXSLT_DOTTED_VERSION "1.0.12"
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* LIBXSLT_VERSION:
|
* LIBXSLT_VERSION:
|
||||||
*
|
*
|
||||||
* the version number: 1.2.3 value is 1002003
|
* the version number: 1.2.3 value is 1002003
|
||||||
*/
|
*/
|
||||||
#define LIBXSLT_VERSION 10011
|
#define LIBXSLT_VERSION 10012
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* LIBXSLT_VERSION_STRING:
|
* LIBXSLT_VERSION_STRING:
|
||||||
*
|
*
|
||||||
* the version number string, 1.2.3 value is "1002003"
|
* the version number string, 1.2.3 value is "1002003"
|
||||||
*/
|
*/
|
||||||
#define LIBXSLT_VERSION_STRING "10011"
|
#define LIBXSLT_VERSION_STRING "10012"
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* WITH_XSLT_DEBUG:
|
* WITH_XSLT_DEBUG:
|
||||||
|
@ -24,37 +24,37 @@ debug = 0
|
|||||||
|
|
||||||
if sgmlop:
|
if sgmlop:
|
||||||
class FastParser:
|
class FastParser:
|
||||||
"""sgmlop based XML parser. this is typically 15x faster
|
"""sgmlop based XML parser. this is typically 15x faster
|
||||||
than SlowParser..."""
|
than SlowParser..."""
|
||||||
|
|
||||||
def __init__(self, target):
|
def __init__(self, target):
|
||||||
|
|
||||||
# setup callbacks
|
# setup callbacks
|
||||||
self.finish_starttag = target.start
|
self.finish_starttag = target.start
|
||||||
self.finish_endtag = target.end
|
self.finish_endtag = target.end
|
||||||
self.handle_data = target.data
|
self.handle_data = target.data
|
||||||
|
|
||||||
# activate parser
|
# activate parser
|
||||||
self.parser = sgmlop.XMLParser()
|
self.parser = sgmlop.XMLParser()
|
||||||
self.parser.register(self)
|
self.parser.register(self)
|
||||||
self.feed = self.parser.feed
|
self.feed = self.parser.feed
|
||||||
self.entity = {
|
self.entity = {
|
||||||
"amp": "&", "gt": ">", "lt": "<",
|
"amp": "&", "gt": ">", "lt": "<",
|
||||||
"apos": "'", "quot": '"'
|
"apos": "'", "quot": '"'
|
||||||
}
|
}
|
||||||
|
|
||||||
def close(self):
|
def close(self):
|
||||||
try:
|
try:
|
||||||
self.parser.close()
|
self.parser.close()
|
||||||
finally:
|
finally:
|
||||||
self.parser = self.feed = None # nuke circular reference
|
self.parser = self.feed = None # nuke circular reference
|
||||||
|
|
||||||
def handle_entityref(self, entity):
|
def handle_entityref(self, entity):
|
||||||
# <string> entity
|
# <string> entity
|
||||||
try:
|
try:
|
||||||
self.handle_data(self.entity[entity])
|
self.handle_data(self.entity[entity])
|
||||||
except KeyError:
|
except KeyError:
|
||||||
self.handle_data("&%s;" % entity)
|
self.handle_data("&%s;" % entity)
|
||||||
|
|
||||||
else:
|
else:
|
||||||
FastParser = None
|
FastParser = None
|
||||||
@ -65,106 +65,106 @@ class SlowParser(xmllib.XMLParser):
|
|||||||
Python's standard library."""
|
Python's standard library."""
|
||||||
|
|
||||||
def __init__(self, target):
|
def __init__(self, target):
|
||||||
self.unknown_starttag = target.start
|
self.unknown_starttag = target.start
|
||||||
self.handle_data = target.data
|
self.handle_data = target.data
|
||||||
self.unknown_endtag = target.end
|
self.unknown_endtag = target.end
|
||||||
xmllib.XMLParser.__init__(self)
|
xmllib.XMLParser.__init__(self)
|
||||||
|
|
||||||
def getparser(target = None):
|
def getparser(target = None):
|
||||||
# get the fastest available parser, and attach it to an
|
# get the fastest available parser, and attach it to an
|
||||||
# unmarshalling object. return both objects.
|
# unmarshalling object. return both objects.
|
||||||
if target == None:
|
if target == None:
|
||||||
target = docParser()
|
target = docParser()
|
||||||
if FastParser:
|
if FastParser:
|
||||||
return FastParser(target), target
|
return FastParser(target), target
|
||||||
return SlowParser(target), target
|
return SlowParser(target), target
|
||||||
|
|
||||||
class docParser:
|
class docParser:
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
self._methodname = None
|
self._methodname = None
|
||||||
self._data = []
|
self._data = []
|
||||||
self.in_function = 0
|
self.in_function = 0
|
||||||
|
|
||||||
def close(self):
|
def close(self):
|
||||||
if debug:
|
if debug:
|
||||||
print "close"
|
print "close"
|
||||||
|
|
||||||
def getmethodname(self):
|
def getmethodname(self):
|
||||||
return self._methodname
|
return self._methodname
|
||||||
|
|
||||||
def data(self, text):
|
def data(self, text):
|
||||||
if debug:
|
if debug:
|
||||||
print "data %s" % text
|
print "data %s" % text
|
||||||
self._data.append(text)
|
self._data.append(text)
|
||||||
|
|
||||||
def start(self, tag, attrs):
|
def start(self, tag, attrs):
|
||||||
if debug:
|
if debug:
|
||||||
print "start %s, %s" % (tag, attrs)
|
print "start %s, %s" % (tag, attrs)
|
||||||
if tag == 'function':
|
if tag == 'function':
|
||||||
self._data = []
|
self._data = []
|
||||||
self.in_function = 1
|
self.in_function = 1
|
||||||
self.function = None
|
self.function = None
|
||||||
self.function_args = []
|
self.function_args = []
|
||||||
self.function_descr = None
|
self.function_descr = None
|
||||||
self.function_return = None
|
self.function_return = None
|
||||||
self.function_file = None
|
self.function_file = None
|
||||||
if attrs.has_key('name'):
|
if attrs.has_key('name'):
|
||||||
self.function = attrs['name']
|
self.function = attrs['name']
|
||||||
if attrs.has_key('file'):
|
if attrs.has_key('file'):
|
||||||
self.function_file = attrs['file']
|
self.function_file = attrs['file']
|
||||||
elif tag == 'info':
|
elif tag == 'info':
|
||||||
self._data = []
|
self._data = []
|
||||||
elif tag == 'arg':
|
elif tag == 'arg':
|
||||||
if self.in_function == 1:
|
if self.in_function == 1:
|
||||||
self.function_arg_name = None
|
self.function_arg_name = None
|
||||||
self.function_arg_type = None
|
self.function_arg_type = None
|
||||||
self.function_arg_info = None
|
self.function_arg_info = None
|
||||||
if attrs.has_key('name'):
|
if attrs.has_key('name'):
|
||||||
self.function_arg_name = attrs['name']
|
self.function_arg_name = attrs['name']
|
||||||
if attrs.has_key('type'):
|
if attrs.has_key('type'):
|
||||||
self.function_arg_type = attrs['type']
|
self.function_arg_type = attrs['type']
|
||||||
if attrs.has_key('info'):
|
if attrs.has_key('info'):
|
||||||
self.function_arg_info = attrs['info']
|
self.function_arg_info = attrs['info']
|
||||||
elif tag == 'return':
|
elif tag == 'return':
|
||||||
if self.in_function == 1:
|
if self.in_function == 1:
|
||||||
self.function_return_type = None
|
self.function_return_type = None
|
||||||
self.function_return_info = None
|
self.function_return_info = None
|
||||||
self.function_return_field = None
|
self.function_return_field = None
|
||||||
if attrs.has_key('type'):
|
if attrs.has_key('type'):
|
||||||
self.function_return_type = attrs['type']
|
self.function_return_type = attrs['type']
|
||||||
if attrs.has_key('info'):
|
if attrs.has_key('info'):
|
||||||
self.function_return_info = attrs['info']
|
self.function_return_info = attrs['info']
|
||||||
if attrs.has_key('field'):
|
if attrs.has_key('field'):
|
||||||
self.function_return_field = attrs['field']
|
self.function_return_field = attrs['field']
|
||||||
|
|
||||||
|
|
||||||
def end(self, tag):
|
def end(self, tag):
|
||||||
if debug:
|
if debug:
|
||||||
print "end %s" % tag
|
print "end %s" % tag
|
||||||
if tag == 'function':
|
if tag == 'function':
|
||||||
if self.function != None:
|
if self.function != None:
|
||||||
function(self.function, self.function_descr,
|
function(self.function, self.function_descr,
|
||||||
self.function_return, self.function_args,
|
self.function_return, self.function_args,
|
||||||
self.function_file)
|
self.function_file)
|
||||||
self.in_function = 0
|
self.in_function = 0
|
||||||
elif tag == 'arg':
|
elif tag == 'arg':
|
||||||
if self.in_function == 1:
|
if self.in_function == 1:
|
||||||
self.function_args.append([self.function_arg_name,
|
self.function_args.append([self.function_arg_name,
|
||||||
self.function_arg_type,
|
self.function_arg_type,
|
||||||
self.function_arg_info])
|
self.function_arg_info])
|
||||||
elif tag == 'return':
|
elif tag == 'return':
|
||||||
if self.in_function == 1:
|
if self.in_function == 1:
|
||||||
self.function_return = [self.function_return_type,
|
self.function_return = [self.function_return_type,
|
||||||
self.function_return_info,
|
self.function_return_info,
|
||||||
self.function_return_field]
|
self.function_return_field]
|
||||||
elif tag == 'info':
|
elif tag == 'info':
|
||||||
str = ''
|
str = ''
|
||||||
for c in self._data:
|
for c in self._data:
|
||||||
str = str + c
|
str = str + c
|
||||||
if self.in_function == 1:
|
if self.in_function == 1:
|
||||||
self.function_descr = str
|
self.function_descr = str
|
||||||
|
|
||||||
|
|
||||||
def function(name, desc, ret, args, file):
|
def function(name, desc, ret, args, file):
|
||||||
global functions
|
global functions
|
||||||
|
|
||||||
@ -301,7 +301,7 @@ def print_function_wrapper(name, output, export, include):
|
|||||||
global skipped_modules
|
global skipped_modules
|
||||||
|
|
||||||
try:
|
try:
|
||||||
(desc, ret, args, file) = functions[name]
|
(desc, ret, args, file) = functions[name]
|
||||||
except:
|
except:
|
||||||
print "failed to get function %s infos"
|
print "failed to get function %s infos"
|
||||||
return
|
return
|
||||||
@ -318,68 +318,68 @@ def print_function_wrapper(name, output, export, include):
|
|||||||
c_return=""
|
c_return=""
|
||||||
c_convert=""
|
c_convert=""
|
||||||
for arg in args:
|
for arg in args:
|
||||||
# This should be correct
|
# This should be correct
|
||||||
if arg[1][0:6] == "const ":
|
if arg[1][0:6] == "const ":
|
||||||
arg[1] = arg[1][6:]
|
arg[1] = arg[1][6:]
|
||||||
c_args = c_args + " %s %s;\n" % (arg[1], arg[0])
|
c_args = c_args + " %s %s;\n" % (arg[1], arg[0])
|
||||||
if py_types.has_key(arg[1]):
|
if py_types.has_key(arg[1]):
|
||||||
(f, t, n, c, p) = py_types[arg[1]]
|
(f, t, n, c, p) = py_types[arg[1]]
|
||||||
if f != None:
|
if f != None:
|
||||||
format = format + f
|
format = format + f
|
||||||
if t != None:
|
if t != None:
|
||||||
format_args = format_args + ", &pyobj_%s" % (arg[0])
|
format_args = format_args + ", &pyobj_%s" % (arg[0])
|
||||||
c_args = c_args + " PyObject *pyobj_%s;\n" % (arg[0])
|
c_args = c_args + " PyObject *pyobj_%s;\n" % (arg[0])
|
||||||
c_convert = c_convert + \
|
c_convert = c_convert + \
|
||||||
" %s = (%s) Py%s_Get(pyobj_%s);\n" % (arg[0],
|
" %s = (%s) Py%s_Get(pyobj_%s);\n" % (arg[0],
|
||||||
arg[1], t, arg[0]);
|
arg[1], t, arg[0]);
|
||||||
else:
|
else:
|
||||||
format_args = format_args + ", &%s" % (arg[0])
|
format_args = format_args + ", &%s" % (arg[0])
|
||||||
if c_call != "":
|
if c_call != "":
|
||||||
c_call = c_call + ", ";
|
c_call = c_call + ", ";
|
||||||
c_call = c_call + "%s" % (arg[0])
|
c_call = c_call + "%s" % (arg[0])
|
||||||
else:
|
else:
|
||||||
if skipped_types.has_key(arg[1]):
|
if skipped_types.has_key(arg[1]):
|
||||||
return 0
|
return 0
|
||||||
if unknown_types.has_key(arg[1]):
|
if unknown_types.has_key(arg[1]):
|
||||||
lst = unknown_types[arg[1]]
|
lst = unknown_types[arg[1]]
|
||||||
lst.append(name)
|
lst.append(name)
|
||||||
else:
|
else:
|
||||||
unknown_types[arg[1]] = [name]
|
unknown_types[arg[1]] = [name]
|
||||||
return -1
|
return -1
|
||||||
if format != "":
|
if format != "":
|
||||||
format = format + ":%s" % (name)
|
format = format + ":%s" % (name)
|
||||||
|
|
||||||
if ret[0] == 'void':
|
if ret[0] == 'void':
|
||||||
if file == "python_accessor":
|
if file == "python_accessor":
|
||||||
c_call = "\n %s->%s = %s;\n" % (args[0][0], args[1][0],
|
c_call = "\n %s->%s = %s;\n" % (args[0][0], args[1][0],
|
||||||
args[1][0])
|
args[1][0])
|
||||||
else:
|
else:
|
||||||
c_call = "\n %s(%s);\n" % (name, c_call);
|
c_call = "\n %s(%s);\n" % (name, c_call);
|
||||||
ret_convert = " Py_INCREF(Py_None);\n return(Py_None);\n"
|
ret_convert = " Py_INCREF(Py_None);\n return(Py_None);\n"
|
||||||
elif py_types.has_key(ret[0]):
|
elif py_types.has_key(ret[0]):
|
||||||
(f, t, n, c, p) = py_types[ret[0]]
|
(f, t, n, c, p) = py_types[ret[0]]
|
||||||
c_return = " %s c_retval;\n" % (ret[0])
|
c_return = " %s c_retval;\n" % (ret[0])
|
||||||
if file == "python_accessor" and ret[2] != None:
|
if file == "python_accessor" and ret[2] != None:
|
||||||
c_call = "\n c_retval = %s->%s;\n" % (args[0][0], ret[2])
|
c_call = "\n c_retval = %s->%s;\n" % (args[0][0], ret[2])
|
||||||
else:
|
else:
|
||||||
c_call = "\n c_retval = %s(%s);\n" % (name, c_call);
|
c_call = "\n c_retval = %s(%s);\n" % (name, c_call);
|
||||||
ret_convert = " py_retval = %s%sWrap((%s) c_retval);\n" % (p,n,c)
|
ret_convert = " py_retval = %s%sWrap((%s) c_retval);\n" % (p,n,c)
|
||||||
ret_convert = ret_convert + " return(py_retval);\n"
|
ret_convert = ret_convert + " return(py_retval);\n"
|
||||||
elif py_return_types.has_key(ret[0]):
|
elif py_return_types.has_key(ret[0]):
|
||||||
(f, t, n, c, p) = py_return_types[ret[0]]
|
(f, t, n, c, p) = py_return_types[ret[0]]
|
||||||
c_return = " %s c_retval;\n" % (ret[0])
|
c_return = " %s c_retval;\n" % (ret[0])
|
||||||
c_call = "\n c_retval = %s(%s);\n" % (name, c_call);
|
c_call = "\n c_retval = %s(%s);\n" % (name, c_call);
|
||||||
ret_convert = " py_retval = %s%sWrap((%s) c_retval);\n" % (p,n,c)
|
ret_convert = " py_retval = %s%sWrap((%s) c_retval);\n" % (p,n,c)
|
||||||
ret_convert = ret_convert + " return(py_retval);\n"
|
ret_convert = ret_convert + " return(py_retval);\n"
|
||||||
else:
|
else:
|
||||||
if skipped_types.has_key(ret[0]):
|
if skipped_types.has_key(ret[0]):
|
||||||
return 0
|
return 0
|
||||||
if unknown_types.has_key(ret[0]):
|
if unknown_types.has_key(ret[0]):
|
||||||
lst = unknown_types[ret[0]]
|
lst = unknown_types[ret[0]]
|
||||||
lst.append(name)
|
lst.append(name)
|
||||||
else:
|
else:
|
||||||
unknown_types[ret[0]] = [name]
|
unknown_types[ret[0]] = [name]
|
||||||
return -1
|
return -1
|
||||||
|
|
||||||
include.write("PyObject * ")
|
include.write("PyObject * ")
|
||||||
include.write("libxslt_%s(PyObject *self, PyObject *args);\n" % (name))
|
include.write("libxslt_%s(PyObject *self, PyObject *args);\n" % (name))
|
||||||
@ -388,25 +388,25 @@ def print_function_wrapper(name, output, export, include):
|
|||||||
|
|
||||||
if file == "python":
|
if file == "python":
|
||||||
# Those have been manually generated
|
# Those have been manually generated
|
||||||
return 1
|
return 1
|
||||||
if file == "python_accessor" and ret[0] != "void" and ret[2] == None:
|
if file == "python_accessor" and ret[0] != "void" and ret[2] == None:
|
||||||
# Those have been manually generated
|
# Those have been manually generated
|
||||||
return 1
|
return 1
|
||||||
|
|
||||||
output.write("PyObject *\n")
|
output.write("PyObject *\n")
|
||||||
output.write("libxslt_%s(PyObject *self, PyObject *args) {\n" % (name))
|
output.write("libxslt_%s(PyObject *self, PyObject *args) {\n" % (name))
|
||||||
if ret[0] != 'void':
|
if ret[0] != 'void':
|
||||||
output.write(" PyObject *py_retval;\n")
|
output.write(" PyObject *py_retval;\n")
|
||||||
if c_return != "":
|
if c_return != "":
|
||||||
output.write(c_return)
|
output.write(c_return)
|
||||||
if c_args != "":
|
if c_args != "":
|
||||||
output.write(c_args)
|
output.write(c_args)
|
||||||
if format != "":
|
if format != "":
|
||||||
output.write("\n if (!PyArg_ParseTuple(args, \"%s\"%s))\n" %
|
output.write("\n if (!PyArg_ParseTuple(args, \"%s\"%s))\n" %
|
||||||
(format, format_args))
|
(format, format_args))
|
||||||
output.write(" return(NULL);\n")
|
output.write(" return(NULL);\n")
|
||||||
if c_convert != "":
|
if c_convert != "":
|
||||||
output.write(c_convert)
|
output.write(c_convert)
|
||||||
|
|
||||||
output.write(c_call)
|
output.write(c_call)
|
||||||
output.write(ret_convert)
|
output.write(ret_convert)
|
||||||
@ -454,10 +454,10 @@ for function in functions.keys():
|
|||||||
ret = print_function_wrapper(function, wrapper, export, include)
|
ret = print_function_wrapper(function, wrapper, export, include)
|
||||||
if ret < 0:
|
if ret < 0:
|
||||||
failed = failed + 1
|
failed = failed + 1
|
||||||
del functions[function]
|
del functions[function]
|
||||||
if ret == 0:
|
if ret == 0:
|
||||||
skipped = skipped + 1
|
skipped = skipped + 1
|
||||||
del functions[function]
|
del functions[function]
|
||||||
if ret == 1:
|
if ret == 1:
|
||||||
nb_wrap = nb_wrap + 1
|
nb_wrap = nb_wrap + 1
|
||||||
include.close()
|
include.close()
|
||||||
@ -465,7 +465,7 @@ export.close()
|
|||||||
wrapper.close()
|
wrapper.close()
|
||||||
|
|
||||||
print "Generated %d wrapper functions, %d failed, %d skipped\n" % (nb_wrap,
|
print "Generated %d wrapper functions, %d failed, %d skipped\n" % (nb_wrap,
|
||||||
failed, skipped);
|
failed, skipped);
|
||||||
print "Missing type converters:"
|
print "Missing type converters:"
|
||||||
for type in unknown_types.keys():
|
for type in unknown_types.keys():
|
||||||
print "%s:%d " % (type, len(unknown_types[type])),
|
print "%s:%d " % (type, len(unknown_types[type])),
|
||||||
@ -549,17 +549,17 @@ for classe in primary_classes:
|
|||||||
classes_processed[classe] = ()
|
classes_processed[classe] = ()
|
||||||
for type in classes_type.keys():
|
for type in classes_type.keys():
|
||||||
tinfo = classes_type[type]
|
tinfo = classes_type[type]
|
||||||
if tinfo[2] == classe:
|
if tinfo[2] == classe:
|
||||||
ctypes.append(type)
|
ctypes.append(type)
|
||||||
ctypes_processed[type] = ()
|
ctypes_processed[type] = ()
|
||||||
for type in classes_type.keys():
|
for type in classes_type.keys():
|
||||||
if ctypes_processed.has_key(type):
|
if ctypes_processed.has_key(type):
|
||||||
continue
|
continue
|
||||||
tinfo = classes_type[type]
|
tinfo = classes_type[type]
|
||||||
if not classes_processed.has_key(tinfo[2]):
|
if not classes_processed.has_key(tinfo[2]):
|
||||||
classes_list.append(tinfo[2])
|
classes_list.append(tinfo[2])
|
||||||
classes_processed[tinfo[2]] = ()
|
classes_processed[tinfo[2]] = ()
|
||||||
|
|
||||||
ctypes.append(type)
|
ctypes.append(type)
|
||||||
ctypes_processed[type] = ()
|
ctypes_processed[type] = ()
|
||||||
|
|
||||||
@ -568,8 +568,8 @@ def nameFixup(function, classe, type, file):
|
|||||||
ll = len(listname)
|
ll = len(listname)
|
||||||
l = len(classe)
|
l = len(classe)
|
||||||
if name[0:l] == listname:
|
if name[0:l] == listname:
|
||||||
func = name[l:]
|
func = name[l:]
|
||||||
func = string.lower(func[0:1]) + func[1:]
|
func = string.lower(func[0:1]) + func[1:]
|
||||||
elif name[0:12] == "xmlParserGet" and file == "python_accessor":
|
elif name[0:12] == "xmlParserGet" and file == "python_accessor":
|
||||||
func = name[12:]
|
func = name[12:]
|
||||||
func = string.lower(func[0:1]) + func[1:]
|
func = string.lower(func[0:1]) + func[1:]
|
||||||
@ -598,26 +598,26 @@ def nameFixup(function, classe, type, file):
|
|||||||
func = name[14:]
|
func = name[14:]
|
||||||
func = string.lower(func[0:1]) + func[1:]
|
func = string.lower(func[0:1]) + func[1:]
|
||||||
elif name[0:l] == classe:
|
elif name[0:l] == classe:
|
||||||
func = name[l:]
|
func = name[l:]
|
||||||
func = string.lower(func[0:1]) + func[1:]
|
func = string.lower(func[0:1]) + func[1:]
|
||||||
elif name[0:7] == "libxml_":
|
elif name[0:7] == "libxml_":
|
||||||
func = name[7:]
|
func = name[7:]
|
||||||
func = string.lower(func[0:1]) + func[1:]
|
func = string.lower(func[0:1]) + func[1:]
|
||||||
elif name[0:8] == "libxslt_":
|
elif name[0:8] == "libxslt_":
|
||||||
func = name[8:]
|
func = name[8:]
|
||||||
func = string.lower(func[0:1]) + func[1:]
|
func = string.lower(func[0:1]) + func[1:]
|
||||||
elif name[0:6] == "xmlGet":
|
elif name[0:6] == "xmlGet":
|
||||||
func = name[6:]
|
func = name[6:]
|
||||||
func = string.lower(func[0:1]) + func[1:]
|
func = string.lower(func[0:1]) + func[1:]
|
||||||
elif name[0:3] == "xml":
|
elif name[0:3] == "xml":
|
||||||
func = name[3:]
|
func = name[3:]
|
||||||
func = string.lower(func[0:1]) + func[1:]
|
func = string.lower(func[0:1]) + func[1:]
|
||||||
elif name[0:7] == "xsltGet":
|
elif name[0:7] == "xsltGet":
|
||||||
func = name[7:]
|
func = name[7:]
|
||||||
func = string.lower(func[0:1]) + func[1:]
|
func = string.lower(func[0:1]) + func[1:]
|
||||||
elif name[0:4] == "xslt":
|
elif name[0:4] == "xslt":
|
||||||
func = name[4:]
|
func = name[4:]
|
||||||
func = string.lower(func[0:1]) + func[1:]
|
func = string.lower(func[0:1]) + func[1:]
|
||||||
else:
|
else:
|
||||||
func = name
|
func = name
|
||||||
if func[0:5] == "xPath":
|
if func[0:5] == "xPath":
|
||||||
@ -640,23 +640,23 @@ for name in functions.keys():
|
|||||||
for type in ctypes:
|
for type in ctypes:
|
||||||
classe = classes_type[type][2]
|
classe = classes_type[type][2]
|
||||||
|
|
||||||
if name[0:4] == "xslt" and len(args) >= 1 and args[0][1] == type:
|
if name[0:4] == "xslt" and len(args) >= 1 and args[0][1] == type:
|
||||||
found = 1
|
found = 1
|
||||||
func = nameFixup(name, classe, type, file)
|
func = nameFixup(name, classe, type, file)
|
||||||
info = (0, func, name, ret, args, file)
|
info = (0, func, name, ret, args, file)
|
||||||
function_classes[classe].append(info)
|
function_classes[classe].append(info)
|
||||||
elif name[0:4] == "xslt" and len(args) >= 2 and args[1][1] == type:
|
elif name[0:4] == "xslt" and len(args) >= 2 and args[1][1] == type:
|
||||||
found = 1
|
found = 1
|
||||||
func = nameFixup(name, classe, type, file)
|
func = nameFixup(name, classe, type, file)
|
||||||
info = (1, func, name, ret, args, file)
|
info = (1, func, name, ret, args, file)
|
||||||
function_classes[classe].append(info)
|
function_classes[classe].append(info)
|
||||||
elif name[0:4] == "xslt" and len(args) >= 3 and args[2][1] == type:
|
elif name[0:4] == "xslt" and len(args) >= 3 and args[2][1] == type:
|
||||||
found = 1
|
found = 1
|
||||||
func = nameFixup(name, classe, type, file)
|
func = nameFixup(name, classe, type, file)
|
||||||
info = (2, func, name, ret, args, file)
|
info = (2, func, name, ret, args, file)
|
||||||
function_classes[classe].append(info)
|
function_classes[classe].append(info)
|
||||||
if found == 1:
|
if found == 1:
|
||||||
break
|
break
|
||||||
if found == 1:
|
if found == 1:
|
||||||
continue
|
continue
|
||||||
if name[0:8] == "xmlXPath":
|
if name[0:8] == "xmlXPath":
|
||||||
@ -677,10 +677,10 @@ def functionCompare(info1, info2):
|
|||||||
(index1, func1, name1, ret1, args1, file1) = info1
|
(index1, func1, name1, ret1, args1, file1) = info1
|
||||||
(index2, func2, name2, ret2, args2, file2) = info2
|
(index2, func2, name2, ret2, args2, file2) = info2
|
||||||
if file1 == file2:
|
if file1 == file2:
|
||||||
if func1 < func2:
|
if func1 < func2:
|
||||||
return -1
|
return -1
|
||||||
if func1 > func2:
|
if func1 > func2:
|
||||||
return 1
|
return 1
|
||||||
if file1 == "python_accessor":
|
if file1 == "python_accessor":
|
||||||
return -1
|
return -1
|
||||||
if file2 == "python_accessor":
|
if file2 == "python_accessor":
|
||||||
@ -700,14 +700,14 @@ def writeDoc(name, args, indent, output):
|
|||||||
output.write('"""')
|
output.write('"""')
|
||||||
while len(val) > 60:
|
while len(val) > 60:
|
||||||
str = val[0:60]
|
str = val[0:60]
|
||||||
i = string.rfind(str, " ");
|
i = string.rfind(str, " ");
|
||||||
if i < 0:
|
if i < 0:
|
||||||
i = 60
|
i = 60
|
||||||
str = val[0:i]
|
str = val[0:i]
|
||||||
val = val[i:]
|
val = val[i:]
|
||||||
output.write(str)
|
output.write(str)
|
||||||
output.write('\n ');
|
output.write('\n ');
|
||||||
output.write(indent)
|
output.write(indent)
|
||||||
output.write(val);
|
output.write(val);
|
||||||
output.write('"""\n')
|
output.write('"""\n')
|
||||||
|
|
||||||
@ -717,63 +717,63 @@ if function_classes.has_key("None"):
|
|||||||
flist.sort(functionCompare)
|
flist.sort(functionCompare)
|
||||||
oldfile = ""
|
oldfile = ""
|
||||||
for info in flist:
|
for info in flist:
|
||||||
(index, func, name, ret, args, file) = info
|
(index, func, name, ret, args, file) = info
|
||||||
if file != oldfile:
|
if file != oldfile:
|
||||||
classes.write("#\n# Functions from module %s\n#\n\n" % file)
|
classes.write("#\n# Functions from module %s\n#\n\n" % file)
|
||||||
txt.write("\n# functions from module %s\n" % file)
|
txt.write("\n# functions from module %s\n" % file)
|
||||||
oldfile = file
|
oldfile = file
|
||||||
classes.write("def %s(" % func)
|
classes.write("def %s(" % func)
|
||||||
txt.write("%s()\n" % func);
|
txt.write("%s()\n" % func);
|
||||||
n = 0
|
n = 0
|
||||||
for arg in args:
|
for arg in args:
|
||||||
if n != 0:
|
if n != 0:
|
||||||
classes.write(", ")
|
classes.write(", ")
|
||||||
classes.write("%s" % arg[0])
|
classes.write("%s" % arg[0])
|
||||||
n = n + 1
|
n = n + 1
|
||||||
classes.write("):\n")
|
classes.write("):\n")
|
||||||
writeDoc(name, args, ' ', classes);
|
writeDoc(name, args, ' ', classes);
|
||||||
|
|
||||||
for arg in args:
|
for arg in args:
|
||||||
if classes_type.has_key(arg[1]):
|
if classes_type.has_key(arg[1]):
|
||||||
classes.write(" if %s == None: %s__o = None\n" %
|
classes.write(" if %s == None: %s__o = None\n" %
|
||||||
(arg[0], arg[0]))
|
(arg[0], arg[0]))
|
||||||
classes.write(" else: %s__o = %s%s\n" %
|
classes.write(" else: %s__o = %s%s\n" %
|
||||||
(arg[0], arg[0], classes_type[arg[1]][0]))
|
(arg[0], arg[0], classes_type[arg[1]][0]))
|
||||||
elif libxml2_classes_type.has_key(arg[1]):
|
elif libxml2_classes_type.has_key(arg[1]):
|
||||||
classes.write(" if %s == None: %s__o = None\n" %
|
classes.write(" if %s == None: %s__o = None\n" %
|
||||||
(arg[0], arg[0]))
|
(arg[0], arg[0]))
|
||||||
classes.write(" else: %s__o = %s%s\n" %
|
classes.write(" else: %s__o = %s%s\n" %
|
||||||
(arg[0], arg[0], libxml2_classes_type[arg[1]][0]))
|
(arg[0], arg[0], libxml2_classes_type[arg[1]][0]))
|
||||||
if ret[0] != "void":
|
if ret[0] != "void":
|
||||||
classes.write(" ret = ");
|
classes.write(" ret = ");
|
||||||
else:
|
else:
|
||||||
classes.write(" ");
|
classes.write(" ");
|
||||||
classes.write("libxsltmod.%s(" % name)
|
classes.write("libxsltmod.%s(" % name)
|
||||||
n = 0
|
n = 0
|
||||||
for arg in args:
|
for arg in args:
|
||||||
if n != 0:
|
if n != 0:
|
||||||
classes.write(", ");
|
classes.write(", ");
|
||||||
classes.write("%s" % arg[0])
|
classes.write("%s" % arg[0])
|
||||||
if classes_type.has_key(arg[1]):
|
if classes_type.has_key(arg[1]):
|
||||||
classes.write("__o");
|
classes.write("__o");
|
||||||
if libxml2_classes_type.has_key(arg[1]):
|
if libxml2_classes_type.has_key(arg[1]):
|
||||||
classes.write("__o");
|
classes.write("__o");
|
||||||
n = n + 1
|
n = n + 1
|
||||||
classes.write(")\n");
|
classes.write(")\n");
|
||||||
if ret[0] != "void":
|
if ret[0] != "void":
|
||||||
if classes_type.has_key(ret[0]):
|
if classes_type.has_key(ret[0]):
|
||||||
classes.write(" if ret == None: return None\n");
|
classes.write(" if ret == None: return None\n");
|
||||||
classes.write(" return ");
|
classes.write(" return ");
|
||||||
classes.write(classes_type[ret[0]][1] % ("ret"));
|
classes.write(classes_type[ret[0]][1] % ("ret"));
|
||||||
classes.write("\n");
|
classes.write("\n");
|
||||||
elif libxml2_classes_type.has_key(ret[0]):
|
elif libxml2_classes_type.has_key(ret[0]):
|
||||||
classes.write(" if ret == None: return None\n");
|
classes.write(" if ret == None: return None\n");
|
||||||
classes.write(" return libxml2.");
|
classes.write(" return libxml2.");
|
||||||
classes.write(libxml2_classes_type[ret[0]][1] % ("ret"));
|
classes.write(libxml2_classes_type[ret[0]][1] % ("ret"));
|
||||||
classes.write("\n");
|
classes.write("\n");
|
||||||
else:
|
else:
|
||||||
classes.write(" return ret\n");
|
classes.write(" return ret\n");
|
||||||
classes.write("\n");
|
classes.write("\n");
|
||||||
|
|
||||||
txt.write("\n\n#\n# Set of classes of the module\n#\n\n")
|
txt.write("\n\n#\n# Set of classes of the module\n#\n\n")
|
||||||
for classname in classes_list:
|
for classname in classes_list:
|
||||||
@ -781,117 +781,117 @@ for classname in classes_list:
|
|||||||
pass
|
pass
|
||||||
else:
|
else:
|
||||||
if classes_ancestor.has_key(classname):
|
if classes_ancestor.has_key(classname):
|
||||||
txt.write("\n\nClass %s(%s)\n" % (classname,
|
txt.write("\n\nClass %s(%s)\n" % (classname,
|
||||||
classes_ancestor[classname]))
|
classes_ancestor[classname]))
|
||||||
classes.write("class %s(%s):\n" % (classname,
|
classes.write("class %s(%s):\n" % (classname,
|
||||||
classes_ancestor[classname]))
|
classes_ancestor[classname]))
|
||||||
classes.write(" def __init__(self, _obj=None):\n")
|
classes.write(" def __init__(self, _obj=None):\n")
|
||||||
classes.write(" self._o = None\n")
|
classes.write(" self._o = None\n")
|
||||||
classes.write(" %s.__init__(self, _obj=_obj)\n\n" % (
|
classes.write(" %s.__init__(self, _obj=_obj)\n\n" % (
|
||||||
classes_ancestor[classname]))
|
classes_ancestor[classname]))
|
||||||
if classes_ancestor[classname] == "xmlCore" or \
|
if classes_ancestor[classname] == "xmlCore" or \
|
||||||
classes_ancestor[classname] == "xmlNode":
|
classes_ancestor[classname] == "xmlNode":
|
||||||
classes.write(" def __repr__(self):\n")
|
classes.write(" def __repr__(self):\n")
|
||||||
format = "%s:%%s" % (classname)
|
format = "%s:%%s" % (classname)
|
||||||
classes.write(" return \"%s\" %% (self.name)\n\n" % (
|
classes.write(" return \"%s\" %% (self.name)\n\n" % (
|
||||||
format))
|
format))
|
||||||
else:
|
else:
|
||||||
txt.write("Class %s()\n" % (classname))
|
txt.write("Class %s()\n" % (classname))
|
||||||
classes.write("class %s:\n" % (classname))
|
classes.write("class %s:\n" % (classname))
|
||||||
classes.write(" def __init__(self, _obj=None):\n")
|
classes.write(" def __init__(self, _obj=None):\n")
|
||||||
classes.write(" if _obj != None:self._o = _obj;return\n")
|
classes.write(" if _obj != None:self._o = _obj;return\n")
|
||||||
classes.write(" self._o = None\n\n");
|
classes.write(" self._o = None\n\n");
|
||||||
if classes_destructors.has_key(classname):
|
if classes_destructors.has_key(classname):
|
||||||
classes.write(" def __del__(self):\n")
|
classes.write(" def __del__(self):\n")
|
||||||
if classes_destructors[classname] == "pass":
|
if classes_destructors[classname] == "pass":
|
||||||
classes.write(" pass\n")
|
classes.write(" pass\n")
|
||||||
else:
|
else:
|
||||||
classes.write(" if self._o != None:\n")
|
classes.write(" if self._o != None:\n")
|
||||||
classes.write(" libxsltmod.%s(self._o)\n" %
|
classes.write(" libxsltmod.%s(self._o)\n" %
|
||||||
classes_destructors[classname]);
|
classes_destructors[classname]);
|
||||||
classes.write(" self._o = None\n\n");
|
classes.write(" self._o = None\n\n");
|
||||||
flist = function_classes[classname]
|
flist = function_classes[classname]
|
||||||
flist.sort(functionCompare)
|
flist.sort(functionCompare)
|
||||||
oldfile = ""
|
oldfile = ""
|
||||||
for info in flist:
|
for info in flist:
|
||||||
(index, func, name, ret, args, file) = info
|
(index, func, name, ret, args, file) = info
|
||||||
if file != oldfile:
|
if file != oldfile:
|
||||||
if file == "python_accessor":
|
if file == "python_accessor":
|
||||||
classes.write(" # accessors for %s\n" % (classname))
|
classes.write(" # accessors for %s\n" % (classname))
|
||||||
txt.write(" # accessors\n")
|
txt.write(" # accessors\n")
|
||||||
else:
|
else:
|
||||||
classes.write(" #\n")
|
classes.write(" #\n")
|
||||||
classes.write(" # %s functions from module %s\n" % (
|
classes.write(" # %s functions from module %s\n" % (
|
||||||
classname, file))
|
classname, file))
|
||||||
txt.write("\n # functions from module %s\n" % file)
|
txt.write("\n # functions from module %s\n" % file)
|
||||||
classes.write(" #\n\n")
|
classes.write(" #\n\n")
|
||||||
oldfile = file
|
oldfile = file
|
||||||
classes.write(" def %s(self" % func)
|
classes.write(" def %s(self" % func)
|
||||||
txt.write(" %s()\n" % func);
|
txt.write(" %s()\n" % func);
|
||||||
n = 0
|
n = 0
|
||||||
for arg in args:
|
for arg in args:
|
||||||
if n != index:
|
if n != index:
|
||||||
classes.write(", %s" % arg[0])
|
classes.write(", %s" % arg[0])
|
||||||
n = n + 1
|
n = n + 1
|
||||||
classes.write("):\n")
|
classes.write("):\n")
|
||||||
writeDoc(name, args, ' ', classes);
|
writeDoc(name, args, ' ', classes);
|
||||||
n = 0
|
n = 0
|
||||||
for arg in args:
|
for arg in args:
|
||||||
if classes_type.has_key(arg[1]):
|
if classes_type.has_key(arg[1]):
|
||||||
if n != index:
|
if n != index:
|
||||||
classes.write(" if %s == None: %s__o = None\n" %
|
classes.write(" if %s == None: %s__o = None\n" %
|
||||||
(arg[0], arg[0]))
|
(arg[0], arg[0]))
|
||||||
classes.write(" else: %s__o = %s%s\n" %
|
classes.write(" else: %s__o = %s%s\n" %
|
||||||
(arg[0], arg[0], classes_type[arg[1]][0]))
|
(arg[0], arg[0], classes_type[arg[1]][0]))
|
||||||
elif libxml2_classes_type.has_key(arg[1]):
|
elif libxml2_classes_type.has_key(arg[1]):
|
||||||
classes.write(" if %s == None: %s__o = None\n" %
|
classes.write(" if %s == None: %s__o = None\n" %
|
||||||
(arg[0], arg[0]))
|
(arg[0], arg[0]))
|
||||||
classes.write(" else: %s__o = %s%s\n" %
|
classes.write(" else: %s__o = %s%s\n" %
|
||||||
(arg[0], arg[0],
|
(arg[0], arg[0],
|
||||||
libxml2_classes_type[arg[1]][0]))
|
libxml2_classes_type[arg[1]][0]))
|
||||||
n = n + 1
|
n = n + 1
|
||||||
if ret[0] != "void":
|
if ret[0] != "void":
|
||||||
classes.write(" ret = ");
|
classes.write(" ret = ");
|
||||||
else:
|
else:
|
||||||
classes.write(" ");
|
classes.write(" ");
|
||||||
classes.write("libxsltmod.%s(" % name)
|
classes.write("libxsltmod.%s(" % name)
|
||||||
n = 0
|
n = 0
|
||||||
for arg in args:
|
for arg in args:
|
||||||
if n != 0:
|
if n != 0:
|
||||||
classes.write(", ");
|
classes.write(", ");
|
||||||
if n != index:
|
if n != index:
|
||||||
classes.write("%s" % arg[0])
|
classes.write("%s" % arg[0])
|
||||||
if classes_type.has_key(arg[1]):
|
if classes_type.has_key(arg[1]):
|
||||||
classes.write("__o");
|
classes.write("__o");
|
||||||
elif libxml2_classes_type.has_key(arg[1]):
|
elif libxml2_classes_type.has_key(arg[1]):
|
||||||
classes.write("__o");
|
classes.write("__o");
|
||||||
else:
|
else:
|
||||||
classes.write("self");
|
classes.write("self");
|
||||||
if classes_type.has_key(arg[1]):
|
if classes_type.has_key(arg[1]):
|
||||||
classes.write(classes_type[arg[1]][0])
|
classes.write(classes_type[arg[1]][0])
|
||||||
elif libxml2_classes_type.has_key(arg[1]):
|
elif libxml2_classes_type.has_key(arg[1]):
|
||||||
classes.write(libxml2_classes_type[arg[1]][0])
|
classes.write(libxml2_classes_type[arg[1]][0])
|
||||||
n = n + 1
|
n = n + 1
|
||||||
classes.write(")\n");
|
classes.write(")\n");
|
||||||
if ret[0] != "void":
|
if ret[0] != "void":
|
||||||
if classes_type.has_key(ret[0]):
|
if classes_type.has_key(ret[0]):
|
||||||
classes.write(" if ret == None: return None\n");
|
classes.write(" if ret == None: return None\n");
|
||||||
classes.write(" return ");
|
classes.write(" return ");
|
||||||
classes.write(classes_type[ret[0]][1] % ("ret"));
|
classes.write(classes_type[ret[0]][1] % ("ret"));
|
||||||
classes.write("\n");
|
classes.write("\n");
|
||||||
elif libxml2_classes_type.has_key(ret[0]):
|
elif libxml2_classes_type.has_key(ret[0]):
|
||||||
classes.write(" if ret == None: return None\n");
|
classes.write(" if ret == None: return None\n");
|
||||||
classes.write(" return libxml2.");
|
classes.write(" return libxml2.");
|
||||||
classes.write(libxml2_classes_type[ret[0]][1] % ("ret"));
|
classes.write(libxml2_classes_type[ret[0]][1] % ("ret"));
|
||||||
classes.write("\n");
|
classes.write("\n");
|
||||||
elif converter_type.has_key(ret[0]):
|
elif converter_type.has_key(ret[0]):
|
||||||
classes.write(" if ret == None: return None\n");
|
classes.write(" if ret == None: return None\n");
|
||||||
classes.write(" return ");
|
classes.write(" return ");
|
||||||
classes.write(converter_type[ret[0]] % ("ret"));
|
classes.write(converter_type[ret[0]] % ("ret"));
|
||||||
classes.write("\n");
|
classes.write("\n");
|
||||||
else:
|
else:
|
||||||
classes.write(" return ret\n");
|
classes.write(" return ret\n");
|
||||||
classes.write("\n");
|
classes.write("\n");
|
||||||
|
|
||||||
txt.close()
|
txt.close()
|
||||||
classes.close()
|
classes.close()
|
||||||
|
@ -16,10 +16,10 @@ def f(ctx, str):
|
|||||||
# Small check to verify the context is correcly accessed
|
# Small check to verify the context is correcly accessed
|
||||||
#
|
#
|
||||||
try:
|
try:
|
||||||
pctxt = libxslt.xpathParserContext(_obj=ctx)
|
pctxt = libxslt.xpathParserContext(_obj=ctx)
|
||||||
ctxt = pctxt.context()
|
ctxt = pctxt.context()
|
||||||
tctxt = ctxt.transformContext()
|
tctxt = ctxt.transformContext()
|
||||||
nodeName = tctxt.insertNode().name
|
nodeName = tctxt.insertNode().name
|
||||||
except:
|
except:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
@ -52,50 +52,50 @@ def xsltProcess(doc, cur, filename):
|
|||||||
|
|
||||||
if xinclude:
|
if xinclude:
|
||||||
if timing:
|
if timing:
|
||||||
startTimer()
|
startTimer()
|
||||||
doc.XIncludeProcess()
|
doc.XIncludeProcess()
|
||||||
if timing:
|
if timing:
|
||||||
endTimer("XInclude processing %s" % (filename))
|
endTimer("XInclude processing %s" % (filename))
|
||||||
|
|
||||||
if timing:
|
if timing:
|
||||||
startTimer()
|
startTimer()
|
||||||
if output == None:
|
if output == None:
|
||||||
if repeat != 0:
|
if repeat != 0:
|
||||||
for j in range(1, repeat):
|
for j in range(1, repeat):
|
||||||
res = cur.applyStylesheet(doc, params)
|
res = cur.applyStylesheet(doc, params)
|
||||||
res.freeDoc()
|
res.freeDoc()
|
||||||
doc.freeDoc()
|
doc.freeDoc()
|
||||||
if html == 1:
|
if html == 1:
|
||||||
doc = libxml2.htmlParseFile(filename, None)
|
doc = libxml2.htmlParseFile(filename, None)
|
||||||
else:
|
else:
|
||||||
doc = libxml2.parseFile(filename, None)
|
doc = libxml2.parseFile(filename, None)
|
||||||
# ctxt = libxslt.newTransformContext(doc)
|
# ctxt = libxslt.newTransformContext(doc)
|
||||||
# if ctxt == None:
|
# if ctxt == None:
|
||||||
# return
|
# return
|
||||||
if profile:
|
if profile:
|
||||||
print "TODO: Profiling not yet supported"
|
print "TODO: Profiling not yet supported"
|
||||||
else:
|
else:
|
||||||
res = cur.applyStylesheet(doc, params)
|
res = cur.applyStylesheet(doc, params)
|
||||||
if timing:
|
if timing:
|
||||||
if repeat != 0:
|
if repeat != 0:
|
||||||
endTimer("Applying stylesheet %d times" % (repeat))
|
endTimer("Applying stylesheet %d times" % (repeat))
|
||||||
else:
|
else:
|
||||||
endTimer("Applying stylesheet")
|
endTimer("Applying stylesheet")
|
||||||
doc.freeDoc()
|
doc.freeDoc()
|
||||||
if res == None:
|
if res == None:
|
||||||
print "no result for %s" % (filename)
|
print "no result for %s" % (filename)
|
||||||
return
|
return
|
||||||
if noout != 0:
|
if noout != 0:
|
||||||
res.freeDoc()
|
res.freeDoc()
|
||||||
return
|
return
|
||||||
if debug == 1:
|
if debug == 1:
|
||||||
res.debugDumpDocument(None)
|
res.debugDumpDocument(None)
|
||||||
else:
|
else:
|
||||||
if timing:
|
if timing:
|
||||||
startTimer()
|
startTimer()
|
||||||
cur.saveResultToFilename("-", res, 0)
|
cur.saveResultToFilename("-", res, 0)
|
||||||
if timing:
|
if timing:
|
||||||
endTimer("Saving result")
|
endTimer("Saving result")
|
||||||
res.freeDoc()
|
res.freeDoc()
|
||||||
else:
|
else:
|
||||||
print "TODO: xsltRunStylesheet not yet mapped"
|
print "TODO: xsltRunStylesheet not yet mapped"
|
||||||
@ -147,75 +147,75 @@ def main(args = None):
|
|||||||
|
|
||||||
if not args:
|
if not args:
|
||||||
args = sys.argv[1:]
|
args = sys.argv[1:]
|
||||||
if len(args) <= 0:
|
if len(args) <= 0:
|
||||||
usage(sys.argv[0])
|
usage(sys.argv[0])
|
||||||
|
|
||||||
|
|
||||||
i = 0
|
i = 0
|
||||||
while i < len(args):
|
while i < len(args):
|
||||||
if args[i] == "-":
|
if args[i] == "-":
|
||||||
break
|
break
|
||||||
if args[i][0] != '-':
|
if args[i][0] != '-':
|
||||||
i = i + 1
|
i = i + 1
|
||||||
continue
|
continue
|
||||||
if args[i] == "-timing" or args[i] == "--timing":
|
if args[i] == "-timing" or args[i] == "--timing":
|
||||||
timing = 1
|
timing = 1
|
||||||
elif args[i] == "-debug" or args[i] == "--debug":
|
elif args[i] == "-debug" or args[i] == "--debug":
|
||||||
debug = 1
|
debug = 1
|
||||||
elif args[i] == "-verbose" or args[i] == "--verbose" or \
|
elif args[i] == "-verbose" or args[i] == "--verbose" or \
|
||||||
args[i] == "-v":
|
args[i] == "-v":
|
||||||
print "TODO: xsltSetGenericDebugFunc() mapping missing"
|
print "TODO: xsltSetGenericDebugFunc() mapping missing"
|
||||||
elif args[i] == "-version" or args[i] == "--version" or \
|
elif args[i] == "-version" or args[i] == "--version" or \
|
||||||
args[i] == "-V":
|
args[i] == "-V":
|
||||||
print "TODO: version informations mapping missing"
|
print "TODO: version informations mapping missing"
|
||||||
elif args[i] == "-verbose" or args[i] == "--verbose" or \
|
elif args[i] == "-verbose" or args[i] == "--verbose" or \
|
||||||
args[i] == "-v":
|
args[i] == "-v":
|
||||||
if repeat == 0:
|
if repeat == 0:
|
||||||
repeat = 20
|
repeat = 20
|
||||||
else:
|
else:
|
||||||
repeat = 100
|
repeat = 100
|
||||||
elif args[i] == "-novalid" or args[i] == "--novalid":
|
elif args[i] == "-novalid" or args[i] == "--novalid":
|
||||||
print "TODO: xmlLoadExtDtdDefaultValue mapping missing"
|
print "TODO: xmlLoadExtDtdDefaultValue mapping missing"
|
||||||
novalid = 1
|
novalid = 1
|
||||||
elif args[i] == "-noout" or args[i] == "--noout":
|
elif args[i] == "-noout" or args[i] == "--noout":
|
||||||
noout = 1
|
noout = 1
|
||||||
elif args[i] == "-html" or args[i] == "--html":
|
elif args[i] == "-html" or args[i] == "--html":
|
||||||
html = 1
|
html = 1
|
||||||
elif args[i] == "-nonet" or args[i] == "--nonet":
|
elif args[i] == "-nonet" or args[i] == "--nonet":
|
||||||
print "TODO: xmlSetExternalEntityLoader mapping missing"
|
print "TODO: xmlSetExternalEntityLoader mapping missing"
|
||||||
nonet = 1
|
nonet = 1
|
||||||
elif args[i] == "-catalogs" or args[i] == "--catalogs":
|
elif args[i] == "-catalogs" or args[i] == "--catalogs":
|
||||||
try:
|
try:
|
||||||
catalogs = posix.environ['SGML_CATALOG_FILES']
|
catalogs = posix.environ['SGML_CATALOG_FILES']
|
||||||
except:
|
except:
|
||||||
catalogs = None
|
catalogs = None
|
||||||
if catalogs != none:
|
if catalogs != none:
|
||||||
libxml2.xmlLoadCatalogs(catalogs)
|
libxml2.xmlLoadCatalogs(catalogs)
|
||||||
else:
|
else:
|
||||||
print "Variable $SGML_CATALOG_FILES not set"
|
print "Variable $SGML_CATALOG_FILES not set"
|
||||||
elif args[i] == "-xinclude" or args[i] == "--xinclude":
|
elif args[i] == "-xinclude" or args[i] == "--xinclude":
|
||||||
xinclude = 1
|
xinclude = 1
|
||||||
libxslt.setXIncludeDefault(1)
|
libxslt.setXIncludeDefault(1)
|
||||||
elif args[i] == "-param" or args[i] == "--param":
|
elif args[i] == "-param" or args[i] == "--param":
|
||||||
i = i + 1
|
i = i + 1
|
||||||
params[args[i]] = args[i + 1]
|
params[args[i]] = args[i + 1]
|
||||||
i = i + 1
|
i = i + 1
|
||||||
elif args[i] == "-stringparam" or args[i] == "--stringparam":
|
elif args[i] == "-stringparam" or args[i] == "--stringparam":
|
||||||
i = i + 1
|
i = i + 1
|
||||||
params[args[i]] = "'%s'" % (args[i + 1])
|
params[args[i]] = "'%s'" % (args[i + 1])
|
||||||
i = i + 1
|
i = i + 1
|
||||||
elif args[i] == "-maxdepth" or args[i] == "--maxdepth":
|
elif args[i] == "-maxdepth" or args[i] == "--maxdepth":
|
||||||
print "TODO: xsltMaxDepth mapping missing"
|
print "TODO: xsltMaxDepth mapping missing"
|
||||||
else:
|
else:
|
||||||
print "Unknown option %s" % (args[i])
|
print "Unknown option %s" % (args[i])
|
||||||
usage()
|
usage()
|
||||||
return(3)
|
return(3)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
i = i + 1
|
i = i + 1
|
||||||
|
|
||||||
libxml2.lineNumbersDefault(1)
|
libxml2.lineNumbersDefault(1)
|
||||||
libxml2.substituteEntitiesDefault(1)
|
libxml2.substituteEntitiesDefault(1)
|
||||||
# TODO: xmlLoadExtDtdDefaultValue = XML_DETECT_IDS | XML_COMPLETE_ATTRS
|
# TODO: xmlLoadExtDtdDefaultValue = XML_DETECT_IDS | XML_COMPLETE_ATTRS
|
||||||
@ -228,60 +228,60 @@ def main(args = None):
|
|||||||
i = 0
|
i = 0
|
||||||
while i < len(args) and done == 0:
|
while i < len(args) and done == 0:
|
||||||
if args[i] == "-maxdepth" or args[i] == "--maxdepth":
|
if args[i] == "-maxdepth" or args[i] == "--maxdepth":
|
||||||
i = i + 2
|
i = i + 2
|
||||||
continue
|
continue
|
||||||
if args[i] == "-o" or args[i] == "-output" or args[i] == "--output":
|
if args[i] == "-o" or args[i] == "-output" or args[i] == "--output":
|
||||||
i = i + 2
|
i = i + 2
|
||||||
continue
|
continue
|
||||||
if args[i] == "-param" or args[i] == "--param":
|
if args[i] == "-param" or args[i] == "--param":
|
||||||
i = i + 3
|
i = i + 3
|
||||||
continue
|
continue
|
||||||
if args[i] == "-stringparam" or args[i] == "--stringparam":
|
if args[i] == "-stringparam" or args[i] == "--stringparam":
|
||||||
i = i + 3
|
i = i + 3
|
||||||
continue
|
continue
|
||||||
if args[i] != "-" and args[i][0] == '-':
|
if args[i] != "-" and args[i][0] == '-':
|
||||||
i = i + 1
|
i = i + 1
|
||||||
continue
|
continue
|
||||||
if timing:
|
if timing:
|
||||||
startTimer()
|
startTimer()
|
||||||
style = libxml2.parseFile(args[i])
|
style = libxml2.parseFile(args[i])
|
||||||
if timing:
|
if timing:
|
||||||
endTimer("Parsing stylesheet %s" % (args[i]))
|
endTimer("Parsing stylesheet %s" % (args[i]))
|
||||||
if style == None:
|
if style == None:
|
||||||
print "cannot parse %s" % (args[i])
|
print "cannot parse %s" % (args[i])
|
||||||
cur = None
|
cur = None
|
||||||
errorno = 4
|
errorno = 4
|
||||||
done = 1
|
done = 1
|
||||||
else:
|
else:
|
||||||
cur = libxslt.loadStylesheetPI(style)
|
cur = libxslt.loadStylesheetPI(style)
|
||||||
if cur != None:
|
if cur != None:
|
||||||
xsltProcess(style, cur, args[i])
|
xsltProcess(style, cur, args[i])
|
||||||
cur = None
|
cur = None
|
||||||
else:
|
else:
|
||||||
cur = libxslt.parseStylesheetDoc(style)
|
cur = libxslt.parseStylesheetDoc(style)
|
||||||
if cur == None:
|
if cur == None:
|
||||||
style.freeDoc()
|
style.freeDoc()
|
||||||
errorno = 5
|
errorno = 5
|
||||||
done = 1
|
done = 1
|
||||||
i = i + 1
|
i = i + 1
|
||||||
break
|
break
|
||||||
|
|
||||||
while i < len(args) and done == 0 and cur != None:
|
while i < len(args) and done == 0 and cur != None:
|
||||||
if timing:
|
if timing:
|
||||||
startTimer()
|
startTimer()
|
||||||
if html:
|
if html:
|
||||||
doc = libxml2.htmlParseFile(args[i], None)
|
doc = libxml2.htmlParseFile(args[i], None)
|
||||||
else:
|
else:
|
||||||
doc = libxml2.parseFile(args[i])
|
doc = libxml2.parseFile(args[i])
|
||||||
if doc == None:
|
if doc == None:
|
||||||
print "unable to parse %s" % (args[i])
|
print "unable to parse %s" % (args[i])
|
||||||
errorno = 6
|
errorno = 6
|
||||||
i = i + 1
|
i = i + 1
|
||||||
continue
|
continue
|
||||||
if timing:
|
if timing:
|
||||||
endTimer("Parsing document %s" % (args[i]))
|
endTimer("Parsing document %s" % (args[i]))
|
||||||
xsltProcess(doc, cur, args[i])
|
xsltProcess(doc, cur, args[i])
|
||||||
i = i + 1
|
i = i + 1
|
||||||
|
|
||||||
if cur != None:
|
if cur != None:
|
||||||
cur.freeStylesheet()
|
cur.freeStylesheet()
|
||||||
|
Reference in New Issue
Block a user