From f1f28b8d79c8062b656f5f17dc081eda6eec5270 Mon Sep 17 00:00:00 2001 From: handa Date: Thu, 12 Jul 2007 04:51:17 +0000 Subject: [PATCH] *** empty log message *** --- Makefile.am | 2 +- utils/dbdata.awk | 33 ++++++++++++++++++++++++++++++++- utils/dbdata.sh | 43 +++++++++++++++++++++++++------------------ utils/imdoc.c | 43 ++++++++++++++++++++++++++++++++++++++++--- 4 files changed, 98 insertions(+), 23 deletions(-) diff --git a/Makefile.am b/Makefile.am index 243e47d..775f088 100644 --- a/Makefile.am +++ b/Makefile.am @@ -94,7 +94,7 @@ SRCALL = \ data/m17n-config.txt data/m17n-db.txt data/exprog.txt \ data/dbformat.txt data/dbdata.txt data/dbtutorial.txt fdl.txt -DBDATA = $(shell echo @M17NDB@/*.{dir,mim,flt,fst,tbl}) +DBDATA = $(shell echo @M17NDB@/*.{dir,fst,tbl} @M17NDB@/MIM/*.mim @M17NDB@/FLT/*.flt @M17NDB@/LANGDATA/LANGUAGE.tbl) DBIMAGE = $(shell echo images/*.png images/*.eps) HTML_USR_TARGET = usr/html/index.html usr/html/parrot.png diff --git a/utils/dbdata.awk b/utils/dbdata.awk index f8b31e8..57cf343 100644 --- a/utils/dbdata.awk +++ b/utils/dbdata.awk @@ -2,7 +2,15 @@ BEGIN { print "/***"; } -/".*\.(mim|flt|fst|tbl)"/ { +/"LANGUAGE.tbl"/ { + DIR=FILENAME; + gsub("/[^/]*$", "", DIR) + system("utils/dbdata.sh "DIR"/LANGDATA LANGUAGE.tbl"); + printf "\n"; + next; +} + +/".*\.(fst|tbl)"/ { FROM=match($0, "\".*\\.(mim|flt|fst|tbl)\"") + 1; LEN=RLENGTH-2; FILE=substr($0, FROM, LEN); @@ -10,6 +18,29 @@ BEGIN { gsub("/[^/]*$", "", DIR) system("utils/dbdata.sh "DIR" "FILE); printf "\n"; + next; +} + +/".*\.mim"/ { + FROM=match($0, "\".*\\.mim\"") + 1; + LEN=RLENGTH-2; + FILE=substr($0, FROM, LEN); + DIR=FILENAME; + gsub("/[^/]*$", "", DIR) + system("utils/dbdata.sh "DIR"/MIM "FILE); + printf "\n"; + next; +} + +/".*\.flt"/ { + FROM=match($0, "\".*\\.flt\"") + 1; + LEN=RLENGTH-2; + FILE=substr($0, FROM, LEN); + DIR=FILENAME; + gsub("/[^/]*$", "", DIR) + system("utils/dbdata.sh "DIR"/FLT "FILE); + printf "\n"; + next; } /^;;;/ { diff --git a/utils/dbdata.sh b/utils/dbdata.sh index 0bea10b..2978cf9 100755 --- a/utils/dbdata.sh +++ b/utils/dbdata.sh @@ -7,37 +7,44 @@ FILE=$1 while shift 1; do IM=`grep '^(input-method' $FILE` if test -n "$IM"; then - if false; then - sed -n -e '/^(input-method/s/(input-method \([^ ]*\) \([^ )]*\)\( \([^)]*\)\)*)/\1 \2 \4/p' $FILE | (read LANG NAME EXTRA + if grep -q '^;;;' $FILE; then + sed -n -e '/^(input-method/s/(input-method \([^ ]*\) \([^ )]*\)\( \([^)]*\)\)*)/\1 \2 \4/p' $FILE | (read LNG NAME EXTRA if test -z "NAME"; then NAME=$EXTRA fi - if test "$LANG" = "t"; then - LANG=generic + if test "$LNG" = "t"; then + LNG=generic fi if test "$NAME" = "nil"; then - echo "
  • $FILE (extra-name:$EXTRA, only for inclusion)" + HEADER="
  • $FILE (extra-name:$EXTRA, only for inclusion)" + HEADER2="" else - base=`basename $FILE` + title=`sed -n -e '/^(title/s/(title \("[^"]*"\).*$/\1/p' $FILE` + file=`basename $FILE` + base=`basename $file .mim` dir=`dirname $FILE` - icon="$dir/icons/$base" + dir=`dirname $dir` + icon="$dir/icons/$base.png" if [ -f "$icon" ] ; then - [ -f "images/icon-$base" ] || cp "$icon" "images/icon-$base" + [ -f "images/icon-$base.png" ] || cp "$icon" "images/icon-$base.png" fi - echo "
  • $FILE (language:$LANG name:$NAME @htmlonly" - echo "" - echo "@endhtmlonly" - echo ")" - fi) - if grep -q '^;;;' $FILE; then + HEADER="
  • $base (language:$LNG name:$NAME @htmlonly" + if test -n "$title"; then + HEADER="$HEADER title:$title" + fi + HEADER2="" + HEADER3="@endhtmlonly" + HEADER4=")" + fi + echo "$HEADER" + if test -n "$HEADER2"; then + echo "$HEADER2"; echo "$HEADER3"; echo "$HEADER4" + fi echo - sed -n -e '/^;;;/ p' $FILE | sed -e '/^[^;]/ s/$/
    /' -e '/^;;;/ s/^;;; *//' | sed -e 's,^||,,' -e 's,||$,,' -e 's,|,,g' + sed -n -e '/^;;;/ p' $FILE | sed -e '/^[^;]/ s/$/
    /' -e '/^;;;/ s/^;;; *//' | sed -e 's,^||,,' -e 's,||$,,' -e 's,|,,g') else M17NDIR=/usr/share/m17n $IMDOC $FILE "$IM" fi - else - M17NDIR=/usr/share/m17n $IMDOC $FILE - fi else echo sed -n -e '/^;;;/ p' $FILE | sed -e '/^[^;]/ s/$/
    /' -e '/^;;;/ s/^;;; *//' diff --git a/utils/imdoc.c b/utils/imdoc.c index 346da2f..8854093 100644 --- a/utils/imdoc.c +++ b/utils/imdoc.c @@ -161,11 +161,48 @@ main (int argc, char **argv) } else { - printf ("@verbatim\n"); - mconv_encode_stream (msymbol ("utf-8"), mt, stdout); + int len = mtext_len (mt), i, c; + + for (i = 0; i < len; i++) + { + c = mtext_ref_char (mt, i); + if (c >= 0x100) + break; + } + if (i < len) + printf ("@htmlonly\n
    \n");
    +      else
    +	printf ("@verbatim\n");
    +      mconv_encode_stream (Mutf8, mt, stdout);
           if (mtext_ref_char (mt, mtext_len (mt) - 1) != '\n')
     	printf ("\n");
    -      printf ("@endverbatim\n");
    +      if (i < len)
    +	{
    +	  MConverter *converter = mconv_stream_converter (Mutf8, stdout);
    +	  int from;
    +
    +	  printf ("

    \n@endhtmlonly\n"); + printf ("@latexonly\n\\begin{verbatim}\n"); + if (i > 0) + mconv_encode_range (converter, mt, 0, i); + for (from = i; i < len; i++) + { + c = mtext_ref_char (mt, i); + if (c >= 0x100) + { + if (i > from) + mconv_encode_range (converter, mt, from, i); + printf ("U+%04X", c); + from = i + 1; + } + } + if (i > from) + mconv_encode_range (converter, mt, from, i); + printf ("\\end{verbatim}\n@endlatexonly\n"); + mconv_free_converter (converter); + } + else + printf ("@endverbatim\n"); } M17N_FINI (); -- 1.7.10.4