| Index: grit/format/c_format.py | 
| diff --git a/grit/format/c_format.py b/grit/format/c_format.py | 
| index c9497f046832b1aefdbe1c5f61cc87c9cd3c1fb7..f346c127e8b6cdcc7271dd7f166c96003163eff9 100644 | 
| --- a/grit/format/c_format.py | 
| +++ b/grit/format/c_format.py | 
| @@ -18,20 +18,18 @@ from grit.node import io | 
| class TopLevel(interface.ItemFormatter): | 
| """Writes out the required preamble for C files.""" | 
|  | 
| -  def Format(self, item, lang='en', begin_item=True, output_dir='.'): | 
| +  def Format(self, item, lang='en', output_dir='.'): | 
| +    """Format the C file header.""" | 
| assert isinstance(lang, types.StringTypes) | 
| -    if not begin_item: | 
| -      return '' | 
| -    else: | 
| -      # Find the location of the resource header file, so that we can include | 
| -      # it. | 
| -      resource_header = 'resource.h'  # fall back to this | 
| -      for output in item.GetRoot().GetOutputFiles(): | 
| -        if output.attrs['type'] == 'rc_header': | 
| -          resource_header = os.path.abspath(output.GetOutputFilename()) | 
| -          resource_header = util.MakeRelativePath(output_dir, | 
| -                                                  resource_header) | 
| -      return """//  Copyright %d Google Inc. All Rights Reserved. | 
| +    # Find the location of the resource header file, so that we can include | 
| +    # it. | 
| +    resource_header = 'resource.h'  # fall back to this | 
| +    for output in item.GetRoot().GetOutputFiles(): | 
| +      if output.attrs['type'] == 'rc_header': | 
| +        resource_header = os.path.abspath(output.GetOutputFilename()) | 
| +        resource_header = util.MakeRelativePath(output_dir, | 
| +                                                resource_header) | 
| +    return """//  Copyright %d Google Inc. All Rights Reserved. | 
| // This file is automatically generated by GRIT.  Do not edit. | 
|  | 
| #include "%s" | 
| @@ -44,12 +42,16 @@ class TopLevel(interface.ItemFormatter): | 
| class StringTable(interface.ItemFormatter): | 
| """Outputs a C switch statement representing the string table.""" | 
|  | 
| -  def Format(self, item, lang='en', begin_item=True, output_dir='.'): | 
| +  def Format(self, item, lang='en', output_dir='.'): | 
| +    """Format the start of the table.""" | 
| assert isinstance(lang, types.StringTypes) | 
| -    if begin_item: | 
| -      return 'const char* GetString(int id) {\n  switch (id) {' | 
| -    else: | 
| -      return '\n    default:\n      return 0;\n  }\n}' | 
| +    return 'const char* GetString(int id) {\n  switch (id) {' | 
| + | 
| +  def FormatEnd(self, item, lang='en', output_dir='.'): | 
| +    """Format the end of the table.""" | 
| +    assert isinstance(lang, types.StringTypes) | 
| +    return '\n    default:\n      return 0;\n  }\n}' | 
| + | 
|  | 
| def _HexToOct(match): | 
| "Return the octal form of the hex numbers" | 
| @@ -61,14 +63,13 @@ def _HexToOct(match): | 
| hex = hex[4:] | 
| return match.group("escaped_backslashes") + result | 
|  | 
| + | 
| class Message(interface.ItemFormatter): | 
| """Writes out a single message as part of the switch.""" | 
|  | 
| -  def Format(self, item, lang='en', begin_item=True, output_dir='.'): | 
| +  def Format(self, item, lang='en', output_dir='.'): | 
| +    """Format a single message.""" | 
| from grit.node import message | 
| -    if not begin_item: | 
| -      return '' | 
| - | 
| assert isinstance(lang, types.StringTypes) | 
| assert isinstance(item, message.MessageNode) | 
|  | 
|  |