Mercurial > emacs
comparison src/coding.c @ 83516:1321f6cfb389
Merged from emacs@sv.gnu.org
Patches applied:
* emacs@sv.gnu.org/emacs--devo--0--patch-266
Update from CVS
* emacs@sv.gnu.org/emacs--devo--0--patch-267
Update from CVS
* emacs@sv.gnu.org/emacs--devo--0--patch-268
Update from CVS
* emacs@sv.gnu.org/emacs--devo--0--patch-269
Update from CVS
* emacs@sv.gnu.org/emacs--devo--0--patch-270
Update from CVS
* emacs@sv.gnu.org/emacs--devo--0--patch-271
Rename "field-at-point" to "field-at-pos"
* emacs@sv.gnu.org/emacs--devo--0--patch-272
(comint-insert-input): Remove redundant calls to setq and goto-char
git-archimport-id: lorentey@elte.hu--2004/emacs--multi-tty--0--patch-556
| author | Karoly Lorentey <lorentey@elte.hu> |
|---|---|
| date | Wed, 10 May 2006 15:04:01 +0000 |
| parents | 2d2f6f096f6e b6740a317343 |
| children | ab6ab63755f7 |
comparison
equal
deleted
inserted
replaced
| 83515:f7a396df2380 | 83516:1321f6cfb389 |
|---|---|
| 384 /* Mnemonic string to indicate format of end-of-line is not yet | 384 /* Mnemonic string to indicate format of end-of-line is not yet |
| 385 decided. */ | 385 decided. */ |
| 386 Lisp_Object eol_mnemonic_undecided; | 386 Lisp_Object eol_mnemonic_undecided; |
| 387 | 387 |
| 388 /* Format of end-of-line decided by system. This is CODING_EOL_LF on | 388 /* Format of end-of-line decided by system. This is CODING_EOL_LF on |
| 389 Unix, CODING_EOL_CRLF on DOS/Windows, and CODING_EOL_CR on Mac. */ | 389 Unix, CODING_EOL_CRLF on DOS/Windows, and CODING_EOL_CR on Mac. |
| 390 This has an effect only for external encoding (i.e. for output to | |
| 391 file and process), not for in-buffer or Lisp string encoding. */ | |
| 390 int system_eol_type; | 392 int system_eol_type; |
| 391 | 393 |
| 392 #ifdef emacs | 394 #ifdef emacs |
| 393 | 395 |
| 394 /* Information about which coding system is safe for which chars. | 396 /* Information about which coding system is safe for which chars. |
| 3918 | 3920 |
| 3919 label_invalid_coding_system: | 3921 label_invalid_coding_system: |
| 3920 coding->type = coding_type_no_conversion; | 3922 coding->type = coding_type_no_conversion; |
| 3921 coding->category_idx = CODING_CATEGORY_IDX_BINARY; | 3923 coding->category_idx = CODING_CATEGORY_IDX_BINARY; |
| 3922 coding->common_flags = 0; | 3924 coding->common_flags = 0; |
| 3923 coding->eol_type = NILP (coding_system) ? system_eol_type : CODING_EOL_LF; | 3925 coding->eol_type = CODING_EOL_UNDECIDED; |
| 3924 if (coding->eol_type != CODING_EOL_LF) | |
| 3925 coding->common_flags | |
| 3926 |= CODING_REQUIRE_DECODING_MASK | CODING_REQUIRE_ENCODING_MASK; | |
| 3927 coding->pre_write_conversion = coding->post_read_conversion = Qnil; | 3926 coding->pre_write_conversion = coding->post_read_conversion = Qnil; |
| 3928 return NILP (coding_system) ? 0 : -1; | 3927 return NILP (coding_system) ? 0 : -1; |
| 3929 } | 3928 } |
| 3930 | 3929 |
| 3931 /* Free memory blocks allocated for storing composition information. */ | 3930 /* Free memory blocks allocated for storing composition information. */ |
| 4998 coding->produced = coding->produced_char = 0; | 4997 coding->produced = coding->produced_char = 0; |
| 4999 coding->consumed = coding->consumed_char = 0; | 4998 coding->consumed = coding->consumed_char = 0; |
| 5000 coding->errors = 0; | 4999 coding->errors = 0; |
| 5001 coding->result = CODING_FINISH_NORMAL; | 5000 coding->result = CODING_FINISH_NORMAL; |
| 5002 if (coding->eol_type == CODING_EOL_UNDECIDED) | 5001 if (coding->eol_type == CODING_EOL_UNDECIDED) |
| 5003 coding->eol_type = system_eol_type; | 5002 coding->eol_type = CODING_EOL_LF; |
| 5004 | 5003 |
| 5005 switch (coding->type) | 5004 switch (coding->type) |
| 5006 { | 5005 { |
| 5007 case coding_type_sjis: | 5006 case coding_type_sjis: |
| 5008 encode_coding_sjis_big5 (coding, source, destination, | 5007 encode_coding_sjis_big5 (coding, source, destination, |
| 5255 Lisp_Object translation_table; | 5254 Lisp_Object translation_table; |
| 5256 | 5255 |
| 5257 if (coding->type == coding_type_ccl | 5256 if (coding->type == coding_type_ccl |
| 5258 || coding->eol_type == CODING_EOL_CRLF | 5257 || coding->eol_type == CODING_EOL_CRLF |
| 5259 || coding->eol_type == CODING_EOL_CR | 5258 || coding->eol_type == CODING_EOL_CR |
| 5260 || (coding->eol_type == CODING_EOL_UNDECIDED | |
| 5261 && system_eol_type != CODING_EOL_LF) | |
| 5262 || (coding->cmp_data && coding->cmp_data->used > 0)) | 5259 || (coding->cmp_data && coding->cmp_data->used > 0)) |
| 5263 { | 5260 { |
| 5264 /* We can't skip any data. */ | 5261 /* We can't skip any data. */ |
| 5265 return; | 5262 return; |
| 5266 } | 5263 } |
| 7112 | 7109 |
| 7113 validate_region (&start, &end); | 7110 validate_region (&start, &end); |
| 7114 from = XFASTINT (start); | 7111 from = XFASTINT (start); |
| 7115 to = XFASTINT (end); | 7112 to = XFASTINT (end); |
| 7116 | 7113 |
| 7117 if (NILP (coding_system) && system_eol_type == CODING_EOL_LF) | 7114 if (NILP (coding_system)) |
| 7118 return make_number (to - from); | 7115 return make_number (to - from); |
| 7119 | 7116 |
| 7120 if (setup_coding_system (Fcheck_coding_system (coding_system), &coding) < 0) | 7117 if (setup_coding_system (Fcheck_coding_system (coding_system), &coding) < 0) |
| 7121 error ("Invalid coding system: %s", SDATA (SYMBOL_NAME (coding_system))); | 7118 error ("Invalid coding system: %s", SDATA (SYMBOL_NAME (coding_system))); |
| 7122 | 7119 |
| 7167 struct coding_system coding; | 7164 struct coding_system coding; |
| 7168 | 7165 |
| 7169 CHECK_STRING (string); | 7166 CHECK_STRING (string); |
| 7170 CHECK_SYMBOL (coding_system); | 7167 CHECK_SYMBOL (coding_system); |
| 7171 | 7168 |
| 7172 if (NILP (coding_system) && system_eol_type == CODING_EOL_LF) | 7169 if (NILP (coding_system)) |
| 7173 return (NILP (nocopy) ? Fcopy_sequence (string) : string); | 7170 return (NILP (nocopy) ? Fcopy_sequence (string) : string); |
| 7174 | 7171 |
| 7175 if (setup_coding_system (Fcheck_coding_system (coding_system), &coding) < 0) | 7172 if (setup_coding_system (Fcheck_coding_system (coding_system), &coding) < 0) |
| 7176 error ("Invalid coding system: %s", SDATA (SYMBOL_NAME (coding_system))); | 7173 error ("Invalid coding system: %s", SDATA (SYMBOL_NAME (coding_system))); |
| 7177 | 7174 |
| 7226 struct coding_system coding; | 7223 struct coding_system coding; |
| 7227 | 7224 |
| 7228 CHECK_STRING (string); | 7225 CHECK_STRING (string); |
| 7229 CHECK_SYMBOL (coding_system); | 7226 CHECK_SYMBOL (coding_system); |
| 7230 | 7227 |
| 7231 if (NILP (coding_system) && system_eol_type == CODING_EOL_LF) | 7228 if (NILP (coding_system)) |
| 7232 return string; | 7229 return string; |
| 7233 | 7230 |
| 7234 if (setup_coding_system (Fcheck_coding_system (coding_system), &coding) < 0) | 7231 if (setup_coding_system (Fcheck_coding_system (coding_system), &coding) < 0) |
| 7235 error ("Invalid coding system: %s", SDATA (SYMBOL_NAME (coding_system))); | 7232 error ("Invalid coding system: %s", SDATA (SYMBOL_NAME (coding_system))); |
| 7236 | 7233 |
