VALUE rb_dir_entries_bang( VALUE self) { VALUE e; e = rb_funcall( self, rb_intern( "entries"), 0); rb_ary_delete( e, rb_str_new( ".", 1)); rb_ary_delete( e, rb_str_new( "..", 2)); return e; }
// // When a window is finished, call this to delete it from the master // list. Returns 1 if all windows are gone. // int shoes_app_remove(shoes_app *app) { shoes_app_clear(app); rb_ary_delete(shoes_world->apps, app->self); return (RARRAY_LEN(shoes_world->apps) == 0); }
static VALUE layout_delete_snap_child(VALUE self, VALUE spr) { VALUE layout = get_layout(self); VALUE snap = *(RSTRUCT_PTR(layout)+3); VALUE children = *(RSTRUCT_PTR(snap)+1); if(TYPE(spr) == T_ARRAY) { int i; for(i=0; i<RARRAY_LEN(spr); i++){ rb_ary_delete(children, *(RARRAY_PTR(spr) + i)); } } else { rb_ary_delete(children, spr); } return self; }
static void boxed_class_converter_free(gpointer user_data) { BoxedInstance2RObjData *data = user_data; rb_ary_delete(data->rb_converters, data->rb_converter); g_free(data); }
/* Module initializer */ void rb_init_apache_multival() { VALUE dmethods; VALUE args[1]; /* Kluge to make Rdoc see the associations in this file */ #if FOR_RDOC_PARSER rb_mApache = rb_define_module( "Apache" ); #endif rb_cApacheMultiVal = rb_define_class_under( rb_mApache, "MultiVal", rb_cObject ); /* Define IDs which indicate to the delegator-creator whether it's supposed to delegate to the whole array or just the first element. */ stringish = rb_intern("stringish"); arrayish = rb_intern("arrayish"); /* Since rb_load_path isn't yet set up, we have to set up our own delegation instead of relying on 'forwardable'. Set up stringish delegation first. */ args[0] = Qfalse; dmethods = rb_class_instance_methods( 1, args, rb_cString ); rb_ary_delete( dmethods, rb_str_new2("each") ); rb_ary_delete( dmethods, rb_str_new2("[]") ); rb_ary_delete( dmethods, rb_str_new2("[]=") ); /* TODO: avoid SEGV */ #if 0 rb_iterate( rb_each, dmethods, multival_make_delegator, stringish ); /* Now set up array-ish delegation */ dmethods = rb_class_instance_methods( 1, args, rb_cArray ); rb_iterate( rb_each, dmethods, multival_make_delegator, arrayish ); #endif /* include Comparable */ rb_include_module( rb_cApacheMultiVal, rb_mComparable ); /* Instance methods */ rb_define_method( rb_cApacheMultiVal, "initialize", multival_init, -2 ); rb_define_method( rb_cApacheMultiVal, "to_s", multival_to_s, 0 ); rb_define_method( rb_cApacheMultiVal, "to_str", multival_to_s, 0 ); rb_define_alias ( rb_cApacheMultiVal, "as_string", "to_s" ); rb_define_method( rb_cApacheMultiVal, "to_a", multival_to_a, 0 ); rb_define_method( rb_cApacheMultiVal, "to_ary", multival_to_a, 0 ); rb_define_alias ( rb_cApacheMultiVal, "as_array", "to_a" ); rb_define_method( rb_cApacheMultiVal, "<=>", multival_compare, 1 ); }
static int env_replace_i(VALUE key, VALUE val, VALUE keys) { if (key != Qundef) { env_aset(Qnil, 0, key, val); if (rb_ary_includes(keys, key)) { rb_ary_delete(keys, key); } } return ST_CONTINUE; }
static VALUE node_delete_child(VALUE rcv, SEL sel, VALUE child) { struct ruby_css_node *node = NODE(rcv); if (rb_ary_delete(node->children, child) != Qnil) { node->node->children_count--; NODE(child)->parent = Qnil; return child; } return Qnil; }
static void __gcpool_RubyFunc_del(VALUE val) { if (_gcpool_RubyFunc == Qnil) { rb_warn("Trying to remove object from empty GC queue RubyFunc"); return; } rb_ary_delete(_gcpool_RubyFunc, val); // If nothing is referenced, don't keep an empty array in the pool... if (RARRAY(_gcpool_RubyFunc)->len == 0) _gcpool_RubyFunc = Qnil; }
void TimerEvent::unregister_callback(VALUE proc) { RAGE_CHECK_DISPOSED(disposed); if (TYPE(rb_ary_includes(timer_observer, proc)) == T_TRUE) { if (rb_class_of(proc) != rb_cProc) rb_raise(rb_eTypeError, RAGE_RB_PROC_ERROR); else rb_ary_delete(timer_observer, proc); } }
static VALUE Sprite_dispose(VALUE self) { Sprite *sprite = EXT_SPRITE(self); if(!sprite->disposed) { VALUE sprites = rb_ivar_get(mGraphics, rb_intern("@sprites")); rb_ary_delete(sprites, self); Rect__remove_ref(sprite->src_rect, self); old_call(self, rb_intern("dispose"), 0, NULL); sprite->disposed = 1; } return self; }
static void rb_mutex_unlock0(VALUE self, bool assert_unlockable, bool delete_from_thread_mutexes) { rb_vm_mutex_t *m = GetMutexPtr(self); bool ok = rb_mutex_can_unlock(m, assert_unlockable); if (ok) { if (delete_from_thread_mutexes) { assert(m->thread->mutexes != Qnil); rb_ary_delete(m->thread->mutexes, self); } pthread_assert(pthread_mutex_unlock(&m->mutex)); m->thread = NULL; } }
void rb_thread_remove_from_group(VALUE thread) { rb_vm_thread_t *t = GetThreadPtr(thread); if (t->group != Qnil) { rb_thread_group_t *tg = GetThreadGroupPtr(t->group); thgroup_lock(tg); if (rb_ary_delete(tg->threads, thread) != thread) { printf("trying to remove a thread (%p) from a group that doesn't "\ "contain it\n", (void *)thread); abort(); } thgroup_unlock(tg); t->group = Qnil; } }
/* * call-seq: * poller.remove(pollitem) => boolean * * Removes a poll item from this poller. Deregisters the socket for *any* previously registered events. * Note that we match on both poll items as well as pollable entities for all registered poll items. * * === Examples * * poller = ZMQ::Poller.new => ZMQ::Poller * poller.register(req) => true * poller.remove(req) => true * */ VALUE rb_czmq_poller_remove(VALUE obj, VALUE pollable) { int pos; VALUE rpollable; ZmqGetPoller(obj); pollable = rb_czmq_pollitem_coerce(pollable); ZmqGetPollitem(pollable); for (pos = 0; pos < poller->poll_size; pos++) { rpollable = rb_ary_entry(poller->pollables, (long)pos); if (pollable == rpollable || rb_czmq_pollitem_pollable(pollable) == rb_czmq_pollitem_pollable(rpollable)) { rb_ary_delete(poller->pollables, rpollable); poller->poll_size--; poller->dirty = TRUE; return rpollable; } } return Qfalse; }
/** * This function is invoked by a Transaction object whenever it is committed or * rolled back. The connection can then discount the Transaction from its list * of transaction to be cleaned up and close time. * * @param connection A reference to the Connection object or an array of * Connection objects that is to be informed about the * transaction. * @param transaction A reference to the Transaction object that is to be * released. * */ void rb_tx_released(VALUE connection, VALUE transaction) { VALUE array = TYPE(connection) == T_ARRAY ? connection : rb_ary_new(), number = Qnil; long size = 0, index; if(TYPE(connection) != T_ARRAY) { rb_ary_push(array, connection); } number = rb_funcall(array, rb_intern("size"), 0); size = TYPE(number) == T_FIXNUM ? FIX2INT(number) : NUM2INT(number); for(index = 0; index < size; index++) { VALUE entry = rb_ary_entry(array, index), list = rb_iv_get(entry, "@transactions"); rb_ary_delete(list, transaction); } }
static VALUE thgroup_add_m(VALUE group, VALUE thread, bool check_enclose) { if (OBJ_FROZEN(group)) { rb_raise(rb_eThreadError, "can't move to the frozen thread group"); } rb_vm_thread_t *t = GetThreadPtr(thread); rb_thread_group_t *new_tg = GetThreadGroupPtr(group); if (new_tg->enclosed && check_enclose) { rb_raise(rb_eThreadError, "can't move from the enclosed thread group"); } if (t->group != Qnil) { if (OBJ_FROZEN(t->group)) { rb_raise(rb_eThreadError, "can't move from the frozen thread group"); } rb_thread_group_t *old_tg = GetThreadGroupPtr(t->group); if (old_tg->enclosed && check_enclose) { rb_raise(rb_eThreadError, "can't move from the enclosed thread group"); } thgroup_lock(old_tg); rb_ary_delete(old_tg->threads, thread); thgroup_unlock(old_tg); } thgroup_lock(new_tg); rb_ary_push(new_tg->threads, thread); thgroup_unlock(new_tg); GC_WB(&t->group, group); return group; }
static VALUE thgroup_add(VALUE group, SEL sel, VALUE thread) { rb_vm_thread_t *t = GetThreadPtr(thread); rb_thread_group_t *new_tg = GetThreadGroupPtr(group); if (new_tg->enclosed) { rb_raise(rb_eThreadError, "can't move from the enclosed thread group"); } if (t->group != Qnil) { rb_thread_group_t *old_tg = GetThreadGroupPtr(t->group); if (old_tg->enclosed) { rb_raise(rb_eThreadError, "can't move from the enclosed thread group"); } rb_ary_delete(old_tg->threads, thread); } rb_ary_push(new_tg->threads, thread); GC_WB(&t->group, group); return group; }
static VALUE queue_delete_from_waiting(struct waiting_delete *p) { rb_ary_delete(p->waiting, p->th); return Qnil; }
static void rb_remove_feature(VALUE feature) { rb_ary_delete(get_loaded_features(), feature); }
void qgf_graphics_remove_object(ruby_value object) { ruby_value arr = rb_cv_get(rb_mGraphics, "@@drawable_objects"); rb_ary_delete(arr, object); qgf_array_remove(&qgf_graphics_object_array, object); }
void Objects::free_object(VALUE object) { rb_ary_delete(objects, object); }
static VALUE array_spec_rb_ary_delete(VALUE self, VALUE array, VALUE item) { return rb_ary_delete(array, item); }
VALUE require_compiled(VALUE fname, VALUE* result, int bLoad) { VALUE path; char* szName1 = 0; VALUE retval = Qtrue; if (TYPE(fname) != T_STRING) rb_raise(rb_eLoadError, "can not load non-string"); szName1 = RSTRING_PTR(fname); if ( String_endsWith(szName1,".rb") ) { rb_str_chop_bang(fname); rb_str_chop_bang(fname); rb_str_chop_bang(fname); } //rb_funcall(fname, rb_intern("sub!"), 2, rb_str_new2(".rb"), rb_str_new2("") ); szName1 = RSTRING_PTR(fname); if ( strcmp("strscan",szName1)==0 || strcmp("enumerator",szName1)==0 || strcmp("stringio",szName1)==0 || strcmp("socket",szName1)==0 ) return Qtrue; RHO_LOCK(require_lock); if ( !bLoad && isAlreadyLoaded(fname) == Qtrue ) goto RCompExit; path = find_file(fname); if ( path != 0 ) { VALUE seq; RAWLOG_INFO1("require_compiled: %s", szName1); //optimize require //rb_ary_push(GET_VM()->loaded_features, path); rb_ary_push(GET_VM()->loaded_features, fname); #ifdef RHODES_EMULATOR if ( strstr( RSTRING_PTR(path), ".rb") == 0 ) rb_str_cat(path,".rb",3); GET_VM()->src_encoding_index = rb_utf8_encindex(); rb_load(path, 0); if( rho_simconf_getBool("reload_app_changes") ) { if ( strncmp( RSTRING_PTR(path), rho_native_rhopath(), strlen(rho_native_rhopath()) ) == 0 ) rb_ary_delete(GET_VM()->loaded_features, fname); } #else //rb_gc_disable(); seq = loadISeqFromFile(path); //*result = rb_funcall(seq, rb_intern("eval"), 0 ); *result = rb_iseq_eval(seq); //rb_gc_enable(); #endif goto RCompExit; } RAWLOG_ERROR1("require_compiled: error: can not find %s", RSTRING_PTR(fname)); retval = Qnil; RCompExit: RHO_UNLOCK(require_lock); return retval; }
static VALUE delete_current_thread(VALUE ary) { return rb_ary_delete(ary, rb_thread_current()); }