1
0
mirror of https://gitlab.gnome.org/GNOME/libxml2.git synced 2025-03-19 14:50:07 +03:00

repair some problem if gtk-doc fail or such patch for Solaris on new

* doc/Makefile.am: repair some problem if gtk-doc fail or such
* configure.in: patch for Solaris on new autoconf closes #98880
* doc/parsedecl.py: repair the frigging API building script,
  did I say that python xmllib sucks ?
* doc/libxml2-api.xml doc/libxml2-refs.xml: regenerated, reordering
  and some comment are no more truncated.
Daniel
This commit is contained in:
Daniel Veillard 2002-11-19 22:28:48 +00:00
parent a7e05b4fce
commit 817e70b6ac
6 changed files with 3662 additions and 2361 deletions

View File

@ -1,3 +1,12 @@
Tue Nov 19 23:25:47 CET 2002 Daniel Veillard <daniel@veillard.com>
* doc/Makefile.am: repair some problem if gtk-doc fail or such
* configure.in: patch for Solaris on new autoconf closes #98880
* doc/parsedecl.py: repair the frigging API building script,
did I say that python xmllib sucks ?
* doc/libxml2-api.xml doc/libxml2-refs.xml: regenerated, reordering
and some comment are no more truncated.
Tue Nov 19 09:09:04 CET 2002 Daniel Veillard <daniel@veillard.com>
* parser.c: Martin Stoilov pointed out a potential leak in

View File

@ -82,12 +82,63 @@ LDFLAGS=${_ldflags}
dnl Checks for header files.
AC_HEADER_DIRENT
AC_HEADER_STDC
AC_CHECK_HEADERS(fcntl.h unistd.h ctype.h dirent.h errno.h malloc.h)
AC_CHECK_HEADERS(stdarg.h sys/stat.h sys/types.h time.h ansidecl.h)
AC_CHECK_HEADERS(ieeefp.h nan.h math.h fp_class.h float.h)
AC_CHECK_HEADERS(stdlib.h sys/socket.h netinet/in.h arpa/inet.h)
AC_CHECK_HEADERS(netdb.h sys/time.h sys/select.h sys/mman.h)
AC_CHECK_HEADERS(sys/timeb.h signal.h arpa/nameser.h resolv.h)
AC_CHECK_HEADERS([fcntl.h])
AC_CHECK_HEADERS([unistd.h])
AC_CHECK_HEADERS([ctype.h])
AC_CHECK_HEADERS([dirent.h])
AC_CHECK_HEADERS([errno.h])
AC_CHECK_HEADERS([malloc.h])
AC_CHECK_HEADERS([stdarg.h])
AC_CHECK_HEADERS([sys/stat.h])
AC_CHECK_HEADERS([sys/types.h])
AC_CHECK_HEADERS([time.h])
AC_CHECK_HEADERS([ansidecl.h])
AC_CHECK_HEADERS([ieeefp.h])
AC_CHECK_HEADERS([nan.h])
AC_CHECK_HEADERS([math.h])
AC_CHECK_HEADERS([fp_class.h])
AC_CHECK_HEADERS([float.h])
AC_CHECK_HEADERS([stdlib.h])
AC_CHECK_HEADERS([sys/socket.h], [], [],
[#if HAVE_SYS_TYPES_H
# include <sys/types.h>
# endif
])
AC_CHECK_HEADERS([netinet/in.h], [], [],
[#if HAVE_SYS_TYPES_H
# include <sys/types.h>
# endif
])
AC_CHECK_HEADERS([arpa/inet.h], [], [],
[#if HAVE_SYS_TYPES_H
# include <sys/types.h>
# endif
#if HAVE_ARPA_INET_H
# include <arpa/inet.h>
# endif
])
AC_CHECK_HEADERS([netdb.h])
AC_CHECK_HEADERS([sys/time.h])
AC_CHECK_HEADERS([sys/select.h])
AC_CHECK_HEADERS([sys/mman.h])
AC_CHECK_HEADERS([sys/timeb.h])
AC_CHECK_HEADERS([signal.h])
AC_CHECK_HEADERS([arpa/nameser.h], [], [],
[#if HAVE_SYS_TYPES_H
# include <sys/types.h>
# endif
])
AC_CHECK_HEADERS([resolv.h], [], [],
[#if HAVE_SYS_TYPES_H
# include <sys/types.h>
# endif
#if HAVE_NETINET_IN_H
# include <netinet/in.h>
# endif
#if HAVE_ARPA_NAMESER_H
# include <arpa/nameser.h>
# endif
])
dnl Specific dir for HTML output ?
if test "x$with_html_dir" = "x" ; then

View File

