SRC="docs/xml-raw"
+classMap = {
+ 'wxString' : 'String',
+ 'void' : '',
+ }
+
def getModuleNames():
"""
return None
-
+def fixType(typeStr):
+ """
+ Fixup type string, dropping the swig pointer and other flags
+ """
+ pos = typeStr.rfind('.')
+ if pos != -1:
+ typeStr = typeStr[pos+1:]
+ return classMap.get(typeStr, typeStr)
def processModule(newDocNode, modulename):
# make a module element
name = getAttr(topNode, "module")
- assert name == modulename # sanity check
+ ##assert name == modulename # sanity check
moduleNode = libxml2.newNode("module")
moduleNode.setProp("name", name)
node = topNode.children
while node is not None:
if node.name == "include":
- processInclude(moduleNode, node, 0)
+ processInclude(moduleNode, node)
node = node.next
doc.freeDoc()
-def processInclude(moduleNode, includeNode, level):
+def processInclude(moduleNode, includeNode):
"""
Almost everything we are interested in is inside an <include>,
which may also be nested.
node = includeNode.children
while node is not None:
if node.name == "insert":
- processInsert(moduleNode, node, level)
+ processInsert(moduleNode, node)
elif node.name == "class":
- processClass(moduleNode, node, level)
+ processClass(moduleNode, node)
elif node.name == "cdecl" and getAttr(node, "view") == "globalfunctionHandler":
func = libxml2.newNode("method")
func.setProp("name", getAttr(node, "sym_name"))
func.setProp("oldname", getAttr(node, "name"))
- func.setProp("type", getAttr(node, "type"))
+ func.setProp("type", fixType(getAttr(node, "type")))
doCheckOverloaded(func, node)
doDocStrings(func, node)
doParamList(func, node)
elif node.name == "include":
- processInclude(moduleNode, node, level+1)
+ processInclude(moduleNode, node)
node = node.next
-def processInsert(parentNode, insertNode, level):
+def processInsert(parentNode, insertNode):
"""
Check for pythoncode
"""
-def processClass(parentNode, classNode, level):
+def processClass(parentNode, classNode):
"""
Handle classes, constructors, methods, etc.
"""
# make class element
klass = libxml2.newNode("class")
- klass.setProp("name", getAttr(classNode, "sym_name"))
- klass.setProp("oldname", getAttr(classNode, "name"))
+ name = getAttr(classNode, "sym_name")
+ oldname = getAttr(classNode, "name")
+ classMap[oldname] = name
+ klass.setProp("name", name)
+ klass.setProp("oldname", oldname)
klass.setProp("module", getAttr(classNode, "module"))
doDocStrings(klass, classNode)
parentNode.addChild(klass)
# check for baseclass(es)
for node in classNode.xpathEval2("attributelist/baselist/base"):
baseclass = libxml2.newNode("baseclass")
- baseclass.setProp("name", node.prop("name"))
+ basename = node.prop("name")
+ baseclass.setProp("name", classMap.get(basename, basename))
klass.addChild(baseclass)
# check for constructors/destructors
if view == "memberfunctionHandler":
func = libxml2.newNode("method")
func.setProp("name", getAttr(node, "sym_name"))
- func.setProp("type", getAttr(node, "type"))
+ func.setProp("type", fixType(getAttr(node, "type")))
doCheckOverloaded(func, node)
doDocStrings(func, node)
doParamList(func, node)
elif view == "staticmemberfunctionHandler":
func = libxml2.newNode("staticmethod")
func.setProp("name", getAttr(node, "sym_name"))
- func.setProp("type", getAttr(node, "type"))
+ func.setProp("type", fixType(getAttr(node, "type")))
doCheckOverloaded(func, node)
doDocStrings(func, node)
doParamList(func, node)
elif view == "variableHandler":
prop = libxml2.newNode("property")
prop.setProp("name", getAttr(node, "sym_name"))
- prop.setProp("type", getAttr(node, "type"))
+ prop.setProp("type", fixType(getAttr(node, "type")))
if getAttr(node, "feature_immutable"):
prop.setProp("readonly", "yes")
else:
plist = libxml2.newNode("paramlist")
for p in params:
pnode = libxml2.newNode("param")
- pnode.setProp("name", getAttr(p, "name"))
- pnode.setProp("type", getAttr(p, "type"))
+ pnode.setProp("name", getAttr(p, "name"))
+ pnode.setProp("type", fixType(getAttr(p, "type")))
pnode.setProp("default", getAttr(p, "value"))
plist.addChild(pnode)
parentNode.addChild(plist)
autodoc = getAttr(srcNode, "python_autodoc")
docstr = getAttr(srcNode, "feature_docstring")
- refdoc = getAttr(srcNode, "feature_refdoc")
if autodoc:
parentNode.addChild(makeDocElement("autodoc", autodoc))
if docstr:
parentNode.addChild(makeDocElement("docstring", docstr))
- if refdoc:
- parentNode.addChild(makeDocElement("refdoc", refdoc))
processModule(newTopNode, m)
newDoc.saveFormatFile(DEST, True)
-
+ print "Wrote simplified metadata to", DEST
#---------------------------------------------------------------------------