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

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

Issue 231243002: PPAPI: Move some of NexeFileDidOpen to NexeLoadManager (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix crash Created 6 years, 8 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
OLDNEW
1 #!/usr/bin/env python 1 #!/usr/bin/env python
2 # Copyright (c) 2012 The Chromium Authors. All rights reserved. 2 # Copyright (c) 2012 The Chromium Authors. All rights reserved.
3 # Use of this source code is governed by a BSD-style license that can be 3 # Use of this source code is governed by a BSD-style license that can be
4 # found in the LICENSE file. 4 # found in the LICENSE file.
5 5
6 """ Generator for C style prototypes and definitions """ 6 """ Generator for C style prototypes and definitions """
7 7
8 import glob 8 import glob
9 import os 9 import os
10 import sys 10 import sys
(...skipping 624 matching lines...) Expand 10 before | Expand all | Expand 10 after
635 635
636 636
637 def Indent(self, data, tabs=0): 637 def Indent(self, data, tabs=0):
638 """Handles indentation and 80-column line wrapping.""" 638 """Handles indentation and 80-column line wrapping."""
639 tab = ' ' * tabs 639 tab = ' ' * tabs
640 lines = [] 640 lines = []
641 for line in data.split('\n'): 641 for line in data.split('\n'):
642 # Add indentation 642 # Add indentation
643 line = tab + line 643 line = tab + line
644 space_break = line.rfind(' ', 0, 80) 644 space_break = line.rfind(' ', 0, 80)
645 if len(line) <= 80 or 'http' in line: 645 if len(line) <= 80 or 'http://' in line:
646 # Ignore normal line and URLs permitted by the style guide. 646 # Ignore normal line and URLs permitted by the style guide.
647 lines.append(line.rstrip()) 647 lines.append(line.rstrip())
648 elif not '(' in line and space_break >= 0: 648 elif not '(' in line and space_break >= 0:
649 # Break long typedefs on nearest space. 649 # Break long typedefs on nearest space.
650 lines.append(line[0:space_break]) 650 lines.append(line[0:space_break])
651 lines.append(' ' + line[space_break + 1:]) 651 lines.append(' ' + line[space_break + 1:])
652 else: 652 else:
653 left = line.rfind('(') + 1 653 left = line.rfind('(') + 1
654 args = line[left:].split(',') 654 args = line[left:].split(',')
655 orig_args = args 655 orig_args = args
(...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after
778 if f.GetProperty('ERRORS') > 0: 778 if f.GetProperty('ERRORS') > 0:
779 print 'Skipping %s' % f.GetName() 779 print 'Skipping %s' % f.GetName()
780 continue 780 continue
781 for node in f.GetChildren()[2:]: 781 for node in f.GetChildren()[2:]:
782 print cgen.Define(node, ast.releases, comment=True, prefix='tst_') 782 print cgen.Define(node, ast.releases, comment=True, prefix='tst_')
783 783
784 784
785 if __name__ == '__main__': 785 if __name__ == '__main__':
786 sys.exit(main(sys.argv[1:])) 786 sys.exit(main(sys.argv[1:]))
787 787
OLDNEW
« no previous file with comments | « ppapi/c/private/ppb_nacl_private.h ('k') | ppapi/generators/test_cgen_range/dev_channel_interface.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698