00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026 #include "stdafx.h"
00027 #include "parser.h"
00028
00029
00030 bool ParseFile(const string &filename) {
00031 extern FILE *yyin;
00032 extern int yyparse(void);
00033 extern string current_file;
00034 extern int line_num;
00035 extern int yydebug;
00036
00037 if (getenv("PBRT_YYDEBUG") != NULL)
00038 yydebug = 1;
00039
00040 if (filename == "-")
00041 yyin = stdin;
00042 else
00043 yyin = fopen(filename.c_str(), "r");
00044 if (yyin != NULL) {
00045 current_file = filename;
00046 if (yyin == stdin) current_file = "<standard input>";
00047 line_num = 1;
00048 yyparse();
00049 if (yyin != stdin) fclose(yyin);
00050 }
00051 current_file = "";
00052 line_num = 0;
00053 return (yyin != NULL);
00054 }
00055
00056