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

41 Коммитов

Автор SHA1 Сообщение Дата
eregon 85bfd7308f * compar.c (Comparable#==): fix typo.
Patch by Andrew Grimm. [Fix GH-297]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@40592 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-05-06 06:40:23 +00:00
nobu 44c5c2a312 compar.c: inversed comarison without infinite recursion
* compar.c (rb_invcmp): compare by inversed comarison, with preventing
  from infinite recursion.  [ruby-core:52305] [Bug #7870]
* string.c (rb_str_cmp_m), time.c (time_cmp): get rid of infinite
  recursion.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@39292 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-02-17 11:55:50 +00:00
zzak e798251a8a * compar.c (cmp_equal): Document ignored exception and return false
By Makoto Kishimoto [Bug #7790] [ruby-dev:46925] [ruby-dev:46910]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@39140 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-02-07 22:33:32 +00:00
marcandre 7729de4d91 * array.c: Documentation: change => in call-seq to ->.
Harmonize "#=>" in examples. [ruby-core:30206]

* bignum.c: ditto

* class.c: ditto

* compar.c: ditto

* cont.c: ditto

* dir.c: ditto

* encoding.c: ditto

* enum.c: ditto

* enumerator.c: ditto

* error.c: ditto

* eval.c: ditto

* file.c: ditto

* gc.c: ditto

* io.c: ditto

* load.c: ditto

* marshal.c: ditto

* math.c: ditto

* numeric.c: ditto

* object.c: ditto

* pack.c: ditto

* proc.c: ditto

* process.c: ditto

* random.c: ditto

* range.c: ditto

* re.c: ditto

* ruby.c: ditto

* signal.c: ditto

* sprintf.c: ditto

* string.c: ditto

* struct.c: ditto

* thread.c: ditto

* time.c: ditto

* transcode.c: ditto

* variable.c: ditto

* vm_eval.c: ditto

* vm_method.c: ditto

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@27865 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-05-17 21:07:33 +00:00
marcandre 705c567194 * string.c: rdoc for <=>, casecmp
* bignum.c: rdoc for <=>

* file.c: ditto

* time.c: ditto

* compar.c: rdoc

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@25522 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-10-28 04:50:09 +00:00
nobu 12d2c8ba41 stripped trailing spaces.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@22552 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-02-22 14:23:33 +00:00
nobu 5f9c188d97 * include/ruby/ruby.h (rb_intern_const): tiny optimization.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@18653 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-08-16 00:20:31 +00:00
nobu 5a647a3f5f * include/ruby/ruby.h (CONST_ID): constant ID cache for non-gcc.
* *.c: no cache in init functions.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@17053 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-06-09 09:25:32 +00:00
matz bdc00ba604 * bignum.c (rb_cmpint): moved from compar.c, to check bignum
zero.

* range.c (range_step): add step for each iteration if begin and
  end are numeric.  [ruby-core:15990]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15911 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-04-06 17:11:50 +00:00
akr 6cdef2dc7e * $Date$ keyword removed to avoid inclusion of locale dependent
string.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@14912 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-01-06 15:49:38 +00:00
akr 2c8e7a50c1 * include/ruby/ruby.h (struct RBignum): embed digits in RBignum for
small bignums.

* bignum.c: RBignum embeded digits implemented.

* include/ruby/intern.h: declare rb_big_resize.

* gc.c: don't free embedded digits.

* numeric.c: replace direct bignum field accessor by abstract field
  accessor such as RBIGNUM(val)->sign to RBIGNUM_SIGN(val).

* sprintf.c: ditto.

* compar.c: ditto.

* marshal.c: ditto.

* random.c: ditto.

* .gdbinit: support embedded small bignums.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@13330 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-09-01 12:02:36 +00:00
matz a25fbe3b3e * encoding.c: provide basic features for M17N.
* parse.y: encoding aware parsing.

* parse.y (pragma_encoding): encoding specification pragma.

* parse.y (rb_intern3): encoding specified symbols.

* string.c (rb_str_length): length based on characters.  
  for older behavior, bytesize method added.

* string.c (rb_str_index_m): index based on characters.  rindex as
  well.

* string.c (succ_char): encoding aware succeeding string.

* string.c (rb_str_reverse): reverse based on characters.

* string.c (rb_str_inspect): encoding aware string description.

* string.c (rb_str_upcase_bang): encoding aware case conversion.
  downcase, capitalize, swapcase as well.

* string.c (rb_str_tr_bang): tr based on characters.  delete,
  squeeze, tr_s, count as well.

* string.c (rb_str_split_m): split based on characters.

* string.c (rb_str_each_line): encoding aware each_line.

* string.c (rb_str_each_char): added.  iteration based on
  characters.

* string.c (rb_str_strip_bang): encoding aware whitespace
  stripping.  lstrip, rstrip as well.

* string.c (rb_str_justify): encoding aware justifying (ljust,
  rjust, center).

* string.c (str_encoding): get encoding attribute from a string. 

* re.c (rb_reg_initialize): encoding aware regular expression

* sprintf.c (rb_str_format): formatting (i.e. length count) based
  on characters.

* io.c (rb_io_getc): getc to return one-character string.
  for older behavior, getbyte method added.

* ext/stringio/stringio.c (strio_getc): ditto.

* io.c (rb_io_ungetc): allow pushing arbitrary string at the
  current reading point.

* ext/stringio/stringio.c (strio_ungetc): ditto.

* ext/strscan/strscan.c: encoding support.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@13261 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-08-25 03:29:39 +00:00
nobu 2b592580bf * include/ruby: moved public headers.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@12501 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-06-10 03:06:15 +00:00
matz 4d467a0865 * ext/digest/digest.c (rb_digest_base_s_digest): add volatile to
protect temporary context object.  [ruby-dev:27979]

* ext/iconv/iconv.c (Init_iconv): rb_gc_register_address() should
  be called before actual variable initialization.
  [ruby-dev:27986]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@9673 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2005-12-12 00:36:54 +00:00
matz 35a84adff0 * test/dbm/test_dbm.rb: remove locking test, which may not be
supported on some platforms.  [ruby-dev:27030]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@9134 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2005-09-12 15:23:54 +00:00
ocean dda5dc00cf * array.c: moved to ANSI function style from K&R function style.
(used protoize on windows, so still K&R remains on #ifdef part of
   other platforms. And  `foo _((boo))' stuff is still there)
   [ruby-dev:26975]

* bignum.c, class.c, compar.c, dir.c, dln.c, dmyext.c, enum.c,
  enumerator.c, error.c, eval.c, file.c, gc.c, hash.c, inits.c,
  io.c, main.c, marshal.c, math.c, numeric.c, object.c, pack.c,
  prec.c, process.c, random.c, range.c, re.c, regcomp.c, regenc.c,
  regerror.c, regexec.c, regparse.c, regparse.h, ruby.c, signal.c,
  sprintf.c, st.c, string.c, struct.c, time.c, util.h, variable.c,
  version.c: ditto.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@9126 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2005-09-12 10:44:21 +00:00
michal 03f3e5e994 Remove explicit NIL_P() checks since rb_cmpint() does it again in the exactly same manner.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@6489 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2004-06-22 06:30:41 +00:00
dave d3b74e1806 Fix dependency issue
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@5215 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2003-12-19 00:01:19 +00:00
matz 394738639e 031031
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@4874 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2003-10-30 16:33:32 +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
nobu 698a24674e * compar.c (rb_cmperr): raise comparison failure.
* intern.h: prototype; rb_cmperr

* numeric.c (flo_gt, flo_ge, flo_lt, flo_le, fix_gt, fix_ge,
  fix_lt, fix_le): should fail unless the argument is comparable.
  (ruby-bugs-ja:PR#456)


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@3768 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2003-05-08 03:56:12 +00:00
matz fd5f913f33 * compar.c (cmp_gt): raises ArgumentError when "<=>" give nil.
inspired by discussion on comp.lang.python.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@3746 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2003-05-02 09:20:21 +00:00
matz 64db238388 * string.c (rb_str_cmp_m): return nil if str2 does not respond to
both "to_str" and "<=>".

* compar.c (cmp_gt): return nil if "<=>" returns nil (means
  incomparable).

* compar.c (cmp_ge): ditto.

* compar.c (cmp_lt): ditto.

* compar.c (cmp_between): use RTEST(), since cmp_lt and cmp_gt may
  return nil.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@3517 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2003-02-20 20:40:20 +00:00
matz 937092b820 * range.c (range_step): step might be float 0 < x < 1.
* eval.c (rb_thread_schedule): pause if no runnable thread when
  there's only one thread.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@3492 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2003-02-13 09:11:11 +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 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 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
matz a84982e129 minor bug fixes.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@2485 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2002-05-22 05:57:08 +00:00
matz edbe98d848 * object.c (Init_Object): should do exact match for Module#==.
* compar.c (cmp_eq): returns 'false' if <=> returns 'nil'.

* compar.c (cmp_gt,cmp_ge,cmp_lt,cmp_le,cmp_between): ditto.

* pack.c (pack_pack): should propagate taintedness.

* pack.c (pack_unpack): ditto.

* eval.c (rb_thread_schedule): need to preserve errno before
  calling rb_trap_exec().

* regex.c (calculate_must_string): a bug in charset/charset_not
  parsing.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@2482 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2002-05-21 05:39:19 +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 ffe1cf575e * error.c (exc_exception): clone the receiver exception instead of
creating brand new exception object of the receiver.

* eval.c (rb_eval_string_wrap): extend new ruby_top_self, not
  original self.

* eval.c (rb_eval_cmd): respect ruby_wrapper if set.

* eval.c (eval): do not update ruby_class unless scope is not
  provided.

* eval.c (eval): preserve wrapper information.

* eval.c (proc_invoke): ditto.

* eval.c (block_pass): ditto.

* parse.y (void_expr): too much warnings for void context
  (e.g. foo[1] that can be mere Proc call).

* error.c (rb_name_error): new function to raise NameError with
  name attribute set.

* eval.c (rb_f_missing): set name and args in the exception
  object. [new]

* error.c (name_name): NameError#name - new method.

* error.c (nometh_args): NoMethodError#args - new method.

* lex.c (rb_reserved_word): lex_state after tRESCUE should be
  EXPR_MID.

* gc.c (add_heap): allocation size of the heap unit is doubled for
  each allocation.

* dir.c (isdelim): space, tab, and newline are no longer
  delimiters for glob patterns.

* eval.c (svalue_to_avalue): new conversion scheme between single
  value and array values.

* eval.c (avalue_to_svalue): ditto.

* eval.c (rb_eval): REXPAND now uses avalue_to_svalue(), return
  and yield too.

* eval.c (rb_yield_0): use avalue_to_svalue().

* eval.c (proc_invoke): Proc#call gives avaules, whereas
  Proc#yield gives mvalues.

* eval.c (bmcall): convert given value (svalue) to avalue.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@1555 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2001-07-02 08:46:28 +00:00
matz 8e5c3b23f2 * dir.c (dir_s_glob): supprt backslash escape of metacharacters
and delimiters.

* dir.c (remove_backslases): remove backslashes from path before
  calling stat(2).

* dir.c (dir_s_glob): call rb_yield directly (via push_pattern) if
  block is given to the method.

* dir.c (push_pattern): do not call rb_ary_push; yield directly.

* eval.c (blk_copy_prev): reduced ALLOC_N too much.

* eval.c (frame_dup): ditto.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@1183 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2001-02-14 05:52:06 +00:00
matz fbcc6dea0c matz: 1.6.0 final (hopufully)
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@934 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2000-09-12 05:37:38 +00:00
matz e0009b6a54 matz
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@916 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2000-08-31 05:29:54 +00:00
matz 374ea2790e matz
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@860 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2000-07-31 04:36:38 +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 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 9e3d9a2a00 1.4.1
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@527 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
1999-09-16 09:40:33 +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 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