[ooo-build-commit] .: patches/test scratch/sc-vba

Noel Power noelp at kemper.freedesktop.org
Tue May 4 03:33:12 PDT 2010


 patches/test/vba-directlocalvaraccess.diff                |  440 ++++++++++----
 scratch/sc-vba/testvba/TestDocuments/MiscOnErrorTests.xls |binary
 2 files changed, 334 insertions(+), 106 deletions(-)

New commits:
commit 922c72b1e55061f0072850ff6da22ea990937847
Author: Noel Power <noel.power at novell.com>
Date:   Tue May 4 11:32:42 2010 +0100

    some improvements for performace patch, new version of Err test doc
    
    * patches/test/vba-directlocalvaraccess.diff:
    * scratch/sc-vba/testvba/TestDocuments/MiscOnErrorTests.xls:

diff --git a/patches/test/vba-directlocalvaraccess.diff b/patches/test/vba-directlocalvaraccess.diff
index 6988c2a..5220842 100644
--- a/patches/test/vba-directlocalvaraccess.diff
+++ b/patches/test/vba-directlocalvaraccess.diff
@@ -1,7 +1,7 @@
-diff -r 8f725fa6b136 basic/source/classes/image.cxx
---- a/basic/source/classes/image.cxx	Tue Apr 20 13:21:03 2010 +0100
-+++ b/basic/source/classes/image.cxx	Fri Apr 23 16:35:00 2010 +0100
-@@ -34,6 +34,47 @@
+diff -r a8d540977f0a basic/source/classes/image.cxx
+--- a/basic/source/classes/image.cxx	Wed Apr 28 15:31:22 2010 +0100
++++ b/basic/source/classes/image.cxx	Tue May 04 10:02:43 2010 +0100
+@@ -37,6 +37,47 @@
  #include <string.h>		// memset() etc
  #include "image.hxx"
  #include <codegen.hxx>
@@ -49,10 +49,30 @@ diff -r 8f725fa6b136 basic/source/classes/image.cxx
  SbiImage::SbiImage()
  {
  	pStringOff = NULL;
-diff -r 8f725fa6b136 basic/source/comp/codegen.cxx
---- a/basic/source/comp/codegen.cxx	Tue Apr 20 13:21:03 2010 +0100
-+++ b/basic/source/comp/codegen.cxx	Fri Apr 23 16:35:00 2010 +0100
-@@ -324,7 +324,8 @@
+@@ -486,6 +527,19 @@
+ *    Accessing the image
+ *
+ **************************************************************************/
++short SbiImage::GetIDForString( const String& rName )
++{
++    short nRes = 0;
++    for ( short nId = 0; nId < nStrings; ++nId )
++    {
++        if ( rName == GetString( nId + 1 ) )
++        {
++            nRes = nId + 1;
++            break; 
++        }
++    }
++    return nRes;
++}
+ 
+ // Note: IDs start with 1
+ String SbiImage::GetString( short nId ) const
+diff -r a8d540977f0a basic/source/comp/codegen.cxx
+--- a/basic/source/comp/codegen.cxx	Wed Apr 28 15:31:22 2010 +0100
++++ b/basic/source/comp/codegen.cxx	Tue May 04 10:02:44 2010 +0100
+@@ -333,7 +333,8 @@
  	nCount = pParser->rEnumArray->Count();
  	for (i = 0; i < nCount; i++)
  		 p->AddEnum((SbxObject *)pParser->rEnumArray->Get(i));
@@ -62,10 +82,10 @@ diff -r 8f725fa6b136 basic/source/comp/codegen.cxx
  	if( !p->IsError() )
  		rMod.pImage = p;
  	else
-diff -r 8f725fa6b136 basic/source/comp/dim.cxx
---- a/basic/source/comp/dim.cxx	Tue Apr 20 13:21:03 2010 +0100
-+++ b/basic/source/comp/dim.cxx	Fri Apr 23 16:35:00 2010 +0100
-@@ -347,10 +347,14 @@
+diff -r a8d540977f0a basic/source/comp/dim.cxx
+--- a/basic/source/comp/dim.cxx	Wed Apr 28 15:31:22 2010 +0100
++++ b/basic/source/comp/dim.cxx	Tue May 04 10:02:44 2010 +0100
+@@ -352,10 +352,14 @@
  								nGblChain = 0;
  								bGblDefs = bNewGblDefs = TRUE;
  								break;
@@ -74,7 +94,7 @@ diff -r 8f725fa6b136 basic/source/comp/dim.cxx
 +                                        eOp2 = _LOCAL; 
  			}
 +		INT32 nId = pDef->GetId();
