1031 |
int multibytep = coding->src_multibyte; |
int multibytep = coding->src_multibyte; |
1032 |
int consumed_chars = 0; |
int consumed_chars = 0; |
1033 |
int found = 0; |
int found = 0; |
1034 |
|
int incomplete; |
1035 |
|
|
1036 |
/* A coding system of this category is always ASCII compatible. */ |
/* A coding system of this category is always ASCII compatible. */ |
1037 |
src += coding->head_ascii; |
src += coding->head_ascii; |
1040 |
{ |
{ |
1041 |
int c, c1, c2, c3, c4; |
int c, c1, c2, c3, c4; |
1042 |
|
|
1043 |
|
incomplete = 0; |
1044 |
ONE_MORE_BYTE (c); |
ONE_MORE_BYTE (c); |
1045 |
if (UTF_8_1_OCTET_P (c)) |
if (UTF_8_1_OCTET_P (c)) |
1046 |
continue; |
continue; |
1047 |
|
incomplete = 1; |
1048 |
ONE_MORE_BYTE (c1); |
ONE_MORE_BYTE (c1); |
1049 |
if (! UTF_8_EXTRA_OCTET_P (c1)) |
if (! UTF_8_EXTRA_OCTET_P (c1)) |
1050 |
break; |
break; |
1083 |
return 0; |
return 0; |
1084 |
|
|
1085 |
no_more_source: |
no_more_source: |
1086 |
if (! found) |
if (incomplete && coding->mode & CODING_MODE_LAST_BLOCK) |
1087 |
return 0; |
{ |
1088 |
*mask &= CATEGORY_MASK_UTF_8; |
*mask &= ~CATEGORY_MASK_UTF_8; |
1089 |
return 1; |
return 0; |
1090 |
|
} |
1091 |
|
return found; |
1092 |
} |
} |
1093 |
|
|
1094 |
|
|
1294 |
int consumed_chars = 0; |
int consumed_chars = 0; |
1295 |
int c1, c2; |
int c1, c2; |
1296 |
|
|
1297 |
|
*mask &= ~CATEGORY_MASK_UTF_16; |
1298 |
|
|
1299 |
ONE_MORE_BYTE (c1); |
ONE_MORE_BYTE (c1); |
1300 |
ONE_MORE_BYTE (c2); |
ONE_MORE_BYTE (c2); |
1301 |
|
|
1302 |
if ((c1 == 0xFF) && (c2 == 0xFE)) |
if ((c1 == 0xFF) && (c2 == 0xFE)) |
1303 |
{ |
*mask |= CATEGORY_MASK_UTF_16_LE; |
|
*mask &= CATEGORY_MASK_UTF_16_LE; |
|
|
return 1; |
|
|
} |
|
1304 |
else if ((c1 == 0xFE) && (c2 == 0xFF)) |
else if ((c1 == 0xFE) && (c2 == 0xFF)) |
1305 |
{ |
*mask |= CATEGORY_MASK_UTF_16_BE; |
1306 |
*mask &= CATEGORY_MASK_UTF_16_BE; |
else |
1307 |
return 1; |
*mask |= CATEGORY_MASK_UTF_16_BE_NOSIG | CATEGORY_MASK_UTF_16_LE_NOSIG; |
1308 |
} |
return 1; |
1309 |
|
|
1310 |
no_more_source: |
no_more_source: |
1311 |
return 0; |
return 0; |
1312 |
} |
} |
1648 |
int consumed_chars = 0; |
int consumed_chars = 0; |
1649 |
int c; |
int c; |
1650 |
int found = 0; |
int found = 0; |
1651 |
|
int incomplete; |
1652 |
|
|
1653 |
/* A coding system of this category is always ASCII compatible. */ |
/* A coding system of this category is always ASCII compatible. */ |
1654 |
src += coding->head_ascii; |
src += coding->head_ascii; |
1655 |
|
|
1656 |
while (1) |
while (1) |
1657 |
{ |
{ |
1658 |
|
incomplete = 0; |
1659 |
ONE_MORE_BYTE (c); |
ONE_MORE_BYTE (c); |
1660 |
|
incomplete = 1; |
1661 |
|
|
1662 |
if (c == 0x80) |
if (c == 0x80) |
1663 |
{ |
{ |
1706 |
return 0; |
return 0; |
1707 |
|
|
1708 |
no_more_source: |
no_more_source: |
1709 |
if (!found) |
if (incomplete && coding->mode & CODING_MODE_LAST_BLOCK) |
1710 |
return 0; |
{ |
1711 |
*mask &= CATEGORY_MASK_EMACS_MULE; |
*mask &= ~CATEGORY_MASK_EMACS_MULE; |
1712 |
return 1; |
return 0; |
1713 |
|
} |
1714 |
|
return found; |
1715 |
} |
} |
1716 |
|
|
1717 |
|
|
2475 |
{ |
{ |
2476 |
int newmask = CATEGORY_MASK_ISO_8_ELSE; |
int newmask = CATEGORY_MASK_ISO_8_ELSE; |
2477 |
|
|
2478 |
|
mask_8bit_found = 1; |
2479 |
if (inhibit_iso_escape_detection) |
if (inhibit_iso_escape_detection) |
2480 |
break; |
break; |
2481 |
if (c != ISO_CODE_CSI) |
if (c != ISO_CODE_CSI) |
2569 |
} |
} |
2570 |
if (!mask_found) |
if (!mask_found) |
2571 |
return 0; |
return 0; |
2572 |
*mask &= mask_iso & mask_found; |
*mask &= ~CATEGORY_MASK_ISO; |
2573 |
|
*mask |= mask_iso & mask_found; |
2574 |
if (! mask_8bit_found) |
if (! mask_8bit_found) |
2575 |
*mask &= ~(CATEGORY_MASK_ISO_8BIT | CATEGORY_MASK_ISO_8_ELSE); |
*mask &= ~(CATEGORY_MASK_ISO_8BIT | CATEGORY_MASK_ISO_8_ELSE); |
2576 |
return 1; |
return 1; |
3670 |
int consumed_chars = 0; |
int consumed_chars = 0; |
3671 |
int found = 0; |
int found = 0; |
3672 |
int c; |
int c; |
3673 |
|
int incomplete; |
3674 |
|
|
3675 |
/* A coding system of this category is always ASCII compatible. */ |
/* A coding system of this category is always ASCII compatible. */ |
3676 |
src += coding->head_ascii; |
src += coding->head_ascii; |
3677 |
|
|
3678 |
while (1) |
while (1) |
3679 |
{ |
{ |
3680 |
|
incomplete = 0; |
3681 |
ONE_MORE_BYTE (c); |
ONE_MORE_BYTE (c); |
3682 |
|
incomplete = 1; |
3683 |
if (c < 0x80) |
if (c < 0x80) |
3684 |
continue; |
continue; |
3685 |
if ((c >= 0x81 && c <= 0x9F) || (c >= 0xE0 && c <= 0xEF)) |
if ((c >= 0x81 && c <= 0x9F) || (c >= 0xE0 && c <= 0xEF)) |
3698 |
return 0; |
return 0; |
3699 |
|
|
3700 |
no_more_source: |
no_more_source: |
3701 |
if (!found) |
if (incomplete && coding->mode & CODING_MODE_LAST_BLOCK) |
3702 |
return 0; |
{ |
3703 |
*mask &= CATEGORY_MASK_SJIS; |
*mask &= ~CATEGORY_MASK_SJIS; |
3704 |
return 1; |
return 0; |
3705 |
|
} |
3706 |
|
return found; |
3707 |
} |
} |
3708 |
|
|
3709 |
/* See the above "GENERAL NOTES on `detect_coding_XXX ()' functions". |
/* See the above "GENERAL NOTES on `detect_coding_XXX ()' functions". |
3721 |
int consumed_chars = 0; |
int consumed_chars = 0; |
3722 |
int found = 0; |
int found = 0; |
3723 |
int c; |
int c; |
3724 |
|
int incomplete; |
3725 |
|
|
3726 |
/* A coding system of this category is always ASCII compatible. */ |
/* A coding system of this category is always ASCII compatible. */ |
3727 |
src += coding->head_ascii; |
src += coding->head_ascii; |
3728 |
|
|
3729 |
while (1) |
while (1) |
3730 |
{ |
{ |
3731 |
|
incomplete = 0; |
3732 |
ONE_MORE_BYTE (c); |
ONE_MORE_BYTE (c); |
3733 |
|
incomplete = 1; |
3734 |
if (c < 0x80) |
if (c < 0x80) |
3735 |
continue; |
continue; |
3736 |
if (c >= 0xA1) |
if (c >= 0xA1) |
3747 |
return 0; |
return 0; |
3748 |
|
|
3749 |
no_more_source: |
no_more_source: |
3750 |
if (!found) |
if (incomplete && coding->mode & CODING_MODE_LAST_BLOCK) |
3751 |
return 0; |
{ |
3752 |
*mask &= CATEGORY_MASK_BIG5; |
*mask &= ~CATEGORY_MASK_BIG5; |
3753 |
return 1; |
return 0; |
3754 |
|
} |
3755 |
|
return found; |
3756 |
} |
} |
3757 |
|
|
3758 |
/* See the above "GENERAL NOTES on `decode_coding_XXX ()' functions". |
/* See the above "GENERAL NOTES on `decode_coding_XXX ()' functions". |
3776 |
|
|
3777 |
val = charset_list; |
val = charset_list; |
3778 |
charset_roman = CHARSET_FROM_ID (XINT (XCAR (val))), val = XCDR (val); |
charset_roman = CHARSET_FROM_ID (XINT (XCAR (val))), val = XCDR (val); |
3779 |
charset_kanji = CHARSET_FROM_ID (XINT (XCAR (val))), val = XCDR (val); |
charset_kana = CHARSET_FROM_ID (XINT (XCAR (val))), val = XCDR (val); |
3780 |
charset_kana = CHARSET_FROM_ID (XINT (XCAR (val))); |
charset_kanji = CHARSET_FROM_ID (XINT (XCAR (val))); |
3781 |
|
|
3782 |
while (1) |
while (1) |
3783 |
{ |
{ |
3824 |
charset = charset_kanji; |
charset = charset_kanji; |
3825 |
} |
} |
3826 |
else |
else |
3827 |
/* SJIS -> JISX0201-Kana */ |
{ |
3828 |
charset = charset_kana; |
/* SJIS -> JISX0201-Kana */ |
3829 |
|
c &= 0x7F; |
3830 |
|
charset = charset_kana; |
3831 |
|
} |
3832 |
} |
} |
3833 |
CODING_DECODE_CHAR (coding, src, src_base, src_end, charset, c, c); |
CODING_DECODE_CHAR (coding, src, src_base, src_end, charset, c, c); |
3834 |
} |
} |
4122 |
return 0; |
return 0; |
4123 |
|
|
4124 |
no_more_source: |
no_more_source: |
4125 |
if (!found) |
return found; |
|
return 0; |
|
|
*mask &= CATEGORY_MASK_CCL; |
|
|
return 1; |
|
4126 |
} |
} |
4127 |
|
|
4128 |
static void |
static void |
4390 |
return 0; |
return 0; |
4391 |
|
|
4392 |
no_more_source: |
no_more_source: |
|
*mask &= CATEGORY_MASK_CHARSET; |
|
4393 |
return 1; |
return 1; |
4394 |
} |
} |
4395 |
|
|
4915 |
#define MAX_EOL_CHECK_COUNT 3 |
#define MAX_EOL_CHECK_COUNT 3 |
4916 |
|
|
4917 |
static int |
static int |
4918 |
detect_eol (coding, source, src_bytes) |
detect_eol (source, src_bytes, category) |
|
struct coding_system *coding; |
|
4919 |
unsigned char *source; |
unsigned char *source; |
4920 |
EMACS_INT src_bytes; |
EMACS_INT src_bytes; |
4921 |
|
enum coding_category category; |
4922 |
{ |
{ |
|
Lisp_Object attrs, coding_type; |
|
4923 |
unsigned char *src = source, *src_end = src + src_bytes; |
unsigned char *src = source, *src_end = src + src_bytes; |
4924 |
unsigned char c; |
unsigned char c; |
4925 |
int total = 0; |
int total = 0; |
4926 |
int eol_seen = EOL_SEEN_NONE; |
int eol_seen = EOL_SEEN_NONE; |
4927 |
|
|
4928 |
attrs = CODING_ID_ATTRS (coding->id); |
if ((1 << category) & CATEGORY_MASK_UTF_16) |
|
coding_type = CODING_ATTR_TYPE (attrs); |
|
|
|
|
|
if (EQ (coding_type, Qccl)) |
|
4929 |
{ |
{ |
4930 |
int msb, lsb; |
int msb, lsb; |
4931 |
|
|
4932 |
msb = coding->spec.utf_16.endian == utf_16_little_endian; |
msb = category == (coding_category_utf_16_le |
4933 |
|
| coding_category_utf_16_le_nosig); |
4934 |
lsb = 1 - msb; |
lsb = 1 - msb; |
4935 |
|
|
4936 |
while (src + 1 < src_end) |
while (src + 1 < src_end) |
5057 |
enum coding_category category = coding_priorities[i]; |
enum coding_category category = coding_priorities[i]; |
5058 |
struct coding_system *this = coding_categories + category; |
struct coding_system *this = coding_categories + category; |
5059 |
|
|
|
if (category >= coding_category_raw_text |
|
|
|| detected & (1 << category)) |
|
|
continue; |
|
|
|
|
5060 |
if (this->id < 0) |
if (this->id < 0) |
5061 |
{ |
{ |
5062 |
/* No coding system of this category is defined. */ |
/* No coding system of this category is defined. */ |
5063 |
mask &= ~(1 << category); |
mask &= ~(1 << category); |
5064 |
} |
} |
5065 |
|
else if (category >= coding_category_raw_text |
5066 |
|
|| detected & (1 << category)) |
5067 |
|
continue; |
5068 |
else |
else |
5069 |
{ |
{ |
5070 |
detected |= detected_mask[category]; |
detected |= detected_mask[category]; |
5071 |
if ((*(this->detector)) (coding, &mask)) |
if ((*(this->detector)) (coding, &mask) |
5072 |
|
&& (mask & (1 << category))) |
5073 |
break; |
break; |
5074 |
} |
} |
5075 |
} |
} |
5099 |
if (VECTORP (CODING_ID_EOL_TYPE (coding->id)) |
if (VECTORP (CODING_ID_EOL_TYPE (coding->id)) |
5100 |
&& ! EQ (coding_type, Qccl)) |
&& ! EQ (coding_type, Qccl)) |
5101 |
{ |
{ |
5102 |
int eol_seen = detect_eol (coding, coding->source, coding->src_bytes); |
int eol_seen = detect_eol (coding->source, coding->src_bytes, |
5103 |
|
XINT (CODING_ATTR_CATEGORY (attrs))); |
5104 |
|
|
5105 |
if (eol_seen != EOL_SEEN_NONE) |
if (eol_seen != EOL_SEEN_NONE) |
5106 |
adjust_coding_eol_type (coding, eol_seen); |
adjust_coding_eol_type (coding, eol_seen); |
6264 |
} |
} |
6265 |
|
|
6266 |
|
|
6267 |
|
/* Detect how the bytes at SRC of length SRC_BYTES are encoded. If |
6268 |
|
HIGHEST is nonzero, return the coding system of the highest |
6269 |
|
priority among the detected coding systems. Otherwize return a |
6270 |
|
list of detected coding systems sorted by their priorities. If |
6271 |
|
MULTIBYTEP is nonzero, it is assumed that the bytes are in correct |
6272 |
|
multibyte form but contains only ASCII and eight-bit chars. |
6273 |
|
Otherwise, the bytes are raw bytes. |
6274 |
|
|
6275 |
|
CODING-SYSTEM controls the detection as below: |
6276 |
|
|
6277 |
|
If it is nil, detect both text-format and eol-format. If the |
6278 |
|
text-format part of CODING-SYSTEM is already specified |
6279 |
|
(e.g. `iso-latin-1'), detect only eol-format. If the eol-format |
6280 |
|
part of CODING-SYSTEM is already specified (e.g. `undecided-unix'), |
6281 |
|
detect only text-format. */ |
6282 |
|
|
6283 |
Lisp_Object |
Lisp_Object |
6284 |
detect_coding_system (src, src_bytes, highest, multibytep, coding_system) |
detect_coding_system (src, src_bytes, highest, multibytep, coding_system) |
6285 |
unsigned char *src; |
unsigned char *src; |
6294 |
Lisp_Object attrs, eol_type; |
Lisp_Object attrs, eol_type; |
6295 |
Lisp_Object val; |
Lisp_Object val; |
6296 |
struct coding_system coding; |
struct coding_system coding; |
6297 |
|
int id; |
6298 |
|
|
6299 |
if (NILP (coding_system)) |
if (NILP (coding_system)) |
6300 |
coding_system = Qundecided; |
coding_system = Qundecided; |
6301 |
setup_coding_system (coding_system, &coding); |
setup_coding_system (coding_system, &coding); |
6302 |
attrs = CODING_ID_ATTRS (coding.id); |
attrs = CODING_ID_ATTRS (coding.id); |
6303 |
eol_type = CODING_ID_EOL_TYPE (coding.id); |
eol_type = CODING_ID_EOL_TYPE (coding.id); |
6304 |
|
coding_system = CODING_ATTR_BASE_NAME (attrs); |
6305 |
|
|
6306 |
coding.source = src; |
coding.source = src; |
6307 |
coding.src_bytes = src_bytes; |
coding.src_bytes = src_bytes; |
6308 |
coding.src_multibyte = multibytep; |
coding.src_multibyte = multibytep; |
6309 |
coding.consumed = 0; |
coding.consumed = 0; |
6310 |
|
coding.mode |= CODING_MODE_LAST_BLOCK; |
6311 |
|
|
6312 |
if (XINT (CODING_ATTR_CATEGORY (attrs)) != coding_category_undecided) |
/* At first, detect text-format if necessary. */ |
6313 |
{ |
if (XINT (CODING_ATTR_CATEGORY (attrs)) == coding_category_undecided) |
|
mask = 1 << XINT (CODING_ATTR_CATEGORY (attrs)); |
|
|
} |
|
|
else |
|
6314 |
{ |
{ |
|
coding_system = Qnil; |
|
6315 |
for (; src < src_end; src++) |
for (; src < src_end; src++) |
6316 |
{ |
{ |
6317 |
c = *src; |
c = *src; |
6318 |
if (c & 0x80 || (c < 0x20 && (c == ISO_CODE_ESC |
if (c & 0x80 |
6319 |
|| c == ISO_CODE_SI |
|| (c < 0x20 && (c == ISO_CODE_ESC |
6320 |
|| c == ISO_CODE_SO))) |
|| c == ISO_CODE_SI |
6321 |
|
|| c == ISO_CODE_SO |
6322 |
|
/* Most UTF-16 text contains '\0'. */ |
6323 |
|
|| !c))) |
6324 |
break; |
break; |
6325 |
} |
} |
6326 |
coding.head_ascii = src - coding.source; |
coding.head_ascii = src - coding.source; |
6331 |
enum coding_category category = coding_priorities[i]; |
enum coding_category category = coding_priorities[i]; |
6332 |
struct coding_system *this = coding_categories + category; |
struct coding_system *this = coding_categories + category; |
6333 |
|
|
|
if (category >= coding_category_raw_text |
|
|
|| detected & (1 << category)) |
|
|
continue; |
|
|
|
|
6334 |
if (this->id < 0) |
if (this->id < 0) |
6335 |
{ |
{ |
6336 |
/* No coding system of this category is defined. */ |
/* No coding system of this category is defined. */ |
6337 |
mask &= ~(1 << category); |
mask &= ~(1 << category); |
6338 |
} |
} |
6339 |
|
else if (category >= coding_category_raw_text |
6340 |
|
|| detected & (1 << category)) |
6341 |
|
continue; |
6342 |
else |
else |
6343 |
{ |
{ |
6344 |
detected |= detected_mask[category]; |
detected |= detected_mask[category]; |
6345 |
if ((*(coding_categories[category].detector)) (&coding, &mask) |
if ((*(coding_categories[category].detector)) (&coding, &mask) |
6346 |
&& highest) |
&& highest |
6347 |
|
&& (mask & (1 << category))) |
6348 |
{ |
{ |
6349 |
mask &= detected_mask[category]; |
mask = 1 << category; |
6350 |
break; |
break; |
6351 |
} |
} |
6352 |
} |
} |
6353 |
} |
} |
|
} |
|
6354 |
|
|
6355 |
if (!mask) |
if (!mask) |
6356 |
val = Fcons (make_number (coding_category_raw_text), Qnil); |
{ |
6357 |
else if (mask == CATEGORY_MASK_ANY) |
id = coding_categories[coding_category_raw_text].id; |
6358 |
val = Fcons (make_number (coding_category_undecided), Qnil); |
val = Fcons (make_number (id), Qnil); |
6359 |
else if (highest) |
} |
6360 |
{ |
else if (mask == CATEGORY_MASK_ANY) |
6361 |
for (i = 0; i < coding_category_raw_text; i++) |
{ |
6362 |
if (mask & (1 << coding_priorities[i])) |
id = coding_categories[coding_category_undecided].id; |
6363 |
{ |
val = Fcons (make_number (id), Qnil); |
6364 |
val = Fcons (make_number (coding_priorities[i]), Qnil); |
} |
6365 |
break; |
else if (highest) |
6366 |
} |
{ |
6367 |
} |
for (i = 0; i < coding_category_raw_text; i++) |
6368 |
|
if (mask & (1 << coding_priorities[i])) |
6369 |
|
{ |
6370 |
|
id = coding_categories[coding_priorities[i]].id; |
6371 |
|
val = Fcons (make_number (id), Qnil); |
6372 |
|
break; |
6373 |
|
} |
6374 |
|
} |
6375 |
|
else |
6376 |
|
{ |
6377 |
|
val = Qnil; |
6378 |
|
for (i = coding_category_raw_text - 1; i >= 0; i--) |
6379 |
|
if (mask & (1 << coding_priorities[i])) |
6380 |
|
{ |
6381 |
|
id = coding_categories[coding_priorities[i]].id; |
6382 |
|
val = Fcons (make_number (id), val); |
6383 |
|
} |
6384 |
|
} |
6385 |
|
} |
6386 |
else |
else |
6387 |
{ |
{ |
6388 |
val = Qnil; |
mask = 1 << XINT (CODING_ATTR_CATEGORY (attrs)); |
6389 |
for (i = coding_category_raw_text - 1; i >= 0; i--) |
val = Fcons (make_number (coding.id), Qnil); |
|
if (mask & (1 << coding_priorities[i])) |
|
|
val = Fcons (make_number (coding_priorities[i]), val); |
|
6390 |
} |
} |
6391 |
|
|
6392 |
|
/* Then, detect eol-format if necessary. */ |
6393 |
{ |
{ |
6394 |
int one_byte_eol = -1, two_byte_eol = -1; |
int normal_eol = -1, utf_16_be_eol = -1, utf_16_le_eol; |
6395 |
Lisp_Object tail; |
Lisp_Object tail; |
6396 |
|
|
6397 |
|
if (VECTORP (eol_type)) |
6398 |
|
{ |
6399 |
|
if (mask & ~CATEGORY_MASK_UTF_16) |
6400 |
|
normal_eol = detect_eol (coding.source, src_bytes, |
6401 |
|
coding_category_raw_text); |
6402 |
|
if (mask & (CATEGORY_MASK_UTF_16_BE | CATEGORY_MASK_UTF_16_BE_NOSIG)) |
6403 |
|
utf_16_be_eol = detect_eol (coding.source, src_bytes, |
6404 |
|
coding_category_utf_16_be); |
6405 |
|
if (mask & (CATEGORY_MASK_UTF_16_LE | CATEGORY_MASK_UTF_16_LE_NOSIG)) |
6406 |
|
utf_16_le_eol = detect_eol (coding.source, src_bytes, |
6407 |
|
coding_category_utf_16_le); |
6408 |
|
} |
6409 |
|
else |
6410 |
|
{ |
6411 |
|
if (EQ (eol_type, Qunix)) |
6412 |
|
normal_eol = utf_16_be_eol = utf_16_le_eol = EOL_SEEN_LF; |
6413 |
|
else if (EQ (eol_type, Qdos)) |
6414 |
|
normal_eol = utf_16_be_eol = utf_16_le_eol = EOL_SEEN_CRLF; |
6415 |
|
else |
6416 |
|
normal_eol = utf_16_be_eol = utf_16_le_eol = EOL_SEEN_CR; |
6417 |
|
} |
6418 |
|
|
6419 |
for (tail = val; CONSP (tail); tail = XCDR (tail)) |
for (tail = val; CONSP (tail); tail = XCDR (tail)) |
6420 |
{ |
{ |
6421 |
struct coding_system *this |
enum coding_category category; |
|
= (NILP (coding_system) ? coding_categories + XINT (XCAR (tail)) |
|
|
: &coding); |
|
6422 |
int this_eol; |
int this_eol; |
6423 |
|
|
6424 |
attrs = CODING_ID_ATTRS (this->id); |
id = XINT (XCAR (tail)); |
6425 |
eol_type = CODING_ID_EOL_TYPE (this->id); |
attrs = CODING_ID_ATTRS (id); |
6426 |
XSETCAR (tail, CODING_ID_NAME (this->id)); |
category = XINT (CODING_ATTR_CATEGORY (attrs)); |
6427 |
|
eol_type = CODING_ID_EOL_TYPE (id); |
6428 |
if (VECTORP (eol_type)) |
if (VECTORP (eol_type)) |
6429 |
{ |
{ |
6430 |
if (EQ (CODING_ATTR_TYPE (attrs), Qutf_16)) |
if (category == coding_category_utf_16_be |
6431 |
{ |
|| category == coding_category_utf_16_be_nosig) |
6432 |
if (two_byte_eol < 0) |
this_eol = utf_16_be_eol; |
6433 |
two_byte_eol = detect_eol (this, coding.source, src_bytes); |
else if (category == coding_category_utf_16_le |
6434 |
this_eol = two_byte_eol; |
|| category == coding_category_utf_16_le_nosig) |
6435 |
} |
this_eol = utf_16_le_eol; |
6436 |
else |
else |
6437 |
{ |
this_eol = normal_eol; |
6438 |
if (one_byte_eol < 0) |
|
|
one_byte_eol =detect_eol (this, coding.source, src_bytes); |
|
|
this_eol = one_byte_eol; |
|
|
} |
|
6439 |
if (this_eol == EOL_SEEN_LF) |
if (this_eol == EOL_SEEN_LF) |
6440 |
XSETCAR (tail, AREF (eol_type, 0)); |
XSETCAR (tail, AREF (eol_type, 0)); |
6441 |
else if (this_eol == EOL_SEEN_CRLF) |
else if (this_eol == EOL_SEEN_CRLF) |
6442 |
XSETCAR (tail, AREF (eol_type, 1)); |
XSETCAR (tail, AREF (eol_type, 1)); |
6443 |
else if (this_eol == EOL_SEEN_CR) |
else if (this_eol == EOL_SEEN_CR) |
6444 |
XSETCAR (tail, AREF (eol_type, 2)); |
XSETCAR (tail, AREF (eol_type, 2)); |
6445 |
|
else |
6446 |
|
XSETCAR (tail, CODING_ID_NAME (id)); |
6447 |
} |
} |
6448 |
|
else |
6449 |
|
XSETCAR (tail, CODING_ID_NAME (id)); |
6450 |
} |
} |
6451 |
} |
} |
6452 |
|
|