#include <mruby.h> #include <mruby/dump.h> #include <mruby/proc.h>
int main() { static const uint8_t foo[] = { 0x52,0x49,0x54,0x45,0x30,0x30,0x30,0x31,0x63,0x5c,0x00,0x00,0x00,0x90,0x4d,0x41, 0x54,0x5a,0x30,0x30,0x30,0x30,0x49,0x52,0x45,0x50,0x00,0x00,0x00,0x72,0x30,0x30, 0x30,0x30,0x00,0x02,0x00,0x00,0x00,0x00,0x00,0x33,0x00,0x01,0x00,0x03,0x00,0x00, 0x00,0x06,0x00,0xbf,0xff,0x83,0x01,0x40,0x02,0x03,0x00,0x80,0x40,0xc1,0x01,0x00, 0x03,0x40,0x00,0x80,0x00,0x21,0x00,0x00,0x00,0x4a,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x01,0x00,0x04,0x65,0x61,0x63,0x68,0x00,0x00,0x00,0x00,0x2f,0x00,0x03,0x00, 0x05,0x00,0x00,0x00,0x05,0x02,0x00,0x00,0x26,0x01,0x80,0x00,0x06,0x02,0x00,0x40, 0x01,0x01,0x80,0x00,0xa0,0x01,0x80,0x00,0x29,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x01,0x00,0x04,0x70,0x75,0x74,0x73,0x00,0x45,0x4e,0x44,0x00,0x00,0x00,0x00,0x08, };
mrb_state* mrb = mrb_open(); int n = mrb_read_irep(mrb, foo); if (n >= 0) { mrb_run(mrb, mrb_proc_new(mrb, mrb->irep[n]), mrb_top_self(mrb)); } else { printf("Failed to load byte code.\n"); } mrb_close(mrb); return 0; }
|