mirror of
https://github.com/wxWidgets/Phoenix.git
synced 2026-02-01 00:20:08 +01:00
Reorder items in the module before the tweaker stage is run such that enums and other constants are processed before the functions and classes that may be using them, etc.
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxPython/Phoenix/trunk@70215 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -17,15 +17,10 @@ from extractors import *
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
|
||||
phoenixRoot = os.path.abspath(os.path.split(__file__)[0]+'/..')
|
||||
from buildtools.config import phoenixDir, wxDir
|
||||
|
||||
xmlsrcbase = 'docs/doxygen/out/xml'
|
||||
WXWIN = os.environ.get('WXWIN')
|
||||
if not WXWIN:
|
||||
for rel in ['../wxWidgets', '..']:
|
||||
path = os.path.join(phoenixRoot, rel, xmlsrcbase)
|
||||
if path and os.path.exists(path):
|
||||
WXWIN = os.path.abspath(os.path.join(phoenixRoot, rel))
|
||||
break
|
||||
WXWIN = wxDir()
|
||||
if WXWIN:
|
||||
XMLSRC = os.path.join(WXWIN, xmlsrcbase)
|
||||
assert WXWIN and os.path.exists(XMLSRC), "Unable to locate Doxygen XML files"
|
||||
@@ -98,6 +93,8 @@ def parseDoxyXML(module, class_or_filename_list):
|
||||
class_or_filename_list.append(name)
|
||||
|
||||
_filesparsed.clear()
|
||||
|
||||
module.parseCompleted()
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
|
||||
|
||||
@@ -990,10 +990,11 @@ class DefineDef(BaseDef):
|
||||
"""
|
||||
Represents a #define with a name and a value.
|
||||
"""
|
||||
def __init__(self, element, **kw):
|
||||
def __init__(self, element=None, **kw):
|
||||
super(DefineDef, self).__init__()
|
||||
self.name = element.find('name').text
|
||||
self.value = flattenNode(element.find('initializer'))
|
||||
if element is not None:
|
||||
self.name = element.find('name').text
|
||||
self.value = flattenNode(element.find('initializer'))
|
||||
self.__dict__.update(kw)
|
||||
|
||||
|
||||
@@ -1192,6 +1193,34 @@ class ModuleDef(BaseDef):
|
||||
self.includes = []
|
||||
self.imports = []
|
||||
|
||||
def parseCompleted(self):
|
||||
"""
|
||||
Called after the loading of items from the XML has completed, just
|
||||
before the tweaking stage is done.
|
||||
"""
|
||||
|
||||
# Reorder the items in the module to be a little more sane, such as
|
||||
# enums and other constants first, then the classes and functions (since
|
||||
# they may use those constants) and then the global variables, but perhaps
|
||||
# only those that have classes in this module as their type.
|
||||
one = list()
|
||||
two = list()
|
||||
three = list()
|
||||
for item in self.items:
|
||||
if isinstance(item, (ClassDef, FunctionDef)):
|
||||
two.append(item)
|
||||
elif isinstance(item, GlobalVarDef):
|
||||
three.append(item)
|
||||
# template instantiations go at the end
|
||||
elif isinstance(item, TypedefDef) and '<' in item.type:
|
||||
three.append(item)
|
||||
|
||||
else:
|
||||
one.append(item)
|
||||
self.items = one + two + three
|
||||
|
||||
|
||||
|
||||
def addHeaderCode(self, code):
|
||||
if isinstance(code, list):
|
||||
self.headerCode.extend(code)
|
||||
|
||||
Reference in New Issue
Block a user