summaryrefslogtreecommitdiffstats
path: root/io.c
Commit message (Collapse)AuthorAgeFilesLines
...
* * io.c (rb_io_flags_mode): add a prefix 0 to octal in error message.akr2008-08-191-2/+2
| | | | | | | (rb_io_modenum_mode): ditto. git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@18704 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * io.c (rb_open_file): encoding in mode string was ignored if perm isakr2008-08-181-0/+6
| | | | | | | specified. git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@18700 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* fix preivous change.akr2008-08-181-1/+1
| | | | git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@18699 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * io.c (rb_open_file): don't access argv[-1] by akr2008-08-181-8/+10
| | | | | | | File.allocate.instance_eval { initialize }. git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@18698 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * io.c (rb_io_check_readable): side effect for STDIN removed.akr2008-08-181-6/+0
| | | | | | | (rb_io_external_encoding): ditto. git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@18695 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * io.c (io_ungetbyte): renamed from io_ungetc.akr2008-08-181-7/+58
| | | | | | | | (rb_io_ungetbyte): new method. (rb_io_ungetc): push back into character buffer if enc2 is set. git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@18694 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * io.c (id_encode): removed.akr2008-08-181-2/+1
| | | | git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@18693 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * io.c (make_writeconv): if enc and enc2 is set, convertakr2008-08-181-23/+17
| | | | | | | | | | string.encoding to enc2. * include/ruby/io.h: comment changed. git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@18692 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * include/ruby/io.h (rb_io_t): new fields: writeconv,akr2008-08-181-16/+134
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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: http://svn.ruby-lang.org/repos/ruby/trunk@18691 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * io.c (clear_readconv): extracted from rb_io_fptr_finalize.akr2008-08-181-8/+20
| | | | | | | | | | (mode_enc): call clear_readconv. (io_set_encoding): ditto. (argf_next_argv): ditto. (io_encoding_set): ditto. git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@18690 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * io.c (mode_enc): modify enc and enc2 consistently.akr2008-08-181-1/+8
| | | | | | | | (io_set_encoding): ditto. (io_encoding_set): ditto. git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@18688 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * io.c (io_enc_str): code conversion removed.akr2008-08-181-20/+2
| | | | | | | | (io_enc_str_converted): removed because it is identical to io_enc_str now. git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@18686 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * io.c (io_shift_crbuf): add strp argument to append into existingakr2008-08-181-101/+131
| | | | | | | | | string. (read_all): use econv if enc2 is set. (io_getc): follow the io_shift_crbuf change. git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@18685 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * io.c (io_enc_str_converted): new function.akr2008-08-181-50/+147
| | | | | | | | | | | | | (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: http://svn.ruby-lang.org/repos/ruby/trunk@18684 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * io.c (appendline): appendline cannot check character boundary.akr2008-08-171-54/+28
| | | | | | | (rb_io_getline_1): relax limit until character boundary. git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@18680 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * io.c (prepare_getline_args): io.gets(10,nil) should cause TypeError.akr2008-08-171-20/+14
| | | | git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@18675 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * include/ruby/encoding.h (rb_econv_putbackable): declared.akr2008-08-171-0/+7
| | | | | | | | | | | | | (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: http://svn.ruby-lang.org/repos/ruby/trunk@18670 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * include/ruby/io.h (rb_io_t): new fields: readconv, crbuf, crbuf_off,akr2008-08-161-2/+75
| | | | | | | | | | | | | crbuf_len, crbuf_capa. (MakeOpenFile): initialize them. * io.c (io_shift_crbuf): new function. (io_getc): use econv. (rb_io_fptr_finalize): finalize readconv and crbuf. git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@18666 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * include/ruby/ruby.h (rb_intern_const): tiny optimization.nobu2008-08-161-0/+1
| | | | git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@18653 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * object.c (rb_obj_untrusted): new method Object#untrusted?.shugo2008-08-131-6/+7
| | | | | | | | | | | | | | | (rb_obj_untrust): new method Object#untrust. (rb_obj_trust): new method Object#trust. * array.c, debug.c, time.c, include/ruby/ruby.h, re.c, variable.c, string.c, io.c, dir.c, vm_method.c, struct.c, class.c, hash.c, ruby.c, marshal.c: fixes for Object#untrusted?. * test/ruby/test_module.rb, test/ruby/test_array.rb, test/ruby/test_object.rb, test/ruby/test_string.rb, test/ruby/test_marshal.rb, test/ruby/test_hash.rb: added tests for Object#untrusted?. git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@18568 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * io.c (shutdown): not define if defined already.nobu2008-08-081-1/+1
| | | | git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@18443 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * configure.in (shutdown, sched_yield, pthread_attr_setinheritsched):nobu2008-08-081-8/+5
| | | | | | | | | check for Haiku. * eval_intern.h, io.c, thread_pthread.c: use autoconfisticated results. git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@18439 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * eval_intern.h: Add support to Haiku. see [ruby-core:18110]naruse2008-08-061-2/+5
| | | | | | | | | | | | | | | | | | | | | | | | * include/ruby/defines.h: ditto. * configure.in: ditto. * thread_pthread.c: ditto. * io.c: ditto. * lib/mkmf.rb: ditto. * ext/socket/getaddrinfo.c: ditto. * ext/socket/extconf.rb: ditto. * ext/socket/socket.c: ditto. * ext/socket/addrinfo.h: ditto. * ext/socket/getnameinfo.c: ditto. git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@18402 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * array.c (rb_ary_sort_bang): reset to real class.nobu2008-08-051-1/+1
| | | | | | | | | * file.c (rb_find_file_ext, rb_find_file): ditto. * io.c (io_reopen): ditto. git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@18377 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * io.c (retry_sendfile, retry_read): ENOSYS and EWOULDBLOCK are notnobu2008-08-051-5/+17
| | | | | | | defined on every platforms. git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@18364 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * io.c (io_ungetc): raise NotImplementedError when ungetc is calledmame2008-07-291-0/+13
| | | | | | | | | | | | | | | against dummy encoding IO. * io.c (rb_io_getline_1): ditto when gets with delimiter is called. * io.c (io_getc): ditto when getc is called. * test/ruby/test_io_m17n.rb (test_terminator_stateful_conversion, test_getc_stateful_conversion, test_ungetc_stateful_conversion): these tests should raise NotImplementedError. git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@18261 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * io.c (prepare_getline_args): check if rs is a string when non-nilnobu2008-07-211-1/+4
| | | | | | | lim is given. [ruby-dev:35610] git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@18140 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * io.c (appendline): remove invalid access.mame2008-07-161-1/+1
| | | | git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@18085 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * io.c (rb_io_wait_readable, rb_io_wait_writable): check if the filenobu2008-07-111-4/+7
| | | | | | | | | descriptor is closed. * thread.c (rb_thread_wait_fd_rw): ditto. git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@18027 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* rename rb_pipe_internal to rb_pipe.akr2008-07-051-7/+7
| | | | | | | use rb_pipe in pipe_nocrash. git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@17895 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * io.c (rb_pipe_internal): new function for handling EMFILE and ENFILEakr2008-07-051-17/+24
| | | | | | | | | | error of pipe(). (UPDATE_MAXFD_PIPE): removed. (pipe_open): use rb_pipe_internal. (rb_io_s_pipe): ditto. git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@17894 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * io.c (argf_each_line): pass args to each_line. [ruby-dev:34958]mame2008-06-301-1/+1
| | | | git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@17738 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * io.c (io_reopen): remove cygwin handling because it seems to be forusa2008-06-241-6/+0
| | | | | | | | | C's stdio. fixed [ruby-dev:35183] git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@17557 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * io.c (rb_io_binmode_p, argf_binmode_p, Init_IO): new methodusa2008-06-211-0/+22
| | | | | | | IO#binmode? and ARGF.binmode? [ruby-dev:35148] git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@17507 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * io.c (rb_open_file): fs_encoding and fname_encoding isnaruse2008-06-181-2/+2
| | | | | | | rb_encoding *. fixed [ruby-dev:35151] git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@17403 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * io.c (rb_open_file): not rb_enc_get_index but rb_enc_get.naruse2008-06-181-1/+1
| | | | git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@17401 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * io.c (io_set_encoding): defined.naruse2008-06-161-20/+88
| | | | | | | | | * io.c (rb_open_file): convert path on Windows and Mac OS X. * io.c (open_key_args): use io_set_encoding and now accept internal_encoding and exernal_encoding. git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@17373 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * io.c (read_all): should use io_read_encoding(), notmatz2008-06-111-7/+6
| | | | | | | | | | | io_input_encoding(). * io.c (rb_io_getline_1): reduce calling of io_read_encoding(). * string.c (rb_str_scan): need not to restore $~ value, so avoid pinning match object. git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@17104 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * io.c (rb_io_reopen): clear read buffer.nobu2008-06-111-0/+1
| | | | git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@17100 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * io.c (io_fread): bypass buffered read if reading buffer is empty.matz2008-06-111-1/+15
| | | | | | * io.c (remain_size): do not add extra one byte. git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@17098 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * include/ruby/ruby.h (CONST_ID): constant ID cache for non-gcc.nobu2008-06-091-4/+6
| | | | | | | * *.c: no cache in init functions. git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@17053 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * io.c (fptr_finalize): close IO object if fd is already closed.akr2008-06-091-4/+15
| | | | | | | (rb_p): call rb_io_write just once. git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@17044 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * array.c, bignum.c, cont.c, dir.c, dln.c, encoding.c, enumerator.c,ko12008-06-081-0/+2
| | | | | | | | | | | | | | | | | | | enumerator.c (enumerator_allocate), eval_jump.c, file.c, hash.c, io.c, load.c, pack.c, proc.c, random.c, re.c, ruby.c, st.c, string.c, thread.c, thread_pthread.c, time.c, util.c, variable.c, vm.c, gc.c: allocated memory objects by xmalloc (ruby_xmalloc) should be freed by xfree (ruby_xfree). * ext/curses/curses.c, ext/dbm/dbm.c, ext/digest/digest.c, ext/gdbm/gdbm.c, ext/json/ext/parser/parser.c, ext/json/ext/parser/unicode.c, ext/openssl/ossl_cipher.c, ext/openssl/ossl_hmac.c, ext/openssl/ossl_pkey_ec.c, ext/sdbm/init.c, ext/strscan/strscan.c, ext/zlib/zlib.c: ditto. git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@17017 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * io.c (rb_f_open), re.c (rb_reg_search), transcode.c (str_transcode):nobu2008-06-071-1/+1
| | | | | | | | | suppress warnings. * util.c (quorem, rv_alloc, nrv_alloc): only used in dtoa(). git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@16873 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * io.c (rb_open_file, rb_io_s_sysopen): fmode should be unsigned int.usa2008-06-061-4/+6
| | | | | | | | fixed [ruby-dev:34979] git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@16869 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * re.c: fix SEGV by Regexp.allocate.names, Match.allocate.names, etc.mame2008-06-021-0/+1
| | | | | | | | | | | * test/ruby/test_regexp.rb: add tests for above. * io.c: fix SEGV by IO.allocate.print, etc. * test/ruby/test_io.rb: add tests for above. git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@16757 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * suppress warnings with -Wwrite-string.nobu2008-05-311-4/+4
| | | | git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@16716 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* remove a compile error.mame2008-05-291-1/+1
| | | | git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@16682 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * io.c (argf_readchar): raise EOFError, synchronizing IO#readchar.mame2008-05-291-1/+1
| | | | git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@16681 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * io.c (argf_external_encoding, argf_internal_encoding): fix SEGV bymame2008-05-291-2/+8
| | | | | | | ARGF.external_encoding. git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@16680 b2dd03c8-39d4-4d8f-98ff-823fe69b080e