| OLD | NEW |
| 1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
| 2 | 2 |
| 3 import os.path | 3 import os.path |
| 4 import re | 4 import re |
| 5 import subprocess | 5 import subprocess |
| 6 import sys | 6 import sys |
| 7 | 7 |
| 8 from in_file import InFile | 8 from in_file import InFile |
| 9 from name_utilities import upper_first_letter | 9 from name_utilities import upper_first_letter |
| 10 import in_generator | 10 import in_generator |
| (...skipping 28 matching lines...) Expand all Loading... |
| 39 | 39 |
| 40 GPERF_TEMPLATE = """ | 40 GPERF_TEMPLATE = """ |
| 41 %%{ | 41 %%{ |
| 42 %(license)s | 42 %(license)s |
| 43 | 43 |
| 44 #include "config.h" | 44 #include "config.h" |
| 45 #include "%(class_name)s.h" | 45 #include "%(class_name)s.h" |
| 46 #include "core/css/HashTools.h" | 46 #include "core/css/HashTools.h" |
| 47 #include <string.h> | 47 #include <string.h> |
| 48 | 48 |
| 49 #ifdef _MSC_VER |
| 50 // Disable the warnings from casting a 64-bit pointer to 32-bit long |
| 51 // warning C4302: 'type cast': truncation from 'char (*)[28]' to 'long' |
| 52 #pragma warning(disable : 4302) |
| 53 #endif |
| 54 |
| 49 namespace blink { | 55 namespace blink { |
| 50 static const char valueListStringPool[] = { | 56 static const char valueListStringPool[] = { |
| 51 %(value_keyword_strings)s | 57 %(value_keyword_strings)s |
| 52 }; | 58 }; |
| 53 | 59 |
| 54 static const unsigned short valueListStringOffsets[] = { | 60 static const unsigned short valueListStringOffsets[] = { |
| 55 %(value_keyword_offsets)s | 61 %(value_keyword_offsets)s |
| 56 }; | 62 }; |
| 57 | 63 |
| 58 %%} | 64 %%} |
| (...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 164 # FIXME: If we could depend on Python 2.7, we would use subprocess.check
_output | 170 # FIXME: If we could depend on Python 2.7, we would use subprocess.check
_output |
| 165 gperf_args = [self.gperf_path, '--key-positions=*', '-P', '-n'] | 171 gperf_args = [self.gperf_path, '--key-positions=*', '-P', '-n'] |
| 166 gperf_args.extend(['-m', '50']) # Pick best of 50 attempts. | 172 gperf_args.extend(['-m', '50']) # Pick best of 50 attempts. |
| 167 gperf_args.append('-D') # Allow duplicate hashes -> More compact code. | 173 gperf_args.append('-D') # Allow duplicate hashes -> More compact code. |
| 168 gperf = subprocess.Popen(gperf_args, stdin=subprocess.PIPE, stdout=subpr
ocess.PIPE, universal_newlines=True) | 174 gperf = subprocess.Popen(gperf_args, stdin=subprocess.PIPE, stdout=subpr
ocess.PIPE, universal_newlines=True) |
| 169 return gperf.communicate(gperf_input)[0] | 175 return gperf.communicate(gperf_input)[0] |
| 170 | 176 |
| 171 | 177 |
| 172 if __name__ == "__main__": | 178 if __name__ == "__main__": |
| 173 in_generator.Maker(CSSValueKeywordsWriter).main(sys.argv) | 179 in_generator.Maker(CSSValueKeywordsWriter).main(sys.argv) |
| OLD | NEW |