scandsp/src/optparser.cxx
// ==========================================================================
// Has same parameters and return value as 'optparse' below.
//
Has same parameters and return value as 'optparse' below.
Has same parameters and return value as ' optparse ' below .
int OptParser::parse(const char *fn, vector<string> &cfgs, string &message)
{
    ifstream infile(fn, ios_base::in | ios_base::binary);
    if (infile.is_open()) {
	cfgs.clear();
	cfgsp = &cfgs;
	for (;;) {
	    char ch;
	    infile.get(ch);
	    if (infile.eof()) {
		break;
	    }
	    track(ch);
	}
	int expected = nProjs > 0 ? nProjs : 1;
	if (cfgs.size() != expected) {
	    stringstream m;
	    m << "Expected " << expected
              << " configurations in .opt file; found " << cfgs.size()
              << "." << ends;
	    noteWarning(m.str());
	}
    }
    else {
	string f = fn;
        f.append(" failed to open.");
	noteError(f);
    }
    if (had_error) {
	message = error_message;
	return 2;
    }
    else if (had_warning) {
	message = error_message;
	return 1;
    }
    return 0;
}
int OptParser :: parse ( const char * fn , vector < string > & cfgs , string & message ) { ifstream infile ( fn , ios_base :: in | ios_base :: binary ) ; if ( infile . is_open ( ) ) { cfgs . clear ( ) ; cfgsp = & cfgs ; for ( ; ; ) { char ch ; infile . get ( ch ) ; if ( infile . eof ( ) ) { break ; } track ( ch ) ; } int expected = nProjs > 0 ? nProjs : 1 ; if ( cfgs . size ( ) != expected ) { stringstream m ; m << " " << expected << " " << cfgs . size ( ) << " " << ends ; noteWarning ( m . str ( ) ) ; } } else { string f = fn ; f . append ( " " ) ; noteError ( f ) ; } if ( had_error ) { message = error_message ; return 2 ; } else if ( had_warning ) { message = error_message ; return 1 ; } return 0 ; }
Has same parameters and return value as 'optparse' below.
Has same parameters and return value as ' optparse ' below .
// Process the contents of the .opt file, one byte at a time.