rh.h 2.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  1. #ifndef rh_H_INCLUDED
  2. #define rh_H_INCLUDED
  3. #include <mruby.h>
  4. #include <mruby/data.h>
  5. #include <mruby/compile.h>
  6. #include <mruby/proc.h>
  7. #include <mruby/string.h>
  8. // shortcut typedef. Also to alllow possible future enhancement.
  9. typedef mrb_state Ruby;
  10. typedef struct Script_ Script;
  11. #include "zori.h"
  12. void toruby_Font_free(mrb_state * state , void * ptr );
  13. extern struct mrb_data_type toruby_Font_type;
  14. void toruby_Path_free(mrb_state * state , void * ptr );
  15. extern struct mrb_data_type toruby_Path;
  16. mrb_value tr_Path (Ruby * ruby, mrb_value self, struct RClass * klass);
  17. Ruby * rh_new(void);
  18. Ruby * rh_free(Ruby * self );
  19. mrb_value rh_inspect(mrb_state *mrb , mrb_value obj );
  20. char * rh_inspect_cstr(mrb_state *mrb , mrb_value value);
  21. int rh_run_file (Ruby * self , const char * filename, FILE * file );
  22. int rh_run_filename (Ruby * self , const char * filename );
  23. /* rh_run_script only works fo files in a (sub) folder of the Eruta script
  24. * directory, where rh_run_filename is generic. */
  25. int rh_run_script(Ruby * self, const char * filename);
  26. char * rh_exception_string (Ruby * self );
  27. mrb_value rh_simple_funcall(Ruby * ruby, char * name);
  28. mrb_value rh_run_function_args(Ruby * ruby, mrb_value rubyself,
  29. char * name, int argc, mrb_value * argv);
  30. mrb_value rh_run_toplevel_args(Ruby * ruby, char * name, int argc, mrb_value * argv);
  31. mrb_value rh_run_function_va(Ruby * ruby, mrb_value rubyself,
  32. char * name, char * format, va_list args);
  33. mrb_value rh_run_toplevel_va(Ruby * ruby, char * name, char * format, va_list args);
  34. mrb_value rh_run_function(Ruby * ruby, mrb_value rubyself, char * name, char * format, ...);
  35. mrb_value rh_run_toplevel(Ruby * ruby, char * name, char * format, ...);
  36. int rh_tobool(mrb_value v);
  37. #define rh_bool_value(B) ( (B) ? mrb_true_value() : mrb_false_value())
  38. int rh_poll_event(mrb_state * mrb, ALLEGRO_EVENT * event);
  39. int rh_poll_events(mrb_state * mrb, ALLEGRO_EVENT_QUEUE * queue);
  40. int rh_load_main();
  41. int rh_on_start();
  42. int rh_on_reload();
  43. int rh_run_console_command(struct zori_console * console, const char * command, void * extra);
  44. #endif