Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 sys | 11 import sys |
| 11 | 12 |
| 12 from idl_log import ErrOut, InfoOut, WarnOut | 13 from idl_log import ErrOut, InfoOut, WarnOut |
| 13 from idl_node import IDLAttribute, IDLNode | 14 from idl_node import IDLAttribute, IDLNode |
| 14 from idl_ast import IDLAst | 15 from idl_ast import IDLAst |
| 15 from idl_option import GetOption, Option, ParseOptions | 16 from idl_option import GetOption, Option, ParseOptions |
| 16 from idl_outfile import IDLOutFile | 17 from idl_outfile import IDLOutFile |
| 17 from idl_parser import ParseFiles | 18 from idl_parser import ParseFiles |
| 18 from idl_c_proto import CGen, GetNodeComments, CommentLines, Comment | 19 from idl_c_proto import CGen, GetNodeComments, CommentLines, Comment |
| 19 from idl_generator import Generator, GeneratorByFile | 20 from idl_generator import Generator, GeneratorByFile |
| (...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 165 # Assume we need stdint if we "include" C or C++ code | 166 # Assume we need stdint if we "include" C or C++ code |
| 166 if filenode.GetListOf('Include'): | 167 if filenode.GetListOf('Include'): |
| 167 includes.append('ppapi/c/pp_stdint.h') | 168 includes.append('ppapi/c/pp_stdint.h') |
| 168 | 169 |
| 169 includes = sorted(set(includes)) | 170 includes = sorted(set(includes)) |
| 170 cur_include = GetOutFileName(filenode, relpath=gpath).replace(os.sep, '/') | 171 cur_include = GetOutFileName(filenode, relpath=gpath).replace(os.sep, '/') |
| 171 for include in includes: | 172 for include in includes: |
| 172 if include == cur_include: continue | 173 if include == cur_include: continue |
| 173 out.Write('#include "%s"\n' % include) | 174 out.Write('#include "%s"\n' % include) |
| 174 | 175 |
| 176 # If we are generating a single release, then create a macro for the highest | |
|
dmichael (off chromium)
2012/05/10 22:33:58
What do you mean by single release here?
noelallen1
2012/05/11 18:07:27
Only when you use --release=M21, so not standard C
| |
| 177 # available release number. | |
| 178 if filenode.GetProperty('NAME').endswith('pp_macros.idl'): | |
| 179 releasestr = GetOption('release') | |
| 180 if releasestr: | |
| 181 release_numbers = re.findall('\d+', releasestr) | |
| 182 if release_numbers: | |
| 183 out.Write('\n#define PPAPI_RELEASE %s\n' % release_numbers[0]) | |
|
dmichael (off chromium)
2012/05/10 22:33:58
This sounds like a good idea. Are you going to upd
noelallen1
2012/05/11 18:07:27
No, see above. Looks like:
/* Copyright (c) 2012
| |
| 184 | |
| 175 # Generate all interface defines | 185 # Generate all interface defines |
| 176 out.Write('\n') | 186 out.Write('\n') |
| 177 for node in filenode.GetListOf('Interface'): | 187 for node in filenode.GetListOf('Interface'): |
| 178 idefs = '' | 188 idefs = '' |
| 179 macro = cgen.GetInterfaceMacro(node) | 189 macro = cgen.GetInterfaceMacro(node) |
| 180 unique = node.GetUniqueReleases(releases) | 190 unique = node.GetUniqueReleases(releases) |
| 181 | 191 |
| 182 # Skip this interface if there are no matching versions | 192 # Skip this interface if there are no matching versions |
| 183 if not unique: continue | 193 if not unique: continue |
| 184 | 194 |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 235 print "Golden file for M13-M15 failed." | 245 print "Golden file for M13-M15 failed." |
| 236 failed =1 | 246 failed =1 |
| 237 else: | 247 else: |
| 238 print "Golden file for M13-M15 passed." | 248 print "Golden file for M13-M15 passed." |
| 239 | 249 |
| 240 return failed | 250 return failed |
| 241 | 251 |
| 242 if __name__ == '__main__': | 252 if __name__ == '__main__': |
| 243 sys.exit(Main(sys.argv[1:])) | 253 sys.exit(Main(sys.argv[1:])) |
| 244 | 254 |
| OLD | NEW |