Kaydet (Commit) d76a0073 authored tarafından Oliver Bolte's avatar Oliver Bolte

CWS-TOOLING: integrate CWS calcperf03

2009-01-27 17:45:09 +0100 er  r267014 : satisfy some stoneage compiler (tinderbox error)
2009-01-26 13:53:16 +0100 er  r266921 : corrected merge accident
2009-01-23 23:27:18 +0100 er  r266857 : #i97468# for better accuracy use ::rtl::math::atanh() in ATANH and FISHER, tanh() in FISHERINV; patch from <regina>
2009-01-23 23:08:14 +0100 er  r266854 : #i97467# added C99 atanh() substitute rtl_math_atanh() and ::rtl::math::atanh() since not all compilers have it; patch from <regina>
Plus in rtl_math_log1p() made a variable volatile to prevent compilers from being too smart.
2009-01-23 19:20:43 +0100 er  r266849 : #i95381# make PODF adapter recognize empty/missing parameter, in this case ADDRESS 3rd parameter
2009-01-23 17:34:21 +0100 er  r266841 : #i95450# support ADDRESS 3rd parameter (abs) as missing parameter
2009-01-23 15:53:23 +0100 er  r266830 : some minor beautification
2009-01-23 15:45:20 +0100 er  r266829 : small bits missed during integration of cws frmdlg
2009-01-23 02:56:38 +0100 er  r266764 : removed CVS nonsense
2009-01-23 02:50:15 +0100 er  r266763 : get rid of nasty DOS lineends
2009-01-23 01:56:09 +0100 er  r266762 : #i98318# fix crash with external references constructed via Function Wizard; also fixes crash #i98338# and WaE #i97555#
2009-01-22 15:58:41 +0100 er  r266732 : #i97547# EUROCONVERT: add SKK/EUR
2009-01-21 15:47:39 +0100 er  r266676 : CWS-TOOLING: rebase CWS calcperf03 to trunk@266428 (milestone: DEV300:m39)
2009-01-09 17:22:23 +0100 er  r266105 : #i89976# use ::std::nth_element() instead of a fully sorted array for MEDIAN, PERCENTILE, QUARTILE, LARGE, SMALL
2008-11-07 20:13:55 +0100 er  r263483 : #i95967# Broadcast: use bulk broadcast also for single cell changes as multiple identical listeners may be involved; speeds up the Zaske document to draw level with Excel
2008-11-07 20:08:37 +0100 er  r263482 : #i95967# Notify: spare a vtable access
üst 3ad7d198
......@@ -89,10 +89,11 @@ public:
FormulaCompiler(FormulaTokenArray& _rArr);
virtual ~FormulaCompiler();
// SUNWS7 needs a forward declared friend, otherwise members of the outer
// SUNWS8 needs a forward declared friend, otherwise members of the outer
// class are not accessible.
class OpCodeMap;
friend class FormulaCompiler::OpCodeMap;
/** Mappings from strings to OpCodes and vice versa. */
class FORMULA_DLLPUBLIC OpCodeMap
{
......
......@@ -31,8 +31,8 @@
#ifndef FORMULA_INTRUREF_HXX
#define FORMULA_INTRUREF_HXX
namespace formula
{
namespace formula
{
/** A simple intrusive refcounting template, not thread safe, but therefore
also a bit faster than boost's smart_ptr or uno::Reference equivalents, and
......@@ -96,9 +96,9 @@ public:
inline operator T*() const { return p; }
inline T* get() const { return p; }
};
// =============================================================================
} // formula
// =============================================================================
// =============================================================================
} // formula
// =============================================================================
#endif // SC_INTRUREF_HXX
......@@ -74,30 +74,30 @@ class FORMULA_DLLPUBLIC FormulaTokenArray
friend class FormulaMissingContext;
protected:
FormulaToken** pCode; // Token code array
FormulaToken** pRPN; // RPN array
FormulaToken** pCode; // Token code array
FormulaToken** pRPN; // RPN array
USHORT nLen; // Length of token array
USHORT nRPN; // Length of RPN array
USHORT nIndex; // Current step index
USHORT nError; // Error code
short nRefs; // Count of cell references
ScRecalcMode nMode; // Flags to indicate when to recalc this code
BOOL bHyperLink; // If HYPERLINK() occurs in the formula.
BOOL bHyperLink; // If HYPERLINK() occurs in the formula.
protected:
void Assign( const FormulaTokenArray& );
/// Also used by the compiler. The token MUST had been allocated with new!
FormulaToken* Add( FormulaToken* );
FormulaToken* Add( FormulaToken* );
inline void SetCombinedBitsRecalcMode( ScRecalcMode nBits )
{ nMode |= (nBits & ~RECALCMODE_EMASK); }
{ nMode |= (nBits & ~RECALCMODE_EMASK); }
inline ScRecalcMode GetCombinedBitsRecalcMode() const
{ return nMode & ~RECALCMODE_EMASK; }
{ return nMode & ~RECALCMODE_EMASK; }
/** Exclusive bits already set in nMode are
zero'ed, nVal may contain combined bits, but
only one exclusive bit may be set! */
inline void SetMaskedRecalcMode( ScRecalcMode nBits )
{ nMode = GetCombinedBitsRecalcMode() | nBits; }
{ nMode = GetCombinedBitsRecalcMode() | nBits; }
public:
FormulaTokenArray();
......@@ -222,14 +222,14 @@ public:
/** Determines if this formula needs any changes to convert it to something
previous versions of OOo could consume (Plain Old Formula). */
bool NeedsPofRewrite(const MissingConvention & rConv);
bool NeedsPofRewrite(const MissingConvention & rConv);
/** Rewrites to Plain Old Formula, substituting missing parameters. The
FormulaTokenArray* returned is new'ed. */
FormulaTokenArray* RewriteMissingToPof(const MissingConvention & rConv);
FormulaTokenArray* RewriteMissingToPof(const MissingConvention & rConv);
/** Determines if this formula may be followed by a reference. */
bool MayReferenceFollow();
bool MayReferenceFollow();
};
inline OpCode FormulaTokenArray::GetOuterFuncOpCode()
......
/build.lst/1.10/Wed Aug 20 14:15:04 2008//Tcws_dev300_frmdlg
/d.lst/1.6/Fri Aug 17 11:27:10 2007//Tcws_dev300_frmdlg
/rpt.xml/1.2/Mon Jul 09 11:56:12 2007//Tcws_dev300_frmdlg
D
:pserver:oj@so-cvs-tunnel.germany.sun.com:/cvs
Issue number:
Submitted by:
Reviewed by:
CVS: ----------------------------------------------------------------------
CVS: Issue number:
CVS: If this change addresses one or more issues,
CVS: then enter the issue number(s) here.
CVS: Submitted by:
CVS: If this code has been contributed to the project by someone else; i.e.,
CVS: they sent us a patch or a set of diffs, then include their name/email
CVS: address here. If this is your work then delete this line.
CVS: Reviewed by:
CVS: If we are doing pre-commit code reviews and someone else has
CVS: reviewed your changes, include their name(s) here.
CVS: If you have not had it reviewed then delete this line.
CVS: ----------------------------------------------------------------------
CVS: Committers,
CVS:
CVS: Please follow these protocols:
CVS:
CVS: * Please include in the log message
CVS: reference(s) by ID / number and/or URL
CVS: to any and all relevant OpenOffice.org issue(s).
CVS:
CVS: * If the code is contributed from outside Sun
CVS: then please verify using the list at the following URL
CVS: http://www.openoffice.org/copyright/copyrightapproved.html
CVS: that Sun has received a signed Copyright Assignment Form
CVS: from the submitter.
CVS:
CVS: Otherwise,
CVS: please send an email TO: the submitter; and CC: OOCRequest@eng.sun.com
CVS: the letter (CopyRightRequest.txt) to request assignment of copyright to Sun
CVS: (http://www.openoffice.org/copyright/assign_copyright.html).
CVS:
CVS: Please do NOT commit code until you have verified (as detailed above) that
CVS: Sun has received a signed Copyright Assignment Form from the submitter.
CVS:
CVS: * Please send an email TO: the submitter
CVS: (particularly, if from outside Sun)
CVS: advising that the code has been committed,
CVS: and gratefully recognizing the contribution.
......@@ -880,11 +880,6 @@ BOOL FormulaTokenArray::HasMatrixDoubleRefOps()
// --- POF (plain old formula) rewrite of a token array ---------------------
/* TODO: When both POF OOoXML and ODFF are to be supported differently, the
* FormulaMissingContext and FormulaTokenArray::*Pof* methods should go to a convention
* on its own.
*/
#if 0
// static function can't be compiled if not used (warning)
//#if OSL_DEBUG_LEVEL > 0
......@@ -898,65 +893,65 @@ static void DumpTokArr( FormulaTokenArray *pCode )
}
#endif
inline bool MissingConvention::isRewriteNeeded( OpCode eOp ) const
{
switch (eOp)
{
case ocGammaDist:
case ocPoissonDist:
return true;
case ocMissing:
case ocLog:
case ocAddress:
return !isODFF(); // rewrite only for PODF
default:
return false;
}
inline bool MissingConvention::isRewriteNeeded( OpCode eOp ) const
{
switch (eOp)
{
case ocGammaDist:
case ocPoissonDist:
case ocAddress:
return true;
case ocMissing:
case ocLog:
return !isODFF(); // rewrite only for PODF
default:
return false;
}
}
class FormulaMissingContext
{
public:
const FormulaToken* mpFunc;
int mnCurArg;
const FormulaToken* mpFunc;
int mnCurArg;
void Clear() { mpFunc = NULL; mnCurArg = 0; }
inline bool AddDefaultArg( FormulaTokenArray* pNewArr, int nArg, double f ) const;
static inline bool IsRewriteNeeded( OpCode eOp );
bool AddMissingExternal( FormulaTokenArray* pNewArr ) const;
bool AddMissing( FormulaTokenArray *pNewArr, const MissingConvention & rConv ) const;
void AddMoreArgs( FormulaTokenArray *pNewArr, const MissingConvention & rConv ) const;
};
void FormulaMissingContext::AddMoreArgs( FormulaTokenArray *pNewArr, const MissingConvention & rConv ) const
{
if ( !mpFunc )
return;
switch (mpFunc->GetOpCode())
{
case ocGammaDist:
if (mnCurArg == 2)
{
pNewArr->AddOpCode( ocSep );
pNewArr->AddDouble( 1.0 ); // 4th, Cumulative=TRUE()
}
break;
case ocPoissonDist:
if (mnCurArg == 1)
{
pNewArr->AddOpCode( ocSep );
pNewArr->AddDouble( 1.0 ); // 3rd, Cumulative=TRUE()
}
break;
case ocLog:
if ( !rConv.isODFF() && mnCurArg == 0 )
{
pNewArr->AddOpCode( ocSep );
pNewArr->AddDouble( 10.0 ); // 2nd, basis 10
}
break;
default:
break;
if ( !mpFunc )
return;
switch (mpFunc->GetOpCode())
{
case ocGammaDist:
if (mnCurArg == 2)
{
pNewArr->AddOpCode( ocSep );
pNewArr->AddDouble( 1.0 ); // 4th, Cumulative=TRUE()
}
break;
case ocPoissonDist:
if (mnCurArg == 1)
{
pNewArr->AddOpCode( ocSep );
pNewArr->AddDouble( 1.0 ); // 3rd, Cumulative=TRUE()
}
break;
case ocLog:
if ( !rConv.isODFF() && mnCurArg == 0 )
{
pNewArr->AddOpCode( ocSep );
pNewArr->AddDouble( 10.0 ); // 2nd, basis 10
}
break;
default:
break;
}
}
......@@ -970,21 +965,10 @@ inline bool FormulaMissingContext::AddDefaultArg( FormulaTokenArray* pNewArr, in
return false;
}
inline bool FormulaMissingContext::IsRewriteNeeded( OpCode eOp )
{
switch (eOp)
{
case ocMissing:
case ocLog:
case ocAddress:
return true;
default:
return false;
}
}
bool FormulaMissingContext::AddMissingExternal( FormulaTokenArray *pNewArr ) const
{
// Only called for PODF, not ODFF. No need to distinguish.
const String &rName = mpFunc->GetExternal();
// initial (fast) check:
......@@ -1007,54 +991,63 @@ bool FormulaMissingContext::AddMissingExternal( FormulaTokenArray *pNewArr ) con
bool FormulaMissingContext::AddMissing( FormulaTokenArray *pNewArr, const MissingConvention & rConv ) const
{
if ( !mpFunc )
return false;
bool bRet = false;
if (rConv.isODFF())
{
}
else
{
switch ( mpFunc->GetOpCode() )
{
case ocFixed:
return AddDefaultArg( pNewArr, 1, 2.0 );
//break;
case ocBetaDist:
case ocBetaInv:
case ocRMZ: // PMT
return AddDefaultArg( pNewArr, 3, 0.0 );
//break;
case ocZinsZ: // IPMT
case ocKapz: // PPMT
return AddDefaultArg( pNewArr, 4, 0.0 );
//break;
case ocBW: // PV
case ocZW: // FV
bRet |= AddDefaultArg( pNewArr, 2, 0.0 ); // pmt
bRet |= AddDefaultArg( pNewArr, 3, 0.0 ); // [fp]v
break;
case ocZins: // RATE
bRet |= AddDefaultArg( pNewArr, 1, 0.0 ); // pmt
bRet |= AddDefaultArg( pNewArr, 3, 0.0 ); // fv
bRet |= AddDefaultArg( pNewArr, 4, 0.0 ); // type
break;
case ocExternal:
return AddMissingExternal( pNewArr );
//break;
// --- more complex cases ---
case ocOffset:
// FIXME: rather tough.
// if arg 3 (height) ommitted, export arg1 (rows)
break;
default:
break;
}
}
if ( !mpFunc )
return false;
bool bRet = false;
const OpCode eOp = mpFunc->GetOpCode();
// Add for both, PODF and ODFF
switch (eOp)
{
case ocAddress:
return AddDefaultArg( pNewArr, 2, 1.0 ); // abs
default:
break;
}
if (rConv.isODFF())
{
// Add for ODFF
}
else
{
// Add for PODF
switch (eOp)
{
case ocFixed:
return AddDefaultArg( pNewArr, 1, 2.0 );
case ocBetaDist:
case ocBetaInv:
case ocRMZ: // PMT
return AddDefaultArg( pNewArr, 3, 0.0 );
case ocZinsZ: // IPMT
case ocKapz: // PPMT
return AddDefaultArg( pNewArr, 4, 0.0 );
case ocBW: // PV
case ocZW: // FV
bRet |= AddDefaultArg( pNewArr, 2, 0.0 ); // pmt
bRet |= AddDefaultArg( pNewArr, 3, 0.0 ); // [fp]v
break;
case ocZins: // RATE
bRet |= AddDefaultArg( pNewArr, 1, 0.0 ); // pmt
bRet |= AddDefaultArg( pNewArr, 3, 0.0 ); // fv
bRet |= AddDefaultArg( pNewArr, 4, 0.0 ); // type
break;
case ocExternal:
return AddMissingExternal( pNewArr );
// --- more complex cases ---
case ocOffset:
// FIXME: rather tough.
// if arg 3 (height) ommitted, export arg1 (rows)
break;
default:
break;
}
}
return bRet;
}
......@@ -1113,8 +1106,8 @@ FormulaTokenArray * FormulaTokenArray::RewriteMissingToPof( const MissingConvent
++nFn; // all following operations on _that_ function
pCtx[ nFn ].mpFunc = PeekPrevNoSpaces();
pCtx[ nFn ].mnCurArg = 0;
if (pCtx[ nFn ].mpFunc && pCtx[ nFn ].mpFunc->GetOpCode() == ocAddress)
pOcas[ nOcas++ ] = nFn; // entering ADDRESS()
if (pCtx[ nFn ].mpFunc && pCtx[ nFn ].mpFunc->GetOpCode() == ocAddress && !rConv.isODFF())
pOcas[ nOcas++ ] = nFn; // entering ADDRESS() if PODF
break;
case ocClose:
pCtx[ nFn ].AddMoreArgs( pNewArr, rConv );
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment