Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Dynare
preprocessor
Commits
988a9f6e
Commit
988a9f6e
authored
Jun 27, 2018
by
Sébastien Villemot
Browse files
std::open and std::fstream constructor accept a std::string for filename in C++11
parent
b91ed6f7
Changes
10
Hide whitespace changes
Inline
Side-by-side
src/CodeInterpreter.hh
View file @
988a9f6e
...
...
@@ -1706,7 +1706,7 @@ public:
tags_liste_t
tags_liste
;
ifstream
CompiledCode
;
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
())
{
return
tags_liste
;
...
...
src/ConfigFile.cc
View file @
988a9f6e
...
...
@@ -138,7 +138,7 @@ ConfigFile::getConfigFileInfo(const string &config_file)
defaultConfigFile
+=
"/.dynare"
;
}
#endif
configFile
=
new
ifstream
(
defaultConfigFile
.
c_str
()
,
fstream
::
in
);
configFile
=
new
ifstream
(
defaultConfigFile
,
fstream
::
in
);
if
(
!
configFile
->
is_open
())
if
(
parallel
||
parallel_test
)
{
...
...
@@ -150,7 +150,7 @@ ConfigFile::getConfigFileInfo(const string &config_file)
}
else
{
configFile
=
new
ifstream
(
config_file
.
c_str
()
,
fstream
::
in
);
configFile
=
new
ifstream
(
config_file
,
fstream
::
in
);
if
(
!
configFile
->
is_open
())
{
cerr
<<
"ERROR: Couldn't open file "
<<
config_file
<<
endl
;;
...
...
src/DynamicModel.cc
View file @
988a9f6e
...
...
@@ -320,7 +320,7 @@ DynamicModel::writeModelEquationsOrdered_M(const string &basename) const
tmp1_output
.
str
(
""
);
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
<<
"% "
<<
tmp1_output
.
str
()
<<
" : Computes dynamic model for Dynare
\n
"
;
output
<<
"%
\n
"
;
...
...
@@ -795,7 +795,7 @@ DynamicModel::writeModelEquationsCode(const string &basename, const map_idx_t &m
boost
::
filesystem
::
create_directories
(
basename
+
"/model/bytecode"
);
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
())
{
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"
);
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
())
{
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"
;
ofstream
mDynamicModelFile
,
mDynamicMexFile
;
mDynamicModelFile
.
open
(
filename
.
c_str
()
,
ios
::
out
|
ios
::
binary
);
mDynamicModelFile
.
open
(
filename
,
ios
::
out
|
ios
::
binary
);
if
(
!
mDynamicModelFile
.
is_open
())
{
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
);
mDynamicModelFile
.
close
();
mDynamicMexFile
.
open
(
filename_mex
.
c_str
()
,
ios
::
out
|
ios
::
binary
);
mDynamicMexFile
.
open
(
filename_mex
,
ios
::
out
|
ios
::
binary
);
if
(
!
mDynamicMexFile
.
is_open
())
{
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
;
bool
OK
;
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
())
{
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"
;
ofstream
output
;
output
.
open
(
filename
.
c_str
()
,
ios
::
out
|
ios
::
binary
);
output
.
open
(
filename
,
ios
::
out
|
ios
::
binary
);
if
(
!
output
.
is_open
())
{
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"
;
ofstream
output
;
output
.
open
(
filename
.
c_str
()
,
ios
::
out
|
ios
::
binary
);
output
.
open
(
filename
,
ios
::
out
|
ios
::
binary
);
if
(
!
output
.
is_open
())
{
cerr
<<
"Error: Can't open file "
<<
filename
<<
" for writing"
<<
endl
;
...
...
@@ -2231,7 +2231,7 @@ DynamicModel::writeDynamicModelHelper(const string &basename,
output
.
close
();
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
())
{
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"
;
ofstream
output
;
output
.
open
(
filename
.
c_str
()
,
ios
::
out
|
ios
::
binary
);
output
.
open
(
filename
,
ios
::
out
|
ios
::
binary
);
if
(
!
output
.
is_open
())
{
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"
;
ofstream
output
;
output
.
open
(
filename
.
c_str
()
,
ios
::
out
|
ios
::
binary
);
output
.
open
(
filename
,
ios
::
out
|
ios
::
binary
);
if
(
!
output
.
is_open
())
{
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
;
boost
::
filesystem
::
create_directories
(
basename
+
"/model/bytecode"
);
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_state
=
state_var
.
size
();
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
?
"#"
:
"%"
;
ofstream
output
;
output
.
open
(
filename
.
c_str
()
,
ios
::
out
|
ios
::
binary
);
output
.
open
(
filename
,
ios
::
out
|
ios
::
binary
);
if
(
!
output
.
is_open
())
{
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"
;
ofstream
paramsDerivsFile
;
paramsDerivsFile
.
open
(
filename
.
c_str
()
,
ios
::
out
|
ios
::
binary
);
paramsDerivsFile
.
open
(
filename
,
ios
::
out
|
ios
::
binary
);
if
(
!
paramsDerivsFile
.
is_open
())
{
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
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
())
{
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
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
())
{
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"
;
ofstream
mDynamicModelFile
,
mDynamicMexFile
;
mDynamicModelFile
.
open
(
filename
.
c_str
()
,
ios
::
out
|
ios
::
binary
);
mDynamicModelFile
.
open
(
filename
,
ios
::
out
|
ios
::
binary
);
if
(
!
mDynamicModelFile
.
is_open
())
{
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"
;
ofstream
mDynamicModelFile
,
mDynamicMexFile
;
mDynamicModelFile
.
open
(
filename
.
c_str
()
,
ios
::
out
|
ios
::
binary
);
mDynamicModelFile
.
open
(
filename
,
ios
::
out
|
ios
::
binary
);
if
(
!
mDynamicModelFile
.
is_open
())
{
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"
;
ofstream
mDynamicModelFile
,
mDynamicMexFile
;
mDynamicModelFile
.
open
(
filename
.
c_str
()
,
ios
::
out
|
ios
::
binary
);
mDynamicModelFile
.
open
(
filename
,
ios
::
out
|
ios
::
binary
);
if
(
!
mDynamicModelFile
.
is_open
())
{
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"
;
ofstream
mDynamicModelFile
,
mDynamicMexFile
;
mDynamicModelFile
.
open
(
filename
.
c_str
()
,
ios
::
out
|
ios
::
binary
);
mDynamicModelFile
.
open
(
filename
,
ios
::
out
|
ios
::
binary
);
if
(
!
mDynamicModelFile
.
is_open
())
{
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"
;
ofstream
mDynamicModelFile
,
mDynamicMexFile
;
mDynamicModelFile
.
open
(
filename
.
c_str
()
,
ios
::
out
|
ios
::
binary
);
mDynamicModelFile
.
open
(
filename
,
ios
::
out
|
ios
::
binary
);
if
(
!
mDynamicModelFile
.
is_open
())
{
cerr
<<
"Error: Can't open file "
<<
filename
<<
" for writing"
<<
endl
;
...
...
src/DynareMain1.cc
View file @
988a9f6e
...
...
@@ -38,7 +38,7 @@ main1(string &modfile, string &basename, string &modfiletxt, bool debug, bool sa
{
if
(
save_macro_file
.
empty
())
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
())
{
cerr
<<
"Cannot open "
<<
save_macro_file
<<
" for macro output"
<<
endl
;
...
...
src/ModFile.cc
View file @
988a9f6e
...
...
@@ -762,7 +762,7 @@ ModFile::writeOutputFiles(const string &basename, bool clear_all, bool clear_glo
{
boost
::
filesystem
::
create_directory
(
"+"
+
basename
);
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
())
{
cerr
<<
"ERROR: Can't open file "
<<
fname
<<
" for writing"
<<
endl
;
...
...
@@ -1099,7 +1099,7 @@ ModFile::writeModelC(const string &basename) const
string
filename
=
basename
+
".c"
;
ofstream
mDriverCFile
;
mDriverCFile
.
open
(
filename
.
c_str
()
,
ios
::
out
|
ios
::
binary
);
mDriverCFile
.
open
(
filename
,
ios
::
out
|
ios
::
binary
);
if
(
!
mDriverCFile
.
is_open
())
{
cerr
<<
"Error: Can't open file "
<<
filename
<<
" for writing"
<<
endl
;
...
...
@@ -1144,7 +1144,7 @@ ModFile::writeModelC(const string &basename) const
{
string
fname
(
basename
);
fname
+=
".m"
;
mOutputFile
.
open
(
fname
.
c_str
()
,
ios
::
out
|
ios
::
binary
);
mOutputFile
.
open
(
fname
,
ios
::
out
|
ios
::
binary
);
if
(
!
mOutputFile
.
is_open
())
{
cerr
<<
"ERROR: Can't open file "
<<
fname
...
...
@@ -1203,7 +1203,7 @@ ModFile::writeModelCC(const string &basename) const
string
filename
=
basename
+
".cc"
;
ofstream
mDriverCFile
;
mDriverCFile
.
open
(
filename
.
c_str
()
,
ios
::
out
|
ios
::
binary
);
mDriverCFile
.
open
(
filename
,
ios
::
out
|
ios
::
binary
);
if
(
!
mDriverCFile
.
is_open
())
{
cerr
<<
"Error: Can't open file "
<<
filename
<<
" for writing"
<<
endl
;
...
...
@@ -1248,7 +1248,7 @@ ModFile::writeModelCC(const string &basename) const
{
string
fname
(
basename
);
fname
+=
".m"
;
mOutputFile
.
open
(
fname
.
c_str
()
,
ios
::
out
|
ios
::
binary
);
mOutputFile
.
open
(
fname
,
ios
::
out
|
ios
::
binary
);
if
(
!
mOutputFile
.
is_open
())
{
cerr
<<
"ERROR: Can't open file "
<<
fname
...
...
@@ -1280,7 +1280,7 @@ ModFile::writeExternalFilesJulia(const string &basename, FileOutputType output,
{
string
fname
(
basename
);
fname
+=
".jl"
;
jlOutputFile
.
open
(
fname
.
c_str
()
,
ios
::
out
|
ios
::
binary
);
jlOutputFile
.
open
(
fname
,
ios
::
out
|
ios
::
binary
);
if
(
!
jlOutputFile
.
is_open
())
{
cerr
<<
"ERROR: Can't open file "
<<
fname
...
...
@@ -1514,7 +1514,7 @@ ModFile::writeJsonOutputParsingCheck(const string &basename, JsonFileOutputType
{
string
fname
(
basename
);
fname
+=
".json"
;
jsonOutputFile
.
open
(
fname
.
c_str
()
,
ios
::
out
|
ios
::
binary
);
jsonOutputFile
.
open
(
fname
,
ios
::
out
|
ios
::
binary
);
if
(
!
jsonOutputFile
.
is_open
())
{
cerr
<<
"ERROR: Can't open file "
<<
fname
<<
" for writing"
<<
endl
;
...
...
@@ -1536,7 +1536,7 @@ ModFile::writeJsonOutputParsingCheck(const string &basename, JsonFileOutputType
{
string
fname
(
basename
);
fname
+=
"_original.json"
;
jsonOutputFile
.
open
(
fname
.
c_str
()
,
ios
::
out
|
ios
::
binary
);
jsonOutputFile
.
open
(
fname
,
ios
::
out
|
ios
::
binary
);
if
(
!
jsonOutputFile
.
is_open
())
{
cerr
<<
"ERROR: Can't open file "
<<
fname
<<
" for writing"
<<
endl
;
...
...
@@ -1558,7 +1558,7 @@ ModFile::writeJsonOutputParsingCheck(const string &basename, JsonFileOutputType
{
string
fname
(
basename
);
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
())
{
cerr
<<
"ERROR: Can't open file "
<<
fname
<<
" for writing"
<<
endl
;
...
...
@@ -1648,7 +1648,7 @@ void
ModFile
::
writeJsonFileHelper
(
string
&
fname
,
ostringstream
&
output
)
const
{
ofstream
jsonOutput
;
jsonOutput
.
open
(
fname
.
c_str
()
,
ios
::
out
|
ios
::
binary
);
jsonOutput
.
open
(
fname
,
ios
::
out
|
ios
::
binary
);
if
(
!
jsonOutput
.
is_open
())
{
cerr
<<
"ERROR: Can't open file "
<<
fname
<<
" for writing"
<<
endl
;
...
...
src/ModelTree.cc
View file @
988a9f6e
...
...
@@ -1652,14 +1652,14 @@ ModelTree::writeLatexModelFile(const string &basename, ExprNodeOutputType output
string
filename
=
basename
+
".tex"
;
string
content_basename
=
basename
+
"_content"
;
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
())
{
cerr
<<
"ERROR: Can't open file "
<<
filename
<<
" for writing"
<<
endl
;
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
())
{
cerr
<<
"ERROR: Can't open file "
<<
content_filename
<<
" for writing"
<<
endl
;
...
...
src/NumericalInitialization.cc
View file @
988a9f6e
...
...
@@ -556,7 +556,7 @@ LoadParamsAndSteadyStateStatement::LoadParamsAndSteadyStateStatement(const strin
cout
<<
"Reading "
<<
filename
<<
"."
<<
endl
;
ifstream
f
;
f
.
open
(
filename
.
c_str
()
,
ios
::
in
);
f
.
open
(
filename
,
ios
::
in
);
if
(
f
.
fail
())
{
cerr
<<
"ERROR: Can't open "
<<
filename
<<
endl
;
...
...
src/StaticModel.cc
View file @
988a9f6e
...
...
@@ -218,7 +218,7 @@ StaticModel::writeModelEquationsOrdered_M(const string &basename) const
tmp1_output
.
str
(
""
);
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
<<
"% "
<<
tmp1_output
.
str
()
<<
" : Computes static model for Dynare
\n
"
;
output
<<
"%
\n
"
;
...
...
@@ -402,7 +402,7 @@ StaticModel::writeModelEquationsCode(const string &basename, map_idx_t map_idx)
boost
::
filesystem
::
create_directories
(
basename
+
"/model/bytecode"
);
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
())
{
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"
);
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
())
{
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"
;
ofstream
output
;
output
.
open
(
filename
.
c_str
()
,
ios
::
out
|
ios
::
binary
);
output
.
open
(
filename
,
ios
::
out
|
ios
::
binary
);
if
(
!
output
.
is_open
())
{
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"
;
ofstream
output
;
output
.
open
(
filename
.
c_str
()
,
ios
::
out
|
ios
::
binary
);
output
.
open
(
filename
,
ios
::
out
|
ios
::
binary
);
if
(
!
output
.
is_open
())
{
cerr
<<
"Error: Can't open file "
<<
filename
<<
" for writing"
<<
endl
;
...
...
@@ -1248,7 +1248,7 @@ StaticModel::writeStaticModelHelper(const string &basename,
output
.
close
();
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
())
{
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"
;
ofstream
output
;
output
.
open
(
filename
.
c_str
()
,
ios
::
out
|
ios
::
binary
);
output
.
open
(
filename
,
ios
::
out
|
ios
::
binary
);
if
(
!
output
.
is_open
())
{
cerr
<<
"Error: Can't open file "
<<
filename
<<
" for writing"
<<
endl
;
...
...
@@ -1654,7 +1654,7 @@ StaticModel::writeStaticModel(const string &basename,
{
string
filename
=
basename
+
"Static.jl"
;
ofstream
output
;
output
.
open
(
filename
.
c_str
()
,
ios
::
out
|
ios
::
binary
);
output
.
open
(
filename
,
ios
::
out
|
ios
::
binary
);
if
(
!
output
.
is_open
())
{
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"
;
ofstream
output
;
output
.
open
(
filename
.
c_str
()
,
ios
::
out
|
ios
::
binary
);
output
.
open
(
filename
,
ios
::
out
|
ios
::
binary
);
if
(
!
output
.
is_open
())
{
cerr
<<
"ERROR: Can't open file "
<<
filename
<<
" for writing"
<<
endl
;
...
...
@@ -1911,7 +1911,7 @@ StaticModel::writeStaticCFile(const string &basename) const
writeNormcdf
(
output
);
output
.
close
();
output
.
open
(
filename_mex
.
c_str
()
,
ios
::
out
|
ios
::
binary
);
output
.
open
(
filename_mex
,
ios
::
out
|
ios
::
binary
);
if
(
!
output
.
is_open
())
{
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"
;
ofstream
output
;
output
.
open
(
filename
.
c_str
()
,
ios
::
out
|
ios
::
binary
);
output
.
open
(
filename
,
ios
::
out
|
ios
::
binary
);
if
(
!
output
.
is_open
())
{
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
?
"#"
:
"%"
;
ofstream
output
;
output
.
open
(
filename
.
c_str
()
,
ios
::
out
|
ios
::
binary
);
output
.
open
(
filename
,
ios
::
out
|
ios
::
binary
);
if
(
!
output
.
is_open
())
{
cerr
<<
"ERROR: Can't open file "
<<
filename
<<
" for writing"
<<
endl
;
...
...
@@ -2592,7 +2592,7 @@ StaticModel::writeParamsDerivativesFile(const string &basename, bool julia) cons
ofstream
paramsDerivsFile
;
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
())
{
cerr
<<
"ERROR: Can't open file "
<<
filename
<<
" for writing"
<<
endl
;
...
...
src/SteadyStateModel.cc
View file @
988a9f6e
...
...
@@ -111,14 +111,14 @@ SteadyStateModel::writeLatexSteadyStateFile(const string &basename) const
string
content_basename
=
basename
+
"_steady_state_content"
;
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
())
{
cerr
<<
"ERROR: Can't open file "
<<
filename
<<
" for writing"
<<
endl
;
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
())
{
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"
;
ofstream
output
;
output
.
open
(
filename
.
c_str
()
,
ios
::
out
|
ios
::
binary
);
output
.
open
(
filename
,
ios
::
out
|
ios
::
binary
);
if
(
!
output
.
is_open
())
{
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"
;
ofstream
output
;
output
.
open
(
filename
.
c_str
()
,
ios
::
out
|
ios
::
binary
);
output
.
open
(
filename
,
ios
::
out
|
ios
::
binary
);
if
(
!
output
.
is_open
())
{
cerr
<<
"ERROR: Can't open file "
<<
filename
<<
" for writing"
<<
endl
;
...
...
src/macro/MacroFlex.ll
View file @
988a9f6e
...
...
@@ -485,7 +485,7 @@ MacroFlex::create_include_context(string *filename, Macro::parser::location_type
#endif
save_context
(
yylloc
)
;
//
Open
new
file
input
=
new
ifstream
(
filename
-
>
c_str
()
,
ios:
:binary
)
;
input
=
new
ifstream
(
*
filename
,
ios:
:binary
)
;
if
(
input-
>
fail
())
{
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++)
{
string
testfile
=
*
it
+
FILESEP
+
*
filename
;
input
=
new
ifstream
(
testfile
.
c_str
()
,
ios:
:binary
)
;
input
=
new
ifstream
(
testfile
,
ios:
:binary
)
;
if
(
input-
>
good
())
break
;
dirs
<<
*
it
<<
endl
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment