<html><head><meta name="color-scheme" content="light dark"></head><body><pre style="word-wrap: break-word; white-space: pre-wrap;">Index: ChangeLog
===================================================================
RCS file: /cvsroot/chasen/ChangeLog,v
retrieving revision 1.147
diff -u -r1.147 ChangeLog
--- ChangeLog	21 Aug 2003 01:14:44 -0000	1.147
+++ ChangeLog	22 Aug 2003 05:32:58 -0000
@@ -1,3 +1,7 @@
+2003-08-22  TAKAOKA Kazuma  &lt;kazuma-t@is.aist-nara.ac.jp&gt;
+
+	* lib/print.c (extract_yomi1): Fix bug.
+
 2003-08-21  TAKAOKA Kazuma  &lt;kazuma-t@is.aist-nara.ac.jp&gt;
 
 	* lib/tokenizer.c (cha_tok_parse): Fix for SPACE_POS.
Index: lib/print.c
===================================================================
RCS file: /cvsroot/chasen/lib/print.c,v
retrieving revision 1.53
diff -u -r1.53 print.c
--- lib/print.c	11 Aug 2003 05:53:36 -0000	1.53
+++ lib/print.c	22 Aug 2003 05:32:58 -0000
@@ -579,40 +579,35 @@
     path-&gt;start = start;
 }
 
-#define copy_mbstr(d,s) \
-do { int len = cha_tok_mblen(Cha_tokenizer, (s), 4 /* XXX */); \
-    while (len-- &amp;&amp; *(s)) { *(d)++ = *(s)++; } \
-    s--; /* XXX */\
-} while (0)
-
 static void
 extract_yomi1(char *dst, char *src)
 {
-    int in_brace = 0, is1st = 0;
-    char *s, *d;
+    char *d = dst;
+    char *s = src;
+    int state = 0;
 
-    if (strchr(src, '{') == NULL) {
-	if (dst != src)
-	    strcpy(dst, src);
-	return;
-    }
+    while (*s) {
+	int i;
+	int len = cha_tok_mblen(Cha_tokenizer, (s), 4 /* XXX */);
 
-    for (s = src, d = dst; *s; s++) {
-	if (!in_brace) {
-	    if (*s == '{')
-		in_brace = is1st = 1;
-	    else
-		copy_mbstr(d, s);
-	} else if (*s == '}')
-	    in_brace = 0;
-	else if (is1st) {
-	    if (*s == '/')
-		is1st = 0;
-	    else
-		copy_mbstr(d, s);
+	if (state == 0 &amp;&amp; len == 1 &amp;&amp; *s == '{') {
+	    state = 1;
+	    s += len;
+	    continue;
+	} else if (state == 1 &amp;&amp; len == 1 &amp;&amp; *s == '/') {
+	    state = 2;
+	    s += len;
+	    continue;
+	} else if (state == 2) {
+	    if (len == 1 &amp;&amp; *s == '}')
+		state = 0;
+	    s += len;
+	    continue;
 	}
-    }
 
+	for (i = 0; i &lt; len; i++)
+	    *d++ = *s++;
+    }
     *d = '\0';
 }
 
</pre></body></html>