Type-mapping isn't needed for parse_xml.py WGL purposes, after all

This commit is contained in:
Nigel Stewart 2019-02-02 18:46:35 +10:00 committed by Nigel Stewart
parent 685e16c7c7
commit 63e352cca0

View File

@ -27,7 +27,7 @@ def findData(node, path):
isPointer = re.compile('(.*)([ ]+)([*]+)') isPointer = re.compile('(.*)([ ]+)([*]+)')
def findParams(node, typeMap = {}): def findParams(node):
n = findData(node, ['name'])[0] n = findData(node, ['name'])[0]
t = '' t = ''
for i in node.childNodes: for i in node.childNodes:
@ -40,8 +40,6 @@ def findParams(node, typeMap = {}):
m = isPointer.match(t) m = isPointer.match(t)
if m: if m:
t = ('%s%s'%(m.group(1), m.group(3))).strip() t = ('%s%s'%(m.group(1), m.group(3))).strip()
if t in typeMap:
t = typeMap[t]
return ( t, n.strip()) return ( t, n.strip())
def findEnums(dom): def findEnums(dom):
@ -52,11 +50,11 @@ def findEnums(dom):
ret[n] = v ret[n] = v
return ret return ret
def findCommands(dom, typeMap = {}): def findCommands(dom):
ret = {} ret = {}
for i in findChildren(dom, [ 'registry', 'commands', 'command' ]): for i in findChildren(dom, [ 'registry', 'commands', 'command' ]):
r,n = findParams(findChildren(i, ['proto'])[0], typeMap) r,n = findParams(findChildren(i, ['proto'])[0])
p = [ findParams(j, typeMap) for j in findChildren(i, ['param'])] p = [ findParams(j) for j in findChildren(i, ['param'])]
ret[n] = (r, p) ret[n] = (r, p)
return ret return ret
@ -87,11 +85,8 @@ def findExtensions(dom):
return ret return ret
def findApi(dom, name): def findApi(dom, name):
typeMap = {}
# if name=='wgl':
# typeMap = { 'int' : 'INT', 'void' : 'VOID' }
enums = findEnums(dom) enums = findEnums(dom)
commands = findCommands(dom, typeMap) commands = findCommands(dom)
features = findFeatures(dom) features = findFeatures(dom)
extensions = findExtensions(dom) extensions = findExtensions(dom)
return (enums, commands, features, extensions) return (enums, commands, features, extensions)