mirror of
https://github.com/mruby/mruby
synced 2026-06-08 16:11:16 +00:00
internal.h: aggregate internal functions.
Internal functions can only be called from within the library. Functions listed in `mruby/internal.h` can be called from: * core (src/*.c) * gems (mrbgems/**/*.c) But not from the application linked with `libmruby`.
This commit is contained in:
@@ -85,7 +85,6 @@ struct RArray {
|
||||
#define ARY_SET_SHARED_FLAG(a) ((a)->flags |= MRB_ARY_SHARED)
|
||||
#define ARY_UNSET_SHARED_FLAG(a) ((a)->flags &= ~MRB_ARY_SHARED)
|
||||
|
||||
void mrb_ary_decref(mrb_state*, mrb_shared_array*);
|
||||
MRB_API void mrb_ary_modify(mrb_state*, struct RArray*);
|
||||
MRB_API mrb_value mrb_ary_new_capa(mrb_state*, mrb_int);
|
||||
|
||||
@@ -296,8 +295,6 @@ MRB_API mrb_value mrb_ary_join(mrb_state *mrb, mrb_value ary, mrb_value sep);
|
||||
*/
|
||||
MRB_API mrb_value mrb_ary_resize(mrb_state *mrb, mrb_value ary, mrb_int new_len);
|
||||
|
||||
/* helper functions */
|
||||
mrb_value mrb_ary_subseq(mrb_state *mrb, mrb_value ary, mrb_int beg, mrb_int len);
|
||||
|
||||
MRB_END_DECL
|
||||
|
||||
|
||||
@@ -73,8 +73,6 @@ mrb_class(mrb_state *mrb, mrb_value v)
|
||||
#define MRB_SET_INSTANCE_TT(c, tt) ((c)->flags = (((c)->flags & ~MRB_INSTANCE_TT_MASK) | (char)(tt)))
|
||||
#define MRB_INSTANCE_TT(c) (enum mrb_vtype)((c)->flags & MRB_INSTANCE_TT_MASK)
|
||||
|
||||
struct RClass *mrb_vm_define_class(mrb_state*, mrb_value, mrb_value, mrb_sym);
|
||||
struct RClass *mrb_vm_define_module(mrb_state*, mrb_value, mrb_sym);
|
||||
MRB_API void mrb_define_method_raw(mrb_state*, struct RClass*, mrb_sym, mrb_method_t);
|
||||
MRB_API void mrb_alias_method(mrb_state*, struct RClass *c, mrb_sym a, mrb_sym b);
|
||||
MRB_API void mrb_remove_method(mrb_state *mrb, struct RClass *c, mrb_sym sym);
|
||||
@@ -83,15 +81,6 @@ MRB_API mrb_method_t mrb_method_search_vm(mrb_state*, struct RClass**, mrb_sym);
|
||||
MRB_API mrb_method_t mrb_method_search(mrb_state*, struct RClass*, mrb_sym);
|
||||
|
||||
MRB_API struct RClass* mrb_class_real(struct RClass* cl);
|
||||
mrb_value mrb_instance_new(mrb_state *mrb, mrb_value cv);
|
||||
|
||||
void mrb_class_name_class(mrb_state*, struct RClass*, struct RClass*, mrb_sym);
|
||||
mrb_bool mrb_const_name_p(mrb_state*, const char*, mrb_int);
|
||||
mrb_value mrb_class_find_path(mrb_state*, struct RClass*);
|
||||
mrb_value mrb_mod_to_s(mrb_state*, mrb_value);
|
||||
void mrb_gc_mark_mt(mrb_state*, struct RClass*);
|
||||
size_t mrb_gc_mark_mt_size(mrb_state*, struct RClass*);
|
||||
void mrb_gc_free_mt(mrb_state*, struct RClass*);
|
||||
|
||||
#ifndef MRB_NO_METHOD_CACHE
|
||||
void mrb_mc_clear_by_class(mrb_state *mrb, struct RClass* c);
|
||||
|
||||
@@ -21,12 +21,7 @@ MRB_BEGIN_DECL
|
||||
#define MRB_DUMP_STATIC 2
|
||||
#define DUMP_DEBUG_INFO MRB_DUMP_DEBUG_INFO /* deprecated */
|
||||
|
||||
int mrb_dump_irep(mrb_state *mrb, const mrb_irep *irep, uint8_t flags, uint8_t **bin, size_t *bin_size);
|
||||
#ifndef MRB_NO_STDIO
|
||||
int mrb_dump_irep_binary(mrb_state*, const mrb_irep*, uint8_t, FILE*);
|
||||
int mrb_dump_irep_cfunc(mrb_state *mrb, const mrb_irep*, uint8_t flags, FILE *f, const char *initname);
|
||||
int mrb_dump_irep_cstruct(mrb_state *mrb, const mrb_irep*, uint8_t flags, FILE *f, const char *initname);
|
||||
mrb_irep *mrb_read_irep_file(mrb_state*, FILE*);
|
||||
MRB_API mrb_value mrb_load_irep_file(mrb_state*,FILE*);
|
||||
MRB_API mrb_value mrb_load_irep_file_cxt(mrb_state*, FILE*, mrbc_context*);
|
||||
#endif
|
||||
|
||||
@@ -27,11 +27,6 @@ MRB_API void mrb_sys_fail(mrb_state *mrb, const char *mesg);
|
||||
MRB_API mrb_value mrb_exc_new_str(mrb_state *mrb, struct RClass* c, mrb_value str);
|
||||
#define mrb_exc_new_lit(mrb, c, lit) mrb_exc_new_str(mrb, c, mrb_str_new_lit(mrb, lit))
|
||||
MRB_API mrb_value mrb_make_exception(mrb_state *mrb, mrb_int argc, const mrb_value *argv);
|
||||
mrb_value mrb_exc_backtrace(mrb_state *mrb, mrb_value exc);
|
||||
mrb_value mrb_get_backtrace(mrb_state *mrb);
|
||||
void mrb_exc_mesg_set(mrb_state *mrb, struct RException *exc, mrb_value mesg);
|
||||
mrb_value mrb_exc_mesg_get(mrb_state *mrb, struct RException *exc);
|
||||
|
||||
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 */
|
||||
|
||||
+1
-2
@@ -84,8 +84,7 @@ typedef struct mrb_gc {
|
||||
size_t majorgc_old_threshold;
|
||||
} mrb_gc;
|
||||
|
||||
MRB_API mrb_bool
|
||||
mrb_object_dead_p(struct mrb_state *mrb, struct RBasic *object);
|
||||
MRB_API mrb_bool mrb_object_dead_p(struct mrb_state *mrb, struct RBasic *object);
|
||||
|
||||
#define MRB_GC_RED 7
|
||||
|
||||
|
||||
@@ -35,7 +35,6 @@ struct RHash {
|
||||
#define mrb_hash_ptr(v) ((struct RHash*)(mrb_ptr(v)))
|
||||
#define mrb_hash_value(p) mrb_obj_value((void*)(p))
|
||||
|
||||
size_t mrb_hash_memsize(mrb_value obj);
|
||||
MRB_API mrb_value mrb_hash_new_capa(mrb_state *mrb, mrb_int capa);
|
||||
|
||||
/*
|
||||
@@ -226,11 +225,6 @@ MRB_API void mrb_hash_merge(mrb_state *mrb, mrb_value hash1, mrb_value hash2);
|
||||
#define MRB_RHASH_DEFAULT_P(hash) (RHASH(hash)->flags & MRB_HASH_DEFAULT)
|
||||
#define MRB_RHASH_PROCDEFAULT_P(hash) (RHASH(hash)->flags & MRB_HASH_PROC_DEFAULT)
|
||||
|
||||
/* GC functions */
|
||||
void mrb_gc_mark_hash(mrb_state*, struct RHash*);
|
||||
size_t mrb_gc_mark_hash_size(mrb_state*, struct RHash*);
|
||||
void mrb_gc_free_hash(mrb_state*, struct RHash*);
|
||||
|
||||
/* return non zero to break the loop */
|
||||
typedef int (mrb_hash_foreach_func)(mrb_state *mrb, mrb_value key, mrb_value val, void *data);
|
||||
MRB_API void mrb_hash_foreach(mrb_state *mrb, struct RHash *hash, mrb_hash_foreach_func *func, void *p);
|
||||
|
||||
@@ -0,0 +1,157 @@
|
||||
/**
|
||||
** @file mruby/internal.h - Functions only called from within the library
|
||||
**
|
||||
** See Copyright Notice in mruby.h
|
||||
*/
|
||||
|
||||
#ifndef MRUBY_INTERNAL_H
|
||||
#define MRUBY_INTERNAL_H
|
||||
|
||||
#ifdef MRUBY_ARRAY_H
|
||||
void mrb_ary_decref(mrb_state*, mrb_shared_array*);
|
||||
mrb_value mrb_ary_subseq(mrb_state *mrb, mrb_value ary, mrb_int beg, mrb_int len);
|
||||
#endif
|
||||
|
||||
#ifdef MRUBY_CLASS_H
|
||||
struct RClass *mrb_vm_define_class(mrb_state*, mrb_value, mrb_value, mrb_sym);
|
||||
struct RClass *mrb_vm_define_module(mrb_state*, mrb_value, mrb_sym);
|
||||
mrb_value mrb_instance_new(mrb_state *mrb, mrb_value cv);
|
||||
void mrb_class_name_class(mrb_state*, struct RClass*, struct RClass*, mrb_sym);
|
||||
mrb_bool mrb_const_name_p(mrb_state*, const char*, mrb_int);
|
||||
mrb_value mrb_class_find_path(mrb_state*, struct RClass*);
|
||||
mrb_value mrb_mod_to_s(mrb_state *, mrb_value);
|
||||
void mrb_method_added(mrb_state *mrb, struct RClass *c, mrb_sym mid);
|
||||
#endif
|
||||
|
||||
/* debug */
|
||||
size_t mrb_packed_int_len(uint32_t num);
|
||||
size_t mrb_packed_int_encode(uint32_t num, uint8_t *p, uint8_t *pend);
|
||||
uint32_t mrb_packed_int_decode(const uint8_t *p, const uint8_t **newpos);
|
||||
|
||||
/* dump */
|
||||
#ifdef MRUBY_IREP_H
|
||||
int mrb_dump_irep(mrb_state *mrb, const mrb_irep *irep, uint8_t flags, uint8_t **bin, size_t *bin_size);
|
||||
#ifndef MRB_NO_STDIO
|
||||
int mrb_dump_irep_binary(mrb_state*, const mrb_irep*, uint8_t, FILE*);
|
||||
int mrb_dump_irep_cfunc(mrb_state *mrb, const mrb_irep*, uint8_t flags, FILE *f, const char *initname);
|
||||
int mrb_dump_irep_cstruct(mrb_state *mrb, const mrb_irep*, uint8_t flags, FILE *f, const char *initname);
|
||||
mrb_irep *mrb_read_irep_file(mrb_state*, FILE*);
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/* error */
|
||||
mrb_value mrb_exc_inspect(mrb_state *mrb, mrb_value exc);
|
||||
mrb_value mrb_exc_backtrace(mrb_state *mrb, mrb_value exc);
|
||||
mrb_value mrb_get_backtrace(mrb_state *mrb);
|
||||
void mrb_exc_mesg_set(mrb_state *mrb, struct RException *exc, mrb_value mesg);
|
||||
mrb_value mrb_exc_mesg_get(mrb_state *mrb, struct RException *exc);
|
||||
|
||||
/* gc */
|
||||
void mrb_gc_mark_mt(mrb_state*, struct RClass*);
|
||||
size_t mrb_gc_mark_mt_size(mrb_state*, struct RClass*);
|
||||
void mrb_gc_free_mt(mrb_state*, struct RClass*);
|
||||
|
||||
/* hash */
|
||||
size_t mrb_hash_memsize(mrb_value obj);
|
||||
void mrb_gc_mark_hash(mrb_state*, struct RHash*);
|
||||
size_t mrb_gc_mark_hash_size(mrb_state*, struct RHash*);
|
||||
void mrb_gc_free_hash(mrb_state*, struct RHash*);
|
||||
|
||||
/* irep */
|
||||
struct mrb_insn_data mrb_decode_insn(const mrb_code *pc);
|
||||
#ifdef MRUBY_IREP_H
|
||||
void mrb_irep_free(mrb_state*, struct mrb_irep*);
|
||||
void mrb_irep_incref(mrb_state*, struct mrb_irep*);
|
||||
void mrb_irep_decref(mrb_state*, struct mrb_irep*);
|
||||
void mrb_irep_cutref(mrb_state*, struct mrb_irep*);
|
||||
void mrb_irep_remove_lv(mrb_state *mrb, mrb_irep *irep);
|
||||
|
||||
static inline const struct mrb_irep_catch_handler *
|
||||
mrb_irep_catch_handler_table(const struct mrb_irep *irep)
|
||||
{
|
||||
if (irep->clen > 0) {
|
||||
return (const struct mrb_irep_catch_handler*)(irep->iseq + irep->ilen);
|
||||
}
|
||||
else {
|
||||
return (const struct mrb_irep_catch_handler*)NULL;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
/* numeric */
|
||||
mrb_int mrb_div_int(mrb_state *mrb, mrb_int x, mrb_int y);
|
||||
mrb_value mrb_int_add(mrb_state *mrb, mrb_value x, mrb_value y);
|
||||
mrb_value mrb_int_sub(mrb_state *mrb, mrb_value x, mrb_value y);
|
||||
mrb_value mrb_int_mul(mrb_state *mrb, mrb_value x, mrb_value y);
|
||||
|
||||
#ifdef MRB_USE_COMPLEX
|
||||
mrb_value mrb_complex_new(mrb_state *mrb, mrb_float x, mrb_float y);
|
||||
mrb_value mrb_complex_add(mrb_state *mrb, mrb_value x, mrb_value y);
|
||||
mrb_value mrb_complex_sub(mrb_state *mrb, mrb_value x, mrb_value y);
|
||||
mrb_value mrb_complex_mul(mrb_state *mrb, mrb_value x, mrb_value y);
|
||||
mrb_value mrb_complex_div(mrb_state *mrb, mrb_value x, mrb_value y);
|
||||
#endif
|
||||
#ifdef MRB_USE_RATIONAL
|
||||
mrb_value mrb_rational_new(mrb_state *mrb, mrb_int x, mrb_int y);
|
||||
mrb_value mrb_rational_add(mrb_state *mrb, mrb_value x, mrb_value y);
|
||||
mrb_value mrb_rational_sub(mrb_state *mrb, mrb_value x, mrb_value y);
|
||||
mrb_value mrb_rational_mul(mrb_state *mrb, mrb_value x, mrb_value y);
|
||||
mrb_value mrb_rational_div(mrb_state *mrb, mrb_value x, mrb_value y);
|
||||
#endif
|
||||
|
||||
#ifdef MRUBY_PROC_H
|
||||
struct RProc *mrb_proc_new(mrb_state*, const mrb_irep*);
|
||||
struct RProc *mrb_closure_new(mrb_state*, const mrb_irep*);
|
||||
void mrb_proc_copy(mrb_state *mrb, struct RProc *a, struct RProc *b);
|
||||
mrb_int mrb_proc_arity(const struct RProc *p);
|
||||
#endif
|
||||
|
||||
/* range */
|
||||
#ifdef MRUBY_RANGE_H
|
||||
mrb_value mrb_get_values_at(mrb_state *mrb, mrb_value obj, mrb_int olen, mrb_int argc, const mrb_value *argv, mrb_value (*func)(mrb_state*, mrb_value, mrb_int));
|
||||
void mrb_gc_mark_range(mrb_state *mrb, struct RRange *r);
|
||||
#endif
|
||||
|
||||
/* string */
|
||||
void mrb_gc_free_str(mrb_state*, struct RString*);
|
||||
uint32_t mrb_str_hash(mrb_state *mrb, mrb_value str);
|
||||
mrb_value mrb_str_dump(mrb_state *mrb, mrb_value str);
|
||||
mrb_value mrb_str_inspect(mrb_state *mrb, mrb_value str);
|
||||
mrb_bool mrb_str_beg_len(mrb_int str_len, mrb_int *begp, mrb_int *lenp);
|
||||
mrb_value mrb_str_byte_subseq(mrb_state *mrb, mrb_value str, mrb_int beg, mrb_int len);
|
||||
mrb_value mrb_str_aref(mrb_state *mrb, mrb_value str, mrb_value idx, mrb_value len);
|
||||
|
||||
#ifdef MRB_UTF8_STRING
|
||||
mrb_int mrb_utf8len(const char *str, const char *end);
|
||||
mrb_int mrb_utf8_strlen(const char *str, mrb_int byte_len);
|
||||
#endif
|
||||
|
||||
/* variable */
|
||||
mrb_value mrb_vm_special_get(mrb_state*, mrb_sym);
|
||||
void mrb_vm_special_set(mrb_state*, mrb_sym, mrb_value);
|
||||
mrb_value mrb_vm_cv_get(mrb_state*, mrb_sym);
|
||||
void mrb_vm_cv_set(mrb_state*, mrb_sym, mrb_value);
|
||||
mrb_value mrb_vm_const_get(mrb_state*, mrb_sym);
|
||||
void mrb_vm_const_set(mrb_state*, mrb_sym, mrb_value);
|
||||
size_t mrb_obj_iv_tbl_memsize(mrb_value);
|
||||
mrb_value mrb_obj_iv_inspect(mrb_state*, struct RObject*);
|
||||
void mrb_obj_iv_set_force(mrb_state *mrb, struct RObject *obj, mrb_sym sym, mrb_value v);
|
||||
mrb_value mrb_mod_constants(mrb_state *mrb, mrb_value mod);
|
||||
mrb_value mrb_f_global_variables(mrb_state *mrb, mrb_value self);
|
||||
mrb_value mrb_obj_instance_variables(mrb_state*, mrb_value);
|
||||
mrb_value mrb_mod_class_variables(mrb_state*, mrb_value);
|
||||
mrb_value mrb_mod_cv_get(mrb_state *mrb, struct RClass * c, mrb_sym sym);
|
||||
mrb_bool mrb_mod_cv_defined(mrb_state *mrb, struct RClass * c, mrb_sym sym);
|
||||
mrb_bool mrb_ident_p(const char *s, mrb_int len);
|
||||
|
||||
/* GC functions */
|
||||
void mrb_gc_mark_gv(mrb_state*);
|
||||
void mrb_gc_free_gv(mrb_state*);
|
||||
void mrb_gc_mark_iv(mrb_state*, struct RObject*);
|
||||
size_t mrb_gc_mark_iv_size(mrb_state*, struct RObject*);
|
||||
void mrb_gc_free_iv(mrb_state*, struct RObject*);
|
||||
|
||||
/* VM */
|
||||
mrb_int mrb_ci_bidx(mrb_callinfo *ci);
|
||||
|
||||
#endif /* MRUBY_INTERNAL_H */
|
||||
@@ -112,12 +112,6 @@ MRB_API mrb_value mrb_load_irep_cxt(mrb_state*, const uint8_t*, mrbc_context*);
|
||||
*/
|
||||
MRB_API mrb_value mrb_load_irep_buf_cxt(mrb_state*, const void*, size_t, mrbc_context*);
|
||||
|
||||
void mrb_irep_free(mrb_state*, struct mrb_irep*);
|
||||
void mrb_irep_incref(mrb_state*, struct mrb_irep*);
|
||||
void mrb_irep_decref(mrb_state*, struct mrb_irep*);
|
||||
void mrb_irep_cutref(mrb_state*, struct mrb_irep*);
|
||||
void mrb_irep_remove_lv(mrb_state *mrb, mrb_irep *irep);
|
||||
|
||||
struct mrb_insn_data {
|
||||
uint8_t insn;
|
||||
uint16_t a;
|
||||
@@ -126,19 +120,6 @@ struct mrb_insn_data {
|
||||
const mrb_code *addr;
|
||||
};
|
||||
|
||||
struct mrb_insn_data mrb_decode_insn(const mrb_code *pc);
|
||||
|
||||
static inline const struct mrb_irep_catch_handler *
|
||||
mrb_irep_catch_handler_table(const struct mrb_irep *irep)
|
||||
{
|
||||
if (irep->clen > 0) {
|
||||
return (const struct mrb_irep_catch_handler*)(irep->iseq + irep->ilen);
|
||||
}
|
||||
else {
|
||||
return (const struct mrb_irep_catch_handler*)NULL;
|
||||
}
|
||||
}
|
||||
|
||||
#define mrb_irep_catch_handler_pack(n, v) uint32_to_bin(n, v)
|
||||
#define mrb_irep_catch_handler_unpack(v) bin_to_uint32(v)
|
||||
|
||||
|
||||
@@ -41,9 +41,6 @@ MRB_API mrb_value mrb_num_mul(mrb_state *mrb, mrb_value x, mrb_value y);
|
||||
MRB_API mrb_value mrb_integer_to_str(mrb_state *mrb, mrb_value x, mrb_int base);
|
||||
MRB_API char *mrb_int_to_cstr(char *buf, size_t len, mrb_int n, mrb_int base);
|
||||
|
||||
/* internal function(s) */
|
||||
mrb_int mrb_div_int(mrb_state *mrb, mrb_int x, mrb_int y);
|
||||
|
||||
/* obsolete function(s); will be removed */
|
||||
#define mrb_fixnum_to_str(mrb, x, base) mrb_integer_to_str(mrb, x, base)
|
||||
|
||||
|
||||
@@ -88,12 +88,8 @@ struct RProc {
|
||||
|
||||
#define mrb_proc_ptr(v) ((struct RProc*)(mrb_ptr(v)))
|
||||
|
||||
struct RProc *mrb_proc_new(mrb_state*, const mrb_irep*);
|
||||
struct RProc *mrb_closure_new(mrb_state*, const mrb_irep*);
|
||||
MRB_API struct RProc *mrb_proc_new_cfunc(mrb_state*, mrb_func_t);
|
||||
MRB_API struct RProc *mrb_closure_new_cfunc(mrb_state *mrb, mrb_func_t func, int nlocals);
|
||||
void mrb_proc_copy(mrb_state *mrb, struct RProc *a, struct RProc *b);
|
||||
mrb_int mrb_proc_arity(const struct RProc *p);
|
||||
|
||||
/* following functions are defined in mruby-proc-ext so please include it when using */
|
||||
MRB_API struct RProc *mrb_proc_new_cfunc_with_env(mrb_state *mrb, mrb_func_t func, mrb_int argc, const mrb_value *argv);
|
||||
|
||||
@@ -71,8 +71,6 @@ enum mrb_range_beg_len {
|
||||
};
|
||||
|
||||
MRB_API enum mrb_range_beg_len mrb_range_beg_len(mrb_state *mrb, mrb_value range, mrb_int *begp, mrb_int *lenp, mrb_int len, mrb_bool trunc);
|
||||
mrb_value mrb_get_values_at(mrb_state *mrb, mrb_value obj, mrb_int olen, mrb_int argc, const mrb_value *argv, mrb_value (*func)(mrb_state*, mrb_value, mrb_int));
|
||||
void mrb_gc_mark_range(mrb_state *mrb, struct RRange *r);
|
||||
|
||||
MRB_END_DECL
|
||||
|
||||
|
||||
@@ -114,8 +114,6 @@ struct RStringEmbed {
|
||||
#define MRB_STR_EMBED_LEN_MASK (((1 << MRB_STR_EMBED_LEN_BIT) - 1) << MRB_STR_EMBED_LEN_SHIFT)
|
||||
#define MRB_STR_TYPE_MASK 15
|
||||
|
||||
void mrb_gc_free_str(mrb_state*, struct RString*);
|
||||
|
||||
MRB_API void mrb_str_modify(mrb_state *mrb, struct RString *s);
|
||||
/* mrb_str_modify() with keeping ASCII flag if set */
|
||||
MRB_API void mrb_str_modify_keep_ascii(mrb_state *mrb, struct RString *s);
|
||||
@@ -423,27 +421,11 @@ MRB_API int mrb_str_cmp(mrb_state *mrb, mrb_value str1, mrb_value str2);
|
||||
*/
|
||||
MRB_API char *mrb_str_to_cstr(mrb_state *mrb, mrb_value str);
|
||||
|
||||
uint32_t mrb_str_hash(mrb_state *mrb, mrb_value str);
|
||||
mrb_value mrb_str_dump(mrb_state *mrb, mrb_value str);
|
||||
|
||||
/**
|
||||
* Returns a printable version of str, surrounded by quote marks, with special characters escaped.
|
||||
*/
|
||||
mrb_value mrb_str_inspect(mrb_state *mrb, mrb_value str);
|
||||
|
||||
/* For backward compatibility */
|
||||
#define mrb_str_cat2(mrb, str, ptr) mrb_str_cat_cstr(mrb, str, ptr)
|
||||
#define mrb_str_buf_cat(mrb, str, ptr, len) mrb_str_cat(mrb, str, ptr, len)
|
||||
#define mrb_str_buf_append(mrb, str, str2) mrb_str_cat_str(mrb, str, str2)
|
||||
|
||||
mrb_bool mrb_str_beg_len(mrb_int str_len, mrb_int *begp, mrb_int *lenp);
|
||||
mrb_value mrb_str_byte_subseq(mrb_state *mrb, mrb_value str, mrb_int beg, mrb_int len);
|
||||
|
||||
#ifdef MRB_UTF8_STRING
|
||||
mrb_int mrb_utf8len(const char *str, const char *end);
|
||||
mrb_int mrb_utf8_strlen(const char *str, mrb_int byte_len);
|
||||
#endif
|
||||
|
||||
MRB_END_DECL
|
||||
|
||||
#endif /* MRUBY_STRING_H */
|
||||
|
||||
@@ -14,13 +14,6 @@
|
||||
*/
|
||||
MRB_BEGIN_DECL
|
||||
|
||||
mrb_value mrb_vm_special_get(mrb_state*, mrb_sym);
|
||||
void mrb_vm_special_set(mrb_state*, mrb_sym, mrb_value);
|
||||
mrb_value mrb_vm_cv_get(mrb_state*, mrb_sym);
|
||||
void mrb_vm_cv_set(mrb_state*, mrb_sym, mrb_value);
|
||||
mrb_value mrb_vm_const_get(mrb_state*, mrb_sym);
|
||||
void mrb_vm_const_set(mrb_state*, mrb_sym, mrb_value);
|
||||
size_t mrb_obj_iv_tbl_memsize(mrb_value);
|
||||
MRB_API mrb_value mrb_const_get(mrb_state*, mrb_value, mrb_sym);
|
||||
MRB_API void mrb_const_set(mrb_state*, mrb_value, mrb_sym, mrb_value);
|
||||
MRB_API mrb_bool mrb_const_defined(mrb_state*, mrb_value, mrb_sym);
|
||||
@@ -99,22 +92,6 @@ MRB_API mrb_value mrb_cv_get(mrb_state *mrb, mrb_value mod, mrb_sym sym);
|
||||
MRB_API void mrb_mod_cv_set(mrb_state *mrb, struct RClass * c, mrb_sym sym, mrb_value v);
|
||||
MRB_API void mrb_cv_set(mrb_state *mrb, mrb_value mod, mrb_sym sym, mrb_value v);
|
||||
MRB_API mrb_bool mrb_cv_defined(mrb_state *mrb, mrb_value mod, mrb_sym sym);
|
||||
mrb_value mrb_obj_iv_inspect(mrb_state*, struct RObject*);
|
||||
void mrb_obj_iv_set_force(mrb_state *mrb, struct RObject *obj, mrb_sym sym, mrb_value v);
|
||||
mrb_value mrb_mod_constants(mrb_state *mrb, mrb_value mod);
|
||||
mrb_value mrb_f_global_variables(mrb_state *mrb, mrb_value self);
|
||||
mrb_value mrb_obj_instance_variables(mrb_state*, mrb_value);
|
||||
mrb_value mrb_mod_class_variables(mrb_state*, mrb_value);
|
||||
mrb_value mrb_mod_cv_get(mrb_state *mrb, struct RClass * c, mrb_sym sym);
|
||||
mrb_bool mrb_mod_cv_defined(mrb_state *mrb, struct RClass * c, mrb_sym sym);
|
||||
mrb_bool mrb_ident_p(const char *s, mrb_int len);
|
||||
|
||||
/* GC functions */
|
||||
void mrb_gc_mark_gv(mrb_state*);
|
||||
void mrb_gc_free_gv(mrb_state*);
|
||||
void mrb_gc_mark_iv(mrb_state*, struct RObject*);
|
||||
size_t mrb_gc_mark_iv_size(mrb_state*, struct RObject*);
|
||||
void mrb_gc_free_iv(mrb_state*, struct RObject*);
|
||||
|
||||
/* return non zero to break the loop */
|
||||
typedef int (mrb_iv_foreach_func)(mrb_state*,mrb_sym,mrb_value,void*);
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
#include <mruby/array.h>
|
||||
#include <mruby/range.h>
|
||||
#include <mruby/hash.h>
|
||||
#include <mruby/internal.h>
|
||||
#include <mruby/presym.h>
|
||||
|
||||
/*
|
||||
|
||||
@@ -12,6 +12,7 @@
|
||||
#include <mruby/class.h>
|
||||
#include <mruby/proc.h>
|
||||
#include <mruby/variable.h>
|
||||
#include <mruby/internal.h>
|
||||
#include "mrdberror.h"
|
||||
#include "apibreak.h"
|
||||
#include "apistring.h"
|
||||
@@ -20,8 +21,6 @@
|
||||
#define MRB_DEBUG_BP_FILE_OK (0x0001)
|
||||
#define MRB_DEBUG_BP_LINENO_OK (0x0002)
|
||||
|
||||
uint32_t mrb_packed_int_decode(uint8_t *p, uint8_t **newpos);
|
||||
|
||||
static uint16_t
|
||||
check_lineno(mrb_irep_debug_info_file *info_file, uint16_t lineno)
|
||||
{
|
||||
@@ -47,8 +46,8 @@ check_lineno(mrb_irep_debug_info_file *info_file, uint16_t lineno)
|
||||
|
||||
case mrb_debug_line_packed_map:
|
||||
{
|
||||
uint8_t *p = info_file->lines.packed_map;
|
||||
uint8_t *pend = p + count;
|
||||
const uint8_t *p = info_file->lines.packed_map;
|
||||
const uint8_t *pend = p + count;
|
||||
uint32_t line = 0;
|
||||
while (p < pend) {
|
||||
mrb_packed_int_decode(p, &p);
|
||||
|
||||
@@ -14,6 +14,7 @@
|
||||
#include <mruby/opcode.h>
|
||||
#include <mruby/variable.h>
|
||||
#include <mruby/proc.h>
|
||||
#include <mruby/internal.h>
|
||||
|
||||
#include "mrdb.h"
|
||||
#include "apibreak.h"
|
||||
|
||||
@@ -9,6 +9,7 @@
|
||||
#include <mruby/compile.h>
|
||||
#include <mruby/dump.h>
|
||||
#include <mruby/proc.h>
|
||||
#include <mruby/internal.h>
|
||||
|
||||
#define RITEBIN_EXT ".mrb"
|
||||
#define C_EXT ".c"
|
||||
|
||||
@@ -8,6 +8,7 @@
|
||||
#include <string.h>
|
||||
#include <mruby/irep.h>
|
||||
#include <mruby/dump.h>
|
||||
#include <mruby/internal.h>
|
||||
|
||||
struct strip_args {
|
||||
int argc_start;
|
||||
|
||||
@@ -18,6 +18,7 @@
|
||||
#include <mruby/throw.h>
|
||||
#include <ctype.h>
|
||||
#include <string.h>
|
||||
#include <mruby/internal.h>
|
||||
|
||||
#ifndef MRB_CODEGEN_LEVEL_MAX
|
||||
#define MRB_CODEGEN_LEVEL_MAX 256
|
||||
|
||||
@@ -21,6 +21,7 @@
|
||||
#include <mruby/throw.h>
|
||||
#include <mruby/string.h>
|
||||
#include <mruby/dump.h>
|
||||
#include <mruby/internal.h>
|
||||
#include <mruby/presym.h>
|
||||
#include "node.h"
|
||||
|
||||
|
||||
+1002
-1001
File diff suppressed because it is too large
Load Diff
@@ -6,9 +6,10 @@
|
||||
#include "mruby/numeric.h"
|
||||
#include "mruby/string.h"
|
||||
#include "mruby/variable.h"
|
||||
#include "mruby/internal.h"
|
||||
#include <mruby/presym.h>
|
||||
#include <errno.h>
|
||||
#include <string.h>
|
||||
#include <mruby/presym.h>
|
||||
|
||||
static const struct {
|
||||
#ifdef MRB_NO_PRESYM
|
||||
|
||||
@@ -11,6 +11,7 @@
|
||||
#include "mruby/variable.h"
|
||||
#include "mruby/ext/io.h"
|
||||
#include "mruby/error.h"
|
||||
#include "mruby/internal.h"
|
||||
#include "mruby/presym.h"
|
||||
|
||||
#include <sys/types.h>
|
||||
|
||||
@@ -6,6 +6,7 @@
|
||||
#include <mruby/string.h>
|
||||
#include <mruby/numeric.h>
|
||||
#include <mruby/proc.h>
|
||||
#include <mruby/internal.h>
|
||||
#include <mruby/presym.h>
|
||||
|
||||
static mrb_value
|
||||
|
||||
@@ -5,6 +5,7 @@
|
||||
#include "mruby/proc.h"
|
||||
#include "mruby/class.h"
|
||||
#include "mruby/string.h"
|
||||
#include <mruby/internal.h>
|
||||
#include "mruby/presym.h"
|
||||
|
||||
typedef enum {
|
||||
|
||||
@@ -4,6 +4,7 @@
|
||||
#include "mruby/variable.h"
|
||||
#include "mruby/proc.h"
|
||||
#include "mruby/string.h"
|
||||
#include "mruby/internal.h"
|
||||
#include "mruby/presym.h"
|
||||
|
||||
mrb_noreturn void mrb_method_missing(mrb_state *mrb, mrb_sym name, mrb_value self, mrb_value args);
|
||||
|
||||
@@ -10,6 +10,7 @@
|
||||
#include <mruby/proc.h>
|
||||
#include <mruby/value.h>
|
||||
#include <mruby/range.h>
|
||||
#include <mruby/internal.h>
|
||||
|
||||
static size_t
|
||||
os_memsize_of_irep(mrb_state* state, const struct mrb_irep *irep)
|
||||
|
||||
@@ -38,6 +38,7 @@
|
||||
#include "mruby/string.h"
|
||||
#include "mruby/variable.h"
|
||||
#include "mruby/error.h"
|
||||
#include "mruby/internal.h"
|
||||
#include "mruby/presym.h"
|
||||
|
||||
#include "mruby/ext/io.h"
|
||||
|
||||
@@ -4,6 +4,7 @@
|
||||
#include <mruby/class.h>
|
||||
#include <mruby/string.h>
|
||||
#include <mruby/range.h>
|
||||
#include <mruby/internal.h>
|
||||
|
||||
#define ENC_ASCII_8BIT "ASCII-8BIT"
|
||||
#define ENC_BINARY "BINARY"
|
||||
|
||||
@@ -13,6 +13,7 @@
|
||||
#include <mruby/hash.h>
|
||||
#include <mruby/range.h>
|
||||
#include <mruby/proc.h>
|
||||
#include <mruby/internal.h>
|
||||
#include <mruby/presym.h>
|
||||
|
||||
#define RSTRUCT_LEN(st) RARRAY_LEN(st)
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
#include <mruby.h>
|
||||
#include <mruby/array.h>
|
||||
#include <mruby/string.h>
|
||||
#include <mruby/internal.h>
|
||||
#ifdef MRB_USE_ALL_SYMBOLS
|
||||
# include <mruby/presym.h>
|
||||
#endif
|
||||
|
||||
@@ -10,6 +10,7 @@
|
||||
#include <mruby/string.h>
|
||||
#include <mruby/range.h>
|
||||
#include <mruby/proc.h>
|
||||
#include <mruby/internal.h>
|
||||
#include <mruby/presym.h>
|
||||
#include "value_array.h"
|
||||
|
||||
|
||||
+3
-3
@@ -14,6 +14,7 @@
|
||||
#include <mruby/error.h>
|
||||
#include <mruby/numeric.h>
|
||||
#include <mruby/data.h>
|
||||
#include <mruby/internal.h>
|
||||
#include <mruby/presym.h>
|
||||
|
||||
struct backtrace_location {
|
||||
@@ -26,8 +27,7 @@ typedef void (*each_backtrace_func)(mrb_state*, const struct backtrace_location*
|
||||
|
||||
static const mrb_data_type bt_type = { "Backtrace", mrb_free };
|
||||
|
||||
mrb_value mrb_exc_inspect(mrb_state *mrb, mrb_value exc);
|
||||
mrb_value mrb_unpack_backtrace(mrb_state *mrb, mrb_value backtrace);
|
||||
static mrb_value mrb_unpack_backtrace(mrb_state *mrb, mrb_value backtrace);
|
||||
|
||||
static void
|
||||
each_backtrace(mrb_state *mrb, ptrdiff_t ciidx, each_backtrace_func func, void *data)
|
||||
@@ -204,7 +204,7 @@ mrb_keep_backtrace(mrb_state *mrb, mrb_value exc)
|
||||
mrb_gc_arena_restore(mrb, ai);
|
||||
}
|
||||
|
||||
mrb_value
|
||||
static mrb_value
|
||||
mrb_unpack_backtrace(mrb_state *mrb, mrb_value backtrace)
|
||||
{
|
||||
const struct backtrace_location *bt;
|
||||
|
||||
@@ -9,6 +9,7 @@
|
||||
#include <mruby/dump.h>
|
||||
#include <mruby/irep.h>
|
||||
#include <mruby/debug.h>
|
||||
#include <mruby/internal.h>
|
||||
|
||||
#include <string.h>
|
||||
|
||||
|
||||
+1
-4
@@ -16,6 +16,7 @@
|
||||
#include <mruby/data.h>
|
||||
#include <mruby/istruct.h>
|
||||
#include <mruby/opcode.h>
|
||||
#include <mruby/internal.h>
|
||||
#include <mruby/presym.h>
|
||||
|
||||
union mt_ptr {
|
||||
@@ -877,8 +878,6 @@ mrb_get_arg1(mrb_state *mrb)
|
||||
return array_argv[0];
|
||||
}
|
||||
|
||||
mrb_int mrb_ci_bidx(mrb_callinfo *ci);
|
||||
|
||||
MRB_API mrb_bool
|
||||
mrb_block_given_p(mrb_state *mrb)
|
||||
{
|
||||
@@ -2306,8 +2305,6 @@ mrb_mod_to_s(mrb_state *mrb, mrb_value klass)
|
||||
}
|
||||
}
|
||||
|
||||
void mrb_method_added(mrb_state *mrb, struct RClass *c, mrb_sym mid);
|
||||
|
||||
static mrb_value
|
||||
mrb_mod_alias(mrb_state *mrb, mrb_value mod)
|
||||
{
|
||||
|
||||
@@ -5,6 +5,7 @@
|
||||
#include <mruby/string.h>
|
||||
#include <mruby/proc.h>
|
||||
#include <mruby/dump.h>
|
||||
#include <mruby/internal.h>
|
||||
|
||||
#ifndef MRB_NO_STDIO
|
||||
static void
|
||||
|
||||
@@ -15,6 +15,7 @@
|
||||
#include <mruby/error.h>
|
||||
#include <mruby/class.h>
|
||||
#include <mruby/throw.h>
|
||||
#include <mruby/internal.h>
|
||||
#include <mruby/presym.h>
|
||||
|
||||
void
|
||||
|
||||
@@ -21,6 +21,7 @@
|
||||
#include <mruby/gc.h>
|
||||
#include <mruby/error.h>
|
||||
#include <mruby/throw.h>
|
||||
#include <mruby/internal.h>
|
||||
#include <mruby/presym.h>
|
||||
|
||||
#ifdef MRB_GC_STRESS
|
||||
|
||||
@@ -11,6 +11,7 @@
|
||||
#include <mruby/hash.h>
|
||||
#include <mruby/string.h>
|
||||
#include <mruby/variable.h>
|
||||
#include <mruby/internal.h>
|
||||
#include <mruby/presym.h>
|
||||
|
||||
/*
|
||||
|
||||
@@ -13,6 +13,7 @@
|
||||
#include <mruby/variable.h>
|
||||
#include <mruby/error.h>
|
||||
#include <mruby/istruct.h>
|
||||
#include <mruby/internal.h>
|
||||
#include <mruby/presym.h>
|
||||
|
||||
MRB_API mrb_bool
|
||||
|
||||
@@ -13,6 +13,7 @@
|
||||
#include <mruby/error.h>
|
||||
#include <mruby/data.h>
|
||||
#include <mruby/endian.h>
|
||||
#include <mruby/internal.h>
|
||||
#include <string.h>
|
||||
|
||||
#if SIZE_MAX < UINT32_MAX
|
||||
|
||||
+1
-14
@@ -9,6 +9,7 @@
|
||||
#include <mruby/numeric.h>
|
||||
#include <mruby/string.h>
|
||||
#include <mruby/class.h>
|
||||
#include <mruby/internal.h>
|
||||
#include <mruby/presym.h>
|
||||
#include <string.h>
|
||||
|
||||
@@ -20,20 +21,6 @@
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef MRB_USE_COMPLEX
|
||||
mrb_value mrb_complex_new(mrb_state *mrb, mrb_float x, mrb_float y);
|
||||
mrb_value mrb_complex_add(mrb_state *mrb, mrb_value x, mrb_value y);
|
||||
mrb_value mrb_complex_sub(mrb_state *mrb, mrb_value x, mrb_value y);
|
||||
mrb_value mrb_complex_mul(mrb_state *mrb, mrb_value x, mrb_value y);
|
||||
mrb_value mrb_complex_div(mrb_state *mrb, mrb_value x, mrb_value y);
|
||||
#endif
|
||||
|
||||
mrb_value mrb_rational_new(mrb_state *mrb, mrb_int x, mrb_int y);
|
||||
mrb_value mrb_rational_add(mrb_state *mrb, mrb_value x, mrb_value y);
|
||||
mrb_value mrb_rational_sub(mrb_state *mrb, mrb_value x, mrb_value y);
|
||||
mrb_value mrb_rational_mul(mrb_state *mrb, mrb_value x, mrb_value y);
|
||||
mrb_value mrb_rational_div(mrb_state *mrb, mrb_value x, mrb_value y);
|
||||
|
||||
void
|
||||
mrb_int_overflow(mrb_state *mrb, const char *reason)
|
||||
{
|
||||
|
||||
+1
-16
@@ -6,24 +6,9 @@
|
||||
|
||||
#include <mruby.h>
|
||||
#include <mruby/numeric.h>
|
||||
#include <mruby/internal.h>
|
||||
#include <mruby/presym.h>
|
||||
|
||||
mrb_value mrb_int_add(mrb_state *mrb, mrb_value x, mrb_value y);
|
||||
mrb_value mrb_int_sub(mrb_state *mrb, mrb_value x, mrb_value y);
|
||||
mrb_value mrb_int_mul(mrb_state *mrb, mrb_value x, mrb_value y);
|
||||
|
||||
#ifdef MRB_USE_COMPLEX
|
||||
mrb_value mrb_complex_new(mrb_state *mrb, mrb_float x, mrb_float y);
|
||||
mrb_value mrb_complex_add(mrb_state *mrb, mrb_value x, mrb_value y);
|
||||
mrb_value mrb_complex_sub(mrb_state *mrb, mrb_value x, mrb_value y);
|
||||
mrb_value mrb_complex_mul(mrb_state *mrb, mrb_value x, mrb_value y);
|
||||
#endif
|
||||
|
||||
mrb_value mrb_rational_new(mrb_state *mrb, mrb_int x, mrb_int y);
|
||||
mrb_value mrb_rational_add(mrb_state *mrb, mrb_value x, mrb_value y);
|
||||
mrb_value mrb_rational_sub(mrb_state *mrb, mrb_value x, mrb_value y);
|
||||
mrb_value mrb_rational_mul(mrb_state *mrb, mrb_value x, mrb_value y);
|
||||
|
||||
MRB_API mrb_value
|
||||
mrb_num_add(mrb_state *mrb, mrb_value x, mrb_value y)
|
||||
{
|
||||
|
||||
+2
-1
@@ -9,9 +9,10 @@
|
||||
#include <mruby/proc.h>
|
||||
#include <mruby/opcode.h>
|
||||
#include <mruby/data.h>
|
||||
#include <mruby/presym.h>
|
||||
#include <mruby/array.h>
|
||||
#include <mruby/hash.h>
|
||||
#include <mruby/internal.h>
|
||||
#include <mruby/presym.h>
|
||||
|
||||
static const mrb_code call_iseq[] = {
|
||||
OP_CALL,
|
||||
|
||||
@@ -12,6 +12,7 @@
|
||||
#include <mruby/debug.h>
|
||||
#include <mruby/string.h>
|
||||
#include <mruby/class.h>
|
||||
#include <mruby/internal.h>
|
||||
|
||||
void mrb_init_core(mrb_state*);
|
||||
void mrb_init_mrbgems(mrb_state*);
|
||||
|
||||
@@ -14,6 +14,7 @@
|
||||
#include <mruby/range.h>
|
||||
#include <mruby/string.h>
|
||||
#include <mruby/numeric.h>
|
||||
#include <mruby/internal.h>
|
||||
#include <mruby/presym.h>
|
||||
#include <string.h>
|
||||
|
||||
|
||||
+1
-4
@@ -10,6 +10,7 @@
|
||||
#include <mruby/string.h>
|
||||
#include <mruby/dump.h>
|
||||
#include <mruby/class.h>
|
||||
#include <mruby/internal.h>
|
||||
#include <mruby/presym.h>
|
||||
|
||||
#ifndef MRB_NO_PRESYM
|
||||
@@ -134,10 +135,6 @@ symhash(const char *key, size_t len)
|
||||
return hash & 0xff;
|
||||
}
|
||||
|
||||
size_t mrb_packed_int_len(uint32_t num);
|
||||
size_t mrb_packed_int_encode(uint32_t num, uint8_t *p, uint8_t *pend);
|
||||
uint32_t mrb_packed_int_decode(const uint8_t *p, const uint8_t **newpos);
|
||||
|
||||
#define sym_lit_p(mrb, i) (mrb->symflags[i>>3]&(1<<(i&7)))
|
||||
#define sym_lit_set(mrb, i) mrb->symflags[i>>3]|=(1<<(i&7))
|
||||
#define sym_flags_clear(mrb, i) mrb->symflags[i>>3]&=~(1<<(i&7))
|
||||
|
||||
@@ -10,6 +10,7 @@
|
||||
#include <mruby/proc.h>
|
||||
#include <mruby/string.h>
|
||||
#include <mruby/variable.h>
|
||||
#include <mruby/internal.h>
|
||||
#include <mruby/presym.h>
|
||||
|
||||
/* Instance variable table structure */
|
||||
|
||||
@@ -19,6 +19,7 @@
|
||||
#include "value_array.h"
|
||||
#include <mruby/throw.h>
|
||||
#include <mruby/dump.h>
|
||||
#include <mruby/internal.h>
|
||||
#include <mruby/presym.h>
|
||||
|
||||
#ifdef MRB_NO_STDIO
|
||||
@@ -1163,9 +1164,6 @@ hash_new_from_values(mrb_state *mrb, mrb_int argc, mrb_value *regs)
|
||||
return hash;
|
||||
}
|
||||
|
||||
void mrb_method_added(mrb_state *mrb, struct RClass *c, mrb_sym mid);
|
||||
mrb_value mrb_str_aref(mrb_state *mrb, mrb_value str, mrb_value idx, mrb_value len);
|
||||
|
||||
#define ARGUMENT_NORMALIZE(arg_base, arg_info, insn) do { \
|
||||
int n = *(arg_info)&0xf; \
|
||||
int nk = (*(arg_info)>>4)&0xf; \
|
||||
|
||||
Reference in New Issue
Block a user