From 5b1add8426ab2371b7d9015aa7059e32bd8504c8 Mon Sep 17 00:00:00 2001 From: handa Date: Mon, 2 Oct 2006 06:10:23 +0000 Subject: [PATCH] New file. --- tbl2mim.awk | 50 ++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 50 insertions(+) create mode 100644 tbl2mim.awk diff --git a/tbl2mim.awk b/tbl2mim.awk new file mode 100644 index 0000000..b02b9d0 --- /dev/null +++ b/tbl2mim.awk @@ -0,0 +1,50 @@ +#!/usr/bin/gawk +# Copyright (C) 2006 +# National Institute of Advanced Industrial Science and Technology (AIST) +# Registration Number H15PRO112 + +# This file is part of the m17n contrib; a sub-part of the m17n +# library. + +# The m17n library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public License +# as published by the Free Software Foundation; either version 2.1 of +# the License, or (at your option) any later version. + +# The m17n library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. + +# You should have received a copy of the GNU Lesser General Public +# License along with the m17n library; if not, write to the Free +# Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA +# 02111-1307, USA. + +BEGIN { + begin_table = 0; +} + +/^ICON *=/ { ICON = " \""$3"\""; next; } +/^NAME *=/ { NAME = tolower($3); next; } +/^LANGUAGES *=/ { LANG = $3; next; } +/^STATUS_PROMPT *=/ { TITLE = $3; next; } +/^BEGIN_TABLE/ { + printf "(input-method %s %s)\n", LANG, NAME; + printf "(title \"%s\"%s)\n", TITLE, ICON; + printf "(map\n (trans"; + begin_table = 1; + next; +} +/^END_TABLE/ { + begin_table = 0; + printf "))\n(state (init (trans)))\n"; + next; +} + +{ + if (begin_table) { + gsub("[\\\\\"]", "\\\\&"); + printf "\n (\"%s\" \"%s\")", $1, $2; + } +} -- 1.7.10.4