summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog5
-rw-r--r--README.EXT1164
-rw-r--r--README.EXT.ja863
3 files changed, 1038 insertions, 994 deletions
diff --git a/ChangeLog b/ChangeLog
index a3cfbba..2585384 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+Tue Dec 4 08:33:46 2012 Eric Hodel <drbrain@segment7.net>
+
+ * README.EXT: Converted to RDoc format
+ * README.EXT.ja: ditto
+
Tue Dec 4 08:32:10 2012 Eric Hodel <drbrain@segment7.net>
* lib/rdoc/ri/driver.rb: Fixed ri page display for files with
diff --git a/README.EXT b/README.EXT
index d81debc..ba74e5c 100644
--- a/README.EXT
+++ b/README.EXT
@@ -1,8 +1,8 @@
-.\" README.EXT - -*- Text -*- created at: Mon Aug 7 16:45:54 JST 1995
+# README.EXT - -*- RDoc -*- created at: Mon Aug 7 16:45:54 JST 1995
This document explains how to make extension libraries for Ruby.
-1. Basic knowledge
+= Basic Knowledge
In C, variables have types and data do not have types. In contrast,
Ruby variables do not have a static type, and data themselves have
@@ -13,47 +13,46 @@ has its data-type.
To retrieve C data from a VALUE, you need to:
- (1) Identify the VALUE's data type
- (2) Convert the VALUE into C data
+1. Identify the VALUE's data type
+2. Convert the VALUE into C data
Converting to the wrong data type may cause serious problems.
-
-1.1 Data-types
+== Data-Types
The Ruby interpreter has the following data types:
- T_NIL nil
- T_OBJECT ordinary object
- T_CLASS class
- T_MODULE module
- T_FLOAT floating point number
- T_STRING string
- T_REGEXP regular expression
- T_ARRAY array
- T_HASH associative array
- T_STRUCT (Ruby) structure
- T_BIGNUM multi precision integer
- T_FIXNUM Fixnum(31bit or 63bit integer)
- T_COMPLEX complex number
- T_RATIONAL rational number
- T_FILE IO
- T_TRUE true
- T_FALSE false
- T_DATA data
- T_SYMBOL symbol
+T_NIL :: nil
+T_OBJECT :: ordinary object
+T_CLASS :: class
+T_MODULE :: module
+T_FLOAT :: floating point number
+T_STRING :: string
+T_REGEXP :: regular expression
+T_ARRAY :: array
+T_HASH :: associative array
+T_STRUCT :: (Ruby) structure
+T_BIGNUM :: multi precision integer
+T_FIXNUM :: Fixnum(31bit or 63bit integer)
+T_COMPLEX :: complex number
+T_RATIONAL :: rational number
+T_FILE :: IO
+T_TRUE :: true
+T_FALSE :: false
+T_DATA :: data
+T_SYMBOL :: symbol
In addition, there are several other types used internally:
- T_ICLASS
- T_MATCH
- T_UNDEF
- T_NODE
- T_ZOMBIE
+T_ICLASS :: included module
+T_MATCH :: MatchData object
+T_UNDEF :: undefined
+T_NODE :: syntax tree node
+T_ZOMBIE :: object awaiting finalization
Most of the types are represented by C structures.
-1.2 Check Data Type of the VALUE
+== Check Data Type of the VALUE
The macro TYPE() defined in ruby.h shows the data type of the VALUE.
TYPE() returns the constant number T_XXXX described above. To handle
@@ -87,7 +86,7 @@ There are also faster check macros for fixnums and nil.
FIXNUM_P(obj)
NIL_P(obj)
-1.3 Convert VALUE into C data
+== Convert VALUE into C Data
The data for type T_NIL, T_FALSE, T_TRUE are nil, false, true
respectively. They are singletons for the data type.
@@ -137,17 +136,17 @@ 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 bugs.
-1.4 Convert C data into VALUE
+== Convert C Data into VALUE
To convert C data to Ruby values:
- * FIXNUM
+FIXNUM ::
- left shift 1 bit, and turn on LSB.
+ left shift 1 bit, and turn on LSB.
- * Other pointer values
+Other pointer values::
- cast to VALUE.
+ cast to VALUE.
You can determine whether a VALUE is pointer or not by checking its LSB.
@@ -157,149 +156,149 @@ structures are defined in <ruby.h>.
To convert C numbers to Ruby values, use these macros.
- INT2FIX() for integers within 31bits.
- INT2NUM() for arbitrary sized integer.
+INT2FIX() :: for integers within 31bits.
+INT2NUM() :: for arbitrary sized integer.
INT2NUM() converts an integer into a Bignum if it is out of the FIXNUM
range, but is a bit slower.
-1.5 Manipulating Ruby data
+== Manipulating Ruby Data
As I already mentioned, it is not recommended to modify an object's
internal structure. To manipulate objects, use the functions supplied
by the Ruby interpreter. Some (not all) of the useful functions are
listed below:
- String functions
+=== String Functions
- rb_str_new(const char *ptr, long len)
+rb_str_new(const char *ptr, long len) ::
- Creates a new Ruby string.
+ Creates a new Ruby string.
- rb_str_new2(const char *ptr)
- rb_str_new_cstr(const char *ptr)
+rb_str_new2(const char *ptr) ::
+rb_str_new_cstr(const char *ptr) ::
- Creates a new Ruby string from a C string. This is equivalent to
- rb_str_new(ptr, strlen(ptr)).
+ Creates a new Ruby string from a C string. This is equivalent to
+ rb_str_new(ptr, strlen(ptr)).
- rb_tainted_str_new(const char *ptr, long len)
+rb_tainted_str_new(const char *ptr, long len) ::
- Creates a new tainted Ruby string. Strings from external data
- sources should be tainted.
+ Creates a new tainted Ruby string. Strings from external data
+ sources should be tainted.
- rb_tainted_str_new2(const char *ptr)
- rb_tainted_str_new_cstr(const char *ptr)
+rb_tainted_str_new2(const char *ptr) ::
+rb_tainted_str_new_cstr(const char *ptr) ::
- Creates a new tainted Ruby string from a C string.
+ Creates a new tainted Ruby string from a C string.
- rb_sprintf(const char *format, ...)
- rb_vsprintf(const char *format, va_list ap)
+rb_sprintf(const char *format, ...) ::
+rb_vsprintf(const char *format, va_list ap) ::
- Creates a new Ruby string with printf(3) format.
+ Creates a new Ruby string with printf(3) format.
- rb_str_cat(VALUE str, const char *ptr, long len)
+rb_str_cat(VALUE str, const char *ptr, long len) ::
- Appends len bytes of data from ptr to the Ruby string.
+ Appends len bytes of data from ptr to the Ruby string.
- rb_str_cat2(VALUE str, const char* ptr)
+rb_str_cat2(VALUE str, const char* ptr) ::
- Appends C string ptr to Ruby string str. This function is
- equivalent to rb_str_cat(str, ptr, strlen(ptr)).
+ Appends C string ptr to Ruby string str. This function is
+ equivalent to rb_str_cat(str, ptr, strlen(ptr)).
- rb_str_catf(VALUE str, const char* format, ...)
- rb_str_vcatf(VALUE str, const char* format, va_list ap)
+rb_str_catf(VALUE str, const char* format, ...) ::
+rb_str_vcatf(VALUE str, const char* format, va_list ap) ::
- Appends C string format and successive arguments to Ruby string
- str according to a printf-like format. These functions are
- equivalent to rb_str_cat2(str, rb_sprintf(format, ...)) and
- rb_str_cat2(str, rb_vsprintf(format, ap)), respectively.
+ Appends C string format and successive arguments to Ruby string
+ str according to a printf-like format. These functions are
+ equivalent to rb_str_cat2(str, rb_sprintf(format, ...)) and
+ rb_str_cat2(str, rb_vsprintf(format, ap)), respectively.
- rb_enc_str_new(const char *ptr, long len, rb_encoding *enc)
+rb_enc_str_new(const char *ptr, long len, rb_encoding *enc) ::
- Creates a new Ruby string with the specified encoding.
+ Creates a new Ruby string with the specified encoding.
- rb_usascii_str_new(const char *ptr, long len)
- rb_usascii_str_new_cstr(const char *ptr)
+rb_usascii_str_new(const char *ptr, long len) ::
+rb_usascii_str_new_cstr(const char *ptr) ::
- Creates a new Ruby string with encoding US-ASCII.
+ Creates a new Ruby string with encoding US-ASCII.
- rb_str_resize(VALUE str, long len)
+rb_str_resize(VALUE str, long len) ::
- Resizes Ruby string to len bytes. If str is not modifiable, this
- function raises an exception. The length of str must be set in
- advance. If len is less than the old length the content beyond
- len bytes is discarded, else if len is greater than the old length
- the content beyond the old length bytes will not be preserved but
- will be garbage. Note that RSTRING_PTR(str) may change by calling
- this function.
+ Resizes Ruby string to len bytes. If str is not modifiable, this
+ function raises an exception. The length of str must be set in
+ advance. If len is less than the old length the content beyond
+ len bytes is discarded, else if len is greater than the old length
+ the content beyond the old length bytes will not be preserved but
+ will be garbage. Note that RSTRING_PTR(str) may change by calling
+ this function.
- rb_str_set_len(VALUE str, long len)
+rb_str_set_len(VALUE str, long len) ::
- Sets the length of Ruby string. If str is not modifiable, this
- function raises an exception. This function preserves the content
- upto len bytes, regardless RSTRING_LEN(str). len must not exceed
- the capacity of str.
+ Sets the length of Ruby string. If str is not modifiable, this
+ function raises an exception. This function preserves the content
+ upto len bytes, regardless RSTRING_LEN(str). len must not exceed
+ the capacity of str.
- Array functions
+=== Array Functions
- rb_ary_new()
+rb_ary_new() ::
- Creates an array with no elements.
+ Creates an array with no elements.
- rb_ary_new2(long len)
+rb_ary_new2(long len) ::
- Creates an array with no elements, allocating internal buffer
- for len elements.
+ Creates an array with no elements, allocating internal buffer
+ for len elements.
- rb_ary_new3(long n, ...)
+rb_ary_new3(long n, ...) ::
- Creates an n-element array from the arguments.
+ Creates an n-element array from the arguments.
- rb_ary_new4(long n, VALUE *elts)
+rb_ary_new4(long n, VALUE *elts) ::
- Creates an n-element array from a C array.
+ Creates an n-element array from a C array.
- rb_ary_to_ary(VALUE obj)
+rb_ary_to_ary(VALUE obj) ::
- Converts the object into an array.
- Equivalent to Object#to_ary.
+ Converts the object into an array.
+ Equivalent to Object#to_ary.
- There are many functions to operate an array.
- They may dump core if other types are given.
+There are many functions to operate an array. They may dump core if other
+types are given.
- rb_ary_aref(argc, VALUE *argv, VALUE ary)
+rb_ary_aref(argc, VALUE *argv, VALUE ary) ::
- Equivaelent to Array#[].
+ Equivaelent to Array#[].
- rb_ary_entry(VALUE ary, long offset)
+rb_ary_entry(VALUE ary, long offset) ::
- ary[offset]
+ ary[offset]
- rb_ary_subseq(VALUE ary, long beg, long len)
+rb_ary_subseq(VALUE ary, long beg, long len) ::
- ary[beg, len]
+ ary[beg, len]
- rb_ary_push(VALUE ary, VALUE val)
- rb_ary_pop(VALUE ary)
- rb_ary_shift(VALUE ary)
- rb_ary_unshift(VALUE ary, VALUE val)
+rb_ary_push(VALUE ary, VALUE val) ::
+rb_ary_pop(VALUE ary) ::
+rb_ary_shift(VALUE ary) ::
+rb_ary_unshift(VALUE ary, VALUE val) ::
- rb_ary_cat(VALUE ary, const VALUE *ptr, long len)
+rb_ary_cat(VALUE ary, const VALUE *ptr, long len) ::
- Appends len elements of objects from ptr to the array.
+ Appends len elements of objects from ptr to the array.
-2. Extending Ruby with C
+= Extending Ruby with C
-2.1 Adding new features to Ruby
+== Adding New Features to Ruby
You can add new features (classes, methods, etc.) to the Ruby
interpreter. Ruby provides APIs for defining the following things:
- * Classes, Modules
- * Methods, Singleton Methods
- * Constants
+* Classes, Modules
+* Methods, Singleton Methods
+* Constants
-2.1.1 Class/module definition
+=== Class and Module Definition
To define a class or module, use the functions below:
@@ -314,7 +313,7 @@ To define nested classes or modules, use the functions below:
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
+=== Method and Singleton Method Definition
To define methods or singleton methods, use these functions:
@@ -346,7 +345,7 @@ where obj is the receiver, and args is the Ruby array containing
actual arguments.
There are some more functions to define methods. One takes an ID
-as the name of method to be defined. See 2.2.2 for IDs.
+as the name of method to be defined. See also ID or Symbol below.
void rb_define_method_id(VALUE klass, ID name,
VALUE (*func)(ANYARGS), int argc)
@@ -397,7 +396,7 @@ func has to take the klass as the argument and return a newly
allocated instance. This instance should be as empty as possible,
without any expensive (including external) resources.
-2.1.3 Constant definition
+=== Constant Definition
We have 2 functions to define constants:
@@ -407,11 +406,11 @@ We have 2 functions to define constants:
The former is to define a constant under specified class/module. The
latter is to define a global constant.
-2.2 Use Ruby features from C
+== Use Ruby Features from C
There are several ways to invoke Ruby's features from C code.
-2.2.1 Evaluate Ruby Programs in a String
+=== Evaluate Ruby Programs in a String
The easiest way to use Ruby's functionality from a C program is to
evaluate the string as Ruby program. This function will do the job:
@@ -429,8 +428,7 @@ function:
It returns nil when an error occur. Moreover, *state is zero if str was
successfully evaluated, or nonzero otherwise.
-
-2.2.2 ID or Symbol
+=== ID or Symbol
You can invoke methods directly, without parsing the string. First I
need to explain about ID. ID is the integer number to represent
@@ -438,9 +436,11 @@ Ruby's identifiers such as variable names. The Ruby data type
corresponding to ID is Symbol. It can be accessed from Ruby in the
form:
- :Identifier
+ :Identifier
+
or
- :"any kind of string"
+
+ :"any kind of string"
You can get the ID value from a string within C code by using
@@ -469,7 +469,7 @@ and to convert Ruby Symbol object to ID, use
ID SYM2ID(VALUE symbol)
-2.2.3 Invoke Ruby method from C
+=== Invoke Ruby Method from C
To invoke methods directly, you can use the function below
@@ -478,7 +478,7 @@ To invoke methods directly, you can use the function below
This function invokes a method on the recv, with the method name
specified by the symbol mid.
-2.2.4 Accessing the variables and constants
+=== Accessing the Variables and Constants
You can access class variables and instance variables using access
functions. Also, global variables can be shared between both
@@ -495,11 +495,11 @@ To access the constants of the class/module:
VALUE rb_const_get(VALUE obj, ID id)
-See 2.1.3 for defining new constant.
+See also Constant Definition above.
-3. Information sharing between Ruby and C
+= Information Sharing Between Ruby and C
-3.1 Ruby constants that C can be accessed from C
+=== Ruby Constants That C Can Be Accessed From C
As stated in section 1.3,
the following Ruby constants can be referred from C.
@@ -513,7 +513,7 @@ Boolean values. Qfalse is false in C also (i.e. 0).
Ruby nil in C scope.
-3.2 Global variables shared between C and Ruby
+== Global Variables Shared Between C and Ruby
Information can be shared between the two environments using shared global
variables. To define them, you can use functions listed below:
@@ -557,7 +557,7 @@ The prototypes of the getter and setter functions are as follows:
void (*setter)(VALUE val, ID id);
-3.3 Encapsulate C data into a Ruby object
+== Encapsulate C Data into a Ruby Object
To wrap and objectify a C pointer as a Ruby object (so called
DATA), use Data_Wrap_Struct().
@@ -597,23 +597,23 @@ A pointer to the structure will be assigned to the variable sval.
See the example below for details.
-4. Example - Creating dbm extension
+= Example - Creating dbm Extension
OK, here's the example of making an extension library. This is the
extension to access DBMs. The full source is included in the ext/
directory in the Ruby's source tree.
-(1) make the directory
+== Make the Directory
% mkdir ext/dbm
Make a directory for the extension library under ext directory.
-(2) design the library
+== Design the Library
You need to design the library features, before making it.
-(3) write C code.
+== Write the C Code
You need to write C code for your extension library. If your library
has only one source file, choosing ``LIBRARY.c'' as a file name is
@@ -630,41 +630,37 @@ the library.
Here's the example of an initializing function.
---
-void
-Init_dbm(void)
-{
- /* define DBM class */
- cDBM = rb_define_class("DBM", rb_cObject);
- /* DBM includes Enumerate module */
- rb_include_module(cDBM, rb_mEnumerable);
-
- /* DBM has class method open(): arguments are received as C array */
- rb_define_singleton_method(cDBM, "open", fdbm_s_open, -1);
-
- /* DBM instance method close(): no args */
- rb_define_method(cDBM, "close", fdbm_close, 0);
- /* DBM instance method []: 1 argument */
- rb_define_method(cDBM, "[]", fdbm_fetch, 1);
- :
-
- /* ID for a instance variable to store DBM data */
- id_dbm = rb_intern("dbm");
-}
---
+ void
+ Init_dbm(void)
+ {
+ /* define DBM class */
+ cDBM = rb_define_class("DBM", rb_cObject);
+ /* DBM includes Enumerate module */
+ rb_include_module(cDBM, rb_mEnumerable);
+
+ /* DBM has class method open(): arguments are received as C array */
+ rb_define_singleton_method(cDBM, "open", fdbm_s_open, -1);
+
+ /* DBM instance method close(): no args */
+ rb_define_method(cDBM, "close", fdbm_close, 0);
+ /* DBM instance method []: 1 argument */
+ rb_define_method(cDBM, "[]", fdbm_fetch, 1);
+
+ /* ... */
+
+ /* ID for a instance variable to store DBM data */
+ id_dbm = rb_intern("dbm");
+ }
The dbm extension wraps the dbm struct in the C environment using
Data_Make_Struct.
---
-struct dbmdata {
- int di_size;
- DBM *di_dbm;
-};
-
+ struct dbmdata {
+ int di_size;
+ DBM *di_dbm;
+ };
-obj = Data_Make_Struct(klass, struct dbmdata, 0, free_dbm, dbmp);
---
+ obj = Data_Make_Struct(klass, struct dbmdata, 0, free_dbm, dbmp);
This code wraps the dbmdata structure into a Ruby object. We avoid
wrapping DBM* directly, because we want to cache size information.
@@ -672,12 +668,10 @@ wrapping DBM* directly, because we want to cache size information.
To retrieve the dbmdata structure from a Ruby object, we define the
following macro:
---
-#define GetDBM(obj, dbmp) {\
- Data_Get_Struct(obj, struct dbmdata, dbmp);\
- if (dbmp->di_dbm == 0) closed_dbm();\
-}
---
+ #define GetDBM(obj, dbmp) {\
+ Data_Get_Struct(obj, struct dbmdata, dbmp);\
+ if (dbmp->di_dbm == 0) closed_dbm();\
+ }
This sort of complicated macro does the retrieving and close checking for
the DBM.
@@ -685,13 +679,11 @@ the DBM.
There are three kinds of way to receive method arguments. First,
methods with a fixed number of arguments receive arguments like this:
---
-static VALUE
-fdbm_delete(VALUE obj, VALUE keystr)
-{
- :
-}
---
+ static VALUE
+ fdbm_delete(VALUE obj, VALUE keystr)
+ {
+ /* ... */
+ }
The first argument of the C function is the self, the rest are the
arguments to the method.
@@ -699,17 +691,15 @@ arguments to the method.
Second, methods with an arbitrary number of arguments receive
arguments like this:
---
-static VALUE
-fdbm_s_open(int argc, VALUE *argv, VALUE klass)
-{
- :
- if (rb_scan_args(argc, argv, "11", &file, &vmode) == 1) {
- mode = 0666; /* default value */
- }
- :
-}
---
+ static VALUE
+ fdbm_s_open(int argc, VALUE *argv, VALUE klass)
+ {
+ /* ... */
+ if (rb_scan_args(argc, argv, "11", &file, &vmode) == 1) {
+ mode = 0666; /* default value */
+ }
+ /* ... */
+ }
The first argument is the number of method arguments, the second
argument is the C array of the method arguments, and the third
@@ -724,25 +714,21 @@ references.
The following is an example of a method that takes arguments by Ruby's
array:
---
-static VALUE
-thread_initialize(VALUE thread, VALUE args)
-{
- :
-}
---
+ static VALUE
+ thread_initialize(VALUE thread, VALUE args)
+ {
+ /* ... */
+ }
The first argument is the receiver, the second one is the Ruby array
which contains the arguments to the method.
-** Notice
-
-GC should know about global variables which refer to Ruby's objects, but
-are not exported to the Ruby world. You need to protect them by
+*Notice*: GC should know about global variables which refer to Ruby's objects,
+but are not exported to the Ruby world. You need to protect them by
void rb_global_variable(VALUE *var)
-(4) prepare extconf.rb
+== Prepare extconf.rb
If the file named extconf.rb exists, it will be executed to generate
Makefile.
@@ -791,7 +777,7 @@ If a compilation condition is not fulfilled, you should not call
``create_makefile''. The Makefile will not be generated, compilation will
not be done.
-(5) prepare depend (optional)
+== Prepare Depend (Optional)
If the file named depend exists, Makefile will include that file to
check dependencies. You can make this file by invoking
@@ -800,7 +786,7 @@ check dependencies. You can make this file by invoking
It's harmless. Prepare it.
-(6) generate Makefile
+== Generate Makefile
Try generating the Makefile by:
@@ -815,7 +801,7 @@ You don't need this step if you put the extension library under the ext
directory of the ruby source tree. In that case, compilation of the
interpreter will do this step for you.
-(7) make
+== Run make
Type
@@ -824,36 +810,38 @@ Type
to compile your extension. You don't need this step either if you have
put the extension library under the ext directory of the ruby source tree.
-(8) debug
+== Debug
You may need to rb_debug the extension. Extensions can be linked
statically by adding the directory name in the ext/Setup file so that
you can inspect the extension with the debugger.
-(9) done, now you have the extension library
+== Done! Now You Have the Extension Library
You can do anything you want with your library. The author of Ruby
will not claim any restrictions on your code depending on the Ruby API.
Feel free to use, modify, distribute or sell your program.
-Appendix A. Ruby source files overview
+= Appendix A. Ruby Source Files Overview
-ruby language core
+== Ruby Language Core
- class.c : classes and modules
- error.c : exception classes and exception mechanism
- gc.c : memory management
- load.c : library loading
- object.c : objects
- variable.c : variables and constants
+class.c :: classes and modules
+error.c :: exception classes and exception mechanism
+gc.c :: memory management
+load.c :: library loading
+object.c :: objects
+variable.c :: variables and constants
-ruby syntax parser
- parse.y
- -> parse.c : automatically generated
- keywords : reserved keywords
- -> lex.c : automatically generated
+== Ruby Syntax Parser
+
+parse.y :: grammar definition
+parse.c :: automatically generated from parse.y
+keywords :: reserved keywords
+lex.c :: automatically generated from keywords
+
+== Ruby Evaluator (a.k.a. YARV)
-ruby evaluator (a.k.a. YARV)
compile.c
eval.c
eval_error.c
@@ -878,7 +866,8 @@ ruby evaluator (a.k.a. YARV)
-> opt*.inc : automatically generated
-> vm.inc : automatically generated
-regular expression engine (oniguruma)
+== Regular Expression Engine (Oniguruma)
+
regex.c
regcomp.c
regenc.c
@@ -887,15 +876,15 @@ regular expression engine (oniguruma)
regparse.c
regsyntax.c
-utility functions
+== Utility Functions
- debug.c : debug symbols for C debuggger
- dln.c : dynamic loading
- st.c : general purpose hash table
- strftime.c : formatting times
- util.c : misc utilities
+debug.c :: debug symbols for C debuggger
+dln.c :: dynamic loading
+st.c :: general purpose hash table
+strftime.c :: formatting times
+util.c :: misc utilities
-ruby interpreter implementation
+== Ruby Interpreter Implementation
dmyext.c
dmydln.c
@@ -909,505 +898,564 @@ ruby interpreter implementation
gem_prelude.rb
prelude.rb
-
-class library
-
- array.c : Array
- bignum.c : Bignum
- compar.c : Comparable
- complex.c : Complex
- cont.c : Fiber, Continuation
- dir.c : Dir
- enum.c : Enumerable
- enumerator.c : Enumerator
- file.c : File
- hash.c : Hash
- io.c : IO
- marshal.c : Marshal
- math.c : Math
- numeric.c : Numeric, Integer, Fixnum, Float
- pack.c : Array#pack, String#unpack
- proc.c : Binding, Proc
- process.c : Process
- random.c : random number
- range.c : Range
- rational.c : Rational
- re.c : Regexp, MatchData
- signal.c : Signal
- sprintf.c :
- string.c : String
- struct.c : Struct
- time.c : Time
-
- defs/known_errors.def : Errno::* exception classes
- -> known_errors.inc : automatically generated
-
-multilingualization
- encoding.c : Encoding
- transcode.c : Encoding::Converter
- enc/*.c : encoding classes
- enc/trans/* : codepoint mapping tables
-
-goruby interpreter implementation
+== Class Library
+
+array.c :: Array
+bignum.c :: Bignum
+compar.c :: Comparable
+complex.c :: Complex
+cont.c :: Fiber, Continuation
+dir.c :: Dir
+enum.c :: Enumerable
+enumerator.c :: Enumerator
+file.c :: File
+hash.c :: Hash
+io.c :: IO
+marshal.c :: Marshal
+math.c :: Math
+numeric.c :: Numeric, Integer, Fixnum, Float
+pack.c :: Array#pack, String#unpack
+proc.c :: Binding, Proc
+process.c :: Process
+random.c :: random number
+range.c :: Range
+rational.c :: Rational
+re.c :: Regexp, MatchData
+signal.c :: Signal
+sprintf.c :: String#sprintf
+string.c :: String
+struct.c :: Struct
+time.c :: Time
+
+defs/known_errors.def :: Errno::* exception classes
+-> known_errors.inc :: automatically generated
+
+== Multilingualization
+
+encoding.c :: Encoding
+transcode.c :: Encoding::Converter
+enc/*.c :: encoding classes
+enc/trans/* :: codepoint mapping tables
+
+== goruby Interpreter Implementation
goruby.c
golf_prelude.rb : goruby specific libraries.
-> golf_prelude.c : automatically generated
-Appendix B. Ruby extension API reference
+= Appendix B. Ruby Extension API Reference
+
+== Types
+
+VALUE ::
+
+ The type for the Ruby object. Actual structures are defined in ruby.h,
+ such as struct RString, etc. To refer the values in structures, use
+ casting macros like RSTRING(obj).
+
+== Variables and Constants
+
+Qnil::
+ nil object
+
+Qtrue::
+ true object (default true value)
+
+Qfalse::
+ false object
+
+== C Pointer Wrapping
+
+Data_Wrap_Struct(VALUE klass, void (*mark)(), void (*free)(), void *sval) ::
+
+ Wrap a C pointer into a Ruby object. If object has references to other
+ Ruby objects, they should be marked by using the mark function during
+ the GC process. Otherwise, mark should be 0. When this object is no
+ longer referred by anywhere, the pointer will be discarded by free
+ function.
+
+Data_Make_Struct(klass, type, mark, free, sval) ::
+
+ This macro allocates memory using malloc(), assigns it to the variable
+ sval, and returns the DATA encapsulating the pointer to memory region.
+
+Data_Get_Struct(data, type, sval) ::
+
+ This macro retrieves the pointer value from DATA, and assigns it to
+ the variable sval.
+
+== Checking Data Types
+
+TYPE(value) ::
+
+ Internal type (T_NIL, T_FIXNUM, etc.)
+
+FIXNUM_P(value) ::
+
+ Is +value+ a Fixnum?
+
+NIL_P(value) ::
+
+ Is +value+ nil?
+
+void Check_Type(VALUE value, int type) ::
+
+ Ensures +value+ is of the given internal +type+ or raises a TypeError
+
+SaveStringValue(value) ::
+
+ Checks that +value+ is a String and is not tainted
+
+== Data Type Conversion
+
+FIX2INT(value), INT2FIX(i) ::
+
+ Fixnum <-> integer
+
+FIX2LONG(value), LONG2FIX(l) ::
+
+ Fixnum <-> long
+
+NUM2INT(value), INT2NUM(i) ::
+
+ Numeric <-> integer
+
+NUM2UINT(value), UINT2NUM(ui) ::
+
+ Numeric <-> unsigned integer
+
+NUM2LONG(value), LONG2NUM(l) ::
+
+ Numeric <-> long
+
+NUM2ULONG(value), ULONG2NUM(ul) ::
+
+ Numeric <-> unsigned long
+
+NUM2LL(value), LL2NUM(ll) ::
-** Types
+ Numeric <-> long long
- VALUE
+NUM2ULL(value), ULL2NUM(ull) ::
-The type for the Ruby object. Actual structures are defined in ruby.h,
-such as struct RString, etc. To refer the values in structures, use
-casting macros like RSTRING(obj).
+ Numeric <-> unsigned long long
-** Variables and constants
+NUM2OFFT(value), OFFT2NUM(off) ::
- Qnil
+ Numeric <-> off_t
-const: nil object
+NUM2SIZET(value), SIZET2NUM(size) ::
- Qtrue
+ Numeric <-> size_t
-const: true object(default true value)
+NUM2SSIZET(value), SSIZET2NUM(ssize) ::
- Qfalse
+ Numeric <-> ssize_t
-const: false object
+NUM2DBL(value) ::
-** C pointer wrapping
+ Numeric -> double
- Data_Wrap_Struct(VALUE klass, void (*mark)(), void (*free)(), void *sval)
+rb_float_new(f) ::
-Wrap a C pointer into a Ruby object. If object has references to other
-Ruby objects, they should be marked by using the mark function during
-the GC process. Otherwise, mark should be 0. When this object is no
-longer referred by anywhere, the pointer will be discarded by free
-function.
+ double -> Float
- Data_Make_Struct(klass, type, mark, free, sval)
+StringValue(value) ::
-This macro allocates memory using malloc(), assigns it to the variable
-sval, and returns the DATA encapsulating the pointer to memory region.
+ Object with #to_str -> String
- Data_Get_Struct(data, type, sval)
+StringValuePtr(value) ::
-This macro retrieves the pointer value from DATA, and assigns it to
-the variable sval.
+ Object with #to_str -> pointer to String data
-** Checking data types
+StringValueCStr(value) ::
-TYPE(value)
-FIXNUM_P(value)
-NIL_P(value)
-void Check_Type(VALUE value, int type)
-void Check_SafeStr(VALUE value)
+ Object with #to_str -> pointer to String data without NULL bytes
-** Data type conversion
+rb_str_new2(s) ::
-FIX2INT(value), INT2FIX(i)
-FIX2LONG(value), LONG2FIX(l)
-NUM2INT(value), INT2NUM(i)
-NUM2UINT(value), UINT2NUM(ui)
-NUM2LONG(value), LONG2NUM(l)
-NUM2ULONG(value), ULONG2NUM(ul)
-NUM2LL(value), LL2NUM(ll)
-NUM2ULL(value), ULL2NUM(ull)
-NUM2OFFT(value), OFFT2NUM(off)
-NUM2SIZET(value), SIZET2NUM(size)
-NUM2SSIZET(value), SSIZET2NUM(ssize)
-NUM2DBL(value)
-rb_float_new(f)
-StringValue(value)
-StringValuePtr(value)
-StringValueCStr(value)
-rb_str_new2(s)
+ char * -> String
-** defining class/module
+== Defining Class and Module
- VALUE rb_define_class(const char *name, VALUE super)
+VALUE rb_define_class(const char *name, VALUE super) ::
-Defines a new Ruby class as a subclass of super.
+ Defines a new Ruby class as a subclass of super.
- VALUE rb_define_class_under(VALUE module, const char *name, VALUE super)
+VALUE rb_define_class_under(VALUE module, const char *name, VALUE super) ::
-Creates a new Ruby class as a subclass of super, under the module's
-namespace.
+ Creates a new Ruby class as a subclass of super, under the module's
+ namespace.
- VALUE rb_define_module(const char *name)
+VALUE rb_define_module(const char *name) ::
-Defines a new Ruby module.
+ Defines a new Ruby module.
- VALUE rb_define_module_under(VALUE module, const char *name)
+VALUE rb_define_module_under(VALUE module, const char *name) ::
-Defines a new Ruby module under the module's namespace.
+ Defines a new Ruby module under the module's namespace.
- void rb_include_module(VALUE klass, VALUE module)
+void rb_include_module(VALUE klass, VALUE module) ::
-Includes module into class. If class already includes it, just
-ignored.
+ Includes module into class. If class already includes it, just ignored.
- void rb_extend_object(VALUE object, VALUE module)
+void rb_extend_object(VALUE object, VALUE module) ::
-Extend the object with the module's attributes.
+ Extend the object with the module's attributes.
-** Defining Global Variables
+== Defining Global Variables
- void rb_define_variable(const 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 a character which is not allowed to be part of the symbol,
-it can't be seen from Ruby programs.
+ Defines a global variable which is shared between C and Ruby. If name
+ contains a character which is not allowed to be part of the symbol,
+ it can't be seen from Ruby programs.
- void rb_define_readonly_variable(const 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 the defined variable is read-only.
+ Defines a read-only global variable. Works just like
+ rb_define_variable(), except the defined variable is read-only.
- void rb_define_virtual_variable(const char *name,
- VALUE (*getter)(), VALUE (*setter)())
+void rb_define_virtual_variable(const char *name, VALUE (*getter)(), VALUE (*setter)()) ::
-Defines a virtual variable, whose behavior is defined by a pair of C
-functions. The getter function is called when the variable is
-referenced. The setter function is called when the variable is set to a
-value. The prototype for getter/setter functions are:
+ Defines a virtual variable, whose behavior is defined by a pair of C
+ functions. The getter function is called when the variable is
+ referenced. The setter function is called when the variable is set to a
+ value. The prototype for getter/setter functions are:
- VALUE getter(ID id)
- void setter(VALUE val, ID id)
+ VALUE getter(ID id)
+ void setter(VALUE val, ID id)
-The getter function must return the value for the access.
+ The getter function must return the value for the access.
- void rb_define_hooked_variable(const char *name, VALUE *var,
- VALUE (*getter)(), VALUE (*setter)())
+void rb_define_hooked_variable(const char *name, VALUE *var, VALUE (*getter)(), VALUE (*setter)()) ::
-Defines hooked variable. It's a virtual variable with a C variable.
-The getter is called as
+ Defines hooked variable. It's a virtual variable with a C variable.
+ The getter is called as
- VALUE getter(ID id, VALUE *var)
+ VALUE getter(ID id, VALUE *var)
-returning a new value. The setter is called as
+ returning a new value. The setter is called as
- void setter(VALUE val, ID id, VALUE *var)
+ void setter(VALUE val, ID id, VALUE *var)
-GC requires C global variables which hold Ruby values to be marked.
+ GC requires C global variables which hold Ruby values to be marked.
- void rb_global_variable(VALUE *var)
+void rb_global_variable(VALUE *var)
-Tells GC to protect these variables.
+ Tells GC to protect these variables.
-** Constant Definition
+== Constant Definition
- void rb_define_const(VALUE klass, const char *name, VALUE val)
+void rb_define_const(VALUE klass, const char *name, VALUE val) ::
-Defines a new constant under the class/module.
+ Defines a new constant under the class/module.
- void rb_define_global_const(const char *name, VALUE val)
+void rb_define_global_const(const char *name, VALUE val) ::
-Defines a global constant. This is just the same as
+ Defines a global constant. This is just the same as
- rb_define_const(cKernal, name, val)
+ rb_define_const(cKernal, name, val)
-** Method Definition
+== Method Definition
- rb_define_method(VALUE klass, const 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
-3 arguments: argc, argv, and self. if argc is -2, the function will
-receive 2 arguments, self and args, where args is a Ruby array of
-the method arguments.
+ 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 a Ruby array of
+ the method arguments.
- rb_define_private_method(VALUE klass, const 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().
+ Defines a private method for the class. Arguments are same as
+ rb_define_method().
- rb_define_singleton_method(VALUE klass, const 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().
+ Defines a singleton method. Arguments are same as rb_define_method().
- rb_scan_args(int argc, VALUE *argv, const char *fmt, ...)
+rb_scan_args(int argc, VALUE *argv, const char *fmt, ...) ::
-Retrieve argument from argc and argv to given VALUE references
-according to the format string. The format can be described in ABNF
-as follows:
+ Retrieve argument from argc and argv to given VALUE references
+ according to the format string. The format can be described in ABNF
+ as follows:
---
-scan-arg-spec := param-arg-spec [option-hash-arg-spec] [block-arg-spec]
+ scan-arg-spec := param-arg-spec [option-hash-arg-spec] [block-arg-spec]
-param-arg-spec := pre-arg-spec [post-arg-spec] / post-arg-spec / pre-opt-post-arg-spec
-pre-arg-spec := num-of-leading-mandatory-args [num-of-optional-args]
-post-arg-spec := sym-for-variable-length-args [num-of-trailing-mandatory-args]
-pre-opt-post-arg-spec := num-of-leading-mandatory-args num-of-optional-args num-of-trailing-mandatory-args
-option-hash-arg-spec := sym-for-option-hash-arg
-block-arg-spec := sym-for-block-arg
+ param-arg-spec := pre-arg-spec [post-arg-spec] / post-arg-spec /
+ pre-opt-post-arg-spec
+ pre-arg-spec := num-of-leading-mandatory-args [num-of-optional-args]
+ post-arg-spec := sym-for-variable-length-args
+ [num-of-trailing-mandatory-args]
+ pre-opt-post-arg-spec := num-of-leading-mandatory-args num-of-optional-args
+ num-of-trailing-mandatory-args
+ option-hash-arg-spec := sym-for-option-hash-arg
+ block-arg-spec := sym-for-block-arg
-num-of-leading-mandatory-args := DIGIT ; The number of leading
- ; mandatory arguments
-num-of-optional-args := DIGIT ; The number of optional
- ; arguments
-sym-for-variable-length-args := "*" ; Indicates that variable
- ; length arguments are
- ; captured as a ruby array
-num-of-trailing-mandatory-args := DIGIT ; The number of trailing
- ; mandatory arguments
-sym-for-option-hash-arg := ":" ; Indicates that an option
- ; hash is captured if the last
- ; argument is a hash or can be
- ; converted to a hash with
- ; #to_hash. When the last
- ; argument is nil, it is
- ; captured if it is not
- ; ambiguous to take it as
- ; empty option hash; i.e. '*'
- ; is not specified and
- ; arguments are given more
- ; than sufficient.
-sym-for-block-arg := "&" ; Indicates that an iterator
- ; block should be captured if
- ; given
---
+ num-of-leading-mandatory-args := DIGIT ; The number of leading
+ ; mandatory arguments
+ num-of-optional-args := DIGIT ; The number of optional
+ ; arguments
+ sym-for-variable-length-args := "*" ; Indicates that variable
+ ; length arguments are
+ ; captured as a ruby array
+ num-of-trailing-mandatory-args := DIGIT ; The number of trailing
+ ; mandatory arguments
+ sym-for-option-hash-arg := ":" ; Indicates that an option
+ ; hash is captured if the last
+ ; argument is a hash or can be
+ ; converted to a hash with
+ ; #to_hash. When the last
+ ; argument is nil, it is
+ ; captured if it is not
+ ; ambiguous to take it as
+ ; empty option hash; i.e. '*'
+ ; is not specified and
+ ; arguments are given more
+ ; than sufficient.
+ sym-for-block-arg := "&" ; Indicates that an iterator
+ ; block should be captured if
+ ; given
-For example, "12" means that the method requires at least one
-argument, and at most receives three (1+2) arguments. So, the format
-string must be followed by three variable references, which are to be
-assigned to captured arguments. For omitted arguments, variables are
-set to Qnil. NULL can be put in place of a variable reference, which
-means the corresponding captured argument(s) should be just dropped.
+ For example, "12" means that the method requires at least one
+ argument, and at most receives three (1+2) arguments. So, the format
+ string must be followed by three variable references, which are to be
+ assigned to captured arguments. For omitted arguments, variables are
+ set to Qnil. NULL can be put in place of a variable reference, which
+ means the corresponding captured argument(s) should be just dropped.
-The number of given arguments, excluding an option hash or iterator
-block, is returned.
+ The number of given arguments, excluding an option hash or iterator
+ block, is returned.
-** Invoking Ruby method
+== Invoking Ruby method
- VALUE rb_funcall(VALUE recv, ID mid, int narg, ...)
+VALUE rb_funcall(VALUE recv, ID mid, int narg, ...) ::
-Invokes a method. To retrieve mid from a method name, use rb_intern().
+ Invokes a method. To retrieve mid from a method name, use rb_intern().
- VALUE rb_funcall2(VALUE recv, ID mid, int argc, VALUE *argv)
+VALUE rb_funcall2(VALUE recv, ID mid, int argc, VALUE *argv) ::
-Invokes a method, passing arguments by an array of values.
+ Invokes a method, passing arguments by an array of values.
- VALUE rb_eval_string(const char *str)
+VALUE rb_eval_string(const char *str) ::
-Compiles and executes the string as a Ruby program.
+ Compiles and executes the string as a Ruby program.
- ID rb_intern(const char *name)
+ID rb_intern(const char *name) ::
-Returns ID corresponding to the name.
+ Returns ID corresponding to the name.
- char *rb_id2name(ID id)
+char *rb_id2name(ID id) ::
-Returns the name corresponding ID.
+ Returns the name corresponding ID.
- char *rb_class2name(VALUE klass)
+char *rb_class2name(VALUE klass) ::
-Returns the name of the class.
+ Returns the name of the class.
- int rb_respond_to(VALUE object, ID id)
+int rb_respond_to(VALUE object, ID id) ::
-Returns true if the object responds to the message specified by id.
+ Returns true if the object responds to the message specified by id.
-** Instance Variables
+== Instance Variables
- VALUE rb_iv_get(VALUE obj, const 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.
+ 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, const char *name, VALUE val)
+VALUE rb_iv_set(VALUE obj, const char *name, VALUE val) ::
-Sets the value of the instance variable.
+ Sets the value of the instance variable.
-** Control Structure
+== Control Structure
- VALUE rb_block_call(VALUE recv, ID mid, int argc, VALUE * argv,
- VALUE (*func) (ANYARGS), VALUE data2)
+VALUE rb_block_call(VALUE recv, ID mid, int argc, VALUE * argv, VALUE (*func) (ANYARGS), VALUE data2) ::
-Calls a method on the recv, with the method name specified by the
-symbol mid, with argc arguments in argv, supplying func as the
-block. When func is called as the block, it will receive the value
-from yield as the first argument, and data2 as the second argument.
-When yielded with multiple values (in C, rb_yield_values(),
-rb_yield_values2() and rb_yield_splat()), data2 is packed as an Array,
-whereas yielded values can be gotten via argc/argv of the third/fourth
-arguments.
+ Calls a method on the recv, with the method name specified by the
+ symbol mid, with argc arguments in argv, supplying func as the
+ block. When func is called as the block, it will receive the value
+ from yield as the first argument, and data2 as the second argument.
+ When yielded with multiple values (in C, rb_yield_values(),
+ rb_yield_values2() and rb_yield_splat()), data2 is packed as an Array,
+ whereas yielded values can be gotten via argc/argv of the third/fourth
+ arguments.
- [OBSOLETE] VALUE rb_iterate(VALUE (*func1)(), void *arg1, VALUE (*func2)(), void *arg2)
+[OBSOLETE] VALUE rb_iterate(VALUE (*func1)(), void *arg1, VALUE (*func2)(), void *arg2) ::
-Calls the function func1, supplying func2 as the block. func1 will be
-called with the argument arg1. func2 receives the value from yield as
-the first argument, arg2 as the second argument.
+ Calls the function func1, supplying func2 as the block. func1 will be
+ called with the argument arg1. func2 receives the value from yield as
+ the first argument, arg2 as the second argument.
-When rb_iterate is used in 1.9, func1 has to call some Ruby-level method.
-This function is obsolete since 1.9; use rb_block_call instead.
+ When rb_iterate is used in 1.9, func1 has to call some Ruby-level method.
+ This function is obsolete since 1.9; use rb_block_call instead.
- VALUE rb_yield(VALUE val)
+VALUE rb_yield(VALUE val) ::
-Evaluates the block with value val.
+ Evaluates the block with value val.
- VALUE rb_rescue(VALUE (*func1)(), VALUE arg1, VALUE (*func2)(), VALUE arg2)
+VALUE rb_rescue(VALUE (*func1)(), VALUE arg1, VALUE (*func2)(), VALUE arg2) ::
-Calls the function func1, with arg1 as the argument. If an exception
-occurs during func1, it calls func2 with arg2 as the argument. The
-return value of rb_rescue() is the return value from func1 if no
-exception occurs, from func2 otherwise.
+ Calls the function func1, with arg1 as the argument. If an exception
+ occurs during func1, it calls func2 with arg2 as the argument. The
+ return value of rb_rescue() is the return value from func1 if no
+ exception occurs, from func2 otherwise.
- VALUE rb_ensure(VALUE (*func1)(), VALUE arg1, VALUE (*func2)(), VALUE arg2)
+VALUE rb_ensure(VALUE (*func1)(), VALUE arg1, VALUE (*func2)(), VALUE arg2) ::
-Calls the function func1 with arg1 as the argument, then calls func2
-with arg2 if execution terminated. The return value from
-rb_ensure() is that of func1 when no exception occured.
+ Calls the function func1 with arg1 as the argument, then calls func2
+ with arg2 if execution terminated. The return value from
+ rb_ensure() is that of func1 when no exception occured.
- VALUE rb_protect(VALUE (*func) (VALUE), VALUE arg, int *state)
+VALUE rb_protect(VALUE (*func) (VALUE), VALUE arg, int *state) ::
-Calls the function func with arg as the argument. If no exception
-occured during func, it returns the result of func and *state is zero.
-Otherwise, it returns Qnil and sets *state to nonzero. If state is
-NULL, it is not set in both cases.
-You have to clear the error info with rb_set_errinfo(Qnil) when
-ignoring the caught exception.
+ Calls the function func with arg as the argument. If no exception
+ occured during func, it returns the result of func and *state is zero.
+ Otherwise, it returns Qnil and sets *state to nonzero. If state is
+ NULL, it is not set in both cases.
+ You have to clear the error info with rb_set_errinfo(Qnil) when
+ ignoring the caught exception.
- void rb_jump_tag(int state)
+void rb_jump_tag(int state) ::
-Continues the exception caught by rb_protect() and rb_eval_string_protect().
-state must be the returned value from those functions. This function
-never return to the caller.
+ Continues the exception caught by rb_protect() and rb_eval_string_protect().
+ state must be the returned value from those functions. This function
+ never return to the caller.
- void rb_iter_break()
+void rb_iter_break() ::
-Exits from the current innermost block. This function never return to
-the caller.
+ Exits from the current innermost block. This function never return to
+ the caller.
- void rb_iter_break_value(VALUE value)
+void rb_iter_break_value(VALUE value) ::
-Exits from the current innermost block with the value. The block will
-return the given argument value. This function never return to the
-caller.
+ Exits from the current innermost block with the value. The block will
+ return the given argument value. This function never return to the
+ caller.
-** Exceptions and Errors
+== Exceptions and Errors
- void rb_warn(const char *fmt, ...)
+void rb_warn(const char *fmt, ...) ::
-Prints a warning message according to a printf-like format.
+ Prints a warning message according to a printf-like format.
- void rb_warning(const char *fmt, ...)
+void rb_warning(const char *fmt, ...) ::
-Prints a warning message according to a printf-like format, if
-$VERBOSE is true.
+ Prints a warning message according to a printf-like format, if
+ $VERBOSE is true.
-void rb_raise(rb_eRuntimeError, const char *fmt, ...)
+void rb_raise(rb_eRuntimeError, const char *fmt, ...) ::
-Raises RuntimeError. The fmt is a format string just like printf().
+ Raises RuntimeError. The fmt is a format string just like printf().
- void rb_raise(VALUE exception, const char *fmt, ...)
+void rb_raise(VALUE exception, const char *fmt, ...) ::
-Raises a class exception. The fmt is a format string just like printf().
+ Raises a class exception. The fmt is a format string just like printf().
- void rb_fatal(const char *fmt, ...)
+void rb_fatal(const char *fmt, ...) ::
-Raises a fatal error, terminates the interpreter. No exception handling
-will be done for fatal errors, but ensure blocks will be executed.
+ Raises a fatal error, terminates the interpreter. No exception handling
+ will be done for fatal errors, but ensure blocks will be executed.
- void rb_bug(const 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
-exception handling nor ensure execution will be done.
+ Terminates the interpreter immediately. This function should be
+ called under the situation caused by the bug in the interpreter. No
+ exception handling nor ensure execution will be done.
-** Initialize and Start the Interpreter
+== Initialize and Start the Interpreter
The embedding API functions are below (not needed for extension libraries):
- void ruby_init()
+void ruby_init() ::
-Initializes the interpreter.
+ Initializes the interpreter.
- void ruby_options(int argc, char **argv)
+void ruby_options(int argc, char **argv) ::
-Process command line arguments for the interpreter.
+ Process command line arguments for the interpreter.
- void ruby_run()
+void ruby_run() ::
-Starts execution of the interpreter.
+ Starts execution of the interpreter.
- void ruby_script(char *name)
+void ruby_script(char *name) ::
-Specifies the name of the script ($0).
+ Specifies the name of the script ($0).
-** Hooks for the Interpreter Events
+== Hooks for the Interpreter Events
- void rb_add_event_hook(rb_event_hook_func_t func, rb_event_flag_t events, VALUE data)
+ void rb_add_event_hook(rb_event_hook_func_t func, rb_event_flag_t events,
+ VALUE data)
Adds a hook function for the specified interpreter events.
-events should be Or'ed value of:
-
- RUBY_EVENT_LINE
- RUBY_EVENT_CLASS
- RUBY_EVENT_END
- RUBY_EVENT_CALL
- RUBY_EVENT_RETURN
- RUBY_EVENT_C_CALL
- RUBY_EVENT_C_RETURN
- RUBY_EVENT_RAISE
- RUBY_EVENT_ALL
+events should be OR'ed value of:
+
+ RUBY_EVENT_LINE
+ RUBY_EVENT_CLASS
+ RUBY_EVENT_END
+ RUBY_EVENT_CALL
+ RUBY_EVENT_RETURN
+ RUBY_EVENT_C_CALL
+ RUBY_EVENT_C_RETURN
+ RUBY_EVENT_RAISE
+ RUBY_EVENT_ALL
The definition of rb_event_hook_func_t is below:
- typedef void (*rb_event_hook_func_t)(rb_event_t event, VALUE data,
- VALUE self, ID id, VALUE klass)
+ typedef void (*rb_event_hook_func_t)(rb_event_t event, VALUE data,
+ VALUE self, ID id, VALUE klass)
The third argument `data' to rb_add_event_hook() is passed to the hook
function as the second argument, which was the pointer to the current
NODE in 1.8. See RB_EVENT_HOOKS_HAVE_CALLBACK_DATA below.
- int rb_remove_event_hook(rb_event_hook_func_t func)
+ int rb_remove_event_hook(rb_event_hook_func_t func)
Removes the specified hook function.
-** Macros for the Compatibilities
+== Macros for Compatibility
Some macros to check API compatibilities are available by default.
- NORETURN_STYLE_NEW
+NORETURN_STYLE_NEW ::
-Means that NORETURN macro is functional style instead of prefix.
+ Means that NORETURN macro is functional style instead of prefix.
- HAVE_RB_DEFINE_ALLOC_FUNC
+HAVE_RB_DEFINE_ALLOC_FUNC ::
-Means that function rb_define_alloc_func() is provided, that means the
-allocation framework is used. This is same as the result of
-have_func("rb_define_alloc_func", "ruby.h").
+ Means that function rb_define_alloc_func() is provided, that means the
+ allocation framework is used. This is same as the result of
+ have_func("rb_define_alloc_func", "ruby.h").
- HAVE_RB_REG_NEW_STR
+HAVE_RB_REG_NEW_STR ::
-Means that function rb_reg_new_str() is provided, that creates Regexp
-object from String object. This is same as the result of
-have_func("rb_reg_new_str", "ruby.h").
+ Means that function rb_reg_new_str() is provided, that creates Regexp
+ object from String object. This is same as the result of
+ have_func("rb_reg_new_str", "ruby.h").
- HAVE_RB_IO_T
+HAVE_RB_IO_T ::
-Means that type rb_io_t is provided.
+ Means that type rb_io_t is provided.
- USE_SYMBOL_AS_METHOD_NAME
+USE_SYMBOL_AS_METHOD_NAME ::
-Means that Symbols will be returned as method names, e.g.,
-Module#methods, #singleton_methods and so on.
+ Means that Symbols will be returned as method names, e.g.,
+ Module#methods, #singleton_methods and so on.
- HAVE_RUBY_*_H
+HAVE_RUBY_*_H ::
-Defined in ruby.h and means correspoinding header is available. For
-instance, when HAVE_RUBY_ST_H is defined you should use ruby/st.h not
-mere st.h.
+ Defined in ruby.h and means corresponding header is available. For
+ instance, when HAVE_RUBY_ST_H is defined you should use ruby/st.h not
+ mere st.h.
- RB_EVENT_HOOKS_HAVE_CALLBACK_DATA
+RB_EVENT_HOOKS_HAVE_CALLBACK_DATA ::
-Means that rb_add_event_hook() takes the third argument `data', to be
-passed to the given event hook function.
+ Means that rb_add_event_hook() takes the third argument `data', to be
+ passed to the given event hook function.
/*
* Local variables:
diff --git a/README.EXT.ja b/README.EXT.ja
index 4ae8b50..7b008b9 100644
--- a/README.EXT.ja
+++ b/README.EXT.ja
@@ -1,8 +1,8 @@
-.\" README.EXT.ja - -*- Text -*- created at: Mon Aug 7 16:45:54 JST 1995
+# README.EXT.ja - -*- RDoc -*- created at: Mon Aug 7 16:45:54 JST 1995
Rubyã®æ‹¡å¼µãƒ©ã‚¤ãƒ–ラリã®ä½œã‚Šæ–¹ã‚’説明ã—ã¾ã™ï¼Ž
-1.基礎知識
+= 基礎知識
Cã®å¤‰æ•°ã«ã¯åž‹ãŒã‚り,データã«ã¯åž‹ãŒã‚りã¾ã›ã‚“.ã§ã™ã‹ã‚‰ï¼ŒãŸ
ã¨ãˆã°ãƒã‚¤ãƒ³ã‚¿ã‚’intã®å¤‰æ•°ã«ä»£å…¥ã™ã‚‹ã¨ï¼Œãã®å€¤ã¯æ•´æ•°ã¨ã—ã¦å–
@@ -17,47 +17,47 @@ Rubyã®ãƒ‡ãƒ¼ã‚¿ã¯VALUEã¨ã„ã†Cã®åž‹ã§è¡¨ç¾ã•れã¾ã™ï¼ŽVALUEåž‹ã®ãƒ‡ãƒ
VALUEã‹ã‚‰Cã«ã¨ã£ã¦æ„味ã®ã‚るデータをå–り出ã™ãŸã‚ã«ã¯
- (1) VALUEã®ãƒ‡ãƒ¼ã‚¿ã‚¿ã‚¤ãƒ—を知る
- (2) VALUEã‚’Cã®ãƒ‡ãƒ¼ã‚¿ã«å¤‰æ›ã™ã‚‹
+1. VALUEã®ãƒ‡ãƒ¼ã‚¿ã‚¿ã‚¤ãƒ—を知る
+2. VALUEã‚’Cã®ãƒ‡ãƒ¼ã‚¿ã«å¤‰æ›ã™ã‚‹
ã®ä¸¡æ–¹ãŒå¿…è¦ã§ã™ï¼Ž(1)を忘れるã¨é–“é•ã£ãŸãƒ‡ãƒ¼ã‚¿ã®å¤‰æ›ãŒè¡Œã‚れ
ã¦ï¼Œæœ€æ‚ªãƒ—ログラムãŒcore dumpã—ã¾ã™ï¼Ž
-1.1 データタイプ
+== データタイプ
Rubyã«ã¯ãƒ¦ãƒ¼ã‚¶ãŒä½¿ã†å¯èƒ½æ€§ã®ã‚る以下ã®ã‚¿ã‚¤ãƒ—ãŒã‚りã¾ã™ï¼Ž
- T_NIL nil
- T_OBJECT 通常ã®ã‚ªãƒ–ジェクト
- T_CLASS クラス
- T_MODULE モジュール
- T_FLOAT æµ®å‹•å°æ•°ç‚¹æ•°
- T_STRING 文字列
- T_REGEXP æ­£è¦è¡¨ç¾
- T_ARRAY é…列
- T_HASH 連想é…列
- T_STRUCT (Rubyã®)構造体
- T_BIGNUM 多å€é•·æ•´æ•°
- T_FIXNUM Fixnum(31bitã¾ãŸã¯63bité•·æ•´æ•°)
- T_COMPLEX 複素数
- T_RATIONAL æœ‰ç†æ•°
- T_FILE 入出力
- T_TRUE 真
- T_FALSE å½
- T_DATA データ
- T_SYMBOL シンボル
+T_NIL :: nil
+T_OBJECT :: 通常ã®ã‚ªãƒ–ジェクト
+T_CLASS :: クラス
+T_MODULE :: モジュール
+T_FLOAT :: æµ®å‹•å°æ•°ç‚¹æ•°
+T_STRING :: 文字列
+T_REGEXP :: æ­£è¦è¡¨ç¾
+T_ARRAY :: é…列
+T_HASH :: 連想é…列
+T_STRUCT :: (Rubyã®)構造体
+T_BIGNUM :: 多å€é•·æ•´æ•°
+T_FIXNUM :: Fixnum(31bitã¾ãŸã¯63bité•·æ•´æ•°)
+T_COMPLEX :: 複素数
+T_RATIONAL :: æœ‰ç†æ•°
+T_FILE :: 入出力
+T_TRUE :: 真
+T_FALSE :: å½
+T_DATA :: データ
+T_SYMBOL :: シンボル
ãã®ä»–ã«å†…部ã§åˆ©ç”¨ã•れã¦ã„る以下ã®ã‚¿ã‚¤ãƒ—ãŒã‚りã¾ã™ï¼Ž
- T_ICLASS
- T_MATCH
- T_UNDEF
- T_NODE
- T_ZOMBIE
+ T_ICLASS
+ T_MATCH
+ T_UNDEF
+ T_NODE
+ T_ZOMBIE
ã»ã¨ã‚“ã©ã®ã‚¿ã‚¤ãƒ—ã¯Cã®æ§‹é€ ä½“ã§å®Ÿè£…ã•れã¦ã„ã¾ã™ï¼Ž
-1.2 VALUEã®ãƒ‡ãƒ¼ã‚¿ã‚¿ã‚¤ãƒ—ã‚’ãƒã‚§ãƒƒã‚¯ã™ã‚‹
+== VALUEã®ãƒ‡ãƒ¼ã‚¿ã‚¿ã‚¤ãƒ—ã‚’ãƒã‚§ãƒƒã‚¯ã™ã‚‹
ruby.hã§ã¯TYPE()ã¨ã„ã†ãƒžã‚¯ãƒ­ãŒå®šç¾©ã•れã¦ã„ã¦ï¼ŒVALUEã®ãƒ‡ãƒ¼ã‚¿
タイプを知るã“ã¨ãŒå‡ºæ¥ã¾ã™ï¼ŽTYPE()マクロã¯ä¸Šã§ç´¹ä»‹ã—ãŸT_XXXX
@@ -94,7 +94,7 @@ FIXNUMã¨NILã«é–¢ã—ã¦ã¯ã‚ˆã‚Šé«˜é€Ÿãªåˆ¤åˆ¥ãƒžã‚¯ãƒ­ãŒç”¨æ„ã•れã¦ã„ã
FIXNUM_P(obj)
NIL_P(obj)
-1.3 VALUEã‚’Cã®ãƒ‡ãƒ¼ã‚¿ã«å¤‰æ›ã™ã‚‹
+== VALUEã‚’Cã®ãƒ‡ãƒ¼ã‚¿ã«å¤‰æ›ã™ã‚‹
データタイプãŒT_NIL,T_FALSE,T_TRUEã§ã‚る時,データã¯ãれãž
れnil,false,trueã§ã™ï¼Žã“ã®ãƒ‡ãƒ¼ã‚¿ã‚¿ã‚¤ãƒ—ã®ã‚ªãƒ–ジェクトã¯ã²ã¨
@@ -153,17 +153,17 @@ Rubyã®æ§‹é€ ä½“を直接アクセスã™ã‚‹æ™‚ã«æ°—ã‚’ã¤ã‘ãªã‘れã°ãªã‚‰ã
ãªã„ã“ã¨ã§ã™ï¼Žç›´æŽ¥å¤‰æ›´ã—ãŸå ´åˆï¼Œã‚ªãƒ–ジェクトã®å†…å®¹ã®æ•´åˆæ€§ãŒ
ã¨ã‚Œãªããªã£ã¦ï¼Œæ€ã‚ã¬ãƒã‚°ã®åŽŸå› ã«ãªã‚Šã¾ã™ï¼Ž
-1.4 Cã®ãƒ‡ãƒ¼ã‚¿ã‚’VALUEã«å¤‰æ›ã™ã‚‹
+== Cã®ãƒ‡ãƒ¼ã‚¿ã‚’VALUEã«å¤‰æ›ã™ã‚‹
VALUEã®å®Ÿéš›ã®æ§‹é€ ã¯
- * FIXNUMã®å ´åˆ
+FIXNUMã®å ´åˆ ::
- 1bit左シフトã—ã¦ï¼ŒLSBã‚’ç«‹ã¦ã‚‹ï¼Ž
+ 1bit左シフトã—ã¦ï¼ŒLSBã‚’ç«‹ã¦ã‚‹ï¼Ž
- * ãã®ä»–ã®ãƒã‚¤ãƒ³ã‚¿ã®å ´åˆ
+ãã®ä»–ã®ãƒã‚¤ãƒ³ã‚¿ã®å ´åˆ ::
- ãã®ã¾ã¾VALUEã«ã‚­ãƒ£ã‚¹ãƒˆã™ã‚‹ï¼Ž
+ ãã®ã¾ã¾VALUEã«ã‚­ãƒ£ã‚¹ãƒˆã™ã‚‹ï¼Ž
ã¨ãªã£ã¦ã„ã¾ã™ï¼Žã‚ˆã£ã¦ï¼ŒLSBã‚’ãƒã‚§ãƒƒã‚¯ã™ã‚Œã°VALUEãŒFIXNUMã‹ã©
ã†ã‹ã‚ã‹ã‚‹ã‚ã‘ã§ã™(ãƒã‚¤ãƒ³ã‚¿ã®LSBãŒç«‹ã£ã¦ã„ãªã„ã“ã¨ã‚’仮定ã—ã¦
@@ -179,14 +179,14 @@ FIXNUMã«é–¢ã—ã¦ã¯å¤‰æ›ãƒžã‚¯ãƒ­ã‚’経由ã™ã‚‹å¿…è¦ãŒã‚りã¾ã™ï¼ŽCã®æ
ã‹ã‚‰VALUEã«å¤‰æ›ã™ã‚‹ãƒžã‚¯ãƒ­ã¯ä»¥ä¸‹ã®ã‚‚ã®ãŒã‚りã¾ã™ï¼Žå¿…è¦ã«å¿œã˜
ã¦ä½¿ã„分ã‘ã¦ãã ã•ã„.
- INT2FIX() ã‚‚ã¨ã®æ•´æ•°ãŒ31bitã¾ãŸã¯63bit以内ã«åŽã¾ã‚‹è‡ªä¿¡
- ãŒã‚る時
- INT2NUM() ä»»æ„ã®æ•´æ•°ã‹ã‚‰VALUEã¸
+INT2FIX() :: ã‚‚ã¨ã®æ•´æ•°ãŒ31bitã¾ãŸã¯63bit以内ã«åŽã¾ã‚‹è‡ªä¿¡
+ ãŒã‚る時
+INT2NUM() :: ä»»æ„ã®æ•´æ•°ã‹ã‚‰VALUEã¸
INT2NUM()ã¯æ•´æ•°ãŒFIXNUMã®ç¯„囲ã«åŽã¾ã‚‰ãªã„å ´åˆï¼ŒBignumã«å¤‰æ›
ã—ã¦ãれã¾ã™(ãŒï¼Œå°‘ã—é…ã„).
-1.5 Rubyã®ãƒ‡ãƒ¼ã‚¿ã‚’æ“作ã™ã‚‹
+== Rubyã®ãƒ‡ãƒ¼ã‚¿ã‚’æ“作ã™ã‚‹
先程も述ã¹ãŸé€šã‚Šï¼ŒRubyã®æ§‹é€ ä½“をアクセスã™ã‚‹æ™‚ã«å†…å®¹ã®æ›´æ–°ã‚’
行ã†ã“ã¨ã¯å‹§ã‚られã¾ã›ã‚“.ã§ï¼ŒRubyã®ãƒ‡ãƒ¼ã‚¿ã‚’æ“作ã™ã‚‹æ™‚ã«ã¯
@@ -195,147 +195,147 @@ RubyãŒç”¨æ„ã—ã¦ã„る関数を用ã„ã¦ãã ã•ã„.
ã“ã“ã§ã¯ã‚‚ã£ã¨ã‚‚使ã‚れるã§ã‚ã‚ã†æ–‡å­—列ã¨é…列ã®ç”Ÿæˆ/æ“作を行
ã„関数をã‚ã’ã¾ã™(全部ã§ã¯ãªã„ã§ã™).
- 文字列ã«å¯¾ã™ã‚‹é–¢æ•°
+=== 文字列ã«å¯¾ã™ã‚‹é–¢æ•°
- rb_str_new(const char *ptr, long len)
+rb_str_new(const char *ptr, long len) ::
- æ–°ã—ã„Rubyã®æ–‡å­—列を生æˆã™ã‚‹ï¼Ž
+ æ–°ã—ã„Rubyã®æ–‡å­—列を生æˆã™ã‚‹ï¼Ž
- rb_str_new2(const char *ptr)
- rb_str_new_cstr(const char *ptr)
+rb_str_new2(const char *ptr)
+rb_str_new_cstr(const char *ptr)
- Cã®æ–‡å­—列ã‹ã‚‰Rubyã®æ–‡å­—列を生æˆã™ã‚‹ï¼Žã“ã®é–¢æ•°ã®æ©Ÿèƒ½ã¯
- rb_str_new(ptr, strlen(ptr))ã¨åŒç­‰ã§ã‚る.
+ Cã®æ–‡å­—列ã‹ã‚‰Rubyã®æ–‡å­—列を生æˆã™ã‚‹ï¼Žã“ã®é–¢æ•°ã®æ©Ÿèƒ½ã¯
+ rb_str_new(ptr, strlen(ptr))ã¨åŒç­‰ã§ã‚る.
- rb_tainted_str_new(const char *ptr, long len)
+rb_tainted_str_new(const char *ptr, long len)
- 汚染マークãŒä»˜åŠ ã•ã‚ŒãŸæ–°ã—ã„Rubyã®æ–‡å­—列を生æˆã™ã‚‹ï¼Žå¤–部
- ã‹ã‚‰ã®ãƒ‡ãƒ¼ã‚¿ã«åŸºã¥ã文字列ã«ã¯æ±šæŸ“マークãŒä»˜åŠ ã•れるã¹ã
- ã§ã‚る.
+ 汚染マークãŒä»˜åŠ ã•ã‚ŒãŸæ–°ã—ã„Rubyã®æ–‡å­—列を生æˆã™ã‚‹ï¼Žå¤–部
+ ã‹ã‚‰ã®ãƒ‡ãƒ¼ã‚¿ã«åŸºã¥ã文字列ã«ã¯æ±šæŸ“マークãŒä»˜åŠ ã•れるã¹ã
+ ã§ã‚る.
- rb_tainted_str_new2(const char *ptr)
- rb_tainted_str_new_cstr(const char *ptr)
+rb_tainted_str_new2(const char *ptr)
+rb_tainted_str_new_cstr(const char *ptr)
- Cã®æ–‡å­—列ã‹ã‚‰æ±šæŸ“マークãŒä»˜åŠ ã•れãŸRubyã®æ–‡å­—列を生æˆã™ã‚‹ï¼Ž
+ Cã®æ–‡å­—列ã‹ã‚‰æ±šæŸ“マークãŒä»˜åŠ ã•れãŸRubyã®æ–‡å­—列を生æˆã™ã‚‹ï¼Ž
- rb_sprintf(const char *format, ...)
- rb_vsprintf(const char *format, va_list ap)
+rb_sprintf(const char *format, ...)
+rb_vsprintf(const char *format, va_list ap)
- Cã®æ–‡å­—列formatã¨ç¶šã引数をprintf(3)ã®ãƒ•ォーマットã«ã—ãŸãŒã£ã¦
- æ•´å½¢ã—,Rubyã®æ–‡å­—列を生æˆã™ã‚‹ï¼Ž
+ Cã®æ–‡å­—列formatã¨ç¶šã引数をprintf(3)ã®ãƒ•ォーマットã«ã—ãŸãŒã£ã¦
+ æ•´å½¢ã—,Rubyã®æ–‡å­—列を生æˆã™ã‚‹ï¼Ž
- rb_str_cat(VALUE str, const char *ptr, long len)
+rb_str_cat(VALUE str, const char *ptr, long len)
- Rubyã®æ–‡å­—列strã«lenãƒã‚¤ãƒˆã®æ–‡å­—列ptrを追加ã™ã‚‹ï¼Ž
+ Rubyã®æ–‡å­—列strã«lenãƒã‚¤ãƒˆã®æ–‡å­—列ptrを追加ã™ã‚‹ï¼Ž
- rb_str_cat2(VALUE str, const char* ptr)
+rb_str_cat2(VALUE str, const char* ptr)
- Rubyã®æ–‡å­—列strã«Cã®æ–‡å­—列ptrを追加ã™ã‚‹ï¼Žã“ã®é–¢æ•°ã®æ©Ÿèƒ½ã¯
- rb_str_cat(str, ptr, strlen(ptr))ã¨åŒç­‰ã§ã‚る.
+ Rubyã®æ–‡å­—列strã«Cã®æ–‡å­—列ptrを追加ã™ã‚‹ï¼Žã“ã®é–¢æ•°ã®æ©Ÿèƒ½ã¯
+ rb_str_cat(str, ptr, strlen(ptr))ã¨åŒç­‰ã§ã‚る.
- rb_str_catf(VALUE str, const char* format, ...)
- rb_str_vcatf(VALUE str, const char* format, va_list ap)
+rb_str_catf(VALUE str, const char* format, ...)
+rb_str_vcatf(VALUE str, const char* format, va_list ap)
- Cã®æ–‡å­—列formatã¨ç¶šã引数をprintf(3)ã®ãƒ•ォーマットã«ã—ãŸãŒã£ã¦
- æ•´å½¢ã—,Rubyã®æ–‡å­—列strã«è¿½åŠ ã™ã‚‹ï¼Žã“ã®é–¢æ•°ã®æ©Ÿèƒ½ã¯ï¼Œãれãžã‚Œ
- rb_str_cat2(str, rb_sprintf(format, ...)) ã‚„
- rb_str_cat2(str, rb_vsprintf(format, ap)) ã¨åŒç­‰ã§ã‚る.
+ Cã®æ–‡å­—列formatã¨ç¶šã引数をprintf(3)ã®ãƒ•ォーマットã«ã—ãŸãŒã£ã¦
+ æ•´å½¢ã—,Rubyã®æ–‡å­—列strã«è¿½åŠ ã™ã‚‹ï¼Žã“ã®é–¢æ•°ã®æ©Ÿèƒ½ã¯ï¼Œãれãžã‚Œ
+ rb_str_cat2(str, rb_sprintf(format, ...)) ã‚„
+ rb_str_cat2(str, rb_vsprintf(format, ap)) ã¨åŒç­‰ã§ã‚る.
- rb_enc_str_new(const char *ptr, long len, rb_encoding *enc)
+rb_enc_str_new(const char *ptr, long len, rb_encoding *enc)
- 指定ã•れãŸã‚¨ãƒ³ã‚³ãƒ¼ãƒ‡ã‚£ãƒ³ã‚°ã§Rubyã®æ–‡å­—列を生æˆã™ã‚‹.
+ 指定ã•れãŸã‚¨ãƒ³ã‚³ãƒ¼ãƒ‡ã‚£ãƒ³ã‚°ã§Rubyã®æ–‡å­—列を生æˆã™ã‚‹.
- rb_usascii_str_new(const char *ptr, long len)
- rb_usascii_str_new_cstr(const char *ptr)
+rb_usascii_str_new(const char *ptr, long len)
+rb_usascii_str_new_cstr(const char *ptr)
- エンコーディングãŒUS-ASCIIã®Rubyã®æ–‡å­—列を生æˆã™ã‚‹.
+ エンコーディングãŒUS-ASCIIã®Rubyã®æ–‡å­—列を生æˆã™ã‚‹.
- rb_str_resize(VALUE str, long len)
+rb_str_resize(VALUE str, long len)
- Rubyã®æ–‡å­—列ã®ã‚µã‚¤ã‚ºã‚’lenãƒã‚¤ãƒˆã«å¤‰æ›´ã™ã‚‹ï¼Žstrã®é•·ã•ã¯å‰
- 以ã¦ã‚»ãƒƒãƒˆã•れã¦ã„ãªã‘れã°ãªã‚‰ãªã„.lenãŒå…ƒã®é•·ã•よりも短
- ã„æ™‚ã¯ï¼Œlenãƒã‚¤ãƒˆã‚’è¶ŠãˆãŸéƒ¨åˆ†ã®å†…å®¹ã¯æ¨ã¦ã‚‰ã‚Œã‚‹ï¼ŽlenãŒå…ƒ
- ã®é•·ã•ã‚ˆã‚Šã‚‚é•·ã„æ™‚ã¯ï¼Œå…ƒã®é•·ã•ã‚’è¶ŠãˆãŸéƒ¨åˆ†ã®å†…容ã¯ä¿å­˜ã•
- れãªã„ã§ã‚´ãƒŸã«ãªã‚‹ã ã‚ã†ï¼Žã“ã®é–¢æ•°ã®å‘¼ã³å‡ºã—ã«ã‚ˆã£ã¦
- RSTRING_PTR(str)ãŒå¤‰æ›´ã•れるã‹ã‚‚ã—れãªã„ã“ã¨ã«æ³¨æ„.
+ Rubyã®æ–‡å­—列ã®ã‚µã‚¤ã‚ºã‚’lenãƒã‚¤ãƒˆã«å¤‰æ›´ã™ã‚‹ï¼Žstrã®é•·ã•ã¯å‰
+ 以ã¦ã‚»ãƒƒãƒˆã•れã¦ã„ãªã‘れã°ãªã‚‰ãªã„.lenãŒå…ƒã®é•·ã•よりも短
+ ã„æ™‚ã¯ï¼Œlenãƒã‚¤ãƒˆã‚’è¶ŠãˆãŸéƒ¨åˆ†ã®å†…å®¹ã¯æ¨ã¦ã‚‰ã‚Œã‚‹ï¼ŽlenãŒå…ƒ
+ ã®é•·ã•ã‚ˆã‚Šã‚‚é•·ã„æ™‚ã¯ï¼Œå…ƒã®é•·ã•ã‚’è¶ŠãˆãŸéƒ¨åˆ†ã®å†…容ã¯ä¿å­˜ã•
+ れãªã„ã§ã‚´ãƒŸã«ãªã‚‹ã ã‚ã†ï¼Žã“ã®é–¢æ•°ã®å‘¼ã³å‡ºã—ã«ã‚ˆã£ã¦
+ RSTRING_PTR(str)ãŒå¤‰æ›´ã•れるã‹ã‚‚ã—れãªã„ã“ã¨ã«æ³¨æ„.
- rb_str_set_len(VALUE str, long len)
+rb_str_set_len(VALUE str, long len)
- Rubyã®æ–‡å­—列ã®ã‚µã‚¤ã‚ºã‚’lenãƒã‚¤ãƒˆã«ã‚»ãƒƒãƒˆã™ã‚‹ï¼ŽstrãŒå¤‰æ›´å¯
- 能ã§ãªã‘れã°ä¾‹å¤–ãŒç™ºç”Ÿã™ã‚‹ï¼ŽRSTRING_LEN(str)ã¨ã¯ç„¡é–¢ä¿‚ã«ï¼Œ
- lenãƒã‚¤ãƒˆã¾ã§ã®å†…容ã¯ä¿å­˜ã•れる.lenã¯strã®å®¹é‡ã‚’è¶Šãˆã¦ã„
- ã¦ã¯ãªã‚‰ãªã„.
+ Rubyã®æ–‡å­—列ã®ã‚µã‚¤ã‚ºã‚’lenãƒã‚¤ãƒˆã«ã‚»ãƒƒãƒˆã™ã‚‹ï¼ŽstrãŒå¤‰æ›´å¯
+ 能ã§ãªã‘れã°ä¾‹å¤–ãŒç™ºç”Ÿã™ã‚‹ï¼ŽRSTRING_LEN(str)ã¨ã¯ç„¡é–¢ä¿‚ã«ï¼Œ
+ lenãƒã‚¤ãƒˆã¾ã§ã®å†…容ã¯ä¿å­˜ã•れる.lenã¯strã®å®¹é‡ã‚’è¶Šãˆã¦ã„
+ ã¦ã¯ãªã‚‰ãªã„.
- é…列ã«å¯¾ã™ã‚‹é–¢æ•°
+== é…列ã«å¯¾ã™ã‚‹é–¢æ•°
- rb_ary_new()
+rb_ary_new()
- è¦ç´ ãŒ0ã®é…列を生æˆã™ã‚‹ï¼Ž
+ è¦ç´ ãŒ0ã®é…列を生æˆã™ã‚‹ï¼Ž
- rb_ary_new2(long len)
+rb_ary_new2(long len)
- è¦ç´ ãŒ0ã®é…列を生æˆã™ã‚‹ï¼Žlenè¦ç´ åˆ†ã®é ˜åŸŸã‚’ã‚らã‹ã˜ã‚割り
- 当ã¦ã¦ãŠã.
+ è¦ç´ ãŒ0ã®é…列を生æˆã™ã‚‹ï¼Žlenè¦ç´ åˆ†ã®é ˜åŸŸã‚’ã‚らã‹ã˜ã‚割り
+ 当ã¦ã¦ãŠã.
- rb_ary_new3(long n, ...)
+rb_ary_new3(long n, ...)
- å¼•æ•°ã§æŒ‡å®šã—ãŸnè¦ç´ ã‚’å«ã‚€é…列を生æˆã™ã‚‹ï¼Ž
+ å¼•æ•°ã§æŒ‡å®šã—ãŸnè¦ç´ ã‚’å«ã‚€é…列を生æˆã™ã‚‹ï¼Ž
- rb_ary_new4(long n, VALUE *elts)
+rb_ary_new4(long n, VALUE *elts)
- é…列ã§ä¸ŽãˆãŸnè¦ç´ ã®é…列を生æˆã™ã‚‹ï¼Ž
+ é…列ã§ä¸ŽãˆãŸnè¦ç´ ã®é…列を生æˆã™ã‚‹ï¼Ž
- rb_ary_to_ary(VALUE obj)
+rb_ary_to_ary(VALUE obj)
- オブジェクトをé…列ã«å¤‰æ›ã™ã‚‹.
- Object#to_aryã¨åŒç­‰ã§ã‚ã‚‹.
+ オブジェクトをé…列ã«å¤‰æ›ã™ã‚‹.
+ Object#to_aryã¨åŒç­‰ã§ã‚ã‚‹.
- ä»–ã«ã‚‚é…列をæ“作ã™ã‚‹é–¢æ•°ãŒå¤šæ•°ã‚ã‚‹. ã“れらã¯
- 引数aryã«é…列を渡ã•ãªã‘れã°ãªã‚‰ãªã„. ã•ã‚‚ãªã„ã¨
- コアをåã.
+ä»–ã«ã‚‚é…列をæ“作ã™ã‚‹é–¢æ•°ãŒå¤šæ•°ã‚ã‚‹. ã“れらã¯
+引数aryã«é…列を渡ã•ãªã‘れã°ãªã‚‰ãªã„. ã•ã‚‚ãªã„ã¨
+コアをåã.
- rb_ary_aref(argc, VALUE *argv, VALUE ary)
+rb_ary_aref(argc, VALUE *argv, VALUE ary)
- Array#[]ã¨åŒç­‰.
+ Array#[]ã¨åŒç­‰.
- rb_ary_entry(VALUE ary, long offset)
+rb_ary_entry(VALUE ary, long offset)
- ary[offset]
+ ary[offset]
- rb_ary_subseq(VALUE ary, long beg, long len)
+rb_ary_subseq(VALUE ary, long beg, long len)
- ary[beg, len]
+ ary[beg, len]
- rb_ary_push(VALUE ary, VALUE val)
- rb_ary_pop(VALUE ary)
- rb_ary_shift(VALUE ary)
- rb_ary_unshift(VALUE ary, VALUE val)
+rb_ary_push(VALUE ary, VALUE val)
+rb_ary_pop(VALUE ary)
+rb_ary_shift(VALUE ary)
+rb_ary_unshift(VALUE ary, VALUE val)
- rb_ary_cat(VALUE ary, const VALUE *ptr, long len)
+rb_ary_cat(VALUE ary, const VALUE *ptr, long len)
- é…列aryã«ptrã‹ã‚‰len個ã®ã‚ªãƒ–ジェクトを追加ã™ã‚‹ï¼Ž
+ é…列aryã«ptrã‹ã‚‰len個ã®ã‚ªãƒ–ジェクトを追加ã™ã‚‹ï¼Ž
-2.Rubyã®æ©Ÿèƒ½ã‚’使ã†
+= Rubyã®æ©Ÿèƒ½ã‚’使ã†
原ç†çš„ã«Rubyã§æ›¸ã‘ã‚‹ã“ã¨ã¯Cã§ã‚‚書ã‘ã¾ã™ï¼ŽRubyãã®ã‚‚ã®ãŒCã§è¨˜
è¿°ã•れã¦ã„ã‚‹ã‚“ã§ã™ã‹ã‚‰ï¼Œå½“ç„¶ã¨ã„ãˆã°å½“ç„¶ãªã‚“ã§ã™ã‘ã©ï¼Žã“ã“ã§
ã¯Rubyã®æ‹¡å¼µã«ä½¿ã†ã“ã¨ãŒå¤šã„ã ã‚ã†ã¨äºˆæ¸¬ã•れる機能を中心ã«ç´¹
介ã—ã¾ã™ï¼Ž
-2.1 Rubyã«æ©Ÿèƒ½ã‚’追加ã™ã‚‹
+== Rubyã«æ©Ÿèƒ½ã‚’追加ã™ã‚‹
Rubyã§æä¾›ã•れã¦ã„る関数を使ãˆã°Rubyã‚¤ãƒ³ã‚¿ãƒ—ãƒªã‚¿ã«æ–°ã—ã„æ©Ÿèƒ½
を追加ã™ã‚‹ã“ã¨ãŒã§ãã¾ã™ï¼ŽRubyã§ã¯ä»¥ä¸‹ã®æ©Ÿèƒ½ã‚’追加ã™ã‚‹é–¢æ•°ãŒ
æä¾›ã•れã¦ã„ã¾ã™ï¼Ž
- * クラス,モジュール
- * メソッド,特異メソッドãªã©
- * 定数
+* クラス,モジュール
+* メソッド,特異メソッドãªã©
+* 定数
ã§ã¯é †ã«ç´¹ä»‹ã—ã¾ã™ï¼Ž
-2.1.1 クラス/モジュール定義
+=== クラス/モジュール定義
クラスやモジュールを定義ã™ã‚‹ãŸã‚ã«ã¯ï¼Œä»¥ä¸‹ã®é–¢æ•°ã‚’使ã„ã¾ã™ï¼Ž
@@ -352,15 +352,15 @@ Rubyã§æä¾›ã•れã¦ã„る関数を使ãˆã°Rubyã‚¤ãƒ³ã‚¿ãƒ—ãƒªã‚¿ã«æ–°ã—ã„
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, const char *name,
- VALUE (*func)(), int argc)
+ VALUE (*func)(), int argc)
void rb_define_singleton_method(VALUE object, const char *name,
- VALUE (*func)(), int argc)
+ VALUE (*func)(), int argc)
念ã®ãŸã‚説明ã™ã‚‹ã¨ã€Œç‰¹ç•°ãƒ¡ã‚½ãƒƒãƒ‰ã€ã¨ã¯ï¼Œãã®ç‰¹å®šã®ã‚ªãƒ–ジェク
@@ -437,7 +437,7 @@ funcã¯ã‚¯ãƒ©ã‚¹ã‚’引数ã¨ã—ã¦å—ã‘å–ã£ã¦ï¼Œæ–°ã—ã割り当ã¦ã‚‰ã‚Œã
ソースãªã©ã‚’å«ã¾ãªã„,ã§ãã‚‹ã ã‘「空ã€ã®ã¾ã¾ã«ã—ã¦ãŠã„ãŸã»ã†
ãŒã‚ˆã„ã§ã—ょã†ï¼Ž
-2.1.3 定数定義
+=== 定数定義
拡張ライブラリãŒå¿…è¦ãªå®šæ•°ã¯ã‚らã‹ã˜ã‚定義ã—ã¦ãŠã„ãŸæ–¹ãŒè‰¯ã„
ã§ã—ょã†ï¼Žå®šæ•°ã‚’定義ã™ã‚‹é–¢æ•°ã¯äºŒã¤ã‚りã¾ã™ï¼Ž
@@ -448,7 +448,7 @@ funcã¯ã‚¯ãƒ©ã‚¹ã‚’引数ã¨ã—ã¦å—ã‘å–ã£ã¦ï¼Œæ–°ã—ã割り当ã¦ã‚‰ã‚Œã
å‰è€…ã¯ç‰¹å®šã®ã‚¯ãƒ©ã‚¹/モジュールã«å±žã™ã‚‹å®šæ•°ã‚’定義ã™ã‚‹ã‚‚ã®ï¼Œå¾Œ
者ã¯ã‚°ãƒ­ãƒ¼ãƒãƒ«ãªå®šæ•°ã‚’定義ã™ã‚‹ã‚‚ã®ã§ã™ï¼Ž
-2.2 Rubyã®æ©Ÿèƒ½ã‚’Cã‹ã‚‰å‘¼ã³å‡ºã™
+== Rubyã®æ©Ÿèƒ½ã‚’Cã‹ã‚‰å‘¼ã³å‡ºã™
æ—¢ã«ã€Ž1.5 Rubyã®ãƒ‡ãƒ¼ã‚¿ã‚’æ“作ã™ã‚‹ã€ã§ä¸€éƒ¨ç´¹ä»‹ã—ãŸã‚ˆã†ãªé–¢æ•°ã‚’
使ãˆã°ï¼ŒRubyã®æ©Ÿèƒ½ã‚’実ç¾ã—ã¦ã„る関数を直接呼ã³å‡ºã™ã“ã¨ãŒå‡ºæ¥
@@ -459,7 +459,7 @@ funcã¯ã‚¯ãƒ©ã‚¹ã‚’引数ã¨ã—ã¦å—ã‘å–ã£ã¦ï¼Œæ–°ã—ã割り当ã¦ã‚‰ã‚Œã
ãれ以外ã«ã‚‚Rubyã®æ©Ÿèƒ½ã‚’呼ã³å‡ºã™æ–¹æ³•ã¯ã„ãã¤ã‹ã‚りã¾ã™ï¼Ž
-2.2.1 Rubyã®ãƒ—ログラムをevalã™ã‚‹
+=== Rubyã®ãƒ—ログラムをevalã™ã‚‹
Cã‹ã‚‰Rubyã®æ©Ÿèƒ½ã‚’呼ã³å‡ºã™ã‚‚ã£ã¨ã‚‚ç°¡å˜ãªæ–¹æ³•ã¨ã—ã¦ï¼Œæ–‡å­—列ã§
与ãˆã‚‰ã‚ŒãŸRubyã®ãƒ—ログラムを評価ã™ã‚‹ä»¥ä¸‹ã®é–¢æ•°ãŒã‚りã¾ã™ï¼Ž
@@ -477,8 +477,7 @@ Cã‹ã‚‰Rubyã®æ©Ÿèƒ½ã‚’呼ã³å‡ºã™ã‚‚ã£ã¨ã‚‚ç°¡å˜ãªæ–¹æ³•ã¨ã—ã¦ï¼Œæ–‡å­—
ã“ã®é–¢æ•°ã¯ã‚¨ãƒ©ãƒ¼ãŒç™ºç”Ÿã™ã‚‹ã¨nilã‚’è¿”ã—ã¾ã™ï¼Žãã—ã¦ï¼ŒæˆåŠŸæ™‚ã«ã¯
*stateã¯ã‚¼ãƒ­ã«ï¼Œã•ã‚‚ãªãã°éžã‚¼ãƒ­ã«ãªã‚Šã¾ã™ï¼Ž
-
-2.2.2 IDã¾ãŸã¯ã‚·ãƒ³ãƒœãƒ«
+=== IDã¾ãŸã¯ã‚·ãƒ³ãƒœãƒ«
Cã‹ã‚‰æ–‡å­—列を経由ã›ãšã«Rubyã®ãƒ¡ã‚½ãƒƒãƒ‰ã‚’呼ã³å‡ºã™ã“ã¨ã‚‚ã§ãã¾
ã™ï¼Žãã®å‰ã«ï¼ŒRubyインタプリタ内ã§ãƒ¡ã‚½ãƒƒãƒ‰ã‚„変数åを指定ã™ã‚‹
@@ -487,7 +486,9 @@ Cã‹ã‚‰æ–‡å­—列を経由ã›ãšã«Rubyã®ãƒ¡ã‚½ãƒƒãƒ‰ã‚’呼ã³å‡ºã™ã“ã¨ã‚‚ã§
IDã¨ã¯å¤‰æ•°å,メソッドåã‚’è¡¨ã™æ•´æ•°ã§ã™ï¼ŽRubyã®ä¸­ã§ã¯
:識別å­
+
ã¾ãŸã¯
+
:"ä»»æ„ã®æ–‡å­—列"
ã§ã‚¢ã‚¯ã‚»ã‚¹ã§ãã¾ã™ï¼ŽCã‹ã‚‰ã“ã®æ•´æ•°ã‚’å¾—ã‚‹ãŸã‚ã«ã¯é–¢æ•°
@@ -509,7 +510,7 @@ IDã¨ã¯å¤‰æ•°å,メソッドåã‚’è¡¨ã™æ•´æ•°ã§ã™ï¼ŽRubyã®ä¸­ã§ã¯
è¿”ã—ãŸå ´åˆã¯å¸¸ã«æ–‡å­—列ã§ã™ï¼Žç¬¬ä¸‰ã®é–¢æ•°ã¯Rubyã®æ–‡å­—列ã§ã¯ãªã
NUL終端ã•れãŸCã®æ–‡å­—列を使ã„ã¾ã™ï¼Ž
-2.2.3 Cã‹ã‚‰Rubyã®ãƒ¡ã‚½ãƒƒãƒ‰ã‚’呼ã³å‡ºã™
+=== Cã‹ã‚‰Rubyã®ãƒ¡ã‚½ãƒƒãƒ‰ã‚’呼ã³å‡ºã™
Cã‹ã‚‰æ–‡å­—列を経由ã›ãšã«Rubyã®ãƒ¡ã‚½ãƒƒãƒ‰ã‚’呼ã³å‡ºã™ãŸã‚ã«ã¯ä»¥ä¸‹
ã®é–¢æ•°ã‚’使ã„ã¾ã™ï¼Ž
@@ -524,7 +525,7 @@ Cã‹ã‚‰æ–‡å­—列を経由ã›ãšã«Rubyã®ãƒ¡ã‚½ãƒƒãƒ‰ã‚’呼ã³å‡ºã™ãŸã‚ã«ã¯
applyã«ã¯å¼•æ•°ã¨ã—ã¦Rubyã®é…列を与ãˆã¾ã™ï¼Ž
-2.2.4 変数/定数をå‚ç…§/æ›´æ–°ã™ã‚‹
+=== 変数/定数をå‚ç…§/æ›´æ–°ã™ã‚‹
Cã‹ã‚‰é–¢æ•°ã‚’使ã£ã¦å‚照・更新ã§ãã‚‹ã®ã¯ï¼Œå®šæ•°ï¼Œã‚¤ãƒ³ã‚¹ã‚¿ãƒ³ã‚¹å¤‰
æ•°ã§ã™ï¼Žå¤§åŸŸå¤‰æ•°ã¯ä¸€éƒ¨ã®ã‚‚ã®ã¯Cã®å¤§åŸŸå¤‰æ•°ã¨ã—ã¦ã‚¢ã‚¯ã‚»ã‚¹ã§ã
@@ -545,24 +546,24 @@ idã¯rb_intern()ã§å¾—られるもã®ã‚’使ã£ã¦ãã ã•ã„.
定数を新ã—ã定義ã™ã‚‹ãŸã‚ã«ã¯ã€Ž2.1.3 定数定義ã€ã§ç´¹ä»‹ã•
れã¦ã„る関数を使ã£ã¦ãã ã•ã„.
-3.Rubyã¨Cã¨ã®æƒ…報共有
+= Rubyã¨Cã¨ã®æƒ…報共有
C言語ã¨Rubyã®é–“ã§æƒ…報を共有ã™ã‚‹æ–¹æ³•ã«ã¤ã„ã¦è§£èª¬ã—ã¾ã™ï¼Ž
-3.1 Cã‹ã‚‰å‚ç…§ã§ãã‚‹Rubyã®å®šæ•°
+== Cã‹ã‚‰å‚ç…§ã§ãã‚‹Rubyã®å®šæ•°
以下ã®Rubyã®å®šæ•°ã¯Cã®ãƒ¬ãƒ™ãƒ«ã‹ã‚‰å‚ç…§ã§ãã¾ã™ï¼Ž
Qtrue
Qfalse
- 真å½å€¤ï¼ŽQfalseã¯C言語ã§ã‚‚å½ã¨ã¿ãªã•れã¾ã™(ã¤ã¾ã‚Š0).
+真å½å€¤ï¼ŽQfalseã¯C言語ã§ã‚‚å½ã¨ã¿ãªã•れã¾ã™(ã¤ã¾ã‚Š0).
Qnil
- C言語ã‹ã‚‰è¦‹ãŸã€Œnilã€ï¼Ž
+C言語ã‹ã‚‰è¦‹ãŸã€Œnilã€ï¼Ž
-3.2 Cã¨Rubyã§å…±æœ‰ã•れる大域変数
+== Cã¨Rubyã§å…±æœ‰ã•れる大域変数
Cã¨Rubyã§å¤§åŸŸå¤‰æ•°ã‚’使ã£ã¦æƒ…報を共有ã§ãã¾ã™ï¼Žå…±æœ‰ã§ãる大域
変数ã«ã¯ã„ãã¤ã‹ã®ç¨®é¡žãŒã‚りã¾ã™ï¼Žãã®ãªã‹ã§ã‚‚ã£ã¨ã‚‚良ã使ã‚
@@ -613,7 +614,7 @@ getterã¨setterã®ä»•様ã¯ä»¥ä¸‹ã®é€šã‚Šã§ã™ï¼Ž
(*getter)(ID id);
(*setter)(VALUE val, ID id);
-3.3 Cã®ãƒ‡ãƒ¼ã‚¿ã‚’Rubyオブジェクトã«ã™ã‚‹
+== Cã®ãƒ‡ãƒ¼ã‚¿ã‚’Rubyオブジェクトã«ã™ã‚‹
Cã®ä¸–界ã§å®šç¾©ã•れãŸãƒ‡ãƒ¼ã‚¿(構造体)ã‚’Rubyã®ã‚ªãƒ–ジェクトã¨ã—ã¦
å–り扱ã„ãŸã„å ´åˆãŒã‚りãˆã¾ã™ï¼Žã“ã®ã‚ˆã†ãªå ´åˆã«ã¯ï¼ŒDataã¨ã„ã†
@@ -664,13 +665,13 @@ Cã®æ§‹é€ ä½“ã¸ã®ãƒã‚¤ãƒ³ã‚¿ã¯å¤‰æ•°svalã«ä»£å…¥ã•れã¾ã™ï¼Ž
ã“れらã®Dataã®ä½¿ã„æ–¹ã¯ã¡ã‚‡ã£ã¨åˆ†ã‹ã‚Šã«ãã„ã®ã§ï¼Œå¾Œã§èª¬æ˜Žã™ã‚‹
例題をå‚ç…§ã—ã¦ãã ã•ã„.
-4.例題 - dbmパッケージを作る
+= 例題 - dbmパッケージを作る
ã“ã“ã¾ã§ã®èª¬æ˜Žã§ã¨ã‚Šã‚ãˆãšæ‹¡å¼µãƒ©ã‚¤ãƒ–ãƒ©ãƒªã¯ä½œã‚Œã‚‹ã¯ãšã§ã™ï¼Ž
Rubyã®extディレクトリã«ã™ã§ã«å«ã¾ã‚Œã¦ã„ã‚‹dbmライブラリを例ã«
ã—ã¦æ®µéšŽçš„ã«èª¬æ˜Žã—ã¾ã™ï¼Ž
-(1) ディレクトリを作る
+== ディレクトリを作る
% mkdir ext/dbm
@@ -680,14 +681,14 @@ Ruby 1.1ã‹ã‚‰ã¯ä»»æ„ã®ãƒ‡ã‚£ãƒ¬ã‚¯ãƒˆãƒªã§ãƒ€ã‚¤ãƒŠãƒŸãƒƒã‚¯ãƒ©ã‚¤ãƒ–ラリ
ライブラリ用ã®ãƒ‡ã‚£ãƒ¬ã‚¯ãƒˆãƒªã‚’作る必è¦ãŒã‚りã¾ã™ï¼Žåå‰ã¯é©å½“ã«
é¸ã‚“ã§æ§‹ã„ã¾ã›ã‚“.
-(2) 設計ã™ã‚‹
+== 設計ã™ã‚‹
ã¾ã‚,当然ãªã‚“ã§ã™ã‘ã©ï¼Œã©ã†ã„ã†æ©Ÿèƒ½ã‚’実ç¾ã™ã‚‹ã‹ã©ã†ã‹ã¾ãšè¨­
計ã™ã‚‹å¿…è¦ãŒã‚りã¾ã™ï¼Žã©ã‚“ãªã‚¯ãƒ©ã‚¹ã‚’ã¤ãã‚‹ã‹ï¼Œãã®ã‚¯ãƒ©ã‚¹ã«ã¯
ã©ã‚“ãªãƒ¡ã‚½ãƒƒãƒ‰ãŒã‚ã‚‹ã‹ï¼Œã‚¯ãƒ©ã‚¹ãŒæä¾›ã™ã‚‹å®šæ•°ãªã©ã«ã¤ã„ã¦è¨­è¨ˆ
ã—ã¾ã™ï¼Ž
-(3) Cコードを書ã
+== Cコードを書ã
拡張ライブラリ本体ã¨ãªã‚‹C言語ã®ã‚½ãƒ¼ã‚¹ã‚’書ãã¾ã™ï¼ŽC言語ã®ã‚½ãƒ¼
スãŒã²ã¨ã¤ã®æ™‚ã«ã¯ã€Œãƒ©ã‚¤ãƒ–ラリå.cã€ã‚’é¸ã¶ã¨è‰¯ã„ã§ã—ょã†ï¼ŽC
@@ -704,44 +705,40 @@ Rubyã¯æ‹¡å¼µãƒ©ã‚¤ãƒ–ラリをロードã™ã‚‹æ™‚ã«ã€ŒInit_ライブラリåã€
ã§ã™ï¼Žã“ã®é–¢æ•°ã®ä¸­ã§ã‚¯ãƒ©ã‚¹ï¼Œãƒ¢ã‚¸ãƒ¥ãƒ¼ãƒ«ï¼Œãƒ¡ã‚½ãƒƒãƒ‰ï¼Œå®šæ•°ãªã©ã®
定義を行ã„ã¾ã™ï¼Ždbm.cã‹ã‚‰ä¸€éƒ¨å¼•用ã—ã¾ã™ï¼Ž
---
-void
-Init_dbm(void)
-{
- /* DBMクラスを定義ã™ã‚‹ */
- cDBM = rb_define_class("DBM", rb_cObject);
- /* DBMã¯Enumerateモジュールをインクルードã™ã‚‹ */
- rb_include_module(cDBM, rb_mEnumerable);
-
- /* DBMクラスã®ã‚¯ãƒ©ã‚¹ãƒ¡ã‚½ãƒƒãƒ‰open(): 引数ã¯Cã®é…列ã§å—ã‘ã‚‹ */
- rb_define_singleton_method(cDBM, "open", fdbm_s_open, -1);
-
- /* DBMクラスã®ãƒ¡ã‚½ãƒƒãƒ‰close(): 引数ã¯ãªã— */
- rb_define_method(cDBM, "close", fdbm_close, 0);
- /* DBMクラスã®ãƒ¡ã‚½ãƒƒãƒ‰[]: 引数ã¯1個 */
- rb_define_method(cDBM, "[]", fdbm_fetch, 1);
- :
-
- /* DBMデータを格ç´ã™ã‚‹ã‚¤ãƒ³ã‚¹ã‚¿ãƒ³ã‚¹å¤‰æ•°åã®ãŸã‚ã®ID */
- id_dbm = rb_intern("dbm");
-}
---
+ void
+ Init_dbm(void)
+ {
+ /* DBMクラスを定義ã™ã‚‹ */
+ cDBM = rb_define_class("DBM", rb_cObject);
+ /* DBMã¯Enumerateモジュールをインクルードã™ã‚‹ */
+ rb_include_module(cDBM, rb_mEnumerable);
+
+ /* DBMクラスã®ã‚¯ãƒ©ã‚¹ãƒ¡ã‚½ãƒƒãƒ‰open(): 引数ã¯Cã®é…列ã§å—ã‘ã‚‹ */
+ rb_define_singleton_method(cDBM, "open", fdbm_s_open, -1);
+
+ /* DBMクラスã®ãƒ¡ã‚½ãƒƒãƒ‰close(): 引数ã¯ãªã— */
+ rb_define_method(cDBM, "close", fdbm_close, 0);
+ /* DBMクラスã®ãƒ¡ã‚½ãƒƒãƒ‰[]: 引数ã¯1個 */
+ rb_define_method(cDBM, "[]", fdbm_fetch, 1);
+
+ /* ... */
+
+ /* DBMデータを格ç´ã™ã‚‹ã‚¤ãƒ³ã‚¹ã‚¿ãƒ³ã‚¹å¤‰æ•°åã®ãŸã‚ã®ID */
+ id_dbm = rb_intern("dbm");
+ }
DBMライブラリã¯dbmã®ãƒ‡ãƒ¼ã‚¿ã¨å¯¾å¿œã™ã‚‹ã‚ªãƒ–ジェクトã«ãªã‚‹ã¯ãšã§
ã™ã‹ã‚‰ï¼ŒCã®ä¸–界ã®dbmã‚’Rubyã®ä¸–界ã«å–り込む必è¦ãŒã‚りã¾ã™ï¼Ž
-
dbm.cã§ã¯Data_Make_Structを以下ã®ã‚ˆã†ã«ä½¿ã£ã¦ã„ã¾ã™ï¼Ž
---
-struct dbmdata {
- int di_size;
- DBM *di_dbm;
-};
-
-
-obj = Data_Make_Struct(klass, struct dbmdata, 0, free_dbm, dbmp);
---
+ struct dbmdata {
+ int di_size;
+ DBM *di_dbm;
+ };
+
+
+ obj = Data_Make_Struct(klass, struct dbmdata, 0, free_dbm, dbmp);
ã“ã“ã§ã¯dbmstruct構造体ã¸ã®ãƒã‚¤ãƒ³ã‚¿ã‚’Dataã«ã‚«ãƒ—セル化ã—ã¦ã„
ã¾ã™ï¼ŽDBM*を直接カプセル化ã—ãªã„ã®ã¯close()ã—ãŸæ™‚ã®å‡¦ç†ã‚’考
@@ -750,12 +747,10 @@ obj = Data_Make_Struct(klass, struct dbmdata, 0, free_dbm, dbmp);
Dataオブジェクトã‹ã‚‰dbmstruct構造体ã®ãƒã‚¤ãƒ³ã‚¿ã‚’å–り出ã™ãŸã‚
ã«ä»¥ä¸‹ã®ãƒžã‚¯ãƒ­ã‚’使ã£ã¦ã„ã¾ã™ï¼Ž
---
-#define GetDBM(obj, dbmp) {\
- Data_Get_Struct(obj, struct dbmdata, dbmp);\
- if (dbmp->di_dbm == 0) closed_dbm();\
-}
---
+ #define GetDBM(obj, dbmp) {\
+ Data_Get_Struct(obj, struct dbmdata, dbmp);\
+ if (dbmp->di_dbm == 0) closed_dbm();\
+ }
ã¡ã‚‡ã£ã¨è¤‡é›‘ãªãƒžã‚¯ãƒ­ã§ã™ãŒï¼Œè¦ã™ã‚‹ã«dbmdata構造体ã®ãƒã‚¤ãƒ³ã‚¿
ã®å–り出ã—ã¨ï¼Œcloseã•れã¦ã„ã‚‹ã‹ã©ã†ã‹ã®ãƒã‚§ãƒƒã‚¯ã‚’ã¾ã¨ã‚ã¦ã„
@@ -766,13 +761,11 @@ DBMクラスã«ã¯ãŸãã•んメソッドãŒã‚りã¾ã™ãŒï¼Œåˆ†é¡žã™ã‚‹ã¨3ç
ã—ã¦ã¯deleteメソッドãŒã‚りã¾ã™ï¼Ždeleteメソッドを実装ã—ã¦ã„ã‚‹
fdbm_delete()ã¯ã“ã®ã‚ˆã†ã«ãªã£ã¦ã„ã¾ã™ï¼Ž
---
-static VALUE
-fdbm_delete(VALUE obj, VALUE keystr)
-{
- :
-}
---
+ static VALUE
+ fdbm_delete(VALUE obj, VALUE keystr)
+ {
+ /* ... */
+ }
å¼•æ•°ã®æ•°ãŒå›ºå®šã®ã‚¿ã‚¤ãƒ—ã¯ç¬¬1引数ãŒself,第2引数以é™ãŒãƒ¡ã‚½ãƒƒãƒ‰
ã®å¼•æ•°ã¨ãªã‚Šã¾ã™ï¼Ž
@@ -782,17 +775,17 @@ fdbm_delete(VALUE obj, VALUE keystr)
ã¯DBMã®ã‚¯ãƒ©ã‚¹ãƒ¡ã‚½ãƒƒãƒ‰ã§ã‚ã‚‹open()ã§ã™ï¼Žã“れを実装ã—ã¦ã„ã‚‹é–¢
æ•°fdbm_s_open()ã¯ã“ã†ãªã£ã¦ã„ã¾ã™ï¼Ž
---
-static VALUE
-fdbm_s_open(int argc, VALUE *argv, VALUE klass)
-{
- :
- if (rb_scan_args(argc, argv, "11", &file, &vmode) == 1) {
- mode = 0666; /* default value */
- }
- :
-}
---
+ static VALUE
+ fdbm_s_open(int argc, VALUE *argv, VALUE klass)
+ {
+ /* ... */
+
+ if (rb_scan_args(argc, argv, "11", &file, &vmode) == 1) {
+ mode = 0666; /* default value */
+ }
+
+ /* ... */
+ }
ã“ã®ã‚¿ã‚¤ãƒ—ã®é–¢æ•°ã¯ç¬¬1引数ãŒä¸Žãˆã‚‰ã‚ŒãŸå¼•æ•°ã®æ•°ï¼Œç¬¬2引数ãŒä¸Žãˆ
られãŸå¼•æ•°ã®å…¥ã£ã¦ã„ã‚‹é…列ã«ãªã‚Šã¾ã™ï¼Žselfã¯ç¬¬3引数ã¨ã—ã¦ä¸Ž
@@ -807,17 +800,15 @@ fdbm_s_open(int argc, VALUE *argv, VALUE klass)
引数をRubyã®é…列ã¨ã—ã¦å—ã‘å–るメソッドã®ä¾‹ã«ã¯
Thread#initializeãŒã‚りã¾ã™ï¼Žå®Ÿè£…ã¯ã“ã†ã§ã™ï¼Ž
---
-static VALUE
-thread_initialize(VALUE thread, VALUE args)
-{
- :
-}
---
+ static VALUE
+ thread_initialize(VALUE thread, VALUE args)
+ {
+ /* ... */
+ }
第1引数ã¯self,第2引数ã¯Rubyã®é…列ã§ã™ï¼Ž
-** 注æ„事項
+*注æ„事項*
Rubyã¨å…±æœ‰ã¯ã—ãªã„ãŒRubyã®ã‚ªãƒ–ジェクトを格ç´ã™ã‚‹å¯èƒ½æ€§ã®ã‚ã‚‹
Cã®å¤§åŸŸå¤‰æ•°ã¯ä»¥ä¸‹ã®é–¢æ•°ã‚’使ã£ã¦Rubyインタプリタã«å¤‰æ•°ã®å­˜åœ¨
@@ -825,7 +816,7 @@ Cã®å¤§åŸŸå¤‰æ•°ã¯ä»¥ä¸‹ã®é–¢æ•°ã‚’使ã£ã¦Rubyインタプリタã«å¤‰æ•°ã®
void rb_global_variable(VALUE *var)
-(4) extconf.rbを用æ„ã™ã‚‹
+== extconf.rbを用æ„ã™ã‚‹
Makefileを作る場åˆã®é››åž‹ã«ãªã‚‹extconf.rbã¨ã„ã†ãƒ•ァイルを作り
ã¾ã™ï¼Žextconf.rbã¯ãƒ©ã‚¤ãƒ–ラリã®ã‚³ãƒ³ãƒ‘イルã«å¿…è¦ãªæ¡ä»¶ã®ãƒã‚§ãƒƒ
@@ -856,7 +847,7 @@ Makefileを作る場åˆã®é››åž‹ã«ãªã‚‹extconf.rbã¨ã„ã†ãƒ•ァイルを作ã‚
パイルã—ãªã„時ã«ã¯create_makefileを呼ã°ãªã‘れã°Makefileã¯ç”Ÿ
æˆã•れãšï¼Œã‚³ãƒ³ãƒ‘イルも行ã‚れã¾ã›ã‚“.
-(5) dependを用æ„ã™ã‚‹
+== dependを用æ„ã™ã‚‹
ã‚‚ã—,ディレクトリã«dependã¨ã„ã†ãƒ•ァイルãŒå­˜åœ¨ã™ã‚Œã°ï¼Œ
MakefileãŒä¾å­˜é–¢ä¿‚ã‚’ãƒã‚§ãƒƒã‚¯ã—ã¦ãれã¾ã™ï¼Ž
@@ -865,7 +856,7 @@ MakefileãŒä¾å­˜é–¢ä¿‚ã‚’ãƒã‚§ãƒƒã‚¯ã—ã¦ãれã¾ã™ï¼Ž
ãªã©ã§ä½œã‚‹ã“ã¨ãŒå‡ºæ¥ã¾ã™ï¼Žã‚ã£ã¦æã¯ç„¡ã„ã§ã—ょã†ï¼Ž
-(6) Makefileを生æˆã™ã‚‹
+== Makefileを生æˆã™ã‚‹
Makefileを実際ã«ç”Ÿæˆã™ã‚‹ãŸã‚ã«ã¯
@@ -887,7 +878,7 @@ vendor_ruby ディレクトリã«ã‚¤ãƒ³ã‚¹ãƒˆãƒ¼ãƒ«ã™ã‚‹å ´åˆã«ã¯
ディレクトリをext以下ã«ç”¨æ„ã—ãŸå ´åˆã«ã¯Ruby全体ã®makeã®æ™‚ã«
自動的ã«MakefileãŒç”Ÿæˆã•れã¾ã™ã®ã§ï¼Œã“ã®ã‚¹ãƒ†ãƒƒãƒ—ã¯ä¸è¦ã§ã™ï¼Ž
-(7) makeã™ã‚‹
+== makeã™ã‚‹
動的リンクライブラリを生æˆã™ã‚‹å ´åˆã«ã¯ãã®å ´ã§makeã—ã¦ãã ã•
ã„.必è¦ã§ã‚れ㰠make install ã§ã‚¤ãƒ³ã‚¹ãƒˆãƒ¼ãƒ«ã•れã¾ã™ï¼Ž
@@ -905,41 +896,42 @@ extconf.rbã‚’æ›¸ãæ›ãˆã‚‹ãªã©ã—ã¦Makefileã®å†ç”ŸæˆãŒå¿…è¦ãªæ™‚ã¯ã
を作り,ãã“ã« æ‹¡å¼µå­ .rb ã®ãƒ•ァイルを置ã„ã¦ãŠã‘ã°åŒæ™‚ã«ã‚¤ãƒ³
ストールã•れã¾ã™ï¼Ž
-(8) デãƒãƒƒã‚°
+== デãƒãƒƒã‚°
ã¾ã‚,デãƒãƒƒã‚°ã—ãªã„ã¨å‹•ã‹ãªã„ã§ã—ょã†ã­ï¼Žext/Setupã«ãƒ‡ã‚£ãƒ¬
クトリåを書ãã¨é™çš„ã«ãƒªãƒ³ã‚¯ã™ã‚‹ã®ã§ãƒ‡ãƒãƒƒã‚¬ãŒä½¿ãˆã‚‹ã‚ˆã†ã«ãª
りã¾ã™ï¼Žãã®åˆ†ã‚³ãƒ³ãƒ‘イルãŒé…ããªã‚Šã¾ã™ã‘ã©ï¼Ž
-(9) ã§ãã‚ãŒã‚Š
+== ã§ãã‚ãŒã‚Š
後ã¯ã“ã£ãり使ã†ãªã‚Šï¼Œåºƒã公開ã™ã‚‹ãªã‚Šï¼Œå£²ã‚‹ãªã‚Šï¼Œã”自由ã«ãŠ
使ã„ãã ã•ã„.Rubyã®ä½œè€…ã¯æ‹¡å¼µãƒ©ã‚¤ãƒ–ラリã«é–¢ã—ã¦ä¸€åˆ‡ã®æ¨©åˆ©ã‚’
主張ã—ã¾ã›ã‚“.
-Appendix A. Rubyã®ã‚½ãƒ¼ã‚¹ã‚³ãƒ¼ãƒ‰ã®åˆ†é¡ž
+= Appendix A. Rubyã®ã‚½ãƒ¼ã‚¹ã‚³ãƒ¼ãƒ‰ã®åˆ†é¡ž
Rubyã®ã‚½ãƒ¼ã‚¹ã¯ã„ãã¤ã‹ã«åˆ†é¡žã™ã‚‹ã“ã¨ãŒå‡ºæ¥ã¾ã™ï¼Žã“ã®ã†ã¡ã‚¯ãƒ©
スライブラリã®éƒ¨åˆ†ã¯åŸºæœ¬çš„ã«æ‹¡å¼µãƒ©ã‚¤ãƒ–ラリã¨åŒã˜ä½œã‚Šæ–¹ã«ãªã£
ã¦ã„ã¾ã™ï¼Žã“れらã®ã‚½ãƒ¼ã‚¹ã¯ä»Šã¾ã§ã®èª¬æ˜Žã§ã»ã¨ã‚“ã©ç†è§£ã§ãã‚‹ã¨
æ€ã„ã¾ã™ï¼Ž
-Ruby言語ã®ã‚³ã‚¢
+== Ruby言語ã®ã‚³ã‚¢
+
+class.c :: クラスã¨ãƒ¢ã‚¸ãƒ¥ãƒ¼ãƒ«
+error.c :: 例外クラスã¨ä¾‹å¤–機構
+gc.c :: 記憶領域管ç†
+load.c :: ライブラリã®ãƒ­ãƒ¼ãƒ‰
+object.c :: オブジェクト
+variable.c :: 変数ã¨å®šæ•°
- class.c : クラスã¨ãƒ¢ã‚¸ãƒ¥ãƒ¼ãƒ«
- error.c : 例外クラスã¨ä¾‹å¤–機構
- gc.c : 記憶領域管ç†
- load.c : ライブラリã®ãƒ­ãƒ¼ãƒ‰
- object.c : オブジェクト
- variable.c : 変数ã¨å®šæ•°
+== Rubyã®æ§‹æ–‡è§£æžå™¨
-Rubyã®æ§‹æ–‡è§£æžå™¨
- parse.y : å­—å¥è§£æžå™¨ã¨æ§‹æ–‡å®šç¾©
- -> parse.c : 自動生æˆ
- keywords : 予約語
- -> lex.c : 自動生æˆ
+ parse.y : å­—å¥è§£æžå™¨ã¨æ§‹æ–‡å®šç¾©
+ -> parse.c : 自動生æˆ
+ keywords : 予約語
+ -> lex.c : 自動生æˆ
-Rubyã®è©•価器 (通称YARV)
+== Rubyã®è©•価器 (通称YARV)
compile.c
eval.c
eval_error.c
@@ -964,7 +956,8 @@ Rubyã®è©•価器 (通称YARV)
-> opt*.inc : 自動生æˆ
-> vm.inc : 自動生æˆ
-æ­£è¦è¡¨ç¾ã‚¨ãƒ³ã‚¸ãƒ³ (鬼車)
+== æ­£è¦è¡¨ç¾ã‚¨ãƒ³ã‚¸ãƒ³ (鬼車)
+
regex.c
regcomp.c
regenc.c
@@ -973,15 +966,15 @@ Rubyã®è©•価器 (通称YARV)
regparse.c
regsyntax.c
-ユーティリティ関数
+== ユーティリティ関数
- debug.c : Cデãƒãƒƒã‚¬ç”¨ã®ãƒ‡ãƒãƒƒã‚°ã‚·ãƒ³ãƒœãƒ«
- dln.c : 動的ローディング
- st.c : 汎用ãƒãƒƒã‚·ãƒ¥è¡¨
- strftime.c : 時刻整形
- util.c : ãã®ä»–ã®ãƒ¦ãƒ¼ãƒ†ã‚£ãƒªãƒ†ã‚£
+debug.c :: Cデãƒãƒƒã‚¬ç”¨ã®ãƒ‡ãƒãƒƒã‚°ã‚·ãƒ³ãƒœãƒ«
+dln.c :: 動的ローディング
+st.c :: 汎用ãƒãƒƒã‚·ãƒ¥è¡¨
+strftime.c :: 時刻整形
+util.c :: ãã®ä»–ã®ãƒ¦ãƒ¼ãƒ†ã‚£ãƒªãƒ†ã‚£
-Rubyコマンドã®å®Ÿè£…
+== Rubyコマンドã®å®Ÿè£…
dmyext.c
dmydln.c
@@ -995,81 +988,80 @@ Rubyコマンドã®å®Ÿè£…
gem_prelude.rb
prelude.rb
-クラスライブラリ
-
- array.c : Array
- bignum.c : Bignum
- compar.c : Comparable
- complex.c : Complex
- cont.c : Fiber, Continuation
- dir.c : Dir
- enum.c : Enumerable
- enumerator.c : Enumerator
- file.c : File
- hash.c : Hash
- io.c : IO
- marshal.c : Marshal
- math.c : Math
- numeric.c : Numeric, Integer, Fixnum, Float
- pack.c : Array#pack, String#unpack
- proc.c : Binding, Proc
- process.c : Process
- random.c : 乱数
- range.c : Range
- rational.c : Rational
- re.c : Regexp, MatchData
- signal.c : Signal
- sprintf.c :
- string.c : String
- struct.c : Struct
- time.c : Time
-
- defs/known_errors.def : 例外クラス Errno::*
- -> known_errors.inc : 自動生æˆ
-
-多言語化
- encoding.c : Encoding
- transcode.c : Encoding::Converter
- enc/*.c : エンコーディングクラス群
- enc/trans/* : コードãƒã‚¤ãƒ³ãƒˆå¯¾å¿œè¡¨
-
-gorubyコマンドã®å®Ÿè£…
+== クラスライブラリ
+
+array.c :: Array
+bignum.c :: Bignum
+compar.c :: Comparable
+complex.c :: Complex
+cont.c :: Fiber, Continuation
+dir.c :: Dir
+enum.c :: Enumerable
+enumerator.c :: Enumerator
+file.c :: File
+hash.c :: Hash
+io.c :: IO
+marshal.c :: Marshal
+math.c :: Math
+numeric.c :: Numeric, Integer, Fixnum, Float
+pack.c :: Array#pack, String#unpack
+proc.c :: Binding, Proc
+process.c :: Process
+random.c :: 乱数
+range.c :: Range
+rational.c :: Rational
+re.c :: Regexp, MatchData
+signal.c :: Signal
+sprintf.c :: String#sprintf
+string.c :: String
+struct.c :: Struct
+time.c :: Time
+defs/known_errors.def :: 例外クラス Errno::*
+-> known_errors.inc :: 自動生æˆ
+
+== 多言語化
+
+encoding.c :: Encoding
+transcode.c :: Encoding::Converter
+enc/*.c :: エンコーディングクラス群
+enc/trans/* :: コードãƒã‚¤ãƒ³ãƒˆå¯¾å¿œè¡¨
+
+== gorubyコマンドã®å®Ÿè£…
goruby.c
golf_prelude.rb : goruby固有ã®ãƒ©ã‚¤ãƒ–ラリ
-> golf_prelude.c : 自動生æˆ
-
-Appendix B. 拡張用関数リファレンス
+= Appendix B. 拡張用関数リファレンス
C言語ã‹ã‚‰Rubyã®æ©Ÿèƒ½ã‚’利用ã™ã‚‹APIã¯ä»¥ä¸‹ã®é€šã‚Šã§ã‚る.
-** åž‹
+== åž‹
-VALUE
+VALUE ::
Rubyオブジェクトを表ç¾ã™ã‚‹åž‹ï¼Žå¿…è¦ã«å¿œã˜ã¦ã‚­ãƒ£ã‚¹ãƒˆã—ã¦ç”¨ã„る.
組ã¿è¾¼ã¿åž‹ã‚’表ç¾ã™ã‚‹Cã®åž‹ã¯ruby.hã«è¨˜è¿°ã—ã¦ã‚ã‚‹Rã§å§‹ã¾ã‚‹æ§‹é€ 
体ã§ã‚る.VALUE型をã“れらã«ã‚­ãƒ£ã‚¹ãƒˆã™ã‚‹ãŸã‚ã«Rã§å§‹ã¾ã‚‹æ§‹é€ ä½“
åã‚’å…¨ã¦å¤§æ–‡å­—ã«ã—ãŸåå‰ã®ãƒžã‚¯ãƒ­ãŒç”¨æ„ã•れã¦ã„る.
-** 変数・定数
+== 変数・定数
-Qnil
+Qnil ::
定数: nilオブジェクト
-Qtrue
+Qtrue ::
定数: trueオブジェクト(真ã®ãƒ‡ãƒ•ォルト値)
-Qfalse
+Qfalse ::
定数: falseオブジェクト
-** Cデータã®ã‚«ãƒ—セル化
+== Cデータã®ã‚«ãƒ—セル化
-Data_Wrap_Struct(VALUE klass, void (*mark)(), void (*free)(), void *sval)
+Data_Wrap_Struct(VALUE klass, void (*mark)(), void (*free)(), void *sval) ::
Cã®ä»»æ„ã®ãƒã‚¤ãƒ³ã‚¿ã‚’カプセル化ã—ãŸRubyオブジェクトを返ã™ï¼Žã“
ã®ãƒã‚¤ãƒ³ã‚¿ãŒRubyã‹ã‚‰ã‚¢ã‚¯ã‚»ã‚¹ã•れãªããªã£ãŸæ™‚,freeã§æŒ‡å®šã—ãŸ
@@ -1077,94 +1069,92 @@ Data_Wrap_Struct(VALUE klass, void (*mark)(), void (*free)(), void *sval)
ジェクトを指ã—ã¦ã„ã‚‹å ´åˆï¼Œmarkã«æŒ‡å®šã™ã‚‹é–¢æ•°ã§ãƒžãƒ¼ã‚¯ã™ã‚‹å¿…è¦
ãŒã‚る.
-Data_Make_Struct(klass, type, mark, free, sval)
+Data_Make_Struct(klass, type, mark, free, sval) ::
typeåž‹ã®ãƒ¡ãƒ¢ãƒªã‚’mallocã—,変数svalã«ä»£å…¥ã—ãŸå¾Œï¼Œãれをカプセ
ル化ã—ãŸãƒ‡ãƒ¼ã‚¿ã‚’è¿”ã™ãƒžã‚¯ãƒ­ï¼Ž
-Data_Get_Struct(data, type, sval)
+Data_Get_Struct(data, type, sval) ::
dataã‹ã‚‰typeåž‹ã®ãƒã‚¤ãƒ³ã‚¿ã‚’å–り出ã—変数svalã«ä»£å…¥ã™ã‚‹ãƒžã‚¯ãƒ­ï¼Ž
-** åž‹ãƒã‚§ãƒƒã‚¯
-
-TYPE(value)
-FIXNUM_P(value)
-NIL_P(value)
-void Check_Type(VALUE value, int type)
-void Check_SafeStr(VALUE value)
-
-** 型変æ›
-
-FIX2INT(value), INT2FIX(i)
-FIX2LONG(value), LONG2FIX(l)
-NUM2INT(value), INT2NUM(i)
-NUM2UINT(value), UINT2NUM(ui)
-NUM2LONG(value), LONG2NUM(l)
-NUM2ULONG(value), ULONG2NUM(ul)
-NUM2LL(value), LL2NUM(ll)
-NUM2ULL(value), ULL2NUM(ull)
-NUM2OFFT(value), OFFT2NUM(off)
-NUM2SIZET(value), SIZET2NUM(size)
-NUM2SSIZET(value), SSIZET2NUM(ssize)
-NUM2DBL(value)
-rb_float_new(f)
-StringValue(value)
-StringValuePtr(value)
-StringValueCStr(value)
-rb_str_new2(s)
-
-** クラス/モジュール定義
-
-VALUE rb_define_class(const char *name, VALUE super)
+== åž‹ãƒã‚§ãƒƒã‚¯
+
+ TYPE(value)
+ FIXNUM_P(value)
+ NIL_P(value)
+ void Check_Type(VALUE value, int type)
+ SafeStringValue(value)
+
+== 型変æ›
+
+ FIX2INT(value), INT2FIX(i)
+ FIX2LONG(value), LONG2FIX(l)
+ NUM2INT(value), INT2NUM(i)
+ NUM2UINT(value), UINT2NUM(ui)
+ NUM2LONG(value), LONG2NUM(l)
+ NUM2ULONG(value), ULONG2NUM(ul)
+ NUM2LL(value), LL2NUM(ll)
+ NUM2ULL(value), ULL2NUM(ull)
+ NUM2OFFT(value), OFFT2NUM(off)
+ NUM2SIZET(value), SIZET2NUM(size)
+ NUM2SSIZET(value), SSIZET2NUM(ssize)
+ NUM2DBL(value)
+ rb_float_new(f)
+ StringValue(value)
+ StringValuePtr(value)
+ StringValueCStr(value)
+ rb_str_new2(s)
+
+== クラス/モジュール定義
+
+VALUE rb_define_class(const char *name, VALUE super) ::
superã®ã‚µãƒ–クラスã¨ã—ã¦æ–°ã—ã„Rubyクラスを定義ã™ã‚‹ï¼Ž
-VALUE rb_define_class_under(VALUE module, const char *name, VALUE super)
+VALUE rb_define_class_under(VALUE module, const char *name, VALUE super) ::
superã®ã‚µãƒ–クラスã¨ã—ã¦æ–°ã—ã„Rubyクラスを定義ã—,moduleã®
定数ã¨ã—ã¦å®šç¾©ã™ã‚‹ï¼Ž
-VALUE rb_define_module(const char *name)
+VALUE rb_define_module(const char *name) ::
æ–°ã—ã„Rubyモジュールを定義ã™ã‚‹ï¼Ž
-VALUE rb_define_module_under(VALUE module, const char *name)
+VALUE rb_define_module_under(VALUE module, const char *name) ::
æ–°ã—ã„Rubyモジュールを定義ã—,moduleã®å®šæ•°ã¨ã—ã¦å®šç¾©ã™ã‚‹ï¼Ž
-void rb_include_module(VALUE klass, VALUE module)
+void rb_include_module(VALUE klass, VALUE module) ::
モジュールをインクルードã™ã‚‹ï¼ŽclassãŒã™ã§ã«moduleをインク
ルードã—ã¦ã„る時ã«ã¯ä½•ã‚‚ã—ãªã„(多é‡ã‚¤ãƒ³ã‚¯ãƒ«ãƒ¼ãƒ‰ã®ç¦æ­¢).
-void rb_extend_object(VALUE object, VALUE module)
+void rb_extend_object(VALUE object, VALUE module) ::
オブジェクトをモジュール(ã§å®šç¾©ã•れã¦ã„るメソッド)ã§æ‹¡å¼µã™ã‚‹ï¼Ž
-** 大域変数定義
+== 大域変数定義
-void rb_define_variable(const char *name, VALUE *var)
+void rb_define_variable(const char *name, VALUE *var) ::
Rubyã¨Cã¨ã§å…±æœ‰ã™ã‚‹ã‚°ãƒ­ãƒ¼ãƒãƒ«å¤‰æ•°ã‚’定義ã™ã‚‹ï¼Žå¤‰æ•°åãŒ`$'ã§
å§‹ã¾ã‚‰ãªã„時ã«ã¯è‡ªå‹•çš„ã«è¿½åŠ ã•れる.nameã¨ã—ã¦Rubyã®è­˜åˆ¥å­
ã¨ã—ã¦è¨±ã•れãªã„文字(例ãˆã°` ')ã‚’å«ã‚€å ´åˆã«ã¯Rubyプログラ
ムã‹ã‚‰ã¯è¦‹ãˆãªããªã‚‹ï¼Ž
-void rb_define_readonly_variable(const 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(const char *name,
- VALUE (*getter)(), void (*setter)())
+void rb_define_virtual_variable(const char *name, VALUE (*getter)(), void (*setter)()) ::
関数ã«ã‚ˆã£ã¦å®Ÿç¾ã•れるRuby変数を定義ã™ã‚‹ï¼Žå¤‰æ•°ãŒå‚ç…§ã•れãŸ
時ã«ã¯getterãŒï¼Œå¤‰æ•°ã«å€¤ãŒã‚»ãƒƒãƒˆã•ã‚ŒãŸæ™‚ã«ã¯setterãŒå‘¼ã°ã‚Œ
る.
-void rb_define_hooked_variable(const char *name, VALUE *var,
- VALUE (*getter)(), void (*setter)())
+void rb_define_hooked_variable(const char *name, VALUE *var, VALUE (*getter)(), void (*setter)()) ::
関数ã«ã‚ˆã£ã¦hookã®ã¤ã‘られãŸã‚°ãƒ­ãƒ¼ãƒãƒ«å¤‰æ•°ã‚’定義ã™ã‚‹ï¼Žå¤‰æ•°
ãŒå‚ç…§ã•ã‚ŒãŸæ™‚ã«ã¯getterãŒï¼Œé–¢æ•°ã«å€¤ãŒã‚»ãƒƒãƒˆã•ã‚ŒãŸæ™‚ã«ã¯
@@ -1176,23 +1166,23 @@ void rb_global_variable(VALUE *var)
GCã®ãŸã‚,Rubyプログラムã‹ã‚‰ã¯ã‚¢ã‚¯ã‚»ã‚¹ã•れãªã„ãŒ, Rubyオブ
ジェクトをå«ã‚€å¤§åŸŸå¤‰æ•°ã‚’マークã™ã‚‹ï¼Ž
-** 定数
+== 定数
-void rb_define_const(VALUE klass, 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)
+void rb_define_global_const(const char *name, VALUE val) ::
大域定数を定義ã™ã‚‹ï¼Ž
- rb_define_const(rb_cObject, name, val)
+ rb_define_const(rb_cObject, name, val)
ã¨åŒã˜æ„味.
-** メソッド定義
+== メソッド定義
-rb_define_method(VALUE klass, const 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
@@ -1200,47 +1190,48 @@ rb_define_method(VALUE klass, const char *name, VALUE (*func)(), int argc)
第1引数ãŒself, 第2引数ãŒargs(argsã¯å¼•æ•°ã‚’å«ã‚€Rubyã®é…列)ã¨
ã„ã†å½¢å¼ã§ä¸Žãˆã‚‰ã‚Œã‚‹ï¼Ž
-rb_define_private_method(VALUE klass, const 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, const 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, const char *fmt, ...)
+rb_scan_args(int argc, VALUE *argv, const char *fmt, ...) ::
argc, argvå½¢å¼ã§ä¸Žãˆã‚‰ã‚ŒãŸæŒ‡å®šã•れãŸãƒ•ォーマットã«å¾“ã£ã¦å¼•
数を分解ã—,続ãVALUEã¸ã®å‚ç…§ã«ã‚»ãƒƒãƒˆã—ã¾ã™ï¼Žã“ã®ãƒ•ォーマッ
トã¯ï¼ŒABNFã§è¨˜è¿°ã™ã‚‹ã¨ä»¥ä¸‹ã®é€šã‚Šã§ã™ï¼Ž
---
-scan-arg-spec := param-arg-spec [option-hash-arg-spec] [block-arg-spec]
-
-param-arg-spec := pre-arg-spec [post-arg-spec] / post-arg-spec / pre-opt-post-arg-spec
-pre-arg-spec := num-of-leading-mandatory-args [num-of-optional-args]
-post-arg-spec := sym-for-variable-length-args [num-of-trailing-mandatory-args]
-pre-opt-post-arg-spec := num-of-leading-mandatory-args num-of-optional-args num-of-trailing-mandatory-args
-option-hash-arg-spec := sym-for-option-hash-arg
-block-arg-spec := sym-for-block-arg
-
-num-of-leading-mandatory-args := DIGIT ; 先頭ã«ç½®ã‹ã‚Œã‚‹çœç•¥ä¸èƒ½ãªå¼•æ•°ã®æ•°
-num-of-optional-args := DIGIT ; ç¶šã„ã¦ç½®ã‹ã‚Œã‚‹çœç•¥å¯èƒ½ãªå¼•æ•°ã®æ•°
-sym-for-variable-length-args := "*" ; ç¶šã„ã¦ç½®ã‹ã‚Œã‚‹å¯å¤‰é•·å¼•æ•°ã‚’
- ; Rubyã®é…列ã§å–å¾—ã™ã‚‹ãŸã‚ã®æŒ‡å®š
-num-of-trailing-mandatory-args := DIGIT ; 終端ã«ç½®ã‹ã‚Œã‚‹çœç•¥ä¸èƒ½ãªå¼•æ•°ã®æ•°
-sym-for-option-hash-arg := ":" ; オプションãƒãƒƒã‚·ãƒ¥ã‚’å–å¾—ã™ã‚‹
- ; ãŸã‚ã®æŒ‡å®š; çœç•¥ä¸èƒ½ãªå¼•æ•°ã®
- ; 数よりも多ãã®å¼•æ•°ãŒæŒ‡å®šã•れ,
- ; 最後ã®å¼•æ•°ãŒãƒãƒƒã‚·ãƒ¥ï¼ˆã¾ãŸã¯
- ; #to_hashã§å¤‰æ›å¯èƒ½ï¼‰ã®å ´åˆã«
- ; å–å¾—ã•れる.最後ã®å¼•æ•°ãŒnilã®
- ; å ´åˆï¼Œå¯å¤‰é•·å¼•数指定ãŒãªã,
- ; çœç•¥ä¸èƒ½å¼•æ•°ã®æ•°ã‚ˆã‚Šã‚‚多ãã®
- ; å¼•æ•°ãŒæŒ‡å®šã•れãŸå ´åˆã«å–å¾—ã•れる
-sym-for-block-arg := "&" ; イテレータブロックをå–å¾—ã™ã‚‹ãŸã‚ã®
- ; 指定
---
+ scan-arg-spec := param-arg-spec [option-hash-arg-spec] [block-arg-spec]
+
+ param-arg-spec := pre-arg-spec [post-arg-spec] / post-arg-spec /
+ pre-opt-post-arg-spec
+ pre-arg-spec := num-of-leading-mandatory-args [num-of-optional-args]
+ post-arg-spec := sym-for-variable-length-args
+ [num-of-trailing-mandatory-args]
+ pre-opt-post-arg-spec := num-of-leading-mandatory-args num-of-optional-args
+ num-of-trailing-mandatory-args
+ option-hash-arg-spec := sym-for-option-hash-arg
+ block-arg-spec := sym-for-block-arg
+
+ num-of-leading-mandatory-args := DIGIT ; 先頭ã«ç½®ã‹ã‚Œã‚‹çœç•¥ä¸èƒ½ãªå¼•æ•°ã®æ•°
+ num-of-optional-args := DIGIT ; ç¶šã„ã¦ç½®ã‹ã‚Œã‚‹çœç•¥å¯èƒ½ãªå¼•æ•°ã®æ•°
+ sym-for-variable-length-args := "*" ; ç¶šã„ã¦ç½®ã‹ã‚Œã‚‹å¯å¤‰é•·å¼•æ•°ã‚’
+ ; Rubyã®é…列ã§å–å¾—ã™ã‚‹ãŸã‚ã®æŒ‡å®š
+ num-of-trailing-mandatory-args := DIGIT ; 終端ã«ç½®ã‹ã‚Œã‚‹çœç•¥ä¸èƒ½ãªå¼•æ•°ã®æ•°
+ sym-for-option-hash-arg := ":" ; オプションãƒãƒƒã‚·ãƒ¥ã‚’å–å¾—ã™ã‚‹
+ ; ãŸã‚ã®æŒ‡å®š; çœç•¥ä¸èƒ½ãªå¼•æ•°ã®
+ ; 数よりも多ãã®å¼•æ•°ãŒæŒ‡å®šã•れ,
+ ; 最後ã®å¼•æ•°ãŒãƒãƒƒã‚·ãƒ¥ï¼ˆã¾ãŸã¯
+ ; #to_hashã§å¤‰æ›å¯èƒ½ï¼‰ã®å ´åˆã«
+ ; å–å¾—ã•れる.最後ã®å¼•æ•°ãŒnilã®
+ ; å ´åˆï¼Œå¯å¤‰é•·å¼•数指定ãŒãªã,
+ ; çœç•¥ä¸èƒ½å¼•æ•°ã®æ•°ã‚ˆã‚Šã‚‚多ãã®
+ ; å¼•æ•°ãŒæŒ‡å®šã•れãŸå ´åˆã«å–å¾—ã•れる
+ sym-for-block-arg := "&" ; イテレータブロックをå–å¾—ã™ã‚‹ãŸã‚ã®
+ ; 指定
フォーマットãŒ"12"ã®å ´åˆï¼Œå¼•æ•°ã¯æœ€ä½Ž1ã¤ã§ï¼Œ3ã¤(1+2)ã¾ã§è¨±ã•
れるã¨ã„ã†æ„味ã«ãªã‚Šã¾ã™ï¼Žå¾“ã£ã¦ï¼Œãƒ•ォーマット文字列ã«ç¶šã„
@@ -1253,14 +1244,14 @@ sym-for-block-arg := "&" ; イテレータブロックをå–å¾—ã
返り値ã¯ä¸Žãˆã‚‰ã‚ŒãŸå¼•æ•°ã®æ•°ã§ã™ï¼Žã‚ªãƒ—ションãƒãƒƒã‚·ãƒ¥ãŠã‚ˆã³ã‚¤
ãƒ†ãƒ¬ãƒ¼ã‚¿ãƒ–ãƒ­ãƒƒã‚¯ã¯æ•°ãˆã¾ã›ã‚“.
-** Rubyメソッド呼ã³å‡ºã—
+== Rubyメソッド呼ã³å‡ºã—
-VALUE rb_funcall(VALUE recv, ID mid, int narg, ...)
+VALUE rb_funcall(VALUE recv, ID mid, int narg, ...) ::
メソッド呼ã³å‡ºã—.文字列ã‹ã‚‰midã‚’å¾—ã‚‹ãŸã‚ã«ã¯rb_intern()ã‚’
使ã†ï¼Ž
-VALUE rb_funcall2(VALUE recv, ID mid, int argc, VALUE *argv)
+VALUE rb_funcall2(VALUE recv, ID mid, int argc, VALUE *argv) ::
メソッド呼ã³å‡ºã—.引数をargc, argvå½¢å¼ã§æ¸¡ã™ï¼Ž
@@ -1268,40 +1259,39 @@ VALUE rb_eval_string(const char *str)
文字列をRubyスクリプトã¨ã—ã¦ã‚³ãƒ³ãƒ‘イル・実行ã™ã‚‹ï¼Ž
-ID rb_intern(const char *name)
+ID rb_intern(const char *name) ::
文字列ã«å¯¾å¿œã™ã‚‹IDã‚’è¿”ã™ï¼Ž
-char *rb_id2name(ID id)
+char *rb_id2name(ID id) ::
IDã«å¯¾å¿œã™ã‚‹æ–‡å­—列を返ã™(デãƒãƒƒã‚°ç”¨).
-char *rb_class2name(VALUE klass)
+char *rb_class2name(VALUE klass) ::
クラスã®åå‰ã‚’è¿”ã™(デãƒãƒƒã‚°ç”¨).クラスãŒåå‰ã‚’æŒãŸãªã„時ã«
ã¯, 祖先をé¡ã£ã¦åå‰ã‚’æŒã¤ã‚¯ãƒ©ã‚¹ã®åå‰ã‚’è¿”ã™ï¼Ž
-int rb_respond_to(VALUE obj, ID id)
+int rb_respond_to(VALUE obj, ID id) ::
objãŒidã§ç¤ºã•れるメソッドをæŒã¤ã‹ã©ã†ã‹ã‚’è¿”ã™ï¼Ž
-** インスタンス変数
+== インスタンス変数
-VALUE rb_iv_get(VALUE obj, const char *name)
+VALUE rb_iv_get(VALUE obj, const char *name) ::
objã®ã‚¤ãƒ³ã‚¹ã‚¿ãƒ³ã‚¹å¤‰æ•°ã®å€¤ã‚’得る.`@'ã§å§‹ã¾ã‚‰ãªã„インスタン
ス変数㯠Rubyプログラムã‹ã‚‰ã‚¢ã‚¯ã‚»ã‚¹ã§ããªã„「隠れãŸã€ã‚¤ãƒ³
スタンス変数ã«ãªã‚‹ï¼Žå®šæ•°ã¯å¤§æ–‡å­—ã®åå‰ã‚’æŒã¤ã‚¯ãƒ©ã‚¹(ã¾ãŸã¯
モジュール)ã®ã‚¤ãƒ³ã‚¹ã‚¿ãƒ³ã‚¹å¤‰æ•°ã¨ã—ã¦å®Ÿè£…ã•れã¦ã„る.
-VALUE rb_iv_set(VALUE obj, const char *name, VALUE val)
+VALUE rb_iv_set(VALUE obj, const char *name, VALUE val) ::
objã®ã‚¤ãƒ³ã‚¹ã‚¿ãƒ³ã‚¹å¤‰æ•°ã‚’valã«ã‚»ãƒƒãƒˆã™ã‚‹ï¼Ž
-** 制御構造
+== 制御構造
-VALUE rb_block_call(VALUE obj, ID mid, int argc, VALUE * argv,
- VALUE (*func) (ANYARGS), VALUE data2)
+VALUE rb_block_call(VALUE obj, ID mid, int argc, VALUE * argv, VALUE (*func) (ANYARGS), VALUE data2) ::
funcをブロックã¨ã—ã¦è¨­å®šã—,objをレシーãƒï¼Œargcã¨argvを引数
ã¨ã—ã¦midメソッドを呼ã³å‡ºã™ï¼Žfuncã¯ç¬¬ä¸€å¼•æ•°ã«yieldã•れãŸå€¤ï¼Œ
@@ -1310,34 +1300,34 @@ VALUE rb_block_call(VALUE obj, ID mid, int argc, VALUE * argv,
data2ã¯Arrayã¨ã—ã¦ãƒ‘ックã•れã¦ã„る.第三, 第四引数ã®argcã¨
argvã«ã‚ˆã£ã¦yieldã•れãŸå€¤ã‚’å–り出ã™ã“ã¨ãŒã§ãる.
-[OBSOLETE] VALUE rb_iterate(VALUE (*func1)(), VALUE arg1, VALUE (*func2)(), VALUE arg2)
+[OBSOLETE] VALUE rb_iterate(VALUE (*func1)(), VALUE arg1, VALUE (*func2)(), VALUE arg2) ::
func2をブロックã¨ã—ã¦è¨­å®šã—, func1をイテレータã¨ã—ã¦å‘¼ã¶ï¼Ž
func1ã«ã¯ arg1ãŒå¼•æ•°ã¨ã—ã¦æ¸¡ã•れ, func2ã«ã¯ç¬¬1引数ã«ã‚¤ãƒ†ãƒ¬ãƒ¼
ã‚¿ã‹ã‚‰ä¸Žãˆã‚‰ã‚ŒãŸå€¤, 第2引数ã«arg2ãŒæ¸¡ã•れる.
-
+
1.9ã§rb_iterateを使ã†å ´åˆã¯, func1ã®ä¸­ã§Rubyレベルã®ãƒ¡ã‚½ãƒƒãƒ‰
を呼ã³å‡ºã•ãªã‘れã°ãªã‚‰ãªã„.
1.9ã§obsoleteã¨ãªã£ãŸ. 代ã‚りã«rb_block_callãŒç”¨æ„ã•れãŸ.
-VALUE rb_yield(VALUE val)
+VALUE rb_yield(VALUE val) ::
valを値ã¨ã—ã¦ã‚¤ãƒ†ãƒ¬ãƒ¼ã‚¿ãƒ–ロックを呼ã³å‡ºã™ï¼Ž
-VALUE rb_rescue(VALUE (*func1)(), VALUE arg1, VALUE (*func2)(), VALUE arg2)
+VALUE rb_rescue(VALUE (*func1)(), VALUE arg1, VALUE (*func2)(), VALUE arg2) ::
関数func1ã‚’arg1を引数ã«å‘¼ã³å‡ºã™ï¼Žfunc1ã®å®Ÿè¡Œä¸­ã«ä¾‹å¤–ãŒç™ºç”Ÿ
ã—ãŸæ™‚ã«ã¯ func2ã‚’arg2を引数ã¨ã—ã¦å‘¼ã¶ï¼Žæˆ»ã‚Šå€¤ã¯ä¾‹å¤–ãŒç™ºç”Ÿ
ã—ãªã‹ã£ãŸæ™‚ã¯func1ã®æˆ»ã‚Šå€¤, 例外ãŒç™ºç”Ÿã—ãŸæ™‚ã«ã¯func2ã®æˆ»
り値ã§ã‚る.
-VALUE rb_ensure(VALUE (*func1)(), VALUE arg1, VALUE (*func2)(), VALUE arg2)
+VALUE rb_ensure(VALUE (*func1)(), VALUE arg1, VALUE (*func2)(), VALUE arg2) ::
関数func1ã‚’arg1を引数ã¨ã—ã¦å®Ÿè¡Œã—, 実行終了後(ãŸã¨ãˆä¾‹å¤–ãŒ
発生ã—ã¦ã‚‚) func2ã‚’arg2を引数ã¨ã—ã¦å®Ÿè¡Œã™ã‚‹ï¼Žæˆ»ã‚Šå€¤ã¯func1
ã®æˆ»ã‚Šå€¤ã§ã‚ã‚‹(例外ãŒç™ºç”Ÿã—ãŸæ™‚ã¯æˆ»ã‚‰ãªã„).
-VALUE rb_protect(VALUE (*func) (VALUE), VALUE arg, int *state)
+VALUE rb_protect(VALUE (*func) (VALUE), VALUE arg, int *state) ::
関数funcã‚’argを引数ã¨ã—ã¦å®Ÿè¡Œã—, 例外ãŒç™ºç”Ÿã—ãªã‘れã°ãã®æˆ»
り値を返ã™ï¼Žä¾‹å¤–ãŒç™ºç”Ÿã—ãŸå ´åˆã¯, *stateã«éž0をセットã—ã¦
@@ -1345,225 +1335,226 @@ VALUE rb_protect(VALUE (*func) (VALUE), VALUE arg, int *state)
rb_jump_tag()を呼ã°ãšã«æ•æ‰ã—ãŸä¾‹å¤–を無視ã™ã‚‹å ´åˆã«ã¯ï¼Œ
rb_set_errinfo(Qnil)ã§ã‚¨ãƒ©ãƒ¼æƒ…報をクリアã—ãªã‘れã°ãªã‚‰ãªã„.
-void rb_jump_tag(int state)
+void rb_jump_tag(int state) ::
rb_protect()ã‚„rb_eval_string_protect()ã§æ•æ‰ã•れãŸä¾‹å¤–ã‚’å†
é€ã™ã‚‹ï¼Žstateã¯ãれらã®é–¢æ•°ã‹ã‚‰è¿”ã•れãŸå€¤ã§ãªã‘れã°ãªã‚‰ãªã„.
ã“ã®é–¢æ•°ã¯ç›´æŽ¥ã®å‘¼ã³å‡ºã—å…ƒã«æˆ»ã‚‰ãªã„.
-void rb_iter_break()
+void rb_iter_break() ::
ç¾åœ¨ã®æœ€ã‚‚内å´ã®ãƒ–ロックを終了ã™ã‚‹ï¼Žã“ã®é–¢æ•°ã¯ç›´æŽ¥ã®å‘¼ã³å‡º
ã—å…ƒã«æˆ»ã‚‰ãªã„.
-void rb_iter_break_value(VALUE value)
+void rb_iter_break_value(VALUE value) ::
ç¾åœ¨ã®æœ€ã‚‚内å´ã®ãƒ–ロックをvalueã§çµ‚了ã™ã‚‹ï¼Žãƒ–ロックã¯å¼•æ•°ã§
与ãˆã‚‰ã‚ŒãŸvalueã‚’è¿”ã™ï¼Žã“ã®é–¢æ•°ã¯ç›´æŽ¥ã®å‘¼ã³å‡ºã—å…ƒã«æˆ»ã‚‰ãªã„.
-** 例外・エラー
+== 例外・エラー
-void rb_warning(const char *fmt, ...)
+void rb_warning(const char *fmt, ...) ::
rb_verboseæ™‚ã«æ¨™æº–エラー出力ã«è­¦å‘Šæƒ…報を表示ã™ã‚‹ï¼Žå¼•æ•°ã¯
printf()ã¨åŒã˜ï¼Ž
-void rb_raise(rb_eRuntimeError, const char *fmt, ...)
+void rb_raise(rb_eRuntimeError, const char *fmt, ...) ::
RuntimeError例外を発生ã•ã›ã‚‹ï¼Žå¼•æ•°ã¯printf()ã¨åŒã˜ï¼Ž
-void rb_raise(VALUE exception, const char *fmt, ...)
+void rb_raise(VALUE exception, const char *fmt, ...) ::
exceptionã§æŒ‡å®šã—ãŸä¾‹å¤–を発生ã•ã›ã‚‹ï¼Žfmt以下ã®å¼•æ•°ã¯
printf()ã¨åŒã˜ï¼Ž
-void rb_fatal(const char *fmt, ...)
+void rb_fatal(const char *fmt, ...) ::
致命的例外を発生ã•ã›ã‚‹ï¼Žé€šå¸¸ã®ä¾‹å¤–処ç†ã¯è¡Œãªã‚れãš, インター
プリタãŒçµ‚了ã™ã‚‹(ãŸã ã—ensureã§æŒ‡å®šã•れãŸã‚³ãƒ¼ãƒ‰ã¯çµ‚了å‰ã«
実行ã•れる).
-void rb_bug(const char *fmt, ...)
+void rb_bug(const char *fmt, ...) ::
インタープリタãªã©ãƒ—ログラムã®ãƒã‚°ã§ã—ã‹ç™ºç”Ÿã™ã‚‹ã¯ãšã®ãªã„
状æ³ã®æ™‚呼ã¶ï¼Žã‚¤ãƒ³ã‚¿ãƒ¼ãƒ—リタã¯ã‚³ã‚¢ãƒ€ãƒ³ãƒ—ã—ç›´ã¡ã«çµ‚了ã™ã‚‹ï¼Ž
例外処ç†ã¯ä¸€åˆ‡è¡Œãªã‚れãªã„.
-** Rubyã®åˆæœŸåŒ–・実行
+== Rubyã®åˆæœŸåŒ–・実行
Rubyをアプリケーションã«åŸ‹ã‚込む場åˆã«ã¯ä»¥ä¸‹ã®ã‚¤ãƒ³ã‚¿ãƒ•ェース
を使ã†ï¼Žé€šå¸¸ã®æ‹¡å¼µãƒ©ã‚¤ãƒ–ラリã«ã¯å¿…è¦ãªã„.
-void ruby_init()
+void ruby_init() ::
Rubyインタプリタã®åˆæœŸåŒ–を行ãªã†ï¼Ž
-void ruby_options(int argc, char **argv)
+void ruby_options(int argc, char **argv) ::
Rubyインタプリタã®ã‚³ãƒžãƒ³ãƒ‰ãƒ©ã‚¤ãƒ³å¼•æ•°ã®å‡¦ç†ã‚’行ãªã†ï¼Ž
-void ruby_run()
+void ruby_run() ::
Rubyインタプリタを実行ã™ã‚‹ï¼Ž
-void ruby_script(char *name)
+void ruby_script(char *name) ::
Rubyã®ã‚¹ã‚¯ãƒªãƒ—トå($0)を設定ã™ã‚‹ï¼Ž
-** インタプリタã®ã‚¤ãƒ™ãƒ³ãƒˆã®ãƒ•ック
+== インタプリタã®ã‚¤ãƒ™ãƒ³ãƒˆã®ãƒ•ック
- void rb_add_event_hook(rb_event_hook_func_t func, rb_event_flag_t events, VALUE data)
+ void rb_add_event_hook(rb_event_hook_func_t func, rb_event_flag_t events,
+ VALUE data)
指定ã•れãŸã‚¤ãƒ³ã‚¿ãƒ—リタã®ã‚¤ãƒ™ãƒ³ãƒˆã«å¯¾ã™ã‚‹ãƒ•ック関数を追加ã—ã¾ã™ï¼Ž
eventsã¯ä»¥ä¸‹ã®å€¤ã®orã§ãªã‘れã°ãªã‚Šã¾ã›ã‚“:
- RUBY_EVENT_LINE
- RUBY_EVENT_CLASS
- RUBY_EVENT_END
- RUBY_EVENT_CALL
- RUBY_EVENT_RETURN
- RUBY_EVENT_C_CALL
- RUBY_EVENT_C_RETURN
- RUBY_EVENT_RAISE
- RUBY_EVENT_ALL
+ RUBY_EVENT_LINE
+ RUBY_EVENT_CLASS
+ RUBY_EVENT_END
+ RUBY_EVENT_CALL
+ RUBY_EVENT_RETURN
+ RUBY_EVENT_C_CALL
+ RUBY_EVENT_C_RETURN
+ RUBY_EVENT_RAISE
+ RUBY_EVENT_ALL
rb_event_hook_func_tã®å®šç¾©ã¯ä»¥ä¸‹ã®é€šã‚Šã§ã™:
- typedef void (*rb_event_hook_func_t)(rb_event_t event, VALUE data,
- VALUE self, ID id, VALUE klass)
+ typedef void (*rb_event_hook_func_t)(rb_event_t event, VALUE data,
+ VALUE self, ID id, VALUE klass)
rb_add_event_hook() ã®ç¬¬3引数 data ã¯ï¼Œãƒ•ック関数ã®ç¬¬2引数ã¨
ã—ã¦æ¸¡ã•れã¾ã™ï¼Žã“れã¯1.8ã§ã¯ç¾åœ¨ã®NODEã¸ã®ãƒã‚¤ãƒ³ã‚¿ã§ã—ãŸï¼Žä»¥
下㮠RB_EVENT_HOOKS_HAVE_CALLBACK_DATA ã‚‚å‚ç…§ã—ã¦ãã ã•ã„.
- int rb_remove_event_hook(rb_event_hook_func_t func)
+ int rb_remove_event_hook(rb_event_hook_func_t func)
指定ã•れãŸãƒ•ック関数を削除ã—ã¾ã™ï¼Ž
-** äº’æ›æ€§ã®ãŸã‚ã®ãƒžã‚¯ãƒ­
+== äº’æ›æ€§ã®ãŸã‚ã®ãƒžã‚¯ãƒ­
APIã®äº’æ›æ€§ã‚’ãƒã‚§ãƒƒã‚¯ã™ã‚‹ãŸã‚ã«ä»¥ä¸‹ã®ãƒžã‚¯ãƒ­ãŒãƒ‡ãƒ•ォルトã§å®šç¾©ã•れã¦ã„ã¾ã™ï¼Ž
-NORETURN_STYLE_NEW
+NORETURN_STYLE_NEW ::
NORETURN マクロãŒé–¢æ•°åž‹ãƒžã‚¯ãƒ­ã¨ã—ã¦å®šç¾©ã•れã¦ã„ã‚‹ã“ã¨ã‚’æ„味ã™ã‚‹ï¼Ž
-HAVE_RB_DEFINE_ALLOC_FUNC
+HAVE_RB_DEFINE_ALLOC_FUNC ::
rb_define_alloc_func() é–¢æ•°ãŒæä¾›ã•れã¦ã„ã‚‹ã“ã¨ï¼Œã¤ã¾ã‚Š
allocation framework ãŒä½¿ã‚れるã“ã¨ã‚’æ„味ã™ã‚‹ï¼Ž
have_func("rb_define_alloc_func", "ruby.h")
ã®çµæžœã¨åŒã˜ï¼Ž
-HAVE_RB_REG_NEW_STR
+HAVE_RB_REG_NEW_STR ::
Stringオブジェクトã‹ã‚‰Regexpオブジェクトを作る
rb_reg_new_str() é–¢æ•°ãŒæä¾›ã•れã¦ã„ã‚‹ã“ã¨ã‚’æ„味ã™ã‚‹ï¼Ž
have_func("rb_reg_new_str", "ruby.h").
ã®çµæžœã¨åŒã˜ï¼Ž
-HAVE_RB_IO_T
+HAVE_RB_IO_T ::
rb_io_t åž‹ãŒæä¾›ã•れã¦ã„ã‚‹ã“ã¨ã‚’æ„味ã™ã‚‹ï¼Ž
-USE_SYMBOL_AS_METHOD_NAME
+USE_SYMBOL_AS_METHOD_NAME ::
メソッドåã‚’è¿”ã™ãƒ¡ã‚½ãƒƒãƒ‰ï¼ŒModule#methods, #singleton_methods
ãªã©ãŒSymbolã‚’è¿”ã™ã“ã¨ã‚’æ„味ã™ã‚‹ï¼Ž
-HAVE_RUBY_*_H
+HAVE_RUBY_*_H ::
ruby.h ã§å®šç¾©ã•れã¦ã„る.対応ã™ã‚‹ãƒ˜ãƒƒãƒ€ãŒæä¾›ã•れã¦ã„ã‚‹ã“ã¨
ã‚’æ„味ã™ã‚‹ï¼ŽãŸã¨ãˆã°ï¼ŒHAVE_RUBY_ST_H ãŒå®šç¾©ã•れã¦ã„ã‚‹å ´åˆã¯
å˜ãªã‚‹ st.h ã§ã¯ãªã ruby/st.h を使用ã™ã‚‹ï¼Ž
-RB_EVENT_HOOKS_HAVE_CALLBACK_DATA
+RB_EVENT_HOOKS_HAVE_CALLBACK_DATA ::
rb_add_event_hook() ãŒãƒ•ãƒƒã‚¯é–¢æ•°ã«æ¸¡ã™ data を第3引数ã¨ã—ã¦
å—ã‘å–ã‚‹ã“ã¨ã‚’æ„味ã™ã‚‹ï¼Ž
-Appendix C. extconf.rbã§ä½¿ãˆã‚‹é–¢æ•°ãŸã¡
+= Appendix C. extconf.rbã§ä½¿ãˆã‚‹é–¢æ•°ãŸã¡
extconf.rbã®ä¸­ã§ã¯åˆ©ç”¨å¯èƒ½ãªã‚³ãƒ³ãƒ‘イルæ¡ä»¶ãƒã‚§ãƒƒã‚¯ã®é–¢æ•°ã¯ä»¥
下ã®é€šã‚Šã§ã‚る.
-have_macro(macro, headers)
+have_macro(macro, headers) ::
ヘッダファイルheaderをインクルードã—ã¦ãƒžã‚¯ãƒ­macroãŒå®šç¾©ã•
れã¦ã„ã‚‹ã‹ã©ã†ã‹ãƒã‚§ãƒƒã‚¯ã™ã‚‹ï¼Žãƒžã‚¯ãƒ­ãŒå®šç¾©ã•れã¦ã„る時true
ã‚’è¿”ã™ï¼Ž
-have_library(lib, func)
+have_library(lib, func) ::
関数funcを定義ã—ã¦ã„るライブラリlibã®å­˜åœ¨ã‚’ãƒã‚§ãƒƒã‚¯ã™ã‚‹ï¼Ž
ライブラリãŒå­˜åœ¨ã™ã‚‹æ™‚,trueã‚’è¿”ã™ï¼Ž
-find_library(lib, func, path...)
+find_library(lib, func, path...) ::
関数funcを定義ã—ã¦ã„るライブラリlibã®å­˜åœ¨ã‚’ -Lpath を追加
ã—ãªãŒã‚‰ãƒã‚§ãƒƒã‚¯ã™ã‚‹ï¼Žãƒ©ã‚¤ãƒ–ラリãŒè¦‹ä»˜ã‹ã£ãŸæ™‚,trueã‚’è¿”ã™ï¼Ž
-have_func(func, header)
+have_func(func, header) ::
ヘッダファイルheaderをインクルードã—ã¦é–¢æ•°funcã®å­˜åœ¨ã‚’ãƒã‚§
ックã™ã‚‹ï¼ŽfuncãŒæ¨™æº–ã§ã¯ãƒªãƒ³ã‚¯ã•れãªã„ライブラリ内ã®ã‚‚ã®ã§
ã‚る時ã«ã¯å…ˆã«have_libraryã§ãã®ãƒ©ã‚¤ãƒ–ラリをãƒã‚§ãƒƒã‚¯ã—ã¦ãŠ
ã事.関数ãŒå­˜åœ¨ã™ã‚‹æ™‚trueã‚’è¿”ã™ï¼Ž
-have_var(var, header)
+have_var(var, header) ::
ヘッダファイルheaderをインクルードã—ã¦å¤‰æ•°varã®å­˜åœ¨ã‚’ãƒã‚§ãƒƒ
クã™ã‚‹ï¼ŽvarãŒæ¨™æº–ã§ã¯ãƒªãƒ³ã‚¯ã•れãªã„ライブラリ内ã®ã‚‚ã®ã§ã‚
る時ã«ã¯å…ˆã«have_libraryã§ãã®ãƒ©ã‚¤ãƒ–ラリをãƒã‚§ãƒƒã‚¯ã—ã¦ãŠã
事.変数ãŒå­˜åœ¨ã™ã‚‹æ™‚trueã‚’è¿”ã™ï¼Ž
-have_header(header)
+have_header(header) ::
ヘッダファイルã®å­˜åœ¨ã‚’ãƒã‚§ãƒƒã‚¯ã™ã‚‹ï¼Žãƒ˜ãƒƒãƒ€ãƒ•ァイルãŒå­˜åœ¨ã™
る時trueã‚’è¿”ã™ï¼Ž
-find_header(header, path...)
+find_header(header, path...) ::
ヘッダファイルheaderã®å­˜åœ¨ã‚’ -Ipath を追加ã—ãªãŒã‚‰ãƒã‚§ãƒƒã‚¯
ã™ã‚‹ï¼Žãƒ˜ãƒƒãƒ€ãƒ•ァイルãŒè¦‹ä»˜ã‹ã£ãŸæ™‚,trueã‚’è¿”ã™ï¼Ž
-have_struct_member(type, member[, header[, opt]])
+have_struct_member(type, member[, header[, opt]]) ::
ヘッダファイルheaderをインクルードã—ã¦åž‹typeã«ãƒ¡ãƒ³ãƒmember
ãŒå­˜åœ¨ã™ã‚‹ã‹ã‚’ãƒã‚§ãƒƒã‚¯ã™ã‚‹ï¼ŽtypeãŒå®šç¾©ã•れã¦ã„ã¦ï¼Œmemberã‚’
æŒã¤ã™ã‚‹æ™‚trueã‚’è¿”ã™ï¼Ž
-have_type(type, header, opt)
+have_type(type, header, opt) ::
ヘッダファイルheaderをインクルードã—ã¦åž‹typeãŒå­˜åœ¨ã™ã‚‹ã‹ã‚’
ãƒã‚§ãƒƒã‚¯ã™ã‚‹ï¼ŽtypeãŒå®šç¾©ã•れã¦ã„る時trueã‚’è¿”ã™ï¼Ž
-check_sizeof(type, header)
+check_sizeof(type, header) ::
ヘッダファイルheaderをインクルードã—ã¦åž‹typeã®charå˜ä½ã‚µã‚¤
ズを調ã¹ã‚‹ï¼ŽtypeãŒå®šç¾©ã•れã¦ã„る時ãã®ã‚µã‚¤ã‚ºã‚’è¿”ã™ï¼Žå®šç¾©ã•
れã¦ã„ãªã„ã¨ãã¯nilã‚’è¿”ã™ï¼Ž
-create_makefile(target[, target_prefix])
+create_makefile(target[, target_prefix]) ::
拡張ライブラリ用ã®Makefileを生æˆã™ã‚‹ï¼Žã“ã®é–¢æ•°ã‚’呼ã°ãªã‘れ
ã°ãã®ãƒ©ã‚¤ãƒ–ラリã¯ã‚³ãƒ³ãƒ‘イルã•れãªã„.targetã¯ãƒ¢ã‚¸ãƒ¥ãƒ¼ãƒ«å
を表ã™ï¼Ž
-find_executable(command, path)
+find_executable(command, path) ::
コマンドcommandã‚’File::PATH_SEPARATORã§åŒºåˆ‡ã‚‰ã‚ŒãŸãƒ‘スåã®
リストpathã‹ã‚‰æŽ¢ã™ï¼ŽpathãŒnilã¾ãŸã¯çœç•¥ã•れãŸå ´åˆã¯ï¼Œç’°å¢ƒ
変数PATHã®å€¤ã‚’使用ã™ã‚‹ï¼Žå®Ÿè¡Œå¯èƒ½ãªã‚³ãƒžãƒ³ãƒ‰ãŒè¦‹ã¤ã‹ã£ãŸå ´åˆ
ã¯ãƒ‘スをå«ã‚€ãƒ•ァイルå,見ã¤ã‹ã‚‰ãªã‹ã£ãŸå ´åˆã¯nilã‚’è¿”ã™ï¼Ž
-with_config(withval[, default=nil])
+with_config(withval[, default=nil]) ::
コマンドライン上ã®--with-<withval>ã§æŒ‡å®šã•れãŸã‚ªãƒ—ション値
を得る.
-enable_config(config, *defaults)
-disable_config(config, *defaults)
+enable_config(config, *defaults) ::
+disable_config(config, *defaults) ::
コマンドライン上ã®--enable-<config>ã¾ãŸã¯
--disable-<config>ã§æŒ‡å®šã•れãŸçœŸå½å€¤ã‚’得る.
@@ -1573,8 +1564,8 @@ disable_config(config, *defaults)
ã„ã‚‹å ´åˆã¯*defaultsã‚’yieldã—ãŸçµæžœï¼Œãƒ–ロックãªã—ãªã‚‰
*defaultsã‚’è¿”ã™ï¼Ž
-dir_config(target[, default_dir])
-dir_config(target[, default_include, default_lib])
+dir_config(target[, default_dir]) ::
+dir_config(target[, default_include, default_lib]) ::
コマンドライン上ã®--with-<target>-dir, --with-<target>-include,
--with-<target>-libã®ã„ãšã‚Œã‹ã§æŒ‡å®šã•れるディレクトリを
@@ -1583,7 +1574,7 @@ dir_config(target[, default_include, default_lib])
ã¨ç­‰ä¾¡ã§ã‚る.追加ã•れ㟠include ディレクトリ㨠lib ディレ
クトリã®é…列を返ã™ï¼Ž ([include_dir, lib_dir])
-pkg_config(pkg)
+pkg_config(pkg) ::
pkg-configコマンドã‹ã‚‰ãƒ‘ッケージpkgã®æƒ…報を得る.
pkg-configã®å®Ÿéš›ã®ã‚³ãƒžãƒ³ãƒ‰åã¯ï¼Œ--with-pkg-configコマンド