summaryrefslogtreecommitdiff
path: root/README.EXT
diff options
context:
space:
mode:
authormatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2003-03-20 06:27:22 +0000
committermatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2003-03-20 06:27:22 +0000
commit85dd7bb0ef28fe4ce63641e653d92e42327b0207 (patch)
treebcd1e5b816c1a7cdc06f31f28cd967f6b78e9a96 /README.EXT
parent5782e5b0006ca5f941e8cdd7101ca07218c9d816 (diff)
* eval.c (load_dyna): clear ruby_errinfo. (ruby-bugs-ja PR#409)
* io.c (read_all): make str empty if given. (ruby-bugs-ja PR#408) * io.c (io_read): ditto. * io.c (rb_io_sysread): ditto. * range.c: do not override min and max. * sprintf.c (remove_sign_bits): octal left most digit for negative numbers may be '3'. (ruby-bugs-ja PR#407) * sprintf.c (rb_f_sprintf): should prefix sign bits if bignum is negative, using sign_bits(). * eval.c (avalue_to_mrhs): split argument passing and assignment conversion. * eval.c (svalue_to_mrhs): ditto. * eval.c (avalue_to_svalue): avalue_to_svalue([[1,2]]) should be [[1,2]], not [1,2] to wrap-around. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@3584 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'README.EXT')
-rw-r--r--README.EXT30
1 files changed, 29 insertions, 1 deletions
diff --git a/README.EXT b/README.EXT
index 95c5ddea61..4bbe1202e6 100644
--- a/README.EXT
+++ b/README.EXT
@@ -35,6 +35,7 @@ The Ruby interpreter has the following data types:
T_HASH associative array
T_STRUCT (Ruby) structure
T_BIGNUM multi precision integer
+ T_FILE IO
T_TRUE true
T_FALSE false
T_DATA data
@@ -93,7 +94,9 @@ The T_FIXNUM data is a 31bit length fixed integer (63bit length on
some machines), which can be convert to a C integer by using the
FIX2INT() macro. There is also NUM2INT() which converts any Ruby
numbers into C integers. The NUM2INT() macro includes a type check, so
-an exception will be raised if the conversion failed.
+an exception will be raised if the conversion failed. There are also
+a macro NUM2DBL() to retrieve the double float value and STR2CSTR() is
+useful to get the string as char*.
Other data types have corresponding C structures, e.g. struct RArray
for T_ARRAY etc. The VALUE of the type which has corresponding structure
@@ -488,6 +491,8 @@ Init_dbm()
rb_define_method(cDBM, "[]", fdbm_fetch, 1);
:
+ /* ID for a instance variable to store DBM data */
+ id_dbm = rb_intern("dbm");
}
--
@@ -756,6 +761,25 @@ sval, and returns the DATA encapsulating the pointer to memory region.
This macro retrieves the pointer value from DATA, and assigns it to
the variable sval.
+** Checking data types
+
+TYPE(value)
+FIXNUM_P(value)
+NIL_P(value)
+void Check_Type(VALUE value, int type)
+void Check_SafeStr(VALUE value)
+
+** Data type conversion
+
+FIX2INT(value)
+INT2FIX(i)
+NUM2INT(value)
+INT2NUM(i)
+NUM2DBL(value)
+rb_float_new(f)
+STR2CSTR(value)
+rb_str_new2(s)
+
** defining class/module
VALUE rb_define_class(const char *name, VALUE super)
@@ -944,6 +968,10 @@ Prints a warning message according to a printf-like format.
Prints a warning message according to a printf-like format, if
$VERBOSE is true.
+void rb_raise(rb_eRuntimeError, const char *fmt, ...)
+
+Raises RuntimeError. The fmt is a format string just like printf().
+
void rb_raise(VALUE exception, const char *fmt, ...)
Raises a class exception. The fmt is a format string just like printf().