trunk preprocessor: automatic reindentation of all code with emacs

git-svn-id: https://www.dynare.org/svn/dynare/trunk@2372 ac1d8469-bf42-47a9-8791-bf33cf982152
issue#70
sebastien 2009-01-23 10:59:37 +00:00
parent 9d0d9f0f83
commit 1740884d1d
20 changed files with 2890 additions and 2890 deletions

View File

@ -31,9 +31,9 @@ using namespace std;
//------------------------------------------------------------------------------
BlockTriangular::BlockTriangular(const SymbolTable &symbol_table_arg) :
symbol_table(symbol_table_arg),
normalization(symbol_table_arg),
incidencematrix(symbol_table_arg)
symbol_table(symbol_table_arg),
normalization(symbol_table_arg),
incidencematrix(symbol_table_arg)
{
bt_verbose = 0;
ModelBlock = NULL;
@ -418,52 +418,52 @@ BlockTriangular::Allocate_Block(int size, int *count_Equ, int count_Block, Block
void
BlockTriangular::Free_Block(Model_Block* ModelBlock) const
{
int blk, i;
for (blk = 0;blk < ModelBlock->Size;blk++)
{
{
int blk, i;
for (blk = 0;blk < ModelBlock->Size;blk++)
{
free(ModelBlock->Block_List[blk].Equation);
free(ModelBlock->Block_List[blk].Variable);
free(ModelBlock->Block_List[blk].Exogenous);
free(ModelBlock->Block_List[blk].Own_Derivative);
free(ModelBlock->Block_List[blk].Other_Endogenous);
for (i = 0;i < ModelBlock->Block_List[blk].Max_Lag + ModelBlock->Block_List[blk].Max_Lead + 1;i++)
{
if (incidencematrix.Model_Max_Lag_Endo-ModelBlock->Block_List[blk].Max_Lag+i>=0 /*&& ModelBlock->Block_List[blk].IM_lead_lag[i].size*/)
{
free(ModelBlock->Block_List[blk].IM_lead_lag[i].u);
free(ModelBlock->Block_List[blk].IM_lead_lag[i].us);
free(ModelBlock->Block_List[blk].IM_lead_lag[i].Equ);
free(ModelBlock->Block_List[blk].IM_lead_lag[i].Var);
free(ModelBlock->Block_List[blk].IM_lead_lag[i].Equ_Index);
free(ModelBlock->Block_List[blk].IM_lead_lag[i].Var_Index);
free(ModelBlock->Block_List[blk].IM_lead_lag[i].u_other_endo);
free(ModelBlock->Block_List[blk].IM_lead_lag[i].Var_other_endo);
free(ModelBlock->Block_List[blk].IM_lead_lag[i].Equ_other_endo);
free(ModelBlock->Block_List[blk].IM_lead_lag[i].Var_Index_other_endo);
free(ModelBlock->Block_List[blk].IM_lead_lag[i].Equ_Index_other_endo);
}
if (incidencematrix.Model_Max_Lag_Exo-ModelBlock->Block_List[blk].Max_Lag+i>=0 /*&& ModelBlock->Block_List[blk].IM_lead_lag[i].size_exo*/)
{
free(ModelBlock->Block_List[blk].IM_lead_lag[i].Exogenous);
free(ModelBlock->Block_List[blk].IM_lead_lag[i].Exogenous_Index);
free(ModelBlock->Block_List[blk].IM_lead_lag[i].Equ_X_Index);
free(ModelBlock->Block_List[blk].IM_lead_lag[i].Equ_X);
}
}
free(ModelBlock->Block_List[blk].IM_lead_lag);
for(i=0; i<ModelBlock->Block_List[blk].Size; i++)
delete ModelBlock->Block_List[blk].Temporary_Terms_in_Equation[i];
free(ModelBlock->Block_List[blk].Temporary_Terms_in_Equation);
delete(ModelBlock->Block_List[blk].Temporary_InUse);
}
free(ModelBlock->Block_List);
free(ModelBlock);
free(Index_Equ_IM);
free(Index_Var_IM);
}
free(ModelBlock->Block_List[blk].Equation);
free(ModelBlock->Block_List[blk].Variable);
free(ModelBlock->Block_List[blk].Exogenous);
free(ModelBlock->Block_List[blk].Own_Derivative);
free(ModelBlock->Block_List[blk].Other_Endogenous);
for (i = 0;i < ModelBlock->Block_List[blk].Max_Lag + ModelBlock->Block_List[blk].Max_Lead + 1;i++)
{
if (incidencematrix.Model_Max_Lag_Endo-ModelBlock->Block_List[blk].Max_Lag+i>=0 /*&& ModelBlock->Block_List[blk].IM_lead_lag[i].size*/)
{
free(ModelBlock->Block_List[blk].IM_lead_lag[i].u);
free(ModelBlock->Block_List[blk].IM_lead_lag[i].us);
free(ModelBlock->Block_List[blk].IM_lead_lag[i].Equ);
free(ModelBlock->Block_List[blk].IM_lead_lag[i].Var);
free(ModelBlock->Block_List[blk].IM_lead_lag[i].Equ_Index);
free(ModelBlock->Block_List[blk].IM_lead_lag[i].Var_Index);
free(ModelBlock->Block_List[blk].IM_lead_lag[i].u_other_endo);
free(ModelBlock->Block_List[blk].IM_lead_lag[i].Var_other_endo);
free(ModelBlock->Block_List[blk].IM_lead_lag[i].Equ_other_endo);
free(ModelBlock->Block_List[blk].IM_lead_lag[i].Var_Index_other_endo);
free(ModelBlock->Block_List[blk].IM_lead_lag[i].Equ_Index_other_endo);
}
if (incidencematrix.Model_Max_Lag_Exo-ModelBlock->Block_List[blk].Max_Lag+i>=0 /*&& ModelBlock->Block_List[blk].IM_lead_lag[i].size_exo*/)
{
free(ModelBlock->Block_List[blk].IM_lead_lag[i].Exogenous);
free(ModelBlock->Block_List[blk].IM_lead_lag[i].Exogenous_Index);
free(ModelBlock->Block_List[blk].IM_lead_lag[i].Equ_X_Index);
free(ModelBlock->Block_List[blk].IM_lead_lag[i].Equ_X);
}
}
free(ModelBlock->Block_List[blk].IM_lead_lag);
for(i=0; i<ModelBlock->Block_List[blk].Size; i++)
delete ModelBlock->Block_List[blk].Temporary_Terms_in_Equation[i];
free(ModelBlock->Block_List[blk].Temporary_Terms_in_Equation);
delete(ModelBlock->Block_List[blk].Temporary_InUse);
}
free(ModelBlock->Block_List);
free(ModelBlock);
free(Index_Equ_IM);
free(Index_Var_IM);
}
t_type
@ -571,7 +571,7 @@ BlockTriangular::Reduce_Blocks_and_type_determination(int prologue, int epilogue
{
if ( ((prev_Type == EVALUATE_FORWARD_R || prev_Type == EVALUATE_FORWARD) && (Simulation_Type == EVALUATE_FORWARD_R || Simulation_Type == EVALUATE_FORWARD))
|| ((prev_Type == EVALUATE_BACKWARD_R || prev_Type == EVALUATE_BACKWARD) && (Simulation_Type == EVALUATE_BACKWARD_R || Simulation_Type == EVALUATE_BACKWARD))
)
)
{
BlockSimulationType c_Type = (Type[Type.size()-1]).first;
int c_Size = (Type[Type.size()-1]).second;

View File

@ -177,7 +177,7 @@ StochSimulStatement::writeOutput(ostream &output, const string &basename) const
}
ForecastStatement::ForecastStatement(const SymbolList &symbol_list_arg,
const OptionsList &options_list_arg) :
const OptionsList &options_list_arg) :
symbol_list(symbol_list_arg),
options_list(options_list_arg)
{

View File

@ -376,13 +376,13 @@ DataTree::AddSqRt(NodeID iArg1)
NodeID
DataTree::AddMaX(NodeID iArg1, NodeID iArg2)
{
return AddBinaryOp(iArg1, oMax, iArg2);
return AddBinaryOp(iArg1, oMax, iArg2);
}
NodeID
DataTree::AddMin(NodeID iArg1, NodeID iArg2)
{
return AddBinaryOp(iArg1, oMin, iArg2);
return AddBinaryOp(iArg1, oMin, iArg2);
}
NodeID

View File

@ -480,12 +480,12 @@ VariableNode::compile(ofstream &CompileCode, bool lhs_rhs, ExprNodeOutputType ou
void
VariableNode::computeTemporaryTerms(map<NodeID, int> &reference_count,
temporary_terms_type &temporary_terms,
map<NodeID, pair<int, int> > &first_occurence,
int Curr_block,
Model_Block *ModelBlock,
int equation,
map_idx_type &map_idx) const
temporary_terms_type &temporary_terms,
map<NodeID, pair<int, int> > &first_occurence,
int Curr_block,
Model_Block *ModelBlock,
int equation,
map_idx_type &map_idx) const
{
if(type== eModelLocalVariable)
datatree.local_variables_table[symb_id]->computeTemporaryTerms(reference_count, temporary_terms, first_occurence, Curr_block, ModelBlock, equation, map_idx);
@ -1080,7 +1080,7 @@ BinaryOpNode::cost(const temporary_terms_type &temporary_terms, bool is_matlab)
return cost + 90;
case oMax:
case oMin:
return cost + 110;
return cost + 110;
case oDivide:
return cost + 990;
case oPower:
@ -1278,7 +1278,7 @@ BinaryOpNode::writeOutput(ostream &output, ExprNodeOutputType output_type,
if ((op_code == oPower && !OFFSET(output_type)) || op_code == oMax || op_code == oMin )
{
switch (op_code)
{
{
case oPower:
output << "pow(";
break;
@ -1290,7 +1290,7 @@ BinaryOpNode::writeOutput(ostream &output, ExprNodeOutputType output_type,
break;
default:
;
}
}
arg1->writeOutput(output, output_type, temporary_terms);
output << ",";
arg2->writeOutput(output, output_type, temporary_terms);
@ -1404,7 +1404,7 @@ BinaryOpNode::collectExogenous(set<pair<int, int> > &result) const
}
TrinaryOpNode::TrinaryOpNode(DataTree &datatree_arg, const NodeID arg1_arg,
TrinaryOpcode op_code_arg, const NodeID arg2_arg, const NodeID arg3_arg) :
TrinaryOpcode op_code_arg, const NodeID arg2_arg, const NodeID arg3_arg) :
ExprNode(datatree_arg),
arg1(arg1_arg),
arg2(arg2_arg),
@ -1531,8 +1531,8 @@ TrinaryOpNode::cost(const temporary_terms_type &temporary_terms, bool is_matlab)
void
TrinaryOpNode::computeTemporaryTerms(map<NodeID, int> &reference_count,
temporary_terms_type &temporary_terms,
bool is_matlab) const
temporary_terms_type &temporary_terms,
bool is_matlab) const
{
NodeID this2 = const_cast<TrinaryOpNode *>(this);
map<NodeID, int>::iterator it = reference_count.find(this2);
@ -1557,12 +1557,12 @@ TrinaryOpNode::computeTemporaryTerms(map<NodeID, int> &reference_count,
void
TrinaryOpNode::computeTemporaryTerms(map<NodeID, int> &reference_count,
temporary_terms_type &temporary_terms,
map<NodeID, pair<int, int> > &first_occurence,
int Curr_block,
Model_Block *ModelBlock,
int equation,
map_idx_type &map_idx) const
temporary_terms_type &temporary_terms,
map<NodeID, pair<int, int> > &first_occurence,
int Curr_block,
Model_Block *ModelBlock,
int equation,
map_idx_type &map_idx) const
{
NodeID this2 = const_cast<TrinaryOpNode *>(this);
map<NodeID, int>::iterator it = reference_count.find(this2);
@ -1646,7 +1646,7 @@ TrinaryOpNode::collectTemporary_terms(const temporary_terms_type &temporary_term
void
TrinaryOpNode::writeOutput(ostream &output, ExprNodeOutputType output_type,
const temporary_terms_type &temporary_terms) const
const temporary_terms_type &temporary_terms) const
{
if (!OFFSET(output_type))
{

View File

@ -114,7 +114,7 @@ IncidenceMatrix::Get_IM(int lead_lag, SymbolType type) const
}
else //eExogenous
{
it = List_IM_X.find(lead_lag);
it = List_IM_X.find(lead_lag);
if(it!=List_IM_X.end())
return(it->second);
else

View File

@ -18,10 +18,10 @@
*/
/*
Useful documentation: Matlab 7 Mat-File Format
-----------------------------------------------
revision: October 2008 PDF only Rereleased for Version 7.7 (Release 2008b)
available at: http://www.mathworks.com/access/helpdesk/help/pdf_doc/matlab/matfile_format.pdf
Useful documentation: Matlab 7 Mat-File Format
-----------------------------------------------
revision: October 2008 PDF only Rereleased for Version 7.7 (Release 2008b)
available at: http://www.mathworks.com/access/helpdesk/help/pdf_doc/matlab/matfile_format.pdf
*/
#include "MatlabFile.hh"
@ -183,69 +183,69 @@ SimpleElem::Get_Data_Class(Data_Header_t data_header) const
returned_ReadData_t ret;
switch(data_header.DataType)
{
case miINT8: //8 bit, signed
case miUINT8: //8 bit, unsigned
ret.Type = Numerical;
ret.Simple = new INT8;
return(ret);
break;
case miINT16: //16-bit, signed
case miUINT16: //16-bit, unsigned
ret.Type = Numerical;
ret.Simple = new INT16;
return(ret);
break;
case miINT32: //32-bit, signed
case miUINT32: //32-bit, unsigned
ret.Type = Numerical;
ret.Simple = new INT32;
return(ret);
break;
case miINT64: //64-bit, signed
case miUINT64: //64-bit, unsigned
ret.Type = Numerical;
ret.Simple = new INT64;
return(ret);
break;
case miSINGLE: //IEEE® 754 single format
ret.Type = Numerical;
ret.Simple = new Single;
return(ret);
break;
case miDOUBLE: //IEEE 754 double format
ret.Type = Numerical;
ret.Simple = new Double;
return(ret);
break;
case miMATRIX: //MATLAB array
ret.Type = Matrix;
ret.Simple = NULL;
return(ret);
break;
case miCOMPRESSED: //Compressed Data
ret.Type = Compressed;
ret.Simple = NULL;
return(ret);
break;
case miUTF8: //Unicode UTF-8 Encoded Character Data
ret.Type = AlphaNumeric;
ret.Simple = new UTF8;
return(ret);
break;
case miUTF16: //Unicode UTF-16 Encoded Character Data
ret.Type = AlphaNumeric;
ret.Simple = new UTF16;
return(ret);
break;
case miUTF32: //Unicode UTF-32 Encoded Character Data
ret.Type = AlphaNumeric;
ret.Simple = new UTF32;
return(ret);
break;
default:
ret.Type = Unknown;
ret.Simple = NULL;
return(ret);
case miINT8: //8 bit, signed
case miUINT8: //8 bit, unsigned
ret.Type = Numerical;
ret.Simple = new INT8;
return(ret);
break;
case miINT16: //16-bit, signed
case miUINT16: //16-bit, unsigned
ret.Type = Numerical;
ret.Simple = new INT16;
return(ret);
break;
case miINT32: //32-bit, signed
case miUINT32: //32-bit, unsigned
ret.Type = Numerical;
ret.Simple = new INT32;
return(ret);
break;
case miINT64: //64-bit, signed
case miUINT64: //64-bit, unsigned
ret.Type = Numerical;
ret.Simple = new INT64;
return(ret);
break;
case miSINGLE: //IEEE® 754 single format
ret.Type = Numerical;
ret.Simple = new Single;
return(ret);
break;
case miDOUBLE: //IEEE 754 double format
ret.Type = Numerical;
ret.Simple = new Double;
return(ret);
break;
case miMATRIX: //MATLAB array
ret.Type = Matrix;
ret.Simple = NULL;
return(ret);
break;
case miCOMPRESSED: //Compressed Data
ret.Type = Compressed;
ret.Simple = NULL;
return(ret);
break;
case miUTF8: //Unicode UTF-8 Encoded Character Data
ret.Type = AlphaNumeric;
ret.Simple = new UTF8;
return(ret);
break;
case miUTF16: //Unicode UTF-16 Encoded Character Data
ret.Type = AlphaNumeric;
ret.Simple = new UTF16;
return(ret);
break;
case miUTF32: //Unicode UTF-32 Encoded Character Data
ret.Type = AlphaNumeric;
ret.Simple = new UTF32;
return(ret);
break;
default:
ret.Type = Unknown;
ret.Simple = NULL;
return(ret);
}
}
@ -259,36 +259,36 @@ SimpleElem::DataProceed(Data_Header data_header, char* InBuff, int* pBuff, FlagS
double tmpv;
switch(ret.Type)
{
case Numerical:
if(data_header.Number_of_Bytes/ret.Simple->size())
for(unsigned int i=0;i<data_header.Number_of_Bytes/ret.Simple->size();i++)
{
tmpv=ret.Simple->ReadNum(InBuff, pBuff);
VNumeric.push_back(tmpv);
}
//to align pBuff on a 4 Bytes
if(*pBuff % 4)
*pBuff += 4-(*pBuff % 4);
delete ret.Simple;
break;
case AlphaNumeric:
case Numerical:
if(data_header.Number_of_Bytes/ret.Simple->size())
for(unsigned int i=0;i<data_header.Number_of_Bytes/ret.Simple->size();i++)
Vstr.push_back(ret.Simple->ReadAlph(InBuff, pBuff, data_header.Number_of_Bytes));
//to align pBuff on a 4 Bytes
if(*pBuff % 4)
*pBuff += 4-(*pBuff % 4);
delete ret.Simple;
break;
case Matrix:
array_elem = matrix.ReadArray_class(InBuff, pBuff);
array_elem->ReadArray(InBuff, pBuff, flag);
break;
case Compressed:
cerr << "Error: Compressed data in Mat-file not implemnted yet!\n set option -v6 when saving to Mat-file\n";
exit(EXIT_FAILURE);
case Unknown:
cerr << "Error: Mat-file format use incomptible format with Matlab 7 specification!\n set option -v6 when saving to Mat-file\n";
exit(EXIT_FAILURE);
{
tmpv=ret.Simple->ReadNum(InBuff, pBuff);
VNumeric.push_back(tmpv);
}
//to align pBuff on a 4 Bytes
if(*pBuff % 4)
*pBuff += 4-(*pBuff % 4);
delete ret.Simple;
break;
case AlphaNumeric:
for(unsigned int i=0;i<data_header.Number_of_Bytes/ret.Simple->size();i++)
Vstr.push_back(ret.Simple->ReadAlph(InBuff, pBuff, data_header.Number_of_Bytes));
//to align pBuff on a 4 Bytes
if(*pBuff % 4)
*pBuff += 4-(*pBuff % 4);
delete ret.Simple;
break;
case Matrix:
array_elem = matrix.ReadArray_class(InBuff, pBuff);
array_elem->ReadArray(InBuff, pBuff, flag);
break;
case Compressed:
cerr << "Error: Compressed data in Mat-file not implemnted yet!\n set option -v6 when saving to Mat-file\n";
exit(EXIT_FAILURE);
case Unknown:
cerr << "Error: Mat-file format use incomptible format with Matlab 7 specification!\n set option -v6 when saving to Mat-file\n";
exit(EXIT_FAILURE);
}
}
@ -319,7 +319,7 @@ SimpleElem::Collect(const string &name, bool found, CollectStruct &collect_struc
{
array_elem->Collect(name, found, collect_struct);
}
}
}
}
@ -438,47 +438,47 @@ ArrayElem::ReadArray_class(char* InBuff, int* pBuff) const
array_flag=array_elem.ReadArrayFlag(InBuff, pBuff);
switch(array_flag.classe)
{
case Cell_array:
return(new CellArray);
break;
case Structure_:
return(new Structure);
break;
case Object_:
return(new Object);
break;
case Character_array:
return(new CharacterArray);
break;
case Sparse_array:
return(new SparseArray);
break;
case Double_precision_array:
return(new DoublePrecisionArray);
break;
case Single_precision_array:
return(new SinglePrecisionArray);
break;
case Signed_integer_8_bit:
return(new Bit8SignedInteger);
break;
case Unsigned_integer_8_bit:
return(new Bit8UnsignedInteger);
break;
case Signed_integer_16_bit:
return(new Bit16SignedInteger);
break;
case Unsigned_integer_16_bit:
return(new Bit16UnsignedInteger);
break;
case Signed_integer_32_bit:
return(new Bit32SignedInteger);
break;
case Unsigned_integer_32_bit:
return(new Bit32UnsignedInteger);
break;
default:
return(NULL);
case Cell_array:
return(new CellArray);
break;
case Structure_:
return(new Structure);
break;
case Object_:
return(new Object);
break;
case Character_array:
return(new CharacterArray);
break;
case Sparse_array:
return(new SparseArray);
break;
case Double_precision_array:
return(new DoublePrecisionArray);
break;
case Single_precision_array:
return(new SinglePrecisionArray);
break;
case Signed_integer_8_bit:
return(new Bit8SignedInteger);
break;
case Unsigned_integer_8_bit:
return(new Bit8UnsignedInteger);
break;
case Signed_integer_16_bit:
return(new Bit16SignedInteger);
break;
case Unsigned_integer_16_bit:
return(new Bit16UnsignedInteger);
break;
case Signed_integer_32_bit:
return(new Bit32SignedInteger);
break;
case Unsigned_integer_32_bit:
return(new Bit32UnsignedInteger);
break;
default:
return(NULL);
}
return(NULL);
}
@ -1024,7 +1024,7 @@ bool
MatlabFile::Collect(const string &name, CollectStruct &collect_struct) const
{
for(vector<PSimpleElem>::const_iterator it=VSimpl.begin(); it!=VSimpl.end(); it++)
(*it)->Collect(name, false, collect_struct);
(*it)->Collect(name, false, collect_struct);
return(!(collect_struct.variable_double_name.empty() and collect_struct.variable_string_name.empty()));
}
@ -1033,7 +1033,7 @@ void
MatlabFile::MatFilePrint()
{
for(vector<PSimpleElem>::iterator it=VSimpl.begin(); it!=VSimpl.end(); it++)
(*it)->Print();
(*it)->Print();
}
@ -1048,9 +1048,9 @@ MatlabFile::Delete()
}
/*
int
main(int argc, char** argv)
{
int
main(int argc, char** argv)
{
CollectStruct collect_struct;
MatlabFile matlab_file;
matlab_file.MatFileRead("gimf_steady.mat");
@ -1060,18 +1060,18 @@ main(int argc, char** argv)
//string tmp_s("stored_values");
tmp_b=matlab_file.Collect("stored_values", collect_struct);
if(tmp_b)
{
int i=0;
for(map<string,vector<double> >::iterator it2=collect_struct.variable_double_name.begin();it2!=collect_struct.variable_double_name.end();it2++)
{
i++;
cout << i << " " << it2->first.c_str() << " : ";
for(vector<double>::iterator it=it2->second.begin();it!=it2->second.end();it++)
cout << *it;
cout << "\n";
}
}
}
{
int i=0;
for(map<string,vector<double> >::iterator it2=collect_struct.variable_double_name.begin();it2!=collect_struct.variable_double_name.end();it2++)
{
i++;
cout << i << " " << it2->first.c_str() << " : ";
for(vector<double>::iterator it=it2->second.begin();it!=it2->second.end();it++)
cout << *it;
cout << "\n";
}
}
}
*/

View File

@ -77,9 +77,9 @@ ModFile::evalAllExpressions()
j++;
}
catch(ExprNode::EvalException &e)
{
cout << "error in evaluation of param\n";
}
{
cout << "error in evaluation of param\n";
}
}
}
if(mod_file_struct.load_params_and_steady_state_present && j!=symbol_table.parameter_nbr)

