path: root/README.EXT
diff options
authormatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>1999-01-26 10:08:18 +0000
committermatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>1999-01-26 10:08:18 +0000
commitceb8031b6b795b189012c38057ebf82733f4aeaf (patch)
treeacd2591c3746e2795fe15ef4fa50fa07b6510726 /README.EXT
parent84d73314a79384e99f8b3490f97868ee81bf1146 (diff)
git-svn-id: svn+ssh:// b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'README.EXT')
1 files changed, 45 insertions, 50 deletions
diff --git a/README.EXT b/README.EXT
index f169e54..a7b6443 100644
@@ -133,11 +133,11 @@ FIXNUMに関しては変換マクロを経由する必要があります.Cの整数
- INT2FIX() もとの整数が31bit以内に収まる時
- INT2NUM() 任意の整数からVALUEへ
+ INT2FIX() for intergers within 31bits.
+ INT2NUM() for arbitrary sized integer.
+INT2NUM() converts integers into Bignums, if it is out of FIXNUM
+range, but bit slower.
1.5 Manipulate Ruby data
@@ -205,8 +205,6 @@ Rubyで提供されている関数を使えばRubyインタプリタに新しい機能
* Methods, Singleton Methods
* Constants
2.1.1 Class/module definition
To define class or module, use functions below:
@@ -643,23 +641,21 @@ extconf.rbはモジュールのコンパイルに必要な条件のチェックなど
(6) prepare depend (optional)
+If the file named depend exists, Makefile will include that file to
+check dependency. You can make this file by invoking
% gcc -MM *.c > depend
+It's no harm. Prepare it.
(7) MANIFESTファイルにファイル名を入れる
- % ls > MANIFEST
+ % find * -type f -print > MANIFEST
-*.o, *~など不必要なファイル以外はMANIFESTに追加しておきます.
+Append file names into MANIFEST. The compilation scheme requires
+MANIFEST only to be exist. But, you'd better take this step to
+distinguish required files.
(8) make
@@ -676,9 +672,9 @@ so that you can inspect the module by the debugger.
(10) done, now you have the extension library
+You can do anything you want with your library. The author of Ruby
+will not claim any restriction about your code depending Ruby API.
+Feel free to use, modify, distribute or sell your program.
Appendix A. Rubyのソースコードの分類
@@ -737,7 +733,7 @@ class library
-Appendix B. 拡張用関数リファレンス
+Appendix B. Ruby extension API reference
@@ -764,7 +760,7 @@ const: Qtrue object(default true value)
const: Qfalse object
-** Cデータのカプセル化
+** C pointer wrapping
Data_Wrap_Struct(VALUE class, void (*mark)(), void (*free)(), void *sval)
@@ -783,33 +779,33 @@ type型のメモリをmallocし,変数svalに代入した後,それをカプセ
-** クラス/モジュール定義
+** defining class/module
VALUE rb_define_class(char *name, VALUE super)
+Defines new Ruby class as subclass of super.
VALUE rb_define_class_under(VALUE module, char *name, VALUE super)
+Creates new Ruby class as subclass of super, under the module's
VALUE rb_define_module(char *name)
+Defines new Ruby module.
VALUE rb_define_module_under(VALUE module, char *name, VALUE super)
+Defines new Ruby module, under the modules's namespace.
void rb_include_module(VALUE class, VALUE module)
+Includes module into class. If class already includes it, just
void rb_extend_object(VALUE object, VALUE module)
+Extend the object with module's attribute.
** Defining Global Variables
@@ -871,19 +867,20 @@ Defines global contant. This is just work as
rb_define_method(VALUE class, char *name, VALUE (*func)(), int argc)
-関数には引数の数(selfを含まない)を第1引数, 引数の配列を第2引
-数とする形式で与えられる(第3引数はself).argcが-2の時, 第1引
-数がself, 第2引数がargs(argsは引数を含むRubyの配列)という形
+Defines a method for the class. func is the function pointer. argc
+is the number of arguments. if argc is -1, the function will receive
+3 arguments argc, argv, and self. if argc is -2, the function will
+receive 2 arguments, self and args, where args is the Ruby array of
+the method arguments.
rb_define_private_method(VALUE class, char *name, VALUE (*func)(), int argc)
+Defines a private method for the class. Arguments are same as
rb_define_singleton_method(VALUE class, char *name, VALUE (*func)(), int argc)
+Defines a singleton method. Arguments are same as rb_define_method().
rb_scan_args(int atgc, VALUE *argv, char *fmt, ...)
@@ -899,42 +896,40 @@ argc,argv形式で与えられた引数を分解する.fmtは必須引数の数,
VALUE rb_funcall(VALUE recv, ID mid, int narg, ...)
+Invokes the method. To retrieve mid from method name, use rb_intern().
VALUE rb_funcall2(VALUE recv, ID mid, int argc, VALUE *argv)
+Invokes method, passing arguments by array of values.
VALUE rb_eval_string(char *str)
+Compiles and executes the string as Ruby program.
ID rb_intern(char *name)
+Returns ID corresponding the name.
char *rb_id2name(ID id)
+Returns the name corresponding ID.
char *rb_class2name(VALUE class)
+Returns the name of the class.
-** インスタンス変数
+** Instance Variables
VALUE rb_iv_get(VALUE obj, char *name)
-変数は Rubyプログラムからアクセスできない「隠れた」インスタ
+Retrieve the value of the instance variable. If the name is not
+prefixed by `@', that variable shall be inaccessible from Ruby.
VALUE rb_iv_set(VALUE obj, char *name, VALUE val)
+Sets the value of the instance variable.
-** 制御構造
+** Control Structure
VALUE rb_iterate(VALUE (*func1)(), void *arg1, VALUE (*func2)(), void *arg2)
@@ -1024,6 +1019,6 @@ this method, the compilation will not be done.
* Local variables:
- * fill-column: 60
+ * fill-column: 70
* end: