diff options
-rw-r--r-- | ChangeLog | 7 | ||||
-rw-r--r-- | README.EXT | 8 | ||||
-rw-r--r-- | README.EXT.ja | 9 |
3 files changed, 16 insertions, 8 deletions
@@ -1,3 +1,10 @@ +Sat Sep 16 19:47:16 2006 Yukihiro Matsumoto <matz@ruby-lang.org> + + * README.EXT: should mention new macros: RSTRING_PTR, RSTRING_LEN, + RARRAY_PTR, RARRAY_LEN. + + * README.EXT.ja: ditto. + Sat Sep 16 16:39:23 2006 Nobuyoshi Nakada <nobu@ruby-lang.org> * Makefile.in, common.in, instruby.rb, ext/extmk.rb, lib/mkmf.rb: diff --git a/README.EXT b/README.EXT index 2fc2fd606a..283de48b7f 100644 --- a/README.EXT +++ b/README.EXT @@ -115,10 +115,10 @@ can be cast to retrieve the pointer to the struct. The casting macro will be of the form RXXXX for each data type; for instance, RARRAY(obj). See "ruby.h". -For example, `RSTRING(str)->len' is the way to get the size of the -Ruby String object. The allocated region can be accessed by -`RSTRING(str)->ptr'. For arrays, use `RARRAY(ary)->len' and -`RARRAY(ary)->ptr' respectively. +There are some accessing macros for structure members, for example +`RSTRING_LEN(s)' to to get the size of the Ruby String object. The +allocated region can be accessed by `RSTRING_PTR(str). For arrays, use +`RARRAY_LEN(ary) and `RARRAY_PTR(ary) respectively. Notice: Do not change the value of the structure directly, unless you are responsible for the result. This ends up being the cause of interesting diff --git a/README.EXT.ja b/README.EXT.ja index fb88c99d82..20c5a362a6 100644 --- a/README.EXT.ja +++ b/README.EXT.ja @@ -129,10 +129,11 @@ obsolete となり、代わりに StringValue() と StringValuePtr() ruby.hでは構造体へキャストするマクロも「RXXXXX()」(全部大文 字にしたもの)という名前で提供されています(例: RSTRING()). -例えば,文字列strの長さを得るためには「RSTRING(str)->len」と -し,文字列strをchar*として得るためには「RSTRING(str)->ptr」 -とします.配列の場合には,それぞれ「RARRAY(ary)->len」, -「RARRAY(ary)->ptr」となります. +構造体からデータを取り出すマクロが提供されています。文字列 +strの長さを得るためには「RSTRING_LEN(str)」とし,文字列strを +char*として得るためには「RSTRING_PTR(str)」とします.配列の +場合には,それぞれ「RARRAY_LEN(ary)」,「RARRAY_PTR(ary)」と +なります. Rubyの構造体を直接アクセスする時に気をつけなければならないこ とは,配列や文字列の構造体の中身は参照するだけで,直接変更し |