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

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

Issue 11417010: Add support for generating thunk source from IDL. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Fixed dmichael's comments. Created 8 years, 1 month 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
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 re 10 import re
11 import sys 11 import sys
12 12
13 from idl_log import ErrOut, InfoOut, WarnOut 13 from idl_log import ErrOut, InfoOut, WarnOut
14 from idl_node import IDLAttribute, IDLNode 14 from idl_node import IDLAttribute, IDLNode
15 from idl_ast import IDLAst 15 from idl_ast import IDLAst
16 from idl_option import GetOption, Option, ParseOptions 16 from idl_option import GetOption, Option, ParseOptions
17 from idl_outfile import IDLOutFile 17 from idl_outfile import IDLOutFile
18 from idl_parser import ParseFiles 18 from idl_parser import ParseFiles
19 from idl_c_proto import CGen, GetNodeComments, CommentLines, Comment 19 from idl_c_proto import CGen, GetNodeComments, CommentLines, Comment
20 from idl_generator import Generator, GeneratorByFile 20 from idl_generator import Generator, GeneratorByFile
21 21
22 Option('dstroot', 'Base directory of output', default=os.path.join('..', 'c')) 22 Option('dstroot', 'Base directory of output', default=os.path.join('..', 'c'))
23 Option('guard', 'Include guard prefix', default=os.path.join('ppapi', 'c')) 23 Option('guard', 'Include guard prefix', default=os.path.join('ppapi', 'c'))
24 Option('out', 'List of output files', default='')
25 24
26 25
27 def GetOutFileName(filenode, relpath=None, prefix=None): 26 def GetOutFileName(filenode, relpath=None, prefix=None):
28 path, name = os.path.split(filenode.GetProperty('NAME')) 27 path, name = os.path.split(filenode.GetProperty('NAME'))
29 name = os.path.splitext(name)[0] + '.h' 28 name = os.path.splitext(name)[0] + '.h'
30 if prefix: name = '%s%s' % (prefix, name) 29 if prefix: name = '%s%s' % (prefix, name)
31 if path: name = os.path.join(path, name) 30 if path: name = os.path.join(path, name)
32 if relpath: name = os.path.join(relpath, name) 31 if relpath: name = os.path.join(relpath, name)
33 return name 32 return name
34 33
(...skipping 210 matching lines...) Expand 10 before | Expand all | Expand 10 after
245 print "Golden file for M13-M15 failed." 244 print "Golden file for M13-M15 failed."
246 failed =1 245 failed =1
247 else: 246 else:
248 print "Golden file for M13-M15 passed." 247 print "Golden file for M13-M15 passed."
249 248
250 return failed 249 return failed
251 250
252 if __name__ == '__main__': 251 if __name__ == '__main__':
253 sys.exit(Main(sys.argv[1:])) 252 sys.exit(Main(sys.argv[1:]))
254 253
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698