ext/fiddle/closure.c File Reference

#include <fiddle.h>

Go to the source code of this file.

Data Structures

struct  fiddle_closure

Defines

#define USE_FFI_CLOSURE_ALLOC   1

Functions

static void dealloc (void *ptr)
static size_t closure_memsize (const void *ptr)
void callback (ffi_cif *cif, void *resp, void **args, void *ctx)
static VALUE allocate (VALUE klass)
static VALUE initialize (int rbargc, VALUE argv[], VALUE self)
static VALUE to_i (VALUE self)
void Init_fiddle_closure ()

Variables

VALUE cFiddleClosure
const rb_data_type_t closure_data_type


Define Documentation

#define USE_FFI_CLOSURE_ALLOC   1

Definition at line 20 of file closure.c.


Function Documentation

static VALUE allocate ( VALUE  klass  )  [static]

Definition at line 172 of file closure.c.

References closure_data_type, fiddle_closure::code, NULL, fiddle_closure::pcl, TypedData_Make_Struct, and VALUE.

Referenced by Init_fiddle_closure(), Init_fiddle_function(), Init_psych_emitter(), and Init_psych_parser().

void callback ( ffi_cif *  cif,
void *  resp,
void **  args,
void *  ctx 
)

Definition at line 59 of file closure.c.

References argc, INT2NUM, LONG2NUM, mFiddle, NUM2DBL, NUM2INT, NUM2LONG, NUM2PTR, NUM2UINT, NUM2ULONG, PTR2NUM, RARRAY_LENINT, RARRAY_PTR, rb_ary_push(), rb_ary_tmp_new(), rb_const_get(), rb_eRuntimeError, rb_float_new, rb_funcall(), rb_funcall2, RB_GC_GUARD, rb_intern, rb_iv_get(), rb_raise(), type, TYPE_CHAR, TYPE_DOUBLE, TYPE_FLOAT, TYPE_INT, TYPE_LONG, TYPE_SHORT, TYPE_VOID, TYPE_VOIDP, UINT2NUM, ULONG2NUM, and VALUE.

Referenced by initialize(), and transcode_search_path().

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

Definition at line 37 of file closure.c.

References fiddle_closure::argv, fiddle_closure::cif, and size.

static void dealloc ( void *  ptr  )  [static]

Definition at line 24 of file closure.c.

References fiddle_closure::argv, fiddle_closure::pcl, and xfree.

Referenced by allocate().

void Init_fiddle_closure (  ) 

Definition at line 263 of file closure.c.

References allocate(), cFiddleClosure, initialize(), mFiddle, rb_cObject, rb_define_alloc_func(), rb_define_class_under(), rb_define_method(), rb_define_module(), and to_i().

Referenced by Init_fiddle().

static VALUE initialize ( int  rbargc,
VALUE  argv[],
VALUE  self 
) [static]

Definition at line 190 of file closure.c.

References argc, args, fiddle_closure::argv, callback(), Check_Type, fiddle_closure::cif, closure_data_type, fiddle_closure::code, INT2FFI_TYPE, INT2NUM, NULL, NUM2INT, fiddle_closure::pcl, RARRAY_LENINT, RARRAY_PTR, rb_eRuntimeError, rb_iv_set(), rb_raise(), rb_scan_args(), rb_sys_fail(), result, T_ARRAY, type, TypedData_Get_Struct, VALUE, and xcalloc.

Referenced by Init_fiddle_closure(), Init_fiddle_function(), and Init_psych_emitter().

static VALUE to_i ( VALUE  self  )  [static]

Definition at line 250 of file closure.c.

References closure_data_type, fiddle_closure::code, PTR2NUM, and TypedData_Get_Struct.

Referenced by Init_fiddle_closure().


Variable Documentation

VALUE cFiddleClosure

Definition at line 3 of file closure.c.

Referenced by Init_fiddle_closure().

const rb_data_type_t closure_data_type

Initial value:

 {
    "fiddle/closure",
    {0, dealloc, closure_memsize,},
}

Definition at line 53 of file closure.c.

Referenced by allocate(), initialize(), and to_i().


Generated on 19 Jul 2016 for Ruby by  doxygen 1.4.7