This is a port of the mruby/c tutorial Chapter 03 to the mbed environment.

Dependencies:   mbed

For details, refer to the following.

http://www.s-itoc.jp/activity/research/mrubyc/mrubyc_tutorial/436

Note:There is a change in rtt0.h from the original source in the mruby/c. It was necessary for inclusion in C ++ source.

Revision:
0:33feccbba3ff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mrubyc/c_range.c	Wed Feb 15 01:03:35 2017 +0000
@@ -0,0 +1,42 @@
+#include <stddef.h>
+
+#include "c_range.h"
+
+#include "alloc.h"
+#include "class.h"
+#include "static.h"
+#include "value.h"
+#include "vm.h"
+
+
+mrb_value mrbc_range_new(mrb_vm *vm, mrb_value *v_st, mrb_value *v_ed, int exclude)
+{
+  mrb_value value;
+  value.tt = MRB_TT_RANGE;
+
+  mrb_value *ptr = (mrb_value*)mrbc_alloc(vm, sizeof(mrb_value)*3);
+  if( ptr == NULL ) return value;  // ENOMEM
+
+  if( exclude ){
+    ptr[0].tt = MRB_TT_TRUE;
+  } else {
+    ptr[0].tt = MRB_TT_FALSE;
+  }
+  ptr[1] = *v_st;
+  ptr[2] = *v_ed;
+  value.value.range = ptr;
+
+  return value;
+}
+
+
+
+
+// init class
+void mrbc_init_class_range(mrb_vm *vm)
+{
+  mrbc_class_range = mrbc_class_alloc(vm, "Range", mrbc_class_object);
+
+
+}
+