Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependents: mruby_mbed_web mirb_mbed
print.c
00001 #include "mruby.h" 00002 #include "mruby/string.h" 00003 #include <stdio.h> 00004 00005 static void 00006 printstr(mrb_state *mrb, mrb_value obj) 00007 { 00008 char *s; 00009 mrb_int len; 00010 00011 if (mrb_string_p(obj)) { 00012 s = RSTRING_PTR(obj); 00013 len = RSTRING_LEN(obj); 00014 fwrite(s, len, 1, stdout); 00015 } 00016 } 00017 00018 /* 15.3.1.2.9 */ 00019 /* 15.3.1.3.34 */ 00020 mrb_value 00021 mrb_printstr(mrb_state *mrb, mrb_value self) 00022 { 00023 mrb_value argv; 00024 00025 mrb_get_args(mrb, "o", &argv); 00026 printstr(mrb, argv); 00027 00028 return argv; 00029 } 00030 00031 void 00032 mrb_mruby_print_gem_init(mrb_state* mrb) 00033 { 00034 struct RClass *krn; 00035 krn = mrb->kernel_module; 00036 mrb_define_method(mrb, krn, "__printstr__", mrb_printstr, MRB_ARGS_REQ(1)); 00037 } 00038 00039 void 00040 mrb_mruby_print_gem_final(mrb_state* mrb) 00041 { 00042 } 00043
Generated on Tue Jul 12 2022 18:00:35 by
1.7.2