| 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. |
| 12 | 14 |
| 13 Run it like: | 15 Run it like: |
| 14 gen_input_methods.py input_methods.txt input_methods.h | 16 gen_input_methods.py input_methods.txt input_methods.h |
| 15 | 17 |
| 16 It will produce output that looks like: | 18 It will produce output that looks like: |
| 17 | 19 |
| 18 // This file is automatically generated by gen_input_methods.py | 20 // This file is automatically generated by gen_input_methods.py |
| 19 #ifndef CHROMEOS_IME_INPUT_METHODS_H_ | 21 #ifndef CHROMEOS_IME_INPUT_METHODS_H_ |
| 20 #define CHROMEOS_IME_INPUT_METHODS_H_ | 22 #define CHROMEOS_IME_INPUT_METHODS_H_ |
| 21 | 23 |
| (...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 123 engine['is_login_keyboard'] = is_login_keyboard | 125 engine['is_login_keyboard'] = is_login_keyboard |
| 124 engines.append(engine) | 126 engines.append(engine) |
| 125 | 127 |
| 126 output = CreateEngineHeader(engines) | 128 output = CreateEngineHeader(engines) |
| 127 output_file = open(sys.argv[2], 'w') | 129 output_file = open(sys.argv[2], 'w') |
| 128 output_file.write(output) | 130 output_file.write(output) |
| 129 | 131 |
| 130 | 132 |
| 131 if __name__ == '__main__': | 133 if __name__ == '__main__': |
| 132 main(sys.argv) | 134 main(sys.argv) |
| OLD | NEW |