}
void
-find_charsets_in_emchar_string (Charset_ID *charsets, const Emchar *str,
- Charcount len)
+find_charsets_in_charc_string (Charset_ID *charsets, const Charc *str,
+ Charcount len)
{
#ifndef MULE
/* Telescope this. */
/* #### SJT doesn't like this. */
if (len == 0)
{
- charsets[XCHARSET_LEADING_BYTE (Vcharset_ascii) - MIN_LEADING_BYTE] = 1;
+ charsets[XCHARSET_ID (Vcharset_ascii) - MIN_LEADING_BYTE] = 1;
return;
}
for (i = 0; i < len; i++)
{
-#ifdef UTF2000
- charsets[CHAR_CHARSET_ID (str[i]) - MIN_LEADING_BYTE] = 1;
-#else /* I'm not sure the definition for UTF2000 works with leading-byte
- representation. */
- charsets[CHAR_LEADING_BYTE (str[i]) - MIN_LEADING_BYTE] = 1;
-#endif
+ charsets[XCHARSET_ID (str[i].charset) - MIN_LEADING_BYTE] = 1;
}
#endif
}
}
int
-emchar_string_displayed_columns (const Emchar *str, Charcount len)
+charc_string_displayed_columns (const Charc *str, Charcount len)
{
#ifdef MULE
int cols = 0;
int i;
for (i = 0; i < len; i++)
- cols += CHAR_COLUMNS (str[i]);
+ cols += CHARSET_COLUMNS (XCHARSET (str[i].charset));
return cols;
#else /* not MULE */
/* NOTE: Does not reset the Dynarr. */
void
-convert_bufbyte_string_into_emchar_dynarr (const Bufbyte *str, Bytecount len,
- Emchar_dynarr *dyn)
+convert_bufbyte_string_into_charc_dynarr (const Bufbyte *str, Bytecount len,
+ Charc_dynarr *dyn)
{
const Bufbyte *strend = str + len;
while (str < strend)
{
- Emchar ch = charptr_emchar (str);
- Dynarr_add (dyn, ch);
+ Charc ec;
+
+ ec.code_point = ENCODE_CHAR (charptr_emchar (str), ec.charset);
+ Dynarr_add (dyn, ec);
INC_CHARPTR (str);
}
}
Does not add a terminating zero. */
void
-convert_emchar_string_into_bufbyte_dynarr (Emchar *arr, int nels,
- Bufbyte_dynarr *dyn)
+convert_charc_string_into_bufbyte_dynarr (Charc *arr, int nels,
+ Bufbyte_dynarr *dyn)
{
Bufbyte str[MAX_EMCHAR_LEN];
int i;
for (i = 0; i < nels; i++)
{
- Bytecount len = set_charptr_emchar (str, arr[i]);
+ Charc ec = arr[i];
+
+ Bytecount len
+ = set_charptr_emchar (str, DECODE_CHAR (ec.charset, ec.code_point));
Dynarr_add_many (dyn, str, len);
}
}
is one more than this: the returned string is zero-terminated. */
Bufbyte *
-convert_emchar_string_into_malloced_string (Emchar *arr, int nels,
+convert_charc_string_into_malloced_string (Charc *arr, int nels,
Bytecount *len_out)
{
/* Damn zero-termination. */
int i;
for (i = 0; i < nels; i++)
- str += set_charptr_emchar (str, arr[i]);
+ {
+ Charc ec = arr[i];
+
+ str += set_charptr_emchar (str,
+ DECODE_CHAR (ec.charset, ec.code_point));
+ }
*str = '\0';
len = str - strorig;
str = (Bufbyte *) xmalloc (1 + len);