Граф коммитов

487 Коммитов

Автор SHA1 Сообщение Дата
akr a8f25ded9c don't use READ_DATA_PENDING in previous change
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@7406 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2004-11-28 17:02:14 +00:00
akr 06646d1b4e * io.c (rb_io_check_writable): restrict io_seek by
READ_DATA_PENDING because io_seek(fptr, 0, SEEK_CUR) is
  meaningful only if read buffer is not empty.
  call io_seek regardless of NEED_IO_SEEK_BETWEEN_RW.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@7404 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2004-11-28 16:31:12 +00:00
akr 39eac7ded8 io.c (rb_io_fwrite): set path to NULL
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@7395 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2004-11-27 14:08:45 +00:00
akr b70e88a123 * io.c: avoid avoid data loss with nonblocking fd and
stdio buffering in sync mode.  [ruby-dev:24966]
  based on matz's patch [ruby-dev:24967]
  (io_fwrite): new primitive writing function which writes
  directly if sync mode.
  (rb_io_fwrite): wrapper for io_fwrite now.
  (io_write): call io_fwrite instead of rb_io_fwrite.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@7392 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2004-11-27 13:05:46 +00:00
matz 65445b53ca * io.c (io_fread): [ruby-dev:24964]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@7387 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2004-11-27 02:21:53 +00:00
matz 6d0f22ebc6 * io.c (rb_io_initialize): [ruby-dev:24963]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@7385 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2004-11-26 06:27:45 +00:00
matz c97c359053 * io.c (rb_io_initialize): [ruby-dev:24962]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@7384 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2004-11-26 05:30:45 +00:00
matz 9e5c4cde2f * io.c (rb_io_initialize): should retrieve flags from copying file
descriptor. [ruby-dev:24961]

* eval.c (method_missing): raise TypeError for classes do not
  have allocators.  [ruby-core:03752]

* lib/erb.rb: [ruby-core:03786]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@7382 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2004-11-26 04:50:36 +00:00
matz 84bd21465e * io.c (io_read): move StringValue() check before GetOpenFile().
[ruby-dev:24959]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@7376 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2004-11-25 15:23:19 +00:00
matz 51c48c29d8 * configure.in: AC_PREREQ(2.53) [ruby-core:03800]
* io.c (read_all): [ruby-dev:24955]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@7369 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2004-11-25 01:58:31 +00:00
matz 0f2fdc6978 * io.c (io_read): [ruby-dev:24952]
* configure.in, io.c: cancel [ ruby-Patches-1074 ].


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@7361 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2004-11-23 17:37:51 +00:00
matz e66752a0ed * io.c (io_read): [ruby-dev:24952]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@7359 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2004-11-23 16:04:16 +00:00
aamine aafc487d6a * io.c (rb_io_getline): f.gets("") did not work. [ruby-core:03771]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@7342 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2004-11-20 14:26:23 +00:00
eban e62aac9424 * io.c (__fpending): commit miss.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@7337 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2004-11-20 12:18:16 +00:00
eban 9b25eee46e * io.c (io_reopen): work around problem with Cygwin fseeko
returning ESPIPE.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@7335 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2004-11-20 08:49:16 +00:00
matz 77a23fba35 * string.c (str_gsub): internal buffer should not be listed by
ObjectSpace.each_object() by String#gsub.  [ruby-dev:24931]

* lib/cgi/session.rb (CGI::Session::FileStore::initialize): raise
  exception if data corresponding to session specified from the
  client does not exist.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@7326 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2004-11-19 16:59:11 +00:00
nobu 27e4aa4a93 * io.c, rubyio.h (rb_io_modenum_flags): exported.
* ext/stringio/stringio.c (strio_initialize): allow Fixnum as mode as
  well as IO.new does.  [ruby-dev:24896]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@7304 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2004-11-18 01:11:01 +00:00
matz 683400f427 * dir.c (rb_glob2): do not allocate buffer from heap to avoid
memory leaks.  use string object for buffering instead.
  [ruby-dev:24738]

* dir.c (join_path): ditto.

* io.c (io_read): external input buffer may be modified even after
  rb_str_locktmp().  [ruby-dev:24735]

* dir.c (fnmatch): p or s may be NULL.  [ruby-dev:24749]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@7242 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2004-11-10 07:17:53 +00:00
usa 7b45f99288 * io.c (pipe_open): need to set cmd if argc == 0 (win32).
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@7179 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2004-11-02 05:54:45 +00:00
matz 4727632f01 * io.c (pipe_open): IO.popen should take array as 1st argument for
a command line.  [ruby-dev:24678]

* io.c (rb_io_s_popen): do not expand argv array.  [ruby-dev:24670]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@7178 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2004-11-02 05:33:11 +00:00
matz 1d1b8102bc * eval.c (proc_invoke): nail down dyna_var node when Proc object
or continuation is created.  [ruby-dev:24671]

* io.c (rb_io_s_popen): do not expand argv array.  [ruby-dev:24670]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@7174 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2004-11-01 23:49:16 +00:00
usa aa23bfaf08 * io.c (pipe_open): avoid conflict of variable name. [ruby-dev:24662]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@7166 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2004-11-01 02:55:29 +00:00
matz 8db864c999 * io.c (rb_f_open): create copy of popen specifier. [ruby-dev:24656]
* string.c (rb_str_locktmp): lock string temporarily.

* string.c (str_independent): add tmplock check.

* io.c (io_write): lock output string temporarily.
  [ruby-dev:24649]

* io.c (io_write): use rb_str_locktmp().

* io.c (read_all): ditto.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@7162 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2004-10-31 17:37:52 +00:00
nobu 9f5f676d82 * io.c (rb_io_check_initialized): new function to check uninitialized
object.  [ruby-talk:118234]

* file.c (rb_file_path), io.c (rb_io_closed): check if initialized.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@7140 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2004-10-29 12:28:32 +00:00
matz b0dee8f90d * eval.c (ruby_cleanup): ruby_finalize_1 may cause exception,
should be wrapped by PUSH_TAG/POP_TAG().  [ruby-dev:24627]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@7127 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2004-10-29 01:06:37 +00:00
matz 018837b84f * node.h (NODE_TYPESHIFT): allow 4 more bits for line numbers.
[ruby-talk:117841]

* ruby.h (FL_ABLE): nodes are not subject for flag operations.

* io.c (ARGF_FORWARD): should have specified argv explicitly,
  since we no longer have frame->argv saved.  [ruby-dev:24602]

* string.c (RESIZE_CAPA): check string attribute before modifying
  capacity member of string structure.  [ruby-dev:24594]

* ext/zlib/zlib.c (gzreader_gets): use memchr() to to gain
  performance.  [ruby-talk:117701]

* sprintf.c (rb_f_sprintf): raise ArgumentError for extra
  arguments, unless (digit)$ style used.

* io.c (rb_io_fptr_finalize): leave stdin/stdout/stderr open in
  interpreter termination.  [ruby-dev:24579]

* eval.c (frame_free): Guy Decoux solved the leak problem.
  Thanks.  [ruby-core:03549]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@7121 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2004-10-27 09:29:26 +00:00
matz d9d60e8c12 * ext/zlib/zlib.c (zstream_shift_buffer): should restore class
field of a buffer.  [ruby-dev:24562]

* eval.c (rb_alias): should warn on method discarding.
  [ruby-dev:24546]

* ext/zlib/zlib.c (zstream_expand_buffer_into): hide internal
  string buffer by clearing klass.  [ruby-dev:24548]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@7099 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2004-10-21 16:13:32 +00:00
eban 2870c4d1a6 * io.c (pipe_open): variable name "fpw" is conflicted.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@7093 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2004-10-21 04:16:40 +00:00
matz 7d7d82463d * parse.y (lex_getline): should not touch ruby_debug_lines if
RIPPER is defined.  [ruby-dev:24547]

* string.c (str_gsub): 	reentrant check.  [ruby-dev:24432]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@7091 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2004-10-20 15:44:06 +00:00
nobu 3054488377 * io.c (rb_io_getline): rs modification check should not interfere in the loop.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@7085 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2004-10-20 03:42:53 +00:00
matz 1057902ac7 * io.c (read_all): block string buffer modification during
rb_io_fread() by freezing it temporarily. [ruby-dev:24479]

* dir.c (rb_push_glob): block call at once the end of method.
  [ruby-dev:24487]

* ext/enumerator/enumerator.c (enum_each_slice): remove
  rb_gc_force_recycle() to prevent potential SEGV.
  [ruby-dev:24499]

