diff --git a/array.c b/array.c index 8ec325c0c9..796740eba3 100644 --- a/array.c +++ b/array.c @@ -95,7 +95,7 @@ memfill(register VALUE *mem, register long size, register VALUE val) ARY_SET_HEAP_LEN(ary, n); \ } \ assert(RARRAY_LEN(ary) == n); \ -} while (0) +} while (0) #define ARY_INCREASE_PTR(ary, n) do { \ assert(!ARY_EMBED_P(ary)); \ assert(!OBJ_FROZEN(ary)); \ @@ -144,31 +144,31 @@ static void ary_resize_capa(VALUE ary, long capacity) { assert(RARRAY_LEN(ary) <= capacity); - assert(!OBJ_FROZEN(ary)); - assert(!ARY_SHARED_P(ary)); + assert(!OBJ_FROZEN(ary)); + assert(!ARY_SHARED_P(ary)); if (capacity > RARRAY_EMBED_LEN_MAX) { if (ARY_EMBED_P(ary)) { - long len = ARY_EMBED_LEN(ary); + long len = ARY_EMBED_LEN(ary); VALUE *ptr = ALLOC_N(VALUE, (capacity)); - MEMCPY(ptr, ARY_EMBED_PTR(ary), VALUE, len); - FL_UNSET_EMBED(ary); - ARY_SET_PTR(ary, ptr); - ARY_SET_HEAP_LEN(ary, len); + MEMCPY(ptr, ARY_EMBED_PTR(ary), VALUE, len); + FL_UNSET_EMBED(ary); + ARY_SET_PTR(ary, ptr); + ARY_SET_HEAP_LEN(ary, len); } - else { + else { REALLOC_N(RARRAY(ary)->as.heap.ptr, VALUE, (capacity)); } - ARY_SET_CAPA(ary, (capacity)); + ARY_SET_CAPA(ary, (capacity)); } else { if (!ARY_EMBED_P(ary)) { - long len = RARRAY_LEN(ary); + long len = RARRAY_LEN(ary); VALUE *ptr = RARRAY_PTR(ary); if (len > capacity) len = capacity; - MEMCPY(RARRAY(ary)->as.ary, ptr, VALUE, len); - FL_SET_EMBED(ary); - ARY_SET_LEN(ary, len); - xfree(ptr); + MEMCPY(RARRAY(ary)->as.ary, ptr, VALUE, len); + FL_SET_EMBED(ary); + ARY_SET_LEN(ary, len); + xfree(ptr); } } } @@ -458,11 +458,11 @@ rb_check_array_type(VALUE ary) * Try to convert obj into an array, using to_ary method. * Returns converted array or nil if obj cannot be converted * for any reason. This method is to check if an argument is an - * array. + * array. * * Array.try_convert([1]) # => [1] * Array.try_convert("1") # => nil - * + * * if tmp = Array.try_convert(arg) * # the argument is an array * elsif tmp = String.try_convert(arg) @@ -496,22 +496,22 @@ rb_ary_s_try_convert(VALUE dummy, VALUE ary) * Array.new * Array.new(2) * Array.new(5, "A") - * + * * # only one copy of the object is created * a = Array.new(2, Hash.new) * a[0]['cat'] = 'feline' * a * a[1]['cat'] = 'Felix' * a - * + * * # here multiple copies are created * a = Array.new(2) { Hash.new } * a[0]['cat'] = 'feline' * a - * + * * squares = Array.new(5) {|i| i*i} * squares - * + * * copy = Array.new(squares) */ @@ -571,8 +571,8 @@ rb_ary_initialize(int argc, VALUE *argv, VALUE ary) } -/* -* Returns a new array populated with the given objects. +/* +* Returns a new array populated with the given objects. * * Array.[]( 1, 'a', /^A/ ) * Array[ 1, 'a', /^A/ ] @@ -678,7 +678,7 @@ ary_take_first_or_last(int argc, VALUE *argv, VALUE ary, enum ary_take_pos_flags /* * call-seq: * array << obj -> array - * + * * Append---Pushes the given object on to the end of this array. This * expression returns the array itself, so several appends * may be chained together. @@ -695,16 +695,16 @@ rb_ary_push(VALUE ary, VALUE item) return ary; } -/* +/* * call-seq: * array.push(obj, ... ) -> array - * + * * Append---Pushes the given object(s) on to the end of this array. This * expression returns the array itself, so several appends * may be chained together. * * a = [ "a", "b", "c" ] - * a.push("d", "e", "f") + * a.push("d", "e", "f") * #=> ["a", "b", "c", "d", "e", "f"] */ @@ -739,13 +739,13 @@ rb_ary_pop(VALUE ary) * call-seq: * array.pop -> obj or nil * array.pop(n) -> array - * + * * Removes the last element from self and returns it, or * nil if the array is empty. * * If a number _n_ is given, returns an array of the last n elements * (or less) just like array.slice!(-n, n) does. - * + * * a = [ "a", "b", "c", "d" ] * a.pop #=> "d" * a.pop(2) #=> ["b", "c"] @@ -796,14 +796,14 @@ rb_ary_shift(VALUE ary) * call-seq: * array.shift -> obj or nil * array.shift(n) -> array - * + * * Returns the first element of self and removes it (shifting all * other elements down by one). Returns nil if the array * is empty. * * If a number _n_ is given, returns an array of the first n elements * (or less) just like array.slice!(0, n) does. - * + * * args = [ "-m", "-q", "filename" ] * args.shift #=> "-m" * args #=> ["-q", "filename"] @@ -840,10 +840,10 @@ rb_ary_shift_m(int argc, VALUE *argv, VALUE ary) /* * call-seq: * array.unshift(obj, ...) -> array - * + * * Prepends objects to the front of array. * other elements up one. - * + * * a = [ "b", "c", "d" ] * a.unshift("a") #=> ["a", "b", "c", "d"] * a.unshift(1, 2) #=> [ 1, 2, "a", "b", "c", "d"] @@ -864,7 +864,7 @@ rb_ary_unshift_m(int argc, VALUE *argv, VALUE ary) MEMMOVE(RARRAY_PTR(ary) + argc, RARRAY_PTR(ary), VALUE, len); MEMCPY(RARRAY_PTR(ary), argv, VALUE, argc); ARY_INCREASE_LEN(ary, argc); - + return ary; } @@ -911,7 +911,7 @@ rb_ary_subseq(VALUE ary, long beg, long len) return ary_make_partial(ary, klass, beg, len); } -/* +/* * call-seq: * array[index] -> obj or nil * array[start, length] -> an_array or nil @@ -977,7 +977,7 @@ rb_ary_aref(int argc, VALUE *argv, VALUE ary) return rb_ary_entry(ary, NUM2LONG(arg)); } -/* +/* * call-seq: * array.at(index) -> obj or nil * @@ -1000,11 +1000,11 @@ rb_ary_at(VALUE ary, VALUE pos) * call-seq: * array.first -> obj or nil * array.first(n) -> an_array - * + * * Returns the first element, or the first +n+ elements, of the array. * If the array is empty, the first form returns nil, and the * second form returns an empty array. - * + * * a = [ "q", "r", "s", "t" ] * a.first #=> "q" * a.first(2) #=> ["q", "r"] @@ -1026,10 +1026,10 @@ rb_ary_first(int argc, VALUE *argv, VALUE ary) * call-seq: * array.last -> obj or nil * array.last(n) -> an_array - * + * * Returns the last element(s) of self. If the array is empty, * the first form returns nil. - * + * * a = [ "w", "x", "y", "z" ] * a.last #=> "z" * a.last(2) #=> ["y", "z"] @@ -1052,14 +1052,14 @@ rb_ary_last(int argc, VALUE *argv, VALUE ary) * array.fetch(index) -> obj * array.fetch(index, default ) -> obj * array.fetch(index) {|index| block } -> obj - * + * * Tries to return the element at position index. If the index * lies outside the array, the first form throws an * IndexError exception, the second form returns * default, and the third form returns the value of invoking * the block, passing in the index. Negative values of index * count from the end of the array. - * + * * a = [ 11, 22, 33, 44 ] * a.fetch(1) #=> 22 * a.fetch(-1) #=> 44 @@ -1098,12 +1098,12 @@ rb_ary_fetch(int argc, VALUE *argv, VALUE ary) * call-seq: * array.index(obj) -> int or nil * array.index {|item| block} -> int or nil - * + * * Returns the index of the first object in self such that is * == to obj. If a block is given instead of an * argument, returns first object for which block is true. * Returns nil if no match is found. - * + * * a = [ "a", "b", "c" ] * a.index("b") #=> 1 * a.index("z") #=> nil @@ -1138,12 +1138,12 @@ rb_ary_index(int argc, VALUE *argv, VALUE ary) /* * call-seq: * array.rindex(obj) -> int or nil - * + * * Returns the index of the last object in array * == to obj. If a block is given instead of an * argument, returns first object for which block is * true. Returns nil if no match is found. - * + * * a = [ "a", "b", "b", "b", "c" ] * a.rindex("b") #=> 3 * a.rindex("z") #=> nil @@ -1248,7 +1248,7 @@ rb_ary_splice(VALUE ary, long beg, long len, VALUE rpl) } } -/* +/* * call-seq: * array[index] = obj -> obj * array[start, length] = obj or an_array or nil -> obj or an_array or nil @@ -1264,7 +1264,7 @@ rb_ary_splice(VALUE ary, long beg, long len, VALUE rpl) * zero. An +IndexError+ is raised if a negative index points * past the beginning of the array. See also * Array#push, and Array#unshift. - * + * * a = Array.new * a[4] = "4"; #=> [nil, nil, nil, nil, "4"] * a[0, 3] = [ 'a', 'b', 'c' ] #=> ["a", "b", "c", nil, "4"] @@ -1309,10 +1309,10 @@ fixnum: /* * call-seq: * array.insert(index, obj...) -> array - * + * * Inserts the given values before the element with the given index * (which may be negative). - * + * * a = %w{ a b c d } * a.insert(2, 99) #=> ["a", "b", 99, "c", "d"] * a.insert(-2, 1, 2, 3) #=> ["a", "b", 99, "c", 1, 2, 3, "d"] @@ -1341,15 +1341,15 @@ rb_ary_insert(int argc, VALUE *argv, VALUE ary) /* * call-seq: * array.each {|item| block } -> array - * + * * Calls block once for each element in self, passing that * element as a parameter. - * + * * a = [ "a", "b", "c" ] * a.each {|x| print x, " -- " } - * + * * produces: - * + * * a -- b -- c -- */ @@ -1368,15 +1368,15 @@ rb_ary_each(VALUE ary) /* * call-seq: * array.each_index {|index| block } -> array - * + * * Same as Array#each, but passes the index of the element * instead of the element itself. - * + * * a = [ "a", "b", "c" ] * a.each_index {|x| print x, " -- " } - * + * * produces: - * + * * 0 -- 1 -- 2 -- */ @@ -1394,16 +1394,16 @@ rb_ary_each_index(VALUE ary) /* * call-seq: - * array.reverse_each {|item| block } - * + * array.reverse_each {|item| block } + * * Same as Array#each, but traverses self in reverse * order. - * + * * a = [ "a", "b", "c" ] * a.reverse_each {|x| print x, " " } - * + * * produces: - * + * * c b a */ @@ -1426,9 +1426,9 @@ rb_ary_reverse_each(VALUE ary) /* * call-seq: * array.length -> int - * + * * Returns the number of elements in self. May be zero. - * + * * [ 1, 2, 3, 4, 5 ].length #=> 5 */ @@ -1442,9 +1442,9 @@ rb_ary_length(VALUE ary) /* * call-seq: * array.empty? -> true or false - * + * * Returns true if self array contains no elements. - * + * * [].empty? #=> true */ @@ -1543,10 +1543,10 @@ rb_ary_join(VALUE ary, VALUE sep) /* * call-seq: * array.join(sep=$,) -> str - * + * * Returns a string created by converting each element of the array to * a string, separated by sep. - * + * * [ "a", "b", "c" ].join #=> "abc" * [ "a", "b", "c" ].join("-") #=> "a-b-c" */ @@ -1558,7 +1558,7 @@ rb_ary_join_m(int argc, VALUE *argv, VALUE ary) rb_scan_args(argc, argv, "01", &sep); if (NIL_P(sep)) sep = rb_output_fs; - + return rb_ary_join(ary, sep); } @@ -1609,7 +1609,7 @@ rb_ary_to_s(VALUE ary) /* * call-seq: * array.to_a -> array - * + * * Returns _self_. If called on a subclass of Array, converts * the receiver to an Array object. */ @@ -1628,7 +1628,7 @@ rb_ary_to_a(VALUE ary) /* * call-seq: * array.to_ary -> array - * + * * Returns _self_. */ @@ -1660,10 +1660,10 @@ rb_ary_reverse(VALUE ary) /* * call-seq: - * array.reverse! -> array - * + * array.reverse! -> array + * * Reverses _self_ in place. - * + * * a = [ "a", "b", "c" ] * a.reverse! #=> ["c", "b", "a"] * a #=> ["c", "b", "a"] @@ -1678,9 +1678,9 @@ rb_ary_reverse_bang(VALUE ary) /* * call-seq: * array.reverse -> an_array - * + * * Returns a new array containing self's elements in reverse order. - * + * * [ "a", "b", "c" ].reverse #=> ["c", "b", "a"] * [ 1 ].reverse #=> [1] */ @@ -1763,14 +1763,14 @@ sort_2(const void *ap, const void *bp, void *dummy) /* * call-seq: * array.sort! -> array - * array.sort! {| a,b | block } -> array - * + * array.sort! {| a,b | block } -> array + * * Sorts _self_. Comparisons for * the sort will be done using the <=> operator or using * an optional code block. The block implements a comparison between * a and b, returning -1, 0, or +1. See also * Enumerable#sort_by. - * + * * a = [ "d", "a", "e", "c", "b" ] * a.sort #=> ["a", "b", "c", "d", "e"] * a.sort {|x,y| y <=> x } #=> ["e", "d", "c", "b", "a"] @@ -1823,7 +1823,7 @@ rb_ary_sort_bang(VALUE ary) ARY_SET_PTR(ary, RARRAY_PTR(tmp)); ARY_SET_HEAP_LEN(ary, RARRAY_LEN(tmp)); ARY_SET_CAPA(ary, ARY_CAPA(tmp)); - } + } /* tmp was lost ownership for the ptr */ FL_UNSET(tmp, FL_FREEZE); FL_SET_EMBED(tmp); @@ -1838,15 +1838,15 @@ rb_ary_sort_bang(VALUE ary) /* * call-seq: - * array.sort -> an_array - * array.sort {| a,b | block } -> an_array - * + * array.sort -> an_array + * array.sort {| a,b | block } -> an_array + * * Returns a new array created by sorting self. Comparisons for * the sort will be done using the <=> operator or using * an optional code block. The block implements a comparison between * a and b, returning -1, 0, or +1. See also * Enumerable#sort_by. - * + * * a = [ "d", "a", "e", "c", "b" ] * a.sort #=> ["a", "b", "c", "d", "e"] * a.sort {|x,y| y <=> x } #=> ["e", "d", "c", "b", "a"] @@ -1892,11 +1892,11 @@ rb_ary_sort_by_bang(VALUE ary) * call-seq: * array.collect {|item| block } -> an_array * array.map {|item| block } -> an_array - * - * Invokes block once for each element of self. Creates a + * + * Invokes block once for each element of self. Creates a * new array containing the values returned by the block. * See also Enumerable#collect. - * + * * a = [ "a", "b", "c", "d" ] * a.collect {|x| x + "!" } #=> ["a!", "b!", "c!", "d!"] * a #=> ["a", "b", "c", "d"] @@ -1917,7 +1917,7 @@ rb_ary_collect(VALUE ary) } -/* +/* * call-seq: * array.collect! {|item| block } -> array * array.map! {|item| block } -> array @@ -1925,7 +1925,7 @@ rb_ary_collect(VALUE ary) * Invokes the block once for each element of _self_, replacing the * element with the value returned by _block_. * See also Enumerable#collect. - * + * * a = [ "a", "b", "c", "d" ] * a.collect! {|x| x + "!" } * a #=> [ "a!", "b!", "c!", "d!" ] @@ -1972,15 +1972,15 @@ rb_get_values_at(VALUE obj, long olen, int argc, VALUE *argv, VALUE (*func) (VAL return result; } -/* +/* * call-seq: * array.values_at(selector,... ) -> an_array * * Returns an array containing the elements in * _self_ corresponding to the given selector(s). The selectors - * may be either integer indices or ranges. + * may be either integer indices or ranges. * See also Array#select. - * + * * a = %w{ a b c d e f } * a.values_at(1, 3, 5) * a.values_at(1, 3, 5, 7) @@ -1998,11 +1998,11 @@ rb_ary_values_at(int argc, VALUE *argv, VALUE ary) /* * call-seq: * array.select {|item| block } -> an_array - * + * * Invokes the block passing in successive elements from array, * returning an array containing those elements for which the block * returns a true value (equivalent to Enumerable#select). - * + * * a = %w{ a b c d e f } * a.select {|v| v =~ /[aeiou]/} #=> ["a", "e"] */ @@ -2025,14 +2025,14 @@ rb_ary_select(VALUE ary) /* * call-seq: - * array.delete(obj) -> obj or nil + * array.delete(obj) -> obj or nil * array.delete(obj) { block } -> obj or nil - * + * * Deletes items from self that are equal to obj. If * the item is not found, returns nil. If the optional * code block is given, returns the result of block if the item * is not found. - * + * * a = [ "a", "b", "b", "b", "c" ] * a.delete("b") #=> "b" * a #=> ["a", "c"] @@ -2101,11 +2101,11 @@ rb_ary_delete_at(VALUE ary, long pos) /* * call-seq: * array.delete_at(index) -> obj or nil - * + * * Deletes the element at the specified index, returning that element, * or nil if the index is out of range. See also * Array#slice!. - * + * * a = %w( ant bat cat dog ) * a.delete_at(2) #=> "cat" * a #=> ["ant", "bat", "dog"] @@ -2122,12 +2122,12 @@ rb_ary_delete_at_m(VALUE ary, VALUE pos) * call-seq: * array.slice!(index) -> obj or nil * array.slice!(start, length) -> sub_array or nil - * array.slice!(range) -> sub_array or nil - * + * array.slice!(range) -> sub_array or nil + * * Deletes the element(s) given by an index (optionally with a length) * or by a range. Returns the deleted object, subarray, or * nil if the index is out of range. - * + * * a = [ "a", "b", "c" ] * a.slice!(1) #=> "b" * a #=> ["a", "c"] @@ -2185,7 +2185,7 @@ rb_ary_slice_bang(int argc, VALUE *argv, VALUE ary) /* * call-seq: * array.reject! {|item| block } -> array or nil - * + * * Equivalent to Array#delete_if, deleting elements from * _self_ for which the block evaluates to true, but returns * nil if no changes were made. Also see @@ -2217,7 +2217,7 @@ rb_ary_reject_bang(VALUE ary) /* * call-seq: * array.reject {|item| block } -> an_array - * + * * Returns a new array containing the items in _self_ * for which the block is not true. */ @@ -2234,10 +2234,10 @@ rb_ary_reject(VALUE ary) /* * call-seq: * array.delete_if {|item| block } -> array - * + * * Deletes every element of self for which block evaluates * to true. - * + * * a = [ "a", "b", "c" ] * a.delete_if {|x| x >= "b" } #=> ["a"] */ @@ -2277,7 +2277,7 @@ take_items(VALUE obj, long n) * call-seq: * array.zip(arg, ...) -> an_array * array.zip(arg, ...) {| arr | block } -> nil - * + * * Converts any arguments to arrays, then merges elements of * self with corresponding elements from each argument. This * generates a sequence of self.size n-element @@ -2286,7 +2286,7 @@ take_items(VALUE obj, long n) * nil values are supplied. If a block given, it is * invoked for each output array, otherwise an array of arrays is * returned. - * + * * a = [ 4, 5, 6 ] * b = [ 7, 8, 9 ] * [1,2,3].zip(a, b) #=> [[1, 4, 7], [2, 5, 8], [3, 6, 9]] @@ -2329,10 +2329,10 @@ rb_ary_zip(int argc, VALUE *argv, VALUE ary) /* * call-seq: * array.transpose -> an_array - * + * * Assumes that self is an array of arrays and transposes the * rows and columns. - * + * * a = [[1,2], [3,4], [5,6]] * a.transpose #=> [[1, 3, 5], [2, 4, 6]] */ @@ -2368,10 +2368,10 @@ rb_ary_transpose(VALUE ary) /* * call-seq: * array.replace(other_array) -> array - * + * * Replaces the contents of self with the contents of * other_array, truncating or expanding if necessary. - * + * * a = [ "a", "b", "c", "d", "e" ] * a.replace([ "x", "y", "z" ]) #=> ["x", "y", "z"] * a #=> ["x", "y", "z"] @@ -2387,7 +2387,7 @@ rb_ary_replace(VALUE copy, VALUE orig) if (RARRAY_LEN(orig) <= RARRAY_EMBED_LEN_MAX) { VALUE *ptr; VALUE shared = 0; - + if (ARY_OWNS_HEAP_P(copy)) { xfree(RARRAY_PTR(copy)); } @@ -2419,7 +2419,7 @@ rb_ary_replace(VALUE copy, VALUE orig) return copy; } -/* +/* * call-seq: * array.clear -> array * @@ -2448,14 +2448,14 @@ rb_ary_clear(VALUE ary) * array.fill {|index| block } -> array * array.fill(start [, length] ) {|index| block } -> array * array.fill(range) {|index| block } -> array - * + * * The first three forms set the selected elements of self (which * may be the entire array) to obj. A start of * nil is equivalent to zero. A length of * nil is equivalent to self.length. The last three * forms fill the array with the value of the block. The block is * passed the absolute index of each element to be filled. - * + * * a = [ "a", "b", "c", "d" ] * a.fill("x") #=> ["x", "x", "x", "x"] * a.fill("z", 2, 2) #=> ["x", "x", "z", "z"] @@ -2535,13 +2535,13 @@ rb_ary_fill(int argc, VALUE *argv, VALUE ary) return ary; } -/* +/* * call-seq: * array + other_array -> an_array * * Concatenation---Returns a new array built by concatenating the * two arrays together to produce a third array. - * + * * [ 1, 2, 3 ] + [ 4, 5 ] #=> [ 1, 2, 3, 4, 5 ] */ @@ -2560,12 +2560,12 @@ rb_ary_plus(VALUE x, VALUE y) return z; } -/* +/* * call-seq: * array.concat(other_array) -> array * * Appends the elements in other_array to _self_. - * + * * [ "a", "b" ].concat( ["c", "d"] ) #=> [ "a", "b", "c", "d" ] */ @@ -2581,7 +2581,7 @@ rb_ary_concat(VALUE x, VALUE y) } -/* +/* * call-seq: * array * int -> an_array * array * str -> a_string @@ -2632,7 +2632,7 @@ rb_ary_times(VALUE ary, VALUE times) return ary2; } -/* +/* * call-seq: * array.assoc(obj) -> an_array or nil * @@ -2670,12 +2670,12 @@ rb_ary_assoc(VALUE ary, VALUE key) /* * call-seq: * array.rassoc(obj) -> an_array or nil - * + * * Searches through the array whose elements are also arrays. Compares * _obj_ with the second element of each contained array using * ==. Returns the first contained array that matches. See * also Array#assoc. - * + * * a = [ [ 1, "one"], [2, "two"], [3, "three"], ["ii", "two"] ] * a.rassoc("two") #=> [2, "two"] * a.rassoc("four") #=> nil @@ -2710,7 +2710,7 @@ recursive_equal(VALUE ary1, VALUE ary2, int recur) return Qtrue; } -/* +/* * call-seq: * array == other_array -> bool * @@ -2803,11 +2803,11 @@ rb_ary_hash(VALUE ary) /* * call-seq: * array.include?(obj) -> true or false - * + * * Returns true if the given object is present in * self (that is, if any object == anObject), * false otherwise. - * + * * a = [ "a", "b", "c" ] * a.include?("b") #=> true * a.include?("z") #=> false @@ -2817,7 +2817,7 @@ VALUE rb_ary_includes(VALUE ary, VALUE item) { long i; - + for (i=0; i other_array -> -1, 0, +1 * @@ -2860,7 +2860,7 @@ recursive_cmp(VALUE ary1, VALUE ary2, int recur) * ``equal'' according to Array#<=> if and only if they have * the same length and the value of each element is equal to the * value of the corresponding element in the other array. - * + * * [ "a", "a", "c" ] <=> [ "a", "b", "c" ] #=> -1 * [ 1, 2, 3, 4, 5, 6 ] <=> [ 1, 2 ] #=> +1 * @@ -2940,7 +2940,7 @@ ary_recycle_hash(VALUE hash) } } -/* +/* * call-seq: * array - other_array -> an_array * @@ -2970,7 +2970,7 @@ rb_ary_diff(VALUE ary1, VALUE ary2) return ary3; } -/* +/* * call-seq: * array & other_array * @@ -3006,7 +3006,7 @@ rb_ary_and(VALUE ary1, VALUE ary2) return ary3; } -/* +/* * call-seq: * array | other_array -> an_array * @@ -3054,17 +3054,17 @@ push_value(st_data_t key, st_data_t val, st_data_t ary) /* * call-seq: * array.uniq! -> array or nil - * + * * Removes duplicate elements from _self_. * Returns nil if no changes are made (that is, no * duplicates are found). - * + * * a = [ "a", "a", "b", "b", "c" ] * a.uniq! #=> ["a", "b", "c"] * b = [ "a", "b", "c" ] * b.uniq! #=> nil * c = [ "a:def", "a:xyz", "b:abc", "b:xyz", "c:jkl" ] - * c.uniq! {|s| s[/^\w+/]} #=> [ "a:def", "b:abc", "c:jkl" ] + * c.uniq! {|s| s[/^\w+/]} #=> [ "a:def", "b:abc", "c:jkl" ] */ static VALUE @@ -3103,13 +3103,13 @@ rb_ary_uniq_bang(VALUE ary) /* * call-seq: * array.uniq -> an_array - * + * * Returns a new array by removing duplicate values in self. - * + * * a = [ "a", "a", "b", "b", "c" ] * a.uniq #=> ["a", "b", "c"] * c = [ "a:def", "a:xyz", "b:abc", "b:xyz", "c:jkl" ] - * c.uniq {|s| s[/^\w+/]} #=> [ "a:def", "b:abc", "c:jkl" ] + * c.uniq {|s| s[/^\w+/]} #=> [ "a:def", "b:abc", "c:jkl" ] */ static VALUE @@ -3138,7 +3138,7 @@ rb_ary_uniq(VALUE ary) return uniq; } -/* +/* * call-seq: * array.compact! -> array or nil * @@ -3158,7 +3158,7 @@ rb_ary_compact_bang(VALUE ary) rb_ary_modify(ary); p = t = RARRAY_PTR(ary); end = p + RARRAY_LEN(ary); - + while (t < end) { if (NIL_P(*t)) t++; else *p++ = *t++; @@ -3198,7 +3198,7 @@ rb_ary_compact(VALUE ary) * array.count -> int * array.count(obj) -> int * array.count { |item| block } -> int - * + * * Returns the number of elements. If an argument is given, counts * the number of elements which equals to obj. If a block is * given, counts the number of elements yielding a true value. @@ -3298,12 +3298,12 @@ flatten(VALUE ary, int level, int *modified) * call-seq: * array.flatten! -> array or nil * array.flatten!(level) -> array or nil - * + * * Flattens _self_ in place. * Returns nil if no modifications were made (i.e., * array contains no subarrays.) If the optional level * argument determines the level of recursion to flatten. - * + * * a = [ 1, 2, [3, [4, 5] ] ] * a.flatten! #=> [1, 2, 3, 4, 5] * a.flatten! #=> nil @@ -3333,12 +3333,12 @@ rb_ary_flatten_bang(int argc, VALUE *argv, VALUE ary) * call-seq: * array.flatten -> an_array * array.flatten(level) -> an_array - * + * * Returns a new array that is a one-dimensional flattening of this * array (recursively). That is, for every element that is an array, * extract its elements into the new array. If the optional * level argument determines the level of recursion to flatten. - * + * * s = [ 1, 2, 3 ] #=> [1, 2, 3] * t = [ 4, 5, 6, [7, 8] ] #=> [4, 5, 6, [7, 8]] * a = [ s, t, 9, 10 ] #=> [[1, 2, 3], [4, 5, 6, [7, 8]], 9, 10] @@ -3366,7 +3366,7 @@ rb_ary_flatten(int argc, VALUE *argv, VALUE ary) /* * call-seq: * array.shuffle! -> array - * + * * Shuffles elements in _self_ in place. */ @@ -3390,9 +3390,9 @@ rb_ary_shuffle_bang(VALUE ary) /* * call-seq: * array.shuffle -> an_array - * + * * Returns a new array with elements of this array shuffled. - * + * * a = [ 1, 2, 3 ] #=> [1, 2, 3] * a.shuffle #=> [2, 3, 1] */ @@ -3410,11 +3410,11 @@ rb_ary_shuffle(VALUE ary) * call-seq: * array.sample -> obj * array.sample(n) -> an_array - * + * * Choose a random element, or the random +n+ elements, from the array. * If the array is empty, the first form returns nil, and the * second form returns an empty array. - * + * */ @@ -3424,7 +3424,7 @@ rb_ary_sample(int argc, VALUE *argv, VALUE ary) VALUE nv, result, *ptr; long n, len, i, j, k, idx[10]; - len = RARRAY_LEN(ary); + len = RARRAY_LEN(ary); if (argc == 0) { if (len == 0) return Qnil; i = len == 1 ? 0 : rb_genrand_real()*len; @@ -3432,8 +3432,8 @@ rb_ary_sample(int argc, VALUE *argv, VALUE ary) } rb_scan_args(argc, argv, "1", &nv); n = NUM2LONG(nv); - ptr = RARRAY_PTR(ary); - len = RARRAY_LEN(ary); + ptr = RARRAY_PTR(ary); + len = RARRAY_LEN(ary); if (n > len) n = len; switch (n) { case 0: return rb_ary_new2(0); @@ -3492,16 +3492,16 @@ rb_ary_sample(int argc, VALUE *argv, VALUE ary) * call-seq: * ary.cycle {|obj| block } * ary.cycle(n) {|obj| block } - * + * * Calls block for each element repeatedly _n_ times or * forever if none or nil is given. If a non-positive number is * given or the array is empty, does nothing. Returns nil if the * loop has finished without getting interrupted. - * + * * a = ["a", "b", "c"] * a.cycle {|x| puts x } # print, a, b, c, a, b, c,.. forever. * a.cycle(2) {|x| puts x } # print, a, b, c, a, b, c. - * + * */ static VALUE @@ -3534,9 +3534,9 @@ rb_ary_cycle(int argc, VALUE *argv, VALUE ary) /* * Recursively compute permutations of r elements of the set [0..n-1]. * When we have a complete permutation of array indexes, copy the values - * at those indexes into a new array and yield that array. + * at those indexes into a new array and yield that array. * - * n: the size of the set + * n: the size of the set * r: the number of elements in each permutation * p: the array (of size r) that we're filling in * index: what index we're filling in now @@ -3553,7 +3553,7 @@ permute0(long n, long r, long *p, long index, int *used, VALUE values) if (index < r-1) { /* if not done yet */ used[i] = 1; /* mark index used */ permute0(n, r, p, index+1, /* recurse */ - used, values); + used, values); used[i] = 0; /* index unused */ } else { @@ -3578,15 +3578,15 @@ permute0(long n, long r, long *p, long index, int *used, VALUE values) * ary.permutation -> enumerator * ary.permutation(n) { |p| block } -> array * ary.permutation(n) -> enumerator - * + * * When invoked with a block, yield all permutations of length n * of the elements of ary, then return the array itself. * If n is not specified, yield all permutations of all elements. - * The implementation makes no guarantees about the order in which + * The implementation makes no guarantees about the order in which * the permutations are yielded. * * When invoked without a block, return an enumerator object instead. - * + * * Examples: * * a = [1, 2, 3] @@ -3609,7 +3609,7 @@ rb_ary_permutation(int argc, VALUE *argv, VALUE ary) rb_scan_args(argc, argv, "01", &num); r = NIL_P(num) ? n : NUM2LONG(num); /* Permutation size from argument */ - if (r < 0 || n < r) { + if (r < 0 || n < r) { /* no permutations: yield nothing */ } else if (r == 0) { /* exactly one permutation: the zero-length array */ @@ -3662,14 +3662,14 @@ combi_len(long n, long k) * call-seq: * ary.combination(n) { |c| block } -> ary * ary.combination(n) -> enumerator - * - * When invoked with a block, yields all combinations of length n + * + * When invoked with a block, yields all combinations of length n * of elements from ary and then returns ary itself. - * The implementation makes no guarantees about the order in which + * The implementation makes no guarantees about the order in which * the combinations are yielded. * * When invoked without a block, returns an enumerator object instead. - * + * * Examples: * * a = [1, 2, 3, 4] @@ -3679,7 +3679,7 @@ combi_len(long n, long k) * a.combination(4).to_a #=> [[1,2,3,4]] * a.combination(0).to_a #=> [[]] # one combination of length 0 * a.combination(5).to_a #=> [] # no combinations of length 5 - * + * */ static VALUE @@ -3729,11 +3729,11 @@ rb_ary_combination(VALUE ary, VALUE num) /* * call-seq: * ary.product(other_ary, ...) - * + * * Returns an array of all combinations of elements from all arrays. * The length of the returned array is the product of the length * of ary and the argument arrays - * + * * [1,2,3].product([4,5]) # => [[1,4],[1,5],[2,4],[2,5],[3,4],[3,5]] * [1,2].product([1,2]) # => [[1,1],[1,2],[2,1],[2,2]] * [1,2].product([3,4],[5,6]) # => [[1,3,5],[1,3,6],[1,4,5],[1,4,6], @@ -3760,7 +3760,7 @@ rb_ary_product(int argc, VALUE *argv, VALUE ary) /* initialize the arrays of arrays */ arrays[0] = ary; for (i = 1; i < n; i++) arrays[i] = to_ary(argv[i-1]); - + /* initialize the counters for the arrays */ for (i = 0; i < n; i++) counters[i] = 0; @@ -3806,12 +3806,12 @@ rb_ary_product(int argc, VALUE *argv, VALUE ary) /* * call-seq: * ary.take(n) => array - * + * * Returns first n elements from ary. - * + * * a = [1, 2, 3, 4, 5, 0] * a.take(3) # => [1, 2, 3] - * + * */ static VALUE @@ -3827,13 +3827,13 @@ rb_ary_take(VALUE obj, VALUE n) /* * call-seq: * ary.take_while {|arr| block } => array - * + * * Passes elements to the block until the block returns nil or false, * then stops iterating and returns an array of all prior elements. - * + * * a = [1, 2, 3, 4, 5, 0] * a.take_while {|i| i < 3 } # => [1, 2] - * + * */ static VALUE @@ -3851,13 +3851,13 @@ rb_ary_take_while(VALUE ary) /* * call-seq: * ary.drop(n) => array - * + * * Drops first n elements from ary, and returns rest elements * in an array. - * + * * a = [1, 2, 3, 4, 5, 0] * a.drop(3) # => [4, 5, 0] - * + * */ static VALUE @@ -3877,14 +3877,14 @@ rb_ary_drop(VALUE ary, VALUE n) /* * call-seq: * ary.drop_while {|arr| block } => array - * + * * Drops elements up to, but not including, the first element for * which the block returns nil or false and returns an array * containing the remaining elements. - * + * * a = [1, 2, 3, 4, 5, 0] * a.drop_while {|i| i < 3 } # => [3, 4, 5, 0] - * + * */ static VALUE @@ -3901,11 +3901,11 @@ rb_ary_drop_while(VALUE ary) -/* Arrays are ordered, integer-indexed collections of any object. - * Array indexing starts at 0, as in C or Java. A negative index is - * assumed to be relative to the end of the array---that is, an index of -1 - * indicates the last element of the array, -2 is the next to last - * element in the array, and so on. +/* Arrays are ordered, integer-indexed collections of any object. + * Array indexing starts at 0, as in C or Java. A negative index is + * assumed to be relative to the end of the array---that is, an index of -1 + * indicates the last element of the array, -2 is the next to last + * element in the array, and so on. */ void diff --git a/bignum.c b/bignum.c index dec147ae3c..7f01917e9f 100644 --- a/bignum.c +++ b/bignum.c @@ -1714,7 +1714,7 @@ bigmul1_karatsuba(VALUE x, VALUE y) t1 = xl; xl = xh; xh = t1; } bigadd_core(BDIGITS(xh), RBIGNUM_LEN(xh), - BDIGITS(xl), RBIGNUM_LEN(xl), + BDIGITS(xl), RBIGNUM_LEN(xl), BDIGITS(xh), RBIGNUM_LEN(xh)); /* yh <- yh + yl */ @@ -1723,7 +1723,7 @@ bigmul1_karatsuba(VALUE x, VALUE y) t1 = yl; yl = yh; yh = t1; } bigadd_core(BDIGITS(yh), RBIGNUM_LEN(yh), - BDIGITS(yl), RBIGNUM_LEN(yl), + BDIGITS(yl), RBIGNUM_LEN(yl), BDIGITS(yh), RBIGNUM_LEN(yh)); } else yh = xh; diff --git a/blockinlining.c b/blockinlining.c index 27b99ff6d4..f9eb8af229 100644 --- a/blockinlining.c +++ b/blockinlining.c @@ -34,7 +34,7 @@ iseq_special_block(rb_iseq_t *iseq, void *builder) else { iseq->cached_special_block_builder = (void *)1; } - + if (iseq->parent_iseq) { parent = iseq->parent_iseq->self; } diff --git a/class.c b/class.c index 38e4ef6fe5..3f87d064a1 100644 --- a/class.c +++ b/class.c @@ -82,7 +82,7 @@ clone_method(ID mid, NODE *body, struct clone_method_data *data) NODE *fbody = body->nd_body->nd_body; if (nd_type(fbody) == RUBY_VM_METHOD_NODE) { - fbody = NEW_NODE(RUBY_VM_METHOD_NODE, 0, + fbody = NEW_NODE(RUBY_VM_METHOD_NODE, 0, rb_iseq_clone((VALUE)fbody->nd_body, data->klass), 0); } @@ -198,7 +198,7 @@ make_metametaclass(VALUE metaclass) } else { metametaclass = rb_class_boot(Qnil); - RBASIC(metametaclass)->klass = + RBASIC(metametaclass)->klass = (RBASIC(RBASIC(metaclass)->klass)->klass == RBASIC(metaclass)->klass) ? make_metametaclass(RBASIC(metaclass)->klass) : RBASIC(RBASIC(metaclass)->klass)->klass; @@ -212,9 +212,9 @@ make_metametaclass(VALUE metaclass) while (FL_TEST(super_of_metaclass, T_ICLASS)) { super_of_metaclass = RCLASS_SUPER(super_of_metaclass); } - RCLASS_SUPER(metametaclass) = + RCLASS_SUPER(metametaclass) = rb_iv_get(RBASIC(super_of_metaclass)->klass, "__attached__") == super_of_metaclass - ? RBASIC(super_of_metaclass)->klass + ? RBASIC(super_of_metaclass)->klass : make_metametaclass(super_of_metaclass); OBJ_INFECT(metametaclass, RCLASS_SUPER(metametaclass)); @@ -422,7 +422,7 @@ rb_include_module(VALUE klass, VALUE module) if (!OBJ_UNTRUSTED(klass)) { rb_secure(4); } - + if (TYPE(module) != T_MODULE) { Check_Type(module, T_MODULE); } @@ -461,16 +461,16 @@ rb_include_module(VALUE klass, VALUE module) /* * call-seq: * mod.included_modules -> array - * + * * Returns the list of modules included in mod. - * + * * module Mixin * end - * + * * module Outer * include Mixin * end - * + * * Mixin.included_modules #=> [] * Outer.included_modules #=> [Mixin] */ @@ -492,10 +492,10 @@ rb_mod_included_modules(VALUE mod) /* * call-seq: * mod.include?(module) => true or false - * + * * Returns true if module is included in * mod or one of mod's ancestors. - * + * * module A * end * class B @@ -525,15 +525,15 @@ rb_mod_include_p(VALUE mod, VALUE mod2) /* * call-seq: * mod.ancestors -> array - * + * * Returns a list of modules included in mod (including * mod itself). - * + * * module Mod * include Math * include Comparable * end - * + * * Mod.ancestors #=> [Mod, Comparable, Math] * Math.ancestors #=> [Math] */ @@ -612,7 +612,7 @@ method_entry(ID key, NODE *body, st_table *list) if (key == ID_ALLOCATOR) { return ST_CONTINUE; } - + if (!st_lookup(list, key, 0)) { if (body ==0 || !body->nd_body->nd_body) { type = -1; /* none */ @@ -658,14 +658,14 @@ class_instance_method_list(int argc, VALUE *argv, VALUE mod, int (*func) (ID, lo /* * call-seq: * mod.instance_methods(include_super=true) => array - * + * * Returns an array containing the names of instance methods that is callable * from outside in the receiver. For a module, these are the public methods; * for a class, they are the instance (not singleton) methods. With no * argument, or with an argument that is false, the * instance methods in mod are returned, otherwise the methods * in mod and mod's superclasses are returned. - * + * * module A * def method1() end * end @@ -675,7 +675,7 @@ class_instance_method_list(int argc, VALUE *argv, VALUE mod, int (*func) (ID, lo * class C < B * def method3() end * end - * + * * A.instance_methods #=> [:method1] * B.instance_methods(false) #=> [:method2] * C.instance_methods(false) #=> [:method3] @@ -691,7 +691,7 @@ rb_class_instance_methods(int argc, VALUE *argv, VALUE mod) /* * call-seq: * mod.protected_instance_methods(include_super=true) => array - * + * * Returns a list of the protected instance methods defined in * mod. If the optional parameter is not false, the * methods of any ancestors are included. @@ -706,11 +706,11 @@ rb_class_protected_instance_methods(int argc, VALUE *argv, VALUE mod) /* * call-seq: * mod.private_instance_methods(include_super=true) => array - * + * * Returns a list of the private instance methods defined in * mod. If the optional parameter is not false, the * methods of any ancestors are included. - * + * * module Mod * def method1() end * private :method1 @@ -729,7 +729,7 @@ rb_class_private_instance_methods(int argc, VALUE *argv, VALUE mod) /* * call-seq: * mod.public_instance_methods(include_super=true) => array - * + * * Returns a list of the public instance methods defined in mod. * If the optional parameter is not false, the methods of * any ancestors are included. @@ -744,30 +744,30 @@ rb_class_public_instance_methods(int argc, VALUE *argv, VALUE mod) /* * call-seq: * obj.singleton_methods(all=true) => array - * + * * Returns an array of the names of singleton methods for obj. * If the optional all parameter is true, the list will include * methods in modules included in obj. - * + * * module Other * def three() end * end - * + * * class Single * def Single.four() end * end - * + * * a = Single.new - * + * * def a.one() * end - * + * * class << a * include Other * def two() * end * end - * + * * Single.singleton_methods #=> [:four] * a.singleton_methods(false) #=> [:two, :one] * a.singleton_methods #=> [:two, :one, :three] @@ -932,7 +932,7 @@ rb_scan_args(int argc, const VALUE *argv, const char *fmt, ...) postargc = *q - '0'; nonpostargc = argc - postargc; } - else { + else { postargc = 0; nonpostargc = argc; } @@ -941,7 +941,7 @@ rb_scan_args(int argc, const VALUE *argv, const char *fmt, ...) if (nonpostargc < 0) rb_raise(rb_eArgError, "wrong number of arguments (%d for %d)", argc, postargc); - goto rest_arg; + goto rest_arg; } else if (ISDIGIT(*p)) { /* leading mandatory arguments */ diff --git a/compar.c b/compar.c index 633c5b5309..e8ebfc5bfa 100644 --- a/compar.c +++ b/compar.c @@ -50,7 +50,7 @@ cmp_failed(void) /* * call-seq: * obj == other => true or false - * + * * Compares two objects based on the receiver's <=> * method, returning true if it returns 0. Also returns true if * _obj_ and _other_ are the same object. @@ -70,7 +70,7 @@ cmp_equal(VALUE x, VALUE y) /* * call-seq: * obj > other => true or false - * + * * Compares two objects based on the receiver's <=> * method, returning true if it returns 1. */ @@ -87,7 +87,7 @@ cmp_gt(VALUE x, VALUE y) /* * call-seq: * obj >= other => true or false - * + * * Compares two objects based on the receiver's <=> * method, returning true if it returns 0 or 1. */ @@ -104,7 +104,7 @@ cmp_ge(VALUE x, VALUE y) /* * call-seq: * obj < other => true or false - * + * * Compares two objects based on the receiver's <=> * method, returning true if it returns -1. */ @@ -121,7 +121,7 @@ cmp_lt(VALUE x, VALUE y) /* * call-seq: * obj <= other => true or false - * + * * Compares two objects based on the receiver's <=> * method, returning true if it returns -1 or 0. */ @@ -138,16 +138,16 @@ cmp_le(VALUE x, VALUE y) /* * call-seq: * obj.between?(min, max) => true or false - * + * * Returns false if obj <=> * min is less than zero or if anObject <=> * max is greater than zero, true otherwise. - * + * * 3.between?(1, 5) #=> true * 6.between?(1, 5) #=> false * 'cat'.between?('ant', 'dog') #=> true * 'gnu'.between?('ant', 'dog') #=> false - * + * */ static VALUE @@ -167,7 +167,7 @@ cmp_between(VALUE x, VALUE min, VALUE max) * <=> to implement the conventional comparison operators * (<, <=, ==, >=, * and >) and the method between?. - * + * * class SizeMatters * include Comparable * attr :str @@ -181,18 +181,18 @@ cmp_between(VALUE x, VALUE min, VALUE max) * @str * end * end - * + * * s1 = SizeMatters.new("Z") * s2 = SizeMatters.new("YY") * s3 = SizeMatters.new("XXX") * s4 = SizeMatters.new("WWWW") * s5 = SizeMatters.new("VVVVV") - * + * * s1 < s2 #=> true * s4.between?(s1, s3) #=> false * s4.between?(s3, s5) #=> true * [ s3, s2, s5, s4, s1 ].sort #=> [Z, YY, XXX, WWWW, VVVVV] - * + * */ void diff --git a/compile.c b/compile.c index 2bf4167719..c98b7ffaa9 100644 --- a/compile.c +++ b/compile.c @@ -3962,7 +3962,6 @@ iseq_compile_each(rb_iseq_t *iseq, LINK_ANCHOR *ret, NODE * node, int poped) VALUE label; VALUE label_sym; - CONST_ID(goto_id, "__goto__"); CONST_ID(label_id, "__label__"); diff --git a/cont.c b/cont.c index 43237560c2..971627b1b2 100644 --- a/cont.c +++ b/cont.c @@ -1,6 +1,6 @@ /********************************************************************** - cont.c - + cont.c - $Author$ created at: Thu May 23 09:03:43 2007 @@ -461,24 +461,24 @@ cont_restore_0(rb_context_t *cont, VALUE *addr_in_prev_frame) * Continuations are somewhat analogous to a structured version of C's * setjmp/longjmp (although they contain more state, so * you might consider them closer to threads). - * + * * For instance: - * + * * arr = [ "Freddie", "Herbie", "Ron", "Max", "Ringo" ] * callcc{|$cc|} * puts(message = arr.shift) * $cc.call unless message =~ /Max/ - * + * * produces: - * + * * Freddie * Herbie * Ron * Max - * + * * This (somewhat contrived) example allows the inner loop to abandon * processing early: - * + * * callcc {|cont| * for i in 0..4 * print "\n#{i}: " @@ -489,9 +489,9 @@ cont_restore_0(rb_context_t *cont, VALUE *addr_in_prev_frame) * end * } * print "\n" - * + * * produces: - * + * * 0: 0 1 2 3 4 * 1: 5 6 7 8 9 * 2: 10 11 12 13 14 @@ -501,7 +501,7 @@ cont_restore_0(rb_context_t *cont, VALUE *addr_in_prev_frame) /* * call-seq: * callcc {|cont| block } => obj - * + * * Generates a Continuation object, which it passes to the * associated block. Performing a cont.call will * cause the callcc to return (as will falling through the @@ -543,13 +543,13 @@ make_passing_arg(int argc, VALUE *argv) * call-seq: * cont.call(args, ...) * cont[args, ...] - * + * * Invokes the continuation. The program continues from the end of the * callcc block. If no arguments are given, the original * callcc returns nil. If one argument is * given, callcc returns it. Otherwise, an array * containing args is returned. - * + * * callcc {|cont| cont.call } #=> nil * callcc {|cont| cont.call 1 } #=> 1 * callcc {|cont| cont.call 1, 2, 3 } #=> [1, 2, 3] @@ -592,26 +592,26 @@ rb_cont_call(int argc, VALUE *argv, VALUE contval) * Document-class: Fiber * * Fibers are primitives for implementing light weight cooperative - * concurrency in Ruby. Basically they are a means of creating code blocks - * that can be paused and resumed, much like threads. The main difference - * is that they are never preempted and that the scheduling must be done by - * the programmer and not the VM. + * concurrency in Ruby. Basically they are a means of creating code blocks + * that can be paused and resumed, much like threads. The main difference + * is that they are never preempted and that the scheduling must be done by + * the programmer and not the VM. * * As opposed to other stackless light weight concurrency models, each fiber * comes with a small 4KB stack. This enables the fiber to be paused from deeply * nested function calls within the fiber block. * - * When a fiber is created it will not run automatically. Rather it must be - * be explicitly asked to run using the Fiber#resume method. - * The code running inside the fiber can give up control by calling - * Fiber.yield in which case it yields control back to caller + * When a fiber is created it will not run automatically. Rather it must be + * be explicitly asked to run using the Fiber#resume method. + * The code running inside the fiber can give up control by calling + * Fiber.yield in which case it yields control back to caller * (the caller of the Fiber#resume). - * - * Upon yielding or termination the Fiber returns the value of the last + * + * Upon yielding or termination the Fiber returns the value of the last * executed expression - * + * * For instance: - * + * * fiber = Fiber.new do * Fiber.yield 1 * 2 @@ -620,20 +620,20 @@ rb_cont_call(int argc, VALUE *argv, VALUE contval) * puts fiber.resume * puts fiber.resume * puts fiber.resume - * + * * produces - * + * * 1 * 2 * FiberError: dead fiber called - * + * * The Fiber#resume method accepts an arbitary number of * parameters, if it is the first call to resume then they * will be passed as block arguments. Otherwise they will be the return * value of the call to Fiber.yield * * Example: - * + * * fiber = Fiber.new do |first| * second = Fiber.yield first + 2 * end @@ -643,7 +643,7 @@ rb_cont_call(int argc, VALUE *argv, VALUE contval) * puts fiber.resume 18 * * produces - * + * * 12 * 14 * FiberError: dead fiber called @@ -923,7 +923,7 @@ rb_fiber_yield(int argc, VALUE *argv) /* * call-seq: * fiber.alive? -> true or false - * + * * Returns true if the fiber can still be resumed (or transferred to). * After finishing execution of the fiber block this method will always * return false. @@ -939,13 +939,13 @@ rb_fiber_alive_p(VALUE fibval) /* * call-seq: * fiber.resume(args, ...) -> obj - * + * * Resumes the fiber from the point at which the last Fiber.yield - * was called, or starts running it if it is the first call to + * was called, or starts running it if it is the first call to * resume. Arguments passed to resume will be the value of - * the Fiber.yield expression or will be passed as block + * the Fiber.yield expression or will be passed as block * parameters to the fiber's block if this is the first resume. - * + * * Alternatively, when resume is called it evaluates to the arguments passed * to the next Fiber.yield statement inside the fiber's block * or to the block value if it runs to completion without any @@ -960,15 +960,15 @@ rb_fiber_m_resume(int argc, VALUE *argv, VALUE fib) /* * call-seq: * fiber.transfer(args, ...) -> obj - * + * * Transfer control to another fiber, resuming it from where it last - * stopped or starting it if it was not resumed before. The calling + * stopped or starting it if it was not resumed before. The calling * fiber will be suspended much like in a call to Fiber.yield. - * - * The fiber which recieves the transfer call is treats it much like + * + * The fiber which recieves the transfer call is treats it much like * a resume call. Arguments passed to transfer are treated like those * passed to resume. - * + * * You cannot resume a fiber that transferred control to another one. * This will cause a double resume error. You need to transfer control * back to this fiber before it can yield and resume. @@ -982,7 +982,7 @@ rb_fiber_m_transfer(int argc, VALUE *argv, VALUE fib) /* * call-seq: * Fiber.yield(args, ...) -> obj - * + * * Yields control back to the context that resumed the fiber, passing * along any arguments that were passed to it. The fiber will resume * processing at this point when resume is called next. @@ -998,7 +998,7 @@ rb_fiber_s_yield(int argc, VALUE *argv, VALUE klass) /* * call-seq: * Fiber.current() -> fiber - * + * * Returns the current fiber. You need to require 'fiber' * before using this method. If you are not running in the context of * a fiber this method will return the root fiber. diff --git a/debug.c b/debug.c index bcf2817fe1..3b4b76e381 100644 --- a/debug.c +++ b/debug.c @@ -30,7 +30,7 @@ static const union { RUBY_ENC_CODERANGE_UNKNOWN = ENC_CODERANGE_UNKNOWN, RUBY_ENC_CODERANGE_7BIT = ENC_CODERANGE_7BIT, RUBY_ENC_CODERANGE_VALID = ENC_CODERANGE_VALID, - RUBY_ENC_CODERANGE_BROKEN = ENC_CODERANGE_BROKEN, + RUBY_ENC_CODERANGE_BROKEN = ENC_CODERANGE_BROKEN, RUBY_FL_MARK = FL_MARK, RUBY_FL_RESERVED = FL_RESERVED, RUBY_FL_FINALIZE = FL_FINALIZE, diff --git a/dln.c b/dln.c index 7521678623..0ded0db4b1 100644 --- a/dln.c +++ b/dln.c @@ -766,7 +766,7 @@ load_1(int fd, long disp, const char *need_init) } } /* end.. look it up */ else { /* is static */ - switch (R_SYMBOL(rel)) { + switch (R_SYMBOL(rel)) { case N_TEXT: case N_DATA: datum = block; @@ -1158,7 +1158,7 @@ aix_loaderror(const char *pathname) char *message[8], errbuf[1024]; int i,j; - struct errtab { + struct errtab { int errnum; char *errstr; } load_errtab[] = { @@ -1181,7 +1181,7 @@ aix_loaderror(const char *pathname) snprintf(errbuf, 1024, "load failed - %s ", pathname); - if (!loadquery(1, &message[0], sizeof(message))) + if (!loadquery(1, &message[0], sizeof(message))) ERRBUF_APPEND(strerror(errno)); for(i = 0; message[i] && *message[i]; i++) { int nerr = atoi(message[i]); @@ -1189,7 +1189,7 @@ aix_loaderror(const char *pathname) if (nerr == load_errtab[i].errnum && load_errtab[i].errstr) ERRBUF_APPEND(load_errtab[i].errstr); } - while (isdigit(*message[i])) message[i]++; + while (isdigit(*message[i])) message[i]++; ERRBUF_APPEND(message[i]); ERRBUF_APPEND("\n"); } @@ -1339,7 +1339,7 @@ dln_load(const char *file) #define DLN_DEFINED /*---------------------------------------------------- By SHIROYAMA Takayuki Psi@fortune.nest.or.jp - + Special Thanks... Yu tomoak-i@is.aist-nara.ac.jp, Mi hisho@tasihara.nest.or.jp, @@ -1354,9 +1354,9 @@ dln_load(const char *file) char *object_files[2] = {NULL, NULL}; void (*init_fct)(); - + object_files[0] = (char*)file; - + s = NXOpenFile(2,NX_WRITEONLY); /* Load object file, if return value ==0 , load failed*/ @@ -1403,7 +1403,7 @@ dln_load(const char *file) /* lookup the initial function */ if(!NSIsSymbolNameDefined(buf)) { rb_loaderror("Failed to lookup Init function %.200s",file); - } + } init_fct = NSAddressOfSymbol(NSLookupAndBindSymbol(buf)); (*init_fct)(); @@ -1425,7 +1425,7 @@ dln_load(const char *file) rb_loaderror("Failed to load add_on %.200s error_code=%x", file, img_id); } - + /* find symbol for module initialize function. */ /* The Be Book KernelKit Images section described to use B_SYMBOL_TYPE_TEXT for symbol of function, not @@ -1608,7 +1608,7 @@ dln_find_1(const char *fname, const char *path, char *fbuf, int size, if (*dp == '~' && (l == 1 || #if defined(DOSISH) - dp[1] == '\\' || + dp[1] == '\\' || #endif dp[1] == '/')) { char *home; diff --git a/encoding.c b/encoding.c index 4afee36ff3..ee0f2f4356 100644 --- a/encoding.c +++ b/encoding.c @@ -925,7 +925,7 @@ enc_find(VALUE klass, VALUE enc) * Encoding.compatible?(str1, str2) => enc or nil * * Checks the compatibility of two strings. - * If they are compatible, means concatenatable, + * If they are compatible, means concatenatable, * returns an encoding which the concatinated string will be. * If they are not compatible, nil is returned. * diff --git a/enum.c b/enum.c index 8c4b5b93e0..ebeb069221 100644 --- a/enum.c +++ b/enum.c @@ -821,7 +821,7 @@ name##_iter_i(VALUE i, VALUE *memo, int argc, VALUE *argv) \ { \ return enum_##name##_func(enum_yield(argc, argv), memo); \ } - + static VALUE enum_all_func(VALUE result, VALUE *memo) { @@ -1428,8 +1428,8 @@ enum_each_with_index(int argc, VALUE *argv, VALUE obj) /* * call-seq: - * enum.reverse_each {|item| block } - * + * enum.reverse_each {|item| block } + * * Traverses enum in reverse order. */ diff --git a/error.c b/error.c index df4b0cc671..98debd9743 100644 --- a/error.c +++ b/error.c @@ -369,7 +369,7 @@ rb_exc_new3(VALUE etype, VALUE str) * call-seq: * Exception.new(msg = nil) => exception * - * Construct a new Exception object, optionally passing in + * Construct a new Exception object, optionally passing in * a message. */ @@ -390,12 +390,12 @@ exc_initialize(int argc, VALUE *argv, VALUE exc) * * call-seq: * exc.exception(string) -> an_exception or exc - * + * * With no argument, or if the argument is the same as the receiver, * return the receiver. Otherwise, create a new * exception object of the same class as the receiver, but with a * message equal to string.to_str. - * + * */ static VALUE @@ -476,27 +476,27 @@ exc_inspect(VALUE exc) /* * call-seq: * exception.backtrace => array - * + * * Returns any backtrace associated with the exception. The backtrace * is an array of strings, each containing either ``filename:lineNo: in * `method''' or ``filename:lineNo.'' - * + * * def a * raise "boom" * end - * + * * def b * a() * end - * + * * begin * b() * rescue => detail * print detail.backtrace.join("\n") * end - * + * * produces: - * + * * prog.rb:2:in `a' * prog.rb:6:in `b' * prog.rb:10 @@ -536,11 +536,11 @@ rb_check_backtrace(VALUE bt) /* * call-seq: * exc.set_backtrace(array) => array - * + * * Sets the backtrace information associated with exc. The * argument must be an array of String objects in the * format described in Exception#backtrace. - * + * */ static VALUE @@ -552,9 +552,9 @@ exc_set_backtrace(VALUE exc, VALUE bt) /* * call-seq: * exc == obj => true or false - * + * * Equality---If obj is not an Exception, returns - * false. Otherwise, returns true if exc and + * false. Otherwise, returns true if exc and * obj share same class, messages, and backtrace. */ @@ -846,7 +846,7 @@ rb_invalid_str(const char *str, const char *type) rb_raise(rb_eArgError, "invalid value for %s: %s", type, RSTRING_PTR(s)); } -/* +/* * Document-module: Errno * * Ruby exception objects are subclasses of Exception. @@ -856,21 +856,21 @@ rb_invalid_str(const char *str, const char *type) * number generating its own subclass of SystemCallError. * As the subclass is created in module Errno, its name * will start Errno::. - * + * * The names of the Errno:: classes depend on * the environment in which Ruby runs. On a typical Unix or Windows * platform, there are Errno classes such as * Errno::EACCES, Errno::EAGAIN, * Errno::EINTR, and so on. - * + * * The integer operating system error number corresponding to a * particular error is available as the class constant * Errno::error::Errno. - * + * * Errno::EACCES::Errno #=> 13 * Errno::EAGAIN::Errno #=> 11 * Errno::EINTR::Errno #=> 4 - * + * * The full list of operating system errors on your particular platform * are available as the constants of Errno. * @@ -1014,7 +1014,7 @@ syserr_eqq(VALUE self, VALUE exc) * statements in begin/end blocks. Exception * objects carry information about the exception---its type (the * exception's class name), an optional descriptive string, and - * optional traceback information. Programs may subclass + * optional traceback information. Programs may subclass * Exception to add additional information. */ diff --git a/eval_error.c b/eval_error.c index 622ae4fdd9..15233e7c1b 100644 --- a/eval_error.c +++ b/eval_error.c @@ -159,7 +159,7 @@ error_print(void) long len = RARRAY_LEN(errat); VALUE *ptr = RARRAY_PTR(errat); int skip = eclass == rb_eSysStackError; - + #define TRACE_MAX (TRACE_HEAD+TRACE_TAIL+5) #define TRACE_HEAD 8 #define TRACE_TAIL 5 diff --git a/gc.c b/gc.c index 94cd66d89f..ca24f82470 100644 --- a/gc.c +++ b/gc.c @@ -118,7 +118,7 @@ getrusage_time(void) ULARGE_INTEGER ui; LONG_LONG q; double t; - + if (GetProcessTimes(GetCurrentProcess(), &creation_time, &exit_time, &kernel_time, &user_time) == 0) { @@ -863,7 +863,7 @@ assign_heap_slot(rb_objspace_t *objspace) RVALUE *p, *pend, *membase; size_t hi, lo, mid; int objs; - + objs = HEAP_OBJ_LIMIT; p = (RVALUE*)malloc(HEAP_SIZE); @@ -962,7 +962,7 @@ static VALUE rb_newobj_from_heap(rb_objspace_t *objspace) { VALUE obj; - + if ((ruby_gc_stress && !ruby_disable_gc_stress) || !freelist) { if (!heaps_increment(objspace) && !garbage_collect(objspace)) { during_gc = 0; @@ -1010,7 +1010,7 @@ rb_during_gc(void) rb_objspace_t *objspace = &rb_objspace; return during_gc; } - + VALUE rb_newobj(void) { @@ -2761,7 +2761,7 @@ gc_profile_record_get(void) VALUE gc_profile = rb_ary_new(); size_t i; rb_objspace_t *objspace = (&rb_objspace); - + if (!objspace->profile.run) { return Qnil; } @@ -2794,7 +2794,7 @@ gc_profile_record_get(void) * GC::Profiler.result -> string * * Report profile data to string. - * + * * It returns a string as: * GC 1 invokes. * Index Invoke Time(sec) Use Size(byte) Total Size(byte) Total Object GC time(ms) @@ -2808,7 +2808,7 @@ gc_profile_result(void) VALUE record; VALUE result; int i; - + record = gc_profile_record_get(); if (objspace->profile.run && objspace->profile.count) { result = rb_sprintf("GC %d invokes.\n", NUM2INT(gc_count(0))); @@ -2850,7 +2850,7 @@ gc_profile_result(void) * GC::Profiler.report * * GC::Profiler.result display - * + * */ static VALUE diff --git a/goruby.c b/goruby.c index 7cd3a2262b..17be654800 100644 --- a/goruby.c +++ b/goruby.c @@ -1,4 +1,4 @@ -void Init_golf(void); +void Init_golf(void); #define ruby_run_node goruby_run_node #include "main.c" #undef ruby_run_node diff --git a/id.c b/id.c index 870bce5dad..24a1959d6f 100644 --- a/id.c +++ b/id.c @@ -1,6 +1,6 @@ /********************************************************************** - id.c - + id.c - $Author$ created at: Thu Jul 12 04:37:51 2007 diff --git a/io.c b/io.c index 59bf9662a7..40f66c1307 100644 --- a/io.c +++ b/io.c @@ -2718,7 +2718,7 @@ rb_io_lines(int argc, VALUE *argv, VALUE io) * Returns an enumerator that gives each byte (0..255) in ios. * The stream must be opened for reading or an IOError * will be raised. - * + * * f = File.new("testfile") * f.bytes.to_a #=> [104, 101, 108, 108, 111] * f.rewind @@ -2734,11 +2734,11 @@ rb_io_bytes(VALUE io) /* * call-seq: * ios.chars => anEnumerator - * + * * Returns an enumerator that gives each character in ios. * The stream must be opened for reading or an IOError * will be raised. - * + * * f = File.new("testfile") * f.chars.to_a #=> ["h", "e", "l", "l", "o"] * f.rewind @@ -4950,7 +4950,7 @@ rb_scan_open_args(int argc, VALUE *argv, } } #endif - + rb_io_extract_modeenc(&vmode, &vperm, opt, &oflags, &fmode, convconfig_p); perm = NIL_P(vperm) ? 0666 : NUM2UINT(vperm); @@ -5909,7 +5909,7 @@ rb_io_stdio_file(rb_io_t *fptr) * IO object or integer file descriptor and mode * string. See also IO#fileno and * IO.for_fd. - * + * * === Parameters * fd:: numeric file descriptor * mode:: file mode. a string or an integer @@ -5919,12 +5919,12 @@ rb_io_stdio_file(rb_io_t *fptr) * When mode is an integer it must be combination of * the modes defined in File::Constants. * - * When mode is a string it must be in one of the + * When mode is a string it must be in one of the * following forms: * - "fmode", * - "fmode:extern", * - "fmode:extern:intern". - * extern is the external encoding name for the IO. + * extern is the external encoding name for the IO. * intern is the internal encoding. * fmode must be combination of the directives. See * the description of class +IO+ for a description of the directives. @@ -5933,20 +5933,20 @@ rb_io_stdio_file(rb_io_t *fptr) * opt can have the following keys * :mode :: * same as mode parameter - * :external_encoding :: - * external encoding for the IO. "-" is a + * :external_encoding :: + * external encoding for the IO. "-" is a * synonym for the default external encoding. * :internal_encoding :: - * internal encoding for the IO. + * internal encoding for the IO. * "-" is a synonym for the default internal encoding. - * If the value is nil no conversion occurs. - * :encoding :: + * If the value is nil no conversion occurs. + * :encoding :: * specifies external and internal encodings as "extern:intern". * :textmode :: * If the value is truth value, same as "b" in argument mode. * :binmode :: * If the value is truth value, same as "t" in argument mode. - * + * * Also opt can have same keys in String#encode for * controlling conversion between the external encoding and the internal encoding. * @@ -5968,7 +5968,7 @@ rb_io_stdio_file(rb_io_t *fptr) * io = IO.new(2, mode: 'w', cr_newline: true, external_encoding: Encoding::UTF_16LE) * io.puts "Hello, World!" * - * both of aboves print "Hello, World!" in UTF-16LE to standard error output with + * both of aboves print "Hello, World!" in UTF-16LE to standard error output with * converting EOL generated by puts to CR. */ @@ -6021,16 +6021,16 @@ rb_io_initialize(int argc, VALUE *argv, VALUE io) * * Opens the file named by _filename_ according to * _mode_ (default is ``r'') and returns a new - * File object. - * - * === Parameters - * See the description of class +IO+ for a description of _mode_. - * The file mode may optionally be specified as a +Fixnum+ - * by _or_-ing together the flags (O_RDONLY etc, - * again described under +IO+). + * File object. * - * Optional permission bits may be given in _perm_. - * These mode and permission bits are platform dependent; + * === Parameters + * See the description of class +IO+ for a description of _mode_. + * The file mode may optionally be specified as a +Fixnum+ + * by _or_-ing together the flags (O_RDONLY etc, + * again described under +IO+). + * + * Optional permission bits may be given in _perm_. + * These mode and permission bits are platform dependent; * on Unix systems, see open(2) for details. * * Optional _opt_ parameter is same as in . @@ -6285,9 +6285,9 @@ argf_next_argv(VALUE argf) if (st.st_uid!=st2.st_uid || st.st_gid!=st2.st_gid) { #ifdef HAVE_FCHOWN (void)fchown(fw, st.st_uid, st.st_gid); -#else +#else (void)chown(fn, st.st_uid, st.st_gid); -#endif +#endif } #endif rb_stdout = prep_io(fw, FMODE_WRITABLE, rb_cFile, fn); diff --git a/iseq.c b/iseq.c index 3c2fb7d546..0385e214b1 100644 --- a/iseq.c +++ b/iseq.c @@ -1247,7 +1247,7 @@ iseq_data_to_ary(rb_iseq_t *iseq) rb_hash_aset(misc, ID2SYM(rb_intern("local_size")), INT2FIX(iseq->local_size)); rb_hash_aset(misc, ID2SYM(rb_intern("stack_max")), INT2FIX(iseq->stack_max)); - /* + /* * [:magic, :major_version, :minor_version, :format_type, :misc, * :name, :filename, :type, :locals, :args, * :catch_table, :bytecode] diff --git a/load.c b/load.c index 5f72d5510a..5f9d4f2294 100644 --- a/load.c +++ b/load.c @@ -341,7 +341,7 @@ rb_load_protect(VALUE fname, int wrap, int *state) /* * call-seq: * load(filename, wrap=false) => true - * + * * Loads and executes the Ruby * program in the file _filename_. If the filename does not * resolve to an absolute path, the file is searched for in the library @@ -406,7 +406,7 @@ load_unlock(const char *ftptr, int done) /* * call-seq: * require(string) => true or false - * + * * Ruby tries to load the library named _string_, returning * +true+ if successful. If the filename does not resolve to * an absolute path, it will be searched for in the directories listed @@ -420,7 +420,7 @@ load_unlock(const char *ftptr, int done) * appears in $". However, the file name is not converted * to an absolute path, so that ``require 'a';require * './a''' will load a.rb twice. - * + * * require "my-library.rb" * require "db-driver" */ @@ -638,11 +638,11 @@ ruby_init_ext(const char *name, void (*init)(void)) /* * call-seq: * mod.autoload(name, filename) => nil - * + * * Registers _filename_ to be loaded (using Kernel::require) * the first time that _module_ (which may be a String or * a symbol) is accessed in the namespace of _mod_. - * + * * module A * end * A.autoload(:B, "b") @@ -672,11 +672,11 @@ rb_mod_autoload_p(VALUE mod, VALUE sym) /* * call-seq: * autoload(module, filename) => nil - * + * * Registers _filename_ to be loaded (using Kernel::require) * the first time that _module_ (which may be a String or * a symbol) is accessed. - * + * * autoload(:MyModule, "/usr/local/lib/modules/my_module.rb") */ diff --git a/marshal.c b/marshal.c index ca97ee3226..8a3a64e4c3 100644 --- a/marshal.c +++ b/marshal.c @@ -1608,7 +1608,7 @@ load_ensure(struct load_arg *arg) * call-seq: * load( source [, proc] ) => obj * restore( source [, proc] ) => obj - * + * * Returns the result of converting the serialized data in source into a * Ruby object (possibly with associated subordinate objects). source * may be either an instance of IO or an object that responds to diff --git a/math.c b/math.c index c7e79c1a80..2043bebfe5 100644 --- a/math.c +++ b/math.c @@ -64,10 +64,10 @@ infinity_check(VALUE arg, double res, const char *msg) /* * call-seq: * Math.atan2(y, x) => float - * + * * Computes the arc tangent given y and x. Returns * -PI..PI. - * + * */ static VALUE @@ -81,7 +81,7 @@ math_atan2(VALUE obj, VALUE y, VALUE x) /* * call-seq: * Math.cos(x) => float - * + * * Computes the cosine of x (expressed in radians). Returns * -1..1. */ @@ -96,7 +96,7 @@ math_cos(VALUE obj, VALUE x) /* * call-seq: * Math.sin(x) => float - * + * * Computes the sine of x (expressed in radians). Returns * -1..1. */ @@ -113,7 +113,7 @@ math_sin(VALUE obj, VALUE x) /* * call-seq: * Math.tan(x) => float - * + * * Returns the tangent of x (expressed in radians). */ @@ -128,7 +128,7 @@ math_tan(VALUE obj, VALUE x) /* * call-seq: * Math.acos(x) => float - * + * * Computes the arc cosine of x. Returns 0..PI. */ @@ -148,7 +148,7 @@ math_acos(VALUE obj, VALUE x) /* * call-seq: * Math.asin(x) => float - * + * * Computes the arc sine of x. Returns -{PI/2} .. {PI/2}. */ @@ -168,7 +168,7 @@ math_asin(VALUE obj, VALUE x) /* * call-seq: * Math.atan(x) => float - * + * * Computes the arc tangent of x. Returns -{PI/2} .. {PI/2}. */ @@ -190,7 +190,7 @@ cosh(double x) /* * call-seq: * Math.cosh(x) => float - * + * * Computes the hyperbolic cosine of x (expressed in radians). */ @@ -198,7 +198,7 @@ static VALUE math_cosh(VALUE obj, VALUE x) { Need_Float(x); - + return DBL2NUM(cosh(RFLOAT_VALUE(x))); } @@ -213,7 +213,7 @@ sinh(double x) /* * call-seq: * Math.sinh(x) => float - * + * * Computes the hyperbolic sine of x (expressed in * radians). */ @@ -236,7 +236,7 @@ tanh(double x) /* * call-seq: * Math.tanh() => float - * + * * Computes the hyperbolic tangent of x (expressed in * radians). */ @@ -251,7 +251,7 @@ math_tanh(VALUE obj, VALUE x) /* * call-seq: * Math.acosh(x) => float - * + * * Computes the inverse hyperbolic cosine of x. */ @@ -271,7 +271,7 @@ math_acosh(VALUE obj, VALUE x) /* * call-seq: * Math.asinh(x) => float - * + * * Computes the inverse hyperbolic sine of x. */ @@ -285,7 +285,7 @@ math_asinh(VALUE obj, VALUE x) /* * call-seq: * Math.atanh(x) => float - * + * * Computes the inverse hyperbolic tangent of x. */ @@ -306,7 +306,7 @@ math_atanh(VALUE obj, VALUE x) /* * call-seq: * Math.exp(x) => float - * + * * Returns e**x. */ @@ -330,7 +330,7 @@ math_exp(VALUE obj, VALUE x) * call-seq: * Math.log(numeric) => float * Math.log(num,base) => float - * + * * Returns the natural logarithm of numeric. * If additional second argument is given, it will be the base * of logarithm. @@ -371,7 +371,7 @@ extern double log2(double); /* * call-seq: * Math.log2(numeric) => float - * + * * Returns the base 2 logarithm of numeric. */ @@ -392,7 +392,7 @@ math_log2(VALUE obj, VALUE x) /* * call-seq: * Math.log10(numeric) => float - * + * * Returns the base 10 logarithm of numeric. */ @@ -413,10 +413,10 @@ math_log10(VALUE obj, VALUE x) /* * call-seq: * Math.sqrt(numeric) => float - * + * * Returns the non-negative square root of numeric. * - * 0.upto(10) {|x| + * 0.upto(10) {|x| * p [x, Math.sqrt(x), Math.sqrt(x)**2] * } * #=> @@ -450,7 +450,7 @@ math_sqrt(VALUE obj, VALUE x) /* * call-seq: * Math.cbrt(numeric) => float - * + * * Returns the cube root of numeric. * * -9.upto(9) {|x| @@ -489,11 +489,11 @@ math_cbrt(VALUE obj, VALUE x) /* * call-seq: * Math.frexp(numeric) => [ fraction, exponent ] - * + * * Returns a two-element array containing the normalized fraction (a * Float) and exponent (a Fixnum) of * numeric. - * + * * fraction, exponent = Math.frexp(1234) #=> [0.6025390625, 11] * fraction * 2**exponent #=> 1234.0 */ @@ -505,7 +505,7 @@ math_frexp(VALUE obj, VALUE x) int exp; Need_Float(x); - + d = frexp(RFLOAT_VALUE(x), &exp); return rb_assoc_new(DBL2NUM(d), INT2NUM(exp)); } @@ -513,9 +513,9 @@ math_frexp(VALUE obj, VALUE x) /* * call-seq: * Math.ldexp(flt, int) -> float - * + * * Returns the value of flt*(2**int). - * + * * fraction, exponent = Math.frexp(1234) * Math.ldexp(fraction, exponent) #=> 1234.0 */ @@ -530,10 +530,10 @@ math_ldexp(VALUE obj, VALUE x, VALUE n) /* * call-seq: * Math.hypot(x, y) => float - * + * * Returns sqrt(x**2 + y**2), the hypotenuse of a right-angled triangle * with sides x and y. - * + * * Math.hypot(3, 4) #=> 5.0 */ @@ -689,7 +689,7 @@ exp1(sqrt) * trigonometric and transcendental functions. See class * Float for a list of constants that * define Ruby's floating point accuracy. - */ + */ void diff --git a/numeric.c b/numeric.c index 56abed8ee8..ea4122ca71 100644 --- a/numeric.c +++ b/numeric.c @@ -2455,7 +2455,7 @@ fix_pow(VALUE x, VALUE y) if (a == -1) { if (b % 2 == 0) return INT2FIX(1); - else + else return INT2FIX(-1); } return int_pow(a, b); diff --git a/object.c b/object.c index 39bab324dc..8ebb86a7bc 100644 --- a/object.c +++ b/object.c @@ -36,7 +36,7 @@ static ID id_eq, id_eql, id_match, id_inspect, id_init_copy; /* * call-seq: * obj === other => true or false - * + * * Case Equality---For class Object, effectively the same * as calling #==, but typically overridden by descendents * to provide meaningful semantics in case statements. @@ -64,7 +64,7 @@ rb_eql(VALUE obj1, VALUE obj2) * obj == other => true or false * obj.equal?(other) => true or false * obj.eql?(other) => true or false - * + * * Equality---At the Object level, == returns * true only if obj and other are the * same object. Typically, this method is overridden in descendent @@ -83,7 +83,7 @@ rb_eql(VALUE obj1, VALUE obj2) * there are exceptions. Numeric types, for example, * perform type conversion across ==, but not across * eql?, so: - * + * * 1 == 1.0 #=> true * 1.eql? 1.0 #=> false */ @@ -144,13 +144,13 @@ rb_class_real(VALUE cl) /* * call-seq: * obj.class => class - * + * * Returns the class of obj, now preferred over * Object#type, as an object's type in Ruby is only * loosely tied to that object's class. This method must always be * called with an explicit receiver, as class is also a * reserved word in Ruby. - * + * * 1.class #=> Fixnum * self.class #=> Object */ @@ -210,12 +210,12 @@ init_copy(VALUE dest, VALUE obj) /* * call-seq: * obj.clone -> an_object - * + * * Produces a shallow copy of obj---the instance variables of * obj are copied, but not the objects they reference. Copies * the frozen and tainted state of obj. See also the discussion * under Object#dup. - * + * * class Klass * attr_accessor :str * end @@ -251,7 +251,7 @@ rb_obj_clone(VALUE obj) /* * call-seq: * obj.dup -> an_object - * + * * Produces a shallow copy of obj---the instance variables of * obj are copied, but not the objects they reference. * dup copies the tainted state of obj. See also @@ -295,7 +295,7 @@ rb_obj_init_copy(VALUE obj, VALUE orig) /* * call-seq: * obj.to_s => string - * + * * Returns a string representing obj. The default * to_s prints the object's class and an encoding of the * object id. As a special case, the top-level object that is the @@ -365,11 +365,11 @@ inspect_obj(VALUE obj, VALUE str, int recur) /* * call-seq: * obj.inspect => string - * + * * Returns a string containing a human-readable representation of * obj. If not overridden, uses the to_s method to * generate the string. - * + * * [ 1, 2, 3..4, 'five' ].inspect #=> "[1, 2, 3..4, \"five\"]" * Time.new.inspect #=> "2008-03-08 19:43:39 +0900" */ @@ -407,7 +407,7 @@ rb_obj_inspect(VALUE obj) /* * call-seq: * obj.instance_of?(class) => true or false - * + * * Returns true if obj is an instance of the given * class. See also Object#kind_of?. */ @@ -433,11 +433,11 @@ rb_obj_is_instance_of(VALUE obj, VALUE c) * call-seq: * obj.is_a?(class) => true or false * obj.kind_of?(class) => true or false - * + * * Returns true if class is the class of * obj, or if class is one of the superclasses of * obj or modules included in obj. - * + * * module M; end * class A * include M @@ -482,7 +482,7 @@ rb_obj_is_kind_of(VALUE obj, VALUE c) /* * call-seq: * obj.tap{|x|...} => obj - * + * * Yields x to the block, and then returns x. * The primary purpose of this method is to "tap into" a method chain, * in order to perform operations on intermediate results within the chain. @@ -535,10 +535,10 @@ rb_obj_tap(VALUE obj) * * call-seq: * singleton_method_added(symbol) - * + * * Invoked as a callback whenever a singleton method is added to the * receiver. - * + * * module Chatty * def Chatty.singleton_method_added(id) * puts "Adding #{id.id2name}" @@ -547,13 +547,13 @@ rb_obj_tap(VALUE obj) * def two() end * def Chatty.three() end * end - * + * * produces: - * + * * Adding singleton_method_added * Adding one * Adding three - * + * */ /* @@ -561,10 +561,10 @@ rb_obj_tap(VALUE obj) * * call-seq: * singleton_method_removed(symbol) - * + * * Invoked as a callback whenever a singleton method is removed from * the receiver. - * + * * module Chatty * def Chatty.singleton_method_removed(id) * puts "Removing #{id.id2name}" @@ -577,9 +577,9 @@ rb_obj_tap(VALUE obj) * remove_method :one * end * end - * + * * produces: - * + * * Removing three * Removing one */ @@ -589,10 +589,10 @@ rb_obj_tap(VALUE obj) * * call-seq: * singleton_method_undefined(symbol) - * + * * Invoked as a callback whenever a singleton method is undefined in * the receiver. - * + * * module Chatty * def Chatty.singleton_method_undefined(id) * puts "Undefining #{id.id2name}" @@ -602,9 +602,9 @@ rb_obj_tap(VALUE obj) * undef_method(:one) * end * end - * + * * produces: - * + * * Undefining one */ @@ -644,7 +644,7 @@ rb_obj_dummy(void) /* * call-seq: * obj.tainted? => true or false - * + * * Returns true if the object is tainted. */ @@ -659,7 +659,7 @@ rb_obj_tainted(VALUE obj) /* * call-seq: * obj.taint -> obj - * + * * Marks obj as tainted---if the $SAFE level is * set appropriately, many method calls which might alter the running * programs environment will refuse to accept tainted strings. @@ -682,7 +682,7 @@ rb_obj_taint(VALUE obj) /* * call-seq: * obj.untaint => obj - * + * * Removes the taint from obj. */ @@ -702,7 +702,7 @@ rb_obj_untaint(VALUE obj) /* * call-seq: * obj.untrusted? => true or false - * + * * Returns true if the object is untrusted. */ @@ -717,7 +717,7 @@ rb_obj_untrusted(VALUE obj) /* * call-seq: * obj.untrust -> obj - * + * * Marks obj as untrusted. */ @@ -738,7 +738,7 @@ rb_obj_untrust(VALUE obj) /* * call-seq: * obj.trust => obj - * + * * Removes the untrusted mark from obj. */ @@ -766,18 +766,18 @@ static st_table *immediate_frozen_tbl = 0; /* * call-seq: * obj.freeze => obj - * + * * Prevents further modifications to obj. A * RuntimeError will be raised if modification is attempted. * There is no way to unfreeze a frozen object. See also * Object#frozen?. - * + * * a = [ "a", "b", "c" ] * a.freeze * a << "z" - * + * * produces: - * + * * prog.rb:3:in `<<': can't modify frozen array (RuntimeError) * from prog.rb:3 */ @@ -803,9 +803,9 @@ rb_obj_freeze(VALUE obj) /* * call-seq: * obj.frozen? => true or false - * + * * Returns the freeze status of obj. - * + * * a = [ "a", "b", "c" ] * a.freeze #=> ["a", "b", "c"] * a.frozen? #=> true @@ -832,9 +832,9 @@ rb_obj_frozen_p(VALUE obj) /* * call-seq: * nil.to_i => 0 - * + * * Always returns zero. - * + * * nil.to_i #=> 0 */ @@ -848,9 +848,9 @@ nil_to_i(VALUE obj) /* * call-seq: * nil.to_f => 0.0 - * + * * Always returns zero. - * + * * nil.to_f #=> 0.0 */ @@ -863,7 +863,7 @@ nil_to_f(VALUE obj) /* * call-seq: * nil.to_s => "" - * + * * Always returns the empty string. */ @@ -878,9 +878,9 @@ nil_to_s(VALUE obj) * * call-seq: * nil.to_a => [] - * + * * Always returns an empty array. - * + * * nil.to_a #=> [] */ @@ -930,7 +930,7 @@ true_to_s(VALUE obj) /* * call-seq: * true & obj => true or false - * + * * And---Returns false if obj is * nil or false, true otherwise. */ @@ -944,16 +944,16 @@ true_and(VALUE obj, VALUE obj2) /* * call-seq: * true | obj => true - * + * * Or---Returns true. As anObject is an argument to * a method call, it is always evaluated; there is no short-circuit * evaluation in this case. - * + * * true | puts("or") * true || puts("logical or") - * + * * produces: - * + * * or */ @@ -967,7 +967,7 @@ true_or(VALUE obj, VALUE obj2) /* * call-seq: * true ^ obj => !obj - * + * * Exclusive Or---Returns true if obj is * nil or false, false * otherwise. @@ -987,7 +987,7 @@ true_xor(VALUE obj, VALUE obj2) * FalseClass and represents a logically false value in * boolean expressions. The class provides operators allowing * false to participate correctly in logical expressions. - * + * */ /* @@ -1007,7 +1007,7 @@ false_to_s(VALUE obj) * call-seq: * false & obj => false * nil & obj => false - * + * * And---Returns false. obj is always * evaluated as it is the argument to a method call---there is no * short-circuit evaluation in this case. @@ -1024,7 +1024,7 @@ false_and(VALUE obj, VALUE obj2) * call-seq: * false | obj => true or false * nil | obj => true or false - * + * * Or---Returns false if obj is * nil or false; true otherwise. */ @@ -1041,11 +1041,11 @@ false_or(VALUE obj, VALUE obj2) * call-seq: * false ^ obj => true or false * nil ^ obj => true or false - * + * * Exclusive Or---If obj is nil or * false, returns false; otherwise, returns * true. - * + * */ static VALUE @@ -1086,7 +1086,7 @@ rb_false(VALUE obj) /* * call-seq: * obj =~ other => nil - * + * * Pattern Match---Overridden by descendents (notably * Regexp and String) to provide meaningful * pattern-match semantics. @@ -1101,7 +1101,7 @@ rb_obj_match(VALUE obj1, VALUE obj2) /* * call-seq: * obj !~ other => true or false - * + * * Returns true if two objects do not match (using the =~ * method), otherwise false. */ @@ -1124,11 +1124,11 @@ rb_obj_not_match(VALUE obj1, VALUE obj2) * included, module methods do not. Conversely, module methods may be * called without creating an encapsulating object, while instance * methods may not. (See Module#module_function) - * + * * In the descriptions that follow, the parameter syml refers * to a symbol, which is either a quoted string or a * Symbol (such as :name). - * + * * module Mod * include Math * CONST = 1 @@ -1139,7 +1139,7 @@ rb_obj_not_match(VALUE obj1, VALUE obj2) * Mod.class #=> Module * Mod.constants #=> [:CONST, :PI, :E] * Mod.instance_methods #=> [:meth] - * + * */ /* @@ -1177,7 +1177,7 @@ rb_mod_to_s(VALUE klass) /* * call-seq: * mod.freeze - * + * * Prevents further modifications to mod. */ @@ -1191,7 +1191,7 @@ rb_mod_freeze(VALUE mod) /* * call-seq: * mod === obj => true or false - * + * * Case Equality---Returns true if anObject is an * instance of mod or one of mod's descendents. Of * limited use for modules, but can be used in case @@ -1209,9 +1209,9 @@ rb_mod_eqq(VALUE mod, VALUE arg) * mod <= other => true, false, or nil * * Returns true if mod is a subclass of other or - * is the same as other. Returns - * nil if there's no relationship between the two. - * (Think of the relationship in terms of the class definition: + * is the same as other. Returns + * nil if there's no relationship between the two. + * (Think of the relationship in terms of the class definition: * "class A true, false, or nil * - * Returns true if mod is a subclass of other. Returns - * nil if there's no relationship between the two. - * (Think of the relationship in terms of the class definition: + * Returns true if mod is a subclass of other. Returns + * nil if there's no relationship between the two. + * (Think of the relationship in terms of the class definition: * "class A= other => true, false, or nil * * Returns true if mod is an ancestor of other, or the - * two modules are the same. Returns - * nil if there's no relationship between the two. - * (Think of the relationship in terms of the class definition: + * two modules are the same. Returns + * nil if there's no relationship between the two. + * (Think of the relationship in terms of the class definition: * "class AA"). * */ @@ -1292,9 +1292,9 @@ rb_mod_ge(VALUE mod, VALUE arg) * call-seq: * mod > other => true, false, or nil * - * Returns true if mod is an ancestor of other. Returns - * nil if there's no relationship between the two. - * (Think of the relationship in terms of the class definition: + * Returns true if mod is an ancestor of other. Returns + * nil if there's no relationship between the two. + * (Think of the relationship in terms of the class definition: * "class AA"). * */ @@ -1309,7 +1309,7 @@ rb_mod_gt(VALUE mod, VALUE arg) /* * call-seq: * mod <=> other_mod => -1, 0, +1, or nil - * + * * Comparison---Returns -1 if mod includes other_mod, 0 if * mod is the same as other_mod, and +1 if mod is * included by other_mod or if mod has no relationship with @@ -1358,11 +1358,11 @@ rb_class_s_alloc(VALUE klass) * call-seq: * Module.new => mod * Module.new {|mod| block } => mod - * + * * Creates a new anonymous module. If a block is given, it is passed * the module object, and the block is evaluated in the context of this * module using module_eval. - * + * * Fred = Module.new do * def meth1 * "hello" @@ -1391,11 +1391,11 @@ rb_mod_initialize(VALUE module) /* * call-seq: * Class.new(super_class=Object) => a_class - * + * * Creates a new anonymous (unnamed) class with the given superclass * (or Object if no parameter is given). You can give a * class a name by assigning the class object to a constant. - * + * */ static VALUE @@ -1424,23 +1424,23 @@ rb_class_initialize(int argc, VALUE *argv, VALUE klass) /* * call-seq: * class.allocate() => obj - * + * * Allocates space for a new object of class's class and does not * call initialize on the new instance. The returned object must be an * instance of class. - * + * * klass = Class.new do * def initialize(*args) * @initialized = true * end - * + * * def initialized? * @initialized || false * end * end - * + * * klass.allocate.initialized? #=> false - * + * */ VALUE @@ -1472,13 +1472,13 @@ rb_class_allocate_instance(VALUE klass) /* * call-seq: * class.new(args, ...) => obj - * + * * Calls allocate to create a new object of * class's class, then invokes that object's * initialize method, passing it args. * This is the method that ends up getting called whenever * an object is constructed using .new. - * + * */ VALUE @@ -1495,9 +1495,9 @@ rb_class_new_instance(int argc, VALUE *argv, VALUE klass) /* * call-seq: * class.superclass -> a_super_class or nil - * + * * Returns the superclass of class, or nil. - * + * * File.superclass #=> IO * IO.superclass #=> Object * Object.superclass #=> BasicObject @@ -1508,7 +1508,7 @@ rb_class_new_instance(int argc, VALUE *argv, VALUE klass) * returns nil when the given class hasn't a parent class: * * BasicObject.superclass #=> nil - * + * */ static VALUE @@ -1533,7 +1533,7 @@ rb_class_superclass(VALUE klass) * call-seq: * attr_reader(symbol, ...) => nil * attr(symbol, ...) => nil - * + * * Creates instance variables and corresponding methods that return the * value of each instance variable. Equivalent to calling * ``attr:name'' on each name in turn. @@ -1564,7 +1564,7 @@ rb_mod_attr(int argc, VALUE *argv, VALUE klass) /* * call-seq: * attr_writer(symbol, ...) => nil - * + * * Creates an accessor method to allow assignment to the attribute * aSymbol.id2name. */ @@ -1583,12 +1583,12 @@ rb_mod_attr_writer(int argc, VALUE *argv, VALUE klass) /* * call-seq: * attr_accessor(symbol, ...) => nil - * + * * Defines a named attribute for this module, where the name is * symbol.id2name, creating an instance variable * (@name) and a corresponding access method to read it. * Also creates a method called name= to set the attribute. - * + * * module Mod * attr_accessor(:one, :two) * end @@ -1609,9 +1609,9 @@ rb_mod_attr_accessor(int argc, VALUE *argv, VALUE klass) /* * call-seq: * mod.const_get(sym, inherit=true) => obj - * + * * Returns the value of the named constant in mod. - * + * * Math.const_get(:PI) #=> 3.14159265358979 * * If the constant is not defined or is defined by the ancestors and @@ -1641,11 +1641,11 @@ rb_mod_const_get(int argc, VALUE *argv, VALUE mod) /* * call-seq: * mod.const_set(sym, obj) => obj - * + * * Sets the named constant to the given object, returning that object. * Creates a new constant if no constant with the given name previously * existed. - * + * * Math.const_set("HIGH_SCHOOL_PI", 22.0/7.0) #=> 3.14285714285714 * Math::HIGH_SCHOOL_PI - Math::PI #=> 0.00126448926734968 */ @@ -1665,10 +1665,10 @@ rb_mod_const_set(VALUE mod, VALUE name, VALUE value) /* * call-seq: * mod.const_defined?(sym, inherit=true) => true or false - * + * * Returns true if a constant with the given name is * defined by mod, or its ancestors if +inherit+ is not false. - * + * * Math.const_defined? "PI" #=> true * IO.const_defined? "SYNC" #=> true * IO.const_defined? "SYNC", false #=> false @@ -1697,17 +1697,17 @@ rb_mod_const_defined(int argc, VALUE *argv, VALUE mod) /* * call-seq: * obj.methods => array - * + * * Returns a list of the names of methods publicly accessible in * obj. This will include all the methods accessible in * obj's ancestors. - * + * * class Klass * def kMethod() * end * end * k = Klass.new - * k.methods[0..9] #=> ["kMethod", "freeze", "nil?", "is_a?", + * k.methods[0..9] #=> ["kMethod", "freeze", "nil?", "is_a?", * # "class", "instance_variable_set", * # "methods", "extend", "__send__", "instance_eval"] * k.methods.length #=> 42 @@ -1738,7 +1738,7 @@ rb_obj_methods(int argc, VALUE *argv, VALUE obj) /* * call-seq: * obj.protected_methods(all=true) => array - * + * * Returns the list of protected methods accessible to obj. If * the all parameter is set to false, only those methods * in the receiver will be listed. @@ -1759,7 +1759,7 @@ rb_obj_protected_methods(int argc, VALUE *argv, VALUE obj) /* * call-seq: * obj.private_methods(all=true) => array - * + * * Returns the list of private methods accessible to obj. If * the all parameter is set to false, only those methods * in the receiver will be listed. @@ -1780,7 +1780,7 @@ rb_obj_private_methods(int argc, VALUE *argv, VALUE obj) /* * call-seq: * obj.public_methods(all=true) => array - * + * * Returns the list of public methods accessible to obj. If * the all parameter is set to false, only those methods * in the receiver will be listed. @@ -1807,7 +1807,7 @@ rb_obj_public_methods(int argc, VALUE *argv, VALUE obj) * variable name should be included for regular instance * variables. Throws a NameError exception if the * supplied symbol is not valid as an instance variable name. - * + * * class Fred * def initialize(p1, p2) * @a, @b = p1, p2 @@ -1832,12 +1832,12 @@ rb_obj_ivar_get(VALUE obj, VALUE iv) /* * call-seq: * obj.instance_variable_set(symbol, obj) => obj - * + * * Sets the instance variable names by symbol to * object, thereby frustrating the efforts of the class's * author to attempt to provide proper encapsulation. The variable * did not have to exist prior to this call. - * + * * class Fred * def initialize(p1, p2) * @a, @b = p1, p2 @@ -1892,11 +1892,11 @@ rb_obj_ivar_defined(VALUE obj, VALUE iv) /* * call-seq: * mod.class_variable_get(symbol) => obj - * + * * Returns the value of the given class variable (or throws a * NameError exception). The @@ part of the * variable name should be included for regular class variables - * + * * class Fred * @@foo = 99 * end @@ -1917,10 +1917,10 @@ rb_mod_cvar_get(VALUE obj, VALUE iv) /* * call-seq: * obj.class_variable_set(symbol, obj) => obj - * + * * Sets the class variable names by symbol to * object. - * + * * class Fred * @@foo = 99 * def foo @@ -2004,7 +2004,7 @@ convert_type(VALUE val, const char *tname, const char *method, int raise) NIL_P(val) ? "nil" : val == Qtrue ? "true" : val == Qfalse ? "false" : - rb_obj_classname(val), + rb_obj_classname(val), tname); } else { @@ -2118,7 +2118,7 @@ rb_Integer(VALUE val) /* * call-seq: * Integer(arg) => integer - * + * * Converts arg to a Fixnum or Bignum. * Numeric types are converted directly (with floating point numbers * being truncated). If arg is a String, leading @@ -2126,7 +2126,7 @@ rb_Integer(VALUE val) * 0x) are honored. Others are converted using * to_int and to_i. This behavior is * different from that of String#to_i. - * + * * Integer(123.999) #=> 123 * Integer("0x1a") #=> 26 * Integer(Time.new) #=> 1204973019 @@ -2261,11 +2261,11 @@ rb_Float(VALUE val) /* * call-seq: * Float(arg) => float - * + * * Returns arg converted to a float. Numeric types are converted * directly, the rest are converted using arg.to_f. As of Ruby * 1.8, converting nil generates a TypeError. - * + * * Float(1) #=> 1.0 * Float("123.456") #=> 123.456 */ @@ -2322,10 +2322,10 @@ rb_String(VALUE val) /* * call-seq: * String(arg) => string - * + * * Converts arg to a String by calling its * to_s method. - * + * * String(self) #=> "main" * String(self.class) #=> "Object" * String(123456) #=> "123456" @@ -2354,10 +2354,10 @@ rb_Array(VALUE val) /* * call-seq: * Array(arg) => array - * + * * Returns arg as an Array. First tries to call * arg.to_ary, then arg.to_a. - * + * * Array(1..5) #=> [1, 2, 3, 4, 5] */ @@ -2391,7 +2391,7 @@ boot_defmetametaclass(VALUE klass, VALUE metametaclass) * * Classes in Ruby are first-class objects---each is an instance of * class Class. - * + * * When a new class is created (typically using class Name ... * end), an object of type Class is created and * assigned to a global constant (Name in this case). When @@ -2399,7 +2399,7 @@ boot_defmetametaclass(VALUE klass, VALUE metametaclass) * new method in Class is run by default. * This can be demonstrated by overriding new in * Class: - * + * * class Class * alias oldNew new * def new(*args) @@ -2407,21 +2407,21 @@ boot_defmetametaclass(VALUE klass, VALUE metametaclass) * oldNew(*args) * end * end - * - * + * + * * class Name * end - * - * + * + * * n = Name.new - * + * * produces: - * + * * Creating a new Name - * + * * Classes, modules, and objects are interrelated. In the diagram * that follows, the vertical arrows represent inheritance, and the - * parentheses meta-classes. All metaclasses are instances + * parentheses meta-classes. All metaclasses are instances * of the class `Class'. * * +-----------------+ @@ -2453,13 +2453,13 @@ boot_defmetametaclass(VALUE klass, VALUE metametaclass) * class hierarchy is a direct subclass of BasicObject. Its * methods are therefore available to all objects unless explicitly * overridden. - * + * * Object mixes in the Kernel module, making * the built-in kernel functions globally accessible. Although the * instance methods of Object are defined by the * Kernel module, we have chosen to document them here for * clarity. - * + * * In the descriptions of Object's methods, the parameter symbol refers * to a symbol, which is either a quoted string or a * Symbol (such as :name). @@ -2509,7 +2509,7 @@ Init_Object(void) rb_define_private_method(rb_cModule, "method_undefined", rb_obj_dummy, 1); rb_define_method(rb_mKernel, "nil?", rb_false, 0); - rb_define_method(rb_mKernel, "===", rb_equal, 1); + rb_define_method(rb_mKernel, "===", rb_equal, 1); rb_define_method(rb_mKernel, "=~", rb_obj_match, 1); rb_define_method(rb_mKernel, "!~", rb_obj_not_match, 1); rb_define_method(rb_mKernel, "eql?", rb_obj_equal, 1); @@ -2595,24 +2595,24 @@ Init_Object(void) rb_define_alloc_func(rb_cModule, rb_module_s_alloc); rb_define_method(rb_cModule, "initialize", rb_mod_initialize, 0); rb_define_method(rb_cModule, "instance_methods", rb_class_instance_methods, -1); /* in class.c */ - rb_define_method(rb_cModule, "public_instance_methods", + rb_define_method(rb_cModule, "public_instance_methods", rb_class_public_instance_methods, -1); /* in class.c */ - rb_define_method(rb_cModule, "protected_instance_methods", + rb_define_method(rb_cModule, "protected_instance_methods", rb_class_protected_instance_methods, -1); /* in class.c */ - rb_define_method(rb_cModule, "private_instance_methods", + rb_define_method(rb_cModule, "private_instance_methods", rb_class_private_instance_methods, -1); /* in class.c */ rb_define_method(rb_cModule, "constants", rb_mod_constants, -1); /* in variable.c */ rb_define_method(rb_cModule, "const_get", rb_mod_const_get, -1); rb_define_method(rb_cModule, "const_set", rb_mod_const_set, 2); rb_define_method(rb_cModule, "const_defined?", rb_mod_const_defined, -1); - rb_define_private_method(rb_cModule, "remove_const", + rb_define_private_method(rb_cModule, "remove_const", rb_mod_remove_const, 1); /* in variable.c */ - rb_define_method(rb_cModule, "const_missing", + rb_define_method(rb_cModule, "const_missing", rb_mod_const_missing, 1); /* in variable.c */ - rb_define_method(rb_cModule, "class_variables", + rb_define_method(rb_cModule, "class_variables", rb_mod_class_variables, 0); /* in variable.c */ - rb_define_method(rb_cModule, "remove_class_variable", + rb_define_method(rb_cModule, "remove_class_variable", rb_mod_remove_cvar, 1); /* in variable.c */ rb_define_method(rb_cModule, "class_variable_get", rb_mod_cvar_get, 1); rb_define_method(rb_cModule, "class_variable_set", rb_mod_cvar_set, 2); diff --git a/parse.y b/parse.y index f0b019670a..545559c424 100644 --- a/parse.y +++ b/parse.y @@ -3498,7 +3498,7 @@ block_call : command do_block } else { block_dup_check($1->nd_args, $2); - } + } $2->nd_iter = $1; $$ = $2; fixpos($$, $1); diff --git a/proc.c b/proc.c index 2761158815..02f33edee9 100644 --- a/proc.c +++ b/proc.c @@ -294,12 +294,12 @@ rb_binding_new(void) /* * call-seq: * binding -> a_binding - * + * * Returns a +Binding+ object, describing the variable and * method bindings at the point of call. This object can be used when * calling +eval+ to execute the evaluated command in this * environment. Also see the description of class +Binding+. - * + * * def getBinding(param) * return binding * end @@ -397,12 +397,12 @@ proc_new(VALUE klass, int is_lambda) * call-seq: * Proc.new {|...| block } => a_proc * Proc.new => a_proc - * + * * Creates a new Proc object, bound to the current * context. Proc::new may be called without a block only * within a method with an attached block, in which case that block is * converted to the Proc object. - * + * * def proc_from * Proc.new * end @@ -466,7 +466,7 @@ proc_lambda(void) * prc.call(params,...) => obj * prc[params,...] => obj * prc.(params,...) => obj - * + * * Invokes the block, setting the block's parameters to the values in * params using something close to method calling semantics. * Generates a warning if multiple values are passed to a proc that @@ -481,15 +481,15 @@ proc_lambda(void) * * Returns the value of the last expression evaluated in the block. See * also Proc#yield. - * + * * a_proc = Proc.new {|a, *b| b.collect {|i| i*a }} * a_proc.call(9, 1, 2, 3) #=> [9, 18, 27] * a_proc[9, 1, 2, 3] #=> [9, 18, 27] * a_proc = Proc.new {|a,b| a} * a_proc.call(1,2,3) - * + * * produces: - * + * * prog.rb:5: wrong number of arguments (3 for 2) (ArgumentError) * from prog.rb:4:in `call' * from prog.rb:5 @@ -498,7 +498,7 @@ proc_lambda(void) /* * call-seq: * prc === obj => obj - * + * * Invokes the block, with obj as the block's parameter. It is * to allow a proc object to be a target of when clause in the case statement. */ @@ -555,14 +555,14 @@ rb_proc_call_with_block(VALUE self, int argc, VALUE *argv, VALUE pass_procval) /* * call-seq: * prc.arity -> fixnum - * + * * Returns the number of arguments that would not be ignored. If the block * is declared to take no arguments, returns 0. If the block is known * to take exactly n arguments, returns n. If the block has optional * arguments, return -n-1, where n is the number of mandatory * arguments. A proc with no argument declarations * is the same a block declaring || as its arguments. - * + * * Proc.new {}.arity #=> 0 * Proc.new {||}.arity #=> 0 * Proc.new {|a|}.arity #=> 1 @@ -761,14 +761,14 @@ proc_to_s(VALUE self) const char *cname = rb_obj_classname(self); rb_iseq_t *iseq; const char *is_lambda; - + GetProcPtr(self, proc); iseq = proc->block.iseq; is_lambda = proc->is_lambda ? " (lambda)" : ""; if (RUBY_VM_NORMAL_ISEQ_P(iseq)) { int line_no = 0; - + if (iseq->insn_info_table) { line_no = rb_iseq_first_lineno(iseq); } @@ -790,7 +790,7 @@ proc_to_s(VALUE self) /* * call-seq: * prc.to_proc -> prc - * + * * Part of the protocol for converting objects to Proc * objects. Instances of class Proc simply return * themselves. @@ -883,7 +883,7 @@ mnew(VALUE klass, VALUE obj, ID id, VALUE mclass, int scope) * associated with an iterator. They may also be unbound from one * object (creating an UnboundMethod) and bound to * another. - * + * * class Thing * def square(n) * n*n @@ -891,10 +891,10 @@ mnew(VALUE klass, VALUE obj, ID id, VALUE mclass, int scope) * end * thing = Thing.new * meth = thing.method(:square) - * + * * meth.call(9) #=> 81 * [ 1, 2, 3 ].collect(&meth) #=> [1, 4, 9] - * + * */ /* @@ -952,7 +952,7 @@ method_hash(VALUE method) /* * call-seq: * meth.unbind => unbound_method - * + * * Dissociates meth from it's current receiver. The resulting * UnboundMethod can subsequently be bound to a new object * of the same class (see UnboundMethod). @@ -981,7 +981,7 @@ method_unbind(VALUE obj) /* * call-seq: * meth.receiver => object - * + * * Returns the bound receiver of the method object. */ @@ -997,7 +997,7 @@ method_receiver(VALUE obj) /* * call-seq: * meth.name => symbol - * + * * Returns the name of the method. */ @@ -1013,7 +1013,7 @@ method_name(VALUE obj) /* * call-seq: * meth.owner => class_or_module - * + * * Returns the class or module that defines the method. */ @@ -1029,13 +1029,13 @@ method_owner(VALUE obj) /* * call-seq: * obj.method(sym) => method - * + * * Looks up the named method as a receiver in obj, returning a * Method object (or raising NameError). The * Method object acts as a closure in obj's object * instance, so instance variables and the value of self * remain available. - * + * * class Demo * def initialize(n) * @iv = n @@ -1044,11 +1044,11 @@ method_owner(VALUE obj) * "Hello, @iv = #{@iv}" * end * end - * + * * k = Demo.new(99) * m = k.method(:hello) * m.call #=> "Hello, @iv = 99" - * + * * l = Demo.new('Fred') * m = l.method("hello") * m.call #=> "Hello, @iv = Fred" @@ -1069,10 +1069,10 @@ rb_obj_public_method(VALUE obj, VALUE vid) /* * call-seq: * mod.instance_method(symbol) => unbound_method - * + * * Returns an +UnboundMethod+ representing the given * instance method in _mod_. - * + * * class Interpreter * def do_a() print "there, "; end * def do_d() print "Hello "; end @@ -1088,13 +1088,13 @@ rb_obj_public_method(VALUE obj, VALUE vid) * string.each_byte {|b| Dispatcher[b].bind(self).call } * end * end - * - * + * + * * interpreter = Interpreter.new * interpreter.interpret('dave') - * + * * produces: - * + * * Hello there, Dave! */ @@ -1114,14 +1114,14 @@ rb_mod_public_instance_method(VALUE mod, VALUE vid) * call-seq: * define_method(symbol, method) => new_method * define_method(symbol) { block } => proc - * + * * Defines an instance method in the receiver. The _method_ * parameter can be a +Proc+ or +Method+ object. * If a block is specified, it is used as the method body. This block * is evaluated using instance_eval, a point that is * tricky to demonstrate because define_method is private. * (This is why we resort to the +send+ hack in this example.) - * + * * class A * def fred * puts "In Fred" @@ -1139,9 +1139,9 @@ rb_mod_public_instance_method(VALUE mod, VALUE vid) * a.wilma * a.create_method(:betty) { p self } * a.betty - * + * * produces: - * + * * In Fred * Charge it! * # @@ -1242,10 +1242,10 @@ method_clone(VALUE self) * call-seq: * meth.call(args, ...) => obj * meth[args, ...] => obj - * + * * Invokes the meth with the specified arguments, returning the * method's return value. - * + * * m = 12.method("+") * m.call(3) #=> 15 * m.call(20) #=> 32 @@ -1296,17 +1296,17 @@ rb_method_call(int argc, VALUE *argv, VALUE method) * with a particular object: these method objects are bound to that * object. Bound method objects for an object can be created using * Object#method. - * + * * Ruby also supports unbound methods; methods objects that are not * associated with a particular object. These can be created either by * calling Module#instance_method or by calling * unbind on a bound method object. The result of both of * these is an UnboundMethod object. - * + * * Unbound methods can only be called after they are bound to an * object. That object must be be a kind_of? the method's original * class. - * + * * class Square * def area * @side * @side @@ -1315,17 +1315,17 @@ rb_method_call(int argc, VALUE *argv, VALUE method) * @side = side * end * end - * + * * area_un = Square.instance_method(:area) - * + * * s = Square.new(12) * area = area_un.bind(s) * area.call #=> 144 - * + * * Unbound methods are a reference to the method at the time it was * objectified: subsequent changes to the underlying class will not * affect the unbound method. - * + * * class Test * def test * :original @@ -1340,17 +1340,17 @@ rb_method_call(int argc, VALUE *argv, VALUE method) * t = Test.new * t.test #=> :modified * um.bind(t).call #=> :original - * + * */ /* * call-seq: * umeth.bind(obj) -> method - * + * * Bind umeth to obj. If Klass was the class * from which umeth was obtained, * obj.kind_of?(Klass) must be true. - * + * * class A * def test * puts "In test, class = #{self.class}" @@ -1360,8 +1360,8 @@ rb_method_call(int argc, VALUE *argv, VALUE method) * end * class C < B * end - * - * + * + * * um = B.instance_method(:test) * bm = um.bind(C.new) * bm.call @@ -1369,9 +1369,9 @@ rb_method_call(int argc, VALUE *argv, VALUE method) * bm.call * bm = um.bind(A.new) * bm.call - * + * * produces: - * + * * In test, class = C * In test, class = B * prog.rb:16:in `bind': bind argument must be an instance of B (TypeError) @@ -1438,14 +1438,14 @@ rb_node_arity(NODE* body) /* * call-seq: * meth.arity => fixnum - * + * * Returns an indication of the number of arguments accepted by a * method. Returns a nonnegative integer for methods that take a fixed * number of arguments. For Ruby methods that take a variable number of * arguments, returns -n-1, where n is the number of required * arguments. For methods written in C, returns -1 if the call takes a * variable number of arguments. - * + * * class C * def one; end * def two(a); end @@ -1461,7 +1461,7 @@ rb_node_arity(NODE* body) * c.method(:four).arity #=> 2 * c.method(:five).arity #=> -3 * c.method(:six).arity #=> -3 - * + * * "cat".method(:size).arity #=> 0 * "cat".method(:replace).arity #=> 1 * "cat".method(:squeeze).arity #=> -1 @@ -1643,7 +1643,7 @@ rb_proc_new( /* * call-seq: * meth.to_proc => prc - * + * * Returns a Proc object corresponding to this method. */ @@ -1705,15 +1705,15 @@ localjump_reason(VALUE exc) /* * call-seq: * prc.binding => binding - * + * * Returns the binding associated with prc. Note that * Kernel#eval accepts either a Proc or a * Binding object as its second parameter. - * + * * def fred(param) * proc {} * end - * + * * b = fred(99) * eval("param", b.binding) #=> 99 */ @@ -1840,18 +1840,18 @@ proc_curry(int argc, VALUE *argv, VALUE self) * Proc objects are blocks of code that have been bound to * a set of local variables. Once bound, the code may be called in * different contexts and still access those variables. - * + * * def gen_times(factor) * return Proc.new {|n| n*factor } * end - * + * * times3 = gen_times(3) * times5 = gen_times(5) - * + * * times3.call(12) #=> 36 * times5.call(5) #=> 25 * times3.call(times5.call(4)) #=> 60 - * + * */ void @@ -1951,11 +1951,11 @@ Init_Proc(void) * are all retained. Binding objects can be created using * Kernel#binding, and are made available to the callback * of Kernel#set_trace_func. - * + * * These binding objects can be passed as the second argument of the * Kernel#eval method, establishing an environment for the * evaluation. - * + * * class Demo * def initialize(n) * @secret = n @@ -1964,18 +1964,18 @@ Init_Proc(void) * return binding() * end * end - * + * * k1 = Demo.new(99) * b1 = k1.getBinding * k2 = Demo.new(-3) * b2 = k2.getBinding - * + * * eval("@secret", b1) #=> 99 * eval("@secret", b2) #=> -3 * eval("@secret") #=> nil - * + * * Binding objects have no class-specific methods. - * + * */ void diff --git a/random.c b/random.c index 3c74a2acb6..050619ef18 100644 --- a/random.c +++ b/random.c @@ -9,7 +9,7 @@ **********************************************************************/ -/* +/* This is based on trimmed version of MT19937. To get the original version, contact . @@ -24,7 +24,7 @@ The original copyright notice follows. or init_by_array(mt, init_key, key_length). Copyright (C) 1997 - 2002, Makoto Matsumoto and Takuji Nishimura, - All rights reserved. + All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions @@ -37,8 +37,8 @@ The original copyright notice follows. notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. - 3. The names of its contributors may not be used to endorse or promote - products derived from this software without specific prior written + 3. The names of its contributors may not be used to endorse or promote + products derived from this software without specific prior written permission. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS @@ -59,7 +59,7 @@ The original copyright notice follows. email: matumoto@math.keio.ac.jp */ -/* Period parameters */ +/* Period parameters */ #define N 624 #define M 397 #define MATRIX_A 0x9908b0dfUL /* constant vector a */ @@ -340,7 +340,7 @@ random_seed(void) /* * call-seq: * srand(number=0) => old_seed - * + * * Seeds the pseudorandom number generator to the value of * number. If number is omitted * or zero, seeds the generator using a combination of the time, the @@ -369,7 +369,7 @@ rb_f_srand(int argc, VALUE *argv, VALUE obj) return old; } -static unsigned long +static unsigned long make_mask(unsigned long x) { x = x | x >> 1; @@ -465,7 +465,7 @@ rb_rand_internal(unsigned long i) /* * call-seq: * rand(max=0) => number - * + * * Converts max to an integer using max1 = * max.to_i.abs. If the result is zero, returns a * pseudorandom floating point number greater than or equal to 0.0 and @@ -474,7 +474,7 @@ rb_rand_internal(unsigned long i) * may be used to ensure repeatable sequences of random numbers between * different runs of the program. Ruby currently uses a modified * Mersenne Twister with a period of 2**19937-1. - * + * * srand 1234 #=> 0 * [ rand, rand ] #=> [0.191519450163469, 0.49766366626136] * [ rand(10), rand(1000) ] #=> [6, 817] diff --git a/range.c b/range.c index 4c9fa869f7..6e0af8679e 100644 --- a/range.c +++ b/range.c @@ -44,7 +44,7 @@ range_init(VALUE range, VALUE beg, VALUE end, int exclude_end) args[0] = beg; args[1] = end; - + if (!FIXNUM_P(beg) || !FIXNUM_P(end)) { VALUE v; @@ -70,7 +70,7 @@ rb_range_new(VALUE beg, VALUE end, int exclude_end) /* * call-seq: * Range.new(start, end, exclusive=false) => range - * + * * Constructs a range using the given start and end. If the third * parameter is omitted or is false, the range will include * the end object; otherwise, it will be excluded. @@ -80,7 +80,7 @@ static VALUE range_initialize(int argc, VALUE *argv, VALUE range) { VALUE beg, end, flags; - + rb_scan_args(argc, argv, "21", &beg, &end, &flags); /* Ranges are immutable, so that they should be initialized only once. */ if (RANGE_EXCL(range) != Qnil) { @@ -95,7 +95,7 @@ range_initialize(int argc, VALUE *argv, VALUE range) /* * call-seq: * rng.exclude_end? => true or false - * + * * Returns true if rng excludes its end value. */ @@ -109,15 +109,15 @@ range_exclude_end_p(VALUE range) /* * call-seq: * rng == obj => true or false - * + * * Returns true only if obj is a Range, has equivalent * beginning and end items (by comparing them with ==), and has * the same #exclude_end? setting as rng. - * + * * (0..2) == (0..2) #=> true * (0..2) == Range.new(0,2) #=> true * (0..2) == (0...2) #=> false - * + * */ static VALUE @@ -171,15 +171,15 @@ r_le(VALUE a, VALUE b) /* * call-seq: * rng.eql?(obj) => true or false - * + * * Returns true only if obj is a Range, has equivalent * beginning and end items (by comparing them with #eql?), and has the same * #exclude_end? setting as rng. - * + * * (0..2) == (0..2) #=> true * (0..2) == Range.new(0,2) #=> true * (0..2) == (0...2) #=> false - * + * */ static VALUE @@ -274,19 +274,19 @@ extern int ruby_float_step(VALUE from, VALUE to, VALUE step, int excl); /* * call-seq: * rng.step(n=1) {| obj | block } => rng - * + * * Iterates over rng, passing each nth element to the block. If * the range contains numbers, n is added for each iteration. Otherwise * step invokes succ to iterate through range * elements. The following code uses class Xs, which is defined * in the class-level documentation. - * + * * range = Xs.new(1)..Xs.new(10) * range.step(2) {|x| puts x} * range.step(3) {|x| puts x} - * + * * produces: - * + * * 1 x * 3 xxx * 5 xxxxx @@ -330,7 +330,7 @@ range_step(int argc, VALUE *argv, VALUE range) if (!EXCL(range)) end += 1; - i = FIX2LONG(b); + i = FIX2LONG(b); while (i < end) { rb_yield(LONG2NUM(i)); if (i + unit < i) break; @@ -392,18 +392,18 @@ each_i(VALUE v, void *arg) /* * call-seq: * rng.each {| i | block } => rng - * + * * Iterates over the elements rng, passing each in turn to the * block. You can only iterate if the start object of the range * supports the +succ+ method (which means that you can't iterate over * ranges of +Float+ objects). - * + * * (10..15).each do |n| * print n, ' ' * end - * + * * produces: - * + * * 10 11 12 13 14 15 */ @@ -447,7 +447,7 @@ range_each(VALUE range) /* * call-seq: * rng.begin => obj - * + * * Returns the first object in rng. */ @@ -461,9 +461,9 @@ range_begin(VALUE range) /* * call-seq: * rng.end => obj - * + * * Returns the object that defines the end of rng. - * + * * (1..10).end #=> 10 * (1...10).end #=> 10 */ @@ -494,7 +494,7 @@ first_i(VALUE i, VALUE *ary) * call-seq: * rng.first => obj * rng.first(n) => an_array - * + * * Returns the first object in rng, or the first +n+ elements. */ @@ -518,7 +518,7 @@ range_first(int argc, VALUE *argv, VALUE range) * call-seq: * rng.last => obj * rng.last(n) => an_array - * + * * Returns the last object in rng, or the last +n+ elements. */ @@ -528,7 +528,7 @@ range_last(int argc, VALUE *argv, VALUE range) VALUE rb_ary_last(int, VALUE *, VALUE); if (argc == 0) return RANGE_END(range); - return rb_ary_last(argc, argv, rb_Array(range)); + return rb_ary_last(argc, argv, rb_Array(range)); } @@ -536,11 +536,11 @@ range_last(int argc, VALUE *argv, VALUE range) * call-seq: * rng.min => obj * rng.min {| a,b | block } => obj - * + * * Returns the minimum value in rng. The second uses * the block to compare values. Returns nil if the first * value in range is larger than the last value. - * + * */ @@ -565,11 +565,11 @@ range_min(VALUE range) * call-seq: * rng.max => obj * rng.max {| a,b | block } => obj - * + * * Returns the maximum value in rng. The second uses * the block to compare values. Returns nil if the first * value in range is larger than the last value. - * + * */ static VALUE @@ -698,7 +698,7 @@ inspect_range(VALUE range, VALUE dummy, int recur) * call-seq: * rng.inspect => string * - * Convert this range object to a printable form (using + * Convert this range object to a printable form (using * inspect to convert the start and end * objects). */ @@ -713,20 +713,20 @@ range_inspect(VALUE range) /* * call-seq: * rng === obj => true or false - * + * * Returns true if obj is an element of * rng, false otherwise. Conveniently, * === is the comparison operator used by * case statements. - * + * * case 79 * when 1..50 then print "low\n" * when 51..75 then print "medium\n" * when 76..100 then print "high\n" * end - * + * * produces: - * + * * high */ @@ -741,11 +741,11 @@ range_eqq(VALUE range, VALUE val) * call-seq: * rng.member?(val) => true or false * rng.include?(val) => true or false - * + * * Returns true if obj is an element of * rng, false otherwise. If beg and end are * numeric, comparison is done according magnitude of values. - * + * * ("a".."z").include?("g") # => true * ("a".."z").include?("A") # => false */ @@ -801,11 +801,11 @@ range_include(VALUE range, VALUE val) /* * call-seq: * rng.cover?(val) => true or false - * + * * Returns true if obj is between beg and end, * i.e beg <= obj <= end (or end exclusive when * exclude_end? is true). - * + * * ("a".."z").cover?("c") #=> true * ("a".."z").cover?("5") #=> false */ @@ -874,17 +874,17 @@ range_alloc(VALUE klass) * run from the start to the end inclusively. Those created using * ... exclude the end value. When used as an iterator, * ranges return each value in the sequence. - * + * * (-1..-5).to_a #=> [] * (-5..-1).to_a #=> [-5, -4, -3, -2, -1] * ('a'..'e').to_a #=> ["a", "b", "c", "d", "e"] * ('a'...'e').to_a #=> ["a", "b", "c", "d"] - * + * * Ranges can be constructed using objects of any type, as long as the * objects can be compared using their <=> operator and * they support the succ method to return the next object * in sequence. - * + * * class Xs # represent a string of 'x's * include Comparable * attr :length @@ -904,18 +904,18 @@ range_alloc(VALUE klass) * 'x' * @length * end * end - * + * * r = Xs.new(3)..Xs.new(6) #=> xxx..xxxxxx * r.to_a #=> [xxx, xxxx, xxxxx, xxxxxx] * r.member?(Xs.new(5)) #=> true - * + * * In the previous code example, class Xs includes the * Comparable module. This is because * Enumerable#member? checks for equality using * ==. Including Comparable ensures that the * == method is defined in terms of the <=> * method implemented in Xs. - * + * */ void diff --git a/re.c b/re.c index 8aa2ec0dc2..8cbcd262f9 100644 --- a/re.c +++ b/re.c @@ -708,7 +708,7 @@ reg_named_captures_iter(const OnigUChar *name, const OnigUChar *name_end, * A key of the hash is a name of the named captures. * A value of the hash is an array which is list of indexes of corresponding * named captures. - * + * * /(?.)(?.)/.named_captures * #=> {"foo"=>[1], "bar"=>[2]} * @@ -2139,7 +2139,7 @@ unescape_nonascii(const char *p, const char *end, rb_encoding *enc, goto escape_asis; } } - /* xxx: How about more than 199 subexpressions? */ + /* xxx: How about more than 199 subexpressions? */ case '0': /* \0, \0O, \0OO */ @@ -2350,7 +2350,7 @@ rb_reg_initialize(VALUE obj, const char *s, int len, rb_encoding *enc, if (options & ARG_ENCODING_NONE) { re->basic.flags |= REG_ENCODING_NONE; } - + re->ptr = make_regexp(RSTRING_PTR(unescaped), RSTRING_LEN(unescaped), enc, options & ARG_REG_OPTION_MASK, err); if (!re->ptr) return -1; @@ -2576,7 +2576,7 @@ reg_match_pos(VALUE re, VALUE *strp, long pos) * * If it is not matched, nil is assigned for the variables. * - * /(?\w+)\s*=\s*(?\w+)/ =~ " x = " + * /(?\w+)\s*=\s*(?\w+)/ =~ " x = " * p lhs #=> nil * p rhs #=> nil * @@ -2694,18 +2694,18 @@ rb_reg_match2(VALUE re) * * /(.)(.)(.)/.match("abc")[2] #=> "b" * /(.)(.)/.match("abc", 1)[2] #=> "c" - * + * * If a block is given, invoke the block with MatchData if match succeed, so * that you can write - * + * * pat.match(str) {|m| ...} - * + * * instead of - * + * * if m = pat.match(str) * ... * end - * + * * The return value is a value from block execution in this case. */ @@ -3200,7 +3200,7 @@ rb_reg_regsub(VALUE str, VALUE src, struct re_registers *regs, VALUE regexp) case 'k': if (s < e && ASCGET(s, e, &clen) == '<') { char *name, *name_end; - + name_end = name = s + clen; while (name_end < e) { c = ASCGET(name_end, e, &clen); diff --git a/regcomp.c b/regcomp.c index cb54c44145..f24c0c46e3 100644 --- a/regcomp.c +++ b/regcomp.c @@ -2555,7 +2555,7 @@ is_not_included(Node* x, Node* y, regex_t* reg) } } break; - + default: break; } @@ -3294,7 +3294,7 @@ expand_case_fold_string_alt(int item_num, OnigCaseFoldCodeItem items[], for (i = 0; i < item_num; i++) { snode = onig_node_new_str(NULL, NULL); if (IS_NULL(snode)) goto mem_err; - + for (j = 0; j < items[i].code_len; j++) { len = ONIGENC_CODE_TO_MBC(reg->enc, items[i].code[j], buf); if (len < 0) { @@ -4004,15 +4004,15 @@ distance_value(MinMaxLen* mm) { /* 1000 / (min-max-dist + 1) */ static const short int dist_vals[] = { - 1000, 500, 333, 250, 200, 167, 143, 125, 111, 100, - 91, 83, 77, 71, 67, 63, 59, 56, 53, 50, - 48, 45, 43, 42, 40, 38, 37, 36, 34, 33, - 32, 31, 30, 29, 29, 28, 27, 26, 26, 25, - 24, 24, 23, 23, 22, 22, 21, 21, 20, 20, - 20, 19, 19, 19, 18, 18, 18, 17, 17, 17, - 16, 16, 16, 16, 15, 15, 15, 15, 14, 14, - 14, 14, 14, 14, 13, 13, 13, 13, 13, 13, - 12, 12, 12, 12, 12, 12, 11, 11, 11, 11, + 1000, 500, 333, 250, 200, 167, 143, 125, 111, 100, + 91, 83, 77, 71, 67, 63, 59, 56, 53, 50, + 48, 45, 43, 42, 40, 38, 37, 36, 34, 33, + 32, 31, 30, 29, 29, 28, 27, 26, 26, 25, + 24, 24, 23, 23, 22, 22, 21, 21, 20, 20, + 20, 19, 19, 19, 18, 18, 18, 17, 17, 17, + 16, 16, 16, 16, 15, 15, 15, 15, 14, 14, + 14, 14, 14, 14, 13, 13, 13, 13, 13, 13, + 12, 12, 12, 12, 12, 12, 11, 11, 11, 11, 11, 11, 11, 11, 11, 10, 10, 10, 10, 10 }; @@ -4899,7 +4899,7 @@ set_optimize_exact_info(regex_t* reg, OptExactInfo* e) reg->exact = str_dup(e->s, e->s + e->len); CHECK_NULL_RETURN_MEMERR(reg->exact); reg->exact_end = reg->exact + e->len; - + allow_reverse = ONIGENC_IS_ALLOWED_REVERSE_MATCH(reg->enc, reg->exact, reg->exact_end); @@ -5938,7 +5938,7 @@ onig_print_compiled_byte_code(FILE* f, UChar* bp, UChar** nextp, p_len_string(f, len, 1, bp); bp += len; break; - + case OP_EXACTMB2N1: p_string(f, 2, bp); bp += 2; break; case OP_EXACTMB2N2: @@ -5958,7 +5958,7 @@ onig_print_compiled_byte_code(FILE* f, UChar* bp, UChar** nextp, case OP_EXACTMBN: { int mb_len; - + GET_LENGTH_INC(mb_len, bp); GET_LENGTH_INC(len, bp); fprintf(f, ":%d:%d:", mb_len, len); diff --git a/regenc.c b/regenc.c index 634afd8883..b625e63048 100644 --- a/regenc.c +++ b/regenc.c @@ -123,7 +123,7 @@ onigenc_strlen(OnigEncoding enc, const UChar* p, const UChar* end) { int n = 0; UChar* q = (UChar* )p; - + while (q < end) { q += ONIGENC_MBC_ENC_LEN(enc, q, end); n++; @@ -137,7 +137,7 @@ onigenc_strlen_null(OnigEncoding enc, const UChar* s) int n = 0; UChar* p = (UChar* )s; UChar* e = p + strlen((const char *)s); - + while (1) { if (*p == '\0') { UChar* q; diff --git a/regerror.c b/regerror.c index 780ba94a0e..0a92c67b5d 100644 --- a/regerror.c +++ b/regerror.c @@ -251,7 +251,7 @@ onig_error_code_to_str(UChar* s, int code, ...) onig_error_code_to_str(s, code, va_alist) UChar* s; int code; - va_dcl + va_dcl #endif { UChar *p, *q; diff --git a/regexec.c b/regexec.c index 260505901d..946e47be60 100644 --- a/regexec.c +++ b/regexec.c @@ -220,13 +220,13 @@ static int onig_region_resize_clear(OnigRegion* region, int n) { int r; - + r = onig_region_resize(region, n); if (r != 0) return r; onig_region_clear(region); return 0; } - + extern int onig_region_set(OnigRegion* region, int at, int beg, int end) { @@ -236,7 +236,7 @@ onig_region_set(OnigRegion* region, int at, int beg, int end) int r = onig_region_resize(region, at + 1); if (r < 0) return r; } - + region->beg[at] = beg; region->end[at] = end; return 0; @@ -2149,7 +2149,7 @@ match_at(regex_t* reg, const UChar* str, const UChar* end, int len; UChar *pstart, *pend; - /* if you want to remove following line, + /* if you want to remove following line, you should check in parse and compile time. */ if (mem > num_mem) goto fail; if (mem_end_stk[mem] == INVALID_STACK_INDEX) goto fail; @@ -2181,7 +2181,7 @@ match_at(regex_t* reg, const UChar* str, const UChar* end, int len; UChar *pstart, *pend; - /* if you want to remove following line, + /* if you want to remove following line, you should check in parse and compile time. */ if (mem > num_mem) goto fail; if (mem_end_stk[mem] == INVALID_STACK_INDEX) goto fail; @@ -2310,7 +2310,7 @@ match_at(regex_t* reg, const UChar* str, const UChar* end, MOP_OUT; continue; } - + break; #endif @@ -2987,7 +2987,7 @@ bm_search(regex_t* reg, const UChar* target, const UChar* target_end, static int set_bm_backward_skip(UChar* s, UChar* end, OnigEncoding enc ARG_UNUSED, int** skip) - + { int i, len; diff --git a/regparse.c b/regparse.c index 8a02966def..039e2d4f9d 100644 --- a/regparse.c +++ b/regparse.c @@ -50,7 +50,7 @@ const OnigSyntaxType OnigSyntaxRuby = { ONIG_SYN_OP2_CCLASS_SET_OP | ONIG_SYN_OP2_ESC_CAPITAL_C_BAR_CONTROL | ONIG_SYN_OP2_ESC_CAPITAL_M_BAR_META | ONIG_SYN_OP2_ESC_V_VTAB | ONIG_SYN_OP2_ESC_H_XDIGIT ) - , ( SYN_GNU_REGEX_BV | + , ( SYN_GNU_REGEX_BV | ONIG_SYN_ALLOW_INTERVAL_LOW_ABBREV | ONIG_SYN_DIFFERENT_LEN_ALT_LOOK_BEHIND | ONIG_SYN_CAPTURE_ONLY_NAMED_GROUP | @@ -2658,7 +2658,7 @@ fetch_name(OnigCodePoint start_code, UChar** src, UChar* end, } else { r = ONIGERR_INVALID_GROUP_NAME; - is_num = 0; + is_num = 0; } } else if (!ONIGENC_IS_CODE_WORD(enc, c)) { @@ -2846,7 +2846,7 @@ find_str_position(OnigCodePoint s[], int n, UChar* from, UChar* to, OnigCodePoint x; UChar *q; UChar *p = from; - + while (p < to) { x = ONIGENC_MBC_TO_CODE(enc, p, to); q = p + enclen(enc, p, to); @@ -3407,7 +3407,7 @@ fetch_token(OnigToken* tok, UChar** src, UChar* end, ScanEnv* env) goto skip_backref; } - if (IS_SYNTAX_OP(syn, ONIG_SYN_OP_DECIMAL_BACKREF) && + if (IS_SYNTAX_OP(syn, ONIG_SYN_OP_DECIMAL_BACKREF) && (num <= env->num_mem || num <= 9)) { /* This spec. from GNU regex */ if (IS_SYNTAX_BV(syn, ONIG_SYN_STRICT_CHECK_BACKREF)) { if (num > env->num_mem || IS_NULL(SCANENV_MEM_NODES(env)[num])) @@ -4388,7 +4388,7 @@ parse_char_class(Node** np, OnigToken* tok, UChar** src, UChar* end, CC_ESC_WARN(env, (UChar* )"-"); goto range_end_val; } - + if (IS_SYNTAX_BV(env->syntax, ONIG_SYN_ALLOW_DOUBLE_RANGE_OP_IN_CC)) { CC_ESC_WARN(env, (UChar* )"-"); goto sb_char; /* [0-9-a] is allowed as [0-9\-a] */ @@ -5073,7 +5073,7 @@ parse_exp(Node** np, OnigToken* tok, int term, r = parse_subexp(&target, tok, term, src, end, env); env->option = prev; if (r < 0) return r; - NENCLOSE(*np)->target = target; + NENCLOSE(*np)->target = target; return tok->type; } break; @@ -5241,7 +5241,7 @@ parse_exp(Node** np, OnigToken* tok, int term, xmemcpy(new_key, &key, sizeof(type_cclass_key)); onig_st_add_direct(OnigTypeCClassTable, (st_data_t )new_key, (st_data_t )*np); - + THREAD_ATOMIC_END; } else { @@ -5387,7 +5387,7 @@ parse_exp(Node** np, OnigToken* tok, int term, NQTFR(qn)->greedy = tok->u.repeat.greedy; r = set_quantifier(qn, *targetp, group, env); if (r < 0) return r; - + if (tok->u.repeat.possessive != 0) { Node* en; en = node_new_enclose(ENCLOSE_STOP_BACKTRACK); diff --git a/regsyntax.c b/regsyntax.c index 96348b0bd7..fc639dfcdf 100644 --- a/regsyntax.c +++ b/regsyntax.c @@ -67,8 +67,8 @@ const OnigSyntaxType OnigSyntaxPosixExtended = { ONIG_SYN_OP_BRACE_INTERVAL | ONIG_SYN_OP_PLUS_ONE_INF | ONIG_SYN_OP_QMARK_ZERO_ONE | ONIG_SYN_OP_VBAR_ALT ) , 0 - , ( ONIG_SYN_CONTEXT_INDEP_ANCHORS | - ONIG_SYN_CONTEXT_INDEP_REPEAT_OPS | ONIG_SYN_CONTEXT_INVALID_REPEAT_OPS | + , ( ONIG_SYN_CONTEXT_INDEP_ANCHORS | + ONIG_SYN_CONTEXT_INDEP_REPEAT_OPS | ONIG_SYN_CONTEXT_INVALID_REPEAT_OPS | ONIG_SYN_ALLOW_UNMATCHED_CLOSE_SUBEXP | ONIG_SYN_ALLOW_DOUBLE_RANGE_OP_IN_CC ) , ( ONIG_OPTION_SINGLELINE | ONIG_OPTION_MULTILINE ) diff --git a/signal.c b/signal.c index b952b4e9bb..ab47ccbf7f 100644 --- a/signal.c +++ b/signal.c @@ -306,14 +306,14 @@ ruby_default_signal(int sig) /* * call-seq: * Process.kill(signal, pid, ...) => fixnum - * + * * Sends the given signal to the specified process id(s), or to the * current process if _pid_ is zero. _signal_ may be an * integer signal number or a POSIX signal name (either with or without * a +SIG+ prefix). If _signal_ is negative (or starts * with a minus sign), kills process groups instead of * processes. Not all signals are available on all platforms. - * + * * pid = fork do * Signal.trap("HUP") { puts "Ouch!"; exit } * # ... do some work ... @@ -321,9 +321,9 @@ ruby_default_signal(int sig) * # ... * Process.kill("HUP", pid) * Process.wait - * + * * produces: - * + * * Ouch! */ diff --git a/sprintf.c b/sprintf.c index aebb9d5e66..772f232062 100644 --- a/sprintf.c +++ b/sprintf.c @@ -31,7 +31,7 @@ static char* remove_sign_bits(char *str, int base) { char *s, *t; - + s = t = str; if (base == 16) { @@ -171,10 +171,10 @@ get_hash(volatile VALUE *hash, int argc, const VALUE *argv) * call-seq: * format(format_string [, arguments...] ) => string * sprintf(format_string [, arguments...] ) => string - * + * * Returns the string resulting from applying format_string to * any additional arguments. Within the format string, any characters - * other than format sequences are copied to the result. + * other than format sequences are copied to the result. * * The syntax of a format sequence is follows. * @@ -210,13 +210,13 @@ get_hash(volatile VALUE *hash, int argc, const VALUE *argv) * * Field | Float Format * ------+-------------------------------------------------------------- - * e | Convert floating point argument into exponential notation + * e | Convert floating point argument into exponential notation * | with one digit before the decimal point as [-]d.dddddde[+-]dd. * | The precision specifies the number of digits after the decimal * | point (defaulting to six). * E | Equivalent to `e', but uses an uppercase E to indicate * | the exponent. - * f | Convert floating point argument as [-]ddd.dddddd, + * f | Convert floating point argument as [-]ddd.dddddd, * | where the precision specifies the number of digits after * | the decimal point. * g | Convert a floating point number using exponential form @@ -234,13 +234,13 @@ get_hash(volatile VALUE *hash, int argc, const VALUE *argv) * | sequence contains a precision, at most that many characters * | will be copied. * % | A percent sign itself will be displayed. No argument taken. - * + * * The flags modifies the behavior of the formats. * The flag characters are: * * Flag | Applies to | Meaning * ---------+---------------+----------------------------------------- - * space | bBdiouxX | Leave a space at the start of + * space | bBdiouxX | Leave a space at the start of * | eEfgG | non-negative numbers. * | (numeric fmt) | For `o', `x', `X', `b' and `B', use * | | a minus sign with absolute value for @@ -276,9 +276,9 @@ get_hash(volatile VALUE *hash, int argc, const VALUE *argv) * | (numeric fmt) | is used for negative numbers formatted as * | | complements. * ---------+---------------+----------------------------------------- - * * | all | Use the next argument as the field width. + * * | all | Use the next argument as the field width. * | | If negative, left-justify the result. If the - * | | asterisk is followed by a number and a dollar + * | | asterisk is followed by a number and a dollar * | | sign, use the indicated argument as the width. * * Examples of flags: @@ -336,7 +336,7 @@ get_hash(volatile VALUE *hash, int argc, const VALUE *argv) * sprintf("%#g", 123.4) #=> "123.400" * sprintf("%g", 123456) #=> "123456" * sprintf("%#g", 123456) #=> "123456." - * + * * The field width is an optional integer, followed optionally by a * period and a precision. The width specifies the minimum number of * characters that will be written to the result for this field. @@ -389,7 +389,7 @@ get_hash(volatile VALUE *hash, int argc, const VALUE *argv) * # precision for `e' is number of * # digits after the decimal point <------> * sprintf("%20.8e", 1234.56789) #=> " 1.23456789e+03" - * + * * # precision for `f' is number of * # digits after the decimal point <------> * sprintf("%20.8f", 1234.56789) #=> " 1234.56789000" diff --git a/strftime.c b/strftime.c index 38167fd384..b602173ea2 100644 --- a/strftime.c +++ b/strftime.c @@ -465,7 +465,7 @@ rb_strftime(char *s, size_t maxsize, const char *format, const struct tm *timept /* * From: Chip Rosenthal * Date: Sun, 19 Mar 1995 00:33:29 -0600 (CST) - * + * * Warning: the %z [code] is implemented by inspecting the * timezone name conditional compile settings, and * inferring a method to get timezone offsets. I've tried diff --git a/struct.c b/struct.c index 838830aa69..87de0ac771 100644 --- a/struct.c +++ b/struct.c @@ -76,10 +76,10 @@ rb_struct_s_members_m(VALUE klass) /* * call-seq: * struct.members => array - * + * * Returns an array of strings representing the names of the instance * variables. - * + * * Customer = Struct.new(:name, :address, :zip) * joe = Customer.new("Joe Smith", "123 Maple, Anytown NC", 12345) * joe.members #=> [:name, :address, :zip] @@ -293,7 +293,7 @@ rb_struct_define(const char *name, ...) * Structs in the system and should start with a capital * letter. Assigning a structure class to a constant effectively gives * the class the name of the constant. - * + * * Struct::new returns a new Class object, * which can then be used to create specific instances of the new * structure. The number of actual parameters must be @@ -302,12 +302,12 @@ rb_struct_define(const char *name, ...) * parameters will raise an \E{ArgumentError}. * * The remaining methods listed in this section (class and instance) - * are defined for this generated class. - * + * are defined for this generated class. + * * # Create a structure with a name in Struct * Struct.new("Customer", :name, :address) #=> Struct::Customer * Struct::Customer.new("Dave", "123 Main") #=> # - * + * * # Create a structure named by its constant * Customer = Struct.new(:name, :address) #=> Customer * Customer.new("Dave", "123 Main") #=> # @@ -426,16 +426,16 @@ rb_struct_new(VALUE klass, ...) /* * call-seq: * struct.each {|obj| block } => struct - * + * * Calls block once for each instance variable, passing the * value as a parameter. - * + * * Customer = Struct.new(:name, :address, :zip) * joe = Customer.new("Joe Smith", "123 Maple, Anytown NC", 12345) * joe.each {|x| puts(x) } - * + * * produces: - * + * * Joe Smith * 123 Maple, Anytown NC * 12345 @@ -456,16 +456,16 @@ rb_struct_each(VALUE s) /* * call-seq: * struct.each_pair {|sym, obj| block } => struct - * + * * Calls block once for each instance variable, passing the name * (as a symbol) and the value as parameters. - * + * * Customer = Struct.new(:name, :address, :zip) * joe = Customer.new("Joe Smith", "123 Maple, Anytown NC", 12345) * joe.each_pair {|name, value| puts("#{name} => #{value}") } - * + * * produces: - * + * * name => Joe Smith * address => 123 Maple, Anytown NC * zip => 12345 @@ -545,9 +545,9 @@ rb_struct_inspect(VALUE s) * call-seq: * struct.to_a => array * struct.values => array - * + * * Returns the values for this instance as an array. - * + * * Customer = Struct.new(:name, :address, :zip) * joe = Customer.new("Joe Smith", "123 Maple, Anytown NC", 12345) * joe.to_a[1] #=> "123 Maple, Anytown NC" @@ -596,17 +596,17 @@ rb_struct_aref_id(VALUE s, ID id) /* * call-seq: * struct[symbol] => anObject - * struct[fixnum] => anObject - * + * struct[fixnum] => anObject + * * Attribute Reference---Returns the value of the instance variable * named by symbol, or indexed (0..length-1) by * fixnum. Will raise NameError if the named * variable does not exist, or IndexError if the index is * out of range. - * + * * Customer = Struct.new(:name, :address, :zip) * joe = Customer.new("Joe Smith", "123 Maple, Anytown NC", 12345) - * + * * joe["name"] #=> "Joe Smith" * joe[:name] #=> "Joe Smith" * joe[0] #=> "Joe Smith" @@ -658,19 +658,19 @@ rb_struct_aset_id(VALUE s, ID id, VALUE val) * call-seq: * struct[symbol] = obj => obj * struct[fixnum] = obj => obj - * + * * Attribute Assignment---Assigns to the instance variable named by * symbol or fixnum the value obj and * returns it. Will raise a NameError if the named * variable does not exist, or an IndexError if the index * is out of range. - * + * * Customer = Struct.new(:name, :address, :zip) * joe = Customer.new("Joe Smith", "123 Maple, Anytown NC", 12345) - * + * * joe["name"] = "Luke" * joe[:zip] = "90210" - * + * * joe.name #=> "Luke" * joe.zip #=> "90210" */ @@ -704,15 +704,15 @@ struct_entry(VALUE s, long n) return rb_struct_aref(s, LONG2NUM(n)); } -/* +/* * call-seq: * struct.values_at(selector,... ) => an_array * * Returns an array containing the elements in * _self_ corresponding to the given selector(s). The selectors - * may be either integer indices or ranges. + * may be either integer indices or ranges. * See also .select. - * + * * a = %w{ a b c d e f } * a.values_at(1, 3, 5) * a.values_at(1, 3, 5, 7) @@ -729,12 +729,12 @@ rb_struct_values_at(int argc, VALUE *argv, VALUE s) /* * call-seq: * struct.select {|i| block } => array - * + * * Invokes the block passing in successive elements from * struct, returning an array containing those elements * for which the block returns a true value (equivalent to * Enumerable#select). - * + * * Lots = Struct.new(:a, :b, :c, :d, :e, :f) * l = Lots.new(11, 22, 33, 44, 55, 66) * l.select {|v| (v % 2).zero? } #=> [22, 44, 66] @@ -762,12 +762,12 @@ rb_struct_select(int argc, VALUE *argv, VALUE s) /* * call-seq: * struct == other_struct => true or false - * + * * Equality---Returns true if other_struct is * equal to this one: they must be of the same class as generated by * Struct::new, and the values of all instance variables * must be equal (according to Object#==). - * + * * Customer = Struct.new(:name, :address, :zip) * joe = Customer.new("Joe Smith", "123 Maple, Anytown NC", 12345) * joejr = Customer.new("Joe Smith", "123 Maple, Anytown NC", 12345) @@ -847,9 +847,9 @@ rb_struct_eql(VALUE s, VALUE s2) * call-seq: * struct.length => fixnum * struct.size => fixnum - * + * * Returns the number of instance variables. - * + * * Customer = Struct.new(:name, :address, :zip) * joe = Customer.new("Joe Smith", "123 Maple, Anytown NC", 12345) * joe.length #=> 3 @@ -865,13 +865,13 @@ rb_struct_size(VALUE s) * A Struct is a convenient way to bundle a number of * attributes together, using accessor methods, without having to write * an explicit class. - * + * * The Struct class is a generator of specific classes, * each one of which is defined to hold a set of variables and their * accessors. In these examples, we'll call the generated class * ``CustomerClass,'' and we'll show an example instance of that * class as ``CustomerInst.'' - * + * * In the descriptions that follow, the parameter symbol refers * to a symbol, which is either a quoted string or a * Symbol (such as :name). diff --git a/time.c b/time.c index f6a754a332..5542c79c9b 100644 --- a/time.c +++ b/time.c @@ -74,18 +74,18 @@ time_modify(VALUE time) /* * call-seq: * Time.new -> time - * + * * Returns a Time object initialized to the current system * time. Note: The object created will be created using the * resolution available on your system clock, and so may include * fractional seconds. - * + * * a = Time.new #=> 2007-11-19 07:50:02 -0600 * b = Time.new #=> 2007-11-19 07:50:02 -0600 * a == b #=> false * "%.6f" % a.to_f #=> "1195480202.282373" * "%.6f" % b.to_f #=> "1195480202.283415" - * + * */ static VALUE @@ -104,7 +104,7 @@ time_init(VALUE time) } #else { - struct timeval tv; + struct timeval tv; if (gettimeofday(&tv, 0) < 0) { rb_sys_fail("gettimeofday"); } @@ -297,14 +297,14 @@ rb_time_timespec(VALUE time) * Time.at(time) => time * Time.at(seconds_with_frac) => time * Time.at(seconds, microseconds_with_frac) => time - * + * * Creates a new time object with the value given by time, * the given number of seconds_with_frac, or * seconds and microseconds_with_frac from the Epoch. * seconds_with_frac and microseconds_with_frac * can be Integer, Float, Rational, or other Numeric. * non-portable feature allows the offset to be negative on some systems. - * + * * Time.at(0) #=> 1969-12-31 18:00:00 -0600 * Time.at(Time.at(0)) #=> 1969-12-31 18:00:00 -0600 * Time.at(946702800) #=> 1999-12-31 23:00:00 -0600 @@ -667,7 +667,7 @@ search_time_t(struct tm *tptr, int utc_p) To avoid overflow in this assignment, `d' is restricted to less than sqrt(2**31). By this restriction and other reasons, the guess is - not accurate and some error is expected. `range' approximates + not accurate and some error is expected. `range' approximates the maximum error. When these parameters are not suitable, i.e. guess is not within @@ -726,7 +726,7 @@ search_time_t(struct tm *tptr, int utc_p) } if (guess <= guess_lo || guess_hi <= guess) { - /* Precious guess is invalid. try binary search. */ + /* Precious guess is invalid. try binary search. */ guess = guess_lo / 2 + guess_hi / 2; if (guess <= guess_lo) guess = guess_lo + 1; @@ -738,7 +738,7 @@ search_time_t(struct tm *tptr, int utc_p) tm = GUESS(&guess); if (!tm) goto error; have_guess = 0; - + d = tmcmp(tptr, tm); if (d < 0) { guess_hi = guess; @@ -922,7 +922,7 @@ time_utc_or_local(int argc, VALUE *argv, int utc_p, VALUE klass) * Time.gm(year, month, day, hour, min, sec_with_frac) => time * Time.gm(year, month, day, hour, min, sec, usec_with_frac) => time * Time.gm(sec, min, hour, day, month, year, wday, yday, isdst, tz) => time - * + * * Creates a time based on given values, interpreted as UTC (GMT). The * year must be specified. Other values default to the minimum value * for that field (and may be nil or omitted). Months may @@ -960,10 +960,10 @@ time_s_mkutc(int argc, VALUE *argv, VALUE klass) * Time.mktime(year, month, day, hour, min, sec_with_frac) => time * Time.mktime(year, month, day, hour, min, sec, usec_with_frac) => time * Time.mktime(sec, min, hour, day, month, year, wday, yday, isdst, tz) => time - * + * * Same as Time::gm, but interprets the values in the * local time zone. - * + * * Time.local(2000,"jan",1,20,15,1) #=> 2000-01-01 20:15:01 -0600 */ @@ -977,10 +977,10 @@ time_s_mktime(int argc, VALUE *argv, VALUE klass) * call-seq: * time.to_i => int * time.tv_sec => int - * + * * Returns the value of time as an integer number of seconds * since the Epoch. - * + * * t = Time.now * "%10.5f" % t.to_f #=> "1049896564.17839" * t.to_i #=> 1049896564 @@ -998,10 +998,10 @@ time_to_i(VALUE time) /* * call-seq: * time.to_f => float - * + * * Returns the value of time as a floating point number of * seconds since the Epoch. - * + * * t = Time.now * "%10.5f" % t.to_f #=> "1049896564.13654" * t.to_i #=> 1049896564 @@ -1023,9 +1023,9 @@ time_to_f(VALUE time) * call-seq: * time.usec => int * time.tv_usec => int - * + * * Returns just the number of microseconds for time. - * + * * t = Time.now #=> 2007-11-19 08:03:26 -0600 * "%10.6f" % t.to_f #=> "1195481006.775195" * t.usec #=> 775195 @@ -1044,9 +1044,9 @@ time_usec(VALUE time) * call-seq: * time.nsec => int * time.tv_nsec => int - * + * * Returns just the number of nanoseconds for time. - * + * * t = Time.now #=> 2007-11-17 15:18:03 +0900 * "%10.9f" % t.to_f #=> "1195280283.536151409" * t.nsec #=> 536151406 @@ -1068,15 +1068,15 @@ time_nsec(VALUE time) /* * call-seq: - * time <=> other_time => -1, 0, +1 - * + * time <=> other_time => -1, 0, +1 + * * Comparison---Compares time with other_time. - * + * * t = Time.now #=> 2007-11-19 08:12:12 -0600 * t2 = t + 2592000 #=> 2007-12-19 08:12:12 -0600 * t <=> t2 #=> -1 * t2 <=> t #=> 1 - * + * * t = Time.now #=> 2007-11-19 08:13:38 -0600 * t2 = t + 0.1 #=> 2007-11-19 08:13:38 -0600 * t.nsec #=> 98222999 @@ -1144,10 +1144,10 @@ time_eql(VALUE time1, VALUE time2) * call-seq: * time.utc? => true or false * time.gmt? => true or false - * + * * Returns true if time represents a time in UTC * (GMT). - * + * * t = Time.now #=> 2007-11-19 08:15:23 -0600 * t.utc? #=> false * t = Time.gm(2000,"jan",1,20,15,1) #=> 2000-01-01 20:15:01 UTC @@ -1216,10 +1216,10 @@ time_dup(VALUE time) /* * call-seq: * time.localtime => time - * + * * Converts time to local time (using the local time zone in * effect for this process) modifying the receiver. - * + * * t = Time.gm(2000, "jan", 1, 20, 15, 1) #=> 2000-01-01 20:15:01 UTC * t.gmt? #=> true * t.localtime #=> 2000-01-01 14:15:01 -0600 @@ -1256,9 +1256,9 @@ time_localtime(VALUE time) * call-seq: * time.gmtime => time * time.utc => time - * + * * Converts time to UTC (GMT), modifying the receiver. - * + * * t = Time.now #=> 2007-11-19 08:18:31 -0600 * t.gmt? #=> false * t.gmtime #=> 2007-11-19 14:18:31 UTC @@ -1299,10 +1299,10 @@ time_gmtime(VALUE time) /* * call-seq: * time.getlocal => new_time - * + * * Returns a new new_time object representing time in * local time (using the local time zone in effect for this process). - * + * * t = Time.gm(2000,1,1,20,15,1) #=> 2000-01-01 20:15:01 UTC * t.gmt? #=> true * l = t.getlocal #=> 2000-01-01 14:15:01 -0600 @@ -1320,10 +1320,10 @@ time_getlocaltime(VALUE time) * call-seq: * time.getgm => new_time * time.getutc => new_time - * + * * Returns a new new_time object representing time in * UTC. - * + * * t = Time.local(2000,1,1,20,15,1) #=> 2000-01-01 20:15:01 -0600 * t.gmt? #=> false * y = t.getgm #=> 2000-01-02 02:15:01 UTC @@ -1348,9 +1348,9 @@ time_get_tm(VALUE time, int gmt) * call-seq: * time.asctime => string * time.ctime => string - * + * * Returns a canonical string representation of time. - * + * * Time.now.asctime #=> "Wed Apr 9 08:56:03 2003" */ @@ -1383,14 +1383,14 @@ rb_strftime(char *s, size_t maxsize, const char *format, * call-seq: * time.inspect => string * time.to_s => string - * + * * Returns a string representing time. Equivalent to calling * Time#strftime with a format string of * ``%Y-%m-%d %H:%M:%S %z'' * for a local time and * ``%Y-%m-%d %H:%M:%S UTC'' * for a UTC time. - * + * * Time.now.to_s #=> "2007-10-05 16:09:51 +0900" * Time.now.utc.to_s #=> "2007-10-05 07:09:51 UTC" */ @@ -1461,10 +1461,10 @@ time_add(struct time_object *tobj, VALUE offset, int sign) /* * call-seq: * time + numeric => time - * + * * Addition---Adds some number of seconds (possibly fractional) to * time and returns that value as a new time. - * + * * t = Time.now #=> 2007-11-19 08:22:21 -0600 * t + (60 * 60 * 24) #=> 2007-11-20 08:22:21 -0600 */ @@ -1485,11 +1485,11 @@ time_plus(VALUE time1, VALUE time2) * call-seq: * time - other_time => float * time - numeric => time - * + * * Difference---Returns a new time that represents the difference * between two times, or subtracts the given number of seconds in * numeric from time. - * + * * t = Time.now #=> 2007-11-19 08:23:10 -0600 * t2 = t + 2592000 #=> 2007-12-19 08:23:10 -0600 * t2 - t #=> 2592000.0 @@ -1551,12 +1551,12 @@ rb_time_succ(VALUE time) /* * call-seq: * time.sec => fixnum - * + * * Returns the second of the minute (0..60)[Yes, seconds really can * range from zero to 60. This allows the system to inject leap seconds * every now and then to correct for the fact that years are not really * a convenient number of hours long.] for time. - * + * * t = Time.now #=> 2007-11-19 08:25:02 -0600 * t.sec #=> 2 */ @@ -1576,9 +1576,9 @@ time_sec(VALUE time) /* * call-seq: * time.min => fixnum - * + * * Returns the minute of the hour (0..59) for time. - * + * * t = Time.now #=> 2007-11-19 08:25:51 -0600 * t.min #=> 25 */ @@ -1598,9 +1598,9 @@ time_min(VALUE time) /* * call-seq: * time.hour => fixnum - * + * * Returns the hour of the day (0..23) for time. - * + * * t = Time.now #=> 2007-11-19 08:26:20 -0600 * t.hour #=> 8 */ @@ -1621,9 +1621,9 @@ time_hour(VALUE time) * call-seq: * time.day => fixnum * time.mday => fixnum - * + * * Returns the day of the month (1..n) for time. - * + * * t = Time.now #=> 2007-11-19 08:27:03 -0600 * t.day #=> 19 * t.mday #=> 19 @@ -1645,9 +1645,9 @@ time_mday(VALUE time) * call-seq: * time.mon => fixnum * time.month => fixnum - * + * * Returns the month of the year (1..12) for time. - * + * * t = Time.now #=> 2007-11-19 08:27:30 -0600 * t.mon #=> 11 * t.month #=> 11 @@ -1668,9 +1668,9 @@ time_mon(VALUE time) /* * call-seq: * time.year => fixnum - * + * * Returns the year for time (including the century). - * + * * t = Time.now #=> 2007-11-19 08:27:51 -0600 * t.year #=> 2007 */ @@ -1690,10 +1690,10 @@ time_year(VALUE time) /* * call-seq: * time.wday => fixnum - * + * * Returns an integer representing the day of the week, 0..6, with * Sunday == 0. - * + * * t = Time.now #=> 2007-11-20 02:35:35 -0600 * t.wday #=> 2 * t.sunday? #=> false @@ -1729,9 +1729,9 @@ time_wday(VALUE time) /* * call-seq: * time.sunday? => true or false - * + * * Returns true if time represents Sunday. - * + * * t = Time.local(1990, 4, 1) #=> 1990-04-01 00:00:00 -0600 * t.sunday? #=> true */ @@ -1745,7 +1745,7 @@ time_sunday(VALUE time) /* * call-seq: * time.monday? => true or false - * + * * Returns true if time represents Monday. * * t = Time.local(2003, 8, 4) #=> 2003-08-04 00:00:00 -0500 @@ -1761,7 +1761,7 @@ time_monday(VALUE time) /* * call-seq: * time.tuesday? => true or false - * + * * Returns true if time represents Tuesday. * * t = Time.local(1991, 2, 19) #=> 1991-02-19 00:00:00 -0600 @@ -1777,7 +1777,7 @@ time_tuesday(VALUE time) /* * call-seq: * time.wednesday? => true or false - * + * * Returns true if time represents Wednesday. * * t = Time.local(1993, 2, 24) #=> 1993-02-24 00:00:00 -0600 @@ -1793,7 +1793,7 @@ time_wednesday(VALUE time) /* * call-seq: * time.thursday? => true or false - * + * * Returns true if time represents Thursday. * * t = Time.local(1995, 12, 21) #=> 1995-12-21 00:00:00 -0600 @@ -1809,7 +1809,7 @@ time_thursday(VALUE time) /* * call-seq: * time.friday? => true or false - * + * * Returns true if time represents Friday. * * t = Time.local(1987, 12, 18) #=> 1987-12-18 00:00:00 -0600 @@ -1825,7 +1825,7 @@ time_friday(VALUE time) /* * call-seq: * time.saturday? => true or false - * + * * Returns true if time represents Saturday. * * t = Time.local(2006, 6, 10) #=> 2006-06-10 00:00:00 -0500 @@ -1841,9 +1841,9 @@ time_saturday(VALUE time) /* * call-seq: * time.yday => fixnum - * + * * Returns an integer representing the day of the year, 1..366. - * + * * t = Time.now #=> 2007-11-19 08:32:31 -0600 * t.yday #=> 323 */ @@ -1864,10 +1864,10 @@ time_yday(VALUE time) * call-seq: * time.isdst => true or false * time.dst? => true or false - * + * * Returns true if time occurs during Daylight * Saving Time in its time zone. - * + * * # CST6CDT: * Time.local(2000, 1, 1).zone #=> "CST" * Time.local(2000, 1, 1).isdst #=> false @@ -1900,10 +1900,10 @@ time_isdst(VALUE time) /* * call-seq: * time.zone => string - * + * * Returns the name of the time zone used for time. As of Ruby * 1.8, returns ``UTC'' rather than ``GMT'' for UTC times. - * + * * t = Time.gm(2000, "jan", 1, 20, 15, 1) * t.zone #=> "UTC" * t = Time.local(2000, "jan", 1, 20, 15, 1) @@ -1918,7 +1918,7 @@ time_zone(VALUE time) char buf[64]; int len; #endif - + GetTimeval(time, tobj); if (tobj->tm_got == 0) { time_get_tm(time, tobj->gmt); @@ -1943,10 +1943,10 @@ time_zone(VALUE time) * time.gmt_offset => fixnum * time.gmtoff => fixnum * time.utc_offset => fixnum - * + * * Returns the offset in seconds between the timezone of time * and UTC. - * + * * t = Time.gm(2000,1,1,20,15,1) #=> 2000-01-01 20:15:01 UTC * t.gmt_offset #=> 0 * l = t.getlocal #=> 2000-01-01 14:15:01 -0600 @@ -1998,14 +1998,14 @@ time_utc_offset(VALUE time) /* * call-seq: * time.to_a => array - * + * * Returns a ten-element array of values for time: * {[ sec, min, hour, day, month, year, wday, yday, isdst, zone * ]}. See the individual methods for an explanation of the * valid ranges of each value. The ten elements can be passed directly * to Time::utc or Time::local to create a * new Time. - * + * * t = Time.now #=> 2007-11-19 08:36:01 -0600 * now = t.to_a #=> [1, 36, 8, 19, 11, 2007, 1, 323, false, "CST"] */ @@ -2067,7 +2067,7 @@ rb_strftime_alloc(char **buf, const char *format, /* * call-seq: * time.strftime( string ) => string - * + * * Formats time according to the directives in the given format * string. Any text not listed as a directive will be passed through * to the output string. @@ -2107,7 +2107,7 @@ rb_strftime_alloc(char **buf, const char *format, * %Y - Year with century * %Z - Time zone name * %% - Literal ``%'' character - * + * * t = Time.now #=> 2007-11-19 08:37:48 -0600 * t.strftime("Printed on %m/%d/%Y") #=> "Printed on 11/19/2007" * t.strftime("at %I:%M%p") #=> "at 08:37AM" @@ -2247,7 +2247,7 @@ time_dump(int argc, VALUE *argv, VALUE time) VALUE str; rb_scan_args(argc, argv, "01", 0); - str = time_mdump(time); + str = time_mdump(time); return str; } @@ -2370,7 +2370,7 @@ time_load(VALUE klass, VALUE str) * as equivalent. GMT is the older way of referring to these * baseline times but persists in the names of calls on POSIX * systems. - * + * * All times are stored with some number of nanoseconds. Be aware of * this fact when comparing times with each other---times that are * apparently equal when displayed may be different when compared. diff --git a/transcode.c b/transcode.c index 1c4b997fc9..bfb99effca 100644 --- a/transcode.c +++ b/transcode.c @@ -1269,13 +1269,13 @@ rb_econv_convert0(rb_econv_t *ec, memcpy(*output_ptr, data_start, len); *output_ptr += len; ec->elems[ec->num_trans-1].out_data_start = - ec->elems[ec->num_trans-1].out_data_end = + ec->elems[ec->num_trans-1].out_data_end = ec->elems[ec->num_trans-1].out_buf_start; has_output = 1; } } - if (ec->in_buf_start && + if (ec->in_buf_start && ec->in_data_start != ec->in_data_end) { res = rb_trans_conv(ec, (const unsigned char **)&ec->in_data_start, ec->in_data_end, output_ptr, output_stop, (flags&~ECONV_AFTER_OUTPUT)|ECONV_PARTIAL_INPUT, &result_position); @@ -1519,7 +1519,7 @@ allocate_converted_string(const char *sname, const char *dname, /* result: 0:success -1:failure */ int -rb_econv_insert_output(rb_econv_t *ec, +rb_econv_insert_output(rb_econv_t *ec, const unsigned char *str, size_t len, const char *str_encoding) { const char *insert_encoding = rb_econv_encoding_to_insert_output(ec); @@ -1863,7 +1863,7 @@ rb_econv_binmode(rb_econv_t *ec) if (entry->transcoder) trs[n++] = entry->transcoder; } - + num_trans = ec->num_trans; j = 0; for (i = 0; i < num_trans; i++) { @@ -3107,7 +3107,7 @@ rb_econv_init_by_convpath(VALUE self, VALUE convpath, * p ec.convpath #=> [[#, #], * # "universal_newline"] * - * # But, if the last encoding is ASCII incompatible, + * # But, if the last encoding is ASCII incompatible, * # decorators are inserted before the last conversion. * ec = Encoding::Converter.new("UTF-8", "UTF-16BE", :crlf_newline => true) * p ec.convpath #=> ["crlf_newline", @@ -3218,7 +3218,7 @@ static VALUE econv_source_encoding(VALUE self) { rb_econv_t *ec = check_econv(self); - if (!ec->source_encoding) + if (!ec->source_encoding) return Qnil; return rb_enc_from_encoding(ec->source_encoding); } @@ -3233,7 +3233,7 @@ static VALUE econv_destination_encoding(VALUE self) { rb_econv_t *ec = check_econv(self); - if (!ec->destination_encoding) + if (!ec->destination_encoding) return Qnil; return rb_enc_from_encoding(ec->destination_encoding); } @@ -3638,7 +3638,7 @@ econv_finish(VALUE self) * * # \xff is invalid as EUC-JP. * ec = Encoding::Converter.new("EUC-JP", "Shift_JIS") - * ec.primitive_convert(src="\xff", dst="", nil, 10) + * ec.primitive_convert(src="\xff", dst="", nil, 10) * p ec.primitive_errinfo * #=> [:invalid_byte_sequence, "EUC-JP", "UTF-8", "\xFF", ""] * @@ -3659,7 +3659,7 @@ econv_finish(VALUE self) * # Encoding::Converter::PARTIAL_INPUT prevents invalid errors by * # partial characters. * ec = Encoding::Converter.new("EUC-JP", "ISO-8859-1") - * ec.primitive_convert(src="\xa4", dst="", nil, 10, Encoding::Converter::PARTIAL_INPUT) + * ec.primitive_convert(src="\xa4", dst="", nil, 10, Encoding::Converter::PARTIAL_INPUT) * p ec.primitive_errinfo * #=> [:source_buffer_empty, nil, nil, nil, nil] * @@ -3823,7 +3823,7 @@ econv_putback(int argc, VALUE *argv, VALUE self) * ec.last_error -> exception or nil * * Returns an exception object for the last conversion. - * Returns nil if the last conversion did not produce an error. + * Returns nil if the last conversion did not produce an error. * * "error" means that * Encoding::InvalidByteSequenceError and Encoding::UndefinedConversionError for diff --git a/util.c b/util.c index 4bc82f6d04..f2b38420b8 100644 --- a/util.c +++ b/util.c @@ -101,7 +101,7 @@ scan_digits(const char *str, int base, size_t *retlen, int *overflow) *overflow = 1; ret *= base; x = ret; - ret += d; + ret += d; if (ret < x) *overflow = 1; } @@ -217,11 +217,11 @@ ruby_strtoul(const char *str, char **endptr, int base) * Style 1: The suffix begins with a '.'. The extension is replaced. * If the name matches the original name, use the fallback method. * - * Style 2: The suffix is a single character, not a '.'. Try to add the + * Style 2: The suffix is a single character, not a '.'. Try to add the * suffix to the following places, using the first one that works. - * [1] Append to extension. - * [2] Append to filename, - * [3] Replace end of extension, + * [1] Append to extension. + * [2] Append to filename, + * [3] Replace end of extension, * [4] Replace end of filename. * If the name matches the original name, use the fallback method. * @@ -257,7 +257,7 @@ ruby_strtoul(const char *str, char **endptr, int base) * longname.fil => longname.fi~ * longname.fi~ => longnam~.fi~ * longnam~.fi~ => longnam~.$$$ - * + * */ @@ -311,7 +311,7 @@ ruby_add_suffix(VALUE str, const char *suffix) strcpy(p, suffix); } else if (suffix[1] == '\0') { /* Style 2 */ - if (extlen < 4) { + if (extlen < 4) { ext[extlen] = *suffix; ext[++extlen] = '\0'; } @@ -336,7 +336,7 @@ fallback: } #if defined(__CYGWIN32__) || defined(_WIN32) -static int +static int valid_filename(const char *s) { int fd; diff --git a/vm_eval.c b/vm_eval.c index 88113d328f..1b6ffe28ba 100644 --- a/vm_eval.c +++ b/vm_eval.c @@ -215,7 +215,6 @@ rb_call0(VALUE klass, VALUE recv, ID mid, int argc, const VALUE *argv, return method_missing(recv, mid, argc, argv, scope == 2 ? NOEX_VCALL : 0); } - if (mid != idMethodMissing) { /* receiver specified form for private method */ @@ -227,7 +226,7 @@ rb_call0(VALUE klass, VALUE recv, ID mid, int argc, const VALUE *argv, /* self must be kind of a specified form for protected method */ if (((noex & NOEX_MASK) & NOEX_PROTECTED) && scope == 0) { VALUE defined_class = klass; - + if (TYPE(defined_class) == T_ICLASS) { defined_class = RBASIC(defined_class)->klass; } diff --git a/vm_insnhelper.c b/vm_insnhelper.c index ffb36e9a00..ce1f0984d0 100644 --- a/vm_insnhelper.c +++ b/vm_insnhelper.c @@ -30,7 +30,7 @@ vm_push_frame(rb_thread_t * th, const rb_iseq_t * iseq, int i; /* setup vm value stack */ - + /* nil initialize */ for (i=0; i < local_size; i++) { *sp = Qnil; @@ -798,7 +798,7 @@ vm_yield_setup_block_args(rb_thread_t *th, const rb_iseq_t * iseq, else { int r = iseq->arg_rest; - if (iseq->arg_post_len || + if (iseq->arg_post_len || iseq->arg_opts) { /* TODO: implement simple version for (iseq->arg_post_len==0 && iseq->arg_opts > 0) */ opt_pc = vm_yield_setup_block_args_complex(th, iseq, argc, argv); }