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

242 Коммитов

Автор SHA1 Сообщение Дата
dave 84f0b051de Annotate enum.c. Add pager support, and report on methods in included modules
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@5214 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2003-12-18 21:08:25 +00:00
matz fc63eb3a77 * enum.c (each_with_index_i): typo.
* eval.c (rb_yield_splat): should call svalue_to_avalue() before
  calling rb_yield_0().


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@4427 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2003-08-22 17:43:57 +00:00
matz 7ff7bcbf9d * enum.c (inject_i): use rb_yield_values.
* enum.c (each_with_index_i): ditto.

* eval.c (rb_yield_splat): new function to call "yield *values".

* string.c (rb_str_scan): use rb_yield_splat().


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@4424 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2003-08-22 08:09:58 +00:00
matz 82cf98939f * eval.c (rb_yield_0): give warning for multiple values for a
block parameter.

* eval.c (rb_yield_values): a function to yield multiple values.

* array.c (sort_1): use rb_yield_values.

* enum.c (min_ii, max_ii): ditto.

* hash.c (rb_hash_update_block_i, delete_if_i, select_i,
  each_pair_i, env_each, env_reject_bang, env_select,
  env_update_i): ditto.

* struct.c (rb_struct_each_pair): ditto.

* eval.c (top_include): should include module in the current self,
  not ruby_top_self. [ruby-dev:20198]

* eval.c (top_include): stop inclusion to ruby_wrapper; give
  warning.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@3833 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2003-05-20 06:29:23 +00:00