* ext/zlib/zlib.c (zstream_expand_buffer): hide internal string
  buffer by clearing klass.  [ruby-dev:24510]

* ext/socket/socket.c (sock_s_getservbyaname): protocol string
  might be altered.  [ruby-dev:24503]

* string.c (rb_str_upto): check if return value from succ is a
  string.  [ruby-dev:24504]

* io.c (rb_io_popen): get mode string via rb_io_flags_mode() to
  avoid mode string modification.  [ruby-dev:24454]

* io.c (rb_io_getline_fast): should take delim as unsigned char to
  distinguish EOF and '\377'.  [ruby-dev:24460]

* io.c (rb_io_getline): add check for RS modification.
  [ruby-dev:24461]

* enum.c (enum_sort_by): use qsort() directly instead using
  rb_iterate().  [ruby-dev:24462]

* enum.c (enum_each_with_index): remove rb_gc_force_recycle() to
  prevent access to recycled object (via continuation for
  example).  [ruby-dev:24463]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@7071 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2004-10-19 10:25:23 +00:00
nobu 0fdb2ae104 * io.c (rb_io_flags_mode, rb_io_mode_flags): distinguish whether file
not existing is created.  [ruby-dev:24505]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@7059 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2004-10-18 02:29:43 +00:00
eban 1d81baaf36 * io.c (MODE_BINMODE, MODE_BINARY): fixed reversed condition.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@7031 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2004-10-12 06:07:01 +00:00
nobu 225f22cd9a * io.c (rb_io_getline): should not treat char as negative value.
[ruby-dev:24460]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@7018 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2004-10-09 10:51:11 +00:00
matz 607314595a * io.c (io_read): should freeze buffer before thread context
switch. [ruby-dev:24442]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@7011 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2004-10-07 05:54:28 +00:00
matz 6299619da9 * pack.c (pack_unpack): string conversion should at the top of the
method.  [ruby-dev:24439]

* io.c (io_read): buffer should be frozen only after the length
  check.  [ruby-dev:24440]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@7010 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2004-10-07 04:06:41 +00:00
matz 7f5cf7a100 * io.c (rb_io_s_sysopen): preserve path in the buffer allocated by
ALLOCA_N() to prevent modification.  [ruby-dev:24438]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@7002 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2004-10-06 15:10:43 +00:00
eban 9a2c853b97 * io.c (rb_io_modenum_mode): typo fix again.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@7000 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2004-10-06 08:02:34 +00:00
matz fbb88b011a * io.c (rb_io_mode_flags): preserve append mode flag.
[ruby-dev:24436]

* io.c (rb_io_modenum_mode): do not use external output buffer.

* string.c (rb_str_justify): differ pointer retrieval to prevent
  padding string modification.  [ruby-dev:24434]

* range.c (range_each_func): allow func to terminate loop by
  returning RANGE_EACH_BREAK.

* range.c (member_i): use RANGE_EACH_BREAK. [ruby-talk:114959]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@6999 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2004-10-06 07:40:06 +00:00
eban 3d17082a50 * io.c (rb_io_flags_mode): typo fix.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@6998 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2004-10-05 09:13:49 +00:00
matz c800d0b75d * io.c (rb_fopen): mode string copy at the lowest level.
* io.c (rb_io_flags_mode): requires output buffer no more.  no
  allocation needed.

* array.c (rb_ary_index): takes a block to compare items in an
  array.  [ruby-talk:113069] [Ruby2]

* array.c (rb_ary_rindex): ditto.

* marshal.c (r_byte): retrieve pointer from string value for each
  time.  [ruby-dev:24404]

* marshal.c (r_bytes0): ditto.

* enum.c (sort_by_i): re-entrance check added.  [ruby-dev:24399]

* io.c (io_read): should freeze all reading buffer.
  [ruby-dev:24400]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@6996 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2004-10-05 01:37:46 +00:00
nobu 889a620b76 * io.c (rb_file_open_internal, rb_io_reopen): fname might be altered
while GC.  [ruby-dev:24408]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@6995 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2004-10-04 05:04:22 +00:00
matz 1b4d97ddba * string.c (rb_str_sum): string may be altered. [ruby-dev:24381]
* eval.c (rb_f_eval): defer pointer retrieval to prevent unsafe
  sourcefile string modification.  [ruby-dev:24373]

* io.c (io_read): block string buffer modification during
  rb_io_fread() by freezing it temporarily. [ruby-dev:24366]

* io.c (rb_io_s_popen): mode argument may be altered.
  [ruby-dev:24375]

* file.c (rb_file_s_basename): ext argument may be altered.
  [ruby-dev:24377]

* enum.c (enum_sort_by): use NODE instead of 2 element arrays.
  [ruby-dev:24378]

* string.c (rb_str_chomp_bang): StringValue() may change the
  receiver.  [ruby-dev:24371]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@6976 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2004-10-01 15:56:05 +00:00
