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 // warning C4311: 'type cast': pointer truncation from 'char (*)[18]' to 'long' |
| 53 #pragma warning(disable : 4302 4311) |
| 54 #endif |
| 55 |
49 namespace blink { | 56 namespace blink { |
50 static const char valueListStringPool[] = { | 57 static const char valueListStringPool[] = { |
51 %(value_keyword_strings)s | 58 %(value_keyword_strings)s |
52 }; | 59 }; |
53 | 60 |
54 static const unsigned short valueListStringOffsets[] = { | 61 static const unsigned short valueListStringOffsets[] = { |
55 %(value_keyword_offsets)s | 62 %(value_keyword_offsets)s |
56 }; | 63 }; |
57 | 64 |
58 %%} | 65 %%} |
(...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 | 171 # 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'] | 172 gperf_args = [self.gperf_path, '--key-positions=*', '-P', '-n'] |
166 gperf_args.extend(['-m', '50']) # Pick best of 50 attempts. | 173 gperf_args.extend(['-m', '50']) # Pick best of 50 attempts. |
167 gperf_args.append('-D') # Allow duplicate hashes -> More compact code. | 174 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) | 175 gperf = subprocess.Popen(gperf_args, stdin=subprocess.PIPE, stdout=subpr
ocess.PIPE, universal_newlines=True) |
169 return gperf.communicate(gperf_input)[0] | 176 return gperf.communicate(gperf_input)[0] |
170 | 177 |
171 | 178 |
172 if __name__ == "__main__": | 179 if __name__ == "__main__": |
173 in_generator.Maker(CSSValueKeywordsWriter).main(sys.argv) | 180 in_generator.Maker(CSSValueKeywordsWriter).main(sys.argv) |
OLD | NEW |