[GME-commit] GMESRC/GME/ConstraintManager OCLTree.cpp,1.23,1.24
OCLGMECMFacade.cpp,1.25,1.26
gme-commit at list.isis.vanderbilt.edu
gme-commit at list.isis.vanderbilt.edu
Mon May 31 16:38:33 CDT 2004
Update of /var/lib/gme/GMESRC/GME/ConstraintManager
In directory braindrain:/tmp/cvs-serv14935
Modified Files:
OCLTree.cpp OCLGMECMFacade.cpp
Log Message:
violation lineno ref corrected, called functions displayed
CVS User: bogyom
Index: OCLTree.cpp
===================================================================
RCS file: /var/lib/gme/GMESRC/GME/ConstraintManager/OCLTree.cpp,v
retrieving revision 1.23
retrieving revision 1.24
diff -C2 -d -r1.23 -r1.24
*** OCLTree.cpp 18 May 2004 13:30:58 -0000 1.23
--- OCLTree.cpp 31 May 2004 20:38:31 -0000 1.24
***************
*** 1523,1526 ****
--- 1523,1532 ----
{
LevelCounter level(&m_stackLevel);
+ string lastFuncName = "";
+ static string currFuncName = "";
+ string *szivas = &currFuncName;
+
+ if (m_stackLevel <= 1)
+ currFuncName = "";
if ( m_pIterator )
***************
*** 1561,1564 ****
--- 1567,1576 ----
if ( ! pIMethod )
THROWOCL0( ET_RUNTIME, EX_METHOD_NOT_IMPLEMENTED );
+
+ if (((OclMeta::Feature*)pMethod)->IsDynamic()) // userdef method
+ {
+ lastFuncName = currFuncName;
+ currFuncName = m_strName; // GetFullName();
+ }
pIMethod->Initialize();
***************
*** 1579,1586 ****
for (int kk=0; kk<num; kk++)
{
! string signo = signature.Print();
! vec[kk].methodName = signo;
AddViolation(context, vec[kk]);
}
return CheckFalseResult( context, spResult, iLineFeatureName, signature.Print() );
--- 1591,1600 ----
for (int kk=0; kk<num; kk++)
{
! if (vec[kk].methodName.empty())
! vec[kk].methodName = currFuncName;
AddViolation(context, vec[kk]);
}
+ if (!lastFuncName.empty())
+ currFuncName = lastFuncName;
return CheckFalseResult( context, spResult, iLineFeatureName, signature.Print() );
Index: OCLGMECMFacade.cpp
===================================================================
RCS file: /var/lib/gme/GMESRC/GME/ConstraintManager/OCLGMECMFacade.cpp,v
retrieving revision 1.25
retrieving revision 1.26
diff -C2 -d -r1.25 -r1.26
*** OCLGMECMFacade.cpp 18 May 2004 13:30:58 -0000 1.25
--- OCLGMECMFacade.cpp 31 May 2004 20:38:31 -0000 1.26
***************
*** 71,74 ****
--- 71,75 ----
void operator()()
{
+
if ( ! m_spFunction.Ptr() || m_spFunction->GetState() < Ocl::Constraint::CS_CHECK_DEPENDENCY_SUCCEEDED )
ThrowException( "Constraint method definition cannot be evaluated." );
***************
*** 574,591 ****
}
! /* bool Facade::GetConstraintFunctionText(string &name, string &text)
{
! text = ..
! for ( i = 0 ; i < m_vecUserConstraintFunctions.size() ; i++ )
{
! if ( m_vecUserConstraintFunctions[ i ]->IsValid() &&
! m_vecUserConstraintFunctions[ i ]->GetName() == name)
! {
! text = ..;
! return true;
! }
}
return false;
! }*/
HRESULT Facade::EvaluateConstraints( EvaluationRecordVector& vecInputs, bool bShowProgress )
--- 575,649 ----
}
! bool Facade::getConstraintFunctionText(string &name, string &text)
{
! text = "";
! for (int i = 0 ; i < m_vecUserConstraintFunctions.size() ; i++ )
{
! bool valid = m_vecUserConstraintFunctions[ i ]->IsValid();
! string fname = m_vecUserConstraintFunctions[ i ]->GetName();// GetFullName();
! if ( valid && fname == name)
! {
! text = m_vecUserConstraintFunctions[ i ]->GetText();
! return true;
! }
! }
! for ( i = 0 ; i < m_vecMetaConstraintFunctions.size() ; i++ )
! {
! bool valid = m_vecMetaConstraintFunctions[ i ]->IsValid();
! string fname = m_vecMetaConstraintFunctions[ i ]->GetName();// GetFullName();
! if ( valid && fname == name)
! {
! text = m_vecMetaConstraintFunctions[ i ]->GetText();
! return true;
! }
}
return false;
! }
!
! void Facade::addFunctionTexts(EvaluationRecord &rec)
! {
! int vnum = rec.vecViolations.size();
! int serial = 1;
! for (int k=0; k< vnum; k++)
! {
! string name = rec.vecViolations[k].methodName;
! if (!rec.vecViolations[k].methodName.empty())
! {
! FuncDesc::iterator it = rec.calledFunctions.find(name);
! if (it != rec.calledFunctions.end())
! continue;
! string text;
! if (getConstraintFunctionText(name, text))
! {
! FuncItem item;
! item.text = text;
! item.serial = serial;
! pair<FuncDesc::iterator, bool> pp = rec.calledFunctions.insert(FuncDesc::value_type(name, item));
! ASSERT(pp.second);
! if (pp.second)
! serial++;
! }
! else
! ASSERT(0);
! }
! }
! }
!
! void Facade::updateLineno(EvaluationRecord &rec)
! {
! int recsize = rec.vecViolations.size();
! for (int i=0; i < recsize; i++)
! {
! if (!rec.vecViolations[i].methodName.empty())
! {
! string name = rec.vecViolations[i].methodName;
! FuncDesc::iterator it = rec.calledFunctions.find(name);
! if (it != rec.calledFunctions.end())
! rec.vecViolations[i].position.iLine += it->second.serial*1000;
! else
! ASSERT(0);;
! }
! }
! }
HRESULT Facade::EvaluateConstraints( EvaluationRecordVector& vecInputs, bool bShowProgress )
***************
*** 609,612 ****
--- 667,671 ----
for ( int i = 0 ; i < loopcount && ! bStopEvaluation ; i++ ) {
+ OclGme::SpConstraint constraint = vecInputs[ i ].spConstraint;
// Level condition for terminating the evaluation
***************
*** 646,649 ****
--- 705,710 ----
bStopEvaluation = true;
iViolationCount++;
+ addFunctionTexts(vecInputs[ i ]);
+ updateLineno(vecInputs[ i ]);
dlgErrors.AddItem( vecInputs[ i ] );
if ( ! bShowProgress && vecInputs[ i ].spConstraint->GetPriority() == 1 )
More information about the GME-commit
mailing list