-+		if ( eOp2 == _LOCAL )
++		if ( eOp2 == _LOCAL && bVBASupportOn )
 +			nId = GetProcRefOffset( pProc, pDef->GetId() );
  			aGen.Gen(
 -                eOp2, pDef->GetId(),
@@ -82,10 +102,10 @@ diff -r 8f725fa6b136 basic/source/comp/dim.cxx
                  sal::static_int_cast< UINT16 >( pDef->GetType() ) );
  		}
  
-diff -r 8f725fa6b136 basic/source/comp/exprgen.cxx
---- a/basic/source/comp/exprgen.cxx	Tue Apr 20 13:21:03 2010 +0100
-+++ b/basic/source/comp/exprgen.cxx	Fri Apr 23 16:35:00 2010 +0100
-@@ -105,7 +105,9 @@
+diff -r a8d540977f0a basic/source/comp/exprgen.cxx
+--- a/basic/source/comp/exprgen.cxx	Wed Apr 28 15:31:22 2010 +0100
++++ b/basic/source/comp/exprgen.cxx	Tue May 04 10:02:44 2010 +0100
+@@ -108,7 +108,9 @@
  				 		bTreatFunctionAsParam = false;
  				}
  				if( !bTreatFunctionAsParam )
@@ -95,7 +115,7 @@ diff -r 8f725fa6b136 basic/source/comp/exprgen.cxx
  			}
          }
  		// AB: 17.12.1995, Spezialbehandlung fuer WITH
-@@ -123,10 +125,9 @@
+@@ -126,10 +128,9 @@
                  eOp = ( aVar.pDef->GetScope() == SbRTL ) ? _RTL : 
                      (aVar.pDef->IsGlobal() ? _FIND_G : _FIND);
  		}
@@ -107,37 +127,28 @@ diff -r 8f725fa6b136 basic/source/comp/exprgen.cxx
  			SbiProcDef* pProc = aVar.pDef->GetProcDef();
  			if ( pGen->GetParser()->bClassModule )
  				eOp = _FIND_CM;
-@@ -134,6 +135,10 @@
+@@ -137,6 +138,10 @@
  			{
  				eOp = _FIND_STATIC;
  			}
