static VALUE sa_array_clear(VALUE self, VALUE array) { return rb_ary_clear(array); }
void TimerEvent::clear(void) { RAGE_CHECK_DISPOSED(disposed); rb_ary_clear(timer_observer); }
int main( int argc, char** argv ) { int state = 0; int rc = 0; int opt_mv = 0; crate_app ca; /** startup items from ruby's original main.c */ #ifdef _WIN32 NtInitialize(&argc, &argv); #endif #if defined(__MACOS__) && defined(__MWERKS__) argc = ccommand(&argv); #endif /* setup ruby */ ruby_init(); ruby_script( argv[0] ); ruby_init_loadpath(); /* strip out the crate specific arguments from argv using --crate- */ opt_mv = crate_init_from_options( &ca, argc, argv ); argc -= opt_mv; argv += opt_mv; /* printf("crate file : %s\n", ca.file_name); */ /* printf("crate class : %s\n", ca.class_name); */ /* printf("crate method: %s\n", ca.method_name); */ /* make ARGV available */ ruby_set_argv( argc, argv ); /* initialize all extensions */ Init_ext(); /* load up the amalgalite libs */ am_bootstrap_lift( cARB, Qnil ); /* remove the current LOAD_PATH */ rb_ary_clear( rb_gv_get( "$LOAD_PATH" ) ); /* invoke the class / method passing in ARGV and ENV */ rb_protect( crate_wrap_app, (VALUE)&ca, &state ); /* check the results */ if ( state ) { /* exception was raised, check the $! var */ VALUE lasterr = rb_gv_get("$!"); /* system exit was called so just propogate that up to our exit */ if ( rb_obj_is_instance_of( lasterr, rb_eSystemExit ) ) { rc = NUM2INT( rb_attr_get( lasterr, rb_intern("status") ) ); /*printf(" Caught SystemExit -> $? will be %d\n", rc ); */ } else { /* some other exception was raised so dump that out */ VALUE klass = rb_class_path( CLASS_OF( lasterr ) ); VALUE message = rb_obj_as_string( lasterr ); VALUE backtrace = rb_funcall( lasterr, rb_intern("backtrace"), 0 ); fprintf( stderr, "%s: %s\n", RSTRING( klass )->ptr, RSTRING( message )->ptr ); rb_iterate( rb_each, backtrace, dump_backtrace, Qnil ); rc = state; } } free( ca.file_name ); free( ca.class_name ); free( ca.method_name ); /* shut down ruby */ ruby_finalize(); /* exit the program */ exit( rc ); }