Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(71)

Unified Diff: chrome/browser/chromeos/input_method/gen_ibus_input_methods.py

Issue 9721017: Rename ibus_input_methods.txt to input_methods.txt. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: re-retry Created 8 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | chrome/browser/chromeos/input_method/gen_input_methods.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/chromeos/input_method/gen_ibus_input_methods.py
diff --git a/chrome/browser/chromeos/input_method/gen_ibus_input_methods.py b/chrome/browser/chromeos/input_method/gen_ibus_input_methods.py
deleted file mode 100755
index 2de02c2c2cd14a6ba2c4f8410e9bd1b97975172a..0000000000000000000000000000000000000000
--- a/chrome/browser/chromeos/input_method/gen_ibus_input_methods.py
+++ /dev/null
@@ -1,124 +0,0 @@
-#!/usr/bin/env python
-# Copyright (c) 2011 The Chromium Authors. All rights reserved.
-# Use of this source code is governed by a BSD-style license that can be
-# found in the LICENSE file.
-
-"""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.
-
-Run it like:
- gen_ibus_input_methods.py ibus_input_methods.txt ibus_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_
-
-namespace chromeos {
-namespace input_method {
-
-struct IBusEngineInfo {
- 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"},
-};
-
-} // namespace input_method
-} // namespace chromeos
-
-#endif // CHROME_BROWSER_CHROMEOS_INPUT_METHOD_IBUS_INPUT_METHODS_H_
-
-"""
-
-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_
-
-namespace chromeos {
-namespace input_method {
-
-struct IBusEngineInfo {
- const char* input_method_id;
- const char* language_code;
- const char* xkb_layout_id;
-};
-const IBusEngineInfo kIBusEngines[] = {
-"""
-
-CPP_FORMAT = '#if %s\n'
-ENGINE_FORMAT = (' {"%(input_method_id)s", "%(language_code)s", ' +
- '"%(xkb_layout_id)s"},\n')
-
-OUTPUT_FOOTER = """
-};
-
-} // namespace input_method
-} // namespace chromeos
-
-#endif // CHROME_BROWSER_CHROMEOS_INPUT_METHOD_IBUS_INPUT_METHODS_H_
-"""
-
-def CreateEngineHeader(engines):
- """Create the header file from a list of engines.
-
- Arguments:
- engines: list of ibus engine objects
- Returns:
- The text of a C++ header file containing the engine data.
- """
- output = []
- output.append(OUTPUT_HEADER)
- for engine in engines:
- if engine.has_key('if'):
- output.append(CPP_FORMAT % engine['if'])
- output.append(ENGINE_FORMAT % engine)
- if engine.has_key('if'):
- output.append('#endif\n')
- output.append(OUTPUT_FOOTER)
-
- return "".join(output)
-
-
-def main(argv):
- if len(argv) != 3:
- print 'Usage: gen_ibus_input_methods.py [whitelist] [output]'
- sys.exit(1)
- engines = []
- for line in fileinput.input(sys.argv[1]):
- line = line.strip()
- if not line or re.match(r'#', line):
- continue
- columns = line.split()
- assert len(columns) == 3 or len(columns) == 4, "Invalid format: " + line
- engine = {}
- engine['input_method_id'] = columns[0]
- engine['xkb_layout_id'] = columns[1]
- engine['language_code'] = columns[2]
- if len(columns) == 4:
- engine['if'] = columns[3]
- engines.append(engine)
-
- output = CreateEngineHeader(engines)
- output_file = open(sys.argv[2], 'w')
- output_file.write(output)
-
-
-if __name__ == '__main__':
- main(sys.argv)
« no previous file with comments | « no previous file | chrome/browser/chromeos/input_method/gen_input_methods.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698