4 ** See Copyright Notice in mruby.h
8 #include <mruby/string.h>
9 #include <mruby/variable.h>
10 #include <mruby/error.h>
11 #include <mruby/presym.h>
16 printcstr(const char *str
, size_t len
, FILE *stream
)
19 fwrite(str
, len
, 1, stream
);
25 printstr(mrb_value obj
, FILE *stream
)
27 if (mrb_string_p(obj
)) {
28 printcstr(RSTRING_PTR(obj
), RSTRING_LEN(obj
), stream
);
33 mrb_core_init_printabort(void)
35 static const char *str
= "Failed mruby core initialization";
36 printcstr(str
, strlen(str
), stdout
);
40 mrb_p(mrb_state
*mrb
, mrb_value obj
)
42 if (mrb_type(obj
) == MRB_TT_EXCEPTION
&& mrb_obj_ptr(obj
) == mrb
->nomem_err
) {
43 static const char *str
= "Out of memory";
44 printcstr(str
, strlen(str
), stdout
);
47 printstr(mrb_inspect(mrb
, obj
), stdout
);
53 mrb_show_version(mrb_state
*mrb
)
55 printstr(mrb_const_get(mrb
, mrb_obj_value(mrb
->object_class
), MRB_SYM(MRUBY_DESCRIPTION
)), stdout
);
59 mrb_show_copyright(mrb_state
*mrb
)
61 printstr(mrb_const_get(mrb
, mrb_obj_value(mrb
->object_class
), MRB_SYM(MRUBY_COPYRIGHT
)), stdout
);
66 mrb_core_init_printabort(void)
71 mrb_p(mrb_state
*mrb
, mrb_value obj
)
76 mrb_show_version(mrb_state
*mrb
)
81 mrb_show_copyright(mrb_state
*mrb
)