preprocessor: read config file before macroprocessor run. #1039
parent
ee6880bfdb
commit
1e307ca50f
|
@ -30,15 +30,17 @@
|
||||||
|
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#include "ExtendedPreprocessorTypes.hh"
|
#include "ExtendedPreprocessorTypes.hh"
|
||||||
|
#include "ConfigFile.hh"
|
||||||
|
|
||||||
/* Prototype for second part of main function
|
/* Prototype for second part of main function
|
||||||
Splitting main() in two parts was necessary because ParsingDriver.h and MacroDriver.h can't be
|
Splitting main() in two parts was necessary because ParsingDriver.h and MacroDriver.h can't be
|
||||||
included simultaneously (because of Bison limitations).
|
included simultaneously (because of Bison limitations).
|
||||||
*/
|
*/
|
||||||
void main2(stringstream &in, string &basename, bool debug, bool clear_all, bool clear_global, bool no_tmp_terms, bool no_log, bool no_warn,
|
void main2(stringstream &in, string &basename, bool debug, bool clear_all, bool clear_global,
|
||||||
bool warn_uninit, bool console, bool nograph, bool nointeractive,
|
bool no_tmp_terms, bool no_log, bool no_warn, bool warn_uninit, bool console,
|
||||||
bool parallel, const string ¶llel_config_file, const string &cluster_name, bool parallel_slave_open_mode,
|
bool nograph, bool nointeractive, bool parallel, ConfigFile &config_file,
|
||||||
bool parallel_test, bool nostrict, bool check_model_changes, bool minimal_workspace, FileOutputType output_mode, LanguageOutputType lang
|
WarningConsolidation &warnings_arg, bool nostrict, bool check_model_changes,
|
||||||
|
bool minimal_workspace, FileOutputType output_mode, LanguageOutputType lang
|
||||||
#if defined(_WIN32) || defined(__CYGWIN32__)
|
#if defined(_WIN32) || defined(__CYGWIN32__)
|
||||||
, bool cygwin, bool msvc
|
, bool cygwin, bool msvc
|
||||||
#endif
|
#endif
|
||||||
|
@ -278,6 +280,14 @@ main(int argc, char **argv)
|
||||||
if (pos != string::npos)
|
if (pos != string::npos)
|
||||||
basename.erase(pos);
|
basename.erase(pos);
|
||||||
|
|
||||||
|
WarningConsolidation warnings(no_warn);
|
||||||
|
|
||||||
|
// Process config file
|
||||||
|
ConfigFile config_file(parallel, parallel_test, parallel_slave_open_mode, cluster_name);
|
||||||
|
config_file.getConfigFileInfo(parallel_config_file);
|
||||||
|
config_file.checkPass(warnings);
|
||||||
|
config_file.transformPass();
|
||||||
|
|
||||||
// Do macro processing
|
// Do macro processing
|
||||||
MacroDriver m;
|
MacroDriver m;
|
||||||
|
|
||||||
|
@ -301,8 +311,9 @@ main(int argc, char **argv)
|
||||||
return EXIT_SUCCESS;
|
return EXIT_SUCCESS;
|
||||||
|
|
||||||
// Do the rest
|
// Do the rest
|
||||||
main2(macro_output, basename, debug, clear_all, clear_global, no_tmp_terms, no_log, no_warn, warn_uninit, console, nograph, nointeractive,
|
main2(macro_output, basename, debug, clear_all, clear_global,
|
||||||
parallel, parallel_config_file, cluster_name, parallel_slave_open_mode, parallel_test, nostrict, check_model_changes, minimal_workspace,
|
no_tmp_terms, no_log, no_warn, warn_uninit, console, nograph, nointeractive,
|
||||||
|
parallel, config_file, warnings, nostrict, check_model_changes, minimal_workspace,
|
||||||
output_mode, language
|
output_mode, language
|
||||||
#if defined(_WIN32) || defined(__CYGWIN32__)
|
#if defined(_WIN32) || defined(__CYGWIN32__)
|
||||||
, cygwin, msvc
|
, cygwin, msvc
|
||||||
|
|
|
@ -25,30 +25,26 @@
|
||||||
#include "ExtendedPreprocessorTypes.hh"
|
#include "ExtendedPreprocessorTypes.hh"
|
||||||
|
|
||||||
void
|
void
|
||||||
main2(stringstream &in, string &basename, bool debug, bool clear_all, bool clear_global, bool no_tmp_terms, bool no_log, bool no_warn, bool warn_uninit, bool console, bool nograph, bool nointeractive,
|
main2(stringstream &in, string &basename, bool debug, bool clear_all, bool clear_global,
|
||||||
bool parallel, const string ¶llel_config_file, const string &cluster_name, bool parallel_slave_open_mode,
|
bool no_tmp_terms, bool no_log, bool no_warn, bool warn_uninit, bool console,
|
||||||
bool parallel_test, bool nostrict, bool check_model_changes, bool minimal_workspace, FileOutputType output_mode, LanguageOutputType language
|
bool nograph, bool nointeractive, bool parallel, ConfigFile &config_file,
|
||||||
|
WarningConsolidation &warnings, bool nostrict, bool check_model_changes,
|
||||||
|
bool minimal_workspace, FileOutputType output_mode, LanguageOutputType language
|
||||||
#if defined(_WIN32) || defined(__CYGWIN32__)
|
#if defined(_WIN32) || defined(__CYGWIN32__)
|
||||||
, bool cygwin, bool msvc
|
, bool cygwin, bool msvc
|
||||||
#endif
|
#endif
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
WarningConsolidation warnings(no_warn);
|
|
||||||
|
|
||||||
ParsingDriver p(warnings, nostrict);
|
ParsingDriver p(warnings, nostrict);
|
||||||
|
|
||||||
// Do parsing and construct internal representation of mod file
|
// Do parsing and construct internal representation of mod file
|
||||||
ModFile *mod_file = p.parse(in, debug);
|
ModFile *mod_file = p.parse(in, debug);
|
||||||
ConfigFile config_file(parallel, parallel_test, parallel_slave_open_mode, cluster_name);
|
|
||||||
config_file.getConfigFileInfo(parallel_config_file);
|
|
||||||
|
|
||||||
// Run checking pass
|
// Run checking pass
|
||||||
mod_file->checkPass();
|
mod_file->checkPass();
|
||||||
config_file.checkPass(warnings);
|
|
||||||
|
|
||||||
// Perform transformations on the model (creation of auxiliary vars and equations)
|
// Perform transformations on the model (creation of auxiliary vars and equations)
|
||||||
mod_file->transformPass(nostrict);
|
mod_file->transformPass(nostrict);
|
||||||
config_file.transformPass();
|
|
||||||
|
|
||||||
// Evaluate parameters initialization, initval, endval and pounds
|
// Evaluate parameters initialization, initval, endval and pounds
|
||||||
mod_file->evalAllExpressions(warn_uninit);
|
mod_file->evalAllExpressions(warn_uninit);
|
||||||
|
|
Loading…
Reference in New Issue