mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
* prec.c (prec_prec_f): documentation patch from
<gerardo.santana at gmail.com>. [ruby-core:07689] * bignum.c (rb_big_pow): second operand may be too big even if it's a Fixnum. [ruby-talk:187984] * README.EXT: update symbol description. [ruby-talk:188104] * COPYING: explicitly note GPLv2. [ruby-talk:187922] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8@10088 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
468a0bd4fa
commit
234c47e9fb
6 changed files with 54 additions and 9 deletions
2
COPYING
2
COPYING
|
@ -1,6 +1,6 @@
|
|||
Ruby is copyrighted free software by Yukihiro Matsumoto <matz@netlab.jp>.
|
||||
You can redistribute it and/or modify it under either the terms of the GPL
|
||||
(see the file GPL), or the conditions below:
|
||||
version 2 (see the file GPL), or the conditions below:
|
||||
|
||||
1. You may make and give away verbatim copies of the source form of the
|
||||
software without restriction, provided that you duplicate all of the
|
||||
|
|
18
ChangeLog
18
ChangeLog
|
@ -1,3 +1,21 @@
|
|||
Mon Apr 10 01:03:10 2006 Yukihiro Matsumoto <matz@ruby-lang.org>
|
||||
|
||||
* prec.c (prec_prec_f): documentation patch from
|
||||
<gerardo.santana at gmail.com>. [ruby-core:07689]
|
||||
|
||||
Sat Apr 8 02:34:34 2006 Yukihiro Matsumoto <matz@ruby-lang.org>
|
||||
|
||||
* bignum.c (rb_big_pow): second operand may be too big even if
|
||||
it's a Fixnum. [ruby-talk:187984]
|
||||
|
||||
Sat Apr 8 02:12:38 2006 Yukihiro Matsumoto <matz@ruby-lang.org>
|
||||
|
||||
* README.EXT: update symbol description. [ruby-talk:188104]
|
||||
|
||||
Thu Apr 6 23:28:47 2006 Yukihiro Matsumoto <matz@ruby-lang.org>
|
||||
|
||||
* COPYING: explicitly note GPLv2. [ruby-talk:187922]
|
||||
|
||||
Thu Apr 6 11:18:37 2006 Hidetoshi NAGAI <nagai@ai.kyutech.ac.jp>
|
||||
|
||||
* ext/tk/lib/tk/panedwindow.rb: lack of arguments. [ruby-core:7681]
|
||||
|
|
23
README.EXT
23
README.EXT
|
@ -330,17 +330,30 @@ of the innermost method (which is defined by Ruby) can be accessed.
|
|||
|
||||
2.2.2 ID or Symbol
|
||||
|
||||
You can invoke methods directly, without parsing the string. First I
|
||||
need to explain about symbols (whose data type is ID). ID is the
|
||||
integer number to represent Ruby's identifiers such as variable names.
|
||||
It can be accessed from Ruby in the form:
|
||||
You can invoke methods directly, without parsing the string. First I need
|
||||
to explain about ID. ID is the integer number to represent Ruby's
|
||||
identifiers such as variable names. The Ruby data type corresponding to ID
|
||||
is Symbol. It can be accessed from Ruby in the form:
|
||||
|
||||
:Identifier
|
||||
|
||||
You can get the symbol value from a string within C code by using
|
||||
You can get the ID value from a string within C code by using
|
||||
|
||||
rb_intern(const char *name)
|
||||
|
||||
You can retrieve ID from Ruby object (Symbol or String) given as an
|
||||
argument by using
|
||||
|
||||
rb_to_id(VALUE symbol)
|
||||
|
||||
You can convert C ID to Ruby Symbol by using
|
||||
|
||||
VALUE ID2SYM(ID id)
|
||||
|
||||
and to convert Ruby Symbol object to ID, use
|
||||
|
||||
ID SYM2ID(VALUE symbol)
|
||||
|
||||
2.2.3 Invoke Ruby method from C
|
||||
|
||||
To invoke methods directly, you can use the function below
|
||||
|
|
|
@ -380,7 +380,8 @@ C
|
|||
す.その前に,Rubyインタプリタ内でメソッドや変数名を指定する
|
||||
時に使われているIDについて説明しておきましょう.
|
||||
|
||||
IDとは変数名,メソッド名を表す整数です.Rubyの中では
|
||||
IDとは変数名,メソッド名を表す整数です.RubyではIDに対応する
|
||||
オブジェクトとしてシンボル(Symbol)があり,
|
||||
|
||||
:識別子
|
||||
|
||||
|
@ -393,6 +394,14 @@ ID
|
|||
|
||||
rb_to_id(VALUE symbol)
|
||||
|
||||
IDからシンボルを得るためには以下のマクロを使います.
|
||||
|
||||
VALUE ID2SYM(ID id)
|
||||
|
||||
シンボルからIDを得るためには以下のマクロを使います.
|
||||
|
||||
ID SYM2ID(VALUE symbol)
|
||||
|
||||
2.2.3 CからRubyのメソッドを呼び出す
|
||||
|
||||
Cから文字列を経由せずにRubyのメソッドを呼び出すためには以下
|
||||
|
|
5
bignum.c
5
bignum.c
|
@ -1606,6 +1606,11 @@ rb_big_pow(x, y)
|
|||
if (yy > 0) {
|
||||
VALUE z = x;
|
||||
|
||||
if (RBIGNUM(x)->len * SIZEOF_BDIGITS * yy > 1024*1024) {
|
||||
rb_warn("in a**b, b may be too big");
|
||||
d = (double)yy;
|
||||
break;
|
||||
}
|
||||
for (;;) {
|
||||
yy -= 1;
|
||||
if (yy == 0) break;
|
||||
|
|
4
prec.c
4
prec.c
|
@ -57,9 +57,9 @@ prec_prec_i(x)
|
|||
|
||||
/*
|
||||
* call-seq:
|
||||
* num.prec_f => Integer
|
||||
* num.prec_f => Float
|
||||
*
|
||||
* Returns an +Float+ converted from _num_. It is equivalent
|
||||
* Returns a +Float+ converted from _num_. It is equivalent
|
||||
* to <code>prec(Float)</code>.
|
||||
*/
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue