Mercurial > emacs
comparison src/coding.c @ 45396:cab845213388
* coding.c (Fread_coding_system, code_convert_region1)
(code_convert_string1, code_convert_string_norecord)
(Ffind_operation_coding_system): Use SYMBOL_NAME instead of
XSYMBOL and name field.
| author | Ken Raeburn <raeburn@raeburn.org> |
|---|---|
| date | Mon, 20 May 2002 08:05:15 +0000 |
| parents | 6a20d4c6bb78 |
| children | e513f55424f6 |
comparison
equal
deleted
inserted
replaced
| 45395:89c5ebcbb7fd | 45396:cab845213388 |
|---|---|
| 6168 (prompt, default_coding_system) | 6168 (prompt, default_coding_system) |
| 6169 Lisp_Object prompt, default_coding_system; | 6169 Lisp_Object prompt, default_coding_system; |
| 6170 { | 6170 { |
| 6171 Lisp_Object val; | 6171 Lisp_Object val; |
| 6172 if (SYMBOLP (default_coding_system)) | 6172 if (SYMBOLP (default_coding_system)) |
| 6173 XSETSTRING (default_coding_system, XSYMBOL (default_coding_system)->name); | 6173 default_coding_system = SYMBOL_NAME (default_coding_system); |
| 6174 val = Fcompleting_read (prompt, Vcoding_system_alist, Qnil, | 6174 val = Fcompleting_read (prompt, Vcoding_system_alist, Qnil, |
| 6175 Qt, Qnil, Qcoding_system_history, | 6175 Qt, Qnil, Qcoding_system_history, |
| 6176 default_coding_system, Qnil); | 6176 default_coding_system, Qnil); |
| 6177 return (XSTRING (val)->size == 0 ? Qnil : Fintern (val, Qnil)); | 6177 return (XSTRING (val)->size == 0 ? Qnil : Fintern (val, Qnil)); |
| 6178 } | 6178 } |
| 6504 | 6504 |
| 6505 if (NILP (coding_system)) | 6505 if (NILP (coding_system)) |
| 6506 return make_number (to - from); | 6506 return make_number (to - from); |
| 6507 | 6507 |
| 6508 if (setup_coding_system (Fcheck_coding_system (coding_system), &coding) < 0) | 6508 if (setup_coding_system (Fcheck_coding_system (coding_system), &coding) < 0) |
| 6509 error ("Invalid coding system: %s", XSYMBOL (coding_system)->name->data); | 6509 error ("Invalid coding system: %s", XSTRING (SYMBOL_NAME (coding_system))->data); |
| 6510 | 6510 |
| 6511 coding.mode |= CODING_MODE_LAST_BLOCK; | 6511 coding.mode |= CODING_MODE_LAST_BLOCK; |
| 6512 coding.src_multibyte = coding.dst_multibyte | 6512 coding.src_multibyte = coding.dst_multibyte |
| 6513 = !NILP (current_buffer->enable_multibyte_characters); | 6513 = !NILP (current_buffer->enable_multibyte_characters); |
| 6514 code_convert_region (from, CHAR_TO_BYTE (from), to, CHAR_TO_BYTE (to), | 6514 code_convert_region (from, CHAR_TO_BYTE (from), to, CHAR_TO_BYTE (to), |
| 6559 | 6559 |
| 6560 if (NILP (coding_system)) | 6560 if (NILP (coding_system)) |
| 6561 return (NILP (nocopy) ? Fcopy_sequence (string) : string); | 6561 return (NILP (nocopy) ? Fcopy_sequence (string) : string); |
| 6562 | 6562 |
| 6563 if (setup_coding_system (Fcheck_coding_system (coding_system), &coding) < 0) | 6563 if (setup_coding_system (Fcheck_coding_system (coding_system), &coding) < 0) |
| 6564 error ("Invalid coding system: %s", XSYMBOL (coding_system)->name->data); | 6564 error ("Invalid coding system: %s", XSTRING (SYMBOL_NAME (coding_system))->data); |
| 6565 | 6565 |
| 6566 coding.mode |= CODING_MODE_LAST_BLOCK; | 6566 coding.mode |= CODING_MODE_LAST_BLOCK; |
| 6567 string = (encodep | 6567 string = (encodep |
| 6568 ? encode_coding_string (string, &coding, !NILP (nocopy)) | 6568 ? encode_coding_string (string, &coding, !NILP (nocopy)) |
| 6569 : decode_coding_string (string, &coding, !NILP (nocopy))); | 6569 : decode_coding_string (string, &coding, !NILP (nocopy))); |
| 6618 | 6618 |
| 6619 if (NILP (coding_system)) | 6619 if (NILP (coding_system)) |
| 6620 return string; | 6620 return string; |
| 6621 | 6621 |
| 6622 if (setup_coding_system (Fcheck_coding_system (coding_system), &coding) < 0) | 6622 if (setup_coding_system (Fcheck_coding_system (coding_system), &coding) < 0) |
| 6623 error ("Invalid coding system: %s", XSYMBOL (coding_system)->name->data); | 6623 error ("Invalid coding system: %s", XSTRING (SYMBOL_NAME (coding_system))->data); |
| 6624 | 6624 |
| 6625 coding.composing = COMPOSITION_DISABLED; | 6625 coding.composing = COMPOSITION_DISABLED; |
| 6626 coding.mode |= CODING_MODE_LAST_BLOCK; | 6626 coding.mode |= CODING_MODE_LAST_BLOCK; |
| 6627 return (encodep | 6627 return (encodep |
| 6628 ? encode_coding_string (string, &coding, 1) | 6628 ? encode_coding_string (string, &coding, 1) |
| 6863 if (!SYMBOLP (operation) | 6863 if (!SYMBOLP (operation) |
| 6864 || !INTEGERP (target_idx = Fget (operation, Qtarget_idx))) | 6864 || !INTEGERP (target_idx = Fget (operation, Qtarget_idx))) |
| 6865 error ("Invalid first argument"); | 6865 error ("Invalid first argument"); |
| 6866 if (nargs < 1 + XINT (target_idx)) | 6866 if (nargs < 1 + XINT (target_idx)) |
| 6867 error ("Too few arguments for operation: %s", | 6867 error ("Too few arguments for operation: %s", |
| 6868 XSYMBOL (operation)->name->data); | 6868 XSTRING (SYMBOL_NAME (operation))->data); |
| 6869 target = args[XINT (target_idx) + 1]; | 6869 target = args[XINT (target_idx) + 1]; |
| 6870 if (!(STRINGP (target) | 6870 if (!(STRINGP (target) |
| 6871 || (EQ (operation, Qopen_network_stream) && INTEGERP (target)))) | 6871 || (EQ (operation, Qopen_network_stream) && INTEGERP (target)))) |
| 6872 error ("Invalid argument %d", XINT (target_idx) + 1); | 6872 error ("Invalid argument %d", XINT (target_idx) + 1); |
| 6873 | 6873 |
