Functions | Variables

ext/dl/cptr.c File Reference

#include <ruby/ruby.h>
#include <ruby/io.h>
#include <ctype.h>
#include "dl.h"
Include dependency graph for cptr.c:

Go to the source code of this file.

Functions

static freefunc_t get_freefunc (VALUE func)
static void dlptr_free (void *ptr)
static size_t dlptr_memsize (const void *ptr)
void dlptr_init (VALUE val)
VALUE rb_dlptr_new2 (VALUE klass, void *ptr, long size, freefunc_t func)
VALUE rb_dlptr_new (void *ptr, long size, freefunc_t func)
VALUE rb_dlptr_malloc (long size, freefunc_t func)
void * rb_dlptr2cptr (VALUE val)
static VALUE rb_dlptr_s_allocate (VALUE klass)
static VALUE rb_dlptr_initialize (int argc, VALUE argv[], VALUE self)
static VALUE rb_dlptr_s_malloc (int argc, VALUE argv[], VALUE klass)
static VALUE rb_dlptr_to_i (VALUE self)
static VALUE rb_dlptr_to_value (VALUE self)
VALUE rb_dlptr_ptr (VALUE self)
VALUE rb_dlptr_ref (VALUE self)
VALUE rb_dlptr_null_p (VALUE self)
static VALUE rb_dlptr_free_set (VALUE self, VALUE val)
static VALUE rb_dlptr_free_get (VALUE self)
static VALUE rb_dlptr_to_s (int argc, VALUE argv[], VALUE self)
static VALUE rb_dlptr_to_str (int argc, VALUE argv[], VALUE self)
static VALUE rb_dlptr_inspect (VALUE self)
VALUE rb_dlptr_eql (VALUE self, VALUE other)
static VALUE rb_dlptr_cmp (VALUE self, VALUE other)
static VALUE rb_dlptr_plus (VALUE self, VALUE other)
static VALUE rb_dlptr_minus (VALUE self, VALUE other)
VALUE rb_dlptr_aref (int argc, VALUE argv[], VALUE self)
VALUE rb_dlptr_aset (int argc, VALUE argv[], VALUE self)
static VALUE rb_dlptr_size_set (VALUE self, VALUE size)
static VALUE rb_dlptr_size_get (VALUE self)
static VALUE rb_dlptr_s_to_ptr (VALUE self, VALUE val)
void Init_dlptr (void)

Variables

VALUE rb_cDLCPtr
static ID id_to_ptr
static const rb_data_type_t dlptr_data_type

Function Documentation

static void dlptr_free ( void *  ptr  )  [static]

Definition at line 27 of file cptr.c.

References ptr_data::free, and ptr_data::ptr.

void dlptr_init ( VALUE  val  ) 

Definition at line 50 of file cptr.c.

References OBJ_TAINT, and TypedData_Get_Struct.

Referenced by rb_dlptr_new2().

static size_t dlptr_memsize ( const void *  ptr  )  [static]

Definition at line 38 of file cptr.c.

References ptr_data::size.

static freefunc_t get_freefunc ( VALUE  func  )  [inline, static]
void Init_dlptr ( void   ) 
void* rb_dlptr2cptr ( VALUE  val  ) 
VALUE rb_dlptr_aref ( int  argc,
VALUE  argv[],
VALUE  self 
)

Definition at line 485 of file cptr.c.

References INT2NUM(), len, NUM2ULONG, ptr_data::ptr, rb_bug(), rb_scan_args(), rb_tainted_str_new(), and RPTR_DATA.

Referenced by Init_dlptr().

VALUE rb_dlptr_aset ( int  argc,
VALUE  argv[],
VALUE  self 
)
static VALUE rb_dlptr_cmp ( VALUE  self,
VALUE  other 
) [static]

Definition at line 425 of file cptr.c.

References INT2FIX, INT2NUM(), rb_cDLCPtr, rb_dlptr2cptr(), rb_obj_is_kind_of(), and SIGNED_VALUE.

Referenced by Init_dlptr().

VALUE rb_dlptr_eql ( VALUE  self,
VALUE  other 
)

Definition at line 405 of file cptr.c.

References Qtrue, rb_cDLCPtr, rb_dlptr2cptr(), and rb_obj_is_kind_of().

Referenced by Init_dlptr().

static VALUE rb_dlptr_free_get ( VALUE  self  )  [static]

Definition at line 303 of file cptr.c.

References CFUNC_CDECL, DLTYPE_VOID, ptr_data::free, rb_dlcfunc_new(), and TypedData_Get_Struct.

Referenced by Init_dlptr().

static VALUE rb_dlptr_free_set ( VALUE  self,
VALUE  val 
) [static]

