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

Side by Side Diff: ppapi/generators/idl_c_proto.py

Issue 8989006: Update PPAPI IDL generator to define versioned structs, and unversioned typedef. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase for line-wrap. Created 8 years, 11 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « ppapi/examples/gles2/gles2.cc ('k') | ppapi/native_client/src/shared/ppapi_proxy/browser_ppp.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 #!/usr/bin/python 1 #!/usr/bin/python
2 # 2 #
3 # Copyright (c) 2011 The Chromium Authors. All rights reserved. 3 # Copyright (c) 2011 The Chromium Authors. All rights reserved.
4 # Use of this source code is governed by a BSD-style license that can be 4 # Use of this source code is governed by a BSD-style license that can be
5 # found in the LICENSE file. 5 # found in the LICENSE file.
6 6
7 """ Generator for C style prototypes and definitions """ 7 """ Generator for C style prototypes and definitions """
8 8
9 import glob 9 import glob
10 import os 10 import os
(...skipping 480 matching lines...) Expand 10 before | Expand all | Expand 10 after
491 out += '%s\n};\n' % '\n'.join(members) 491 out += '%s\n};\n' % '\n'.join(members)
492 return out 492 return out
493 493
494 494
495 def DefineStruct(self, node, releases, prefix='', comment=False): 495 def DefineStruct(self, node, releases, prefix='', comment=False):
496 __pychecker__ = 'unusednames=comment,prefix' 496 __pychecker__ = 'unusednames=comment,prefix'
497 self.LogEnter('DefineStruct %s' % node) 497 self.LogEnter('DefineStruct %s' % node)
498 out = '' 498 out = ''
499 build_list = node.GetUniqueReleases(releases) 499 build_list = node.GetUniqueReleases(releases)
500 500
501 # Build the most recent one with comments 501 if node.IsA('Interface'):
502 out = self.DefineStructInternals(node, build_list[-1], 502 # Build the most recent one versioned, with comments
503 include_version=False, comment=True) 503 out = self.DefineStructInternals(node, build_list[-1],
504 include_version=True, comment=True)
505
506 # Define an unversioned typedef for the most recent version
507 out += '\ntypedef struct %s %s;\n' % (
508 self.GetStructName(node, build_list[-1], include_version=True),
509 self.GetStructName(node, build_list[-1], include_version=False))
510 else:
511 # Build the most recent one versioned, with comments
512 out = self.DefineStructInternals(node, build_list[-1],
513 include_version=False, comment=True)
514
504 515
505 # Build the rest without comments and with the version number appended 516 # Build the rest without comments and with the version number appended
506 for rel in build_list[0:-1]: 517 for rel in build_list[0:-1]:
507 out += '\n' + self.DefineStructInternals(node, rel, 518 out += '\n' + self.DefineStructInternals(node, rel,
508 include_version=True, 519 include_version=True,
509 comment=False) 520 comment=False)
510 521
511 self.LogExit('Exit DefineStruct') 522 self.LogExit('Exit DefineStruct')
512 return out 523 return out
513 524
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after
637 if f.GetProperty('ERRORS') > 0: 648 if f.GetProperty('ERRORS') > 0:
638 print 'Skipping %s' % f.GetName() 649 print 'Skipping %s' % f.GetName()
639 continue 650 continue
640 print DefineDepends(node) 651 print DefineDepends(node)
641 for node in f.GetChildren()[2:]: 652 for node in f.GetChildren()[2:]:
642 print Define(node, comment=True, prefix='tst_') 653 print Define(node, comment=True, prefix='tst_')
643 654
644 655
645 if __name__ == '__main__': 656 if __name__ == '__main__':
646 sys.exit(Main(sys.argv[1:])) 657 sys.exit(Main(sys.argv[1:]))
OLDNEW
« no previous file with comments | « ppapi/examples/gles2/gles2.cc ('k') | ppapi/native_client/src/shared/ppapi_proxy/browser_ppp.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698