From e871b77f417538dc181ef69d497262786d96f5c0 Mon Sep 17 00:00:00 2001 From: Seba Gamboa Date: Fri, 9 Oct 2015 17:43:47 -0300 Subject: Increasing docs coverage --- .yardopts | 8 ++++++++ include/mruby.h | 19 ++++++++++++++++++- src/array.c | 2 +- src/hash.c | 2 +- src/kernel.c | 2 +- src/numeric.c | 4 ++-- src/object.c | 6 +++--- src/string.c | 2 +- src/symbol.c | 2 +- 9 files changed, 36 insertions(+), 11 deletions(-) diff --git a/.yardopts b/.yardopts index 017b7ce70..fa13642a8 100644 --- a/.yardopts +++ b/.yardopts @@ -1,6 +1,14 @@ --plugin mruby --plugin coderay --output-dir doc/api + +src/**/*.c +mrblib/**/*.rb +include/**/*.h + +mrbgems/*/src/**/*.c +mrbgems/*/mrblib/**/*.rb +mrbgems/*/include/**/*.h - AUTHORS MITL diff --git a/include/mruby.h b/include/mruby.h index d50ec3496..7ed4973e2 100644 --- a/include/mruby.h +++ b/include/mruby.h @@ -887,9 +887,26 @@ MRB_API mrb_value mrb_attr_get(mrb_state *mrb, mrb_value obj, mrb_sym id); MRB_API mrb_bool mrb_respond_to(mrb_state *mrb, mrb_value obj, mrb_sym mid); MRB_API mrb_bool mrb_obj_is_instance_of(mrb_state *mrb, mrb_value obj, struct RClass* c); -/* fiber functions (you need to link mruby-fiber mrbgem to use) */ + +/* + * Resume a Fiber + * + * @mrbgem mruby-fiber + */ MRB_API mrb_value mrb_fiber_resume(mrb_state *mrb, mrb_value fib, mrb_int argc, const mrb_value *argv); + +/* + * Yield a Fiber + * + * @mrbgem mruby-fiber + */ MRB_API mrb_value mrb_fiber_yield(mrb_state *mrb, mrb_int argc, const mrb_value *argv); + +/* + * FiberError reference + * + * @mrbgem mruby-fiber + */ #define E_FIBER_ERROR (mrb_class_get(mrb, "FiberError")) /* memory pool implementation */ diff --git a/src/array.c b/src/array.c index aa914952a..2ef9c2a47 100644 --- a/src/array.c +++ b/src/array.c @@ -1068,7 +1068,7 @@ mrb_init_array(mrb_state *mrb) { struct RClass *a; - a = mrb->array_class = mrb_define_class(mrb, "Array", mrb->object_class); /* 15.2.12 */ + mrb->array_class = a = mrb_define_class(mrb, "Array", mrb->object_class); /* 15.2.12 */ MRB_SET_INSTANCE_TT(a, MRB_TT_ARRAY); mrb_define_class_method(mrb, a, "[]", mrb_ary_s_create, MRB_ARGS_ANY()); /* 15.2.12.4.1 */ diff --git a/src/hash.c b/src/hash.c index ffb8bd931..44b878890 100644 --- a/src/hash.c +++ b/src/hash.c @@ -827,7 +827,7 @@ mrb_init_hash(mrb_state *mrb) { struct RClass *h; - h = mrb->hash_class = mrb_define_class(mrb, "Hash", mrb->object_class); /* 15.2.13 */ + mrb->hash_class = h = mrb_define_class(mrb, "Hash", mrb->object_class); /* 15.2.13 */ MRB_SET_INSTANCE_TT(h, MRB_TT_HASH); mrb_define_method(mrb, h, "[]", mrb_hash_aget, MRB_ARGS_REQ(1)); /* 15.2.13.4.2 */ diff --git a/src/kernel.c b/src/kernel.c index 759dc42b7..a6c967b27 100644 --- a/src/kernel.c +++ b/src/kernel.c @@ -1097,7 +1097,7 @@ mrb_init_kernel(mrb_state *mrb) { struct RClass *krn; - krn = mrb->kernel_module = mrb_define_module(mrb, "Kernel"); /* 15.3.1 */ + mrb->kernel_module = krn = mrb_define_module(mrb, "Kernel"); /* 15.3.1 */ mrb_define_class_method(mrb, krn, "block_given?", mrb_f_block_given_p_m, MRB_ARGS_NONE()); /* 15.3.1.2.2 */ mrb_define_class_method(mrb, krn, "global_variables", mrb_f_global_variables, MRB_ARGS_NONE()); /* 15.3.1.2.4 */ mrb_define_class_method(mrb, krn, "iterator?", mrb_f_block_given_p_m, MRB_ARGS_NONE()); /* 15.3.1.2.5 */ diff --git a/src/numeric.c b/src/numeric.c index 1a3c903f0..5d595f6a9 100644 --- a/src/numeric.c +++ b/src/numeric.c @@ -1161,7 +1161,7 @@ mrb_init_numeric(mrb_state *mrb) mrb_define_method(mrb, integer, "to_int", int_to_i, MRB_ARGS_NONE()); /* Fixnum Class */ - fixnum = mrb->fixnum_class = mrb_define_class(mrb, "Fixnum", integer); + mrb->fixnum_class = fixnum = mrb_define_class(mrb, "Fixnum", integer); mrb_define_method(mrb, fixnum, "+", fix_plus, MRB_ARGS_REQ(1)); /* 15.2.8.3.1 */ mrb_define_method(mrb, fixnum, "-", fix_minus, MRB_ARGS_REQ(1)); /* 15.2.8.3.2 */ mrb_define_method(mrb, fixnum, "*", fix_mul, MRB_ARGS_REQ(1)); /* 15.2.8.3.3 */ @@ -1181,7 +1181,7 @@ mrb_init_numeric(mrb_state *mrb) mrb_define_method(mrb, fixnum, "divmod", fix_divmod, MRB_ARGS_REQ(1)); /* 15.2.8.3.30 (x) */ /* Float Class */ - fl = mrb->float_class = mrb_define_class(mrb, "Float", numeric); /* 15.2.9 */ + mrb->float_class = fl = mrb_define_class(mrb, "Float", numeric); /* 15.2.9 */ mrb_undef_class_method(mrb, fl, "new"); mrb_define_method(mrb, fl, "+", flo_plus, MRB_ARGS_REQ(1)); /* 15.2.9.3.1 */ mrb_define_method(mrb, fl, "-", flo_minus, MRB_ARGS_REQ(1)); /* 15.2.9.3.2 */ diff --git a/src/object.c b/src/object.c index 2e0bd245f..da60ebbcd 100644 --- a/src/object.c +++ b/src/object.c @@ -264,7 +264,7 @@ mrb_init_object(mrb_state *mrb) struct RClass *t; struct RClass *f; - n = mrb->nil_class = mrb_define_class(mrb, "NilClass", mrb->object_class); + mrb->nil_class = n = mrb_define_class(mrb, "NilClass", mrb->object_class); mrb_undef_class_method(mrb, n, "new"); mrb_define_method(mrb, n, "&", false_and, MRB_ARGS_REQ(1)); /* 15.2.4.3.1 */ mrb_define_method(mrb, n, "^", false_xor, MRB_ARGS_REQ(1)); /* 15.2.4.3.2 */ @@ -273,7 +273,7 @@ mrb_init_object(mrb_state *mrb) mrb_define_method(mrb, n, "to_s", nil_to_s, MRB_ARGS_NONE()); /* 15.2.4.3.5 */ mrb_define_method(mrb, n, "inspect", nil_inspect, MRB_ARGS_NONE()); - t = mrb->true_class = mrb_define_class(mrb, "TrueClass", mrb->object_class); + mrb->true_class = t = mrb_define_class(mrb, "TrueClass", mrb->object_class); mrb_undef_class_method(mrb, t, "new"); mrb_define_method(mrb, t, "&", true_and, MRB_ARGS_REQ(1)); /* 15.2.5.3.1 */ mrb_define_method(mrb, t, "^", true_xor, MRB_ARGS_REQ(1)); /* 15.2.5.3.2 */ @@ -281,7 +281,7 @@ mrb_init_object(mrb_state *mrb) mrb_define_method(mrb, t, "|", true_or, MRB_ARGS_REQ(1)); /* 15.2.5.3.4 */ mrb_define_method(mrb, t, "inspect", true_to_s, MRB_ARGS_NONE()); - f = mrb->false_class = mrb_define_class(mrb, "FalseClass", mrb->object_class); + mrb->false_class = f = mrb_define_class(mrb, "FalseClass", mrb->object_class); mrb_undef_class_method(mrb, f, "new"); mrb_define_method(mrb, f, "&", false_and, MRB_ARGS_REQ(1)); /* 15.2.6.3.1 */ mrb_define_method(mrb, f, "^", false_xor, MRB_ARGS_REQ(1)); /* 15.2.6.3.2 */ diff --git a/src/string.c b/src/string.c index b597c3da9..ef84459ed 100644 --- a/src/string.c +++ b/src/string.c @@ -2674,7 +2674,7 @@ mrb_init_string(mrb_state *mrb) mrb_static_assert(RSTRING_EMBED_LEN_MAX < (1 << 5), "pointer size too big for embedded string"); - s = mrb->string_class = mrb_define_class(mrb, "String", mrb->object_class); /* 15.2.10 */ + mrb->string_class = s = mrb_define_class(mrb, "String", mrb->object_class); /* 15.2.10 */ MRB_SET_INSTANCE_TT(s, MRB_TT_STRING); mrb_define_method(mrb, s, "bytesize", mrb_str_bytesize, MRB_ARGS_NONE()); diff --git a/src/symbol.c b/src/symbol.c index f1c0bf80a..e380a5b5e 100644 --- a/src/symbol.c +++ b/src/symbol.c @@ -478,7 +478,7 @@ mrb_init_symbol(mrb_state *mrb) { struct RClass *sym; - sym = mrb->symbol_class = mrb_define_class(mrb, "Symbol", mrb->object_class); /* 15.2.11 */ + mrb->symbol_class = sym = mrb_define_class(mrb, "Symbol", mrb->object_class); /* 15.2.11 */ mrb_define_method(mrb, sym, "===", sym_equal, MRB_ARGS_REQ(1)); /* 15.2.11.3.1 */ mrb_define_method(mrb, sym, "id2name", mrb_sym_to_s, MRB_ARGS_NONE()); /* 15.2.11.3.2 */ -- cgit v1.2.3 From fe1275a6afc587a1034afa708477dad466a53b94 Mon Sep 17 00:00:00 2001 From: Seba Gamboa Date: Wed, 14 Oct 2015 12:17:52 -0300 Subject: Improved mrb_args_format table --- .yardopts | 1 + include/mruby.h | 53 ++++++++++++++++++++++++++++------------------------- 2 files changed, 29 insertions(+), 25 deletions(-) diff --git a/.yardopts b/.yardopts index fa13642a8..27f6d59a1 100644 --- a/.yardopts +++ b/.yardopts @@ -1,3 +1,4 @@ +--markup markdown --plugin mruby --plugin coderay --output-dir doc/api diff --git a/include/mruby.h b/include/mruby.h index 7ed4973e2..7f9c48562 100644 --- a/include/mruby.h +++ b/include/mruby.h @@ -607,42 +607,45 @@ MRB_API struct RClass * mrb_define_module_under(mrb_state *mrb, struct RClass *o #define MRB_ARGS_NONE() ((mrb_aspec)0) /** - * Format specifiers for \ref mrb_get_args function - * - * Must be a list of following format specifiers: - * - * | char | mruby type | retrieve types |note | - * |:----:|----------------|---------------------|----------------------------------------------------| - * | o | Object | mrb_value | Could be used to retrieve any type of argument | - * | C | Class/Module | mrb_value | | - * | S | String | mrb_value | when ! follows, the value may be nil | - * | A | Array | mrb_value | when ! follows, the value may be nil | - * | H | Hash | mrb_value | when ! follows, the value may be nil | - * | s | String | char *, mrb_int | Receive two arguments; s! gives (NULL,0) for nil | - * | z | String | char * | NUL terminated string; z! gives NULL for nil | - * | a | Array | mrb_value *, mrb_int | Receive two arguments; a! gives (NULL,0) for nil | - * | f | Float | mrb_float | | - * | i | Integer | mrb_int | | - * | b | boolean | mrb_bool | | - * | n | Symbol | mrb_sym | | - * | & | block | mrb_value | | - * | * | rest arguments | mrb_value *, mrb_int | Receive the rest of arguments as an array. | - * | \| | optional | | After this spec following specs would be optional. | - * | ? | optional given | mrb_bool | True if preceding argument is given. Used to check optional argument is given. | + * Format specifiers for {mrb_get_args} function + * + * Must be a C string composed of the following format specifiers: + * + * | char | Ruby type | C types | Notes | + * |:----:|----------------|-------------------|----------------------------------------------------| + * | `o` | {Object} | {mrb_value} | Could be used to retrieve any type of argument | + * | `C` | {Class}/{Module} | {mrb_value} | | + * | `S` | {String} | {mrb_value} | when `!` follows, the value may be `nil` | + * | `A` | {Array} | {mrb_value} | when `!` follows, the value may be `nil` | + * | `H` | {Hash} | {mrb_value} | when `!` follows, the value may be `nil` | + * | `s` | {String} | char *, {mrb_int} | Receive two arguments; `s!` gives (`NULL`,`0`) for `nil` | + * | `z` | {String} | char * | `NULL` terminated string; `z!` gives `NULL` for `nil` | + * | `a` | {Array} | {mrb_value} *, {mrb_int} | Receive two arguments; `a!` gives (`NULL`,`0`) for `nil` | + * | `f` | {Float} | {mrb_float} | | + * | `i` | {Integer} | {mrb_int} | | + * | `b` | boolean | {mrb_bool} | | + * | `n` | {Symbol} | {mrb_sym} | | + * | `&` | block | {mrb_value} | | + * | `*` | rest arguments | {mrb_value} *, {mrb_int} | Receive the rest of arguments as an array. | + * | | | optional | | After this spec following specs would be optional. | + * | `?` | optional given | {mrb_bool} | `TRUE` if preceding argument is given. Used to check optional argument is given. | + * + * @see mrb_get_args */ typedef const char *mrb_args_format; /** * Retrieve arguments from mrb_state. * - * When applicable, implicit conversions (such as to_str, to_ary, to_hash) are + * When applicable, implicit conversions (such as `to_str`, `to_ary`, `to_hash`) are * applied to received arguments. - * Use it inside a function pointed by mrb_func_t. + * Used inside a function of mrb_func_t type. * * @param mrb The current MRuby state. - * @param format is a list of format specifiers see @ref mrb_args_format + * @param format [mrb_args_format] is a list of format specifiers * @param ... The passing variadic arguments must be a pointer of retrieving type. * @return the number of arguments retrieved. + * @see mrb_args_format */ MRB_API mrb_int mrb_get_args(mrb_state *mrb, mrb_args_format format, ...); -- cgit v1.2.3 From 84b70886cd9827593810264bf1f068044d5c6986 Mon Sep 17 00:00:00 2001 From: Seba Gamboa Date: Wed, 14 Oct 2015 12:49:17 -0300 Subject: Add block to document mrb_value type --- include/mruby/value.h | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/include/mruby/value.h b/include/mruby/value.h index dfad3ec73..002ea8511 100644 --- a/include/mruby/value.h +++ b/include/mruby/value.h @@ -98,6 +98,22 @@ enum mrb_vtype { #include "mruby/object.h" +#ifdef MRB_DOCUMENTATION_BLOCK + +/** + * @abstract + * MRuby value boxing. + * + * Actual implementation depends on configured boxing type. + * + * @see mruby/boxing_no.h Default boxing representation + * @see mruby/boxing_word.h Word representation + * @see mruby/boxing_nan.h Boxed double representation + */ +typedef void mrb_value; + +#endif + #if defined(MRB_NAN_BOXING) #include "boxing_nan.h" #elif defined(MRB_WORD_BOXING) -- cgit v1.2.3 From 5cdcce8dbddd94ecb9503a0a1d47370c4ef97177 Mon Sep 17 00:00:00 2001 From: Seba Gamboa Date: Wed, 14 Oct 2015 14:37:47 -0300 Subject: Mark core gems with mrbgem tag --- include/mruby/error.h | 24 ++++++++- mrbgems/mruby-array-ext/mrblib/array.rb | 46 ++++++++++++----- mrbgems/mruby-array-ext/src/array.c | 19 ++++--- mrbgems/mruby-enum-ext/mrblib/enum.rb | 63 ++++++++++++++--------- mrbgems/mruby-enum-lazy/mrblib/lazy.rb | 47 +++++++++-------- mrbgems/mruby-enumerator/mrblib/enumerator.rb | 3 +- mrbgems/mruby-eval/src/eval.c | 8 +++ mrbgems/mruby-exit/src/mruby-exit.c | 4 ++ mrbgems/mruby-fiber/src/fiber.c | 12 +++++ mrbgems/mruby-hash-ext/mrblib/hash.rb | 19 ++++--- mrbgems/mruby-hash-ext/src/hash-ext.c | 2 + mrbgems/mruby-kernel-ext/src/kernel.c | 10 ++++ mrbgems/mruby-math/src/math.c | 6 +++ mrbgems/mruby-numeric-ext/mrblib/numeric_ext.rb | 3 ++ mrbgems/mruby-numeric-ext/src/numeric_ext.c | 3 ++ mrbgems/mruby-object-ext/mrblib/object.rb | 1 + mrbgems/mruby-object-ext/src/object.c | 12 +++-- mrbgems/mruby-objectspace/src/mruby_objectspace.c | 6 +++ mrbgems/mruby-print/mrblib/print.rb | 8 +-- mrbgems/mruby-proc-ext/mrblib/proc.rb | 4 ++ mrbgems/mruby-proc-ext/src/proc.c | 15 +++++- mrbgems/mruby-random/src/random.c | 18 +++++-- mrbgems/mruby-range-ext/src/range.c | 9 +++- mrbgems/mruby-sprintf/mrblib/string.rb | 2 + mrbgems/mruby-sprintf/src/kernel.c | 3 ++ mrbgems/mruby-string-ext/mrblib/string.rb | 16 ++++++ mrbgems/mruby-string-ext/src/string.c | 42 +++++++++++++++ mrbgems/mruby-struct/src/struct.c | 34 ++++++------ mrbgems/mruby-symbol-ext/mrblib/symbol.rb | 16 ++++-- mrbgems/mruby-symbol-ext/src/symbol.c | 4 ++ mrbgems/mruby-time/mrblib/time.rb | 3 ++ mrbgems/mruby-toplevel-ext/mrblib/toplevel.rb | 7 ++- 32 files changed, 361 insertions(+), 108 deletions(-) diff --git a/include/mruby/error.h b/include/mruby/error.h index 8b6430137..1ac0791a2 100644 --- a/include/mruby/error.h +++ b/include/mruby/error.h @@ -32,12 +32,34 @@ MRB_API mrb_noreturn void mrb_no_method_error(mrb_state *mrb, mrb_sym id, mrb_va /* declaration for fail method */ MRB_API mrb_value mrb_f_raise(mrb_state*, mrb_value); -/* functions defined in mruby-error mrbgem */ +/** + * Protect + * + * @mrbgem mruby-error + */ MRB_API mrb_value mrb_protect(mrb_state *mrb, mrb_func_t body, mrb_value data, mrb_bool *state); + +/** + * Ensure + * + * @mrbgem mruby-error + */ MRB_API mrb_value mrb_ensure(mrb_state *mrb, mrb_func_t body, mrb_value b_data, mrb_func_t ensure, mrb_value e_data); + +/** + * Rescue + * + * @mrbgem mruby-error + */ MRB_API mrb_value mrb_rescue(mrb_state *mrb, mrb_func_t body, mrb_value b_data, mrb_func_t rescue, mrb_value r_data); + +/** + * Rescue exception + * + * @mrbgem mruby-error + */ MRB_API mrb_value mrb_rescue_exceptions(mrb_state *mrb, mrb_func_t body, mrb_value b_data, mrb_func_t rescue, mrb_value r_data, mrb_int len, struct RClass **classes); diff --git a/mrbgems/mruby-array-ext/mrblib/array.rb b/mrbgems/mruby-array-ext/mrblib/array.rb index 35be79339..74b183d3f 100644 --- a/mrbgems/mruby-array-ext/mrblib/array.rb +++ b/mrbgems/mruby-array-ext/mrblib/array.rb @@ -1,4 +1,5 @@ class Array + ## # call-seq: # ary.uniq! -> ary or nil @@ -15,6 +16,7 @@ class Array # c = [["student","sam"], ["student","george"], ["teacher","matz"]] # c.uniq! { |s| s.first } # => [["student", "sam"], ["teacher", "matz"]] # + # @mrbgem mruby-array-ext def uniq!(&block) ary = self.dup result = [] @@ -54,6 +56,7 @@ class Array # b = [["student","sam"], ["student","george"], ["teacher","matz"]] # b.uniq { |s| s.first } # => [["student", "sam"], ["teacher", "matz"]] # + # @mrbgem mruby-array-ext def uniq(&block) ary = self.dup if block @@ -75,6 +78,7 @@ class Array # # [ 1, 1, 2, 2, 3, 3, 4, 5 ] - [ 1, 2, 4 ] #=> [ 3, 3, 5 ] # + # @mrbgem mruby-array-ext def -(elem) raise TypeError, "can't convert #{elem.class} into Array" unless elem.class == Array @@ -95,6 +99,7 @@ class Array # [ "a", "b", "c" ] | [ "c", "d", "a" ] # #=> [ "a", "b", "c", "d" ] # + # @mrbgem mruby-array-ext def |(elem) raise TypeError, "can't convert #{elem.class} into Array" unless elem.class == Array @@ -111,6 +116,7 @@ class Array # # [ 1, 1, 3, 5 ] & [ 1, 2, 3 ] #=> [ 1, 3 ] # + # @mrbgem mruby-array-ext def &(elem) raise TypeError, "can't convert #{elem.class} into Array" unless elem.class == Array @@ -143,6 +149,7 @@ class Array # a = [ 1, 2, [3, [4, 5] ] ] # a.flatten(1) #=> [1, 2, 3, [4, 5]] # + # @mrbgem mruby-array-ext def flatten(depth=nil) ar = [] self.each do |e| @@ -172,6 +179,7 @@ class Array # a = [ 1, 2, [3, [4, 5] ] ] # a.flatten!(1) #=> [1, 2, 3, [4, 5]] # + # @mrbgem mruby-array-ext def flatten!(depth=nil) modified = false ar = [] @@ -199,6 +207,7 @@ class Array # [ "a", nil, "b", nil, "c", nil ].compact # #=> [ "a", "b", "c" ] # + # @mrbgem mruby-array-ext def compact result = self.dup result.compact! @@ -216,6 +225,7 @@ class Array # [ "a", nil, "b", nil, "c" ].compact! #=> [ "a", "b", "c" ] # [ "a", "b", "c" ].compact! #=> nil # + # @mrbgem mruby-array-ext def compact! result = self.select { |e| !e.nil? } if result.size == self.size @@ -226,6 +236,7 @@ class Array end # for efficiency + # @mrbgem mruby-array-ext def reverse_each(&block) return to_enum :reverse_each unless block_given? @@ -238,6 +249,7 @@ class Array end NONE=Object.new + ## # call-seq: # ary.fetch(index) -> obj @@ -260,7 +272,7 @@ class Array # a.fetch(100) { |i| puts "#{i} is out of bounds" } # #=> "100 is out of bounds" # - + # @mrbgem mruby-array-ext def fetch(n=nil, ifnone=NONE, &block) warn "block supersedes default value argument" if !n.nil? && ifnone != NONE && block @@ -310,7 +322,7 @@ class Array # a.fill(1, 2) { |i| i+1 } #=> [0, 2, 3, 27] # a.fill(0..1) { |i| i+1 } #=> [1, 2, 3, 27] # - + # @mrbgem mruby-array-ext def fill(arg0=nil, arg1=nil, arg2=nil, &block) if arg0.nil? && arg1.nil? && arg2.nil? && !block raise ArgumentError, "wrong number of arguments (0 for 1..3)" @@ -394,7 +406,8 @@ class Array # a #=> ["a", "b", "c", "d"] # a.rotate(2) #=> ["c", "d", "a", "b"] # a.rotate(-3) #=> ["b", "c", "d", "a"] - + # + # @mrbgem mruby-array-ext def rotate(count=1) ary = [] len = self.length @@ -425,12 +438,12 @@ class Array # a #=> ["b", "c", "d", "a"] # a.rotate!(2) #=> ["d", "a", "b", "c"] # a.rotate!(-3) #=> ["a", "b", "c", "d"] - + # + # @mrbgem mruby-array-ext def rotate!(count=1) self.replace(self.rotate(count)) end - ## # call-seq: # ary.delete_if { |item| block } -> ary # ary.delete_if -> Enumerator @@ -446,7 +459,8 @@ class Array # # scores = [ 97, 42, 75 ] # scores.delete_if {|score| score < 80 } #=> [97] - + # + # @mrbgem mruby-array-ext def delete_if(&block) return to_enum :delete_if unless block_given? @@ -475,7 +489,8 @@ class Array # See also Enumerable#reject and Array#delete_if. # # If no block is given, an Enumerator is returned instead. - + # + # @mrbgem mruby-array-ext def reject!(&block) return to_enum :reject! unless block_given? @@ -507,7 +522,8 @@ class Array # a = %w{ a b c d } # a.insert(2, 99) #=> ["a", "b", 99, "c", "d"] # a.insert(-2, 1, 2, 3) #=> ["a", "b", 99, "c", 1, 2, 3, "d"] - + # + # @mrbgem mruby-array-ext def insert(idx, *args) idx += self.size + 1 if idx < 0 self[idx, 0] = args @@ -565,7 +581,8 @@ class Array # You must not mix the two modes at a time; the block must always # return either true/false, or always return a number. It is # undefined which value is actually picked up at each iteration. - + # + # @mrbgem mruby-array-ext def bsearch(&block) return to_enum :bsearch unless block_given? @@ -612,7 +629,8 @@ class Array # # scores = [ 97, 42, 75 ] # scores.delete_if {|score| score < 80 } #=> [97] - + # + # @mrbgem mruby-array-ext def delete_if(&block) return to_enum :delete_if unless block_given? @@ -641,7 +659,8 @@ class Array # # a = [1, 2, 3, 4, 5] # a.keep_if { |val| val > 3 } #=> [4, 5] - + # + # @mrbgem mruby-array-ext def keep_if(&block) return to_enum :keep_if unless block_given? @@ -670,7 +689,8 @@ class Array # See also Array#keep_if # # If no block is given, an Enumerator is returned instead. - + # + # @mrbgem mruby-array-ext def select!(&block) return to_enum :select! unless block_given? @@ -694,6 +714,8 @@ class Array # first object for which the block returns +true+. Returns +nil+ if no # match is found. # + # @mrbgem mruby-array-ext + # # ISO 15.2.12.5.14 def index(val=NONE, &block) return to_enum(:find_index, val) if !block && val == NONE diff --git a/mrbgems/mruby-array-ext/src/array.c b/mrbgems/mruby-array-ext/src/array.c index d69f0ac44..79dadbee5 100644 --- a/mrbgems/mruby-array-ext/src/array.c +++ b/mrbgems/mruby-array-ext/src/array.c @@ -4,7 +4,7 @@ #include "mruby/range.h" #include "mruby/hash.h" -/* +/** * call-seq: * ary.assoc(obj) -> new_ary or nil * @@ -22,8 +22,9 @@ * a = [ s1, s2, s3 ] * a.assoc("letters") #=> [ "letters", "a", "b", "c" ] * a.assoc("foo") #=> nil + * + * @mrbgem mruby-array-ext */ - static mrb_value mrb_ary_assoc(mrb_state *mrb, mrb_value ary) { @@ -73,7 +74,7 @@ mrb_ary_rassoc(mrb_state *mrb, mrb_value ary) return mrb_nil_value(); } -/* +/** * call-seq: * ary.at(index) -> obj or nil * @@ -84,8 +85,9 @@ mrb_ary_rassoc(mrb_state *mrb, mrb_value ary) * a = [ "a", "b", "c", "d", "e" ] * a.at(0) #=> "a" * a.at(-1) #=> "e" + * + * @mrbgem mruby-array-ext */ - static mrb_value mrb_ary_at(mrb_state *mrb, mrb_value ary) { @@ -95,6 +97,10 @@ mrb_ary_at(mrb_state *mrb, mrb_value ary) return mrb_ary_entry(ary, pos); } +/** + * + * @mrbgem mruby-array-ext + */ static mrb_value mrb_ary_values_at(mrb_state *mrb, mrb_value self) { @@ -106,7 +112,7 @@ mrb_ary_values_at(mrb_state *mrb, mrb_value self) return mrb_get_values_at(mrb, self, RARRAY_LEN(self), argc, argv, mrb_ary_ref); } -/* +/** * call-seq: * ary.to_h -> Hash * @@ -115,8 +121,9 @@ mrb_ary_values_at(mrb_state *mrb, mrb_value self) * * [[:foo, :bar], [1, 2]].to_h * # => {:foo => :bar, 1 => 2} + * + * @mrbgem mruby-array-ext */ - static mrb_value mrb_ary_to_h(mrb_state *mrb, mrb_value ary) { diff --git a/mrbgems/mruby-enum-ext/mrblib/enum.rb b/mrbgems/mruby-enum-ext/mrblib/enum.rb index d469f0651..7efec89c9 100644 --- a/mrbgems/mruby-enum-ext/mrblib/enum.rb +++ b/mrbgems/mruby-enum-ext/mrblib/enum.rb @@ -1,7 +1,5 @@ -## -# Enumerable -# module Enumerable + ## # call-seq: # enum.drop(n) -> array @@ -11,7 +9,8 @@ module Enumerable # # a = [1, 2, 3, 4, 5, 0] # a.drop(3) #=> [4, 5, 0] - + # + # @mrbgem mruby-enum-ext def drop(n) raise TypeError, "no implicit conversion of #{n.class} into Integer" unless n.respond_to?(:to_int) raise ArgumentError, "attempt to drop negative size" if n < 0 @@ -35,7 +34,8 @@ module Enumerable # # a = [1, 2, 3, 4, 5, 0] # a.drop_while {|i| i < 3 } #=> [3, 4, 5, 0] - + # + # @mrbgem mruby-enum-ext def drop_while(&block) return to_enum :drop_while unless block @@ -55,7 +55,8 @@ module Enumerable # # a = [1, 2, 3, 4, 5, 0] # a.take(3) #=> [1, 2, 3] - + # + # @mrbgem mruby-enum-ext def take(n) raise TypeError, "no implicit conversion of #{n.class} into Integer" unless n.respond_to?(:to_int) raise ArgumentError, "attempt to take negative size" if n < 0 @@ -81,7 +82,8 @@ module Enumerable # # a = [1, 2, 3, 4, 5, 0] # a.take_while {|i| i < 3 } #=> [1, 2] - + # + # @mrbgem mruby-enum-ext def take_while(&block) return to_enum :take_while unless block @@ -111,7 +113,8 @@ module Enumerable # [6, 7, 8] # [7, 8, 9] # [8, 9, 10] - + # + # @mrbgem mruby-enum-ext def each_cons(n, &block) raise TypeError, "no implicit conversion of #{n.class} into Integer" unless n.respond_to?(:to_int) raise ArgumentError, "invalid size" if n <= 0 @@ -139,7 +142,8 @@ module Enumerable # [4, 5, 6] # [7, 8, 9] # [10] - + # + # @mrbgem mruby-enum-ext def each_slice(n, &block) raise TypeError, "no implicit conversion of #{n.class} into Integer" unless n.respond_to?(:to_int) raise ArgumentError, "invalid slice size" if n <= 0 @@ -167,7 +171,8 @@ module Enumerable # corresponding to the key. # # (1..6).group_by {|i| i%3} #=> {0=>[3, 6], 1=>[1, 4], 2=>[2, 5]} - + # + # @mrbgem mruby-enum-ext def group_by(&block) return to_enum :group_by unless block @@ -189,7 +194,8 @@ module Enumerable # values in enum through the given block. # # If no block is given, an enumerator is returned instead. - + # + # @mrbgem mruby-enum-ext def sort_by(&block) return to_enum :sort_by unless block @@ -216,6 +222,8 @@ module Enumerable # Returns the first element, or the first +n+ elements, of the enumerable. # If the enumerable is empty, the first form returns nil, and the # second form returns an empty array. + # + # @mrbgem mruby-enum-ext def first(n=NONE) if n == NONE self.each do |*val| @@ -244,6 +252,8 @@ module Enumerable # If an argument is given, the number of items in +enum+ that # are equal to +item+ are counted. If a block is given, it # counts the number of elements yielding a true value. + # + # @mrbgem mruby-enum-ext def count(v=NONE, &block) count = 0 if block @@ -276,6 +286,8 @@ module Enumerable # # [1, 2, 3, 4].flat_map { |e| [e, -e] } #=> [1, -1, 2, -2, 3, -3, 4, -4] # [[1, 2], [3, 4]].flat_map { |e| e + [100] } #=> [1, 2, 100, 3, 4, 100] + # + # @mrbgem mruby-enum-ext def flat_map(&block) return to_enum :flat_map unless block @@ -303,7 +315,8 @@ module Enumerable # If no block is given, an enumerator is returned instead. # # %w[albatross dog horse].max_by {|x| x.length } #=> "albatross" - + # + # @mrbgem mruby-enum-ext def max_by(&block) return to_enum :max_by unless block @@ -337,7 +350,8 @@ module Enumerable # If no block is given, an enumerator is returned instead. # # %w[albatross dog horse].min_by {|x| x.length } #=> "dog" - + # + # @mrbgem mruby-enum-ext def min_by(&block) return to_enum :min_by unless block @@ -373,7 +387,8 @@ module Enumerable # a = %w(albatross dog horse) # a.minmax #=> ["albatross", "horse"] # a.minmax { |a, b| a.length <=> b.length } #=> ["dog", "albatross"] - + # + # @mrbgem mruby-enum-ext def minmax(&block) max = nil min = nil @@ -411,7 +426,8 @@ module Enumerable # If no block is given, an enumerator is returned instead. # # %w(albatross dog horse).minmax_by { |x| x.length } #=> ["dog", "albatross"] - + # + # @mrbgem mruby-enum-ext def minmax_by(&block) return to_enum :minmax_by unless block @@ -454,7 +470,8 @@ module Enumerable # [].none? #=> true # [nil, false].none? #=> true # [nil, true].none? #=> false - + # + # @mrbgem mruby-enum-ext def none?(&block) if block self.each do |*val| @@ -484,7 +501,7 @@ module Enumerable # [nil, true, 99].one? #=> false # [nil, true, false].one? #=> true # - + # @mrbgem mruby-enum-ext def one?(&block) count = 0 if block @@ -515,7 +532,7 @@ module Enumerable # (1..10).each_with_object([]) { |i, a| a << i*2 } # #=> [2, 4, 6, 8, 10, 12, 14, 16, 18, 20] # - + # @mrbgem mruby-enum-ext def each_with_object(obj=nil, &block) raise ArgumentError, "wrong number of arguments (0 for 1)" if obj.nil? @@ -542,7 +559,7 @@ module Enumerable # 2 # 1 # - + # @mrbgem mruby-enum-ext def reverse_each(&block) return to_enum :reverse_each unless block @@ -574,7 +591,7 @@ module Enumerable # a.cycle { |x| puts x } # print, a, b, c, a, b, c,.. forever. # a.cycle(2) { |x| puts x } # print, a, b, c, a, b, c. # - + # @mrbgem mruby-enum-ext def cycle(n=nil, &block) return to_enum(:cycle, n) if !block && n.nil? @@ -623,7 +640,7 @@ module Enumerable # (1..100).find_index { |i| i % 5 == 0 and i % 7 == 0 } #=> 34 # (1..100).find_index(50) #=> 49 # - + # @mrbgem mruby-enum-ext def find_index(val=NONE, &block) return to_enum(:find_index, val) if !block && val == NONE @@ -653,7 +670,7 @@ module Enumerable # enum#size. If the size of any argument is less than # enum#size, nil values are supplied. # - + # @mrbgem mruby-enum-ext def zip(*arg) ary = [] arg = arg.map{|a|a.to_a} @@ -682,7 +699,7 @@ module Enumerable # %i[hello world].each_with_index.to_h # # => {:hello => 0, :world => 1} # - + # @mrbgem mruby-enum-ext def to_h h = {} self.each do |*v| diff --git a/mrbgems/mruby-enum-lazy/mrblib/lazy.rb b/mrbgems/mruby-enum-lazy/mrblib/lazy.rb index 2ffeb1808..a31e89d0e 100644 --- a/mrbgems/mruby-enum-lazy/mrblib/lazy.rb +++ b/mrbgems/mruby-enum-lazy/mrblib/lazy.rb @@ -1,30 +1,33 @@ -# = Enumerable#lazy implementation -# -# Enumerable#lazy returns an instance of Enumerable::Lazy. -# You can use it just like as normal Enumerable object, -# except these methods act as 'lazy': -# -# - map collect -# - select find_all -# - reject -# - grep -# - drop -# - drop_while -# - take_while -# - flat_map collect_concat -# - zip -# -# == Acknowledgements -# -# Based on https://github.com/yhara/enumerable-lazy -# Inspired by https://github.com/antimon2/enumerable_lz -# http://jp.rubyist.net/magazine/?0034-Enumerable_lz (ja) - module Enumerable + + # = Enumerable#lazy implementation + # + # Enumerable#lazy returns an instance of Enumerable::Lazy. + # You can use it just like as normal Enumerable object, + # except these methods act as 'lazy': + # + # - map collect + # - select find_all + # - reject + # - grep + # - drop + # - drop_while + # - take_while + # - flat_map collect_concat + # - zip + # + # @mrbgem mruby-enum-lazy def lazy Lazy.new(self) end + # == Acknowledgements + # + # Based on https://github.com/yhara/enumerable-lazy + # Inspired by https://github.com/antimon2/enumerable_lz + # http://jp.rubyist.net/magazine/?0034-Enumerable_lz (ja) + # + # @mrbgem mruby-enum-lazy class Lazy < Enumerator def initialize(obj, &block) super(){|yielder| diff --git a/mrbgems/mruby-enumerator/mrblib/enumerator.rb b/mrbgems/mruby-enumerator/mrblib/enumerator.rb index c54959e91..c517c8152 100644 --- a/mrbgems/mruby-enumerator/mrblib/enumerator.rb +++ b/mrbgems/mruby-enumerator/mrblib/enumerator.rb @@ -84,7 +84,8 @@ # # implementing an internal iterator. # puts ext_each(o.to_enum) {|*x| puts x; [:b, *x] } # # => [], [:b], [1], [:b, 1], [1, 2], [:b, 1, 2], 3 - +# +# @mrbgem mruby-enumerator class Enumerator include Enumerable diff --git a/mrbgems/mruby-eval/src/eval.c b/mrbgems/mruby-eval/src/eval.c index dd5fd5024..d1d2c1265 100644 --- a/mrbgems/mruby-eval/src/eval.c +++ b/mrbgems/mruby-eval/src/eval.c @@ -195,6 +195,10 @@ create_proc_from_string(mrb_state *mrb, char *s, int len, mrb_value binding, cha return proc; } +/** + * + * @mrbgem mruby-eval + */ static mrb_value f_eval(mrb_state *mrb, mrb_value self) { @@ -221,6 +225,10 @@ mrb_value mrb_obj_instance_eval(mrb_state *mrb, mrb_value self); #define CI_ACC_SKIP -1 +/** + * + * @mrbgem mruby-eval + */ static mrb_value f_instance_eval(mrb_state *mrb, mrb_value self) { diff --git a/mrbgems/mruby-exit/src/mruby-exit.c b/mrbgems/mruby-exit/src/mruby-exit.c index 726dfd7c4..5ac46d387 100644 --- a/mrbgems/mruby-exit/src/mruby-exit.c +++ b/mrbgems/mruby-exit/src/mruby-exit.c @@ -1,6 +1,10 @@ #include #include "mruby.h" +/** + * + * @mrbgem mruby-exit + */ static mrb_value f_exit(mrb_state *mrb, mrb_value self) { diff --git a/mrbgems/mruby-fiber/src/fiber.c b/mrbgems/mruby-fiber/src/fiber.c index 93b3f1227..ba277f767 100644 --- a/mrbgems/mruby-fiber/src/fiber.c +++ b/mrbgems/mruby-fiber/src/fiber.c @@ -368,6 +368,13 @@ mrb_mruby_fiber_gem_init(mrb_state* mrb) { struct RClass *c; + + + /** + * Fiber + * + * @mrbgem mruby-fiber + */ c = mrb_define_class(mrb, "Fiber", mrb->object_class); MRB_SET_INSTANCE_TT(c, MRB_TT_FIBER); @@ -380,6 +387,11 @@ mrb_mruby_fiber_gem_init(mrb_state* mrb) mrb_define_class_method(mrb, c, "yield", fiber_yield, MRB_ARGS_ANY()); mrb_define_class_method(mrb, c, "current", fiber_current, MRB_ARGS_NONE()); + /** + * FiberError + * + * @mrbgem mruby-fiber + */ mrb_define_class(mrb, "FiberError", mrb->eStandardError_class); } diff --git a/mrbgems/mruby-hash-ext/mrblib/hash.rb b/mrbgems/mruby-hash-ext/mrblib/hash.rb index ec8bd05fb..28ffd8146 100644 --- a/mrbgems/mruby-hash-ext/mrblib/hash.rb +++ b/mrbgems/mruby-hash-ext/mrblib/hash.rb @@ -1,6 +1,8 @@ class Hash # ISO does not define Hash#each_pair, so each_pair is defined in gem. + # + # @mrbgem mruby-hash-ext alias each_pair each ## @@ -22,7 +24,7 @@ class Hash # Hash[ [ ["a", 100], ["b", 200] ] ] #=> {"a"=>100, "b"=>200} # Hash["a" => 100, "b" => 200] #=> {"a"=>100, "b"=>200} # - + # @mrbgem mruby-hash-ext def self.[](*object) length = object.length if length == 1 @@ -80,7 +82,7 @@ class Hash # h1.merge!(h2) { |key, v1, v2| v1 } # #=> {"a"=>100, "b"=>200, "c"=>300} # - + # @mrbgem mruby-hash-ext def merge!(other, &block) raise TypeError, "can't convert argument into Hash" unless other.respond_to?(:to_hash) if block @@ -122,7 +124,7 @@ class Hash # prog.rb:2:in 'fetch': key not found (KeyError) # from prog.rb:2 # - + # @mrbgem mruby-hash-ext def fetch(key, none=NONE, &block) unless self.key?(key) if block @@ -150,7 +152,7 @@ class Hash # h = { "a" => 100, "b" => 200, "c" => 300 } # h.delete_if {|key, value| key >= "b" } #=> {"a"=>100} # - + # @mrbgem mruby-hash-ext def delete_if(&block) return to_enum :delete_if unless block_given? @@ -175,7 +177,7 @@ class Hash # a.flatten # => [1, "one", 2, [2, "two"], 3, "three"] # a.flatten(2) # => [1, "one", 2, 2, "two", 3, "three"] # - + # @mrbgem mruby-hash-ext def flatten(level=1) self.to_a.flatten(level) end @@ -190,7 +192,7 @@ class Hash # h = { "n" => 100, "m" => 100, "y" => 300, "d" => 200, "a" => 0 } # h.invert #=> {0=>"a", 100=>"m", 200=>"d", 300=>"y"} # - + # @mrbgem mruby-hash-ext def invert h = Hash.new self.each {|k, v| h[v] = k } @@ -207,7 +209,7 @@ class Hash # # If no block is given, an enumerator is returned instead. # - + # @mrbgem mruby-hash-ext def keep_if(&block) return to_enum :keep_if unless block_given? @@ -232,7 +234,7 @@ class Hash # h.key(300) #=> "c" # h.key(999) #=> nil # - + # @mrbgem mruby-hash-ext def key(val) self.each do |k, v| return k if v == val @@ -247,6 +249,7 @@ class Hash # Returns +self+. If called on a subclass of Hash, converts # the receiver to a Hash object. # + # @mrbgem mruby-hash-ext def to_h self end diff --git a/mrbgems/mruby-hash-ext/src/hash-ext.c b/mrbgems/mruby-hash-ext/src/hash-ext.c index bce842cb4..d9a3b8de0 100644 --- a/mrbgems/mruby-hash-ext/src/hash-ext.c +++ b/mrbgems/mruby-hash-ext/src/hash-ext.c @@ -17,6 +17,8 @@ * * h = { "cat" => "feline", "dog" => "canine", "cow" => "bovine" } * h.values_at("cow", "cat") #=> ["bovine", "feline"] + * + * @mrbgem mruby-hash-ext */ static mrb_value diff --git a/mrbgems/mruby-kernel-ext/src/kernel.c b/mrbgems/mruby-kernel-ext/src/kernel.c index baccbd303..a0f78e471 100644 --- a/mrbgems/mruby-kernel-ext/src/kernel.c +++ b/mrbgems/mruby-kernel-ext/src/kernel.c @@ -11,6 +11,7 @@ * Symbol. * If called outside of a method, it returns nil. * + * @mrbgem mruby-kernel-ext */ static mrb_value mrb_f_method(mrb_state *mrb, mrb_value self) @@ -45,6 +46,8 @@ mrb_f_method(mrb_state *mrb, mrb_value self) * Integer("0930", 10) #=> 930 * Integer("111", 2) #=> 7 * Integer(nil) #=> TypeError + * + * @mrbgem mruby-kernel-ext */ static mrb_value mrb_f_integer(mrb_state *mrb, mrb_value self) @@ -67,6 +70,8 @@ mrb_f_integer(mrb_state *mrb, mrb_value self) * Float(123.456) #=> 123.456 * Float("123.456") #=> 123.456 * Float(nil) #=> TypeError + * + * @mrbgem mruby-kernel-ext */ static mrb_value mrb_f_float(mrb_state *mrb, mrb_value self) @@ -88,6 +93,8 @@ mrb_f_float(mrb_state *mrb, mrb_value self) * String(self) #=> "main" * String(self.class) #=> "Object" * String(123456) #=> "123456" + * + * @mrbgem mruby-kernel-ext */ static mrb_value mrb_f_string(mrb_state *mrb, mrb_value self) @@ -112,6 +119,7 @@ mrb_f_string(mrb_state *mrb, mrb_value self) * * Array(1..5) #=> [1, 2, 3, 4, 5] * + * @mrbgem mruby-kernel-ext */ static mrb_value mrb_f_array(mrb_state *mrb, mrb_value self) @@ -142,6 +150,8 @@ mrb_f_array(mrb_state *mrb, mrb_value self) * Hash(nil) #=> {} * Hash(key: :value) #=> {:key => :value} * Hash([1, 2, 3]) #=> TypeError + * + * @mrbgem mruby-kernel-ext */ static mrb_value mrb_f_hash(mrb_state *mrb, mrb_value self) diff --git a/mrbgems/mruby-math/src/math.c b/mrbgems/mruby-math/src/math.c index 109112578..8cbc2544e 100644 --- a/mrbgems/mruby-math/src/math.c +++ b/mrbgems/mruby-math/src/math.c @@ -721,6 +721,12 @@ void mrb_mruby_math_gem_init(mrb_state* mrb) { struct RClass *mrb_math; + + /** + * Math functions + * + * @mrbgem mruby-math + */ mrb_math = mrb_define_module(mrb, "Math"); mrb_define_class_under(mrb, mrb_math, "DomainError", mrb->eStandardError_class); diff --git a/mrbgems/mruby-numeric-ext/mrblib/numeric_ext.rb b/mrbgems/mruby-numeric-ext/mrblib/numeric_ext.rb index dfc6ba87c..9cd76fd3f 100644 --- a/mrbgems/mruby-numeric-ext/mrblib/numeric_ext.rb +++ b/mrbgems/mruby-numeric-ext/mrblib/numeric_ext.rb @@ -1,5 +1,8 @@ module Integral + + # @mrbgem mruby-numeric-ext def div(other) self.divmod(other)[0] end + end diff --git a/mrbgems/mruby-numeric-ext/src/numeric_ext.c b/mrbgems/mruby-numeric-ext/src/numeric_ext.c index 22c1668fa..fc35c5329 100644 --- a/mrbgems/mruby-numeric-ext/src/numeric_ext.c +++ b/mrbgems/mruby-numeric-ext/src/numeric_ext.c @@ -1,6 +1,9 @@ #include #include "mruby.h" +/** + * @mrbgem mruby-numeric-ext + */ static mrb_value mrb_int_chr(mrb_state *mrb, mrb_value x) { diff --git a/mrbgems/mruby-object-ext/mrblib/object.rb b/mrbgems/mruby-object-ext/mrblib/object.rb index 581156cb0..69c21a6b5 100644 --- a/mrbgems/mruby-object-ext/mrblib/object.rb +++ b/mrbgems/mruby-object-ext/mrblib/object.rb @@ -12,6 +12,7 @@ class Object # .select {|x| x%2==0} .tap {|x| puts "evens: #{x.inspect}"} # .map { |x| x*x } .tap {|x| puts "squares: #{x.inspect}"} # + # @mrbgem mruby-object-ext def tap yield self self diff --git a/mrbgems/mruby-object-ext/src/object.c b/mrbgems/mruby-object-ext/src/object.c index dc1924db0..f14831a80 100644 --- a/mrbgems/mruby-object-ext/src/object.c +++ b/mrbgems/mruby-object-ext/src/object.c @@ -7,8 +7,9 @@ * nil.to_a -> [] * * Always returns an empty array. + * + * @mrbgem mruby-object-ext */ - static mrb_value nil_to_a(mrb_state *mrb, mrb_value obj) { @@ -20,8 +21,9 @@ nil_to_a(mrb_state *mrb, mrb_value obj) * nil.to_f -> 0.0 * * Always returns zero. + * + * @mrbgem mruby-object-ext */ - static mrb_value nil_to_f(mrb_state *mrb, mrb_value obj) { @@ -33,8 +35,9 @@ nil_to_f(mrb_state *mrb, mrb_value obj) * nil.to_i -> 0 * * Always returns zero. + * + * @mrbgem mruby-object-ext */ - static mrb_value nil_to_i(mrb_state *mrb, mrb_value obj) { @@ -57,8 +60,9 @@ nil_to_i(mrb_state *mrb, mrb_value obj) * end * k = KlassWithSecret.new * k.instance_exec(5) {|x| @secret+x } #=> 104 + * + * @mrbgem mruby-object-ext */ - static mrb_value mrb_obj_instance_exec(mrb_state *mrb, mrb_value self) { diff --git a/mrbgems/mruby-objectspace/src/mruby_objectspace.c b/mrbgems/mruby-objectspace/src/mruby_objectspace.c index 1b18bf23f..cbb80799e 100644 --- a/mrbgems/mruby-objectspace/src/mruby_objectspace.c +++ b/mrbgems/mruby-objectspace/src/mruby_objectspace.c @@ -174,6 +174,12 @@ os_each_object(mrb_state *mrb, mrb_value self) void mrb_mruby_objectspace_gem_init(mrb_state *mrb) { + + /** + * ObjectSpace + * + * @mrbgem mruby-objectspace + */ struct RClass *os = mrb_define_module(mrb, "ObjectSpace"); mrb_define_class_method(mrb, os, "count_objects", os_count_objects, MRB_ARGS_OPT(1)); mrb_define_class_method(mrb, os, "each_object", os_each_object, MRB_ARGS_OPT(1)); diff --git a/mrbgems/mruby-print/mrblib/print.rb b/mrbgems/mruby-print/mrblib/print.rb index 38a10661b..77a1cb696 100644 --- a/mrbgems/mruby-print/mrblib/print.rb +++ b/mrbgems/mruby-print/mrblib/print.rb @@ -1,11 +1,9 @@ -## -# Kernel -# -# ISO 15.3.1 module Kernel + ## # Invoke method +print+ on STDOUT and passing +*args+ # + # @mrbgem mruby-print # ISO 15.3.1.2.10 def print(*args) i = 0 @@ -19,6 +17,7 @@ module Kernel ## # Invoke method +puts+ on STDOUT and passing +*args*+ # + # @mrbgem mruby-print # ISO 15.3.1.2.11 def puts(*args) i = 0 @@ -36,6 +35,7 @@ module Kernel ## # Print human readable object description # + # @mrbgem mruby-print # ISO 15.3.1.3.34 def p(*args) i = 0 diff --git a/mrbgems/mruby-proc-ext/mrblib/proc.rb b/mrbgems/mruby-proc-ext/mrblib/proc.rb index b71663938..c89c63d20 100644 --- a/mrbgems/mruby-proc-ext/mrblib/proc.rb +++ b/mrbgems/mruby-proc-ext/mrblib/proc.rb @@ -1,17 +1,21 @@ class Proc + # @mrbgem mruby-proc-ext def ===(*args) call(*args) end + # @mrbgem mruby-proc-ext def yield(*args) call(*args) end + # @mrbgem mruby-proc-ext def to_proc self end + # @mrbgem mruby-proc-ext def curry(arity=self.arity) type = :proc abs = lambda {|a| a < 0 ? -a - 1 : a} diff --git a/mrbgems/mruby-proc-ext/src/proc.c b/mrbgems/mruby-proc-ext/src/proc.c index 73873a360..783fbbd3a 100644 --- a/mrbgems/mruby-proc-ext/src/proc.c +++ b/mrbgems/mruby-proc-ext/src/proc.c @@ -5,6 +5,9 @@ #include "mruby/string.h" #include "mruby/debug.h" +/** + * @mrbgem mruby-proc-ext + */ static mrb_value mrb_proc_lambda(mrb_state *mrb, mrb_value self) { @@ -12,6 +15,9 @@ mrb_proc_lambda(mrb_state *mrb, mrb_value self) return mrb_bool_value(MRB_PROC_STRICT_P(p)); } +/** + * @mrbgem mruby-proc-ext + */ static mrb_value mrb_proc_source_location(mrb_state *mrb, mrb_value self) { @@ -33,6 +39,9 @@ mrb_proc_source_location(mrb_state *mrb, mrb_value self) } } +/** + * @mrbgem mruby-proc-ext + */ static mrb_value mrb_proc_inspect(mrb_state *mrb, mrb_value self) { @@ -67,6 +76,9 @@ mrb_proc_inspect(mrb_state *mrb, mrb_value self) return str; } +/** + * @mrbgem mruby-proc-ext + */ static mrb_value mrb_kernel_proc(mrb_state *mrb, mrb_value self) { @@ -88,8 +100,9 @@ mrb_kernel_proc(mrb_state *mrb, mrb_value self) * * prc = lambda{|x, y=42, *other|} * prc.parameters #=> [[:req, :x], [:opt, :y], [:rest, :other]] + * + * @mrbgem mruby-proc-ext */ - static mrb_value mrb_proc_parameters(mrb_state *mrb, mrb_value self) { diff --git a/mrbgems/mruby-random/src/random.c b/mrbgems/mruby-random/src/random.c index 3be3ac81c..1a9e8a7d3 100644 --- a/mrbgems/mruby-random/src/random.c +++ b/mrbgems/mruby-random/src/random.c @@ -104,6 +104,9 @@ get_random_state(mrb_state *mrb) return DATA_GET_PTR(mrb, random_val, &mt_state_type, mt_state); } +/** + * @mrbgem mruby-random + */ static mrb_value mrb_random_g_rand(mrb_state *mrb, mrb_value self) { @@ -111,6 +114,9 @@ mrb_random_g_rand(mrb_state *mrb, mrb_value self) return mrb_random_rand(mrb, random); } +/** + * @mrbgem mruby-random + */ static mrb_value mrb_random_g_srand(mrb_state *mrb, mrb_value self) { @@ -196,8 +202,9 @@ mrb_random_srand(mrb_state *mrb, mrb_value self) * ary.shuffle! -> ary * * Shuffles elements in self in place. + * + * @mrbgem mruby-random */ - static mrb_value mrb_ary_shuffle_bang(mrb_state *mrb, mrb_value ary) { @@ -234,8 +241,9 @@ mrb_ary_shuffle_bang(mrb_state *mrb, mrb_value ary) * ary.shuffle -> new_ary * * Returns a new array with elements of self shuffled. + * + * @mrbgem mruby-random */ - static mrb_value mrb_ary_shuffle(mrb_state *mrb, mrb_value ary) { @@ -258,8 +266,9 @@ mrb_ary_shuffle(mrb_state *mrb, mrb_value ary) * * If the array is empty the first form returns +nil+ and the second form * returns an empty array. + * + * @mrbgem mruby-random */ - static mrb_value mrb_ary_sample(mrb_state *mrb, mrb_value ary) { @@ -323,6 +332,9 @@ void mrb_mruby_random_gem_init(mrb_state *mrb) mrb_define_method(mrb, mrb->kernel_module, "rand", mrb_random_g_rand, MRB_ARGS_OPT(1)); mrb_define_method(mrb, mrb->kernel_module, "srand", mrb_random_g_srand, MRB_ARGS_OPT(1)); + /** + * @mrbgem mruby-random + */ random = mrb_define_class(mrb, "Random", mrb->object_class); MRB_SET_INSTANCE_TT(random, MRB_TT_DATA); mrb_define_class_method(mrb, random, "rand", mrb_random_g_rand, MRB_ARGS_OPT(1)); diff --git a/mrbgems/mruby-range-ext/src/range.c b/mrbgems/mruby-range-ext/src/range.c index 35632ad20..974fbe419 100644 --- a/mrbgems/mruby-range-ext/src/range.c +++ b/mrbgems/mruby-range-ext/src/range.c @@ -38,6 +38,8 @@ r_lt(mrb_state *mrb, mrb_value a, mrb_value b) * ("a".."z").cover?("c") #=> true * ("a".."z").cover?("5") #=> false * ("a".."z").cover?("cc") #=> true + * + * @mrbgem mruby-range-ext */ static mrb_value mrb_range_cover(mrb_state *mrb, mrb_value range) @@ -75,6 +77,8 @@ mrb_range_cover(mrb_state *mrb, mrb_value range) * * (10..20).first #=> 10 * (10..20).first(3) #=> [10, 11, 12] + * + * @mrbgem mruby-range-ext */ static mrb_value mrb_range_first(mrb_state *mrb, mrb_value range) @@ -106,6 +110,8 @@ mrb_range_first(mrb_state *mrb, mrb_value range) * (10...20).last #=> 20 * (10..20).last(3) #=> [18, 19, 20] * (10...20).last(3) #=> [17, 18, 19] + * + * @mrbgem mruby-range-ext */ static mrb_value mrb_range_last(mrb_state *mrb, mrb_value range) @@ -131,8 +137,9 @@ mrb_range_last(mrb_state *mrb, mrb_value range) * * (10..20).size #=> 11 * ('a'..'z').size #=> nil + * + * @mrbgem mruby-range-ext */ - static mrb_value mrb_range_size(mrb_state *mrb, mrb_value range) { diff --git a/mrbgems/mruby-sprintf/mrblib/string.rb b/mrbgems/mruby-sprintf/mrblib/string.rb index d7e55536a..cfca56b7a 100644 --- a/mrbgems/mruby-sprintf/mrblib/string.rb +++ b/mrbgems/mruby-sprintf/mrblib/string.rb @@ -1,4 +1,6 @@ class String + + # @mrbgem mruby-sprintf def %(args) if args.is_a? Array sprintf(self, *args) diff --git a/mrbgems/mruby-sprintf/src/kernel.c b/mrbgems/mruby-sprintf/src/kernel.c index bd4f2bca1..22cede04c 100644 --- a/mrbgems/mruby-sprintf/src/kernel.c +++ b/mrbgems/mruby-sprintf/src/kernel.c @@ -6,6 +6,9 @@ #include "mruby.h" +/** + * @mrbgem mruby-sprintf + */ mrb_value mrb_f_sprintf(mrb_state *mrb, mrb_value obj); /* in sprintf.c */ void diff --git a/mrbgems/mruby-string-ext/mrblib/string.rb b/mrbgems/mruby-string-ext/mrblib/string.rb index 4c8a2ce3b..b38b3c59f 100644 --- a/mrbgems/mruby-string-ext/mrblib/string.rb +++ b/mrbgems/mruby-string-ext/mrblib/string.rb @@ -9,6 +9,7 @@ class String # a = "abcde" # a.clear #=> "" # + # @mrbgem mruby-string-ext def clear self.replace("") end @@ -23,6 +24,7 @@ class String # " hello ".lstrip #=> "hello " # "hello".lstrip #=> "hello" # + # @mrbgem mruby-string-ext def lstrip a = 0 z = self.size - 1 @@ -40,6 +42,7 @@ class String # " hello ".rstrip #=> " hello" # "hello".rstrip #=> "hello" # + # @mrbgem mruby-string-ext def rstrip a = 0 z = self.size - 1 @@ -56,6 +59,7 @@ class String # " hello ".strip #=> "hello" # "\tgoodbye\r\n".strip #=> "goodbye" # + # @mrbgem mruby-string-ext def strip a = 0 z = self.size - 1 @@ -75,6 +79,7 @@ class String # " hello ".lstrip #=> "hello " # "hello".lstrip! #=> nil # + # @mrbgem mruby-string-ext def lstrip! s = self.lstrip (s == self) ? nil : self.replace(s) @@ -91,6 +96,7 @@ class String # " hello ".rstrip #=> " hello" # "hello".rstrip! #=> nil # + # @mrbgem mruby-string-ext def rstrip! s = self.rstrip (s == self) ? nil : self.replace(s) @@ -103,6 +109,7 @@ class String # Removes leading and trailing whitespace from str. Returns # nil if str was not altered. # + # @mrbgem mruby-string-ext def strip! s = self.strip (s == self) ? nil : self.replace(s) @@ -119,6 +126,7 @@ class String # "abcdef".casecmp("abcdefg") #=> -1 # "abcdef".casecmp("ABCDEF") #=> 0 # + # @mrbgem mruby-string-ext def casecmp(str) self.downcase <=> str.to_str.downcase rescue NoMethodError @@ -136,6 +144,7 @@ class String end end + # @mrbgem mruby-string-ext def rpartition(sep) raise TypeError, "type mismatch: #{sep.class} given" unless sep.is_a? String n = rindex(sep) @@ -163,6 +172,7 @@ class String # string.slice!("r") #=> "r" # string #=> "thsa sting" # + # @mrbgem mruby-string-ext def slice!(arg1, arg2=nil) raise "wrong number of arguments (for 1..2)" if arg1.nil? && arg2.nil? @@ -234,6 +244,7 @@ class String # "abcd".insert(-3, 'X') #=> "abXcd" # "abcd".insert(-1, 'X') #=> "abcdX" # + # @mrbgem mruby-string-ext def insert(idx, str) pos = idx.to_i pos += self.size + 1 if pos < 0 @@ -256,6 +267,8 @@ class String # "hello".ljust(4) #=> "hello" # "hello".ljust(20) #=> "hello " # "hello".ljust(20, '1234') #=> "hello123412341234123" + # + # @mrbgem mruby-string-ext def ljust(idx, padstr = ' ') if idx <= self.size return self @@ -297,6 +310,7 @@ class String # "25".upto("5").to_a #=> [] # "07".upto("11").to_a #=> ["07", "08", "09", "10", "11"] # + # @mrbgem mruby-string-ext def upto(other_str, excl=false, &block) return to_enum :upto, other_str, excl unless block @@ -311,6 +325,7 @@ class String end end + # @mrbgem mruby-string-ext def chars(&block) if block_given? self.split('').map do |i| @@ -323,6 +338,7 @@ class String end alias each_char chars + # @mrbgem mruby-string-ext def codepoints(&block) len = self.size diff --git a/mrbgems/mruby-string-ext/src/string.c b/mrbgems/mruby-string-ext/src/string.c index 0afc53386..028f77aee 100644 --- a/mrbgems/mruby-string-ext/src/string.c +++ b/mrbgems/mruby-string-ext/src/string.c @@ -5,6 +5,9 @@ #include "mruby/string.h" #include "mruby/range.h" +/** + * @mrbgem mruby-string-ext + */ static mrb_value mrb_str_getbyte(mrb_state *mrb, mrb_value str) { @@ -19,6 +22,9 @@ mrb_str_getbyte(mrb_state *mrb, mrb_value str) return mrb_fixnum_value((unsigned char)RSTRING_PTR(str)[pos]); } +/** + * @mrbgem mruby-string-ext + */ static mrb_value mrb_str_setbyte(mrb_state *mrb, mrb_value str) { @@ -38,6 +44,9 @@ mrb_str_setbyte(mrb_state *mrb, mrb_value str) return mrb_fixnum_value((unsigned char)byte); } +/** + * @mrbgem mruby-string-ext + */ static mrb_value mrb_str_byteslice(mrb_state *mrb, mrb_value str) { @@ -79,6 +88,8 @@ mrb_str_byteslice(mrb_state *mrb, mrb_value str) * Equivalent to String#swapcase, but modifies the receiver in * place, returning str, or nil if no changes were made. * Note: case conversion is effective only in ASCII region. + * + * @mrbgem mruby-string-ext */ static mrb_value mrb_str_swapcase_bang(mrb_state *mrb, mrb_value str) @@ -116,6 +127,8 @@ mrb_str_swapcase_bang(mrb_state *mrb, mrb_value str) * * "Hello".swapcase #=> "hELLO" * "cYbEr_PuNk11".swapcase #=> "CyBeR_pUnK11" + * + * @mrbgem mruby-string-ext */ static mrb_value mrb_str_swapcase(mrb_state *mrb, mrb_value self) @@ -141,6 +154,8 @@ mrb_str_swapcase(mrb_state *mrb, mrb_value self) * a = "hello " * a << "world" #=> "hello world" * a.concat(33) #=> "hello world!" + * + * @mrbgem mruby-string-ext */ static mrb_value mrb_str_concat2(mrb_state *mrb, mrb_value self) @@ -163,6 +178,8 @@ mrb_str_concat2(mrb_state *mrb, mrb_value self) * "hello".start_with?("heaven", "hell") #=> true * "hello".start_with?("heaven", "paradise") #=> false * "h".start_with?("heaven", "hell") #=> false + * + * @mrbgem mruby-string-ext */ static mrb_value mrb_str_start_with(mrb_state *mrb, mrb_value self) @@ -192,6 +209,8 @@ mrb_str_start_with(mrb_state *mrb, mrb_value self) * str.end_with?([suffixes]+) -> true or false * * Returns true if +str+ ends with one of the +suffixes+ given. + * + * @mrbgem mruby-string-ext */ static mrb_value mrb_str_end_with(mrb_state *mrb, mrb_value self) @@ -218,12 +237,18 @@ mrb_str_end_with(mrb_state *mrb, mrb_value self) return mrb_false_value(); } +/* + * @mrbgem mruby-string-ext + */ static mrb_value mrb_str_hex(mrb_state *mrb, mrb_value self) { return mrb_str_to_inum(mrb, self, 16, FALSE); } +/* + * @mrbgem mruby-string-ext + */ static mrb_value mrb_str_oct(mrb_state *mrb, mrb_value self) { @@ -238,6 +263,8 @@ mrb_str_oct(mrb_state *mrb, mrb_value self) * * a = "abcde" * a.chr #=> "a" + * + * @mrbgem mruby-string-ext */ static mrb_value mrb_str_chr(mrb_state *mrb, mrb_value self) @@ -245,6 +272,9 @@ mrb_str_chr(mrb_state *mrb, mrb_value self) return mrb_str_substr(mrb, self, 0, 1); } +/* + * @mrbgem mruby-string-ext + */ static mrb_value mrb_fixnum_chr(mrb_state *mrb, mrb_value num) { @@ -298,6 +328,8 @@ mrb_fixnum_chr(mrb_state *mrb, mrb_value num) * * a = "abc\ndef" * a.lines #=> ["abc\n", "def"] + * + * @mrbgem mruby-string-ext */ static mrb_value mrb_str_lines(mrb_state *mrb, mrb_value self) @@ -345,6 +377,8 @@ mrb_str_lines(mrb_state *mrb, mrb_value self) * * a = "abc" * a.succ #=> "abd" + * + * @mrbgem mruby-string-ext */ static mrb_value mrb_str_succ_bang(mrb_state *mrb, mrb_value self) @@ -419,6 +453,9 @@ mrb_str_succ_bang(mrb_state *mrb, mrb_value self) return self; } +/* + * @mrbgem mruby-string-ext + */ static mrb_value mrb_str_succ(mrb_state *mrb, mrb_value self) { @@ -438,6 +475,8 @@ mrb_str_succ(mrb_state *mrb, mrb_value self) * a = "world" * a.prepend("hello ") #=> "hello world" * a #=> "hello world" + * + * @mrbgem mruby-string-ext */ static mrb_value mrb_str_prepend(mrb_state *mrb, mrb_value self) @@ -516,6 +555,9 @@ utf8code(unsigned char* p) return p[0]; } +/* + * @mrbgem mruby-string-ext + */ static mrb_value mrb_str_ord(mrb_state* mrb, mrb_value str) { diff --git a/mrbgems/mruby-struct/src/struct.c b/mrbgems/mruby-struct/src/struct.c index 342e3eb5e..e73482f68 100644 --- a/mrbgems/mruby-struct/src/struct.c +++ b/mrbgems/mruby-struct/src/struct.c @@ -739,26 +739,28 @@ mrb_struct_values_at(mrb_state *mrb, mrb_value self) return mrb_get_values_at(mrb, self, RSTRUCT_LEN(self), argc, argv, struct_aref_int); } - -/* - * A Struct is a convenient way to bundle a number of - * attributes together, using accessor methods, without having to write - * an explicit class. - * - * The Struct class is a generator of specific classes, - * each one of which is defined to hold a set of variables and their - * accessors. In these examples, we'll call the generated class - * "CustomerClass," and we'll show an example instance of that - * class as "CustomerInst." - * - * In the descriptions that follow, the parameter symbol refers - * to a symbol, which is either a quoted string or a - * Symbol (such as :name). - */ void mrb_mruby_struct_gem_init(mrb_state* mrb) { struct RClass *st; + + /* + * A Struct is a convenient way to bundle a number of + * attributes together, using accessor methods, without having to write + * an explicit class. + * + * The Struct class is a generator of specific classes, + * each one of which is defined to hold a set of variables and their + * accessors. In these examples, we'll call the generated class + * "CustomerClass," and we'll show an example instance of that + * class as "CustomerInst." + * + * In the descriptions that follow, the parameter symbol refers + * to a symbol, which is either a quoted string or a + * Symbol (such as :name). + * + * @mrbgem mruby-struct + */ st = mrb_define_class(mrb, "Struct", mrb->object_class); mrb_define_class_method(mrb, st, "new", mrb_struct_s_def, MRB_ARGS_ANY()); /* 15.2.18.3.1 */ diff --git a/mrbgems/mruby-symbol-ext/mrblib/symbol.rb b/mrbgems/mruby-symbol-ext/mrblib/symbol.rb index 1e3d24b80..9e45f0acd 100644 --- a/mrbgems/mruby-symbol-ext/mrblib/symbol.rb +++ b/mrbgems/mruby-symbol-ext/mrblib/symbol.rb @@ -1,6 +1,7 @@ class Symbol include Comparable + # @mrbgem mruby-symbol-ext alias intern to_sym def to_proc @@ -14,7 +15,8 @@ class Symbol # sym.capitalize -> symbol # # Same as sym.to_s.capitalize.intern. - + # + # @mrbgem mruby-symbol-ext def capitalize (self.to_s.capitalize! || self).to_sym end @@ -24,7 +26,8 @@ class Symbol # sym.downcase -> symbol # # Same as sym.to_s.downcase.intern. - + # + # @mrbgem mruby-symbol-ext def downcase (self.to_s.downcase! || self).to_sym end @@ -34,7 +37,8 @@ class Symbol # sym.upcase -> symbol # # Same as sym.to_s.upcase.intern. - + # + # @mrbgem mruby-symbol-ext def upcase (self.to_s.upcase! || self).to_sym end @@ -44,7 +48,8 @@ class Symbol # sym.casecmp(other) -> -1, 0, +1 or nil # # Case-insensitive version of Symbol#<=>. - + # + # @mrbgem mruby-symbol-ext def casecmp(other) return nil unless other.kind_of?(Symbol) lhs = self.to_s; lhs.upcase! @@ -57,7 +62,8 @@ class Symbol # sym.empty? -> true or false # # Returns that _sym_ is :"" or not. - + # + # @mrbgem mruby-symbol-ext def empty? self.length == 0 end diff --git a/mrbgems/mruby-symbol-ext/src/symbol.c b/mrbgems/mruby-symbol-ext/src/symbol.c index a96c4017f..ea4cd9efa 100644 --- a/mrbgems/mruby-symbol-ext/src/symbol.c +++ b/mrbgems/mruby-symbol-ext/src/symbol.c @@ -21,6 +21,8 @@ typedef struct symbol_name { * :default_proc, :compact, :extend, * :Tms, :getwd, :$=, :ThreadGroup, * :wait2, :$>] + * + * @mrbgem mruby-symbol-ext */ static mrb_value mrb_sym_all_symbols(mrb_state *mrb, mrb_value self) @@ -40,6 +42,8 @@ mrb_sym_all_symbols(mrb_state *mrb, mrb_value self) * sym.length -> integer * * Same as sym.to_s.length. + * + * @mrbgem mruby-symbol-ext */ static mrb_value mrb_sym_length(mrb_state *mrb, mrb_value self) diff --git a/mrbgems/mruby-time/mrblib/time.rb b/mrbgems/mruby-time/mrblib/time.rb index df0d8ca82..cb2153c6f 100644 --- a/mrbgems/mruby-time/mrblib/time.rb +++ b/mrbgems/mruby-time/mrblib/time.rb @@ -1,3 +1,6 @@ +# Time class +# +# @mrbgem mruby-time class Time def sunday?; wday == 0 end def monday?; wday == 1 end diff --git a/mrbgems/mruby-toplevel-ext/mrblib/toplevel.rb b/mrbgems/mruby-toplevel-ext/mrblib/toplevel.rb index 774562398..562cdf1ac 100644 --- a/mrbgems/mruby-toplevel-ext/mrblib/toplevel.rb +++ b/mrbgems/mruby-toplevel-ext/mrblib/toplevel.rb @@ -1,11 +1,16 @@ - +# @mrbgem mruby-toplevel-ext def self.include (*modules) self.class.include(*modules) end +# @mrbgem mruby-toplevel-ext def self.private(*methods) end + +# @mrbgem mruby-toplevel-ext def self.protected(*methods) end + +# @mrbgem mruby-toplevel-ext def self.public(*methods) end -- cgit v1.2.3 From 45e70e4dd67d4a407260f79417a48063237c9e28 Mon Sep 17 00:00:00 2001 From: Seba Gamboa Date: Wed, 14 Oct 2015 14:56:53 -0300 Subject: Fix enumerator doc errors --- mrbgems/mruby-enumerator/mrblib/enumerator.rb | 122 +++++++++++++------------- 1 file changed, 60 insertions(+), 62 deletions(-) diff --git a/mrbgems/mruby-enumerator/mrblib/enumerator.rb b/mrbgems/mruby-enumerator/mrblib/enumerator.rb index c517c8152..d09ffaff8 100644 --- a/mrbgems/mruby-enumerator/mrblib/enumerator.rb +++ b/mrbgems/mruby-enumerator/mrblib/enumerator.rb @@ -6,93 +6,92 @@ # A class which allows both internal and external iteration. # # An Enumerator can be created by the following methods. -# - Kernel#to_enum -# - Kernel#enum_for -# - Enumerator.new +# - {Kernel#to_enum} +# - {Kernel#enum_for} +# - {Enumerator#initialize Enumerator.new} # # Most methods have two forms: a block form where the contents # are evaluated for each item in the enumeration, and a non-block form # which returns a new Enumerator wrapping the iteration. # -# enumerator = %w(one two three).each -# puts enumerator.class # => Enumerator +# enumerator = %w(one two three).each +# puts enumerator.class # => Enumerator # -# enumerator.each_with_object("foo") do |item, obj| -# puts "#{obj}: #{item}" -# end +# enumerator.each_with_object("foo") do |item, obj| +# puts "#{obj}: #{item}" +# end # -# # foo: one -# # foo: two -# # foo: three +# # foo: one +# # foo: two +# # foo: three # -# enum_with_obj = enumerator.each_with_object("foo") -# puts enum_with_obj.class # => Enumerator +# enum_with_obj = enumerator.each_with_object("foo") +# puts enum_with_obj.class # => Enumerator # -# enum_with_obj.each do |item, obj| -# puts "#{obj}: #{item}" -# end +# enum_with_obj.each do |item, obj| +# puts "#{obj}: #{item}" +# end # -# # foo: one -# # foo: two -# # foo: three +# # foo: one +# # foo: two +# # foo: three # # This allows you to chain Enumerators together. For example, you # can map a list's elements to strings containing the index # and the element as a string via: # -# puts %w[foo bar baz].map.with_index { |w, i| "#{i}:#{w}" } -# # => ["0:foo", "1:bar", "2:baz"] +# puts %w[foo bar baz].map.with_index { |w, i| "#{i}:#{w}" } +# # => ["0:foo", "1:bar", "2:baz"] # # An Enumerator can also be used as an external iterator. # For example, Enumerator#next returns the next value of the iterator # or raises StopIteration if the Enumerator is at the end. # -# e = [1,2,3].each # returns an enumerator object. -# puts e.next # => 1 -# puts e.next # => 2 -# puts e.next # => 3 -# puts e.next # raises StopIteration +# e = [1,2,3].each # returns an enumerator object. +# puts e.next # => 1 +# puts e.next # => 2 +# puts e.next # => 3 +# puts e.next # raises StopIteration # # You can use this to implement an internal iterator as follows: # -# def ext_each(e) -# while true -# begin -# vs = e.next_values -# rescue StopIteration -# return $!.result +# def ext_each(e) +# while true +# begin +# vs = e.next_values +# rescue StopIteration +# return $!.result +# end +# y = yield(*vs) +# e.feed y +# end # end -# y = yield(*vs) -# e.feed y -# end -# end # -# o = Object.new +# o = Object.new # -# def o.each -# puts yield -# puts yield(1) -# puts yield(1, 2) -# 3 -# end +# def o.each +# puts yield +# puts yield(1) +# puts yield(1, 2) +# 3 +# end # -# # use o.each as an internal iterator directly. -# puts o.each {|*x| puts x; [:b, *x] } -# # => [], [:b], [1], [:b, 1], [1, 2], [:b, 1, 2], 3 +# # use o.each as an internal iterator directly. +# puts o.each {|*x| puts x; [:b, *x] } +# # => [], [:b], [1], [:b, 1], [1, 2], [:b, 1, 2], 3 # -# # convert o.each to an external iterator for -# # implementing an internal iterator. -# puts ext_each(o.to_enum) {|*x| puts x; [:b, *x] } -# # => [], [:b], [1], [:b, 1], [1, 2], [:b, 1, 2], 3 +# # convert o.each to an external iterator for +# # implementing an internal iterator. +# puts ext_each(o.to_enum) {|*x| puts x; [:b, *x] } +# # => [], [:b], [1], [:b, 1], [1, 2], [:b, 1, 2], 3 # # @mrbgem mruby-enumerator class Enumerator include Enumerable ## - # call-seq: - # Enumerator.new(size = nil) { |yielder| ... } - # Enumerator.new(obj, method = :each, *args) + # @overload initialize(size = nil, &block) + # @overload initialize(obj, method = :each, *args) # # Creates a new Enumerator object, which can be used as an # Enumerable. @@ -101,15 +100,15 @@ class Enumerator # which a "yielder" object, given as block parameter, can be used to # yield a value by calling the +yield+ method (aliased as +<<+): # - # fib = Enumerator.new do |y| - # a = b = 1 - # loop do - # y << a - # a, b = b, a + b + # fib = Enumerator.new do |y| + # a = b = 1 + # loop do + # y << a + # a, b = b, a + b + # end # end - # end # - # p fib.take(10) # => [1, 1, 2, 3, 5, 8, 13, 21, 34, 55] + # p fib.take(10) # => [1, 1, 2, 3, 5, 8, 13, 21, 34, 55] # def initialize(obj=nil, meth=:each, *args, &block) if block_given? @@ -189,8 +188,7 @@ class Enumerator # # If no block is given, returns a new Enumerator. # - # === Example - # + # @example # to_three = Enumerator.new do |y| # 3.times do |x| # y << x -- cgit v1.2.3 From f0e997422137e9fc92923a49465f009b2730e78d Mon Sep 17 00:00:00 2001 From: Seba Gamboa Date: Wed, 14 Oct 2015 14:59:31 -0300 Subject: Fix Unknown tag error --- include/mruby.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/mruby.h b/include/mruby.h index 7f9c48562..9d30a1614 100644 --- a/include/mruby.h +++ b/include/mruby.h @@ -762,7 +762,7 @@ MRB_API void mrb_close(mrb_state *mrb); /** * The default allocation function. * - * @ref mrb_allocf + * @see mrb_allocf */ MRB_API void* mrb_default_allocf(mrb_state*, void*, size_t, void*); -- cgit v1.2.3 From 13b552538af9e9794398e4a4177ba1cea04cccca Mon Sep 17 00:00:00 2001 From: Seba Gamboa Date: Tue, 20 Oct 2015 12:48:31 -0300 Subject: Remove obvious warnings from docs --- mrbgems/mruby-array-ext/src/array.c | 4 +- mrbgems/mruby-enum-ext/mrblib/enum.rb | 22 +++++----- mrbgems/mruby-enumerator/mrblib/enumerator.rb | 34 +++++++-------- mrbgems/mruby-hash-ext/mrblib/hash.rb | 14 +++---- mrbgems/mruby-kernel-ext/src/kernel.c | 8 ++-- mrbgems/mruby-math/src/math.c | 5 ++- mrblib/enum.rb | 19 ++++----- mrblib/hash.rb | 4 +- src/hash.c | 60 +++++++++++++-------------- 9 files changed, 84 insertions(+), 86 deletions(-) diff --git a/mrbgems/mruby-array-ext/src/array.c b/mrbgems/mruby-array-ext/src/array.c index 79dadbee5..37d8739b6 100644 --- a/mrbgems/mruby-array-ext/src/array.c +++ b/mrbgems/mruby-array-ext/src/array.c @@ -119,8 +119,8 @@ mrb_ary_values_at(mrb_state *mrb, mrb_value self) * Returns the result of interpreting aray as an array of * [key, value] paris. * - * [[:foo, :bar], [1, 2]].to_h - * # => {:foo => :bar, 1 => 2} + * [[:foo, :bar], [1, 2]].to_h + * # => {:foo => :bar, 1 => 2} * * @mrbgem mruby-array-ext */ diff --git a/mrbgems/mruby-enum-ext/mrblib/enum.rb b/mrbgems/mruby-enum-ext/mrblib/enum.rb index 7efec89c9..b41eaaf1f 100644 --- a/mrbgems/mruby-enum-ext/mrblib/enum.rb +++ b/mrbgems/mruby-enum-ext/mrblib/enum.rb @@ -78,10 +78,10 @@ module Enumerable # Passes elements to the block until the block returns +nil+ or +false+, # then stops iterating and returns an array of all prior elements. # - # If no block is given, an enumerator is returned instead. + # If no block is given, an enumerator is returned instead. # - # a = [1, 2, 3, 4, 5, 0] - # a.take_while {|i| i < 3 } #=> [1, 2] + # a = [1, 2, 3, 4, 5, 0] + # a.take_while {|i| i < 3 } #=> [1, 2] # # @mrbgem mruby-enum-ext def take_while(&block) @@ -96,13 +96,12 @@ module Enumerable end ## - # call-seq: - # enum.each_cons(n) {...} -> nil - # # Iterates the given block for each array of consecutive # elements. # - # e.g.: + # @return [nil] + # + # @example # (1..10).each_cons(3) {|a| p a} # # outputs below # [1, 2, 3] @@ -130,12 +129,11 @@ module Enumerable end ## - # call-seq: - # enum.each_slice(n) {...} -> nil - # # Iterates the given block for each slice of elements. # - # e.g.: + # @return [nil] + # + # @example # (1..10).each_slice(3) {|a| p a} # # outputs below # [1, 2, 3] @@ -170,7 +168,7 @@ module Enumerable # block, and values are arrays of elements in enum # corresponding to the key. # - # (1..6).group_by {|i| i%3} #=> {0=>[3, 6], 1=>[1, 4], 2=>[2, 5]} + # (1..6).group_by {|i| i%3} #=> {0=>[3, 6], 1=>[1, 4], 2=>[2, 5]} # # @mrbgem mruby-enum-ext def group_by(&block) diff --git a/mrbgems/mruby-enumerator/mrblib/enumerator.rb b/mrbgems/mruby-enumerator/mrblib/enumerator.rb index d09ffaff8..e9300462a 100644 --- a/mrbgems/mruby-enumerator/mrblib/enumerator.rb +++ b/mrbgems/mruby-enumerator/mrblib/enumerator.rb @@ -581,27 +581,27 @@ module Kernel # # Here is such an example, with parameter passing and a sizing block: # - # module Enumerable - # # a generic method to repeat the values of any enumerable - # def repeat(n) - # raise ArgumentError, "#{n} is negative!" if n < 0 - # unless block_given? - # return to_enum(__method__, n) do # __method__ is :repeat here - # sz = size # Call size and multiply by n... - # sz * n if sz # but return nil if size itself is nil + # module Enumerable + # # a generic method to repeat the values of any enumerable + # def repeat(n) + # raise ArgumentError, "#{n} is negative!" if n < 0 + # unless block_given? + # return to_enum(__method__, n) do # __method__ is :repeat here + # sz = size # Call size and multiply by n... + # sz * n if sz # but return nil if size itself is nil + # end + # end + # each do |*val| + # n.times { yield *val } # end - # end - # each do |*val| - # n.times { yield *val } # end # end - # end # - # %i[hello world].repeat(2) { |w| puts w } - # # => Prints 'hello', 'hello', 'world', 'world' - # enum = (1..14).repeat(3) - # # => returns an Enumerator when called without a block - # enum.first(4) # => [1, 1, 1, 2] + # %i[hello world].repeat(2) { |w| puts w } + # # => Prints 'hello', 'hello', 'world', 'world' + # enum = (1..14).repeat(3) + # # => returns an Enumerator when called without a block + # enum.first(4) # => [1, 1, 1, 2] # def to_enum(meth=:each, *args) Enumerator.new self, meth, *args diff --git a/mrbgems/mruby-hash-ext/mrblib/hash.rb b/mrbgems/mruby-hash-ext/mrblib/hash.rb index 28ffd8146..415d8ea8f 100644 --- a/mrbgems/mruby-hash-ext/mrblib/hash.rb +++ b/mrbgems/mruby-hash-ext/mrblib/hash.rb @@ -7,22 +7,22 @@ class Hash ## # call-seq: - # Hash[ key, value, ... ] -> new_hash - # Hash[ [ [key, value], ... ] ] -> new_hash - # Hash[ object ] -> new_hash + # Hash[ key, value, ... ] -> new_hash + # Hash[ [ [key, value], ... ] ] -> new_hash + # Hash[ object ] -> new_hash # # Creates a new hash populated with the given objects. # - # Similar to the literal { _key_ => _value_, ... }. In the first + # Similar to the literal `{ _key_ => _value_, ... }`. In the first # form, keys and values occur in pairs, so there must be an even number of # arguments. # # The second and third form take a single argument which is either an array # of key-value pairs or an object convertible to a hash. # - # Hash["a", 100, "b", 200] #=> {"a"=>100, "b"=>200} - # Hash[ [ ["a", 100], ["b", 200] ] ] #=> {"a"=>100, "b"=>200} - # Hash["a" => 100, "b" => 200] #=> {"a"=>100, "b"=>200} + # Hash["a", 100, "b", 200] #=> {"a"=>100, "b"=>200} + # Hash[ [ ["a", 100], ["b", 200] ] ] #=> {"a"=>100, "b"=>200} + # Hash["a" => 100, "b" => 200] #=> {"a"=>100, "b"=>200} # # @mrbgem mruby-hash-ext def self.[](*object) diff --git a/mrbgems/mruby-kernel-ext/src/kernel.c b/mrbgems/mruby-kernel-ext/src/kernel.c index a0f78e471..a00fa9d6f 100644 --- a/mrbgems/mruby-kernel-ext/src/kernel.c +++ b/mrbgems/mruby-kernel-ext/src/kernel.c @@ -146,10 +146,10 @@ mrb_f_array(mrb_state *mrb, mrb_value self) * arg.to_hash. Returns an empty Hash when * arg is nil or []. * - * Hash([]) #=> {} - * Hash(nil) #=> {} - * Hash(key: :value) #=> {:key => :value} - * Hash([1, 2, 3]) #=> TypeError + * Hash([]) #=> {} + * Hash(nil) #=> {} + * Hash(key: :value) #=> {:key => :value} + * Hash([1, 2, 3]) #=> TypeError * * @mrbgem mruby-kernel-ext */ diff --git a/mrbgems/mruby-math/src/math.c b/mrbgems/mruby-math/src/math.c index 8cbc2544e..a94c48c7b 100644 --- a/mrbgems/mruby-math/src/math.c +++ b/mrbgems/mruby-math/src/math.c @@ -236,7 +236,8 @@ math_tan(mrb_state *mrb, mrb_value obj) * call-seq: * Math.asin(x) -> float * - * Computes the arc sine of x. Returns -{PI/2} .. {PI/2}. + * Computes the arc sine of x. + * @return computed value between `-(PI/2)` and `(PI/2)`. */ static mrb_value math_asin(mrb_state *mrb, mrb_value obj) @@ -276,7 +277,7 @@ math_acos(mrb_state *mrb, mrb_value obj) * call-seq: * Math.atan(x) -> float * - * Computes the arc tangent of x. Returns -{PI/2} .. {PI/2}. + * Computes the arc tangent of x. Returns `-(PI/2) .. (PI/2)`. */ static mrb_value math_atan(mrb_state *mrb, mrb_value obj) diff --git a/mrblib/enum.rb b/mrblib/enum.rb index f0c9a4884..650d24302 100644 --- a/mrblib/enum.rb +++ b/mrblib/enum.rb @@ -1,17 +1,16 @@ ## # Enumerable # -# ISO 15.3.2 +# The Enumerable mixin provides collection classes with +# several traversal and searching methods, and with the ability to +# sort. The class must provide a method `each`, which +# yields successive members of the collection. If +# {Enumerable#max}, {#min}, or +# {#sort} is used, the objects in the collection must also +# implement a meaningful `<=>` operator, as these methods +# rely on an ordering between members of the collection. # -# The Enumerable mixin provides collection classes with -# several traversal and searching methods, and with the ability to -# sort. The class must provide a method each, which -# yields successive members of the collection. If -# Enumerable#max, #min, or -# #sort is used, the objects in the collection must also -# implement a meaningful <=> operator, as these methods -# rely on an ordering between members of the collection. - +# @ISO 15.3.2 module Enumerable ## diff --git a/mrblib/hash.rb b/mrblib/hash.rb index 48ac96e56..e3e709070 100644 --- a/mrblib/hash.rb +++ b/mrblib/hash.rb @@ -74,8 +74,8 @@ class Hash # # If no block is given, an enumerator is returned instead. # - # h = { "a" => 100, "b" => 200 } - # h.each {|key, value| puts "#{key} is #{value}" } + # h = { "a" => 100, "b" => 200 } + # h.each {|key, value| puts "#{key} is #{value}" } # # produces: # diff --git a/src/hash.c b/src/hash.c index 44b878890..22937dff2 100644 --- a/src/hash.c +++ b/src/hash.c @@ -294,22 +294,22 @@ mrb_hash_modify(mrb_state *mrb, mrb_value hash) * default value. It is the block's responsibility to store the value * in the hash if required. * - * h = Hash.new("Go Fish") - * h["a"] = 100 - * h["b"] = 200 - * h["a"] #=> 100 - * h["c"] #=> "Go Fish" - * # The following alters the single default object - * h["c"].upcase! #=> "GO FISH" - * h["d"] #=> "GO FISH" - * h.keys #=> ["a", "b"] - * - * # While this creates a new default object each time - * h = Hash.new { |hash, key| hash[key] = "Go Fish: #{key}" } - * h["c"] #=> "Go Fish: c" - * h["c"].upcase! #=> "GO FISH: C" - * h["d"] #=> "Go Fish: d" - * h.keys #=> ["c", "d"] + * h = Hash.new("Go Fish") + * h["a"] = 100 + * h["b"] = 200 + * h["a"] #=> 100 + * h["c"] #=> "Go Fish" + * # The following alters the single default object + * h["c"].upcase! #=> "GO FISH" + * h["d"] #=> "GO FISH" + * h.keys #=> ["a", "b"] + * + * # While this creates a new default object each time + * h = Hash.new { |hash, key| hash[key] = "Go Fish: #{key}" } + * h["c"] #=> "Go Fish: c" + * h["c"].upcase! #=> "GO FISH: C" + * h["d"] #=> "Go Fish: d" + * h.keys #=> ["c", "d"] * */ @@ -517,10 +517,10 @@ mrb_hash_delete_key(mrb_state *mrb, mrb_value hash, mrb_value key) * key is not found, pass in the key and return the result of * block. * - * h = { "a" => 100, "b" => 200 } - * h.delete("a") #=> 100 - * h.delete("z") #=> nil - * h.delete("z") { |el| "#{el} not found" } #=> "z not found" + * h = { "a" => 100, "b" => 200 } + * h.delete("a") #=> 100 + * h.delete("z") #=> nil + * h.delete("z") { |el| "#{el} not found" } #=> "z not found" * */ static mrb_value @@ -541,9 +541,9 @@ mrb_hash_delete(mrb_state *mrb, mrb_value self) * two-item array [ key, value ], or * the hash's default value if the hash is empty. * - * h = { 1 => "a", 2 => "b", 3 => "c" } - * h.shift #=> [1, "a"] - * h #=> {2=>"b", 3=>"c"} + * h = { 1 => "a", 2 => "b", 3 => "c" } + * h.shift #=> [1, "a"] + * h #=> {2=>"b", 3=>"c"} */ static mrb_value @@ -580,10 +580,10 @@ mrb_hash_shift(mrb_state *mrb, mrb_value hash) * call-seq: * hsh.clear -> hsh * - * Removes all key-value pairs from hsh. + * Removes all key-value pairs from `hsh`. * - * h = { "a" => 100, "b" => 200 } #=> {"a"=>100, "b"=>200} - * h.clear #=> {} + * h = { "a" => 100, "b" => 200 } #=> {"a"=>100, "b"=>200} + * h.clear #=> {} * */ @@ -609,10 +609,10 @@ mrb_hash_clear(mrb_state *mrb, mrb_value hash) * use as a key (a String passed as a key will be * duplicated and frozen). * - * h = { "a" => 100, "b" => 200 } - * h["a"] = 9 - * h["c"] = 4 - * h #=> {"a"=>9, "b"=>200, "c"=>4} + * h = { "a" => 100, "b" => 200 } + * h["a"] = 9 + * h["c"] = 4 + * h #=> {"a"=>9, "b"=>200, "c"=>4} * */ static mrb_value -- cgit v1.2.3 From 25c8e9536530afa72bacb78702a7a6d132c354f3 Mon Sep 17 00:00:00 2001 From: Seba Gamboa Date: Wed, 21 Oct 2015 14:31:13 -0300 Subject: Revert "Mark core gems with mrbgem tag" This reverts commit 5cdcce8dbddd94ecb9503a0a1d47370c4ef97177. --- include/mruby/error.h | 24 +-------- mrbgems/mruby-array-ext/mrblib/array.rb | 46 +++++------------- mrbgems/mruby-array-ext/src/array.c | 18 +++---- mrbgems/mruby-enum-ext/mrblib/enum.rb | 59 ++++++++--------------- mrbgems/mruby-enum-lazy/mrblib/lazy.rb | 4 -- mrbgems/mruby-enumerator/mrblib/enumerator.rb | 1 - mrbgems/mruby-eval/src/eval.c | 8 --- mrbgems/mruby-exit/src/mruby-exit.c | 4 -- mrbgems/mruby-fiber/src/fiber.c | 12 ----- mrbgems/mruby-hash-ext/mrblib/hash.rb | 19 +++----- mrbgems/mruby-hash-ext/src/hash-ext.c | 2 - mrbgems/mruby-kernel-ext/src/kernel.c | 9 ---- mrbgems/mruby-math/src/math.c | 6 --- mrbgems/mruby-numeric-ext/mrblib/numeric_ext.rb | 3 -- mrbgems/mruby-numeric-ext/src/numeric_ext.c | 3 -- mrbgems/mruby-object-ext/mrblib/object.rb | 1 - mrbgems/mruby-object-ext/src/object.c | 12 ++--- mrbgems/mruby-objectspace/src/mruby_objectspace.c | 6 --- mrbgems/mruby-print/mrblib/print.rb | 8 +-- mrbgems/mruby-proc-ext/mrblib/proc.rb | 4 -- mrbgems/mruby-proc-ext/src/proc.c | 15 +----- mrbgems/mruby-random/src/random.c | 18 ++----- mrbgems/mruby-range-ext/src/range.c | 9 +--- mrbgems/mruby-sprintf/mrblib/string.rb | 2 - mrbgems/mruby-sprintf/src/kernel.c | 3 -- mrbgems/mruby-string-ext/mrblib/string.rb | 16 ------ mrbgems/mruby-string-ext/src/string.c | 42 ---------------- mrbgems/mruby-struct/src/struct.c | 34 ++++++------- mrbgems/mruby-symbol-ext/mrblib/symbol.rb | 16 ++---- mrbgems/mruby-symbol-ext/src/symbol.c | 4 -- mrbgems/mruby-time/mrblib/time.rb | 3 -- mrbgems/mruby-toplevel-ext/mrblib/toplevel.rb | 7 +-- 32 files changed, 83 insertions(+), 335 deletions(-) diff --git a/include/mruby/error.h b/include/mruby/error.h index 1ac0791a2..8b6430137 100644 --- a/include/mruby/error.h +++ b/include/mruby/error.h @@ -32,34 +32,12 @@ MRB_API mrb_noreturn void mrb_no_method_error(mrb_state *mrb, mrb_sym id, mrb_va /* declaration for fail method */ MRB_API mrb_value mrb_f_raise(mrb_state*, mrb_value); -/** - * Protect - * - * @mrbgem mruby-error - */ +/* functions defined in mruby-error mrbgem */ MRB_API mrb_value mrb_protect(mrb_state *mrb, mrb_func_t body, mrb_value data, mrb_bool *state); - -/** - * Ensure - * - * @mrbgem mruby-error - */ MRB_API mrb_value mrb_ensure(mrb_state *mrb, mrb_func_t body, mrb_value b_data, mrb_func_t ensure, mrb_value e_data); - -/** - * Rescue - * - * @mrbgem mruby-error - */ MRB_API mrb_value mrb_rescue(mrb_state *mrb, mrb_func_t body, mrb_value b_data, mrb_func_t rescue, mrb_value r_data); - -/** - * Rescue exception - * - * @mrbgem mruby-error - */ MRB_API mrb_value mrb_rescue_exceptions(mrb_state *mrb, mrb_func_t body, mrb_value b_data, mrb_func_t rescue, mrb_value r_data, mrb_int len, struct RClass **classes); diff --git a/mrbgems/mruby-array-ext/mrblib/array.rb b/mrbgems/mruby-array-ext/mrblib/array.rb index 74b183d3f..35be79339 100644 --- a/mrbgems/mruby-array-ext/mrblib/array.rb +++ b/mrbgems/mruby-array-ext/mrblib/array.rb @@ -1,5 +1,4 @@ class Array - ## # call-seq: # ary.uniq! -> ary or nil @@ -16,7 +15,6 @@ class Array # c = [["student","sam"], ["student","george"], ["teacher","matz"]] # c.uniq! { |s| s.first } # => [["student", "sam"], ["teacher", "matz"]] # - # @mrbgem mruby-array-ext def uniq!(&block) ary = self.dup result = [] @@ -56,7 +54,6 @@ class Array # b = [["student","sam"], ["student","george"], ["teacher","matz"]] # b.uniq { |s| s.first } # => [["student", "sam"], ["teacher", "matz"]] # - # @mrbgem mruby-array-ext def uniq(&block) ary = self.dup if block @@ -78,7 +75,6 @@ class Array # # [ 1, 1, 2, 2, 3, 3, 4, 5 ] - [ 1, 2, 4 ] #=> [ 3, 3, 5 ] # - # @mrbgem mruby-array-ext def -(elem) raise TypeError, "can't convert #{elem.class} into Array" unless elem.class == Array @@ -99,7 +95,6 @@ class Array # [ "a", "b", "c" ] | [ "c", "d", "a" ] # #=> [ "a", "b", "c", "d" ] # - # @mrbgem mruby-array-ext def |(elem) raise TypeError, "can't convert #{elem.class} into Array" unless elem.class == Array @@ -116,7 +111,6 @@ class Array # # [ 1, 1, 3, 5 ] & [ 1, 2, 3 ] #=> [ 1, 3 ] # - # @mrbgem mruby-array-ext def &(elem) raise TypeError, "can't convert #{elem.class} into Array" unless elem.class == Array @@ -149,7 +143,6 @@ class Array # a = [ 1, 2, [3, [4, 5] ] ] # a.flatten(1) #=> [1, 2, 3, [4, 5]] # - # @mrbgem mruby-array-ext def flatten(depth=nil) ar = [] self.each do |e| @@ -179,7 +172,6 @@ class Array # a = [ 1, 2, [3, [4, 5] ] ] # a.flatten!(1) #=> [1, 2, 3, [4, 5]] # - # @mrbgem mruby-array-ext def flatten!(depth=nil) modified = false ar = [] @@ -207,7 +199,6 @@ class Array # [ "a", nil, "b", nil, "c", nil ].compact # #=> [ "a", "b", "c" ] # - # @mrbgem mruby-array-ext def compact result = self.dup result.compact! @@ -225,7 +216,6 @@ class Array # [ "a", nil, "b", nil, "c" ].compact! #=> [ "a", "b", "c" ] # [ "a", "b", "c" ].compact! #=> nil # - # @mrbgem mruby-array-ext def compact! result = self.select { |e| !e.nil? } if result.size == self.size @@ -236,7 +226,6 @@ class Array end # for efficiency - # @mrbgem mruby-array-ext def reverse_each(&block) return to_enum :reverse_each unless block_given? @@ -249,7 +238,6 @@ class Array end NONE=Object.new - ## # call-seq: # ary.fetch(index) -> obj @@ -272,7 +260,7 @@ class Array # a.fetch(100) { |i| puts "#{i} is out of bounds" } # #=> "100 is out of bounds" # - # @mrbgem mruby-array-ext + def fetch(n=nil, ifnone=NONE, &block) warn "block supersedes default value argument" if !n.nil? && ifnone != NONE && block @@ -322,7 +310,7 @@ class Array # a.fill(1, 2) { |i| i+1 } #=> [0, 2, 3, 27] # a.fill(0..1) { |i| i+1 } #=> [1, 2, 3, 27] # - # @mrbgem mruby-array-ext + def fill(arg0=nil, arg1=nil, arg2=nil, &block) if arg0.nil? && arg1.nil? && arg2.nil? && !block raise ArgumentError, "wrong number of arguments (0 for 1..3)" @@ -406,8 +394,7 @@ class Array # a #=> ["a", "b", "c", "d"] # a.rotate(2) #=> ["c", "d", "a", "b"] # a.rotate(-3) #=> ["b", "c", "d", "a"] - # - # @mrbgem mruby-array-ext + def rotate(count=1) ary = [] len = self.length @@ -438,12 +425,12 @@ class Array # a #=> ["b", "c", "d", "a"] # a.rotate!(2) #=> ["d", "a", "b", "c"] # a.rotate!(-3) #=> ["a", "b", "c", "d"] - # - # @mrbgem mruby-array-ext + def rotate!(count=1) self.replace(self.rotate(count)) end + ## # call-seq: # ary.delete_if { |item| block } -> ary # ary.delete_if -> Enumerator @@ -459,8 +446,7 @@ class Array # # scores = [ 97, 42, 75 ] # scores.delete_if {|score| score < 80 } #=> [97] - # - # @mrbgem mruby-array-ext + def delete_if(&block) return to_enum :delete_if unless block_given? @@ -489,8 +475,7 @@ class Array # See also Enumerable#reject and Array#delete_if. # # If no block is given, an Enumerator is returned instead. - # - # @mrbgem mruby-array-ext + def reject!(&block) return to_enum :reject! unless block_given? @@ -522,8 +507,7 @@ class Array # a = %w{ a b c d } # a.insert(2, 99) #=> ["a", "b", 99, "c", "d"] # a.insert(-2, 1, 2, 3) #=> ["a", "b", 99, "c", 1, 2, 3, "d"] - # - # @mrbgem mruby-array-ext + def insert(idx, *args) idx += self.size + 1 if idx < 0 self[idx, 0] = args @@ -581,8 +565,7 @@ class Array # You must not mix the two modes at a time; the block must always # return either true/false, or always return a number. It is # undefined which value is actually picked up at each iteration. - # - # @mrbgem mruby-array-ext + def bsearch(&block) return to_enum :bsearch unless block_given? @@ -629,8 +612,7 @@ class Array # # scores = [ 97, 42, 75 ] # scores.delete_if {|score| score < 80 } #=> [97] - # - # @mrbgem mruby-array-ext + def delete_if(&block) return to_enum :delete_if unless block_given? @@ -659,8 +641,7 @@ class Array # # a = [1, 2, 3, 4, 5] # a.keep_if { |val| val > 3 } #=> [4, 5] - # - # @mrbgem mruby-array-ext + def keep_if(&block) return to_enum :keep_if unless block_given? @@ -689,8 +670,7 @@ class Array # See also Array#keep_if # # If no block is given, an Enumerator is returned instead. - # - # @mrbgem mruby-array-ext + def select!(&block) return to_enum :select! unless block_given? @@ -714,8 +694,6 @@ class Array # first object for which the block returns +true+. Returns +nil+ if no # match is found. # - # @mrbgem mruby-array-ext - # # ISO 15.2.12.5.14 def index(val=NONE, &block) return to_enum(:find_index, val) if !block && val == NONE diff --git a/mrbgems/mruby-array-ext/src/array.c b/mrbgems/mruby-array-ext/src/array.c index 37d8739b6..177dd7123 100644 --- a/mrbgems/mruby-array-ext/src/array.c +++ b/mrbgems/mruby-array-ext/src/array.c @@ -4,7 +4,7 @@ #include "mruby/range.h" #include "mruby/hash.h" -/** +/* * call-seq: * ary.assoc(obj) -> new_ary or nil * @@ -22,9 +22,8 @@ * a = [ s1, s2, s3 ] * a.assoc("letters") #=> [ "letters", "a", "b", "c" ] * a.assoc("foo") #=> nil - * - * @mrbgem mruby-array-ext */ + static mrb_value mrb_ary_assoc(mrb_state *mrb, mrb_value ary) { @@ -74,7 +73,7 @@ mrb_ary_rassoc(mrb_state *mrb, mrb_value ary) return mrb_nil_value(); } -/** +/* * call-seq: * ary.at(index) -> obj or nil * @@ -85,9 +84,8 @@ mrb_ary_rassoc(mrb_state *mrb, mrb_value ary) * a = [ "a", "b", "c", "d", "e" ] * a.at(0) #=> "a" * a.at(-1) #=> "e" - * - * @mrbgem mruby-array-ext */ + static mrb_value mrb_ary_at(mrb_state *mrb, mrb_value ary) { @@ -97,10 +95,6 @@ mrb_ary_at(mrb_state *mrb, mrb_value ary) return mrb_ary_entry(ary, pos); } -/** - * - * @mrbgem mruby-array-ext - */ static mrb_value mrb_ary_values_at(mrb_state *mrb, mrb_value self) { @@ -112,7 +106,7 @@ mrb_ary_values_at(mrb_state *mrb, mrb_value self) return mrb_get_values_at(mrb, self, RARRAY_LEN(self), argc, argv, mrb_ary_ref); } -/** +/* * call-seq: * ary.to_h -> Hash * @@ -122,8 +116,8 @@ mrb_ary_values_at(mrb_state *mrb, mrb_value self) * [[:foo, :bar], [1, 2]].to_h * # => {:foo => :bar, 1 => 2} * - * @mrbgem mruby-array-ext */ + static mrb_value mrb_ary_to_h(mrb_state *mrb, mrb_value ary) { diff --git a/mrbgems/mruby-enum-ext/mrblib/enum.rb b/mrbgems/mruby-enum-ext/mrblib/enum.rb index b41eaaf1f..ed1943f30 100644 --- a/mrbgems/mruby-enum-ext/mrblib/enum.rb +++ b/mrbgems/mruby-enum-ext/mrblib/enum.rb @@ -1,5 +1,7 @@ +## +# Enumerable +# module Enumerable - ## # call-seq: # enum.drop(n) -> array @@ -9,8 +11,7 @@ module Enumerable # # a = [1, 2, 3, 4, 5, 0] # a.drop(3) #=> [4, 5, 0] - # - # @mrbgem mruby-enum-ext + def drop(n) raise TypeError, "no implicit conversion of #{n.class} into Integer" unless n.respond_to?(:to_int) raise ArgumentError, "attempt to drop negative size" if n < 0 @@ -34,8 +35,7 @@ module Enumerable # # a = [1, 2, 3, 4, 5, 0] # a.drop_while {|i| i < 3 } #=> [3, 4, 5, 0] - # - # @mrbgem mruby-enum-ext + def drop_while(&block) return to_enum :drop_while unless block @@ -55,8 +55,7 @@ module Enumerable # # a = [1, 2, 3, 4, 5, 0] # a.take(3) #=> [1, 2, 3] - # - # @mrbgem mruby-enum-ext + def take(n) raise TypeError, "no implicit conversion of #{n.class} into Integer" unless n.respond_to?(:to_int) raise ArgumentError, "attempt to take negative size" if n < 0 @@ -83,7 +82,6 @@ module Enumerable # a = [1, 2, 3, 4, 5, 0] # a.take_while {|i| i < 3 } #=> [1, 2] # - # @mrbgem mruby-enum-ext def take_while(&block) return to_enum :take_while unless block @@ -112,8 +110,7 @@ module Enumerable # [6, 7, 8] # [7, 8, 9] # [8, 9, 10] - # - # @mrbgem mruby-enum-ext + def each_cons(n, &block) raise TypeError, "no implicit conversion of #{n.class} into Integer" unless n.respond_to?(:to_int) raise ArgumentError, "invalid size" if n <= 0 @@ -140,8 +137,7 @@ module Enumerable # [4, 5, 6] # [7, 8, 9] # [10] - # - # @mrbgem mruby-enum-ext + def each_slice(n, &block) raise TypeError, "no implicit conversion of #{n.class} into Integer" unless n.respond_to?(:to_int) raise ArgumentError, "invalid slice size" if n <= 0 @@ -170,7 +166,6 @@ module Enumerable # # (1..6).group_by {|i| i%3} #=> {0=>[3, 6], 1=>[1, 4], 2=>[2, 5]} # - # @mrbgem mruby-enum-ext def group_by(&block) return to_enum :group_by unless block @@ -192,8 +187,7 @@ module Enumerable # values in enum through the given block. # # If no block is given, an enumerator is returned instead. - # - # @mrbgem mruby-enum-ext + def sort_by(&block) return to_enum :sort_by unless block @@ -220,8 +214,6 @@ module Enumerable # Returns the first element, or the first +n+ elements, of the enumerable. # If the enumerable is empty, the first form returns nil, and the # second form returns an empty array. - # - # @mrbgem mruby-enum-ext def first(n=NONE) if n == NONE self.each do |*val| @@ -250,8 +242,6 @@ module Enumerable # If an argument is given, the number of items in +enum+ that # are equal to +item+ are counted. If a block is given, it # counts the number of elements yielding a true value. - # - # @mrbgem mruby-enum-ext def count(v=NONE, &block) count = 0 if block @@ -284,8 +274,6 @@ module Enumerable # # [1, 2, 3, 4].flat_map { |e| [e, -e] } #=> [1, -1, 2, -2, 3, -3, 4, -4] # [[1, 2], [3, 4]].flat_map { |e| e + [100] } #=> [1, 2, 100, 3, 4, 100] - # - # @mrbgem mruby-enum-ext def flat_map(&block) return to_enum :flat_map unless block @@ -313,8 +301,7 @@ module Enumerable # If no block is given, an enumerator is returned instead. # # %w[albatross dog horse].max_by {|x| x.length } #=> "albatross" - # - # @mrbgem mruby-enum-ext + def max_by(&block) return to_enum :max_by unless block @@ -348,8 +335,7 @@ module Enumerable # If no block is given, an enumerator is returned instead. # # %w[albatross dog horse].min_by {|x| x.length } #=> "dog" - # - # @mrbgem mruby-enum-ext + def min_by(&block) return to_enum :min_by unless block @@ -385,8 +371,7 @@ module Enumerable # a = %w(albatross dog horse) # a.minmax #=> ["albatross", "horse"] # a.minmax { |a, b| a.length <=> b.length } #=> ["dog", "albatross"] - # - # @mrbgem mruby-enum-ext + def minmax(&block) max = nil min = nil @@ -424,8 +409,7 @@ module Enumerable # If no block is given, an enumerator is returned instead. # # %w(albatross dog horse).minmax_by { |x| x.length } #=> ["dog", "albatross"] - # - # @mrbgem mruby-enum-ext + def minmax_by(&block) return to_enum :minmax_by unless block @@ -468,8 +452,7 @@ module Enumerable # [].none? #=> true # [nil, false].none? #=> true # [nil, true].none? #=> false - # - # @mrbgem mruby-enum-ext + def none?(&block) if block self.each do |*val| @@ -499,7 +482,7 @@ module Enumerable # [nil, true, 99].one? #=> false # [nil, true, false].one? #=> true # - # @mrbgem mruby-enum-ext + def one?(&block) count = 0 if block @@ -530,7 +513,7 @@ module Enumerable # (1..10).each_with_object([]) { |i, a| a << i*2 } # #=> [2, 4, 6, 8, 10, 12, 14, 16, 18, 20] # - # @mrbgem mruby-enum-ext + def each_with_object(obj=nil, &block) raise ArgumentError, "wrong number of arguments (0 for 1)" if obj.nil? @@ -557,7 +540,7 @@ module Enumerable # 2 # 1 # - # @mrbgem mruby-enum-ext + def reverse_each(&block) return to_enum :reverse_each unless block @@ -589,7 +572,7 @@ module Enumerable # a.cycle { |x| puts x } # print, a, b, c, a, b, c,.. forever. # a.cycle(2) { |x| puts x } # print, a, b, c, a, b, c. # - # @mrbgem mruby-enum-ext + def cycle(n=nil, &block) return to_enum(:cycle, n) if !block && n.nil? @@ -638,7 +621,7 @@ module Enumerable # (1..100).find_index { |i| i % 5 == 0 and i % 7 == 0 } #=> 34 # (1..100).find_index(50) #=> 49 # - # @mrbgem mruby-enum-ext + def find_index(val=NONE, &block) return to_enum(:find_index, val) if !block && val == NONE @@ -668,7 +651,7 @@ module Enumerable # enum#size. If the size of any argument is less than # enum#size, nil values are supplied. # - # @mrbgem mruby-enum-ext + def zip(*arg) ary = [] arg = arg.map{|a|a.to_a} @@ -697,7 +680,7 @@ module Enumerable # %i[hello world].each_with_index.to_h # # => {:hello => 0, :world => 1} # - # @mrbgem mruby-enum-ext + def to_h h = {} self.each do |*v| diff --git a/mrbgems/mruby-enum-lazy/mrblib/lazy.rb b/mrbgems/mruby-enum-lazy/mrblib/lazy.rb index a31e89d0e..8ce363c6d 100644 --- a/mrbgems/mruby-enum-lazy/mrblib/lazy.rb +++ b/mrbgems/mruby-enum-lazy/mrblib/lazy.rb @@ -15,8 +15,6 @@ module Enumerable # - take_while # - flat_map collect_concat # - zip - # - # @mrbgem mruby-enum-lazy def lazy Lazy.new(self) end @@ -26,8 +24,6 @@ module Enumerable # Based on https://github.com/yhara/enumerable-lazy # Inspired by https://github.com/antimon2/enumerable_lz # http://jp.rubyist.net/magazine/?0034-Enumerable_lz (ja) - # - # @mrbgem mruby-enum-lazy class Lazy < Enumerator def initialize(obj, &block) super(){|yielder| diff --git a/mrbgems/mruby-enumerator/mrblib/enumerator.rb b/mrbgems/mruby-enumerator/mrblib/enumerator.rb index e9300462a..9abaca38a 100644 --- a/mrbgems/mruby-enumerator/mrblib/enumerator.rb +++ b/mrbgems/mruby-enumerator/mrblib/enumerator.rb @@ -85,7 +85,6 @@ # puts ext_each(o.to_enum) {|*x| puts x; [:b, *x] } # # => [], [:b], [1], [:b, 1], [1, 2], [:b, 1, 2], 3 # -# @mrbgem mruby-enumerator class Enumerator include Enumerable diff --git a/mrbgems/mruby-eval/src/eval.c b/mrbgems/mruby-eval/src/eval.c index d1d2c1265..dd5fd5024 100644 --- a/mrbgems/mruby-eval/src/eval.c +++ b/mrbgems/mruby-eval/src/eval.c @@ -195,10 +195,6 @@ create_proc_from_string(mrb_state *mrb, char *s, int len, mrb_value binding, cha return proc; } -/** - * - * @mrbgem mruby-eval - */ static mrb_value f_eval(mrb_state *mrb, mrb_value self) { @@ -225,10 +221,6 @@ mrb_value mrb_obj_instance_eval(mrb_state *mrb, mrb_value self); #define CI_ACC_SKIP -1 -/** - * - * @mrbgem mruby-eval - */ static mrb_value f_instance_eval(mrb_state *mrb, mrb_value self) { diff --git a/mrbgems/mruby-exit/src/mruby-exit.c b/mrbgems/mruby-exit/src/mruby-exit.c index 5ac46d387..726dfd7c4 100644 --- a/mrbgems/mruby-exit/src/mruby-exit.c +++ b/mrbgems/mruby-exit/src/mruby-exit.c @@ -1,10 +1,6 @@ #include #include "mruby.h" -/** - * - * @mrbgem mruby-exit - */ static mrb_value f_exit(mrb_state *mrb, mrb_value self) { diff --git a/mrbgems/mruby-fiber/src/fiber.c b/mrbgems/mruby-fiber/src/fiber.c index ba277f767..93b3f1227 100644 --- a/mrbgems/mruby-fiber/src/fiber.c +++ b/mrbgems/mruby-fiber/src/fiber.c @@ -368,13 +368,6 @@ mrb_mruby_fiber_gem_init(mrb_state* mrb) { struct RClass *c; - - - /** - * Fiber - * - * @mrbgem mruby-fiber - */ c = mrb_define_class(mrb, "Fiber", mrb->object_class); MRB_SET_INSTANCE_TT(c, MRB_TT_FIBER); @@ -387,11 +380,6 @@ mrb_mruby_fiber_gem_init(mrb_state* mrb) mrb_define_class_method(mrb, c, "yield", fiber_yield, MRB_ARGS_ANY()); mrb_define_class_method(mrb, c, "current", fiber_current, MRB_ARGS_NONE()); - /** - * FiberError - * - * @mrbgem mruby-fiber - */ mrb_define_class(mrb, "FiberError", mrb->eStandardError_class); } diff --git a/mrbgems/mruby-hash-ext/mrblib/hash.rb b/mrbgems/mruby-hash-ext/mrblib/hash.rb index 415d8ea8f..d243aec24 100644 --- a/mrbgems/mruby-hash-ext/mrblib/hash.rb +++ b/mrbgems/mruby-hash-ext/mrblib/hash.rb @@ -1,8 +1,6 @@ class Hash # ISO does not define Hash#each_pair, so each_pair is defined in gem. - # - # @mrbgem mruby-hash-ext alias each_pair each ## @@ -24,7 +22,7 @@ class Hash # Hash[ [ ["a", 100], ["b", 200] ] ] #=> {"a"=>100, "b"=>200} # Hash["a" => 100, "b" => 200] #=> {"a"=>100, "b"=>200} # - # @mrbgem mruby-hash-ext + def self.[](*object) length = object.length if length == 1 @@ -82,7 +80,7 @@ class Hash # h1.merge!(h2) { |key, v1, v2| v1 } # #=> {"a"=>100, "b"=>200, "c"=>300} # - # @mrbgem mruby-hash-ext + def merge!(other, &block) raise TypeError, "can't convert argument into Hash" unless other.respond_to?(:to_hash) if block @@ -124,7 +122,7 @@ class Hash # prog.rb:2:in 'fetch': key not found (KeyError) # from prog.rb:2 # - # @mrbgem mruby-hash-ext + def fetch(key, none=NONE, &block) unless self.key?(key) if block @@ -152,7 +150,7 @@ class Hash # h = { "a" => 100, "b" => 200, "c" => 300 } # h.delete_if {|key, value| key >= "b" } #=> {"a"=>100} # - # @mrbgem mruby-hash-ext + def delete_if(&block) return to_enum :delete_if unless block_given? @@ -177,7 +175,7 @@ class Hash # a.flatten # => [1, "one", 2, [2, "two"], 3, "three"] # a.flatten(2) # => [1, "one", 2, 2, "two", 3, "three"] # - # @mrbgem mruby-hash-ext + def flatten(level=1) self.to_a.flatten(level) end @@ -192,7 +190,7 @@ class Hash # h = { "n" => 100, "m" => 100, "y" => 300, "d" => 200, "a" => 0 } # h.invert #=> {0=>"a", 100=>"m", 200=>"d", 300=>"y"} # - # @mrbgem mruby-hash-ext + def invert h = Hash.new self.each {|k, v| h[v] = k } @@ -209,7 +207,7 @@ class Hash # # If no block is given, an enumerator is returned instead. # - # @mrbgem mruby-hash-ext + def keep_if(&block) return to_enum :keep_if unless block_given? @@ -234,7 +232,7 @@ class Hash # h.key(300) #=> "c" # h.key(999) #=> nil # - # @mrbgem mruby-hash-ext + def key(val) self.each do |k, v| return k if v == val @@ -249,7 +247,6 @@ class Hash # Returns +self+. If called on a subclass of Hash, converts # the receiver to a Hash object. # - # @mrbgem mruby-hash-ext def to_h self end diff --git a/mrbgems/mruby-hash-ext/src/hash-ext.c b/mrbgems/mruby-hash-ext/src/hash-ext.c index d9a3b8de0..bce842cb4 100644 --- a/mrbgems/mruby-hash-ext/src/hash-ext.c +++ b/mrbgems/mruby-hash-ext/src/hash-ext.c @@ -17,8 +17,6 @@ * * h = { "cat" => "feline", "dog" => "canine", "cow" => "bovine" } * h.values_at("cow", "cat") #=> ["bovine", "feline"] - * - * @mrbgem mruby-hash-ext */ static mrb_value diff --git a/mrbgems/mruby-kernel-ext/src/kernel.c b/mrbgems/mruby-kernel-ext/src/kernel.c index a00fa9d6f..c578b6793 100644 --- a/mrbgems/mruby-kernel-ext/src/kernel.c +++ b/mrbgems/mruby-kernel-ext/src/kernel.c @@ -11,7 +11,6 @@ * Symbol. * If called outside of a method, it returns nil. * - * @mrbgem mruby-kernel-ext */ static mrb_value mrb_f_method(mrb_state *mrb, mrb_value self) @@ -46,8 +45,6 @@ mrb_f_method(mrb_state *mrb, mrb_value self) * Integer("0930", 10) #=> 930 * Integer("111", 2) #=> 7 * Integer(nil) #=> TypeError - * - * @mrbgem mruby-kernel-ext */ static mrb_value mrb_f_integer(mrb_state *mrb, mrb_value self) @@ -70,8 +67,6 @@ mrb_f_integer(mrb_state *mrb, mrb_value self) * Float(123.456) #=> 123.456 * Float("123.456") #=> 123.456 * Float(nil) #=> TypeError - * - * @mrbgem mruby-kernel-ext */ static mrb_value mrb_f_float(mrb_state *mrb, mrb_value self) @@ -93,8 +88,6 @@ mrb_f_float(mrb_state *mrb, mrb_value self) * String(self) #=> "main" * String(self.class) #=> "Object" * String(123456) #=> "123456" - * - * @mrbgem mruby-kernel-ext */ static mrb_value mrb_f_string(mrb_state *mrb, mrb_value self) @@ -119,7 +112,6 @@ mrb_f_string(mrb_state *mrb, mrb_value self) * * Array(1..5) #=> [1, 2, 3, 4, 5] * - * @mrbgem mruby-kernel-ext */ static mrb_value mrb_f_array(mrb_state *mrb, mrb_value self) @@ -151,7 +143,6 @@ mrb_f_array(mrb_state *mrb, mrb_value self) * Hash(key: :value) #=> {:key => :value} * Hash([1, 2, 3]) #=> TypeError * - * @mrbgem mruby-kernel-ext */ static mrb_value mrb_f_hash(mrb_state *mrb, mrb_value self) diff --git a/mrbgems/mruby-math/src/math.c b/mrbgems/mruby-math/src/math.c index a94c48c7b..79ad18b90 100644 --- a/mrbgems/mruby-math/src/math.c +++ b/mrbgems/mruby-math/src/math.c @@ -722,12 +722,6 @@ void mrb_mruby_math_gem_init(mrb_state* mrb) { struct RClass *mrb_math; - - /** - * Math functions - * - * @mrbgem mruby-math - */ mrb_math = mrb_define_module(mrb, "Math"); mrb_define_class_under(mrb, mrb_math, "DomainError", mrb->eStandardError_class); diff --git a/mrbgems/mruby-numeric-ext/mrblib/numeric_ext.rb b/mrbgems/mruby-numeric-ext/mrblib/numeric_ext.rb index 9cd76fd3f..dfc6ba87c 100644 --- a/mrbgems/mruby-numeric-ext/mrblib/numeric_ext.rb +++ b/mrbgems/mruby-numeric-ext/mrblib/numeric_ext.rb @@ -1,8 +1,5 @@ module Integral - - # @mrbgem mruby-numeric-ext def div(other) self.divmod(other)[0] end - end diff --git a/mrbgems/mruby-numeric-ext/src/numeric_ext.c b/mrbgems/mruby-numeric-ext/src/numeric_ext.c index fc35c5329..22c1668fa 100644 --- a/mrbgems/mruby-numeric-ext/src/numeric_ext.c +++ b/mrbgems/mruby-numeric-ext/src/numeric_ext.c @@ -1,9 +1,6 @@ #include #include "mruby.h" -/** - * @mrbgem mruby-numeric-ext - */ static mrb_value mrb_int_chr(mrb_state *mrb, mrb_value x) { diff --git a/mrbgems/mruby-object-ext/mrblib/object.rb b/mrbgems/mruby-object-ext/mrblib/object.rb index 69c21a6b5..581156cb0 100644 --- a/mrbgems/mruby-object-ext/mrblib/object.rb +++ b/mrbgems/mruby-object-ext/mrblib/object.rb @@ -12,7 +12,6 @@ class Object # .select {|x| x%2==0} .tap {|x| puts "evens: #{x.inspect}"} # .map { |x| x*x } .tap {|x| puts "squares: #{x.inspect}"} # - # @mrbgem mruby-object-ext def tap yield self self diff --git a/mrbgems/mruby-object-ext/src/object.c b/mrbgems/mruby-object-ext/src/object.c index f14831a80..dc1924db0 100644 --- a/mrbgems/mruby-object-ext/src/object.c +++ b/mrbgems/mruby-object-ext/src/object.c @@ -7,9 +7,8 @@ * nil.to_a -> [] * * Always returns an empty array. - * - * @mrbgem mruby-object-ext */ + static mrb_value nil_to_a(mrb_state *mrb, mrb_value obj) { @@ -21,9 +20,8 @@ nil_to_a(mrb_state *mrb, mrb_value obj) * nil.to_f -> 0.0 * * Always returns zero. - * - * @mrbgem mruby-object-ext */ + static mrb_value nil_to_f(mrb_state *mrb, mrb_value obj) { @@ -35,9 +33,8 @@ nil_to_f(mrb_state *mrb, mrb_value obj) * nil.to_i -> 0 * * Always returns zero. - * - * @mrbgem mruby-object-ext */ + static mrb_value nil_to_i(mrb_state *mrb, mrb_value obj) { @@ -60,9 +57,8 @@ nil_to_i(mrb_state *mrb, mrb_value obj) * end * k = KlassWithSecret.new * k.instance_exec(5) {|x| @secret+x } #=> 104 - * - * @mrbgem mruby-object-ext */ + static mrb_value mrb_obj_instance_exec(mrb_state *mrb, mrb_value self) { diff --git a/mrbgems/mruby-objectspace/src/mruby_objectspace.c b/mrbgems/mruby-objectspace/src/mruby_objectspace.c index cbb80799e..1b18bf23f 100644 --- a/mrbgems/mruby-objectspace/src/mruby_objectspace.c +++ b/mrbgems/mruby-objectspace/src/mruby_objectspace.c @@ -174,12 +174,6 @@ os_each_object(mrb_state *mrb, mrb_value self) void mrb_mruby_objectspace_gem_init(mrb_state *mrb) { - - /** - * ObjectSpace - * - * @mrbgem mruby-objectspace - */ struct RClass *os = mrb_define_module(mrb, "ObjectSpace"); mrb_define_class_method(mrb, os, "count_objects", os_count_objects, MRB_ARGS_OPT(1)); mrb_define_class_method(mrb, os, "each_object", os_each_object, MRB_ARGS_OPT(1)); diff --git a/mrbgems/mruby-print/mrblib/print.rb b/mrbgems/mruby-print/mrblib/print.rb index 77a1cb696..38a10661b 100644 --- a/mrbgems/mruby-print/mrblib/print.rb +++ b/mrbgems/mruby-print/mrblib/print.rb @@ -1,9 +1,11 @@ +## +# Kernel +# +# ISO 15.3.1 module Kernel - ## # Invoke method +print+ on STDOUT and passing +*args+ # - # @mrbgem mruby-print # ISO 15.3.1.2.10 def print(*args) i = 0 @@ -17,7 +19,6 @@ module Kernel ## # Invoke method +puts+ on STDOUT and passing +*args*+ # - # @mrbgem mruby-print # ISO 15.3.1.2.11 def puts(*args) i = 0 @@ -35,7 +36,6 @@ module Kernel ## # Print human readable object description # - # @mrbgem mruby-print # ISO 15.3.1.3.34 def p(*args) i = 0 diff --git a/mrbgems/mruby-proc-ext/mrblib/proc.rb b/mrbgems/mruby-proc-ext/mrblib/proc.rb index c89c63d20..b71663938 100644 --- a/mrbgems/mruby-proc-ext/mrblib/proc.rb +++ b/mrbgems/mruby-proc-ext/mrblib/proc.rb @@ -1,21 +1,17 @@ class Proc - # @mrbgem mruby-proc-ext def ===(*args) call(*args) end - # @mrbgem mruby-proc-ext def yield(*args) call(*args) end - # @mrbgem mruby-proc-ext def to_proc self end - # @mrbgem mruby-proc-ext def curry(arity=self.arity) type = :proc abs = lambda {|a| a < 0 ? -a - 1 : a} diff --git a/mrbgems/mruby-proc-ext/src/proc.c b/mrbgems/mruby-proc-ext/src/proc.c index 783fbbd3a..73873a360 100644 --- a/mrbgems/mruby-proc-ext/src/proc.c +++ b/mrbgems/mruby-proc-ext/src/proc.c @@ -5,9 +5,6 @@ #include "mruby/string.h" #include "mruby/debug.h" -/** - * @mrbgem mruby-proc-ext - */ static mrb_value mrb_proc_lambda(mrb_state *mrb, mrb_value self) { @@ -15,9 +12,6 @@ mrb_proc_lambda(mrb_state *mrb, mrb_value self) return mrb_bool_value(MRB_PROC_STRICT_P(p)); } -/** - * @mrbgem mruby-proc-ext - */ static mrb_value mrb_proc_source_location(mrb_state *mrb, mrb_value self) { @@ -39,9 +33,6 @@ mrb_proc_source_location(mrb_state *mrb, mrb_value self) } } -/** - * @mrbgem mruby-proc-ext - */ static mrb_value mrb_proc_inspect(mrb_state *mrb, mrb_value self) { @@ -76,9 +67,6 @@ mrb_proc_inspect(mrb_state *mrb, mrb_value self) return str; } -/** - * @mrbgem mruby-proc-ext - */ static mrb_value mrb_kernel_proc(mrb_state *mrb, mrb_value self) { @@ -100,9 +88,8 @@ mrb_kernel_proc(mrb_state *mrb, mrb_value self) * * prc = lambda{|x, y=42, *other|} * prc.parameters #=> [[:req, :x], [:opt, :y], [:rest, :other]] - * - * @mrbgem mruby-proc-ext */ + static mrb_value mrb_proc_parameters(mrb_state *mrb, mrb_value self) { diff --git a/mrbgems/mruby-random/src/random.c b/mrbgems/mruby-random/src/random.c index 1a9e8a7d3..3be3ac81c 100644 --- a/mrbgems/mruby-random/src/random.c +++ b/mrbgems/mruby-random/src/random.c @@ -104,9 +104,6 @@ get_random_state(mrb_state *mrb) return DATA_GET_PTR(mrb, random_val, &mt_state_type, mt_state); } -/** - * @mrbgem mruby-random - */ static mrb_value mrb_random_g_rand(mrb_state *mrb, mrb_value self) { @@ -114,9 +111,6 @@ mrb_random_g_rand(mrb_state *mrb, mrb_value self) return mrb_random_rand(mrb, random); } -/** - * @mrbgem mruby-random - */ static mrb_value mrb_random_g_srand(mrb_state *mrb, mrb_value self) { @@ -202,9 +196,8 @@ mrb_random_srand(mrb_state *mrb, mrb_value self) * ary.shuffle! -> ary * * Shuffles elements in self in place. - * - * @mrbgem mruby-random */ + static mrb_value mrb_ary_shuffle_bang(mrb_state *mrb, mrb_value ary) { @@ -241,9 +234,8 @@ mrb_ary_shuffle_bang(mrb_state *mrb, mrb_value ary) * ary.shuffle -> new_ary * * Returns a new array with elements of self shuffled. - * - * @mrbgem mruby-random */ + static mrb_value mrb_ary_shuffle(mrb_state *mrb, mrb_value ary) { @@ -266,9 +258,8 @@ mrb_ary_shuffle(mrb_state *mrb, mrb_value ary) * * If the array is empty the first form returns +nil+ and the second form * returns an empty array. - * - * @mrbgem mruby-random */ + static mrb_value mrb_ary_sample(mrb_state *mrb, mrb_value ary) { @@ -332,9 +323,6 @@ void mrb_mruby_random_gem_init(mrb_state *mrb) mrb_define_method(mrb, mrb->kernel_module, "rand", mrb_random_g_rand, MRB_ARGS_OPT(1)); mrb_define_method(mrb, mrb->kernel_module, "srand", mrb_random_g_srand, MRB_ARGS_OPT(1)); - /** - * @mrbgem mruby-random - */ random = mrb_define_class(mrb, "Random", mrb->object_class); MRB_SET_INSTANCE_TT(random, MRB_TT_DATA); mrb_define_class_method(mrb, random, "rand", mrb_random_g_rand, MRB_ARGS_OPT(1)); diff --git a/mrbgems/mruby-range-ext/src/range.c b/mrbgems/mruby-range-ext/src/range.c index 974fbe419..35632ad20 100644 --- a/mrbgems/mruby-range-ext/src/range.c +++ b/mrbgems/mruby-range-ext/src/range.c @@ -38,8 +38,6 @@ r_lt(mrb_state *mrb, mrb_value a, mrb_value b) * ("a".."z").cover?("c") #=> true * ("a".."z").cover?("5") #=> false * ("a".."z").cover?("cc") #=> true - * - * @mrbgem mruby-range-ext */ static mrb_value mrb_range_cover(mrb_state *mrb, mrb_value range) @@ -77,8 +75,6 @@ mrb_range_cover(mrb_state *mrb, mrb_value range) * * (10..20).first #=> 10 * (10..20).first(3) #=> [10, 11, 12] - * - * @mrbgem mruby-range-ext */ static mrb_value mrb_range_first(mrb_state *mrb, mrb_value range) @@ -110,8 +106,6 @@ mrb_range_first(mrb_state *mrb, mrb_value range) * (10...20).last #=> 20 * (10..20).last(3) #=> [18, 19, 20] * (10...20).last(3) #=> [17, 18, 19] - * - * @mrbgem mruby-range-ext */ static mrb_value mrb_range_last(mrb_state *mrb, mrb_value range) @@ -137,9 +131,8 @@ mrb_range_last(mrb_state *mrb, mrb_value range) * * (10..20).size #=> 11 * ('a'..'z').size #=> nil - * - * @mrbgem mruby-range-ext */ + static mrb_value mrb_range_size(mrb_state *mrb, mrb_value range) { diff --git a/mrbgems/mruby-sprintf/mrblib/string.rb b/mrbgems/mruby-sprintf/mrblib/string.rb index cfca56b7a..d7e55536a 100644 --- a/mrbgems/mruby-sprintf/mrblib/string.rb +++ b/mrbgems/mruby-sprintf/mrblib/string.rb @@ -1,6 +1,4 @@ class String - - # @mrbgem mruby-sprintf def %(args) if args.is_a? Array sprintf(self, *args) diff --git a/mrbgems/mruby-sprintf/src/kernel.c b/mrbgems/mruby-sprintf/src/kernel.c index 22cede04c..bd4f2bca1 100644 --- a/mrbgems/mruby-sprintf/src/kernel.c +++ b/mrbgems/mruby-sprintf/src/kernel.c @@ -6,9 +6,6 @@ #include "mruby.h" -/** - * @mrbgem mruby-sprintf - */ mrb_value mrb_f_sprintf(mrb_state *mrb, mrb_value obj); /* in sprintf.c */ void diff --git a/mrbgems/mruby-string-ext/mrblib/string.rb b/mrbgems/mruby-string-ext/mrblib/string.rb index b38b3c59f..4c8a2ce3b 100644 --- a/mrbgems/mruby-string-ext/mrblib/string.rb +++ b/mrbgems/mruby-string-ext/mrblib/string.rb @@ -9,7 +9,6 @@ class String # a = "abcde" # a.clear #=> "" # - # @mrbgem mruby-string-ext def clear self.replace("") end @@ -24,7 +23,6 @@ class String # " hello ".lstrip #=> "hello " # "hello".lstrip #=> "hello" # - # @mrbgem mruby-string-ext def lstrip a = 0 z = self.size - 1 @@ -42,7 +40,6 @@ class String # " hello ".rstrip #=> " hello" # "hello".rstrip #=> "hello" # - # @mrbgem mruby-string-ext def rstrip a = 0 z = self.size - 1 @@ -59,7 +56,6 @@ class String # " hello ".strip #=> "hello" # "\tgoodbye\r\n".strip #=> "goodbye" # - # @mrbgem mruby-string-ext def strip a = 0 z = self.size - 1 @@ -79,7 +75,6 @@ class String # " hello ".lstrip #=> "hello " # "hello".lstrip! #=> nil # - # @mrbgem mruby-string-ext def lstrip! s = self.lstrip (s == self) ? nil : self.replace(s) @@ -96,7 +91,6 @@ class String # " hello ".rstrip #=> " hello" # "hello".rstrip! #=> nil # - # @mrbgem mruby-string-ext def rstrip! s = self.rstrip (s == self) ? nil : self.replace(s) @@ -109,7 +103,6 @@ class String # Removes leading and trailing whitespace from str. Returns # nil if str was not altered. # - # @mrbgem mruby-string-ext def strip! s = self.strip (s == self) ? nil : self.replace(s) @@ -126,7 +119,6 @@ class String # "abcdef".casecmp("abcdefg") #=> -1 # "abcdef".casecmp("ABCDEF") #=> 0 # - # @mrbgem mruby-string-ext def casecmp(str) self.downcase <=> str.to_str.downcase rescue NoMethodError @@ -144,7 +136,6 @@ class String end end - # @mrbgem mruby-string-ext def rpartition(sep) raise TypeError, "type mismatch: #{sep.class} given" unless sep.is_a? String n = rindex(sep) @@ -172,7 +163,6 @@ class String # string.slice!("r") #=> "r" # string #=> "thsa sting" # - # @mrbgem mruby-string-ext def slice!(arg1, arg2=nil) raise "wrong number of arguments (for 1..2)" if arg1.nil? && arg2.nil? @@ -244,7 +234,6 @@ class String # "abcd".insert(-3, 'X') #=> "abXcd" # "abcd".insert(-1, 'X') #=> "abcdX" # - # @mrbgem mruby-string-ext def insert(idx, str) pos = idx.to_i pos += self.size + 1 if pos < 0 @@ -267,8 +256,6 @@ class String # "hello".ljust(4) #=> "hello" # "hello".ljust(20) #=> "hello " # "hello".ljust(20, '1234') #=> "hello123412341234123" - # - # @mrbgem mruby-string-ext def ljust(idx, padstr = ' ') if idx <= self.size return self @@ -310,7 +297,6 @@ class String # "25".upto("5").to_a #=> [] # "07".upto("11").to_a #=> ["07", "08", "09", "10", "11"] # - # @mrbgem mruby-string-ext def upto(other_str, excl=false, &block) return to_enum :upto, other_str, excl unless block @@ -325,7 +311,6 @@ class String end end - # @mrbgem mruby-string-ext def chars(&block) if block_given? self.split('').map do |i| @@ -338,7 +323,6 @@ class String end alias each_char chars - # @mrbgem mruby-string-ext def codepoints(&block) len = self.size diff --git a/mrbgems/mruby-string-ext/src/string.c b/mrbgems/mruby-string-ext/src/string.c index 028f77aee..0afc53386 100644 --- a/mrbgems/mruby-string-ext/src/string.c +++ b/mrbgems/mruby-string-ext/src/string.c @@ -5,9 +5,6 @@ #include "mruby/string.h" #include "mruby/range.h" -/** - * @mrbgem mruby-string-ext - */ static mrb_value mrb_str_getbyte(mrb_state *mrb, mrb_value str) { @@ -22,9 +19,6 @@ mrb_str_getbyte(mrb_state *mrb, mrb_value str) return mrb_fixnum_value((unsigned char)RSTRING_PTR(str)[pos]); } -/** - * @mrbgem mruby-string-ext - */ static mrb_value mrb_str_setbyte(mrb_state *mrb, mrb_value str) { @@ -44,9 +38,6 @@ mrb_str_setbyte(mrb_state *mrb, mrb_value str) return mrb_fixnum_value((unsigned char)byte); } -/** - * @mrbgem mruby-string-ext - */ static mrb_value mrb_str_byteslice(mrb_state *mrb, mrb_value str) { @@ -88,8 +79,6 @@ mrb_str_byteslice(mrb_state *mrb, mrb_value str) * Equivalent to String#swapcase, but modifies the receiver in * place, returning str, or nil if no changes were made. * Note: case conversion is effective only in ASCII region. - * - * @mrbgem mruby-string-ext */ static mrb_value mrb_str_swapcase_bang(mrb_state *mrb, mrb_value str) @@ -127,8 +116,6 @@ mrb_str_swapcase_bang(mrb_state *mrb, mrb_value str) * * "Hello".swapcase #=> "hELLO" * "cYbEr_PuNk11".swapcase #=> "CyBeR_pUnK11" - * - * @mrbgem mruby-string-ext */ static mrb_value mrb_str_swapcase(mrb_state *mrb, mrb_value self) @@ -154,8 +141,6 @@ mrb_str_swapcase(mrb_state *mrb, mrb_value self) * a = "hello " * a << "world" #=> "hello world" * a.concat(33) #=> "hello world!" - * - * @mrbgem mruby-string-ext */ static mrb_value mrb_str_concat2(mrb_state *mrb, mrb_value self) @@ -178,8 +163,6 @@ mrb_str_concat2(mrb_state *mrb, mrb_value self) * "hello".start_with?("heaven", "hell") #=> true * "hello".start_with?("heaven", "paradise") #=> false * "h".start_with?("heaven", "hell") #=> false - * - * @mrbgem mruby-string-ext */ static mrb_value mrb_str_start_with(mrb_state *mrb, mrb_value self) @@ -209,8 +192,6 @@ mrb_str_start_with(mrb_state *mrb, mrb_value self) * str.end_with?([suffixes]+) -> true or false * * Returns true if +str+ ends with one of the +suffixes+ given. - * - * @mrbgem mruby-string-ext */ static mrb_value mrb_str_end_with(mrb_state *mrb, mrb_value self) @@ -237,18 +218,12 @@ mrb_str_end_with(mrb_state *mrb, mrb_value self) return mrb_false_value(); } -/* - * @mrbgem mruby-string-ext - */ static mrb_value mrb_str_hex(mrb_state *mrb, mrb_value self) { return mrb_str_to_inum(mrb, self, 16, FALSE); } -/* - * @mrbgem mruby-string-ext - */ static mrb_value mrb_str_oct(mrb_state *mrb, mrb_value self) { @@ -263,8 +238,6 @@ mrb_str_oct(mrb_state *mrb, mrb_value self) * * a = "abcde" * a.chr #=> "a" - * - * @mrbgem mruby-string-ext */ static mrb_value mrb_str_chr(mrb_state *mrb, mrb_value self) @@ -272,9 +245,6 @@ mrb_str_chr(mrb_state *mrb, mrb_value self) return mrb_str_substr(mrb, self, 0, 1); } -/* - * @mrbgem mruby-string-ext - */ static mrb_value mrb_fixnum_chr(mrb_state *mrb, mrb_value num) { @@ -328,8 +298,6 @@ mrb_fixnum_chr(mrb_state *mrb, mrb_value num) * * a = "abc\ndef" * a.lines #=> ["abc\n", "def"] - * - * @mrbgem mruby-string-ext */ static mrb_value mrb_str_lines(mrb_state *mrb, mrb_value self) @@ -377,8 +345,6 @@ mrb_str_lines(mrb_state *mrb, mrb_value self) * * a = "abc" * a.succ #=> "abd" - * - * @mrbgem mruby-string-ext */ static mrb_value mrb_str_succ_bang(mrb_state *mrb, mrb_value self) @@ -453,9 +419,6 @@ mrb_str_succ_bang(mrb_state *mrb, mrb_value self) return self; } -/* - * @mrbgem mruby-string-ext - */ static mrb_value mrb_str_succ(mrb_state *mrb, mrb_value self) { @@ -475,8 +438,6 @@ mrb_str_succ(mrb_state *mrb, mrb_value self) * a = "world" * a.prepend("hello ") #=> "hello world" * a #=> "hello world" - * - * @mrbgem mruby-string-ext */ static mrb_value mrb_str_prepend(mrb_state *mrb, mrb_value self) @@ -555,9 +516,6 @@ utf8code(unsigned char* p) return p[0]; } -/* - * @mrbgem mruby-string-ext - */ static mrb_value mrb_str_ord(mrb_state* mrb, mrb_value str) { diff --git a/mrbgems/mruby-struct/src/struct.c b/mrbgems/mruby-struct/src/struct.c index e73482f68..342e3eb5e 100644 --- a/mrbgems/mruby-struct/src/struct.c +++ b/mrbgems/mruby-struct/src/struct.c @@ -739,28 +739,26 @@ mrb_struct_values_at(mrb_state *mrb, mrb_value self) return mrb_get_values_at(mrb, self, RSTRUCT_LEN(self), argc, argv, struct_aref_int); } + +/* + * A Struct is a convenient way to bundle a number of + * attributes together, using accessor methods, without having to write + * an explicit class. + * + * The Struct class is a generator of specific classes, + * each one of which is defined to hold a set of variables and their + * accessors. In these examples, we'll call the generated class + * "CustomerClass," and we'll show an example instance of that + * class as "CustomerInst." + * + * In the descriptions that follow, the parameter symbol refers + * to a symbol, which is either a quoted string or a + * Symbol (such as :name). + */ void mrb_mruby_struct_gem_init(mrb_state* mrb) { struct RClass *st; - - /* - * A Struct is a convenient way to bundle a number of - * attributes together, using accessor methods, without having to write - * an explicit class. - * - * The Struct class is a generator of specific classes, - * each one of which is defined to hold a set of variables and their - * accessors. In these examples, we'll call the generated class - * "CustomerClass," and we'll show an example instance of that - * class as "CustomerInst." - * - * In the descriptions that follow, the parameter symbol refers - * to a symbol, which is either a quoted string or a - * Symbol (such as :name). - * - * @mrbgem mruby-struct - */ st = mrb_define_class(mrb, "Struct", mrb->object_class); mrb_define_class_method(mrb, st, "new", mrb_struct_s_def, MRB_ARGS_ANY()); /* 15.2.18.3.1 */ diff --git a/mrbgems/mruby-symbol-ext/mrblib/symbol.rb b/mrbgems/mruby-symbol-ext/mrblib/symbol.rb index 9e45f0acd..1e3d24b80 100644 --- a/mrbgems/mruby-symbol-ext/mrblib/symbol.rb +++ b/mrbgems/mruby-symbol-ext/mrblib/symbol.rb @@ -1,7 +1,6 @@ class Symbol include Comparable - # @mrbgem mruby-symbol-ext alias intern to_sym def to_proc @@ -15,8 +14,7 @@ class Symbol # sym.capitalize -> symbol # # Same as sym.to_s.capitalize.intern. - # - # @mrbgem mruby-symbol-ext + def capitalize (self.to_s.capitalize! || self).to_sym end @@ -26,8 +24,7 @@ class Symbol # sym.downcase -> symbol # # Same as sym.to_s.downcase.intern. - # - # @mrbgem mruby-symbol-ext + def downcase (self.to_s.downcase! || self).to_sym end @@ -37,8 +34,7 @@ class Symbol # sym.upcase -> symbol # # Same as sym.to_s.upcase.intern. - # - # @mrbgem mruby-symbol-ext + def upcase (self.to_s.upcase! || self).to_sym end @@ -48,8 +44,7 @@ class Symbol # sym.casecmp(other) -> -1, 0, +1 or nil # # Case-insensitive version of Symbol#<=>. - # - # @mrbgem mruby-symbol-ext + def casecmp(other) return nil unless other.kind_of?(Symbol) lhs = self.to_s; lhs.upcase! @@ -62,8 +57,7 @@ class Symbol # sym.empty? -> true or false # # Returns that _sym_ is :"" or not. - # - # @mrbgem mruby-symbol-ext + def empty? self.length == 0 end diff --git a/mrbgems/mruby-symbol-ext/src/symbol.c b/mrbgems/mruby-symbol-ext/src/symbol.c index ea4cd9efa..a96c4017f 100644 --- a/mrbgems/mruby-symbol-ext/src/symbol.c +++ b/mrbgems/mruby-symbol-ext/src/symbol.c @@ -21,8 +21,6 @@ typedef struct symbol_name { * :default_proc, :compact, :extend, * :Tms, :getwd, :$=, :ThreadGroup, * :wait2, :$>] - * - * @mrbgem mruby-symbol-ext */ static mrb_value mrb_sym_all_symbols(mrb_state *mrb, mrb_value self) @@ -42,8 +40,6 @@ mrb_sym_all_symbols(mrb_state *mrb, mrb_value self) * sym.length -> integer * * Same as sym.to_s.length. - * - * @mrbgem mruby-symbol-ext */ static mrb_value mrb_sym_length(mrb_state *mrb, mrb_value self) diff --git a/mrbgems/mruby-time/mrblib/time.rb b/mrbgems/mruby-time/mrblib/time.rb index cb2153c6f..df0d8ca82 100644 --- a/mrbgems/mruby-time/mrblib/time.rb +++ b/mrbgems/mruby-time/mrblib/time.rb @@ -1,6 +1,3 @@ -# Time class -# -# @mrbgem mruby-time class Time def sunday?; wday == 0 end def monday?; wday == 1 end diff --git a/mrbgems/mruby-toplevel-ext/mrblib/toplevel.rb b/mrbgems/mruby-toplevel-ext/mrblib/toplevel.rb index 562cdf1ac..774562398 100644 --- a/mrbgems/mruby-toplevel-ext/mrblib/toplevel.rb +++ b/mrbgems/mruby-toplevel-ext/mrblib/toplevel.rb @@ -1,16 +1,11 @@ -# @mrbgem mruby-toplevel-ext + def self.include (*modules) self.class.include(*modules) end -# @mrbgem mruby-toplevel-ext def self.private(*methods) end - -# @mrbgem mruby-toplevel-ext def self.protected(*methods) end - -# @mrbgem mruby-toplevel-ext def self.public(*methods) end -- cgit v1.2.3 From d4238494eb7cd36c510c87ace6c31aeb1d0f1d6b Mon Sep 17 00:00:00 2001 From: Seba Gamboa Date: Wed, 21 Oct 2015 17:03:43 -0300 Subject: Tag include/mruby/error.h functions with required mrbgem tag --- include/mruby/error.h | 24 +++++++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-) diff --git a/include/mruby/error.h b/include/mruby/error.h index 8b6430137..1ac0791a2 100644 --- a/include/mruby/error.h +++ b/include/mruby/error.h @@ -32,12 +32,34 @@ MRB_API mrb_noreturn void mrb_no_method_error(mrb_state *mrb, mrb_sym id, mrb_va /* declaration for fail method */ MRB_API mrb_value mrb_f_raise(mrb_state*, mrb_value); -/* functions defined in mruby-error mrbgem */ +/** + * Protect + * + * @mrbgem mruby-error + */ MRB_API mrb_value mrb_protect(mrb_state *mrb, mrb_func_t body, mrb_value data, mrb_bool *state); + +/** + * Ensure + * + * @mrbgem mruby-error + */ MRB_API mrb_value mrb_ensure(mrb_state *mrb, mrb_func_t body, mrb_value b_data, mrb_func_t ensure, mrb_value e_data); + +/** + * Rescue + * + * @mrbgem mruby-error + */ MRB_API mrb_value mrb_rescue(mrb_state *mrb, mrb_func_t body, mrb_value b_data, mrb_func_t rescue, mrb_value r_data); + +/** + * Rescue exception + * + * @mrbgem mruby-error + */ MRB_API mrb_value mrb_rescue_exceptions(mrb_state *mrb, mrb_func_t body, mrb_value b_data, mrb_func_t rescue, mrb_value r_data, mrb_int len, struct RClass **classes); -- cgit v1.2.3