*** empty log message ***
authorhanda <handa>
Thu, 12 Jul 2007 04:51:17 +0000 (04:51 +0000)
committerhanda <handa>
Thu, 12 Jul 2007 04:51:17 +0000 (04:51 +0000)
Makefile.am
utils/dbdata.awk
utils/dbdata.sh
utils/imdoc.c

index 243e47d..775f088 100644 (file)
@@ -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
index f8b31e8..57cf343 100644 (file)
@@ -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;
 }
 
 /^;;;/ {
index 0bea10b..2978cf9 100755 (executable)
@@ -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 "<li> $FILE (extra-name:$EXTRA, only for inclusion)"
+               HEADER="<li> $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 "<li> $FILE (language:$LANG name:$NAME @htmlonly"
-               echo "<img src=\"icon-$base\" style=\"vertical-align:middle;\">"
-               echo "@endhtmlonly"
-               echo ")"
-           fi)
-       if grep -q '^;;;' $FILE; then
+               HEADER="<li> $base (language:$LNG name:$NAME @htmlonly"
+               if test -n "$title"; then
+                   HEADER="$HEADER title:$title"
+               fi
+               HEADER2="<img src=\"icon-$base.png\" style=\"vertical-align:middle;\">"
+               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/$/<br>/' -e '/^;;;/ s/^;;; *//' | sed -e 's,^||,<tr><td align="center">,' -e 's,||$,</td></tr>,' -e 's,|,</td><td align="center">,g'
+            sed -n -e '/^;;;/ p' $FILE | sed -e '/^[^;]/ s/$/<br>/' -e '/^;;;/ s/^;;; *//' | sed -e 's,^||,<tr><td align="center">,' -e 's,||$,</td></tr>,' -e 's,|,</td><td align="center">,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/$/<br>/' -e '/^;;;/ s/^;;; *//'
index 346da2f..8854093 100644 (file)
@@ -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<div class=\"fragment\"><pre class=\"fragment\">\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 ("</pre></div><p>\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 ();