1
0
mirror of https://gitlab.gnome.org/GNOME/libxml2.git synced 2025-07-14 20:01:04 +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> Tue Nov 19 09:09:04 CET 2002 Daniel Veillard <daniel@veillard.com>
* parser.c: Martin Stoilov pointed out a potential leak in * parser.c: Martin Stoilov pointed out a potential leak in

View File

@ -82,12 +82,63 @@ LDFLAGS=${_ldflags}
dnl Checks for header files. dnl Checks for header files.
AC_HEADER_DIRENT AC_HEADER_DIRENT
AC_HEADER_STDC AC_HEADER_STDC
AC_CHECK_HEADERS(fcntl.h unistd.h ctype.h dirent.h errno.h malloc.h) AC_CHECK_HEADERS([fcntl.h])
AC_CHECK_HEADERS(stdarg.h sys/stat.h sys/types.h time.h ansidecl.h) AC_CHECK_HEADERS([unistd.h])
AC_CHECK_HEADERS(ieeefp.h nan.h math.h fp_class.h float.h) AC_CHECK_HEADERS([ctype.h])
AC_CHECK_HEADERS(stdlib.h sys/socket.h netinet/in.h arpa/inet.h) AC_CHECK_HEADERS([dirent.h])
AC_CHECK_HEADERS(netdb.h sys/time.h sys/select.h sys/mman.h) AC_CHECK_HEADERS([errno.h])
AC_CHECK_HEADERS(sys/timeb.h signal.h arpa/nameser.h resolv.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 ? dnl Specific dir for HTML output ?
if test "x$with_html_dir" = "x" ; then 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 ); $(bindir)/xsltproc --html $(top_srcdir)/doc/api.xsl $(top_srcdir)/doc/xml.html ; fi );
scan: 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 templates: scan
gtkdoc-mktmpl --module=libxml -gtkdoc-mktmpl --module=libxml
sgml: sgml: templates
gtkdoc-mkdb --module=libxml --source-dir=$(DOC_SOURCE_DIR) -gtkdoc-mkdb --module=libxml --source-dir=$(DOC_SOURCE_DIR)
xml: sgml xml: sgml
if test -d xml ; then rm xml/* ; else mkdir xml ; fi if test -d xml ; then rm xml/* ; else mkdir xml ; fi
-@(for s in sgml/*.sgml ; do name=`basename $$s .sgml` ; \ -@(for s in sgml/*.sgml ; do name=`basename $$s .sgml` ; \
echo '<!DOCTYPE refentry [ <!ENTITY nbsp "&#x00A0;"> ]>' > \ xmllint --sgml $$s > xml/"$$name".xml ; done)
xml/"$$name".xml ;\
grep -v "^<colspec" $$s | sed 's+<anchor(.*>+<anchor\1/>+' >> xml/"$$name".xml ; done)
libxml2-api.xml libxml2-refs.xml: xml parsedecl.py libxml-decl.txt libxml-decl-list.txt libxml2-api.xml libxml2-refs.xml: xml parsedecl.py libxml-decl.txt libxml-decl-list.txt
-(./parsedecl.py) -(./parsedecl.py)
@ -67,7 +65,7 @@ clean-local:
maintainer-clean-local: clean maintainer-clean-local: clean
rm -rf sgml html libxml-decl-list.txt libxml-decl.txt 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 libxml-sections.txt : scan
cp libxml-decl-list.txt libxml-sections.txt 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 nbcomments = nbcomments + 1
import libxml2
import os 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): def analyzeXMLDescriptionRow(doc, desc, id, row):
"""slow but safe standard parser, based on the XML parser in if doc == None or desc == None or id == None or row == None:
Python's standard library.""" 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): insertParameterComment(id, name, str, is_param)
self.unknown_starttag = target.start
self.handle_data = target.data
self.unknown_endtag = target.end
xmllib.XMLParser.__init__(self)
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): def analyzeXMLDescription(doc, desc):
if debug: if doc == None or desc == None:
print "close" 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: # get the function comments
print "data %s" % text #
self._data.append(text) 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): comment = comment + str
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, '-', '_')
def end(self, tag): insertComment(id, title, comment, old_id)
if debug:
print "end %s" % tag rows = ctxt.xpathEval("informaltable/tgroup/tbody/row")
if tag == 'refsect2': for row in rows:
self.type = insertComment(self.id, self.title, self.string, analyzeXMLDescriptionRow(doc, desc, id, row)
self.orig_id)
self.string = None def analyzeXMLDoc(doc):
elif tag == 'row': if doc == None:
if self.parameter_info != None and self.parameter_info != '': return
insertParameterComment(self.id, self.parameter, ctxt = doc.xpathNewContext()
self.parameter_info, self.is_parameter) descriptions = ctxt.xpathEval("//refsect2")
self.parameter_info = None print len(descriptions)
self.parameter = 0 for description in descriptions:
self.is_parameter = 0 analyzeXMLDescription(doc, description)
elif tag == 'parameter' and self.in_parameter == 1 and self.entry == 1:
str = '' doc = libxml2.parseFile("xml/c14n.xml");
for c in self._data: analyzeXMLDoc(doc)
str = str + c doc.freeDoc()
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
xmlfiles = 0 xmlfiles = 0
filenames = os.listdir("xml") filenames = os.listdir("xml")
for filename in filenames: for filename in filenames:
print filename
try: try:
f = open("xml/" + filename, 'r') doc = libxml2.parseFile("xml/" + filename)
except IOError, msg: analyzeXMLDoc(doc)
print file, ":", msg doc.freeDoc()
xmlfiles = xmlfiles + 1
except:
print "failed to parse XML description %s" % ("xml/" + filename)
continue 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) print "Parsed: %d XML files collexting %d comments" % (xmlfiles, nbcomments)