View File

@ -552,9 +552,9 @@ Normalization::Normalize(int n, int prologue, int epilogue, bool* IM, simple* In
#ifdef DEBUG
cout << "end of Normalize\n";
#endif
if(matchingSize < effective_n )
return(0);
else
return(1);
if(matchingSize < effective_n )
return(0);
else
return(1);
}

File diff suppressed because it is too large Load Diff

View File

@ -269,11 +269,11 @@ ParsingDriver::init_param(string *name, NodeID rhs)
// Update global eval context
/*try
{
double val = rhs->eval(mod_file->global_eval_context);
int symb_id = mod_file->symbol_table.getID(*name);
mod_file->global_eval_context[make_pair(symb_id, eParameter)] = val;
}
catch(ExprNode::EvalException &e)
double val = rhs->eval(mod_file->global_eval_context);
int symb_id = mod_file->symbol_table.getID(*name);
mod_file->global_eval_context[make_pair(symb_id, eParameter)] = val;
}
catch(ExprNode::EvalException &e)
{
}
*/
@ -296,11 +296,11 @@ ParsingDriver::init_val(string *name, NodeID rhs)
// Update global evaluation context
/*try
{
double val = rhs->eval(mod_file->global_eval_context);
int symb_id = mod_file->symbol_table.getID(*name);
mod_file->global_eval_context[make_pair(symb_id, type)] = val;
double val = rhs->eval(mod_file->global_eval_context);
int symb_id = mod_file->symbol_table.getID(*name);
mod_file->global_eval_context[make_pair(symb_id, type)] = val;
}
catch(ExprNode::EvalException &e)
catch(ExprNode::EvalException &e)
{
}
*/
@ -372,7 +372,7 @@ ParsingDriver::sparse_dll()
{
model_tree->mode = eSparseDLLMode;
/*model_tree->block_triangular.init_incidence_matrix(mod_file->symbol_table.endo_nbr);
model_tree->block_triangular.init_incidence_matrix_X(mod_file->symbol_table.exo_nbr);*/
model_tree->block_triangular.init_incidence_matrix_X(mod_file->symbol_table.exo_nbr);*/
}
void
@ -380,7 +380,7 @@ ParsingDriver::sparse()
{
model_tree->mode = eSparseMode;
/*model_tree->block_triangular.init_incidence_matrix(mod_file->symbol_table.endo_nbr);
model_tree->block_triangular.init_incidence_matrix_X(mod_file->symbol_table.exo_nbr);*/
model_tree->block_triangular.init_incidence_matrix_X(mod_file->symbol_table.exo_nbr);*/
}
void

