OLD | NEW |
1 # Copyright (C) 2013 Google Inc. All rights reserved. | 1 # Copyright (C) 2013 Google Inc. All rights reserved. |
2 # | 2 # |
3 # Redistribution and use in source and binary forms, with or without | 3 # Redistribution and use in source and binary forms, with or without |
4 # modification, are permitted provided that the following conditions are | 4 # modification, are permitted provided that the following conditions are |
5 # met: | 5 # met: |
6 # | 6 # |
7 # * Redistributions of source code must retain the above copyright | 7 # * Redistributions of source code must retain the above copyright |
8 # notice, this list of conditions and the following disclaimer. | 8 # notice, this list of conditions and the following disclaimer. |
9 # * Redistributions in binary form must reproduce the above | 9 # * Redistributions in binary form must reproduce the above |
10 # copyright notice, this list of conditions and the following disclaimer | 10 # copyright notice, this list of conditions and the following disclaimer |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
57 \\ | 57 \\ |
58 %(unconditional_macros)s | 58 %(unconditional_macros)s |
59 \\ | 59 \\ |
60 %(conditional_macros)s | 60 %(conditional_macros)s |
61 | 61 |
62 #endif // %(namespace)sInterfaces_h | 62 #endif // %(namespace)sInterfaces_h |
63 """ | 63 """ |
64 | 64 |
65 | 65 |
66 class Writer(in_generator.Writer): | 66 class Writer(in_generator.Writer): |
67 def __init__(self, in_file_path, enabled_conditions): | 67 def __init__(self, in_file_path): |
68 super(Writer, self).__init__(in_file_path, enabled_conditions) | 68 super(Writer, self).__init__(in_file_path) |
69 self.namespace = self.in_file.parameters['namespace'].strip('"') | 69 self.namespace = self.in_file.parameters['namespace'].strip('"') |
70 self._entries_by_conditional = {} | 70 self._entries_by_conditional = {} |
71 self._unconditional_entries = [] | 71 self._unconditional_entries = [] |
72 self._sort_entries_by_conditional() | 72 self._sort_entries_by_conditional() |
73 self._outputs = {(self.namespace + "Headers.h"): self.generate_headers_h
eader, | 73 self._outputs = {(self.namespace + "Headers.h"): self.generate_headers_h
eader, |
74 (self.namespace + "Interfaces.h"): self.generate_interf
aces_header, | 74 (self.namespace + "Interfaces.h"): self.generate_interf
aces_header, |
75 } | 75 } |
76 | 76 |
77 def _sort_entries_by_conditional(self): | 77 def _sort_entries_by_conditional(self): |
78 unconditional_names = set() | 78 unconditional_names = set() |
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
157 | 157 |
158 def generate_interfaces_header(self): | 158 def generate_interfaces_header(self): |
159 return INTERFACES_HEADER_TEMPLATE % { | 159 return INTERFACES_HEADER_TEMPLATE % { |
160 'license': license.license_for_generated_cpp(), | 160 'license': license.license_for_generated_cpp(), |
161 'namespace': self.namespace, | 161 'namespace': self.namespace, |
162 'macro_style_name': name_utilities.to_macro_style(self.namespace), | 162 'macro_style_name': name_utilities.to_macro_style(self.namespace), |
163 'declare_conditional_macros': self._declare_conditional_macros(), | 163 'declare_conditional_macros': self._declare_conditional_macros(), |
164 'unconditional_macros': '\n'.join(sorted(set(map(self._unconditional
_macro, self._unconditional_entries)))), | 164 'unconditional_macros': '\n'.join(sorted(set(map(self._unconditional
_macro, self._unconditional_entries)))), |
165 'conditional_macros': '\n'.join(map(self._conditional_macros, self._
entries_by_conditional.keys())), | 165 'conditional_macros': '\n'.join(map(self._conditional_macros, self._
entries_by_conditional.keys())), |
166 } | 166 } |
OLD | NEW |