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

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

Issue 7751001: More multi-version support (part 2) (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 9 years, 4 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 | « no previous file | ppapi/generators/idl_c_proto.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 #!/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 149 matching lines...) Expand 10 before | Expand all | Expand 10 after
160 out.Write('#include "%s"\n' % include) 160 out.Write('#include "%s"\n' % include)
161 161
162 # Generate all interface defines 162 # Generate all interface defines
163 out.Write('\n') 163 out.Write('\n')
164 for node in filenode.GetListOf('Interface'): 164 for node in filenode.GetListOf('Interface'):
165 idefs = '' 165 idefs = ''
166 name = node.GetName() 166 name = node.GetName()
167 macro = node.GetProperty('macro') 167 macro = node.GetProperty('macro')
168 if not macro: 168 if not macro:
169 macro = self.GetMacro(node) 169 macro = self.GetMacro(node)
170 label = node.GetLabel() 170
171 if label: 171 unique = node.GetUniqueReleases(releases)
172 for vers in label.versions: 172 for rel in unique:
173 strver = str(vers).replace('.', '_') 173 version = node.GetVersion(rel)
174 idefs += self.GetDefine('%s_%s' % (macro, strver), 174 strver = str(version).replace('.', '_')
175 '"%s;%s"' % (name, vers)) 175 idefs += self.GetDefine('%s_%s' % (macro, strver),
176 if label.GetRelease(vers) == releases[-1]: 176 '"%s;%s"' % (name, version))
177 idefs += self.GetDefine(macro, '%s_%s' % (macro, strver)) 177 idefs += self.GetDefine(macro, '%s_%s' % (macro, strver)) + '\n'
178 idefs += '\n'
179 out.Write(idefs) 178 out.Write(idefs)
180 179
181 # Generate the @file comment 180 # Generate the @file comment
182 out.Write('%s\n' % Comment(fileinfo, prefix='*\n @file')) 181 out.Write('%s\n' % Comment(fileinfo, prefix='*\n @file'))
183 182
184 def GenerateBody(self, out, filenode, releases, options): 183 def GenerateBody(self, out, filenode, releases, options):
185 GenerateHeader(out, filenode, releases) 184 GenerateHeader(out, filenode, releases)
186 185
187 def GenerateTail(self, out, filenode, releases, options): 186 def GenerateTail(self, out, filenode, releases, options):
188 gpath = GetOption('guard') 187 gpath = GetOption('guard')
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
222 failed =1 221 failed =1
223 else: 222 else:
224 print "Golden file for M13-M15 passed." 223 print "Golden file for M13-M15 passed."
225 224
226 return failed 225 return failed
227 226
228 if __name__ == '__main__': 227 if __name__ == '__main__':
229 retval = Main(sys.argv[1:]) 228 retval = Main(sys.argv[1:])
230 sys.exit(retval) 229 sys.exit(retval)
231 230
OLDNEW
« no previous file with comments | « no previous file | ppapi/generators/idl_c_proto.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698