View File

@ -24,12 +24,12 @@ using namespace std;
#include "Shocks.hh"
AbstractShocksStatement::AbstractShocksStatement(bool mshocks_arg,
const det_shocks_type &det_shocks_arg,
const var_and_std_shocks_type &var_shocks_arg,
const var_and_std_shocks_type &std_shocks_arg,
const covar_and_corr_shocks_type &covar_shocks_arg,
const covar_and_corr_shocks_type &corr_shocks_arg,
const SymbolTable &symbol_table_arg) :
const det_shocks_type &det_shocks_arg,
const var_and_std_shocks_type &var_shocks_arg,
const var_and_std_shocks_type &std_shocks_arg,
const covar_and_corr_shocks_type &covar_shocks_arg,
const covar_and_corr_shocks_type &corr_shocks_arg,
const SymbolTable &symbol_table_arg) :
mshocks(mshocks_arg),
det_shocks(det_shocks_arg),
var_shocks(var_shocks_arg),

View File

@ -51,17 +51,17 @@ enum BlockType
/*enum BlockSimulationType
{
UNKNOWN = -1, //!< Unknown simulation type
EVALUATE_FORWARD = 0, //!< Simple evaluation, normalized variable on left-hand side, forward
EVALUATE_BACKWARD = 1, //!< Simple evaluation, normalized variable on left-hand side, backward
SOLVE_FORWARD_SIMPLE = 2, //!< Block of one equation, newton solver needed, forward
SOLVE_BACKWARD_SIMPLE = 3, //!< Block of one equation, newton solver needed, backward
SOLVE_TWO_BOUNDARIES_SIMPLE = 4, //!< Block of one equation, newton solver needed, forward & ackward
SOLVE_FORWARD_COMPLETE = 5, //!< Block of several equations, newton solver needed, forward
SOLVE_BACKWARD_COMPLETE = 6, //!< Block of several equations, newton solver needed, backward
SOLVE_TWO_BOUNDARIES_COMPLETE = 7, //!< Block of several equations, newton solver needed, forward and backwar
EVALUATE_FORWARD_R = 8, //!< Simple evaluation, normalized variable on right-hand side, forward
EVALUATE_BACKWARD_R = 9 //!< Simple evaluation, normalized variable on right-hand side, backward
UNKNOWN = -1, //!< Unknown simulation type
EVALUATE_FORWARD = 0, //!< Simple evaluation, normalized variable on left-hand side, forward
EVALUATE_BACKWARD = 1, //!< Simple evaluation, normalized variable on left-hand side, backward
SOLVE_FORWARD_SIMPLE = 2, //!< Block of one equation, newton solver needed, forward
SOLVE_BACKWARD_SIMPLE = 3, //!< Block of one equation, newton solver needed, backward
SOLVE_TWO_BOUNDARIES_SIMPLE = 4, //!< Block of one equation, newton solver needed, forward & ackward
SOLVE_FORWARD_COMPLETE = 5, //!< Block of several equations, newton solver needed, forward
SOLVE_BACKWARD_COMPLETE = 6, //!< Block of several equations, newton solver needed, backward
SOLVE_TWO_BOUNDARIES_COMPLETE = 7, //!< Block of several equations, newton solver needed, forward and backwar
EVALUATE_FORWARD_R = 8, //!< Simple evaluation, normalized variable on right-hand side, forward
EVALUATE_BACKWARD_R = 9 //!< Simple evaluation, normalized variable on right-hand side, backward
};
*/
enum BlockSimulationType

