From 7dc1b0ffd8d58199abfef601647e587a945916b2 Mon Sep 17 00:00:00 2001 From: handa Date: Tue, 17 Feb 2009 07:50:44 +0000 Subject: [PATCH] *** empty log message *** --- Makefile.am | 1 + utils/expand-mdb.awk | 37 +++++++++++++++++++++++++++++++++++++ utils/expand-mdb.sed | 1 + 3 files changed, 39 insertions(+) create mode 100644 utils/expand-mdb.awk create mode 100644 utils/expand-mdb.sed diff --git a/Makefile.am b/Makefile.am index d432aa1..b8c5d28 100644 --- a/Makefile.am +++ b/Makefile.am @@ -265,6 +265,7 @@ data/exprog.txt: ${EXAMPLE_PROGS} utils/exprog.sh utils/exprog.sh ${EXAMPLE_PROGS} > $@ data/dbdata.txt: ${DBDATA} ${DBIMAGE} @M17NDB@/mdb.xml utils/expand-mdb.awk + [ -d data ] || mkdir data SEDFILE=`pwd`/utils/expand-mdb.sed; \ @AWK@ -v SEDFILE=$$SEDFILE -v M17NDB=@M17NDB@ -f utils/expand-mdb.awk @M17NDB@/mdb.xml > data/expanded-mdb.xml diff --git a/utils/expand-mdb.awk b/utils/expand-mdb.awk new file mode 100644 index 0000000..1e5e3fb --- /dev/null +++ b/utils/expand-mdb.awk @@ -0,0 +1,37 @@ +BEGIN { + SUBDIR["input-method-*"] = "MIM/"; + SUBDIR["font-layouter-*"] = "FLT/"; + SUBDIR["language-name-*"] = "LANGDATA/"; + SUBDIR["standard-language-iso639"] = "LANGDATA/"; + KEY=""; +} + +/^ 0) { + KEY = sprintf("%s-%s", KEY, substr($0, RSTART + 6, RLENGTH - 6)); + if (match($0, "key2=\"[^\"]*") > 0) + KEY = sprintf("%s-%s", KEY, substr($0, RSTART + 6, RLENGTH - 6)); + } + print; + next; +} + +/[^<]*<\/filename>/ { + from = match($0, ""); + HEAD = substr($0, 1, from - 1) + if (length(HEAD) > 1 && ! match(HEAD, "^[ \t]*$")) + printf "%s\n", substr($0, 1, from - 1); + to = match($0, "<\/filename>"); + TAIL = substr($0, to + RLENGTH); + FILE = sprintf("%s%s", SUBDIR[KEY], substr($0, from+10, to - (from+10))); + system(sprintf("cd %s; ls %s|sed -f %s", M17NDB, FILE, SEDFILE)); + if (length(TAIL) > 0) + print TAIL; + next; +} + +{ + print; +} diff --git a/utils/expand-mdb.sed b/utils/expand-mdb.sed new file mode 100644 index 0000000..4e80791 --- /dev/null +++ b/utils/expand-mdb.sed @@ -0,0 +1 @@ +s,\(.*\),, -- 1.7.10.4