*** empty log message ***
authorhanda <handa>
Tue, 17 Feb 2009 07:50:44 +0000 (07:50 +0000)
committerhanda <handa>
Tue, 17 Feb 2009 07:50:44 +0000 (07:50 +0000)
Makefile.am
utils/expand-mdb.awk [new file with mode: 0644]
utils/expand-mdb.sed [new file with mode: 0644]

index d432aa1..b8c5d28 100644 (file)
@@ -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 (file)
index 0000000..1e5e3fb
--- /dev/null
@@ -0,0 +1,37 @@
+BEGIN {
+    SUBDIR["input-method-*"] = "MIM/";
+    SUBDIR["font-layouter-*"] = "FLT/";
+    SUBDIR["language-name-*"] = "LANGDATA/";
+    SUBDIR["standard-language-iso639"] = "LANGDATA/";
+    KEY="";
+}
+
+/^<item / {
+    match($0, "key0=\"[^\"]*");
+    KEY=substr($0, RSTART + 6, RLENGTH - 6);
+    if (match($0, "key1=\"[^\"]*") > 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>[^<]*<\/filename>/ {
+    from = match($0, "<filename>");
+    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 (file)
index 0000000..4e80791
--- /dev/null
@@ -0,0 +1 @@
+s,\(.*\),<xi:include xmlns:xi="http://www.w3.org/2001/XInclude" parse="xml" href="\1"/>,