{ ruby.c }
procedure rb_check_type(x: Tvalue; t: Integer);
procedure rb_check_safe_str(x: Tvalue);
procedure rb_secure(level: Integer);
function rb_num2long(val: Tvalue): Integer;
function rb_num2ulong(val: Tvalue): Cardinal;
function rb_num2dbl(n: Tvalue): Double;
function rb_str2cstr(x: Tvalue; var len: Integer): PChar; {$IFDEF RUBY18}deprecated;{$ENDIF}

function rb_newobj: Tvalue;

function rb_data_object_alloc(klass: Tvalue; datap, dmark, dfree: Pointer): Tvalue;

function rb_define_class(const name: PChar; super: Tvalue): Tvalue;
function rb_define_module(const name: PChar): Tvalue;
function rb_define_class_under(module: Tvalue; const name: PChar; super: Tvalue): Tvalue;
function rb_define_module_under(module: Tvalue; const name: PChar): Tvalue;

procedure rb_include_module(klass, module: Tvalue);
procedure rb_extend_object(obj, module: Tvalue);

procedure rb_define_variable(const name: PChar; v: Pvalue);
procedure rb_define_virtual_variable(const name: PChar; getter, setter: Pointer);
procedure rb_define_hooked_variable(const name: PChar; v: Pvalue; getter, setter: Pointer);
procedure rb_define_readonly_variable(const name: PChar; v: Pvalue);
procedure rb_define_const(klass: Tvalue; const name: PChar; v: Tvalue);
procedure rb_define_global_const(const name: PChar; v: Tvalue);

function rb_define_method(klass: Tvalue; name: PChar; func: Pointer; argc: integer): Tvalue;
function rb_define_module_function(module: Tvalue; name: PChar; func: Pointer; argc: integer): Tvalue;
function rb_define_global_function(name: PChar; func: Pointer; argc: integer): Tvalue;

procedure rb_undef_method(klass: Tvalue; const name: PChar);
procedure rb_define_alias(klass: Tvalue; const name1, name2: PChar);
procedure rb_define_attr(klass: Tvalue; const name: PChar; r, w: Integer);

function rb_intern(name: PChar): Tid;
function rb_id2name(id: Tid): PChar;
function rb_to_id(obj: Tvalue): Tid;

function rb_class2name(klass: Tvalue): PChar;

procedure rb_p(obj: Tvalue);

function rb_eval_string(const str: PChar): Tvalue;
function rb_eval_string_protect(const str: PChar; var state: Integer): Tvalue;
function rb_eval_string_wrap(const str: PChar; var state: Integer): Tvalue;
function rb_funcall2(recv: Tvalue; mid: Tid; argc: Integer; argv: Pointer): Tvalue;
function rb_funcall3(recv: Tvalue; mid: Tid; argc: Integer; argv: Pointer): Tvalue;
function rb_call_super(argc: Integer; argv: Pointer): Tvalue;

function rb_gv_set(const name: PChar; val: Tvalue): Tvalue;
function rb_gv_get(const name: PChar): Tvalue;
function rb_iv_get(obj: Tvalue; const name: PChar): Tvalue;
function rb_iv_set(obj: Tvalue; const name: PChar; val: Tvalue): Tvalue;
function rb_cv_get(obj: Tvalue; const name: PChar): Tvalue;
function rb_cv_set(obj: Tvalue; const name: PChar; val: Tvalue): Tvalue;
function rb_const_get(klass: Tvalue; id: Tid): Tvalue;
function rb_const_get_at(klass: Tvalue; id: Tid): Tvalue;
procedure rb_const_set(klass: Tvalue; id: Tid; val: Tvalue);

function rb_equal(x, y: Tvalue): Tvalue;

function rb_safe_level: Integer;
procedure rb_set_safe_level(level: Integer);

procedure rb_sys_fail(const mesg: PChar);
procedure rb_iter_break;
procedure rb_exit(status: Integer);
procedure rb_notimplement;

function rb_each(obj: Tvalue): Tvalue;
function rb_yield(val: Tvalue): Tvalue;
function rb_block_given_p: Integer;
function rb_iterate(it_proc: Pointer; data1: Tvalue; bl_proc: Pointer; data2: Tvalue): Tvalue;
function rb_rescue(b_proc: Pointer; data1: Tvalue; r_proc: Pointer; data2: Tvalue): Tvalue;
function rb_ensure(b_proc: Pointer; data1: Tvalue; e_proc: Pointer; data2: Tvalue): Tvalue;
function rb_catch(const tag: PChar; proc: Pointer; data: Tvalue): Tvalue;
procedure rb_throw(const tag: PChar; val: Tvalue);

function rb_require(const fname: PChar): Tvalue;

procedure ruby_init;
procedure ruby_options(argc: Integer; argv: Pointer);
procedure ruby_run;
procedure ruby_finalize;
{$IFDEF RUBY18}
function ruby_cleanup(ex: Integer): Integer;
function ruby_exec: Integer;
{$ENDIF}
procedure ruby_stop(ex: Integer);

procedure ruby_incpush(const path: PChar);
procedure ruby_init_loadpath;
procedure require_libraries;

procedure rb_load_file(fname: PChar);
procedure ruby_script(fname: PChar);
procedure ruby_prog_init;
procedure ruby_set_argv(argc: Integer; argv: Pointer);
procedure ruby_process_options(argc: Integer; argv: Pointer);
procedure ruby_load_script;

