Mercurial > hg > xemacs-beta
comparison src/file-coding.c @ 814:a634e3b7acc8
[xemacs-hg @ 2002-04-14 12:41:59 by ben]
latest changes
TODO.ben-mule-21-5: Update.
make-docfile.c: Add basic support for handling ISO 2022 doc strings -- we parse
the basic charset designation sequences so we know whether we're
in ASCII and have to pay attention to end quotes and such.
Reformat code according to coding standards.
abbrev.el: Add `global-abbrev-mode', which turns on or off abbrev-mode in all
buffers. Added `defining-abbrev-turns-on-abbrev-mode' -- if
non-nil, defining an abbrev through an interactive function will
automatically turn on abbrev-mode, either globally or locally
depending on the command. This is the "what you'd expect"
behavior.
indent.el: general function for indenting a balanced expression in a
mode-correct way. Works similar to indent-region in that a mode
can specify a specific command to do the whole operation; if not,
figure out the region using forward-sexp and indent each line
using indent-according-to-mode.
keydefs.el: Removed.
Modify M-C-backslash to do indent-region-or-balanced-expression.
Make S-Tab just insert a TAB char, like it's meant to do.
make-docfile.el: Now that we're using the call-process-in-lisp, we need to load
an extra file win32-native.el because we're running a bare temacs.
menubar-items.el: Totally redo the Cmds menu so that most used commands appear
directly on the menu and less used commands appear in submenus.
The old way may have been very pretty, but rather impractical.
process.el: Under Windows, don't ever use old-call-process-internal, even
in batch mode. We can do processes in batch mode.
subr.el: Someone recoded truncate-string-to-width, saying "the FSF version
is too complicated and does lots of hard-to-understand stuff" but
the resulting recoded version was *totally* wrong! it
misunderstood the basic point of this function, which is work in
*columns* not chars. i dumped ours and copied the version from
FSF 21.1. Also added truncate-string-with-continuation-dots,
since this idiom is used often.
config.inc.samp, xemacs.mak: Separate out debug and optimize flags.
Remove all vestiges of USE_MINIMAL_TAGBITS,
USE_INDEXED_LRECORD_IMPLEMENTATION, and GUNG_HO, since those
ifdefs have long been removed.
Make error-checking support actually work.
Some rearrangement of config.inc.samp to make it more logical.
Remove callproc.c and ntproc.c from xemacs.mak, no longer used.
Make pdump the default.
lisp.h: Add support for strong type-checking of Bytecount, Bytebpos,
Charcount, Charbpos, and others, by making them classes,
overloading the operators to provide integer-like operation and
carefully controlling what operations are allowed. Not currently
enabled in C++ builds because there are still a number of compile
errors, and it won't really work till we merge in my "8-bit-Mule"
workspace, in which I make use of the new types Charxpos,
Bytexpos, Memxpos, representing a "position" either in a buffer or
a string. (This is especially important in the extent code.)
abbrev.c, alloc.c, eval.c, buffer.c, buffer.h, editfns.c, fns.c, text.h: Warning fixes, some of them related to new C++ strict type
checking of Bytecount, Charbpos, etc.
dired.c: Caught an actual error due to strong type checking -- char len
being passed when should be byte len.
alloc.c, backtrace.h, bytecode.c, bytecode.h, eval.c, sysdep.c: Further optimize Ffuncall:
-- process arg list at compiled-function creation time, converting
into an array for extra-quick access at funcall time.
-- rewrite funcall_compiled_function to use it, and inline this
function.
-- change the order of check for magic stuff in
SPECBIND_FAST_UNSAFE to be faster.
-- move the check for need to garbage collect into the allocation
code, so only a single flag needs to be checked in funcall.
buffer.c, symbols.c: add debug funs to check on mule optimization info in buffers and
strings.
eval.c, emacs.c, text.c, regex.c, scrollbar-msw.c, search.c: Fix evil crashes due to eistrings not properly reinitialized under
pdump. Redo a bit some of the init routines; convert some
complex_vars_of() into simple vars_of(), because they didn't need
complex processing.
callproc.c, emacs.c, event-stream.c, nt.c, process.c, process.h, sysdep.c, sysdep.h, syssignal.h, syswindows.h, ntproc.c: Delete. Hallelujah, praise the Lord, there is no god
but Allah!!!
fix so that processes can be invoked in bare temacs -- thereby
eliminating any need for callproc.c. (currently only eliminated
under NT.) remove all crufty and unnecessary old process code in
ntproc.c and elsewhere. move non-callproc-specific stuff (mostly
environment) into process.c, so callproc.c can be left out under
NT.
console-tty.c, doc.c, file-coding.c, file-coding.h, lstream.c, lstream.h: fix doc string handling so it works with Japanese, etc docs.
change handling of "character mode" so callers don't have to
manually set it (quite error-prone).
event-msw.c: spacing fixes.
lread.c: eliminate unused crufty vintage-19 "FSF defun hack" code.
lrecord.h: improve pdump description docs.
buffer.c, ntheap.c, unexnt.c, win32.c, emacs.c: Mule-ize some unexec and startup code. It was pseudo-Mule-ized
before by simply always calling the ...A versions of functions,
but that won't cut it -- eventually we want to be able to run
properly even if XEmacs has been installed in a Japanese
directory. (The current problem is the timing of the loading of
the Unicode tables; this will eventually be fixed.) Go through and
fix various other places where the code was not Mule-clean.
Provide a function mswindows_get_module_file_name() to get our own
name without resort to PATH_MAX and such. Add a big comment in
main() about the problem with Unicode table load timing that I
just alluded to.
emacs.c: When error-checking is enabled (interpreted as "user is developing
XEmacs"), don't ask user to "pause to read messages" when a fatal
error has occurred, because it will wedge if we are in an inner
modal loop (typically when a menu is popped up) and make us unable
to get a useful stack trace in the debugger.
text.c: Correct update_entirely_ascii_p_flag to actually work.
lisp.h, symsinit.h: declarations for above changes.
author | ben |
---|---|
date | Sun, 14 Apr 2002 12:43:31 +0000 |
parents | 19dfb459d51a |
children | 6728e641994e |
comparison
equal
deleted
inserted
replaced
813:9541922fb765 | 814:a634e3b7acc8 |
---|---|
2035 Bytecount rejected = Dynarr_length (str->convert_from); | 2035 Bytecount rejected = Dynarr_length (str->convert_from); |
2036 /* #### 1024 is arbitrary; we really need to separate 0 from EOF, | 2036 /* #### 1024 is arbitrary; we really need to separate 0 from EOF, |
2037 and when we get 0, keep taking more data until we don't get 0 -- | 2037 and when we get 0, keep taking more data until we don't get 0 -- |
2038 we don't know how much data the conversion routine might need | 2038 we don't know how much data the conversion routine might need |
2039 before it can generate any data of its own */ | 2039 before it can generate any data of its own */ |
2040 Bytecount readmore = max (size, str->one_byte_at_a_time ? 1 : 1024); | 2040 Bytecount readmore = |
2041 str->one_byte_at_a_time ? (Bytecount) 1 : | |
2042 max (size, (Bytecount) 1024); | |
2041 | 2043 |
2042 Dynarr_add_many (str->convert_from, 0, readmore); | 2044 Dynarr_add_many (str->convert_from, 0, readmore); |
2043 read_size = Lstream_read (str->other_end, | 2045 read_size = Lstream_read (str->other_end, |
2044 Dynarr_atp (str->convert_from, rejected), | 2046 Dynarr_atp (str->convert_from, rejected), |
2045 readmore); | 2047 readmore); |
2127 from the other_end stream, and we set that one to be character mode or | 2129 from the other_end stream, and we set that one to be character mode or |
2128 not. This is consistent with the comment above the prototype for | 2130 not. This is consistent with the comment above the prototype for |
2129 Lstream_set_character_mode(), which lays out rules for who is allowed to | 2131 Lstream_set_character_mode(), which lays out rules for who is allowed to |
2130 modify the character type mode on a stream. | 2132 modify the character type mode on a stream. |
2131 | 2133 |
2132 NOTE: We could potentially implement the full-character checking stuff | 2134 If we're a read stream, we're always setting character mode on the |
2133 ourselves, which might be a bit safer in case people mess up the | 2135 source, but we also set it on ourselves consistent with the flag that |
2134 character mode themselves. But people shouldn't be doing that -- don't | 2136 can disable this (see again the comment above |
2135 hide bugs -- and there's no sense duplicating code. */ | 2137 Lstream_set_character_mode()). |
2138 */ | |
2136 | 2139 |
2137 static void | 2140 static void |
2138 set_coding_character_mode (Lstream *stream) | 2141 set_coding_character_mode (Lstream *stream) |
2139 { | 2142 { |
2140 struct coding_stream *str = CODING_STREAM_DATA (stream); | 2143 struct coding_stream *str = CODING_STREAM_DATA (stream); |
2143 if (encode_decode_source_sink_type_is_char | 2146 if (encode_decode_source_sink_type_is_char |
2144 (str->codesys, CODING_SOURCE, str->direction)) | 2147 (str->codesys, CODING_SOURCE, str->direction)) |
2145 Lstream_set_character_mode (stream_to_set); | 2148 Lstream_set_character_mode (stream_to_set); |
2146 else | 2149 else |
2147 Lstream_unset_character_mode (stream_to_set); | 2150 Lstream_unset_character_mode (stream_to_set); |
2151 if (str->set_char_mode_on_us_when_reading && | |
2152 (stream->flags & LSTREAM_FL_READ)) | |
2153 { | |
2154 if (encode_decode_source_sink_type_is_char | |
2155 (str->codesys, CODING_SINK, str->direction)) | |
2156 Lstream_set_character_mode (stream); | |
2157 else | |
2158 Lstream_unset_character_mode (stream); | |
2159 } | |
2148 } | 2160 } |
2149 | 2161 |
2150 static Lisp_Object | 2162 static Lisp_Object |
2151 coding_marker (Lisp_Object stream) | 2163 coding_marker (Lisp_Object stream) |
2152 { | 2164 { |
2317 str->us = lstr; | 2329 str->us = lstr; |
2318 str->other_end = stream; | 2330 str->other_end = stream; |
2319 str->convert_to = Dynarr_new (unsigned_char); | 2331 str->convert_to = Dynarr_new (unsigned_char); |
2320 str->convert_from = Dynarr_new (unsigned_char); | 2332 str->convert_from = Dynarr_new (unsigned_char); |
2321 str->direction = direction; | 2333 str->direction = direction; |
2322 if (flags & CODE_FL_NO_CLOSE_OTHER) | 2334 if (flags & LSTREAM_FL_NO_CLOSE_OTHER) |
2323 str->no_close_other = 1; | 2335 str->no_close_other = 1; |
2324 else if (flags & CODE_FL_READ_ONE_BYTE_AT_A_TIME) | 2336 if (flags & LSTREAM_FL_READ_ONE_BYTE_AT_A_TIME) |
2325 str->one_byte_at_a_time = 1; | 2337 str->one_byte_at_a_time = 1; |
2338 if (!(flags & LSTREAM_FL_NO_INIT_CHAR_MODE_WHEN_READING)) | |
2339 str->set_char_mode_on_us_when_reading = 1; | |
2326 | 2340 |
2327 set_coding_stream_coding_system (lstr, codesys); | 2341 set_coding_stream_coding_system (lstr, codesys); |
2328 return wrap_lstream (lstr); | 2342 return wrap_lstream (lstr); |
2329 } | 2343 } |
2330 | 2344 |
2331 /* FLAGS -- #### document me. If NO_CLOSE_OTHER is non-zero, don't close | 2345 /* FLAGS: |
2332 STREAM (the stream at the other end) when this stream is closed. */ | 2346 |
2347 LSTREAM_FL_NO_CLOSE_OTHER | |
2348 Don't close STREAM (the stream at the other end) when this stream is | |
2349 closed. | |
2350 | |
2351 LSTREAM_FL_READ_ONE_BYTE_AT_A_TIME | |
2352 When reading from STREAM, read and process one byte at a time rather | |
2353 than in large chunks. This is for reading from TTY's, so we don't | |
2354 block. #### We should instead create a non-blocking filedesc stream | |
2355 that emulates the behavior as necessary using select(), when the | |
2356 fcntls don't work. (As seems to be the case on Cygwin.) | |
2357 | |
2358 LSTREAM_FL_NO_INIT_CHAR_MODE_WHEN_READING | |
2359 When reading from STREAM, read and process one byte at a time rather | |
2360 than in large chunks. This is for reading from TTY's, so we don't | |
2361 block. #### We should instead create a non-blocking filedesc stream | |
2362 that emulates the behavior as necessary using select(), when the | |
2363 fcntls don't work. (As seems to be the case on Cygwin.) | |
2364 */ | |
2333 Lisp_Object | 2365 Lisp_Object |
2334 make_coding_input_stream (Lstream *stream, Lisp_Object codesys, | 2366 make_coding_input_stream (Lstream *stream, Lisp_Object codesys, |
2335 enum encode_decode direction, int flags) | 2367 enum encode_decode direction, int flags) |
2336 { | 2368 { |
2337 return make_coding_stream_1 (stream, codesys, "r", direction, | 2369 return make_coding_stream_1 (stream, codesys, "r", direction, |
2338 flags); | 2370 flags); |
2339 } | 2371 } |
2340 | 2372 |
2341 /* FLAGS -- #### document me. If NO_CLOSE_OTHER is non-zero, don't close | 2373 /* FLAGS: |
2342 STREAM (the stream at the other end) when this stream is closed. */ | 2374 |
2375 LSTREAM_FL_NO_CLOSE_OTHER | |
2376 Don't close STREAM (the stream at the other end) when this stream is | |
2377 closed. | |
2378 */ | |
2343 Lisp_Object | 2379 Lisp_Object |
2344 make_coding_output_stream (Lstream *stream, Lisp_Object codesys, | 2380 make_coding_output_stream (Lstream *stream, Lisp_Object codesys, |
2345 enum encode_decode direction, int flags) | 2381 enum encode_decode direction, int flags) |
2346 { | 2382 { |
2347 return make_coding_stream_1 (stream, codesys, "w", direction, | 2383 return make_coding_stream_1 (stream, codesys, "w", direction, |
4149 struct gcpro gcpro1, gcpro2, gcpro3; | 4185 struct gcpro gcpro1, gcpro2, gcpro3; |
4150 UExtbyte random_buffer[65536]; | 4186 UExtbyte random_buffer[65536]; |
4151 Lisp_Object binary_instream = | 4187 Lisp_Object binary_instream = |
4152 make_coding_input_stream | 4188 make_coding_input_stream |
4153 (XLSTREAM (stream), Qbinary, | 4189 (XLSTREAM (stream), Qbinary, |
4154 CODING_ENCODE, CODE_FL_NO_CLOSE_OTHER); | 4190 CODING_ENCODE, LSTREAM_FL_NO_CLOSE_OTHER); |
4155 Lisp_Object decstream = | 4191 Lisp_Object decstream = |
4156 make_coding_input_stream | 4192 make_coding_input_stream |
4157 (XLSTREAM (binary_instream), | 4193 (XLSTREAM (binary_instream), |
4158 Qundecided, CODING_DECODE, 0); | 4194 Qundecided, CODING_DECODE, 0); |
4159 Lstream *decstr = XLSTREAM (decstream); | 4195 Lstream *decstr = XLSTREAM (decstream); |