X-Git-Url: http://git.chise.org/gitweb/?a=blobdiff_plain;f=src%2Fmtext.c;h=6da71709a649abae4f1190c035b3f2ccba48fece;hb=6dd098a655551afd765159165e4b29ec9f693cb2;hp=0439829da8da4fcbdceca9d31572dee86846d56b;hpb=460cab45886257c1c68e0bde79f0c9cf5646b59f;p=m17n%2Fm17n-lib.git diff --git a/src/mtext.c b/src/mtext.c index 0439829..6da7170 100644 --- a/src/mtext.c +++ b/src/mtext.c @@ -17,7 +17,7 @@ You should have received a copy of the GNU Lesser General Public License along with the m17n library; if not, write to the Free - Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 02111-1307, USA. */ /***en @@ -971,6 +971,7 @@ mtext__init () M17N_OBJECT_ADD_ARRAY (mtext_table, "M-text"); M_charbag = msymbol_as_managing_key (" charbag"); mtext_table.count = 0; + Mlanguage = msymbol ("language"); return 0; } @@ -1585,6 +1586,12 @@ const int MTEXT_FORMAT_UTF_32 = MTEXT_FORMAT_UTF_32LE; /*** @{ */ /*=*/ +/***en The symbol whose name is "language". */ +/***ja "language" ¤È¤¤¤¦Ì¾Á°¤ò»ý¤Ä¥·¥ó¥Ü¥ë. */ +MSymbol Mlanguage; + +/*=*/ + /***en @brief Allocate a new M-text. @@ -2016,7 +2023,7 @@ mtext_cat_char (MText *mt, int c) nunits = CHAR_UNITS (c, mt->format); if ((mt->nbytes + nunits + 1) * unit_bytes > mt->allocated) { - mt->allocated = (mt->nbytes + nunits + 1) * unit_bytes; + mt->allocated = (mt->nbytes + nunits * 16 + 1) * unit_bytes; MTABLE_REALLOC (mt->data, mt->allocated, MERROR_MTEXT); } @@ -3589,35 +3596,39 @@ mtext_uppercase (MText *mt) MText * mdebug_dump_mtext (MText *mt, int indent, int fullp) { - char *prefix = (char *) alloca (indent + 1); int i; - unsigned char *p; - - memset (prefix, 32, indent); - prefix[indent] = 0; - fprintf (stderr, - "(mtext (size %d %d %d) (cache %d %d)", - mt->nchars, mt->nbytes, mt->allocated, - mt->cache_char_pos, mt->cache_byte_pos); if (! fullp) { - fprintf (stderr, " \""); + fprintf (stderr, "\""); for (i = 0; i < mt->nchars; i++) { int c = mtext_ref_char (mt, i); if (c == '"' || c == '\\') fprintf (stderr, "\\%c", c); - else if (c >= ' ' && c < 127) + else if ((c >= ' ' && c < 127) || c == '\n') fprintf (stderr, "%c", c); else fprintf (stderr, "\\x%02X", c); } fprintf (stderr, "\""); + return mt; } - else if (mt->nchars > 0) + + fprintf (stderr, + "(mtext (size %d %d %d) (cache %d %d)", + mt->nchars, mt->nbytes, mt->allocated, + mt->cache_char_pos, mt->cache_byte_pos); + + if (mt->nchars > 0) { + char *prefix = (char *) alloca (indent + 1); + unsigned char *p; + + memset (prefix, 32, indent); + prefix[indent] = 0; + fprintf (stderr, "\n%s (bytes \"", prefix); for (i = 0; i < mt->nbytes; i++) fprintf (stderr, "\\x%02x", mt->data[i]);