summaryrefslogtreecommitdiff
path: root/basic
diff options
context:
space:
mode:
authorMathias Bauer <mba@openoffice.org>2009-09-25 21:47:16 +0200
committerMathias Bauer <mba@openoffice.org>2009-09-25 21:47:16 +0200
commit0a266bd33b8786869cdeab8325f8f1b1900533ad (patch)
tree137ba378aaae9e8f0765fabbbf5035131f250781 /basic
parent6a1e797fa4b432841708545272e13e8f6ab4bd39 (diff)
parentab33e14647ada2a32624fa39ec0ddbbbdc694df5 (diff)
merge commit
Diffstat (limited to 'basic')
-rw-r--r--basic/prj/build.lst2
-rw-r--r--basic/source/classes/sb.cxx27
-rw-r--r--basic/source/classes/sbunoobj.cxx6
-rw-r--r--basic/source/comp/dim.cxx63
-rw-r--r--basic/source/inc/expr.hxx1
-rw-r--r--basic/source/inc/parser.hxx1
-rw-r--r--basic/source/runtime/methods1.cxx7
-rw-r--r--basic/source/sbx/sbxvalue.cxx2
8 files changed, 95 insertions, 14 deletions
diff --git a/basic/prj/build.lst b/basic/prj/build.lst
index ec6bd0e83930..994901580c86 100644
--- a/basic/prj/build.lst
+++ b/basic/prj/build.lst
@@ -1,4 +1,4 @@
-sb basic : l10n offuh svtools sj2 xmlscript framework NULL
+sb basic : l10n offuh svtools xmlscript framework NULL
sb basic usr1 - all sb_mkout NULL
sb basic\inc nmake - all sb_inc NULL
sb basic\source\app nmake - all sb_app sb_class sb_inc NULL
diff --git a/basic/source/classes/sb.cxx b/basic/source/classes/sb.cxx
index 7ff7cb76c7c5..af056b884826 100644
--- a/basic/source/classes/sb.cxx
+++ b/basic/source/classes/sb.cxx
@@ -303,6 +303,33 @@ SbxObject* SbTypeFactory::cloneTypeObjectImpl( const SbxObject& rTypeObj )
if( pProp )
{
SbxProperty* pNewProp = new SbxProperty( *pProp );
+ if( pVar->GetType() & SbxARRAY )
+ {
+ SbxBase* pParObj = pVar->GetObject();
+ SbxDimArray* pSource = PTR_CAST(SbxDimArray,pParObj);
+ SbxDimArray* pDest = new SbxDimArray( pVar->GetType() );
+ INT32 lb = 0;
+ INT32 ub = 0;
+
+ pDest->setHasFixedSize( pSource->hasFixedSize() );
+ if ( pSource->GetDims() && pSource->hasFixedSize() )
+ {
+ for ( INT32 j = 1 ; j <= pSource->GetDims(); ++j )
+ {
+ pSource->GetDim32( (INT32)j, lb, ub );
+ pDest->AddDim32( lb, ub );
+ }
+ }
+ else
+ pDest->unoAddDim( 0, -1 ); // variant array
+
+ USHORT nSavFlags = pVar->GetFlags();
+ pNewProp->ResetFlag( SBX_FIXED );
+ // need to reset the FIXED flag
+ // when calling PutObject ( because the type will not match Object )
+ pNewProp->PutObject( pDest );
+ pNewProp->SetFlags( nSavFlags );
+ }
pProps->PutDirect( pNewProp, i );
}
}
diff --git a/basic/source/classes/sbunoobj.cxx b/basic/source/classes/sbunoobj.cxx
index a1bdb687b002..a6ae8cac29af 100644
--- a/basic/source/classes/sbunoobj.cxx
+++ b/basic/source/classes/sbunoobj.cxx
@@ -750,7 +750,11 @@ void unoToSbxValue( SbxVariable* pVar, const Any& aValue )
// SbUnoObject instanzieren
String aName;
SbUnoObject* pSbUnoObject = new SbUnoObject( aName, aValue );
- if ( SbiRuntime::isVBAEnabled() )
+ //If this is called externally e.g. from the scripting
+ //framework then there is no 'active' runtime the default property will not be set up
+ //only a vba object will have XDefaultProp set anyway so... this
+ //test seems a bit of overkill
+ //if ( SbiRuntime::isVBAEnabled() )
{
String sDfltPropName;
diff --git a/basic/source/comp/dim.cxx b/basic/source/comp/dim.cxx
index d242071784b6..54e98f401594 100644
--- a/basic/source/comp/dim.cxx
+++ b/basic/source/comp/dim.cxx
@@ -212,7 +212,7 @@ void SbiParser::DefVar( SbiOpcode eOp, BOOL bStatic )
// #110004 It can also be a sub/function
if( !bConst && (eCurTok == SUB || eCurTok == FUNCTION || eCurTok == PROPERTY ||
- eCurTok == STATIC || eCurTok == ENUM ) )
+ eCurTok == STATIC || eCurTok == ENUM || eCurTok == DECLARE) )
{
// Next token is read here, because !bConst
bool bPrivate = ( eFirstTok == PRIVATE );
@@ -241,6 +241,12 @@ void SbiParser::DefVar( SbiOpcode eOp, BOOL bStatic )
DefEnum( bPrivate );
return;
}
+ else if( eCurTok == DECLARE )
+ {
+ Next();
+ DefDeclare( bPrivate );
+ return;
+ }
}
#ifdef SHARED
@@ -546,7 +552,7 @@ void SbiParser::DefType( BOOL bPrivate )
SbxObject *pType = new SbxObject(aSym);
SbiSymDef* pElem;
- SbiDimList* pDim;
+ SbiDimList* pDim = NULL;
BOOL bDone = FALSE;
while( !bDone && !IsEof() )
@@ -570,13 +576,6 @@ void SbiParser::DefType( BOOL bPrivate )
pElem = VarDecl(&pDim,FALSE,FALSE);
if( !pElem )
bDone = TRUE; // Error occured
- if( pDim )
- {
- // HOT FIX, to be updated
- delete pDim;
- Error( SbERR_NO_STRINGS_ARRAYS );
- }
-
}
if( pElem )
{
@@ -586,6 +585,43 @@ void SbiParser::DefType( BOOL bPrivate )
else
{
SbxProperty *pTypeElem = new SbxProperty (pElem->GetName(),pElem->GetType());
+ if( pDim )
+ {
+ SbxDimArray* pArray = new SbxDimArray( pElem->GetType() );
+ if ( pDim->GetSize() )
+ {
+ // Dimension the target array
+
+ for ( short i=0; i<pDim->GetSize();++i )
+ {
+ INT32 ub = -1;
+ INT32 lb = nBase;
+ SbiExprNode* pNode = pDim->Get(i)->GetExprNode();
+ ub = pNode->GetNumber();
+ if ( !pDim->Get( i )->IsBased() ) // each dim is low/up
+ {
+ if ( ++i >= pDim->GetSize() ) // trouble
+ StarBASIC::FatalError( SbERR_INTERNAL_ERROR );
+ pNode = pDim->Get(i)->GetExprNode();
+ lb = ub;
+ ub = pNode->GetNumber();
+ }
+ else if ( !bCompatible )
+ ub += nBase;
+ pArray->AddDim32( lb, ub );
+ }
+ pArray->setHasFixedSize( true );
+ }
+ else
+ pArray->unoAddDim( 0, -1 ); // variant array
+ USHORT nSavFlags = pTypeElem->GetFlags();
+ // need to reset the FIXED flag
+ // when calling PutObject ( because the type will not match Object )
+ pTypeElem->ResetFlag( SBX_FIXED );
+ pTypeElem->PutObject( pArray );
+ pTypeElem->SetFlags( nSavFlags );
+ }
+ delete pDim;
pTypeMembers->Insert( pTypeElem, pTypeMembers->Count() );
}
delete pElem;
@@ -872,6 +908,11 @@ SbiProcDef* SbiParser::ProcDecl( BOOL bDecl )
void SbiParser::Declare()
{
+ DefDeclare( FALSE );
+}
+
+void SbiParser::DefDeclare( BOOL bPrivate )
+{
Next();
if( eCurTok != SUB && eCurTok != FUNCTION )
Error( SbERR_UNEXPECTED, eCurTok );
@@ -892,12 +933,16 @@ void SbiParser::Declare()
// Als Variable deklariert
Error( SbERR_BAD_DECLARATION, pDef->GetName() );
delete pDef;
+ pDef = NULL;
}
else
pDef->Match( p );
}
else
aPublics.Add( pDef );
+
+ if ( pDef )
+ pDef->SetPublic( !bPrivate );
}
}
}
diff --git a/basic/source/inc/expr.hxx b/basic/source/inc/expr.hxx
index 319af5cbfbc5..b66006cb639a 100644
--- a/basic/source/inc/expr.hxx
+++ b/basic/source/inc/expr.hxx
@@ -144,6 +144,7 @@ public:
SbiExprNode* GetRealNode(); // letzter Knoten in x.y.z
short GetDepth(); // Tiefe eines Baumes berechnen
const String& GetString() { return aStrVal; }
+ short GetNumber() { return (short)nVal; }
SbiExprList* GetParameters() { return aVar.pPar; }
SbiExprListVector* GetMoreParameters() { return aVar.pvMorePar; }
diff --git a/basic/source/inc/parser.hxx b/basic/source/inc/parser.hxx
index 5f2ef47080c3..379ae962834b 100644
--- a/basic/source/inc/parser.hxx
+++ b/basic/source/inc/parser.hxx
@@ -66,6 +66,7 @@ class SbiParser : public SbiTokenizer
void StmntBlock( SbiToken ); // Statement-Block abarbeiten
void DefType( BOOL bPrivate ); // Parse type declaration
void DefEnum( BOOL bPrivate ); // Parse enum declaration
+ void DefDeclare( BOOL bPrivate );
void EnableCompatibility();
public:
SbxArrayRef rTypeArray; // das Type-Array
diff --git a/basic/source/runtime/methods1.cxx b/basic/source/runtime/methods1.cxx
index 2c9c22f7f44a..dbd66a61575c 100644
--- a/basic/source/runtime/methods1.cxx
+++ b/basic/source/runtime/methods1.cxx
@@ -662,12 +662,15 @@ RTLFUNC(Array)
}
// Parameter ins Array uebernehmen
- for( short i = 0 ; i < nArraySize ; i++ )
+ // ATTENTION: Using type USHORT for loop variable is
+ // mandatory to workaround a problem with the
+ // Solaris Intel compiler optimizer! See i104354
+ for( USHORT i = 0 ; i < nArraySize ; i++ )
{
SbxVariable* pVar = rPar.Get(i+1);
SbxVariable* pNew = new SbxVariable( *pVar );
pNew->SetFlag( SBX_WRITE );
- short index = i;
+ short index = static_cast< short >(i);
if ( bIncIndex )
++index;
pArray->Put( pNew, &index );
diff --git a/basic/source/sbx/sbxvalue.cxx b/basic/source/sbx/sbxvalue.cxx
index 7c3bd3b057ba..ca21908ece78 100644
--- a/basic/source/sbx/sbxvalue.cxx
+++ b/basic/source/sbx/sbxvalue.cxx
@@ -1470,7 +1470,7 @@ BOOL SbxValue::Compare( SbxOperator eOp, const SbxValue& rOp ) const
bRes = TRUE;
}
else if( GetType() == SbxEMPTY && rOp.GetType() == SbxEMPTY )
- bRes = TRUE;
+ bRes = !bVBAInterop ? TRUE : ( eOp == SbxEQ ? TRUE : FALSE );
// Sonderregel 1: Ist ein Operand Null, ist das Ergebnis FALSE
else if( GetType() == SbxNULL || rOp.GetType() == SbxNULL )
bRes = FALSE;