void read_config_file(void) { char *homedir; char *filename; FILE *file; char inputLine[1024]; /* hack: assume each line is less than 1024 chars */ char *p; /* open $HOME/.tortoise */ homedir = getenv("HOME"); if (homedir == NULL) return; filename = (char *)malloc(strlen(homedir) + strlen(CONFIGFILENAME) + strlen(DIRECTORYSEPARATOR) + 1); if (filename == NULL) return; sprintf(filename, "%s%s%s", homedir, DIRECTORYSEPARATOR, CONFIGFILENAME); /* get Guile to do all of the work */ gh_eval_file(filename); free(filename); }
/** ** Called from scheme. */ local void gh_main_prog(int argc,char* argv[]) { gh_new_procedure0_0("clone-library-path",CclCloneLibraryPath); gh_new_procedure1_0("title-screen",CclTitleScreen); gh_new_procedure5_0("mana-sprite",CclManaSprite); gh_new_procedure5_0("health-sprite",CclHealthSprite); gh_new_procedure0_0("show-health-bar",CclShowHealthBar); gh_new_procedure0_0("show-health-dot",CclShowHealthDot); gh_new_procedure0_0("show-mana-bar",CclShowManaBar); gh_new_procedure0_0("show-mana-dot",CclShowManaDot); gh_new_procedure0_0("show-full",CclShowFull); gh_new_procedure0_0("show-no-full",CclShowNoFull); gh_new_procedure0_0("decoration-on-top",CclDecorationOnTop); gh_new_procedure0_0("show-sight-range",CclShowSightRange); gh_new_procedure0_0("show-react-range",CclShowReactRange); gh_new_procedure0_0("show-attack-range",CclShowAttackRange); gh_new_procedure0_0("show-orders",CclShowOrders); gh_new_procedure1_0("speed-mine",CclSpeedMine); gh_new_procedure1_0("speed-gold",CclSpeedGold); gh_new_procedure1_0("speed-chop",CclSpeedChop); gh_new_procedure1_0("speed-wood",CclSpeedWood); gh_new_procedure1_0("speed-haul",CclSpeedHaul); gh_new_procedure1_0("speed-oil",CclSpeedOil); gh_new_procedure1_0("speed-build",CclSpeedBuild); gh_new_procedure1_0("speed-train",CclSpeedTrain); gh_new_procedure1_0("speed-upgrade",CclSpeedUpgrade); gh_new_procedure1_0("speed-research",CclSpeedResearch); gh_new_procedure1_0("speeds",CclSpeeds); gh_new_procedureN("missile-type",CclMissileType); MapCclRegister(); UnitButtonCclRegister(); UnitTypeCclRegister(); SoundCclRegister(); UserInterfaceCclRegister(); gh_new_procedure1_0("load-pud",CclLoadPud); gh_new_procedure2_0("define-map",CclDefineMap); gh_new_procedureN("clone-map",CclCloneMap); gh_new_procedure0_0("c-main1",CclMain1); #ifdef GUILE_GTK SGTK_REGISTER_GLUE(sgtk_init_gtk_gtk_glue); SGTK_REGISTER_GLUE(sgtk_init_gtk_gdk_glue); // ALL Stupid { int argc; char** argv; static char* args[2] = { "clone", NULL }; argc=1; argv=args; sgtk_init_with_args(&argc,&argv); } //sgtk_init_with_args(NULL,NULL); #endif // // Load and evaluate configuration file // CclInConfigFile=1; gh_eval_file(CclStartFile); CclInConfigFile=0; // FIXME: guile didn't cleanup, all memory is lost! main1(argc,argv); // continue with setup }