Mercurial > emacs
comparison src/coding.c @ 46370:40db0673e6f0
Most uses of XSTRING combined with STRING_BYTES or indirection changed to
SCHARS, SBYTES, STRING_INTERVALS, SREF, SDATA; explicit size_byte references
left unchanged for now.
| author | Ken Raeburn <raeburn@raeburn.org> |
|---|---|
| date | Mon, 15 Jul 2002 00:00:41 +0000 |
| parents | 1fb8f75062c6 |
| children | c6bb99a483e0 |
comparison
equal
deleted
inserted
replaced
| 46369:dd1d3b1d0053 | 46370:40db0673e6f0 |
|---|---|
| 5222 CODING_ADD_COMPOSITION_COMPONENT (coding, XINT (ch)); | 5222 CODING_ADD_COMPOSITION_COMPONENT (coding, XINT (ch)); |
| 5223 } | 5223 } |
| 5224 else if (VECTORP (val) || STRINGP (val)) | 5224 else if (VECTORP (val) || STRINGP (val)) |
| 5225 { | 5225 { |
| 5226 int len = (VECTORP (val) | 5226 int len = (VECTORP (val) |
| 5227 ? XVECTOR (val)->size : XSTRING (val)->size); | 5227 ? XVECTOR (val)->size : SCHARS (val)); |
| 5228 int i; | 5228 int i; |
| 5229 for (i = 0; i < len; i++) | 5229 for (i = 0; i < len; i++) |
| 5230 { | 5230 { |
| 5231 ch = (STRINGP (val) | 5231 ch = (STRINGP (val) |
| 5232 ? Faref (val, make_number (i)) | 5232 ? Faref (val, make_number (i)) |
| 5830 multibyteness of the working buffer to that of STR. */ | 5830 multibyteness of the working buffer to that of STR. */ |
| 5831 Ferase_buffer (); | 5831 Ferase_buffer (); |
| 5832 buf->enable_multibyte_characters = multibyte ? Qt : Qnil; | 5832 buf->enable_multibyte_characters = multibyte ? Qt : Qnil; |
| 5833 | 5833 |
| 5834 insert_from_string (str, 0, 0, | 5834 insert_from_string (str, 0, 0, |
| 5835 XSTRING (str)->size, STRING_BYTES (XSTRING (str)), 0); | 5835 SCHARS (str), SBYTES (str), 0); |
| 5836 UNGCPRO; | 5836 UNGCPRO; |
| 5837 inhibit_pre_post_conversion = 1; | 5837 inhibit_pre_post_conversion = 1; |
| 5838 if (encodep) | 5838 if (encodep) |
| 5839 call2 (coding->pre_write_conversion, make_number (BEG), make_number (Z)); | 5839 call2 (coding->pre_write_conversion, make_number (BEG), make_number (Z)); |
| 5840 else | 5840 else |
| 5862 int shrinked_bytes = 0; | 5862 int shrinked_bytes = 0; |
| 5863 Lisp_Object newstr; | 5863 Lisp_Object newstr; |
| 5864 int consumed, consumed_char, produced, produced_char; | 5864 int consumed, consumed_char, produced, produced_char; |
| 5865 | 5865 |
| 5866 from = 0; | 5866 from = 0; |
| 5867 to_byte = STRING_BYTES (XSTRING (str)); | 5867 to_byte = SBYTES (str); |
| 5868 | 5868 |
| 5869 saved_coding_symbol = coding->symbol; | 5869 saved_coding_symbol = coding->symbol; |
| 5870 coding->src_multibyte = STRING_MULTIBYTE (str); | 5870 coding->src_multibyte = STRING_MULTIBYTE (str); |
| 5871 coding->dst_multibyte = 1; | 5871 coding->dst_multibyte = 1; |
| 5872 if (CODING_REQUIRE_DETECTION (coding)) | 5872 if (CODING_REQUIRE_DETECTION (coding)) |
| 5873 { | 5873 { |
| 5874 /* See the comments in code_convert_region. */ | 5874 /* See the comments in code_convert_region. */ |
| 5875 if (coding->type == coding_type_undecided) | 5875 if (coding->type == coding_type_undecided) |
| 5876 { | 5876 { |
| 5877 detect_coding (coding, XSTRING (str)->data, to_byte); | 5877 detect_coding (coding, SDATA (str), to_byte); |
| 5878 if (coding->type == coding_type_undecided) | 5878 if (coding->type == coding_type_undecided) |
| 5879 { | 5879 { |
| 5880 coding->type = coding_type_emacs_mule; | 5880 coding->type = coding_type_emacs_mule; |
| 5881 coding->category_idx = CODING_CATEGORY_IDX_EMACS_MULE; | 5881 coding->category_idx = CODING_CATEGORY_IDX_EMACS_MULE; |
| 5882 /* As emacs-mule decoder will handle composition, we | 5882 /* As emacs-mule decoder will handle composition, we |
| 5887 } | 5887 } |
| 5888 if (coding->eol_type == CODING_EOL_UNDECIDED | 5888 if (coding->eol_type == CODING_EOL_UNDECIDED |
| 5889 && coding->type != coding_type_ccl) | 5889 && coding->type != coding_type_ccl) |
| 5890 { | 5890 { |
| 5891 saved_coding_symbol = coding->symbol; | 5891 saved_coding_symbol = coding->symbol; |
| 5892 detect_eol (coding, XSTRING (str)->data, to_byte); | 5892 detect_eol (coding, SDATA (str), to_byte); |
| 5893 if (coding->eol_type == CODING_EOL_UNDECIDED) | 5893 if (coding->eol_type == CODING_EOL_UNDECIDED) |
| 5894 coding->eol_type = CODING_EOL_LF; | 5894 coding->eol_type = CODING_EOL_LF; |
| 5895 /* We had better recover the original eol format if we | 5895 /* We had better recover the original eol format if we |
| 5896 encounter an inconsistent eol format while decoding. */ | 5896 encounter an inconsistent eol format while decoding. */ |
| 5897 coding->mode |= CODING_MODE_INHIBIT_INCONSISTENT_EOL; | 5897 coding->mode |= CODING_MODE_INHIBIT_INCONSISTENT_EOL; |
| 5906 | 5906 |
| 5907 if (STRING_MULTIBYTE (str)) | 5907 if (STRING_MULTIBYTE (str)) |
| 5908 { | 5908 { |
| 5909 /* Decoding routines expect the source text to be unibyte. */ | 5909 /* Decoding routines expect the source text to be unibyte. */ |
| 5910 str = Fstring_as_unibyte (str); | 5910 str = Fstring_as_unibyte (str); |
| 5911 to_byte = STRING_BYTES (XSTRING (str)); | 5911 to_byte = SBYTES (str); |
| 5912 nocopy = 1; | 5912 nocopy = 1; |
| 5913 coding->src_multibyte = 0; | 5913 coding->src_multibyte = 0; |
| 5914 } | 5914 } |
| 5915 | 5915 |
| 5916 /* Try to skip the heading and tailing ASCIIs. */ | 5916 /* Try to skip the heading and tailing ASCIIs. */ |
| 5917 if (require_decoding && coding->type != coding_type_ccl) | 5917 if (require_decoding && coding->type != coding_type_ccl) |
| 5918 { | 5918 { |
| 5919 SHRINK_CONVERSION_REGION (&from, &to_byte, coding, XSTRING (str)->data, | 5919 SHRINK_CONVERSION_REGION (&from, &to_byte, coding, SDATA (str), |
| 5920 0); | 5920 0); |
| 5921 if (from == to_byte) | 5921 if (from == to_byte) |
| 5922 require_decoding = 0; | 5922 require_decoding = 0; |
| 5923 shrinked_bytes = from + (STRING_BYTES (XSTRING (str)) - to_byte); | 5923 shrinked_bytes = from + (SBYTES (str) - to_byte); |
| 5924 } | 5924 } |
| 5925 | 5925 |
| 5926 if (!require_decoding) | 5926 if (!require_decoding) |
| 5927 { | 5927 { |
| 5928 coding->consumed = STRING_BYTES (XSTRING (str)); | 5928 coding->consumed = SBYTES (str); |
| 5929 coding->consumed_char = XSTRING (str)->size; | 5929 coding->consumed_char = SCHARS (str); |
| 5930 if (coding->dst_multibyte) | 5930 if (coding->dst_multibyte) |
| 5931 { | 5931 { |
| 5932 str = Fstring_as_multibyte (str); | 5932 str = Fstring_as_multibyte (str); |
| 5933 nocopy = 1; | 5933 nocopy = 1; |
| 5934 } | 5934 } |
| 5935 coding->produced = STRING_BYTES (XSTRING (str)); | 5935 coding->produced = SBYTES (str); |
| 5936 coding->produced_char = XSTRING (str)->size; | 5936 coding->produced_char = SCHARS (str); |
| 5937 return (nocopy ? str : Fcopy_sequence (str)); | 5937 return (nocopy ? str : Fcopy_sequence (str)); |
| 5938 } | 5938 } |
| 5939 | 5939 |
| 5940 if (coding->composing != COMPOSITION_DISABLED) | 5940 if (coding->composing != COMPOSITION_DISABLED) |
| 5941 coding_allocate_composition_data (coding, from); | 5941 coding_allocate_composition_data (coding, from); |
| 5943 allocate_conversion_buffer (buf, len); | 5943 allocate_conversion_buffer (buf, len); |
| 5944 | 5944 |
| 5945 consumed = consumed_char = produced = produced_char = 0; | 5945 consumed = consumed_char = produced = produced_char = 0; |
| 5946 while (1) | 5946 while (1) |
| 5947 { | 5947 { |
| 5948 result = decode_coding (coding, XSTRING (str)->data + from + consumed, | 5948 result = decode_coding (coding, SDATA (str) + from + consumed, |
| 5949 buf.data + produced, to_byte - from - consumed, | 5949 buf.data + produced, to_byte - from - consumed, |
| 5950 buf.size - produced); | 5950 buf.size - produced); |
| 5951 consumed += coding->consumed; | 5951 consumed += coding->consumed; |
| 5952 consumed_char += coding->consumed_char; | 5952 consumed_char += coding->consumed_char; |
| 5953 produced += coding->produced; | 5953 produced += coding->produced; |
| 6012 newstr = make_uninit_multibyte_string (produced_char + shrinked_bytes, | 6012 newstr = make_uninit_multibyte_string (produced_char + shrinked_bytes, |
| 6013 produced + shrinked_bytes); | 6013 produced + shrinked_bytes); |
| 6014 else | 6014 else |
| 6015 newstr = make_uninit_string (produced + shrinked_bytes); | 6015 newstr = make_uninit_string (produced + shrinked_bytes); |
| 6016 if (from > 0) | 6016 if (from > 0) |
| 6017 bcopy (XSTRING (str)->data, XSTRING (newstr)->data, from); | 6017 bcopy (SDATA (str), SDATA (newstr), from); |
| 6018 bcopy (buf.data, XSTRING (newstr)->data + from, produced); | 6018 bcopy (buf.data, SDATA (newstr) + from, produced); |
| 6019 if (shrinked_bytes > from) | 6019 if (shrinked_bytes > from) |
| 6020 bcopy (XSTRING (str)->data + to_byte, | 6020 bcopy (SDATA (str) + to_byte, |
| 6021 XSTRING (newstr)->data + from + produced, | 6021 SDATA (newstr) + from + produced, |
| 6022 shrinked_bytes - from); | 6022 shrinked_bytes - from); |
| 6023 free_conversion_buffer (&buf); | 6023 free_conversion_buffer (&buf); |
| 6024 | 6024 |
| 6025 if (coding->cmp_data && coding->cmp_data->used) | 6025 if (coding->cmp_data && coding->cmp_data->used) |
| 6026 coding_restore_composition (coding, newstr); | 6026 coding_restore_composition (coding, newstr); |
| 6050 if (SYMBOLP (coding->pre_write_conversion) | 6050 if (SYMBOLP (coding->pre_write_conversion) |
| 6051 && !NILP (Ffboundp (coding->pre_write_conversion))) | 6051 && !NILP (Ffboundp (coding->pre_write_conversion))) |
| 6052 str = run_pre_post_conversion_on_str (str, coding, 1); | 6052 str = run_pre_post_conversion_on_str (str, coding, 1); |
| 6053 | 6053 |
| 6054 from = 0; | 6054 from = 0; |
| 6055 to = XSTRING (str)->size; | 6055 to = SCHARS (str); |
| 6056 to_byte = STRING_BYTES (XSTRING (str)); | 6056 to_byte = SBYTES (str); |
| 6057 | 6057 |
| 6058 /* Encoding routines determine the multibyteness of the source text | 6058 /* Encoding routines determine the multibyteness of the source text |
| 6059 by coding->src_multibyte. */ | 6059 by coding->src_multibyte. */ |
| 6060 coding->src_multibyte = STRING_MULTIBYTE (str); | 6060 coding->src_multibyte = STRING_MULTIBYTE (str); |
| 6061 coding->dst_multibyte = 0; | 6061 coding->dst_multibyte = 0; |
| 6062 if (! CODING_REQUIRE_ENCODING (coding)) | 6062 if (! CODING_REQUIRE_ENCODING (coding)) |
| 6063 { | 6063 { |
| 6064 coding->consumed = STRING_BYTES (XSTRING (str)); | 6064 coding->consumed = SBYTES (str); |
| 6065 coding->consumed_char = XSTRING (str)->size; | 6065 coding->consumed_char = SCHARS (str); |
| 6066 if (STRING_MULTIBYTE (str)) | 6066 if (STRING_MULTIBYTE (str)) |
| 6067 { | 6067 { |
| 6068 str = Fstring_as_unibyte (str); | 6068 str = Fstring_as_unibyte (str); |
| 6069 nocopy = 1; | 6069 nocopy = 1; |
| 6070 } | 6070 } |
| 6071 coding->produced = STRING_BYTES (XSTRING (str)); | 6071 coding->produced = SBYTES (str); |
| 6072 coding->produced_char = XSTRING (str)->size; | 6072 coding->produced_char = SCHARS (str); |
| 6073 return (nocopy ? str : Fcopy_sequence (str)); | 6073 return (nocopy ? str : Fcopy_sequence (str)); |
| 6074 } | 6074 } |
| 6075 | 6075 |
| 6076 if (coding->composing != COMPOSITION_DISABLED) | 6076 if (coding->composing != COMPOSITION_DISABLED) |
| 6077 coding_save_composition (coding, from, to, str); | 6077 coding_save_composition (coding, from, to, str); |
| 6078 | 6078 |
| 6079 /* Try to skip the heading and tailing ASCIIs. */ | 6079 /* Try to skip the heading and tailing ASCIIs. */ |
| 6080 if (coding->type != coding_type_ccl) | 6080 if (coding->type != coding_type_ccl) |
| 6081 { | 6081 { |
| 6082 SHRINK_CONVERSION_REGION (&from, &to_byte, coding, XSTRING (str)->data, | 6082 SHRINK_CONVERSION_REGION (&from, &to_byte, coding, SDATA (str), |
| 6083 1); | 6083 1); |
| 6084 if (from == to_byte) | 6084 if (from == to_byte) |
| 6085 return (nocopy ? str : Fcopy_sequence (str)); | 6085 return (nocopy ? str : Fcopy_sequence (str)); |
| 6086 shrinked_bytes = from + (STRING_BYTES (XSTRING (str)) - to_byte); | 6086 shrinked_bytes = from + (SBYTES (str) - to_byte); |
| 6087 } | 6087 } |
| 6088 | 6088 |
| 6089 len = encoding_buffer_size (coding, to_byte - from); | 6089 len = encoding_buffer_size (coding, to_byte - from); |
| 6090 allocate_conversion_buffer (buf, len); | 6090 allocate_conversion_buffer (buf, len); |
| 6091 | 6091 |
| 6092 consumed = consumed_char = produced = produced_char = 0; | 6092 consumed = consumed_char = produced = produced_char = 0; |
| 6093 while (1) | 6093 while (1) |
| 6094 { | 6094 { |
| 6095 result = encode_coding (coding, XSTRING (str)->data + from + consumed, | 6095 result = encode_coding (coding, SDATA (str) + from + consumed, |
| 6096 buf.data + produced, to_byte - from - consumed, | 6096 buf.data + produced, to_byte - from - consumed, |
| 6097 buf.size - produced); | 6097 buf.size - produced); |
| 6098 consumed += coding->consumed; | 6098 consumed += coding->consumed; |
| 6099 consumed_char += coding->consumed_char; | 6099 consumed_char += coding->consumed_char; |
| 6100 produced += coding->produced; | 6100 produced += coding->produced; |
| 6112 coding->produced = produced; | 6112 coding->produced = produced; |
| 6113 coding->produced_char = produced_char; | 6113 coding->produced_char = produced_char; |
| 6114 | 6114 |
| 6115 newstr = make_uninit_string (produced + shrinked_bytes); | 6115 newstr = make_uninit_string (produced + shrinked_bytes); |
| 6116 if (from > 0) | 6116 if (from > 0) |
| 6117 bcopy (XSTRING (str)->data, XSTRING (newstr)->data, from); | 6117 bcopy (SDATA (str), SDATA (newstr), from); |
| 6118 bcopy (buf.data, XSTRING (newstr)->data + from, produced); | 6118 bcopy (buf.data, SDATA (newstr) + from, produced); |
| 6119 if (shrinked_bytes > from) | 6119 if (shrinked_bytes > from) |
| 6120 bcopy (XSTRING (str)->data + to_byte, | 6120 bcopy (SDATA (str) + to_byte, |
| 6121 XSTRING (newstr)->data + from + produced, | 6121 SDATA (newstr) + from + produced, |
| 6122 shrinked_bytes - from); | 6122 shrinked_bytes - from); |
| 6123 | 6123 |
| 6124 free_conversion_buffer (&buf); | 6124 free_conversion_buffer (&buf); |
| 6125 coding_free_composition_data (coding); | 6125 coding_free_composition_data (coding); |
| 6126 | 6126 |
| 6158 do | 6158 do |
| 6159 { | 6159 { |
| 6160 val = Fcompleting_read (prompt, Vcoding_system_alist, Qnil, | 6160 val = Fcompleting_read (prompt, Vcoding_system_alist, Qnil, |
| 6161 Qt, Qnil, Qcoding_system_history, Qnil, Qnil); | 6161 Qt, Qnil, Qcoding_system_history, Qnil, Qnil); |
| 6162 } | 6162 } |
| 6163 while (XSTRING (val)->size == 0); | 6163 while (SCHARS (val) == 0); |
| 6164 return (Fintern (val, Qnil)); | 6164 return (Fintern (val, Qnil)); |
| 6165 } | 6165 } |
| 6166 | 6166 |
| 6167 DEFUN ("read-coding-system", Fread_coding_system, Sread_coding_system, 1, 2, 0, | 6167 DEFUN ("read-coding-system", Fread_coding_system, Sread_coding_system, 1, 2, 0, |
| 6168 doc: /* Read a coding system from the minibuffer, prompting with string PROMPT. | 6168 doc: /* Read a coding system from the minibuffer, prompting with string PROMPT. |
| 6174 if (SYMBOLP (default_coding_system)) | 6174 if (SYMBOLP (default_coding_system)) |
| 6175 default_coding_system = SYMBOL_NAME (default_coding_system); | 6175 default_coding_system = SYMBOL_NAME (default_coding_system); |
| 6176 val = Fcompleting_read (prompt, Vcoding_system_alist, Qnil, | 6176 val = Fcompleting_read (prompt, Vcoding_system_alist, Qnil, |
| 6177 Qt, Qnil, Qcoding_system_history, | 6177 Qt, Qnil, Qcoding_system_history, |
| 6178 default_coding_system, Qnil); | 6178 default_coding_system, Qnil); |
| 6179 return (XSTRING (val)->size == 0 ? Qnil : Fintern (val, Qnil)); | 6179 return (SCHARS (val) == 0 ? Qnil : Fintern (val, Qnil)); |
| 6180 } | 6180 } |
| 6181 | 6181 |
| 6182 DEFUN ("check-coding-system", Fcheck_coding_system, Scheck_coding_system, | 6182 DEFUN ("check-coding-system", Fcheck_coding_system, Scheck_coding_system, |
| 6183 1, 1, 0, | 6183 1, 1, 0, |
| 6184 doc: /* Check validity of CODING-SYSTEM. | 6184 doc: /* Check validity of CODING-SYSTEM. |
| 6316 (string, highest) | 6316 (string, highest) |
| 6317 Lisp_Object string, highest; | 6317 Lisp_Object string, highest; |
| 6318 { | 6318 { |
| 6319 CHECK_STRING (string); | 6319 CHECK_STRING (string); |
| 6320 | 6320 |
| 6321 return detect_coding_system (XSTRING (string)->data, | 6321 return detect_coding_system (SDATA (string), |
| 6322 /* "+ 1" is to include the anchor byte | 6322 /* "+ 1" is to include the anchor byte |
| 6323 `\0'. With this, code detectors can | 6323 `\0'. With this, code detectors can |
| 6324 handle the tailing bytes more | 6324 handle the tailing bytes more |
| 6325 accurately. */ | 6325 accurately. */ |
| 6326 STRING_BYTES (XSTRING (string)) + 1, | 6326 SBYTES (string) + 1, |
| 6327 !NILP (highest), | 6327 !NILP (highest), |
| 6328 STRING_MULTIBYTE (string)); | 6328 STRING_MULTIBYTE (string)); |
| 6329 } | 6329 } |
| 6330 | 6330 |
| 6331 /* Return an intersection of lists L1 and L2. */ | 6331 /* Return an intersection of lists L1 and L2. */ |
| 6418 | 6418 |
| 6419 if (STRINGP (start)) | 6419 if (STRINGP (start)) |
| 6420 { | 6420 { |
| 6421 if (!STRING_MULTIBYTE (start)) | 6421 if (!STRING_MULTIBYTE (start)) |
| 6422 return Qt; | 6422 return Qt; |
| 6423 p1 = XSTRING (start)->data, p1end = p1 + STRING_BYTES (XSTRING (start)); | 6423 p1 = SDATA (start), p1end = p1 + SBYTES (start); |
| 6424 p2 = p2end = p1end; | 6424 p2 = p2end = p1end; |
| 6425 if (XSTRING (start)->size != STRING_BYTES (XSTRING (start))) | 6425 if (SCHARS (start) != SBYTES (start)) |
| 6426 non_ascii_p = 1; | 6426 non_ascii_p = 1; |
| 6427 } | 6427 } |
| 6428 else | 6428 else |
| 6429 { | 6429 { |
| 6430 int from, to, stop; | 6430 int from, to, stop; |
| 6506 | 6506 |
| 6507 if (NILP (coding_system)) | 6507 if (NILP (coding_system)) |
| 6508 return make_number (to - from); | 6508 return make_number (to - from); |
| 6509 | 6509 |
| 6510 if (setup_coding_system (Fcheck_coding_system (coding_system), &coding) < 0) | 6510 if (setup_coding_system (Fcheck_coding_system (coding_system), &coding) < 0) |
| 6511 error ("Invalid coding system: %s", XSTRING (SYMBOL_NAME (coding_system))->data); | 6511 error ("Invalid coding system: %s", SDATA (SYMBOL_NAME (coding_system))); |
| 6512 | 6512 |
| 6513 coding.mode |= CODING_MODE_LAST_BLOCK; | 6513 coding.mode |= CODING_MODE_LAST_BLOCK; |
| 6514 coding.src_multibyte = coding.dst_multibyte | 6514 coding.src_multibyte = coding.dst_multibyte |
| 6515 = !NILP (current_buffer->enable_multibyte_characters); | 6515 = !NILP (current_buffer->enable_multibyte_characters); |
| 6516 code_convert_region (from, CHAR_TO_BYTE (from), to, CHAR_TO_BYTE (to), | 6516 code_convert_region (from, CHAR_TO_BYTE (from), to, CHAR_TO_BYTE (to), |
| 6561 | 6561 |
| 6562 if (NILP (coding_system)) | 6562 if (NILP (coding_system)) |
| 6563 return (NILP (nocopy) ? Fcopy_sequence (string) : string); | 6563 return (NILP (nocopy) ? Fcopy_sequence (string) : string); |
| 6564 | 6564 |
| 6565 if (setup_coding_system (Fcheck_coding_system (coding_system), &coding) < 0) | 6565 if (setup_coding_system (Fcheck_coding_system (coding_system), &coding) < 0) |
| 6566 error ("Invalid coding system: %s", XSTRING (SYMBOL_NAME (coding_system))->data); | 6566 error ("Invalid coding system: %s", SDATA (SYMBOL_NAME (coding_system))); |
| 6567 | 6567 |
| 6568 coding.mode |= CODING_MODE_LAST_BLOCK; | 6568 coding.mode |= CODING_MODE_LAST_BLOCK; |
| 6569 string = (encodep | 6569 string = (encodep |
| 6570 ? encode_coding_string (string, &coding, !NILP (nocopy)) | 6570 ? encode_coding_string (string, &coding, !NILP (nocopy)) |
| 6571 : decode_coding_string (string, &coding, !NILP (nocopy))); | 6571 : decode_coding_string (string, &coding, !NILP (nocopy))); |
| 6620 | 6620 |
| 6621 if (NILP (coding_system)) | 6621 if (NILP (coding_system)) |
| 6622 return string; | 6622 return string; |
| 6623 | 6623 |
| 6624 if (setup_coding_system (Fcheck_coding_system (coding_system), &coding) < 0) | 6624 if (setup_coding_system (Fcheck_coding_system (coding_system), &coding) < 0) |
| 6625 error ("Invalid coding system: %s", XSTRING (SYMBOL_NAME (coding_system))->data); | 6625 error ("Invalid coding system: %s", SDATA (SYMBOL_NAME (coding_system))); |
| 6626 | 6626 |
| 6627 coding.composing = COMPOSITION_DISABLED; | 6627 coding.composing = COMPOSITION_DISABLED; |
| 6628 coding.mode |= CODING_MODE_LAST_BLOCK; | 6628 coding.mode |= CODING_MODE_LAST_BLOCK; |
| 6629 return (encodep | 6629 return (encodep |
| 6630 ? encode_coding_string (string, &coding, 1) | 6630 ? encode_coding_string (string, &coding, 1) |
| 6865 if (!SYMBOLP (operation) | 6865 if (!SYMBOLP (operation) |
| 6866 || !INTEGERP (target_idx = Fget (operation, Qtarget_idx))) | 6866 || !INTEGERP (target_idx = Fget (operation, Qtarget_idx))) |
| 6867 error ("Invalid first argument"); | 6867 error ("Invalid first argument"); |
| 6868 if (nargs < 1 + XINT (target_idx)) | 6868 if (nargs < 1 + XINT (target_idx)) |
| 6869 error ("Too few arguments for operation: %s", | 6869 error ("Too few arguments for operation: %s", |
| 6870 XSTRING (SYMBOL_NAME (operation))->data); | 6870 SDATA (SYMBOL_NAME (operation))); |
| 6871 target = args[XINT (target_idx) + 1]; | 6871 target = args[XINT (target_idx) + 1]; |
| 6872 if (!(STRINGP (target) | 6872 if (!(STRINGP (target) |
| 6873 || (EQ (operation, Qopen_network_stream) && INTEGERP (target)))) | 6873 || (EQ (operation, Qopen_network_stream) && INTEGERP (target)))) |
| 6874 error ("Invalid argument %d", XINT (target_idx) + 1); | 6874 error ("Invalid argument %d", XINT (target_idx) + 1); |
| 6875 | 6875 |
| 7428 if (! NILP (Vlocale_coding_system)) | 7428 if (! NILP (Vlocale_coding_system)) |
| 7429 { | 7429 { |
| 7430 Lisp_Object dec = code_convert_string_norecord (build_string (str), | 7430 Lisp_Object dec = code_convert_string_norecord (build_string (str), |
| 7431 Vlocale_coding_system, | 7431 Vlocale_coding_system, |
| 7432 0); | 7432 0); |
| 7433 str = (char *) XSTRING (dec)->data; | 7433 str = (char *) SDATA (dec); |
| 7434 } | 7434 } |
| 7435 | 7435 |
| 7436 return str; | 7436 return str; |
| 7437 } | 7437 } |
| 7438 | 7438 |
