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

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

Issue 103993006: Add PPB_Alarms_Dev interface definition. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . Created 7 years 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 re 10 import re
(...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after
138 if last_group: 138 if last_group:
139 out.Write(CommentLines(['*',' @}', '']) + '\n') 139 out.Write(CommentLines(['*',' @}', '']) + '\n')
140 140
141 141
142 def CheckTypedefs(filenode, releases): 142 def CheckTypedefs(filenode, releases):
143 """Checks that typedefs don't specify callbacks that take some structs. 143 """Checks that typedefs don't specify callbacks that take some structs.
144 144
145 See http://crbug.com/233439 for details. 145 See http://crbug.com/233439 for details.
146 """ 146 """
147 cgen = CGen() 147 cgen = CGen()
148 # TODO(teravest): Fix the following callback to pass PP_Var by pointer
149 # instead of by value.
150 node_whitelist = ['PP_Ext_Alarms_OnAlarm_Func_Dev_0_1']
151 for node in filenode.GetListOf('Typedef'): 148 for node in filenode.GetListOf('Typedef'):
152 if node.GetName() in node_whitelist:
153 continue
154 build_list = node.GetUniqueReleases(releases) 149 build_list = node.GetUniqueReleases(releases)
155 callnode = node.GetOneOf('Callspec') 150 callnode = node.GetOneOf('Callspec')
156 if callnode: 151 if callnode:
157 for param in callnode.GetListOf('Param'): 152 for param in callnode.GetListOf('Param'):
158 if param.GetListOf('Array'): 153 if param.GetListOf('Array'):
159 continue 154 continue
160 if cgen.GetParamMode(param) != 'in': 155 if cgen.GetParamMode(param) != 'in':
161 continue 156 continue
162 t = param.GetType(build_list[0]) 157 t = param.GetType(build_list[0])
163 while t.IsA('Typedef'): 158 while t.IsA('Typedef'):
164 t = t.GetType(build_list[0]) 159 t = t.GetType(build_list[0])
165 if t.IsA('Struct'): 160 if t.IsA('Struct') and t.GetProperty('passByValue'):
166 raise Exception('%s is a struct in callback %s. ' 161 raise Exception('%s is a struct in callback %s. '
167 'See http://crbug.com/233439' % 162 'See http://crbug.com/233439' %
168 (t.GetName(), node.GetName())) 163 (t.GetName(), node.GetName()))
169 164
170 165
171 def CheckPassByValue(filenode, releases): 166 def CheckPassByValue(filenode, releases):
172 """Checks that new pass-by-value structs are not introduced. 167 """Checks that new pass-by-value structs are not introduced.
173 168
174 See http://crbug.com/233439 for details. 169 See http://crbug.com/233439 for details.
175 """ 170 """
(...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after
346 print "Golden file for M13-M15 failed." 341 print "Golden file for M13-M15 failed."
347 failed =1 342 failed =1
348 else: 343 else:
349 print "Golden file for M13-M15 passed." 344 print "Golden file for M13-M15 passed."
350 345
351 return failed 346 return failed
352 347
353 if __name__ == '__main__': 348 if __name__ == '__main__':
354 sys.exit(main(sys.argv[1:])) 349 sys.exit(main(sys.argv[1:]))
355 350
OLDNEW
« no previous file with comments | « ppapi/c/dev/ppb_alarms_dev.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