Mercurial > hg > xemacs-beta
diff src/file-coding.c @ 800:a5954632b187
[xemacs-hg @ 2002-03-31 08:27:14 by ben]
more fixes, first crack at finishing behavior implementation
TODO.ben-mule-21-5: Update.
configure.in: Fix for new error-checking types.
make-mswin-unicode.pl: Don't be fucked up by CRLF. Output code
to force errors when nonintercepted Windows calls issued.
behavior.el, dumped-lisp.el, menubar-items.el: Add support for saving using custom. Load into a dumped XEmacs.
Correct :title to :short-doc in accordance with behavior-defs.el.
Add a submenu under Options for turning on/off behaviors.
cl-macs.el: Properly document `loop'. Fix a minor bug in keymap iteration and
add support for bit-vector iteration.
lisp-mode.el: Rearrange and add items for macro expanding.
menubar-items.el: Document connection between these two functions.
window.el: Port stuff from GNU 21.1.
config.inc.samp, xemacs.mak: Separate out and add new variable for controlling error-checking.
s/windowsnt.h: Use new ERROR_CHECK_ALL; not related to DEBUG_XEMACS.
alloc.c, backtrace.h, buffer.c, buffer.h, bytecode.c, callproc.c, casetab.c, charset.h, chartab.c, cmdloop.c, config.h.in, console-msw.c, console-stream.c, console-tty.c, console.c, console.h, data.c, device-msw.c, device.c, device.h, dired-msw.c, dired.c, dumper.c, editfns.c, eldap.c, elhash.c, emacs.c, eval.c, event-Xt.c, event-gtk.c, event-msw.c, event-stream.c, events.c, extents.c, faces.c, file-coding.c, file-coding.h, fileio.c, frame-msw.c, frame.c, frame.h, glyphs-gtk.c, glyphs-msw.c, glyphs-shared.c, glyphs-widget.c, glyphs-x.c, glyphs.c, glyphs.h, insdel.c, intl-auto-encap-win32.c, intl-auto-encap-win32.h, intl-encap-win32.c, intl-win32.c, keymap.c, lisp-union.h, lisp.h, lread.c, lrecord.h, lstream.c, lstream.h, macros.c, marker.c, md5.c, menubar-x.c, menubar.c, mule-coding.c, ntproc.c, objects-gtk.c, objects-msw.c, objects-x.c, objects.c, opaque.c, print.c, process-nt.c, process-unix.c, process.c, rangetab.c, redisplay-msw.c, redisplay-output.c, redisplay.c, regex.c, scrollbar-msw.c, select-msw.c, signal.c, specifier.c, specifier.h, symbols.c, sysdep.c, syswindows.h, text.c, text.h, toolbar-msw.c, tooltalk.c, ui-gtk.c, unicode.c, window.c: Redo error-checking macros: ERROR_CHECK_TYPECHECK ->
ERROR_CHECK_TYPES, ERROR_CHECK_CHARBPOS -> ERROR_CHECK_TEXT, add
ERROR_CHECK_DISPLAY, ERROR_CHECK_STRUCTURES. Document these in
config.h.in. Fix code to follow docs. Fix *_checking_assert()
in accordance with new names.
Attempt to fix periodic redisplay crash freeing display line
structures. Add first implementation of sledgehammer redisplay
check.
Redo print_*() to use write_fmt_string(), write_fmt_string_lisp().
Fix bug in md5 handling.
Rename character-to-unicode to char-to-unicode; same for
unicode-to-char{acter}.
Move chartab documentation to `make-char-table'.
Some header cleanup.
Clean up remaining places where nonintercepted Windows calls are
being used.
automated/mule-tests.el: Fix for new Unicode support.
author | ben |
---|---|
date | Sun, 31 Mar 2002 08:30:17 +0000 |
parents | e38acbeb1cae |
children | 2b676dc88c66 |
line wrap: on
line diff
--- a/src/file-coding.c Sat Mar 30 04:46:48 2002 +0000 +++ b/src/file-coding.c Sun Mar 31 08:30:17 2002 +0000 @@ -560,8 +560,7 @@ print_coding_system_in_print_method (Lisp_Object cs, Lisp_Object printcharfun, int escapeflag) { - print_internal (XCODING_SYSTEM_NAME (cs), printcharfun, 0); - write_c_string ("[", printcharfun); + write_fmt_string_lisp (printcharfun, "%s[", 1, XCODING_SYSTEM_NAME (cs)); print_coding_system_properties (cs, printcharfun); write_c_string ("]", printcharfun); } @@ -2209,7 +2208,10 @@ str->convert_from = 0; } - return Lstream_close (str->other_end); + if (str->no_close_other) + return Lstream_flush (str->other_end); + else + return Lstream_close (str->other_end); } static void @@ -2302,7 +2304,8 @@ static Lisp_Object make_coding_stream_1 (Lstream *stream, Lisp_Object codesys, - const char *mode, enum encode_decode direction) + const char *mode, enum encode_decode direction, + int no_close_other) { Lstream *lstr = Lstream_new (lstream_coding, mode); struct coding_stream *str = CODING_STREAM_DATA (lstr); @@ -2316,22 +2319,29 @@ str->convert_to = Dynarr_new (unsigned_char); str->convert_from = Dynarr_new (unsigned_char); str->direction = direction; + str->no_close_other = no_close_other; set_coding_stream_coding_system (lstr, codesys); return wrap_lstream (lstr); } +/* If NO_CLOSE_OTHER is non-zero, don't close STREAM (the stream at the + other end) when this stream is closed. */ Lisp_Object make_coding_input_stream (Lstream *stream, Lisp_Object codesys, - enum encode_decode direction) + enum encode_decode direction, int no_close_other) { - return make_coding_stream_1 (stream, codesys, "r", direction); + return make_coding_stream_1 (stream, codesys, "r", direction, + no_close_other); } +/* If NO_CLOSE_OTHER is non-zero, don't close STREAM (the stream at the + other end) when this stream is closed. */ Lisp_Object make_coding_output_stream (Lstream *stream, Lisp_Object codesys, - enum encode_decode direction) + enum encode_decode direction, int no_close_other) { - return make_coding_stream_1 (stream, codesys, "w", direction); + return make_coding_stream_1 (stream, codesys, "w", direction, + no_close_other); } static Lisp_Object @@ -2372,18 +2382,19 @@ XCODING_SYSTEM_EOL_TYPE (coding_system) == EOL_AUTODETECT) next = auto_outstream = make_coding_output_stream - (XLSTREAM (next), Fget_coding_system (Qconvert_eol_autodetect), CODING_DECODE); + (XLSTREAM (next), Fget_coding_system (Qconvert_eol_autodetect), + CODING_DECODE, 0); if (!sink_char) next = from_outstream = - make_coding_output_stream (XLSTREAM (next), Qbinary, CODING_DECODE); + make_coding_output_stream (XLSTREAM (next), Qbinary, CODING_DECODE, 0); outstream = make_coding_output_stream (XLSTREAM (next), coding_system, - direction); + direction, 0); if (!source_char) { to_outstream = make_coding_output_stream (XLSTREAM (outstream), - Qbinary, CODING_ENCODE); + Qbinary, CODING_ENCODE, 0); ostr = XLSTREAM (to_outstream); } else @@ -2691,7 +2702,7 @@ make_coding_output_stream (XLSTREAM (lstream_out), codesys[direction == CODING_ENCODE ? ncodesys - (i + 1) : i], - direction); + direction, 0); lstream_out = data->lstreams[i]; Lstream_set_buffering (XLSTREAM (lstream_out), LSTREAM_UNBUFFERED, 0); @@ -3904,7 +3915,7 @@ make_coding_output_stream (XLSTREAM (data->c.lstreams[data->c.lstream_count - 1]), Fget_coding_system (Qconvert_eol_autodetect), - CODING_DECODE); + CODING_DECODE, 0); Lstream_set_buffering (XLSTREAM (data->c.lstreams[1]), LSTREAM_UNBUFFERED, 0); @@ -3915,7 +3926,7 @@ (XLSTREAM (data->c.lstreams[1]), /* Substitute binary if we need to detect the encoding */ csdata->do_coding ? Qbinary : csdata->cs, - CODING_DECODE); + CODING_DECODE, 0); Lstream_set_buffering (XLSTREAM (data->c.lstreams[0]), LSTREAM_UNBUFFERED, 0); @@ -4124,6 +4135,9 @@ return Qnil; } +/* Detect the encoding of STREAM. Assumes stream is at the begnning and will + read through to the end of STREAM, leaving it there but open. */ + Lisp_Object detect_coding_stream (Lisp_Object stream) { @@ -4133,11 +4147,11 @@ Lisp_Object binary_instream = make_coding_input_stream (XLSTREAM (stream), Qbinary, - CODING_ENCODE); + CODING_ENCODE, 1); Lisp_Object decstream = make_coding_input_stream (XLSTREAM (binary_instream), - Qundecided, CODING_DECODE); + Qundecided, CODING_DECODE, 0); Lstream *decstr = XLSTREAM (decstream); GCPRO3 (decstream, stream, binary_instream);