Exemplo n.º 1
0
Arquivo: ruby.c Projeto: filp/slash
static sl_ruby_object_t*
get_ruby_object(sl_vm_t* vm, SLVAL obj)
{
    SLVAL Ruby_Object = sl_vm_store_get(vm, &cRuby_Object);
    sl_expect(vm, obj, Ruby_Object);
    return (sl_ruby_object_t*)sl_get_ptr(obj);
}
Exemplo n.º 2
0
Arquivo: ruby.c Projeto: filp/slash
static SLVAL
make_ruby_object(sl_vm_t* vm, VALUE ruby_value)
{
    SLVAL Ruby_Object = sl_vm_store_get(vm, &cRuby_Object);
    SLVAL robj = sl_allocate(vm, Ruby_Object);
    ((sl_ruby_object_t*)sl_get_ptr(robj))->obj = ruby_value;
    return robj;
}
Exemplo n.º 3
0
static gcrypt_algorithm_t*
get_algo(sl_vm_t* vm, SLVAL obj)
{
    SLVAL klass = sl_vm_store_get(vm, &cGCrypt_Algorithm);
    gcrypt_algorithm_t* ptr;
    sl_expect(vm, obj, klass);
    ptr = (gcrypt_algorithm_t*)sl_get_ptr(obj);
    return ptr;
}
Exemplo n.º 4
0
Arquivo: ruby.c Projeto: filp/slash
static void
sl_ruby_protect(sl_vm_t* vm, void(*func)(sl_vm_t*,void*), void* data)
{
    struct sl_ruby_protect_args args = { vm, data, func, 0, { 0 } };
    sl_vm_frame_t frame;
    pthread_mutex_lock(&sl_ruby_lock);
    SL_ENSURE(frame, {
        rb_rescue2(sl_ruby_protect_try, (VALUE)&args, sl_ruby_protect_catch, (VALUE)&args, rb_eException, 0);
        pthread_mutex_unlock(&sl_ruby_lock);
        if(args.exception) {
            SLVAL Ruby_Exception = sl_vm_store_get(vm, &cRuby_Exception);
            SLVAL err = sl_allocate(vm, Ruby_Exception);
            sl_error_set_message(vm, err, sl_ruby_to_slash(vm, rb_obj_as_string(args.exception)));
            sl_set_ivar(vm, err, sl_intern(vm, "object"), make_ruby_object(vm, args.exception));
            args.sl_exception = err;
        }
    }, {
Exemplo n.º 5
0
static sl_response_internal_opts_t*
response(sl_vm_t* vm)
{
    return (sl_response_internal_opts_t*)sl_get_ptr(sl_vm_store_get(vm, &Response_opts));
}
Exemplo n.º 6
0
static sl_request_internal_opts_t*
request(sl_vm_t* vm)
{
    return (sl_request_internal_opts_t*)sl_get_ptr(sl_vm_store_get(vm, &Request_opts));
}