summaryrefslogtreecommitdiff
path: root/io.c
AgeCommit message (Collapse)Author
2008-08-23* io.c (rb_io_extract_modeenc): check :textmode and :binmode in optionakr
hash. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@18786 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-08-23* io.c (check_pipe_command): extracted from rb_f_open and rb_io_open.akr
(rb_f_open): use check_pipe_command. (rb_io_open): ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@18784 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-08-23* io.c (read_all): fptr->enc2 is 0 if no conversion.akr
(rb_io_getline_fast): ditto. (io_getc): ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@18783 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-08-23* include/ruby/io.h (rb_io_t): remove path field and add pathv field.akr
(MakeOpenFile): initialize pathv as Qnil. * gc.c: mark pathv field in T_FILE. * io.c: follow the rb_io_t field change. * file.c: ditto. * ext/socket/socket.c: ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@18782 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-08-22* include/ruby/io.h (FMODE_TEXTMODE): defined.akr
* 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: svn+ssh://ci.ruby-lang.org/ruby/trunk@18780 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-08-22* io.c (rb_io_pid): use PIDT2NUM.akr
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@18771 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-08-21* io.c (rb_file_open_generic): take filename as a VALUE.akr
(rb_file_open_internal): ditto. (rb_io_open): ditto. (rb_file_open): pass filename as a VALUE to rb_file_open_internal. (rb_open_file): pass filename as a VALUE to rb_file_open_generic. (open_key_args): pass filename as a VALUE to rb_io_open. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@18765 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-08-21* io.c (rb_io_s_sysopen): mode can be a Bignum.akr
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@18761 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-08-21* io.c (rb_io_extract_modeenc): notify coerced to caller.akr
(rb_io_initialize): mode may be a Bignum. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@18760 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-08-21* io.c (rb_io_extract_modeenc): use rb_check_to_integer to testakr
integer. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@18759 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-08-21* io.c (rb_io_initialize): accept hash argument.akr
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@18756 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-08-21* io.c (io_extract_encoding_option): if internal encoding is notakr
specified, enc is external encoding. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@18751 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-08-20* io.c (io_extract_encoding_option): enc2 is external encoding ifakr
external encoding and internal encoding is given. (pipe_open): add flags and convconfig argument to initialize fptr->{mode,enc,enc2}. (pipe_open_v): pass flags and convconfig from caller to pipe_open. (pipe_open_s): ditto. (pop_last_hash): new function. (rb_io_s_popen): use last hash as option to specify code conversion. (rb_io_open): specify flags and convconfig arguments for pipe_open_s. (rb_f_backquote): ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@18741 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-08-20* io.c (prep_io): local variable renamed.akr
(rb_io_fdopen): ditto. (prep_stdio): ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@18740 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-08-20* io.c (open_key_args): simplified.akr
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@18738 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-08-20* io.c (open_key_args): IO.foreach(path, rs, limit) didn't work.akr
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@18737 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-08-20* io.c (rb_file_sysopen_internal): unused function removed.akr
(rb_file_sysopen): ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@18736 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-08-20* io.c: use mode_t for the 3rd argument, permission, of open(2).akr
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@18735 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-08-20* io.c (io_set_encoding): removed.akr
(rb_io_open): set up encoding using new argument opt. (open_key_args): call rb_io_open with opt. don't call io_set_encoding. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@18730 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-08-20* io.c (rb_file_open_internal): use rb_io_flags_modenum.akr
(rb_io_reopen): use rb_io_flags_modenum and rb_io_modenum_mode. (rb_io_stdio_file): ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@18729 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-08-20* io.c (rb_io_open_with_args): use rb_open_file instead of rb_io_open.akr
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@18726 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-08-20* io.c (rb_scan_open_args): extracted from rb_open_file.akr
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@18725 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-08-20* io.c (convconfig_t): new type.akr
(rb_io_extract_modeenc): new function. (rb_file_open_generic): new function. (rb_file_open_internal): use rb_file_open_generic. (rb_file_sysopen_internal): use rb_file_open_generic. (rb_open_file): use rb_io_extract_modeenc and rb_file_open_generic. (rb_io_open): call rb_file_open_internal instead of rb_file_open. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@18724 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-08-20* io.c (Init_IO): new constants: File::DSYNC, File::RSYNC andakr
File::NOFOLLOW. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@18723 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-08-20* io.c (rb_open_file): don't lookup :mode and :perm in opt. it isakr
useless because vmode and perm is overwritten by rb_scan_args anyway. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@18722 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-08-20* io.c (open_key_args): meaningless MEMCPY removed.akr
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@18721 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-08-20* io.c (prep_io) [cygwin]: use FMODE_BINMODE instead of O_BINARY.akr
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@18720 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-08-19* io.c (parse_mode_enc): extracted from mode_enc.akr
(io_extract_encoding_option): extracted from io_set_encoding. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@18715 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-08-19* io.c (rb_io_flags_modenum): make it static.akr
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@18714 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-08-19* include/ruby/io.h (FMODE_TRUNC): new constant.akr
* io.c (rb_io_mode_flags): set FMODE_TRUNC for "w". (rb_io_modenum_flags): set FMODE_TRUNC for O_TRUNC. (rb_io_flags_modenum): new function. (rb_io_mode_modenum): just use rb_io_mode_flags and rb_io_flags_modenum. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@18713 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-08-19* io.c (fopen): macro for vms removed. fopen is not used now.akr
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@18712 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-08-19* include/ruby/io.h (rb_fopen): declaration removed.akr
* io.c (rb_fopen): unused function removed. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@18709 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-08-19* io.c (rb_io_flags_mode): use hexadecimal in error message.akr
(rb_io_modenum_mode): ditto. (rb_io_initialize): ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@18707 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-08-19* io.c (rb_io_flags_mode): add a prefix 0 to octal in error message.akr
(rb_io_modenum_mode): ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@18704 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-08-18* io.c (rb_open_file): encoding in mode string was ignored if perm isakr
specified. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@18700 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-08-18fix preivous change.akr
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@18699 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-08-18* io.c (rb_open_file): don't access argv[-1] by akr
File.allocate.instance_eval { initialize }. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@18698 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-08-18* io.c (rb_io_check_readable): side effect for STDIN removed.akr
(rb_io_external_encoding): ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@18695 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-08-18* io.c (io_ungetbyte): renamed from io_ungetc.akr
(rb_io_ungetbyte): new method. (rb_io_ungetc): push back into character buffer if enc2 is set. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@18694 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-08-18* io.c (id_encode): removed.akr
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@18693 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-08-18* io.c (make_writeconv): if enc and enc2 is set, convertakr
string.encoding to enc2. * include/ruby/io.h: comment changed. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@18692 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-08-18* include/ruby/io.h (rb_io_t): new fields: writeconv,akr
writeconv_stateless and writeconv_initialized. (MakeOpenFile): initialize them. * include/ruby/encoding.h (rb_econv_stateless_encoding): declared. (rb_econv_string): declared. * io.c (make_writeconv): new function. (io_fwrite): use econv. (make_readconv): fix error message. (finish_writeconv): new function. (fptr_finalize): call finish_writeconv. (clear_writeconv): new function. (clear_codeconv): new function to call both clear_readconv and clear_writeconv. (rb_io_fptr_finalize): call clear_codeconv instead of clear_readconv. (mode_enc): ditto. (io_set_encoding): ditto. (argf_next_argv): ditto. (io_encoding_set): ditto. * gc.c (gc_mark_children): mark writeconv_stateless in T_FILE. * transcode.c (stateless_encoding_i): new function. (rb_econv_stateless_encoding): ditto. (rb_econv_string): ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@18691 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-08-18* io.c (clear_readconv): extracted from rb_io_fptr_finalize.akr
(mode_enc): call clear_readconv. (io_set_encoding): ditto. (argf_next_argv): ditto. (io_encoding_set): ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@18690 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-08-18* io.c (mode_enc): modify enc and enc2 consistently.akr
(io_set_encoding): ditto. (io_encoding_set): ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@18688 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-08-18* io.c (io_enc_str): code conversion removed.akr
(io_enc_str_converted): removed because it is identical to io_enc_str now. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@18686 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-08-18* io.c (io_shift_crbuf): add strp argument to append into existingakr
string. (read_all): use econv if enc2 is set. (io_getc): follow the io_shift_crbuf change. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@18685 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-08-18* io.c (io_enc_str_converted): new function.akr
(make_readconv): extracted from io_getc. (more_char): ditto. (appendline): use econv via make_readconv and more_char for code conversion. (prepare_getline_args): don't convert record separator. (rb_io_getline_1): don't use rb_io_getline_fast if enc2 is set. (io_getc): use make_readconv and more_char. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@18684 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-08-17* io.c (appendline): appendline cannot check character boundary.akr
(rb_io_getline_1): relax limit until character boundary. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@18680 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-08-17* io.c (prepare_getline_args): io.gets(10,nil) should cause TypeError.akr
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@18675 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-08-17* include/ruby/encoding.h (rb_econv_putbackable): declared.akr
(rb_econv_putback): ditto. * transcode.c (rb_econv_putbackable): implemented. (rb_econv_putback): ditto. * io.c (io_getc): put back bytes if possible. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@18670 b2dd03c8-39d4-4d8f-98ff-823fe69b080e