-+            if ( eOp == _FIND_STATIC || eOp == _FIND_CM || eOp == _FIND )
++            if ( pGen->GetParser()->IsVBASupportOn() && ( eOp == _FIND_STATIC || eOp == _FIND_CM || eOp == _FIND ) )
 +            {
 +                aVar.pDef->nLocalIndex = pGen->GetParser()->GetProcRefOffset( pGen->GetParser()->GetProc(), aVar.pDef->GetId() );
 +            }
  		}
  		for( SbiExprNode* p = this; p; p = p->aVar.pNext )
  		{
-@@ -168,7 +173,7 @@
- void SbiExprNode::GenElement( SbiOpcode eOp )
- {
- #ifdef DBG_UTIL
--	if( (eOp < _RTL || eOp > _CALLC) && eOp != _FIND_G && eOp != _FIND_CM )
-+	if( ( eOp < _RTL || eOp > _CALLC) && eOp != _FIND_G && eOp != _FIND_CM )
- 		pGen->GetParser()->Error( SbERR_INTERNAL_ERROR, "Opcode" );
- #endif
- 	SbiSymDef* pDef = aVar.pDef;
-@@ -176,6 +181,9 @@
+@@ -179,6 +184,9 @@
  	// Falls das Bit 0x8000 gesetzt ist, hat die Variable
  	// eine Parameterliste.
  	USHORT nId = ( eOp == _PARAM ) ? pDef->GetPos() : pDef->GetId();
-+        if ( eOp == _FIND_STATIC || eOp == _FIND_CM || eOp == _FIND )
++        if ( pGen->GetParser()->IsVBASupportOn() && ( eOp == _FIND_STATIC || eOp == _FIND_CM || eOp == _FIND ) )
 +            nId = aVar.pDef->nLocalIndex ;
 +
  	// Parameterliste aufbauen
  	if( aVar.pPar && aVar.pPar->GetSize() )
  	{
-@@ -194,7 +202,7 @@
+@@ -197,7 +205,7 @@
  		if( pProc->GetAlias().Len() )
  			nId = ( nId & 0x8000 ) | pGen->GetParser()->aGblStrings.Add( pProc->GetAlias() );
  	}
@@ -146,10 +157,10 @@ diff -r 8f725fa6b136 basic/source/comp/exprgen.cxx
  
  	if( aVar.pvMorePar )
  	{
-diff -r 8f725fa6b136 basic/source/comp/parser.cxx
---- a/basic/source/comp/parser.cxx	Tue Apr 20 13:21:03 2010 +0100
-+++ b/basic/source/comp/parser.cxx	Fri Apr 23 16:35:00 2010 +0100
-@@ -118,6 +118,27 @@
+diff -r a8d540977f0a basic/source/comp/parser.cxx
+--- a/basic/source/comp/parser.cxx	Wed Apr 28 15:31:22 2010 +0100
++++ b/basic/source/comp/parser.cxx	Tue May 04 10:02:44 2010 +0100
+@@ -123,6 +123,27 @@
  // 'this' : used in base member initializer list
  #pragma warning( disable: 4355 )
  #endif
@@ -177,10 +188,10 @@ diff -r 8f725fa6b136 basic/source/comp/parser.cxx
  
  SbiParser::SbiParser( StarBASIC* pb, SbModule* pm )
  		: SbiTokenizer( pm->GetSource32(), pb ),
-diff -r 8f725fa6b136 basic/source/comp/symtbl.cxx
---- a/basic/source/comp/symtbl.cxx	Tue Apr 20 13:21:03 2010 +0100
-+++ b/basic/source/comp/symtbl.cxx	Fri Apr 23 16:35:00 2010 +0100
-@@ -306,6 +306,7 @@
+diff -r a8d540977f0a basic/source/comp/symtbl.cxx
+--- a/basic/source/comp/symtbl.cxx	Wed Apr 28 15:31:22 2010 +0100
++++ b/basic/source/comp/symtbl.cxx	Tue May 04 10:02:44 2010 +0100
+@@ -309,6 +309,7 @@
  	pIn		 =
  	pPool	 = NULL;
  	nDefaultId = 0;
@@ -188,7 +199,7 @@ diff -r 8f725fa6b136 basic/source/comp/symtbl.cxx
  }
  
  SbiSymDef::~SbiSymDef()
-@@ -410,7 +411,7 @@
+@@ -413,7 +414,7 @@
  		 : SbiSymDef( rName )
  		 , aParams( pParser->aGblStrings, SbPARAM )  // wird gedumpt
  		 , aLabels( pParser->aLclStrings, SbLOCAL )	 // wird nicht gedumpt
@@ -197,10 +208,10 @@ diff -r 8f725fa6b136 basic/source/comp/symtbl.cxx
  {
  	aParams.SetParent( &pParser->aPublics );
  	pPool = new SbiSymPool( pParser->aGblStrings, SbLOCAL ); // Locals
-diff -r 8f725fa6b136 basic/source/inc/image.hxx
---- a/basic/source/inc/image.hxx	Tue Apr 20 13:21:03 2010 +0100
-+++ b/basic/source/inc/image.hxx	Fri Apr 23 16:35:00 2010 +0100
-@@ -33,11 +33,31 @@
+diff -r a8d540977f0a basic/source/inc/image.hxx
+--- a/basic/source/inc/image.hxx	Wed Apr 28 15:31:22 2010 +0100
++++ b/basic/source/inc/image.hxx	Tue May 04 10:02:44 2010 +0100
+@@ -36,11 +36,32 @@
  #include <rtl/ustring.hxx>
  #endif
  #include <filefmt.hxx>
@@ -224,6 +235,7 @@ diff -r 8f725fa6b136 basic/source/inc/image.hxx
 +    ProcRefHandler( const String& procName );
 +    UINT32 getProcRefOffset( UINT32 nOp );
 +    UINT32 getIdForProcRefOffset( UINT32 nOffset );
++    bool hasProcRefOffset( UINT32 nOp ) { return mOpToOffsetMap.find( nOp ) !=  mOpToOffsetMap.end(); }
 +    String getName(){ return m_sName; }
 +    INT32  getMaxOffset() { return  m_nOffsetGen; }
 +};
@@ -232,21 +244,22 @@ diff -r 8f725fa6b136 basic/source/inc/image.hxx
  
  class SbiImage {
  	friend class SbiCodeGen;			// Compiler-Klassen, die die private-
-@@ -66,7 +86,10 @@
+@@ -69,7 +90,11 @@
  	void AddType(SbxObject *);      // User-Type mit aufnehmen
  	void AddEnum(SbxObject *);      // Register enum type
  
 +        vProcRefHandlers m_vPropRefHandlers;
  public:
++	short GetIDForString( const String& rName );
 +        void SetProcRefs( const vProcRefHandlers& rHandlers ) { m_vPropRefHandlers =  rHandlers; }
 +        ProcRefHandler* GetProcRef( const String& rProcName );
  	String aName;					// Makroname
      ::rtl::OUString aOUSource;		// Quellcode
  	String aComment;				// Kommentar
-diff -r 8f725fa6b136 basic/source/inc/parser.hxx
---- a/basic/source/inc/parser.hxx	Tue Apr 20 13:21:03 2010 +0100
-+++ b/basic/source/inc/parser.hxx	Fri Apr 23 16:35:00 2010 +0100
-@@ -34,14 +34,15 @@
+diff -r a8d540977f0a basic/source/inc/parser.hxx
+--- a/basic/source/inc/parser.hxx	Wed Apr 28 15:31:22 2010 +0100
++++ b/basic/source/inc/parser.hxx	Tue May 04 10:02:44 2010 +0100
+@@ -37,14 +37,15 @@
  
  
  #include <vector>
@@ -264,7 +277,7 @@ diff -r 8f725fa6b136 basic/source/inc/parser.hxx
  	SbiParseStack* pStack;   		// Block-Stack
  	SbiProcDef* pProc;				// aktuelle Prozedur
  	SbiExprNode*  pWithVar;			// aktuelle With-Variable
-@@ -66,6 +67,9 @@
+@@ -69,6 +70,9 @@
  	void DefDeclare( BOOL bPrivate );
  	void EnableCompatibility();	
  public:
@@ -274,10 +287,10 @@ diff -r 8f725fa6b136 basic/source/inc/parser.hxx
  	SbxArrayRef	  rTypeArray;		// das Type-Array
  	SbxArrayRef	  rEnumArray;		// Enum types
  	SbiStringPool aGblStrings;		// der String-Pool
-diff -r 8f725fa6b136 basic/source/inc/runtime.hxx
---- a/basic/source/inc/runtime.hxx	Tue Apr 20 13:21:03 2010 +0100
-+++ b/basic/source/inc/runtime.hxx	Fri Apr 23 16:35:00 2010 +0100
-@@ -306,6 +306,7 @@
+diff -r a8d540977f0a basic/source/inc/runtime.hxx
+--- a/basic/source/inc/runtime.hxx	Wed Apr 28 15:31:22 2010 +0100
++++ b/basic/source/inc/runtime.hxx	Tue May 04 10:02:44 2010 +0100
+@@ -310,6 +310,7 @@
  	String		  aLibName;			// Lib-Name fuer Declare-Call
  	SbxArrayRef   refParams;        // aktuelle Prozedur-Parameter
  	SbxArrayRef   refLocals;        // lokale Variable
@@ -285,18 +298,10 @@ diff -r 8f725fa6b136 basic/source/inc/runtime.hxx
  	SbxArrayRef   refArgv;          // aktueller Argv
  	// AB, 28.3.2000 #74254, Ein refSaveObj reicht nicht! Neu: pRefSaveList (s.u.)
  	//SbxVariableRef refSaveObj;      // #56368 Bei StepElem Referenz sichern
-@@ -432,6 +433,7 @@
- 	void StepDCREATE_REDIMP(UINT32,UINT32), StepDCREATE_IMPL(UINT32,UINT32);
- 	void StepFIND_CM( UINT32, UINT32 );
- 	void StepFIND_STATIC( UINT32, UINT32 );
-+    void StepFINDLOCAL( UINT32, UINT32 );
- public:
- 	void          SetVBAEnabled( bool bEnabled ) { bVBAEnabled = bEnabled; };
- 	USHORT		GetImageFlag( USHORT n ) const;
-diff -r 8f725fa6b136 basic/source/inc/symtbl.hxx
---- a/basic/source/inc/symtbl.hxx	Tue Apr 20 13:21:03 2010 +0100
-+++ b/basic/source/inc/symtbl.hxx	Fri Apr 23 16:35:00 2010 +0100
-@@ -134,6 +134,7 @@
+diff -r a8d540977f0a basic/source/inc/symtbl.hxx
+--- a/basic/source/inc/symtbl.hxx	Wed Apr 28 15:31:22 2010 +0100
++++ b/basic/source/inc/symtbl.hxx	Tue May 04 10:02:44 2010 +0100
+@@ -137,6 +137,7 @@
  	BOOL	   bParamArray : 1;		// TRUE: ParamArray parameter
  	USHORT	   nDefaultId;			// Symbol number of default value
  public:
@@ -304,18 +309,169 @@ diff -r 8f725fa6b136 basic/source/inc/symtbl.hxx
  	SbiSymDef( const String& );
  	virtual ~SbiSymDef();
  	virtual SbiProcDef* GetProcDef();
-diff -r 8f725fa6b136 basic/source/runtime/runtime.cxx
---- a/basic/source/runtime/runtime.cxx	Tue Apr 20 13:21:03 2010 +0100
-+++ b/basic/source/runtime/runtime.cxx	Fri Apr 23 16:35:00 2010 +0100
-@@ -529,6 +529,7 @@
+diff -r a8d540977f0a basic/source/runtime/runtime.cxx
+--- a/basic/source/runtime/runtime.cxx	Wed Apr 28 15:31:22 2010 +0100
++++ b/basic/source/runtime/runtime.cxx	Tue May 04 10:02:44 2010 +0100
+@@ -93,6 +93,150 @@
+ 	short nArgc;						// Argc
+ };
+ 
++char* aStep0Char[] = {
++"SbiRuntime::StepNOP",
++"SbiRuntime::StepEXP",
++"SbiRuntime::StepMUL",
++"SbiRuntime::StepDIV",
++"SbiRuntime::StepMOD",
++"SbiRuntime::StepPLUS",
++"SbiRuntime::StepMINUS",
++"SbiRuntime::StepNEG",
++"SbiRuntime::StepEQ",
++"SbiRuntime::StepNE",
++"SbiRuntime::StepLT",
++"SbiRuntime::StepGT",
++"SbiRuntime::StepLE",
++"SbiRuntime::StepGE",
++"SbiRuntime::StepIDIV",
++"SbiRuntime::StepAND",
++"SbiRuntime::StepOR",
++"SbiRuntime::StepXOR",
++"SbiRuntime::StepEQV",
++"SbiRuntime::StepIMP",
++"SbiRuntime::StepNOT",
++"SbiRuntime::StepCAT",
++"SbiRuntime::StepLIKE",
++"SbiRuntime::StepIS",
++"SbiRuntime::StepARGC",
++"SbiRuntime::StepARGV",
++"SbiRuntime::StepINPUT",
++"SbiRuntime::StepLINPUT",
++"SbiRuntime::StepGET",
++"SbiRuntime::StepSET",
++"SbiRuntime::StepPUT",
++"SbiRuntime::StepPUTC",
++"SbiRuntime::StepDIM",
++"SbiRuntime::StepREDIM",
++"SbiRuntime::StepREDIMP",
++"SbiRuntime::StepERASE",
++"SbiRuntime::StepSTOP",
++"SbiRuntime::StepINITFOR",
++"SbiRuntime::StepNEXT",
++"SbiRuntime::StepCASE",
++"SbiRuntime::StepENDCASE",
++"SbiRuntime::StepSTDERROR",
++"SbiRuntime::StepNOERROR",
++"SbiRuntime::StepLEAVE",
++"SbiRuntime::StepCHANNEL",
++"SbiRuntime::StepPRINT",
++"SbiRuntime::StepPRINTF",
++"SbiRuntime::StepWRITE",
++"SbiRuntime::StepRENAME",
++"SbiRuntime::StepPROMPT",
++"SbiRuntime::StepRESTART",
++"SbiRuntime::StepCHANNEL0",
++"SbiRuntime::StepEMPTY",
++"SbiRuntime::StepERROR",
++"SbiRuntime::StepLSET",
++"SbiRuntime::StepRSET",
++"SbiRuntime::StepREDIMP_ERASE",
++"SbiRuntime::StepINITFOREACH",
++"SbiRuntime::SetVBASET",
++"SbiRuntime::SetERASE_CLEAR",
++}; 
++
++char* aStep1Char[] = {	
++"SbiRuntime::StepLOADNC",
++"SbiRuntime::StepLOADSC",
++"SbiRuntime::StepLOADI",
++"SbiRuntime::StepARGN",
++"SbiRuntime::StepPAD",
++"SbiRuntime::StepJUMP",
++"SbiRuntime::StepJUMPT",
++"SbiRuntime::StepJUMPF",
++"SbiRuntime::StepONJUMP",
++"SbiRuntime::StepGOSUB",
++"SbiRuntime::StepRETURN",
++"SbiRuntime::StepTESTFOR",
++"SbiRuntime::StepCASETO",
++"SbiRuntime::StepERRHDL",
++"SbiRuntime::StepRESUME",
++"SbiRuntime::StepCLOSE",
++"SbiRuntime::StepPRCHAR",
++"SbiRuntime::StepSETCLASS",
++"SbiRuntime::StepTESTCLASS",
++"SbiRuntime::StepLIB",
++"SbiRuntime::StepBASED",
++"SbiRuntime::StepARGTYP",
++};
++char* aStep2Char[] = {
++"SbiRuntime::StepRTL",
++"SbiRuntime::StepFIND",
++"SbiRuntime::StepELEM",
++"SbiRuntime::StepPARAM",
++"SbiRuntime::StepCALL",
++"SbiRuntime::StepCALLC",
++"SbiRuntime::StepCASEIS",
++"SbiRuntime::StepSTMNT",
++"SbiRuntime::StepOPEN",
++"SbiRuntime::StepLOCAL",
++"SbiRuntime::StepPUBLIC",
++"SbiRuntime::StepGLOBAL",
++"SbiRuntime::StepCREATE",
++"SbiRuntime::StepSTATIC",
++"SbiRuntime::StepTCREATE",
++"SbiRuntime::StepDCREATE",
++"SbiRuntime::StepGLOBAL_P",
++"SbiRuntime::StepFIND_G",
++"SbiRuntime::StepDCREATE_REDIMP",
++"SbiRuntime::StepFIND_CM",
++"SbiRuntime::StepPUBLIC_P",
++"SbiRuntime::StepFIND_STATIC"
++};
++void SbiRuntime::DumpPCode()
++{
++	int numBytes = pImg->GetCodeSize();
++	USHORT nOp1, nOp2;
++	int i=0;
++	BYTE* pCodeCopy = (BYTE*)pCode;
++	for ( ; i< numBytes; i++ )
++	{
++		SbiOpcode eOp = (SbiOpcode ) ( *pCodeCopy++ );
++		if( eOp <= SbOP0_END )
++		{
++			OSL_TRACE("Runtime::DumpPCode() aStep0[ %d ] %s",
++				eOp, aStep0Char[ eOp ] );
++		}
++		else if( eOp >= SbOP1_START && eOp <= SbOP1_END )
++		{
++			nOp1 = *pCodeCopy++; nOp1 |= *pCodeCopy++ << 8; nOp1 |= *pCodeCopy++ << 16; nOp1 |= *pCodeCopy++ << 24;
++			i+=2;
++			OSL_TRACE("Runtime::DumpDumpPCode aStep1[ %d ] %s (%d)",
++				eOp, aStep1Char[ eOp - SbOP1_START ], nOp1 );
++		}
++		else if( eOp >= SbOP2_START && eOp <= SbOP2_END )
++		{
++			nOp1 = *pCodeCopy++; nOp1 |= *pCodeCopy++ << 8; nOp1 |= *pCodeCopy++ << 16; nOp1 |= *pCodeCopy++ << 24;
++			nOp2 = *pCodeCopy++; nOp2 |= *pCodeCopy++ << 8; nOp2 |= *pCodeCopy++ << 16; nOp2 |= *pCodeCopy++ << 24;
++			i+=8;
++			OSL_TRACE("Runtime::DumpPCode() aStep2[ %d ] %s (%d, %d)",
++				eOp, aStep2Char[ eOp - SbOP2_START ], nOp1, nOp2 );
++		}
++		
++	}
++	OSL_TRACE("Count = %d, reported size is %d",i,  numBytes);
++}
+ SbiRuntime::pStep0 SbiRuntime::aStep0[] = {	// Alle Opcodes ohne Operanden
+ 	&SbiRuntime::StepNOP,
+ 	&SbiRuntime::StepEXP,
+@@ -553,6 +697,7 @@
+ #endif
  	pRefSaveList = NULL;
  	pItemStoreList = NULL;
- 	bVBAEnabled = isVBAEnabled();
-+	refLocalDefines = NULL;
++        refLocalDefines = NULL;
  }
  
  SbiRuntime::~SbiRuntime()
-@@ -544,6 +545,18 @@
+@@ -568,6 +713,18 @@
  		RefSaveItem* pToDeleteItem = pItemStoreList;
  		pItemStoreList = pToDeleteItem->pNext;
  		delete pToDeleteItem;
@@ -334,10 +490,35 @@ diff -r 8f725fa6b136 basic/source/runtime/runtime.cxx
  	}
  }
  
