Commit f3f97eeb authored by Bao-Duy Tran's avatar Bao-Duy Tran Committed by Chromium LUCI CQ

Remove dead code and update sample output in gen_input_methods.py.

This script is used for on-the-fly autogen of C++ code from legacy
input_methods.txt [1] config file that's mostly obsolete and on track
for full deprecation. This cleanup is in prep for trimming the script
to just what's still really in use nowadays from input_methods.txt.

[1] https://source.chromium.org/chromium/chromium/src/+/master:chromeos/ime/input_methods.txt;drc=5ab33d25bc676b63e4afbcfade6f9265a5f5a3ea

Bug: 1134526,1134465
Change-Id: Id8b235958deaee0f2d935f8e384af9c4e0cc19c7
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2568923Reviewed-by: default avatarYuichiro Hanada <yhanada@chromium.org>
Reviewed-by: default avatarDarren Shen <shend@chromium.org>
Reviewed-by: default avatarMy Nguyen <myy@chromium.org>
Commit-Queue: Bao-Duy Tran <tranbaoduy@chromium.org>
Cr-Commit-Position: refs/heads/master@{#833085}
parent ce21c7fd
......@@ -15,7 +15,7 @@ Run it like:
It will produce output that looks like:
// This file is automatically generated by gen_input_methods.py
// Automatically generated by gen_input_methods.py
#ifndef CHROMEOS_IME_INPUT_METHODS_H_
#define CHROMEOS_IME_INPUT_METHODS_H_
......@@ -25,7 +25,7 @@ namespace input_method {
struct InputMethodsInfo {
const char* input_method_id;
const char* language_code;
const char* xkb_keyboard_id;
const char* xkb_layout_id;
const char* indicator;
bool is_login_keyboard;
};
......@@ -64,12 +64,9 @@ struct InputMethodsInfo {
};
const InputMethodsInfo kInputMethods[] = {
"""
CPP_FORMAT = '#if %s\n'
ENGINE_FORMAT = (' {"%(input_method_id)s", "%(language_code)s", ' +
'"%(xkb_layout_id)s", "%(indicator)s", ' +
'%(is_login_keyboard)s},\n')
OUTPUT_FOOTER = """
};
......@@ -90,11 +87,7 @@ def CreateEngineHeader(engines):
output = []
output.append(OUTPUT_HEADER)
for engine in engines:
if 'if' in engine:
output.append(CPP_FORMAT % engine['if'])
output.append(ENGINE_FORMAT % engine)
if 'if' in engine:
output.append('#endif\n')
output.append(OUTPUT_FOOTER)
return "".join(output)
......@@ -102,7 +95,7 @@ def CreateEngineHeader(engines):
def main(argv):
if len(argv) != 3:
print 'Usage: gen_input_methods.py [allowlist] [output]'
print 'Usage: gen_input_methods.py [input_methods.txt] [output]'
sys.exit(1)
engines = []
for line in fileinput.input(sys.argv[1]):
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment