@@ -133,11 +133,11 @@ FIXNUM
133
133
����VALUE���Ѵ�����ޥ����ϰʲ��Τ�Τ�����ޤ���ɬ�פ˱���
134
134
�ƻȤ�ʬ���Ƥ���������
135
135
136
- INT2FIX() ��Ȥ�������31bit����˼��ޤ��
137
- INT2NUM() Ǥ�դ���������VALUE��
136
+ INT2FIX() for intergers within 31bits.
137
+ INT2NUM() for arbitrary sized integer.
138
138
139
- INT2NUM()�������� FIXNUM���ϰϤ˼��ޤ�ʤ���硤Bignum���Ѵ�
140
- ���Ƥ���ޤ�(���������٤�)��
139
+ INT2NUM() converts integers into Bignums, if it is out of FIXNUM
140
+ range, but bit slower.
141
141
142
142
1.5 Manipulate Ruby data
143
143
205
205
* Methods, Singleton Methods
206
206
* Constants
207
207
208
- �ǤϽ�˾Ҳ𤷤ޤ���
209
-
210
208
2.1.1 Class/module definition
211
209
212
210
To define class or module, use functions below:
@@ -643,23 +641,21 @@ extconf.rb
643
641
644
642
(6) prepare depend (optional)
645
643
646
- �⤷���ǥ��쥯�ȥ�� depend�Ȥ����ե����뤬¸�ߤ���С�
647
- Makefile����¸�ط�������å����Ƥ���ޤ���
644
+ If the file named depend exists, Makefile will include that file to
645
+ check dependency. You can make this file by invoking
648
646
649
647
% gcc -MM *.c > depend
650
648
651
- �ʤɤǺ�뤳�Ȥ�����ޤ������ä�»��̵���Ǥ��礦��
649
+ It's no harm. Prepare it.
652
650
653
651
(7) MANIFEST�ե�����˥ե�����̾�������
654
652
655
- % ls > MANIFEST
653
+ % find * -type f -print > MANIFEST
656
654
% vi MANIFEST
657
655
658
- *.o, *~�ʤ���ɬ�פʥե�����ʳ���MANIFEST���ɲä��Ƥ����ޤ���
659
- make���ˤ�MANIFEST�����Ƥϻ��Ȥ��ޤ���Τǡ����ΤޤޤǤ�����
660
- �ϵ����ޤ����ѥå������λ��˻��Ȥ��뤳�Ȥ�����Τȡ�
661
- ɬ�פʥե��������̤Ǥ���Τǡ��Ѱդ��Ƥ����������ɤ��Ǥ���
662
- ����
656
+ Append file names into MANIFEST. The compilation scheme requires
657
+ MANIFEST only to be exist. But, you'd better take this step to
658
+ distinguish required files.
663
659
664
660
(8) make
665
661
@@ -676,9 +672,9 @@ so that you can inspect the module by the debugger.
676
672
677
673
(10) done, now you have the extension library
678
674
679
- ��Ϥ��ä���Ȥ��ʤꡤ������������ʤꡤ���ʤꡤ����ͳ�ˤ�
680
- �Ȥ����������� Ruby�κ�Ԥϳ�ĥ�饤�֥��˴ؤ��ư��ڤθ�����
681
- ��ĥ���ޤ���
675
+ You can do anything you want with your library. The author of Ruby
676
+ will not claim any restriction about your code depending Ruby API.
677
+ Feel free to use, modify, distribute or sell your program.
682
678
683
679
Appendix A. Ruby�Υ����������ɤ�ʬ��
684
680
@@ -737,7 +733,7 @@ class library
737
733
struct.c
738
734
time.c
739
735
740
- Appendix B. ��ĥ�Ѵؿ���ե����
736
+ Appendix B. Ruby extension API reference
741
737
742
738
C���줫��Ruby�ε�ǽ�����Ѥ���API�ϰʲ����̤�Ǥ��롥
743
739
@@ -764,7 +760,7 @@ const: Qtrue object(default true value)
764
760
765
761
const: Qfalse object
766
762
767
- ** C�ǡ����Υ��ץ��벽
763
+ ** C pointer wrapping
768
764
769
765
Data_Wrap_Struct(VALUE class, void (*mark)(), void (*free)(), void *sval)
770
766
@@ -783,33 +779,33 @@ type
783
779
784
780
data����type���Υݥ�����Ф��ѿ�sval����������ޥ�����
785
781
786
- ** ���饹/�⥸�塼�����
782
+ ** defining class/module
787
783
788
784
VALUE rb_define_class(char *name, VALUE super)
789
785
790
- super�Υ��֥��饹�Ȥ��ƿ����� Ruby���饹��������롥
786
+ Defines new Ruby class as subclass of super.
791
787
792
788
VALUE rb_define_class_under(VALUE module, char *name, VALUE super)
793
789
794
- super�Υ��֥��饹�Ȥ��ƿ����� Ruby���饹��������� module����
795
- ���Ȥ���������롥
790
+ Creates new Ruby class as subclass of super, under the module's
791
+ namespace.
796
792
797
793
VALUE rb_define_module(char *name)
798
794
799
- ������ Ruby�⥸�塼���������롥
795
+ Defines new Ruby module.
800
796
801
797
VALUE rb_define_module_under(VALUE module, char *name, VALUE super)
802
798
803
- ������ Ruby�⥸�塼���������� module������Ȥ���������롥
799
+ Defines new Ruby module, under the modules's namespace.
804
800
805
801
void rb_include_module(VALUE class, VALUE module)
806
802
807
- �⥸�塼��롼�ɤ��롥class�����Ǥ� module�롼
808
- �ɤ��Ƥ�����ˤϲ��⤷�ʤ�(¿�ť��롼�ɤζػ�)��
803
+ Includes module into class. If class already includes it, just
804
+ ignore.
809
805
810
806
void rb_extend_object(VALUE object, VALUE module)
811
807
812
- ���֥������Ȥ�⥸�塼��(���������Ƥ����å�)�dz�ĥ���롥
808
+ Extend the object with module's attribute.
813
809
814
810
** Defining Global Variables
815
811
@@ -871,19 +867,20 @@ Defines global contant. This is just work as
871
867
872
868
rb_define_method(VALUE class, char *name, VALUE (*func)(), int argc)
873
869
874
- ��åɤ�������롥argc��self����������ο���argc��-1�λ�,
875
- �ؿ��ˤϰ����ο�(self��ޤޤʤ�)����1����, �������������2��
876
- ���Ȥ��������Ϳ������(��3������ self)�� argc��-2�λ�, ��1��
877
- ���� self, ��2������ args(args�ϰ�����ޤ� Ruby������)�Ȥ�����
878
- ����Ϳ�����롥
870
+ Defines a method for the class. func is the function pointer. argc
871
+ is the number of arguments. if argc is -1, the function will receive
872
+ 3 arguments argc, argv, and self. if argc is -2, the function will
873
+ receive 2 arguments, self and args, where args is the Ruby array of
874
+ the method arguments.
879
875
880
876
rb_define_private_method(VALUE class, char *name, VALUE (*func)(), int argc)
881
877
882
- private��åɤ�������롥������rb_define_method()��Ʊ����
878
+ Defines a private method for the class. Arguments are same as
879
+ rb_define_method().
883
880
884
881
rb_define_singleton_method(VALUE class, char *name, VALUE (*func)(), int argc)
885
882
886
- �ðۥ�åɤ�������롥������ rb_define_method()��Ʊ����
883
+ Defines a singleton method. Arguments are same as rb_define_method().
887
884
888
885
rb_scan_args(int atgc, VALUE *argv, char *fmt, ...)
889
886
@@ -899,42 +896,40 @@ argc,argv
899
896
900
897
VALUE rb_funcall(VALUE recv, ID mid, int narg, ...)
901
898
902
- ��åɸƤӽФ���ʸ���� mid�����뤿��ˤ� rb_intern()��Ȥ���
899
+ Invokes the method. To retrieve mid from method name, use rb_intern().
903
900
904
901
VALUE rb_funcall2(VALUE recv, ID mid, int argc, VALUE *argv)
905
902
906
- ��åɸƤӽФ���������argc,argv�������Ϥ���
903
+ Invokes method, passing arguments by array of values.
907
904
908
905
VALUE rb_eval_string(char *str)
909
906
910
- ʸ����� Ruby�ȥ�����ץȤ��ƥ���ѥ��롦�¹Ԥ��롥
907
+ Compiles and executes the string as Ruby program.
911
908
912
909
ID rb_intern(char *name)
913
910
914
- ʸ������б�����ID���֤���
911
+ Returns ID corresponding the name.
915
912
916
913
char *rb_id2name(ID id)
917
914
918
- ID���б�����ʸ������֤�(�ǥХå���)��
915
+ Returns the name corresponding ID.
919
916
920
917
char *rb_class2name(VALUE class)
921
918
922
- class��̾�����֤�(�ǥХå���)��class��̾��������ʤ����ˤ�,
923
- ������̤ä�̾������ĥ��饹��̾�����֤���
919
+ Returns the name of the class.
924
920
925
- ** �������ѿ�
921
+ ** Instance Variables
926
922
927
923
VALUE rb_iv_get(VALUE obj, char *name)
928
924
929
- obj�Υ������ѿ����ͤ����롥`@'�ǻϤޤ�ʤ�������
930
- �ѿ��� Ruby�ץ�����फ�饢�������Ǥ��ʤ��ֱ��줿�ץ���
931
- ���ѿ��ˤʤ롥
925
+ Retrieve the value of the instance variable. If the name is not
926
+ prefixed by `@', that variable shall be inaccessible from Ruby.
932
927
933
928
VALUE rb_iv_set(VALUE obj, char *name, VALUE val)
934
929
935
- obj�Υ������ѿ���val�˥��åȤ��롥
930
+ Sets the value of the instance variable.
936
931
937
- ** ���湽¤
932
+ ** Control Structure
938
933
939
934
VALUE rb_iterate(VALUE (*func1)(), void *arg1, VALUE (*func2)(), void *arg2)
940
935
@@ -1024,6 +1019,6 @@ this method, the compilation will not be done.
1024
1019
1025
1020
/*
1026
1021
* Local variables:
1027
- * fill-column: 60
1022
+ * fill-column: 70
1028
1023
* end:
1029
1024
*/
0 commit comments