Fix missing `MRB_API` prefix for functions below; clse #4267

Functions to add prototypes to headers:
* mrb_ary_splice()
* mrb_notimplement()
* mrb_vformat()
* mrb_cstr_to_dbl()
* mrb_cstr_to_inum()

Functions to be made `static` (`MRB_API` was not needed):
* mrb_mod_module_function()
* mrb_obj_hash()
* mrb_str_len_to_inum()

Functions to remove `MRB_API` from definitions (referenced from within `libmruby`):
* mrb_mod_cv_defined()
* mrb_mod_cv_get()
* mrb_f_send()
parent a5a6b511
...@@ -708,6 +708,9 @@ MRB_API struct RClass * mrb_module_get(mrb_state *mrb, const char *name); ...@@ -708,6 +708,9 @@ MRB_API struct RClass * mrb_module_get(mrb_state *mrb, const char *name);
* @return [struct RClass *] A reference to the module. * @return [struct RClass *] A reference to the module.
*/ */
MRB_API struct RClass * mrb_module_get_under(mrb_state *mrb, struct RClass *outer, const char *name); MRB_API struct RClass * mrb_module_get_under(mrb_state *mrb, struct RClass *outer, const char *name);
/* a function to raise NotImplementedError with current method name */
MRB_API void mrb_notimplement(mrb_state*);
/* a function to be replacement of unimplemented method */
MRB_API mrb_value mrb_notimplement_m(mrb_state*, mrb_value); MRB_API mrb_value mrb_notimplement_m(mrb_state*, mrb_value);
/** /**
...@@ -1143,6 +1146,8 @@ MRB_API void mrb_warn(mrb_state *mrb, const char *fmt, ...); ...@@ -1143,6 +1146,8 @@ MRB_API void mrb_warn(mrb_state *mrb, const char *fmt, ...);
MRB_API mrb_noreturn void mrb_bug(mrb_state *mrb, const char *fmt, ...); MRB_API mrb_noreturn void mrb_bug(mrb_state *mrb, const char *fmt, ...);
MRB_API void mrb_print_backtrace(mrb_state *mrb); MRB_API void mrb_print_backtrace(mrb_state *mrb);
MRB_API void mrb_print_error(mrb_state *mrb); MRB_API void mrb_print_error(mrb_state *mrb);
/* function for `raisef` formatting */
MRB_API mrb_value mrb_vformat(mrb_state *mrb, const char *format, va_list ap);
/* macros to get typical exception objects /* macros to get typical exception objects
note: note:
......
...@@ -227,6 +227,22 @@ MRB_API mrb_value mrb_ary_unshift(mrb_state *mrb, mrb_value self, mrb_value item ...@@ -227,6 +227,22 @@ MRB_API mrb_value mrb_ary_unshift(mrb_state *mrb, mrb_value self, mrb_value item
*/ */
MRB_API mrb_value mrb_ary_entry(mrb_value ary, mrb_int offset); MRB_API mrb_value mrb_ary_entry(mrb_value ary, mrb_int offset);
/*
* Replace subsequence of an array.
*
* Equivalent to:
*
* ary.shift
*
* @param mrb The mruby state reference.
* @param self The array from which the value will be shifted.
* @param head Beginning position of a replacement subsequence.
* @param len Length of a replacement subsequence.
* @param rpl The array of replacement elements.
* @return The receiver array.
*/
MRB_API mrb_value mrb_ary_splice(mrb_state *mrb, mrb_value self, mrb_int head, mrb_int len, mrb_value rpl);
/* /*
* Shifts the first element from the array. * Shifts the first element from the array.
* *
......
...@@ -29,7 +29,7 @@ MRB_API mrb_value mrb_exc_backtrace(mrb_state *mrb, mrb_value exc); ...@@ -29,7 +29,7 @@ MRB_API mrb_value mrb_exc_backtrace(mrb_state *mrb, mrb_value exc);
MRB_API mrb_value mrb_get_backtrace(mrb_state *mrb); MRB_API mrb_value mrb_get_backtrace(mrb_state *mrb);
MRB_API mrb_noreturn void mrb_no_method_error(mrb_state *mrb, mrb_sym id, mrb_value args, const char *fmt, ...); MRB_API mrb_noreturn void mrb_no_method_error(mrb_state *mrb, mrb_sym id, mrb_value args, const char *fmt, ...);
/* declaration for fail method */ /* declaration for `fail` method */
MRB_API mrb_value mrb_f_raise(mrb_state*, mrb_value); MRB_API mrb_value mrb_f_raise(mrb_state*, mrb_value);
struct RBreak { struct RBreak {
......
...@@ -352,7 +352,9 @@ MRB_API mrb_value mrb_str_dup(mrb_state *mrb, mrb_value str); ...@@ -352,7 +352,9 @@ MRB_API mrb_value mrb_str_dup(mrb_state *mrb, mrb_value str);
MRB_API mrb_value mrb_str_intern(mrb_state *mrb, mrb_value self); MRB_API mrb_value mrb_str_intern(mrb_state *mrb, mrb_value self);
MRB_API mrb_value mrb_str_to_inum(mrb_state *mrb, mrb_value str, mrb_int base, mrb_bool badcheck); MRB_API mrb_value mrb_str_to_inum(mrb_state *mrb, mrb_value str, mrb_int base, mrb_bool badcheck);
MRB_API mrb_value mrb_cstr_to_inum(mrb_state *mrb, const char *s, mrb_int base, mrb_bool badcheck);
MRB_API double mrb_str_to_dbl(mrb_state *mrb, mrb_value str, mrb_bool badcheck); MRB_API double mrb_str_to_dbl(mrb_state *mrb, mrb_value str, mrb_bool badcheck);
MRB_API double mrb_cstr_to_dbl(mrb_state *mrb, const char *s, mrb_bool badcheck);
/* /*
* Returns a converted string type. * Returns a converted string type.
......
...@@ -2106,7 +2106,7 @@ mrb_mod_eqq(mrb_state *mrb, mrb_value mod) ...@@ -2106,7 +2106,7 @@ mrb_mod_eqq(mrb_state *mrb, mrb_value mod)
return mrb_bool_value(eqq); return mrb_bool_value(eqq);
} }
MRB_API mrb_value static mrb_value
mrb_mod_module_function(mrb_state *mrb, mrb_value mod) mrb_mod_module_function(mrb_state *mrb, mrb_value mod)
{ {
mrb_value *argv; mrb_value *argv;
......
...@@ -492,7 +492,7 @@ mrb_obj_frozen(mrb_state *mrb, mrb_value self) ...@@ -492,7 +492,7 @@ mrb_obj_frozen(mrb_state *mrb, mrb_value self)
* <code>Hash</code>. Any hash value that exceeds the capacity of a * <code>Hash</code>. Any hash value that exceeds the capacity of a
* <code>Fixnum</code> will be truncated before being used. * <code>Fixnum</code> will be truncated before being used.
*/ */
MRB_API mrb_value static mrb_value
mrb_obj_hash(mrb_state *mrb, mrb_value self) mrb_obj_hash(mrb_state *mrb, mrb_value self)
{ {
return mrb_fixnum_value(mrb_obj_id(self)); return mrb_fixnum_value(mrb_obj_id(self));
......
...@@ -2006,7 +2006,7 @@ mrb_str_split_m(mrb_state *mrb, mrb_value str) ...@@ -2006,7 +2006,7 @@ mrb_str_split_m(mrb_state *mrb, mrb_value str)
return result; return result;
} }
MRB_API mrb_value static mrb_value
mrb_str_len_to_inum(mrb_state *mrb, const char *str, mrb_int len, mrb_int base, int badcheck) mrb_str_len_to_inum(mrb_state *mrb, const char *str, mrb_int len, mrb_int base, int badcheck)
{ {
const char *p = str; const char *p = str;
...@@ -2174,7 +2174,7 @@ mrb_str_len_to_inum(mrb_state *mrb, const char *str, mrb_int len, mrb_int base, ...@@ -2174,7 +2174,7 @@ mrb_str_len_to_inum(mrb_state *mrb, const char *str, mrb_int len, mrb_int base,
} }
MRB_API mrb_value MRB_API mrb_value
mrb_cstr_to_inum(mrb_state *mrb, const char *str, int base, int badcheck) mrb_cstr_to_inum(mrb_state *mrb, const char *str, mrb_int base, mrb_bool badcheck)
{ {
return mrb_str_len_to_inum(mrb, str, strlen(str), base, badcheck); return mrb_str_len_to_inum(mrb, str, strlen(str), base, badcheck);
} }
......
...@@ -621,7 +621,7 @@ mrb_mod_class_variables(mrb_state *mrb, mrb_value mod) ...@@ -621,7 +621,7 @@ mrb_mod_class_variables(mrb_state *mrb, mrb_value mod)
return ary; return ary;
} }
MRB_API mrb_value mrb_value
mrb_mod_cv_get(mrb_state *mrb, struct RClass *c, mrb_sym sym) mrb_mod_cv_get(mrb_state *mrb, struct RClass *c, mrb_sym sym)
{ {
struct RClass * cls = c; struct RClass * cls = c;
...@@ -714,7 +714,7 @@ mrb_cv_set(mrb_state *mrb, mrb_value mod, mrb_sym sym, mrb_value v) ...@@ -714,7 +714,7 @@ mrb_cv_set(mrb_state *mrb, mrb_value mod, mrb_sym sym, mrb_value v)
mrb_mod_cv_set(mrb, mrb_class_ptr(mod), sym, v); mrb_mod_cv_set(mrb, mrb_class_ptr(mod), sym, v);
} }
MRB_API mrb_bool mrb_bool
mrb_mod_cv_defined(mrb_state *mrb, struct RClass * c, mrb_sym sym) mrb_mod_cv_defined(mrb_state *mrb, struct RClass * c, mrb_sym sym)
{ {
while (c) { while (c) {
......
...@@ -593,7 +593,7 @@ mrb_exec_irep(mrb_state *mrb, mrb_value self, struct RProc *p) ...@@ -593,7 +593,7 @@ mrb_exec_irep(mrb_state *mrb, mrb_value self, struct RProc *p)
* k = Klass.new * k = Klass.new
* k.send :hello, "gentle", "readers" #=> "Hello gentle readers" * k.send :hello, "gentle", "readers" #=> "Hello gentle readers"
*/ */
MRB_API mrb_value mrb_value
mrb_f_send(mrb_state *mrb, mrb_value self) mrb_f_send(mrb_state *mrb, mrb_value self)
{ {
mrb_sym name; mrb_sym name;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment