mbed I/F binding for mruby

Dependents:   mruby_mbed_web mirb_mbed

mbed-mruby

How to use

Class

Committer:
mzta
Date:
Mon Apr 13 05:20:15 2015 +0000
Revision:
1:8ccd1d494a4b
Parent:
0:158c61bb030f
- code refactoring.; - add SPI, SPISlave, I2C class to mruby-mbed (Incomplete).

Who changed what in which revision?

UserRevisionLine numberNew contents of line
mzta 0:158c61bb030f 1 /*
mzta 0:158c61bb030f 2 ** mruby/variable.h - mruby variables
mzta 0:158c61bb030f 3 **
mzta 0:158c61bb030f 4 ** See Copyright Notice in mruby.h
mzta 0:158c61bb030f 5 */
mzta 0:158c61bb030f 6
mzta 0:158c61bb030f 7 #ifndef MRUBY_VARIABLE_H
mzta 0:158c61bb030f 8 #define MRUBY_VARIABLE_H
mzta 0:158c61bb030f 9
mzta 0:158c61bb030f 10 #if defined(__cplusplus)
mzta 0:158c61bb030f 11 extern "C" {
mzta 0:158c61bb030f 12 #endif
mzta 0:158c61bb030f 13
mzta 0:158c61bb030f 14 typedef struct global_variable {
mzta 0:158c61bb030f 15 int counter;
mzta 0:158c61bb030f 16 mrb_value *data;
mzta 0:158c61bb030f 17 mrb_value (*getter)(void);
mzta 0:158c61bb030f 18 void (*setter)(void);
mzta 0:158c61bb030f 19 /* void (*marker)(); */
mzta 0:158c61bb030f 20 /* int block_trace; */
mzta 0:158c61bb030f 21 /* struct trace_var *trace; */
mzta 0:158c61bb030f 22 } global_variable;
mzta 0:158c61bb030f 23
mzta 0:158c61bb030f 24 struct global_entry {
mzta 0:158c61bb030f 25 global_variable *var;
mzta 0:158c61bb030f 26 mrb_sym id;
mzta 0:158c61bb030f 27 };
mzta 0:158c61bb030f 28
mzta 0:158c61bb030f 29 mrb_value mrb_vm_special_get(mrb_state*, mrb_sym);
mzta 0:158c61bb030f 30 void mrb_vm_special_set(mrb_state*, mrb_sym, mrb_value);
mzta 0:158c61bb030f 31 mrb_value mrb_vm_iv_get(mrb_state*, mrb_sym);
mzta 0:158c61bb030f 32 void mrb_vm_iv_set(mrb_state*, mrb_sym, mrb_value);
mzta 0:158c61bb030f 33 mrb_value mrb_vm_cv_get(mrb_state*, mrb_sym);
mzta 0:158c61bb030f 34 void mrb_vm_cv_set(mrb_state*, mrb_sym, mrb_value);
mzta 0:158c61bb030f 35 mrb_value mrb_vm_const_get(mrb_state*, mrb_sym);
mzta 0:158c61bb030f 36 void mrb_vm_const_set(mrb_state*, mrb_sym, mrb_value);
mzta 0:158c61bb030f 37 MRB_API mrb_value mrb_const_get(mrb_state*, mrb_value, mrb_sym);
mzta 0:158c61bb030f 38 MRB_API void mrb_const_set(mrb_state*, mrb_value, mrb_sym, mrb_value);
mzta 0:158c61bb030f 39 MRB_API mrb_bool mrb_const_defined(mrb_state*, mrb_value, mrb_sym);
mzta 0:158c61bb030f 40 MRB_API void mrb_const_remove(mrb_state*, mrb_value, mrb_sym);
mzta 0:158c61bb030f 41
mzta 0:158c61bb030f 42 MRB_API mrb_bool mrb_iv_p(mrb_state *mrb, mrb_sym sym);
mzta 0:158c61bb030f 43 MRB_API void mrb_iv_check(mrb_state *mrb, mrb_sym sym);
mzta 0:158c61bb030f 44 MRB_API mrb_value mrb_obj_iv_get(mrb_state *mrb, struct RObject *obj, mrb_sym sym);
mzta 0:158c61bb030f 45 MRB_API void mrb_obj_iv_set(mrb_state *mrb, struct RObject *obj, mrb_sym sym, mrb_value v);
mzta 0:158c61bb030f 46 MRB_API mrb_bool mrb_obj_iv_defined(mrb_state *mrb, struct RObject *obj, mrb_sym sym);
mzta 0:158c61bb030f 47 MRB_API void mrb_obj_iv_ifnone(mrb_state *mrb, struct RObject *obj, mrb_sym sym, mrb_value v);
mzta 0:158c61bb030f 48 MRB_API mrb_value mrb_iv_get(mrb_state *mrb, mrb_value obj, mrb_sym sym);
mzta 0:158c61bb030f 49 MRB_API void mrb_iv_set(mrb_state *mrb, mrb_value obj, mrb_sym sym, mrb_value v);
mzta 0:158c61bb030f 50 MRB_API mrb_bool mrb_iv_defined(mrb_state*, mrb_value, mrb_sym);
mzta 0:158c61bb030f 51 MRB_API mrb_value mrb_iv_remove(mrb_state *mrb, mrb_value obj, mrb_sym sym);
mzta 0:158c61bb030f 52 MRB_API void mrb_iv_copy(mrb_state *mrb, mrb_value dst, mrb_value src);
mzta 0:158c61bb030f 53 MRB_API mrb_bool mrb_const_defined_at(mrb_state *mrb, mrb_value mod, mrb_sym id);
mzta 0:158c61bb030f 54 MRB_API mrb_value mrb_gv_get(mrb_state *mrb, mrb_sym sym);
mzta 0:158c61bb030f 55 MRB_API void mrb_gv_set(mrb_state *mrb, mrb_sym sym, mrb_value val);
mzta 0:158c61bb030f 56 MRB_API void mrb_gv_remove(mrb_state *mrb, mrb_sym sym);
mzta 0:158c61bb030f 57 MRB_API mrb_value mrb_cv_get(mrb_state *mrb, mrb_value mod, mrb_sym sym);
mzta 0:158c61bb030f 58 MRB_API void mrb_mod_cv_set(mrb_state *mrb, struct RClass * c, mrb_sym sym, mrb_value v);
mzta 0:158c61bb030f 59 MRB_API void mrb_cv_set(mrb_state *mrb, mrb_value mod, mrb_sym sym, mrb_value v);
mzta 0:158c61bb030f 60 MRB_API mrb_bool mrb_cv_defined(mrb_state *mrb, mrb_value mod, mrb_sym sym);
mzta 0:158c61bb030f 61 mrb_value mrb_obj_iv_inspect(mrb_state*, struct RObject*);
mzta 0:158c61bb030f 62 mrb_value mrb_mod_constants(mrb_state *mrb, mrb_value mod);
mzta 0:158c61bb030f 63 mrb_value mrb_f_global_variables(mrb_state *mrb, mrb_value self);
mzta 0:158c61bb030f 64 mrb_value mrb_obj_instance_variables(mrb_state*, mrb_value);
mzta 0:158c61bb030f 65 mrb_value mrb_mod_class_variables(mrb_state*, mrb_value);
mzta 0:158c61bb030f 66 mrb_value mrb_mod_cv_get(mrb_state *mrb, struct RClass * c, mrb_sym sym);
mzta 0:158c61bb030f 67 mrb_bool mrb_mod_cv_defined(mrb_state *mrb, struct RClass * c, mrb_sym sym);
mzta 0:158c61bb030f 68 mrb_sym mrb_class_sym(mrb_state *mrb, struct RClass *c, struct RClass *outer);
mzta 0:158c61bb030f 69
mzta 0:158c61bb030f 70 /* GC functions */
mzta 0:158c61bb030f 71 void mrb_gc_mark_gv(mrb_state*);
mzta 0:158c61bb030f 72 void mrb_gc_free_gv(mrb_state*);
mzta 0:158c61bb030f 73 void mrb_gc_mark_iv(mrb_state*, struct RObject*);
mzta 0:158c61bb030f 74 size_t mrb_gc_mark_iv_size(mrb_state*, struct RObject*);
mzta 0:158c61bb030f 75 void mrb_gc_free_iv(mrb_state*, struct RObject*);
mzta 0:158c61bb030f 76
mzta 0:158c61bb030f 77 #if defined(__cplusplus)
mzta 0:158c61bb030f 78 } /* extern "C" { */
mzta 0:158c61bb030f 79 #endif
mzta 0:158c61bb030f 80
mzta 0:158c61bb030f 81 #endif /* MRUBY_VARIABLE_H */
mzta 0:158c61bb030f 82