Exemplo n.º 1
0
/* Initializes the Ruby VM and builtin libraries.
 * @retval 0 if succeeded.
 * @retval non-zero an error occurred.
 */
int
ruby_setup(void)
{
    static int initialized = 0;
    int state;

    if (initialized)
	return 0;
    initialized = 1;

    ruby_init_stack((void *)&state);
    Init_BareVM();
    Init_heap();
    Init_vm_objects();

    PUSH_TAG();
    if ((state = EXEC_TAG()) == 0) {
	rb_call_inits();
	ruby_prog_init();
	GET_VM()->running = 1;
    }
    POP_TAG();

    return state;
}
Exemplo n.º 2
0
void
ruby_init(void)
{
    static int initialized = 0;
    int state;

    if (initialized)
        return;
    initialized = 1;
    //RHO
    //rb_origenviron = environ;
    //RHO

    Init_stack((void *)&state);
    Init_BareVM();
    Init_heap();

    PUSH_TAG();
    if ((state = EXEC_TAG()) == 0) {
        rb_call_inits();
        ruby_prog_init();
    }
    POP_TAG();

    if (state) {
        error_print();
        exit(EXIT_FAILURE);
    }
    GET_VM()->running = 1;
}
Exemplo n.º 3
0
void
ruby_init(void)
{
    int state;

    if (ruby_initialized)
	return;
    ruby_initialized = 1;

#ifdef __MACOS__
    rb_origenviron = 0;
#else
    rb_origenviron = environ;
#endif

#if WITH_OBJC
    char *s;
   
    s = getenv("MACRUBY_DEBUG");
    ruby_dlog_enabled = !(s == NULL || *s == '0');
    s = getenv("MACRUBY_DEBUG_FILE");
    if (s == NULL) {
	ruby_dlog_file = stderr;
    }
    else {
	ruby_dlog_file = fopen(s, "w");
	if (ruby_dlog_file == NULL) {
	    fprintf(stderr, "cannot open macruby debug file `%s'",
		    strerror(errno));
	    ruby_dlog_file = stderr;
	}
    }
#endif

    Init_stack((void *)&state);
    Init_PreGC();
    Init_BareVM();
    Init_heap();

    PUSH_TAG();
    if ((state = EXEC_TAG()) == 0) {
	rb_call_inits();

#ifdef __MACOS__
	_macruby_init();
#elif defined(__VMS)
	_vmsruby_init();
#endif

	ruby_prog_init();
	ALLOW_INTS;
    }
    POP_TAG();

    if (state) {
	error_print();
	exit(EXIT_FAILURE);
    }
    GET_VM()->running = 1;
}
Exemplo n.º 4
0
void
ruby_init(void)
{
    if (ruby_initialized) {
	return;
    }
    ruby_initialized = true;

    rb_origenviron = environ;

    Init_PreClass();	// requires nothing
    Init_PreGC(); 	// requires nothing
    Init_PreVM(); 	// requires nothing
    Init_PreGCD(); 	// requires nothing
    Init_PreEncoding(); // requires rb_cEncoding, GC

    rb_call_inits();
    ruby_prog_init();
}
Exemplo n.º 5
0
Arquivo: eval.c Projeto: genki/ruby
void
ruby_init(void)
{
    static int initialized = 0;
    int state;

    if (initialized)
	return;
    initialized = 1;

#ifdef __MACOS__
    rb_origenviron = 0;
#else
    rb_origenviron = environ;
#endif

    Init_stack((void *)&state);
    Init_BareVM();
    Init_heap();

    PUSH_TAG();
    if ((state = EXEC_TAG()) == 0) {
	rb_call_inits();

#ifdef __MACOS__
	_macruby_init();
#elif defined(__VMS)
	_vmsruby_init();
#endif

	ruby_prog_init();
	ALLOW_INTS;
    }
    POP_TAG();

    if (state) {
	error_print();
	exit(EXIT_FAILURE);
    }
    GET_VM()->running = 1;
}
Exemplo n.º 6
0
Arquivo: eval.c Projeto: 4nkh/rhodes
void
ruby_init(void)
{
    static int initialized = 0;
    int state;

    //RHO
    const_cache_version++;
    
    rb_mKernel = 0;
    rb_mComparable = 0;
    rb_mEnumerable = 0;
    rb_mErrno = 0;
    rb_mFileTest = 0;
    rb_mGC = 0;
    rb_mMath = 0;
    rb_mProcess = 0;
    rb_mWaitReadable = 0;
    rb_mWaitWritable = 0;
    
    rb_cBasicObject = 0;
    rb_cObject = 0;
    rb_cArray = 0;
    rb_cBignum = 0;
    rb_cBinding = 0;
    rb_cClass = 0;
    //rb_cCont = 0;
    rb_cDir = 0;
    rb_cData = 0;
    rb_cFalseClass = 0;
    rb_cEncoding = 0;
    rb_cEnumerator = 0;
    rb_cFile = 0;
    rb_cFixnum = 0;
    rb_cFloat = 0;
    rb_cHash = 0;
    rb_cInteger = 0;
    rb_cIO = 0;
    rb_cMatch = 0;
    rb_cMethod = 0;
    rb_cModule = 0;
    rb_cNameErrorMesg = 0;
    rb_cNilClass = 0;
    rb_cNumeric = 0;
    rb_cProc = 0;
    rb_cRandom = 0;
    rb_cRange = 0;
    rb_cRational = 0;
    rb_cComplex = 0;
    rb_cRegexp = 0;
    rb_cStat = 0;
    rb_cString = 0;
    rb_cStruct = 0;
    rb_cSymbol = 0;
    rb_cThread = 0;
    rb_cTime = 0;
    rb_cTrueClass = 0;
    rb_cUnboundMethod = 0;
    
    rb_eException = 0;
    rb_eStandardError = 0;
    rb_eSystemExit = 0;
    rb_eInterrupt = 0;
    rb_eSignal = 0;
    rb_eFatal = 0;
    rb_eArgError = 0;
    rb_eEOFError = 0;
    rb_eIndexError = 0;
    rb_eStopIteration = 0;
    rb_eKeyError = 0;
    rb_eRangeError = 0;
    rb_eIOError = 0;
    rb_eRuntimeError = 0;
    rb_eSecurityError = 0;
    rb_eSystemCallError = 0;
    rb_eThreadError = 0;
    rb_eTypeError = 0;
    rb_eZeroDivError = 0;
    rb_eNotImpError = 0;
    rb_eNoMemError = 0;
    rb_eNoMethodError = 0;
    rb_eFloatDomainError = 0;
    rb_eLocalJumpError = 0;
    rb_eSysStackError = 0;
    rb_eRegexpError = 0;
    rb_eEncodingError = 0;
    rb_eEncCompatError = 0;
    
    rb_eScriptError = 0;
    rb_eNameError = 0;
    rb_eSyntaxError = 0;
    rb_eLoadError = 0;
    
    rb_eMathDomainError = 0;
    
    ruby_current_vm = 0;
    
    rb_cISeq = 0;
    rb_cRubyVM = 0;
    rb_cEnv = 0;
    rb_mRubyVMFrozenCore = 0;

    //RHO
    
    
    //RHO
    //if (initialized)
	//return;
    //RHO
    
    initialized = 1;

    ruby_init_stack((void *)&state);
    Init_BareVM();
    Init_heap();

    PUSH_TAG();
    if ((state = EXEC_TAG()) == 0) {
	rb_call_inits();
	ruby_prog_init();
    }
    POP_TAG();

    if (state) {
	error_print();
	exit(EXIT_FAILURE);
    }
    GET_VM()->running = 1;
}