| 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 '''This file contains item formatters for resource_map_header and | 6 '''This file contains item formatters for resource_map_header and |
| 7 resource_map_source files. A resource map is a mapping between resource names | 7 resource_map_source files. A resource map is a mapping between resource names |
| 8 (string) and the internal resource ID.''' | 8 (string) and the internal resource ID.''' |
| 9 | 9 |
| 10 import os | 10 import os |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 49 '''Create the header file for the resource mapping. This file just declares | 49 '''Create the header file for the resource mapping. This file just declares |
| 50 an array of name/value pairs.''' | 50 an array of name/value pairs.''' |
| 51 return '''\ | 51 return '''\ |
| 52 // This file is automatically generated by GRIT. Do not edit. | 52 // This file is automatically generated by GRIT. Do not edit. |
| 53 | 53 |
| 54 #include <stddef.h> | 54 #include <stddef.h> |
| 55 | 55 |
| 56 #ifndef GRIT_RESOURCE_MAP_STRUCT_ | 56 #ifndef GRIT_RESOURCE_MAP_STRUCT_ |
| 57 #define GRIT_RESOURCE_MAP_STRUCT_ | 57 #define GRIT_RESOURCE_MAP_STRUCT_ |
| 58 struct GritResourceMap { | 58 struct GritResourceMap { |
| 59 const char* const name; | 59 const char* name; |
| 60 int value; | 60 int value; |
| 61 }; | 61 }; |
| 62 #endif // GRIT_RESOURCE_MAP_STRUCT_ | 62 #endif // GRIT_RESOURCE_MAP_STRUCT_ |
| 63 | 63 |
| 64 extern const GritResourceMap %(map_name)s[]; | 64 extern const GritResourceMap %(map_name)s[]; |
| 65 extern const size_t %(map_name)sSize; | 65 extern const size_t %(map_name)sSize; |
| 66 ''' % { 'map_name': GetMapName(root) } | 66 ''' % { 'map_name': GetMapName(root) } |
| 67 | 67 |
| 68 | 68 |
| 69 def _FormatSourceHeader(root): | 69 def _FormatSourceHeader(root): |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 126 yield ' {"%s", %s},\n' % (key, tid) | 126 yield ' {"%s", %s},\n' % (key, tid) |
| 127 yield _FormatSourceFooter(root) | 127 yield _FormatSourceFooter(root) |
| 128 | 128 |
| 129 | 129 |
| 130 def _GetItemName(item): | 130 def _GetItemName(item): |
| 131 return item.attrs['name'] | 131 return item.attrs['name'] |
| 132 | 132 |
| 133 | 133 |
| 134 def _GetItemPath(item): | 134 def _GetItemPath(item): |
| 135 return item.GetInputPath().replace("\\", "/") | 135 return item.GetInputPath().replace("\\", "/") |
| OLD | NEW |