diff options
author | wez@chromium.org <wez@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-01-04 21:57:04 +0000 |
---|---|---|
committer | wez@chromium.org <wez@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-01-04 21:57:04 +0000 |
commit | dbf21cc6203bfef5ce4dc7a9df4ce2f486445dd2 (patch) | |
tree | 5ec56f65866e62e8d0090b26e2e224de72729731 /ppapi/generators | |
parent | 0158ee76f6ec8a8223de6ea62850d83a2ee98003 (diff) | |
download | chromium_src-dbf21cc6203bfef5ce4dc7a9df4ce2f486445dd2.zip chromium_src-dbf21cc6203bfef5ce4dc7a9df4ce2f486445dd2.tar.gz chromium_src-dbf21cc6203bfef5ce4dc7a9df4ce2f486445dd2.tar.bz2 |
Tweak the PPAPI IDL generator to wrap the generated-from comment if necessary.
BUG=109129
Review URL: http://codereview.chromium.org/8983022
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@116391 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ppapi/generators')
-rw-r--r-- | ppapi/generators/idl_c_header.py | 16 | ||||
-rw-r--r-- | ppapi/generators/idl_outfile.py | 12 |
2 files changed, 18 insertions, 10 deletions
diff --git a/ppapi/generators/idl_c_header.py b/ppapi/generators/idl_c_header.py index 7813b0b..536d73e 100644 --- a/ppapi/generators/idl_c_header.py +++ b/ppapi/generators/idl_c_header.py @@ -1,6 +1,6 @@ #!/usr/bin/python # -# Copyright (c) 2011 The Chromium Authors. All rights reserved. +# Copyright (c) 2012 The Chromium Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. @@ -130,9 +130,17 @@ class HGen(GeneratorByFile): assert(fileinfo.IsA('Comment')) out.Write('%s\n' % cgen.Copyright(cright_node)) - out.Write('/* From %s modified %s. */\n\n'% ( - filenode.GetProperty('NAME').replace(os.sep,'/'), - filenode.GetProperty('DATETIME'))) + + # Wrap the From ... modified ... comment if it would be >80 characters. + from_text = 'From %s' % ( + filenode.GetProperty('NAME').replace(os.sep,'/')) + modified_text = 'modified %s.' % ( + filenode.GetProperty('DATETIME')) + if len(from_text) + len(modified_text) < 74: + out.Write('/* %s %s */\n\n' % (from_text, modified_text)) + else: + out.Write('/* %s,\n * %s\n */\n\n' % (from_text, modified_text)) + out.Write('#ifndef %s\n#define %s\n\n' % (def_guard, def_guard)) # Generate set of includes diff --git a/ppapi/generators/idl_outfile.py b/ppapi/generators/idl_outfile.py index 434cfa0..a747d7d 100644 --- a/ppapi/generators/idl_outfile.py +++ b/ppapi/generators/idl_outfile.py @@ -1,6 +1,6 @@ #!/usr/bin/python # -# Copyright (c) 2011 The Chromium Authors. All rights reserved. +# Copyright (c) 2012 The Chromium Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. @@ -36,14 +36,15 @@ def IsEquivelent(intext, outtext): outwords = outline.split() if not inwords or not outwords: return False - if inwords[0] != outwords[0] or inwords[0] != '/*': return False + if inwords[0] != outwords[0] or inwords[0] not in ('/*', '*'): return False # Neither the year, nor the modified date need an exact match if inwords[1] == 'Copyright': if inwords[4:] == outwords[4:]: continue - elif inwords[1] == 'From': - if inwords[0:4] == outwords[0:4]: - continue + elif inwords[1] == 'From': # Un-wrapped modified date. + if inwords[0:4] == outwords[0:4]: continue + elif inwords[1] == 'modified': # Wrapped modified date. + if inwords[0:2] == outwords[0:2]: continue return False return True @@ -173,4 +174,3 @@ if __name__ == '__main__': os.remove(filename) if not errors: InfoOut.Log('All tests pass.') sys.exit(errors) - |