Beispiel #1
0
// Parsing Global Interface
bool ParseFile(const std::string &filename) {
    extern FILE *yyin;
    extern int yyparse(void);
    extern std::string current_file;
    extern int line_num;
    extern int yydebug;

    LOG(INFO) << "Starting to parse input file " << filename;

    if (getenv("PBRT_YYDEBUG") != nullptr) yydebug = 1;

    if (filename == "-")
        yyin = stdin;
    else {
        yyin = fopen(filename.c_str(), "r");
        SetSearchDirectory(DirectoryContaining(filename));
    }
    if (yyin != nullptr) {
        current_file = filename;
        if (yyin == stdin) current_file = "<standard input>";
        line_num = 1;
        yyparse();
        if (yyin != stdin) fclose(yyin);
    }
    current_file = "";
    line_num = 0;
    LOG(INFO) << "Done parsing input file " << filename;
    return (yyin != nullptr);
}
// Parsing Global Interface
bool ParseFile(const string &filename) {
    extern FILE *yyin;
    extern int yyparse(void);
    extern string current_file;
    extern int line_num;
    extern int yydebug;

    if (getenv("PBRT_YYDEBUG") != NULL)
        yydebug = 1;

    if (filename == "-")
        yyin = stdin;
    else {
        yyin = fopen(filename.c_str(), "r");
        SetSearchDirectory(DirectoryContaining(filename));
    }

    if (yyin != NULL) {
        current_file = filename;
        if (yyin == stdin) current_file = "<standard input>";
        line_num = 1;
        yyparse();
        if (yyin != stdin) fclose(yyin);
    }
    current_file = "";
    line_num = 0;
    return (yyin != NULL);
}
// same as regular setsearch directory but takes regular strings
STDMETHODIMP CLTDMLoader::SetSearchDirectory(REFCLSID rguidClass, const char* sPath, BOOL fClear)
{
	// fail if string is too long
	if (strlen(sPath) >= MAX_PATH) return E_FAIL;

	// string to hold new wide string
	WCHAR wszPath[MAX_PATH];

	// convert string
    MULTI_TO_WIDE( wszPath, sPath );

	// call the real SetSearchDirectory
	return SetSearchDirectory(rguidClass, wszPath, fClear);
}