parsercmd/src/clinterpret.cxx
// ===========================================================================
// Returns true if config file is read successfully.
// In case of failure, a diagnostic message is allocated and stored into
// 'diagnostic'.
//
Returns true if config file is read successfully.
In case of failure, a diagnostic message is allocated and stored into
'diagnostic'.
Returns true if config file is read successfully . In case of failure a diagnostic message is allocated and stored into ' diagnostic ' .
bool CommandLineInterpreter::configure(const char *config_file,
                                       vector<string> &envargs_param,
                                       string *&diagnostic,
				       msg_sev unrec_arg) {
    name_intros.clear();
    delete flag_prefix;
    flag_prefix = NULL;
    flags.clear();
    suffixes.clear();
    blocks.clear();
    unrec_receiver = NULL;
    unrec_msg = msg_sev(unspecified_sev);
    envargs = &envargs_param;
    bool result = parse_config_file(config_file, diagnostic, 
				    name_intros, name_intro_equivs,
				    flag_prefix,
                                    blocks,
				    unrec_msg,
				    *this);
    if (unrec_arg != unspecified_sev) {
        unrec_msg = unrec_arg;
    }
    selectors.clear();
    default_selector = NULL;
    a_list_of_cstrs::iterator siter;
    for (siter = name_intros.begin(); siter != name_intros.end(); ++siter) {
	const char *sp = *siter;
	if (sp != NULL) {
	    selectors.push_back(new NameSelector(sp));
	    if (siter == name_intros.begin()) {
    	    	default_selector = selectors.front();
	    }
	}
    }
    equivs.clear();
    for (siter = name_intro_equivs.begin(); siter != name_intro_equivs.end(); ++siter) {
	const char *sp = *siter;
	if (sp != NULL && default_selector != NULL) {
	    equivs.push_back(new NameSelectorEquivalent(sp, *default_selector));
	}
    }
    a_list_of_blocks::iterator iter;
    for (iter = blocks.begin(); iter != blocks.end(); ++iter) {
	OutputBlock *b = *iter;
	if (b != NULL) {
	    b->configure(*this, envargs_param);
	}
    }
    return result;
}
bool CommandLineInterpreter :: configure ( const char * config_file , vector < string > & envargs_param , string * & diagnostic , msg_sev unrec_arg ) { name_intros . clear ( ) ; delete flag_prefix ; flag_prefix = NULL ; flags . clear ( ) ; suffixes . clear ( ) ; blocks . clear ( ) ; unrec_receiver = NULL ; unrec_msg = msg_sev ( unspecified_sev ) ; envargs = & envargs_param ; bool result = parse_config_file ( config_file , diagnostic , name_intros , name_intro_equivs , flag_prefix , blocks , unrec_msg , * this ) ; if ( unrec_arg != unspecified_sev ) { unrec_msg = unrec_arg ; } selectors . clear ( ) ; default_selector = NULL ; a_list_of_cstrs :: iterator siter ; for ( siter = name_intros . begin ( ) ; siter != name_intros . end ( ) ; ++ siter ) { const char * sp = * siter ; if ( sp != NULL ) { selectors . push_back ( new NameSelector ( sp ) ) ; if ( siter == name_intros . begin ( ) ) { default_selector = selectors . front ( ) ; } } } equivs . clear ( ) ; for ( siter = name_intro_equivs . begin ( ) ; siter != name_intro_equivs . end ( ) ; ++ siter ) { const char * sp = * siter ; if ( sp != NULL && default_selector != NULL ) { equivs . push_back ( new NameSelectorEquivalent ( sp , * default_selector ) ) ; } } a_list_of_blocks :: iterator iter ; for ( iter = blocks . begin ( ) ; iter != blocks . end ( ) ; ++ iter ) { OutputBlock * b = * iter ; if ( b != NULL ) { b -> configure ( * this , envargs_param ) ; } } return result ; }
Returns true if config file is read successfully.
Returns true if config file is read successfully .
// Clear out the members from any data from a config file. // We're not careful about freeing memory here, because it // is only supposed to happen once. // Create a NameSelector for each name_intro string. // To be populated below, where configure is called for each OutputBlock. // If it's the first, then it's the default. // Create a NameSelectorEquivalent for each name_equiv string. // Different kinds of blocks must be accounted for differently in // the interpreter's state. Call a virtual function so that a // translation block can activate its option interpreters in the // interpreter, etc. //