From 4e44f6ef8668faa59898de2da7612b6a2cad1eb8 Mon Sep 17 00:00:00 2001 From: nobu Date: Wed, 26 Oct 2016 06:11:23 +0000 Subject: [PATCH] [DOC] replace Fixnum with Integer [ci skip] * numeric.c: [DOC] update document for Integer class. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56492 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- bignum.c | 4 +-- error.c | 2 +- ext/bigdecimal/bigdecimal.c | 8 +++--- ext/objspace/object_tracing.c | 2 +- ext/openssl/ossl_pkey_ec.c | 2 +- ext/socket/basicsocket.c | 4 +-- ext/win32ole/win32ole_variant.c | 2 +- ext/zlib/zlib.c | 2 +- hash.c | 2 +- io.c | 12 ++++----- math.c | 2 +- numeric.c | 48 +++++++++------------------------ object.c | 14 +++++----- proc.c | 4 +-- process.c | 2 +- re.c | 2 +- string.c | 12 ++++----- thread_pthread.c | 2 +- 18 files changed, 51 insertions(+), 75 deletions(-) diff --git a/bignum.c b/bignum.c index dbfe89967c..600cdad9f7 100644 --- a/bignum.c +++ b/bignum.c @@ -5443,8 +5443,8 @@ rb_big_le(VALUE x, VALUE y) * big == obj -> true or false * * Returns true only if obj has the same value - * as big. Contrast this with Bignum#eql?, which - * requires obj to be a Bignum. + * as big. Contrast this with Integer#eql?, which + * requires obj to be a Integer. * * 68719476736 == 68719476736.0 #=> true */ diff --git a/error.c b/error.c index 4758961e93..0856bc0e2a 100644 --- a/error.c +++ b/error.c @@ -1816,7 +1816,7 @@ syserr_eqq(VALUE self, VALUE exc) * * Since constant names must start with a capital: * - * Fixnum.const_set :answer, 42 + * Integer.const_set :answer, 42 * * raises the exception: * diff --git a/ext/bigdecimal/bigdecimal.c b/ext/bigdecimal/bigdecimal.c index 623bd11cee..8aebb389e9 100644 --- a/ext/bigdecimal/bigdecimal.c +++ b/ext/bigdecimal/bigdecimal.c @@ -680,7 +680,7 @@ BigDecimal_check_num(Real *p) static VALUE BigDecimal_split(VALUE self); -/* Returns the value as an integer (Fixnum or Bignum). +/* Returns the value as an Integer. * * If the BigNumber is infinity or NaN, raises FloatDomainError. */ @@ -2483,7 +2483,7 @@ static Real *BigDecimal_new(int argc, VALUE *argv); * If it is a String, spaces are ignored and unrecognized characters * terminate the value. * - * digits:: The number of significant digits, as a Fixnum. If omitted or 0, + * digits:: The number of significant digits, as an Integer. If omitted or 0, * the number of significant digits is determined from the initial * value. * @@ -2492,10 +2492,10 @@ static Real *BigDecimal_new(int argc, VALUE *argv); * * ==== Exceptions * - * TypeError:: If the +initial+ type is neither Fixnum, Bignum, Float, + * TypeError:: If the +initial+ type is neither Integer, Float, * Rational, nor BigDecimal, this exception is raised. * - * TypeError:: If the +digits+ is not a Fixnum, this exception is raised. + * TypeError:: If the +digits+ is not an Integer, this exception is raised. * * ArgumentError:: If +initial+ is a Float, and the +digits+ is larger than * Float::DIG + 1, this exception is raised. diff --git a/ext/objspace/object_tracing.c b/ext/objspace/object_tracing.c index 3a7f54427d..d3169c6c48 100644 --- a/ext/objspace/object_tracing.c +++ b/ext/objspace/object_tracing.c @@ -439,7 +439,7 @@ allocation_method_id(VALUE self, VALUE obj) } /* - * call-seq: allocation_generation(object) -> Fixnum + * call-seq: allocation_generation(object) -> integer or nil * * Returns garbage collector generation for the given +object+. * diff --git a/ext/openssl/ossl_pkey_ec.c b/ext/openssl/ossl_pkey_ec.c index f0a31231b4..20a7222384 100644 --- a/ext/openssl/ossl_pkey_ec.c +++ b/ext/openssl/ossl_pkey_ec.c @@ -1191,7 +1191,7 @@ static VALUE ossl_ec_group_set_seed(VALUE self, VALUE seed) /* * call-seq: - * group.degree => Fixnum + * group.degree => integer * * See the OpenSSL documentation for EC_GROUP_get_degree() */ diff --git a/ext/socket/basicsocket.c b/ext/socket/basicsocket.c index ee967c7b7a..264b882500 100644 --- a/ext/socket/basicsocket.c +++ b/ext/socket/basicsocket.c @@ -158,10 +158,10 @@ bsock_close_write(VALUE sock) * * +optval+ is the value of the option, it is passed to the underlying * setsockopt() as a pointer to a certain number of bytes. How this is * done depends on the type: - * - Fixnum: value is assigned to an int, and a pointer to the int is + * - Integer: value is assigned to an int, and a pointer to the int is * passed, with length of sizeof(int). * - true or false: 1 or 0 (respectively) is assigned to an int, and the - * int is passed as for a Fixnum. Note that +false+ must be passed, + * int is passed as for an Integer. Note that +false+ must be passed, * not +nil+. * - String: the string's data and length is passed to the socket. * * +socketoption+ is an instance of Socket::Option diff --git a/ext/win32ole/win32ole_variant.c b/ext/win32ole/win32ole_variant.c index f0d41839ed..3bbf86df52 100644 --- a/ext/win32ole/win32ole_variant.c +++ b/ext/win32ole/win32ole_variant.c @@ -602,7 +602,7 @@ folevariant_ary_aset(int argc, VALUE *argv, VALUE self) * * Returns Ruby object value from OLE variant. * obj = WIN32OLE_VARIANT.new(1, WIN32OLE::VARIANT::VT_BSTR) - * obj.value # => "1" (not Fixnum object, but String object "1") + * obj.value # => "1" (not Integer object, but String object "1") * */ static VALUE diff --git a/ext/zlib/zlib.c b/ext/zlib/zlib.c index 4dfa2a5f34..deb3b04617 100644 --- a/ext/zlib/zlib.c +++ b/ext/zlib/zlib.c @@ -3218,7 +3218,7 @@ rb_gzfile_set_lineno(VALUE obj, VALUE lineno) * Document-method: Zlib::GzipWriter#mtime= * * Specify the modification time (+mtime+) in the gzip header. - * Using a Fixnum or Integer. + * Using an Integer. * * Setting the mtime in the gzip header does not effect the * mtime of the file generated. Different utilities that diff --git a/hash.c b/hash.c index db8bdc8bb6..8ed8c48ebb 100644 --- a/hash.c +++ b/hash.c @@ -2863,7 +2863,7 @@ rb_hash_any_p(VALUE hash) * * g = { foo: [10, 11, 12] } * g.dig(:foo, 1) #=> 11 - * g.dig(:foo, 1, 0) #=> TypeError: Fixnum does not have #dig method + * g.dig(:foo, 1, 0) #=> TypeError: Integer does not have #dig method * g.dig(:foo, :bar) #=> TypeError: no implicit conversion of Symbol into Integer */ diff --git a/io.c b/io.c index 8fc0ca9247..44440d95ae 100644 --- a/io.c +++ b/io.c @@ -6441,7 +6441,7 @@ rb_io_s_open(int argc, VALUE *argv, VALUE klass) * IO.sysopen(path, [mode, [perm]]) -> integer * * Opens the given path, returning the underlying file descriptor as a - * Fixnum. + * Integer. * * IO.sysopen("testfile") #=> 3 */ @@ -11378,7 +11378,7 @@ argf_getc(VALUE argf) /* * call-seq: - * ARGF.getbyte -> Fixnum or nil + * ARGF.getbyte -> Integer or nil * * Gets the next 8-bit byte (0..255) from +ARGF+. Returns +nil+ if called at * the end of the stream. @@ -11458,9 +11458,9 @@ argf_readchar(VALUE argf) /* * call-seq: - * ARGF.readbyte -> Fixnum + * ARGF.readbyte -> Integer * - * Reads the next 8-bit byte from ARGF and returns it as a +Fixnum+. Raises + * Reads the next 8-bit byte from ARGF and returns it as an +Integer+. Raises * an +EOFError+ after the last byte of the last file has been read. * * For example: @@ -11521,7 +11521,7 @@ argf_block_call(ID mid, int argc, VALUE *argv, VALUE argf) * which defaults to your platform's newline character) of each file in * +ARGV+. If a block is supplied, each line in turn will be yielded to the * block, otherwise an enumerator is returned. - * The optional _limit_ argument is a +Fixnum+ specifying the maximum + * The optional _limit_ argument is an +Integer+ specifying the maximum * length of each line; longer lines will be split according to this limit. * * This method allows you to treat the files supplied on the command line as @@ -11571,7 +11571,7 @@ argf_lines(int argc, VALUE *argv, VALUE argf) * ARGF.each_byte -> an_enumerator * * Iterates over each byte of each file in +ARGV+. - * A byte is returned as a +Fixnum+ in the range 0..255. + * A byte is returned as an +Integer+ in the range 0..255. * * This method allows you to treat the files supplied on the command line as * a single file consisting of the concatenation of each named file. After diff --git a/math.c b/math.c index b15e87113c..e1c0e1b1ad 100644 --- a/math.c +++ b/math.c @@ -683,7 +683,7 @@ math_cbrt(VALUE obj, VALUE x) * Math.frexp(x) -> [fraction, exponent] * * Returns a two-element array containing the normalized fraction (a Float) - * and exponent (a Fixnum) of +x+. + * and exponent (an Integer) of +x+. * * fraction, exponent = Math.frexp(1234) #=> [0.6025390625, 11] * fraction * 2**exponent #=> 1234.0 diff --git a/numeric.c b/numeric.c index 7d4d9225e9..9a28a45f77 100644 --- a/numeric.c +++ b/numeric.c @@ -669,7 +669,7 @@ num_real_p(VALUE num) * call-seq: * num.integer? -> true or false * - * Returns +true+ if +num+ is an Integer (including Fixnum and Bignum). + * Returns +true+ if +num+ is an Integer. * * (1.0).integer? #=> false * (1).integer? #=> true @@ -787,8 +787,8 @@ num_infinite_p(VALUE num) * Invokes the child class's +to_i+ method to convert +num+ to an integer. * * 1.0.class => Float - * 1.0.to_int.class => Fixnum - * 1.0.to_i.class => Fixnum + * 1.0.to_int.class => Integer + * 1.0.to_i.class => Integer */ static VALUE @@ -2952,11 +2952,13 @@ rb_num2ull(VALUE val) #endif /* HAVE_LONG_LONG */ -/* +/******************************************************************** + * * Document-class: Integer * - * This class is the basis for the two concrete classes that hold whole - * numbers, Bignum and Fixnum. + * Holds Integer values. You cannot add a singleton method to an + * Integer. Any attempt to add a singleton method to an Integer object + * will raise a TypeError. * */ @@ -3039,8 +3041,6 @@ int_even_p(VALUE num) /* * Document-method: Integer#succ * Document-method: Integer#next - * Document-method: Fixnum#succ - * Document-method: Fixnum#next * call-seq: * int.next -> integer * int.succ -> integer @@ -3192,22 +3192,8 @@ int_ord(VALUE num) return num; } -/******************************************************************** - * - * Document-class: Fixnum - * - * Holds Integer values that can be represented in a native machine word - * (minus 1 bit). If any operation on a Fixnum exceeds this range, the value - * is automatically converted to a Bignum. - * - * Fixnum objects have immediate value. This means that when they are assigned - * or passed as parameters, the actual object is passed, rather than a - * reference to that object. - * - * Assignment does not alias Fixnum objects. There is effectively only one - * Fixnum object instance for any given integer value, so, for example, you - * cannot add a singleton method to a Fixnum. Any attempt to add a singleton - * method to a Fixnum object will raise a TypeError. +/* + * Fixnum */ @@ -3325,7 +3311,6 @@ rb_int2str(VALUE x, int base) /* * Document-method: Integer#+ - * Document-method: Fixnum#+ * call-seq: * int + numeric -> numeric_result * @@ -3381,7 +3366,6 @@ rb_int_plus(VALUE x, VALUE y) /* * Document-method: Integer#- - * Document-method: Fixnum#- * call-seq: * int - numeric -> numeric_result * @@ -3434,7 +3418,6 @@ rb_int_minus(VALUE x, VALUE y) /* * Document-method: Integer#* - * Document-method: Fixnum#* * call-seq: * int * numeric -> numeric_result * @@ -3521,7 +3504,6 @@ int_fdiv(VALUE x, VALUE y) /* * Document-method: Integer#/ - * Document-method: Fixnum#/ * call-seq: * int / numeric -> numeric_result * @@ -3609,7 +3591,6 @@ rb_int_idiv(VALUE x, VALUE y) } /* - * Document-method: Fixnum#% * Document-method: Integer#% * Document-method: Integer#modulo * call-seq: @@ -3741,7 +3722,7 @@ int_divmod(VALUE x, VALUE y) * * Raises +integer+ to the power of +numeric+, which may be negative or * fractional. - * The result may be a Fixnum, Bignum, or Float + * The result may be an Integer, or a Float * * 2 ** 3 #=> 8 * 2 ** -1 #=> (1/2) @@ -3864,7 +3845,6 @@ rb_int_pow(VALUE x, VALUE y) /* * Document-method: Integer#== - * Document-method: Fixnum#== * call-seq: * int == other -> true or false * @@ -3958,7 +3938,6 @@ int_cmp(VALUE x, VALUE y) /* * Document-method: Integer#> - * Document-method: Fixnum#> * call-seq: * int > real -> true or false * @@ -3997,7 +3976,6 @@ int_gt(VALUE x, VALUE y) /* * Document-method: Integer#>= - * Document-method: Fixnum#>= * call-seq: * int >= real -> true or false * @@ -4038,7 +4016,6 @@ rb_int_ge(VALUE x, VALUE y) /* * Document-method: Integer#< - * Document-method: Fixnum#< * call-seq: * int < real -> true or false * @@ -4077,7 +4054,6 @@ int_lt(VALUE x, VALUE y) /* * Document-method: Integer#<= - * Document-method: Fixnum#<= * call-seq: * int <= real -> true or false * @@ -5019,7 +4995,7 @@ int_truncate(int argc, VALUE* argv, VALUE num) * by preventing instantiation and duplication. * * Integer.new(1) #=> NoMethodError: undefined method `new' for Integer:Class - * 1.dup #=> TypeError: can't dup Fixnum + * 1.dup #=> TypeError: can't dup Integer * * For this reason, Numeric should be used when defining other numeric classes. * diff --git a/object.c b/object.c index 9769c1ee26..fb8cee4071 100644 --- a/object.c +++ b/object.c @@ -147,12 +147,12 @@ rb_obj_equal(VALUE obj1, VALUE obj2) * call-seq: * obj.hash -> integer * - * Generates a Fixnum hash value for this object. This function must have the + * Generates an Integer hash value for this object. This function must have the * property that a.eql?(b) implies a.hash == b.hash. * * The hash value is used along with #eql? by the Hash class to determine if * two objects reference the same hash key. Any hash value that exceeds the - * capacity of a Fixnum will be truncated before being used. + * capacity of an Integer will be truncated before being used. * * The hash value for an object may not be identical across invocations or * implementations of Ruby. If you need a stable identifier across Ruby @@ -221,7 +221,7 @@ rb_class_real(VALUE cl) * called with an explicit receiver, as class is also a * reserved word in Ruby. * - * 1.class #=> Fixnum + * 1.class #=> Integer * self.class #=> Object */ @@ -241,7 +241,7 @@ rb_obj_class(VALUE obj) * If obj is nil, true, or * false, it returns NilClass, TrueClass, or FalseClass, * respectively. - * If obj is a Fixnum or a Symbol, it raises a TypeError. + * If obj is an Integer, a Float or a Symbol, it raises a TypeError. * * Object.new.singleton_class #=> #> * String.singleton_class #=> # @@ -1087,8 +1087,8 @@ rb_obj_infect(VALUE obj1, VALUE obj2) * prog.rb:3:in `<<': can't modify frozen Array (RuntimeError) * from prog.rb:3 * - * Objects of the following classes are always frozen: Fixnum, - * Bignum, Float, Symbol. + * Objects of the following classes are always frozen: Integer, + * Float, Symbol. */ VALUE @@ -2734,7 +2734,7 @@ rb_Integer(VALUE val) * call-seq: * Integer(arg, base=0) -> integer * - * Converts arg to a Fixnum or Bignum. + * Converts arg to an Integer. * Numeric types are converted directly (with floating point numbers * being truncated). base (0, or between 2 and 36) is a base for * integer string representation. If arg is a String, diff --git a/proc.c b/proc.c index 651eaaad0d..a7f22714fe 100644 --- a/proc.c +++ b/proc.c @@ -1087,7 +1087,7 @@ iseq_location(const rb_iseq_t *iseq) /* * call-seq: - * prc.source_location -> [String, Fixnum] + * prc.source_location -> [String, Integer] * * Returns the Ruby source filename and line number containing this proc * or +nil+ if this proc was not defined in Ruby (i.e. native) @@ -2472,7 +2472,7 @@ rb_obj_method_location(VALUE obj, ID id) /* * call-seq: - * meth.source_location -> [String, Fixnum] + * meth.source_location -> [String, Integer] * * Returns the Ruby source filename and line number containing this method * or nil if this method was not defined in Ruby (i.e. native) diff --git a/process.c b/process.c index 1171060201..b027be2bbe 100644 --- a/process.c +++ b/process.c @@ -501,7 +501,7 @@ rb_last_status_clear(void) * stat.to_i -> integer * stat.to_int -> integer * - * Returns the bits in _stat_ as a Fixnum. Poking + * Returns the bits in _stat_ as a Integer. Poking * around in these bits is platform dependent. * * fork { exit 0xab } #=> 26566 diff --git a/re.c b/re.c index 2f3149a85c..0536aa6d8e 100644 --- a/re.c +++ b/re.c @@ -3292,7 +3292,7 @@ rb_reg_match_m_p(int argc, VALUE *argv, VALUE re) * String or a Regexp (in which case that regexp's options are propagated), * and new options may not be specified (a change as of Ruby 1.8). * - * If +options+ is a Fixnum, it should be one or more of the constants + * If +options+ is an Integer, it should be one or more of the constants * Regexp::EXTENDED, Regexp::IGNORECASE, and Regexp::MULTILINE, * or-ed together. Otherwise, if +options+ is not * +nil+ or +false+, the regexp will be case insensitive. diff --git a/string.c b/string.c index 91ee0fc749..68cc400167 100644 --- a/string.c +++ b/string.c @@ -4423,10 +4423,10 @@ rb_str_aset(VALUE str, VALUE indx, VALUE val) * the text it is replacing, the string will be adjusted accordingly. If the * regular expression or string is used as the index doesn't match a position * in the string, IndexError is raised. If the regular expression - * form is used, the optional second Fixnum allows you to specify + * form is used, the optional second Integer allows you to specify * which portion of the match to replace (effectively using the - * MatchData indexing rules. The forms that take a - * Fixnum will raise an IndexError if the value is + * MatchData indexing rules. The forms that take an + * Integer will raise an IndexError if the value is * out of range; the Range form will raise a * RangeError, and the Regexp and String * will raise an IndexError on negative match. @@ -5196,8 +5196,8 @@ str_byte_aref(VALUE str, VALUE indx) * str.byteslice(integer, integer) -> new_str or nil * str.byteslice(range) -> new_str or nil * - * Byte Reference---If passed a single Fixnum, returns a - * substring of one byte at that position. If passed two Fixnum + * Byte Reference---If passed a single Integer, returns a + * substring of one byte at that position. If passed two Integer * objects, returns a substring starting at the offset given by the first, and * a length given by the second. If given a Range, a substring containing * bytes at offsets given by the range is returned. In all three cases, if @@ -8521,7 +8521,7 @@ rb_str_ord(VALUE s) * str.sum(n=16) -> integer * * Returns a basic n-bit checksum of the characters in str, - * where n is the optional Fixnum parameter, defaulting + * where n is the optional Integer parameter, defaulting * to 16. The result is simply the sum of the binary value of each byte in * str modulo 2**n - 1. This is not a particularly good * checksum. diff --git a/thread_pthread.c b/thread_pthread.c index 20e4869a50..43644e7c06 100644 --- a/thread_pthread.c +++ b/thread_pthread.c @@ -1515,7 +1515,7 @@ native_set_thread_name(rb_thread_t *th) SET_CURRENT_THREAD_NAME(RSTRING_PTR(loc)); } else if (!NIL_P(loc = rb_proc_location(th->first_proc))) { - const VALUE *ptr = RARRAY_CONST_PTR(loc); /* [ String, Fixnum ] */ + const VALUE *ptr = RARRAY_CONST_PTR(loc); /* [ String, Integer ] */ char *name, *p; char buf[16]; size_t len;