2008-01-30 12:38:09 +01:00
|
|
|
/*
|
2015-05-28 11:42:12 +02:00
|
|
|
* Copyright (C) 2008-2015 Dynare Team
|
2008-01-30 12:38:09 +01:00
|
|
|
*
|
|
|
|
* This file is part of Dynare.
|
|
|
|
*
|
|
|
|
* Dynare is free software: you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU General Public License as published by
|
|
|
|
* the Free Software Foundation, either version 3 of the License, or
|
|
|
|
* (at your option) any later version.
|
|
|
|
*
|
|
|
|
* Dynare is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with Dynare. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include <iostream>
|
|
|
|
|
|
|
|
#include "ParsingDriver.hh"
|
|
|
|
#include "ModFile.hh"
|
2010-10-25 18:20:58 +02:00
|
|
|
#include "ConfigFile.hh"
|
2014-04-20 11:12:12 +02:00
|
|
|
#include "ExtendedPreprocessorTypes.hh"
|
2008-01-30 12:38:09 +01:00
|
|
|
|
|
|
|
void
|
2015-08-28 16:09:43 +02:00
|
|
|
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, bool parallel, ConfigFile &config_file,
|
|
|
|
WarningConsolidation &warnings, bool nostrict, bool check_model_changes,
|
|
|
|
bool minimal_workspace, FileOutputType output_mode, LanguageOutputType language
|
2009-12-11 15:46:21 +01:00
|
|
|
#if defined(_WIN32) || defined(__CYGWIN32__)
|
|
|
|
, bool cygwin, bool msvc
|
|
|
|
#endif
|
|
|
|
)
|
2008-01-30 12:38:09 +01:00
|
|
|
{
|
2013-09-16 22:13:56 +02:00
|
|
|
ParsingDriver p(warnings, nostrict);
|
2008-08-25 18:45:39 +02:00
|
|
|
|
2008-01-30 12:38:09 +01:00
|
|
|
// Do parsing and construct internal representation of mod file
|
2008-03-28 18:38:10 +01:00
|
|
|
ModFile *mod_file = p.parse(in, debug);
|
2008-08-25 18:45:39 +02:00
|
|
|
|
2008-01-30 12:38:09 +01:00
|
|
|
// Run checking pass
|
|
|
|
mod_file->checkPass();
|
|
|
|
|
2009-09-30 17:10:31 +02:00
|
|
|
// Perform transformations on the model (creation of auxiliary vars and equations)
|
2013-09-13 20:37:31 +02:00
|
|
|
mod_file->transformPass(nostrict);
|
2009-09-30 17:10:31 +02:00
|
|
|
|
2008-12-19 11:24:31 +01:00
|
|
|
// Evaluate parameters initialization, initval, endval and pounds
|
2009-11-06 19:31:03 +01:00
|
|
|
mod_file->evalAllExpressions(warn_uninit);
|
2008-12-19 11:24:31 +01:00
|
|
|
|
2008-01-30 12:38:09 +01:00
|
|
|
// Do computations
|
2013-09-17 15:11:57 +02:00
|
|
|
mod_file->computingPass(no_tmp_terms, output_mode);
|
2008-01-30 12:38:09 +01:00
|
|
|
|
|
|
|
// Write outputs
|
2013-08-13 21:16:02 +02:00
|
|
|
if (output_mode != none)
|
2014-04-20 21:23:32 +02:00
|
|
|
mod_file->writeExternalFiles(basename, output_mode, language);
|
2013-08-06 21:20:36 +02:00
|
|
|
else
|
2015-05-10 20:29:03 +02:00
|
|
|
mod_file->writeOutputFiles(basename, clear_all, clear_global, no_log, no_warn, console, nograph,
|
2015-05-28 11:42:12 +02:00
|
|
|
nointeractive, config_file, check_model_changes, minimal_workspace
|
2009-12-11 15:46:21 +01:00
|
|
|
#if defined(_WIN32) || defined(__CYGWIN32__)
|
2015-05-10 20:29:03 +02:00
|
|
|
, cygwin, msvc
|
2009-12-11 15:46:21 +01:00
|
|
|
#endif
|
2015-05-10 20:29:03 +02:00
|
|
|
);
|
2008-01-30 12:38:09 +01:00
|
|
|
|
|
|
|
delete mod_file;
|
|
|
|
|
2013-08-06 21:20:36 +02:00
|
|
|
cout << "Preprocessing completed." << endl;
|
2008-01-30 12:38:09 +01:00
|
|
|
}
|