comparison src/coding.c @ 98951:71becd1e9707

(detect_coding_charset): For iso-8859-* coding systems, check Vlatin_extra_code_table.
author Kenichi Handa <handa@m17n.org>
date Tue, 21 Oct 2008 02:25:49 +0000
parents 1cfa973fde14
children d4659edb9b7b
comparison
equal deleted inserted replaced
98950:d6f6dbaf9d02 98951:71becd1e9707
4973 { 4973 {
4974 const unsigned char *src = coding->source, *src_base; 4974 const unsigned char *src = coding->source, *src_base;
4975 const unsigned char *src_end = coding->source + coding->src_bytes; 4975 const unsigned char *src_end = coding->source + coding->src_bytes;
4976 int multibytep = coding->src_multibyte; 4976 int multibytep = coding->src_multibyte;
4977 int consumed_chars = 0; 4977 int consumed_chars = 0;
4978 Lisp_Object attrs, valids; 4978 Lisp_Object attrs, valids, name;
4979 int found = 0; 4979 int found = 0;
4980 int head_ascii = coding->head_ascii; 4980 int head_ascii = coding->head_ascii;
4981 int check_latin_extra = 0;
4981 4982
4982 detect_info->checked |= CATEGORY_MASK_CHARSET; 4983 detect_info->checked |= CATEGORY_MASK_CHARSET;
4983 4984
4984 coding = &coding_categories[coding_category_charset]; 4985 coding = &coding_categories[coding_category_charset];
4985 attrs = CODING_ID_ATTRS (coding->id); 4986 attrs = CODING_ID_ATTRS (coding->id);
4986 valids = AREF (attrs, coding_attr_charset_valids); 4987 valids = AREF (attrs, coding_attr_charset_valids);
4987 4988 name = CODING_ID_NAME (coding->id);
4989 if (VECTORP (Vlatin_extra_code_table)
4990 && strcmp ((char *) SDATA (SYMBOL_NAME (name)), "iso-8859-"))
4991 check_latin_extra = 1;
4988 if (! NILP (CODING_ATTR_ASCII_COMPAT (attrs))) 4992 if (! NILP (CODING_ATTR_ASCII_COMPAT (attrs)))
4989 src += head_ascii; 4993 src += head_ascii;
4990 4994
4991 while (1) 4995 while (1)
4992 { 4996 {
5001 continue; 5005 continue;
5002 val = AREF (valids, c); 5006 val = AREF (valids, c);
5003 if (NILP (val)) 5007 if (NILP (val))
5004 break; 5008 break;
5005 if (c >= 0x80) 5009 if (c >= 0x80)
5006 found = CATEGORY_MASK_CHARSET; 5010 {
5011 if (c < 0xA0
5012 && check_latin_extra
5013 && NILP (XVECTOR (Vlatin_extra_code_table)->contents[c]))
5014 break;
5015 found = CATEGORY_MASK_CHARSET;
5016 }
5007 if (INTEGERP (val)) 5017 if (INTEGERP (val))
5008 { 5018 {
5009 charset = CHARSET_FROM_ID (XFASTINT (val)); 5019 charset = CHARSET_FROM_ID (XFASTINT (val));
5010 dim = CHARSET_DIMENSION (charset); 5020 dim = CHARSET_DIMENSION (charset);
5011 for (idx = 1; idx < dim; idx++) 5021 for (idx = 1; idx < dim; idx++)