Definition at line 287 of file cptr.c.

References ptr_data::free, get_freefunc(), and TypedData_Get_Struct.

Referenced by Init_dlptr().

static VALUE rb_dlptr_initialize ( int  argc,
VALUE  argv[],
VALUE  self 
) [static]
static VALUE rb_dlptr_inspect ( VALUE  self  )  [static]
VALUE rb_dlptr_malloc ( long  size,
freefunc_t  func 
)

Definition at line 81 of file cptr.c.

References ptr_data::ptr, rb_dlptr_new(), rb_secure(), and ruby_xmalloc().

Referenced by rb_dlptr_s_malloc().

static VALUE rb_dlptr_minus ( VALUE  self,
VALUE  other 
) [static]

Definition at line 464 of file cptr.c.

References NUM2LONG(), ptr_data::ptr, rb_dlptr2cptr(), rb_dlptr_new(), RPTR_DATA, and size.

Referenced by Init_dlptr().

VALUE rb_dlptr_new ( void *  ptr,
long  size,
freefunc_t  func 
)
VALUE rb_dlptr_new2 ( VALUE  klass,
void *  ptr,
long  size,
freefunc_t  func 
)

Definition at line 59 of file cptr.c.

References dlptr_init(), ptr_data::free, ptr_data::ptr, rb_secure(), ptr_data::size, and TypedData_Make_Struct.

Referenced by rb_dlptr_new().

VALUE rb_dlptr_null_p ( VALUE  self  ) 

Definition at line 273 of file cptr.c.

References ptr_data::ptr, Qfalse, and TypedData_Get_Struct.

Referenced by Init_dlptr().

static VALUE rb_dlptr_plus ( VALUE  self,
VALUE  other 
) [static]

Definition at line 446 of file cptr.c.

References NUM2LONG(), ptr_data::ptr, rb_dlptr2cptr(), rb_dlptr_new(), RPTR_DATA, and size.

Referenced by Init_dlptr().

VALUE rb_dlptr_ptr ( VALUE  self  ) 

Definition at line 244 of file cptr.c.

References ptr_data::ptr, rb_dlptr_new(), and TypedData_Get_Struct.

Referenced by Init_dlptr().

VALUE rb_dlptr_ref ( VALUE  self  ) 

Definition at line 259 of file cptr.c.

References ptr_data::ptr, rb_dlptr_new(), and TypedData_Get_Struct.

Referenced by Init_dlptr().

static VALUE rb_dlptr_s_allocate ( VALUE  klass  )  [static]

Definition at line 112 of file cptr.c.

References ptr_data::free, ptr_data::ptr, rb_secure(), ptr_data::size, and TypedData_Make_Struct.

Referenced by Init_dlptr().

static VALUE rb_dlptr_s_malloc ( int  argc,
VALUE  argv[],
VALUE  klass 
) [static]

Definition at line 186 of file cptr.c.

References get_freefunc(), NUM2LONG(), rb_bug(), rb_dlptr_malloc(), rb_scan_args(), and size.

Referenced by Init_dlptr().

static VALUE rb_dlptr_s_to_ptr ( VALUE  self,
VALUE  val 
) [static]
static VALUE rb_dlptr_size_get ( VALUE  self  )  [static]

Definition at line 569 of file cptr.c.

References LONG2NUM, RPTR_DATA, and size.

Referenced by Init_dlptr().

static VALUE rb_dlptr_size_set ( VALUE  self,
VALUE  size 
) [static]

Definition at line 557 of file cptr.c.

References NUM2LONG(), and RPTR_DATA.

Referenced by Init_dlptr().

static VALUE rb_dlptr_to_i ( VALUE  self  )  [static]

Definition at line 216 of file cptr.c.

References ptr_data::ptr, PTR2NUM, and TypedData_Get_Struct.

Referenced by Init_dlptr().

static VALUE rb_dlptr_to_s ( int  argc,
VALUE  argv[],
VALUE  self 
) [static]
static VALUE rb_dlptr_to_str ( int  argc,
VALUE  argv[],
VALUE  self 
) [static]
static VALUE rb_dlptr_to_value ( VALUE  self  )  [static]

Definition at line 230 of file cptr.c.

References ptr_data::ptr, and TypedData_Get_Struct.

Referenced by Init_dlptr().


Variable Documentation

Initial value:
 {
    "dl/ptr",
    0, dlptr_free, dlptr_memsize,
}

Definition at line 44 of file cptr.c.

ID id_to_ptr [static]

Definition at line 24 of file cptr.c.

Referenced by Init_dlptr(), and rb_dlptr_s_to_ptr().