comparison src/coding.c @ 41899:5c01da9c8604

(setup_coding_system, shrink_encoding_region) (Fdecode_sjis_char): Likewise.
author Pavel Janík <Pavel@Janik.cz>
date Sun, 09 Dec 2001 00:56:24 +0000
parents 5aa97e545399
children e5356ff675e3
comparison
equal deleted inserted replaced
41898:9965a3b28660 41899:5c01da9c8604
3574 for (charset = 0; charset <= MAX_CHARSET; charset++) 3574 for (charset = 0; charset <= MAX_CHARSET; charset++)
3575 CODING_SPEC_ISO_REQUESTED_DESIGNATION (coding, charset) 3575 CODING_SPEC_ISO_REQUESTED_DESIGNATION (coding, charset)
3576 = CODING_SPEC_ISO_NO_REQUESTED_DESIGNATION; 3576 = CODING_SPEC_ISO_NO_REQUESTED_DESIGNATION;
3577 for (i = 0; i < 4; i++) 3577 for (i = 0; i < 4; i++)
3578 { 3578 {
3579 if (INTEGERP (flags[i]) 3579 if ((INTEGERP (flags[i])
3580 && (charset = XINT (flags[i]), CHARSET_VALID_P (charset)) 3580 && (charset = XINT (flags[i]), CHARSET_VALID_P (charset)))
3581 || (charset = get_charset_id (flags[i])) >= 0) 3581 || (charset = get_charset_id (flags[i])) >= 0)
3582 { 3582 {
3583 CODING_SPEC_ISO_INITIAL_DESIGNATION (coding, i) = charset; 3583 CODING_SPEC_ISO_INITIAL_DESIGNATION (coding, i) = charset;
3584 CODING_SPEC_ISO_REQUESTED_DESIGNATION (coding, charset) = i; 3584 CODING_SPEC_ISO_REQUESTED_DESIGNATION (coding, charset) = i;
3585 } 3585 }
3593 { 3593 {
3594 Lisp_Object tail; 3594 Lisp_Object tail;
3595 tail = flags[i]; 3595 tail = flags[i];
3596 3596
3597 coding->flags |= CODING_FLAG_ISO_DESIGNATION; 3597 coding->flags |= CODING_FLAG_ISO_DESIGNATION;
3598 if (INTEGERP (XCAR (tail)) 3598 if ((INTEGERP (XCAR (tail))
3599 && (charset = XINT (XCAR (tail)), 3599 && (charset = XINT (XCAR (tail)),
3600 CHARSET_VALID_P (charset)) 3600 CHARSET_VALID_P (charset)))
3601 || (charset = get_charset_id (XCAR (tail))) >= 0) 3601 || (charset = get_charset_id (XCAR (tail))) >= 0)
3602 { 3602 {
3603 CODING_SPEC_ISO_INITIAL_DESIGNATION (coding, i) = charset; 3603 CODING_SPEC_ISO_INITIAL_DESIGNATION (coding, i) = charset;
3604 CODING_SPEC_ISO_REQUESTED_DESIGNATION (coding, charset) =i; 3604 CODING_SPEC_ISO_REQUESTED_DESIGNATION (coding, charset) =i;
3605 } 3605 }
3606 else 3606 else
3607 CODING_SPEC_ISO_INITIAL_DESIGNATION (coding, i) = -1; 3607 CODING_SPEC_ISO_INITIAL_DESIGNATION (coding, i) = -1;
3608 tail = XCDR (tail); 3608 tail = XCDR (tail);
3609 while (CONSP (tail)) 3609 while (CONSP (tail))
3610 { 3610 {
3611 if (INTEGERP (XCAR (tail)) 3611 if ((INTEGERP (XCAR (tail))
3612 && (charset = XINT (XCAR (tail)), 3612 && (charset = XINT (XCAR (tail)),
3613 CHARSET_VALID_P (charset)) 3613 CHARSET_VALID_P (charset)))
3614 || (charset = get_charset_id (XCAR (tail))) >= 0) 3614 || (charset = get_charset_id (XCAR (tail))) >= 0)
3615 CODING_SPEC_ISO_REQUESTED_DESIGNATION (coding, charset) 3615 CODING_SPEC_ISO_REQUESTED_DESIGNATION (coding, charset)
3616 = i; 3616 = i;
3617 else if (EQ (XCAR (tail), Qt)) 3617 else if (EQ (XCAR (tail), Qt))
3618 reg_bits |= 1 << i; 3618 reg_bits |= 1 << i;
5045 Lisp_Object translation_table; 5045 Lisp_Object translation_table;
5046 5046
5047 if (coding->type == coding_type_ccl 5047 if (coding->type == coding_type_ccl
5048 || coding->eol_type == CODING_EOL_CRLF 5048 || coding->eol_type == CODING_EOL_CRLF
5049 || coding->eol_type == CODING_EOL_CR 5049 || coding->eol_type == CODING_EOL_CR
5050 || coding->cmp_data && coding->cmp_data->used > 0) 5050 || (coding->cmp_data && coding->cmp_data->used > 0))
5051 { 5051 {
5052 /* We can't skip any data. */ 5052 /* We can't skip any data. */
5053 return; 5053 return;
5054 } 5054 }
5055 if (coding->type == coding_type_no_conversion 5055 if (coding->type == coding_type_no_conversion
6604 else 6604 else
6605 error ("Invalid Shift JIS code: %x", XFASTINT (code)); 6605 error ("Invalid Shift JIS code: %x", XFASTINT (code));
6606 } 6606 }
6607 else 6607 else
6608 { 6608 {
6609 if ((s1 < 0x80 || s1 > 0x9F && s1 < 0xE0 || s1 > 0xEF) 6609 if ((s1 < 0x80 || (s1 > 0x9F && s1 < 0xE0) || s1 > 0xEF)
6610 || (s2 < 0x40 || s2 == 0x7F || s2 > 0xFC)) 6610 || (s2 < 0x40 || s2 == 0x7F || s2 > 0xFC))
6611 error ("Invalid Shift JIS code: %x", XFASTINT (code)); 6611 error ("Invalid Shift JIS code: %x", XFASTINT (code));
6612 DECODE_SJIS (s1, s2, c1, c2); 6612 DECODE_SJIS (s1, s2, c1, c2);
6613 XSETFASTINT (val, MAKE_CHAR (charset_jisx0208, c1, c2)); 6613 XSETFASTINT (val, MAKE_CHAR (charset_jisx0208, c1, c2));
6614 } 6614 }