@ -37,21 +37,19 @@ $(APIPAGES): libxml2-refs.xml site.xsl api.xsl
$(bindir)/xsltproc --html $(top_srcdir)/doc/api.xsl $(top_srcdir)/doc/xml.html ; fi );
scan:
gtkdoc-scan --module=libxml --source-dir=$(DOC_SOURCE_DIR) --ignore-headers="acconfig.h config.h win32config.h trio.h triostr.h triop.h config-mac.h XMLTestPrefix2.h XMLTestPrefix.h triodef.h trionan.h xlink.h libxml.h libxml2-py.h libxml_wrap.h xmlschemas.h xmlschemastypes.h"
-gtkdoc-scan --module=libxml --source-dir=$(DOC_SOURCE_DIR) --ignore-headers="acconfig.h config.h win32config.h trio.h triostr.h triop.h config-mac.h XMLTestPrefix2.h XMLTestPrefix.h triodef.h trionan.h xlink.h libxml.h libxml2-py.h libxml_wrap.h xmlschemas.h xmlschemastypes.h"
templates: scan
gtkdoc-mktmpl --module=libxml
-gtkdoc-mktmpl --module=libxml
sgml:
gtkdoc-mkdb --module=libxml --source-dir=$(DOC_SOURCE_DIR)
sgml: templates
-gtkdoc-mkdb --module=libxml --source-dir=$(DOC_SOURCE_DIR)
xml: sgml
xml: sgml
if test -d xml ; then rm xml/* ; else mkdir xml ; fi
-@(for s in sgml/*.sgml ; do name=`basename $$s .sgml` ; \
echo '<!DOCTYPE refentry [ <!ENTITY nbsp "&#x00A0;"> ]>' > \
xml/"$$name".xml ;\
grep -v "^<colspec" $$s | sed 's+<anchor(.*>+<anchor\1/>+' >> xml/"$$name".xml ; done)
xmllint --sgml $$s > xml/"$$name".xml ; done)
libxml2-api.xml libxml2-refs.xml: xml parsedecl.py libxml-decl.txt libxml-decl-list.txt
-(./parsedecl.py)
@ -67,7 +65,7 @@ clean-local:
maintainer-clean-local: clean
rm -rf sgml html libxml-decl-list.txt libxml-decl.txt
libxml-decl-list.txt : templates
libxml-decl-list.txt libxml-decl.txt : templates
libxml-sections.txt : scan
cp libxml-decl-list.txt libxml-sections.txt

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -450,196 +450,102 @@ def insertComment(name, title, value, id):
nbcomments = nbcomments + 1
import libxml2
import os
import xmllib
try:
import sgmlop
except ImportError:
sgmlop = None # accelerator not available
debug = 0
if sgmlop:
class FastParser:
"""sgmlop based XML parser. this is typically 15x faster
than SlowParser..."""
def __init__(self, target):
# setup callbacks
self.finish_starttag = target.start
self.finish_endtag = target.end
self.handle_data = target.data
# activate parser
self.parser = sgmlop.XMLParser()
self.parser.register(self)
self.feed = self.parser.feed
self.entity = {
"amp": "&", "gt": ">", "lt": "<",
"apos": "'", "quot": '"'
}
def close(self):
try:
self.parser.close()
finally:
self.parser = self.feed = None # nuke circular reference
def handle_entityref(self, entity):
# <string> entity
try:
self.handle_data(self.entity[entity])
except KeyError:
self.handle_data("&%s;" % entity)
else:
FastParser = None
class SlowParser(xmllib.XMLParser):
"""slow but safe standard parser, based on the XML parser in
Python's standard library."""
def analyzeXMLDescriptionRow(doc, desc, id, row):
if doc == None or desc == None or id == None or row == None:
return
ctxt = doc.xpathNewContext()
ctxt.setContextNode(row)
param = ctxt.xpathEval("entry[1]/parameter")
entries = ctxt.xpathEval("entry")
if param == []:
is_param = 0
name = None
else:
name = param[0].content
is_param = 1
str = entries[1].content
str = string.replace(str, '\n', ' ')
str = string.replace(str, '\r', ' ')
str = string.replace(str, ' ', ' ')
str = string.replace(str, ' ', ' ')
str = string.replace(str, ' ', ' ')
while len(str) >= 1 and str[0] == ' ':
str=str[1:]
def __init__(self, target):
self.unknown_starttag = target.start
self.handle_data = target.data
self.unknown_endtag = target.end
xmllib.XMLParser.__init__(self)
insertParameterComment(id, name, str, is_param)
def getparser(target = None):
# get the fastest available parser, and attach it to an
# unmarshalling object. return both objects.
if target == None:
target = docParser()
if FastParser:
return FastParser(target), target
return SlowParser(target), target
class docParser:
def __init__(self):
self._methodname = None
self._data = []
self.id = None
self.title = None
self.descr = None
self.string = None
def close(self):
if debug:
print "close"
def analyzeXMLDescription(doc, desc):
if doc == None or desc == None:
return
ctxt = doc.xpathNewContext()
ctxt.setContextNode(desc)
def getmethodname(self):
return self._methodname
#
# get the function name
#
try:
title = ctxt.xpathEval("title")[0].content
except:
return
old_id = ctxt.xpathEval("string(title/anchor/@id)")
id = string.replace(title, '(', ' ');
id = string.replace(id, ')', ' ');
id = string.split(id) [0]
def data(self, text):
if debug:
print "data %s" % text
self._data.append(text)
#
# get the function comments
#
comment = ""
paras = ctxt.xpathEval("para")
for para in paras:
str = para.content
str = string.replace(str, '\n', ' ')
str = string.replace(str, '\r', ' ')
str = string.replace(str, ' ', ' ')
str = string.replace(str, ' ', ' ')
str = string.replace(str, ' ', ' ')
while len(str) >= 1 and str[0] == ' ':
str=str[1:]
def start(self, tag, attrs):
if debug:
print "start %s, %s" % (tag, attrs)
if tag == 'refsect2':
self.id = None
self.title = None
self.descr = None
self.string = None
self.type = None
self.in_parameter = 0
self.is_parameter = 0
self.parameter = None
self.parameter_info = None
self.entry = 0
elif tag == 'para':
self._data = []
elif tag == 'title':
self._data = []
elif tag == 'tgroup':
self.in_parameter = 1
elif tag == 'row':
self._data = []
self.entry = 0
elif tag == 'entry':
self.entry = self.entry + 1
elif tag == 'parameter' and self.in_parameter == 1:
self._data = []
elif tag == 'anchor' and self.id == None:
if attrs.has_key('id'):
self.orig_id = attrs['id']
self.id = string.replace(self.orig_id, '-CAPS', '')
self.id = string.replace(self.id, '-', '_')
comment = comment + str
def end(self, tag):
if debug:
print "end %s" % tag
if tag == 'refsect2':
self.type = insertComment(self.id, self.title, self.string,
self.orig_id)
self.string = None
elif tag == 'row':
if self.parameter_info != None and self.parameter_info != '':
insertParameterComment(self.id, self.parameter,
self.parameter_info, self.is_parameter)
self.parameter_info = None
self.parameter = 0
self.is_parameter = 0
elif tag == 'parameter' and self.in_parameter == 1 and self.entry == 1:
str = ''
for c in self._data:
str = str + c
str = string.replace(str, '\n', ' ')
str = string.replace(str, '\r', ' ')
str = string.replace(str, ' ', ' ')
str = string.replace(str, ' ', ' ')
str = string.replace(str, ' ', ' ')
while len(str) >= 1 and str[0] == ' ':
str=str[1:]
self.parameter = str
self.is_parameter = 1
self._data = []
elif tag == 'para' or tag == 'entry':
str = ''
for c in self._data:
str = str + c
str = string.replace(str, '\n', ' ')
str = string.replace(str, '\r', ' ')
str = string.replace(str, ' ', ' ')
str = string.replace(str, ' ', ' ')
str = string.replace(str, ' ', ' ')
while len(str) >= 1 and str[0] == ' ':
str=str[1:]
if self.string == None:
self.string = str
elif self.in_parameter == 1:
self.parameter_info = str
self._data = []
elif tag == 'title':
str = ''
for c in self._data:
str = str + c
str = string.replace(str, '\n', ' ')
str = string.replace(str, '\r', ' ')
str = string.replace(str, ' ', ' ')
str = string.replace(str, ' ', ' ')
str = string.replace(str, ' ', ' ')
while len(str) >= 1 and str[0] == ' ':
str=str[1:]
self.title = str
insertComment(id, title, comment, old_id)
rows = ctxt.xpathEval("informaltable/tgroup/tbody/row")
for row in rows:
analyzeXMLDescriptionRow(doc, desc, id, row)
def analyzeXMLDoc(doc):
if doc == None:
return
ctxt = doc.xpathNewContext()
descriptions = ctxt.xpathEval("//refsect2")
print len(descriptions)
for description in descriptions:
analyzeXMLDescription(doc, description)
doc = libxml2.parseFile("xml/c14n.xml");
analyzeXMLDoc(doc)
doc.freeDoc()
xmlfiles = 0
filenames = os.listdir("xml")
for filename in filenames:
print filename
try:
f = open("xml/" + filename, 'r')
except IOError, msg:
print file, ":", msg
doc = libxml2.parseFile("xml/" + filename)
analyzeXMLDoc(doc)
doc.freeDoc()
xmlfiles = xmlfiles + 1
except:
print "failed to parse XML description %s" % ("xml/" + filename)
continue
data = f.read()
(parser, target) = getparser()
parser.feed(data)
parser.close()
xmlfiles = xmlfiles + 1
print "Parsed: %d XML files collexting %d comments" % (xmlfiles, nbcomments)