Beispiel #1
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;
}
Beispiel #2
0
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);
    }
}
Beispiel #3
0
int
goruby_run_node(void *arg)
{
    int state;
    if (NIL_P(rb_protect(init_golf, Qtrue, &state))) {
	return state == EXIT_SUCCESS ? EXIT_FAILURE : state;
    }
    return ruby_run_node(arg);
}
Beispiel #4
0
int main(int argc, char **argv)
{
  ruby_sysinit(&argc, &argv);
  {
    RUBY_INIT_STACK;
    ruby_init();
    return ruby_run_node(ruby_options(argc, argv));
  }
}
Beispiel #5
0
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));
        }
    }
}
Beispiel #6
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));
  }
}
Beispiel #7
0
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;
}
Beispiel #8
0
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));
    }
}
int
main(void)
{
  char *argv_raw[] = {
    "milter-manager",
    "-e",
    "''"
  };
  int argc;
  char **argv;

  argc = sizeof(argv_raw) / sizeof(char *);
  argv = argv_raw;
  ruby_sysinit(&argc, &argv);
  {
    RUBY_INIT_STACK;
    ruby_init();
    return ruby_run_node(ruby_process_options(argc, argv));
  }
}
Beispiel #10
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;
}