-diff -r 8f725fa6b136 basic/source/runtime/step2.cxx
---- a/basic/source/runtime/step2.cxx	Tue Apr 20 13:21:03 2010 +0100
-+++ b/basic/source/runtime/step2.cxx	Fri Apr 23 16:35:00 2010 +0100
-@@ -52,6 +52,17 @@
+@@ -705,18 +862,23 @@
+ 		UINT32 nOp1, nOp2;
+ 		if( eOp <= SbOP0_END )
+ 		{
++			OSL_TRACE("Runtime::Step() calling aStep0[ %d ] %s",
++				eOp, aStep0Char[ eOp ] );
+ 			(this->*( aStep0[ eOp ] ) )();
+ 		}
+ 		else if( eOp >= SbOP1_START && eOp <= SbOP1_END )
+ 		{
+ 			nOp1 = *pCode++; nOp1 |= *pCode++ << 8; nOp1 |= *pCode++ << 16; nOp1 |= *pCode++ << 24;
+-			
++			OSL_TRACE("Runtime::Step() calling aStep1[ %d ] %s (%d)",
++				eOp, aStep1Char[ eOp - SbOP1_START ], nOp1 );			
+ 			(this->*( aStep1[ eOp - SbOP1_START ] ) )( nOp1 );
+ 		}
+ 		else if( eOp >= SbOP2_START && eOp <= SbOP2_END )
+ 		{
+ 			nOp1 = *pCode++; nOp1 |= *pCode++ << 8; nOp1 |= *pCode++ << 16; nOp1 |= *pCode++ << 24;
+ 			nOp2 = *pCode++; nOp2 |= *pCode++ << 8; nOp2 |= *pCode++ << 16; nOp2 |= *pCode++ << 24;
++			OSL_TRACE("Runtime::Step() calling aStep2[ %d ] %s (%d, %d)",
++				eOp, aStep2Char[ eOp - SbOP2_START ], nOp1, nOp2 );
+ 			(this->*( aStep2[ eOp - SbOP2_START ] ) )( nOp1, nOp2 );
+ 		}
+ 		else
+diff -r a8d540977f0a basic/source/runtime/step2.cxx
+--- a/basic/source/runtime/step2.cxx	Wed Apr 28 15:31:22 2010 +0100
++++ b/basic/source/runtime/step2.cxx	Tue May 04 10:02:44 2010 +0100
+@@ -55,6 +55,17 @@
  using com::sun::star::uno::Reference;
  
  SbxVariable* getVBAConstant( const String& rName );
