diff options
| author | akr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2008-08-22 16:44:00 +0000 |
|---|---|---|
| committer | akr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2008-08-22 16:44:00 +0000 |
| commit | 754d1090511522418d5aae03c42200fac66a062b (patch) | |
| tree | 9e8391c680b542386aa8dcd20f515522ae1953af /include/ruby | |
| parent | 78ab948defea3760e8a621f1dedbb9ea96709eaf (diff) | |
| download | ruby-754d1090511522418d5aae03c42200fac66a062b.tar.gz ruby-754d1090511522418d5aae03c42200fac66a062b.tar.xz ruby-754d1090511522418d5aae03c42200fac66a062b.zip | |
* include/ruby/io.h (FMODE_TEXTMODE): defined.
* include/ruby/encoding.h (rb_econv_t): new field: flags.
(rb_econv_binmode): declared.
* io.c (io_unread): text mode hack removed.
(NEED_NEWLINE_DECODER): defined.
(NEED_NEWLINE_ENCODER): defined.
(NEED_READCONV): defined.
(NEED_WRITECONV): defined.
(TEXTMODE_NEWLINE_ENCODER): defined for windows.
(make_writeconv): setup converter with TEXTMODE_NEWLINE_ENCODER for
text mode.
(io_fwrite): use NEED_WRITECONV. character code conversion is
disabled if fptr->writeconv_stateless is nil.
(make_readconv): setup converter with
ECONV_UNIVERSAL_NEWLINE_DECODER for text mode.
(read_all): use NEED_READCONV.
(appendline): use NEED_READCONV.
(rb_io_getline_1): use NEED_READCONV.
(io_getc): use NEED_READCONV.
(rb_io_ungetc): use NEED_READCONV.
(rb_io_binmode): OS-level text mode test removed. call
rb_econv_binmode.
(rb_io_binmode_m): call rb_io_binmode_m with write_io as well.
(rb_io_flags_mode): return mode string including "t".
(rb_io_mode_flags): detect "t" for text mode.
(rb_sysopen): always specify O_BINARY.
* transcode.c (rb_econv_open_by_transcoder_entries): initialize flags.
(rb_econv_open): if source and destination encoding is
both empty string, open newline converter. last_tc will be NULL in
this case.
(rb_econv_encoding_to_insert_output): last_tc may be NULL now.
(rb_econv_string): ditto.
(output_replacement_character): ditto.
(transcode_loop): ditto.
(econv_init): ditto.
(econv_inspect): ditto.
(rb_econv_binmode): new function.
git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@18780 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'include/ruby')
| -rw-r--r-- | include/ruby/encoding.h | 3 | ||||
| -rw-r--r-- | include/ruby/io.h | 1 |
2 files changed, 4 insertions, 0 deletions
diff --git a/include/ruby/encoding.h b/include/ruby/encoding.h index 6c443d6f0..03aac871f 100644 --- a/include/ruby/encoding.h +++ b/include/ruby/encoding.h @@ -217,6 +217,7 @@ typedef struct { } rb_econv_elem_t; typedef struct { + int flags; const char *source_encoding_name; const char *destination_encoding_name; @@ -273,6 +274,8 @@ const char *rb_econv_stateless_encoding(const char *stateful_enc); VALUE rb_econv_string(rb_econv_t *ec, VALUE src, long off, long len, VALUE dst, int flags); +void rb_econv_binmode(rb_econv_t *ec); + /* flags for rb_econv_open */ #define ECONV_UNIVERSAL_NEWLINE_DECODER 0x100 #define ECONV_CRLF_NEWLINE_ENCODER 0x200 diff --git a/include/ruby/io.h b/include/ruby/io.h index 7312f4e9a..d42cadc05 100644 --- a/include/ruby/io.h +++ b/include/ruby/io.h @@ -85,6 +85,7 @@ typedef struct rb_io_t { #define FMODE_WSPLIT 0x0200 #define FMODE_WSPLIT_INITIALIZED 0x0400 #define FMODE_TRUNC 0x0800 +#define FMODE_TEXTMODE 0x1000 /* #define FMODE_PREP 0x10000 */ #define GetOpenFile(obj,fp) rb_io_check_closed((fp) = RFILE(rb_io_taint_check(obj))->fptr) |
