int model::save_model(int iter) const { std::string model_name = dfile + "-"; if (iter >= 0) { std::ostringstream sstr1; sstr1 << std::setw(5) << std::setfill('0') << iter; model_name += sstr1.str(); } else { model_name += "final"; } if (save_model_time(mdir + model_name + ".time")) { return 1; } std::cout << "time done" << std::endl; if (save_model_llh(mdir + model_name + ".llh")) { return 1; } std::cout << "llh done" << std::endl; if (save_model_params(mdir + model_name + ".params")) { return 1; } std::cout << "others done" << std::endl; if (n_topWords > 0) { if (save_model_topWords(mdir + model_name + ".twords")) { return 1; } std::cout << "twords done" << std::endl; } if (n_topWords > 0) { if (save_model_phi(mdir + model_name + ".phi")) { return 1; } std::cout << "phi done" << std::endl; } if (n_topWords > 0) { if (save_model_theta(mdir + model_name + ".theta")) { return 1; } std::cout << "theta done" << std::endl; } return 0; }
/* ======================================================================== main: This is the main entry point for the VirtualT application. ======================================================================== */ int main(int argc, char **argv) { if (process_args(argc, argv)) /* Parse command line args */ return 1; setup_working_path(argv); /* Create a working dir path */ setup_unix_signals(); /* Setup Unix signal handling */ // Added by JV for prefs init_pref(); /* load user Menu preferences */ check_installation(); /* Test if install needs to be performed */ load_setup_preferences(); /* Load user Peripheral setup preferences */ load_memory_preferences(); /* Load user Memory setup preferences */ load_remote_preferences(); /* Load user Remote Socket preferences */ /* Perform initialization */ init_mem(); /* Initialize Memory */ init_io(); /* Initialize I/O structures */ init_sound(); /* Initialize Sound system */ init_display(); /* Initialize the Display */ init_cpu(); /* Initialize the CPU */ init_throttle_timer(); /* Initialize the throttle timer */ init_remote(); /* Initialize the remote control */ init_lpt(); /* Initialize the printer subsystem */ init_other_windows(); /* Initialize other windows that were opened (memedit, regs, etc. */ get_model_time(); /* Load the emulated time for current model */ /* Perform Emulation */ emulate(); /* Main emulation loop */ /* Save RAM contents after emulation */ save_ram(); save_model_time(); /* Save the emulated time */ /* Cleanup */ deinit_io(); /* Deinitialize I/O */ deinit_sound(); /* Deinitialize sound */ deinit_lpt(); /* Deinitialize the printer */ deinit_throttle_timer(); /* Deinitialize the throttle timer */ deinit_display(); /* Deinitialze and free the main window */ free_mem(); /* Free memory used by ReMem and/or Rampac */ return 0; }