@@ -355,7 +536,7 @@ diff -r 8f725fa6b136 basic/source/runtime/step2.cxx
  
  // Suchen eines Elements
  // Die Bits im String-ID:
-@@ -60,14 +71,8 @@
+@@ -63,14 +74,8 @@
  SbxVariable* SbiRuntime::FindElement
  	( SbxObject* pObj, UINT32 nOp1, UINT32 nOp2, SbError nNotFound, BOOL bLocal, BOOL bStatic )
  {
@@ -372,7 +553,7 @@ diff -r 8f725fa6b136 basic/source/runtime/step2.cxx
  	SbxVariable* pElem = NULL;
  	if( !pObj )
  	{
-@@ -78,36 +83,64 @@
+@@ -81,36 +86,66 @@
  	{
  		BOOL bFatalError = FALSE;
  		SbxDataType t = (SbxDataType) nOp2;
@@ -398,24 +579,21 @@ diff -r 8f725fa6b136 basic/source/runtime/step2.cxx
  		if( bLocal )
  		{
 -			if ( bStatic )
-+			if ( bStatic && pMeth )
- 			{	
+-			{	
 -				if ( pMeth )
--					pElem = pMeth->GetStatics()->Find( aName, SbxCLASS_DONTCARE );
-+				aName = pImg->GetString( static_cast<short>( nOp1 & 0x7FFF ) );
-+				pElem = pMeth->GetStatics()->Find( aName, SbxCLASS_DONTCARE );
- 			}
- 
- 			if ( !pElem )
--				pElem = refLocals->Find( aName, SbxCLASS_DONTCARE );
++
++			SbxVariableRef* pRef = NULL;
++                        if ( bVBAEnabled )
++                        {
++                            pRef = (*refLocalDefines)[ nOp1 & 0x7FFF ];
++			    if ( pRef )
++                                pElem = *pRef;
++                        }
++                        if ( !pElem ) // not locally defined
 +			{
-+				SbxVariableRef* pRef = (*refLocalDefines)[ nOp1 & 0x7FFF ];
-+				if ( pRef )
-+					pElem = *pRef;
-+                                if ( !pElem ) // not locally defined
++				if ( bVBAEnabled )
 +				{
-+					OSL_TRACE("here");
-+					pHandler = pMod->pImage->GetProcRef( pMeth ? pMeth->GetName() : String() );
++				        pHandler = pMod->pImage->GetProcRef( pMeth ? pMeth->GetName() : String() );
 +					if ( pHandler )
 +					{
 +						bool bHasParams = false;
@@ -426,19 +604,25 @@ diff -r 8f725fa6b136 basic/source/runtime/step2.cxx
 +							nOp1 = nOp1 | 0x8000;
 +					}
 +				}
-+			}
- 		}
-+
++				aName = pImg->GetString( static_cast<short>( nOp1 & 0x7FFF ) );
++				if ( bStatic && pMeth )
+ 					pElem = pMeth->GetStatics()->Find( aName, SbxCLASS_DONTCARE );
+ 			}
++		}
+ 
+-			if ( !pElem )
+-				pElem = refLocals->Find( aName, SbxCLASS_DONTCARE );
 +		if( bVBAEnabled )
 +		{
 +			StarBASIC* pMSOMacroRuntimeLib = GetSbData()->pMSOMacroRuntimLib;
 +			if( pMSOMacroRuntimeLib != NULL )
 +				pMSOMacroRuntimeLib->ResetFlag( SBX_EXTSEARCH );
-+		}
+ 		}
 +
  		if( !pElem )
  		{
-+			aName = pImg->GetString( static_cast<short>( nOp1 & 0x7FFF ) );
++			if ( aName.Len() == 0 ) 
++				aName = pImg->GetString( static_cast<short>( nOp1 & 0x7FFF ) );
 +			// Hacky capture of Evaluate [] syntax
 +			// this should be tackled I feel at the pcode level
 +			if ( bVBAEnabled && aName.Len() && aName.GetBuffer()[0] == '[') 
@@ -458,7 +642,7 @@ diff -r 8f725fa6b136 basic/source/runtime/step2.cxx
  			// Die RTL brauchen wir nicht mehr zu durchsuchen!
  			BOOL bSave = rBasic.bNoRtl;
  			rBasic.bNoRtl = TRUE;
-@@ -168,7 +201,10 @@
+@@ -171,7 +206,10 @@
  					// deklarierten Vars automatisch global !
  					if ( bSetName )
  						pElem->SetName( aName );
@@ -470,7 +654,7 @@ diff -r 8f725fa6b136 basic/source/runtime/step2.cxx
  				}
  			}
  