View File

@ -105,7 +105,7 @@ private:
const OptionsList options_list;
public:
ForecastStatement(const SymbolList &symbol_list_arg,
const OptionsList &options_list_arg);
const OptionsList &options_list_arg);
virtual void checkPass(ModFileStructure &mod_file_struct);
virtual void writeOutput(ostream &output, const string &basename) const;
};

View File

@ -66,10 +66,10 @@ typedef map<pair<int, SymbolType>, double> eval_context_type;
/* Equal to 1 for Matlab langage, or to 0 for C language
In Matlab, array indexes begin at 1, while they begin at 0 in C */
#define OFFSET(output_type) ((output_type == oMatlabStaticModel) \
|| (output_type == oMatlabDynamicModel) \
|| (output_type == oMatlabOutsideModel) \
|| (output_type == oMatlabStaticModelSparse) \
#define OFFSET(output_type) ((output_type == oMatlabStaticModel) \
|| (output_type == oMatlabDynamicModel) \
|| (output_type == oMatlabOutsideModel) \
|| (output_type == oMatlabStaticModelSparse) \
|| (output_type == oMatlabDynamicModelSparse))
// Left parenthesis: '(' for Matlab, '[' for C
@ -123,7 +123,7 @@ public:
//! Returns derivative w.r. to variable varID
/*! Uses a symbolic a priori to pre-detect null derivatives, and caches the result for other derivatives (to avoid computing it several times)
For an equal node, returns the derivative of lhs minus rhs */
For an equal node, returns the derivative of lhs minus rhs */
NodeID getDerivative(int varID);
//! Returns precedence of node
@ -142,7 +142,7 @@ public:
//! Computes the set of endogenous variables in the expression
/*! Endogenous are stored as integer pairs of the form (symb_id, lag)
They are added to the set given in argument */
They are added to the set given in argument */
virtual void collectEndogenous(set<pair<int, int> > &result) const = 0;
virtual void collectExogenous(set<pair<int, int> > &result) const = 0;
virtual void collectTemporary_terms(const temporary_terms_type &temporary_terms, Model_Block *ModelBlock, int Curr_Block) const = 0;
@ -206,12 +206,12 @@ public:
virtual void collectEndogenous(set<pair<int, int> > &result) const;
virtual void collectExogenous(set<pair<int, int> > &result) const;
virtual void computeTemporaryTerms(map<NodeID, int> &reference_count,
temporary_terms_type &temporary_terms,
map<NodeID, pair<int, int> > &first_occurence,
int Curr_block,
Model_Block *ModelBlock,
int equation,
map_idx_type &map_idx) const;
temporary_terms_type &temporary_terms,
map<NodeID, pair<int, int> > &first_occurence,
int Curr_block,
Model_Block *ModelBlock,
int equation,
map_idx_type &map_idx) const;
virtual void collectTemporary_terms(const temporary_terms_type &temporary_terms, Model_Block *ModelBlock, int Curr_Block) const;
virtual double eval(const eval_context_type &eval_context) const throw (EvalException);
virtual void compile(ofstream &CompileCode, bool lhs_rhs, ExprNodeOutputType output_type, const temporary_terms_type &temporary_terms, map_idx_type &map_idx) const;

