return range_charset_code_point (charset, ch);
}
-unsigned char
-charset_get_byte1 (Lisp_Object charset, Emchar ch)
-{
- Lisp_Object table;
- int d;
-
- if (!EQ (table = XCHARSET_ENCODING_TABLE (charset), Qnil))
- {
- Lisp_Object value = get_char_code_table (ch, table);
-
- if (INTP (value))
- {
- Emchar code = XINT (value);
-
- if (code < (1 << 8))
- return code;
- else if (code < (1 << 16))
- return code >> 8;
- else if (code < (1 << 24))
- return code >> 16;
- else
- return code >> 24;
- }
- }
- if ((XCHARSET_UCS_MIN (charset) <= ch)
- && (ch <= XCHARSET_UCS_MAX (charset)))
- return (ch - XCHARSET_UCS_MIN (charset)
- + XCHARSET_CODE_OFFSET (charset))
- / (XCHARSET_DIMENSION (charset) == 1 ?
- 1
- :
- XCHARSET_DIMENSION (charset) == 2 ?
- XCHARSET_CHARS (charset)
- :
- XCHARSET_DIMENSION (charset) == 3 ?
- XCHARSET_CHARS (charset) * XCHARSET_CHARS (charset)
- :
- XCHARSET_CHARS (charset)
- * XCHARSET_CHARS (charset) * XCHARSET_CHARS (charset))
- + XCHARSET_BYTE_OFFSET (charset);
- else if (XCHARSET_CODE_OFFSET (charset) == 0)
- {
- if (XCHARSET_DIMENSION (charset) == 1)
- {
- if (XCHARSET_CHARS (charset) == 94)
- {
- if (((d = ch - (MIN_CHAR_94
- + (XCHARSET_FINAL (charset) - '0') * 94)) >= 0)
- && (d < 94))
- return d + 33;
- }
- else if (XCHARSET_CHARS (charset) == 96)
- {
- if (((d = ch - (MIN_CHAR_96
- + (XCHARSET_FINAL (charset) - '0') * 96)) >= 0)
- && (d < 96))
- return d + 32;
- }
- else
- return 0;
- }
- else if (XCHARSET_DIMENSION (charset) == 2)
- {
- if (XCHARSET_CHARS (charset) == 94)
- {
- if (((d = ch - (MIN_CHAR_94x94
- + (XCHARSET_FINAL (charset) - '0') * 94 * 94))
- >= 0)
- && (d < 94 * 94))
- return (d / 94) + 33;
- }
- else if (XCHARSET_CHARS (charset) == 96)
- {
- if (((d = ch - (MIN_CHAR_96x96
- + (XCHARSET_FINAL (charset) - '0') * 96 * 96))
- >= 0)
- && (d < 96 * 96))
- return (d / 96) + 32;
- }
- }
- }
- return 0;
-}
-
-unsigned char
-charset_get_byte2 (Lisp_Object charset, Emchar ch)
-{
- if (XCHARSET_DIMENSION (charset) == 1)
- return 0;
- else
- {
- Lisp_Object table;
-
- if (!EQ (table = XCHARSET_ENCODING_TABLE (charset), Qnil))
- {
- Lisp_Object value = get_char_code_table (ch, table);
-
- if (INTP (value))
- {
- Emchar code = XINT (value);
-
- if (code < (1 << 16))
- return (unsigned char)code;
- else if (code < (1 << 24))
- return (unsigned char)(code >> 16);
- else
- return (unsigned char)(code >> 24);
- }
- }
- if ((XCHARSET_UCS_MIN (charset) <= ch)
- && (ch <= XCHARSET_UCS_MAX (charset)))
- return ((ch - XCHARSET_UCS_MIN (charset)
- + XCHARSET_CODE_OFFSET (charset))
- / (XCHARSET_DIMENSION (charset) == 2 ?
- 1
- :
- XCHARSET_DIMENSION (charset) == 3 ?
- XCHARSET_CHARS (charset)
- :
- XCHARSET_CHARS (charset) * XCHARSET_CHARS (charset)))
- % XCHARSET_CHARS (charset)
- + XCHARSET_BYTE_OFFSET (charset);
- else if (XCHARSET_CHARS (charset) == 94)
- return (MIN_CHAR_94x94
- + (XCHARSET_FINAL (charset) - '0') * 94 * 94 <= ch)
- && (ch < MIN_CHAR_94x94
- + (XCHARSET_FINAL (charset) - '0' + 1) * 94 * 94) ?
- ((ch - MIN_CHAR_94x94) % 94) + 33 : 0;
- else /* if (XCHARSET_CHARS (charset) == 96) */
- return (MIN_CHAR_96x96
- + (XCHARSET_FINAL (charset) - '0') * 96 * 96 <= ch)
- && (ch < MIN_CHAR_96x96
- + (XCHARSET_FINAL (charset) - '0' + 1) * 96 * 96) ?
- ((ch - MIN_CHAR_96x96) % 96) + 32 : 0;
- }
-}
-
Lisp_Object Vdefault_coded_charset_priority_list;
#endif