summaryrefslogtreecommitdiff
path: root/formula
diff options
context:
space:
mode:
authorKohei Yoshida <kohei.yoshida@gmail.com>2013-03-18 22:10:49 -0400
committerKohei Yoshida <kohei.yoshida@gmail.com>2013-03-19 13:40:24 -0400
commit292ffa80bc2665107d7011b2180c2659835d6c26 (patch)
tree68bbe19230409e38910353905fdbce5ff4b991c2 /formula
parent3a09e0078ae0e25c7317baed471a9c7c1f729794 (diff)
First cut on checking the token array on whether we could do vectorization.
Not tested yet. Change-Id: I87f8a8595229d8d8e83526dc0334891d253cf2c7
Diffstat (limited to 'formula')
-rw-r--r--formula/inc/formula/compiler.hrc4
-rw-r--r--formula/inc/formula/tokenarray.hxx6
-rw-r--r--formula/source/core/api/token.cxx6
3 files changed, 16 insertions, 0 deletions
diff --git a/formula/inc/formula/compiler.hrc b/formula/inc/formula/compiler.hrc
index 8acfff652d07..053947c2a796 100644
--- a/formula/inc/formula/compiler.hrc
+++ b/formula/inc/formula/compiler.hrc
@@ -94,6 +94,8 @@
#define SC_OPCODE_NEG_SUB 62
#define SC_OPCODE_STOP_UN_OP 63
+#define SC_OPCODE_START_FUNCTION 65
+
/*** Functions without parameters ***/
#define SC_OPCODE_START_NO_PAR 65
#define SC_OPCODE_PI 65
@@ -403,6 +405,8 @@
#define SC_OPCODE_STOP_2_PAR 407
#define SC_OPCODE_LAST_OPCODE_ID 406 /* last OpCode */
+#define SC_OPCODE_STOP_FUNCTION 407
+
/*** Internal ***/
#define SC_OPCODE_INTERNAL_BEGIN 9999
#define SC_OPCODE_TTT 9999
diff --git a/formula/inc/formula/tokenarray.hxx b/formula/inc/formula/tokenarray.hxx
index 42c92127c856..875b055a621a 100644
--- a/formula/inc/formula/tokenarray.hxx
+++ b/formula/inc/formula/tokenarray.hxx
@@ -192,6 +192,12 @@ public:
*/
bool Fill(const com::sun::star::uno::Sequence< com::sun::star::sheet::FormulaToken >& _aSequence, ExternalReferenceHelper* _pRef = NULL);
+ /**
+ * Do some checking based on the individual tokens. For now, we use this
+ * only to check whether we can vectorize the token array.
+ */
+ virtual void CheckToken( const FormulaToken& t );
+
FormulaToken* AddToken( const FormulaToken& );
FormulaToken* AddString( const sal_Unicode* pStr );
FormulaToken* AddString( const String& rStr );
diff --git a/formula/source/core/api/token.cxx b/formula/source/core/api/token.cxx
index 875055519ddd..84180f02fcf1 100644
--- a/formula/source/core/api/token.cxx
+++ b/formula/source/core/api/token.cxx
@@ -708,6 +708,11 @@ void FormulaTokenArray::Clear()
ClearRecalcMode();
}
+void FormulaTokenArray::CheckToken( const FormulaToken& /*r*/ )
+{
+ // Do nothing.
+}
+
FormulaToken* FormulaTokenArray::AddToken( const FormulaToken& r )
{
return Add( r.Clone() );
@@ -724,6 +729,7 @@ FormulaToken* FormulaTokenArray::Add( FormulaToken* t )
pCode = new FormulaToken*[ MAXCODE ];
if( nLen < MAXCODE-1 )
{
+ CheckToken(*t);
pCode[ nLen++ ] = t;
if( t->GetOpCode() == ocPush
&& ( t->GetType() == svSingleRef || t->GetType() == svDoubleRef ) )