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/irep.h - mrb_irep structure
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_IREP_H
mzta 0:158c61bb030f 8 #define MRUBY_IREP_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 #include "mruby/compile.h"
mzta 0:158c61bb030f 15
mzta 0:158c61bb030f 16 enum irep_pool_type {
mzta 0:158c61bb030f 17 IREP_TT_STRING,
mzta 0:158c61bb030f 18 IREP_TT_FIXNUM,
mzta 0:158c61bb030f 19 IREP_TT_FLOAT,
mzta 0:158c61bb030f 20 };
mzta 0:158c61bb030f 21
mzta 0:158c61bb030f 22 struct mrb_locals {
mzta 0:158c61bb030f 23 mrb_sym name;
mzta 0:158c61bb030f 24 uint16_t r;
mzta 0:158c61bb030f 25 };
mzta 0:158c61bb030f 26
mzta 0:158c61bb030f 27 /* Program data array struct */
mzta 0:158c61bb030f 28 typedef struct mrb_irep {
mzta 0:158c61bb030f 29 uint16_t nlocals; /* Number of local variables */
mzta 0:158c61bb030f 30 uint16_t nregs; /* Number of register variables */
mzta 0:158c61bb030f 31 uint8_t flags;
mzta 0:158c61bb030f 32
mzta 0:158c61bb030f 33 mrb_code *iseq;
mzta 0:158c61bb030f 34 mrb_value *pool;
mzta 0:158c61bb030f 35 mrb_sym *syms;
mzta 0:158c61bb030f 36 struct mrb_irep **reps;
mzta 0:158c61bb030f 37
mzta 0:158c61bb030f 38 struct mrb_locals *lv;
mzta 0:158c61bb030f 39 /* debug info */
mzta 0:158c61bb030f 40 const char *filename;
mzta 0:158c61bb030f 41 uint16_t *lines;
mzta 0:158c61bb030f 42 struct mrb_irep_debug_info* debug_info;
mzta 0:158c61bb030f 43
mzta 0:158c61bb030f 44 size_t ilen, plen, slen, rlen, refcnt;
mzta 0:158c61bb030f 45 } mrb_irep;
mzta 0:158c61bb030f 46
mzta 0:158c61bb030f 47 #define MRB_ISEQ_NO_FREE 1
mzta 0:158c61bb030f 48
mzta 0:158c61bb030f 49 MRB_API mrb_irep *mrb_add_irep(mrb_state *mrb);
mzta 0:158c61bb030f 50 MRB_API mrb_value mrb_load_irep(mrb_state*, const uint8_t*);
mzta 0:158c61bb030f 51 MRB_API mrb_value mrb_load_irep_cxt(mrb_state*, const uint8_t*, mrbc_context*);
mzta 0:158c61bb030f 52 void mrb_irep_free(mrb_state*, struct mrb_irep*);
mzta 0:158c61bb030f 53 void mrb_irep_incref(mrb_state*, struct mrb_irep*);
mzta 0:158c61bb030f 54 void mrb_irep_decref(mrb_state*, struct mrb_irep*);
mzta 0:158c61bb030f 55
mzta 0:158c61bb030f 56 #if defined(__cplusplus)
mzta 0:158c61bb030f 57 } /* extern "C" { */
mzta 0:158c61bb030f 58 #endif
mzta 0:158c61bb030f 59
mzta 0:158c61bb030f 60 #endif /* MRUBY_IREP_H */
mzta 0:158c61bb030f 61