io.c

来自「一个编译器修改的例子」· C语言 代码 · 共 52 行

C
52
字号
#include "error.h"#include "io.h"#include "lex.h"#include "statement.h"#include <stdlib.h>List	   *search_path;FILE	   *c_out, *h_out;const char *input_file_name = "<stdin>";void open_input_file(const char *file_name){    if (file_name != 0)    {	input_file_name = file_name;	if ((yyin = fopen(file_name, "r")) == 0)	{	    perror("Error opening input file (fatal)");	    exit(1);	}    }}void open_output_files(void){    if ((h_out = fopen("cb.h", "w")) == 0 || (c_out = fopen("cb.c", "w")) == 0)    {	perror("Error opening output file (fatal)");	exit(1);    }    fprintf(h_out,"#include \"rts.h\"\n");	fprintf(c_out,"#include \"cb.h\"\n");#ifdef DEBUG	printf("#include \"rts.h\"\n");	printf("#include \"cb.h\"\n");#endif}void close_files(void){    fclose(yyin);    fclose(c_out);    fclose(h_out);}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?