trunk preprocessor: automatic reindentation of all code with emacs
git-svn-id: https://www.dynare.org/svn/dynare/trunk@2372 ac1d8469-bf42-47a9-8791-bf33cf982152time-shift
parent
867daedd40
commit
723b260f9f
|
@ -31,9 +31,9 @@ using namespace std;
|
||||||
//------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------
|
||||||
|
|
||||||
BlockTriangular::BlockTriangular(const SymbolTable &symbol_table_arg) :
|
BlockTriangular::BlockTriangular(const SymbolTable &symbol_table_arg) :
|
||||||
symbol_table(symbol_table_arg),
|
symbol_table(symbol_table_arg),
|
||||||
normalization(symbol_table_arg),
|
normalization(symbol_table_arg),
|
||||||
incidencematrix(symbol_table_arg)
|
incidencematrix(symbol_table_arg)
|
||||||
{
|
{
|
||||||
bt_verbose = 0;
|
bt_verbose = 0;
|
||||||
ModelBlock = NULL;
|
ModelBlock = NULL;
|
||||||
|
@ -418,52 +418,52 @@ BlockTriangular::Allocate_Block(int size, int *count_Equ, int count_Block, Block
|
||||||
|
|
||||||
void
|
void
|
||||||
BlockTriangular::Free_Block(Model_Block* ModelBlock) const
|
BlockTriangular::Free_Block(Model_Block* ModelBlock) const
|
||||||
{
|
{
|
||||||
int blk, i;
|
int blk, i;
|
||||||
for (blk = 0;blk < ModelBlock->Size;blk++)
|
for (blk = 0;blk < ModelBlock->Size;blk++)
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|
||||||
free(ModelBlock->Block_List[blk].Equation);
|
free(ModelBlock->Block_List[blk].Equation);
|
||||||
free(ModelBlock->Block_List[blk].Variable);
|
free(ModelBlock->Block_List[blk].Variable);
|
||||||
free(ModelBlock->Block_List[blk].Exogenous);
|
free(ModelBlock->Block_List[blk].Exogenous);
|
||||||
free(ModelBlock->Block_List[blk].Own_Derivative);
|
free(ModelBlock->Block_List[blk].Own_Derivative);
|
||||||
free(ModelBlock->Block_List[blk].Other_Endogenous);
|
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++)
|
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*/)
|
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].u);
|
||||||
free(ModelBlock->Block_List[blk].IM_lead_lag[i].us);
|
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].Equ);
|
||||||
free(ModelBlock->Block_List[blk].IM_lead_lag[i].Var);
|
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].Equ_Index);
|
||||||
free(ModelBlock->Block_List[blk].IM_lead_lag[i].Var_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].u_other_endo);
|
||||||
free(ModelBlock->Block_List[blk].IM_lead_lag[i].Var_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].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].Var_Index_other_endo);
|
||||||
free(ModelBlock->Block_List[blk].IM_lead_lag[i].Equ_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*/)
|
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);
|
||||||
free(ModelBlock->Block_List[blk].IM_lead_lag[i].Exogenous_Index);
|
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_Index);
|
||||||
free(ModelBlock->Block_List[blk].IM_lead_lag[i].Equ_X);
|
free(ModelBlock->Block_List[blk].IM_lead_lag[i].Equ_X);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
free(ModelBlock->Block_List[blk].IM_lead_lag);
|
free(ModelBlock->Block_List[blk].IM_lead_lag);
|
||||||
for(i=0; i<ModelBlock->Block_List[blk].Size; i++)
|
for(i=0; i<ModelBlock->Block_List[blk].Size; i++)
|
||||||
delete ModelBlock->Block_List[blk].Temporary_Terms_in_Equation[i];
|
delete ModelBlock->Block_List[blk].Temporary_Terms_in_Equation[i];
|
||||||
free(ModelBlock->Block_List[blk].Temporary_Terms_in_Equation);
|
free(ModelBlock->Block_List[blk].Temporary_Terms_in_Equation);
|
||||||
delete(ModelBlock->Block_List[blk].Temporary_InUse);
|
delete(ModelBlock->Block_List[blk].Temporary_InUse);
|
||||||
}
|
}
|
||||||
free(ModelBlock->Block_List);
|
free(ModelBlock->Block_List);
|
||||||
free(ModelBlock);
|
free(ModelBlock);
|
||||||
free(Index_Equ_IM);
|
free(Index_Equ_IM);
|
||||||
free(Index_Var_IM);
|
free(Index_Var_IM);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
t_type
|
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))
|
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))
|
|| ((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;
|
BlockSimulationType c_Type = (Type[Type.size()-1]).first;
|
||||||
int c_Size = (Type[Type.size()-1]).second;
|
int c_Size = (Type[Type.size()-1]).second;
|
||||||
|
|
|
@ -177,7 +177,7 @@ StochSimulStatement::writeOutput(ostream &output, const string &basename) const
|
||||||
}
|
}
|
||||||
|
|
||||||
ForecastStatement::ForecastStatement(const SymbolList &symbol_list_arg,
|
ForecastStatement::ForecastStatement(const SymbolList &symbol_list_arg,
|
||||||
const OptionsList &options_list_arg) :
|
const OptionsList &options_list_arg) :
|
||||||
symbol_list(symbol_list_arg),
|
symbol_list(symbol_list_arg),
|
||||||
options_list(options_list_arg)
|
options_list(options_list_arg)
|
||||||
{
|
{
|
||||||
|
|
|
@ -376,13 +376,13 @@ DataTree::AddSqRt(NodeID iArg1)
|
||||||
NodeID
|
NodeID
|
||||||
DataTree::AddMaX(NodeID iArg1, NodeID iArg2)
|
DataTree::AddMaX(NodeID iArg1, NodeID iArg2)
|
||||||
{
|
{
|
||||||
return AddBinaryOp(iArg1, oMax, iArg2);
|
return AddBinaryOp(iArg1, oMax, iArg2);
|
||||||
}
|
}
|
||||||
|
|
||||||
NodeID
|
NodeID
|
||||||
DataTree::AddMin(NodeID iArg1, NodeID iArg2)
|
DataTree::AddMin(NodeID iArg1, NodeID iArg2)
|
||||||
{
|
{
|
||||||
return AddBinaryOp(iArg1, oMin, iArg2);
|
return AddBinaryOp(iArg1, oMin, iArg2);
|
||||||
}
|
}
|
||||||
|
|
||||||
NodeID
|
NodeID
|
||||||
|
|
|
@ -480,12 +480,12 @@ VariableNode::compile(ofstream &CompileCode, bool lhs_rhs, ExprNodeOutputType ou
|
||||||
|
|
||||||
void
|
void
|
||||||
VariableNode::computeTemporaryTerms(map<NodeID, int> &reference_count,
|
VariableNode::computeTemporaryTerms(map<NodeID, int> &reference_count,
|
||||||
temporary_terms_type &temporary_terms,
|
temporary_terms_type &temporary_terms,
|
||||||
map<NodeID, pair<int, int> > &first_occurence,
|
map<NodeID, pair<int, int> > &first_occurence,
|
||||||
int Curr_block,
|
int Curr_block,
|
||||||
Model_Block *ModelBlock,
|
Model_Block *ModelBlock,
|
||||||
int equation,
|
int equation,
|
||||||
map_idx_type &map_idx) const
|
map_idx_type &map_idx) const
|
||||||
{
|
{
|
||||||
if(type== eModelLocalVariable)
|
if(type== eModelLocalVariable)
|
||||||
datatree.local_variables_table[symb_id]->computeTemporaryTerms(reference_count, temporary_terms, first_occurence, Curr_block, ModelBlock, equation, map_idx);
|
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;
|
return cost + 90;
|
||||||
case oMax:
|
case oMax:
|
||||||
case oMin:
|
case oMin:
|
||||||
return cost + 110;
|
return cost + 110;
|
||||||
case oDivide:
|
case oDivide:
|
||||||
return cost + 990;
|
return cost + 990;
|
||||||
case oPower:
|
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 )
|
if ((op_code == oPower && !OFFSET(output_type)) || op_code == oMax || op_code == oMin )
|
||||||
{
|
{
|
||||||
switch (op_code)
|
switch (op_code)
|
||||||
{
|
{
|
||||||
case oPower:
|
case oPower:
|
||||||
output << "pow(";
|
output << "pow(";
|
||||||
break;
|
break;
|
||||||
|
@ -1290,7 +1290,7 @@ BinaryOpNode::writeOutput(ostream &output, ExprNodeOutputType output_type,
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
;
|
;
|
||||||
}
|
}
|
||||||
arg1->writeOutput(output, output_type, temporary_terms);
|
arg1->writeOutput(output, output_type, temporary_terms);
|
||||||
output << ",";
|
output << ",";
|
||||||
arg2->writeOutput(output, output_type, temporary_terms);
|
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,
|
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),
|
ExprNode(datatree_arg),
|
||||||
arg1(arg1_arg),
|
arg1(arg1_arg),
|
||||||
arg2(arg2_arg),
|
arg2(arg2_arg),
|
||||||
|
@ -1531,8 +1531,8 @@ TrinaryOpNode::cost(const temporary_terms_type &temporary_terms, bool is_matlab)
|
||||||
|
|
||||||
void
|
void
|
||||||
TrinaryOpNode::computeTemporaryTerms(map<NodeID, int> &reference_count,
|
TrinaryOpNode::computeTemporaryTerms(map<NodeID, int> &reference_count,
|
||||||
temporary_terms_type &temporary_terms,
|
temporary_terms_type &temporary_terms,
|
||||||
bool is_matlab) const
|
bool is_matlab) const
|
||||||
{
|
{
|
||||||
NodeID this2 = const_cast<TrinaryOpNode *>(this);
|
NodeID this2 = const_cast<TrinaryOpNode *>(this);
|
||||||
map<NodeID, int>::iterator it = reference_count.find(this2);
|
map<NodeID, int>::iterator it = reference_count.find(this2);
|
||||||
|
@ -1557,12 +1557,12 @@ TrinaryOpNode::computeTemporaryTerms(map<NodeID, int> &reference_count,
|
||||||
|
|
||||||
void
|
void
|
||||||
TrinaryOpNode::computeTemporaryTerms(map<NodeID, int> &reference_count,
|
TrinaryOpNode::computeTemporaryTerms(map<NodeID, int> &reference_count,
|
||||||
temporary_terms_type &temporary_terms,
|
temporary_terms_type &temporary_terms,
|
||||||
map<NodeID, pair<int, int> > &first_occurence,
|
map<NodeID, pair<int, int> > &first_occurence,
|
||||||
int Curr_block,
|
int Curr_block,
|
||||||
Model_Block *ModelBlock,
|
Model_Block *ModelBlock,
|
||||||
int equation,
|
int equation,
|
||||||
map_idx_type &map_idx) const
|
map_idx_type &map_idx) const
|
||||||
{
|
{
|
||||||
NodeID this2 = const_cast<TrinaryOpNode *>(this);
|
NodeID this2 = const_cast<TrinaryOpNode *>(this);
|
||||||
map<NodeID, int>::iterator it = reference_count.find(this2);
|
map<NodeID, int>::iterator it = reference_count.find(this2);
|
||||||
|
@ -1646,7 +1646,7 @@ TrinaryOpNode::collectTemporary_terms(const temporary_terms_type &temporary_term
|
||||||
|
|
||||||
void
|
void
|
||||||
TrinaryOpNode::writeOutput(ostream &output, ExprNodeOutputType output_type,
|
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))
|
if (!OFFSET(output_type))
|
||||||
{
|
{
|
||||||
|
|
|
@ -114,7 +114,7 @@ IncidenceMatrix::Get_IM(int lead_lag, SymbolType type) const
|
||||||
}
|
}
|
||||||
else //eExogenous
|
else //eExogenous
|
||||||
{
|
{
|
||||||
it = List_IM_X.find(lead_lag);
|
it = List_IM_X.find(lead_lag);
|
||||||
if(it!=List_IM_X.end())
|
if(it!=List_IM_X.end())
|
||||||
return(it->second);
|
return(it->second);
|
||||||
else
|
else
|
||||||
|
|
|
@ -18,10 +18,10 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Useful documentation: Matlab 7 Mat-File Format
|
Useful documentation: Matlab 7 Mat-File Format
|
||||||
-----------------------------------------------
|
-----------------------------------------------
|
||||||
revision: October 2008 PDF only Rereleased for Version 7.7 (Release 2008b)
|
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
|
available at: http://www.mathworks.com/access/helpdesk/help/pdf_doc/matlab/matfile_format.pdf
|
||||||
*/
|
*/
|
||||||
#include "MatlabFile.hh"
|
#include "MatlabFile.hh"
|
||||||
|
|
||||||
|
@ -183,69 +183,69 @@ SimpleElem::Get_Data_Class(Data_Header_t data_header) const
|
||||||
returned_ReadData_t ret;
|
returned_ReadData_t ret;
|
||||||
switch(data_header.DataType)
|
switch(data_header.DataType)
|
||||||
{
|
{
|
||||||
case miINT8: //8 bit, signed
|
case miINT8: //8 bit, signed
|
||||||
case miUINT8: //8 bit, unsigned
|
case miUINT8: //8 bit, unsigned
|
||||||
ret.Type = Numerical;
|
ret.Type = Numerical;
|
||||||
ret.Simple = new INT8;
|
ret.Simple = new INT8;
|
||||||
return(ret);
|
return(ret);
|
||||||
break;
|
break;
|
||||||
case miINT16: //16-bit, signed
|
case miINT16: //16-bit, signed
|
||||||
case miUINT16: //16-bit, unsigned
|
case miUINT16: //16-bit, unsigned
|
||||||
ret.Type = Numerical;
|
ret.Type = Numerical;
|
||||||
ret.Simple = new INT16;
|
ret.Simple = new INT16;
|
||||||
return(ret);
|
return(ret);
|
||||||
break;
|
break;
|
||||||
case miINT32: //32-bit, signed
|
case miINT32: //32-bit, signed
|
||||||
case miUINT32: //32-bit, unsigned
|
case miUINT32: //32-bit, unsigned
|
||||||
ret.Type = Numerical;
|
ret.Type = Numerical;
|
||||||
ret.Simple = new INT32;
|
ret.Simple = new INT32;
|
||||||
return(ret);
|
return(ret);
|
||||||
break;
|
break;
|
||||||
case miINT64: //64-bit, signed
|
case miINT64: //64-bit, signed
|
||||||
case miUINT64: //64-bit, unsigned
|
case miUINT64: //64-bit, unsigned
|
||||||
ret.Type = Numerical;
|
ret.Type = Numerical;
|
||||||
ret.Simple = new INT64;
|
ret.Simple = new INT64;
|
||||||
return(ret);
|
return(ret);
|
||||||
break;
|
break;
|
||||||
case miSINGLE: //IEEE® 754 single format
|
case miSINGLE: //IEEE® 754 single format
|
||||||
ret.Type = Numerical;
|
ret.Type = Numerical;
|
||||||
ret.Simple = new Single;
|
ret.Simple = new Single;
|
||||||
return(ret);
|
return(ret);
|
||||||
break;
|
break;
|
||||||
case miDOUBLE: //IEEE 754 double format
|
case miDOUBLE: //IEEE 754 double format
|
||||||
ret.Type = Numerical;
|
ret.Type = Numerical;
|
||||||
ret.Simple = new Double;
|
ret.Simple = new Double;
|
||||||
return(ret);
|
return(ret);
|
||||||
break;
|
break;
|
||||||
case miMATRIX: //MATLAB array
|
case miMATRIX: //MATLAB array
|
||||||
ret.Type = Matrix;
|
ret.Type = Matrix;
|
||||||
ret.Simple = NULL;
|
ret.Simple = NULL;
|
||||||
return(ret);
|
return(ret);
|
||||||
break;
|
break;
|
||||||
case miCOMPRESSED: //Compressed Data
|
case miCOMPRESSED: //Compressed Data
|
||||||
ret.Type = Compressed;
|
ret.Type = Compressed;
|
||||||
ret.Simple = NULL;
|
ret.Simple = NULL;
|
||||||
return(ret);
|
return(ret);
|
||||||
break;
|
break;
|
||||||
case miUTF8: //Unicode UTF-8 Encoded Character Data
|
case miUTF8: //Unicode UTF-8 Encoded Character Data
|
||||||
ret.Type = AlphaNumeric;
|
ret.Type = AlphaNumeric;
|
||||||
ret.Simple = new UTF8;
|
ret.Simple = new UTF8;
|
||||||
return(ret);
|
return(ret);
|
||||||
break;
|
break;
|
||||||
case miUTF16: //Unicode UTF-16 Encoded Character Data
|
case miUTF16: //Unicode UTF-16 Encoded Character Data
|
||||||
ret.Type = AlphaNumeric;
|
ret.Type = AlphaNumeric;
|
||||||
ret.Simple = new UTF16;
|
ret.Simple = new UTF16;
|
||||||
return(ret);
|
return(ret);
|
||||||
break;
|
break;
|
||||||
case miUTF32: //Unicode UTF-32 Encoded Character Data
|
case miUTF32: //Unicode UTF-32 Encoded Character Data
|
||||||
ret.Type = AlphaNumeric;
|
ret.Type = AlphaNumeric;
|
||||||
ret.Simple = new UTF32;
|
ret.Simple = new UTF32;
|
||||||
return(ret);
|
return(ret);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
ret.Type = Unknown;
|
ret.Type = Unknown;
|
||||||
ret.Simple = NULL;
|
ret.Simple = NULL;
|
||||||
return(ret);
|
return(ret);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -259,36 +259,36 @@ SimpleElem::DataProceed(Data_Header data_header, char* InBuff, int* pBuff, FlagS
|
||||||
double tmpv;
|
double tmpv;
|
||||||
switch(ret.Type)
|
switch(ret.Type)
|
||||||
{
|
{
|
||||||
case Numerical:
|
case Numerical:
|
||||||
if(data_header.Number_of_Bytes/ret.Simple->size())
|
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:
|
|
||||||
for(unsigned int i=0;i<data_header.Number_of_Bytes/ret.Simple->size();i++)
|
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
|
tmpv=ret.Simple->ReadNum(InBuff, pBuff);
|
||||||
if(*pBuff % 4)
|
VNumeric.push_back(tmpv);
|
||||||
*pBuff += 4-(*pBuff % 4);
|
}
|
||||||
delete ret.Simple;
|
//to align pBuff on a 4 Bytes
|
||||||
break;
|
if(*pBuff % 4)
|
||||||
case Matrix:
|
*pBuff += 4-(*pBuff % 4);
|
||||||
array_elem = matrix.ReadArray_class(InBuff, pBuff);
|
delete ret.Simple;
|
||||||
array_elem->ReadArray(InBuff, pBuff, flag);
|
break;
|
||||||
break;
|
case AlphaNumeric:
|
||||||
case Compressed:
|
for(unsigned int i=0;i<data_header.Number_of_Bytes/ret.Simple->size();i++)
|
||||||
cerr << "Error: Compressed data in Mat-file not implemnted yet!\n set option -v6 when saving to Mat-file\n";
|
Vstr.push_back(ret.Simple->ReadAlph(InBuff, pBuff, data_header.Number_of_Bytes));
|
||||||
exit(EXIT_FAILURE);
|
//to align pBuff on a 4 Bytes
|
||||||
case Unknown:
|
if(*pBuff % 4)
|
||||||
cerr << "Error: Mat-file format use incomptible format with Matlab 7 specification!\n set option -v6 when saving to Mat-file\n";
|
*pBuff += 4-(*pBuff % 4);
|
||||||
exit(EXIT_FAILURE);
|
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);
|
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);
|
array_flag=array_elem.ReadArrayFlag(InBuff, pBuff);
|
||||||
switch(array_flag.classe)
|
switch(array_flag.classe)
|
||||||
{
|
{
|
||||||
case Cell_array:
|
case Cell_array:
|
||||||
return(new CellArray);
|
return(new CellArray);
|
||||||
break;
|
break;
|
||||||
case Structure_:
|
case Structure_:
|
||||||
return(new Structure);
|
return(new Structure);
|
||||||
break;
|
break;
|
||||||
case Object_:
|
case Object_:
|
||||||
return(new Object);
|
return(new Object);
|
||||||
break;
|
break;
|
||||||
case Character_array:
|
case Character_array:
|
||||||
return(new CharacterArray);
|
return(new CharacterArray);
|
||||||
break;
|
break;
|
||||||
case Sparse_array:
|
case Sparse_array:
|
||||||
return(new SparseArray);
|
return(new SparseArray);
|
||||||
break;
|
break;
|
||||||
case Double_precision_array:
|
case Double_precision_array:
|
||||||
return(new DoublePrecisionArray);
|
return(new DoublePrecisionArray);
|
||||||
break;
|
break;
|
||||||
case Single_precision_array:
|
case Single_precision_array:
|
||||||
return(new SinglePrecisionArray);
|
return(new SinglePrecisionArray);
|
||||||
break;
|
break;
|
||||||
case Signed_integer_8_bit:
|
case Signed_integer_8_bit:
|
||||||
return(new Bit8SignedInteger);
|
return(new Bit8SignedInteger);
|
||||||
break;
|
break;
|
||||||
case Unsigned_integer_8_bit:
|
case Unsigned_integer_8_bit:
|
||||||
return(new Bit8UnsignedInteger);
|
return(new Bit8UnsignedInteger);
|
||||||
break;
|
break;
|
||||||
case Signed_integer_16_bit:
|
case Signed_integer_16_bit:
|
||||||
return(new Bit16SignedInteger);
|
return(new Bit16SignedInteger);
|
||||||
break;
|
break;
|
||||||
case Unsigned_integer_16_bit:
|
case Unsigned_integer_16_bit:
|
||||||
return(new Bit16UnsignedInteger);
|
return(new Bit16UnsignedInteger);
|
||||||
break;
|
break;
|
||||||
case Signed_integer_32_bit:
|
case Signed_integer_32_bit:
|
||||||
return(new Bit32SignedInteger);
|
return(new Bit32SignedInteger);
|
||||||
break;
|
break;
|
||||||
case Unsigned_integer_32_bit:
|
case Unsigned_integer_32_bit:
|
||||||
return(new Bit32UnsignedInteger);
|
return(new Bit32UnsignedInteger);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
return(NULL);
|
return(NULL);
|
||||||
}
|
}
|
||||||
return(NULL);
|
return(NULL);
|
||||||
}
|
}
|
||||||
|
@ -1024,7 +1024,7 @@ bool
|
||||||
MatlabFile::Collect(const string &name, CollectStruct &collect_struct) const
|
MatlabFile::Collect(const string &name, CollectStruct &collect_struct) const
|
||||||
{
|
{
|
||||||
for(vector<PSimpleElem>::const_iterator it=VSimpl.begin(); it!=VSimpl.end(); it++)
|
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()));
|
return(!(collect_struct.variable_double_name.empty() and collect_struct.variable_string_name.empty()));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1033,7 +1033,7 @@ void
|
||||||
MatlabFile::MatFilePrint()
|
MatlabFile::MatFilePrint()
|
||||||
{
|
{
|
||||||
for(vector<PSimpleElem>::iterator it=VSimpl.begin(); it!=VSimpl.end(); it++)
|
for(vector<PSimpleElem>::iterator it=VSimpl.begin(); it!=VSimpl.end(); it++)
|
||||||
(*it)->Print();
|
(*it)->Print();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -1048,9 +1048,9 @@ MatlabFile::Delete()
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
int
|
int
|
||||||
main(int argc, char** argv)
|
main(int argc, char** argv)
|
||||||
{
|
{
|
||||||
CollectStruct collect_struct;
|
CollectStruct collect_struct;
|
||||||
MatlabFile matlab_file;
|
MatlabFile matlab_file;
|
||||||
matlab_file.MatFileRead("gimf_steady.mat");
|
matlab_file.MatFileRead("gimf_steady.mat");
|
||||||
|
@ -1060,18 +1060,18 @@ main(int argc, char** argv)
|
||||||
//string tmp_s("stored_values");
|
//string tmp_s("stored_values");
|
||||||
tmp_b=matlab_file.Collect("stored_values", collect_struct);
|
tmp_b=matlab_file.Collect("stored_values", collect_struct);
|
||||||
if(tmp_b)
|
if(tmp_b)
|
||||||
{
|
{
|
||||||
int i=0;
|
int i=0;
|
||||||
for(map<string,vector<double> >::iterator it2=collect_struct.variable_double_name.begin();it2!=collect_struct.variable_double_name.end();it2++)
|
for(map<string,vector<double> >::iterator it2=collect_struct.variable_double_name.begin();it2!=collect_struct.variable_double_name.end();it2++)
|
||||||
{
|
{
|
||||||
i++;
|
i++;
|
||||||
cout << i << " " << it2->first.c_str() << " : ";
|
cout << i << " " << it2->first.c_str() << " : ";
|
||||||
for(vector<double>::iterator it=it2->second.begin();it!=it2->second.end();it++)
|
for(vector<double>::iterator it=it2->second.begin();it!=it2->second.end();it++)
|
||||||
cout << *it;
|
cout << *it;
|
||||||
cout << "\n";
|
cout << "\n";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -77,9 +77,9 @@ ModFile::evalAllExpressions()
|
||||||
j++;
|
j++;
|
||||||
}
|
}
|
||||||
catch(ExprNode::EvalException &e)
|
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)
|
if(mod_file_struct.load_params_and_steady_state_present && j!=symbol_table.parameter_nbr)
|
||||||
|
|
|
@ -552,9 +552,9 @@ Normalization::Normalize(int n, int prologue, int epilogue, bool* IM, simple* In
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
cout << "end of Normalize\n";
|
cout << "end of Normalize\n";
|
||||||
#endif
|
#endif
|
||||||
if(matchingSize < effective_n )
|
if(matchingSize < effective_n )
|
||||||
return(0);
|
return(0);
|
||||||
else
|
else
|
||||||
return(1);
|
return(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -269,11 +269,11 @@ ParsingDriver::init_param(string *name, NodeID rhs)
|
||||||
// Update global eval context
|
// Update global eval context
|
||||||
/*try
|
/*try
|
||||||
{
|
{
|
||||||
double val = rhs->eval(mod_file->global_eval_context);
|
double val = rhs->eval(mod_file->global_eval_context);
|
||||||
int symb_id = mod_file->symbol_table.getID(*name);
|
int symb_id = mod_file->symbol_table.getID(*name);
|
||||||
mod_file->global_eval_context[make_pair(symb_id, eParameter)] = val;
|
mod_file->global_eval_context[make_pair(symb_id, eParameter)] = val;
|
||||||
}
|
}
|
||||||
catch(ExprNode::EvalException &e)
|
catch(ExprNode::EvalException &e)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
*/
|
*/
|
||||||
|
@ -296,11 +296,11 @@ ParsingDriver::init_val(string *name, NodeID rhs)
|
||||||
// Update global evaluation context
|
// Update global evaluation context
|
||||||
/*try
|
/*try
|
||||||
{
|
{
|
||||||
double val = rhs->eval(mod_file->global_eval_context);
|
double val = rhs->eval(mod_file->global_eval_context);
|
||||||
int symb_id = mod_file->symbol_table.getID(*name);
|
int symb_id = mod_file->symbol_table.getID(*name);
|
||||||
mod_file->global_eval_context[make_pair(symb_id, type)] = val;
|
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->mode = eSparseDLLMode;
|
||||||
/*model_tree->block_triangular.init_incidence_matrix(mod_file->symbol_table.endo_nbr);
|
/*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
|
void
|
||||||
|
@ -380,7 +380,7 @@ ParsingDriver::sparse()
|
||||||
{
|
{
|
||||||
model_tree->mode = eSparseMode;
|
model_tree->mode = eSparseMode;
|
||||||
/*model_tree->block_triangular.init_incidence_matrix(mod_file->symbol_table.endo_nbr);
|
/*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
|
void
|
||||||
|
|
|
@ -24,12 +24,12 @@ using namespace std;
|
||||||
#include "Shocks.hh"
|
#include "Shocks.hh"
|
||||||
|
|
||||||
AbstractShocksStatement::AbstractShocksStatement(bool mshocks_arg,
|
AbstractShocksStatement::AbstractShocksStatement(bool mshocks_arg,
|
||||||
const det_shocks_type &det_shocks_arg,
|
const det_shocks_type &det_shocks_arg,
|
||||||
const var_and_std_shocks_type &var_shocks_arg,
|
const var_and_std_shocks_type &var_shocks_arg,
|
||||||
const var_and_std_shocks_type &std_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 &covar_shocks_arg,
|
||||||
const covar_and_corr_shocks_type &corr_shocks_arg,
|
const covar_and_corr_shocks_type &corr_shocks_arg,
|
||||||
const SymbolTable &symbol_table_arg) :
|
const SymbolTable &symbol_table_arg) :
|
||||||
mshocks(mshocks_arg),
|
mshocks(mshocks_arg),
|
||||||
det_shocks(det_shocks_arg),
|
det_shocks(det_shocks_arg),
|
||||||
var_shocks(var_shocks_arg),
|
var_shocks(var_shocks_arg),
|
||||||
|
|
|
@ -51,17 +51,17 @@ enum BlockType
|
||||||
|
|
||||||
/*enum BlockSimulationType
|
/*enum BlockSimulationType
|
||||||
{
|
{
|
||||||
UNKNOWN = -1, //!< Unknown simulation type
|
UNKNOWN = -1, //!< Unknown simulation type
|
||||||
EVALUATE_FORWARD = 0, //!< Simple evaluation, normalized variable on left-hand side, forward
|
EVALUATE_FORWARD = 0, //!< Simple evaluation, normalized variable on left-hand side, forward
|
||||||
EVALUATE_BACKWARD = 1, //!< Simple evaluation, normalized variable on left-hand side, backward
|
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_FORWARD_SIMPLE = 2, //!< Block of one equation, newton solver needed, forward
|
||||||
SOLVE_BACKWARD_SIMPLE = 3, //!< Block of one equation, newton solver needed, backward
|
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_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_FORWARD_COMPLETE = 5, //!< Block of several equations, newton solver needed, forward
|
||||||
SOLVE_BACKWARD_COMPLETE = 6, //!< Block of several equations, newton solver needed, backward
|
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
|
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_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
|
EVALUATE_BACKWARD_R = 9 //!< Simple evaluation, normalized variable on right-hand side, backward
|
||||||
};
|
};
|
||||||
*/
|
*/
|
||||||
enum BlockSimulationType
|
enum BlockSimulationType
|
||||||
|
|
|
@ -105,7 +105,7 @@ private:
|
||||||
const OptionsList options_list;
|
const OptionsList options_list;
|
||||||
public:
|
public:
|
||||||
ForecastStatement(const SymbolList &symbol_list_arg,
|
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 checkPass(ModFileStructure &mod_file_struct);
|
||||||
virtual void writeOutput(ostream &output, const string &basename) const;
|
virtual void writeOutput(ostream &output, const string &basename) const;
|
||||||
};
|
};
|
||||||
|
|
|
@ -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
|
/* 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 */
|
In Matlab, array indexes begin at 1, while they begin at 0 in C */
|
||||||
#define OFFSET(output_type) ((output_type == oMatlabStaticModel) \
|
#define OFFSET(output_type) ((output_type == oMatlabStaticModel) \
|
||||||
|| (output_type == oMatlabDynamicModel) \
|
|| (output_type == oMatlabDynamicModel) \
|
||||||
|| (output_type == oMatlabOutsideModel) \
|
|| (output_type == oMatlabOutsideModel) \
|
||||||
|| (output_type == oMatlabStaticModelSparse) \
|
|| (output_type == oMatlabStaticModelSparse) \
|
||||||
|| (output_type == oMatlabDynamicModelSparse))
|
|| (output_type == oMatlabDynamicModelSparse))
|
||||||
|
|
||||||
// Left parenthesis: '(' for Matlab, '[' for C
|
// Left parenthesis: '(' for Matlab, '[' for C
|
||||||
|
@ -123,7 +123,7 @@ public:
|
||||||
|
|
||||||
//! Returns derivative w.r. to variable varID
|
//! 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)
|
/*! 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);
|
NodeID getDerivative(int varID);
|
||||||
|
|
||||||
//! Returns precedence of node
|
//! Returns precedence of node
|
||||||
|
@ -142,7 +142,7 @@ public:
|
||||||
|
|
||||||
//! Computes the set of endogenous variables in the expression
|
//! Computes the set of endogenous variables in the expression
|
||||||
/*! Endogenous are stored as integer pairs of the form (symb_id, lag)
|
/*! 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 collectEndogenous(set<pair<int, int> > &result) const = 0;
|
||||||
virtual void collectExogenous(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;
|
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 collectEndogenous(set<pair<int, int> > &result) const;
|
||||||
virtual void collectExogenous(set<pair<int, int> > &result) const;
|
virtual void collectExogenous(set<pair<int, int> > &result) const;
|
||||||
virtual void computeTemporaryTerms(map<NodeID, int> &reference_count,
|
virtual void computeTemporaryTerms(map<NodeID, int> &reference_count,
|
||||||
temporary_terms_type &temporary_terms,
|
temporary_terms_type &temporary_terms,
|
||||||
map<NodeID, pair<int, int> > &first_occurence,
|
map<NodeID, pair<int, int> > &first_occurence,
|
||||||
int Curr_block,
|
int Curr_block,
|
||||||
Model_Block *ModelBlock,
|
Model_Block *ModelBlock,
|
||||||
int equation,
|
int equation,
|
||||||
map_idx_type &map_idx) const;
|
map_idx_type &map_idx) const;
|
||||||
virtual void collectTemporary_terms(const temporary_terms_type &temporary_terms, Model_Block *ModelBlock, int Curr_Block) 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 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;
|
virtual void compile(ofstream &CompileCode, bool lhs_rhs, ExprNodeOutputType output_type, const temporary_terms_type &temporary_terms, map_idx_type &map_idx) const;
|
||||||
|
|
|
@ -17,10 +17,10 @@
|
||||||
* along with Dynare. If not, see <http://www.gnu.org/licenses/>.
|
* along with Dynare. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
/*
|
/*
|
||||||
Usefull documentation: Matlab 7 Mat-File Format
|
Usefull documentation: Matlab 7 Mat-File Format
|
||||||
-----------------------------------------------
|
-----------------------------------------------
|
||||||
revision: October 2008 PDF only Rereleased for Version 7.7 (Release 2008b)
|
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
|
available at: http://www.mathworks.com/access/helpdesk/help/pdf_doc/matlab/matfile_format.pdf
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef _MAT_FILE_HH
|
#ifndef _MAT_FILE_HH
|
||||||
|
@ -42,50 +42,50 @@ using namespace std;
|
||||||
|
|
||||||
|
|
||||||
enum Data_Type
|
enum Data_Type
|
||||||
{
|
{
|
||||||
miINT8 = 1, //8 bit, signed
|
miINT8 = 1, //8 bit, signed
|
||||||
miUINT8 = 2, //8 bit, unsigned
|
miUINT8 = 2, //8 bit, unsigned
|
||||||
miINT16 = 3, //16-bit, signed
|
miINT16 = 3, //16-bit, signed
|
||||||
miUINT16 = 4, //16-bit, unsigned
|
miUINT16 = 4, //16-bit, unsigned
|
||||||
miINT32 = 5, //32-bit, signed
|
miINT32 = 5, //32-bit, signed
|
||||||
miUINT32 = 6, //32-bit, unsigned
|
miUINT32 = 6, //32-bit, unsigned
|
||||||
miSINGLE = 7, //IEEE® 754 single format
|
miSINGLE = 7, //IEEE® 754 single format
|
||||||
miDOUBLE = 9, //IEEE 754 double format
|
miDOUBLE = 9, //IEEE 754 double format
|
||||||
miINT64 = 12, //64-bit, signed
|
miINT64 = 12, //64-bit, signed
|
||||||
miUINT64 = 13, //64-bit, unsigned
|
miUINT64 = 13, //64-bit, unsigned
|
||||||
miMATRIX = 14, //MATLAB array
|
miMATRIX = 14, //MATLAB array
|
||||||
miCOMPRESSED = 15, //Compressed Data
|
miCOMPRESSED = 15, //Compressed Data
|
||||||
miUTF8 = 16, //Unicode UTF-8 Encoded Character Data
|
miUTF8 = 16, //Unicode UTF-8 Encoded Character Data
|
||||||
miUTF16 = 17, //Unicode UTF-16 Encoded Character Data
|
miUTF16 = 17, //Unicode UTF-16 Encoded Character Data
|
||||||
miUTF32 = 18 //Unicode UTF-32 Encoded Character Data
|
miUTF32 = 18 //Unicode UTF-32 Encoded Character Data
|
||||||
};
|
};
|
||||||
|
|
||||||
enum Array_Type
|
enum Array_Type
|
||||||
{
|
{
|
||||||
Cell_array = 1,
|
Cell_array = 1,
|
||||||
Structure_ = 2,
|
Structure_ = 2,
|
||||||
Object_ = 3,
|
Object_ = 3,
|
||||||
Character_array = 4,
|
Character_array = 4,
|
||||||
Sparse_array = 5,
|
Sparse_array = 5,
|
||||||
Double_precision_array = 6,
|
Double_precision_array = 6,
|
||||||
Single_precision_array = 7,
|
Single_precision_array = 7,
|
||||||
Signed_integer_8_bit = 8,
|
Signed_integer_8_bit = 8,
|
||||||
Unsigned_integer_8_bit = 9,
|
Unsigned_integer_8_bit = 9,
|
||||||
Signed_integer_16_bit = 10,
|
Signed_integer_16_bit = 10,
|
||||||
Unsigned_integer_16_bit = 11,
|
Unsigned_integer_16_bit = 11,
|
||||||
Signed_integer_32_bit = 12,
|
Signed_integer_32_bit = 12,
|
||||||
Unsigned_integer_32_bit = 13
|
Unsigned_integer_32_bit = 13
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
enum Function_Returned_Type
|
enum Function_Returned_Type
|
||||||
{
|
{
|
||||||
Numerical =1,
|
Numerical =1,
|
||||||
AlphaNumeric =2,
|
AlphaNumeric =2,
|
||||||
Matrix =3,
|
Matrix =3,
|
||||||
Compressed =4,
|
Compressed =4,
|
||||||
Unknown =5
|
Unknown =5
|
||||||
};
|
};
|
||||||
|
|
||||||
class ArrayElem;
|
class ArrayElem;
|
||||||
class SimpleElem;
|
class SimpleElem;
|
||||||
|
@ -106,7 +106,7 @@ typedef struct Header
|
||||||
short int Version;
|
short int Version;
|
||||||
char Edian_Indicator[2];
|
char Edian_Indicator[2];
|
||||||
}
|
}
|
||||||
Header_t;
|
Header_t;
|
||||||
|
|
||||||
typedef struct Data_Header
|
typedef struct Data_Header
|
||||||
{
|
{
|
||||||
|
@ -114,7 +114,7 @@ typedef struct Data_Header
|
||||||
ShortInt DataType;
|
ShortInt DataType;
|
||||||
uLongInt Number_of_Bytes;
|
uLongInt Number_of_Bytes;
|
||||||
}
|
}
|
||||||
Data_Header_t;
|
Data_Header_t;
|
||||||
|
|
||||||
typedef struct Array_Flag
|
typedef struct Array_Flag
|
||||||
{
|
{
|
||||||
|
@ -124,7 +124,7 @@ typedef struct Array_Flag
|
||||||
char undef1[2];
|
char undef1[2];
|
||||||
uLongInt nzmax;
|
uLongInt nzmax;
|
||||||
}
|
}
|
||||||
Array_Flag_t;
|
Array_Flag_t;
|
||||||
|
|
||||||
|
|
||||||
typedef struct returned_ReadData
|
typedef struct returned_ReadData
|
||||||
|
@ -143,13 +143,13 @@ typedef struct FlagStructure
|
||||||
typedef struct CollectStruct
|
typedef struct CollectStruct
|
||||||
{
|
{
|
||||||
/*vector<string> variable_name;
|
/*vector<string> variable_name;
|
||||||
vector< vector<double> > variable_double;
|
vector< vector<double> > variable_double;
|
||||||
vector< vector<string> > variable_string;*/
|
vector< vector<string> > variable_string;*/
|
||||||
string tmp_name;
|
string tmp_name;
|
||||||
map<string,vector<string> > variable_string_name;
|
map<string,vector<string> > variable_string_name;
|
||||||
map<string,vector<double> > variable_double_name;
|
map<string,vector<double> > variable_double_name;
|
||||||
}
|
}
|
||||||
CollectStruct;
|
CollectStruct;
|
||||||
|
|
||||||
typedef vector<int> Array_Dimensions_t;
|
typedef vector<int> Array_Dimensions_t;
|
||||||
|
|
||||||
|
@ -161,23 +161,23 @@ typedef vector<int> Array_Dimensions_t;
|
||||||
class SimpleElem
|
class SimpleElem
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
bool verbose;
|
bool verbose;
|
||||||
vector<double> VNumeric;
|
vector<double> VNumeric;
|
||||||
vector<string> Vstr;
|
vector<string> Vstr;
|
||||||
ArrayElem *array_elem;
|
ArrayElem *array_elem;
|
||||||
int Type;
|
int Type;
|
||||||
SimpleElem();
|
SimpleElem();
|
||||||
virtual ~SimpleElem();
|
virtual ~SimpleElem();
|
||||||
virtual double ReadNum(char* InBuff, int* pBuff) const{return(0);};
|
virtual double ReadNum(char* InBuff, int* pBuff) const{return(0);};
|
||||||
virtual string ReadAlph(char* InBuff, int* pBuff, int Size) const{return(NULL);};
|
virtual string ReadAlph(char* InBuff, int* pBuff, int Size) const{return(NULL);};
|
||||||
virtual Data_Header_t ReadDataHeader(char* InBuff, int* pBuff) const;
|
virtual Data_Header_t ReadDataHeader(char* InBuff, int* pBuff) const;
|
||||||
virtual int size() const{cout << "oups\n";return(0);};
|
virtual int size() const{cout << "oups\n";return(0);};
|
||||||
void Print() const;
|
void Print() const;
|
||||||
void Delete() const;
|
void Delete() const;
|
||||||
void Collect(const string &name, bool found, CollectStruct &collect_struct) const;
|
void Collect(const string &name, bool found, CollectStruct &collect_struct) const;
|
||||||
returned_ReadData_t ReadData(char* InBuff, int* pBuff) const;
|
returned_ReadData_t ReadData(char* InBuff, int* pBuff) const;
|
||||||
returned_ReadData_t Get_Data_Class(Data_Header_t data_header) 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);
|
void DataProceed(Data_Header data_header, char* InBuff, int* pBuff, FlagStructure flag);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
@ -208,53 +208,53 @@ public:
|
||||||
class INT8 : public SimpleElem
|
class INT8 : public SimpleElem
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
virtual int size() const {return(1);};
|
virtual int size() const {return(1);};
|
||||||
virtual double ReadNum(char* InBuff, int* pBuff) const;
|
virtual double ReadNum(char* InBuff, int* pBuff) const;
|
||||||
virtual string ReadAlph(char* InBuff, int* pBuff, int Size) const {return(NULL);};
|
virtual string ReadAlph(char* InBuff, int* pBuff, int Size) const {return(NULL);};
|
||||||
};
|
};
|
||||||
|
|
||||||
class INT16 : public SimpleElem
|
class INT16 : public SimpleElem
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
virtual int size() const {return(2);};
|
virtual int size() const {return(2);};
|
||||||
virtual double ReadNum(char* InBuff, int* pBuff) const;
|
virtual double ReadNum(char* InBuff, int* pBuff) const;
|
||||||
virtual string ReadAlph(char* InBuff, int* pBuff, int Size) const {return(NULL);};
|
virtual string ReadAlph(char* InBuff, int* pBuff, int Size) const {return(NULL);};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
class INT32 : public SimpleElem
|
class INT32 : public SimpleElem
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
virtual int size() const {return(4);};
|
virtual int size() const {return(4);};
|
||||||
virtual double ReadNum(char* InBuff, int* pBuff) const;
|
virtual double ReadNum(char* InBuff, int* pBuff) const;
|
||||||
virtual string ReadAlph(char* InBuff, int* pBuff, int Size) const {return(NULL);};
|
virtual string ReadAlph(char* InBuff, int* pBuff, int Size) const {return(NULL);};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
class INT64 : public SimpleElem
|
class INT64 : public SimpleElem
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
virtual int size() const {return(8);};
|
virtual int size() const {return(8);};
|
||||||
virtual double ReadNum(char* InBuff, int* pBuff) const;
|
virtual double ReadNum(char* InBuff, int* pBuff) const;
|
||||||
virtual string ReadAlph(char* InBuff, int* pBuff, int Size) const {return(NULL);};
|
virtual string ReadAlph(char* InBuff, int* pBuff, int Size) const {return(NULL);};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
class Single : public SimpleElem
|
class Single : public SimpleElem
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
virtual int size() const {return(4);};
|
virtual int size() const {return(4);};
|
||||||
virtual double ReadNum(char* InBuff, int* pBuff) const;
|
virtual double ReadNum(char* InBuff, int* pBuff) const;
|
||||||
virtual string ReadAlph(char* InBuff, int* pBuff, int Size) const {return(NULL);};
|
virtual string ReadAlph(char* InBuff, int* pBuff, int Size) const {return(NULL);};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
class Double : public SimpleElem
|
class Double : public SimpleElem
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
virtual int size() const {return(8);};
|
virtual int size() const {return(8);};
|
||||||
virtual double ReadNum(char* InBuff, int* pBuff) const;
|
virtual double ReadNum(char* InBuff, int* pBuff) const;
|
||||||
virtual string ReadAlph(char* InBuff, int* pBuff, int Size) const {return(NULL);};
|
virtual string ReadAlph(char* InBuff, int* pBuff, int Size) const {return(NULL);};
|
||||||
};
|
};
|
||||||
|
|
||||||
//! Base class for Array Element in Mat-File
|
//! Base class for Array Element in Mat-File
|
||||||
|
@ -294,7 +294,7 @@ public:
|
||||||
|
|
||||||
class CellArray : public ArrayElem
|
class CellArray : public ArrayElem
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
virtual void Collect(const string &name, bool found, CollectStruct &collect_struct) const;
|
virtual void Collect(const string &name, bool found, CollectStruct &collect_struct) const;
|
||||||
virtual void Print() const;
|
virtual void Print() const;
|
||||||
virtual void Delete() const;
|
virtual void Delete() const;
|
||||||
|
@ -303,7 +303,7 @@ class CellArray : public ArrayElem
|
||||||
|
|
||||||
class Structure : public ArrayElem
|
class Structure : public ArrayElem
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
virtual void Collect(const string &name, bool found, CollectStruct &collect_struct) const;
|
virtual void Collect(const string &name, bool found, CollectStruct &collect_struct) const;
|
||||||
virtual void Print() const;
|
virtual void Print() const;
|
||||||
virtual void Delete() const;
|
virtual void Delete() const;
|
||||||
|
@ -312,7 +312,7 @@ class Structure : public ArrayElem
|
||||||
|
|
||||||
class Object : public ArrayElem
|
class Object : public ArrayElem
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
virtual void Collect(const string &name, bool found, CollectStruct &collect_struct) const;
|
virtual void Collect(const string &name, bool found, CollectStruct &collect_struct) const;
|
||||||
virtual void Print() const;
|
virtual void Print() const;
|
||||||
virtual void Delete() const;
|
virtual void Delete() const;
|
||||||
|
@ -321,7 +321,7 @@ class Object : public ArrayElem
|
||||||
|
|
||||||
class CharacterArray : public ArrayElem
|
class CharacterArray : public ArrayElem
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
virtual void Collect(const string &name, bool found, CollectStruct &collect_struct) const;
|
virtual void Collect(const string &name, bool found, CollectStruct &collect_struct) const;
|
||||||
virtual void Print() const;
|
virtual void Print() const;
|
||||||
virtual void Delete() const;
|
virtual void Delete() const;
|
||||||
|
@ -330,7 +330,7 @@ class CharacterArray : public ArrayElem
|
||||||
|
|
||||||
class SparseArray : public ArrayElem
|
class SparseArray : public ArrayElem
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
virtual void Collect(const string &name, bool found, CollectStruct &collect_struct) const;
|
virtual void Collect(const string &name, bool found, CollectStruct &collect_struct) const;
|
||||||
virtual void Print() const;
|
virtual void Print() const;
|
||||||
virtual void Delete() const;
|
virtual void Delete() const;
|
||||||
|
@ -339,7 +339,7 @@ class SparseArray : public ArrayElem
|
||||||
|
|
||||||
class DoublePrecisionArray : public ArrayElem
|
class DoublePrecisionArray : public ArrayElem
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
virtual void Collect(const string &name, bool found, CollectStruct &collect_struct) const;
|
virtual void Collect(const string &name, bool found, CollectStruct &collect_struct) const;
|
||||||
virtual void Print() const;
|
virtual void Print() const;
|
||||||
virtual void Delete() const;
|
virtual void Delete() const;
|
||||||
|
@ -348,7 +348,7 @@ class DoublePrecisionArray : public ArrayElem
|
||||||
|
|
||||||
class SinglePrecisionArray : public ArrayElem
|
class SinglePrecisionArray : public ArrayElem
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
virtual void Collect(const string &name, bool found, CollectStruct &collect_struct) const;
|
virtual void Collect(const string &name, bool found, CollectStruct &collect_struct) const;
|
||||||
virtual void Print() const;
|
virtual void Print() const;
|
||||||
virtual void Delete() const;
|
virtual void Delete() const;
|
||||||
|
@ -357,7 +357,7 @@ class SinglePrecisionArray : public ArrayElem
|
||||||
|
|
||||||
class Bit8SignedInteger : public ArrayElem
|
class Bit8SignedInteger : public ArrayElem
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
virtual void Collect(const string &name, bool found, CollectStruct &collect_struct) const;
|
virtual void Collect(const string &name, bool found, CollectStruct &collect_struct) const;
|
||||||
virtual void Print() const;
|
virtual void Print() const;
|
||||||
virtual void Delete() const;
|
virtual void Delete() const;
|
||||||
|
@ -366,7 +366,7 @@ class Bit8SignedInteger : public ArrayElem
|
||||||
|
|
||||||
class Bit8UnsignedInteger : public ArrayElem
|
class Bit8UnsignedInteger : public ArrayElem
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
virtual void Collect(const string &name, bool found, CollectStruct &collect_struct) const;
|
virtual void Collect(const string &name, bool found, CollectStruct &collect_struct) const;
|
||||||
virtual void Print() const;
|
virtual void Print() const;
|
||||||
virtual void Delete() const;
|
virtual void Delete() const;
|
||||||
|
@ -375,7 +375,7 @@ class Bit8UnsignedInteger : public ArrayElem
|
||||||
|
|
||||||
class Bit16SignedInteger : public ArrayElem
|
class Bit16SignedInteger : public ArrayElem
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
virtual void Collect(const string &name, bool found, CollectStruct &collect_struct) const;
|
virtual void Collect(const string &name, bool found, CollectStruct &collect_struct) const;
|
||||||
virtual void Print() const;
|
virtual void Print() const;
|
||||||
virtual void Delete() const;
|
virtual void Delete() const;
|
||||||
|
@ -384,7 +384,7 @@ class Bit16SignedInteger : public ArrayElem
|
||||||
|
|
||||||
class Bit16UnsignedInteger : public ArrayElem
|
class Bit16UnsignedInteger : public ArrayElem
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
virtual void Collect(const string &name, bool found, CollectStruct &collect_struct) const;
|
virtual void Collect(const string &name, bool found, CollectStruct &collect_struct) const;
|
||||||
virtual void Print() const;
|
virtual void Print() const;
|
||||||
virtual void Delete() const;
|
virtual void Delete() const;
|
||||||
|
@ -393,7 +393,7 @@ class Bit16UnsignedInteger : public ArrayElem
|
||||||
|
|
||||||
class Bit32SignedInteger : public ArrayElem
|
class Bit32SignedInteger : public ArrayElem
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
virtual void Collect(const string &name, bool found, CollectStruct &collect_struct) const;
|
virtual void Collect(const string &name, bool found, CollectStruct &collect_struct) const;
|
||||||
virtual void Print() const;
|
virtual void Print() const;
|
||||||
virtual void Delete() const;
|
virtual void Delete() const;
|
||||||
|
@ -402,7 +402,7 @@ class Bit32SignedInteger : public ArrayElem
|
||||||
|
|
||||||
class Bit32UnsignedInteger : public ArrayElem
|
class Bit32UnsignedInteger : public ArrayElem
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
virtual void Collect(const string &name, bool found, CollectStruct &collect_struct) const;
|
virtual void Collect(const string &name, bool found, CollectStruct &collect_struct) const;
|
||||||
virtual void Print() const;
|
virtual void Print() const;
|
||||||
virtual void Delete() const;
|
virtual void Delete() const;
|
||||||
|
@ -412,7 +412,7 @@ class Bit32UnsignedInteger : public ArrayElem
|
||||||
|
|
||||||
class MatlabFile
|
class MatlabFile
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
Header_t header;
|
Header_t header;
|
||||||
vector<PSimpleElem> VSimpl;
|
vector<PSimpleElem> VSimpl;
|
||||||
MatlabFile();
|
MatlabFile();
|
||||||
|
|
|
@ -160,7 +160,7 @@ public:
|
||||||
bool computeThirdDerivatives;
|
bool computeThirdDerivatives;
|
||||||
//! Execute computations (variable sorting + derivation)
|
//! Execute computations (variable sorting + derivation)
|
||||||
/*! You must set computeJacobian, computeJacobianExo, computeHessian, computeStaticHessian and computeThirdDerivatives to correct values before calling this function
|
/*! 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);
|
void computingPass(const eval_context_type &eval_context, bool no_tmp_terms);
|
||||||
//! Writes model initialization and lead/lag incidence matrix to output
|
//! Writes model initialization and lead/lag incidence matrix to output
|
||||||
void writeOutput(ostream &output) const;
|
void writeOutput(ostream &output) const;
|
||||||
|
|
|
@ -49,7 +49,7 @@ using namespace std;
|
||||||
|
|
||||||
//! The lexer class
|
//! The lexer class
|
||||||
/*! Actually it was necessary to subclass the DynareFlexLexer class generated by Flex,
|
/*! 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
|
class DynareFlex : public DynareFlexLexer
|
||||||
{
|
{
|
||||||
|
|
|
@ -31,11 +31,11 @@ using namespace std;
|
||||||
|
|
||||||
//! Stores the symbol table
|
//! 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
|
class SymbolTable
|
||||||
{
|
{
|
||||||
|
|
|
@ -44,7 +44,7 @@ using namespace std;
|
||||||
|
|
||||||
//! The lexer class
|
//! The lexer class
|
||||||
/*! Actually it was necessary to subclass the MacroFlexLexer class generated by Flex,
|
/*! 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
|
class MacroFlex : public MacroFlexLexer
|
||||||
{
|
{
|
||||||
|
@ -128,8 +128,8 @@ private:
|
||||||
|
|
||||||
//! Iterates over the loop body
|
//! Iterates over the loop body
|
||||||
/*! If loop is terminated, return false and do nothing.
|
/*! If loop is terminated, return false and do nothing.
|
||||||
Otherwise, set loop variable to its new value (through driver.iter_loop()),
|
Otherwise, set loop variable to its new value (through driver.iter_loop()),
|
||||||
and initialise a new scanning context with the loop body */
|
and initialise a new scanning context with the loop body */
|
||||||
bool iter_loop(MacroDriver &driver, Macro::parser::location_type *yylloc);
|
bool iter_loop(MacroDriver &driver, Macro::parser::location_type *yylloc);
|
||||||
public:
|
public:
|
||||||
MacroFlex(istream* in, ostream* out, bool no_line_macro_arg);
|
MacroFlex(istream* in, ostream* out, bool no_line_macro_arg);
|
||||||
|
|
|
@ -150,8 +150,8 @@ public:
|
||||||
virtual const MacroValue *in(const MacroValue *array) const throw (TypeError);
|
virtual const MacroValue *in(const MacroValue *array) const throw (TypeError);
|
||||||
//! Creates a integer range
|
//! Creates a integer range
|
||||||
/*! Arguments must be of type IntMV.
|
/*! Arguments must be of type IntMV.
|
||||||
Returns an integer array containing all integers between mv1 and mv2.
|
Returns an integer array containing all integers between mv1 and mv2.
|
||||||
If mv2 < mv1, constructs the range in decreasing order.
|
If mv2 < mv1, constructs the range in decreasing order.
|
||||||
*/
|
*/
|
||||||
static const MacroValue *new_range(MacroDriver &driver, const MacroValue *mv1, const MacroValue *mv2) throw (TypeError);
|
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);
|
virtual const MacroValue *operator!=(const MacroValue &mv) const throw (TypeError);
|
||||||
//! Subscripting operator
|
//! Subscripting operator
|
||||||
/*! Argument must be an ArrayMV<int>. Indexes begin at 1.
|
/*! Argument must be an ArrayMV<int>. Indexes begin at 1.
|
||||||
If argument is a one-element array, returns an IntMV or StringMV.
|
If argument is a one-element array, returns an IntMV or StringMV.
|
||||||
Otherwise returns an array. */
|
Otherwise returns an array. */
|
||||||
virtual const MacroValue *operator[](const MacroValue &mv) const throw (TypeError, OutOfBoundsError);
|
virtual const MacroValue *operator[](const MacroValue &mv) const throw (TypeError, OutOfBoundsError);
|
||||||
//! Returns a string containing the concatenation of string representations of elements
|
//! Returns a string containing the concatenation of string representations of elements
|
||||||
virtual string toString() const;
|
virtual string toString() const;
|
||||||
|
|
Loading…
Reference in New Issue