diff options
author | Daniel Rentz <dr@openoffice.org> | 2010-06-15 20:02:53 +0200 |
---|---|---|
committer | Daniel Rentz <dr@openoffice.org> | 2010-06-15 20:02:53 +0200 |
commit | 5ed103d2dd5f8ee2f13183263c0930f84437bdc7 (patch) | |
tree | ab1c7cf7a0b884df473eeda6048030ee8629972b /basic/source/inc | |
parent | CWS-TOOLING: integrate CWS gridcontrol_03 (diff) | |
download | core-5ed103d2dd5f8ee2f13183263c0930f84437bdc7.tar.gz core-5ed103d2dd5f8ee2f13183263c0930f84437bdc7.zip |
mib16: contributed bugfixes and various new symbols in VBA compatibility implementation
Diffstat (limited to 'basic/source/inc')
-rw-r--r-- | basic/source/inc/codegen.hxx | 2 | ||||
-rw-r--r-- | basic/source/inc/dlgcont.hxx | 9 | ||||
-rw-r--r-- | basic/source/inc/expr.hxx | 20 | ||||
-rw-r--r-- | basic/source/inc/namecont.hxx | 9 | ||||
-rw-r--r-- | basic/source/inc/opcodes.hxx | 1 | ||||
-rw-r--r-- | basic/source/inc/parser.hxx | 3 | ||||
-rw-r--r-- | basic/source/inc/runtime.hxx | 5 | ||||
-rw-r--r-- | basic/source/inc/sbintern.hxx | 3 | ||||
-rw-r--r-- | basic/source/inc/scriptcont.hxx | 9 | ||||
-rw-r--r-- | basic/source/inc/symtbl.hxx | 6 | ||||
-rw-r--r-- | basic/source/inc/token.hxx | 20 |
11 files changed, 69 insertions, 18 deletions
diff --git a/basic/source/inc/codegen.hxx b/basic/source/inc/codegen.hxx index 3d90d16bdcbe..a3fe02227cfd 100644 --- a/basic/source/inc/codegen.hxx +++ b/basic/source/inc/codegen.hxx @@ -44,6 +44,7 @@ class SbiCodeGen { // Code-Erzeugung: public: SbiCodeGen( SbModule&, SbiParser*, short ); SbiParser* GetParser() { return pParser; } + SbModule& GetModule() { return rMod; } UINT32 Gen( SbiOpcode ); UINT32 Gen( SbiOpcode, UINT32 ); UINT32 Gen( SbiOpcode, UINT32, UINT32 ); @@ -53,7 +54,6 @@ public: void GenStmnt(); // evtl. Statement-Opcode erzeugen UINT32 GetPC(); UINT32 GetOffset() { return GetPC() + 1; } - SbModule& GetModule() { return rMod; } void Save(); // #29955 for-Schleifen-Ebene pflegen diff --git a/basic/source/inc/dlgcont.hxx b/basic/source/inc/dlgcont.hxx index b0b3334b5031..2c927a8286f4 100644 --- a/basic/source/inc/dlgcont.hxx +++ b/basic/source/inc/dlgcont.hxx @@ -54,14 +54,17 @@ class SfxDialogLibraryContainer : public SfxLibraryContainer virtual bool SAL_CALL isLibraryElementValid( ::com::sun::star::uno::Any aElement ) const; virtual void SAL_CALL writeLibraryElement ( - ::com::sun::star::uno::Any aElement, + const ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameContainer>& xLibrary, const ::rtl::OUString& aElementName, - ::com::sun::star::uno::Reference< ::com::sun::star::io::XOutputStream > xOutput + const ::com::sun::star::uno::Reference< ::com::sun::star::io::XOutputStream >& xOutput ) throw(::com::sun::star::uno::Exception); virtual ::com::sun::star::uno::Any SAL_CALL importLibraryElement - ( const ::rtl::OUString& aFile, + ( + const ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameContainer>& xLibrary, + const ::rtl::OUString& aElementName, + const ::rtl::OUString& aFile, const ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream >& xElementStream ); virtual void SAL_CALL importFromOldStorage( const ::rtl::OUString& aFile ); diff --git a/basic/source/inc/expr.hxx b/basic/source/inc/expr.hxx index 8ccbcebe4309..9b8f51d09dea 100644 --- a/basic/source/inc/expr.hxx +++ b/basic/source/inc/expr.hxx @@ -52,6 +52,13 @@ struct SbVar { // Variablen-Element: SbiExprListVector* pvMorePar; // Array of arrays foo(pPar)(avMorePar[0])(avMorePar[1])... }; +struct KeywordSymbolInfo +{ + String m_aKeywordSymbol; + SbxDataType m_eSbxDataType; + SbiToken m_eTok; +}; + enum SbiExprType { // Expression-Typen: SbSTDEXPR, // normaler Ausdruck SbLVALUE, // beliebiger lValue @@ -76,6 +83,7 @@ enum SbiNodeType { SbxVARVAL, // aVar = Wert SbxTYPEOF, // TypeOf ObjExpr Is Type SbxNODE, // Node + SbxNEW, // new <type> expression SbxDUMMY }; @@ -107,9 +115,11 @@ class SbiExprNode { // Operatoren (und Operanden) void FoldConstants(); // Constant Folding durchfuehren void CollectBits(); // Umwandeln von Zahlen in Strings BOOL IsOperand() // TRUE, wenn Operand - { return BOOL( eNodeType != SbxNODE && eNodeType != SbxTYPEOF ); } + { return BOOL( eNodeType != SbxNODE && eNodeType != SbxTYPEOF && eNodeType != SbxNEW ); } BOOL IsTypeOf() { return BOOL( eNodeType == SbxTYPEOF ); } + BOOL IsNew() + { return BOOL( eNodeType == SbxNEW ); } BOOL IsNumber(); // TRUE bei Zahlen BOOL IsString(); // TRUE bei Strings BOOL IsLvalue(); // TRUE, falls als Lvalue verwendbar @@ -122,6 +132,7 @@ public: SbiExprNode( SbiParser*, const SbiSymDef&, SbxDataType, SbiExprList* = NULL ); SbiExprNode( SbiParser*, SbiExprNode*, SbiToken, SbiExprNode* ); SbiExprNode( SbiParser*, SbiExprNode*, USHORT ); // #120061 TypeOf + SbiExprNode( SbiParser*, USHORT ); // new <type> virtual ~SbiExprNode(); BOOL IsValid() { return BOOL( !bError ); } @@ -166,9 +177,9 @@ protected: BOOL bByVal; // TRUE: ByVal-Parameter BOOL bBracket; // TRUE: Parameter list with brackets USHORT nParenLevel; - SbiExprNode* Term(); + SbiExprNode* Term( const KeywordSymbolInfo* pKeywordSymbolInfo = NULL ); SbiExprNode* ObjTerm( SbiSymDef& ); - SbiExprNode* Operand(); + SbiExprNode* Operand( bool bUsedForTypeOf = false ); SbiExprNode* Unary(); SbiExprNode* Exp(); SbiExprNode* MulDiv(); @@ -180,7 +191,8 @@ protected: SbiExprNode* Comp(); SbiExprNode* Boolean(); public: - SbiExpression( SbiParser*, SbiExprType = SbSTDEXPR, SbiExprMode eMode = EXPRMODE_STANDARD ); // Parsender Ctor + SbiExpression( SbiParser*, SbiExprType = SbSTDEXPR, + SbiExprMode eMode = EXPRMODE_STANDARD, const KeywordSymbolInfo* pKeywordSymbolInfo = NULL ); // Parsender Ctor SbiExpression( SbiParser*, const String& ); SbiExpression( SbiParser*, double, SbxDataType = SbxDOUBLE ); SbiExpression( SbiParser*, const SbiSymDef&, SbiExprList* = NULL ); diff --git a/basic/source/inc/namecont.hxx b/basic/source/inc/namecont.hxx index 1f4084db1d0d..4df1c48557d2 100644 --- a/basic/source/inc/namecont.hxx +++ b/basic/source/inc/namecont.hxx @@ -284,14 +284,17 @@ protected: virtual bool SAL_CALL isLibraryElementValid( ::com::sun::star::uno::Any aElement ) const = 0; virtual void SAL_CALL writeLibraryElement ( - ::com::sun::star::uno::Any aElement, + const ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameContainer>& xLibrary, const ::rtl::OUString& aElementName, - ::com::sun::star::uno::Reference< ::com::sun::star::io::XOutputStream > xOutput + const ::com::sun::star::uno::Reference< ::com::sun::star::io::XOutputStream >& xOutput ) throw(::com::sun::star::uno::Exception) = 0; virtual ::com::sun::star::uno::Any SAL_CALL importLibraryElement - ( const ::rtl::OUString& aFile, + ( + const ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameContainer>& xLibrary, + const ::rtl::OUString& aElementName, + const ::rtl::OUString& aFile, const ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream >& xElementStream ) = 0; virtual void SAL_CALL importFromOldStorage( const ::rtl::OUString& aFile ) = 0; diff --git a/basic/source/inc/opcodes.hxx b/basic/source/inc/opcodes.hxx index 9d909c03c436..ff7eff027f83 100644 --- a/basic/source/inc/opcodes.hxx +++ b/basic/source/inc/opcodes.hxx @@ -93,6 +93,7 @@ enum SbiOpcode { _VBASET, // VBA-like Set _ERASE_CLEAR, // Erase array and clear variable _ARRAYACCESS, // Assign parameters to TOS and get value, used for array of arrays + _BYVAL, // byref -> byval for lvalue parameter passed in call SbOP0_END, // Alle Opcodes mit einem Operanden diff --git a/basic/source/inc/parser.hxx b/basic/source/inc/parser.hxx index 3dc8525377a2..1161c4ed259d 100644 --- a/basic/source/inc/parser.hxx +++ b/basic/source/inc/parser.hxx @@ -99,7 +99,7 @@ public: BOOL TestComma(); // Komma oder EOLN? void TestEoln(); // EOLN? - void Symbol(); // Let oder Call + void Symbol( const KeywordSymbolInfo* pKeywordSymbolInfo = NULL ); // Let oder Call void ErrorStmnt(); // ERROR n void NotImp(); // nicht implementiert void BadBlock(); // LOOP/WEND/NEXT @@ -119,6 +119,7 @@ public: void If(); // IF void Implements(); // IMPLEMENTS void Input(); // INPUT, INPUT # + void Line(); // LINE -> LINE INPUT [#] (#i92642) void LineInput(); // LINE INPUT, LINE INPUT # void LSet(); // LSET void Name(); // NAME .. AS .. diff --git a/basic/source/inc/runtime.hxx b/basic/source/inc/runtime.hxx index c9a41110ad46..6ca69209a752 100644 --- a/basic/source/inc/runtime.hxx +++ b/basic/source/inc/runtime.hxx @@ -407,7 +407,7 @@ class SbiRuntime void StepPRINTF(), StepWRITE(), StepRENAME(), StepPROMPT(); void StepRESTART(), StepEMPTY(), StepLEAVE(); void StepLSET(), StepRSET(), StepREDIMP_ERASE(), StepERASE_CLEAR(); - void StepARRAYACCESS(); + void StepARRAYACCESS(), StepBYVAL(); // Alle Opcodes mit einem Operanden void StepLOADNC( UINT32 ), StepLOADSC( UINT32 ), StepLOADI( UINT32 ); void StepARGN( UINT32 ), StepBASED( UINT32 ), StepPAD( UINT32 ); @@ -416,7 +416,7 @@ class SbiRuntime void StepGOSUB( UINT32 ), StepRETURN( UINT32 ); void StepTESTFOR( UINT32 ), StepCASETO( UINT32 ), StepERRHDL( UINT32 ); void StepRESUME( UINT32 ), StepSETCLASS( UINT32 ), StepVBASETCLASS( UINT32 ), StepTESTCLASS( UINT32 ), StepLIB( UINT32 ); - bool checkClass_Impl( const SbxVariableRef& refVal, const String& aClass, bool bRaiseErrors ); + bool checkClass_Impl( const SbxVariableRef& refVal, const String& aClass, bool bRaiseErrors, bool bDefault = true ); void StepCLOSE( UINT32 ), StepPRCHAR( UINT32 ), StepARGTYP( UINT32 ); // Alle Opcodes mit zwei Operanden void StepRTL( UINT32, UINT32 ), StepPUBLIC( UINT32, UINT32 ), StepPUBLIC_P( UINT32, UINT32 ); @@ -434,6 +434,7 @@ class SbiRuntime void StepDCREATE_REDIMP(UINT32,UINT32), StepDCREATE_IMPL(UINT32,UINT32); void StepFIND_CM( UINT32, UINT32 ); void StepFIND_STATIC( UINT32, UINT32 ); + void implCreateFixedString( SbxVariable* pStrVar, UINT32 nOp2 ); public: void SetVBAEnabled( bool bEnabled ); USHORT GetImageFlag( USHORT n ) const; diff --git a/basic/source/inc/sbintern.hxx b/basic/source/inc/sbintern.hxx index 5896db78ea40..59cfe21d25a8 100644 --- a/basic/source/inc/sbintern.hxx +++ b/basic/source/inc/sbintern.hxx @@ -39,6 +39,7 @@ namespace utl class SbUnoFactory; class SbTypeFactory; class SbOLEFactory; +class SbFormFactory; class SbiInstance; class SbModule; @@ -101,6 +102,7 @@ struct SbiGlobals SbTypeFactory* pTypeFac; // Factory for user defined types SbClassFactory* pClassFac; // Factory for user defined classes (based on class modules) SbOLEFactory* pOLEFac; // Factory for OLE types + SbFormFactory* pFormFac; // Factory for user forms SbModule* pMod; // aktuell aktives Modul SbModule* pCompMod; // aktuell compiliertes Modul short nInst; // Anzahl BASICs @@ -136,6 +138,7 @@ SbiGlobals* GetSbData(); #define pTYPEFAC GetSbData()->pTypeFac #define pCLASSFAC GetSbData()->pClassFac #define pOLEFAC GetSbData()->pOLEFac +#define pFORMFAC GetSbData()->pFormFac #endif diff --git a/basic/source/inc/scriptcont.hxx b/basic/source/inc/scriptcont.hxx index 31025c48c4a4..d184a2d558e2 100644 --- a/basic/source/inc/scriptcont.hxx +++ b/basic/source/inc/scriptcont.hxx @@ -53,14 +53,17 @@ class SfxScriptLibraryContainer : public SfxLibraryContainer, public OldBasicPas virtual bool SAL_CALL isLibraryElementValid( ::com::sun::star::uno::Any aElement ) const; virtual void SAL_CALL writeLibraryElement ( - ::com::sun::star::uno::Any aElement, + const ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameContainer>& xLibrary, const ::rtl::OUString& aElementName, - ::com::sun::star::uno::Reference< ::com::sun::star::io::XOutputStream > xOutput + const ::com::sun::star::uno::Reference< ::com::sun::star::io::XOutputStream >& xOutput ) throw(::com::sun::star::uno::Exception); virtual ::com::sun::star::uno::Any SAL_CALL importLibraryElement - ( const ::rtl::OUString& aFile, + ( + const ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameContainer>& xLibrary, + const ::rtl::OUString& aElementName, + const ::rtl::OUString& aFile, const ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream >& xElementStream ); virtual void SAL_CALL importFromOldStorage( const ::rtl::OUString& aFile ); diff --git a/basic/source/inc/symtbl.hxx b/basic/source/inc/symtbl.hxx index 03202edba910..9bd8cfd49754 100644 --- a/basic/source/inc/symtbl.hxx +++ b/basic/source/inc/symtbl.hxx @@ -132,7 +132,9 @@ protected: BOOL bAs : 1; // TRUE: Datentyp per AS XXX definiert BOOL bGlobal : 1; // TRUE: Global-Variable BOOL bParamArray : 1; // TRUE: ParamArray parameter + BOOL bWithEvents : 1; // TRUE: Declared WithEvents USHORT nDefaultId; // Symbol number of default value + short nFixedStringLength; // String length in: Dim foo As String*Length public: SbiSymDef( const String& ); virtual ~SbiSymDef(); @@ -156,6 +158,7 @@ public: BOOL IsDefined() const{ return bChained; } void SetOptional() { bOpt = TRUE; } void SetParamArray() { bParamArray = TRUE; } + void SetWithEvents() { bWithEvents = TRUE; } void SetByVal() { bByVal = TRUE; } void SetStatic( BOOL bAsStatic = TRUE ) { bStatic = bAsStatic; } void SetNew() { bNew = TRUE; } @@ -165,11 +168,14 @@ public: USHORT GetDefaultId( void ) { return nDefaultId; } BOOL IsOptional() const{ return bOpt; } BOOL IsParamArray() const{ return bParamArray; } + BOOL IsWithEvents() const{ return bWithEvents; } BOOL IsByVal() const { return bByVal; } BOOL IsStatic() const { return bStatic; } BOOL IsNew() const { return bNew; } BOOL IsDefinedAs() const { return bAs; } BOOL IsGlobal() const { return bGlobal; } + short GetFixedStringLength( void ) const { return nFixedStringLength; } + void SetFixedStringLength( short n ) { nFixedStringLength = n; } SbiSymPool& GetPool(); UINT32 Define(); // Symbol in Code definieren diff --git a/basic/source/inc/token.hxx b/basic/source/inc/token.hxx index 3dc1113b57d1..930f68910b78 100644 --- a/basic/source/inc/token.hxx +++ b/basic/source/inc/token.hxx @@ -95,7 +95,7 @@ enum SbiToken { NUMBER=FIRSTEXTRA, FIXSTRING, SYMBOL, _CDECL_, BYVAL, BYREF, OUTPUT, RANDOM, APPEND, BINARY, ACCESS, LOCK, READ, PRESERVE, BASE, ANY, LIB, _OPTIONAL_, - EXPLICIT, COMPATIBLE, CLASSMODULE, PARAMARRAY, + EXPLICIT, COMPATIBLE, CLASSMODULE, PARAMARRAY, WITHEVENTS, // Ab hier kommen JavaScript-Tokens (gleiches enum, damit gleicher Typ) FIRSTJAVA, @@ -120,7 +120,25 @@ enum SbiToken { #undef SbiTokenSHAREDTMPUNDEF #endif +// #i109076 +class TokenLabelInfo +{ + bool* m_pTokenCanBeLabelTab; + +public: + TokenLabelInfo( void ); + TokenLabelInfo( const TokenLabelInfo& rInfo ) + : m_pTokenCanBeLabelTab( NULL ) + { (void)rInfo; } + ~TokenLabelInfo(); + + bool canTokenBeLabel( SbiToken eTok ) + { return m_pTokenCanBeLabelTab[eTok]; } +}; + class SbiTokenizer : public SbiScanner { + TokenLabelInfo m_aTokenLabelInfo; + protected: SbiToken eCurTok; // aktuelles Token SbiToken ePush; // Pushback-Token |