/* Coding system handler (conversion, detection, etc).
Copyright (C) 1995, 1997, 1998 Electrotechnical Laboratory, JAPAN.
Licensed to the Free Software Foundation.
- Copyright (C) 2001, 2002 Free Software Foundation, Inc.
+ Copyright (C) 2001, 2002, 2003, 2004, 2005 Free Software Foundation, Inc.
Copyright (C) 2003
National Institute of Advanced Industrial Science and Technology (AIST)
Registration Number H13PRO009
You should have received a copy of the GNU General Public License
along with GNU Emacs; see the file COPYING. If not, write to
-the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
-Boston, MA 02111-1307, USA. */
+the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+Boston, MA 02110-1301, USA. */
/*** TABLE OF CONTENTS ***
Lisp_Object QCcategory, QCmnemonic, QCdefalut_char;
Lisp_Object QCdecode_translation_table, QCencode_translation_table;
Lisp_Object QCpost_read_conversion, QCpre_write_conversion;
+Lisp_Object QCascii_compatible_p;
extern Lisp_Object Qinsert_file_contents, Qwrite_region;
-Lisp_Object Qcall_process, Qcall_process_region, Qprocess_argument;
+Lisp_Object Qcall_process, Qcall_process_region;
Lisp_Object Qstart_process, Qopen_network_stream;
Lisp_Object Qtarget_idx;
c = ((c & 1) << 6) | *src++; \
else \
{ \
- c = - string_char (--src, &src, NULL); \
+ src--; \
+ c = - string_char (src, &src, NULL); \
record_conversion_result \
(coding, CODING_RESULT_INVALID_SRC); \
} \
c = ((c & 1) << 6) | *src++; \
else \
{ \
- c = - string_char (--src, &src, NULL); \
+ src--; \
+ c = - string_char (src, &src, NULL); \
record_conversion_result \
(coding, CODING_RESULT_INVALID_SRC); \
} \
case CODING_RESULT_INSUFFICIENT_MEM:
Vlast_code_conversion_error = Qinsufficient_memory;
break;
+ default:
+ Vlast_code_conversion_error = intern ("Unknown error");
}
}
coding_charset_list (coding)
struct coding_system *coding;
{
- Lisp_Object attrs, charset_list, coding_type;
+ Lisp_Object attrs, charset_list;
CODING_GET_INFO (coding, attrs, charset_list);
if (EQ (CODING_ATTR_TYPE (attrs), Qiso_2022))
{
int c = *src++;
- coding->charbuf[coding->charbuf_used++] = (c & 0x80 ? - c : c);
+ if (c & 0x80)
+ c = BYTE8_TO_CHAR (c);
+ coding->charbuf[coding->charbuf_used++] = c;
}
produce_chars (coding, Qnil, 1);
}
Lisp_Object attrs;
Lisp_Object buffer;
int saved_pt = -1, saved_pt_byte;
+ int kill_src_buffer = 0;
buffer = Fcurrent_buffer ();
args[2] = make_number (Z);
safe_call (3, args);
}
+ if (XBUFFER (coding->src_object) != current_buffer)
+ kill_src_buffer = 1;
coding->src_object = Fcurrent_buffer ();
if (BEG != GPT)
move_gap_both (BEG, BEG_BYTE);
saved_pt_byte + (coding->produced - bytes));
}
+ if (kill_src_buffer)
+ Fkill_buffer (coding->src_object);
unbind_to (count, Qnil);
}
CODING_ATTR_PLIST (attrs)
= Fcons (QCcategory, Fcons (AREF (Vcoding_category_table, category),
CODING_ATTR_PLIST (attrs)));
+ CODING_ATTR_PLIST (attrs)
+ = Fcons (QCascii_compatible_p,
+ Fcons (CODING_ATTR_ASCII_COMPAT (attrs),
+ CODING_ATTR_PLIST (attrs)));
eol_type = args[coding_arg_eol_type];
if (! NILP (eol_type)
CHECK_SYMBOL (val);
CODING_ATTR_PRE_WRITE (attrs) = val;
}
+ else if (EQ (prop, QCascii_compatible_p))
+ {
+ CODING_ATTR_ASCII_COMPAT (attrs) = val;
+ }
CODING_ATTR_PLIST (attrs)
= Fplist_put (CODING_ATTR_PLIST (attrs), prop, val);
DEFSYM (QCencode_translation_table, ":encode-translation-table");
DEFSYM (QCpost_read_conversion, ":post-read-conversion");
DEFSYM (QCpre_write_conversion, ":pre-write-conversion");
+ DEFSYM (QCascii_compatible_p, ":ascii-compatible-p");
Vcoding_category_table
= Fmake_vector (make_number (coding_category_max), Qnil);
one algorithm agrees with a byte sequence of source text, the coding
system bound to the corresponding coding-category is selected.
-When you modify this variable, `update-coding-systems-internal' must
-be called. */);
+Don't modify this variable directly, but use `set-coding-priority'. */);
{
int i;
plist[3] = args[coding_arg_mnemonic] = make_number ('-');
plist[5] = args[coding_arg_coding_type] = Qundecided;
/* This is already set.
- /*plist[7] = args[coding_arg_ascii_compatible_p] = Qt;*/
+ plist[7] = args[coding_arg_ascii_compatible_p] = Qt; */
plist[8] = intern (":charset-list");
plist[9] = args[coding_arg_charset_list] = Fcons (Qascii, Qnil);
plist[11] = args[coding_arg_for_unibyte] = Qnil;