summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog9
-rw-r--r--README.EXT106
-rw-r--r--README.EXT.jp122
-rw-r--r--eval.c33
-rw-r--r--object.c1
-rw-r--r--version.h4
6 files changed, 146 insertions, 129 deletions
diff --git a/ChangeLog b/ChangeLog
index 63ad0140d7..9ac2f02892 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,12 @@
+Thu Oct 5 18:02:39 2000 Yukihiro Matsumoto <[email protected]>
+
+ * object.c (rb_obj_dup): should have propagated taint flag.
+ (ruby-bugs:#PR64,65)
+
+Wed Oct 4 00:26:11 2000 Yukihiro Matsumoto <[email protected]>
+
+ * eval.c (proc_arity): proc{|a|}'s arity should be -1.
+
Mon Oct 2 05:28:58 2000 akira yamada <[email protected]>
* string.c (trnext): minus at the end of pattern.
diff --git a/README.EXT b/README.EXT
index 12d379e09b..5079adb558 100644
--- a/README.EXT
+++ b/README.EXT
@@ -38,11 +38,13 @@ Ruby interpreter has data-types as below:
T_TRUE true
T_FALSE false
T_DATA data
+ T_SYMBOL symbol
Otherwise, there are several other types used internally:
T_ICLASS
T_MATCH
+ T_UNDEF
T_VARMAP
T_SCOPE
T_NODE
@@ -141,25 +143,25 @@ interpreter. Useful functions are listed below (not all):
String functions
- rb_str_new(char *ptr, int len)
+ rb_str_new(const char *ptr, long len)
Creates a new Ruby string.
- rb_str_new2(char *ptr)
+ rb_str_new2(const char *ptr)
Creates a new Ruby string from C string. This is equivalent to
rb_str_new(ptr, strlen(ptr)).
- rb_tainted_str_new(char *ptr, int len)
+ rb_tainted_str_new(const char *ptr, long len)
Creates a new tainted Ruby string. Strings from external data
should be tainted.
- rb_tainted_str_new2(char *ptr)
+ rb_tainted_str_new2(const char *ptr)
Creates a new tainted Ruby string from C string.
- rb_str_cat(VALUE str, char *ptr, int len)
+ rb_str_cat(VALUE str, const char *ptr, long len)
Appends len bytes data from ptr to the Ruby string.
@@ -169,16 +171,16 @@ interpreter. Useful functions are listed below (not all):
Creates an array with no element.
- rb_ary_new2(int len)
+ rb_ary_new2(long len)
Creates an array with no element, with allocating internal buffer
for len elements.
- rb_ary_new3(int n, ...)
+ rb_ary_new3(long n, ...)
Creates an n-elements array from arguments.
- rb_ary_new4(int n, VALUE *elts)
+ rb_ary_new4(long n, VALUE *elts)
Creates an n-elements array from C array.
@@ -186,7 +188,6 @@ interpreter. Useful functions are listed below (not all):
rb_ary_pop(VALUE ary)
rb_ary_shift(VALUE ary)
rb_ary_unshift(VALUE ary, VALUE val)
- rb_ary_entry(VALUE ary, int idx)
Array operations. The first argument to each functions must be an
array. They may dump core if other types given.
@@ -206,25 +207,25 @@ interpreter. Ruby provides the API to define things below:
To define class or module, use functions below:
- VALUE rb_define_class(char *name, VALUE super)
- VALUE rb_define_module(char *name)
+ VALUE rb_define_class(const char *name, VALUE super)
+ VALUE rb_define_module(const char *name)
These functions return the newly created class or module. You may
want to save this reference into the variable to use later.
To define nested class or module, use functions below:
- VALUE rb_define_class_under(VALUE outer, char *name, VALUE super)
- VALUE rb_define_module_under(VALUE outer, char *name)
+ VALUE rb_define_class_under(VALUE outer, const char *name, VALUE super)
+ VALUE rb_define_module_under(VALUE outer, const char *name)
2.1.2 Method/singleton method definition
To define methods or singleton methods, use functions below:
- void rb_define_method(VALUE klass, char *name,
+ void rb_define_method(VALUE klass, const char *name,
VALUE (*func)(), int argc)
- void rb_define_singleton_method(VALUE object, char *name,
+ void rb_define_singleton_method(VALUE object, const char *name,
VALUE (*func)(), int argc)
The `argc' represents the number of the arguments to the C function,
@@ -251,7 +252,7 @@ actual arguments.
There're two more functions to define method. One is to define
private method:
- void rb_define_private_method(VALUE klass, char *name,
+ void rb_define_private_method(VALUE klass, const char *name,
VALUE (*func)(), int argc)
The other is to define module function, which is private AND singleton
@@ -267,13 +268,13 @@ or
To define module function
- void rb_define_module_function(VALUE module, char *name,
+ void rb_define_module_function(VALUE module, const char *name,
VALUE (*func)(), int argc)
Oh, in addition, function-like method, which is private method defined
in Kernel module, can be defined using:
- void rb_define_global_function(char *name, VALUE (*func)(), int argc)
+ void rb_define_global_function(const char *name, VALUE (*func)(), int argc)
To define alias to the method,
@@ -283,8 +284,8 @@ To define alias to the method,
We have 2 functions to define constants:
- void rb_define_const(VALUE klass, char *name, VALUE val)
- void rb_define_global_const(char *name, VALUE val)
+ void rb_define_const(VALUE klass, const char *name, VALUE val)
+ void rb_define_global_const(const char *name, VALUE val)
The former is to define constant under specified class/module. The
latter is to define global constant.
@@ -298,7 +299,7 @@ There are several ways to invoke Ruby's features from C code.
Easiest way to call Ruby's function from C program is to evaluate the
string as Ruby program. This function will do the job.
- VALUE rb_eval_string(char *str)
+ VALUE rb_eval_string(const char *str)
Evaluation is done under current context, thus current local variables
of the innermost method (which is defined by Ruby) can be accessed.
@@ -314,10 +315,7 @@ It can be accessed from Ruby in the form like:
You can get the symbol value from string within C code, by using
- rb_intern(char *name)
-
-In addition, the symbols for one character operators (e.g +) is the
-code for that character.
+ rb_intern(const char *name)
2.2.3 Invoke Ruby method from C
@@ -367,7 +365,7 @@ Ruby nil in C scope.
Information can be shared between two worlds, using shared global
variables. To define them, you can use functions listed below:
- void rb_define_variable(char *name, VALUE *var)
+ void rb_define_variable(const char *name, VALUE *var)
This function defines the variable which is shared by the both world.
The value of the global variable pointed by `var', can be accessed
@@ -376,20 +374,20 @@ through Ruby's global variable named `name'.
You can define read-only (from Ruby, of course) variable by the
function below.
- void rb_define_readonly_variable(char *name, VALUE *var)
+ void rb_define_readonly_variable(const char *name, VALUE *var)
You can defined hooked variables. The accessor functions (getter and
setter) are called on access to the hooked variables.
- void rb_define_hooked_variable(char *name, VALUE *var,
- VALUE (*getter)(), VALUE (*setter)())
+ void rb_define_hooked_variable(constchar *name, VALUE *var,
+ VALUE (*getter)(), void (*setter)())
If you need to supply either setter or getter, just supply 0 for the
hook you don't need. If both hooks are 0, rb_define_hooked_variable()
works just like rb_define_variable().
- void rb_define_virtual_variable(char *name,
- VALUE (*getter)(), VALUE (*setter)())
+ void rb_define_virtual_variable(const char *name,
+ VALUE (*getter)(), void (*setter)())
This function defines the Ruby global variable without corresponding C
variable. The value of the variable will be set/get only by hooks.
@@ -756,20 +754,20 @@ the variable sval.
** defining class/module
- VALUE rb_define_class(char *name, VALUE super)
+ VALUE rb_define_class(const char *name, VALUE super)
Defines new Ruby class as subclass of super.
- VALUE rb_define_class_under(VALUE module, char *name, VALUE super)
+ VALUE rb_define_class_under(VALUE module, const char *name, VALUE super)
Creates new Ruby class as subclass of super, under the module's
namespace.
- VALUE rb_define_module(char *name)
+ VALUE rb_define_module(const char *name)
Defines new Ruby module.
- VALUE rb_define_module_under(VALUE module, char *name, VALUE super)
+ VALUE rb_define_module_under(VALUE module, const char *name, VALUE super)
Defines new Ruby module, under the module's namespace.
@@ -784,18 +782,18 @@ Extend the object with module's attribute.
** Defining Global Variables
- void rb_define_variable(char *name, VALUE *var)
+ void rb_define_variable(const char *name, VALUE *var)
Defines a global variable which is shared between C and Ruby. If name
contains the character which is not allowed to be part of the symbol,
it can't be seen from Ruby programs.
- void rb_define_readonly_variable(char *name, VALUE *var)
+ void rb_define_readonly_variable(const char *name, VALUE *var)
Defines a read-only global variable. Works just like
rb_define_variable(), except defined variable is read-only.
- void rb_define_virtual_variable(char *name,
+ void rb_define_virtual_variable(const char *name,
VALUE (*getter)(), VALUE (*setter)())
Defines a virtual variable, whose behavior is defined by pair of C
@@ -808,7 +806,7 @@ variable. The prototype for getter/setter functions are:
The getter function must return the value for the access.
- void rb_define_hooked_variable(char *name, VALUE *var,
+ void rb_define_hooked_variable(const char *name, VALUE *var,
VALUE (*getter)(), VALUE (*setter)())
Defines hooked variable. It's virtual variable with C variable. The
@@ -828,11 +826,11 @@ Tells GC to protect these variables.
** Constant Definition
- void rb_define_const(VALUE klass, char *name, VALUE val)
+ void rb_define_const(VALUE klass, const char *name, VALUE val)
Defines a new constant under the class/module.
- void rb_define_global_const(char *name, VALUE val)
+ void rb_define_global_const(const char *name, VALUE val)
Defines global constant. This is just work as
@@ -840,7 +838,7 @@ Defines global constant. This is just work as
** Method Definition
- rb_define_method(VALUE klass, char *name, VALUE (*func)(), int argc)
+ rb_define_method(VALUE klass, const char *name, VALUE (*func)(), int argc)
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
@@ -848,16 +846,16 @@ is the number of arguments. if argc is -1, the function will receive
receive 2 arguments, self and args, where args is the Ruby array of
the method arguments.
- rb_define_private_method(VALUE klass, char *name, VALUE (*func)(), int argc)
+ rb_define_private_method(VALUE klass, const char *name, VALUE (*func)(), int argc)
Defines a private method for the class. Arguments are same as
rb_define_method().
- rb_define_singleton_method(VALUE klass, char *name, VALUE (*func)(), int argc)
+ rb_define_singleton_method(VALUE klass, const char *name, VALUE (*func)(), int argc)
Defines a singleton method. Arguments are same as rb_define_method().
- rb_scan_args(int argc, VALUE *argv, char *fmt, ...)
+ rb_scan_args(int argc, VALUE *argv, const char *fmt, ...)
Retrieve argument from argc, argv. The fmt is the format string for
the arguments, such as "12" for 1 non-optional argument, 2 optional
@@ -875,11 +873,11 @@ Invokes the method. To retrieve mid from method name, use rb_intern().
Invokes method, passing arguments by array of values.
- VALUE rb_eval_string(char *str)
+ VALUE rb_eval_string(const char *str)
Compiles and executes the string as Ruby program.
- ID rb_intern(char *name)
+ ID rb_intern(const char *name)
Returns ID corresponding the name.
@@ -897,12 +895,12 @@ Returns true if the object responds to the message specified by id.
** Instance Variables
- VALUE rb_iv_get(VALUE obj, char *name)
+ VALUE rb_iv_get(VALUE obj, const char *name)
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)
+ VALUE rb_iv_set(VALUE obj, const char *name, VALUE val)
Sets the value of the instance variable.
@@ -933,26 +931,26 @@ rb_ensure() is that of func1.
** Exceptions and Errors
- void rb_warn(char *fmt, ...)
+ void rb_warn(const char *fmt, ...)
Prints warning message according to the printf-like format.
- void rb_warning(char *fmt, ...)
+ void rb_warning(const char *fmt, ...)
Prints warning message according to the printf-like format, if
$VERBOSE is true.
- void rb_raise(VALUE exception, char *fmt, ...)
+ void rb_raise(VALUE exception, const char *fmt, ...)
Raises an exception of class exception. The fmt is the format string
just like printf().
- void rb_fatal(char *fmt, ...)
+ void rb_fatal(const char *fmt, ...)
Raises fatal error, terminates the interpreter. No exception handling
will be done for fatal error, but ensure blocks will be executed.
- void rb_bug(char *fmt, ...)
+ void rb_bug(const char *fmt, ...)
Terminates the interpreter immediately. This function should be
called under the situation caused by the bug in the interpreter. No
diff --git a/README.EXT.jp b/README.EXT.jp
index e8be946d68..0db954818e 100644
--- a/README.EXT.jp
+++ b/README.EXT.jp
@@ -43,11 +43,13 @@ Ruby�ˤϥ桼�����Ȥ���ǽ���Τ���ʲ��Υ����פ�����ޤ���
T_TRUE ��
T_FALSE ��
T_DATA �ǡ���
+ T_SYMBOL ����ܥ�
����¾�����������Ѥ���Ƥ���ʲ��Υ����פ�����ޤ���
T_ICLASS
T_MATCH
+ T_UNDEF
T_VARMAP
T_SCOPE
T_NODE
@@ -171,26 +173,26 @@ Ruby���Ѱդ��Ƥ���ؿ����Ѥ��Ƥ���������
ʸ������Ф���ؿ�
- rb_str_new(char *ptr, int len)
+ rb_str_new(const char *ptr, long len)
������Ruby��ʸ������������롥
- rb_str_new2(char *ptr)
+ rb_str_new2(const char *ptr)
C��ʸ���󤫤�Ruby��ʸ������������롥���δؿ��ε�ǽ��
rb_str_new(ptr, strlen(ptr))��Ʊ���Ǥ��롥
- rb_tainted_str_new(char *ptr, int len)
+ rb_tainted_str_new(const char *ptr, long len)
�����ޡ������ղä��줿������Ruby��ʸ������������롥����
����Υǡ����˴�Ť�ʸ����ˤϱ����ޡ������ղä����٤�
�Ǥ��롥
- rb_tainted_str_new2(char *ptr)
+ rb_tainted_str_new2(const char *ptr)
C��ʸ���󤫤�����ޡ������ղä��줿Ruby��ʸ������������롥
- rb_str_cat(VALUE str, char *ptr, int len)
+ rb_str_cat(VALUE str, const char *ptr, long len)
Ruby��ʸ����str��len�Х��Ȥ�ʸ����ptr���ɲä��롥
@@ -200,16 +202,16 @@ Ruby���Ѱդ��Ƥ���ؿ����Ѥ��Ƥ���������
���Ǥ�0��������������롥
- rb_ary_new2(int len)
+ rb_ary_new2(long len)
���Ǥ�0��������������롥len����ʬ���ΰ�򤢤餫������
���ƤƤ�����
- rb_ary_new3(int n, ...)
+ rb_ary_new3(long n, ...)
�����ǻ��ꤷ��n���Ǥ�ޤ�������������롥
- rb_ary_new4(int n, VALUE *elts)
+ rb_ary_new4(long n, VALUE *elts)
�����Ϳ����n���Ǥ�������������롥
@@ -217,7 +219,6 @@ Ruby���Ѱդ��Ƥ���ؿ����Ѥ��Ƥ���������
rb_ary_pop(VALUE ary)
rb_ary_shift(VALUE ary)
rb_ary_unshift(VALUE ary, VALUE val)
- rb_ary_entry(VALUE ary, int idx)
Array��Ʊ̾�Υ᥽�åɤ�Ʊ��Ư���򤹤�ؿ�����1������ɬ��
����Ǥʤ���Фʤ�ʤ���
@@ -245,8 +246,8 @@ Ruby���󶡤���Ƥ���ؿ���Ȥ���Ruby���󥿥ץ꥿�˿�������ǽ
���饹��⥸�塼���������뤿��ˤϡ��ʲ��δؿ���Ȥ��ޤ���
- VALUE rb_define_class(char *name, VALUE super)
- VALUE rb_define_module(char *name)
+ VALUE rb_define_class(const char *name, VALUE super)
+ VALUE rb_define_module(const char *name)
�����δؿ��Ͽ�����������줿���饹��⥸�塼����֤��ޤ���
�᥽�åɤ����������ˤ������ͤ�ɬ�פʤΤǡ��ۤȤ�ɤξ��
@@ -255,17 +256,17 @@ Ruby���󶡤���Ƥ���ؿ���Ȥ���Ruby���󥿥ץ꥿�˿�������ǽ
���饹��⥸�塼���¾�Υ��饹�������˥ͥ��Ȥ�������������
�ϰʲ��δؿ���Ȥ��ޤ���
- VALUE rb_define_class_under(VALUE outer, char *name, VALUE super)
- VALUE rb_define_module_under(VALUE outer, char *name)
+ VALUE rb_define_class_under(VALUE outer, const char *name, VALUE super)
+ VALUE rb_define_module_under(VALUE outer, const char *name)
2.1.2 �᥽�å�/�ðۥ᥽�å����
�᥽�åɤ��ðۥ᥽�åɤ��������ˤϰʲ��δؿ���Ȥ��ޤ���
- void rb_define_method(VALUE klass, char *name,
+ void rb_define_method(VALUE klass, const char *name,
VALUE (*func)(), int argc)
- void rb_define_singleton_method(VALUE object, char *name,
+ void rb_define_singleton_method(VALUE object, const char *name,
VALUE (*func)(), int argc)
@@ -287,7 +288,7 @@ argc��-1�λ��ϰ����������������Ϥ���ޤ���argc��-2�λ��ϰ�
�᥽�åɤ��������ؿ��Ϥ⤦��Ĥ���ޤ����ҤȤĤ�private��
���åɤ��������ؿ��ǡ�������rb_define_method()��Ʊ���Ǥ���
- void rb_define_private_method(VALUE klass, char *name,
+ void rb_define_private_method(VALUE klass, const char *name,
VALUE (*func)(), int argc)
private�᥽�åɤȤϴؿ������Ǥ����ƤӽФ����Ȥν���ʤ��᥽��
@@ -308,13 +309,13 @@ private�᥽�åɤȤϴؿ������Ǥ����ƤӽФ����Ȥν���ʤ��᥽��
�Ȥ��������Ǥ�Ȥ��ޤ����⥸�塼��ؿ����������ؿ��ϰʲ���
�̤�Ǥ���
- void rb_define_module_function(VALUE module, char *name,
+ void rb_define_module_function(VALUE module, const char *name,
VALUE (*func)(), int argc)
�ؿ�Ū�᥽�å�(Kernel�⥸�塼���private method)��������뤿
��δؿ��ϰʲ����̤�Ǥ���
- void rb_define_global_function(char *name, VALUE (*func)(), int argc)
+ void rb_define_global_function(const char *name, VALUE (*func)(), int argc)
�᥽�åɤ���̾��������뤿��δؿ��ϰʲ����̤�Ǥ���
@@ -326,8 +327,8 @@ private�᥽�åɤȤϴؿ������Ǥ����ƤӽФ����Ȥν���ʤ��᥽��
��ĥ�饤�֥�꤬ɬ�פ�����Ϥ��餫����������Ƥ����������ɤ�
�Ǥ��礦��������������ؿ�����Ĥ���ޤ���
- void rb_define_const(VALUE klass, char *name, VALUE val)
- void rb_define_global_const(char *name, VALUE val)
+ void rb_define_const(VALUE klass, const char *name, VALUE val)
+ void rb_define_global_const(const char *name, VALUE val)
���Ԥ�����Υ��饹/�⥸�塼���°�����������������Ρ���
�Ԥϥ������Х���������������ΤǤ���
@@ -348,7 +349,7 @@ private�᥽�åɤȤϴؿ������Ǥ����ƤӽФ����Ȥν���ʤ��᥽��
C����Ruby�ε�ǽ��ƤӽФ���äȤ��ñ����ˡ�Ȥ��ơ�ʸ�����
Ϳ����줿Ruby�Υץ�������ɾ������ʲ��δؿ�������ޤ���
- VALUE rb_eval_string(char *str)
+ VALUE rb_eval_string(const char *str)
����ɾ���ϸ��ߤδĶ��ǹԤ��ޤ����Ĥޤꡤ���ߤΥ��������ѿ�
�ʤɤ�����Ѥ��ޤ���
@@ -365,11 +366,10 @@ ID�Ȥ��ѿ�̾���᥽�å�̾��ɽ�������Ǥ���Ruby����Ǥ�
�ǥ��������Ǥ��ޤ���C���餳�����������뤿��ˤϴؿ�
- rb_intern(char *name)
+ rb_intern(const char *name)
-��Ȥ��ޤ����ޤ���ʸ���α黻�ҤϤ���ʸ�������ɤ����Τޤޥ���
-�ܥ�ˤʤäƤ��ޤ���Ruby��������Ȥ���Ϳ����줿����ܥ�(��
-����ʸ����)��ID���Ѵ�����ˤϰʲ��δؿ���Ȥ��ޤ���
+��Ȥ��ޤ���Ruby��������Ȥ���Ϳ����줿����ܥ�(�ޤ���ʸ��
+��)��ID���Ѵ�����ˤϰʲ��δؿ���Ȥ��ޤ���
rb_to_id(VALUE symbol)
@@ -432,7 +432,7 @@ C��Ruby������ѿ���Ȥäƾ����ͭ�Ǥ��ޤ�����ͭ�Ǥ������
�ѿ��ˤϤ����Ĥ��μ��ब����ޤ������Τʤ��Ǥ�äȤ��ɤ��Ȥ�
���Ȼפ���Τ�rb_define_variable()�Ǥ���
- void rb_define_variable(char *name, VALUE *var)
+ void rb_define_variable(const char *name, VALUE *var)
���δؿ���Ruby��C�ȤǶ�ͭ��������ѿ���������ޤ����ѿ�̾��
`$'�ǻϤޤ�ʤ����ˤϼ�ưŪ���ɲä���ޤ��������ѿ����ͤ���
@@ -441,14 +441,14 @@ C��Ruby������ѿ���Ȥäƾ����ͭ�Ǥ��ޤ�����ͭ�Ǥ������
�ޤ�Ruby¦����Ϲ����Ǥ��ʤ��ѿ��⤢��ޤ�������read only��
�ѿ��ϰʲ��δؿ���������ޤ���
- void rb_define_readonly_variable(char *name, VALUE *var)
+ void rb_define_readonly_variable(const char *name, VALUE *var)
������ѿ���¾��hook��Ĥ�������ѿ�������Ǥ��ޤ���hook�դ�
������ѿ��ϰʲ��δؿ����Ѥ���������ޤ���hook�դ�����ѿ���
�ͤλ��Ȥ������hook�ǹԤ�ɬ�פ�����ޤ���
- void rb_define_hooked_variable(char *name, VALUE *var,
- VALUE (*getter)(), VALUE (*setter)())
+ void rb_define_hooked_variable(const char *name, VALUE *var,
+ VALUE (*getter)(), void (*setter)())
���δؿ���C�δؿ��ˤ�ä�hook�ΤĤ���줿����ѿ����������
�����ѿ������Ȥ��줿���ˤϴؿ�getter�����ѿ����ͤ����åȤ���
@@ -460,8 +460,8 @@ setter��0����ꤷ�ޤ���
���줫�顤C�δؿ��ˤ�äƼ¸������Ruby������ѿ����������
�ؿ�������ޤ���
- void rb_define_virtual_variable(char *name,
- VALUE (*getter)(), VALUE (*setter)())
+ void rb_define_virtual_variable(const char *name,
+ VALUE (*getter)(), void (*setter)())
���δؿ��ˤ�ä�������줿Ruby������ѿ������Ȥ��줿���ˤ�
getter�����ѿ����ͤ����åȤ��줿���ˤ�setter���ƤФ�ޤ���
@@ -551,7 +551,7 @@ MANIFEST�Ȥ����ե�����ϡ���Ū��󥯤�make�λ��˥ǥ��쥯�ȥ�
�ޤ��������ʤ�Ǥ����ɡ��ɤ�������ǽ��¸����뤫�ɤ����ޤ���
�פ���ɬ�פ�����ޤ����ɤ�ʥ��饹��Ĥ��뤫�����Υ��饹�ˤ�
�ɤ�ʥ᥽�åɤ����뤫�����饹���󶡤�������ʤɤˤĤ����߷�
-���ޤ���dbm���饹�ˤĤ��Ƥ�ext/dbm.doc�򻲾Ȥ��Ƥ���������
+���ޤ���
(4) C�����ɤ��
@@ -911,20 +911,20 @@ rb_str_new2(s)
** ���饹/�⥸�塼�����
-VALUE rb_define_class(char *name, VALUE super)
+VALUE rb_define_class(const char *name, VALUE super)
super�Υ��֥��饹�Ȥ��ƿ�����Ruby���饹��������롥
-VALUE rb_define_class_under(VALUE module, char *name, VALUE super)
+VALUE rb_define_class_under(VALUE module, const char *name, VALUE super)
super�Υ��֥��饹�Ȥ��ƿ�����Ruby���饹���������module��
����Ȥ���������롥
-VALUE rb_define_module(char *name)
+VALUE rb_define_module(const char *name)
������Ruby�⥸�塼���������롥
-VALUE rb_define_module_under(VALUE module, char *name, VALUE super)
+VALUE rb_define_module_under(VALUE module, const char *name, VALUE super)
������Ruby�⥸�塼����������module������Ȥ���������롥
@@ -939,27 +939,27 @@ void rb_extend_object(VALUE object, VALUE module)
** ����ѿ����
-void rb_define_variable(char *name, VALUE *var)
+void rb_define_variable(const char *name, VALUE *var)
Ruby��C�ȤǶ�ͭ���륰�����Х��ѿ���������롥�ѿ�̾��`$'��
�Ϥޤ�ʤ����ˤϼ�ưŪ���ɲä���롥name�Ȥ���Ruby�μ��̻�
�Ȥ��Ƶ�����ʤ�ʸ��(�㤨��` ')��ޤ���ˤ�Ruby�ץ�����
�फ��ϸ����ʤ��ʤ롥
-void rb_define_readonly_variable(char *name, VALUE *var)
+void rb_define_readonly_variable(const char *name, VALUE *var)
Ruby��C�ȤǶ�ͭ����read only�Υ������Х��ѿ���������롥
read only�Ǥ��뤳�Ȱʳ���rb_define_variable()��Ʊ����
-void rb_define_virtual_variable(char *name,
- VALUE (*getter)(), VALUE (*setter)())
+void rb_define_virtual_variable(const char *name,
+ VALUE (*getter)(), void (*setter)())
�ؿ��ˤ�äƼ¸������Ruby�ѿ���������롥�ѿ������Ȥ��줿
���ˤ�getter�����ѿ����ͤ����åȤ��줿���ˤ�setter���ƤФ�
�롥
-void rb_define_hooked_variable(char *name, VALUE *var,
- VALUE (*getter)(), VALUE (*setter)())
+void rb_define_hooked_variable(const char *name, VALUE *var,
+ VALUE (*getter)(), void (*setter)())
�ؿ��ˤ�ä�hook�ΤĤ���줿�������Х��ѿ���������롥�ѿ�
�����Ȥ��줿���ˤ�getter�����ؿ����ͤ����åȤ��줿���ˤ�
@@ -973,21 +973,21 @@ void rb_global_variable(VALUE *var)
** ���
-void rb_define_const(VALUE klass, char *name, VALUE val)
+void rb_define_const(VALUE klass, const char *name, VALUE val)
�����������롥
-void rb_define_global_const(char *name, VALUE val)
+void rb_define_global_const(const char *name, VALUE val)
��������������롥
- rb_define_const(cKernal, name, val)
+ rb_define_const(rb_cObject, name, val)
��Ʊ����̣��
** �᥽�å����
-rb_define_method(VALUE klass, char *name, VALUE (*func)(), int argc)
+rb_define_method(VALUE klass, const char *name, VALUE (*func)(), int argc)
�᥽�åɤ�������롥argc��self����������ο���argc��-1�λ�,
�ؿ��ˤϰ����ο�(self��ޤޤʤ�)����1����, �������������2
@@ -995,15 +995,15 @@ rb_define_method(VALUE klass, char *name, VALUE (*func)(), int argc)
��1������self, ��2������args(args�ϰ�����ޤ�Ruby������)��
����������Ϳ�����롥
-rb_define_private_method(VALUE klass, char *name, VALUE (*func)(), int argc)
+rb_define_private_method(VALUE klass, const char *name, VALUE (*func)(), int argc)
private�᥽�åɤ�������롥������rb_define_method()��Ʊ����
-rb_define_singleton_method(VALUE klass, char *name, VALUE (*func)(), int argc)
+rb_define_singleton_method(VALUE klass, const char *name, VALUE (*func)(), int argc)
�ðۥ᥽�åɤ�������롥������rb_define_method()��Ʊ����
-rb_scan_args(int argc, VALUE *argv, char *fmt, ...)
+rb_scan_args(int argc, VALUE *argv, const char *fmt, ...)
argc, argv������Ϳ����줿������ʬ�򤹤롥fmt��ɬ�ܰ����ο�,
�ղð����ο�, �Ĥ�ΰ��������뤫����ꤹ��ʸ�����, "����
@@ -1024,11 +1024,11 @@ VALUE rb_funcall2(VALUE recv, ID mid, int argc, VALUE *argv)
�᥽�åɸƤӽФ���������argc, argv�������Ϥ���
-VALUE rb_eval_string(char *str)
+VALUE rb_eval_string(const char *str)
ʸ�����Ruby������ץȤȤ��ƥ���ѥ��롦�¹Ԥ��롥
-ID rb_intern(char *name)
+ID rb_intern(const char *name)
ʸ������б�����ID���֤���
@@ -1047,20 +1047,20 @@ int rb_respond_to(VALUE obj, ID id)
** ���󥹥����ѿ�
-VALUE rb_iv_get(VALUE obj, char *name)
+VALUE rb_iv_get(VALUE obj, const char *name)
obj�Υ��󥹥����ѿ����ͤ����롥`@'�ǻϤޤ�ʤ����󥹥���
���ѿ��� Ruby�ץ�����फ�饢�������Ǥ��ʤ��ֱ��줿�ץ���
�������ѿ��ˤʤ롥�������ʸ����̾������ĥ��饹(�ޤ���
�⥸�塼��)�Υ��󥹥����ѿ��Ȥ��Ƽ�������Ƥ��롥
-VALUE rb_iv_set(VALUE obj, char *name, VALUE val)
+VALUE rb_iv_set(VALUE obj, const char *name, VALUE val)
obj�Υ��󥹥����ѿ���val�˥��åȤ��롥
** ���湽¤
-VALUE rb_iterate(VALUE (*func1)(), void *arg1, VALUE (*func2)(), void *arg2)
+VALUE rb_iterate(VALUE (*func1)(), VALUE arg1, VALUE (*func2)(), VALUE arg2)
func2��֥��å��Ȥ������ꤷ, func1�򥤥ƥ졼���Ȥ��ƸƤ֡�
func1�ˤ� arg1�������Ȥ����Ϥ���, func2�ˤ���1�����˥��ƥ졼
@@ -1070,14 +1070,14 @@ VALUE rb_yield(VALUE val)
val���ͤȤ��ƥ��ƥ졼���֥��å���ƤӽФ���
-VALUE rb_rescue(VALUE (*func1)(), void *arg1, VALUE (*func2)(), void *arg2)
+VALUE rb_rescue(VALUE (*func1)(), VALUE arg1, VALUE (*func2)(), VALUE arg2)
�ؿ�func1��arg1������˸ƤӽФ���func1�μ¹�����㳰��ȯ��
�������ˤ� func2��arg2������Ȥ��ƸƤ֡�����ͤ��㳰��ȯ��
���ʤ��ä�����func1�������, �㳰��ȯ���������ˤ�func2����
���ͤǤ��롥
-VALUE rb_ensure(VALUE (*func1)(), void *arg1, void (*func2)(), void *arg2)
+VALUE rb_ensure(VALUE (*func1)(), VALUE arg1, void (*func2)(), VALUE arg2)
�ؿ�func1��arg1������Ȥ��Ƽ¹Ԥ�, �¹Խ�λ��(���Ȥ��㳰��
ȯ�����Ƥ�) func2��arg2������Ȥ��Ƽ¹Ԥ��롥����ͤ�func1
@@ -1085,27 +1085,27 @@ VALUE rb_ensure(VALUE (*func1)(), void *arg1, void (*func2)(), void *arg2)
** �㳰�����顼
-void rb_warning(char *fmt, ...)
+void rb_warning(const char *fmt, ...)
rb_verbose����ɸ�२�顼���Ϥ˷ٹ�����ɽ�����롥������
printf()��Ʊ����
-void rb_raise(rb_eRuntimeError, char *fmt, ...)
+void rb_raise(rb_eRuntimeError, const char *fmt, ...)
RuntimeError�㳰��ȯ�������롥������printf()��Ʊ����
-void rb_raise(VALUE exception, char *fmt, ...)
+void rb_raise(VALUE exception, const char *fmt, ...)
exception�ǻ��ꤷ���㳰��ȯ�������롥fmt�ʲ��ΰ�����
printf()��Ʊ����
-void rb_fatal(char *fmt, ...)
+void rb_fatal(const char *fmt, ...)
��̿Ū�㳰��ȯ�������롥�̾���㳰�����ϹԤʤ�줺, ���󥿡�
�ץ꥿����λ����(������ensure�ǻ��ꤵ�줿�����ɤϽ�λ����
�¹Ԥ����)��
-void rb_bug(char *fmt, ...)
+void rb_bug(const char *fmt, ...)
���󥿡��ץ꥿�ʤɥץ������ΥХ��Ǥ���ȯ������Ϥ��Τʤ�
�����λ��Ƥ֡����󥿡��ץ꥿�ϥ�������פ�ľ���˽�λ���롥
diff --git a/eval.c b/eval.c
index de6da1d62f..88b2cf346e 100644
--- a/eval.c
+++ b/eval.c
@@ -3986,15 +3986,24 @@ static int STACK_LEVEL_MAX = 655300;
extern VALUE *rb_gc_stack_start;
static int
-stack_length()
+stack_length(p)
+ VALUE **p;
{
- VALUE pos;
+#ifdef C_ALLOCA
+ VALUE stack_end;
+ alloca(0);
+# define STACK_END (&stack_end)
+#else
+ VALUE *stack_end = alloca(1);
+# define STACK_END (stack_end)
+#endif
+ if (p) *p = STACK_END;
#ifdef sparc
- return rb_gc_stack_start - &pos + 0x80;
+ return rb_gc_stack_start - STACK_END + 0x80;
#else
- return (&pos < rb_gc_stack_start) ? rb_gc_stack_start - &pos
- : &pos - rb_gc_stack_start;
+ return (STACK_END < rb_gc_stack_start) ? rb_gc_stack_start - STACK_END
+ : STACK_END - rb_gc_stack_start;
#endif
}
@@ -4113,7 +4122,7 @@ rb_call0(klass, recv, id, argc, argv, body, nosuper)
if ((++tick & 0xff) == 0) {
CHECK_INTS; /* better than nothing */
- if (stack_length() > STACK_LEVEL_MAX) {
+ if (stack_length(0) > STACK_LEVEL_MAX) {
rb_raise(rb_eSysStackError, "stack level too deep");
}
}
@@ -6111,7 +6120,7 @@ proc_arity(proc)
if (data->var == 0) return INT2FIX(-1);
switch (nd_type(data->var)) {
default:
- return INT2FIX(-2);
+ return INT2FIX(-1);
case NODE_MASGN:
list = data->var->nd_head;
n = 0;
@@ -6736,15 +6745,15 @@ static void
rb_thread_save_context(th)
rb_thread_t th;
{
- VALUE v;
+ VALUE *pos;
int len;
- len = stack_length();
+ len = stack_length(&pos);
th->stk_len = 0;
- th->stk_pos = (rb_gc_stack_start<(VALUE*)&v)?rb_gc_stack_start
- :rb_gc_stack_start - len;
- if (len > th->stk_max) {
+ th->stk_pos = (rb_gc_stack_start<pos)?rb_gc_stack_start
+ :rb_gc_stack_start - len;
+ if (len > th->stk_max) {
REALLOC_N(th->stk_ptr, VALUE, len);
th->stk_max = len;
}
diff --git a/object.c b/object.c
index 3574c6f23a..cfc1f125c6 100644
--- a/object.c
+++ b/object.c
@@ -113,6 +113,7 @@ rb_obj_dup(obj)
}
if (!SPECIAL_CONST_P(dup)) {
OBJSETUP(dup, rb_obj_type(obj), BUILTIN_TYPE(obj));
+ OBJ_INFECT(dup, obj);
}
return dup;
}
diff --git a/version.h b/version.h
index 849a4f9ea5..0064b66cad 100644
--- a/version.h
+++ b/version.h
@@ -1,4 +1,4 @@
#define RUBY_VERSION "1.6.1"
-#define RUBY_RELEASE_DATE "2000-10-02"
+#define RUBY_RELEASE_DATE "2000-10-05"
#define RUBY_VERSION_CODE 161
-#define RUBY_RELEASE_CODE 20001002
+#define RUBY_RELEASE_CODE 20001005