/* $Id: main.c,v 1.6 2004/02/05 05:09:36 jmuelmen Exp $ */ #include #include "glue.h" struct ident *i; FILE *glue_file, *glue_header_file, *register_file; int yyparse (); int main () { struct ident s; i = &s; /* open the output files */ glue_file = fopen("instglue.c", "w"); glue_header_file = fopen("instglue.h", "w"); register_file = fopen("register.c", "w"); if (!glue_file || !glue_header_file || !register_file) return 1; /* make sure the glue file includes everything it needs */ fprintf(glue_file, "#include \"parse.h\"\n" "#include \"builtin.h\"\n" "#include \"inst.h\"\n\n" "#include \"act.h\"\n\n" "#include \"libsurf_dumb.h\"\n\n" "typedef char string[STRING_LIT_LEN];\n\n"); /* start the register file off on the right foot */ fprintf(register_file, "#include \"shell.h\"\n" "#include \"instglue.h\"\n" "void func_register ()\n" "{\n"); if (yyparse()) return 1; /* terminate the register file properly */ fprintf(register_file, "}\n"); return 0; }