summaryrefslogtreecommitdiffstats
path: root/ppapi/generators/idl_c_proto.py
diff options
context:
space:
mode:
authornoelallen@google.com <noelallen@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2011-08-25 21:04:26 +0000
committernoelallen@google.com <noelallen@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2011-08-25 21:04:26 +0000
commite8a83febaed38a6c891b866a7504de909cd2942b (patch)
tree805c1d4ae13c184cb038f36cb9264c3aae704a0f /ppapi/generators/idl_c_proto.py
parent32b885603a053196143fb27d05772df6301bf6cb (diff)
downloadchromium_src-e8a83febaed38a6c891b866a7504de909cd2942b.zip
chromium_src-e8a83febaed38a6c891b866a7504de909cd2942b.tar.gz
chromium_src-e8a83febaed38a6c891b866a7504de909cd2942b.tar.bz2
More multi-version support (part 2)
Add member to Node to return a set of unique releases for that node. Updates DefineStruct to iterate across all unique releases for the struct, generating first the most recent release as we do today and other releases without comments, and the version number appended to the structure name. NOTE: This is work in progress. This CL adds support for Interfaces that change which should be enough for M15. While this same CL creates multiple structures when the structures change, references to structures will not have mangled names which would cause errors. BUG= http://code.google.com/p/chromium/issues/detail?id=89969 TEST= python generator.py --cgen --test --diff --range=M13,M14 Review URL: http://codereview.chromium.org/7751001 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@98298 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ppapi/generators/idl_c_proto.py')
-rw-r--r--ppapi/generators/idl_c_proto.py30
1 files changed, 23 insertions, 7 deletions
diff --git a/ppapi/generators/idl_c_proto.py b/ppapi/generators/idl_c_proto.py
index 05937e4..1ea8e03 100644
--- a/ppapi/generators/idl_c_proto.py
+++ b/ppapi/generators/idl_c_proto.py
@@ -398,27 +398,43 @@ class CGen(object):
self.LogExit('Exit DefineMember')
return out
- # Define a Struct.
- def DefineStruct(self, node, releases, prefix='', comment=False):
+ def DefineStructInternals(self, node, release, suffix='', comment=True):
out = ''
-
- self.LogEnter('DefineStruct %s' % node)
if node.GetProperty('union'):
- out += 'union %s%s {\n' % (prefix, node.GetName())
+ out += 'union %s%s {\n' % (node.GetName(), suffix)
else:
- out += 'struct %s%s {\n' % (prefix, node.GetName())
+ out += 'struct %s%s {\n' % (node.GetName(), suffix)
# Generate Member Functions
members = []
for child in node.GetListOf('Member'):
- member = self.Define(child, releases, tabs=1, comment=comment)
+ member = self.Define(child, [release], tabs=1, comment=comment)
if not member:
continue
members.append(member)
out += '%s\n};\n' % '\n'.join(members)
+ return out
+
+
+ def DefineStruct(self, node, releases, prefix='', comment=False):
+ self.LogEnter('DefineStruct %s' % node)
+ out = ''
+ build_list = node.GetUniqueReleases(releases)
+
+ # Build the most recent one with comments
+ out = self.DefineStructInternals(node, build_list[-1], comment=True)
+
+ # Build the rest without comments and with the version number appended
+ for rel in build_list[0:-1]:
+ ver_num = node.GetVersion(rel)
+ ver = ("_%s" % ver_num).replace('.', '_')
+ out += '\n' + self.DefineStructInternals(node, rel, suffix=ver,
+ comment=False)
+
self.LogExit('Exit DefineStruct')
return out
+
#
# Copyright and Comment
#