Preprocessor interface for multiple graph formats

issue#70
Sébastien Villemot 2012-09-11 14:26:53 +02:00
parent fb4a8d6186
commit 514db5f801
3 changed files with 35 additions and 6 deletions

View File

@ -2250,13 +2250,22 @@ o_nograph : NOGRAPH
{ driver.option_num("nograph", "0"); }
;
o_nodisplay : NODISPLAY { driver.option_num("nodisplay","1"); };
o_graph_format : GRAPH_FORMAT EQUAL EPS
{ driver.option_str("graph_format", "eps"); }
| GRAPH_FORMAT EQUAL FIG
{ driver.option_str("graph_format", "fig"); }
| GRAPH_FORMAT EQUAL PDF
{ driver.option_str("graph_format", "pdf"); }
o_graph_format : GRAPH_FORMAT EQUAL allowed_graph_formats
{ driver.process_graph_format_option(); }
| GRAPH_FORMAT EQUAL '(' list_allowed_graph_formats ')'
{ driver.process_graph_format_option(); }
;
allowed_graph_formats : EPS
{ driver.add_graph_format("eps"); }
| FIG
{ driver.add_graph_format("fig"); }
| PDF
{ driver.add_graph_format("pdf"); }
;
list_allowed_graph_formats : allowed_graph_formats
| list_allowed_graph_formats COMMA allowed_graph_formats
;
o_subsample_name : symbol EQUAL date_number ':' date_number
{ driver.set_subsample_name_equal_to_date_range($1, $3, $5); }
;

View File

@ -2479,3 +2479,17 @@ ParsingDriver::add_steady_state_model_equal_multiple(expr_t expr)
symbol_list.clear();
}
void
ParsingDriver::add_graph_format(const string &name)
{
graph_formats.addSymbol(name);
}
void
ParsingDriver::process_graph_format_option()
{
options_list.symbol_list_options["graph_format"] = graph_formats;
graph_formats.clear();
}

View File

@ -197,6 +197,8 @@ private:
void reset_current_external_function_options();
//! Adds a model lagged variable to ModelTree and VariableTable
expr_t add_model_variable(int symb_id, int lag);
//! For parsing the graph_format option
SymbolList graph_formats;
//! The mod file representation constructed by this ParsingDriver
ModFile *mod_file;
@ -628,6 +630,10 @@ public:
void declare_nonstationary_var(string *name, string *tex_name = NULL);
//! Ends declaration of nonstationary variable
void end_nonstationary_var(expr_t deflator);
//! Add a graph format to the list of formats requested
void add_graph_format(const string &name);
//! Add the graph_format option to the OptionsList structure
void process_graph_format_option();
};
#endif // ! PARSING_DRIVER_HH