diff options
| author | Paolo Bosetti <[email protected]> | 2012-05-30 11:39:22 -0700 |
|---|---|---|
| committer | Paolo Bosetti <[email protected]> | 2012-05-30 11:42:42 -0700 |
| commit | 636d45f76598e970d130c277bb66584064db1360 (patch) | |
| tree | 975a226cbb8472adeb61bb1b4cfcdf6e730e803e /xcode/HelloMRuby/hello_mruby.c | |
| parent | d73517877847dab5b345c7fa98091647737bbfe0 (diff) | |
| download | mruby-636d45f76598e970d130c277bb66584064db1360.tar.gz mruby-636d45f76598e970d130c277bb66584064db1360.zip | |
Added Xcode template with native target for compiling static libs and tools (mruby, mrbc, mirb)
Diffstat (limited to 'xcode/HelloMRuby/hello_mruby.c')
| -rw-r--r-- | xcode/HelloMRuby/hello_mruby.c | 39 |
1 files changed, 0 insertions, 39 deletions
diff --git a/xcode/HelloMRuby/hello_mruby.c b/xcode/HelloMRuby/hello_mruby.c deleted file mode 100644 index 2cfa38143..000000000 --- a/xcode/HelloMRuby/hello_mruby.c +++ /dev/null @@ -1,39 +0,0 @@ -// -// hello_mruby.c -// mruby -// -// Created by Paolo Bosetti on 5/22/12. -// Copyright (c) 2012 University of Trento. All rights reserved. -// - -#include <stdlib.h> -#include <stdio.h> - -/* Include the mruby header */ -#include <mruby.h> -#include <mruby/proc.h> -#include <mruby/data.h> -#include <mruby/compile.h> - - - -int main(int argc, const char * argv[]) -{ - struct mrb_parser_state *parse; - mrb_state *mrb = mrb_open(); - char code[] = "p 'hello world!'"; - int n; - - printf("Executing Ruby code from C!\n"); - parse = mrb_parse_string(mrb, code); - n = mrb_generate_code(mrb, parse->tree); - - mrb_run(mrb, mrb_proc_new(mrb, mrb->irep[n]), mrb_top_self(mrb)); - - if (mrb->exc) { - mrb_p(mrb, mrb_obj_value(mrb->exc)); - } - - mrb_close(mrb); - return 0; -}
\ No newline at end of file |
