| 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 """Generate a C++ header from input_methods.txt. | 6 """Generate a C++ header from input_methods.txt. |
| 7 | 7 |
| 8 This program generates a C++ header file containing the information on | 8 This program generates a C++ header file containing the information on |
| 9 available input methods. It parses input_methods.txt, and then generates a | 9 available input methods. It parses input_methods.txt, and then generates a |
| 10 static array definition from the information extracted. The input and output | 10 static array definition from the information extracted. The input and output |
| 11 file names are specified on the command line. | 11 file names are specified on the command line. |
| 12 The header input_methods.h is used in input_method_whitelist.cc which is for | |
| 13 testing purpose. | |
| 14 | 12 |
| 15 Run it like: | 13 Run it like: |
| 16 gen_input_methods.py input_methods.txt input_methods.h | 14 gen_input_methods.py input_methods.txt input_methods.h |
| 17 | 15 |
| 18 It will produce output that looks like: | 16 It will produce output that looks like: |
| 19 | 17 |
| 20 // This file is automatically generated by gen_input_methods.py | 18 // This file is automatically generated by gen_input_methods.py |
| 21 #ifndef CHROMEOS_IME_INPUT_METHODS_H_ | 19 #ifndef CHROMEOS_IME_INPUT_METHODS_H_ |
| 22 #define CHROMEOS_IME_INPUT_METHODS_H_ | 20 #define CHROMEOS_IME_INPUT_METHODS_H_ |
| 23 | 21 |
| (...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 125 engine['is_login_keyboard'] = is_login_keyboard | 123 engine['is_login_keyboard'] = is_login_keyboard |
| 126 engines.append(engine) | 124 engines.append(engine) |
| 127 | 125 |
| 128 output = CreateEngineHeader(engines) | 126 output = CreateEngineHeader(engines) |
| 129 output_file = open(sys.argv[2], 'w') | 127 output_file = open(sys.argv[2], 'w') |
| 130 output_file.write(output) | 128 output_file.write(output) |
| 131 | 129 |
| 132 | 130 |
| 133 if __name__ == '__main__': | 131 if __name__ == '__main__': |
| 134 main(sys.argv) | 132 main(sys.argv) |
| OLD | NEW |