Some cosmetics.

Change-Id: I4825d94c58d8cfb245f110b7f46397c2724436a3
This commit is contained in:
Kohei Yoshida
2014-03-20 09:44:02 -04:00
parent aa99ae09fb
commit 393068beec
3 changed files with 25 additions and 12 deletions

View File

@@ -74,6 +74,9 @@ struct FormulaGroupContext : boost::noncopyable
void ensureStrArray( ColArray& rColArray, size_t nArrayLen );
void ensureNumArray( ColArray& rColArray, size_t nArrayLen );
FormulaGroupContext();
~FormulaGroupContext();
};
/**

View File

@@ -3372,24 +3372,23 @@ DynamicKernel* DynamicKernel::create(ScDocument& /* rDoc */,
sal_uInt8 nParamCount = pCur->GetParamCount();
for (sal_uInt8 i = 0; i < nParamCount; i++)
{
FormulaToken* m_TempFormula = aTokenList.back();
FormulaToken* pTempFormula = aTokenList.back();
aTokenList.pop_back();
if(m_TempFormula->GetOpCode()!=ocPush)
if (pTempFormula->GetOpCode() != ocPush)
{
if (aHashMap.find(m_TempFormula)==aHashMap.end())
if (aHashMap.find(pTempFormula)==aHashMap.end())
return NULL;
pCurNode->Children.push_back(aHashMap[m_TempFormula]);
pCurNode->Children.push_back(aHashMap[pTempFormula]);
}
else
{
FormulaTreeNodeRef m_ChildTreeNode =
FormulaTreeNodeRef pChildTreeNode =
FormulaTreeNodeRef(
new FormulaTreeNode(m_TempFormula));
pCurNode->Children.push_back(m_ChildTreeNode);
new FormulaTreeNode(pTempFormula));
pCurNode->Children.push_back(pChildTreeNode);
}
}
std::reverse(pCurNode->Children.begin(),
pCurNode->Children.end());
std::reverse(pCurNode->Children.begin(), pCurNode->Children.end());
aHashMap[pCur] = pCurNode;
}
aTokenList.push_back(pCur);
@@ -3404,11 +3403,13 @@ DynamicKernel* DynamicKernel::create(ScDocument& /* rDoc */,
return NULL;
// OpenCL source code generation and kernel compilation
try {
try
{
pDynamicKernel->CodeGen();
pDynamicKernel->CreateKernel();
}
catch (const UnhandledToken &ut) {
catch (const UnhandledToken &ut)
{
std::cerr << "\nDynamic formual compiler: unhandled token: ";
std::cerr << ut.mMessage << " at ";
std::cerr << ut.mFile << ":" << ut.mLineNumber << "\n";
@@ -3419,7 +3420,8 @@ DynamicKernel* DynamicKernel::create(ScDocument& /* rDoc */,
return NULL;
#endif
}
catch (...) {
catch (...)
{
std::cerr << "Dynamic formula compiler: unhandled compiler error\n";
return NULL;
}

View File

@@ -129,6 +129,14 @@ void FormulaGroupContext::ensureNumArray( ColArray& rColArray, size_t nArrayLen
rColArray.mpNumArray = &maNumArrays.back();
}
FormulaGroupContext::FormulaGroupContext()
{
}
FormulaGroupContext::~FormulaGroupContext()
{
}
namespace {
/**