#include "graphics_api.h" #include "parse.h" void write_graphics_file(FILE* f, GRAPHICS_INFO& gi) { fprintf(f, "%d\n" "%d\n" "%f\n", gi.xsize, gi.ysize, gi.refresh_period ); } int parse_graphics_file(FILE* f, GRAPHICS_INFO& gi) { char buf[256]; while (fgets(buf, 256, f)) { if (match_tag(buf, "")) return 0; else if (parse_int(buf, "", gi.xsize)) continue; else if (parse_int(buf, "", gi.ysize)) continue; else if (parse_double(buf, "", gi.refresh_period)) continue; else fprintf(stderr, "parse_core_file: unrecognized %s", buf); } return -1; }