int main(int argc,char *argv[]) { ruby_init(); ruby_options(argc,argv); ruby_run(); 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; }
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 main(int argc, char **argv) { ruby_sysinit(&argc, &argv); { RUBY_INIT_STACK; ruby_init(); return ruby_run_node(ruby_options(argc, argv)); } }
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 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)); } }
void * goruby_options(int argc, char **argv) { static const char cmd[] = "END{require 'irb';IRB.start}"; int rw[2], infd; void *ret; if ((isatty(0) && isatty(1) && isatty(2)) && (pipe(rw) == 0)) { infd = dup(0); dup2(rw[0], 0); close(rw[0]); write(rw[1], cmd, sizeof(cmd) - 1); close(rw[1]); ret = ruby_options(argc, argv); dup2(infd, 0); close(infd); return ret; } else { return 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; }
int shoes_ruby_embed() { VALUE v; char *argv[] = {"ruby", "-e", "1"}; int sysinit_argc = 0; char** sysinit_argv = NULL; RUBY_INIT_STACK; #ifdef SHOES_WIN32 ruby_sysinit( &sysinit_argc, &sysinit_argv ); #endif ruby_init(); v = (VALUE)ruby_options(3, argv); return !FIXNUM_P(v); }
static void rb_w_define_klass() { /* * Initialize Ruby Interpreter */ int rb_argc = 0; char *rb_argv[] = {NULL}; ruby_init(); ruby_init_loadpath(); ruby_options(rb_argc, rb_argv); ruby_script("Wireplay"); /* * Initialize the Wireplay::Hook class for ruby hook repository */ rb_mWireplay = rb_define_module("Wireplay"); rb_const_set(rb_mWireplay, rb_intern("WIREPLAY_PROG_NAME"), rb_str_new2(WIREPLAY_PROG_NAME)); rb_const_set(rb_mWireplay, rb_intern("WIREPLAY_PROG_VER"), rb_str_new2(WIREPLAY_PROG_VER)); //rb_const_set(rb_mWireplay, rb_intern("WIREPLAY_AUTHOR"), rb_str_new2(WIREPLAY_AUTHOR)); rb_const_set(rb_mWireplay, rb_intern("WIREPLAY_COPYRIGHT"), rb_str_new2(WIREPLAY_COPYRIGHT)); rb_const_set(rb_mWireplay, rb_intern("REPLAY_SERVER_TO_CLIENT"), INT2FIX(REPLAY_SERVER_TO_CLIENT)); rb_const_set(rb_mWireplay, rb_intern("REPLAY_CLIENT_TO_SERVER"), INT2FIX(REPLAY_CLIENT_TO_SERVER)); rb_const_set(rb_mWireplay, rb_intern("ERROR_CONNECT_FAILED"), INT2FIX(ERROR_CONNECT_FAILED)); rb_const_set(rb_mWireplay, rb_intern("ERROR_SEND_FAILED"), INT2FIX(ERROR_SEND_FAILED)); rb_const_set(rb_mWireplay, rb_intern("ERROR_RECV_FAILED"), INT2FIX(ERROR_RECV_FAILED)); rb_const_set(rb_mWireplay, rb_intern("ERROR_TIMEOUT"), INT2FIX(ERROR_TIMEOUT)); rb_const_set(rb_mWireplay, rb_intern("ERROR_SOCKET_ERROR"), INT2FIX(ERROR_SOCKET_ERROR)); rb_const_set(rb_mWireplay, rb_intern("ROLE_CLIENT"), INT2FIX(ROLE_CLIENT)); rb_const_set(rb_mWireplay, rb_intern("ROLE_SERVER"), INT2FIX(ROLE_SERVER)); rb_define_global_function("cmsg", rb_w_cmsg, 1); /* TODO: define other msg.c functions */ rb_cHook = rb_define_class_under(rb_mWireplay, "Hooks", rb_cObject); rb_cvar_set(rb_cHook, rb_intern("_hooks"), rb_ary_new(), 0); rb_define_singleton_method(rb_cHook, "register", rb_cHook_register, 1); rb_define_singleton_method(rb_cHook, "hooks", rb_cHook_hooks, 0); rb_define_singleton_method(rb_mWireplay, "start_irb", rb_test_start_irb, 0); rb_define_singleton_method(rb_mWireplay, "load_library", rb_mWireplay_load_library, 1); //rb_test_start_irb(); return; }
void CRScriptCore::InitializeEnvironment() { ATLTRACE(_("Initialize Environment in Thread:%08X\n"), GetCurrentThreadId()); #ifndef __IRubyEngine_INTERFACE_DEFINED__ int stacktop; s_pStackTop = reinterpret_cast<LPBYTE>(&stacktop); #endif int dummyargc(1); char* dummyargv[] = {"dummy", NULL }; char** pargv; ruby_sysinit(&dummyargc, &pargv); RUBY_INIT_STACK; ruby_init(); ruby_options(3, asr_argv); s_pEncoding = rb_default_internal_encoding(); if (!s_pEncoding) s_pEncoding = rb_default_external_encoding(); try { rb_require("win32ole"); VALUE v = rb_eval_string("WIN32OLE"); // override original constructor rb_define_singleton_method(v, "new", reinterpret_cast<VALUE(*)(...)>(fole_s_new), -1); rb_define_singleton_method(v, "connect", reinterpret_cast<VALUE(*)(...)>(fole_s_connect), 1); rb_define_singleton_method(v, "attach", reinterpret_cast<VALUE(*)(...)>(foleex_attach), 2); rb_define_method(v, "__release", reinterpret_cast<VALUE(*)(...)>(foleex_release), 0); rb_define_method(v, "method_missing", reinterpret_cast<VALUE(*)(...)>(foleex_missing), -1); rb_define_method(v, "each", reinterpret_cast<VALUE(*)(...)>(foleex_each), 0); if (rb_const_defined_at(v, rb_intern("ARGV")) == Qfalse) { rb_define_const(v, "ARGV", rb_ary_new()); } s_valueWin32Ole = v; s_valueWIN32OLERuntimeError = rb_eval_string("WIN32OLERuntimeError"); v = rb_define_class("WIN32OLEEX", v); s_valueWin32OleEx = v; rb_define_singleton_method(v, "attach", reinterpret_cast<VALUE(*)(...)>(foleex_attach), 2); rb_define_method(v, "method_missing", reinterpret_cast<VALUE(*)(...)>(foleex_missing), -1); // s_valueActiveRubyScript = rb_define_class("ActiveScriptRuby", rb_cObject); rb_define_singleton_method(s_valueActiveRubyScript, "trace", (VALUE(*)(...))trace_hook, 6); rb_define_singleton_method(s_valueActiveRubyScript, "settrace", (VALUE(*)(...))trace_set, 1); rb_define_singleton_method(s_valueActiveRubyScript, "rubyize", (VALUE(*)(...))rubyize, 1); } catch (...) { ATLTRACE(_T("Exception for class\n")); } }
int main(int argc, char **argv) { #ifdef RUBY_DEBUG_ENV ruby_set_debug_option(getenv("RUBY_DEBUG")); #endif #ifdef HAVE_LOCALE_H setlocale(LC_CTYPE, ""); #endif ruby_sysinit(&argc, &argv); { RUBY_INIT_STACK; ruby_init(); return ruby_run_node(ruby_options(argc, argv)); } }
static int ensure_ruby_initialized(void) { if (!ruby_initialized) { #ifdef DYNAMIC_RUBY if (ruby_enabled(TRUE)) { #endif #ifdef _WIN32 /* suggested by Ariya Mizutani */ int argc = 1; char *argv[] = {"gvim.exe"}; char **argvp = argv; NtInitialize(&argc, &argvp); #endif { #if defined(RUBY19_OR_LATER) || defined(RUBY_INIT_STACK) ruby_init_stack(ruby_stack_start); #endif ruby_init(); } #ifdef RUBY19_OR_LATER { int dummy_argc = 2; char *dummy_argv[] = {"vim-ruby", "-e0"}; ruby_options(dummy_argc, dummy_argv); } ruby_script("vim-ruby"); #else ruby_init_loadpath(); #endif ruby_io_init(); ruby_vim_init(); ruby_initialized = 1; #ifdef DYNAMIC_RUBY } else { EMSG(_("E266: Sorry, this command is disabled, the Ruby library could not be loaded.")); return 0; } #endif } return ruby_initialized; }
int main(int argc, char **argv, char **envp) { #ifdef RUBY_GC_STRESS RUBY_EXTERN int gc_stress; gc_stress = getenv("RUBY_GC_STRESS") != NULL; #endif #ifdef _WIN32 NtInitialize(&argc, &argv); #endif #if defined(__MACOS__) && defined(__MWERKS__) argc = ccommand(&argv); #endif { RUBY_INIT_STACK; ruby_init(); ruby_options(argc, argv); ruby_run(); } return 0; }
int main(int argc, char **argv) { int nRes = 0; //_CrtSetDbgFlag ( _CRTDBG_ALLOC_MEM_DF | _CRTDBG_LEAK_CHECK_DF | _CRTDBG_CHECK_CRT_DF | _CRTDBG_LEAK_CHECK_DF); #ifdef RUBY_DEBUG_ENV ruby_set_debug_option(getenv("RUBY_DEBUG")); #endif #ifdef HAVE_LOCALE_H setlocale(LC_CTYPE, ""); #endif #ifdef WIN32 SetEnvironmentVariable("RUBYOPT",""); SetEnvironmentVariable("RUBYLIB",""); #endif //WIN32 // 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; }