11 # define RB_OBJ_CLASSNAME(obj) rb_obj_class(obj)
12 # define RB_OBJ_STRING(obj) (obj)
14 # define PRIsVALUE "s"
15 # define RB_OBJ_CLASSNAME(obj) rb_obj_classname(obj)
16 # define RB_OBJ_STRING(obj) StringValueCStr(obj)
30 #define RPTR_DATA(obj) ((struct ptr_data *)(DATA_PTR(obj)))
41 *wrap = (addrnum !=
func) ? func : 0;
75 return data ?
sizeof(*data) + data->
size : 0;
112 memset(ptr,0,(
size_t)size);
126 else if (val ==
Qnil) {
170 if (
rb_scan_args(argc, argv,
"12", &ptr, &size, &sym) >= 1) {
172 if (addrnum != ptr) wrap =
ptr;
189 data->
wrap[1] = funcwrap;
226 rb_bug(
"rb_fiddle_ptr_s_malloc");
389 rb_bug(
"rb_fiddle_ptr_to_s");
427 rb_bug(
"rb_fiddle_ptr_to_str");
552 retval =
INT2NUM(*((
char *)data->
ptr + offset));
560 rb_bug(
"rb_fiddle_ptr_aref()");
579 VALUE arg0, arg1, arg2;
587 switch(
rb_scan_args(argc, argv,
"21", &arg0, &arg1, &arg2) ){
605 memcpy((
char *)data->
ptr + offset, mem, len);
609 rb_bug(
"rb_fiddle_ptr_aset()");
672 if (num == val) wrap = 0;
#define RB_TYPE_P(obj, type)
static VALUE rb_fiddle_ptr_ref(VALUE self)
void rb_bug(const char *fmt,...)
static VALUE rb_fiddle_ptr_plus(VALUE self, VALUE other)
static VALUE rb_fiddle_ptr_inspect(VALUE self)
static VALUE rb_fiddle_ptr_to_s(int argc, VALUE argv[], VALUE self)
#define rb_tainted_str_new2
static VALUE rb_fiddle_ptr_eql(VALUE self, VALUE other)
void rb_define_singleton_method(VALUE obj, const char *name, VALUE(*func)(ANYARGS), int argc)
Defines a singleton method for obj.
SSL_METHOD *(* func)(void)
static VALUE rb_fiddle_ptr_ptr(VALUE self)
void rb_define_alloc_func(VALUE, rb_alloc_func_t)
VALUE rb_ary_push(VALUE ary, VALUE item)
static void * rb_fiddle_ptr2cptr(VALUE val)
VALUE rb_define_class_under(VALUE outer, const char *name, VALUE super)
Defines a class under the namespace of outer.
void rb_raise(VALUE exc, const char *fmt,...)
static VALUE rb_fiddle_ptr_s_malloc(int argc, VALUE argv[], VALUE klass)
#define GetOpenFile(obj, fp)
static VALUE rb_fiddle_ptr_cmp(VALUE self, VALUE other)
memset(y->frac+ix+1, 0,(y->Prec-(ix+1))*sizeof(BDIGIT))
#define TypedData_Get_Struct(obj, type, data_type, sval)
#define StringValuePtr(v)
void Init_fiddle_pointer(void)
void rb_define_const(VALUE, const char *, VALUE)
static VALUE rb_fiddle_ptr_aref(int argc, VALUE argv[], VALUE self)
static VALUE rb_fiddle_ptr_aset(int argc, VALUE argv[], VALUE self)
static VALUE rb_fiddle_ptr_new2(VALUE klass, void *ptr, long size, freefunc_t func)
static void fiddle_ptr_mark(void *ptr)
VALUE rb_check_funcall(VALUE, ID, int, VALUE *)
VALUE rb_tainted_str_new(const char *, long)
#define RB_OBJ_CLASSNAME(obj)
VALUE rb_sprintf(const char *format,...)
static freefunc_t get_freefunc(VALUE func, volatile VALUE *wrap)
int rb_scan_args(int argc, const VALUE *argv, const char *fmt,...)
static VALUE rb_fiddle_ptr_size_set(VALUE self, VALUE size)
RUBY_EXTERN VALUE rb_cString
static VALUE rb_fiddle_ptr_free_get(VALUE self)
void * ruby_xmalloc(size_t size)
static VALUE rb_fiddle_ptr_size_get(VALUE self)
VALUE rb_fiddle_new_function(VALUE address, VALUE arg_types, VALUE ret_type)
VALUE rb_obj_is_kind_of(VALUE, VALUE)
static VALUE rb_fiddle_ptr_malloc(long size, freefunc_t func)
static VALUE rb_fiddle_ptr_null_p(VALUE self)
#define TypedData_Make_Struct(klass, type, data_type, sval)
RUBY_EXTERN VALUE rb_cObject
static VALUE rb_fiddle_ptr_to_i(VALUE self)
static VALUE rb_fiddle_ptr_free_set(VALUE self, VALUE val)
static Bigint * diff(Bigint *a, Bigint *b)
static VALUE rb_fiddle_ptr_to_value(VALUE self)
static VALUE rb_fiddle_ptr_new(void *ptr, long size, freefunc_t func)
static VALUE rb_fiddle_ptr_s_to_ptr(VALUE self, VALUE val)
FILE * rb_io_stdio_file(rb_io_t *fptr)
static const rb_data_type_t fiddle_ptr_data_type
static VALUE rb_fiddle_ptr_initialize(int argc, VALUE argv[], VALUE self)
void(* freefunc_t)(void *)
static VALUE rb_fiddle_ptr_s_allocate(VALUE klass)
static VALUE rb_fiddle_ptr_to_str(int argc, VALUE argv[], VALUE self)
void rb_define_method(VALUE klass, const char *name, VALUE(*func)(ANYARGS), int argc)
static size_t fiddle_ptr_memsize(const void *ptr)
static void fiddle_ptr_free(void *ptr)
static VALUE rb_fiddle_ptr_minus(VALUE self, VALUE other)