Share the "THIS FILE IS AUTOGENERATED" comment accross code generators.
authorMs2ger <ms2ger@gmail.com>
Sat, 28 Jan 2012 13:29:12 +0100
changeset 85180 474c28746f9fef114281998a6ff5b4d80ef48d47
parent 85179 e1bf18d8e68bf131ba92b008a53cf5131547b2cc
child 85181 1ccba9eba26604e1c93fc22c5f2638ee045d8b07
push id76
push userMs2ger@gmail.com
push dateSat, 28 Jan 2012 12:40:32 +0000
milestone12.0a1
Share the "THIS FILE IS AUTOGENERATED" comment accross code generators.
dom/bindings/BindingGen.py
dom/bindings/Codegen.py
dom/bindings/GlobalGen.py
--- a/dom/bindings/BindingGen.py
+++ b/dom/bindings/BindingGen.py
@@ -12,19 +12,17 @@ def generate_binding_header(config, outp
     |config| Is the configuration object.
     |outputprefix| is a prefix to use for the header guards and filename.
     """
 
     filename = outputprefix + ".h"
     print "Generating binding header: %s" % (filename)
     f = open(filename, 'w')
 
-    prologue = """
-/* THIS FILE IS AUTO-GENERATED - DO NOT EDIT */
-
+    prologue = autogenerated_comment + """
 #ifndef mozilla_dom_bindings_%s_h__
 #define mozilla_dom_bindings_%s_h__
 
 #include "mozilla/dom/bindings/DOMJSClass.h"
 #include "mozilla/dom/bindings/Utils.h"
 
 """ % (outputprefix, outputprefix)
 
@@ -54,18 +52,17 @@ def generate_binding_cpp(config, outputp
 
     includes = ""
     for domClass in config.dom_classes.values():
         parentInterface = domClass.interface.parent
         if parentInterface:
             parentFileName = os.path.split(parentInterface.filename())[1].replace(".webidl", "");
             includes += parentIncludeTemplate % parentFileName
 
-    prologue = """/* THIS FILE IS AUTO-GENERATED - DO NOT EDIT */
-
+    prologue = autogenerated_comment + """
 %s
 #include "%s.h"
 
 """ % (includes, outputprefix)
 
     epilogue = """"""
 
     # Write recursively.
--- a/dom/bindings/Codegen.py
+++ b/dom/bindings/Codegen.py
@@ -1,14 +1,16 @@
 # This Source Code Form is subject to the terms of the Mozilla Public
 # License, v. 2.0. If a copy of the MPL was not distributed with this file,
 # You can obtain one at http://mozilla.org/MPL/2.0/.
 
 # Common codegen classes.
 
+autogenerated_comment = "/* THIS FILE IS AUTOGENERATED - DO NOT EDIT */\n"
+
 class CGThing():
     """
     Abstract base case for things that spit out code.
     """
     def __init__(self):
         pass # Nothing for now
     def declare(self):
         """Produce code for a header file."""
--- a/dom/bindings/GlobalGen.py
+++ b/dom/bindings/GlobalGen.py
@@ -4,32 +4,30 @@
 
 # We do one global pass over all the WebIDL to generate our prototype enum
 # and generate information for subsequent phases.
 
 import os
 import cStringIO
 import WebIDL
 import cPickle
-from Codegen import Configuration, DOMClass, DOMClassImplementation
+from Codegen import Configuration, DOMClass, DOMClassImplementation, autogenerated_comment
 
 def generate_prototype_list(config, filename):
 
     # Read a copy of the old file, so that we don't touch it if it hasn't changed.
     oldFileContents = ""
     try:
         oldFile = open(filename, 'r')
         oldFileContents = ''.join(oldFile.readlines())
         oldFile.close()
     except:
         pass
 
-    prologue = """
-/* THIS FILE IS AUTOGENERATED - DO NOT EDIT */
-
+    prologue = autogenerated_comment + """
 #ifndef mozilla_dom_bindings_PrototypeList_h
 #define mozilla_dom_bindings_PrototypeList_h
 
 namespace mozilla {
 namespace dom {
 namespace bindings {
 namespace prototypes {
 namespace id {