Mercurial > hg > xemacs-beta
comparison src/file-coding.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 | 3a7e78e1142d |
children | 8de8e3f6228a |
comparison
equal
deleted
inserted
replaced
437:e2a4e8b94b82 | 438:84b14dcb0985 |
---|---|
422 break; | 422 break; |
423 } | 423 } |
424 } | 424 } |
425 } | 425 } |
426 | 426 |
427 static enum eol_type | 427 static eol_type_t |
428 symbol_to_eol_type (Lisp_Object symbol) | 428 symbol_to_eol_type (Lisp_Object symbol) |
429 { | 429 { |
430 CHECK_SYMBOL (symbol); | 430 CHECK_SYMBOL (symbol); |
431 if (NILP (symbol)) return EOL_AUTODETECT; | 431 if (NILP (symbol)) return EOL_AUTODETECT; |
432 if (EQ (symbol, Qlf)) return EOL_LF; | 432 if (EQ (symbol, Qlf)) return EOL_LF; |
436 signal_simple_error ("Unrecognized eol type", symbol); | 436 signal_simple_error ("Unrecognized eol type", symbol); |
437 return EOL_AUTODETECT; /* not reached */ | 437 return EOL_AUTODETECT; /* not reached */ |
438 } | 438 } |
439 | 439 |
440 static Lisp_Object | 440 static Lisp_Object |
441 eol_type_to_symbol (enum eol_type type) | 441 eol_type_to_symbol (eol_type_t type) |
442 { | 442 { |
443 switch (type) | 443 switch (type) |
444 { | 444 { |
445 default: abort (); | 445 default: abort (); |
446 case EOL_LF: return Qlf; | 446 case EOL_LF: return Qlf; |
1057 meaningful or nothing at all. */ | 1057 meaningful or nothing at all. */ |
1058 return Qnil; | 1058 return Qnil; |
1059 } | 1059 } |
1060 | 1060 |
1061 static Lisp_Object | 1061 static Lisp_Object |
1062 subsidiary_coding_system (Lisp_Object coding_system, enum eol_type type) | 1062 subsidiary_coding_system (Lisp_Object coding_system, eol_type_t type) |
1063 { | 1063 { |
1064 Lisp_Coding_System *cs = XCODING_SYSTEM (coding_system); | 1064 Lisp_Coding_System *cs = XCODING_SYSTEM (coding_system); |
1065 Lisp_Object new_coding_system; | 1065 Lisp_Object new_coding_system; |
1066 | 1066 |
1067 if (CODING_SYSTEM_EOL_TYPE (cs) != EOL_AUTODETECT) | 1067 if (CODING_SYSTEM_EOL_TYPE (cs) != EOL_AUTODETECT) |
1398 /* Detecting the encoding of data */ | 1398 /* Detecting the encoding of data */ |
1399 /************************************************************************/ | 1399 /************************************************************************/ |
1400 | 1400 |
1401 struct detection_state | 1401 struct detection_state |
1402 { | 1402 { |
1403 enum eol_type eol_type; | 1403 eol_type_t eol_type; |
1404 int seen_non_ascii; | 1404 int seen_non_ascii; |
1405 int mask; | 1405 int mask; |
1406 #ifdef MULE | 1406 #ifdef MULE |
1407 struct | 1407 struct |
1408 { | 1408 { |
1479 /* Perhaps the only thing useful you learn from intensive Microsoft | 1479 /* Perhaps the only thing useful you learn from intensive Microsoft |
1480 technical interviews */ | 1480 technical interviews */ |
1481 return (mask & (mask - 1)) == 0; | 1481 return (mask & (mask - 1)) == 0; |
1482 } | 1482 } |
1483 | 1483 |
1484 static enum eol_type | 1484 static eol_type_t |
1485 detect_eol_type (struct detection_state *st, CONST unsigned char *src, | 1485 detect_eol_type (struct detection_state *st, CONST unsigned char *src, |
1486 unsigned int n) | 1486 unsigned int n) |
1487 { | 1487 { |
1488 int c; | 1488 int c; |
1489 | 1489 |
1641 | 1641 |
1642 #define LENGTH(string_constant) (sizeof (string_constant) - 1) | 1642 #define LENGTH(string_constant) (sizeof (string_constant) - 1) |
1643 | 1643 |
1644 void | 1644 void |
1645 determine_real_coding_system (Lstream *stream, Lisp_Object *codesys_in_out, | 1645 determine_real_coding_system (Lstream *stream, Lisp_Object *codesys_in_out, |
1646 enum eol_type *eol_type_in_out) | 1646 eol_type_t *eol_type_in_out) |
1647 { | 1647 { |
1648 struct detection_state decst; | 1648 struct detection_state decst; |
1649 | 1649 |
1650 if (*eol_type_in_out == EOL_AUTODETECT) | 1650 if (*eol_type_in_out == EOL_AUTODETECT) |
1651 *eol_type_in_out = XCODING_SYSTEM_EOL_TYPE (*codesys_in_out); | 1651 *eol_type_in_out = XCODING_SYSTEM_EOL_TYPE (*codesys_in_out); |
1944 /* EOL_TYPE specifies the type of end-of-line conversion that | 1944 /* EOL_TYPE specifies the type of end-of-line conversion that |
1945 currently applies. We need to keep this separate from the | 1945 currently applies. We need to keep this separate from the |
1946 EOL type stored in CODESYS because the latter might indicate | 1946 EOL type stored in CODESYS because the latter might indicate |
1947 automatic EOL-type detection while the former will always | 1947 automatic EOL-type detection while the former will always |
1948 indicate a particular EOL type. */ | 1948 indicate a particular EOL type. */ |
1949 enum eol_type eol_type; | 1949 eol_type_t eol_type; |
1950 #ifdef MULE | 1950 #ifdef MULE |
1951 /* Additional ISO2022 information. We define the structure above | 1951 /* Additional ISO2022 information. We define the structure above |
1952 because it's also needed by the detection routines. */ | 1952 because it's also needed by the detection routines. */ |
1953 struct iso2022_decoder iso2022; | 1953 struct iso2022_decoder iso2022; |
1954 | 1954 |