added an XML description of the API, moved the script generating it here.

* Makefile.am doc/Makefile.am doc/libxml2-api.xml doc/parsedecl.py:
  added an XML description of the API, moved the script generating
  it here. Added a "make api" target
Daniel
This commit is contained in:
Daniel Veillard 2002-01-21 17:31:47 +00:00
parent d2f23009b3
commit 610064716f
9 changed files with 6496 additions and 5538 deletions

View File

@ -1,3 +1,9 @@
Mon Jan 21 18:29:19 CET 2002 Daniel Veillard <daniel@veillard.com>
* Makefile.am doc/Makefile.am doc/libxml2-api.xml doc/parsedecl.py:
added an XML description of the API, moved the script generating
it here. Added a "make api" target
Mon Jan 21 14:34:37 CET 2002 Daniel Veillard <daniel@veillard.com>
* tree.c: Adam Lounds pointed out a bug in xmlSearchNs()

View File

@ -1,5 +1,5 @@
## Process this file with automake to produce Makefile.in
AUTOMAKE_OPTIONS=no-dependencies
#AUTOMAKE_OPTIONS=no-dependencies
SUBDIRS = include . doc example

View File

@ -26,7 +26,7 @@ $(PAGES): xml.html site.xsl
$(bindir)/xsltproc --html $(top_srcdir)/doc/site.xsl $(top_srcdir)/doc/xml.html > index.html ; fi );
scan:
gtkdoc-scan --module=libxml --source-dir=$(DOC_SOURCE_DIR) --ignore-headers="acconfig.h config.h xmlwin32version.h win32config.h trio.h triostr.h triop.h config-mac.h XMLTestPrefix2.h XMLTestPrefix.h triodef.h trionan.h xlink.h"
gtkdoc-scan --module=libxml --source-dir=$(DOC_SOURCE_DIR) --ignore-headers="acconfig.h config.h xmlwin32version.h win32config.h trio.h triostr.h triop.h config-mac.h XMLTestPrefix2.h XMLTestPrefix.h triodef.h trionan.h xlink.h libxml.h"
templates: scan
gtkdoc-mktmpl --module=libxml
@ -34,6 +34,18 @@ templates: scan
sgml:
gtkdoc-mkdb --module=libxml --source-dir=$(DOC_SOURCE_DIR)
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 >> xml/"$$name".xml ; done)
libxml2-api.xml: xml parsedecl.py libxml-decl.txt libxml-decl-list.txt
-./parsedecl.py
api: libxml2-api.xml
html:
if test -n -d html ; then mkdir html ; fi
-cd html && gtkdoc-mkhtml libxml ../$(DOC_MAIN_SGML_FILE)
@ -49,7 +61,7 @@ libxml-decl-list.txt : templates
libxml-sections.txt : scan
cp libxml-decl-list.txt libxml-sections.txt
rebuild: libxml-sections.txt templates sgml html
rebuild: libxml-sections.txt templates sgml html api
install-data-local:
$(mkinstalldirs) $(DESTDIR)$(TARGET_DIR)
@ -59,6 +71,6 @@ install-data-local:
-(cd $(DESTDIR); gtkdoc-fixxref --module=libxml --html-dir=$(HTML_DIR))
dist-hook:
(cd $(srcdir) ; tar cvf - *.1 site.xsl *.html *.gif html/*.html html/*.sgml) | (cd $(distdir); tar xf -)
(cd $(srcdir) ; tar cvf - *.1 site.xsl *.html *.gif html/*.html html/*.sgml libxml2-api.xml parsedecl.py) | (cd $(distdir); tar xf -)
.PHONY : html sgml templates scan

View File

@ -1,327 +0,0 @@
<HTML
><HEAD
><TITLE
>Gnome XML Library Reference Manual</TITLE
><META
NAME="GENERATOR"
CONTENT="Modular DocBook HTML Stylesheet Version 1.64
"><LINK
REL="NEXT"
TITLE="Libxml Programming Notes"
HREF="libxml-notes.html"></HEAD
><BODY
CLASS="BOOK"
BGCOLOR="#FFFFFF"
TEXT="#000000"
LINK="#0000FF"
VLINK="#840084"
ALINK="#0000FF"
><DIV
CLASS="BOOK"
><DIV
CLASS="TITLEPAGE"
><TABLE
WIDTH="100%"
BORDER="0"
BGCOLOR="#000000"
CELLPADDING="1"
CELLSPACING="0"
><TR
><TH
ALIGN="center"
VALIGN="center"
><FONT
COLOR="#FFFFFF"
SIZE="7"
><P
CLASS="TITLE"
><A
NAME="AEN2"
>Gnome XML Library Reference Manual</A
></P
></FONT
></TH
></TR
></TABLE
><H3
CLASS="AUTHOR"
><A
NAME="AEN5"
>Daniel Veillard</A
></H3
><DIV
CLASS="AFFILIATION"
><DIV
CLASS="ADDRESS"
><P
CLASS="ADDRESS"
> &nbsp;&nbsp;&nbsp;&nbsp;daniel@veillard.com<br>
&nbsp;&nbsp;</P
></DIV
></DIV
><P
CLASS="COPYRIGHT"
>Copyright &copy; 1999 by Daniel Veillard</P
><DIV
><DIV
CLASS="ABSTRACT"
><A
NAME="AEN18"
></A
><P
></P
><P
>This manual documents the interfaces of the libxml
library and has some short notes to help get you up to speed
with using the library.</P
><P
></P
></DIV
></DIV
><DIV
CLASS="LEGALNOTICE"
><A
NAME="AEN14"
></A
><P
></P
><P
>Permission is granted to make and distribute verbatim
copies of this manual provided the copyright notice and this
permission notice are preserved on all copies.</P
><P
>Permission is granted to copy and distribute modified
versions of this manual under the conditions for verbatim
copying, provided also that the entire resulting derived work is
distributed under the terms of a permission notice identical to
this one.</P
><P
>Permission is granted to copy and distribute translations
of this manual into another language, under the above conditions
for modified versions.</P
><P
></P
></DIV
></DIV
><DIV
CLASS="TOC"
><DL
><DT
><B
>Table of Contents</B
></DT
><DT
><A
HREF="libxml-notes.html"
>Libxml Programming Notes</A
></DT
><DT
><A
HREF="libxml-lib.html"
>Libxml Library Reference</A
></DT
><DD
><DL
><DT
><A
HREF="libxml-parser.html"
>parser</A
> &#8212; </DT
><DT
><A
HREF="libxml-sax.html"
>SAX</A
> &#8212; </DT
><DT
><A
HREF="libxml-tree.html"
>tree</A
> &#8212; </DT
><DT
><A
HREF="libxml-entities.html"
>entities</A
> &#8212; </DT
><DT
><A
HREF="libxml-valid.html"
>valid</A
> &#8212; </DT
><DT
><A
HREF="libxml-uri.html"
>uri</A
> &#8212; </DT
><DT
><A
HREF="libxml-xmlerror.html"
>xmlerror</A
> &#8212; </DT
><DT
><A
HREF="libxml-htmlparser.html"
>HTMLparser</A
> &#8212; </DT
><DT
><A
HREF="libxml-htmltree.html"
>HTMLtree</A
> &#8212; </DT
><DT
><A
HREF="libxml-xpath.html"
>xpath</A
> &#8212; </DT
><DT
><A
HREF="libxml-xpathinternals.html"
>xpathInternals</A
> &#8212; </DT
><DT
><A
HREF="libxml-xpointer.html"
>xpointer</A
> &#8212; </DT
><DT
><A
HREF="libxml-xinclude.html"
>xinclude</A
> &#8212; </DT
><DT
><A
HREF="libxml-nanohttp.html"
>nanohttp</A
> &#8212; </DT
><DT
><A
HREF="libxml-nanoftp.html"
>nanoftp</A
> &#8212; </DT
><DT
><A
HREF="libxml-xmlio.html"
>xmlIO</A
> &#8212; </DT
><DT
><A
HREF="libxml-catalog.html"
>catalog</A
> &#8212; </DT
><DT
><A
HREF="libxml-threads.html"
>threads</A
> &#8212; </DT
><DT
><A
HREF="libxml-globals.html"
>globals</A
> &#8212; </DT
><DT
><A
HREF="libxml-docbparser.html"
>DOCBparser</A
> &#8212; </DT
><DT
><A
HREF="libxml-parserinternals.html"
>parserInternals</A
> &#8212; </DT
><DT
><A
HREF="libxml-encoding.html"
>encoding</A
> &#8212; </DT
><DT
><A
HREF="libxml-hash.html"
>hash</A
> &#8212; </DT
><DT
><A
HREF="libxml-debugxml.html"
>debugXML</A
> &#8212; </DT
><DT
><A
HREF="libxml-xmlmemory.html"
>xmlmemory</A
> &#8212; </DT
></DL
></DD
></DL
></DIV
></DIV
><DIV
CLASS="NAVFOOTER"
><BR
CLEAR="all"><BR><TABLE
WIDTH="100%"
BORDER="0"
BGCOLOR="#000000"
CELLPADDING="1"
CELLSPACING="0"
><TR
><TD
WIDTH="25%"
BGCOLOR="#C00000"
ALIGN="left"
>&nbsp;</TD
><TD
WIDTH="25%"
BGCOLOR="#0000C0"
ALIGN="center"
><FONT
COLOR="#FFFFFF"
SIZE="3"
><B
>&nbsp;</B
></FONT
></TD
><TD
WIDTH="25%"
BGCOLOR="#00C000"
ALIGN="center"
><FONT
COLOR="#FFFFFF"
SIZE="3"
><B
>&nbsp;</B
></FONT
></TD
><TD
WIDTH="25%"
BGCOLOR="#C00000"
ALIGN="right"
><A
HREF="libxml-notes.html"
><FONT
COLOR="#FFFFFF"
SIZE="3"
><B
>Next Page &#62;&#62;&#62;</B
></FONT
></A
></TD
></TR
><TR
><TD
COLSPAN="2"
ALIGN="left"
>&nbsp;</TD
><TD
COLSPAN="2"
ALIGN="right"
><FONT
COLOR="#FFFFFF"
SIZE="3"
><B
>Libxml Programming Notes</B
></FONT
></TD
></TR
></TABLE
></DIV
></BODY
></HTML
>

View File

@ -166,184 +166,4 @@ HREF="libxml-htmltree.html"
><A
HREF="libxml-xpath.html"
>xpath</A
> &#8212; </DT
><DT
><A
HREF="libxml-xpathinternals.html"
>xpathInternals</A
> &#8212; </DT
><DT
><A
HREF="libxml-xpointer.html"
>xpointer</A
> &#8212; </DT
><DT
><A
HREF="libxml-xinclude.html"
>xinclude</A
> &#8212; </DT
><DT
><A
HREF="libxml-nanohttp.html"
>nanohttp</A
> &#8212; </DT
><DT
><A
HREF="libxml-nanoftp.html"
>nanoftp</A
> &#8212; </DT
><DT
><A
HREF="libxml-xmlio.html"
>xmlIO</A
> &#8212; </DT
><DT
><A
HREF="libxml-catalog.html"
>catalog</A
> &#8212; </DT
><DT
><A
HREF="libxml-threads.html"
>threads</A
> &#8212; </DT
><DT
><A
HREF="libxml-globals.html"
>globals</A
> &#8212; </DT
><DT
><A
HREF="libxml-docbparser.html"
>DOCBparser</A
> &#8212; </DT
><DT
><A
HREF="libxml-parserinternals.html"
>parserInternals</A
> &#8212; </DT
><DT
><A
HREF="libxml-encoding.html"
>encoding</A
> &#8212; </DT
><DT
><A
HREF="libxml-hash.html"
>hash</A
> &#8212; </DT
><DT
><A
HREF="libxml-debugxml.html"
>debugXML</A
> &#8212; </DT
><DT
><A
HREF="libxml-xmlmemory.html"
>xmlmemory</A
> &#8212; </DT
></DL
></DIV
><P
>This section contains the API reference for libxml. All
the public interfaces are documented here. This reference guide is
build by extracting comments from the code sources. </P
>_functions;
</DIV
><DIV
CLASS="NAVFOOTER"
><BR
CLEAR="all"><BR><TABLE
WIDTH="100%"
BORDER="0"
BGCOLOR="#000000"
CELLPADDING="1"
CELLSPACING="0"
><TR
><TD
WIDTH="25%"
BGCOLOR="#C00000"
ALIGN="left"
><A
HREF="libxml-notes.html"
><FONT
COLOR="#FFFFFF"
SIZE="3"
><B
>&#60;&#60;&#60; Previous Page</B
></FONT
></A
></TD
><TD
WIDTH="25%"
BGCOLOR="#0000C0"
ALIGN="center"
><FONT
COLOR="#FFFFFF"
SIZE="3"
><B
><A
HREF="book1.html"
><FONT
COLOR="#FFFFFF"
SIZE="3"
><B
>Home</B
></FONT
></A
></B
></FONT
></TD
><TD
WIDTH="25%"
BGCOLOR="#00C000"
ALIGN="center"
><FONT
COLOR="#FFFFFF"
SIZE="3"
><B
>&nbsp;</B
></FONT
></TD
><TD
WIDTH="25%"
BGCOLOR="#C00000"
ALIGN="right"
><A
HREF="libxml-parser.html"
><FONT
COLOR="#FFFFFF"
SIZE="3"
><B
>Next Page &#62;&#62;&#62;</B
></FONT
></A
></TD
></TR
><TR
><TD
COLSPAN="2"
ALIGN="left"
><FONT
COLOR="#FFFFFF"
SIZE="3"
><B
>Libxml Programming Notes</B
></FONT
></TD
><TD
COLSPAN="2"
ALIGN="right"
><FONT
COLOR="#FFFFFF"
SIZE="3"
><B
>parser</B
></FONT
></TD
></TR
></TABLE
></DIV
></BODY
></HTML
>
> &#8212;

File diff suppressed because it is too large Load Diff

6043
doc/libxml2-api.xml Normal file

File diff suppressed because it is too large Load Diff

336
doc/parsedecl.py Executable file
View File

@ -0,0 +1,336 @@
#!/usr/bin/python -u
#
# tries to parse the output of gtk-doc declaration files and make
# an XML reusable description from them
#
# TODO: try to extracts comments from the DocBook output of
import sys
import string
macros = []
structs = []
typedefs = []
enums = {}
functions = {}
private_functions = {}
ret_types = {}
types = {}
sections = []
files = {}
identifiers_file = {}
identifiers_type = {}
def mormalizeTypeSpaces(raw, function):
global types
tokens = string.split(raw)
type = ''
for token in tokens:
if type != '':
type = type + ' ' + token
else:
type = token
if types.has_key(type):
types[type].append(function)
else:
types[type] = [function]
return type
def removeComments(raw):
while string.find(raw, '/*') > 0:
e = string.find(raw, '/*')
tmp = raw[0:e]
raw = raw[e:]
e = string.find(raw, '*/')
if e > 0:
raw = tmp + raw[e + 2:]
else:
raw = tmp
return raw
def extractArgs(raw, function):
raw = removeComments(raw)
list = string.split(raw, ",")
ret = []
for arg in list:
i = len(arg)
if i == 0:
continue
i = i - 1
c = arg[i]
while string.find(string.letters, c) >= 0 or \
string.find(string.digits, c) >= 0:
i = i - 1
if i < 0:
break
c = arg[i]
name = arg[i+1:]
while string.find(string.whitespace, c) >= 0:
i = i - 1
if i < 0:
break
c = arg[i]
type = mormalizeTypeSpaces(arg[0:i+1], function)
# print "list: %s -> %s, %s" % (list, type, name)
ret.append((type, name))
return ret
def extractTypes(raw, function):
global ret_types
tokens = string.split(raw)
type = ''
for token in tokens:
if type != '':
type = type + ' ' + token
else:
type = token
if ret_types.has_key(type):
ret_types[type].append(function)
else:
ret_types[type] = [function]
return type
def parseMacro():
global input
global macros
line = input.readline()[:-1]
while line != "</MACRO>":
if line[0:6] == "<NAME>" and line[-7:] == "</NAME>":
name = line[6:-7]
line = input.readline()[:-1]
macros.append(name)
identifiers_type[name] = "macro"
def parseStruct():
global input
global structs
line = input.readline()[:-1]
while line != "</STRUCT>":
if line[0:6] == "<NAME>" and line[-7:] == "</NAME>":
name = line[6:-7]
line = input.readline()[:-1]
structs.append(name)
identifiers_type[name] = "struct"
def parseTypedef():
global input
global typedefs
line = input.readline()[:-1]
while line != "</TYPEDEF>":
if line[0:6] == "<NAME>" and line[-7:] == "</NAME>":
name = line[6:-7]
line = input.readline()[:-1]
typedefs.append(name)
identifiers_type[name] = "typedef"
def parseEnum():
global input
global enums
line = input.readline()[:-1]
consts = []
while line != "</ENUM>":
if line[0:6] == "<NAME>" and line[-7:] == "</NAME>":
name = line[6:-7]
elif string.find(line, 'enum') >= 0:
pass
elif string.find(line, '{') >= 0:
pass
elif string.find(line, '}') >= 0:
pass
elif string.find(line, ';') >= 0:
pass
else:
comment = string.find(line, '/*')
if comment >= 0:
line = line[0:comment]
decls = string.split(line, ",")
for decl in decls:
val = string.split(decl, "=")[0]
tokens = string.split(val)
if len(tokens) >= 1:
token = tokens[0]
if string.find(string.letters, token[0]) >= 0:
consts.append(token)
identifiers_type[token] = "const"
line = input.readline()[:-1]
enums[name] = consts
identifiers_type[name] = "enum"
def parseStaticFunction():
global input
global private_functions
line = input.readline()[:-1]
type = None
signature = None
while line != "</USER_FUNCTION>":
if line[0:6] == "<NAME>" and line[-7:] == "</NAME>":
name = line[6:-7]
elif line[0:9] == "<RETURNS>" and line[-10:] == "</RETURNS>":
type = extractTypes(line[9:-10], name)
else:
signature = line
line = input.readline()[:-1]
args = extractArgs(signature, name)
private_functions[name] = (type , args)
identifiers_type[name] = "private_func"
def parseFunction():
global input
global functions
line = input.readline()[:-1]
type = None
signature = None
while line != "</FUNCTION>":
if line[0:6] == "<NAME>" and line[-7:] == "</NAME>":
name = line[6:-7]
elif line[0:9] == "<RETURNS>" and line[-10:] == "</RETURNS>":
type = extractTypes(line[9:-10], name)
else:
signature = line
line = input.readline()[:-1]
args = extractArgs(signature, name)
functions[name] = (type , args)
identifiers_type[name] = "function"
def parseSection():
global input
global sections
global files
global identifiers_file
tokens = []
line = input.readline()[:-1]
while line != "</SECTION>":
if line[0:6] == "<FILE>" and line[-7:] == "</FILE>":
name = line[6:-7]
elif len(line) > 0:
tokens.append(line)
line = input.readline()[:-1]
sections.append(name)
files[name] = tokens
for token in tokens:
identifiers_file[token] = name
#
# Small transitivity for enum values
#
if enums.has_key(token):
for const in enums[token]:
identifiers_file[const] = name
print "Parsing: libxml-decl.txt"
input = open('libxml-decl.txt')
while 1:
line = input.readline()
if not line:
break
line = line[:-1]
if line == "<MACRO>":
parseMacro()
elif line == "<ENUM>":
parseEnum()
elif line == "<FUNCTION>":
parseFunction()
elif line == "<STRUCT>":
parseStruct()
elif line == "<TYPEDEF>":
parseTypedef()
elif line == "<USER_FUNCTION>":
parseStaticFunction()
elif len(line) >= 1 and line[0] == "<":
print "unhandled %s" % (line)
print "Parsed: %d macros. %d structs, %d typedefs, %d enums" % (
len(macros), len(structs), len(typedefs), len(enums))
c = 0
for enum in enums.keys():
consts = enums[enum]
c = c + len(consts)
print " %d constants, %d functions and %d private functions" % (
c, len(functions.keys()), len(private_functions.keys()))
print "The functions manipulates %d different types" % (len(types.keys()))
print "The functions returns %d different types" % (len(ret_types.keys()))
print "Parsing: libxml-decl-list.txt"
input = open('libxml-decl-list.txt')
while 1:
line = input.readline()
if not line:
break
line = line[:-1]
if line == "<SECTION>":
parseSection()
elif len(line) >= 1 and line[0] == "<":
print "unhandled %s" % (line)
print "Parsed: %d files %d identifiers" % (len(files), len(identifiers_file.keys()))
print "Saving XML description libxml2-api.xml"
output = open("libxml2-api.xml", "w")
output.write("<api name='libxml2'>\n")
output.write(" <files>\n")
for file in files.keys():
output.write(" <file name='%s'>\n" % file)
for symbol in files[file]:
output.write(" <exports symbol='%s'/>\n" % (symbol))
output.write(" </file>\n")
output.write(" </files>\n")
output.write(" <symbols>\n")
symbols=macros
for i in structs: symbols.append(i)
for i in typedefs: symbols.append(i)
for i in enums.keys():
symbols.append(i)
for j in enums[i]:
symbols.append(j)
for i in functions.keys(): symbols.append(i)
symbols.sort()
prev = None
for i in symbols:
if i == prev:
# print "Symbol %s redefined" % (i)
continue
else:
prev = i
if identifiers_type.has_key(i):
type = identifiers_type[i]
if identifiers_file.has_key(i):
file = identifiers_file[i]
else:
file = None
output.write(" <%s name='%s'" % (type, i))
if file != None:
output.write(" file='%s'" % (file))
if type == "function":
output.write(">\n");
(ret, args) = functions[i]
output.write(" <return type='%s'/>\n" % (ret))
for arg in args:
output.write(" <arg name='%s' type='%s'/>\n" % (
arg[1], arg[0]))
output.write(" </%s>\n" % (type));
else:
output.write("/>\n");
else:
print "Symbol %s not found in identifiers list" % (i)
output.write(" </symbols>\n")
output.write("</api>\n")
print "generated XML for %d symbols" % (len(symbols))

View File

@ -1,185 +0,0 @@
#!/usr/bin/python -u
#
# tries to parse the output of gtk-doc declaration files and make
# something usable from them
#
import sys
import string
input = open('doc/libxml-decl.txt')
macros = []
structs = []
typedefs = []
enums = {}
functions = {}
private_functions = {}
types = {}
def extractTypes(raw, function):
global types
tokens = string.split(raw)
type = ''
for token in tokens:
if type != '':
type = type + ' ' + token
else:
type = token
if types.has_key(type):
types[type].append(function)
else:
types[type] = [function]
return type
def parseMacro():
global input
global macros
line = input.readline()[:-1]
while line != "</MACRO>":
if line[0:6] == "<NAME>" and line[-7:] == "</NAME>":
name = line[6:-7]
line = input.readline()[:-1]
macros.append(name)
def parseStruct():
global input
global structs
line = input.readline()[:-1]
while line != "</STRUCT>":
if line[0:6] == "<NAME>" and line[-7:] == "</NAME>":
name = line[6:-7]
line = input.readline()[:-1]
structs.append(name)
def parseTypedef():
global input
global typedefs
line = input.readline()[:-1]
while line != "</TYPEDEF>":
if line[0:6] == "<NAME>" and line[-7:] == "</NAME>":
name = line[6:-7]
line = input.readline()[:-1]
typedefs.append(name)
def parseEnum():
global input
global enums
line = input.readline()[:-1]
consts = []
while line != "</ENUM>":
if line[0:6] == "<NAME>" and line[-7:] == "</NAME>":
name = line[6:-7]
elif string.find(line, 'enum') >= 0:
pass
elif string.find(line, '{') >= 0:
pass
elif string.find(line, '}') >= 0:
pass
elif string.find(line, ';') >= 0:
pass
else:
comment = string.find(line, '/*')
if comment >= 0:
line = line[0:comment]
decls = string.split(line, ",")
for decl in decls:
val = string.split(decl, "=")[0]
tokens = string.split(val)
if len(tokens) >= 1:
token = tokens[0]
if string.find(string.letters, token[0]) >= 0:
consts.append(token)
line = input.readline()[:-1]
enums[name] = consts
def parseStaticFunction():
global input
global private_functions
line = input.readline()[:-1]
type = None
signature = None
while line != "</USER_FUNCTION>":
if line[0:6] == "<NAME>" and line[-7:] == "</NAME>":
name = line[6:-7]
elif line[0:9] == "<RETURNS>" and line[-10:] == "</RETURNS>":
type = extractTypes(line[9:-10], name)
else:
signature = line
line = input.readline()[:-1]
args = string.split(signature, ",")
sig = []
for arg in args:
l = string.split(arg)
sig.append(extractTypes(l[0], name))
private_functions[name] = (type , sig)
def parseFunction():
global input
global functions
line = input.readline()[:-1]
type = None
signature = None
while line != "</FUNCTION>":
if line[0:6] == "<NAME>" and line[-7:] == "</NAME>":
name = line[6:-7]
elif line[0:9] == "<RETURNS>" and line[-10:] == "</RETURNS>":
type = extractTypes(line[9:-10], name)
else:
signature = line
line = input.readline()[:-1]
args = string.split(signature, ",")
sig = []
for arg in args:
l = string.split(arg)
sig.append(extractTypes(l[0], name))
functions[name] = (type , sig)
while 1:
line = input.readline()
if not line:
break
line = line[:-1]
if line == "<MACRO>":
parseMacro()
elif line == "<ENUM>":
parseEnum()
elif line == "<FUNCTION>":
parseFunction()
elif line == "<STRUCT>":
parseStruct()
elif line == "<TYPEDEF>":
parseTypedef()
elif line == "<USER_FUNCTION>":
parseStaticFunction()
elif len(line) >= 1 and line[0] == "<":
print "unhandled %s" % (line)
print "Parsed: %d macros. %d structs, %d typedefs, %d enums" % (
len(macros), len(structs), len(typedefs), len(enums))
c = 0
for enum in enums.keys():
consts = enums[enum]
c = c + len(consts)
print " %d constants, %d functions and %d private functions" % (
c, len(functions.keys()), len(private_functions.keys()))
print "The functions uses %d different types" % (len(types.keys()))
for type in types.keys():
if string.find(type, '*') >= 0 or (type[0:3] != 'xml' and
type[0:4] != 'html' and type[0:4] != 'docb'):
# print " %s : %s" % (type, types[type])
print " %s" % (type)