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
51feda7d
Commit
51feda7d
authored
Jun 14, 2017
by
Stéphane Adjemian
Browse files
Fixed code indentation.
parent
3eddd5ce
Changes
35
Expand all
Hide whitespace changes
Inline
Side-by-side
CodeInterpreter.hh
View file @
51feda7d
...
...
@@ -228,15 +228,15 @@ enum TrinaryOpcode
};
enum
external_function_type
{
ExternalFunctionWithoutDerivative
,
ExternalFunctionWithFirstDerivative
,
ExternalFunctionWithFirstandSecondDerivative
,
ExternalFunctionNumericalFirstDerivative
,
ExternalFunctionFirstDerivative
,
ExternalFunctionNumericalSecondDerivative
,
ExternalFunctionSecondDerivative
};
{
ExternalFunctionWithoutDerivative
,
ExternalFunctionWithFirstDerivative
,
ExternalFunctionWithFirstandSecondDerivative
,
ExternalFunctionNumericalFirstDerivative
,
ExternalFunctionFirstDerivative
,
ExternalFunctionNumericalSecondDerivative
,
ExternalFunctionSecondDerivative
};
enum
PriorDistributions
{
...
...
@@ -1451,9 +1451,9 @@ public:
exogenous
=
vector
<
unsigned
int
>
(
exogenous_arg
);
other_endogenous
=
vector
<
unsigned
int
>
(
other_endogenous_arg
);
is_linear
=
is_linear_arg
;
endo_nbr
=
endo_nbr_arg
;
Max_Lag
=
Max_Lag_arg
;
Max_Lead
=
Max_Lead_arg
;
u_count_int
=
u_count_int_arg
;
nb_col_jacob
=
nb_col_jacob_arg
;
det_exo_size
=
det_exo_size_arg
;
nb_col_det_exo_jacob
=
nb_col_det_exo_jacob_arg
;
exo_size
=
exo_size_arg
;
nb_col_exo_jacob
=
nb_col_exo_jacob_arg
;
nb_col_jacob
=
nb_col_jacob_arg
;
det_exo_size
=
det_exo_size_arg
;
nb_col_det_exo_jacob
=
nb_col_det_exo_jacob_arg
;
exo_size
=
exo_size_arg
;
nb_col_exo_jacob
=
nb_col_exo_jacob_arg
;
other_endo_size
=
other_endo_size_arg
;
nb_col_other_endo_jacob
=
nb_col_other_endo_jacob_arg
;
};
inline
...
...
@@ -1467,7 +1467,7 @@ public:
is_linear
=
is_linear_arg
;
endo_nbr
=
endo_nbr_arg
;
Max_Lag
=
Max_Lag_arg
;
Max_Lead
=
Max_Lead_arg
;
u_count_int
=
u_count_int_arg
;
nb_col_jacob
=
nb_col_jacob_arg
;
det_exo_size
=
0
;
exo_size
=
0
;
other_endo_size
=
0
;
nb_col_det_exo_jacob
=
0
;
nb_col_exo_jacob
=
0
;
nb_col_other_endo_jacob
=
0
;
nb_col_det_exo_jacob
=
0
;
nb_col_exo_jacob
=
0
;
nb_col_other_endo_jacob
=
0
;
}
inline
unsigned
int
get_size
()
...
...
@@ -2025,4 +2025,3 @@ public:
#endif
#pragma pack(pop)
#endif
ComputingTasks.cc
View file @
51feda7d
This diff is collapsed.
Click to expand it.
ComputingTasks.hh
View file @
51feda7d
...
...
@@ -137,7 +137,7 @@ private:
const
OptionsList
options_list
;
public:
RamseyModelStatement
(
const
SymbolList
&
symbol_list_arg
,
const
OptionsList
&
options_list_arg
);
const
OptionsList
&
options_list_arg
);
virtual
void
checkPass
(
ModFileStructure
&
mod_file_struct
,
WarningConsolidation
&
warnings
);
virtual
void
writeOutput
(
ostream
&
output
,
const
string
&
basename
,
bool
minimal_workspace
)
const
;
virtual
void
writeJsonOutput
(
ostream
&
output
)
const
;
...
...
@@ -146,11 +146,12 @@ public:
class
RamseyConstraintsStatement
:
public
Statement
{
public:
struct
Constraint
{
struct
Constraint
{
int
endo
;
BinaryOpcode
code
;
expr_t
expression
;
};
};
typedef
vector
<
Constraint
>
constraints_t
;
private:
const
SymbolTable
&
symbol_table
;
...
...
@@ -186,7 +187,7 @@ private:
const
OptionsList
options_list
;
public:
DiscretionaryPolicyStatement
(
const
SymbolList
&
symbol_list_arg
,
const
OptionsList
&
options_list_arg
);
const
OptionsList
&
options_list_arg
);
virtual
void
checkPass
(
ModFileStructure
&
mod_file_struct
,
WarningConsolidation
&
warnings
);
virtual
void
writeOutput
(
ostream
&
output
,
const
string
&
basename
,
bool
minimal_workspace
)
const
;
virtual
void
writeJsonOutput
(
ostream
&
output
)
const
;
...
...
@@ -455,7 +456,8 @@ public:
/*! \param model_tree_arg the model tree used to store the objective function.
It is owned by the PlannerObjectiveStatement, and will be deleted by its destructor */
PlannerObjectiveStatement
(
StaticModel
*
model_tree_arg
);
virtual
~
PlannerObjectiveStatement
();
virtual
~
PlannerObjectiveStatement
();
/*! \todo check there are only endogenous variables at the current period in the objective
(no exogenous, no lead/lag) */
virtual
void
checkPass
(
ModFileStructure
&
mod_file_struct
,
WarningConsolidation
&
warnings
);
...
...
@@ -553,7 +555,7 @@ private:
const
OptionsList
options_list
;
public:
MSSBVARIrfStatement
(
const
SymbolList
&
symbol_list_arg
,
const
OptionsList
&
options_list_arg
);
const
OptionsList
&
options_list_arg
);
virtual
void
checkPass
(
ModFileStructure
&
mod_file_struct
,
WarningConsolidation
&
warnings
);
virtual
void
writeOutput
(
ostream
&
output
,
const
string
&
basename
,
bool
minimal_workspace
)
const
;
virtual
void
writeJsonOutput
(
ostream
&
output
)
const
;
...
...
@@ -691,7 +693,7 @@ public:
int
lag
;
int
variable
;
expr_t
value
;
};
};
typedef
vector
<
svar_identification_restriction
>
svar_identification_restrictions_t
;
private:
...
...
@@ -705,7 +707,7 @@ public:
SvarIdentificationStatement
(
const
svar_identification_restrictions_t
&
restrictions_arg
,
const
bool
&
upper_cholesky_present_arg
,
const
bool
&
lower_cholesky_present_arg
,
const
bool
&
constants_exclusion_present_arg
,
const
bool
&
constants_exclusion_present_arg
,
const
SymbolTable
&
symbol_table_arg
);
virtual
void
checkPass
(
ModFileStructure
&
mod_file_struct
,
WarningConsolidation
&
warnings
);
virtual
void
writeOutput
(
ostream
&
output
,
const
string
&
basename
,
bool
minimal_workspace
)
const
;
...
...
@@ -819,11 +821,11 @@ public:
virtual
void
writeJsonOutput
(
ostream
&
output
)
const
;
};
class
BasicPriorStatement
:
public
Statement
{
public:
virtual
~
BasicPriorStatement
();
virtual
~
BasicPriorStatement
();
protected:
const
string
name
;
const
string
subsample_name
;
...
...
@@ -932,7 +934,8 @@ public:
class
BasicOptionsStatement
:
public
Statement
{
public:
virtual
~
BasicOptionsStatement
();
virtual
~
BasicOptionsStatement
();
protected:
const
string
name
;
const
string
subsample_name
;
...
...
ConfigFile.cc
View file @
51feda7d
...
...
@@ -102,7 +102,7 @@ ConfigFile::getConfigFileInfo(const string &config_file)
if
(
config_file
.
empty
())
{
string
defaultConfigFile
(
""
);
string
defaultConfigFile
(
""
);
// Test OS and try to open default file
#if defined(_WIN32) || defined(__CYGWIN32__)
if
(
getenv
(
"APPDATA"
)
==
NULL
)
...
...
@@ -122,42 +122,41 @@ ConfigFile::getConfigFileInfo(const string &config_file)
defaultConfigFile
+=
"
\\
dynare.ini"
;
}
#else
if
(
getenv
(
"HOME"
)
==
NULL
)
{
if
(
parallel
||
parallel_test
)
cerr
<<
"ERROR: "
;
else
cerr
<<
"WARNING: "
;
cerr
<<
"HOME environment variable not found."
<<
endl
;
if
(
parallel
||
parallel_test
)
exit
(
EXIT_FAILURE
);
}
else
{
defaultConfigFile
+=
getenv
(
"HOME"
);
defaultConfigFile
+=
"/.dynare"
;
}
#endif
configFile
=
new
ifstream
(
defaultConfigFile
.
c_str
(),
fstream
::
in
);
if
(
!
configFile
->
is_open
())
if
(
getenv
(
"HOME"
)
==
NULL
)
{
if
(
parallel
||
parallel_test
)
{
cerr
<<
"ERROR: Could not open the default config file ("
<<
defaultConfigFile
<<
")"
<<
endl
;
exit
(
EXIT_FAILURE
);
}
cerr
<<
"ERROR: "
;
else
return
;
}
else
{
configFile
=
new
ifstream
(
config_file
.
c_str
(),
fstream
::
in
);
if
(
!
configFile
->
is_open
())
cerr
<<
"WARNING: "
;
cerr
<<
"HOME environment variable not found."
<<
endl
;
if
(
parallel
||
parallel_test
)
exit
(
EXIT_FAILURE
);
}
else
{
defaultConfigFile
+=
getenv
(
"HOME"
);
defaultConfigFile
+=
"/.dynare"
;
}
#endif
configFile
=
new
ifstream
(
defaultConfigFile
.
c_str
(),
fstream
::
in
);
if
(
!
configFile
->
is_open
())
if
(
parallel
||
parallel_test
)
{
cerr
<<
"ERROR: Could
n'
t open file "
<<
c
onfig
_f
ile
<<
endl
;
;
cerr
<<
"ERROR: Could
no
t open
the default config
file
(
"
<<
defaultC
onfig
F
ile
<<
")"
<<
endl
;
exit
(
EXIT_FAILURE
);
}
}
else
return
;
}
else
{
configFile
=
new
ifstream
(
config_file
.
c_str
(),
fstream
::
in
);
if
(
!
configFile
->
is_open
())
{
cerr
<<
"ERROR: Couldn't open file "
<<
config_file
<<
endl
;;
exit
(
EXIT_FAILURE
);
}
}
string
name
,
computerName
,
port
,
userName
,
password
,
remoteDrive
,
remoteDirectory
,
dynarePath
,
matlabOctavePath
,
operatingSystem
,
...
...
@@ -271,7 +270,7 @@ ConfigFile::getConfigFileInfo(const string &config_file)
vector
<
string
>
tokenizedPath
;
split
(
tokenizedPath
,
tokenizedLine
.
back
(),
is_any_of
(
":"
),
token_compress_on
);
for
(
vector
<
string
>::
iterator
it
=
tokenizedPath
.
begin
();
it
!=
tokenizedPath
.
end
();
it
++
)
it
!=
tokenizedPath
.
end
();
it
++
)
if
(
!
it
->
empty
())
{
trim
(
*
it
);
...
...
@@ -375,7 +374,7 @@ ConfigFile::getConfigFileInfo(const string &config_file)
for
(
tokenizer
<
char_separator
<
char
>
>::
iterator
it
=
tokens
.
begin
();
it
!=
tokens
.
end
();
it
++
)
{
string
token
(
*
it
);
string
token
(
*
it
);
if
(
token
.
compare
(
"("
)
==
0
)
{
begin_weight
=
true
;
...
...
@@ -525,10 +524,10 @@ void
ConfigFile
::
checkPass
(
WarningConsolidation
&
warnings
)
const
{
bool
global_init_file_declared
=
false
;
for
(
vector
<
Hook
*>::
const_iterator
it
=
hooks
.
begin
()
;
it
!=
hooks
.
end
();
it
++
)
for
(
vector
<
Hook
*>::
const_iterator
it
=
hooks
.
begin
();
it
!=
hooks
.
end
();
it
++
)
{
const
map
<
string
,
string
>
hookmap
=
(
*
it
)
->
get_hooks
();
for
(
map
<
string
,
string
>::
const_iterator
mapit
=
hookmap
.
begin
()
;
mapit
!=
hookmap
.
end
();
mapit
++
)
for
(
map
<
string
,
string
>::
const_iterator
mapit
=
hookmap
.
begin
();
mapit
!=
hookmap
.
end
();
mapit
++
)
if
(
mapit
->
first
.
compare
(
"global_init_file"
)
==
0
)
if
(
global_init_file_declared
==
true
)
{
...
...
@@ -686,10 +685,10 @@ vector<string>
ConfigFile
::
getIncludePaths
()
const
{
vector
<
string
>
include_paths
;
for
(
vector
<
Path
*>::
const_iterator
it
=
paths
.
begin
()
;
it
!=
paths
.
end
();
it
++
)
for
(
vector
<
Path
*>::
const_iterator
it
=
paths
.
begin
();
it
!=
paths
.
end
();
it
++
)
{
map
<
string
,
vector
<
string
>
>
pathmap
=
(
*
it
)
->
get_paths
();
for
(
map
<
string
,
vector
<
string
>
>::
const_iterator
mapit
=
pathmap
.
begin
()
;
mapit
!=
pathmap
.
end
();
mapit
++
)
for
(
map
<
string
,
vector
<
string
>
>::
const_iterator
mapit
=
pathmap
.
begin
();
mapit
!=
pathmap
.
end
();
mapit
++
)
for
(
vector
<
string
>::
const_iterator
vecit
=
mapit
->
second
.
begin
();
vecit
!=
mapit
->
second
.
end
();
vecit
++
)
include_paths
.
push_back
(
*
vecit
);
}
...
...
@@ -699,10 +698,10 @@ ConfigFile::getIncludePaths() const
void
ConfigFile
::
writeHooks
(
ostream
&
output
)
const
{
for
(
vector
<
Hook
*>::
const_iterator
it
=
hooks
.
begin
()
;
it
!=
hooks
.
end
();
it
++
)
for
(
vector
<
Hook
*>::
const_iterator
it
=
hooks
.
begin
();
it
!=
hooks
.
end
();
it
++
)
{
map
<
string
,
string
>
hookmap
=
(
*
it
)
->
get_hooks
();
for
(
map
<
string
,
string
>::
const_iterator
mapit
=
hookmap
.
begin
()
;
mapit
!=
hookmap
.
end
();
mapit
++
)
for
(
map
<
string
,
string
>::
const_iterator
mapit
=
hookmap
.
begin
();
mapit
!=
hookmap
.
end
();
mapit
++
)
output
<<
"options_."
<<
mapit
->
first
<<
" = '"
<<
mapit
->
second
<<
"';"
<<
endl
;
}
}
...
...
ConfigFile.hh
View file @
51feda7d
...
...
@@ -37,18 +37,26 @@ public:
private:
map
<
string
,
string
>
hooks
;
public:
inline
map
<
string
,
string
>
get_hooks
()
{
return
hooks
;
};
inline
map
<
string
,
string
>
get_hooks
()
{
return
hooks
;
};
};
class
Path
{
public:
Path
(
vector
<
string
>
&
includepath_arg
);
Path
(
vector
<
string
>
&
includepath_arg
);
~
Path
();
private:
map
<
string
,
vector
<
string
>
>
paths
;
public:
inline
map
<
string
,
vector
<
string
>
>
get_paths
()
{
return
paths
;
};
inline
map
<
string
,
vector
<
string
>
>
get_paths
()
{
return
paths
;
};
};
class
SlaveNode
...
...
DataTree.hh
View file @
51feda7d
...
...
@@ -104,7 +104,8 @@ private:
public:
DataTree
(
SymbolTable
&
symbol_table_arg
,
NumericalConstants
&
num_constants_arg
,
ExternalFunctionsTable
&
external_functions_table_arg
);
virtual
~
DataTree
();
virtual
~
DataTree
();
//! Some predefined constants
expr_t
Zero
,
One
,
Two
,
MinusOne
,
NaN
,
Infinity
,
MinusInfinity
,
Pi
;
...
...
DynamicModel.cc
View file @
51feda7d
This diff is collapsed.
Click to expand it.
DynamicModel.hh
View file @
51feda7d
...
...
@@ -285,7 +285,7 @@ public:
//! Returns number of static only equations
size_t
staticOnlyEquationsNbr
()
const
;
//! Returns number of dynamic only equations
size_t
dynamicOnlyEquationsNbr
()
const
;
...
...
@@ -337,7 +337,7 @@ public:
//! Transforms the model by creating aux vars for the diff of forward vars
/*! If subset is empty, does the transformation for all fwrd vars; otherwise
restrict it to the vars in subset */
restrict it to the vars in subset */
void
differentiateForwardVars
(
const
vector
<
string
>
&
subset
);
//! Fills eval context with values of model local variables and auxiliary variables
...
...
@@ -535,7 +535,7 @@ DynamicModel::checkHessianZero() const
return
second_derivatives
.
empty
();
}
//! Classes to re-order derivatives for various sparse storage formats
//! Classes to re-order derivatives for various sparse storage formats
class
derivative
{
public:
...
...
@@ -543,14 +543,17 @@ public:
long
unsigned
int
col_nbr
;
unsigned
int
row_nbr
;
expr_t
value
;
derivative
(
long
unsigned
int
arg1
,
long
unsigned
int
arg2
,
int
arg3
,
expr_t
arg4
)
:
linear_address
(
arg1
),
col_nbr
(
arg2
),
row_nbr
(
arg3
),
value
(
arg4
)
{};
derivative
(
long
unsigned
int
arg1
,
long
unsigned
int
arg2
,
int
arg3
,
expr_t
arg4
)
:
linear_address
(
arg1
),
col_nbr
(
arg2
),
row_nbr
(
arg3
),
value
(
arg4
)
{
};
};
class
derivative_less_than
{
public:
bool
operator
()(
const
derivative
&
d1
,
const
derivative
&
d2
)
const
bool
operator
()(
const
derivative
&
d1
,
const
derivative
&
d2
)
const
{
return
d1
.
linear_address
<
d2
.
linear_address
;
}
...
...
DynareMain.cc
View file @
51feda7d
...
...
@@ -130,8 +130,8 @@ main(int argc, char **argv)
clear_all
=
false
;
else
if
(
strlen
(
argv
[
arg
])
>=
19
&&
!
strncmp
(
argv
[
arg
],
"params_derivs_order"
,
19
))
{
if
(
strlen
(
argv
[
arg
])
>=
22
||
argv
[
arg
][
19
]
!=
'='
||
!
(
argv
[
arg
][
20
]
==
'0'
||
argv
[
arg
][
20
]
==
'1'
||
argv
[
arg
][
20
]
==
'2'
))
if
(
strlen
(
argv
[
arg
])
>=
22
||
argv
[
arg
][
19
]
!=
'='
||
!
(
argv
[
arg
][
20
]
==
'0'
||
argv
[
arg
][
20
]
==
'1'
||
argv
[
arg
][
20
]
==
'2'
))
{
cerr
<<
"Incorrect syntax for params_derivs_order option"
<<
endl
;
usage
();
...
...
@@ -228,12 +228,12 @@ main(int argc, char **argv)
size_t
equal_index
=
string
(
argv
[
arg
]).
find
(
'='
);
if
(
equal_index
!=
string
::
npos
)
{
string
key
=
string
(
argv
[
arg
]).
erase
(
equal_index
).
erase
(
0
,
2
);
string
key
=
string
(
argv
[
arg
]).
erase
(
equal_index
).
erase
(
0
,
2
);
defines
[
key
]
=
string
(
argv
[
arg
]).
erase
(
0
,
equal_index
+
1
);
}
else
{
string
key
=
string
(
argv
[
arg
]).
erase
(
0
,
2
);
string
key
=
string
(
argv
[
arg
]).
erase
(
0
,
2
);
defines
[
key
]
=
"1"
;
}
}
...
...
@@ -245,36 +245,36 @@ main(int argc, char **argv)
<<
"must not be separated from -I by whitespace."
<<
endl
;
usage
();
}
path
.
push_back
(
string
(
argv
[
arg
]).
erase
(
0
,
2
));
path
.
push_back
(
string
(
argv
[
arg
]).
erase
(
0
,
2
));
}
else
if
(
strlen
(
argv
[
arg
])
>=
6
&&
!
strncmp
(
argv
[
arg
],
"output"
,
6
))
{
if
(
strlen
(
argv
[
arg
])
<=
7
||
argv
[
arg
][
6
]
!=
'='
)
{
cerr
<<
"Incorrect syntax for ouput option"
<<
endl
;
usage
();
}
if
(
strlen
(
argv
[
arg
])
==
14
&&
!
strncmp
(
argv
[
arg
]
+
7
,
"dynamic"
,
7
))
output_mode
=
dynamic
;
else
if
(
strlen
(
argv
[
arg
])
==
12
&&
!
strncmp
(
argv
[
arg
]
+
7
,
"first"
,
5
))
output_mode
=
first
;
else
if
(
strlen
(
argv
[
arg
])
==
13
&&
!
strncmp
(
argv
[
arg
]
+
7
,
"second"
,
6
))
output_mode
=
second
;
else
if
(
strlen
(
argv
[
arg
])
==
12
&&
!
strncmp
(
argv
[
arg
]
+
7
,
"third"
,
5
))
output_mode
=
third
;
else
{
cerr
<<
"Incorrect syntax for ouput option"
<<
endl
;
usage
();
if
(
strlen
(
argv
[
arg
])
<=
7
||
argv
[
arg
][
6
]
!=
'='
)
{
cerr
<<
"Incorrect syntax for ouput option"
<<
endl
;
usage
();
}
if
(
strlen
(
argv
[
arg
])
==
14
&&
!
strncmp
(
argv
[
arg
]
+
7
,
"dynamic"
,
7
))
output_mode
=
dynamic
;
else
if
(
strlen
(
argv
[
arg
])
==
12
&&
!
strncmp
(
argv
[
arg
]
+
7
,
"first"
,
5
))
output_mode
=
first
;
else
if
(
strlen
(
argv
[
arg
])
==
13
&&
!
strncmp
(
argv
[
arg
]
+
7
,
"second"
,
6
))
output_mode
=
second
;
else
if
(
strlen
(
argv
[
arg
])
==
12
&&
!
strncmp
(
argv
[
arg
]
+
7
,
"third"
,
5
))
output_mode
=
third
;
else
{
cerr
<<
"Incorrect syntax for ouput option"
<<
endl
;
usage
();
}
}
else
if
(
strlen
(
argv
[
arg
])
>=
8
&&
!
strncmp
(
argv
[
arg
],
"language"
,
8
))
{
if
(
strlen
(
argv
[
arg
])
<=
9
||
argv
[
arg
][
8
]
!=
'='
)
{
cerr
<<
"Incorrect syntax for language option"
<<
endl
;
usage
();
}
if
(
strlen
(
argv
[
arg
])
<=
9
||
argv
[
arg
][
8
]
!=
'='
)
{
cerr
<<
"Incorrect syntax for language option"
<<
endl
;
usage
();
}
if
(
strlen
(
argv
[
arg
])
==
14
&&
!
strncmp
(
argv
[
arg
]
+
9
,
"julia"
,
5
))
language
=
julia
;
...
...
@@ -302,26 +302,26 @@ main(int argc, char **argv)
else
if
(
!
strcmp
(
argv
[
arg
],
"onlyjson"
))
onlyjson
=
true
;
else
if
(
!
strcmp
(
argv
[
arg
],
"jsonprintderivdetail"
))
jsonprintderivdetail
=
true
;
jsonprintderivdetail
=
true
;
else
if
(
strlen
(
argv
[
arg
])
>=
4
&&
!
strncmp
(
argv
[
arg
],
"json"
,
4
))
{
if
(
strlen
(
argv
[
arg
])
<=
5
||
argv
[
arg
][
4
]
!=
'='
)
{
cerr
<<
"Incorrect syntax for json option"
<<
endl
;
usage
();
}
if
(
strlen
(
argv
[
arg
])
==
10
&&
!
strncmp
(
argv
[
arg
]
+
5
,
"parse"
,
5
))
json
=
parsing
;
else
if
(
strlen
(
argv
[
arg
])
==
10
&&
!
strncmp
(
argv
[
arg
]
+
5
,
"check"
,
5
))
json
=
checkpass
;
else
if
(
strlen
(
argv
[
arg
])
==
14
&&
!
strncmp
(
argv
[
arg
]
+
5
,
"transform"
,
9
))
json
=
transformpass
;
else
if
(
strlen
(
argv
[
arg
])
==
12
&&
!
strncmp
(
argv
[
arg
]
+
5
,
"compute"
,
7
))
json
=
computingpass
;
else
{
cerr
<<
"Incorrect syntax for json option"
<<
endl
;
usage
();
if
(
strlen
(
argv
[
arg
])
<=
5
||
argv
[
arg
][
4
]
!=
'='
)
{
cerr
<<
"Incorrect syntax for json option"
<<
endl
;
usage
();
}
if
(
strlen
(
argv
[
arg
])
==
10
&&
!
strncmp
(
argv
[
arg
]
+
5
,
"parse"
,
5
))
json
=
parsing
;
else
if
(
strlen
(
argv
[
arg
])
==
10
&&
!
strncmp
(
argv
[
arg
]
+
5
,
"check"
,
5
))
json
=
checkpass
;
else
if
(
strlen
(
argv
[
arg
])
==
14
&&
!
strncmp
(
argv
[
arg
]
+
5
,
"transform"
,
9
))
json
=
transformpass
;
else
if
(
strlen
(
argv
[
arg
])
==
12
&&
!
strncmp
(
argv
[
arg
]
+
5
,
"compute"
,
7
))
json
=
computingpass
;
else
{
cerr
<<
"Incorrect syntax for json option"
<<
endl
;
usage
();
}
}
else
...
...
DynareMain2.cc
View file @
51feda7d
...
...
@@ -69,9 +69,9 @@ main2(stringstream &in, string &basename, bool debug, bool clear_all, bool clear
mod_file
->
writeOutputFiles
(
basename
,
clear_all
,
clear_global
,
no_log
,
no_warn
,
console
,
nograph
,
nointeractive
,
config_file
,
check_model_changes
,
minimal_workspace
,
compute_xrefs
#if defined(_WIN32) || defined(__CYGWIN32__) || defined(__MINGW32__)
,
cygwin
,
msvc
,
mingw
,
cygwin
,
msvc
,
mingw
#endif
);
);
delete
mod_file
;
...
...
ExprNode.cc
View file @
51feda7d
...
...
@@ -107,7 +107,7 @@ ExprNode::collectVariables(SymbolType type, set<int> &result) const
set<pair<int, int> > symbs_lags;
collectDynamicVariables(type, symbs_lags);
transform(symbs_lags.begin(), symbs_lags.end(), inserter(result, result.begin()),
boost
::
bind
(
&
pair
<
int
,
int
>::
first
,
_1
));
boost::bind(&pair<int,
int>::first,
_1));
}
void
...
...
@@ -537,7 +537,6 @@ NumConstNode::substituteStaticAuxiliaryVariable() const
return const_cast<NumConstNode *>(this);
}
VariableNode::VariableNode(DataTree &datatree_arg, int symb_id_arg, int lag_arg) :
ExprNode(datatree_arg),
symb_id(symb_id_arg),
...
...
@@ -904,7 +903,7 @@ VariableNode::substituteStaticAuxiliaryVariable() const
}
return const_cast<VariableNode *>(this);
}
double
VariableNode::eval(const eval_context_t &eval_context) const throw (EvalException, EvalExternalFunctionException)
{
...
...
@@ -1013,17 +1012,17 @@ VariableNode::collectDynamicVariables(SymbolType type_arg, set<pair<int, int> >
pair<int, expr_t>
VariableNode::normalizeEquation(int var_endo, vector<pair<int, pair<expr_t, expr_t> > > &List_of_Op_RHS) const
{
/* The equation has to be normalized with respect to the current endogenous variable ascribed to it.
The two input arguments are :
- The ID of the endogenous variable associated to the equation.
- The list of operators and operands needed to normalize the equation*
The pair returned by NormalizeEquation is composed of
- a flag indicating if the expression returned contains (flag = 1) or not (flag = 0)
the endogenous variable related to the equation.
If the expression contains more than one occurence of the associated endogenous variable,
the flag is equal to 2.
- an expression equal to the RHS if flag = 0 and equal to NULL elsewhere
/* The equation has to be normalized with respect to the current endogenous variable ascribed to it.
The two input arguments are :
- The ID of the endogenous variable associated to the equation.
- The list of operators and operands needed to normalize the equation*
The pair returned by NormalizeEquation is composed of
- a flag indicating if the expression returned contains (flag = 1) or not (flag = 0)
the endogenous variable related to the equation.
If the expression contains more than one occurence of the associated endogenous variable,
the flag is equal to 2.
- an expression equal to the RHS if flag = 0 and equal to NULL elsewhere
*/
if (type == eEndogenous)
{
...
...
@@ -1501,7 +1500,7 @@ VariableNode::removeTrendLeadLag(map<int, expr_t> trend_symbols_map) const
expr_t noTrendLeadLagNode = new VariableNode(datatree, it->first, 0);
bool log_trend = get_type() == eLogTrend;
expr_t trend = it->second;
if (get_lag() > 0)
{
expr_t growthFactorSequence = trend->decreaseLeadsLags(-1);
...
...
@@ -2003,7 +2002,7 @@ UnaryOpNode::writeJsonOutput(ostream &output,
break;
}
bool
close_parenthesis
=
false
;
bool close_parenthesis = false;
/* Enclose argument with parentheses if:
- current opcode is not uminus, or
...
...
@@ -2352,9 +2351,9 @@ UnaryOpNode::normalizeEquation(int var_endo, vector<pair<int, pair<expr_t, expr_
if (is_endogenous_present == 2) /* The equation could not be normalized and the process is given-up*/
return (make_pair(2, (expr_t) NULL));
else
if
(
is_endogenous_present
)
/* The argument of the function contains the current values of
the endogenous variable associated to the equation.
In order to normalized, we have to apply the invert function to the RHS.*/
else if (is_endogenous_present) /* The argument of the function contains the current values of
the endogenous variable associated to the equation.
In order to normalized, we have to apply the invert function to the RHS.*/
{
switch (op_code)
{
...
...
@@ -2423,7 +2422,7 @@ UnaryOpNode::normalizeEquation(int var_endo, vector<pair<int, pair<expr_t, expr_
}
}
else
{
/* If the argument of the function do not contain the current values of the endogenous variable
{ /* If the argument of the function do not contain the current values of the endogenous variable
related to the equation, the function with its argument is stored in the RHS*/
switch (op_code)
{
...
...
@@ -2660,7 +2659,7 @@ UnaryOpNode::substituteExoLag(subst_table_t &subst_table, vector<BinaryOpNode *>
expr_t
UnaryOpNode::substituteExpectation(subst_table_t &subst_table, vector<BinaryOpNode *> &neweqs, bool partial_information_model) const
{
if
(
op_code
==
oExpectation
)
if (op_code
==
oExpectation)
{
subst_table_t::iterator it = subst_table.find(const_cast<UnaryOpNode *>(this));