Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(921)

Unified Diff: ppapi/generators/idl_c_proto.py

Issue 538903002: Generate Pepper IDL for OpenGLES2 (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: more comments Created 6 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « ppapi/c/ppb_opengles2.h ('k') | ppapi/native_client/src/untrusted/pnacl_irt_shim/pnacl_shim.c » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ppapi/generators/idl_c_proto.py
diff --git a/ppapi/generators/idl_c_proto.py b/ppapi/generators/idl_c_proto.py
index d029f93d04d795d32aad8b7fe4d71add1eb2266c..bc569ad3210cec36862e13922152f5610bc6cf56 100755
--- a/ppapi/generators/idl_c_proto.py
+++ b/ppapi/generators/idl_c_proto.py
@@ -174,6 +174,21 @@ class CGen(object):
'interface_t' : 'const void*'
}
+ # Tell how to handle pointers to GL types.
+ for gltype in ['GLbitfield', 'GLboolean', 'GLbyte', 'GLclampf',
+ 'GLclampx', 'GLenum', 'GLfixed', 'GLfloat', 'GLint',
+ 'GLintptr', 'GLshort', 'GLsizei', 'GLsizeiptr',
+ 'GLubyte', 'GLuint', 'GLushort']:
+ ptrtype = gltype + '_ptr_t'
+ TypeMap[ptrtype] = {
+ 'in': 'const %s',
+ 'inout': '%s',
+ 'out': '%s',
+ 'return': 'const %s',
+ 'store': '%s'
+ }
+ RemapName[ptrtype] = '%s*' % gltype
+
def __init__(self):
self.dbg_depth = 0
@@ -571,6 +586,22 @@ class CGen(object):
return out
+ def DefineUnversionedInterface(self, node, rel):
+ out = '\n'
+ if node.GetProperty('force_struct_namespace'):
+ # Duplicate the definition to put it in struct namespace. This
+ # attribute is only for legacy APIs like OpenGLES2 and new APIs
+ # must not use this. See http://crbug.com/411799
+ out += self.DefineStructInternals(node, rel,
+ include_version=False, comment=True)
+ else:
+ # Define an unversioned typedef for the most recent version
+ out += 'typedef struct %s %s;\n' % (
+ self.GetStructName(node, rel, include_version=True),
+ self.GetStructName(node, rel, include_version=False))
+ return out
+
+
def DefineStruct(self, node, releases, prefix='', comment=False):
__pychecker__ = 'unusednames=comment,prefix'
self.LogEnter('DefineStruct %s' % node)
@@ -601,10 +632,7 @@ class CGen(object):
out = self.DefineStructInternals(node, last_rel,
include_version=True, comment=True)
if last_rel == newest_stable:
- # Define an unversioned typedef for the most recent version
- out += '\ntypedef struct %s %s;\n' % (
- self.GetStructName(node, last_rel, include_version=True),
- self.GetStructName(node, last_rel, include_version=False))
+ out += self.DefineUnversionedInterface(node, last_rel)
# Build the rest without comments and with the version number appended
for rel in build_list[0:-1]:
@@ -619,10 +647,7 @@ class CGen(object):
include_version=True,
comment=False)
if rel == newest_stable:
- # Define an unversioned typedef for the most recent version
- out += '\ntypedef struct %s %s;\n' % (
- self.GetStructName(node, rel, include_version=True),
- self.GetStructName(node, rel, include_version=False))
+ out += self.DefineUnversionedInterface(node, rel)
self.LogExit('Exit DefineStruct')
return out
@@ -790,4 +815,3 @@ def main(args):
if __name__ == '__main__':
sys.exit(main(sys.argv[1:]))
-
« no previous file with comments | « ppapi/c/ppb_opengles2.h ('k') | ppapi/native_client/src/untrusted/pnacl_irt_shim/pnacl_shim.c » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698