comparison src/charset.c @ 17322:a7d9b8e167ca

(non_ascii_char_to_string, update_charset_table, Fsplit_char): Adjusted for the above change.
author Kenichi Handa <handa@m17n.org>
date Mon, 07 Apr 1997 07:12:13 +0000
parents 65bc06706714
children f7809ff2c65f
comparison
equal deleted inserted replaced
17321:9f837bea89e3 17322:a7d9b8e167ca
104 int 104 int
105 non_ascii_char_to_string (c, workbuf, str) 105 non_ascii_char_to_string (c, workbuf, str)
106 int c; 106 int c;
107 unsigned char *workbuf, **str; 107 unsigned char *workbuf, **str;
108 { 108 {
109 int charset; 109 int charset, c1, c2;
110 unsigned char c1, c2;
111 110
112 if (COMPOSITE_CHAR_P (c)) 111 if (COMPOSITE_CHAR_P (c))
113 { 112 {
114 int cmpchar_id = COMPOSITE_CHAR_ID (c); 113 int cmpchar_id = COMPOSITE_CHAR_ID (c);
115 114
130 *str = workbuf; 129 *str = workbuf;
131 *workbuf++ = CHARSET_LEADING_CODE_BASE (charset); 130 *workbuf++ = CHARSET_LEADING_CODE_BASE (charset);
132 if (*workbuf = CHARSET_LEADING_CODE_EXT (charset)) 131 if (*workbuf = CHARSET_LEADING_CODE_EXT (charset))
133 workbuf++; 132 workbuf++;
134 *workbuf++ = c1 | 0x80; 133 *workbuf++ = c1 | 0x80;
135 if (c2) 134 if (c2 >= 0)
136 *workbuf++ = c2 | 0x80; 135 *workbuf++ = c2 | 0x80;
137 136
138 return (workbuf - *str); 137 return (workbuf - *str);
139 } 138 }
140 139
242 { 241 {
243 int charset = XINT (charset_id); 242 int charset = XINT (charset_id);
244 int bytes; 243 int bytes;
245 unsigned char leading_code_base, leading_code_ext; 244 unsigned char leading_code_base, leading_code_ext;
246 245
247 if (NILP (Faref (Vcharset_table, charset_id))) 246 if (NILP (CHARSET_TABLE_ENTRY (charset)))
248 Faset (Vcharset_table, charset_id, 247 CHARSET_TABLE_ENTRY (charset)
249 Fmake_vector (make_number (CHARSET_MAX_IDX), Qnil)); 248 = Fmake_vector (make_number (CHARSET_MAX_IDX), Qnil);
250 249
251 /* Get byte length of multibyte form, base leading-code, and 250 /* Get byte length of multibyte form, base leading-code, and
252 extended leading-code of the charset. See the comment under the 251 extended leading-code of the charset. See the comment under the
253 title "GENERAL NOTE on CHARACTER SET (CHARSET)" in charset.h. */ 252 title "GENERAL NOTE on CHARACTER SET (CHARSET)" in charset.h. */
254 bytes = XINT (dimension); 253 bytes = XINT (dimension);
458 XSYMBOL (charset_symbol)->name->data); 457 XSYMBOL (charset_symbol)->name->data);
459 } 458 }
460 459
461 update_charset_table (charset_id, vec[0], vec[1], vec[2], vec[3], 460 update_charset_table (charset_id, vec[0], vec[1], vec[2], vec[3],
462 vec[4], vec[5], vec[6], vec[7], vec[8]); 461 vec[4], vec[5], vec[6], vec[7], vec[8]);
463 Fput (charset_symbol, Qcharset, Faref (Vcharset_table, charset_id)); 462 Fput (charset_symbol, Qcharset, CHARSET_TABLE_ENTRY (XINT (charset_id)));
464 CHARSET_SYMBOL (XINT (charset_id)) = charset_symbol; 463 CHARSET_SYMBOL (XINT (charset_id)) = charset_symbol;
465 Vcharset_list = Fcons (charset_symbol, Vcharset_list); 464 Vcharset_list = Fcons (charset_symbol, Vcharset_list);
466 return Qnil; 465 return Qnil;
467 } 466 }
468 467
598 "Return list of charset and one or two position-codes of CHAR.") 597 "Return list of charset and one or two position-codes of CHAR.")
599 (ch) 598 (ch)
600 Lisp_Object ch; 599 Lisp_Object ch;
601 { 600 {
602 Lisp_Object val; 601 Lisp_Object val;
603 int charset; 602 int charset, c1, c2;
604 unsigned char c1, c2;
605 603
606 CHECK_NUMBER (ch, 0); 604 CHECK_NUMBER (ch, 0);
607 SPLIT_CHAR (XFASTINT (ch), charset, c1, c2); 605 SPLIT_CHAR (XFASTINT (ch), charset, c1, c2);
608 return ((charset == CHARSET_COMPOSITION || CHARSET_DIMENSION (charset) == 2) 606 return (c2 >= 0
609 ? Fcons (CHARSET_SYMBOL (charset), 607 ? Fcons (CHARSET_SYMBOL (charset),
610 Fcons (make_number (c1), Fcons (make_number (c2), Qnil))) 608 Fcons (make_number (c1), Fcons (make_number (c2), Qnil)))
611 : Fcons (CHARSET_SYMBOL (charset), Fcons (make_number (c1), Qnil))); 609 : Fcons (CHARSET_SYMBOL (charset), Fcons (make_number (c1), Qnil)));
612 } 610 }
613 611