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; }
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(); }