summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2006-09-16 10:51:35 +0000
committermatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2006-09-16 10:51:35 +0000
commitf208b3ad51d4f6c040d255672ab45f28496f4577 (patch)
treea6f67591f5263c19346542368ad3b147ee67472a
parent46799937ee259e85df53bda7d65693ccfbefe8b2 (diff)
* README.EXT: should mention new macros: RSTRING_PTR, RSTRING_LEN,
RARRAY_PTR, RARRAY_LEN. * README.EXT.ja: ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@10950 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r--ChangeLog7
-rw-r--r--README.EXT8
-rw-r--r--README.EXT.ja9
3 files changed, 16 insertions, 8 deletions
diff --git a/ChangeLog b/ChangeLog
index 89397aefa0..aca9dc4883 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -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の構造体を直接アクセスする時に気をつけなければならないこ
とは,配列や文字列の構造体の中身は参照するだけで,直接変更し