akr 44abd80865 * ext/zlib/zlib.c (gzfile_read_raw): call readpartial at first.
(Zlib::GzipReader#readpartial): new method.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@6923 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2004-09-19 18:42:32 +00:00
matz 88ba175ab0 * bignum.c (rb_big_and): protect parameters from GC.
[ruby-talk:110664]

* error.c (exc_equal): exceptions are equal if they share same
  class, message and backtrace. [ruby-talk:110354]

* error.c (name_err_mesg_equal): ditto.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@6826 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2004-08-28 14:14:11 +00:00
usa 34fff376ff * io.c (rb_io_check_writable): no need to check read buffer if
already changed to write mode.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@6801 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2004-08-20 08:30:43 +00:00
matz d73fa69935 * dir.c (free_dir): fix memory leak. reported by yamamoto
madoka.

* eval.c (bind_eval): new method. [RCR 251]

* string.c (rb_str_clear): new method. [ruby-dev:24104]

* io.c (rb_io_reopen): should clear allocated OpenFile.  pointed
  out by Guy Decoux. [ruby-core:03288]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@6794 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2004-08-19 07:33:15 +00:00
matz 67232b2151 * io.c (rb_io_reopen): should clear allocated OpenFile. pointed
out by Guy Decoux. [ruby-core:03288]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@6781 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2004-08-17 09:02:40 +00:00
akr 8f8de7782e * io.c (read_buffered_data): extracted from rb_io_fread.
(io_readpartial): new method IO#readpartial.
  [ruby-dev:24055]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@6756 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2004-08-11 16:57:14 +00:00
matz 9531aef9eb * env.h: remove argv from ruby_frame.
* eval.c (rb_eval): no more copy on write.

* eval.c (assign): ditto.

* eval.c (rb_call0): can receive *rest by specifying negative
  argc.  (-1 means 0 arg and *rest, -2 means 1 arg and *rest...)

* eval.c (rb_call0): properly set frame's argc counter.

* gc.c (rb_gc_mark_frame): need not to mark frame's argv

* gc.c (run_final): wrong order of data. [ruby-dev:23948]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@6708 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2004-07-28 01:22:49 +00:00
nobu 63dedc7de4 * io.c (rb_io_popen): update the document for the first argument and
exceptions.

* process.c (rb_f_exec, rb_f_system): update the document for
  exceptions.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@6540 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2004-06-29 01:17:39 +00:00
nobu 620cbfd466 * io.c (rb_fopen, rb_fdopen, rb_io_reopen): setvbuf() may return
positive value on failure.  [ruby-dev:23792]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@6521 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2004-06-25 15:13:16 +00:00
matz 2c7c9e82df * ext/socket/socket.c (sock_sockaddr): Socket#gethostbyname()
should give us packed address, not struct sockaddr.
  [ruby-core:03053]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@6515 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2004-06-24 23:10:55 +00:00
nobu 2f978ec25a * io.c (rb_io_fread): return already read data when system call is
interrupted.  [ruby-talk:97206]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@6510 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2004-06-24 05:23:44 +00:00
michal 3e1c383e45 io_seek()'s retval should be checked [ruby-core:03045]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@6505 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2004-06-23 13:18:32 +00:00
nobu 65e0e64656 * io.c (rb_io_initialize): should check fcntl result. [ruby-dev:23742]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@6497 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2004-06-22 15:00:36 +00:00
matz 4f127ee34b * io.c (rb_io_gets_m): set lastline ($_) even when read line is
nil.  [ruby-dev:23663]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@6427 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2004-06-04 09:56:25 +00:00
ocean 94e5d6ba19 * io.c (rb_io_fwrite): check all case errno != 0 [ruby-dev:23648]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@6422 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2004-05-27 11:22:30 +00:00
eban b629932863 * io.c (rb_io_fwrite): should check if errnro == ENOENT, too.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@6416 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2004-05-27 06:17:05 +00:00
eban ec6cb67d03 * io.c (rb_io_fwrite): workaround for bcc32's fwrite bug.
add errno checking.  [ruby-dev:23627]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@6415 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2004-05-27 05:58:32 +00:00
nobu 13ebee7a9e * io.c (rb_io_init_copy): copy also positions. [ruby-talk:100910]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@6406 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2004-05-26 04:15:02 +00:00
matz 2c247e3d6b * io.c (rb_f_open): open should not ignore block when "to_open"
method is used.  [ruby-dev:23478]

* ext/dbm/dbm.c (fdbm_modify): typo fixed. [ruby-dev:23473]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@6276 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2004-05-08 08:12:08 +00:00
matz 1b0f90ca33 * parse.y (string_content): turn off NODE_NEWLINE flag to avoid
unnecessary line trace for inlined expression.
  (ruby-bugs PR#1320)

* numeric.c (flo_to_s): tweak output string based to preserve
  decimal point and to remove trailing zeros.  [ruby-talk:97891]

* string.c (rb_str_index_m): use unsigned comparison for T_FIXNUM
  search.  [ruby-talk:97342]

* hash.c (rb_hash_equal): returns true if two hashes have same set
  of key-value set.  [ruby-talk:97559]

* hash.c (rb_hash_eql): returns true if two hashes are equal and
  have same default values.

* string.c (rb_str_equal): always returns true or false, never
  returns nil. [ruby-dev:23404]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@6262 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2004-05-07 08:44:24 +00:00
nobu 92f0be2037 * dln.c, io.c, pack.c, lib/benchmark.rb, lib/cgi.rb, lib/csv.rb,
lib/date.rb, lib/ftools.rb, lib/getoptlong.rb, lib/logger.rb,
  lib/matrix.rb, lib/monitor.rb, lib/set.rb, lib/thwait.rb,
  lib/timeout.rb, lib/yaml.rb, lib/drb/drb.rb, lib/irb/workspace.rb,
  lib/net/ftp.rb, lib/net/http.rb, lib/net/imap.rb, lib/net/pop.rb,
  lib/net/telnet.rb, lib/racc/parser.rb, lib/rinda/rinda.rb,
  lib/rinda/tuplespace.rb, lib/shell/command-processor.rb,
  lib/soap/rpc/soaplet.rb, lib/test/unit/testcase.rb,
  lib/test/unit/testsuite.rb: typo fix.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@6178 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2004-04-18 23:19:47 +00:00
nobu d952e33003 * array.c, enum.c, eval.c, file.c, io.c, numeric.c, object.c, prec.c,
process.c, re.c, string.c: typos in RDoc comments.  [ruby-core:02783]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@6158 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2004-04-14 04:06:52 +00:00
nobu 4732bf25f5 * io.c (rb_io_binmode): inverted condition. [ruby-dev:23349]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@6124 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2004-04-08 10:03:38 +00:00
matz df84c64be9 * pack.c (pack_pack): use NUM2INT() instead of num2i32().
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@6120 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2004-04-07 06:30:15 +00:00
matz 4ded52b623 * file.c (rb_get_path): get path string via "to_path" method if
path object is not a string. [Ruby2]

* gc.c (rb_gc_call_finalizer_at_exit): do not free threads in the
  exit finalizers.

* io.c (rb_io_reopen): should use rb_io_check_io().


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@6114 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2004-04-07 02:51:05 +00:00
matz ce44928d2b * error.c (Init_Exception): remove Exception#to_str. [Ruby2]
* eval.c (error_print): should no call "to_str" anymore use
  "message" method instead.

* io.c (rb_f_open): Kernel#open() calls "to_open" if the first
  argument responds to it. [Ruby2]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@6102 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2004-04-05 15:55:09 +00:00
matz 189febdf24 * pack.c (pack_pack): raises RangeError if uv is out of UTF8 value
range.  [ruby-dev:23281]

* io.c (rb_io_binmode): stdio buffer should be empty when calling
  IO#binmode.  [ruby-talk:96155]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@6054 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2004-03-31 02:59:57 +00:00
matz 610b5d7975 * variable.c (rb_cvar_set): class variables become private to the
particular class/module. [Ruby2]

* variable.c (rb_cvar_get): ditto.

* io.c (rb_io_sync): need not to check writable. [ruby-core:02674]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@5977 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2004-03-19 07:13:01 +00:00
matz 2fab242f66 * eval.c (rb_yield_0): should not re-submit TAG_BREAK if this
yield is not break destination. [ruby-dev:23197]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@5952 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2004-03-15 02:27:29 +00:00
matz 7c097dc891 * struct.c (rb_struct_s_def): Struct::new executes block with
generated struct class. [ruby-talk:02606]

* io.c (rb_io_ungetc): raise IOError instead of calling
  rb_sys_fail().  [ruby-talk:23181]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@5934 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2004-03-10 07:05:19 +00:00
nobu 5aad820604 * io.c (pipe_open): erred program name should be reported by
exceptions, instead of the first argument.

* process.c (rb_spawn): ditto.

* process.c (proc_spawn_v): use first argument as program name.

* win32/win32.c (rb_w32_aspawn): ditto.

* win32/win32.c (CreateChild): search executable file if no program
  name given.

* lib/drb/extservm.rb (invoke_service_command): use Process.spawn.
  [ruby-dev:23103]

* lib/rdoc/ri/ri_display.rb (setup_pager): use IO.popen.
  [ruby-dev:23086], [ruby-dev:23103]

* lib/rdoc/diagram.rb (convert_to_png): ditto.

* lib/rdoc/generators/chm_generator.rb (compile_project): ditto.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@5872 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2004-03-02 07:30:35 +00:00
nobu b0e0f45571 * gc.c (obj_free), io.c (rb_io_fptr_finalize), rubyio.h (OpenFile):
sharing OpenFile.

* io.c (rb_io_initialize): accept IO instance.  [ruby-dev:22195]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@5831 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2004-02-25 12:17:39 +00:00
nobu d6a70ac44c * io.c (pipe_open): fix typo.
* win32/win32.c (CreateChild): first argument to CreateProcess() must
  have path, not just basename.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@5789 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2004-02-20 03:57:36 +00:00
nobu 03d8c88b87 * configure.in: check functions, fork spawnv.
* io.c (rb_io_s_popen): accept argv not only single command line.

* process.c (rb_proc_exec_n): export.

* process.c (rb_check_argv): check if arguments are safe to invoke.

* process.c (rb_fork): retry to fork.

* process.c (rb_spawn): spawn child process asynchronously.

* process.c (rb_f_system): raise an exception if the command could not
  execute.

* win32/win32.c (rb_w32_argv_size): count necessary size for joined
  arguments.

* win32/win32.c (rb_w32_join_argv): join arguments with quoting.

* win32/win32.c (rb_w32_pipe_exec, rb_w32_spawn, rb_w32_aspawn):
  accept program name adding to command line.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@5725 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2004-02-16 06:45:32 +00:00
dave 9b077b3490 Remove references to defout
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@5558 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2004-01-26 13:54:41 +00:00
nobu a7b1a2eced * class.c, error.c, file.c, io.c, numeric.c, object.c, re.c, struct.c,
time.c: marked init_copy functions nodoc.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@5492 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2004-01-18 14:16:47 +00:00
nobu 5a8d60bf7f * io.c (argf_read): do not append EOF. (ruby-bugs-ja:PR#585)
* io.c (rb_io_fwrite): ad-hockery hack to get rid of HP-UX stdio
  weird behavior.  [ruby-dev:22424]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@5467 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2004-01-15 04:03:15 +00:00
nobu d231dc04d0 * io.c (fptr_finalize): should save errno just after failure.
[ruby-dev:22492]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@5390 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2004-01-06 12:55:05 +00:00
matz 59dbfa3e4c * dir.c: merge tuning from H.Yamamoto <ocean@m2.ccsnet.ne.jp>.
[ruby-dev:22476]

* io.c (argf_eof): ARGF.eof? should not have any side effect.
  [ruby-dev:22469]

* io.c (argf_each_byte): should return self.  [ruby-dev:22465]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@5365 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2004-01-02 16:21:26 +00:00
matz 2c87fffec4 * io.c (rb_f_readline): should raise EOFError at the end of
files.  [ruby-dev:22458]

* io.c (argf_read): should concatenate input files when length
  argument is nil. [ruby-dev:22450]

* io.c (argf_read): should update supplied string buffer (2nd
  argument) even when IO#read is called multiple times.

* io.c: should initialize lineno by zero. [ruby-dev:22460]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@5354 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2003-12-30 19:29:56 +00:00
dave 349f4e7db7 Add RDoc for kernel functions, and tidy up
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@5352 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2003-12-30 16:38:32 +00:00
dave e950d051e1 Added RDoc for class IO
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@5314 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2003-12-27 00:44:05 +00:00
matz 23f79ec282 * io.c (next_argv): warn always for stdin on inplace edit mode.
* io.c (read_all): need to check string value.

* io.c (argf_read): allow ARGF.read(nil).  [ruby-dev:22433]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@5310 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2003-12-26 17:05:20 +00:00
matz b9a79bc020 * io.c (rb_f_backquote): need not to check nil result.
[ruby-core:02078]

* io.c (rb_io_getline): should return nil on eof, even when nil rs is
  specified. [ruby-core:02077]

* pack.c (pack_pack): add sign check for 'i', and 'l'.
  [ruby-dev:22427]

* bignum.c (rb_quad_pack): add range check for 'quad int'.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@5308 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2003-12-26 15:34:33 +00:00
usa f573bcd129 * MANIFEST: add vms/config.h and remove vms/config.h_in.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@5300 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2003-12-26 01:59:42 +00:00
akiyoshi 67331f2497 [VMS] "rfm=stmlf" is specified for open() and fopen().
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@5299 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2003-12-26 01:47:12 +00:00
matz e9e100aa48 * eval.c (catch_timer): do not call rb_thread_schedule() inside to
avoid pthread_mutex_lock() deadlock.  interrupts to system calls
  are detected by TRAP_END via EINTR error.

* eval.c (thread_timer): do not post signal unless it is
  absolutely necessary.

* rubysig.h (TRAP_END): add CHECK_INTS to switch thread.

* regex.c (re_compile_pattern): check if nextp is smaller than
  pend.  [ruby-dev:22372]

* eval.c (umethod_bind): remove method overridden check.
  [ruby-dev:22366]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@5279 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2003-12-24 08:47:36 +00:00
dave f0346bd249 Forgot to save buffer.... sigh
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@5272 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2003-12-24 04:24:29 +00:00
matz 0a4fc3d71b * io.c (read_all): do not return nil at the end of file.
[ruby-dev:22334]

* io.c (argf_read): do not depend on nil at eof behavior of
  IO#read().

* eval.c (rb_thread_join): dup exception before re-raising it.

* io.c (rb_io_eof): call clearerr() to prevent side effect.  this
  patch is supplied by Masahiro Sakai <sakai@tom.sfc.keio.ac.jp>.
  [ruby-dev:22234]

* pack.c (OFF16): get offset for big endian machines.

* pack.c (pack_pack): use OFF16 instead of OFF16B.
  [ruby-dev:22344]

* pack.c (pack_unpack): ditto.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@5266 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2003-12-23 19:53:45 +00:00
nobu 163a6e81b2 * io.c (rb_io_ungetc): raise an exception at unread stream to
avoid unspecified behavior.  [ruby-dev:22330]

* test/ruby/test_system.rb (test_syntax): glob relatively from
  __FILE__.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@5261 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2003-12-23 10:43:04 +00:00
matz dbc5af97c7 * pack.c (pack_pack): remove unnecessary negative value check.
[ruby-dev:22329]

* io.c (rb_io_ungetc): need fflush before ungetc if write buffer
  is filled. [ruby-dev:22330]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@5259 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2003-12-23 10:02:17 +00:00
matz f449c04a36 * io.c (read_all): should return given string even if data read is
empty.  [ruby-dev:22207]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@5159 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2003-12-10 08:26:36 +00:00
akr 231f7cb95f io.c (rb_io_check_writable): don't call io_seek if EOF flag is set,
to avoid clearing EOF flag.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@5148 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2003-12-09 05:12:52 +00:00
akr 39e04f4aa0 * io.c (rb_io_check_readable): Don't clear EOF flag by io_seek.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@5147 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2003-12-09 03:50:02 +00:00
eban a971d184ce * io.c (flush_before_seek): flush before seek on any platform.
* configure.in: ditto.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@5126 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2003-12-06 12:48:51 +00:00
matz 7e6cecb769 * dln.c (aix_loaderror): should not use member named 'errno' which
might be a macro (e.g. on AIX).

* io.c (read_all): do not depend on lseek position.
  [ruby-dev:22026]

* eval.c (rb_eval): preserve $! value when retry happens in the
  rescue clause.  [ruby-talk:86697]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@5113 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2003-12-04 21:57:35 +00:00
matz 4f5976cbb8 * io.c (argf_read): should not terminate on empty string; wait
until real EOF.  [ruby-dev:21969]

* io.c (argf_read): should adjust length to read, when length is
  specified and read spans command line argument files.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@5096 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2003-12-03 17:30:09 +00:00
matz 2c1140b3e0 * io.c (appendline): file may not end with newline. a bug if
READ_DATA_PENDING_PTR is defined. [ruby-talk:84925]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@4937 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2003-11-11 13:48:51 +00:00
nobu 9fad82a6ba * io.c (rb_io_inspect): show the path also at a closed file.
[ruby-dev:21851]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@4911 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2003-11-06 09:05:11 +00:00
matz a4934a42cb * io.c (read_all): fptr->f may be NULL, if IO is closed in the
signal handler.

* io.c (io_read): ditto.

* string.c (get_pat): remove 1.8.0 warning code.

* string.c (rb_str_match): extend warning until 1.8.2.

* string.c (rb_str_match2): ditto.

* class.c (class_instance_method_list): remove 1.8.0 warnings.
  method_list now recurs.  [ruby-dev:21816]

* class.c (rb_obj_singleton_methods): ditto.

* array.c (rb_ary_select): remove select with block.
  [ruby-dev:21824]

* hash.c (rb_hash_select): ditto.

* hash.c (env_select): ditto.

* re.c (match_select): ditto.

* struct.c (rb_struct_select): ditto.

* process.c (check_uid_switch): remove duplicated error messages.

* process.c (check_gid_switch): ditto.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@4892 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2003-11-04 09:13:57 +00:00
matz 1a8ccefafc * io.c (READ_DATA_BUFFERED): new macro to detect whether stdio
buffer filled.

* io.c (rb_io_fptr_cleanup): move path deallocation to
  rb_io_fptr_finalize (finalizer called by GC).


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@4865 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2003-10-30 09:36:41 +00:00
matz c492b9b085 * eval.c (mark_frame_adj): need to adjust argv pointer if using
system's alloca. [ruby-core:01503]

* io.c (rb_f_gets): should call next_argv() before type check
  current_file. [ruby-list:38336]

* eval.c (proc_invoke): should retrieve retval when pcall is true.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@4509 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2003-09-05 05:07:54 +00:00
shugo 90e010abb9 * io.c (next_argv): should not call GetOpenFile() if rb_stdout is
not a IO (T_FILE).


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@4408 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2003-08-19 02:21:04 +00:00
matz 4aaa5493f9 * eval.c (method_proc): should specify YIELD_FUNC_SVALUE.
[ruby-dev:21107]

* marshal.c (w_object): should not call w_extended for USRMARSHAL
  dump. [ruby-dev:21106]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@4314 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2003-08-04 05:28:50 +00:00
matz 2c225e77e0 * numeric.c (flo_to_s): get rid of buffer overflow.
* io.c (appendline): clearerr(3) before raising exception, since
  exception may be captured by rescue. [ruby-talk:77794]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@4290 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2003-08-02 18:05:02 +00:00
nobu e36f44caa8 * io.c (rb_io_check_readable, rb_io_check_writable): ensure not
closed at first.

* io.c (rb_io_getline): check readable always.  (ruby-bugs:PR#1069)

* io.c (rb_io_each_byte): ditto.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@4262 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2003-08-01 07:23:00 +00:00
nobu 7162db6632 * io.c (READ_DATA_PENDING_PTR): cast to get rid of warnings.
* ext/socket/socket.c (unix_send_io, unix_recv_io): ditto.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@4261 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2003-08-01 07:02:54 +00:00
matz 5b9afca5e4 * numeric.c (rb_num_coerce_relop): export function.
* marshal.c (w_object): check has been dropped. "_dump must return
  string." [ruby-dev:21024]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@4243 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2003-07-31 08:42:44 +00:00
matz fe13785cc6 * marshal.c (w_object): if object responds to 'marshal_dump',
Marshal.dump uses it to dump object.  unlike '_dump',
  marshal_dump returns any kind of object.

* marshal.c (r_object0): restore instance by calling
  'marshal_load' method.  unlike '_load', it's an instance
  method, to handle cyclic reference.

* marshal.c (marshal_load): all objects read from file should be
  tainted. [ruby-core:01325]

* lib/timeout.rb (Timeout::timeout): execute immediately if sec is
  zero.

* ext/socket/socket.c (socks_init): typo fixed. [ruby-talk:77232]

* ext/socket/extconf.rb: the default value for --enable-socks is
  taken from ENV["SOCKS_SERVER"]. [ruby-talk:77232]

* ruby.c (proc_options): add -W option. -W0 to shut up all warning
  messages. [ruby-talk:77227]

* error.c (rb_warn): no message will be printed if the value of
  $VERBOSE is "nil", i.e. perfect silence.

* ruby.c (verbose_setter): $VERBOSE value is either true, false,
  or nil.

* io.c (Init_IO): no "read" check for $stdin.  in addition some
  function names has been changed.

* regex.c (re_match_exec): incorrect multibyte match.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@4220 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2003-07-29 18:26:55 +00:00
matz 37b2487c70 * lib/net/smtp.rb (Net::SMTP::send0): add taint check.
* ruby.h (LLONG_MIN): wrong value.

* io.c (rb_f_getc): $stdin may not be IO. [ruby-dev:20973]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@4206 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2003-07-29 07:52:55 +00:00
matz dea1baa169 * ext/stringio/stringio.c (strio_gets): only "gets" should set $_.
* ext/stringio/stringio.c (strio_getline): should not set $_ here.

* io.c (argf_to_s): argf.to_s returns "ARGF".

* io.c (set_defout_var, set_deferr_var): make $defout and $deferr
  obsolete.

* io.c (set_input_var, set_output_var): allow $stdin, $stdout,
  $stderr not to be instance of IO.

* io.c (rb_f_readline): forward method to current_file. gets,
  readline, readlines, getc, readchar, tell, seek, pos=, rewind,
  fileno, to_io, eof, each_line, each_byte, binmode, and closed?
  as well.

* io.c (argf_forward): utility function to forward method to
  current_file.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@4190 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2003-07-28 07:31:52 +00:00
nobu f01fe1351e * io.c (io_reopen): avoid dup2() equal handles not to close itself and
to get rid of a msvcrt bug.  [ruby-dev:20919]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@4177 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2003-07-26 18:10:47 +00:00
usa b431230396 * io.c (rb_fdopen): set errno if it's zero on win32 platforms.
* ext/openssl/ossl_ssl.c (TO_SOCKET): define special version when
  _WIN32 is defined. this is ruby's problem, not OpenSSL.

* win32/win32.c: remove some old comments.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@4172 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2003-07-26 12:27:04 +00:00
matz 5dd2b7102c * gcc -Wall clean-up.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@4151 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2003-07-24 18:33:50 +00:00
nobu 7a425f71e3 * io.c (io_fflush): need to check if closed after thread switch.
[ruby-dev:20351]

* io.c (fptr_finalize): ditto.

* string.c (rb_str_rindex_m): fixed wrong fix.  should move backward
  first only when matching from the end.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@4006 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2003-06-26 18:24:58 +00:00
aamine 9d05b9a4b3 * io.c (io_close): missing prototype.
* ext/socket/socket.c (bsock_do_not_rev_lookup_set): ditto.
* ext/win32ole/win32ole.c (foletype_guid, foletype_progid): ditto.
* error.c (syserr_initialize): length argument of sprintf() is an int.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@3990 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2003-06-23 14:55:09 +00:00
nobu 69459d98ef * dir.c (find_dirsep): get rid of warnings.
* eval.c (error_print): temporary value might be disposed by GC.

* hash.c (env_has_value, env_index): should not increment NULL.

* io.c (io_read, rb_io_sysread): not read when length is 0.

* io.c (rb_io_reopen): ensure initialized IO.

* io.c (rb_io_init_copy): sychronize file pointer.

* io.c (rb_io_s_pipe): make exception proof.

* string.c (rb_str_rindex_m): Fixnum 0 matched end of string.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@3984 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2003-06-23 08:41:07 +00:00
akr 2aba26fa52 * io.c (rb_open_file): initialize flags.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@3983 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2003-06-23 07:19:03 +00:00
matz 67dcad92b7 * string.c (rb_str_upto): generate sequence according to "succ"
order.  formerly check was done by dictionary order.
  [ruby-talk:74138]

* string.c (rb_string_value): fill constant empty string along
  with setting ELTS_SHARED if str->ptr is NULL. [ruby-core:01179]

* string.c (rb_string_value_ptr): ditto.

* string.c (rb_check_string_type): ditto.

* string.c (str_gsub): move END(0) check before mbclen2().

* string.c (scan_once): reduce END(0) check.

* io.c (rb_io_initialize): accept fixnum mode.

* eval.c (error_print): replace strchr() by memchr(), einfo may
  contain "\0".

* pack.c (pack_unpack): range check for "@" move; initialize check
  for "m".

* error.c (syserr_initialize): avoid buffer overflow.

* file.c (rb_file_s_readlink): expand buffer until readlink
  succeed.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@3982 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2003-06-23 06:52:39 +00:00
matz 9481face42 * parse.y (value_expr0): class and module statements should not be
warned for "void value expression". [ruby-talk:72989]

* gc.c (add_final): should determine type by respond_to?

* gc.c (define_final): ditto.

* io.c (rb_io_ctl): should not depend on respond_to?

* range.c (range_step): rb_check_string_type().

* process.c (proc_setgroups): new functions.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@3918 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2003-06-07 15:34:31 +00:00
matz 9e77e91a13 * eval.c (ruby_cleanup): $SAFE is turned off in the finalization.
Each END proc should preserve its own $SAFE level. [ruby-core:01119]

* marshal.c (marshal_load): remove unused variable "hash".
  [ruby-core:01120]

* hash.c (env_str_new): freeze strings from ENV. [ruby-talk:72860]

* array.c (rb_ary_first): optional argument to retrieve first n
  elements.

* array.c (rb_ary_last): optional argument to retrieve last n
  elements.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@3914 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2003-06-06 09:24:59 +00:00
matz 6125313d69 * array.c (push_values_at): Array#values_at should work with
ranges too.

* range.c (rb_range_beg_len): length calculation was wrong.

* eval.c (rb_call): should set T_ICLASS in the frame->last_class.
  [ruby-core:01110]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@3899 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2003-06-02 04:49:46 +00:00
matz 979f006b9e * io.c (rb_f_syscall): type dispatch should be based on
rb_check_string_type(), not FIXNUM_P(), because values may be a
  bignum.  [ruby-talk:72257]

* eval.c (rb_call0): should pass the current klass value to
  block_invoke, which may be called via "super". [ruby-core:01077]

* eval.c (block_invoke): now takes 4th argument "klass".

* eval.c (block_alloc): should propagate BLOCK_PROC to
  ruby_block.

* marshal.c (r_object0): should not use "yield" method, use "call"
  instead. (ruby-bugs-ja PR#476)


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@3886 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2003-05-30 16:08:03 +00:00
nobu 63a5a45a01 commit miss
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@3846 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2003-05-21 17:49:18 +00:00
nobu 874eca3c04 * eval.c (rb_thread_fd_close): raise for writing threads.
[ruby-dev:20269]

* io.c (rb_io_close, io_reopen): ditto.

* io.c (io_reopen): keep stdio objects for stdin, stdout,
  and stderr.  [ruby-dev:19442]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@3844 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2003-05-21 17:42:56 +00:00
matz db0b2bb241 * object.c (rb_mod_cmp): stupid comparison fixed.
* io.c (Init_IO): ARGF.path added (alias to ARGF.filename).
  [ruby-dev:20197]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@3821 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2003-05-19 06:27:06 +00:00
matz 6e52d10fe6 * object.c (init_copy): rename copy_object as initialize_copy,
since it works as copy constructor.

* eval.c (rb_add_method): initialize_copy should always be
  private, like initialize.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@3820 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2003-05-19 05:41:08 +00:00
matz c92a8f21a6 * io.c (set_stdio): better message.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@3799 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2003-05-15 04:27:14 +00:00
matz 2046e06513 * io.c (set_stdio): $stdin, $stdout, $stderr now became read-only.
* variable.c (readonly_setter): message changed.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@3798 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2003-05-15 04:20:31 +00:00
matz 5e8a9873a2 * eval.c (error_pos): use $deferr for output instead of stderr
directly.

* eval.c (error_print,error_handle,rb_longjmp,rb_thread_schedule):
  ditto.

* io.c (Init_IO): new variable $deferr which is default output
  port of error messages.

* io.c (rb_warn_m): new method "warn". [new]

* error.c (warn_print): use $deferr.

* error.c (rb_bug): ditto.

* error.c (err_append): ditto.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@3782 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2003-05-13 05:53:08 +00:00
matz 4870c89f77 * io.c (rb_io_reopen): It should be possible to reopen closed IO.
[ruby-talk:70941]

* io.c (rb_io_reopen): inherit original file mode unless specified.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@3770 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2003-05-09 08:12:52 +00:00
matz 776e2693e7 * string.c (rb_str_ljust): now takes optional argument to specify
pad string. [ruby-talk:70482]

* string.c (rb_str_rjust): ditto.

* string.c (rb_str_center): ditto.

* string.c (rb_str_justify): utility function.

* eval.c (rb_add_method): call singleton_method_added or
  method_added for every method definition (after ruby_running).
  [ruby-talk:70471]

* array.c (rb_ary_reverse_bang): Array#reverse! should not return
  nil even for arrays sized less than 2.

* io.c (argf_eof): should not block after reading all argument
  files. (ruby-bugs-ja PR#449)


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@3742 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2003-05-02 06:41:33 +00:00
matz 38bde8a9e0 * parse.y (open_args): warning message changed to "don't put space
before argument parentheses".

* io.c (argf_read): ARGF.read() should read all argument files.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@3735 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2003-04-26 14:59:19 +00:00
matz 60be770136 * io.c (argf_read): read should not span two files. [ruby-dev:20073]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@3731 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2003-04-25 09:41:08 +00:00
matz a268f439f2 * eval.c (splat_value): split splat_value() and avalue_splat().
* io.c: there's no way to set non-IO value to current_file, thus
  no need for argf_forward().


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@3730 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2003-04-25 09:20:51 +00:00
matz f34f20ebc5 * rubyio.h (struct OpenFile): add error raise flag to finalizer.
* io.c (Init_IO): define $/, $-0, and $\ as string-only
  variables.

* string.c (rb_str_split_m): does not generate empty string if
  there's no match in the receiver.

* io.c (fptr_finalize): should raise error on EBADF for readable
  IOs as well.

* file.c (rb_stat): use rb_check_convert_type() to retrieve IO.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@3679 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2003-04-14 09:04:43 +00:00
nobu 0b984f51a1 * io.c (set_stdin): assigned value must respond to "read" and
"getc".

* io.c (set_outfile): assigned value must respond to "write".
  (ruby-bugs-ja:PR#425)


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@3667 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2003-04-10 17:41:40 +00:00
matz e11f6de3c5 * ext/socket/socket.c (sock_s_unpack_sockaddr_in): remove struct
size check.  getnameinfo(3) can handle. [ruby-dev:19967]

* io.c (io_read): do not call rb_sys_fail() when required data
  length is zero. (ruby-bugs-ja PR#420)

* eval.c (umethod_proc): should raise TypeError, instead of
  returning error causing Proc.  Following the principle of "fail
  early".  [ruby-core:00927]

* pack.c (pack_pack): small but serious typo.

* eval.c (backtrace): skip internal allocator frame.
  (ruby-bugs-ja PR#416)


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@3646 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2003-04-07 06:58:31 +00:00
matz c94187bce0 * eval.c (rb_f_missing): use "inspect" for T_OBJECT as well.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@3640 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2003-04-03 05:25:00 +00:00
matz d4db9e9c60 * io.c (rb_io_initialize): should check rb_secure(4).
* dir.c (dir_s_getwd): should check rb_secure(4).

* object.c (rb_obj_infect): function version of OBJ_INFECT().

* eval.c (rb_secure_update): new function to check object update.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@3611 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2003-03-25 03:11:27 +00:00
matz 94f40186c0 * io.c (rb_io_fread): may lose data on nonblocking read.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@3604 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2003-03-23 15:38:44 +00:00
matz 85dd7bb0ef * eval.c (load_dyna): clear ruby_errinfo. (ruby-bugs-ja PR#409)
* io.c (read_all): make str empty if given. (ruby-bugs-ja PR#408)

* io.c (io_read): ditto.

* io.c (rb_io_sysread): ditto.

* range.c: do not override min and max.

* sprintf.c (remove_sign_bits): octal left most digit for negative
  numbers may be '3'. (ruby-bugs-ja PR#407)

* sprintf.c (rb_f_sprintf): should prefix sign bits if bignum is
  negative, using sign_bits().

* eval.c (avalue_to_mrhs): split argument passing and assignment
  conversion.

* eval.c (svalue_to_mrhs): ditto.

* eval.c (avalue_to_svalue): avalue_to_svalue([[1,2]]) should be
  [[1,2]], not [1,2] to wrap-around.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@3584 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2003-03-20 06:27:22 +00:00
eban 38ceb49b79 * io.c (prep_stdio): set binmode only if the file descriptor
is not connected to a terminal on Cygwin.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@3579 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2003-03-12 07:59:28 +00:00
matz d37e836a58 * io.c (rb_io_popen): do not call rb_io_close() directly, call
"close" method instead. [ruby-dev:19717]

* io.c (rb_io_s_open): ditto.

* hash.c (rb_any_hash): remove DEFER_INTS.  all do_hash() calls in
  st.c are at the top of functions.  No reentrant problem.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@3551 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2003-03-04 07:04:11 +00:00
matz 6a6d0ad220 * parse.y (arg): parse 'lhs = a rescue b' as 'lhs=(a rescue b)'.
* io.c (rb_io_fread): should not clearerr() if there's no filled
  buffer (i.e. rb_io_fread() returning zero).


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@3543 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2003-03-03 05:17:39 +00:00
matz ddd9d609dc * eval.c (rb_call0): should not report uninitialized warning by
attribute reader method.

* variable.c (rb_attr_get): new function to get instance variable
  without uninitialized warning.

* io.c (argf_to_io): should prefetch argv.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@3504 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2003-02-18 14:30:17 +00:00
eban 2f7275db77 * io.c (prep_stdio, Init_io): always set binmode on Cygwin.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@3496 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2003-02-15 18:16:52 +00:00
eban b53549941d * io.c (rb_file_sysopen): rb_file_sysopen_internal() needs four
arguments.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@3472 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2003-02-09 18:36:22 +00:00
matz 1d5e19f624 * array.c (rb_ary_equal): a == b is true when b is non T_ARRAY
object, if b has "to_ary" and b == a.

* hash.c (rb_hash_equal): a == b is true when b is non T_HASH
  object, if b has "to_hash" and b == a.

* string.c (rb_str_equal): a == b is true when b is non T_STRING
  object, if b has "to_str" and b == a.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@3442 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2003-02-04 07:27:43 +00:00
matz 74d5623029 * variable.c (rb_obj_classname): new function.
* string.c (rb_str_dup): should preserve original's class (but not
  hidden singleton class).

* string.c (rb_str_substr): ditto.

* parse.y: backout EXPR_CMDARG removal.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@3427 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2003-01-31 04:00:17 +00:00
michal 9df466b287 Updated Copyrights of Matz to 2003.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@3345 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2003-01-16 07:34:03 +00:00
nobu 51308528f2 * io.c (next_argv): not always set binmode.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@3338 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2003-01-13 16:24:40 +00:00
eban 7af9f79560 * io.c (next_argv): inherit binmode from $defout.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@3332 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2003-01-12 09:24:28 +00:00
nobu 4e6dbec8c8 * configure.in (RUBY_CHECK_IO_NEED): added more tests.
* io.c (rb_io_check_readable): seek after synchronized write.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@3326 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2003-01-10 16:47:03 +00:00
nobu 00eedd2da9 adjust indentation
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@3319 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2003-01-09 08:20:32 +00:00
nobu 99628bf1f0 * configure.in (RUBY_CHECK_IO_NEED): check whether fseek() and
fflush() are needed.

* io.c (flush_before_seek): flush write stream only.

* io.c (rb_io_check_readable): seek instead of flush if the last
  operation was write.

* io.c (rb_io_check_writable): seek instead of flush if the last
  operation was read.

* bcc32/Makefile.sub, win32/Makefile.sub: needs to seek between
  R/W.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@3318 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2003-01-09 08:05:32 +00:00
matz 6d481a4ae4 * hash.c (env_clear): new Hash compatible method.
* hash.c (env_shift): ditto.

* hash.c (env_invert): ditto.

* hash.c (env_replace): ditto.

* hash.c (env_update): ditto.

* array.c (rb_ary_join): dispatch based on "to_str".

* array.c (rb_ary_times): ditto.

* array.c (rb_ary_equal): ditto.

* process.c (rb_f_exec): dispatch based on "to_ary".

* eval.c (umethod_bind): exact class match is not required.  relax
  the restriction to subclasses.

* eval.c (rb_eval): call "inherited" before executing class body.

* class.c (rb_define_class): call "inherited" after defining the
  constant.

* class.c (rb_define_class_under): ditto.

* eval.c (massign): expand first element if RHS is an array and
  its size is 1, and LHS has concrete assignment target (i.e. LHS
  has target(s) other than *var).

* eval.c (massign): avoid unnecessary avalue/svalue conversion.

* eval.c (rb_yield_0): ditto

* array.c (rb_ary_update): do not allocate unused array if rpl is
  nil (i.e. merely removing elements).

* io.c (io_read): should resize supplied string if it's shorter
  than expected.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@3307 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2003-01-07 07:36:40 +00:00
usa b469f3155a * array.c (ary_alloc), dir.c (dir_s_alloc), eval.c (thgroup_s_alloc),
file.c (rb_stat_s_alloc), hash.c (hash_alloc), io.c (io_alloc),
  object.c (rb_module_s_alloc, rb_class_allocate_instance),
  re.c (match_alloc, rb_reg_s_alloc), string.c (str_alloc),
  time.c (time_s_alloc), ext/digest/digest.c (rb_digest_base_alloc),
  ext/tcltklib/tcltklib.c (ip_alloc),
  ext/win32ole/win32ole.c (fole_s_allocate, fev_s_allocate)
  : add prototype to get rid of VC++ warnings.

* ext/sdbm/init.c (fsdbm_alloc): allocator takes only one argument.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@3197 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2002-12-21 18:02:01 +00:00
nobu 5b615c70eb * io.c (rb_io_fwrite): separated from io_write().
* marshal.c (w_byten): use rb_io_fwrite() to support non-blocking
  IO, and added error check.

* rubyio.h: prototypes; rb_io_fwrite


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@3191 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2002-12-20 09:29:41 +00:00
matz bc49bc7c6b * parse.y (do_block): split "do" block and tLBRACE_ARG block.
* parse.y (cmd_brace_block): new tLBRACE_ARG block rule

* parse.y (command): can take optional cmd_brace_block; use %prec
  to resolve shift/reduce conflict. (ruby-bugs-ja PR#372)

* eval.c (ruby_finalize): trace_func should be cleared here (after
  executing exit procs and finalizers).

* eval.c (rb_define_alloc_func): new allocation framework, based
  on Nobu's work [ruby-dev:19116].  "allocate" method is no longer
  used for object allocation.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@3188 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2002-12-20 08:33:17 +00:00
matz baa00aa250 * numeric.c (num_step): use DBL_EPSILON.
* array.c (rb_check_array_type): new function: return an array
  (convert if possible), or nil.

* string.c (rb_check_string_type): new function: return a string
  (convert if possible), or nil.

* numeric.c (rb_dbl_cmp): returns nil if values are not
  comparable.

* numeric.c (fix_cmp,flo_cmp): use rb_num_coerce_cmp()

* bignum.c (rb_big_cmp): ditto.

* numeric.c (rb_num_coerce_cmp): new coercing function for "<=>",
  which does not raise TypeError.

* numeric.c (do_coerce): can be supress exception now.

* object.c (rb_mod_cmp): should return nil for non class/module
  objects.

* re.c (rb_reg_eqq): return false if the argument is not a
  string.  now returns boolean value.

* class.c (rb_include_module): argument should be T_MODULE, not
  T_class, nor T_ICLASS.

* eval.c (is_defined): "defined?" should return "assignment" for
  attribute assignment (e.g. a.foo=b) and indexed assignment
  (e.g. a[2] = 44).

* parse.y (aryset): use NODE_ATTRASGN.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@3169 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2002-12-19 09:20:20 +00:00
uema2 b19e36a214 * configure.in, defines.h, dir.c, dir.h, dln.c, error.c,
eval.c, file.c, hash.c, io.c, main.c, missing.c,
      process.c, ruby.c, rubysig.h, signal.c, st.c, util.c, util.h,
      bcc/Makefile.sub, win32/Makefile.sub, win32/win32.h,
      ext/Win32API/Win32API.c, ext/socket/getaddrinfo.c,
      ext/socket/getnameinfo.c, ext/socket/socket.c,
      ext/tcltklib/stubs.c
      : replace "NT" with "_WIN32", add DOSISH_DRIVE_LETTER
* wince/exe.mak : delete \r at the end of lines.
* wince/mswince-ruby17.def : delete rb_obj_become


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@3148 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2002-12-15 03:18:08 +00:00
matz 2498da0ea0 * io.c (io_read): takes optional second argument to specify a
string to be written.  the string should not be frozen.

* io.c (rb_io_sysread): ditto.

* lib/getoptlong.rb (GetoptLong::Error): provide a common ancestor
  for GetoptLong error classes (RCR#129).

* re.c (rb_reg_copy_object): fixed memory leak.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@3126 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2002-12-11 09:32:41 +00:00
matz 60b2446bea * sprintf.c (rb_f_sprintf): preceding ".." for negative numbers
still left;  removed.

* sprintf.c (rb_f_sprintf): should not prepend '0' if width > prec
  for example "%5.3d".

* process.c (Init_process): add Process.exit and Process.abort

* pack.c (utf8_to_uv): raise ArgumentError for malformed/redundant
  UTF-8 sequences.

* process.c (last_status_set): add pid attribute to Process::Status.

* pack.c (uv_to_utf8): limit maximum length of the encoded string
  to 6 bytes, even when the platform supports 8 bytes long integers.

* pack.c (utf8_to_uv): do not decode sequences longer than 6 bytes.

* object.c (copy_object): use "copy_object" method, not "become".


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@3123 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2002-12-10 06:23:44 +00:00
matz 90c4dae08f WinCE patch merged
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@3106 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2002-12-02 07:57:17 +00:00
knu a2868ff651 * eval.c, file.c, gc.c, io.c, object.c, ruby.c, ruby.h, struct.c,
ext/socket/socket.c: differentiate long and int; use proper
  printf type specifiers and do casts where appropriate.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@3014 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2002-10-29 21:35:28 +00:00
eban c87332937b * djgpp/*: sync with the latest.
* ext/extmk.rb, lib/mkmf.rb: flush $stdout.
* io.c (READ_DATA_PENDING_COUNT, READ_DATA_PENDING_PTR):
  undef these macros on DJGPP.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@3007 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2002-10-27 09:04:55 +00:00
nobu ca7549b203 * gc.c (gc_sweep): also adjust heaps_limits when free unused heap
page.  [ruby-core:00526]

* io.c (io_fflush): condition to retry can occur.

* io.c (io_write): returned 0 wrongly if no error occurred.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@2947 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2002-10-09 06:12:54 +00:00
nobu 00882bfe35 * io.c (io_write): must check returned value from fwrite() before
test with ferror().  (ruby-bugs-ja:PR#350)


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@2945 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2002-10-08 05:34:45 +00:00
nobu 3a76a40196 * configure.in (RUBY_CHECK_IO_NEED_FLUSH): check whether fflush()
is needed.

* io.c (flush_before_seek): flush before seek if buffered data
  may remain.

* io.c (rb_io_check_readable): flush if the last operation was
  write.

* io.c (rb_io_check_writable): flush if the last operation was
  read.

* rubyio.h (FMODE_RBUF): added.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@2923 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2002-10-02 14:59:25 +00:00
nobu 71c41cf5a5 * io.c (rb_io_wait_readable): handle retryable errors.
* io.c (rb_io_wait_writable): ditto.

* ext/socket/socket.c (bsock_send): ditto.

* ext/socket/socket.c (s_recvfrom): ditto.

* ext/socket/socket.c (s_accept): ditto.

* ext/socket/socket.c (udp_send): ditto.

* ext/socket/getaddrinfo.c (afdl): made private structures constant.

* rubyio.h: prototype; rb_io_wait_readable(), rb_io_wait_writable().


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@2921 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2002-10-02 14:13:58 +00:00
nobu a7a8ea12da * io.c (rb_io_inspect): not need to raise IOError for closed stream. [ruby-talk:51871]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@2910 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2002-09-30 11:31:28 +00:00
matz 4b9a7eac05 * io.c (appendline): forget to terminate with nul.
* eval.c (ruby_run): should set toplevel visibility again here.

* eval.c (rb_eval): should not rely on ruby_class == rb_cObject
  check.   Besides allow implicit publicity for attribute set
  methods.

* parse.y (primary): need not to check class_nest, just set
  whether method is an attrset or not.

* string.c (rb_str_each_line): p might be at the top of the
  string.

* class.c (rb_make_metaclass): class of metaclass should be
  metaclass of superclass, unless class itself is a metaclass;
  class of metaclass of metaclass should point back to self.
  eh, confusing, isn't it.

* class.c (rb_singleton_class): check if its class is singleton
  AND attached to self.

* eval.c (rb_eval): should define class/module under ruby_cbase.

* eval.c (rb_eval): should set class/module path based on
  ruby_cbase, not ruby_class.

* eval.c (module_setup): use ruby_cbase instead of ruby_class.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@2887 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2002-09-25 07:03:05 +00:00
michal c7e16e94e4 move struct timeval to missing.h
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@2873 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2002-09-17 13:52:45 +00:00
aamine 50cc115b7e * io.c: add parameter prototype.
* re.c: ditto.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@2869 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2002-09-16 15:56:31 +00:00
nobu f34534c52a retry on EINTR, ERESTART and EWOULDBLOCK. [ruby-dev:17855], [ruby-dev:17878], [ruby-core:00444]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@2841 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2002-09-11 01:09:04 +00:00
aamine 5ef74b512c * io.c (rb_io_puts): RSTRING(line)->ptr might be NULL.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@2805 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2002-09-06 01:58:32 +00:00
matz 6f484e4930 * variable.c (rb_copy_generic_ivar): remove old generic instance
variable table if it existes.

	* class.c (rb_make_metaclass): metaclass of a metaclass is a
	  metaclass itself.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@2784 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2002-09-03 05:20:14 +00:00
michal 438ea00969 read_all ftello (instead ftell) (ruby-core:392)
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@2778 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2002-09-02 08:05:39 +00:00
eban 3bf972993f * io.c (read_all): should use off_t instead of long.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@2763 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2002-08-29 04:38:37 +00:00
nobu b961db7587 * io.c (appendline): data was lost when raw mode.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@2759 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2002-08-28 14:36:38 +00:00
nobu 4c59a65d04 adjust indet
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@2757 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2002-08-28 09:41:58 +00:00
michal 0d0ae37e50 Int vs Long cleanup #3 (ruby-core:352)
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@2754 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2002-08-28 08:05:23 +00:00
matz c45908e41f * file.c (rb_find_file): $LOAD_PATH must not be empty.
* file.c (rb_find_file_ext): ditto.

* range.c (range_eq): class check should be based on range.class,
  instead of Range to work with Range.dup.

* range.c (range_eql): ditto.

* class.c (rb_mod_dup): need to preserve metaclass and flags.

* object.c (rb_cstr_to_dbl): had a buffer overrun.

* marshal.c (w_class): integrate singleton check into a funciton
  to follow DRY principle.

* marshal.c (w_uclass): should check singleton method.

* object.c (rb_obj_dup): dmark and dfree functions must be match
  for T_DATA type.

* object.c (rb_obj_dup): class of the duped object must be match
  to the class of the original.

* re.c (rb_reg_quote): do not escape \t, \f, \r, \n, for they are
  not regular expression metacharacters.

* time.c (time_s_alloc): use time_free instead of free (null check,
  also serves for type mark).

* time.c (time_s_at): check dfree function too.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@2748 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2002-08-27 08:31:08 +00:00
michal ffc13a6525 *.c: Int vs Long cleanup
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@2734 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2002-08-21 15:47:54 +00:00
matz c7c1384e60 * eval.c (rb_thread_cleanup): should not modify the global
variable curr_thread.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@2731 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2002-08-21 08:30:09 +00:00
H_Konishi 5738d62912 * replace of check EPIPE error(in getc()) rutine on bcc32.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@2728 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2002-08-20 13:03:22 +00:00
matz c8c55db68a * io.c (rb_io_putc): output via rb_io_write().
* re.c (rb_reg_initialize_m): frozen check should be moved here
  from rb_reg_initialize().


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@2725 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2002-08-20 07:36:01 +00:00
eban 4f60a534cd * io.c (NOFILE): define NOFILE as 64 if not defined.
* signal.c (sighandler_t): rename to sh_t on dietlibc.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@2715 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2002-08-16 07:23:04 +00:00
nobu 2229b70615 * io.c (rb_io_fread): renamed from io_fread and made extern.
* marshal.c (r_bytes0): check if successfully read, use
  rb_io_fread() instead of fread() to be preemptive.
  (ruby-bugs-ja:PR#294, 295)

* rubyio.h (rb_io_fread): added.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@2713 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2002-08-16 02:52:25 +00:00
usa 2f2143a2be * io.c (pipe_finalize, pipe_popen): two-way pipe support for win32.
* win32/win32.c (ChildRecord, FindFreeChildSlot): ditto.

* win32/win32.c, win32/win32.h (pipe_exec): new function for two-way
  pipe support for win32.

* win32/win32.c, win32/win32.h (FindPipedChildSlot, rb_w32_popen,
  rb_w32_pclose): removed functions for two-way pipe support for win32.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@2610 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2002-06-28 18:26:01 +00:00
H_Konishi d0b3651906 new platform [bccwin32] merged.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@2543 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2002-06-11 01:27:48 +00:00
matz 4ab1577db3 * parse.y: yyparse #defines moved from intern.h
* ruby.c (proc_options): access prefixed "ruby_yydebug".

* applied modifies to pacify some of gcc -Wall warnings.

* parse.y (arg): no more ugly hack for "**", so that "-2**2" to be
  parsed as "(-2)**2", whereas "- 2**2" or "-(2)**2" to be parsed
  as "-(2**2)".

* parse.y (yylex): '-2' to be literal fixnum. [new]

* time.c (time_succ): new method for Range support.

* time.c (time_arg): nil test against v[6] (usec).


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@2500 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2002-05-29 05:20:39 +00:00
matz 6e87a54aec * ruby.c (proc_options): removed "-*-" support for #! line.
* io.c (rb_io_s_sysopen): new method to get a raw file
  descriptor. [new]

* ext/socket/socket.c (tcp_sysaccept): new method to return an
  accepted socket fd (integer). [new]

* ext/socket/socket.c (unix_sysaccept,sock_sysaccept): ditto.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@2492 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2002-05-23 05:35:32 +00:00
nobu b241a0680c * io.c (rb_io_clone): writing stream was not copied properly.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@2473 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2002-05-20 04:33:59 +00:00
matz 20ed1f8d1a * error.c: use HAVE_DECL_SYS_NERR instead of platform names.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@2423 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2002-05-02 07:50:36 +00:00
matz e3a8c62630 * io.c (rb_io_mode_flags): both 'r+b' and 'rb+' should be allowed.
* io.c (rb_io_mode_modenum): ditto.

* gc.c (rb_memerror): rename from mem_error, and exported.

* gc.c (Init_GC): pre-allocate NoMemoryError instance.

* object.c (convert_type): error message changed from "failed to
  convert" to "cannot convert", since it does not try to convert
  if an object does not respond to the converting method.

* eval.c (block_pass): convert Method to Proc using
  rb_check_convert_type().

* object.c (rb_check_convert_type): always convert T_DATA

* eval.c (rb_thread_cleanup): should not terminate main_thread by
  Fatal error.

* regex.c (is_in_list): need to not exclude NUL and NEWLINE.

* re.c (rb_reg_expr_str): wrong backslash escapement.

* re.c (rb_reg_expr_str): do not escape embedded space
  characters.

* marshal.c (w_object): T_DATA process patch from Joel VanderWerf
  <vjoel@PATH.Berkeley.EDU>.  This is temporary hack; it remains
  undocumented, and it will be removed when marshaling is
  re-designed.

* marshal.c (r_object): ditto.

* numeric.c (num_step): Integer#step is moved to Numeric#step;
  Fixnum#step is merged into this method.

* numeric.c (int_dotimes): Fixnum#times is merged.

* numeric.c (int_upto): Fixnum#upto is merged.

* numeric.c (int_downto): Fixnum#downto is merged.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@2401 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2002-04-24 04:54:16 +00:00