| 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 re |
| (...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 103 if last_group: | 103 if last_group: |
| 104 out.Write(CommentLines(['*',' @}', '']) + '\n') | 104 out.Write(CommentLines(['*',' @}', '']) + '\n') |
| 105 | 105 |
| 106 | 106 |
| 107 class HGen(GeneratorByFile): | 107 class HGen(GeneratorByFile): |
| 108 def __init__(self): | 108 def __init__(self): |
| 109 Generator.__init__(self, 'C Header', 'cgen', 'Generate the C headers.') | 109 Generator.__init__(self, 'C Header', 'cgen', 'Generate the C headers.') |
| 110 | 110 |
| 111 def GenerateFile(self, filenode, releases, options): | 111 def GenerateFile(self, filenode, releases, options): |
| 112 savename = GetOutFileName(filenode, GetOption('dstroot')) | 112 savename = GetOutFileName(filenode, GetOption('dstroot')) |
| 113 unique_releases = filenode.GetUniqueReleases(releases) | 113 my_min, my_max = filenode.GetMinMax(releases) |
| 114 if not unique_releases: | 114 if my_min > releases[-1] or my_max < releases[0]: |
| 115 if os.path.isfile(savename): | 115 if os.path.isfile(savename): |
| 116 print "Removing stale %s for this range." % filenode.GetName() | 116 print "Removing stale %s for this range." % filenode.GetName() |
| 117 os.remove(os.path.realpath(savename)) | 117 os.remove(os.path.realpath(savename)) |
| 118 return False | 118 return False |
| 119 | 119 |
| 120 out = IDLOutFile(savename) | 120 out = IDLOutFile(savename) |
| 121 self.GenerateHead(out, filenode, releases, options) | 121 self.GenerateHead(out, filenode, releases, options) |
| 122 self.GenerateBody(out, filenode, releases, options) | 122 self.GenerateBody(out, filenode, releases, options) |
| 123 self.GenerateTail(out, filenode, releases, options) | 123 self.GenerateTail(out, filenode, releases, options) |
| 124 return out.Close() | 124 return out.Close() |
| (...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 245 print "Golden file for M13-M15 failed." | 245 print "Golden file for M13-M15 failed." |
| 246 failed =1 | 246 failed =1 |
| 247 else: | 247 else: |
| 248 print "Golden file for M13-M15 passed." | 248 print "Golden file for M13-M15 passed." |
| 249 | 249 |
| 250 return failed | 250 return failed |
| 251 | 251 |
| 252 if __name__ == '__main__': | 252 if __name__ == '__main__': |
| 253 sys.exit(Main(sys.argv[1:])) | 253 sys.exit(Main(sys.argv[1:])) |
| 254 | 254 |
| OLD | NEW |