Ruby 2.0.0p353(2013-11-22revision43784)

- Main Page
- Modules
- Data Structures
- Files

- File List
- Globals

Data Structures | Macros | Functions | Variables
handle.c File Reference
`#include <ruby.h>`
`#include <fiddle.h>`
Include dependency graph for handle.c:

Go to the source code of this file.

## Data Structures
struct | dl_handle

## Macros
#define | RTLD_NEXT NULL
#define | RTLD_DEFAULT NULL
#define | CHECK_DLERROR

## Functions
static void | fiddle_handle_free (void *ptr)
static size_t | fiddle_handle_memsize (const void *ptr)
static VALUE | rb_fiddle_handle_close (VALUE self)
static VALUE | rb_fiddle_handle_s_allocate (VALUE klass)
static VALUE | predefined_fiddle_handle (void *handle)
static VALUE | rb_fiddle_handle_initialize (int argc, VALUE argv[], VALUE self)
static VALUE | rb_fiddle_handle_enable_close (VALUE self)
static VALUE | rb_fiddle_handle_disable_close (VALUE self)
static VALUE | rb_fiddle_handle_close_enabled_p (VALUE self)
static VALUE | rb_fiddle_handle_to_i (VALUE self)
static VALUE | fiddle_handle_sym (void *handle, const char *symbol)
static VALUE | rb_fiddle_handle_sym (VALUE self, VALUE sym)
static VALUE | rb_fiddle_handle_s_sym (VALUE self, VALUE sym)
void | Init_fiddle_handle (void)

## Variables
VALUE | rb_cHandle
static const rb_data_type_t | fiddle_handle_data_type

## Macro Definition Documentation

#define CHECK_DLERROR

Referenced by fiddle_handle_sym().

#define RTLD_DEFAULT NULL

Definition at line 283 of file handle.c.

Referenced by Init_fiddle_handle().

#define RTLD_NEXT NULL

Definition at line 280 of file handle.c.

Referenced by Init_fiddle_handle(), and rb_fiddle_handle_s_sym().

## Function Documentation

static void fiddle_handle_free | ( | void * | ptr | ) |
| static

Definition at line 37 of file handle.c.

References dl_handle::enable_close, dl_handle::open, dl_handle::ptr, and ptr.

static size_t fiddle_handle_memsize | ( | const void * | ptr | ) |
| static

Definition at line 46 of file handle.c.

static VALUE fiddle_handle_sym | ( | void * | handle,
|  | const char * | symbol
| ) |  |
| static

Definition at line 303 of file handle.c.

References CHECK_DLERROR, err, func, i, int, len, memcpy(), PTR2NUM, rb_eFiddleError, rb_raise(), rb_secure(), strcpy(), strlen(), void, xfree, xmalloc, and xrealloc.

Referenced by rb_fiddle_handle_s_sym(), and rb_fiddle_handle_sym().

void Init_fiddle_handle | ( | void |  | ) |

Definition at line 368 of file handle.c.

References INT2NUM, mFiddle, predefined_fiddle_handle(), rb_cHandle, rb_cObject, rb_define_alloc_func(), rb_define_class_under(), rb_define_const(), rb_define_method(), rb_define_singleton_method(), rb_fiddle_handle_close(), rb_fiddle_handle_close_enabled_p(), rb_fiddle_handle_disable_close(), rb_fiddle_handle_enable_close(), rb_fiddle_handle_initialize(), rb_fiddle_handle_s_allocate(), rb_fiddle_handle_s_sym(), rb_fiddle_handle_sym(), rb_fiddle_handle_to_i(), RTLD_DEFAULT, and RTLD_NEXT.

Referenced by Init_fiddle().

static VALUE predefined_fiddle_handle | ( | void * | handle | ) |
| static

Definition at line 103 of file handle.c.

References DATA_PTR(), obj, OBJ_FREEZE, dl_handle::open, dl_handle::ptr, rb_cHandle, and rb_fiddle_handle_s_allocate().

Referenced by Init_fiddle_handle().

static VALUE rb_fiddle_handle_close | ( | VALUE | self | ) |
| static

Definition at line 64 of file handle.c.