-@@ -214,7 +250,10 @@
+@@ -217,7 +255,10 @@
  						if( t != SbxVARIANT )
  							pElem->SetFlag( SBX_FIXED );
  						pElem->SetName( aName );
@@ -482,19 +666,54 @@ diff -r 8f725fa6b136 basic/source/runtime/step2.cxx
  					}
  				}
  			}
-@@ -603,8 +642,11 @@
+@@ -294,7 +335,21 @@
+ 		return NULL;
+ 
+ 	// Lokal suchen
+-	if( refLocals )
++	if ( bVBAEnabled && refLocalDefines )
++	{
++		INT32 nOp1 = pMod->pImage->GetIDForString( rName );
++		ProcRefHandler* pHandler = pMod->pImage->GetProcRef( pMeth ? pMeth->GetName() : String() );
++		if ( pHandler )
++		{
++			if ( pHandler->hasProcRefOffset( nOp1 ) )
++			{
++				SbxVariableRef* pRef = (*refLocalDefines)[ pHandler->getProcRefOffset( nOp1 ) ];
++				if ( pRef )	
++					pElem = *pRef;
++			}
++		}
++	}
++	else if( refLocals )
+ 		pElem = refLocals->Find( rName, SbxCLASS_DONTCARE );
+ 
+ 	// In Statics suchen
+@@ -304,7 +359,10 @@
+ 		String aMethName = pMeth->GetName();
+ 		aMethName += ':';
+ 		aMethName += rName;
+-		pElem = pMod->Find(aMethName, SbxCLASS_DONTCARE);
++		if ( !pElem )
++			pElem = pMeth->GetStatics()->Find( aMethName, SbxCLASS_DONTCARE );
++		if ( !pElem )
++			pElem = pMod->Find(aMethName, SbxCLASS_DONTCARE);
+ 	}
+ 
+ 	// In Parameter-Liste suchen
+@@ -608,8 +666,11 @@
  void
  SbiRuntime::StepFIND_Impl( SbxObject* pObj, UINT32 nOp1, UINT32 nOp2, SbError nNotFound, BOOL bLocal, BOOL bStatic )
  {
 +
  	if( !refLocals )
  		refLocals = new SbxArray;
-+	if( !refLocalDefines )
++	if( bVBAEnabled && !refLocalDefines )
 +		initRefDefines( pMod->pImage, pMeth, refLocalDefines );
  	PushVar( FindElement( pObj, nOp1, nOp2, nNotFound, bLocal, bStatic ) );
  }
  // Laden einer lokalen/globalen Variablen (+StringID+Typ)
