This is a port of the mruby/c tutorial Chapter 03 to the mbed environment.
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.
Diff: mrubyc/global.h
- Revision:
- 0:33feccbba3ff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mrubyc/global.h Wed Feb 15 01:03:35 2017 +0000 @@ -0,0 +1,45 @@ +/*! @file + @brief + Manage global objects. + + <pre> + Copyright (C) 2015 Kyushu Institute of Technology. + Copyright (C) 2015 Shimane IT Open-innovation Center. + + This file is distributed under BSD 3-Clause License. + + </pre> +*/ + +#ifndef MRBC_SRC_GLOBAL_H_ +#define MRBC_SRC_GLOBAL_H_ + +#include "value.h" + +#ifdef __cplusplus +extern "C" { +#endif + +#define OBJECT_WITH_SYMBOL\ + mrb_sym sym_id;\ + mrb_object obj + +typedef struct GLOBAL_OBJECT { + OBJECT_WITH_SYMBOL; +} mrb_globalobject; + +typedef struct CONST_OBJECT { + OBJECT_WITH_SYMBOL; +} mrb_constobject; + +void global_object_add(mrb_sym sym_id, mrb_object *obj); +mrb_object global_object_get(mrb_sym sym_id); + +void const_add(mrb_sym sym_id, mrb_object *obj); +mrb_object const_get(mrb_sym sym_id); + +#ifdef __cplusplus +} +#endif +#endif +