| Index: chrome/browser/chromeos/input_method/gen_input_methods.py
|
| diff --git a/chrome/browser/chromeos/input_method/gen_ibus_input_methods.py b/chrome/browser/chromeos/input_method/gen_input_methods.py
|
| similarity index 62%
|
| rename from chrome/browser/chromeos/input_method/gen_ibus_input_methods.py
|
| rename to chrome/browser/chromeos/input_method/gen_input_methods.py
|
| index 2de02c2c2cd14a6ba2c4f8410e9bd1b97975172a..35f60ab4d00a4fcec9dfbfa8936ac15cd03cac94 100755
|
| --- a/chrome/browser/chromeos/input_method/gen_ibus_input_methods.py
|
| +++ b/chrome/browser/chromeos/input_method/gen_input_methods.py
|
| @@ -6,40 +6,39 @@
|
| """Generate a C++ header from ibus_input_methods.txt.
|
|
|
| This program generates a C++ header file containing the information on
|
| -available ibus engines. It parses ibus_input_methods.txt, and then
|
| -generates a static array definition from the information extracted. The
|
| -input and output file names are specified on the command line.
|
| +available input methods. It parses input_methods.txt, and then generates a
|
| +static array definition from the information extracted. The input and output
|
| +file names are specified on the command line.
|
|
|
| Run it like:
|
| - gen_ibus_input_methods.py ibus_input_methods.txt ibus_input_methods.h
|
| + gen_input_methods.py input_methods.txt input_methods.h
|
|
|
| It will produce output that looks like:
|
|
|
| -// This file is automatically generated by gen_engines.py
|
| -#ifndef CHROME_BROWSER_CHROMEOS_INPUT_METHOD_IBUS_INPUT_METHODS_H_
|
| -#define CHROME_BROWSER_CHROMEOS_INPUT_METHOD_IBUS_INPUT_METHODS_H_
|
| +// This file is automatically generated by gen_input_methods.py
|
| +#ifndef CHROME_BROWSER_CHROMEOS_INPUT_METHOD_INPUT_METHODS_H_
|
| +#define CHROME_BROWSER_CHROMEOS_INPUT_METHOD_INPUT_METHODS_H_
|
|
|
| namespace chromeos {
|
| namespace input_method {
|
|
|
| -struct IBusEngineInfo {
|
| +struct InputMethodsInfo {
|
| const char* input_method_id;
|
| const char* language_code;
|
| const char* xkb_keyboard_id;
|
| - const char* keyboard_overlay_id;
|
| };
|
| -const IBusEngineInfo kIBusEngines[] = {
|
| - {"mozc-chewing", "zh-TW", "us", "zh-TW"},
|
| - {"xkb:us::eng", "eng", "us", "en_US"},
|
| - {"xkb:us:dvorak:eng", "eng", "us(dvorak)", "en_US_dvorak"},
|
| - {"xkb:be::fra", "fra", "be", "fr"},
|
| - {"xkb:br::por", "por", "br", "pt_BR"},
|
| +const InputMethodsInfo kInputMethods[] = {
|
| + {"mozc-chewing", "zh-TW", "us"},
|
| + {"xkb:us::eng", "en-US", "us"},
|
| + {"xkb:us:dvorak:eng", "en-US", "us(dvorak)"},
|
| + {"xkb:be::fra", "fr", "be"},
|
| + {"xkb:br::por", "pt-BR", "br"},
|
| };
|
|
|
| } // namespace input_method
|
| } // namespace chromeos
|
|
|
| -#endif // CHROME_BROWSER_CHROMEOS_INPUT_METHOD_IBUS_INPUT_METHODS_H_
|
| +#endif // CHROME_BROWSER_CHROMEOS_INPUT_METHOD_INPUT_METHODS_H_
|
|
|
| """
|
|
|
| @@ -47,19 +46,19 @@ import fileinput
|
| import re
|
| import sys
|
|
|
| -OUTPUT_HEADER = """// Automatically generated by gen_ibus_input_methods.py
|
| -#ifndef CHROME_BROWSER_CHROMEOS_INPUT_METHOD_IBUS_INPUT_METHODS_H_
|
| -#define CHROME_BROWSER_CHROMEOS_INPUT_METHOD_IBUS_INPUT_METHODS_H_
|
| +OUTPUT_HEADER = """// Automatically generated by gen_input_methods.py
|
| +#ifndef CHROME_BROWSER_CHROMEOS_INPUT_METHOD_INPUT_METHODS_H_
|
| +#define CHROME_BROWSER_CHROMEOS_INPUT_METHOD_INPUT_METHODS_H_
|
|
|
| namespace chromeos {
|
| namespace input_method {
|
|
|
| -struct IBusEngineInfo {
|
| +struct InputMethodsInfo {
|
| const char* input_method_id;
|
| const char* language_code;
|
| const char* xkb_layout_id;
|
| };
|
| -const IBusEngineInfo kIBusEngines[] = {
|
| +const InputMethodsInfo kInputMethods[] = {
|
| """
|
|
|
| CPP_FORMAT = '#if %s\n'
|
| @@ -72,14 +71,14 @@ OUTPUT_FOOTER = """
|
| } // namespace input_method
|
| } // namespace chromeos
|
|
|
| -#endif // CHROME_BROWSER_CHROMEOS_INPUT_METHOD_IBUS_INPUT_METHODS_H_
|
| +#endif // CHROME_BROWSER_CHROMEOS_INPUT_METHOD_INPUT_METHODS_H_
|
| """
|
|
|
| def CreateEngineHeader(engines):
|
| """Create the header file from a list of engines.
|
|
|
| Arguments:
|
| - engines: list of ibus engine objects
|
| + engines: list of engine objects
|
| Returns:
|
| The text of a C++ header file containing the engine data.
|
| """
|
| @@ -98,7 +97,7 @@ def CreateEngineHeader(engines):
|
|
|
| def main(argv):
|
| if len(argv) != 3:
|
| - print 'Usage: gen_ibus_input_methods.py [whitelist] [output]'
|
| + print 'Usage: gen_input_methods.py [whitelist] [output]'
|
| sys.exit(1)
|
| engines = []
|
| for line in fileinput.input(sys.argv[1]):
|
|
|