rh.h 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  1. #ifndef rh_H_INCLUDED
  2. #define rh_H_INCLUDED
  3. #include <stdarg.h>
  4. #include <mruby.h>
  5. #include <mruby/data.h>
  6. #include <mruby/compile.h>
  7. #include <mruby/proc.h>
  8. #include <mruby/string.h>
  9. // shortcut typedef. Also to alllow possible future enhancement.
  10. typedef mrb_state Ruby;
  11. typedef struct Script_ Script;
  12. Ruby * rh_new(void);
  13. Ruby * rh_free(Ruby * self);
  14. mrb_value rh_inspect(mrb_state *mrb , mrb_value obj );
  15. char * rh_inspect_cstr(mrb_state *mrb , mrb_value value);
  16. int rh_run_file(Ruby * self , const char * filename, FILE * file );
  17. int rh_run_filename (Ruby * self , const char * filename );
  18. /* rh_run_script only works fo files in a (sub) folder of the WOE
  19. * directory, where rh_run_filename is generic. */
  20. int rh_run_script(Ruby * self, const char * filename);
  21. char * rh_exception_string (Ruby * self );
  22. mrb_value rh_simple_funcall(Ruby * ruby, char * name);
  23. mrb_value rh_run_function_args(Ruby * ruby, mrb_value rubyself,
  24. char * name, int argc, mrb_value * argv);
  25. mrb_value rh_run_toplevel_args(Ruby * ruby, char * name, int argc, mrb_value * argv);
  26. mrb_value rh_run_function_va(Ruby * ruby, mrb_value rubyself,
  27. char * name, char * format, va_list args);
  28. mrb_value rh_run_toplevel_va(Ruby * ruby, char * name, char * format, va_list args);
  29. mrb_value rh_run_function(Ruby * ruby, mrb_value rubyself, char * name, char * format, ...);
  30. mrb_value rh_run_toplevel(Ruby * ruby, char * name, char * format, ...);
  31. int rh_tobool(mrb_value v);
  32. #define rh_bool_value(B) ( (B) ? mrb_true_value() : mrb_false_value())
  33. /* Tries to (re-)load the main ruby file, output to console. */
  34. int rh_load_main();
  35. Ruby * rh_open_ruby_state();
  36. Ruby * rh_close_ruby_state();
  37. Ruby * rh_get_ruby_state(Ruby * ruby);
  38. int rh_load_main();
  39. int rh_on_start();
  40. int rh_on_reload();
  41. #endif