Ruby 1.9.3p327(2012-11-10revision37606)
|
Go to the source code of this file.
#define CALL_CASE |
switch( RARRAY_LEN(ary) ){ \ CASE(0); break; \ CASE(1); break; CASE(2); break; CASE(3); break; CASE(4); break; CASE(5); break; \ CASE(6); break; CASE(7); break; CASE(8); break; CASE(9); break; CASE(10);break; \ CASE(11);break; CASE(12);break; CASE(13);break; CASE(14);break; CASE(15);break; \ CASE(16);break; CASE(17);break; CASE(18);break; CASE(19);break; CASE(20);break; \ default: rb_raise(rb_eArgError, "too many arguments"); \ }
Definition at line 317 of file cfunc.c.
Referenced by rb_dlcfunc_call().
#define CASE | ( | n | ) |
case n: { \ DECL_FUNC_CDECL(f,double,DLSTACK_PROTO##n,cfunc->ptr); \ double ret; \ ret = f(DLSTACK_ARGS##n(stack)); \ result = rb_float_new(ret); \ }
#define CASE | ( | n | ) |
case n: { \ DECL_FUNC_CDECL(f,float,DLSTACK_PROTO##n,cfunc->ptr); \ float ret; \ ret = f(DLSTACK_ARGS##n(stack)); \ result = rb_float_new(ret); \ }
#define CASE | ( | n | ) |
case n: { \ DECL_FUNC_CDECL(f,void*,DLSTACK_PROTO##n,cfunc->ptr); \ void * ret; \ ret = f(DLSTACK_ARGS##n(stack)); \ result = PTR2NUM(ret); \ }
#define CASE | ( | n | ) |
case n: { \ DECL_FUNC_CDECL(f,int,DLSTACK_PROTO##n,cfunc->ptr); \ int ret; \ ret = f(DLSTACK_ARGS##n(stack)); \ result = INT2NUM(ret); \ }
#define CASE | ( | n | ) |
case n: { \ DECL_FUNC_CDECL(f,short,DLSTACK_PROTO##n,cfunc->ptr); \ short ret; \ ret = f(DLSTACK_ARGS##n(stack)); \ result = INT2NUM((int)ret); \ }
#define CASE | ( | n | ) |
case n: { \ DECL_FUNC_CDECL(f,char,DLSTACK_PROTO##n,cfunc->ptr); \ char ret; \ ret = f(DLSTACK_ARGS##n(stack)); \ result = CHR2FIX(ret); \ }
#define CASE | ( | n | ) |
case n: { \ DECL_FUNC_CDECL(f,long,DLSTACK_PROTO##n,cfunc->ptr); \ long ret; \ ret = f(DLSTACK_ARGS##n(stack)); \ result = LONG2NUM(ret); \ }
#define CASE | ( | n | ) |
case n: { \ DECL_FUNC_CDECL(f,void,DLSTACK_PROTO##n,cfunc->ptr); \ f(DLSTACK_ARGS##n(stack)); \ result = Qnil; \ }
static void dlcfunc_free | ( | void * | ptr | ) | [static] |
Definition at line 54 of file cfunc.c.
References cfunc_data::name, cfunc_data::ptr, and xfree().
static void dlcfunc_mark | ( | void * | ptr | ) | [static] |
Definition at line 45 of file cfunc.c.
References cfunc_data::ptr, rb_gc_mark(), and cfunc_data::wrap.
static size_t dlcfunc_memsize | ( | const void * | ptr | ) | [static] |
Definition at line 64 of file cfunc.c.
References cfunc_data::name, cfunc_data::ptr, size, and strlen().
void Init_dlcfunc | ( | void | ) |
Definition at line 621 of file cfunc.c.
References id_last_error, rb_cDLCFunc, rb_cObject, rb_define_alloc_func(), rb_define_class_under(), rb_define_method(), rb_define_module_function(), rb_dl_get_last_error(), rb_dlcfunc_call(), rb_dlcfunc_calltype(), rb_dlcfunc_ctype(), rb_dlcfunc_initialize(), rb_dlcfunc_inspect(), rb_dlcfunc_name(), rb_dlcfunc_ptr(), rb_dlcfunc_s_allocate(), rb_dlcfunc_set_calltype(), rb_dlcfunc_set_ctype(), rb_dlcfunc_set_ptr(), rb_dlcfunc_to_i(), rb_intern, and rb_mDL.
Referenced by Init_dl().
Definition at line 14 of file cfunc.c.
References id_last_error, rb_thread_current(), and rb_thread_local_aref().
Referenced by Init_dlcfunc().
Definition at line 20 of file cfunc.c.
References id_last_error, Qnil, rb_thread_current(), and rb_thread_local_aset().
Referenced by rb_dlcfunc_call().
void* rb_dlcfunc2ptr | ( | VALUE | val | ) |
Definition at line 104 of file cfunc.c.
References DATA_PTR, func, NULL, cfunc_data::ptr, Qnil, rb_eTypeError, rb_raise(), and rb_typeddata_is_kind_of().
Definition at line 339 of file cfunc.c.
References CALL_CASE, cfunc_data::calltype, CFUNC_CDECL, CFUNC_STDCALL, Check_Type, DLSTACK_SIZE, DLSTACK_TYPE, DLTYPE_CHAR, DLTYPE_DOUBLE, DLTYPE_FLOAT, DLTYPE_INT, DLTYPE_LONG, DLTYPE_SHORT, DLTYPE_VOID, DLTYPE_VOIDP, errno, FIX2LONG, FIXNUM_P, INT2NUM(), name, PRIxVALUE, cfunc_data::ptr, Qnil, RARRAY_LEN, RARRAY_PTR, rb_big2ulong_pack(), rb_check_safe_obj(), rb_dl_set_last_error(), rb_eDLError, rb_eDLTypeError, rb_id2name(), rb_raise(), rb_secure_update(), rb_to_int(), RB_TYPE_P, result, T_ARRAY, T_BIGNUM, T_FIXNUM, cfunc_data::type, and TypedData_Get_Struct.
Referenced by Init_dlcfunc().
Definition at line 230 of file cfunc.c.
References cfunc_data::calltype, ID2SYM, and TypedData_Get_Struct.
Referenced by Init_dlcfunc().
Definition at line 199 of file cfunc.c.
References INT2NUM(), cfunc_data::type, and TypedData_Get_Struct.
Referenced by Init_dlcfunc().
Definition at line 152 of file cfunc.c.
References cfunc_data::calltype, CFUNC_CDECL, DLTYPE_VOID, cfunc_data::name, name, NIL_P, NULL, NUM2INT, NUM2PTR, cfunc_data::ptr, Qnil, rb_Integer(), rb_scan_args(), strdup, StringValuePtr, SYM2ID, cfunc_data::type, type, TypedData_Get_Struct, cfunc_data::wrap, and xfree().
Referenced by Init_dlcfunc().
Definition at line 293 of file cfunc.c.
References cfunc_data::name, OBJ_TAINT, cfunc_data::ptr, rb_sprintf(), cfunc_data::type, and TypedData_Get_Struct.
Referenced by Init_dlcfunc().
int rb_dlcfunc_kind_p | ( | VALUE | func | ) |
Definition at line 139 of file cfunc.c.
References rb_typeddata_is_kind_of().
Referenced by get_freefunc().
Definition at line 183 of file cfunc.c.
References cfunc_data::name, Qnil, rb_tainted_str_new2(), and TypedData_Get_Struct.
Referenced by Init_dlcfunc().
Definition at line 83 of file cfunc.c.
References cfunc_data::calltype, func, cfunc_data::name, NULL, cfunc_data::ptr, Qnil, rb_cDLCFunc, rb_secure(), strdup, type, cfunc_data::type, and TypedData_Make_Struct.
Referenced by rb_dlptr_free_get().
Definition at line 261 of file cfunc.c.
References cfunc_data::ptr, PTR2NUM, and TypedData_Get_Struct.
Referenced by Init_dlcfunc().
Definition at line 124 of file cfunc.c.
References cfunc_data::calltype, CFUNC_CDECL, cfunc_data::name, cfunc_data::ptr, cfunc_data::type, and TypedData_Make_Struct.
Referenced by Init_dlcfunc().
Definition at line 245 of file cfunc.c.
References cfunc_data::calltype, sym, SYM2ID, and TypedData_Get_Struct.
Referenced by Init_dlcfunc().
Definition at line 214 of file cfunc.c.
References NUM2INT, cfunc_data::type, and TypedData_Get_Struct.
Referenced by Init_dlcfunc().
Definition at line 276 of file cfunc.c.
References NUM2PTR, cfunc_data::ptr, Qnil, and TypedData_Get_Struct.
Referenced by Init_dlcfunc().
Definition at line 612 of file cfunc.c.
References cfunc_data::ptr, PTR2NUM, and TypedData_Get_Struct.
Referenced by Init_dlcfunc().
{ "dl/cfunc", {dlcfunc_mark, dlcfunc_free, dlcfunc_memsize,}, }
ID id_last_error [static] |
Definition at line 11 of file cfunc.c.
Referenced by Init_dlcfunc(), rb_dl_get_last_error(), and rb_dl_set_last_error().
Definition at line 9 of file cfunc.c.
Referenced by Init_dlcfunc(), and rb_dlcfunc_new().