closure.c File Reference
`#include <fiddle.h>`

Go to the source code of this file.

## Data Structures

struct | fiddle_closure

## 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

## Function Documentation

static VALUE allocate | ( | VALUE | klass | ) |

static

Definition at line 166 of file closure.c.

References fiddle_closure::code, i, NULL, fiddle_closure::pcl, and TypedData_Make_Struct.

Referenced by Init_fiddle_closure().

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

Definition at line 53 of file closure.c.

References argc, i, 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(), and ULONG2NUM().

Referenced by initialize(), rb_objspace_each_objects(), and transcode_search_path().

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

static

Definition at line 31 of file closure.c.

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

static void dealloc | ( | void * | ptr | ) |

static

Definition at line 18 of file closure.c.

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

void Init_fiddle_closure | ( |  | ) |

Definition at line 254 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 184 of file closure.c.

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

Referenced by Init_fiddle_closure().

static VALUE to_i | ( | VALUE | self | ) |

static

Definition at line 241 of file closure.c.

References 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 47 of file closure.c.