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

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

Issue 11235016: Change the way we generate versions (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 8 years, 2 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/generators/idl_c_proto.py ('k') | ppapi/generators/idl_namespace.py » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 # Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 # Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 # Use of this source code is governed by a BSD-style license that can be 2 # Use of this source code is governed by a BSD-style license that can be
3 # found in the LICENSE file. 3 # found in the LICENSE file.
4 4
5 """Base class for generating wrapper functions for PPAPI methods. 5 """Base class for generating wrapper functions for PPAPI methods.
6 """ 6 """
7 7
8 from datetime import datetime 8 from datetime import datetime
9 import os 9 import os
10 import sys 10 import sys
11 11
12 from idl_c_proto import CGen 12 from idl_c_proto import CGen
13 from idl_generator import Generator 13 from idl_generator import Generator
14 from idl_log import ErrOut, InfoOut, WarnOut 14 from idl_log import ErrOut, InfoOut, WarnOut
15 from idl_option import GetOption
15 from idl_outfile import IDLOutFile 16 from idl_outfile import IDLOutFile
16 17
17 18
18 class PPKind(object): 19 class PPKind(object):
19 @staticmethod 20 @staticmethod
20 def ChoosePPFunc(iface, ppb_func, ppp_func): 21 def ChoosePPFunc(iface, ppb_func, ppp_func):
21 name = iface.node.GetName() 22 name = iface.node.GetName()
22 if name.startswith("PPP"): 23 if name.startswith("PPP"):
23 return ppp_func 24 return ppp_func
24 elif name.startswith("PPB"): 25 elif name.startswith("PPB"):
(...skipping 187 matching lines...) Expand 10 before | Expand all | Expand 10 after
212 213
213 ############################################################ 214 ############################################################
214 215
215 def DetermineInterfaces(self, ast, releases): 216 def DetermineInterfaces(self, ast, releases):
216 """Get a list of interfaces along with whatever metadata we need. 217 """Get a list of interfaces along with whatever metadata we need.
217 """ 218 """
218 iface_releases = [] 219 iface_releases = []
219 for filenode in ast.GetListOf('File'): 220 for filenode in ast.GetListOf('File'):
220 # If this file has errors, skip it 221 # If this file has errors, skip it
221 if filenode in self.skip_list: 222 if filenode in self.skip_list:
222 InfoOut.Log('WrapperGen: Skipping %s due to errors\n' % 223 if GetOption('verbose'):
223 filenode.GetName()) 224 InfoOut.Log('WrapperGen: Skipping %s due to errors\n' %
225 filenode.GetName())
224 continue 226 continue
225 227
226 file_name = self.GetHeaderName(filenode.GetName()) 228 file_name = self.GetHeaderName(filenode.GetName())
227 ifaces = filenode.GetListOf('Interface') 229 ifaces = filenode.GetListOf('Interface')
228 for iface in ifaces: 230 for iface in ifaces:
229 releases_for_iface = iface.GetUniqueReleases(releases) 231 releases_for_iface = iface.GetUniqueReleases(releases)
230 for release in releases_for_iface: 232 for release in releases_for_iface:
231 version = iface.GetVersion(release) 233 version = iface.GetVersion(release)
232 struct_name = self.cgen.GetStructName(iface, release, 234 struct_name = self.cgen.GetStructName(iface, release,
233 include_version=True) 235 include_version=True)
234 needs_wrap = self.InterfaceVersionNeedsWrapping(iface, version) 236 needs_wrap = self.InterfaceVersionNeedsWrapping(iface, version)
235 if not needs_wrap: 237 if not needs_wrap:
236 InfoOut.Log('Interface %s ver %s does not need wrapping' % 238 if GetOption('verbose'):
237 (struct_name, version)) 239 InfoOut.Log('Interface %s ver %s does not need wrapping' %
240 (struct_name, version))
238 iface_releases.append( 241 iface_releases.append(
239 Interface(iface, release, version, 242 Interface(iface, release, version,
240 struct_name, needs_wrap, file_name)) 243 struct_name, needs_wrap, file_name))
241 return iface_releases 244 return iface_releases
242 245
243 246
244 def GenerateIncludes(self, iface_releases, out): 247 def GenerateIncludes(self, iface_releases, out):
245 """Generate the list of #include that define the original interfaces. 248 """Generate the list of #include that define the original interfaces.
246 """ 249 """
247 self.WriteCopyrightGeneratedTime(out) 250 self.WriteCopyrightGeneratedTime(out)
(...skipping 201 matching lines...) Expand 10 before | Expand all | Expand 10 after
449 452
450 # Generate a table of the wrapped interface structs that can be looked up. 453 # Generate a table of the wrapped interface structs that can be looked up.
451 self.GenerateWrapperInfoAndCollection(iface_releases, out) 454 self.GenerateWrapperInfoAndCollection(iface_releases, out)
452 455
453 # Write out the IDL-invariant functions. 456 # Write out the IDL-invariant functions.
454 self.GenerateFixedFunctions(out) 457 self.GenerateFixedFunctions(out)
455 458
456 out.Write(self.GetGuardEnd()) 459 out.Write(self.GetGuardEnd())
457 out.Close() 460 out.Close()
458 return 0 461 return 0
462
OLDNEW
« no previous file with comments | « ppapi/generators/idl_c_proto.py ('k') | ppapi/generators/idl_namespace.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698