v4 parser: correcting for 64 bits

git-svn-id: https://www.dynare.org/svn/dynare/dynare_v4@949 ac1d8469-bf42-47a9-8791-bf33cf982152
time-shift
michel 2006-10-07 09:50:42 +00:00
parent 7a5d7f3a53
commit cf650ea461
4 changed files with 37 additions and 29 deletions

View File

@ -131,22 +131,22 @@ dynare::Objects* dynare::parser::translate_symbol(Objects* obj)
ostringstream symbol;
if (obj->type == eEndogenous)
{
symbol << "oo_.steady_state(" << (int)obj->ID+1 << ")";
symbol << "oo_.steady_state(" << (long int)obj->ID+1 << ")";
obj->symbol = symbol.str();
}
else if (obj->type == eExogenous)
{
symbol << "oo_.exo_steady_state(" << (int)obj->ID+1 << ")";
symbol << "oo_.exo_steady_state(" << (long int)obj->ID+1 << ")";
obj->symbol = symbol.str();
}
else if (obj->type == eExogenousDet)
{
symbol << "oo_.exo_det_steady_state(" << (int)obj->ID+1 << ")";
symbol << "oo_.exo_det_steady_state(" << (long int)obj->ID+1 << ")";
obj->symbol = symbol.str();
}
else if (obj->type == eParameter)
{
symbol << "M_.params(" << (int)obj->ID+1 << ")";
symbol << "M_.params(" << (long int)obj->ID+1 << ")";
obj->symbol = symbol.str();
}
else if (obj->type == eLocalParameter)
@ -158,8 +158,8 @@ dynare::Objects* dynare::parser::translate_symbol(Objects* obj)
dynare::Objects* dynare::parser::add_expression_token( Objects* arg1, Objects* arg2, Objects* op)
{
int id = expression.AddToken((int) arg1->ID,arg1->type,
(int) arg2->ID,arg2->type,
int id = expression.AddToken((long int) arg1->ID,arg1->type,
(long int) arg2->ID,arg2->type,
op->opcode);
//cout << "after add_expression_token\n";
return new Objects("", (NodeID) id, eTempResult);
@ -169,12 +169,12 @@ dynare::Objects* dynare::parser::add_expression_token( Objects* arg1, Objects* o
int id;
if (op->opcode != NAME)
{
id = expression.AddToken((int) arg1->ID,arg1->type,
id = expression.AddToken((long int) arg1->ID,arg1->type,
op->opcode);
}
else
{
id = expression.AddToken((int) arg1->ID,arg1->type,
id = expression.AddToken((long int) arg1->ID,arg1->type,
op->symbol);
}

View File

@ -636,7 +636,7 @@ inline NodeID ModelTree::DeriveArgument(NodeID iArg, Type iType, int iVarID)
case eExogenousDet :
case eEndogenous :
case eRecursiveVariable :
if ((int) iArg == iVarID)
if ((long int) iArg == iVarID)
//if ((VariableTable::getSymbolID(iArg) == VariableTable::getSymbolID(iVarID)) &&
// (VariableTable::getType(iArg) == VariableTable::getType(iVarID)))
{
@ -1290,20 +1290,20 @@ inline string ModelTree::getArgument(NodeID id, Type type, EquationType iEquatio
if (type == eParameter)
{
argument << param_name << lpar << (int)id+offset << rpar;
argument << param_name << lpar << (long int)id+offset << rpar;
}
else if (type == eLocalParameter)
{
argument << SymbolTable::getNameByID(eLocalParameter,(int)id);
argument << SymbolTable::getNameByID(eLocalParameter,(long int)id);
}
else if (type == eNumericalConstant)
{
argument << NumericalConstants::get((int) id);
argument << NumericalConstants::get((long int) id);
}
else if (type == eEndogenous || type == eExogenous || type == eExogenousDet)
if (iEquationType == eStaticEquations || iEquationType == eStaticDerivatives)
{
int idx = VariableTable::getSymbolID((int) id)+offset;
int idx = VariableTable::getSymbolID((long int) id)+offset;
if (type == eEndogenous)
{
argument << "y" << lpar << idx << rpar;
@ -1322,13 +1322,13 @@ inline string ModelTree::getArgument(NodeID id, Type type, EquationType iEquatio
{
if (type == eEndogenous)
{
int idx = VariableTable::getPrintIndex((int) id)+offset;
int idx = VariableTable::getPrintIndex((long int) id)+offset;
argument << "y" << lpar << idx << rpar;
}
else if (type == eExogenous)
{
int idx = VariableTable::getSymbolID((int) id)+offset;
int lag = VariableTable::getLag((int) id);
int idx = VariableTable::getSymbolID((long int) id)+offset;
int lag = VariableTable::getLag((long int) id);
if (offset == 1)
{
if ( lag != 0)
@ -1356,8 +1356,8 @@ inline string ModelTree::getArgument(NodeID id, Type type, EquationType iEquatio
}
else if (type == eExogenousDet)
{
int idx = VariableTable::getSymbolID((int) id)+ModelParameters::exo_nbr+offset;
int lag = VariableTable::getLag((int) id);
int idx = VariableTable::getSymbolID((long int) id)+ModelParameters::exo_nbr+offset;
int lag = VariableTable::getLag((long int) id);
if (offset == 1)
{
if (lag != 0)

View File

@ -189,7 +189,7 @@ inline std::string DataTree::Key(MToken iToken)
char key[100];
//ostringstream key;
//key << iToken.id1 << " " << iToken.id2 << " " << iToken.type1 << " " << iToken.op_code;
sprintf(key,"%X %X %d %d", (int)iToken.id1, (int)iToken.id2,
sprintf(key,"%X %X %d %d", (long int)iToken.id1, (long int)iToken.id2,
iToken.type1, iToken.op_code);
//std::cout << key << endl;
return std::string(key);

View File

@ -1,7 +1,9 @@
/* A Bison parser, made by GNU Bison 2.1. */
/* A Bison parser, made by GNU Bison 2.3. */
/* Skeleton parser for Yacc-like parsing with Bison,
Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005 Free Software Foundation, Inc.
/* Skeleton interface for Bison's Yacc-like parsers in C
Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005, 2006
Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@ -18,10 +20,18 @@
Foundation, Inc., 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301, USA. */
/* As a special exception, when this file is copied by Bison into a
Bison output file, you may use that output file without restriction.
This special exception was added by the Free Software Foundation
in version 1.24 of Bison. */
/* As a special exception, you may create a larger work that contains
part or all of the Bison parser skeleton and distribute that work
under terms of your choice, so long as that work isn't itself a
parser generator using the skeleton or a modified version thereof
as a parser skeleton. Alternatively, if you modify or redistribute
the parser skeleton itself, you may (at your option) remove this
special exception, which will cause the skeleton and the resulting
Bison output files to be licensed under the GNU General Public
License without this special exception.
This special exception was added by the Free Software Foundation in
version 2.2 of Bison. */
/* Tokens. */
#ifndef YYTOKENTYPE
@ -336,7 +346,7 @@
#if ! defined (YYSTYPE) && ! defined (YYSTYPE_IS_DECLARED)
#if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED
typedef int YYSTYPE;
# define yystype YYSTYPE /* obsolescent; will be withdrawn */
# define YYSTYPE_IS_DECLARED 1
@ -345,5 +355,3 @@ typedef int YYSTYPE;
extern YYSTYPE yylval;