Function: decode-big5-char
decode-big5-char is a function defined in coding.c.
Signature
(decode-big5-char CODE)
Documentation
Decode a Big5 character which has CODE in BIG5 coding system.
Return the corresponding character.
Source Code
// Defined in /usr/src/emacs/src/coding.c
{
Lisp_Object spec, attrs, val;
struct charset *charset_roman, *charset_big5, *charset;
EMACS_INT ch;
int c;
CHECK_FIXNAT (code);
ch = XFIXNAT (code);
CHECK_CODING_SYSTEM_GET_SPEC (Vbig5_coding_system, spec);
attrs = AREF (spec, 0);
if (ASCII_CHAR_P (ch)
&& ! NILP (CODING_ATTR_ASCII_COMPAT (attrs)))
return code;
val = CODING_ATTR_CHARSET_LIST (attrs);
charset_roman = CHARSET_FROM_ID (XFIXNUM (XCAR (val))), val = XCDR (val);
charset_big5 = CHARSET_FROM_ID (XFIXNUM (XCAR (val)));
if (ch <= 0x7F)
{
c = ch;
charset = charset_roman;
}
else
{
EMACS_INT b1 = ch >> 8;
int b2 = ch & 0x7F;
if (b1 < 0xA1 || b1 > 0xFE
|| b2 < 0x40 || (b2 > 0x7E && b2 < 0xA1) || b2 > 0xFE)
error ("Invalid code: %"pI"d", ch);
c = ch;
charset = charset_big5;
}
c = DECODE_CHAR (charset, c);
if (c < 0)
error ("Invalid code: %"pI"d", ch);
return make_fixnum (c);
}