181 |
} |
} |
182 |
|
|
183 |
/* Convert the unibyte character C to the corresponding multibyte |
/* Convert the unibyte character C to the corresponding multibyte |
184 |
character based on the current value of charset_primary. If C |
character based on the current value of charset_unibyte. If C |
185 |
can't be converted, return C. */ |
can't be converted, return C. */ |
186 |
|
|
187 |
int |
int |
188 |
unibyte_char_to_multibyte (c) |
unibyte_char_to_multibyte (c) |
189 |
int c; |
int c; |
190 |
{ |
{ |
191 |
struct charset *charset = CHARSET_FROM_ID (charset_primary); |
struct charset *charset = CHARSET_FROM_ID (charset_unibyte); |
192 |
int c1 = DECODE_CHAR (charset, c); |
int c1 = DECODE_CHAR (charset, c); |
193 |
|
|
194 |
return ((c1 >= 0) ? c1 : c); |
return ((c1 >= 0) ? c1 : c); |
196 |
|
|
197 |
|
|
198 |
/* Convert the multibyte character C to unibyte 8-bit character based |
/* Convert the multibyte character C to unibyte 8-bit character based |
199 |
on the current value of charset_primary. If dimension of |
on the current value of charset_unibyte. If dimension of |
200 |
charset_primary is more than one, return (C & 0xFF). |
charset_unibyte is more than one, return (C & 0xFF). |
201 |
|
|
202 |
The argument REV_TBL is now ignored. It will be removed in the |
The argument REV_TBL is now ignored. It will be removed in the |
203 |
future. */ |
future. */ |
207 |
int c; |
int c; |
208 |
Lisp_Object rev_tbl; |
Lisp_Object rev_tbl; |
209 |
{ |
{ |
210 |
struct charset *charset = CHARSET_FROM_ID (charset_primary); |
struct charset *charset = CHARSET_FROM_ID (charset_unibyte); |
211 |
unsigned c1 = ENCODE_CHAR (charset, c); |
unsigned c1 = ENCODE_CHAR (charset, c); |
212 |
|
|
213 |
return ((c1 != CHARSET_INVALID_CODE (charset)) ? c1 : c & 0xFF); |
return ((c1 != CHARSET_INVALID_CODE (charset)) ? c1 : c & 0xFF); |
244 |
c = XFASTINT (ch); |
c = XFASTINT (ch); |
245 |
if (c >= 0400) |
if (c >= 0400) |
246 |
error ("Invalid unibyte character: %d", c); |
error ("Invalid unibyte character: %d", c); |
247 |
charset = CHARSET_FROM_ID (charset_primary); |
charset = CHARSET_FROM_ID (charset_unibyte); |
248 |
c = DECODE_CHAR (charset, c); |
c = DECODE_CHAR (charset, c); |
249 |
if (c < 0) |
if (c < 0) |
250 |
c = BYTE8_TO_CHAR (XFASTINT (ch)); |
c = BYTE8_TO_CHAR (XFASTINT (ch)); |
260 |
Lisp_Object ch; |
Lisp_Object ch; |
261 |
{ |
{ |
262 |
int c; |
int c; |
|
struct charset *charset; |
|
263 |
|
|
264 |
CHECK_CHARACTER (ch); |
CHECK_CHARACTER (ch); |
265 |
c = XFASTINT (ch); |
c = XFASTINT (ch); |