#include "graphics_api.h"
#include "error_numbers.h"
#include "parse.h"
int write_graphics_file(FILE* f, GRAPHICS_INFO* gi) {
fprintf(f,
"\n"
" %d\n"
" %d\n"
" %d\n"
" %f\n"
"\n",
gi->xsize,
gi->ysize,
gi->graphics_mode,
gi->refresh_period
);
return 0;
}
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_int(buf, "", gi->graphics_mode)) continue;
else if (parse_double(buf, "", gi->refresh_period)) continue;
else fprintf(stderr, "parse_core_file: unrecognized %s", buf);
}
return -1;
}