mbed I/F binding for mruby

Dependents:   mruby_mbed_web mirb_mbed

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers irep.h Source File

irep.h

00001 /*
00002 ** mruby/irep.h - mrb_irep structure
00003 **
00004 ** See Copyright Notice in mruby.h
00005 */
00006 
00007 #ifndef MRUBY_IREP_H
00008 #define MRUBY_IREP_H
00009 
00010 #if defined(__cplusplus)
00011 extern "C" {
00012 #endif
00013 
00014 #include "mruby/compile.h"
00015 
00016 enum irep_pool_type {
00017   IREP_TT_STRING,
00018   IREP_TT_FIXNUM,
00019   IREP_TT_FLOAT,
00020 };
00021 
00022 struct mrb_locals {
00023   mrb_sym name;
00024   uint16_t r;
00025 };
00026 
00027 /* Program data array struct */
00028 typedef struct mrb_irep {
00029   uint16_t nlocals;        /* Number of local variables */
00030   uint16_t nregs;          /* Number of register variables */
00031   uint8_t flags;
00032 
00033   mrb_code *iseq;
00034   mrb_value *pool;
00035   mrb_sym *syms;
00036   struct mrb_irep **reps;
00037 
00038   struct mrb_locals *lv;
00039   /* debug info */
00040   const char *filename;
00041   uint16_t *lines;
00042   struct mrb_irep_debug_info* debug_info;
00043 
00044   size_t ilen, plen, slen, rlen, refcnt;
00045 } mrb_irep;
00046 
00047 #define MRB_ISEQ_NO_FREE 1
00048 
00049 MRB_API mrb_irep *mrb_add_irep(mrb_state *mrb);
00050 MRB_API mrb_value mrb_load_irep(mrb_state*, const uint8_t*);
00051 MRB_API mrb_value mrb_load_irep_cxt(mrb_state*, const uint8_t*, mrbc_context*);
00052 void mrb_irep_free(mrb_state*, struct mrb_irep*);
00053 void mrb_irep_incref(mrb_state*, struct mrb_irep*);
00054 void mrb_irep_decref(mrb_state*, struct mrb_irep*);
00055 
00056 #if defined(__cplusplus)
00057 }  /* extern "C" { */
00058 #endif
00059 
00060 #endif  /* MRUBY_IREP_H */
00061