/***ja
@addtogroup m17nConv
- @brief ¥³¡¼¥É·Ï¥ª¥Ö¥¸¥§¥¯¥È¤È¤½¤ì¤Ë´Ø¤¹¤ë API
+ @brief ¥³¡¼¥É·Ï¥ª¥Ö¥¸¥§¥¯¥È¤È¤½¤ì¤Ë´Ø¤¹¤ë API.
m17n ¥é¥¤¥Ö¥é¥ê¤Ï¡¢Éä¹æ²½Ê¸»ú½¸¹ç (coded character set; CCS) ¤Îʸ
»úÉä¹ç²½Êý¼° (character encoding scheme; CES) ¤ò @e ¥³¡¼¥É·Ï ¤È¸Æ
reseting a converter. */
int (*resetter) (MConverter *converter);
- int (*decoder) (unsigned char *str, int str_bytes, MText *mt,
+ int (*decoder) (const unsigned char *str, int str_bytes, MText *mt,
MConverter *converter);
int (*encoder) (MText *mt, int from, int to,
static int
finish_decoding (MText *mt, MConverter *converter, int nchars,
- unsigned char *source, unsigned char *src_end,
- unsigned char *src,
+ const unsigned char *source, const unsigned char *src_end,
+ const unsigned char *src,
int error)
{
MConverterStatus *internal = (MConverterStatus *) converter->internal_info;
{
unsigned char *dst = mt->data + mt->nbytes;
unsigned char *dst_end = mt->data + mt->allocated;
- unsigned char *src_stop = src_end;
+ const unsigned char *src_stop = src_end;
int c;
int last_nchars = nchars;
}
static int
-decode_coding_charset (unsigned char *source, int src_bytes, MText *mt,
+decode_coding_charset (const unsigned char *source, int src_bytes, MText *mt,
MConverter *converter)
{
MConverterStatus *internal = (MConverterStatus *) converter->internal_info;
MCodingSystem *coding = internal->coding;
- unsigned char *src = internal->carryover;
- unsigned char *src_stop = src + internal->carryover_bytes;
- unsigned char *src_end = source + src_bytes;
- unsigned char *src_base;
+ const unsigned char *src = internal->carryover;
+ const unsigned char *src_stop = src + internal->carryover_bytes;
+ const unsigned char *src_end = source + src_bytes;
+ const unsigned char *src_base;
unsigned char *dst = mt->data + mt->nbytes;
unsigned char *dst_end = mt->data + mt->allocated;
int nchars = 0;
static int
-decode_coding_utf_8 (unsigned char *source, int src_bytes, MText *mt,
+decode_coding_utf_8 (const unsigned char *source, int src_bytes, MText *mt,
MConverter *converter)
{
MConverterStatus *internal = (MConverterStatus *) converter->internal_info;
MCodingSystem *coding = internal->coding;
- unsigned char *src = internal->carryover;
- unsigned char *src_stop = src + internal->carryover_bytes;
- unsigned char *src_end = source + src_bytes;
- unsigned char *src_base;
+ const unsigned char *src = internal->carryover;
+ const unsigned char *src_stop = src + internal->carryover_bytes;
+ const unsigned char *src_end = source + src_bytes;
+ const unsigned char *src_base;
unsigned char *dst = mt->data + mt->nbytes;
unsigned char *dst_end = mt->data + mt->allocated;
int nchars = 0;
}
static int
-decode_coding_utf_16 (unsigned char *source, int src_bytes, MText *mt,
+decode_coding_utf_16 (const unsigned char *source, int src_bytes, MText *mt,
MConverter *converter)
{
MConverterStatus *internal = (MConverterStatus *) converter->internal_info;
- unsigned char *src = internal->carryover;
- unsigned char *src_stop = src + internal->carryover_bytes;
- unsigned char *src_end = source + src_bytes;
- unsigned char *src_base;
+ const unsigned char *src = internal->carryover;
+ const unsigned char *src_stop = src + internal->carryover_bytes;
+ const unsigned char *src_end = source + src_bytes;
+ const unsigned char *src_base;
unsigned char *dst = mt->data + mt->nbytes;
unsigned char *dst_end = mt->data + mt->allocated;
int nchars = 0;
static int
-decode_coding_utf_32 (unsigned char *source, int src_bytes, MText *mt,
+decode_coding_utf_32 (const unsigned char *source, int src_bytes, MText *mt,
MConverter *converter)
{
MConverterStatus *internal = (MConverterStatus *) converter->internal_info;
- unsigned char *src = internal->carryover;
- unsigned char *src_stop = src + internal->carryover_bytes;
- unsigned char *src_end = source + src_bytes;
- unsigned char *src_base;
+ const unsigned char *src = internal->carryover;
+ const unsigned char *src_stop = src + internal->carryover_bytes;
+ const unsigned char *src_end = source + src_bytes;
+ const unsigned char *src_base;
unsigned char *dst = mt->data + mt->nbytes;
unsigned char *dst_end = mt->data + mt->allocated;
int nchars = 0;
}
static int
-decode_coding_iso_2022 (unsigned char *source, int src_bytes, MText *mt,
+decode_coding_iso_2022 (const unsigned char *source, int src_bytes, MText *mt,
MConverter *converter)
{
MConverterStatus *internal = (MConverterStatus *) converter->internal_info;
MCodingSystem *coding = internal->coding;
- unsigned char *src = internal->carryover;
- unsigned char *src_stop = src + internal->carryover_bytes;
- unsigned char *src_end = source + src_bytes;
- unsigned char *src_base;
+ const unsigned char *src = internal->carryover;
+ const unsigned char *src_stop = src + internal->carryover_bytes;
+ const unsigned char *src_end = source + src_bytes;
+ const unsigned char *src_base;
unsigned char *dst = mt->data + mt->nbytes;
unsigned char *dst_end = mt->data + mt->allocated;
int nchars = 0;
MSymbol kana_sym = msymbol ("jisx0201-kana");
MCharset *kana = MCHARSET (kana_sym);
- if (! kanji_sym || ! kana_sym)
+ if (! kanji || ! kana)
return -1;
coding->ncharsets = 3;
coding->charsets[1] = kanji;
}
static int
-decode_coding_sjis (unsigned char *source, int src_bytes, MText *mt,
+decode_coding_sjis (const unsigned char *source, int src_bytes, MText *mt,
MConverter *converter)
{
MConverterStatus *internal = (MConverterStatus *) converter->internal_info;
MCodingSystem *coding = internal->coding;
- unsigned char *src = internal->carryover;
- unsigned char *src_stop = src + internal->carryover_bytes;
- unsigned char *src_end = source + src_bytes;
- unsigned char *src_base;
+ const unsigned char *src = internal->carryover;
+ const unsigned char *src_stop = src + internal->carryover_bytes;
+ const unsigned char *src_end = source + src_bytes;
+ const unsigned char *src_base;
unsigned char *dst = mt->data + mt->nbytes;
unsigned char *dst_end = mt->data + mt->allocated - MAX_UTF8_CHAR_BYTES;
int nchars = 0;
if (! coding)
{
- MPlist *param = mplist_get (coding_definition_list, name);
+ MPlist *plist, *pl;
+ MSymbol sym = msymbol__canonicalize (name);
- if (! param)
+ plist = mplist_find_by_key (coding_definition_list, sym);
+ if (! plist)
return NULL;
- param = mplist__from_plist (param);
- mconv_define_coding (MSYMBOL_NAME (name), param, NULL, NULL, NULL, NULL);
+ pl = MPLIST_PLIST (plist);
+ name = MPLIST_VAL (pl);
+ mconv_define_coding (MSYMBOL_NAME (name), MPLIST_NEXT (pl),
+ NULL, NULL, NULL, NULL);
coding = (MCodingSystem *) msymbol_get (name, Mcoding);
- M17N_OBJECT_UNREF (param);
+ plist = mplist_pop (plist);
+ M17N_OBJECT_UNREF (plist);
}
return coding;
}
}
void
-mconv__define_coding_from_charset (MSymbol sym)
-{
- MPlist *param = mplist (), *charsets = mplist ();
-
- mplist_set (charsets, Msymbol, sym);
- mplist_add (param, Mtype, Mcharset);
- mplist_add (param, Mcharsets, charsets);
- mconv_define_coding (msymbol_name (sym), param, NULL, NULL, NULL, NULL);
- M17N_OBJECT_UNREF (charsets);
- M17N_OBJECT_UNREF (param);
-}
-
-void
mconv__register_charset_coding (MSymbol sym)
{
- if (! mplist_find_by_key (coding_definition_list, sym))
+ MSymbol name = msymbol__canonicalize (sym);
+
+ if (! mplist_find_by_key (coding_definition_list, name))
{
MPlist *param = mplist (), *charsets = mplist ();
mplist_set (charsets, Msymbol, sym);
- mplist_add (param, Msymbol, Mtype);
- mplist_add (param, Msymbol, Mcharset);
- mplist_add (param, Msymbol, Mcharsets);
- mplist_add (param, Mplist, charsets);
- mplist_put (coding_definition_list, sym, param);
+ mplist_add (param, Msymbol, sym);
+ mplist_add (param, Mtype, Mcharset);
+ mplist_add (param, Mcharsets, charsets);
+ mplist_put (coding_definition_list, name, param);
M17N_OBJECT_UNREF (charsets);
}
}
MPLIST_DO (plist, def_list)
{
MPlist *pl;
- MSymbol name;
+ MSymbol name, canonicalized;
if (! MPLIST_PLIST_P (plist))
MERROR (MERROR_CHARSET, -1);
if (! MPLIST_SYMBOL_P (pl))
MERROR (MERROR_CHARSET, -1);
name = MPLIST_SYMBOL (pl);
- pl = MPLIST_NEXT (pl);
- definitions = mplist_add (definitions, name, pl);
- M17N_OBJECT_REF (pl);
+ canonicalized = msymbol__canonicalize (name);
+ pl = mplist__from_plist (MPLIST_NEXT (pl));
+ mplist_push (pl, Msymbol, name);
+ definitions = mplist_add (definitions, canonicalized, pl);
}
M17N_OBJECT_UNREF (def_list);
/*** @{ */
/*=*/
-/***en @name Variables: Symbols representing a coding system */
+/***en @name Variables: Symbols representing coding systems */
/***ja @name ÊÑ¿ô: ÄêµÁºÑ¤ß¥³¡¼¥É·Ï¤ò»ØÄꤹ¤ë¤¿¤á¤Î¥·¥ó¥Ü¥ë */
/*** @{ */
/*=*/
/***en
- @brief Symbol for the coding system US-ASCII
+ @brief Symbol for the coding system US-ASCII.
The symbol #Mcoding_us_ascii has name <tt>"us-ascii"</tt> and
represents a coding system for the CES US-ASCII. */
/***ja
- @brief US-ASCII ¥³¡¼¥É·Ï¤Î¥·¥ó¥Ü¥ë
+ @brief US-ASCII ¥³¡¼¥É·Ï¤Î¥·¥ó¥Ü¥ë.
¥·¥ó¥Ü¥ë #Mcoding_us_ascii ¤Ï <tt>"us-ascii"</tt> ¤È¤¤¤¦Ì¾Á°¤ò»ý¤Á¡¢
CES US-ASCII ÍѤΥ³¡¼¥É·Ï¤ò¼¨¤¹¡£
/*=*/
/***en
- @brief Symbol for the coding system ISO-8859-1
+ @brief Symbol for the coding system ISO-8859-1.
The symbol #Mcoding_iso_8859_1 has name <tt>"iso-8859-1"</tt> and
represents a coding system for the CES ISO-8859-1. */
/***ja
- @brief ISO-8859-1 ¥³¡¼¥É·Ï¤Î¥·¥ó¥Ü¥ë
+ @brief ISO-8859-1 ¥³¡¼¥É·Ï¤Î¥·¥ó¥Ü¥ë.
¥·¥ó¥Ü¥ë #Mcoding_iso_8859_1 ¤Ï <tt>"iso-8859-1"</tt> ¤È¤¤¤¦Ì¾Á°
¤ò»ý¤Á¡¢CES ISO-8859-1 ÍѤΥ³¡¼¥É·Ï¤ò¼¨¤¹¡£ */
/*=*/
/***en
- @brief Symbol for the coding system UTF-8
+ @brief Symbol for the coding system UTF-8.
The symbol #Mcoding_utf_8 has name <tt>"utf-8"</tt> and represents
a coding system for the CES UTF-8. */
/***ja
- @brief UTF-8 ¥³¡¼¥É·Ï¤Î¥·¥ó¥Ü¥ë
+ @brief UTF-8 ¥³¡¼¥É·Ï¤Î¥·¥ó¥Ü¥ë.
¥·¥ó¥Ü¥ë #Mcoding_utf_8 ¤Ï <tt>"utf-8"</tt> ¤È¤¤¤¦Ì¾Á°¤ò»ý¤Á¡¢CES
UTF-8 ÍѤΥ³¡¼¥É·Ï¤ò¼¨¤¹¡£
/*=*/
/***en
- @brief Symbol for the coding system UTF-8-FULL
+ @brief Symbol for the coding system UTF-8-FULL.
The symbol #Mcoding_utf_8_full has name <tt>"utf-8-full"</tt> and
represents a coding system that is a extension of UTF-8. This
supported by the m17n library. */
/***ja
- @brief UTF-8-FULL ¥³¡¼¥É·Ï¤Î¥·¥ó¥Ü¥ë
+ @brief UTF-8-FULL ¥³¡¼¥É·Ï¤Î¥·¥ó¥Ü¥ë.
¥·¥ó¥Ü¥ë #Mcoding_utf_8_full ¤Ï <tt>"utf-8-full"</tt> ¤È¤¤¤¦Ì¾Á°¤ò
»ý¤Á¡¢<tt>"UTF-8"</tt> ¤Î³ÈÄ¥¤Ç¤¢¤ë¥³¡¼¥É·Ï¤ò¼¨¤¹¡£¤³¤Î¥³¡¼¥É·Ï¤Ï
/*=*/
/***en
- @brief Symbol for the coding system UTF-16
+ @brief Symbol for the coding system UTF-16.
The symbol #Mcoding_utf_16 has name <tt>"utf-16"</tt> and
represents a coding system for the CES UTF-16 (RFC 2279). */
/***ja
- @brief UTF-16 ¥³¡¼¥É·Ï¤Î¥·¥ó¥Ü¥ë
+ @brief UTF-16 ¥³¡¼¥É·Ï¤Î¥·¥ó¥Ü¥ë.
¥·¥ó¥Ü¥ë #Mcoding_utf_16 ¤Ï <tt>"utf-16"</tt> ¤È¤¤¤¦Ì¾Á°¤ò»ý¤Á¡¢
CES UTF-16 (RFC 2279) ÍѤΥ³¡¼¥É·Ï¤ò¼¨¤¹¡£
/*=*/
/***en
- @brief Symbol for the coding system UTF-16BE
+ @brief Symbol for the coding system UTF-16BE.
The symbol #Mcoding_utf_16be has name <tt>"utf-16be"</tt> and
represents a coding system for the CES UTF-16BE (RFC 2279). */
/***ja
- @brief UTF-16BE ¥³¡¼¥É·Ï¤Î¥·¥ó¥Ü¥ë
+ @brief UTF-16BE ¥³¡¼¥É·Ï¤Î¥·¥ó¥Ü¥ë.
¥·¥ó¥Ü¥ë #Mcoding_utf_16be ¤Ï <tt>"utf-16be"</tt> ¤È¤¤¤¦Ì¾Á°¤ò»ý¤Á¡¢
CES UTF-16BE (RFC 2279) ÍѤΥ³¡¼¥É·Ï¤ò¼¨¤¹¡£ */
/*=*/
/***en
- @brief Symbol for the coding system UTF-16LE
+ @brief Symbol for the coding system UTF-16LE.
The symbol #Mcoding_utf_16le has name <tt>"utf-16le"</tt> and
represents a coding system for the CES UTF-16LE (RFC 2279). */
/***ja
- @brief UTF-16LE ¥³¡¼¥É·Ï¤Î¥·¥ó¥Ü¥ë
+ @brief UTF-16LE ¥³¡¼¥É·Ï¤Î¥·¥ó¥Ü¥ë.
¥·¥ó¥Ü¥ë #Mcoding_utf_16le ¤Ï <tt>"utf-16le"</tt> ¤È¤¤¤¦Ì¾Á°¤ò»ý¤Á¡¢
CES UTF-16LE (RFC 2279) ÍѤΥ³¡¼¥É·Ï¤ò¼¨¤¹¡£ */
/*=*/
/***en
- @brief Symbol for the coding system UTF-32
+ @brief Symbol for the coding system UTF-32.
The symbol #Mcoding_utf_32 has name <tt>"utf-32"</tt> and
represents a coding system for the CES UTF-32 (RFC 2279). */
/***ja
- @brief UTF-32 ¥³¡¼¥É·Ï¤Î¥·¥ó¥Ü¥ë
+ @brief UTF-32 ¥³¡¼¥É·Ï¤Î¥·¥ó¥Ü¥ë.
¥·¥ó¥Ü¥ë #Mcoding_utf_32 ¤Ï <tt>"utf-32"</tt> ¤È¤¤¤¦Ì¾Á°¤ò»ý¤Á¡¢
CES UTF-32 (RFC 2279) ÍѤΥ³¡¼¥É·Ï¤ò¼¨¤¹¡£ */
/*=*/
/***en
- @brief Symbol for the coding system UTF-32be
+ @brief Symbol for the coding system UTF-32BE.
The symbol #Mcoding_utf_32be has name <tt>"utf-32be"</tt> and
represents a coding system for the CES UTF-32BE (RFC 2279). */
/***ja
- @brief UTF-32be ¥³¡¼¥É·Ï¤Î¥·¥ó¥Ü¥ë
+ @brief UTF-32BE ¥³¡¼¥É·Ï¤Î¥·¥ó¥Ü¥ë.
¥·¥ó¥Ü¥ë #Mcoding_utf_32be ¤Ï <tt>"utf-32be"</tt> ¤È¤¤¤¦Ì¾Á°¤ò»ý¤Á¡¢
CES UTF-32BE (RFC 2279) ÍѤΥ³¡¼¥É·Ï¤ò¼¨¤¹¡£ */
/*=*/
/***en
- @brief Symbol for the coding system UTF-32LE
+ @brief Symbol for the coding system UTF-32LE.
The symbol #Mcoding_utf_32le has name <tt>"utf-32le"</tt> and
represents a coding system for the CES UTF-32LE (RFC 2279). */
/***ja
- @brief UTF-32LE ¥³¡¼¥É·Ï¤Î¥·¥ó¥Ü¥ë
+ @brief UTF-32LE ¥³¡¼¥É·Ï¤Î¥·¥ó¥Ü¥ë.
¥·¥ó¥Ü¥ë #Mcoding_utf_32le ¤Ï <tt>"utf-32le"</tt> ¤È¤¤¤¦Ì¾Á°¤ò»ý¤Á¡¢
CES UTF-32LE (RFC 2279) ÍѤΥ³¡¼¥É·Ï¤ò¼¨¤¹¡£ */
/*=*/
/***en
- @brief Symbol for the coding system SJIS
+ @brief Symbol for the coding system SJIS.
The symbol #Mcoding_sjis has name <tt>"sjis"</tt> and represents a coding
system for the CES Shift-JIS. */
/***ja
- @brief SJIS ¥³¡¼¥É·Ï¤Î¥·¥ó¥Ü¥ë
+ @brief SJIS ¥³¡¼¥É·Ï¤Î¥·¥ó¥Ü¥ë.
¥·¥ó¥Ü¥ë #Mcoding_sjis has ¤Ï <tt>"sjis"</tt> ¤È¤¤¤¦Ì¾Á°¤ò»ý¤Á¡¢
CES Shift-JISÍѤΥ³¡¼¥É·Ï¤ò¼¨¤¹¡£ */
/*=*/
/***en
- @name Variables: Symbols representing coding system type. */
+ @name Variables: Symbols representing coding system types. */
/***ja
@name ÊÑ¿ô¡§ ¥³¡¼¥É·Ï¤Î¥¿¥¤¥×¤ò¼¨¤¹¥·¥ó¥Ü¥ë. */
/*** @{ */
/*=*/
/***en
- Symbol that can be a value of the #Mflags parameter of a coding
+ Symbols that can be a value of the #Mflags parameter of a coding
system used in an argument to the mconv_define_coding () function
(which see). */
/***ja
used a value of #Mbom parameter of the function
mconv_define_coding () (which see). */
/***ja
- @brief "maybe"¤È¤¤¤¦Ì¾Á°¤ò»ý¤Ä¥·¥ó¥Ü¥ë
+ @brief "maybe"¤È¤¤¤¦Ì¾Á°¤ò»ý¤Ä¥·¥ó¥Ü¥ë.
ÊÑ¿ô #Mmaybe ¤Ï <tt>"maybe"</tt> ¤È¤¤¤¦Ì¾Á°¤ò»ý¤Ä¡£¤³¤ì¤Ï´Ø¿ô
mconv_define_coding () ¥Ñ¥é¥á¡¼¥¿ #Mbom ¤ÎÃͤȤ·¤ÆÍѤ¤¤é¤ì¤ë¡£(¾Ü
/*=*/
/***en
- @brief The symbol @c Mcoding
+ @brief The symbol @c Mcoding.
Any decoded M-text has a text property whose key is the predefined
symbol @c Mcoding. The name of @c Mcoding is
<tt>"coding"</tt>. */
/***ja
- @brief ¥·¥ó¥Ü¥ë @c Mcoding
+ @brief ¥·¥ó¥Ü¥ë @c Mcoding.
¥Ç¥³¡¼¥É¤µ¤ì¤¿ M-text ¤Ï¤¹¤Ù¤Æ¡¢¥¡¼¤¬ÄêµÁºÑ¤ß¥·¥ó¥Ü¥ë @c Mcoding
¤Ç¤¢¤ë¤è¤¦¤Ê¥Æ¥¥¹¥È¥×¥í¥Ñ¥Æ¥£¤ò»ý¤Ä¡£¥·¥ó¥Ü¥ë @c Mcoding ¤Ï
/*=*/
/***en
- @brief Define a coding system
+ @brief Define a coding system.
The mconv_define_coding () function defines a new coding system
and makes it accessive via a symbol whose name is $NAME. $PLIST
¥¿¥¤¥×¤¬ #Mcharset ¤Ê¤é¤Ð $EXTRA_INFO ¤Ï̵»ë¤µ¤ì¤ë¡£
- ¥¿¥¤¥×¤¬ #Mutf ¤Ê¤é¤Ð $EXTRA_INFO ¤Ï#MCodingInfoUTF ¤Ø¤Î¥Ý¥¤¥ó¥¿¤Ç
+ ¥¿¥¤¥×¤¬ #Mutf ¤Ê¤é¤Ð $EXTRA_INFO ¤Ï #MCodingInfoUTF ¤Ø¤Î¥Ý¥¤¥ó¥¿¤Ç
¤Ê¤¯¤Æ¤Ï¤Ê¤é¤Ê¤¤¡£
- ¥¿¥¤¥×¤¬ #Miso_2022¤Ê¤é¤Ð $EXTRA_INFO ¤Ï#MCodingInfoISO2022 ¤Ø¤Î¥Ý
+ ¥¿¥¤¥×¤¬ #Miso_2022¤Ê¤é¤Ð $EXTRA_INFO ¤Ï #MCodingInfoISO2022 ¤Ø¤Î¥Ý
¥¤¥ó¥¿¤Ç¤Ê¤¯¤Æ¤Ï¤Ê¤é¤Ê¤¤¡£
¥¿¥¤¥×¤¬ #Mnil ¤Ê¤é¤Ð¡¢°ú¿ô $RESETTER, $DECODER, $ENCODER ¤òÍ¿¤¨¤Ê
<li> #Miso_6429
- ¸½¾õ¤Ç¤ÏÍѤ¤¤é¤ì¤Æ¤¤¤Ê¤¤¡£
+ ¸½»þÅÀ¤Ç¤ÏÍѤ¤¤é¤ì¤Æ¤¤¤Ê¤¤¡£
<li> #Mrevision_number
<li> ¥¡¼¤¬ #Minvocation¤ÇÃͤ¬ plist ¤Î»þ
¥¿¥¤¥×¤¬ #Miso_2022 ¤Ê¤é¤Ð¡¢Ãͤϳƽ¸¹ç¤ò¤É¤Î¤è¤¦¤Ë¸Æ¤Ó½Ð¤¹¤«¤ò¼¨¤¹¡£
- plist ¤ÎŤµ¤Ï 1 ¤Ê¤¤¤· 2 ¤Ç¤¢¤ë¡£plist ¤Î¥¡¼¤Ï#Minteger¡¢ÃͤϽ¸
+ plist ¤ÎŤµ¤Ï 1 ¤Ê¤¤¤· 2 ¤Ç¤¢¤ë¡£plist ¤Î¥¡¼¤Ï #Minteger¡¢ÃͤϽ¸
¹ç¡Êgraphic register)¤ò¼¨¤¹¿ô»ú¤Ç¤Ê¤±¤ì¤Ð¤Ê¤é¤Ê¤¤¡£ºÇ½é¤ÎÍ×ÁǤÎÃÍ
¤¬¿Þ·Áʸ»ú½¸¹çº¸È¾Ì̤˸ƤӽФµ¤ì¤ë½¸¹ç¤Ç¤¢¤ë¡£ plist ¤ÎŤµ¤¬ 1 ¤Ê
¤é¤Ð¡¢±¦È¾Ì̤ˤϲ¿¤â¸Æ¤Ó½Ð¤µ¤ì¤Ê¤¤¡£¤½¤¦¤Ç¤±¤ì¤Ð¡¢£²¤Ä¤á¤ÎÍ×ÁǤÎÃÍ
<li> ¥¡¼¤¬ #Mlittle_endian ¤ÇÃͤ¬¥·¥ó¥Ü¥ë¤Î»þ
¥¿¥¤¥×¤¬ #Mutf ¤Ç¥³¡¼¥É¥æ¥Ë¥Ã¥È¤Î¥Ó¥Ã¥ÈŤ¬ 16 ¤« 32¤Ê¤é¤Ð¡¢Ãͤϥ¨
- ¥ó¥³¡¼¥É¤¬ little endian ¤«¤É¤¦¤«¤ò¼¨¤¹¡£Ãͤ¬¥Ç¥Õ¥©¥ë¥ÈÃͤÎ#Mnil
+ ¥ó¥³¡¼¥É¤¬ little endian ¤«¤É¤¦¤«¤ò¼¨¤¹¡£Ãͤ¬¥Ç¥Õ¥©¥ë¥ÈÃͤΠ#Mnil
¤Ê¤é¤Ð big endian ¤Ç¤¢¤ê¡¢¤½¤¦¤Ç¤Ê¤±¤ì¤Ð little endian ¤Ç¤¢¤ë¡£
</ul>
$DECODER ¤Ï¥Ð¥¤¥ÈÎó¤ò¤³¤Î¥³¡¼¥É·Ï¤Ë½¾¤Ã¤Æ¥Ç¥³¡¼¥É¤¹¤ë´Ø¿ô¤Ø¤Î¥Ý¥¤
¥ó¥¿¤Ç¤¢¤ë¡£¤³¤Î´Ø¿ô¤Ï°Ê²¼¤Î4°ú¿ô¤ò¤È¤ë¡£
- @li ¥Ð¥¤¥ÈÎó¤Ø¤Î¥Ý¥¤¥ó¥¿
+ @li ¥Ç¥³¡¼¥É¤¹¤ë¥Ð¥¤¥ÈÎó¤Ø¤Î¥Ý¥¤¥ó¥¿
@li ¥Ç¥³¡¼¥É¤¹¤Ù¤¥Ð¥¤¥È¿ô
@li ¥Ç¥³¡¼¥É·ë²Ì¤Îʸ»ú¤òÉղ乤ë M-text ¤Ø¤Î¥Ý¥¤¥ó¥¿
@li ¥³¥ó¥Ð¡¼¥¿¥ª¥Ö¥¸¥§¥¯¥È¤Ø¤Î¥Ý¥¤¥ó¥¿
$ENCODER ¤Ï M-text ¤ò¤³¤Î¥³¡¼¥É·Ï¤Ë½¾¤Ã¤Æ¥¨¥ó¥³¡¼¥É¤¹¤ë´Ø¿ô¤Ø¤Î¥Ý
¥¤¥ó¥¿¤Ç¤¢¤ë¡£¤³¤Î´Ø¿ô¤Ï°Ê²¼¤Î6°ú¿ô¤ò¤È¤ë¡£
- @li M-text ¤Ø¤Î¥Ý¥¤¥ó¥¿
+ @li ¥¨¥ó¥³¡¼¥É¤¹¤ëM-text ¤Ø¤Î¥Ý¥¤¥ó¥¿
@li M-text ¤Î¥¨¥ó¥³¡¼¥É³«»Ï°ÌÃÖ
@li M-text ¤Î¥¨¥ó¥³¡¼¥É½ªÎ»°ÌÃÖ
@li À¸À®¤·¤¿¥Ð¥¤¥È¤òÊÝ»ý¤¹¤ë¥á¥â¥êÎΰè¤Ø¤Î¥Ý¥¤¥ó¥¿
@c MERROR_CODING */
MSymbol
-mconv_define_coding (char *name, MPlist *plist,
+mconv_define_coding (const char *name, MPlist *plist,
int (*resetter) (MConverter *),
- int (*decoder) (unsigned char *, int, MText *,
+ int (*decoder) (const unsigned char *, int, MText *,
MConverter *),
int (*encoder) (MText *, int, int,
unsigned char *, int,
/***en
- @brief List symbols representing a coding system.
+ @brief List symbols representing coding systems.
The mconv_list_codings () function makes an array of symbols
representing a coding system, stores the pointer to the array in a
place pointed to by $SYMBOLS, and returns the length of the array. */
/***ja
- @brief ¥³¡¼¥É·Ï¤òɽ¤ï¤¹¥·¥ó¥Ü¥ë¤òÎóµó¤¹¤ë
+ @brief ¥³¡¼¥É·Ï¤òɽ¤ï¤¹¥·¥ó¥Ü¥ë¤òÎóµó¤¹¤ë.
´Ø¿ô mchar_list_codings () ¤Ï¡¢¥³¡¼¥É·Ï¤ò¼¨¤¹¥·¥ó¥Ü¥ë¤òʤ٤¿ÇÛÎó
¤òºî¤ê¡¢$SYMBOLS ¤Ç¥Ý¥¤¥ó¥È¤µ¤ì¤¿¾ì½ê¤Ë¤³¤ÎÇÛÎó¤Ø¤Î¥Ý¥¤¥ó¥¿¤òÃÖ¤¡¢
MTABLE_MALLOC ((*symbols), i, MERROR_CODING);
i = 0;
MPLIST_DO (plist, coding_definition_list)
- (*symbols)[i++] = MPLIST_KEY (plist);
+ {
+ MPlist *pl = MPLIST_VAL (plist);
+ (*symbols)[i++] = MPLIST_SYMBOL (pl);
+ }
for (j = 0; j < coding_list.used; j++)
if (! mplist_find_by_key (coding_definition_list,
coding_list.codings[j]->name))
@brief Create a code converter bound to a buffer.
The mconv_buffer_converter () function creates a pointer to a code
- converter for coding system $CODING. The code converter is bound
+ converter for coding system $NAME. The code converter is bound
to buffer area of $N bytes pointed to by $BUF. Subsequent
decodings and encodings are done to/from this buffer area.
- $CODING can be #Mnil. In this case, a coding system associated
+ $NAME can be #Mnil. In this case, a coding system associated
with the current locale (LC_CTYPE) is used.
@return
assigns an error code to the external variable #merror_code. */
/***ja
- @brief ¥Ð¥Ã¥Õ¥¡¤Ë·ë¤ÓÉÕ¤±¤é¤ì¤¿¥³¡¼¥É¥³¥ó¥Ð¡¼¥¿¤òºî¤ë
+ @brief ¥Ð¥Ã¥Õ¥¡¤Ë·ë¤ÓÉÕ¤±¤é¤ì¤¿¥³¡¼¥É¥³¥ó¥Ð¡¼¥¿¤òºî¤ë.
- ´Ø¿ô mconv_buffer_converter () ¤Ï¡¢¥³¡¼¥É·Ï $CODING ÍѤΥ³¡¼¥É¥³¥ó
+ ´Ø¿ô mconv_buffer_converter () ¤Ï¡¢¥³¡¼¥É·Ï $NAME ÍѤΥ³¡¼¥É¥³¥ó
¥Ð¡¼¥¿¤òºî¤ë¡£¤³¤Î¥³¡¼¥É¥³¥ó¥Ð¡¼¥¿¤Ï¡¢$BUF ¤Ç¼¨¤µ¤ì¤ëÂ礤µ $N ¥Ð
¥¤¥È¤Î¥Ð¥Ã¥Õ¥¡Îΰè¤Ë·ë¤ÓÉÕ¤±¤é¤ì¤ë¡£¤³¤ì°Ê¹ß¤Î¥Ç¥³¡¼¥É¤ª¤è¤Ó
¥¨¥ó¥³¡¼¥É¤Ï¡¢¤³¤Î¥Ð¥Ã¥Õ¥¡Îΰè¤ËÂФ·¤Æ¹Ô¤Ê¤ï¤ì¤ë¡£
- $CODING ¤Ï #Mnil ¤Ç¤¢¤Ã¤Æ¤â¤è¤¤¡£¤³¤Î¾ì¹ç¤Ï¸½ºß¤Î¥í¥±¡¼¥ë
+ $NAME ¤Ï #Mnil ¤Ç¤¢¤Ã¤Æ¤â¤è¤¤¡£¤³¤Î¾ì¹ç¤Ï¸½ºß¤Î¥í¥±¡¼¥ë
(LC_CTYPE) ¤Ë´ØÏ¢ÉÕ¤±¤é¤ì¤¿¥³¡¼¥É·Ï¤¬»È¤ï¤ì¤ë¡£
@return
/***en
@brief Create a code converter bound to a stream.
- The mconv_stream_converter () function create a pointer to a code
- converter for coding system $CODING. The code converter is bound
+ The mconv_stream_converter () function creates a pointer to a code
+ converter for coding system $NAME. The code converter is bound
to stream $FP. Subsequent decodings and encodings are done
to/from this stream.
- $CODING can be #Mnil. In this case, a coding system associated
+ $NAME can be #Mnil. In this case, a coding system associated
with the current locale (LC_CTYPE) is used.
@return If the operation was successful, mconv_stream_converter ()
returns the created code converter. Otherwise it returns @c NULL
- and assigns an error code to the external variable @c
- merror_code. */
+ and assigns an error code to the external variable
+ #merror_code. */
/***ja
- @brief ¥¹¥È¥ê¡¼¥à¤Ë·ë¤ÓÉÕ¤±¤é¤ì¤¿¥³¡¼¥É¥³¥ó¥Ð¡¼¥¿¤òºî¤ë
+ @brief ¥¹¥È¥ê¡¼¥à¤Ë·ë¤ÓÉÕ¤±¤é¤ì¤¿¥³¡¼¥É¥³¥ó¥Ð¡¼¥¿¤òºî¤ë.
- ´Ø¿ô mconv_stream_converter () ¤Ï¡¢¥³¡¼¥É·Ï $CODING ÍѤΥ³¡¼¥É¥³¥ó
+ ´Ø¿ô mconv_stream_converter () ¤Ï¡¢¥³¡¼¥É·Ï $NAME ÍѤΥ³¡¼¥É¥³¥ó
¥Ð¡¼¥¿¤òºî¤ë¡£¤³¤Î¥³¡¼¥É¥³¥ó¥Ð¡¼¥¿¤Ï¡¢¥¹¥È¥ê¡¼¥à $FP ¤Ë·ë¤ÓÉÕ¤±¤é
¤ì¤ë¡£¤³¤ì°Ê¹ß¤Î¥Ç¥³¡¼¥É¤ª¤è¤Ó¥¨¥ó¥³¡¼¥É¤Ï¡¢¤³¤Î¥¹¥È¥ê¡¼¥à¤ËÂФ·¤Æ
¹Ô¤Ê¤ï¤ì¤ë¡£
- $CODING ¤Ï #Mnil ¤Ç¤¢¤Ã¤Æ¤â¤è¤¤¡£¤³¤Î¾ì¹ç¤Ï¸½ºß¤Î¥í¥±¡¼¥ë
+ $NAME ¤Ï #Mnil ¤Ç¤¢¤Ã¤Æ¤â¤è¤¤¡£¤³¤Î¾ì¹ç¤Ï¸½ºß¤Î¥í¥±¡¼¥ë
(LC_CTYPE) ¤Ë´ØÏ¢ÉÕ¤±¤é¤ì¤¿¥³¡¼¥É·Ï¤¬»È¤ï¤ì¤ë¡£
@return
applied to $CONVERTER. Otherwise it returns 0. */
/***ja
- @brief ¥³¡¼¥É¥³¥ó¥Ð¡¼¥¿¤ò¥ê¥»¥Ã¥È¤¹¤ë
+ @brief ¥³¡¼¥É¥³¥ó¥Ð¡¼¥¿¤ò¥ê¥»¥Ã¥È¤¹¤ë.
´Ø¿ô mconv_reset_converter () ¤Ï¥³¡¼¥É¥³¥ó¥Ð¡¼¥¿ $CONVERTER ¤ò½é´ü
¾õÂÖ¤ËÌ᤹¡£
$CONVERTER. */
/***ja
- @brief ¥³¡¼¥É¥³¥ó¥Ð¡¼¥¿¤ò²òÊü¤¹¤ë
+ @brief ¥³¡¼¥É¥³¥ó¥Ð¡¼¥¿¤ò²òÊü¤¹¤ë.
´Ø¿ô mconv_free_converter () ¤Ï¥³¡¼¥É¥³¥ó¥Ð¡¼¥¿ $CONVERTER ¤ò²òÊü
¤¹¤ë¡£ */
This function always returns $CONVERTER. */
/***ja
- @brief ¥³¡¼¥É¥³¥ó¥Ð¡¼¥¿¤Ë¥Ð¥Ã¥Õ¥¡Îΰè¤ò·ë¤ÓÉÕ¤±¤ë
+ @brief ¥³¡¼¥É¥³¥ó¥Ð¡¼¥¿¤Ë¥Ð¥Ã¥Õ¥¡Îΰè¤ò·ë¤ÓÉÕ¤±¤ë.
´Ø¿ô mconv_rebind_buffer () ¤Ï¡¢$BUF ¤Ë¤è¤Ã¤Æ»Ø¤µ¤ì¤¿Â礤µ $N ¥Ð
¥¤¥È¤Î¥Ð¥Ã¥Õ¥¡Îΰè¤ò¥³¡¼¥É¥³¥ó¥Ð¡¼¥¿ $CONVERTER ¤Ë·ë¤ÓÉÕ¤±¤ë¡£¤³¤ì
This function always returns $CONVERTER. */
/***ja
- @brief ¥³¡¼¥É¥³¥ó¥Ð¡¼¥¿¤Ë¥¹¥È¥ê¡¼¥à¤ò·ë¤ÓÉÕ¤±¤ë
+ @brief ¥³¡¼¥É¥³¥ó¥Ð¡¼¥¿¤Ë¥¹¥È¥ê¡¼¥à¤ò·ë¤ÓÉÕ¤±¤ë.
´Ø¿ô mconv_rebind_stream () ¤Ï¡¢¥¹¥È¥ê¡¼¥à $FP ¤ò¥³¡¼¥É¥³¥ó¥Ð¡¼¥¿
$CONVERTER ¤Ë·ë¤ÓÉÕ¤±¤ë¡£¤³¤ì°Ê¹ß¤Î¥Ç¥³¡¼¥É¤ª¤è¤Ó¥¨¥ó¥³¡¼¥É¤Ï¡¢
The mconv_decode () function decodes a byte sequence and appends
the result at the end of M-text $MT. The source byte sequence is
- taken from currently bound the buffer area or the stream.
+ taken from either the buffer area or the stream that is currently
+ bound to $CONVERTER.
@return
If the operation was successful, mconv_decode () returns updated
the external variable #merror_code. */
/***ja
- @brief ¥Ð¥¤¥ÈÎó¤ò M-text ¤Ë¥Ç¥³¡¼¥É¤¹¤ë
+ @brief ¥Ð¥¤¥ÈÎó¤ò M-text ¤Ë¥Ç¥³¡¼¥É¤¹¤ë.
´Ø¿ô mconv_decode () ¤Ï¡¢¥Ð¥¤¥ÈÎó¤ò¥Ç¥³¡¼¥É¤·¤Æ¤½¤Î·ë²Ì¤ò M-text
- $MT ¤ÎËöÈø¤ËÄɲ乤롣¥Ç¥³¡¼¥É¸µ¤Î¥Ð¥¤¥ÈÎó¤Ï¡¢¸½ºß·ë¤ÓÉÕ¤±¤é¤ì¤Æ¤¤¤ë
- ¥Ð¥Ã¥Õ¥¡Îΰ褢¤ë¤¤¤Ï¥¹¥È¥ê¡¼¥à¤«¤é¼è¤é¤ì¤ë¡£
+ $MT ¤ÎËöÈø¤ËÄɲ乤롣¥Ç¥³¡¼¥É¸µ¤Î¥Ð¥¤¥ÈÎó¤Ï¡¢$CONVERTER ¤Ë¸½ºß·ë
+ ¤ÓÉÕ¤±¤é¤ì¤Æ¤¤¤ë¥Ð¥Ã¥Õ¥¡Îΰ褢¤ë¤¤¤Ï¥¹¥È¥ê¡¼¥à¤«¤é¼è¤é¤ì¤ë¡£
@return
¤â¤·½èÍý¤¬À®¸ù¤¹¤ì¤Ð¡¢mconv_decode () ¤Ï¹¹¿·¤µ¤ì¤¿ $MT ¤òÊÖ¤¹¡£¤½
M_CHECK_READONLY (mt, NULL);
+ if (mt->format != MTEXT_FORMAT_UTF_8)
+ mtext__adjust_format (mt, MTEXT_FORMAT_UTF_8);
+
if (! mt->data)
mtext__enlarge (mt, MAX_UTF8_CHAR_BYTES);
/***en
@brief Decode a buffer area based on a coding system.
- The mconv_decode_buffer () function decodes $N bytes of buffer
+ The mconv_decode_buffer () function decodes $N bytes of the buffer
area pointed to by $BUF based on the coding system $NAME. A
temporary code converter for decoding is automatically created
and freed.
assigns an error code to the external variable #merror_code. */
/***ja
- @brief ¥³¡¼¥É·Ï¤Ë´ð¤Å¤¤¤Æ¥Ð¥Ã¥Õ¥¡Îΰè¤ò¥Ç¥³¡¼¥É¤¹¤ë
+ @brief ¥³¡¼¥É·Ï¤Ë´ð¤Å¤¤¤Æ¥Ð¥Ã¥Õ¥¡Îΰè¤ò¥Ç¥³¡¼¥É¤¹¤ë.
´Ø¿ô mconv_decode_buffer () ¤Ï¡¢$BUF ¤Ë¤è¤Ã¤Æ»Ø¤µ¤ì¤¿ $N ¥Ð¥¤¥È¤Î
¥Ð¥Ã¥Õ¥¡Îΰè¤ò¡¢¥³¡¼¥É·Ï $NAME ¤Ë´ð¤Å¤¤¤Æ¥Ç¥³¡¼¥É¤¹¤ë¡£¥Ç¥³¡¼¥É¤Ë
error code to the external variable #merror_code. */
/***ja
- @brief ¥³¡¼¥É·Ï¤Ë´ð¤Å¤¤¤Æ¥¹¥È¥ê¡¼¥àÆþÎϤò¥Ç¥³¡¼¥É¤¹¤ë
+ @brief ¥³¡¼¥É·Ï¤Ë´ð¤Å¤¤¤Æ¥¹¥È¥ê¡¼¥àÆþÎϤò¥Ç¥³¡¼¥É¤¹¤ë.
´Ø¿ô mconv_decode_stream () ¤Ï¡¢¥¹¥È¥ê¡¼¥à $FP ¤«¤éÆɤ߹þ¤Þ¤ì¤ë¥Ð
¥¤¥ÈÎóÁ´ÂΤò¡¢¥³¡¼¥É·Ï $NAME ¤Ë´ð¤Å¤¤¤Æ¥Ç¥³¡¼¥É¤¹¤ë¡£¥Ç¥³¡¼¥É¤Ëɬ
error code to the external variable #merror_code. */
/***ja
- @brief M-text ¤ò¥Ð¥¤¥ÈÎó¤Ë¥¨¥ó¥³¡¼¥É¤¹¤ë
+ @brief M-text ¤ò¥Ð¥¤¥ÈÎó¤Ë¥¨¥ó¥³¡¼¥É¤¹¤ë.
´Ø¿ô mconv_encode () ¤Ï¡¢M-text $MT ¤ò¥¨¥ó¥³¡¼¥É¤·¤Æ¡¢¥³¡¼¥É¥³¥ó¥Ð¡¼
¥¿ $CONVERTER ¤Ë¸½ºß·ë¤ÓÉÕ¤±¤é¤ì¤Æ¤¤¤ë¥Ð¥Ã¥Õ¥¡Îΰ褢¤ë¤¤¤Ï¥¹¥È¥ê¡¼
- ¥à¤Ë½ñ¤¹þ¤à¡£
+ ¥à¤ËÆÀ¤é¤ì¤¿¥Ð¥¤¥ÈÎó¤ò½ñ¤¹þ¤à¡£
@return
¤â¤·½èÍý¤¬À®¸ù¤¹¤ì¤Ð¡¢mconv_encode () ¤Ï½ñ¤¹þ¤Þ¤ì¤¿¥Ð¥¤¥È¿ô¤òÊÖ¤¹¡£
/*=*/
/***en
- @brief Encode a part of an M-text
+ @brief Encode a part of an M-text.
The mconv_encode_range () function encodes the text between $FROM
(inclusive) and $TO (exclusive) in M-text $MT and writes the
error code to the external variable #merror_code. */
/***ja
- @brief M-text ¤Î°ìÉô¤ò¤ò¥Ð¥¤¥ÈÎó¤Ë¥¨¥ó¥³¡¼¥É¤¹¤ë
+ @brief M-text ¤Î°ìÉô¤ò¥Ð¥¤¥ÈÎó¤Ë¥¨¥ó¥³¡¼¥É¤¹¤ë.
´Ø¿ô mconv_encode_range () ¤Ï¡¢M-text $MT ¤Î $FROM ¡Ê´Þ¤à¡Ë¤«¤é
$TO ¡Ê´Þ¤Þ¤Ê¤¤¡Ë¤Þ¤Ç¤ÎÈϰϤΥƥ¥¹¥È¤ò¥¨¥ó¥³¡¼¥É¤·¤Æ¡¢¥³¡¼¥É¥³¥ó¥Ð¡¼
¥¿ $CONVERTER ¤Ë¸½ºß·ë¤ÓÉÕ¤±¤é¤ì¤Æ¤¤¤ë¥Ð¥Ã¥Õ¥¡Îΰ褢¤ë¤¤¤Ï¥¹¥È¥ê¡¼
- ¥à¤Ë½ñ¤¹þ¤à¡£
+ ¥à¤ËÆÀ¤é¤ì¤¿¥Ð¥¤¥ÈÎó¤ò½ñ¤¹þ¤à¡£
@return
¤â¤·½èÍý¤¬À®¸ù¤¹¤ì¤Ð¡¢mconv_encode_range () ¤Ï½ñ¤¹þ¤Þ¤ì¤¿¥Ð¥¤¥È¿ô
an error code to the external variable #merror_code. */
/***ja
- @brief M-text ¤ò¥¨¥ó¥³¡¼¥É¤·¤Æ¥Ð¥Ã¥Õ¥¡Îΰè¤Ë½ñ¤¹þ¤à
+ @brief M-text ¤ò¥¨¥ó¥³¡¼¥É¤·¤Æ¥Ð¥Ã¥Õ¥¡Îΰè¤Ë½ñ¤¹þ¤à.
´Ø¿ô mconv_encode_buffer () ¤ÏM-text $MT ¤ò¥³¡¼¥É·Ï $NAME ¤Ë´ð¤Å¤¤
¤Æ¥¨¥ó¥³¡¼¥É¤·¡¢ÆÀ¤é¤ì¤¿¥Ð¥¤¥ÈÎó¤ò $BUF ¤Î»Ø¤¹¥Ð¥Ã¥Õ¥¡Îΰè¤Ë½ñ¤¹þ
an error code to the external variable #merror_code. */
/***ja
- @brief M-text ¤ò¥¨¥ó¥³¡¼¥É¤·¤Æ¥¹¥È¥ê¡¼¥à¤Ë½ñ¤¹þ¤à
+ @brief M-text ¤ò¥¨¥ó¥³¡¼¥É¤·¤Æ¥¹¥È¥ê¡¼¥à¤Ë½ñ¤¹þ¤à.
´Ø¿ô mconv_encode_stream () ¤ÏM-text $MT ¤ò¥³¡¼¥É·Ï $NAME ¤Ë´ð¤Å¤¤
¤Æ¥¨¥ó¥³¡¼¥É¤·¡¢ÆÀ¤é¤ì¤¿¥Ð¥¤¥ÈÎó¤ò¥¹¥È¥ê¡¼¥à $FP ¤Ë½ñ¤½Ð¤¹¡£¥¨¥ó
#merror_code. */
/***ja
- @brief ¥³¡¼¥É¥³¥ó¥Ð¡¼¥¿·Ðͳ¤Ç1ʸ»úÆɤà
+ @brief ¥³¡¼¥É¥³¥ó¥Ð¡¼¥¿·Ðͳ¤Ç1ʸ»úÆɤà.
´Ø¿ô mconv_getc () ¤Ï¡¢¥³¡¼¥É¥³¥ó¥Ð¡¼¥¿ $CONVERTER ¤Ë¸½ºß·ë¤ÓÉÕ¤±
- ¤é¤ì¤Æ¤¤¤ë¥Ð¥Ã¥Õ¥¡Îΰ褢¤ë¤¤¤Ï¥¹¥È¥ê¡¼¥à¤«¤é1ʸ»ú¤òÆɤ߹þ¤à¡£¥Ð¥¤
- ¥ÈÎó¤Î¥Ç¥³¡¼¥É¤Ë¤Ï $CONVERTER ¤Î¥Ç¥³¡¼¥À¤¬ÍѤ¤¤é¤ì¤ë¡£$CONVERTER
+ ¤é¤ì¤Æ¤¤¤ë¥Ð¥Ã¥Õ¥¡Îΰ褢¤ë¤¤¤Ï¥¹¥È¥ê¡¼¥à¤«¤é 1 ʸ»ú¤òÆɤ߹þ¤à¡£¥Ð
+ ¥¤¥ÈÎó¤Î¥Ç¥³¡¼¥É¤Ë¤Ï $CONVERTER ¤Î¥Ç¥³¡¼¥À¤¬ÍѤ¤¤é¤ì¤ë¡£$CONVERTER
¤ÎÆâÉô¾õÂÖ¤ÏɬÍפ˱þ¤¸¤Æ¹¹¿·¤µ¤ì¤ë¡£
@return
external variable #merror_code. */
/***ja
- @brief ¥³¡¼¥É¥³¥ó¥Ð¡¼¥¿¤Ë1ʸ»úÌ᤹
+ @brief ¥³¡¼¥É¥³¥ó¥Ð¡¼¥¿¤Ë1ʸ»úÌ᤹.
´Ø¿ô mconv_ungetc () ¤Ï¡¢¥³¡¼¥É¥³¥ó¥Ð¡¼¥¿ $CONVERTER ¤Ëʸ»ú $C ¤ò
²¡¤·Ì᤹¡£Ì᤹ʸ»ú¿ô¤ËÀ©¸Â¤Ï¤Ê¤¤¡£¤³¤Î¸å¤Ë mconv_getc () ¤ò¸Æ¤Ó½Ð
an error code to the external variable #merror_code. */
/***ja
- @brief ¥³¡¼¥É¥³¥ó¥Ð¡¼¥¿¤ò·Ðͳ¤Ç1ʸ»ú½ñ¤¯
+ @brief ¥³¡¼¥É¥³¥ó¥Ð¡¼¥¿¤ò·Ðͳ¤·¤Æ1ʸ»ú½ñ¤¯.
´Ø¿ô mconv_putc () ¤Ï¡¢¥³¡¼¥É¥³¥ó¥Ð¡¼¥¿ $CONVERTER ¤Ë¸½ºß·ë¤ÓÉÕ¤±
¤é¤ì¤Æ¤¤¤ë¥Ð¥Ã¥Õ¥¡Îΰ褢¤ë¤¤¤Ï¥¹¥È¥ê¡¼¥à¤Ëʸ»ú $C ¤ò½ñ¤½Ð¤¹¡£Ê¸»ú
If the operation was successful, mconv_gets () returns the
modified $MT. If it encounters EOF without reading a single
character, it returns $MT without changing it. If an error is
- detected, it returns @c NULL and assigns an error code to @c
- merror_code. */
+ detected, it returns @c NULL and assigns an error code to
+ #merror_code. */
/***ja
- @brief ¥³¡¼¥É¥³¥ó¥Ð¡¼¥¿¤ò»È¤Ã¤Æ1¹ÔÆɤà
+ @brief ¥³¡¼¥É¥³¥ó¥Ð¡¼¥¿¤ò»È¤Ã¤Æ1¹ÔÆɤà.
´Ø¿ô mconv_gets () ¤Ï¡¢¥³¡¼¥É¥³¥ó¥Ð¡¼¥¿ $CONVERTER ¤Ë¸½ºß·ë¤ÓÉÕ¤±
- ¤é¤ì¤Æ¤¤¤ë¥Ð¥Ã¥Õ¥¡Îΰ褢¤ë¤¤¤Ï¥¹¥È¥ê¡¼¥à¤«¤é1¹Ô¤òÆɤ߹þ¤à¡£¥Ð¥¤¥È
- Îó¤Î¥Ç¥³¡¼¥É¤Ë¤Ï $CONVERTER ¤Î¥Ç¥³¡¼¥À¤¬ÍѤ¤¤é¤ì¤ë¡£¥Ç¥³¡¼¥É¤µ¤ì¤¿
- ʸ»úÎó¤Ï M-text $MT ¤ÎËöÈø¤ËÄɲ䵤ì¤ë¡£¸µ¤Î¥Ð¥¤¥ÈÎó¤Î½ªÃ¼²þ¹Ôʸ»ú
- ¤ÏÄɲ䵤ì¤Ê¤¤¡£$CONVERTER ¤ÎÆâÉô¾õÂÖ¤ÏɬÍפ˱þ¤¸¤Æ¹¹¿·¤µ¤ì¤ë¡£
+ ¤é¤ì¤Æ¤¤¤ë¥Ð¥Ã¥Õ¥¡Îΰ褢¤ë¤¤¤Ï¥¹¥È¥ê¡¼¥à¤«¤é 1 ¹Ô¤òÆɤ߹þ¤à¡£¥Ð¥¤
+ ¥ÈÎó¤Î¥Ç¥³¡¼¥É¤Ë¤Ï $CONVERTER ¤Î¥Ç¥³¡¼¥À¤¬ÍѤ¤¤é¤ì¤ë¡£¥Ç¥³¡¼¥É¤µ¤ì
+ ¤¿Ê¸»úÎó¤Ï M-text $MT ¤ÎËöÈø¤ËÄɲ䵤ì¤ë¡£¸µ¤Î¥Ð¥¤¥ÈÎó¤Î½ªÃ¼²þ¹Ôʸ
+ »ú¤ÏÄɲ䵤ì¤Ê¤¤¡£$CONVERTER ¤ÎÆâÉô¾õÂÖ¤ÏɬÍפ˱þ¤¸¤Æ¹¹¿·¤µ¤ì¤ë¡£
@return
½èÍý¤¬À®¸ù¤¹¤ì¤Ð¡¢mconv_gets () ¤ÏÊѹ¹¤µ¤ì¤¿ $MT ¤òÊÖ¤¹¡£¤â¤·1ʸ»ú
int c;
M_CHECK_READONLY (mt, NULL);
+ if (mt->format != MTEXT_FORMAT_UTF_8)
+ mtext__adjust_format (mt, MTEXT_FORMAT_UTF_8);
+
while (1)
{
c = mconv_getc (converter);
mtext_cat_char (mt, c);
}
if (c == EOF && converter->result != MCONVERSION_RESULT_SUCCESS)
- /* mconv_getc () sets merror_code */
+ /* mconv_getc () sets #merror_code */
return NULL;
return mt;
}