void ObjectHeader::initialize_copy(STATE, Object* other) { klass(other->klass()); ivars(other->ivars()); state->shared().om->write_barrier(this, klass()); state->shared().om->write_barrier(this, ivars()); }
main(int ac, char **av) #endif /* HAS_WINDOWS */ { wordlist *wl = NULL; #ifndef X_DISPLAY_MISSING char *displayname; /* grrr, Xtk forced contortions */ char *argv[2]; int argc = 2; char buf[512]; #endif /* X_DISPLAY_MISSING */ ivars( ); cp_in = stdin; cp_out = stdout; cp_err = stderr; #ifndef X_DISPLAY_MISSING if (cp_getvar("display", CP_STRING, buf)) { displayname = buf; } else if (!(displayname = getenv("DISPLAY"))) { fprintf(stderr, "Can't open X display."); goto out; } argv[0] = "nutmeg"; argv[1] = displayname; /* initialize X toolkit */ toplevel = XtInitialize("nutmeg", "Nutmeg", NULL, 0, &argc, argv); out: #endif /* X_DISPLAY_MISSING */ if (ac > 1) wl = wl_build(av + 1); hlp_main(Help_Path, wl); #ifndef X_DISPLAY_MISSING if (hlp_usex) { printf("Hit control-C when done.\n"); /* sigh */ XtMainLoop(); } #endif /* X_DISPLAY_MISSING */ #ifdef HAS_WINDOWS /* Keep window open untill a key is pressed */ printf("Press a key to quit\n"); while( getchar() == EOF) {} #endif /* HAS_WINDOWS */ return EXIT_NORMAL; }
// Rubinius.primitive :string_dup String* string_dup(STATE) { if(likely(klass() == G(string) && ivars()->nil_p())) { /* We have a plain string with no metaclass or ivars, so if we can * allocate a new object in the young space, we can copy it directly * without needing a write barrier. */ String* so = state->memory()->new_object<String>(state, G(string)); if(likely(so->young_object_p())) { so->copy_body(state->vm(), this); so->shared(state, cTrue); shared(state, cTrue); infect(state, so); return so; } } return string_dup_slow(state); }
/* Le mando los datos como string */ int processNetList(const char* netlist_in_memory, const char* output_filename, FILE* nulFP, int binaryResults) { /* Archivo de entrada */ FILE* file; /* Archivo de salida */ MEMFILE* mfp; /* Marca que se inició */ started = true; /* Pone o no el rawfile en binario */ AsciiRawFile = !binaryResults; /* Inicializa variables de entorno */ ivars(); /* Le da valor a los file pointers de salida */ /* cp_in = stdin; cp_out = stdout; cp_err = stderr; cp_curin = stdin; cp_curout = stdout; cp_curerr = stderr; */ cp_in = stdin; cp_out = nulFP; cp_err = nulFP; cp_curin = stdin; cp_curout = nulFP; cp_curerr = nulFP; /* Limpio el circuito actual (necesario por la reutilización */ ft_curckt = NULL; /* Inicializa el simulador y lo conecta con el front-end */ if (SIMinit(&nutmeginfo,&ft_sim) != OK) return EXIT_BAD; /* Obtiene el nombre del programa */ cp_program = ft_sim->simulator; /* Inicializa los números aleatorios */ srandom((unsigned int)time(0)); /* Es la función que devuelve parámetros del circuito */ if_getparam = spif_getparam; /* Indico que la ejecucuión no es interactiva */ cp_interactive = false; /* Carga la netlist */ /*inp_spsource(file, false, netlist_filename);*/ inp_spsource_from_mem(netlist_in_memory, false); /* Realiza la simulación */ if (ft_dorun(output_filename)) return EXIT_BAD; /* Todo OK */ return EXIT_NORMAL; }