mgp_1.11b-4.dsc (NOT pgp-verified) mgp-1.11b-4
authormirabilos <t.glaser@tarent.de>
Tue, 31 May 2005 15:04:26 +0000 (00:04 +0900)
committermirabilos <mirabilos@evolvis.org>
Tue, 31 May 2005 15:04:26 +0000 (00:04 +0900)
debian/changelog
debian/copyright
livepatch.mgp [new file with mode: 0644]
m17n.c
mgp.c
mgp.h
parse.c
x11.c

index 983b16a..b1e406e 100644 (file)
@@ -1,3 +1,11 @@
+mgp (1.11b-4) unstable; urgency=high
+
+  * apply Kenichi Handa's patch
+  * fix segfault when html generation mode (mgp -D)
+  * improve font handling
+
+ -- Fumitoshi UKAI <ukai@debian.or.jp>  Wed,  1 Jun 2005 00:04:26 +0900
+
 mgp (1.11b-3) unstable; urgency=high
 
   * fix broken m17n support
index ed7beea..55da4f2 100644 (file)
@@ -1,7 +1,7 @@
 This package was debianized by Fumitoshi UKAI ukai@debian.or.jp on
 Wed, 24 Dec 1997 16:17:59 +0900.
 
-It was downloaded from ftp://ftp.mew.org/pub/MagicPoint/
+It was downloaded from http://member.wide.ad.jp/wg/mgp/
 (snapshot version ftp://sh.wide.ad.jp/WIDE/free-ware/mgp-snap/)
 
 Copyright:
diff --git a/livepatch.mgp b/livepatch.mgp
new file mode 100644 (file)
index 0000000..d91e0aa
--- /dev/null
@@ -0,0 +1,237 @@
+%deffont "standard"   xfont "serif"
+%deffont "thick"      xfont "sans-serif"
+%deffont "typewriter" xfont "monospace"
+%deffont "roman" xfont "Times New Roman"
+%tab 0 size 4
+%tab 1 size 4, vgap 40, prefix "  ", icon box "green" 50
+%tab 2 size 3, vgap 40, prefix "      ", icon arc "yellow" 50
+%tab 3 size 3, vgap 40, prefix "            ", icon delta3 "white" 40
+%tab 4 size 2, vgap 40, prefix "            ", icon delta3 "white" 40
+%default 1 fore "blue", back "white", font "thick", size 4, right
+%default 2 left, size 7, vgap 10, prefix " "
+%default 3 size 2, bar "gray70", vgap 10
+%default 4 size 4, fore "black", vgap 30, prefix " ", font "standard"
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+%page
+%nodefault
+%fore "black", size 8, back "gray100", font "thick", vgap 0, ccolor "gray"
+
+
+
+
+%center, size 5, fore "blue"
+CGL3.0\e$B$N<B8=$H$O4X78$J$$\e(B(?)
+%size 8
+LivePatch\e$B5!G=$N<BAu\e(B
+%bar "blue", vgap 10
+
+
+
+
+
+
+
+
+
+%size 5, font "standard"
+%center
+%size 4, fore "black"
+Lightning Talk, Linux Conference 2005, June 2005
+%size 4, fore "black", font "standard"
+Fumitoshi UKAI / \e$B1-;t\e(B \e$BJ8IR\e(B
+%size 3
+ukai@linux.or.jp / ukai@debian.org / ukai@debian.or.jp / ukai@fsij.org
+
+%%% 6/3 5min?
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+%page
+livepatch
+\e$B35MW\e(B
+
+OSDL\e$B$K$*$$$F!"\e(BCGL\e$B;EMM\e(B3.0\e$B$,8!F$$5$l$F$$$k!#$=$N;EMM$K=q$+$l$F$$$k\e(B
+\e$BMW5a$N0l$D$K!"\e(BLive-Patch\e$B5!G=\e(B(\e$B%W%m%;%9$r:F5/F0$9$k$3$H$J$/!"=$@5$d5!G=DI2C$r9T$&5!G=\e(B)\e$B$,$"$k!#$3$N5!G=$O!"DL?.6H3&$G$O0lHL$KI,MW$H$5$l$k$b$N$G$"$k$i$7$$!#\e(B
+
+\e$B:#2s$N%W%l%<%s%F!<%7%g%s$G$O!"\e(BLive-Patch\e$B5!G=$N35MW!"F0:n86M}$K$D$$$F@bL@$9$k!#\e(B
+
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+%page
+livepatch
+\e$B%"%8%'%s%@\e(B
+
+       CGL\e$B;EMM\e(B3.0\e$BHG$H\e(BLive-Patch\e$B5!G=\e(B
+       \e$B<BAuNc\e(B
+               Pannus
+               livepatch
+       \e$B$^$H$a\e(B
+
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+%page
+livepatch
+CGL\e$B;EMM\e(B
+
+CGL(Carrier Grade Linux)
+               \e$B9b2DMQ@-$G7xO4$J!"DL?.;v6H<T$N4p447O%7%9%F%`$N4pHW$H$J$j$&$k\e(BLinux
+               OSDL\e$B$N\e(BCGL\e$B%o!<%/%0%k!<%W\e(B(2002\e$BG/@_N)\e(B)\e$B$K$h$j;EMM:vDj\e(B
+CGL\e$B$NNr;K\e(B
+               \e$B>JN,\e(B
+CGL\e$B;EMM:vDj\e(B
+               \e$B%f!<%6MW5a$r$H$j$^$H$a\e(B
+               \e$B5;=QE*4QE@$+$iI>2A\e(B
+               \e$B%f!<%6MW5a$KBP$7!"%=%j%e!<%7%g%s\e(B(OSS\e$B%W%m%8%'%/%H$NB8:_\e(B)\e$B$,I,?\\e(B
+
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+%page
+livepatch
+CGL\e$B;EMM\e(B3.0\e$BHG$H\e(BLive-Patch\e$B5!G=\e(B
+
+Live-Patch\e$B5!G=$N35MW\e(B
+       CGL\e$B;EMM\e(B3.0\e$B$r8!F$Cf$K!"DL?.;v6H<T$+$iDs=P$5$l$?MW5a9`L\$N$R$H$D\e(B
+               \e$BDL?.4pHW%7%9%F%`\e(B(\e$B8r495!Ey\e(B)\e$B$G$O!"\e(B99.999%\e$B5i$N?.Mj@-$,5a$a$i$l!"%5!<%S%9$rDd;_$G$-$J$$\e(B
+               \e$BIQHK$K%5!<%S%9DI2C!&JQ99$J$I$N%7%9%F%`JQ99$r9T$&I,MW$,$"$k\e(B
+       \e$B%W%m%;%9$rDd;_$;$:!"%"%W%j%1!<%7%g%s$K%Q%C%A$rE,MQ$9$k5!G=\e(B
+               \e$B%5!<%S%9%W%m%;%9$N:F5/F0$rI,MW$H$7$J$$5!G=\e(B
+               \e$BDL>o$N%Q%C%A$G$O!"=$@5%P%$%J%j$r$D$+$C$F%W%m%;%9$r:F5/F0$9$kI,MW$,$"$k\e(B
+                       \e$B%W%m%;%9$N:F5/F0$K$h$k%5!<%S%9Dd;_;~4V$,LdBj;k\e(B
+       CGL\e$B;EMM\e(B3.0\e$B$N\e(B AVL14.0 V2.0 "Live Patching"
+               OSDL CGL specifies that carrier grade linux shall provide the mechanism for a running application's functions to be replaced dynamically (without restarting)
+
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+%page
+livepatch
+Live-Patch\e$B5!G=$N<BAuNc\e(B: Pannus
+
+2004\e$BG/\e(B5\e$B7n$K!"\e(BNTT\e$B%0%k!<%W$K$h$j@_N)$5$l$?\e(BOSS\e$B%W%m%8%'%/%H\e(B
+http://pannus.sourceforge.net/
+
+       kernel patch
+               mmap3(2)
+                       \e$BG$0U$N%W%m%;%9$N%"%I%l%96u4V$K%m!<%I$,=PMh$k%7%9%F%`%3!<%k\e(B
+       tool
+               relocation, dynamic binding
+
+
+%font "roman", size 4, fore "grey40"
+Maintain your own patches; if that seems too hard, do the right thing.
+by Pavel, on linux-kernel mailing-list.
+
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+%page
+livepatch
+Live-Patch\e$B5!G=$N<BAuNc\e(B: livepatch
+
+2004\e$BG/\e(B11\e$B7n\e(B3\e$BF|$K<BAu$7$?\e(Btoy program
+       \e$B$-$C$+$1\e(B: 11\e$B7n\e(B1\e$BF|$K\e(BIRC\e$B>e$K$G$?OC\e(B
+                       19:45 g> \e$B$H$$$&$h$j$3$NA0$N%+!<%M%k%+%s%U%!%l%s%9\e(B
+                       19:45 g> \e$B$"$l$rH/I=$7$?%3%`%&%'%"$O\e(B \e$BM&<T$@$H$^$8$G$*$b$C$?\e(B
+                       19:45 K> \e$B$@$h$M$'\e(B
+                       19:46 g> \e$B$$$d$3$&\e(B \e$B5;=QE*$K$b$&$d$j$?$$J|Bj\e(B?
+                       19:47 g> \e$B$"$j$($M$(\e(B \e$B$H$$$&$3$H$r$d$C$F$?\e(B
+                       19:50 g> \e$B$"$l$r$d$l$H$$$o$l$?$i\e(B \e$B1L$l$OF(K4$9$k$J\e(B
+                       19:51 g> developer.osdl.jp/projects/pannus/ \e$B$3$l$G$9$h\e(B
+                       19:51 ukai> \e$B$`\e(B live patching
+                       19:52 g> \e$B$^$"%+!<%M%k$,2?$+$o$+$C$F$J$$$H\e(B \e$B$@$^$5$l$k9V1i$+$7$i\e(B
+                       20:18 ukai> \e$B$&!<$s\e(B \e$B$h$/$o$+$i$s$J\e(B
+                       20:18 ukai> ptrace\e$B$G$,$s$P$k$N$8$c$@$a$J$s$G$9$+\e(B? > pannus
+                       20:23 ukai> ptrace\e$B7PM3$G\e(B memory\e$B$r3NJ]$H$+$O$`$:$+$7$$$+$J\e(B
+
+%font "roman", size 4, fore "grey40"
+Your full patch is just a funky ptrace equivalent as far as I can see.
+-- by Andi, on linux-kernel mailing-list.
+
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+%page
+livepatch
+Live-Patch\e$B5!G=$N<BAuNc\e(B: livepatch
+
+       \e$B$=$NMbF|\e(B 11\e$B7n\e(B2\e$BF|\e(B
+                       18:32 ukai> Pannus \e$BAjEv$N$O\e(Bkernel patch\e$B$J$7$N$,0l=54V$/$i$$$G$G$-$k$s$8$c$J$$$+\e(B \e$B$H$$$&$3$H$,$o$+$C$F$-$?\e(B
+                       19:24 ukai> \e$B$"$H$O\e(B reloc\e$B$r$d$l$P$$$$$N$+$J\e(B
+                       19:26 K> \e$B$^$@%"%l%2%3!<%I$N@$3&$rC5K,$7$F$k$9$+\e(B
+                       19:26 ukai> \e$B$$$d:F<BAu$G$9$h\e(B(\e$B$o$i\e(B
+                       19:27 K> \e$B$=$l$O$*$b$7$m$$$J\e(B
+                       19:27 ukai> \e$B$H$&$$$&$+\e(B \e$BF(Hr$7$9$.$@\e(B
+                       19:27 ukai> kernel patch\e$B$J$7$G:F<BAu\e(B
+                       19:27 ukai> \e$B$^$!$[$\$G$-$=$&$@\e(B
+                       19:28 k> ptrace \e$B$G\e(Bgo \e$B$9$+\e(B
+                       19:28 ukai> \e$B$b$A$m$s\e(B \e$B$=$&$G$7$g$&\e(B
+                       19:28 ukai> \e$B%-%b$O$`$j$d$j\e(Btarget\e$B$G\e(B mmap\e$B$7$F\e(Bmemory\e$B3NJ]$@$M\e(B(\e$B$o$i\e(B
+                       19:28 k> \e$B$d$j$9$.$k$H$3$l$G?)$C$F$k%R%H$K;I$5$l$k$9$h\e(B
+                       19:29 ukai> \e$B$^$!\e(B ptrace\e$B$"$=$S$K$A$g$&$I$$$$Bj:`$G$"$C$?\e(B
+                       19:31 g> \e$B$^$"\e(B ptrace \e$B$N%3%9%H$O$+$+$k$J\e(B
+                       19:32 ukai> \e$B$3$s$J\e(Bpatch\e$B$9$k$H$3$m$K$9$4$$8zN($b$H$a$F$b$7$+$?$J$$$h$&$J\e(B(\e$B$o$i\e(B
+
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+%page
+livepatch
+Live-Patch\e$B5!G=$N<BAuNc\e(B: livepatch
+
+       \e$B$=$NMbF|\e(B 11\e$B7n\e(B3\e$BF|\e(B
+                       06:06 ukai> \e$B$*\e(B
+                       06:06 ukai> \e$B$J$s$+$G$-$?$+$J\e(B
+                       07:45 ukai> \e$B$^$!$3$s$J$b$s$+$N$&\e(B
+                       (\e$B?gL2\e(B)
+                       17:13 ukai> livepatch \e$B$O$I$&$9$C$+$J\e(B
+                       20:24 ukai> \e$B$U!<$`\e(B
+                       20:24 ukai> \e$B$"$H\e(Bdocument\e$B$+$$$F\e(B \e$B$=$m$=$m$d$a$K$9$k$+$J\e(B
+                       20:25 ukai> 852\e$B9T$+\e(B
+                       20:26 K> \e$B$`\e(B \e$B%&%+%$%i%$%V%Q%C%A%j%j!<%9$+\e(B
+                       20:28 ukai> 1\e$BF|%O%C%/$G$7$?$J\e(B
+                       21:34 ukai> \e$B$3$s$J$b$s$+$N$&\e(B
+                       21:37 ukai> http://ukai.jp/Software/livepatch/
+
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+%page
+livepatch
+Live-Patch\e$B5!G=$N<BAuNc\e(B: livepatch
+
+livepatch\e$B$N%]%$%s%H\e(B
+       target process\e$B$N%a%b%jFI$_=q$-$O\e(Bptrace(2)
+       target process\e$B$G$N%a%b%j3NJ]\e(B
+               mmap call\e$B$r$9$k%3!<%I$r\e(Bptrace(2)\e$B$G$*$/$j$3$_<B9T\e(B
+                       \e$B0z?t$r\e(Bstack\e$B$K$D$s$G\e(Bint $0x80
+       bfd\e$B$r$D$+$C$F\e(BELF section\e$B$N$H$j$@$7!"\e(Bsymbol\e$B>pJs$N<hF@\e(B
+       ptrace(2)\e$B$G\e(B ELF section\e$B$N$*$/$j$3$_\e(B
+               ptrace(2)\e$B$G$O\e(B4 byte\e$BC10L$J$N$G$3$3$,CY$$$H$$$($PCY$$\e(B
+       symbol\e$B$N\e(Bdynamic binding
+
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+%page
+livepatch
+\e$B$^$H$a\e(B
+
+       ptrace(2)\e$B$H\e(B bfd, elf\e$B$^$o$j$r$A$g$C$H3X=,$7$?\e(B
+               bfd\e$B$N%I%-%e%a%s%H$,$o$+$j$K$/$9$.$k$s$G$9$,!D\e(B
+               info\e$B$@$1$G$O$o$+$j$K$/$F!"%=!<%9$r$_$F$d$C$H$o$+$C$?$j\e(B
+               dynamic link\e$B$K$D$$$F$NM}2r$r$U$+$a$k$3$H$,$G$-$?\e(B
+       ptrace(2)\e$B$G$O$*$=$$\e(B?
+               so library\e$B$r\e(Bptrace(2)\e$B$G\e(B target process\e$B>e$G\e(Bmmap(2)
+               ptrace(2)\e$B$G\e(B page\e$BC10L$N\e(Bread/write\e$B$H$$$&3HD%\e(B?
+       livepatch\e$B$O4m81\e(B
+               \e$B$X$s$J%P%$%J%j%Q%C%A$r$"$F$h$&$H$9$k$H\e(Btarget process\e$B$,B(;`$9$k\e(B
+       HA\e$B$,MW5a$5$l$k%5!<%S%9$r<B9T$9$k%W%m%0%i%`$O$=$&$$$&;EAH$r$b$C$?$[$&$,$h$$\e(B
+               shmem\e$B$K$h$k>uBV$N6&M-\e(B
+               fd passing\e$B$K$h$k\e(BTCP connection\e$B$N$&$1$o$?$7\e(B
+
+%font "roman", size 4, fore "grey40"
+solving a real-world problem is much more interesting to listen to that filling in a check-box on a (somewhat dubious) specification 
+-- by Chris, on linux-kernel mailing-list.
+
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+%page
+livepatch
+Happy Hacking!
+
+%font "roman", size 4, fore "grey40"
+The kernel is not about business, demand, or what the CEO of some big-name company wants.  The kernel strives for the goal of 
+%cont, font "thick"
+"Good Engineering (TM)."
+
+%font "roman"
+But you miss the point.  Linux is *NOT* about "business", or "enterprise", or "mission-critical".  Linux is (at least to many hackers) about hacking, having fun, and 
+%cont, font "thick"
+Good Design(TM).
+
+%font "roman"
+by Kyle, on linux-kernel mailing-list.
+
+
diff --git a/m17n.c b/m17n.c
index 106ac7d..cc69f5d 100644 (file)
--- a/m17n.c
+++ b/m17n.c
@@ -67,6 +67,7 @@ static MText *space;
 
 static MSymbol Miso8859_1, Municode_bmp, Mjisx0208, Mgb2312, Mksc5601;
 static MSymbol Mlatin, Mhan, Mhangul, Mkatakana, Mhiragana;
+static MSymbol Mzh, Mja, Mko;
 
 static int kinsoku_range [][2] = {
   {0x3041, 0x30FF},            /* Kana */
@@ -148,6 +149,27 @@ M17N__gen_mtext (p)
                /* Try ISO-2022 encoding.  */
                coding = mconv_resolve_coding (msymbol ("iso-2022-7bit"));
                if (coding) mt = mconv_decode_buffer (coding, p, len);
+               if (mt)
+                 {
+                   int len = mtext_len (mt);
+                   int pos = 0, to;
+
+                   for (pos = 0; pos < len; pos = to)
+                     if (mtext_prop_range (mt, Mcharset, pos, NULL, &to, 0))
+                       {
+                         MSymbol cs = mtext_get_prop (mt, pos, Mcharset);
+                         char *name = msymbol_name (cs);
+                         MSymbol lang
+                           = (strncmp (name, "jis", 3) == 0 ? Mja
+                              : strncmp (name, "gb", 2) == 0 ? Mzh
+                              : strncmp (name, "ksc", 3) == 0 ? Mko
+                              : Mnil);
+
+                         if (lang != Mnil)
+                           mtext_put_prop (mt, pos, to, Mlanguage, lang);
+                       }
+                 }
+
        }
        if (!mt)
          {
@@ -181,7 +203,7 @@ M17N__gen_mtext (p)
 /* Return a font matching SEED and REGISTRY.  If no such font is found
    and RECORD is nonzero, create a new font and remember it.  */
 
-MFont *
+static MFont *
 M17N__get_font (seed, registry, record)
      char *seed;
      char *registry;
@@ -210,7 +232,7 @@ M17N__get_font (seed, registry, record)
     sym_registry = msymbol (registry);
 
   for (plist = mplist_find_by_key (font_list, sym_seed); plist;
-       plist = mplist_find_by_key (plist, sym_seed))
+       plist = mplist_find_by_key (mplist_next (plist), sym_seed))
     {
       font = mplist_value (plist);
       if (mfont_get_prop (font, Mregistry) == sym_registry)
@@ -296,6 +318,7 @@ M17N__define_font (cp)
   MSymbol family, registry;
   MPlist *plist, *pl;
   MFont *font, *recorded;
+  static MPlist *registered_list;
   
   for (; cp && cp->ct_op != CTL_XFONT2; cp = cp->ct_next);
   if (! cp)
@@ -304,6 +327,20 @@ M17N__define_font (cp)
   recorded = M17N__get_font (cp->ctc2_value1, cp->ctc2_value2, 1);
   family = mfont_get_prop (recorded, Mfamily);
   registry = mfont_get_prop (recorded, Mregistry);
+
+  plist = NULL;
+  if (! registered_list)
+    registered_list = mplist ();
+  else if ((plist = mplist_get (registered_list, family))
+          && (pl = mplist_get (plist, registry)))
+    return;
+
+  /* This font is not yet registered.  */
+  if (! plist)
+    plist = mplist ();
+  mplist_push (plist, registry, Mt);
+  mplist_push (registered_list, family, plist);
+
   if (registry == Miso8859_1)
     {
       /* This may be a TTF, in which case, we may be able to use it
@@ -313,7 +350,13 @@ M17N__define_font (cp)
   else
     {
       plist = mplist ();
-      if (registry == Mjisx0208 || registry == Mgb2312)
+      if (registry == Mjisx0208)
+       {
+         mplist_put (plist, Mhan, NULL);
+         mplist_put (plist, Mhiragana, NULL);
+         mplist_put (plist, Mkatakana, NULL);
+       }
+      else if (registry == Mgb2312)
        mplist_put (plist, Mhan, NULL);
       else if (registry == Mksc5601)
        mplist_put (plist, Mhangul, NULL);
@@ -333,25 +376,28 @@ M17N__define_font (cp)
          MSymbol lang = mplist_key (p0);
 
          mfont_put_prop (font, Mregistry, registry);
-         mfontset_modify_entry (fontset, script, lang, Mnil, font, Mnil, -1);
          if (registry == Miso8859_1)
            {
+             /* Add this font only for Latin script, and add
+                unicode version of this font for any scripts.  */
+             if (script == Mlatin)
+               mfontset_modify_entry (fontset, script, lang, Mnil,
+                                      font, Mnil, 1);
              mfont_put_prop (font, Mregistry, Municode_bmp);
-             mfontset_modify_entry (fontset, script, lang, Mnil, font,
-                                    Mnil, -1);
            }
+         mfontset_modify_entry (fontset, script, lang, Mnil, font, Mnil, 1);
        }
       m17n_object_unref (p);
     }
   m17n_object_unref (plist);
 
-  mfont_put_prop (font, Mregistry, registry);
-  mfontset_modify_entry (fontset, Mnil, Mnil, Mnil, font, Mnil, -1);
+  mfontset_modify_entry (fontset, Mnil, Mnil, Mnil, font, Mnil, 1);
   if (registry == Miso8859_1)
     {
       mfont_put_prop (font, Mregistry, Municode_bmp);
-      mfontset_modify_entry (fontset, Mnil, Mnil, Mnil, font, Mnil, -1);
+      mfontset_modify_entry (fontset, Mnil, Mnil, Mnil, font, Mnil, 1);
     }
+  free (font);
 }
 
 \f
@@ -364,7 +410,8 @@ M17N_init()
        M17N_INIT();
 
        space = mtext_from_data (" ", 1, MTEXT_FORMAT_US_ASCII);
-       fontset = mfontset ("truetype");
+       // fontset = mfontset ("truetype");
+       fontset = mfontset ("default");
        memset (&control, 0, sizeof control);
        control.two_dimensional = 1;
        control.enable_bidi = 1;
@@ -395,6 +442,9 @@ M17N_init()
        Mhangul = msymbol ("hangul");
        Mkatakana = msymbol ("katakana");
        Mhiragana = msymbol ("hiragana");
+       Mzh = msymbol ("zh");
+       Mja = msymbol ("ja");
+       Mko = msymbol ("ko");
 
        for (i = 0; i < MAXFONTDEF; i++)
          if (fontdef_control[i])
@@ -620,4 +670,30 @@ M17N_process_direc(key, value)
   else if (key_sym == Mlanguage)
     languages[caching] = value ? msymbol (value) : Mnil;
 }
-#endif
+
+void
+M17N_write_text (txt, cp)
+     FILE *txt;
+     struct ctrl *cp;
+{
+  MText *mt;
+
+  if (! cp->ctc_value)
+    return;
+  if (cp->ct_flag == 0)
+    {
+      /* cp->ctc_value points a raw byte sequence.  */
+      mt = M17N__gen_mtext ((u_char *) cp->ctc_value);
+      cp->ctc_value = (char *) mt;
+      cp->ct_flag =1;
+    }
+  else
+    {
+      /* cp->ctc_valus points an M-text. */
+      mt = (MText *) cp->ctc_value;
+    }
+  if (mt)
+    mconv_encode_stream (Mcoding_utf_8, mt, txt);
+}
+
+#endif /* USE_M17N */
diff --git a/mgp.c b/mgp.c
index 1ad0ec8..f438e96 100644 (file)
--- a/mgp.c
+++ b/mgp.c
@@ -456,6 +456,11 @@ main(argc, argv)
 
        signal(SIGCHLD, waitkids);
 
+#ifdef USE_M17N
+       if (! (mgp_flag & FL_NOM17N))
+               /* initaiize M17N library */
+               M17N_init();
+#endif
        if (dumpdir)
                genhtml(start_page);
        else if (mgp_flag & FL_DEMO) {
@@ -628,6 +633,12 @@ genhtml(start_page)
                                        goto txtdone;
                                break;
                        case CTL_TEXT:
+#ifdef USE_M17N
+                               if (! (mgp_flag & FL_NOM17N)) {
+                                       M17N_write_text (txt, state.cp);
+                                       break;
+                               }
+#endif
                                fprintf(txt, "%s", state.cp->ctc_value);
                                break;
                        case CTL_LINEEND:
diff --git a/mgp.h b/mgp.h
index e2f8120..056efef 100644 (file)
--- a/mgp.h
+++ b/mgp.h
@@ -844,4 +844,6 @@ extern void M17N_set_color __P((u_long));
 extern void M17N_process_direc __P((char *, char *));
 extern void M17N_draw_string __P((struct render_state *, struct ctrl *cp));
 extern void M17N_draw_object __P((struct render_object *, Drawable, int, int));
+extern void M17N_write_text __P((FILE *, struct ctrl *));
+
 #endif
diff --git a/parse.c b/parse.c
index eb7699f..b1e613a 100644 (file)
--- a/parse.c
+++ b/parse.c
@@ -982,13 +982,13 @@ thirdpass()
        if (! (mgp_flag & FL_NOM17N)) {
                tmpstr[6] = ctlalloc1(CTL_M17N);
                tmpstr[6]->ctc2_value1 = strdup("fontset");
-               tmpstr[6]->ctc2_value2 = strdup("default");
+               tmpstr[6]->ctc2_value2 = NULL;
                tmpstr[7] = ctlalloc1(CTL_M17N);
                tmpstr[7]->ctc2_value1 = strdup("family");
-               tmpstr[7]->ctc2_value2 = strdup("default");
+               tmpstr[7]->ctc2_value2 = NULL;
                tmpstr[8] = ctlalloc1(CTL_M17N);
                tmpstr[8]->ctc2_value1 = strdup("language");
-               tmpstr[8]->ctc2_value2 = strdup("default");
+               tmpstr[8]->ctc2_value2 = NULL;
        } else
 #endif
        {
@@ -1099,6 +1099,7 @@ thirdpass()
                                case CTL_TMFONT: tmpstr[4] = cp; break;
 #endif
                                case CTL_XFONT2:
+                                       define_font (cp);
                                        if (strcmp(cp->ctc2_value2,
                                                        "iso8859-1") == 0) {
                                                tmpstr[2] = cp;
@@ -1921,7 +1922,7 @@ define_font(cp)
        int i;
 
        /* find duplicated def */
-       for (i = 0; i < MAXFONTDEF; i++) {
+       for (i = 0; cp->ct_op != CTL_XFONT2 && i < MAXFONTDEF; i++) {
                if (!fontdef_control[i])
                        continue;
                if (strcmp(fontdef_control[i]->ctc_value,
@@ -1957,8 +1958,10 @@ find_font(font)
        for (i = 0; i < MAXFONTDEF; i++) {
                if (!fontdef_control[i])
                        continue;
-               if (strcmp(fontdef_control[i]->ctc_value, font) == 0)
+               if (fontdef_control[i]->ct_op != CTL_XFONT2
+                   && strcmp(fontdef_control[i]->ctc_value, font) == 0) {
                        return fontdef_control[i];
+               }
        }
        return NULL;
 }
diff --git a/x11.c b/x11.c
index 40bb258..3147da1 100644 (file)
--- a/x11.c
+++ b/x11.c
@@ -350,10 +350,6 @@ init_win3()
                toggle_fullscreen();                    
        }
 
-#ifdef USE_M17N
-       /* initaiize M17N library */
-       M17N_init();
-#endif
 }
 
 void