View File

@ -17,10 +17,10 @@
* along with Dynare. If not, see <http://www.gnu.org/licenses/>.
*/
/*
Usefull documentation: Matlab 7 Mat-File Format
-----------------------------------------------
revision: October 2008 PDF only Rereleased for Version 7.7 (Release 2008b)
available at: http://www.mathworks.com/access/helpdesk/help/pdf_doc/matlab/matfile_format.pdf
Usefull documentation: Matlab 7 Mat-File Format
-----------------------------------------------
revision: October 2008 PDF only Rereleased for Version 7.7 (Release 2008b)
available at: http://www.mathworks.com/access/helpdesk/help/pdf_doc/matlab/matfile_format.pdf
*/
#ifndef _MAT_FILE_HH
@ -42,50 +42,50 @@ using namespace std;
enum Data_Type
{
miINT8 = 1, //8 bit, signed
miUINT8 = 2, //8 bit, unsigned
miINT16 = 3, //16-bit, signed
miUINT16 = 4, //16-bit, unsigned
miINT32 = 5, //32-bit, signed
miUINT32 = 6, //32-bit, unsigned
miSINGLE = 7, //IEEE® 754 single format
miDOUBLE = 9, //IEEE 754 double format
miINT64 = 12, //64-bit, signed
miUINT64 = 13, //64-bit, unsigned
miMATRIX = 14, //MATLAB array
miCOMPRESSED = 15, //Compressed Data
miUTF8 = 16, //Unicode UTF-8 Encoded Character Data
miUTF16 = 17, //Unicode UTF-16 Encoded Character Data
miUTF32 = 18 //Unicode UTF-32 Encoded Character Data
};
{
miINT8 = 1, //8 bit, signed
miUINT8 = 2, //8 bit, unsigned
miINT16 = 3, //16-bit, signed
miUINT16 = 4, //16-bit, unsigned
miINT32 = 5, //32-bit, signed
miUINT32 = 6, //32-bit, unsigned
miSINGLE = 7, //IEEE® 754 single format
miDOUBLE = 9, //IEEE 754 double format
miINT64 = 12, //64-bit, signed
miUINT64 = 13, //64-bit, unsigned
miMATRIX = 14, //MATLAB array
miCOMPRESSED = 15, //Compressed Data
miUTF8 = 16, //Unicode UTF-8 Encoded Character Data
miUTF16 = 17, //Unicode UTF-16 Encoded Character Data
miUTF32 = 18 //Unicode UTF-32 Encoded Character Data
};
enum Array_Type
{
Cell_array = 1,
Structure_ = 2,
Object_ = 3,
Character_array = 4,
Sparse_array = 5,
Double_precision_array = 6,
Single_precision_array = 7,
Signed_integer_8_bit = 8,
Unsigned_integer_8_bit = 9,
Signed_integer_16_bit = 10,
Unsigned_integer_16_bit = 11,
Signed_integer_32_bit = 12,
Unsigned_integer_32_bit = 13
};
{
Cell_array = 1,
Structure_ = 2,
Object_ = 3,
Character_array = 4,
Sparse_array = 5,
Double_precision_array = 6,
Single_precision_array = 7,
Signed_integer_8_bit = 8,
Unsigned_integer_8_bit = 9,
Signed_integer_16_bit = 10,
Unsigned_integer_16_bit = 11,
Signed_integer_32_bit = 12,
Unsigned_integer_32_bit = 13
};
enum Function_Returned_Type
{
Numerical =1,
AlphaNumeric =2,
Matrix =3,
Compressed =4,
Unknown =5
};
{
Numerical =1,
AlphaNumeric =2,
Matrix =3,
Compressed =4,
Unknown =5
};
class ArrayElem;
class SimpleElem;
@ -106,7 +106,7 @@ typedef struct Header
short int Version;
char Edian_Indicator[2];
}
Header_t;
Header_t;
typedef struct Data_Header
{
@ -114,7 +114,7 @@ typedef struct Data_Header
ShortInt DataType;
uLongInt Number_of_Bytes;
}
Data_Header_t;
Data_Header_t;
typedef struct Array_Flag
{
@ -124,7 +124,7 @@ typedef struct Array_Flag
char undef1[2];
uLongInt nzmax;
}
Array_Flag_t;
Array_Flag_t;
typedef struct returned_ReadData
@ -143,13 +143,13 @@ typedef struct FlagStructure
typedef struct CollectStruct
{
/*vector<string> variable_name;
vector< vector<double> > variable_double;
vector< vector<string> > variable_string;*/
vector< vector<double> > variable_double;
vector< vector<string> > variable_string;*/
string tmp_name;
map<string,vector<string> > variable_string_name;
map<string,vector<double> > variable_double_name;
}
CollectStruct;
CollectStruct;
typedef vector<int> Array_Dimensions_t;
@ -161,23 +161,23 @@ typedef vector<int> Array_Dimensions_t;
class SimpleElem
{
public:
bool verbose;
vector<double> VNumeric;
vector<string> Vstr;
ArrayElem *array_elem;
int Type;
SimpleElem();
virtual ~SimpleElem();
virtual double ReadNum(char* InBuff, int* pBuff) const{return(0);};
virtual string ReadAlph(char* InBuff, int* pBuff, int Size) const{return(NULL);};
virtual Data_Header_t ReadDataHeader(char* InBuff, int* pBuff) const;
virtual int size() const{cout << "oups\n";return(0);};
void Print() const;
void Delete() const;
void Collect(const string &name, bool found, CollectStruct &collect_struct) const;
returned_ReadData_t ReadData(char* InBuff, int* pBuff) const;
returned_ReadData_t Get_Data_Class(Data_Header_t data_header) const;
void DataProceed(Data_Header data_header, char* InBuff, int* pBuff, FlagStructure flag);
bool verbose;
vector<double> VNumeric;
vector<string> Vstr;
ArrayElem *array_elem;
int Type;
SimpleElem();
virtual ~SimpleElem();
virtual double ReadNum(char* InBuff, int* pBuff) const{return(0);};
virtual string ReadAlph(char* InBuff, int* pBuff, int Size) const{return(NULL);};
virtual Data_Header_t ReadDataHeader(char* InBuff, int* pBuff) const;
virtual int size() const{cout << "oups\n";return(0);};
void Print() const;
void Delete() const;
void Collect(const string &name, bool found, CollectStruct &collect_struct) const;
returned_ReadData_t ReadData(char* InBuff, int* pBuff) const;
returned_ReadData_t Get_Data_Class(Data_Header_t data_header) const;
void DataProceed(Data_Header data_header, char* InBuff, int* pBuff, FlagStructure flag);
};
@ -208,53 +208,53 @@ public:
class INT8 : public SimpleElem
{
public:
virtual int size() const {return(1);};
virtual double ReadNum(char* InBuff, int* pBuff) const;
virtual string ReadAlph(char* InBuff, int* pBuff, int Size) const {return(NULL);};
virtual int size() const {return(1);};
virtual double ReadNum(char* InBuff, int* pBuff) const;
virtual string ReadAlph(char* InBuff, int* pBuff, int Size) const {return(NULL);};
};
class INT16 : public SimpleElem
{
public:
virtual int size() const {return(2);};
virtual double ReadNum(char* InBuff, int* pBuff) const;
virtual string ReadAlph(char* InBuff, int* pBuff, int Size) const {return(NULL);};
virtual int size() const {return(2);};
virtual double ReadNum(char* InBuff, int* pBuff) const;
virtual string ReadAlph(char* InBuff, int* pBuff, int Size) const {return(NULL);};
};
class INT32 : public SimpleElem
{
public:
virtual int size() const {return(4);};
virtual double ReadNum(char* InBuff, int* pBuff) const;
virtual string ReadAlph(char* InBuff, int* pBuff, int Size) const {return(NULL);};
virtual int size() const {return(4);};
virtual double ReadNum(char* InBuff, int* pBuff) const;
virtual string ReadAlph(char* InBuff, int* pBuff, int Size) const {return(NULL);};
};
class INT64 : public SimpleElem
{
public:
virtual int size() const {return(8);};
virtual double ReadNum(char* InBuff, int* pBuff) const;
virtual string ReadAlph(char* InBuff, int* pBuff, int Size) const {return(NULL);};
virtual int size() const {return(8);};
virtual double ReadNum(char* InBuff, int* pBuff) const;
virtual string ReadAlph(char* InBuff, int* pBuff, int Size) const {return(NULL);};
};
class Single : public SimpleElem
{
public:
virtual int size() const {return(4);};
virtual double ReadNum(char* InBuff, int* pBuff) const;
virtual string ReadAlph(char* InBuff, int* pBuff, int Size) const {return(NULL);};
virtual int size() const {return(4);};
virtual double ReadNum(char* InBuff, int* pBuff) const;
virtual string ReadAlph(char* InBuff, int* pBuff, int Size) const {return(NULL);};
};
class Double : public SimpleElem
{
public:
virtual int size() const {return(8);};
virtual double ReadNum(char* InBuff, int* pBuff) const;
virtual string ReadAlph(char* InBuff, int* pBuff, int Size) const {return(NULL);};
virtual int size() const {return(8);};
virtual double ReadNum(char* InBuff, int* pBuff) const;
virtual string ReadAlph(char* InBuff, int* pBuff, int Size) const {return(NULL);};
};
//! Base class for Array Element in Mat-File
@ -294,7 +294,7 @@ public:
class CellArray : public ArrayElem
{
public:
public:
virtual void Collect(const string &name, bool found, CollectStruct &collect_struct) const;
virtual void Print() const;
virtual void Delete() const;
@ -303,7 +303,7 @@ class CellArray : public ArrayElem
class Structure : public ArrayElem
{
public:
public:
virtual void Collect(const string &name, bool found, CollectStruct &collect_struct) const;
virtual void Print() const;
virtual void Delete() const;
@ -312,7 +312,7 @@ class Structure : public ArrayElem
class Object : public ArrayElem
{
public:
public:
virtual void Collect(const string &name, bool found, CollectStruct &collect_struct) const;
virtual void Print() const;
virtual void Delete() const;
@ -321,7 +321,7 @@ class Object : public ArrayElem
class CharacterArray : public ArrayElem
{
public:
public:
virtual void Collect(const string &name, bool found, CollectStruct &collect_struct) const;
virtual void Print() const;
virtual void Delete() const;
@ -330,7 +330,7 @@ class CharacterArray : public ArrayElem
class SparseArray : public ArrayElem
{
public:
public:
virtual void Collect(const string &name, bool found, CollectStruct &collect_struct) const;
virtual void Print() const;
virtual void Delete() const;
@ -339,7 +339,7 @@ class SparseArray : public ArrayElem
class DoublePrecisionArray : public ArrayElem
{
public:
public:
virtual void Collect(const string &name, bool found, CollectStruct &collect_struct) const;
virtual void Print() const;
virtual void Delete() const;
@ -348,7 +348,7 @@ class DoublePrecisionArray : public ArrayElem
class SinglePrecisionArray : public ArrayElem
{
public:
public:
virtual void Collect(const string &name, bool found, CollectStruct &collect_struct) const;
virtual void Print() const;
virtual void Delete() const;
@ -357,7 +357,7 @@ class SinglePrecisionArray : public ArrayElem
class Bit8SignedInteger : public ArrayElem
{
public:
public:
virtual void Collect(const string &name, bool found, CollectStruct &collect_struct) const;
virtual void Print() const;
virtual void Delete() const;
@ -366,7 +366,7 @@ class Bit8SignedInteger : public ArrayElem
class Bit8UnsignedInteger : public ArrayElem
{
public:
public:
virtual void Collect(const string &name, bool found, CollectStruct &collect_struct) const;
virtual void Print() const;
virtual void Delete() const;
@ -375,7 +375,7 @@ class Bit8UnsignedInteger : public ArrayElem
class Bit16SignedInteger : public ArrayElem
{
public:
public:
virtual void Collect(const string &name, bool found, CollectStruct &collect_struct) const;
virtual void Print() const;
virtual void Delete() const;
@ -384,7 +384,7 @@ class Bit16SignedInteger : public ArrayElem
class Bit16UnsignedInteger : public ArrayElem
{
public:
public:
virtual void Collect(const string &name, bool found, CollectStruct &collect_struct) const;
virtual void Print() const;
virtual void Delete() const;
@ -393,7 +393,7 @@ class Bit16UnsignedInteger : public ArrayElem
class Bit32SignedInteger : public ArrayElem
{
public:
public:
virtual void Collect(const string &name, bool found, CollectStruct &collect_struct) const;
virtual void Print() const;
virtual void Delete() const;
@ -402,7 +402,7 @@ class Bit32SignedInteger : public ArrayElem
class Bit32UnsignedInteger : public ArrayElem
{
public:
public:
virtual void Collect(const string &name, bool found, CollectStruct &collect_struct) const;
virtual void Print() const;
virtual void Delete() const;
@ -412,7 +412,7 @@ class Bit32UnsignedInteger : public ArrayElem
class MatlabFile
{
public:
public:
Header_t header;
vector<PSimpleElem> VSimpl;
MatlabFile();

View File

@ -160,7 +160,7 @@ public:
bool computeThirdDerivatives;
//! Execute computations (variable sorting + derivation)
/*! You must set computeJacobian, computeJacobianExo, computeHessian, computeStaticHessian and computeThirdDerivatives to correct values before calling this function
\param no_tmp_terms if true, no temporary terms will be computed in the static and dynamic files */
\param no_tmp_terms if true, no temporary terms will be computed in the static and dynamic files */
void computingPass(const eval_context_type &eval_context, bool no_tmp_terms);
//! Writes model initialization and lead/lag incidence matrix to output
void writeOutput(ostream &output) const;

View File

@ -49,7 +49,7 @@ using namespace std;
//! The lexer class
/*! Actually it was necessary to subclass the DynareFlexLexer class generated by Flex,
since the prototype for DynareFlexLexer::yylex() was not convenient.
since the prototype for DynareFlexLexer::yylex() was not convenient.
*/
class DynareFlex : public DynareFlexLexer
{

View File

@ -31,11 +31,11 @@ using namespace std;
//! Stores the symbol table
/*!
A symbol is given by its name, and is internally represented by a pair (type, id).
A symbol is given by its name, and is internally represented by a pair (type, id).
There is a distinct sequence of ids for each type, so two symbol of different types can have the same id.
There is a distinct sequence of ids for each type, so two symbol of different types can have the same id.
Also manages a TeX name for each symbol, which by default is an empty string.
Also manages a TeX name for each symbol, which by default is an empty string.
*/
class SymbolTable
{

View File

@ -44,7 +44,7 @@ using namespace std;
//! The lexer class
/*! Actually it was necessary to subclass the MacroFlexLexer class generated by Flex,
since the prototype for MacroFlexLexer::yylex() was not convenient.
since the prototype for MacroFlexLexer::yylex() was not convenient.
*/
class MacroFlex : public MacroFlexLexer
{
@ -128,8 +128,8 @@ private:
//! Iterates over the loop body
/*! If loop is terminated, return false and do nothing.
Otherwise, set loop variable to its new value (through driver.iter_loop()),
and initialise a new scanning context with the loop body */
Otherwise, set loop variable to its new value (through driver.iter_loop()),
and initialise a new scanning context with the loop body */
bool iter_loop(MacroDriver &driver, Macro::parser::location_type *yylloc);
public:
MacroFlex(istream* in, ostream* out, bool no_line_macro_arg);

View File

@ -150,8 +150,8 @@ public:
virtual const MacroValue *in(const MacroValue *array) const throw (TypeError);
//! Creates a integer range
/*! Arguments must be of type IntMV.
Returns an integer array containing all integers between mv1 and mv2.
If mv2 < mv1, constructs the range in decreasing order.
Returns an integer array containing all integers between mv1 and mv2.
If mv2 < mv1, constructs the range in decreasing order.
*/
static const MacroValue *new_range(MacroDriver &driver, const MacroValue *mv1, const MacroValue *mv2) throw (TypeError);
};
@ -209,8 +209,8 @@ public:
virtual const MacroValue *operator!=(const MacroValue &mv) const throw (TypeError);
//! Subscripting operator
/*! Argument must be an ArrayMV<int>. Indexes begin at 1.
If argument is a one-element array, returns an IntMV or StringMV.
Otherwise returns an array. */
If argument is a one-element array, returns an IntMV or StringMV.
Otherwise returns an array. */
virtual const MacroValue *operator[](const MacroValue &mv) const throw (TypeError, OutOfBoundsError);
//! Returns a string containing the concatenation of string representations of elements
virtual string toString() const;