comparison src/mule-charset.c @ 438:84b14dcb0985 r21-2-27

Import from CVS: tag r21-2-27
author cvs
date Mon, 13 Aug 2007 11:32:25 +0200
parents 3ecd8885ac67
children 8de8e3f6228a
comparison
equal deleted inserted replaced
437:e2a4e8b94b82 438:84b14dcb0985
90 indexed by the first byte of that representation. 90 indexed by the first byte of that representation.
91 91
92 rep_bytes_by_first_byte(c) is more efficient than the equivalent 92 rep_bytes_by_first_byte(c) is more efficient than the equivalent
93 canonical computation: 93 canonical computation:
94 94
95 (BYTE_ASCII_P (c) ? 1 : XCHARSET_REP_BYTES (CHARSET_BY_LEADING_BYTE (c))) */ 95 XCHARSET_REP_BYTES (CHARSET_BY_LEADING_BYTE (c)) */
96 96
97 Bytecount rep_bytes_by_first_byte[0xA0] = 97 const Bytecount rep_bytes_by_first_byte[0xA0] =
98 { /* 0x00 - 0x7f are for straight ASCII */ 98 { /* 0x00 - 0x7f are for straight ASCII */
99 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 99 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
100 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 100 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
101 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 101 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
102 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 102 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
504 chlook->charset_by_attributes[type][final][direction] = obj; 504 chlook->charset_by_attributes[type][final][direction] = obj;
505 } 505 }
506 506
507 assert (NILP (chlook->charset_by_leading_byte[id - 128])); 507 assert (NILP (chlook->charset_by_leading_byte[id - 128]));
508 chlook->charset_by_leading_byte[id - 128] = obj; 508 chlook->charset_by_leading_byte[id - 128] = obj;
509 if (id < 0xA0)
510 /* official leading byte */
511 rep_bytes_by_first_byte[id] = rep_bytes;
512 509
513 /* Some charsets are "faux" and don't have names or really exist at 510 /* Some charsets are "faux" and don't have names or really exist at
514 all except in the leading-byte table. */ 511 all except in the leading-byte table. */
515 if (!NILP (name)) 512 if (!NILP (name))
516 Fputhash (name, obj, Vcharset_hash_table); 513 Fputhash (name, obj, Vcharset_hash_table);
1120 1117
1121 return XCHARSET_NAME (CHARSET_BY_LEADING_BYTE 1118 return XCHARSET_NAME (CHARSET_BY_LEADING_BYTE
1122 (CHAR_LEADING_BYTE (XCHAR (ch)))); 1119 (CHAR_LEADING_BYTE (XCHAR (ch))));
1123 } 1120 }
1124 1121
1122 DEFUN ("char-octet", Fchar_octet, 1, 2, 0, /*
1123 Return the octet numbered N (should be 0 or 1) of char CH.
1124 N defaults to 0 if omitted.
1125 */
1126 (ch, n))
1127 {
1128 Lisp_Object charset;
1129 int octet0, octet1;
1130
1131 CHECK_CHAR_COERCE_INT (ch);
1132
1133 BREAKUP_CHAR (XCHAR (ch), charset, octet0, octet1);
1134
1135 if (NILP (n) || EQ (n, Qzero))
1136 return make_int (octet0);
1137 else if (EQ (n, make_int (1)))
1138 return make_int (octet1);
1139 else
1140 signal_simple_error ("Octet number must be 0 or 1", n);
1141 }
1142
1125 DEFUN ("split-char", Fsplit_char, 1, 1, 0, /* 1143 DEFUN ("split-char", Fsplit_char, 1, 1, 0, /*
1126 Return list of charset and one or two position-codes of CHAR. 1144 Return list of charset and one or two position-codes of CHAR.
1127 */ 1145 */
1128 (character)) 1146 (character))
1129 { 1147 {
1251 DEFSUBR (Fset_charset_ccl_program); 1269 DEFSUBR (Fset_charset_ccl_program);
1252 DEFSUBR (Fset_charset_registry); 1270 DEFSUBR (Fset_charset_registry);
1253 1271
1254 DEFSUBR (Fmake_char); 1272 DEFSUBR (Fmake_char);
1255 DEFSUBR (Fchar_charset); 1273 DEFSUBR (Fchar_charset);
1274 DEFSUBR (Fchar_octet);
1256 DEFSUBR (Fsplit_char); 1275 DEFSUBR (Fsplit_char);
1257 1276
1258 #ifdef ENABLE_COMPOSITE_CHARS 1277 #ifdef ENABLE_COMPOSITE_CHARS
1259 DEFSUBR (Fmake_composite_char); 1278 DEFSUBR (Fmake_composite_char);
1260 DEFSUBR (Fcomposite_char_string); 1279 DEFSUBR (Fcomposite_char_string);