aboutsummaryrefslogtreecommitdiffstats
path: root/compar.c
Commit message (Collapse)AuthorAgeFilesLines
* Comparable#clampnobu2016-08-111-0/+34
| | | | | | * compar.c (cmp_clamp): Introduce Comparable#clamp. [Feature #10594] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55863 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* compar.c: utility functionsnobu2016-08-111-19/+20
| | | | | | | | * compar.c (rb_cmp): call comparison method by predefiend ID. * compar.c (cmpint): returns compared result. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55862 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * compar.c: Update doc for == [#7688] [ci-skip]marcandre2015-12-151-3/+0
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@53136 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* compar.c: variable name [ci skip]nobu2015-02-211-2/+2
| | | | | | | * compar.c (Init_Comparable): [DOC] Replace camelcase variable name. [Fix GH-833] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@49673 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * compar.c (cmp_equal): no more error hiding for Comparable#==.eregon2015-02-111-22/+6
| | | | | | | It now behaves as other Comparable methods. See #7688. * test/ruby/test_comparable.rb: update related test. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@49570 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* compar.c: fix messagenobu2015-01-131-1/+1
| | | | | | | * compar.c (rb_cmperr): show float values in the error message always, not only flonum. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@49234 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* compar.c: use Module#to_snobu2014-08-211-2/+2
| | | | | | | * compar.c (rb_cmperr): use Module#to_s so that names in a message can be overridden by to_s. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@47239 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* compar.c: preserve encodingsnobu2014-08-191-6/+5
| | | | | | | * compar.c (rb_cmperr): preserve encodings of arguments in the message. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@47220 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * compar.c (cmp_equal): warn for this release and still rescueeregon2014-01-181-6/+22
| | | | | | | | standard exceptions for a nicer transition. See #7688. Partly reverts r44502. * test/ruby/test_comparable.rb: adapt assertion to match new behavior. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@44646 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * compar.c (cmp_equal): remove error hiding in Comparable#==.eregon2014-01-051-20/+6
| | | | | | | | | | Comparable#== no longer rescues exceptions silently. This was the cause of quite a couple bugs. See #7688. [EXPERIMENTAL] * test/ruby/test_comparable.rb: adapt assertion to match new behavior. * lib/rdoc/method_attr.rb: fix bugs discovered by this change. * test/rdoc/test_rdoc_normal_class.rb: fix bugs in tests. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@44502 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * compar.c (cmp_eq_recursive): Fix the return value, the value foreregon2013-12-281-1/+1
| | | | | | | | failed #<=> should be nil. It was raising a NoMethodError for the test case TestComparable#test_no_cmp (undefined method `>' for false:FalseClass). Yet one more reason for #7688. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@44453 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* compar.c: fail if recursionnobu2013-10-091-1/+8
| | | | | | | | * compar.c (cmp_eq): fail if recursion. [ruby-core:57736] [Bug #9003] * thread.c (rb_exec_recursive_paired_outer): new function which is combinnation of paired and outer variants. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43208 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * compar.c (Comparable#==): fix typo.eregon2013-05-061-1/+1
| | | | | | Patch by Andrew Grimm. [Fix GH-297] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@40592 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* compar.c: inversed comarison without infinite recursionnobu2013-02-171-0/+20
| | | | | | | | | * 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
* * compar.c (cmp_equal): Document ignored exception and return falsezzak2013-02-071-0/+3
| | | | | | | 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
* * array.c: Documentation: change => in call-seq to ->.marcandre2010-05-171-6/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* * string.c: rdoc for <=>, casecmpmarcandre2009-10-281-1/+3
| | | | | | | | | | | | * 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
* stripped trailing spaces.nobu2009-02-221-12/+12
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@22552 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * include/ruby/ruby.h (rb_intern_const): tiny optimization.nobu2008-08-161-0/+1
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@18653 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * include/ruby/ruby.h (CONST_ID): constant ID cache for non-gcc.nobu2008-06-091-0/+2
| | | | | | | * *.c: no cache in init functions. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@17053 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * bignum.c (rb_cmpint): moved from compar.c, to check bignummatz2008-04-061-16/+0
| | | | | | | | | 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
* * $Date$ keyword removed to avoid inclusion of locale dependentakr2008-01-061-1/+0
| | | | | | | string. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@14912 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * include/ruby/ruby.h (struct RBignum): embed digits in RBignum forakr2007-09-011-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* * encoding.c: provide basic features for M17N.matz2007-08-251-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * 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
* * include/ruby: moved public headers.nobu2007-06-101-1/+1
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@12501 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * ext/digest/digest.c (rb_digest_base_s_digest): add volatile tomatz2005-12-121-2/+2
| | | | | | | | | | | 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
* * test/dbm/test_dbm.rb: remove locking test, which may not bematz2005-09-121-1/+0
| | | | | | | supported on some platforms. [ruby-dev:27030] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@9134 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * array.c: moved to ANSI function style from K&R function style.ocean2005-09-121-20/+11
| | | | | | | | | | | | | | | | | (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
* Remove explicit NIL_P() checks since rb_cmpint() does it again in the ↵michal2004-06-221-6/+0
| | | | | | exactly same manner. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@6489 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* Fix dependency issuedave2003-12-191-0/+94
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@5215 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* 031031matz2003-10-301-6/+20
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@4874 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * ext/pty/pty.c (pty_finalize_syswait): join (using Thread#value)matz2003-05-191-8/+11
| | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* * compar.c (rb_cmperr): raise comparison failure.nobu2003-05-081-4/+16
| | | | | | | | | | | * 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
* * compar.c (cmp_gt): raises ArgumentError when "<=>" give nil.matz2003-05-021-5/+13
| | | | | | | inspired by discussion on comp.lang.python. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@3746 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * string.c (rb_str_cmp_m): return nil if str2 does not respond tomatz2003-02-201-6/+6
| | | | | | | | | | | | | | | | | 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
* * range.c (range_step): step might be float 0 < x < 1.matz2003-02-131-0/+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
* Updated Copyrights of Matz to 2003.michal2003-01-161-1/+1
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@3345 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * file.c (rb_find_file_ext): should not terminate searching withmatz2002-11-221-24/+22
| | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* * variable.c (rb_copy_generic_ivar): remove old generic instancematz2002-09-031-14/+26
| | | | | | | | | | 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
* minor bug fixes.matz2002-05-221-1/+1
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@2485 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * object.c (Init_Object): should do exact match for Module#==.matz2002-05-211-34/+17
| | | | | | | | | | | | | | | | | | | * 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
* * re.c (rb_reg_expr_str): should treat backslash specially inmatz2002-04-181-1/+1
| | | | | | | | | | | | | | | | | 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
* * error.c (exc_exception): clone the receiver exception instead ofmatz2001-07-021-2/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* * dir.c (dir_s_glob): supprt backslash escape of metacharactersmatz2001-02-141-1/+1
| | | | | | | | | | | | | | | | | | | 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
* matz: 1.6.0 final (hopufully)matz2000-09-121-9/+2
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@934 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* matzmatz2000-08-311-2/+3
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@916 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* matzmatz2000-07-311-1/+8
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@860 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* 2000-05-01matz2000-05-011-2/+2
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@678 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* 20000105matz2000-01-051-1/+1
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@598 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* 1.4.1matz1999-09-161-4/+22
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@527 b2dd03c8-39d4-4d8f-98ff-823fe69b080e