summaryrefslogtreecommitdiffstats
path: root/ppapi/generators
diff options
context:
space:
mode:
Diffstat (limited to 'ppapi/generators')
-rw-r--r--ppapi/generators/idl_c_header.py8
-rw-r--r--ppapi/generators/idl_c_proto.py33
2 files changed, 25 insertions, 16 deletions
diff --git a/ppapi/generators/idl_c_header.py b/ppapi/generators/idl_c_header.py
index d95a7c2..72fbf2a 100644
--- a/ppapi/generators/idl_c_header.py
+++ b/ppapi/generators/idl_c_header.py
@@ -86,8 +86,14 @@ def GenerateHeader(filenode, pref, inline=True):
if include == cur_include: continue
out.Write('#include "%s"\n' % include)
+ # Generate all interface defines
+ release = 'M14'
+ out.Write('\n')
+ for node in filenode.GetListOf('Interface'):
+ out.Write( cgen.InterfaceDefs(node) )
+
# Generate the @file comment
- out.Write('\n%s\n' % cgen.Comment(fileinfo, prefix='*\n @file'))
+ out.Write('%s\n' % cgen.Comment(fileinfo, prefix='*\n @file'))
# Generate definitions.
last_group = None
diff --git a/ppapi/generators/idl_c_proto.py b/ppapi/generators/idl_c_proto.py
index f92bf14..7147bbb 100644
--- a/ppapi/generators/idl_c_proto.py
+++ b/ppapi/generators/idl_c_proto.py
@@ -383,24 +383,27 @@ class CGen(object):
self.LogExit('Exit DefineMember')
return out
+ def InterfaceDefs(self, node):
+ out = ''
+ release = 'M14'
+ name = node.GetName()
+ macro = node.GetProperty('macro')
+ if not macro:
+ macro = self.GetMacro(node)
+ label = node.GetLabel()
+ if label:
+ for vers in label.versions:
+ strver = str(vers).replace('.', '_')
+ out += self.GetDefine('%s_%s' % (macro, strver),
+ '"%s;%s"' % (name, vers))
+ if label.GetRelease(vers) == release:
+ out += self.GetDefine(macro, '%s_%s' % (macro, strver))
+ out += '\n'
+ return out
+
# Define a Struct.
def DefineStruct(self, node, prefix='', comment=False):
out = ''
- if node.IsA('Interface'):
- release = 'M14'
- name = node.GetName()
- macro = node.GetProperty('macro')
- if not macro:
- macro = self.GetMacro(node)
- label = node.GetLabel()
- if label:
- for vers in label.versions:
- strver = str(vers).replace('.', '_')
- out += self.GetDefine('%s_%s' % (macro, strver),
- '"%s;%s"' % (name, vers))
- if label.GetRelease(vers) == release:
- out += self.GetDefine(macro, '%s_%s' % (macro, strver))
- out += '\n'
self.LogEnter('DefineStruct %s' % node)
if node.GetProperty('union'):