References fiddle_handle_data_type, INT2NUM, dl_handle::open, dl_handle::ptr, rb_eFiddleError, rb_raise(), ret, TypedData_Get_Struct, and UNREACHABLE.

Referenced by Init_fiddle_handle(), and rb_fiddle_handle_initialize().

static VALUE rb_fiddle_handle_close_enabled_p | ( | VALUE | self | ) |
| static

Definition at line 233 of file handle.c.

References dl_handle::enable_close, fiddle_handle_data_type, Qfalse, Qtrue, and TypedData_Get_Struct.

Referenced by Init_fiddle_handle().

static VALUE rb_fiddle_handle_disable_close | ( | VALUE | self | ) |
| static

Definition at line 216 of file handle.c.

References dl_handle::enable_close, fiddle_handle_data_type, Qnil, and TypedData_Get_Struct.

Referenced by Init_fiddle_handle().

static VALUE rb_fiddle_handle_enable_close | ( | VALUE | self | ) |
| static

Definition at line 201 of file handle.c.

References dl_handle::enable_close, fiddle_handle_data_type, Qnil, and TypedData_Get_Struct.

Referenced by Init_fiddle_handle().

static VALUE rb_fiddle_handle_initialize | ( | int | argc,
|  | VALUE | argv[],
|  | VALUE | self
| ) |  |
| static

Definition at line 122 of file handle.c.

References dl_handle::enable_close, err, fiddle_handle_data_type, flag, NIL_P(), NULL, NUM2INT, dl_handle::open, dl_handle::ptr, ptr, Qnil, rb_block_given_p(), rb_bug(), rb_eFiddleError, rb_ensure(), rb_fiddle_handle_close(), rb_raise(), rb_scan_args(), rb_secure(), rb_yield(), STRCASECMP, StringValuePtr, and TypedData_Get_Struct.

Referenced by Init_fiddle_handle().

static VALUE rb_fiddle_handle_s_allocate | ( | VALUE | klass | ) |
| static

Definition at line 89 of file handle.c.

References dl_handle::enable_close, fiddle_handle_data_type, obj, dl_handle::open, dl_handle::ptr, rb_cHandle, and TypedData_Make_Struct.

Referenced by Init_fiddle_handle(), and predefined_fiddle_handle().

static VALUE rb_fiddle_handle_s_sym | ( | VALUE | self,
|  | VALUE | sym
| ) |  |
| static

Definition at line 297 of file handle.c.

References fiddle_handle_sym(), RTLD_NEXT, and StringValueCStr.

Referenced by Init_fiddle_handle().

static VALUE rb_fiddle_handle_sym | ( | VALUE | self,
|  | VALUE | sym
| ) |  |
| static

Definition at line 267 of file handle.c.

References fiddle_handle_data_type, fiddle_handle_sym(), dl_handle::open, dl_handle::ptr, rb_eFiddleError, rb_raise(), StringValueCStr, and TypedData_Get_Struct.

Referenced by Init_fiddle_handle().

static VALUE rb_fiddle_handle_to_i | ( | VALUE | self | ) |
| static

Definition at line 249 of file handle.c.

References fiddle_handle_data_type, PTR2NUM, and TypedData_Get_Struct.

Referenced by Init_fiddle_handle().

## Variable Documentation

const rb_data_type_t fiddle_handle_data_type
| static

Initial value:
= {
"fiddle/handle",
{0, fiddle_handle_free, fiddle_handle_memsize,},
}
fiddle_handle_memsize
static size_t fiddle_handle_memsize(const void *ptr)
Definition: handle.c:46
fiddle_handle_free
static void fiddle_handle_free(void *ptr)
Definition: handle.c:37

Definition at line 51 of file handle.c.

Referenced by rb_fiddle_handle_close(), rb_fiddle_handle_close_enabled_p(), rb_fiddle_handle_disable_close(), rb_fiddle_handle_enable_close(), rb_fiddle_handle_initialize(), rb_fiddle_handle_s_allocate(), rb_fiddle_handle_sym(), and rb_fiddle_handle_to_i().

VALUE rb_cHandle

Definition at line 4 of file handle.c.

Referenced by Init_fiddle_handle(), predefined_fiddle_handle(), and rb_fiddle_handle_s_allocate().