/* mtext.c -- M-text module.
- Copyright (C) 2003, 2004, 2005
+ Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010
National Institute of Advanced Industrial Science and Technology (AIST)
Registration Number H15PRO112
@brief Dump an M-text.
The mdebug_dump_mtext () function prints the M-text $MT in a human
- readable way to the stderr. $INDENT specifies how many columns to
- indent the lines but the first one. If $FULLP is zero, this
+ readable way to the stderr or to what specified by the environment
+ variable MDEBUG_OUTPUT_FILE. $INDENT specifies how many columns
+ to indent the lines but the first one. If $FULLP is zero, this
function prints only a character code sequence. Otherwise, it
prints the internal byte sequence and text properties as well.
/***ja
@brief M-text ¤ò¥À¥ó¥×¤¹¤ë.
- ´Ø¿ô mdebug_dump_mtext () ¤Ï M-text $MT ¤ò stderr
- ¤Ë¿Í´Ö¤Ë²ÄÆɤʷÁ¤Ç°õºþ¤¹¤ë¡£ $INDENT ¤Ï£²¹ÔÌܰʹߤΥ¤¥ó¥Ç¥ó¥È¤ò»ØÄꤹ¤ë¡£
- $FULLP ¤¬ 0 ¤Ê¤é¤Ð¡¢Ê¸»ú¥³¡¼¥ÉÎó¤À¤±¤ò°õºþ¤¹¤ë¡£
- ¤½¤¦¤Ç¤Ê¤±¤ì¤Ð¡¢ÆâÉô¥Ð¥¤¥ÈÎó¤È¥Æ¥¥¹¥È¥×¥í¥Ñ¥Æ¥£¤â°õºþ¤¹¤ë¡£
+ ´Ø¿ô mdebug_dump_mtext () ¤Ï M-text $MT ¤òɸ½à¥¨¥é¡¼½ÐÎϤ⤷¤¯¤Ï´Ä
+ ¶ÊÑ¿ô MDEBUG_DUMP_FONT ¤Ç»ØÄꤵ¤ì¤¿¥Õ¥¡¥¤¥ë¤Ë¿Í´Ö¤Ë²ÄÆɤʷÁ¤Ç°õºþ
+ ¤¹¤ë¡£ $INDENT ¤Ï£²¹ÔÌܰʹߤΥ¤¥ó¥Ç¥ó¥È¤ò»ØÄꤹ¤ë¡£$FULLP ¤¬ 0 ¤Ê¤é
+ ¤Ð¡¢Ê¸»ú¥³¡¼¥ÉÎó¤À¤±¤ò°õºþ¤¹¤ë¡£¤½¤¦¤Ç¤Ê¤±¤ì¤Ð¡¢ÆâÉô¥Ð¥¤¥ÈÎó¤È¥Æ¥
+ ¥¹¥È¥×¥í¥Ñ¥Æ¥£¤â°õºþ¤¹¤ë¡£
@return
¤³¤Î´Ø¿ô¤Ï $MT ¤òÊÖ¤¹¡£ */
if (! fullp)
{
- fprintf (stderr, "\"");
+ fprintf (mdebug__output, "\"");
for (i = 0; i < mt->nchars; i++)
{
int c = mtext_ref_char (mt, i);
if (c == '"' || c == '\\')
- fprintf (stderr, "\\%c", c);
+ fprintf (mdebug__output, "\\%c", c);
else if ((c >= ' ' && c < 127) || c == '\n')
- fprintf (stderr, "%c", c);
+ fprintf (mdebug__output, "%c", c);
else
- fprintf (stderr, "\\x%02X", c);
+ fprintf (mdebug__output, "\\x%02X", c);
}
- fprintf (stderr, "\"");
+ fprintf (mdebug__output, "\"");
return mt;
}
- fprintf (stderr,
+ fprintf (mdebug__output,
"(mtext (size %d %d %d) (cache %d %d)",
mt->nchars, mt->nbytes, mt->allocated,
mt->cache_char_pos, mt->cache_byte_pos);
memset (prefix, 32, indent);
prefix[indent] = 0;
- fprintf (stderr, "\n%s (bytes \"", prefix);
+ fprintf (mdebug__output, "\n%s (bytes \"", prefix);
for (i = 0; i < mt->nbytes; i++)
- fprintf (stderr, "\\x%02x", mt->data[i]);
- fprintf (stderr, "\")\n");
- fprintf (stderr, "%s (chars \"", prefix);
+ fprintf (mdebug__output, "\\x%02x", mt->data[i]);
+ fprintf (mdebug__output, "\")\n");
+ fprintf (mdebug__output, "%s (chars \"", prefix);
p = mt->data;
for (i = 0; i < mt->nchars; i++)
{
int c = STRING_CHAR_AND_BYTES (p, len);
if (c == '"' || c == '\\')
- fprintf (stderr, "\\%c", c);
+ fprintf (mdebug__output, "\\%c", c);
else if (c >= ' ' && c < 127)
- fputc (c, stderr);
+ fputc (c, mdebug__output);
else
- fprintf (stderr, "\\x%X", c);
+ fprintf (mdebug__output, "\\x%X", c);
p += len;
}
- fprintf (stderr, "\")");
+ fprintf (mdebug__output, "\")");
if (mt->plist)
{
- fprintf (stderr, "\n%s ", prefix);
+ fprintf (mdebug__output, "\n%s ", prefix);
dump_textplist (mt->plist, indent + 1);
}
}
- fprintf (stderr, ")");
+ fprintf (mdebug__output, ")");
return mt;
}