#include <ruby.h>
#include <errno.h>
#include "dl.h"
Include dependency graph for cfunc.c:
Go to the source code of this file.
#define CALL_CASE |
Value:
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 309 of file cfunc.c.
Referenced by rb_dlcfunc_call().
#define CASE | ( | n | ) |
Value:
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 | ) |
Value:
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 | ) |
Value:
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 | ) |
Value:
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 | ) |
Value:
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 | ) |
Value:
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 | ) |
Value:
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 | ) |
Value:
case n: { \ DECL_FUNC_CDECL(f,void,DLSTACK_PROTO##n,cfunc->ptr); \ f(DLSTACK_ARGS##n(stack)); \ result = Qnil; \ }
#define DECL_FUNC_CDECL | ( | f, | |||
ret, | |||||
args, | |||||
val | ) | ret (FUNC_CDECL(*f))(args) = (ret (FUNC_CDECL(*))(args))(VALUE)(val) |
static void dlcfunc_free | ( | void * | ptr | ) | [static] |
static size_t dlcfunc_memsize | ( | const void * | ptr | ) | [static] |
void Init_dlcfunc | ( | void | ) |
Definition at line 607 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 1164 of file bignum.c.
References big2ulong(), FALSE, RBIGNUM_SIGN, and SIGNED_VALUE.
Referenced by rb_dlcfunc_call().
Definition at line 16 of file cfunc.c.
References id_last_error, rb_thread_current(), and rb_thread_local_aref().
Referenced by Init_dlcfunc().
Definition at line 22 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 98 of file cfunc.c.
References DATA_PTR, dlcfunc_data_type, NULL, cfunc_data::ptr, Qnil, rb_eTypeError, rb_raise(), and rb_typeddata_is_kind_of().
Definition at line 331 of file cfunc.c.
References CALL_CASE, cfunc_data::calltype, CFUNC_CDECL, CFUNC_STDCALL, Check_Type, dlcfunc_data_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, FUNC_STDCALL, INT2NUM(), 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_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 222 of file cfunc.c.
References cfunc_data::calltype, dlcfunc_data_type, ID2SYM, and TypedData_Get_Struct.
Referenced by Init_dlcfunc().
Definition at line 191 of file cfunc.c.
References dlcfunc_data_type, INT2NUM(), cfunc_data::type, and TypedData_Get_Struct.
Referenced by Init_dlcfunc().
Definition at line 146 of file cfunc.c.
References cfunc_data::calltype, CFUNC_CDECL, dlcfunc_data_type, 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, and xfree.
Referenced by Init_dlcfunc().
Definition at line 285 of file cfunc.c.
References dlcfunc_data_type, 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 133 of file cfunc.c.
References dlcfunc_data_type, and rb_typeddata_is_kind_of().
Definition at line 175 of file cfunc.c.
References dlcfunc_data_type, cfunc_data::name, Qnil, rb_tainted_str_new2, and TypedData_Get_Struct.
Referenced by Init_dlcfunc().
Definition at line 77 of file cfunc.c.
References cfunc_data::calltype, dlcfunc_data_type, cfunc_data::name, NULL, cfunc_data::ptr, Qnil, rb_cDLCFunc, rb_secure(), strdup, cfunc_data::type, and TypedData_Make_Struct.
Definition at line 253 of file cfunc.c.
References dlcfunc_data_type, cfunc_data::ptr, PTR2NUM, and TypedData_Get_Struct.
Referenced by Init_dlcfunc().
Definition at line 118 of file cfunc.c.
References cfunc_data::calltype, CFUNC_CDECL, dlcfunc_data_type, cfunc_data::name, cfunc_data::ptr, cfunc_data::type, and TypedData_Make_Struct.
Referenced by Init_dlcfunc().
Definition at line 237 of file cfunc.c.
References cfunc_data::calltype, dlcfunc_data_type, SYM2ID, and TypedData_Get_Struct.
Referenced by Init_dlcfunc().
Definition at line 206 of file cfunc.c.
References dlcfunc_data_type, NUM2INT, cfunc_data::type, and TypedData_Get_Struct.
Referenced by Init_dlcfunc().
Definition at line 268 of file cfunc.c.
References dlcfunc_data_type, NUM2PTR, cfunc_data::ptr, Qnil, and TypedData_Get_Struct.
Referenced by Init_dlcfunc().
Definition at line 598 of file cfunc.c.
References dlcfunc_data_type, cfunc_data::ptr, PTR2NUM, and TypedData_Get_Struct.
Referenced by Init_dlcfunc().
Initial value:
{ "dl/cfunc", 0, dlcfunc_free, dlcfunc_memsize, }
Definition at line 71 of file cfunc.c.
Referenced by rb_dlcfunc2ptr(), rb_dlcfunc_call(), rb_dlcfunc_calltype(), rb_dlcfunc_ctype(), rb_dlcfunc_initialize(), rb_dlcfunc_inspect(), rb_dlcfunc_kind_p(), rb_dlcfunc_name(), rb_dlcfunc_new(), rb_dlcfunc_ptr(), rb_dlcfunc_s_allocate(), rb_dlcfunc_set_calltype(), rb_dlcfunc_set_ctype(), rb_dlcfunc_set_ptr(), and rb_dlcfunc_to_i().
ID id_last_error [static] |
Definition at line 13 of file cfunc.c.
Referenced by Init_dlcfunc(), rb_dl_get_last_error(), and rb_dl_set_last_error().