int proxenet_ruby_initialize_vm(plugin_t* plugin) { interpreter_t *interpreter; interpreter = plugin->interpreter; /* checks */ if (interpreter->ready) return 0; #ifdef DEBUG xlog(LOG_DEBUG, "Initializing Ruby VM version %s\n", _RUBY_VERSION_); #endif /* init vm */ ruby_init(); interpreter->vm = (void*) rb_mKernel; ruby_script(PROGNAME); ruby_init_loadpath(); interpreter->ready = true; return 0; }
int main(int argc, char **argv) { int nRes = 0; #ifdef RUBY_DEBUG_ENV ruby_set_debug_option(getenv("RUBY_DEBUG")); #endif #ifdef HAVE_LOCALE_H setlocale(LC_CTYPE, ""); #endif // MessageBox(0,"","",MB_OK); ruby_sysinit(&argc, &argv); { RUBY_INIT_STACK; ruby_init(); Init_strscan(); Init_sqlite3_api(); Init_SyncEngine(); Init_System(); //Init_prelude(); rb_define_global_function("__rho_compile", __rho_compile, 1); nRes = ruby_run_node(ruby_options(argc, argv)); } return nRes; }
static bool init_rb(rb_internal_t*rb) { if(rb_reference_count==0) { ruby_init(); } rb_reference_count++; }
void RubyInterpreter::initRuby() { d = new RubyInterpreterPrivate(); ruby_init(); ruby_init_loadpath(); rb_define_global_function("require", (VALUE (*)(...))RubyInterpreter::require, 1); }
int main(int argc, char **argv, char **envp) { #ifdef HAVE_LOCALE_H setlocale(LC_CTYPE, ""); #endif ruby_is_miniruby = argc > 0 && strstr(argv[0], "miniruby") != NULL; try { ruby_sysinit(&argc, &argv); ruby_init(); void *node = ruby_options(argc, argv); rb_vm_init_compiler(); if (ruby_aot_compile) { rb_vm_aot_compile((NODE *)node); rb_exit(0); } else { rb_exit(ruby_run_node(node)); } } catch (...) { rb_vm_print_current_exception(); rb_exit(1); } }
int initrb_start(int argc, char **argv, initrb_boot_fn_t boot) { int ret = 0; { /* Initialize the stack */ RUBY_INIT_STACK; /* Initialize the interpreter */ ruby_init(); /* Initialize the loadpath */ ruby_init_loadpath(); /* We're initrb */ ruby_script("initrb"); /* Set the argv */ ruby_set_argv(argc, argv); /* Boot statics */ initrb_boot_statics(); /* Run */ ret = boot(argc, argv); /* Finalize the interpreter */ ruby_finalize(); } return ret; }
int main(int argc, char *argv[]) { int ret; const char *script = argv[1]; if (script == NULL) { script = //"alphadraw.rb"; "alpha.rb"; //"aadraw.rb"; //"test_fib.rb"; } ruby_debug = Qtrue; ruby_verbose = Qtrue; ruby_init(); ruby_init_loadpath(); ruby_script(script); rb_load_file(script); ret = ruby_cleanup(ruby_exec()); //exit(ret); return(ret); }
int main(int argc,char *argv[]) { ruby_init(); ruby_options(argc,argv); ruby_run(); return 0; }
int eruta_ruby_init() { VALUE options = Qnil, sublet = Qnil; void Init_prelude(void); RUBY_INIT_STACK; ruby_init(); ruby_init_loadpath(); ruby_script("eruta"); #ifdef HAVE_RB_ENC_SET_DEFAULT_INTERNAL { VALUE encoding = Qnil; /* FIXME: Fix for ruby 1.9.2p429 borrowed from ruby? */ (void)rb_filesystem_encoding(); /* Set encoding */ encoding = rb_enc_from_encoding(rb_locale_encoding()); rb_enc_set_default_external(encoding); } #endif /* HAVE_RB_ENC_SET_DEFAULT_INTERNAL */ /* FIXME: Fake ruby_init_gems(Qtrue) */ rb_define_module("Gem"); Init_prelude(); /* Bypassing garbage collection. Why? */ /* shelter = rb_ary_new(); rb_gc_register_address(&shelter); */ }
shoes_code shoes_init(SHOES_INIT_ARGS) { #ifdef SHOES_GTK gtk_init(NULL, NULL); #endif #ifdef SHOES_WIN32 INITCOMMONCONTROLSEX InitCtrlEx; InitCtrlEx.dwSize = sizeof(INITCOMMONCONTROLSEX); InitCtrlEx.dwICC = ICC_PROGRESS_CLASS; InitCommonControlsEx(&InitCtrlEx); #else signal(SIGINT, shoes_sigint); signal(SIGQUIT, shoes_sigint); #endif ruby_init(); shoes_ruby_init(); shoes_world = shoes_world_alloc(); #ifdef SHOES_QUARTZ shoes_app_quartz_install(); shoes_slot_quartz_register(); if (PasteboardCreate(kPasteboardClipboard, &shoes_world->os.clip) != noErr) { INFO("Apple Pasteboard create failed.\n"); } #endif #ifdef SHOES_WIN32 shoes_world->os.instance = inst; shoes_world->os.style = style; shoes_classex_init(); #endif return SHOES_OK; }
int main ( int argc, char * * argv ) { ruby_init(); rb_eval_string("print 'Hello World\n'"); return (0); }
void InitializeInterpreter() { ruby_init(); VALUE load_path = rb_gv_get("$LOAD_PATH"); rb_ary_push(load_path, rb_str_new2(".")); Init_armagetronad(); ruby_script("Armagetron Advanced"); }
DWORD WINAPI rh_thread_proc(LPVOID lpParam) { DWORD dwWaitResult; int must_exit = 0; #ifdef DEBUG_THREADS rh_log("RubyHoldem thread %d starting\n", GetCurrentThreadId()); #endif ruby_init(); rh_safe_call("rh_load_init_script", (rh_function)rh_init_module, Qnil); while (!must_exit) { #ifdef DEBUG_THREADS rh_log("RubyHoldem thread %d waiting for event...\n", GetCurrentThreadId()); #endif dwWaitResult = WaitForSingleObject(rh_event_job, INFINITE); switch (dwWaitResult) { // Event object was signaled case WAIT_OBJECT_0: #ifdef DEBUG_THREADS rh_log("Event occured in RubyHoldem thread %d\n", GetCurrentThreadId()); #endif switch(rh_event_type) { case RH_EXIT: #ifdef DEBUG_THREADS rh_log("Event is RH_EXIT\n"); #endif must_exit = 1; break; case RH_PROCESS_MESSAGE: #ifdef DEBUG_THREADS rh_log("Event is RH_PROCESS_MESSAGE\n"); #endif rh_process_message(); break; } break; // An error occurred default: rh_log("RubyHoldem thread: Wait error (%d)\n", GetLastError()); return 0; } rh_job_done(); } ruby_finalize(); #ifdef DEBUG_THREADS rh_log("RubyHoldem thread %d finished\n", GetCurrentThreadId()); #endif return 1; }
int main( void ) { ruby_init(); rb_Rargs_define_spec(); rb_Rargs_parse_spec(); rb_Rargs_macro_spec(); }
int main(int argc, char **argv) { ruby_sysinit(&argc, &argv); { RUBY_INIT_STACK; ruby_init(); return ruby_run_node(ruby_options(argc, argv)); } }
void boot_vm() { _argc = 0; _argv = &gorby; ruby_sysinit(&_argc, &_argv); { RUBY_INIT_STACK; ruby_init(); } }
void crb_init() { int argc2 = 0; char **argv2 = NULL; ruby_sysinit(&argc2, &argv2); RUBY_INIT_STACK; ruby_init(); ruby_init_loadpath(); }
RUBY_GLOBAL_SETUP void init_ruby(void) { RUBY_INIT_STACK; ruby_init(); // FIXME: a Ruby error causes a segfault. This is because we aren't wrapping with rb_protect and re-raising in Node. // rb_funcall(rb_cObject, rb_intern("puts"), 1, rb_str_new2("Ruby initialized from within node.js")); }
static void * rpmrubyThread(void * _ruby) { rpmruby ruby = _ruby; rpmzLog zlog = ruby->zlog; int i; Trace((zlog, "-- %s: running", __FUNCTION__)); _rpmruby_ruby_to_main(ruby, Qnil); for (i = 0; i < 2; i++) _rpmruby_ruby_to_main(ruby, Qnil); { VALUE variable_in_this_stack_frame; uint8_t * b = ruby->stack; uint8_t * e = b + ruby->nstack; /* Start up the ruby interpreter. */ Trace((zlog, "-- %s: interpreter starting", __FUNCTION__)); ruby_sysinit(&ruby->ac, (char ***) &ruby->av); ruby_bind_stack((VALUE *)b, (VALUE *)e); ruby_init_stack(&variable_in_this_stack_frame); ruby_init(); ruby_init_loadpath(); /* allow Ruby script to relay */ rb_define_module_function(rb_mKernel, "relay_from_ruby_to_main", relay_from_ruby_to_main, 0); Trace((zlog, "-- %s: interpreter started", __FUNCTION__)); /* Run file.rb arguments. */ for (i = 1; i < ruby->ac; i++) { if (*ruby->av[i] == '-') /* XXX FIXME: skip options. */ continue; Trace((zlog, "-- %s: require '%s' begin", __FUNCTION__, ruby->av[i])); rpmrubyRunThreadFile(ruby, ruby->av[i], NULL); Trace((zlog, "-- %s: require '%s' end", __FUNCTION__, ruby->av[i])); } /* Terminate the ruby interpreter. */ Trace((zlog, "-- %s: interpreter terminating", __FUNCTION__)); ruby_finalize(); ruby_cleanup(0); Trace((zlog, "-- %s: interpreter terminated", __FUNCTION__)); } /* Report interpreter end to main. */ ruby->more = 0; /* Permit main thread to run without blocking. */ yarnRelease(ruby->main_coroutine_lock); Trace((zlog, "-- %s: ended", __FUNCTION__)); return NULL; }
int main(int argc, char **argv) { int i; int myargc; char** myargv; char script_path[MAXPATHLEN]; char* dump_val; DWORD attr; #ifdef HAVE_LOCALE_H setlocale(LC_CTYPE, ""); #endif dump_val = getenv("EXEFY_DUMP"); if (GetModuleFileName(NULL, script_path, MAXPATHLEN)) { for (i = strlen(script_path) - 1; i >= 0; --i) { if (*(script_path + i) == '.') { *(script_path + i) = '\0'; break; } } attr = GetFileAttributes(script_path); if (attr == INVALID_FILE_ATTRIBUTES) { printf("Script %s is missing!", script_path); return -1; } // Let Ruby initialize program arguments ruby_sysinit(&argc, &argv); // Change arguments by inserting path to script file // as second argument (first argument is always executable // name) and copying arguments from command line after it. myargc = argc + 1; myargv = (char**)xmalloc(sizeof(char*) * (myargc + 1)); memset(myargv, 0, sizeof(char*) * (myargc + 1)); *myargv = *argv; *(myargv + 1) = &script_path[0]; for (i = 1; i < argc; ++i) { *(myargv + i + 1) = *(argv + i); } if (NULL != dump_val) { dump_args(myargc, myargv); } { RUBY_INIT_STACK; ruby_init(); return ruby_run_node(ruby_options(myargc, myargv)); } } }
/* --- */ int init_ruby_parser(void) { ruby_init(); rb_define_global_function("get_row", get_row, 0); rb_define_global_function("get_col", get_col, 0); return ruby_interpreter = register_interpreter("Ruby", NULL, execute_ruby); }
void *worker_thread () { ruby_init(); pthread_mutex_lock(&worker_mutex); pthread_mutex_unlock(&caller_mutex); while (1) { pthread_cond_wait(&call_cond, &worker_mutex); perform_task(); pthread_cond_signal(&ret_cond); } }
void fs_rb_init(int argc, char** argv){ ruby_sysinit(&argc, &argv); RUBY_INIT_STACK ruby_init(); ruby_init_loadpath(); ruby_set_argv(argc, argv); Init_fsnet(); }
void xen_initialize(void) { #ifdef RUBY_INIT_STACK RUBY_INIT_STACK; #endif ruby_init(); ruby_init_loadpath(); ruby_script("xen"); /* necessary in ruby 1.9 (else segfault in rb_raise) */ Init_Hook(); }
int main() { ruby_init(); ruby_init_loadpath(); Init_Dvector(); VALUE cls = rb_eval_string("Dobjects::Dvector"); VALUE res; res = rb_eval_string("Dobjects::Dvector.fast_fancy_read" "(File.open('tmp.dat', 'r'), " "Dobjects::Dvector::FANCY_READ_DEFAULTS)"); return 0; }
int nacl_main(int argc, char **argv) { if (nacl_startup_untar(argv[0], DATA_ARCHIVE, "/")) return -1; if (argc == 2 && !strcmp(argv[1], "/bin/irb")) fprintf(stderr, "Launching irb ...\n"); ruby_sysinit(&argc, &argv); { RUBY_INIT_STACK; ruby_init(); return ruby_run_node(ruby_options(argc, argv)); } }
int main ( int argc, char ** argv) { ruby_set_debug_option(getenv("RUBY_DEBUG")); ruby_sysinit(&argc, &argv); RUBY_INIT_STACK; ruby_init(); ruby_init_loadpath(); setbuf(stdout, NULL); // disable buffering rb_protect( test_iseq, 0, & error);// call our stuff rb_protect'ed perror("ERROR"); return ruby_run_node(ruby_options(argc, argv)); ruby_finalize(); return 0; }
int main(int argc, char *argv[]) { void (*sigusr1)(int), (*sigusr2)(int); MPI_Init(&argc, &argv); /* ruby_run() calls exit() (why?), so we have to call finalize this way. */ atexit((void (*)(void))MPI_Finalize); /* Allow errors to be returned as exceptions in ruby */ MPI_Errhandler_set(MPI_COMM_WORLD, MPI_ERRORS_RETURN); /* This seems legitimate because comms can be passed by value to fns. */ self = malloc(sizeof(MPI_Comm)); if (self == NULL) { perror("Unable to allocate MPI::Comm::SELF"); MPI_Finalize(); exit(1); } *self = MPI_COMM_SELF; world = malloc(sizeof(MPI_Comm)); if (self == NULL) { perror("Unable to allocate MPI::Comm::WORLD"); MPI_Finalize(); exit(1); } *world = MPI_COMM_WORLD; MPI_Barrier(*world); sigusr1 = signal(SIGUSR1, SIG_IGN); sigusr2 = signal(SIGUSR2, SIG_IGN); ruby_init(); ruby_init_loadpath(); ruby_options(argc, argv); signal(SIGUSR1, sigusr1); signal(SIGUSR2, sigusr2); MPI_Barrier(*world); Init_MPI(); ruby_run(); /* Unreachable */ MPI_Finalize(); return 0; }
static void init() { ruby_init(); #if RUBY_VERSION_CODE >= 160 ruby_init_loadpath(); #else #if RUBY_VERSION_CODE >= 145 rb_ary_push(rb_load_path, rb_str_new2(".")); #endif #endif if (eruby_mode == MODE_CGI || eruby_mode == MODE_NPHCGI) rb_set_safe_level(1); eruby_init(); }
void RubyModule::Initialize() { RubyModule::instance_ = this; ruby_init(); ruby_init_loadpath(); // Add the application directoy to the Ruby include path so // that includes work in a intuitive way for application developers. ruby_incpush(host->GetApplication()->GetResourcesPath().c_str()); this->InitializeBinding(); host->AddModuleProvider(this); }