std::open and std::fstream constructor accept a std::string for filename in C++11
parent
b91ed6f78c
commit
988a9f6e2d
|
@ -1706,7 +1706,7 @@ public:
|
||||||
tags_liste_t tags_liste;
|
tags_liste_t tags_liste;
|
||||||
ifstream CompiledCode;
|
ifstream CompiledCode;
|
||||||
streamoff Code_Size;
|
streamoff Code_Size;
|
||||||
CompiledCode.open((file_name + ".cod").c_str(), std::ios::in | std::ios::binary| std::ios::ate);
|
CompiledCode.open(file_name + ".cod", std::ios::in | std::ios::binary| std::ios::ate);
|
||||||
if (!CompiledCode.is_open())
|
if (!CompiledCode.is_open())
|
||||||
{
|
{
|
||||||
return tags_liste;
|
return tags_liste;
|
||||||
|
|
|
@ -138,7 +138,7 @@ ConfigFile::getConfigFileInfo(const string &config_file)
|
||||||
defaultConfigFile += "/.dynare";
|
defaultConfigFile += "/.dynare";
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
configFile = new ifstream(defaultConfigFile.c_str(), fstream::in);
|
configFile = new ifstream(defaultConfigFile, fstream::in);
|
||||||
if (!configFile->is_open())
|
if (!configFile->is_open())
|
||||||
if (parallel || parallel_test)
|
if (parallel || parallel_test)
|
||||||
{
|
{
|
||||||
|
@ -150,7 +150,7 @@ ConfigFile::getConfigFileInfo(const string &config_file)
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
configFile = new ifstream(config_file.c_str(), fstream::in);
|
configFile = new ifstream(config_file, fstream::in);
|
||||||
if (!configFile->is_open())
|
if (!configFile->is_open())
|
||||||
{
|
{
|
||||||
cerr << "ERROR: Couldn't open file " << config_file << endl;;
|
cerr << "ERROR: Couldn't open file " << config_file << endl;;
|
||||||
|
|
|
@ -320,7 +320,7 @@ DynamicModel::writeModelEquationsOrdered_M(const string &basename) const
|
||||||
|
|
||||||
tmp1_output.str("");
|
tmp1_output.str("");
|
||||||
tmp1_output << packageDir(basename + ".block") << "/dynamic_" << block+1 << ".m";
|
tmp1_output << packageDir(basename + ".block") << "/dynamic_" << block+1 << ".m";
|
||||||
output.open(tmp1_output.str().c_str(), ios::out | ios::binary);
|
output.open(tmp1_output.str(), ios::out | ios::binary);
|
||||||
output << "%\n";
|
output << "%\n";
|
||||||
output << "% " << tmp1_output.str() << " : Computes dynamic model for Dynare\n";
|
output << "% " << tmp1_output.str() << " : Computes dynamic model for Dynare\n";
|
||||||
output << "%\n";
|
output << "%\n";
|
||||||
|
@ -795,7 +795,7 @@ DynamicModel::writeModelEquationsCode(const string &basename, const map_idx_t &m
|
||||||
boost::filesystem::create_directories(basename + "/model/bytecode");
|
boost::filesystem::create_directories(basename + "/model/bytecode");
|
||||||
|
|
||||||
string main_name = basename + "/model/bytecode/dynamic.cod";
|
string main_name = basename + "/model/bytecode/dynamic.cod";
|
||||||
code_file.open(main_name.c_str(), ios::out | ios::binary | ios::ate);
|
code_file.open(main_name, ios::out | ios::binary | ios::ate);
|
||||||
if (!code_file.is_open())
|
if (!code_file.is_open())
|
||||||
{
|
{
|
||||||
cerr << "Error : Can't open file \"" << main_name << "\" for writing" << endl;
|
cerr << "Error : Can't open file \"" << main_name << "\" for writing" << endl;
|
||||||
|
@ -1070,7 +1070,7 @@ DynamicModel::writeModelEquationsCode_Block(const string &basename, const map_id
|
||||||
boost::filesystem::create_directories(basename + "/model/bytecode");
|
boost::filesystem::create_directories(basename + "/model/bytecode");
|
||||||
|
|
||||||
string main_name = basename + "/model/bytecode/dynamic.cod";
|
string main_name = basename + "/model/bytecode/dynamic.cod";
|
||||||
code_file.open(main_name.c_str(), ios::out | ios::binary | ios::ate);
|
code_file.open(main_name, ios::out | ios::binary | ios::ate);
|
||||||
if (!code_file.is_open())
|
if (!code_file.is_open())
|
||||||
{
|
{
|
||||||
cerr << "Error : Can't open file \"" << main_name << "\" for writing" << endl;
|
cerr << "Error : Can't open file \"" << main_name << "\" for writing" << endl;
|
||||||
|
@ -1559,7 +1559,7 @@ DynamicModel::writeDynamicCFile(const string &basename, const int order) const
|
||||||
string filename_mex = basename + "/model/src/dynamic_mex.c";
|
string filename_mex = basename + "/model/src/dynamic_mex.c";
|
||||||
ofstream mDynamicModelFile, mDynamicMexFile;
|
ofstream mDynamicModelFile, mDynamicMexFile;
|
||||||
|
|
||||||
mDynamicModelFile.open(filename.c_str(), ios::out | ios::binary);
|
mDynamicModelFile.open(filename, ios::out | ios::binary);
|
||||||
if (!mDynamicModelFile.is_open())
|
if (!mDynamicModelFile.is_open())
|
||||||
{
|
{
|
||||||
cerr << "Error: Can't open file " << filename << " for writing" << endl;
|
cerr << "Error: Can't open file " << filename << " for writing" << endl;
|
||||||
|
@ -1598,7 +1598,7 @@ DynamicModel::writeDynamicCFile(const string &basename, const int order) const
|
||||||
writeNormcdf(mDynamicModelFile);
|
writeNormcdf(mDynamicModelFile);
|
||||||
mDynamicModelFile.close();
|
mDynamicModelFile.close();
|
||||||
|
|
||||||
mDynamicMexFile.open(filename_mex.c_str(), ios::out | ios::binary);
|
mDynamicMexFile.open(filename_mex, ios::out | ios::binary);
|
||||||
if (!mDynamicMexFile.is_open())
|
if (!mDynamicMexFile.is_open())
|
||||||
{
|
{
|
||||||
cerr << "Error: Can't open file " << filename_mex << " for writing" << endl;
|
cerr << "Error: Can't open file " << filename_mex << " for writing" << endl;
|
||||||
|
@ -1802,7 +1802,7 @@ DynamicModel::writeSparseDynamicMFile(const string &basename) const
|
||||||
ostringstream tmp, tmp1, tmp_eq;
|
ostringstream tmp, tmp1, tmp_eq;
|
||||||
bool OK;
|
bool OK;
|
||||||
string filename = packageDir(basename) + "/dynamic.m";
|
string filename = packageDir(basename) + "/dynamic.m";
|
||||||
mDynamicModelFile.open(filename.c_str(), ios::out | ios::binary);
|
mDynamicModelFile.open(filename, ios::out | ios::binary);
|
||||||
if (!mDynamicModelFile.is_open())
|
if (!mDynamicModelFile.is_open())
|
||||||
{
|
{
|
||||||
cerr << "Error: Can't open file " << filename << " for writing" << endl;
|
cerr << "Error: Can't open file " << filename << " for writing" << endl;
|
||||||
|
@ -2144,7 +2144,7 @@ DynamicModel::writeWrapperFunctions(const string &basename, const string &ending
|
||||||
|
|
||||||
string filename = packageDir(basename) + "/" + name + ".m";
|
string filename = packageDir(basename) + "/" + name + ".m";
|
||||||
ofstream output;
|
ofstream output;
|
||||||
output.open(filename.c_str(), ios::out | ios::binary);
|
output.open(filename, ios::out | ios::binary);
|
||||||
if (!output.is_open())
|
if (!output.is_open())
|
||||||
{
|
{
|
||||||
cerr << "Error: Can't open file " << filename << " for writing" << endl;
|
cerr << "Error: Can't open file " << filename << " for writing" << endl;
|
||||||
|
@ -2194,7 +2194,7 @@ DynamicModel::writeDynamicModelHelper(const string &basename,
|
||||||
{
|
{
|
||||||
string filename = packageDir(basename) + "/" + name_tt + ".m";
|
string filename = packageDir(basename) + "/" + name_tt + ".m";
|
||||||
ofstream output;
|
ofstream output;
|
||||||
output.open(filename.c_str(), ios::out | ios::binary);
|
output.open(filename, ios::out | ios::binary);
|
||||||
if (!output.is_open())
|
if (!output.is_open())
|
||||||
{
|
{
|
||||||
cerr << "Error: Can't open file " << filename << " for writing" << endl;
|
cerr << "Error: Can't open file " << filename << " for writing" << endl;
|
||||||
|
@ -2231,7 +2231,7 @@ DynamicModel::writeDynamicModelHelper(const string &basename,
|
||||||
output.close();
|
output.close();
|
||||||
|
|
||||||
filename = packageDir(basename) + "/" + name + ".m";
|
filename = packageDir(basename) + "/" + name + ".m";
|
||||||
output.open(filename.c_str(), ios::out | ios::binary);
|
output.open(filename, ios::out | ios::binary);
|
||||||
if (!output.is_open())
|
if (!output.is_open())
|
||||||
{
|
{
|
||||||
cerr << "Error: Can't open file " << filename << " for writing" << endl;
|
cerr << "Error: Can't open file " << filename << " for writing" << endl;
|
||||||
|
@ -2276,7 +2276,7 @@ DynamicModel::writeDynamicMatlabCompatLayer(const string &basename) const
|
||||||
{
|
{
|
||||||
string filename = packageDir(basename) + "/dynamic.m";
|
string filename = packageDir(basename) + "/dynamic.m";
|
||||||
ofstream output;
|
ofstream output;
|
||||||
output.open(filename.c_str(), ios::out | ios::binary);
|
output.open(filename, ios::out | ios::binary);
|
||||||
if (!output.is_open())
|
if (!output.is_open())
|
||||||
{
|
{
|
||||||
cerr << "Error: Can't open file " << filename << " for writing" << endl;
|
cerr << "Error: Can't open file " << filename << " for writing" << endl;
|
||||||
|
@ -2633,7 +2633,7 @@ DynamicModel::writeDynamicModel(const string &basename, ostream &DynamicOutput,
|
||||||
{
|
{
|
||||||
string filename = basename + "Dynamic.jl";
|
string filename = basename + "Dynamic.jl";
|
||||||
ofstream output;
|
ofstream output;
|
||||||
output.open(filename.c_str(), ios::out | ios::binary);
|
output.open(filename, ios::out | ios::binary);
|
||||||
if (!output.is_open())
|
if (!output.is_open())
|
||||||
{
|
{
|
||||||
cerr << "Error: Can't open file " << filename << " for writing" << endl;
|
cerr << "Error: Can't open file " << filename << " for writing" << endl;
|
||||||
|
@ -3260,7 +3260,7 @@ DynamicModel::writeOutput(ostream &output, const string &basename, bool block_de
|
||||||
ofstream KF_index_file;
|
ofstream KF_index_file;
|
||||||
boost::filesystem::create_directories(basename + "/model/bytecode");
|
boost::filesystem::create_directories(basename + "/model/bytecode");
|
||||||
string main_name = basename + "/model/bytecode/kfi";
|
string main_name = basename + "/model/bytecode/kfi";
|
||||||
KF_index_file.open(main_name.c_str(), ios::out | ios::binary | ios::ate);
|
KF_index_file.open(main_name, ios::out | ios::binary | ios::ate);
|
||||||
int n_obs = symbol_table.observedVariablesNbr();
|
int n_obs = symbol_table.observedVariablesNbr();
|
||||||
int n_state = state_var.size();
|
int n_state = state_var.size();
|
||||||
for (vector<int>::const_iterator it = state_var.begin(); it != state_var.end(); it++)
|
for (vector<int>::const_iterator it = state_var.begin(); it != state_var.end(); it++)
|
||||||
|
@ -4369,7 +4369,7 @@ DynamicModel::writeSetAuxiliaryVariables(const string &basename, const bool juli
|
||||||
string comment = julia ? "#" : "%";
|
string comment = julia ? "#" : "%";
|
||||||
|
|
||||||
ofstream output;
|
ofstream output;
|
||||||
output.open(filename.c_str(), ios::out | ios::binary);
|
output.open(filename, ios::out | ios::binary);
|
||||||
if (!output.is_open())
|
if (!output.is_open())
|
||||||
{
|
{
|
||||||
cerr << "ERROR: Can't open file " << filename << " for writing" << endl;
|
cerr << "ERROR: Can't open file " << filename << " for writing" << endl;
|
||||||
|
@ -5014,7 +5014,7 @@ DynamicModel::writeParamsDerivativesFile(const string &basename, bool julia) con
|
||||||
|
|
||||||
string filename = julia ? basename + "DynamicParamsDerivs.jl" : packageDir(basename) + "/dynamic_params_derivs.m";
|
string filename = julia ? basename + "DynamicParamsDerivs.jl" : packageDir(basename) + "/dynamic_params_derivs.m";
|
||||||
ofstream paramsDerivsFile;
|
ofstream paramsDerivsFile;
|
||||||
paramsDerivsFile.open(filename.c_str(), ios::out | ios::binary);
|
paramsDerivsFile.open(filename, ios::out | ios::binary);
|
||||||
if (!paramsDerivsFile.is_open())
|
if (!paramsDerivsFile.is_open())
|
||||||
{
|
{
|
||||||
cerr << "ERROR: Can't open file " << filename << " for writing" << endl;
|
cerr << "ERROR: Can't open file " << filename << " for writing" << endl;
|
||||||
|
@ -5729,7 +5729,7 @@ DynamicModel::isChecksumMatching(const string &basename) const
|
||||||
// read old checksum if it exists
|
// read old checksum if it exists
|
||||||
if (basename_dir_exists)
|
if (basename_dir_exists)
|
||||||
{
|
{
|
||||||
checksum_file.open(filename.c_str(), ios::in | ios::binary);
|
checksum_file.open(filename, ios::in | ios::binary);
|
||||||
if (checksum_file.is_open())
|
if (checksum_file.is_open())
|
||||||
{
|
{
|
||||||
checksum_file >> old_checksum;
|
checksum_file >> old_checksum;
|
||||||
|
@ -5739,7 +5739,7 @@ DynamicModel::isChecksumMatching(const string &basename) const
|
||||||
// write new checksum file if none or different from old checksum
|
// write new checksum file if none or different from old checksum
|
||||||
if (old_checksum != result.checksum())
|
if (old_checksum != result.checksum())
|
||||||
{
|
{
|
||||||
checksum_file.open(filename.c_str(), ios::out | ios::binary);
|
checksum_file.open(filename, ios::out | ios::binary);
|
||||||
if (!checksum_file.is_open())
|
if (!checksum_file.is_open())
|
||||||
{
|
{
|
||||||
cerr << "ERROR: Can't open file " << filename << endl;
|
cerr << "ERROR: Can't open file " << filename << endl;
|
||||||
|
@ -5851,7 +5851,7 @@ DynamicModel::writeResidualsC(const string &basename, bool cuda) const
|
||||||
string filename = basename + "_residuals.c";
|
string filename = basename + "_residuals.c";
|
||||||
ofstream mDynamicModelFile, mDynamicMexFile;
|
ofstream mDynamicModelFile, mDynamicMexFile;
|
||||||
|
|
||||||
mDynamicModelFile.open(filename.c_str(), ios::out | ios::binary);
|
mDynamicModelFile.open(filename, ios::out | ios::binary);
|
||||||
if (!mDynamicModelFile.is_open())
|
if (!mDynamicModelFile.is_open())
|
||||||
{
|
{
|
||||||
cerr << "Error: Can't open file " << filename << " for writing" << endl;
|
cerr << "Error: Can't open file " << filename << " for writing" << endl;
|
||||||
|
@ -5904,7 +5904,7 @@ DynamicModel::writeFirstDerivativesC(const string &basename, bool cuda) const
|
||||||
string filename = basename + "_first_derivatives.c";
|
string filename = basename + "_first_derivatives.c";
|
||||||
ofstream mDynamicModelFile, mDynamicMexFile;
|
ofstream mDynamicModelFile, mDynamicMexFile;
|
||||||
|
|
||||||
mDynamicModelFile.open(filename.c_str(), ios::out | ios::binary);
|
mDynamicModelFile.open(filename, ios::out | ios::binary);
|
||||||
if (!mDynamicModelFile.is_open())
|
if (!mDynamicModelFile.is_open())
|
||||||
{
|
{
|
||||||
cerr << "Error: Can't open file " << filename << " for writing" << endl;
|
cerr << "Error: Can't open file " << filename << " for writing" << endl;
|
||||||
|
@ -5963,7 +5963,7 @@ DynamicModel::writeFirstDerivativesC_csr(const string &basename, bool cuda) cons
|
||||||
string filename = basename + "_first_derivatives.c";
|
string filename = basename + "_first_derivatives.c";
|
||||||
ofstream mDynamicModelFile, mDynamicMexFile;
|
ofstream mDynamicModelFile, mDynamicMexFile;
|
||||||
|
|
||||||
mDynamicModelFile.open(filename.c_str(), ios::out | ios::binary);
|
mDynamicModelFile.open(filename, ios::out | ios::binary);
|
||||||
if (!mDynamicModelFile.is_open())
|
if (!mDynamicModelFile.is_open())
|
||||||
{
|
{
|
||||||
cerr << "Error: Can't open file " << filename << " for writing" << endl;
|
cerr << "Error: Can't open file " << filename << " for writing" << endl;
|
||||||
|
@ -6066,7 +6066,7 @@ DynamicModel::writeSecondDerivativesC_csr(const string &basename, bool cuda) con
|
||||||
string filename = basename + "_second_derivatives.c";
|
string filename = basename + "_second_derivatives.c";
|
||||||
ofstream mDynamicModelFile, mDynamicMexFile;
|
ofstream mDynamicModelFile, mDynamicMexFile;
|
||||||
|
|
||||||
mDynamicModelFile.open(filename.c_str(), ios::out | ios::binary);
|
mDynamicModelFile.open(filename, ios::out | ios::binary);
|
||||||
if (!mDynamicModelFile.is_open())
|
if (!mDynamicModelFile.is_open())
|
||||||
{
|
{
|
||||||
cerr << "Error: Can't open file " << filename << " for writing" << endl;
|
cerr << "Error: Can't open file " << filename << " for writing" << endl;
|
||||||
|
@ -6160,7 +6160,7 @@ DynamicModel::writeThirdDerivativesC_csr(const string &basename, bool cuda) cons
|
||||||
string filename = basename + "_third_derivatives.c";
|
string filename = basename + "_third_derivatives.c";
|
||||||
ofstream mDynamicModelFile, mDynamicMexFile;
|
ofstream mDynamicModelFile, mDynamicMexFile;
|
||||||
|
|
||||||
mDynamicModelFile.open(filename.c_str(), ios::out | ios::binary);
|
mDynamicModelFile.open(filename, ios::out | ios::binary);
|
||||||
if (!mDynamicModelFile.is_open())
|
if (!mDynamicModelFile.is_open())
|
||||||
{
|
{
|
||||||
cerr << "Error: Can't open file " << filename << " for writing" << endl;
|
cerr << "Error: Can't open file " << filename << " for writing" << endl;
|
||||||
|
|
|
@ -38,7 +38,7 @@ main1(string &modfile, string &basename, string &modfiletxt, bool debug, bool sa
|
||||||
{
|
{
|
||||||
if (save_macro_file.empty())
|
if (save_macro_file.empty())
|
||||||
save_macro_file = basename + "-macroexp.mod";
|
save_macro_file = basename + "-macroexp.mod";
|
||||||
ofstream macro_output_file(save_macro_file.c_str());
|
ofstream macro_output_file(save_macro_file);
|
||||||
if (macro_output_file.fail())
|
if (macro_output_file.fail())
|
||||||
{
|
{
|
||||||
cerr << "Cannot open " << save_macro_file << " for macro output" << endl;
|
cerr << "Cannot open " << save_macro_file << " for macro output" << endl;
|
||||||
|
|
|
@ -762,7 +762,7 @@ ModFile::writeOutputFiles(const string &basename, bool clear_all, bool clear_glo
|
||||||
{
|
{
|
||||||
boost::filesystem::create_directory("+" + basename);
|
boost::filesystem::create_directory("+" + basename);
|
||||||
string fname = "+" + basename + "/driver.m";
|
string fname = "+" + basename + "/driver.m";
|
||||||
mOutputFile.open(fname.c_str(), ios::out | ios::binary);
|
mOutputFile.open(fname, ios::out | ios::binary);
|
||||||
if (!mOutputFile.is_open())
|
if (!mOutputFile.is_open())
|
||||||
{
|
{
|
||||||
cerr << "ERROR: Can't open file " << fname << " for writing" << endl;
|
cerr << "ERROR: Can't open file " << fname << " for writing" << endl;
|
||||||
|
@ -1099,7 +1099,7 @@ ModFile::writeModelC(const string &basename) const
|
||||||
string filename = basename + ".c";
|
string filename = basename + ".c";
|
||||||
|
|
||||||
ofstream mDriverCFile;
|
ofstream mDriverCFile;
|
||||||
mDriverCFile.open(filename.c_str(), ios::out | ios::binary);
|
mDriverCFile.open(filename, ios::out | ios::binary);
|
||||||
if (!mDriverCFile.is_open())
|
if (!mDriverCFile.is_open())
|
||||||
{
|
{
|
||||||
cerr << "Error: Can't open file " << filename << " for writing" << endl;
|
cerr << "Error: Can't open file " << filename << " for writing" << endl;
|
||||||
|
@ -1144,7 +1144,7 @@ ModFile::writeModelC(const string &basename) const
|
||||||
{
|
{
|
||||||
string fname(basename);
|
string fname(basename);
|
||||||
fname += ".m";
|
fname += ".m";
|
||||||
mOutputFile.open(fname.c_str(), ios::out | ios::binary);
|
mOutputFile.open(fname, ios::out | ios::binary);
|
||||||
if (!mOutputFile.is_open())
|
if (!mOutputFile.is_open())
|
||||||
{
|
{
|
||||||
cerr << "ERROR: Can't open file " << fname
|
cerr << "ERROR: Can't open file " << fname
|
||||||
|
@ -1203,7 +1203,7 @@ ModFile::writeModelCC(const string &basename) const
|
||||||
string filename = basename + ".cc";
|
string filename = basename + ".cc";
|
||||||
|
|
||||||
ofstream mDriverCFile;
|
ofstream mDriverCFile;
|
||||||
mDriverCFile.open(filename.c_str(), ios::out | ios::binary);
|
mDriverCFile.open(filename, ios::out | ios::binary);
|
||||||
if (!mDriverCFile.is_open())
|
if (!mDriverCFile.is_open())
|
||||||
{
|
{
|
||||||
cerr << "Error: Can't open file " << filename << " for writing" << endl;
|
cerr << "Error: Can't open file " << filename << " for writing" << endl;
|
||||||
|
@ -1248,7 +1248,7 @@ ModFile::writeModelCC(const string &basename) const
|
||||||
{
|
{
|
||||||
string fname(basename);
|
string fname(basename);
|
||||||
fname += ".m";
|
fname += ".m";
|
||||||
mOutputFile.open(fname.c_str(), ios::out | ios::binary);
|
mOutputFile.open(fname, ios::out | ios::binary);
|
||||||
if (!mOutputFile.is_open())
|
if (!mOutputFile.is_open())
|
||||||
{
|
{
|
||||||
cerr << "ERROR: Can't open file " << fname
|
cerr << "ERROR: Can't open file " << fname
|
||||||
|
@ -1280,7 +1280,7 @@ ModFile::writeExternalFilesJulia(const string &basename, FileOutputType output,
|
||||||
{
|
{
|
||||||
string fname(basename);
|
string fname(basename);
|
||||||
fname += ".jl";
|
fname += ".jl";
|
||||||
jlOutputFile.open(fname.c_str(), ios::out | ios::binary);
|
jlOutputFile.open(fname, ios::out | ios::binary);
|
||||||
if (!jlOutputFile.is_open())
|
if (!jlOutputFile.is_open())
|
||||||
{
|
{
|
||||||
cerr << "ERROR: Can't open file " << fname
|
cerr << "ERROR: Can't open file " << fname
|
||||||
|
@ -1514,7 +1514,7 @@ ModFile::writeJsonOutputParsingCheck(const string &basename, JsonFileOutputType
|
||||||
{
|
{
|
||||||
string fname(basename);
|
string fname(basename);
|
||||||
fname += ".json";
|
fname += ".json";
|
||||||
jsonOutputFile.open(fname.c_str(), ios::out | ios::binary);
|
jsonOutputFile.open(fname, ios::out | ios::binary);
|
||||||
if (!jsonOutputFile.is_open())
|
if (!jsonOutputFile.is_open())
|
||||||
{
|
{
|
||||||
cerr << "ERROR: Can't open file " << fname << " for writing" << endl;
|
cerr << "ERROR: Can't open file " << fname << " for writing" << endl;
|
||||||
|
@ -1536,7 +1536,7 @@ ModFile::writeJsonOutputParsingCheck(const string &basename, JsonFileOutputType
|
||||||
{
|
{
|
||||||
string fname(basename);
|
string fname(basename);
|
||||||
fname += "_original.json";
|
fname += "_original.json";
|
||||||
jsonOutputFile.open(fname.c_str(), ios::out | ios::binary);
|
jsonOutputFile.open(fname, ios::out | ios::binary);
|
||||||
if (!jsonOutputFile.is_open())
|
if (!jsonOutputFile.is_open())
|
||||||
{
|
{
|
||||||
cerr << "ERROR: Can't open file " << fname << " for writing" << endl;
|
cerr << "ERROR: Can't open file " << fname << " for writing" << endl;
|
||||||
|
@ -1558,7 +1558,7 @@ ModFile::writeJsonOutputParsingCheck(const string &basename, JsonFileOutputType
|
||||||
{
|
{
|
||||||
string fname(basename);
|
string fname(basename);
|
||||||
fname += "_steady_state_model.json";
|
fname += "_steady_state_model.json";
|
||||||
jsonOutputFile.open(fname.c_str(), ios::out | ios::binary);
|
jsonOutputFile.open(fname, ios::out | ios::binary);
|
||||||
if (!jsonOutputFile.is_open())
|
if (!jsonOutputFile.is_open())
|
||||||
{
|
{
|
||||||
cerr << "ERROR: Can't open file " << fname << " for writing" << endl;
|
cerr << "ERROR: Can't open file " << fname << " for writing" << endl;
|
||||||
|
@ -1648,7 +1648,7 @@ void
|
||||||
ModFile::writeJsonFileHelper(string &fname, ostringstream &output) const
|
ModFile::writeJsonFileHelper(string &fname, ostringstream &output) const
|
||||||
{
|
{
|
||||||
ofstream jsonOutput;
|
ofstream jsonOutput;
|
||||||
jsonOutput.open(fname.c_str(), ios::out | ios::binary);
|
jsonOutput.open(fname, ios::out | ios::binary);
|
||||||
if (!jsonOutput.is_open())
|
if (!jsonOutput.is_open())
|
||||||
{
|
{
|
||||||
cerr << "ERROR: Can't open file " << fname << " for writing" << endl;
|
cerr << "ERROR: Can't open file " << fname << " for writing" << endl;
|
||||||
|
|
|
@ -1652,14 +1652,14 @@ ModelTree::writeLatexModelFile(const string &basename, ExprNodeOutputType output
|
||||||
string filename = basename + ".tex";
|
string filename = basename + ".tex";
|
||||||
string content_basename = basename + "_content";
|
string content_basename = basename + "_content";
|
||||||
string content_filename = content_basename + ".tex";
|
string content_filename = content_basename + ".tex";
|
||||||
output.open(filename.c_str(), ios::out | ios::binary);
|
output.open(filename, ios::out | ios::binary);
|
||||||
if (!output.is_open())
|
if (!output.is_open())
|
||||||
{
|
{
|
||||||
cerr << "ERROR: Can't open file " << filename << " for writing" << endl;
|
cerr << "ERROR: Can't open file " << filename << " for writing" << endl;
|
||||||
exit(EXIT_FAILURE);
|
exit(EXIT_FAILURE);
|
||||||
}
|
}
|
||||||
|
|
||||||
content_output.open(content_filename.c_str(), ios::out | ios::binary);
|
content_output.open(content_filename, ios::out | ios::binary);
|
||||||
if (!content_output.is_open())
|
if (!content_output.is_open())
|
||||||
{
|
{
|
||||||
cerr << "ERROR: Can't open file " << content_filename << " for writing" << endl;
|
cerr << "ERROR: Can't open file " << content_filename << " for writing" << endl;
|
||||||
|
|
|
@ -556,7 +556,7 @@ LoadParamsAndSteadyStateStatement::LoadParamsAndSteadyStateStatement(const strin
|
||||||
cout << "Reading " << filename << "." << endl;
|
cout << "Reading " << filename << "." << endl;
|
||||||
|
|
||||||
ifstream f;
|
ifstream f;
|
||||||
f.open(filename.c_str(), ios::in);
|
f.open(filename, ios::in);
|
||||||
if (f.fail())
|
if (f.fail())
|
||||||
{
|
{
|
||||||
cerr << "ERROR: Can't open " << filename << endl;
|
cerr << "ERROR: Can't open " << filename << endl;
|
||||||
|
|
|
@ -218,7 +218,7 @@ StaticModel::writeModelEquationsOrdered_M(const string &basename) const
|
||||||
|
|
||||||
tmp1_output.str("");
|
tmp1_output.str("");
|
||||||
tmp1_output << packageDir(basename + ".block") << "/static_" << block+1 << ".m";
|
tmp1_output << packageDir(basename + ".block") << "/static_" << block+1 << ".m";
|
||||||
output.open(tmp1_output.str().c_str(), ios::out | ios::binary);
|
output.open(tmp1_output.str(), ios::out | ios::binary);
|
||||||
output << "%\n";
|
output << "%\n";
|
||||||
output << "% " << tmp1_output.str() << " : Computes static model for Dynare\n";
|
output << "% " << tmp1_output.str() << " : Computes static model for Dynare\n";
|
||||||
output << "%\n";
|
output << "%\n";
|
||||||
|
@ -402,7 +402,7 @@ StaticModel::writeModelEquationsCode(const string &basename, map_idx_t map_idx)
|
||||||
boost::filesystem::create_directories(basename + "/model/bytecode");
|
boost::filesystem::create_directories(basename + "/model/bytecode");
|
||||||
|
|
||||||
string main_name = basename + "/model/bytecode/static.cod";
|
string main_name = basename + "/model/bytecode/static.cod";
|
||||||
code_file.open(main_name.c_str(), ios::out | ios::binary | ios::ate);
|
code_file.open(main_name, ios::out | ios::binary | ios::ate);
|
||||||
if (!code_file.is_open())
|
if (!code_file.is_open())
|
||||||
{
|
{
|
||||||
cerr << "Error : Can't open file \"" << main_name << "\" for writing" << endl;
|
cerr << "Error : Can't open file \"" << main_name << "\" for writing" << endl;
|
||||||
|
@ -584,7 +584,7 @@ StaticModel::writeModelEquationsCode_Block(const string &basename, map_idx_t map
|
||||||
boost::filesystem::create_directories(basename + "/model/bytecode");
|
boost::filesystem::create_directories(basename + "/model/bytecode");
|
||||||
|
|
||||||
string main_name = basename + "/model/bytecode/static.cod";
|
string main_name = basename + "/model/bytecode/static.cod";
|
||||||
code_file.open(main_name.c_str(), ios::out | ios::binary | ios::ate);
|
code_file.open(main_name, ios::out | ios::binary | ios::ate);
|
||||||
if (!code_file.is_open())
|
if (!code_file.is_open())
|
||||||
{
|
{
|
||||||
cerr << "Error : Can't open file \"" << main_name << "\" for writing" << endl;
|
cerr << "Error : Can't open file \"" << main_name << "\" for writing" << endl;
|
||||||
|
@ -1167,7 +1167,7 @@ StaticModel::writeWrapperFunctions(const string &basename, const string &ending)
|
||||||
|
|
||||||
string filename = packageDir(basename) + "/" + name + ".m";
|
string filename = packageDir(basename) + "/" + name + ".m";
|
||||||
ofstream output;
|
ofstream output;
|
||||||
output.open(filename.c_str(), ios::out | ios::binary);
|
output.open(filename, ios::out | ios::binary);
|
||||||
if (!output.is_open())
|
if (!output.is_open())
|
||||||
{
|
{
|
||||||
cerr << "Error: Can't open file " << filename << " for writing" << endl;
|
cerr << "Error: Can't open file " << filename << " for writing" << endl;
|
||||||
|
@ -1216,7 +1216,7 @@ StaticModel::writeStaticModelHelper(const string &basename,
|
||||||
{
|
{
|
||||||
string filename = packageDir(basename) + "/" + name_tt + ".m";
|
string filename = packageDir(basename) + "/" + name_tt + ".m";
|
||||||
ofstream output;
|
ofstream output;
|
||||||
output.open(filename.c_str(), ios::out | ios::binary);
|
output.open(filename, ios::out | ios::binary);
|
||||||
if (!output.is_open())
|
if (!output.is_open())
|
||||||
{
|
{
|
||||||
cerr << "Error: Can't open file " << filename << " for writing" << endl;
|
cerr << "Error: Can't open file " << filename << " for writing" << endl;
|
||||||
|
@ -1248,7 +1248,7 @@ StaticModel::writeStaticModelHelper(const string &basename,
|
||||||
output.close();
|
output.close();
|
||||||
|
|
||||||
filename = packageDir(basename) + "/" + name + ".m";
|
filename = packageDir(basename) + "/" + name + ".m";
|
||||||
output.open(filename.c_str(), ios::out | ios::binary);
|
output.open(filename, ios::out | ios::binary);
|
||||||
if (!output.is_open())
|
if (!output.is_open())
|
||||||
{
|
{
|
||||||
cerr << "Error: Can't open file " << filename << " for writing" << endl;
|
cerr << "Error: Can't open file " << filename << " for writing" << endl;
|
||||||
|
@ -1289,7 +1289,7 @@ StaticModel::writeStaticMatlabCompatLayer(const string &basename) const
|
||||||
{
|
{
|
||||||
string filename = packageDir(basename) + "/static.m";
|
string filename = packageDir(basename) + "/static.m";
|
||||||
ofstream output;
|
ofstream output;
|
||||||
output.open(filename.c_str(), ios::out | ios::binary);
|
output.open(filename, ios::out | ios::binary);
|
||||||
if (!output.is_open())
|
if (!output.is_open())
|
||||||
{
|
{
|
||||||
cerr << "Error: Can't open file " << filename << " for writing" << endl;
|
cerr << "Error: Can't open file " << filename << " for writing" << endl;
|
||||||
|
@ -1654,7 +1654,7 @@ StaticModel::writeStaticModel(const string &basename,
|
||||||
{
|
{
|
||||||
string filename = basename + "Static.jl";
|
string filename = basename + "Static.jl";
|
||||||
ofstream output;
|
ofstream output;
|
||||||
output.open(filename.c_str(), ios::out | ios::binary);
|
output.open(filename, ios::out | ios::binary);
|
||||||
if (!output.is_open())
|
if (!output.is_open())
|
||||||
{
|
{
|
||||||
cerr << "Error: Can't open file " << filename << " for writing" << endl;
|
cerr << "Error: Can't open file " << filename << " for writing" << endl;
|
||||||
|
@ -1870,7 +1870,7 @@ StaticModel::writeStaticCFile(const string &basename) const
|
||||||
string filename_mex = basename + "/model/src/static_mex.c";
|
string filename_mex = basename + "/model/src/static_mex.c";
|
||||||
|
|
||||||
ofstream output;
|
ofstream output;
|
||||||
output.open(filename.c_str(), ios::out | ios::binary);
|
output.open(filename, ios::out | ios::binary);
|
||||||
if (!output.is_open())
|
if (!output.is_open())
|
||||||
{
|
{
|
||||||
cerr << "ERROR: Can't open file " << filename << " for writing" << endl;
|
cerr << "ERROR: Can't open file " << filename << " for writing" << endl;
|
||||||
|
@ -1911,7 +1911,7 @@ StaticModel::writeStaticCFile(const string &basename) const
|
||||||
writeNormcdf(output);
|
writeNormcdf(output);
|
||||||
output.close();
|
output.close();
|
||||||
|
|
||||||
output.open(filename_mex.c_str(), ios::out | ios::binary);
|
output.open(filename_mex, ios::out | ios::binary);
|
||||||
if (!output.is_open())
|
if (!output.is_open())
|
||||||
{
|
{
|
||||||
cerr << "ERROR: Can't open file " << filename_mex << " for writing" << endl;
|
cerr << "ERROR: Can't open file " << filename_mex << " for writing" << endl;
|
||||||
|
@ -2021,7 +2021,7 @@ StaticModel::writeStaticBlockMFSFile(const string &basename) const
|
||||||
string filename = packageDir(basename) + "/static.m";
|
string filename = packageDir(basename) + "/static.m";
|
||||||
|
|
||||||
ofstream output;
|
ofstream output;
|
||||||
output.open(filename.c_str(), ios::out | ios::binary);
|
output.open(filename, ios::out | ios::binary);
|
||||||
if (!output.is_open())
|
if (!output.is_open())
|
||||||
{
|
{
|
||||||
cerr << "ERROR: Can't open file " << filename << " for writing" << endl;
|
cerr << "ERROR: Can't open file " << filename << " for writing" << endl;
|
||||||
|
@ -2375,7 +2375,7 @@ StaticModel::writeSetAuxiliaryVariables(const string &basename, const bool julia
|
||||||
string comment = julia ? "#" : "%";
|
string comment = julia ? "#" : "%";
|
||||||
|
|
||||||
ofstream output;
|
ofstream output;
|
||||||
output.open(filename.c_str(), ios::out | ios::binary);
|
output.open(filename, ios::out | ios::binary);
|
||||||
if (!output.is_open())
|
if (!output.is_open())
|
||||||
{
|
{
|
||||||
cerr << "ERROR: Can't open file " << filename << " for writing" << endl;
|
cerr << "ERROR: Can't open file " << filename << " for writing" << endl;
|
||||||
|
@ -2592,7 +2592,7 @@ StaticModel::writeParamsDerivativesFile(const string &basename, bool julia) cons
|
||||||
|
|
||||||
ofstream paramsDerivsFile;
|
ofstream paramsDerivsFile;
|
||||||
string filename = julia ? basename + "StaticParamsDerivs.jl" : packageDir(basename) + "/static_params_derivs.m";
|
string filename = julia ? basename + "StaticParamsDerivs.jl" : packageDir(basename) + "/static_params_derivs.m";
|
||||||
paramsDerivsFile.open(filename.c_str(), ios::out | ios::binary);
|
paramsDerivsFile.open(filename, ios::out | ios::binary);
|
||||||
if (!paramsDerivsFile.is_open())
|
if (!paramsDerivsFile.is_open())
|
||||||
{
|
{
|
||||||
cerr << "ERROR: Can't open file " << filename << " for writing" << endl;
|
cerr << "ERROR: Can't open file " << filename << " for writing" << endl;
|
||||||
|
|
|
@ -111,14 +111,14 @@ SteadyStateModel::writeLatexSteadyStateFile(const string &basename) const
|
||||||
string content_basename = basename + "_steady_state_content";
|
string content_basename = basename + "_steady_state_content";
|
||||||
string content_filename = content_basename + ".tex";
|
string content_filename = content_basename + ".tex";
|
||||||
|
|
||||||
output.open(filename.c_str(), ios::out | ios::binary);
|
output.open(filename, ios::out | ios::binary);
|
||||||
if (!output.is_open())
|
if (!output.is_open())
|
||||||
{
|
{
|
||||||
cerr << "ERROR: Can't open file " << filename << " for writing" << endl;
|
cerr << "ERROR: Can't open file " << filename << " for writing" << endl;
|
||||||
exit(EXIT_FAILURE);
|
exit(EXIT_FAILURE);
|
||||||
}
|
}
|
||||||
|
|
||||||
content_output.open(content_filename.c_str(), ios::out | ios::binary);
|
content_output.open(content_filename, ios::out | ios::binary);
|
||||||
if (!content_output.is_open())
|
if (!content_output.is_open())
|
||||||
{
|
{
|
||||||
cerr << "ERROR: Can't open file " << content_filename << " for writing" << endl;
|
cerr << "ERROR: Can't open file " << content_filename << " for writing" << endl;
|
||||||
|
@ -161,7 +161,7 @@ SteadyStateModel::writeSteadyStateFile(const string &basename, bool ramsey_model
|
||||||
|
|
||||||
string filename = julia ? basename + "SteadyState2.jl" : packageDir(basename) + "/steadystate.m";
|
string filename = julia ? basename + "SteadyState2.jl" : packageDir(basename) + "/steadystate.m";
|
||||||
ofstream output;
|
ofstream output;
|
||||||
output.open(filename.c_str(), ios::out | ios::binary);
|
output.open(filename, ios::out | ios::binary);
|
||||||
if (!output.is_open())
|
if (!output.is_open())
|
||||||
{
|
{
|
||||||
cerr << "ERROR: Can't open file " << filename << " for writing" << endl;
|
cerr << "ERROR: Can't open file " << filename << " for writing" << endl;
|
||||||
|
@ -226,7 +226,7 @@ SteadyStateModel::writeSteadyStateFileC(const string &basename, bool ramsey_mode
|
||||||
string filename = basename + "_steadystate.c";
|
string filename = basename + "_steadystate.c";
|
||||||
|
|
||||||
ofstream output;
|
ofstream output;
|
||||||
output.open(filename.c_str(), ios::out | ios::binary);
|
output.open(filename, ios::out | ios::binary);
|
||||||
if (!output.is_open())
|
if (!output.is_open())
|
||||||
{
|
{
|
||||||
cerr << "ERROR: Can't open file " << filename << " for writing" << endl;
|
cerr << "ERROR: Can't open file " << filename << " for writing" << endl;
|
||||||
|
|
|
@ -485,7 +485,7 @@ MacroFlex::create_include_context(string *filename, Macro::parser::location_type
|
||||||
#endif
|
#endif
|
||||||
save_context(yylloc);
|
save_context(yylloc);
|
||||||
// Open new file
|
// Open new file
|
||||||
input = new ifstream(filename->c_str(), ios::binary);
|
input = new ifstream(*filename, ios::binary);
|
||||||
if (input->fail())
|
if (input->fail())
|
||||||
{
|
{
|
||||||
ostringstream dirs;
|
ostringstream dirs;
|
||||||
|
@ -493,7 +493,7 @@ MacroFlex::create_include_context(string *filename, Macro::parser::location_type
|
||||||
for (vector<string>::const_iterator it = path.begin(); it != path.end(); it++)
|
for (vector<string>::const_iterator it = path.begin(); it != path.end(); it++)
|
||||||
{
|
{
|
||||||
string testfile = *it + FILESEP + *filename;
|
string testfile = *it + FILESEP + *filename;
|
||||||
input = new ifstream(testfile.c_str(), ios::binary);
|
input = new ifstream(testfile, ios::binary);
|
||||||
if (input->good())
|
if (input->good())
|
||||||
break;
|
break;
|
||||||
dirs << *it << endl;
|
dirs << *it << endl;
|
||||||
|
|
Loading…
Reference in New Issue