matz 7e35911e10 * ext/pty/pty.c (pty_finalize_syswait): join (using Thread#value)
before detach pid. [ruby-talk:71519]

* eval.c (PUSH_FRAME): save outer ruby_block. [ruby-list:37677],
  [ruby-dev:20202]

* eval.c (BEGIN_CALLARGS): restore outer block by using
  ruby_block->outer.

* eval.c (block_pass): do not alter block->prev, but block->outer.

* array.c (get_inspect_tbl): warning on wrong condition.

* eval.c (localjump_xvalue): renamed exitstatus to exit_value
  since it's not exit "status" after all.

* eval.c (localjump_error): add reason to LocalJumpError.

* compar.c (rb_cmpint): raise error via rb_cmperr(), if cmp value
  is nil. now take new 2 arguments.

* time.c (time_cmp): 2003-05-16 fix was incomplete.
  (ruby-bugs-ja:PR#458)


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@3823 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2003-05-19 15:45:46 +00:00
michal 4e13d36561 -Wall cleanups (removed unused vars, no 'code has no effect' warnings)
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@3346 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2003-01-16 07:38:40 +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
matz a973f9698f * enum.c (enum_all): now works without block.
* enum.c (enum_any): ditto.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@3344 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2003-01-15 08:07:41 +00:00
matz e2d384d628 * file.c (rb_find_file_ext): should not terminate searching with
empty path, just ignore.

* dir.c: remove <sys/parm.h> inclusion.

* compar.c (cmp_eq,cmp_gt,cmp_ge,cmp_lt,cmp_le): check using
  rb_cmpint().

* error.c (init_syserr): remove sys_nerr dependency.

* numeric.c (num_cmp): added to satisfy Comparable assumption.

* eval.c (rb_add_method): "initialize" should be public if it is a
  singleton method.

* regex.c (re_match): avoid dereferencing if size == 0.
  (ruby-bugs-ja:PR#360)

* time.c (time_cmp): should return nil if an operand is not a
  number nor time. (ruby-bugs-ja:PR#359)

* file.c (rb_stat_cmp): should return nil if an operand is not
  File::Stat.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@3076 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2002-11-22 09:14:24 +00:00
matz 5315f0d667 * array.c (rb_ary_zip): iterates over items in the receiver.
zipped with nil if argument arrays are shorter.  if arrays are
  longer, left items are ignored.  now works with blocks.

* enum.c (zip_i): changed for new behavior.

* array.c (rb_ary_transpose): added. [new]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@3064 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2002-11-19 08:07:51 +00:00
matz aae36756dc * object.c (Init_Object): added Object#object_id, new name for
Object#id. [new]

* object.c (rb_obj_id_obsolete): give warning for Object#id.

* numeric.c (fix_intern): added Fixnum#to_sym. [new]

* object.c (sym_to_sym): rename from Symbol#intern

* enum.c (enum_zip): added Enumerable#zip. [new]

* array.c (rb_ary_zip): added Array#zip.

* error.c (init_syserr): remove sys_nerr dependency.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@3020 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2002-11-03 11:04:35 +00:00
matz 5e6634ce67 * parse.y (tokadd_string): ignore backslashed spaces in %w.
* enum.c (enum_find): do not use rb_eval_cmd(); should not accept
  a string for if_none.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@2679 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2002-08-01 09:42:38 +00:00
michal 722c202b9a enum.c: Fix bug in enum_sort_by and some code indents
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@2624 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2002-07-05 08:58:57 +00:00
matz b3ecbfaa01 * eval.c (svalue_to_avalue): v may be Qundef. This fix was
suggested by Guy Decoux.

* hash.c (rb_hash_s_create): use rb_hash_aset() instead of calling
  st_insert() directly, to dup&freeze string keys.

* parse.y (yylex): proper error message for "@@0".

* parse.y (yylex): paren to parse_string() must be zero for
  unparenthesized strings.

* parse.y (str_extend): broken string when unterminated "#{".

* enum.c (enum_sort_by): had a bug in 1 element enumeration.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@2565 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2002-06-13 03:55:44 +00:00
matz 4fa0cdea78 * numeric.c (num_step): better iteration condition for float
values;  suggested by Masahiro TANAKA <masa@ir.isas.ac.jp>.

* range.c (range_step): step (for Range#step method) <= 0 makes no
  sence, thus ArgError will be raised.

* range.c (range_each): Range#each method is special case for
  Range#step(1)

* file.c (rb_find_file): load must be done from an abolute path if
  $SAFE >= 4.

* enum.c (enum_partition): new method. [new]

* re.c (rb_reg_s_quote): quote whitespaces for /x cases.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@2420 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2002-05-01 09:41:50 +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
nobu e3235029ad * enum.c (enum_find): catch a value before recycle.
* enum.c (enum_all): ditto.

* enum.c (enum_any): ditto.

* enum.c (enum_min): ditto.

* enum.c (enum_max): ditto.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@2216 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2002-03-18 01:48:56 +00:00
nobu cecb9cae01 * enum.c (enum_inject): use the first iterated element as the
initial value when omitted.

* enum.c (inject_i): ditto.

* enum.c (Init_Enumerable): Enumerable#inject now takes variable
  count arguments.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@2215 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2002-03-18 01:46:33 +00:00
matz 86c6af5873 * marshal.c (w_object): module inclusion using extend() should
also be detected.

* eval.c (rb_eval_cmd): cbase should not be NULL; it should be
  either ruby_wrapper or Object.

* enum.c (enum_each_with_index): should return self.

* process.c (proc_setpgrp): should return value for non-void function.

* process.c (proc_getpgid): should raise exception if getpgid() return -1.

* string.c (rb_str_ljust): should return a duplicated string.

* string.c (rb_str_rjust): ditto.

* string.c (rb_str_center): ditto.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@2172 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2002-03-11 08:02:04 +00:00
matz 2f8d3bdc21 * array.c (rb_ary_modify): should copy the internal buffer if the
modifying buffer is shared.

* array.c (ary_make_shared): make an internal buffer of an array
  to be shared.

* array.c (rb_ary_shift): avoid sliding an internal buffer by
  using shared buffer.

* array.c (rb_ary_subseq): avoid copying the buffer.

* parse.y (gettable): should freeze __LINE__ string.

* io.c (rb_io_puts): old behavoir restored.  rationale: a) if you
  want to call to_s for arrays, you can just call print a, "\n".
  b) to_s wastes memory if array (and sum of its contents) is
  huge.  c) now any object that has to_ary is treated as an array,
  using rb_check_convert_type().

* hash.c (rb_hash_initialize): now accepts a block to calculate
  the default value. [new]

* hash.c (rb_hash_aref): call "default" method to get the value
  corrensponding to the non existing key.

* hash.c (rb_hash_default): get the default value based on the
  block given to 'new'.  Now it takes an optinal "key" argument.
  "default" became the method to get the value for non existing
  key.  Users may override "default" method to change the hash
  behavior.

* hash.c (rb_hash_set_default): clear the flag if a block is given
  to 'new'

* object.c (Init_Object): undef Data.allocate, left Data.new.

* ext/curses/curses.c (window_scrollok): use RTEST().

* ext/curses/curses.c (window_idlok): ditto.

* ext/curses/curses.c (window_keypad): ditto.

* ext/curses/curses.c (window_idlok): idlok() may return void on
  some platforms; so don't use return value.

* ext/curses/curses.c (window_scrollok): ditto for consistency.

* ext/curses/curses.c: replace FIX2INT() by typechecking NUM2INT().

* parse.y (str_extend): should not process immature #$x and
  #@x interpolation, e.g #@#@ etc.

* enum.c (enum_sort_by): sort_by does not have to be stable always.

* enum.c (enum_sort_by): call qsort directly to gain performance.

* util.c (ruby_qsort): ruby_qsort(qs6) is now native thread safe.

* error.c (rb_sys_fail): it must be a bug if it's called when
  errno == 0.

* regex.c (WC2MBC1ST): should not pass through > 0x80 number in UTF-8.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@1896 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2001-12-10 07:18:16 +00:00
nobu ca1a9450fb * enum.c (enum_sort_by): should replace with last elements.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@1892 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2001-12-09 13:47:54 +00:00
matz 186c8b592a * marshal.c (w_float): must distinguish -0.0 from 0.0.
* gc.c (gc_mark_all): tweak mark order for little bit better scan.

* gc.c (rb_gc_mark): ditto.

* gc.c (rb_gc): ditto.

* enum.c (sort_by_i): slight performance boost.

* gc.c (gc_mark_rest): should call gc_mark_children(), not gc_mark().

* gc.c (rb_gc_mark): may cause infinite looop.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@1861 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2001-11-27 10:00:35 +00:00
matz 7422ccdd9e * signal.c (sighandle): should not re-register sighandler if
POSIX_SIGNAL is defined.

* eval.c (error_print): errat array may be empty.

* eval.c (rb_eval_cmd): should not upgrade safe level unless
  explicitly specified by argument newly added.

* signal.c (sig_trap): should not allow tainted trap closure.

* variable.c (rb_f_trace_var): should not allow trace_var on safe
  level higher than 3.

* variable.c (rb_f_trace_var): should not allow tainted trace
  closure.

* gc.c: do not use static stack until system stack overflows.

* eval.c (eval): should call Exception#exception instead of
  calling rb_exc_new3() directly.

* error.c (exc_exception): set "mesg" directly to the clone.  it
  might be better to set mesg via some method for flexibility.

* variable.c (cvar_override_check): should print original module
  name, if 'a' is T_ICLASS.

* parse.y (yylex): float '1_.0' should not be allowed.

* variable.c (var_getter): should care about var as Qfalse
  (ruby-bugs#PR199).

* array.c (cmpint): <=> or block for {min,max} may return bignum.

* array.c (sort_1): use rb_compint.

* array.c (sort_2): ditto.

* enum.c (min_ii): ditto.

* enum.c (min_ii): ditto.

* enum.c (max_i): ditto.

* enum.c (max_ii): ditto.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@1827 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2001-11-13 08:19:52 +00:00
matz 1fe40b7cc5 * marshal.c (r_object): better allocation type check for
TYPE_UCLASS. usage of allocation framework is disabled for now.

* variable.c (rb_class_path): Module may have subclass.

* string.c (rb_str_update): should maintain original negative
  offset.

* string.c (rb_str_subpat_set): ditto

* string.c (rb_str_aset): ditto.

* re.c (rb_reg_nth_match): should check negative nth.

* re.c (rb_reg_nth_defined): ditto.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@1764 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2001-10-03 07:19:19 +00:00
nobu 4ffb361630 fix typo.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@1708 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2001-08-23 17:49:08 +00:00
matz 1289a7a11f * eval.c (is_defined): should not dump core for "defined?(())".
* eval.c (umethod_bind): recv can be an instance of descender of
  oklass if oklass is a Module.

* hash.c (rb_hash_equal): check identiry equality first.

* file.c (group_member): should check real gid only.

* file.c (eaccess): do not cache euid, since effective euid may be
  changed via Process.euid=().

* file.c (eaccess): return -1 unless every specified access mode
  is permitted.

* eval.c (rb_eval): while/until returns the value which is given
  to break.

* parse.y (value_expr): using while/until/class/def as an
  expression is now gives a warning, not an error.

* range.c (range_eqq): should compare strings based on magical
  increment (using String#upto), not dictionary order.

* enum.c (enum_sort_by): new method for Schewartzian transformed
  stable sort.

* variable.c (mod_av_set): detect constant overriding for built-in
  classes/modules.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@1707 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2001-08-23 06:02:15 +00:00
matz e502549be1 * io.c (argf_seek_m): wrong calling sequence of rb_io_seek().
* parse.y (cond0): no special treatment of string literal in
  condition.

* math.c: add acos, asin, atan, conh, sinh, tanh and hypot to Math.

* configure.in: check hypot availablility.

* missing/hypot.c: public domain rewrite of hypot.

* parse.y (warn_unless_e_option): warning condition was wrong.

* parse.y (warning_unless_e_option): ditto.

* enum.c (enum_all): new method 'all?', which returns true if
  block returns true for all elements.

* enum.c (enum_any): new method 'any?', which returns true if
  block retruns true for any of elements.

* marshal.c (marshal_load): do not give warning unless explicitly
  set to verbose.

* eval.c (rb_exit): give string value "exit" to SystemExit.

* ruby.c (proc_options): -v should not print version if
  proc_options called via moreswitches().

* parse.y (stmt): while/until modifier must work for empty body.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@1241 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2001-03-13 05:45:13 +00:00
matz 2f0faf671d * string.c (str_independent): should not clear str->orig here.
it's too early.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@1153 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2001-01-29 05:10:42 +00:00
matz 87beea4496 * enum.c (enum_inject): new method.
* gc.c (rb_gc_call_finalizer_at_exit): clear klass member of
  terminating object.

* eval.c (rb_call): raise exception for terminated object.

* bignum.c (bigdivrem): t2 might be too big for signed long; do
  not use rb_int2big(), but rb_uint2big().

* error.c (rb_load_fail): new func to report LoadError.

* ruby.c (load_file): use rb_load_fail.

* eval.c (ruby_finalize): should enclosed by PUSH_TAG/POP_TAG.

* gc.c (rb_gc_mark): link 2 of NODE_IFUNC should not be explicitly
  marked.  it may contain non object pointer.

* re.c (reg_s_last_match): Regexp::last_match(nth) returns nth
  substring of the match  (alternative for $& and $<digit>).

* eval.c (rb_mod_define_method): wrong comparison for blocks.

* gc.c (id2ref): should handle Symbol too.

* gc.c (id2ref): should print original ptr value

* eval.c (rb_iterate): NODE_CFUNC does not protect its data
  (nd_tval), so create new node NODE_IFUNC for iteration C
  function.

* eval.c (rb_yield_0): use NODE_IFUNC.

* gc.c (rb_gc_mark): support NODE_IFUNC.

* gc.c (mem_error): prohibit recursive mem_error().
  (ruby-bugs-ja:PR#36)

* eval.c (rb_thread_fd_writable): should not switch context if
  rb_thread_critical is set.

* eval.c (rb_thread_wait_fd): ditto.

* eval.c (rb_thread_wait_for): ditto.

* eval.c (rb_thread_select): ditto.

* eval.c (rb_thread_join): join during critical section causes
  deadlock.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@1090 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2001-01-09 07:26:21 +00:00
matz 8b1de0b1ad 2000-05-24
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@710 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2000-05-24 04:34:26 +00:00
matz fedf48986d 2000-05-01
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@678 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2000-05-01 09:42:38 +00:00
matz 7194267b3b 2000-04-10
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@661 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2000-04-10 05:48:43 +00:00
matz dde62bcd2e 2000-01-17
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@606 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2000-01-17 08:37:53 +00:00
matz de71615260 20000105
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@598 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2000-01-05 04:41:21 +00:00
matz c18d3740a9 991207
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@577 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
1999-12-07 09:25:55 +00:00
matz ebab487fcd 19991125
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@570 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
1999-11-25 09:03:08 +00:00
matz 8e48dc16e9 19991117
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@564 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
1999-11-17 07:30:37 +00:00
matz 0d684beafb 19991029
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@556 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
1999-10-29 09:25:48 +00:00
matz 65a5162550 1.4.0
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@520 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
1999-08-13 05:45:20 +00:00
matz 210367ec88 This commit was generated by cvs2svn to compensate for changes in r372,
which included commits to RCS files with non-trunk default branches.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@373 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
1999-01-20 04:59:39 +00:00
matz 7ea2ceddb8 This commit was generated by cvs2svn to compensate for changes in r11,
which included commits to RCS files with non-trunk default branches.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@12 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
1998-01-16 12:19:22 +00:00
matz 3db12e8b23 Initial revision
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@2 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
1998-01-16 12:13:05 +00:00