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

453 Коммитов

Автор SHA1 Сообщение Дата
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
matz e63a990141 * re.c (rb_reg_expr_str): should treat backslash specially in
escaping.

* io.c: complete off_t handling; missing argument for
  fptr_finalize(); polished rb_scan_args call.

* dir.c: wrap multi-statment macro by do { } while (0)

* eval.c, numeric,c, sprintf.c, util.c: ditto.

* bignum.c (rb_big_eq): check `y == x' if y is neither Fixnum,
  Bignum, nor Float.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@2382 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2002-04-18 08:46:18 +00:00
matz 9a24232fd2 * pack.c (pack_unpack): should treat 'U' in character unit, not in
byte unit.

* error.c (exc_initialize): should clear backtrace information.

* io.c (rb_io_fptr_cleanup): should close IO created by IO.new(fd).

* rubyio.h: remove FMODE_FDOPEN


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@2375 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2002-04-15 07:48:47 +00:00
matz cd948e4600 * struct.c (rb_struct_select): fix typo.
* io.c (io_write): check error if written data is less than
  specified size to detect EPIPE.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@2372 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2002-04-12 08:45:02 +00:00
eban 65a269376f * io.c (remain_size): IO#read returns "" if file.size == 0.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@2365 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2002-04-11 10:11:53 +00:00
matz 1c6a8e4deb * Makefile.in (CPPFLAGS): remove @includedir@.
* lib/mkmf.rb (create_makefile): ditto.

* ext/extmk.rb.in (create_makefile): ditto.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@2320 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2002-04-02 06:48:45 +00:00
matz de373b1b6c * io.c (rb_io_fptr_cleanup): need flush even when io will not be
closed.

* io.c (rb_io_initialize): was calling wrong function
  rb_io_mode_flags().


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@2316 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2002-04-01 08:31:49 +00:00
matz 1550277b34 * re.c (match_setter): it's OK to assign nil to $~.
* io.c (rb_io_fptr_cleanup): do not close IO created by for_fd().

* io.c (rb_io_initialize): mark IO created by for_fd

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


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@2312 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2002-04-01 07:39:09 +00:00
matz 564222ba27 * io.c (io_fflush): DRY patch from /Christoph applied.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@2308 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2002-03-29 14:50:09 +00:00
matz cc38f5f090 * ext/socket/socket.c (sock_addrinfo): should specify socktype
from outside.

* io.c (argf_binmode): should call next_argv() to initialize ARGF.

* io.c (argf_filename): ditto.

* io.c (argf_file): ditto.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@2299 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2002-03-28 09:17:54 +00:00
eban e1eee80893 * io.c (READ_DATA_PENDING): configure.in has supported for uClibc,
so remove uClibc stuff.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@2297 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2002-03-27 05:55:01 +00:00
nobu 4ae4525ca4 typo
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@2296 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2002-03-27 05:52:36 +00:00
matz cf06d8b20b * io.c (rb_io_sysseek): new method based on a patch from Aristarkh
A Zagorodnikov <xm@bolotov-team.ru>. [new]

* io.c (READ_DATA_PENDING): use !feof(fp) for default behavior.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@2294 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2002-03-27 05:28:00 +00:00
nobu dfaf41d759 * configure.in (FILE_READPTR): new. for IO#gets improvement.
* io.c (READ_DATA_PENDING_PTR): ditto.

* io.c (remain_size): separated from read_all().

* io.c (read_all): argument chagend.

* io.c (appendline): new.  get a line and append to string.

* io.c (swallow): new.  swallow continuous line delimiters.

* io.c (rb_io_getline_fast): add delimiter argument.

* io.c (rb_io_getline): performance improvement.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@2276 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2002-03-25 14:50:40 +00:00
matz e748f56a6b * ext/socket/socket.c (bsock_do_not_rev_lookup_set): should not be
allowed when $SAFE > 3.

* eval.c (rb_thread_ready): THREAD_TO_KILL threads should not turn
  into THREAD_RUNNABLE on wakeup.

* eval.c (rb_thread_list): THREAD_TO_KILL threads should be in the
  list.

* eval.c (thgroup_list): ditto; by moving gid clearance from
  rb_thread_cleanup().

* dir.c (fnmatch): "*/bar" (with FNM_PATHNAME flag) does not
  match "foo/bar".

* io.c (read_all): files on /proc filesystem with zero stat size,
  may have contents.

* ext/socket/socket.c (tcp_s_gethostbyname): refactored.

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


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@2271 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2002-03-25 06:18:07 +00:00
matz 2bd0c2bf73 * the VMS support patch submitted by Akiyoshi, Masamichi
<Masamichi.Akiyoshi@jp.compaq.com> is merged.

* eval.c (exec_under): changing ruby_class is OK, but should not
  alter cbase.

* eval.c (yield_under_i): ditto.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@2258 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2002-03-22 07:26:42 +00:00
matz 997b69cb6a * re.c (rb_reg_match): should clear $~ if operand is nil.
* re.c (rb_reg_match2): ditto.

* configure: merge Jonathan Baker's large file support patch
  [ruby-talk:35316], with read_all patch in [ruby-talk:35470].

* eval.c (rb_f_abort): optional message argument that be printed
  on termination. [new]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@2200 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2002-03-14 06:23:46 +00:00
eban 2fcd221fec * io.c (READ_DATA_PENDING): uClibc support.
* random.c (rand_init): ditto.
* ext/socket/{addinfo.h,getaddrinfo.c} (gai_strerror): ditto.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@2143 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2002-02-27 04:30:20 +00:00
matz 088d04d88e * bignum.c (get2comp): need to specify to carry or not.
* io.c (rb_io_inspect): embed path info.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@2112 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2002-02-22 10:28:47 +00:00
nobu 0eb1a2ff6d * intern.h: prototypes; rb_io_addstr(), rb_io_printf(),
rb_io_print(), rb_io_puts()

* io.c (rb_io_addstr): make extern.

* io.c (rb_io_printf): ditto.

* io.c (rb_io_print): ditto.

* io.c (rb_io_puts): ditto.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@2104 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2002-02-20 06:35:37 +00:00
usa 4fd111f0c1 * io.c (rb_io_close): return Qnil.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@2103 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2002-02-20 04:42:49 +00:00
matz c46468d773 * hash.c (rb_any_cmp): should handle Qundef in keys.
* eval.c (remove_method): should not remove a empty method to
  implement "undef".

* eval.c (rb_eval): should allow singleton class def for
  true/false/nil.

* parse.y (str_extend): backslash escape was done wrong.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@2102 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2002-02-20 04:31:50 +00:00
nobu 0cbfe8c524 * io.c (rb_io_ungetc): don't fail pushed EOF back.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@2086 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2002-02-19 04:19:06 +00:00
matz 90991d9889 * io.c (io_write): flag when buffered write is done.
* io.c (fptr_finalize): do not raise error on EBADF if write
  buffer is empty.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@2052 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2002-02-07 04:18:08 +00:00
matz d77119bfe4 * io.c (rb_io_readlines): avoid calling GetOpenFile() repeatedly.
* io.c (rb_io_each_line): ditto.

* io.c (argf_getline): ditto.

* process.c: should include <time.h> to get proper CLK_TCK.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@2049 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2002-02-06 07:30:13 +00:00
nobu cc2ab3aca6 * io.c (fptr_finalize): ignore EBADF when f and f2 use same
descriptor.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@2047 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2002-02-05 17:10:54 +00:00
matz 8210c254be * io.c (fptr_finalize): should raise error when fclose fails.
* eval.c (method_inspect): proper output format to distinguish
  methods and singleton methods.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@2046 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2002-02-05 07:56:31 +00:00
matz eb9708f386 * array.c (Init_Array): remove Array#filter.
* object.c (rb_mod_initialize): should accept zero argument.

* object.c (rb_mod_cmp): should raise ArgumentError if
  inheritance/inclusion relation between two classes/modules is
  not defined. [new]

* io.c (rb_io_fsync): new method. [new]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@2014 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2002-01-23 07:30:43 +00:00
matz b03bdcd64f * eval.c (ruby_stop): should not trace error handler.
* signal.c (install_sighandler): do not install sighandler unless
  the old value is SIG_DFL.

* io.c (io_write): should not raise exception on O_NONBLOCK io.

* dir.c (dir_set_pos): seek should return dir, pos= should not.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@2009 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2002-01-21 07:44:06 +00:00
matz a7a7324ea6 * io.c (rb_io_s_new): block check moved from initialize to this
method.

* io.c (rb_io_s_open): open should call initialize too. IO#for_fd
  also calls initialize. [new]

* error.c (rb_sys_fail): replace INT2FIX() by INT2NUM() since
  errno value may not fit in Fixnum size on Hurd.

* error.c (set_syserr): ditto.

* dir.c (dir_s_glob): returns nil if block given.

* io.c (rb_io_each_byte): should return self.

* io.c (rb_io_close_m): close check added.

* dir.c (dir_seek): should return pos.

* parse.y (fixpos): orig may be (NODE*)1, which should not be
  dereferenced.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@2004 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2002-01-18 14:24:01 +00:00
matz 85e32dd221 * re.c (match_select): should propagate taintness.
* hash.c (rb_hash_set_default): Hash#default= should return the
  new value.

* string.c (rb_str_to_i): accepts optional base argument. [new]

* numeric.c (rb_fix2str): should not handle negative fixnum values
  int32 via calling sprintf() directly.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@1985 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2002-01-11 09:18:54 +00:00
matz 459031e5d9 * process.c (rb_f_system): abandon vfork.
* io.c (pipe_open): ditto.

* defines.h: sparc linux needs different FLUSH_REGISTER_WINDOWS

* regex.c (re_search): abandon stclass optimization.

* bignum.c (rb_cstr2inum): deny "0_".

* bignum.c (rb_cstr2inum): allow "0\n" and so on.

* error.c (rb_invalid_str): utility function to show inspect()'ed
  string.

* bignum.c (rb_cstr2inum): prints invalid strings in inspect()'ed
  format.

* object.c (rb_Float): ditto.

* object.c (rb_convert_type): no longer use rb_rescue().

* re.c (rb_reg_search): initialize taint status of match object.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@1959 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2002-01-04 14:15:33 +00:00
matz 63b6b9c430 * time.c (time_plus): result should not be negative unless
NEGATIVE_TIME_T is defined.

* time.c (time_new_internal): should check tv_sec overflow too.

* time.c (time_timeval): should check time_t range when time is
  initialized from float.

* time.c (time_plus): uses modf(3).

* variable.c (rb_cvar_set): add frozen class/module check.

* variable.c (rb_cvar_declare): add frozen class/module check.

* re.c (match_to_a): should propagate taint.

* re.c (rb_reg_s_quote): ditto.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@1933 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2001-12-21 09:23:28 +00:00
matz ee87eb1367 * eval.c (rb_mod_define_method): define_method should follow
default method visibility.

* eval.c (rb_attr): should warn if the default method visibility
  is "module_function" (can be error).

* eval.c (rb_mod_define_method): should define class/module method
  also if the visibility is "module_function".

* eval.c (rb_mod_define_method): should call hook method
  "method_added", and "singleton_method_added".

* string.c: use RESIZE_CAPA for capacity change.

* ext/socket/socket.c (Init_socket): add listen method to
  TCPServer and UNIXServer.

* ext/socket/socket.c (bsock_send): should raise EWOULDBLOCK
  exception.

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

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

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


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@1923 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2001-12-19 07:48:32 +00:00
nobu cd956b3114 * intern.h: add prototypes.
rb_gc_enable(), rb_gc_disable(), rb_gc_start(), rb_str_new5()
  rb_str_buf_append(), rb_str_buf_cat(), rb_str_buf_cat2(),
  rb_str_dup_frozen()

* ruby.h: added declaration.
  rb_defout, rb_stdin, rb_stdout, rb_stderr, ruby_errinfo

* rubyio.h: changed double include guard macro to RUBYIO_H.

* array.c (inspect_call): make static.

* eval.c (dvar_asgn): ditto.

* io.c (rb_io_close_read): ditto.

* lex.c (rb_reserved_word): ditto.

* ruby.c: (req_list_head, req_list_last): ditto.

* ruby.c (require_libraries): ditto.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@1915 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2001-12-17 07:52:35 +00:00