summaryrefslogtreecommitdiff
path: root/basic/source/comp/dim.cxx
diff options
context:
space:
mode:
authorIvo Hinkelmann <ihi@openoffice.org>2009-09-17 14:29:05 +0000
committerIvo Hinkelmann <ihi@openoffice.org>2009-09-17 14:29:05 +0000
commit9066ef90e6707477488cce9b18d3e28613f336e2 (patch)
tree5bb92eafcbe8f52bb1c39d3e1808386832c1b7af /basic/source/comp/dim.cxx
parentca929afbdb49345507f6d3eb122a521dbb05ebdd (diff)
CWS-TOOLING: integrate CWS ab74
2009-09-10 10:13:43 +0200 jsk r276023 : Test Cases for #i103691, #i103697, #i103990 2009-09-03 15:42:36 +0200 ab r275754 : #i103990# Removed warning 2009-09-03 09:02:32 +0200 ab r275744 : CWS-TOOLING: rebase CWS ab74 to trunk@275331 (milestone: DEV300:m56) 2009-09-02 17:14:42 +0200 ab r275724 : #i103697# Applied patch 2009-08-27 15:11:50 +0200 ab r275488 : #i103354# Check Lucene index file to be named _0.cfs, fail otherwise 2009-08-26 08:57:21 +0200 ab r275393 : #i104354# Changed loop variable type to avoid Solaris Intel compiler optimizer bug 2009-08-17 14:17:32 +0200 ab r275053 : #i73263# Adapted breakpoint dialog to longer strings 2009-08-13 17:09:30 +0200 ab r274951 : #i103691# Fix empty comparison behaviour 2009-08-13 13:03:28 +0200 ab r274935 : #i103948# Applied patch 2009-08-13 12:31:15 +0200 ab r274931 : #i103134# Patch: Always set default property 2009-08-13 11:02:50 +0200 ab r274926 : #i103990# Support arrays in user types 2009-07-21 11:16:54 +0200 ab r274171 : #i102816# Make sure LocaleItem is loaded before copying from it 2009-07-20 14:56:35 +0200 ab r274139 : #i102816# Use default language as final fallback in service implementation
Diffstat (limited to 'basic/source/comp/dim.cxx')
-rw-r--r--basic/source/comp/dim.cxx63
1 files changed, 54 insertions, 9 deletions
diff --git a/basic/source/comp/dim.cxx b/basic/source/comp/dim.cxx
index b6c95c5748..dfb9637d06 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 );
}
}
}