Skip to content

Commit

Permalink
исправлен порядок добавления калков для SMR (#21)
Browse files Browse the repository at this point in the history
  • Loading branch information
bogachev-pa committed Oct 7, 2014
1 parent 55c0cea commit 7ff57d1
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 10 deletions.
8 changes: 3 additions & 5 deletions simulator/compiler/parser/grammar/rdoevn.yx
Original file line number Diff line number Diff line change
Expand Up @@ -9520,11 +9520,9 @@ smr_main
{
#PASS2
{
PARSER->error().error(@1, @3, "Невозможно изменить параметр ресурса до запуска модели");
// TODO вернуть возможность изменить параметр ресурса во вкладке SMR
// LPRDOFUNArithm pArithm = PARSER->stack().pop<RDOFUNArithm>($5);
// ASSERT(pArithm);
// PARSER->getSMR()->setResParValue(PARSER->stack().pop<RDOValue>($1)->src_info(), PARSER->stack().pop<RDOValue>($3)->src_info(), pArithm);
LPRDOFUNArithm pArithm = PARSER->stack().pop<RDOFUNArithm>($5);
ASSERT(pArithm);
PARSER->getSMR()->setResParValue(PARSER->stack().pop<RDOValue>($1)->src_info(), PARSER->stack().pop<RDOValue>($3)->src_info(), pArithm);
}
}
| RDO_IDENTIF '.' RDO_Seed '=' RDO_INT_CONST
Expand Down
8 changes: 7 additions & 1 deletion simulator/compiler/parser/rdoparser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -346,7 +346,7 @@ Context::LPFindResult RDOParser::onFindContext(const std::string& method, const
}
}
}

}

return rdo::Factory<Context::FindResult>::create();
Expand Down Expand Up @@ -531,6 +531,12 @@ void RDOParser::runRSSPost()

void RDOParser::runSMRPost()
{
//! Калки, созданные в SMR
const std::vector<rdo::runtime::LPRDOCalc> calcList = m_pSMR->getCalcList();
for (const rdo::runtime::LPRDOCalc& initCalc: calcList)
{
runtime()->addInitCalc(initCalc);
}
//! Планирование событий, описанных в SMR
for (const LPRDOPATPattern& pattern: getPATPatterns())
{
Expand Down
8 changes: 4 additions & 4 deletions simulator/compiler/parser/rdosmr.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
\file rdosmr.cpp
\authors Барс Александр
\authors Урусов Андрей ([email protected])
\date
\brief
\date
\brief
\indent 4T
*/

Expand Down Expand Up @@ -124,7 +124,7 @@ void RDOSMR::setConstValue(const RDOParserSrcInfo& const_info, LPRDOFUNArithm& p
ASSERT(pArithm);
pArithm->checkParamType(pConstant->getTypeInfo());
rdo::runtime::LPRDOCalc pCalc = pArithm->createCalc(pConstant->getTypeInfo());
RDOParser::s_parser()->runtime()->addInitCalc(rdo::Factory<rdo::runtime::RDOCalcSetConst>::create(pConstant->getNumber(), pCalc));
this->addCalc(rdo::Factory<rdo::runtime::RDOCalcSetConst>::create(pConstant->getNumber(), pCalc));
RDOParser::s_parser()->insertChanges(pConstant->src_text(), pArithm->src_text());
}

Expand All @@ -147,7 +147,7 @@ void RDOSMR::setResParValue(const RDOParserSrcInfo& res_info, const RDOParserSrc
pArithm->checkParamType(pParam->getTypeInfo());
const std::size_t parNumb = pResource->getType()->getRTPParamNumber(par_info.src_text());
rdo::runtime::LPRDOCalc pCalc = pArithm->createCalc(pParam->getTypeInfo());
RDOParser::s_parser()->runtime()->addInitCalc(rdo::Factory<rdo::runtime::RDOSetResourceParamCalc>::create(pResource->getID(), parNumb, pCalc));
this->addCalc(rdo::Factory<rdo::runtime::RDOSetResourceParamCalc>::create(pResource->getID(), parNumb, pCalc));
RDOParser::s_parser()->insertChanges(res_info.src_text() + "." + par_info.src_text(), pArithm->src_text());
}

Expand Down
6 changes: 6 additions & 0 deletions simulator/compiler/parser/rdosmr.h
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,8 @@ DECLARE_FACTORY(RDOSMR);
void setSeed (const RDOParserSrcInfo& seq_info, int base);
void insertBreakPoint(const RDOParserSrcInfo& src_info, LPRDOFUNLogic& pLogic);

std::vector<rdo::runtime::LPRDOCalc> getCalcList() const { return m_SMRCalcList; }

private:
RDOSMR();

Expand All @@ -95,6 +97,10 @@ DECLARE_FACTORY(RDOSMR);
YYLTYPE m_traceEndTime_pos;
LPRDOFUNLogic m_pTerminateIf;
BreakPointList m_breakPointList;

void addCalc(const rdo::runtime::LPRDOCalc pCalc) { m_SMRCalcList.push_back(pCalc); }

std::vector<rdo::runtime::LPRDOCalc> m_SMRCalcList;
};

CLOSE_RDO_PARSER_NAMESPACE
Expand Down

0 comments on commit 7ff57d1

Please sign in to comment.