-@@ -1076,15 +1118,29 @@
+@@ -1083,15 +1144,38 @@
  
  void SbiRuntime::StepLOCAL( UINT32 nOp1, UINT32 nOp2 )
  {
@@ -513,8 +732,17 @@ diff -r 8f725fa6b136 basic/source/runtime/step2.cxx
 -		p->SetName( aName );
 -		refLocals->Put( p, refLocals->Count() );
 +                (*refLocalDefines)[ nOp1 ] = new SbxVariableRef( new SbxVariable( t ) );
++		ProcRefHandler* pHandler = pMod->pImage->GetProcRef( pMeth ? pMeth->GetName() : String() );
++#if 0 // do we need to set the name ?
++		if ( pHandler )
++		{
++			UINT32 nTmpOp1 = pHandler->getIdForProcRefOffset( nOp1 & 0x7FFF );
++			String aName = pImg->GetString( static_cast<short>( nTmpOp1 ) );
++			SbxVariable* pElem = *(*refLocalDefines)[ nOp1 ];
++			pElem->SetName( aName );
++		}
++#endif
 +		//p->SetName( aName );
-+		return;
 +	}
 +        else
 +        {
diff --git a/scratch/sc-vba/testvba/TestDocuments/MiscOnErrorTests.xls b/scratch/sc-vba/testvba/TestDocuments/MiscOnErrorTests.xls
index d795f98..e51539b 100644
Binary files a/scratch/sc-vba/testvba/TestDocuments/MiscOnErrorTests.xls and b/scratch/sc-vba/testvba/TestDocuments/MiscOnErrorTests.xls differ


More information about the ooo-build-commit mailing list