basic/source/classes/sbxmod.cxx | 16 +-- basic/source/comp/codegen.cxx | 34 +++--- basic/source/comp/dim.cxx | 108 ++++++++++----------- basic/source/comp/exprgen.cxx | 98 +++++++++---------- basic/source/comp/io.cxx | 36 +++---- basic/source/comp/loops.cxx | 80 ++++++++-------- basic/source/comp/parser.cxx | 50 +++++----- basic/source/comp/token.cxx | 14 +- basic/source/inc/opcodes.hxx | 194 +++++++++++++++++++-------------------- basic/source/inc/token.hxx | 10 +- basic/source/runtime/runtime.cxx | 12 +- include/sfx2/dispatch.hxx | 8 - linguistic/source/dlistimp.cxx | 2 linguistic/source/dlistimp.hxx | 4 sfx2/source/control/bindings.cxx | 8 - sfx2/source/control/dispatch.cxx | 26 ++--- sfx2/source/control/statcach.cxx | 2 17 files changed, 351 insertions(+), 351 deletions(-)
New commits: commit 9351353b63886f494782f28f5400f5d71d22bcbd Author: Stephan Bergmann <sberg...@redhat.com> Date: Tue Apr 5 23:12:46 2016 +0200 Avoid reserved identifiers Change-Id: I18ebddef41955948fd4528ae74f4fe9c7439d53b diff --git a/include/sfx2/dispatch.hxx b/include/sfx2/dispatch.hxx index 5ce479e..0234868 100644 --- a/include/sfx2/dispatch.hxx +++ b/include/sfx2/dispatch.hxx @@ -91,7 +91,7 @@ friend class SfxViewFrame; DECL_DLLPRIVATE_LINK_TYPED( PostMsgHandler, SfxRequest *, void ); SAL_DLLPRIVATE void Call_Impl( SfxShell& rShell, const SfxSlot &rSlot, SfxRequest &rReq, bool bRecord ); - SAL_DLLPRIVATE void _Update_Impl( bool,bool,bool,SfxWorkWindow*); + SAL_DLLPRIVATE void Update_Impl_( bool,bool,bool,SfxWorkWindow*); protected: friend class SfxBindings; @@ -99,10 +99,10 @@ friend class SfxStateCache; friend class SfxPopupMenuManager; friend class SfxHelp; - bool _FindServer( sal_uInt16 nId, SfxSlotServer &rServer, bool bModal ); - bool _FillState( const SfxSlotServer &rServer, + bool FindServer_( sal_uInt16 nId, SfxSlotServer &rServer, bool bModal ); + bool FillState_( const SfxSlotServer &rServer, SfxItemSet &rState, const SfxSlot *pRealSlot ); - void _Execute( SfxShell &rShell, const SfxSlot &rSlot, + void Execute_( SfxShell &rShell, const SfxSlot &rSlot, SfxRequest &rReq, SfxCallMode eCall = SfxCallMode::RECORD); diff --git a/sfx2/source/control/bindings.cxx b/sfx2/source/control/bindings.cxx index e681c19..aa2b004 100644 --- a/sfx2/source/control/bindings.cxx +++ b/sfx2/source/control/bindings.cxx @@ -410,7 +410,7 @@ void SfxBindings::Update_Impl if ( pSet ) { // Query Status - if ( rDispat._FillState( *pMsgServer, *pSet, pRealSlot ) ) + if ( rDispat.FillState_( *pMsgServer, *pSet, pRealSlot ) ) { // Post Status const SfxInterface *pInterface = @@ -1169,7 +1169,7 @@ void SfxBindings::Execute_Impl( SfxRequest& aReq, const SfxSlot* pSlot, SfxShell const sal_uInt16 nSlotId = pRealSlot->GetSlotId(); aReq.SetSlot( nSlotId ); aReq.AppendItem( SfxAllEnumItem( rPool.GetWhich(nSlotId), pSlot->GetValue() ) ); - pDispatcher->_Execute( *pShell, *pRealSlot, aReq, aReq.GetCallMode() | SfxCallMode::RECORD ); + pDispatcher->Execute_( *pShell, *pRealSlot, aReq, aReq.GetCallMode() | SfxCallMode::RECORD ); } else if ( SfxSlotKind::Attribute == pSlot->GetKind() ) { @@ -1249,10 +1249,10 @@ void SfxBindings::Execute_Impl( SfxRequest& aReq, const SfxSlot* pSlot, SfxShell } } - pDispatcher->_Execute( *pShell, *pSlot, aReq, aReq.GetCallMode() | SfxCallMode::RECORD ); + pDispatcher->Execute_( *pShell, *pSlot, aReq, aReq.GetCallMode() | SfxCallMode::RECORD ); } else - pDispatcher->_Execute( *pShell, *pSlot, aReq, aReq.GetCallMode() | SfxCallMode::RECORD ); + pDispatcher->Execute_( *pShell, *pSlot, aReq, aReq.GetCallMode() | SfxCallMode::RECORD ); } diff --git a/sfx2/source/control/dispatch.cxx b/sfx2/source/control/dispatch.cxx index dc710dd..b6e3600 100644 --- a/sfx2/source/control/dispatch.cxx +++ b/sfx2/source/control/dispatch.cxx @@ -787,7 +787,7 @@ bool SfxDispatcher::GetShellAndSlot_Impl(sal_uInt16 nSlot, SfxShell** ppShell, Flush(); SfxSlotServer aSvr; - if ( _FindServer(nSlot, aSvr, bModal) ) + if ( FindServer_(nSlot, aSvr, bModal) ) { if ( bOwnShellsOnly && aSvr.GetShellLevel() >= xImp->aStack.size() ) return false; @@ -813,7 +813,7 @@ bool SfxDispatcher::GetShellAndSlot_Impl(sal_uInt16 nSlot, SfxShell** ppShell, @param rReq function to be performed (Id and optional parameters) @param eCallMode Synchronously, asynchronously or as shown in the slot */ -void SfxDispatcher::_Execute(SfxShell& rShell, const SfxSlot& rSlot, +void SfxDispatcher::Execute_(SfxShell& rShell, const SfxSlot& rSlot, SfxRequest& rReq, SfxCallMode eCallMode) { DBG_ASSERT( !xImp->bFlushing, "recursive call to dispatcher" ); @@ -914,7 +914,7 @@ const SfxPoolItem* SfxDispatcher::Execute(sal_uInt16 nSlot, SfxCallMode nCall, aReq.SetInternalArgs_Impl( *pInternalArgs ); aReq.SetModifier( nModi ); - _Execute( *pShell, *pSlot, aReq, nCall ); + Execute_( *pShell, *pSlot, aReq, nCall ); return aReq.GetReturnValue(); } return nullptr; @@ -963,7 +963,7 @@ const SfxPoolItem* SfxDispatcher::Execute(sal_uInt16 nSlot, SfxCallMode eCall, aSet.Put( **pArg ); pReq->SetInternalArgs_Impl( aSet ); } - _Execute( *pShell, *pSlot, *pReq, eCall ); + Execute_( *pShell, *pSlot, *pReq, eCall ); const SfxPoolItem* pRet = pReq->GetReturnValue(); delete pReq; return pRet; } @@ -1002,7 +1002,7 @@ const SfxPoolItem* SfxDispatcher::Execute(sal_uInt16 nSlot, SfxCallMode eCall, MappedPut_Impl( aSet, *pArg ); SfxRequest aReq( nSlot, eCall, aSet ); aReq.SetModifier( 0 ); - _Execute( *pShell, *pSlot, aReq, eCall ); + Execute_( *pShell, *pSlot, aReq, eCall ); return aReq.GetReturnValue(); } return nullptr; @@ -1054,7 +1054,7 @@ const SfxPoolItem* SfxDispatcher::ExecuteList(sal_uInt16 nSlot, SfxCallMode eCal } SfxRequest aReq( nSlot, eCall, aSet ); - _Execute( *pShell, *pSlot, aReq, eCall ); + Execute_( *pShell, *pSlot, aReq, eCall ); return aReq.GetReturnValue(); } return nullptr; @@ -1074,7 +1074,7 @@ IMPL_LINK_TYPED(SfxDispatcher, PostMsgHandler, SfxRequest*, pReq, void) { Flush(); SfxSlotServer aSvr; - if ( _FindServer(pReq->GetSlot(), aSvr, true ) ) // HACK(x), whatever that was supposed to mean + if ( FindServer_(pReq->GetSlot(), aSvr, true ) ) // HACK(x), whatever that was supposed to mean { const SfxSlot *pSlot = aSvr.GetSlot(); SfxShell *pSh = GetShell(aSvr.GetShellLevel()); @@ -1222,7 +1222,7 @@ void SfxDispatcher::Update_Impl( bool bForce ) pActDispat = pActDispat->xImp->pParent; } - _Update_Impl( bUIActive, !bIsIPActive, bIsIPActive, pTaskWin ); + Update_Impl_( bUIActive, !bIsIPActive, bIsIPActive, pTaskWin ); if ( (bUIActive || bIsActive) && !comphelper::LibreOfficeKit::isActive() ) pWorkWin->UpdateObjectBars_Impl(); @@ -1235,7 +1235,7 @@ void SfxDispatcher::Update_Impl( bool bForce ) return; } -void SfxDispatcher::_Update_Impl( bool bUIActive, bool bIsMDIApp, bool bIsIPOwner, SfxWorkWindow *pTaskWin ) +void SfxDispatcher::Update_Impl_( bool bUIActive, bool bIsMDIApp, bool bIsIPOwner, SfxWorkWindow *pTaskWin ) { SfxGetpApp(); SfxWorkWindow *pWorkWin = xImp->pFrame->GetFrame().GetWorkWindow_Impl(); @@ -1250,7 +1250,7 @@ void SfxDispatcher::_Update_Impl( bool bUIActive, bool bIsMDIApp, bool bIsIPOwne } if ( xImp->pParent && !xImp->bQuiet /* && bUIActive */ ) - xImp->pParent->_Update_Impl( bUIActive, bIsMDIApp, bIsIPOwner, pTaskWin ); + xImp->pParent->Update_Impl_( bUIActive, bIsMDIApp, bIsIPOwner, pTaskWin ); for (sal_uInt16 n=0; n<SFX_OBJECTBAR_MAX; n++) xImp->aObjBars[n].nResId = 0; @@ -1642,7 +1642,7 @@ SfxSlotFilterState SfxDispatcher::IsSlotEnabledByFilter_Impl( sal_uInt16 nSID ) false The Slot is currently not served, rServer is invalid. */ -bool SfxDispatcher::_FindServer(sal_uInt16 nSlot, SfxSlotServer& rServer, bool bModal) +bool SfxDispatcher::FindServer_(sal_uInt16 nSlot, SfxSlotServer& rServer, bool bModal) { SFX_STACK(SfxDispatcher::_FindServer); @@ -1701,7 +1701,7 @@ bool SfxDispatcher::_FindServer(sal_uInt16 nSlot, SfxSlotServer& rServer, bool b { if ( xImp->pParent ) { - bool bRet = xImp->pParent->_FindServer( nSlot, rServer, bModal ); + bool bRet = xImp->pParent->FindServer_( nSlot, rServer, bModal ); rServer.SetShellLevel ( rServer.GetShellLevel() + xImp->aStack.size() ); return bRet; @@ -1775,7 +1775,7 @@ bool SfxDispatcher::_FindServer(sal_uInt16 nSlot, SfxSlotServer& rServer, bool b @param rState SfxItemSet to be filled @param pRealSlot The actual Slot if possible */ -bool SfxDispatcher::_FillState(const SfxSlotServer& rSvr, SfxItemSet& rState, +bool SfxDispatcher::FillState_(const SfxSlotServer& rSvr, SfxItemSet& rState, const SfxSlot* pRealSlot) { SFX_STACK(SfxDispatcher::_FillState); diff --git a/sfx2/source/control/statcach.cxx b/sfx2/source/control/statcach.cxx index 9891d85..c610e05 100644 --- a/sfx2/source/control/statcach.cxx +++ b/sfx2/source/control/statcach.cxx @@ -233,7 +233,7 @@ const SfxSlotServer* SfxStateCache::GetSlotServer( SfxDispatcher &rDispat , cons if ( bSlotDirty ) { // get the SlotServer; we need it for internal controllers anyway, but also in most cases - rDispat._FindServer( nId, aSlotServ, false ); + rDispat.FindServer_( nId, aSlotServ, false ); DBG_ASSERT( !pDispatch, "Old Dispatch not removed!" ); commit 8d1bc5056e0a3f647bd9044749d6a7c603029075 Author: Stephan Bergmann <sberg...@redhat.com> Date: Tue Apr 5 23:12:29 2016 +0200 Avoid reserved identifier Change-Id: I56dfbda84e000d974a9dd0644b3dbc2963d3e353 diff --git a/linguistic/source/dlistimp.cxx b/linguistic/source/dlistimp.cxx index d648583..bc1af01 100644 --- a/linguistic/source/dlistimp.cxx +++ b/linguistic/source/dlistimp.cxx @@ -619,7 +619,7 @@ void SAL_CALL aEvtListeners.removeInterface( rxListener ); } -void DicList::_CreateDicList() +void DicList::CreateDicList() { bInCreation = true; diff --git a/linguistic/source/dlistimp.hxx b/linguistic/source/dlistimp.hxx index 42c395e..2b1fa49 100644 --- a/linguistic/source/dlistimp.hxx +++ b/linguistic/source/dlistimp.hxx @@ -73,11 +73,11 @@ class DicList : DicList( const DicList & ) = delete; DicList & operator = (const DicList &) = delete; - void _CreateDicList(); + void CreateDicList(); DictionaryVec_t & GetOrCreateDicList() { if ( !bInCreation && aDicList.empty() ) - _CreateDicList(); + CreateDicList(); return aDicList; } commit c83173940a34f2d388fe4257e70048747dca6f29 Author: Stephan Bergmann <sberg...@redhat.com> Date: Tue Apr 5 23:11:48 2016 +0200 Avoid reserved identifier Change-Id: I2f8dc470100e91841eebbe1e3b02a3d31ab3a535 diff --git a/basic/source/classes/sbxmod.cxx b/basic/source/classes/sbxmod.cxx index 628b533..e8b54d7 100644 --- a/basic/source/classes/sbxmod.cxx +++ b/basic/source/classes/sbxmod.cxx @@ -952,7 +952,7 @@ void SbModule::SetSource32( const OUString& r ) // Broadcast of a hint to all Basics -static void _SendHint( SbxObject* pObj, sal_uInt32 nId, SbMethod* p ) +static void SendHint_( SbxObject* pObj, sal_uInt32 nId, SbMethod* p ) { // Self a BASIC? if( dynamic_cast<const StarBASIC *>(pObj) != nullptr && pObj->IsBroadcaster() ) @@ -963,7 +963,7 @@ static void _SendHint( SbxObject* pObj, sal_uInt32 nId, SbMethod* p ) { SbxVariable* pVar = pObjs->Get( i ); if( dynamic_cast<const SbxObject *>(pVar) != nullptr ) - _SendHint( dynamic_cast<SbxObject*>( pVar), nId, p ); + SendHint_( dynamic_cast<SbxObject*>( pVar), nId, p ); } } @@ -971,7 +971,7 @@ static void SendHint( SbxObject* pObj, sal_uInt32 nId, SbMethod* p ) { while( pObj->GetParent() ) pObj = pObj->GetParent(); - _SendHint( pObj, nId, p ); + SendHint_( pObj, nId, p ); } // #57841 Clear Uno-Objects, which were helt in RTL functions, commit 45adae8fd6e4a6f63220b619d16fb5bd06b82d95 Author: Stephan Bergmann <sberg...@redhat.com> Date: Tue Apr 5 21:31:32 2016 +0200 Avoid reserved identifiers Change-Id: Ibba1a36d4f3744fa68f7e9d0076c997e076262cb diff --git a/basic/source/comp/dim.cxx b/basic/source/comp/dim.cxx index 031bf81..28b7e6e 100644 --- a/basic/source/comp/dim.cxx +++ b/basic/source/comp/dim.cxx @@ -106,7 +106,7 @@ void SbiParser::TypeDecl( SbiSymDef& rDef, bool bAsNewAlreadyParsed ) case TDATE: case TSTRING: case TOBJECT: - case _ERROR_: + case ERROR_: case TBOOLEAN: case TVARIANT: case TBYTE: @@ -222,9 +222,9 @@ void SbiParser::DefVar( SbiOpcode eOp, bool bStatic ) // PRIVATE is a synonymous for DIM // _CONST_? bool bConst = false; - if( eCurTok == _CONST_ ) + if( eCurTok == CONST_ ) bConst = true; - else if( Peek() == _CONST_ ) + else if( Peek() == CONST_ ) { Next(); bConst = true; @@ -831,7 +831,7 @@ SbiProcDef* SbiParser::ProcDecl( bool bDecl ) SbxDataType eType = eScanType; SbiProcDef* pDef = new SbiProcDef( this, aName, true ); pDef->SetType( eType ); - if( Peek() == _CDECL_ ) + if( Peek() == CDECL_ ) { Next(); pDef->SetCdecl(); } @@ -872,7 +872,7 @@ SbiProcDef* SbiParser::ProcDecl( bool bDecl ) } if( pDef->IsCdecl() ) { - Error( ERRCODE_BASIC_UNEXPECTED, _CDECL_ ); + Error( ERRCODE_BASIC_UNEXPECTED, CDECL_ ); } pDef->SetCdecl( false ); pDef->GetLib().clear(); @@ -887,7 +887,7 @@ SbiProcDef* SbiParser::ProcDecl( bool bDecl ) } if( pDef->IsCdecl() ) { - Error( ERRCODE_BASIC_UNEXPECTED, _CDECL_ ); + Error( ERRCODE_BASIC_UNEXPECTED, CDECL_ ); } pDef->SetCdecl( false ); pDef->GetAlias().clear(); @@ -907,7 +907,7 @@ SbiProcDef* SbiParser::ProcDecl( bool bDecl ) bool bByVal = false; bool bOptional = false; bool bParamArray = false; - while( Peek() == BYVAL || Peek() == BYREF || Peek() == _OPTIONAL_ ) + while( Peek() == BYVAL || Peek() == BYREF || Peek() == OPTIONAL_ ) { if( Peek() == BYVAL ) { @@ -917,7 +917,7 @@ SbiProcDef* SbiParser::ProcDecl( bool bDecl ) { bByVal = false; } - else if ( Peek() == _OPTIONAL_ ) + else if ( Peek() == OPTIONAL_ ) { bOptional = true; } diff --git a/basic/source/comp/loops.cxx b/basic/source/comp/loops.cxx index c52113a..198f2b2 100644 --- a/basic/source/comp/loops.cxx +++ b/basic/source/comp/loops.cxx @@ -207,7 +207,7 @@ void SbiParser::For() if( bForEach ) { - TestToken( _IN_ ); + TestToken( IN_ ); SbiExpression aCollExpr( this, SbOPERAND ); aCollExpr.Gen(); // Collection var to for stack TestEoln(); @@ -465,9 +465,9 @@ void SbiParser::On() OUString aString = SbiTokenizer::Symbol(eTok); if (aString.equalsIgnoreAsciiCase("ERROR")) { - eTok = _ERROR_; // Error comes as SYMBOL + eTok = ERROR_; // Error comes as SYMBOL } - if( eTok != _ERROR_ && eTok != LOCAL ) + if( eTok != ERROR_ && eTok != LOCAL ) { OnGoto(); } diff --git a/basic/source/comp/parser.cxx b/basic/source/comp/parser.cxx index ca19e95..a26f5e6 100644 --- a/basic/source/comp/parser.cxx +++ b/basic/source/comp/parser.cxx @@ -46,7 +46,7 @@ static const SbiStatement StmntTable [] = { { ATTRIBUTE, &SbiParser::Attribute, Y, Y, }, // ATTRIBUTE { CALL, &SbiParser::Call, N, Y, }, // CALL { CLOSE, &SbiParser::Close, N, Y, }, // CLOSE -{ _CONST_, &SbiParser::Dim, Y, Y, }, // CONST +{ CONST_, &SbiParser::Dim, Y, Y, }, // CONST { DECLARE, &SbiParser::Declare, Y, N, }, // DECLARE { DEFBOOL, &SbiParser::DefXXX, Y, N, }, // DEFBOOL { DEFCUR, &SbiParser::DefXXX, Y, N, }, // DEFCUR @@ -67,7 +67,7 @@ static const SbiStatement StmntTable [] = { { END, &SbiParser::Stop, N, Y, }, // END { ENUM, &SbiParser::Enum, Y, N, }, // TYPE { ERASE, &SbiParser::Erase, N, Y, }, // ERASE -{ _ERROR_, &SbiParser::ErrorStmnt, N, Y, }, // ERROR +{ ERROR_, &SbiParser::ErrorStmnt, N, Y, }, // ERROR { EXIT, &SbiParser::Exit, N, Y, }, // EXIT { FOR, &SbiParser::For, N, Y, }, // FOR { FUNCTION, &SbiParser::SubFunc, Y, N, }, // FUNCTION @@ -378,7 +378,7 @@ bool SbiParser::Parse() // In vba it's possible to do Error.foobar ( even if it results in // a runtime error - if ( eCurTok == _ERROR_ && IsVBASupportOn() ) // we probably need to define a subset of keywords where this madness applies e.g. if ( IsVBASupportOn() && SymbolCanBeRedined( eCurTok ) ) + if ( eCurTok == ERROR_ && IsVBASupportOn() ) // we probably need to define a subset of keywords where this madness applies e.g. if ( IsVBASupportOn() && SymbolCanBeRedined( eCurTok ) ) { SbiTokenizer tokens( *static_cast<SbiTokenizer*>(this) ); tokens.Next(); diff --git a/basic/source/comp/token.cxx b/basic/source/comp/token.cxx index 8fb0aac..f779fc1 100644 --- a/basic/source/comp/token.cxx +++ b/basic/source/comp/token.cxx @@ -56,12 +56,12 @@ static const TokenTable aTokTable_Basic [] = { { BYVAL, "ByVal", }, { CALL, "Call" }, { CASE, "Case" }, - { _CDECL_, "Cdecl" }, + { CDECL_, "Cdecl" }, { CLASSMODULE, "ClassModule" }, { CLOSE, "Close" }, { COMPARE, "Compare" }, { COMPATIBLE,"Compatible" }, - { _CONST_, "Const" }, + { CONST_, "Const" }, { TCURRENCY,"Currency" }, { TDATE, "Date" }, { DECLARE, "Declare" }, @@ -94,7 +94,7 @@ static const TokenTable aTokTable_Basic [] = { { ENUM, "Enum" }, { EQV, "Eqv" }, { ERASE, "Erase" }, - { _ERROR_, "Error" }, + { ERROR_, "Error" }, { EXIT, "Exit" }, { BASIC_EXPLICIT, "Explicit" }, { FOR, "For" }, @@ -106,7 +106,7 @@ static const TokenTable aTokTable_Basic [] = { { IF, "If" }, { IMP, "Imp" }, { IMPLEMENTS, "Implements" }, - { _IN_, "In" }, + { IN_, "In" }, { INPUT, "Input" }, // also INPUT # { TINTEGER, "Integer" }, { IS, "Is" }, @@ -130,7 +130,7 @@ static const TokenTable aTokTable_Basic [] = { { ON, "On" }, { OPEN, "Open" }, { OPTION, "Option" }, - { _OPTIONAL_, "Optional" }, + { OPTIONAL_, "Optional" }, { OR, "Or" }, { OUTPUT, "Output" }, { PARAMARRAY, "ParamArray" }, @@ -192,7 +192,7 @@ TokenLabelInfo::TokenLabelInfo() } // Token accepted as label by VBA SbiToken eLabelToken[] = { ACCESS, ALIAS, APPEND, BASE, BINARY, CLASSMODULE, - COMPARE, COMPATIBLE, DEFERR, _ERROR_, BASIC_EXPLICIT, LIB, LINE, LPRINT, NAME, + COMPARE, COMPATIBLE, DEFERR, ERROR_, BASIC_EXPLICIT, LIB, LINE, LPRINT, NAME, TOBJECT, OUTPUT, PROPERTY, RANDOM, READ, STEP, STOP, TEXT, VBASUPPORT, NIL }; SbiToken eTok; for( SbiToken* pTok = eLabelToken ; (eTok = *pTok) != NIL ; ++pTok ) @@ -508,7 +508,7 @@ special: { bAs = false; } - else if( eCurTok >= DATATYPE1 && eCurTok <= DATATYPE2 && (bErrorIsSymbol || eCurTok != _ERROR_) ) + else if( eCurTok >= DATATYPE1 && eCurTok <= DATATYPE2 && (bErrorIsSymbol || eCurTok != ERROR_) ) { eCurTok = SYMBOL; } diff --git a/basic/source/inc/token.hxx b/basic/source/inc/token.hxx index 4b2f42a..e3b3a8a 100644 --- a/basic/source/inc/token.hxx +++ b/basic/source/inc/token.hxx @@ -47,7 +47,7 @@ enum SbiToken { // commands: FIRSTKWD = 0x40, AS = FIRSTKWD, ALIAS, ASSIGN, - CALL, CASE, CLOSE, COMPARE, _CONST_, + CALL, CASE, CLOSE, COMPARE, CONST_, DECLARE, DIM, DO, // in the order of the data type enums! @@ -57,13 +57,13 @@ enum SbiToken { DATATYPE1, TINTEGER = DATATYPE1, TLONG, TSINGLE, TDOUBLE, TCURRENCY, TDATE, TSTRING, TOBJECT, - _ERROR_, TBOOLEAN, TVARIANT, TBYTE, + ERROR_, TBOOLEAN, TVARIANT, TBYTE, DATATYPE2 = TBYTE, EACH, ELSE, ELSEIF, END, ERASE, EXIT, FOR, FUNCTION, GET, GLOBAL, GOSUB, GOTO, - IF, _IN_, INPUT, + IF, IN_, INPUT, LET, LINE, LINEINPUT, LOCAL, LOOP, LPRINT, LSET, NAME, NEW, NEXT, ON, OPEN, OPTION, ATTRIBUTE, IMPLEMENTS, @@ -86,9 +86,9 @@ enum SbiToken { IMP, CAT, LIKE, IS, TYPEOF, // miscellaneous: FIRSTEXTRA, - NUMBER=FIRSTEXTRA, FIXSTRING, SYMBOL, _CDECL_, BYVAL, BYREF, + NUMBER=FIRSTEXTRA, FIXSTRING, SYMBOL, CDECL_, BYVAL, BYREF, OUTPUT, RANDOM, APPEND, BINARY, ACCESS, - LOCK, READ, PRESERVE, BASE, ANY, LIB, _OPTIONAL_, + LOCK, READ, PRESERVE, BASE, ANY, LIB, OPTIONAL_, BASIC_EXPLICIT, COMPATIBLE, CLASSMODULE, PARAMARRAY, WITHEVENTS, // from here there are JavaScript-tokens (same enum so that same type) commit f7a3bdf623ca0c8db81997d2b60ed4acb3b51149 Author: Stephan Bergmann <sberg...@redhat.com> Date: Tue Apr 5 21:22:43 2016 +0200 Turn SbiOpcode into scoped enum Change-Id: I75d808dd3a42e57e7f55bad97e24fef65bb62dc6 diff --git a/basic/source/classes/sbxmod.cxx b/basic/source/classes/sbxmod.cxx index d0ff0fb..628b533 100644 --- a/basic/source/classes/sbxmod.cxx +++ b/basic/source/classes/sbxmod.cxx @@ -1481,19 +1481,19 @@ const sal_uInt8* SbModule::FindNextStmnt( const sal_uInt8* p, sal_uInt16& nLine, { SbiOpcode eOp = (SbiOpcode ) ( *p++ ); nPC++; - if( bFollowJumps && eOp == JUMP_ && pImg ) + if( bFollowJumps && eOp == SbiOpcode::JUMP_ && pImg ) { SAL_WARN_IF( !pImg, "basic", "FindNextStmnt: pImg==NULL with FollowJumps option" ); sal_uInt32 nOp1 = *p++; nOp1 |= *p++ << 8; nOp1 |= *p++ << 16; nOp1 |= *p++ << 24; p = reinterpret_cast<const sal_uInt8*>(pImg->GetCode()) + nOp1; } - else if( eOp >= SbOP1_START && eOp <= SbOP1_END ) + else if( eOp >= SbiOpcode::SbOP1_START && eOp <= SbiOpcode::SbOP1_END ) { p += 4; nPC += 4; } - else if( eOp == STMNT_ ) + else if( eOp == SbiOpcode::STMNT_ ) { sal_uInt32 nl, nc; nl = *p++; nl |= *p++ << 8; @@ -1503,12 +1503,12 @@ const sal_uInt8* SbModule::FindNextStmnt( const sal_uInt8* p, sal_uInt16& nLine, nLine = (sal_uInt16)nl; nCol = (sal_uInt16)nc; return p; } - else if( eOp >= SbOP2_START && eOp <= SbOP2_END ) + else if( eOp >= SbiOpcode::SbOP2_START && eOp <= SbiOpcode::SbOP2_END ) { p += 8; nPC += 8; } - else if( !( eOp >= SbOP0_START && eOp <= SbOP0_END ) ) + else if( !( eOp >= SbiOpcode::SbOP0_START && eOp <= SbiOpcode::SbOP0_END ) ) { StarBASIC::FatalError( ERRCODE_BASIC_INTERNAL_ERROR ); break; diff --git a/basic/source/comp/codegen.cxx b/basic/source/comp/codegen.cxx index 9ef2cf9..3ad73e0 100644 --- a/basic/source/comp/codegen.cxx +++ b/basic/source/comp/codegen.cxx @@ -71,7 +71,7 @@ void SbiCodeGen::GenStmnt() if( bStmnt ) { bStmnt = false; - Gen( STMNT_, nLine, nCol ); + Gen( SbiOpcode::STMNT_, nLine, nCol ); } } @@ -84,7 +84,7 @@ sal_uInt32 SbiCodeGen::Gen( SbiOpcode eOpcode ) return 0; #ifdef DBG_UTIL - if( eOpcode < SbOP0_START || eOpcode > SbOP0_END ) + if( eOpcode < SbiOpcode::SbOP0_START || eOpcode > SbiOpcode::SbOP0_END ) pParser->Error( ERRCODE_BASIC_INTERNAL_ERROR, "OPCODE1" ); #endif GenStmnt(); @@ -98,7 +98,7 @@ sal_uInt32 SbiCodeGen::Gen( SbiOpcode eOpcode, sal_uInt32 nOpnd ) return 0; #ifdef DBG_UTIL - if( eOpcode < SbOP1_START || eOpcode > SbOP1_END ) + if( eOpcode < SbiOpcode::SbOP1_START || eOpcode > SbiOpcode::SbOP1_END ) pParser->Error( ERRCODE_BASIC_INTERNAL_ERROR, "OPCODE2" ); #endif GenStmnt(); @@ -114,7 +114,7 @@ sal_uInt32 SbiCodeGen::Gen( SbiOpcode eOpcode, sal_uInt32 nOpnd1, sal_uInt32 nOp return 0; #ifdef DBG_UTIL - if( eOpcode < SbOP2_START || eOpcode > SbOP2_END ) + if( eOpcode < SbiOpcode::SbOP2_START || eOpcode > SbiOpcode::SbOP2_END ) pParser->Error( ERRCODE_BASIC_INTERNAL_ERROR, "OPCODE3" ); #endif GenStmnt(); @@ -433,9 +433,9 @@ public: { SbiOpcode eOp = (SbiOpcode)(*pCode++); - if ( eOp <= SbOP0_END ) + if ( eOp <= SbiOpcode::SbOP0_END ) visitor.processOpCode0( eOp ); - else if( eOp >= SbOP1_START && eOp <= SbOP1_END ) + else if( eOp >= SbiOpcode::SbOP1_START && eOp <= SbiOpcode::SbOP1_END ) { if ( visitor.processParams() ) nOp1 = readParam( pCode ); @@ -443,7 +443,7 @@ public: pCode += sizeof( T ); visitor.processOpCode1( eOp, nOp1 ); } - else if( eOp >= SbOP2_START && eOp <= SbOP2_END ) + else if( eOp >= SbiOpcode::SbOP2_START && eOp <= SbiOpcode::SbOP2_END ) { if ( visitor.processParams() ) { @@ -508,17 +508,17 @@ public: m_ConvertedBuf += (sal_uInt8)eOp; switch( eOp ) { - case JUMP_: - case JUMPT_: - case JUMPF_: - case GOSUB_: - case CASEIS_: - case RETURN_: - case ERRHDL_: - case TESTFOR_: + case SbiOpcode::JUMP_: + case SbiOpcode::JUMPT_: + case SbiOpcode::JUMPF_: + case SbiOpcode::GOSUB_: + case SbiOpcode::CASEIS_: + case SbiOpcode::RETURN_: + case SbiOpcode::ERRHDL_: + case SbiOpcode::TESTFOR_: nOp1 = static_cast<T>( convertBufferOffSet(m_pStart, nOp1) ); break; - case RESUME_: + case SbiOpcode::RESUME_: if ( nOp1 > 1 ) nOp1 = static_cast<T>( convertBufferOffSet(m_pStart, nOp1) ); break; @@ -531,7 +531,7 @@ public: virtual void processOpCode2( SbiOpcode eOp, T nOp1, T nOp2 ) override { m_ConvertedBuf += (sal_uInt8)eOp; - if ( eOp == CASEIS_ ) + if ( eOp == SbiOpcode::CASEIS_ ) if ( nOp1 ) nOp1 = static_cast<T>( convertBufferOffSet(m_pStart, nOp1) ); m_ConvertedBuf += static_cast<S>(nOp1); diff --git a/basic/source/comp/dim.cxx b/basic/source/comp/dim.cxx index 9c822a8..031bf81 100644 --- a/basic/source/comp/dim.cxx +++ b/basic/source/comp/dim.cxx @@ -197,7 +197,7 @@ void SbiParser::TypeDecl( SbiSymDef& rDef, bool bAsNewAlreadyParsed ) void SbiParser::Dim() { - DefVar( DIM_, pProc && bVBASupportOn && pProc->IsStatic() ); + DefVar( SbiOpcode::DIM_, pProc && bVBASupportOn && pProc->IsStatic() ); } void SbiParser::DefVar( SbiOpcode eOp, bool bStatic ) @@ -248,7 +248,7 @@ void SbiParser::DefVar( SbiOpcode eOp, bool bStatic ) // SbiParser::Parse() under these conditions if( bNewGblDefs && nGblChain == 0 ) { - nGblChain = aGen.Gen( JUMP_, 0 ); + nGblChain = aGen.Gen( SbiOpcode::JUMP_, 0 ); bNewGblDefs = false; } Next(); @@ -290,8 +290,8 @@ void SbiParser::DefVar( SbiOpcode eOp, bool bStatic ) if( Peek() == PRESERVE ) { Next(); - if( eOp == REDIM_ ) - eOp = REDIMP_; + if( eOp == SbiOpcode::REDIM_ ) + eOp = SbiOpcode::REDIMP_; else Error( ERRCODE_BASIC_UNEXPECTED, eCurTok ); } @@ -302,7 +302,7 @@ void SbiParser::DefVar( SbiOpcode eOp, bool bStatic ) sal_uInt32 nEndOfStaticLbl = 0; if( !bVBASupportOn && bStatic ) { - nEndOfStaticLbl = aGen.Gen( JUMP_, 0 ); + nEndOfStaticLbl = aGen.Gen( SbiOpcode::JUMP_, 0 ); aGen.Statement(); // catch up on static here } @@ -324,7 +324,7 @@ void SbiParser::DefVar( SbiOpcode eOp, bool bStatic ) if( pOld ) bRtlSym = true; } - if( pOld && !(eOp == REDIM_ || eOp == REDIMP_) ) + if( pOld && !(eOp == SbiOpcode::REDIM_ || eOp == SbiOpcode::REDIMP_) ) { if( pDef->GetScope() == SbLOCAL && pOld->GetScope() != SbLOCAL ) pOld = nullptr; @@ -333,7 +333,7 @@ void SbiParser::DefVar( SbiOpcode eOp, bool bStatic ) { bDefined = true; // always an error at a RTL-S - if( !bRtlSym && (eOp == REDIM_ || eOp == REDIMP_) ) + if( !bRtlSym && (eOp == SbiOpcode::REDIM_ || eOp == SbiOpcode::REDIMP_) ) { // compare the attributes at a REDIM SbxDataType eDefType; @@ -359,27 +359,27 @@ void SbiParser::DefVar( SbiOpcode eOp, bool bStatic ) // #36374: Create the variable in front of the distinction IsNew() // Otherwise error at Dim Identifier As New Type and option explicit - if( !bDefined && !(eOp == REDIM_ || eOp == REDIMP_) + if( !bDefined && !(eOp == SbiOpcode::REDIM_ || eOp == SbiOpcode::REDIMP_) && ( !bConst || pDef->GetScope() == SbGLOBAL ) ) { // Declare variable or global constant SbiOpcode eOp2; switch ( pDef->GetScope() ) { - case SbGLOBAL: eOp2 = bPersistantGlobal ? GLOBAL_P_ : GLOBAL_; + case SbGLOBAL: eOp2 = bPersistantGlobal ? SbiOpcode::GLOBAL_P_ : SbiOpcode::GLOBAL_; goto global; - case SbPUBLIC: eOp2 = bPersistantGlobal ? PUBLIC_P_ : PUBLIC_; + case SbPUBLIC: eOp2 = bPersistantGlobal ? SbiOpcode::PUBLIC_P_ : SbiOpcode::PUBLIC_; // #40689, no own Opcode anymore if( bVBASupportOn && bStatic ) { - eOp2 = STATIC_; + eOp2 = SbiOpcode::STATIC_; break; } global: aGen.BackChain( nGblChain ); nGblChain = 0; bGblDefs = bNewGblDefs = true; break; - default: eOp2 = LOCAL_; + default: eOp2 = SbiOpcode::LOCAL_; } sal_uInt32 nOpnd2 = sal::static_int_cast< sal_uInt16 >( pDef->GetType() ); if( pDef->IsWithEvents() ) @@ -425,35 +425,35 @@ void SbiParser::DefVar( SbiOpcode eOp, bool bStatic ) if( pDim ) { - if( eOp == REDIMP_ ) + if( eOp == SbiOpcode::REDIMP_ ) { SbiExpression aExpr( this, *pDef, nullptr ); aExpr.Gen(); - aGen.Gen( REDIMP_ERASE_ ); + aGen.Gen( SbiOpcode::REDIMP_ERASE_ ); pDef->SetDims( pDim->GetDims() ); SbiExpression aExpr2( this, *pDef, std::move(pDim) ); aExpr2.Gen(); - aGen.Gen( DCREATE_REDIMP_, pDef->GetId(), pDef->GetTypeId() ); + aGen.Gen( SbiOpcode::DCREATE_REDIMP_, pDef->GetId(), pDef->GetTypeId() ); } else { pDef->SetDims( pDim->GetDims() ); SbiExpression aExpr( this, *pDef, std::move(pDim) ); aExpr.Gen(); - aGen.Gen( DCREATE_, pDef->GetId(), pDef->GetTypeId() ); + aGen.Gen( SbiOpcode::DCREATE_, pDef->GetId(), pDef->GetTypeId() ); } } else { SbiExpression aExpr( this, *pDef ); aExpr.Gen(); - SbiOpcode eOp_ = pDef->IsNew() ? CREATE_ : TCREATE_; + SbiOpcode eOp_ = pDef->IsNew() ? SbiOpcode::CREATE_ : SbiOpcode::TCREATE_; aGen.Gen( eOp_, pDef->GetId(), pDef->GetTypeId() ); if ( bVBASupportOn ) - aGen.Gen( VBASET_ ); + aGen.Gen( SbiOpcode::VBASET_ ); else - aGen.Gen( SET_ ); + aGen.Gen( SbiOpcode::SET_ ); } } else @@ -476,7 +476,7 @@ void SbiParser::DefVar( SbiOpcode eOp, bool bStatic ) // Create code only for the global constant! aVar.Gen(); aExpr.Gen(); - aGen.Gen( PUTC_ ); + aGen.Gen( SbiOpcode::PUTC_ ); } SbiConstDef* pConst = pDef->GetConstDef(); if( aExpr.GetType() == SbxSTRING ) @@ -489,7 +489,7 @@ void SbiParser::DefVar( SbiOpcode eOp, bool bStatic ) { // Dimension the variable // Delete the var at REDIM beforehand - if( eOp == REDIM_ ) + if( eOp == SbiOpcode::REDIM_ ) { SbiExpression aExpr( this, *pDef, nullptr ); aExpr.Gen(); @@ -498,15 +498,15 @@ void SbiParser::DefVar( SbiOpcode eOp, bool bStatic ) // clear the variable ( this // allows the processing of // the param to happen as normal without errors ( ordinary ERASE just clears the array ) - aGen.Gen( ERASE_CLEAR_ ); + aGen.Gen( SbiOpcode::ERASE_CLEAR_ ); else - aGen.Gen( ERASE_ ); + aGen.Gen( SbiOpcode::ERASE_ ); } - else if( eOp == REDIMP_ ) + else if( eOp == SbiOpcode::REDIMP_ ) { SbiExpression aExpr( this, *pDef, nullptr ); aExpr.Gen(); - aGen.Gen( REDIMP_ERASE_ ); + aGen.Gen( SbiOpcode::REDIMP_ERASE_ ); } pDef->SetDims( pDim->GetDims() ); if( bPersistantGlobal ) @@ -514,7 +514,7 @@ void SbiParser::DefVar( SbiOpcode eOp, bool bStatic ) SbiExpression aExpr( this, *pDef, std::move(pDim) ); aExpr.Gen(); pDef->SetGlobal( false ); - aGen.Gen( (eOp == STATIC_) ? DIM_ : eOp ); + aGen.Gen( (eOp == SbiOpcode::STATIC_) ? SbiOpcode::DIM_ : eOp ); } } if( !TestComma() ) @@ -536,7 +536,7 @@ void SbiParser::DefVar( SbiOpcode eOp, bool bStatic ) if( !bVBASupportOn && bStatic ) { // maintain the global chain - nGblChain = aGen.Gen( JUMP_, 0 ); + nGblChain = aGen.Gen( SbiOpcode::JUMP_, 0 ); bGblDefs = bNewGblDefs = true; // Register for Sub a jump to the end of statics @@ -549,7 +549,7 @@ void SbiParser::DefVar( SbiOpcode eOp, bool bStatic ) void SbiParser::ReDim() { - DefVar( REDIM_, pProc && bVBASupportOn && pProc->IsStatic() ); + DefVar( SbiOpcode::REDIM_, pProc && bVBASupportOn && pProc->IsStatic() ); } // ERASE array, ... @@ -560,7 +560,7 @@ void SbiParser::Erase() { SbiExpression aExpr( this, SbLVALUE ); aExpr.Gen(); - aGen.Gen( ERASE_ ); + aGen.Gen( SbiOpcode::ERASE_ ); if( !TestComma() ) break; } } @@ -782,7 +782,7 @@ void SbiParser::DefEnum( bool bPrivate ) if( !bPrivate ) { - SbiOpcode eOp = GLOBAL_; + SbiOpcode eOp = SbiOpcode::GLOBAL_; aGen.BackChain( nGblChain ); nGblChain = 0; bGblDefs = bNewGblDefs = true; @@ -792,8 +792,8 @@ void SbiParser::DefEnum( bool bPrivate ) aVar.Gen(); sal_uInt16 nStringId = aGen.GetParser()->aGblStrings.Add( nCurrentEnumValue, SbxLONG ); - aGen.Gen( NUMBER_, nStringId ); - aGen.Gen( PUTC_ ); + aGen.Gen( SbiOpcode::NUMBER_, nStringId ); + aGen.Gen( SbiOpcode::PUTC_ ); } SbiConstDef* pConst = pElem->GetConstDef(); @@ -1057,7 +1057,7 @@ void SbiParser::DefDeclare( bool bPrivate ) { if( bNewGblDefs && nGblChain == 0 ) { - nGblChain = aGen.Gen( JUMP_, 0 ); + nGblChain = aGen.Gen( SbiOpcode::JUMP_, 0 ); bNewGblDefs = false; } @@ -1073,19 +1073,19 @@ void SbiParser::DefDeclare( bool bPrivate ) SbxDataType eType = pDef->GetType(); if( bFunction ) { - aGen.Gen( PARAM_, 0, sal::static_int_cast< sal_uInt16 >( eType ) ); + aGen.Gen( SbiOpcode::PARAM_, 0, sal::static_int_cast< sal_uInt16 >( eType ) ); } if( nParCount > 1 ) { - aGen.Gen( ARGC_ ); + aGen.Gen( SbiOpcode::ARGC_ ); for( sal_uInt16 i = 1 ; i < nParCount ; ++i ) { SbiSymDef* pParDef = rPool.Get( i ); SbxDataType eParType = pParDef->GetType(); - aGen.Gen( PARAM_, i, sal::static_int_cast< sal_uInt16 >( eParType ) ); - aGen.Gen( ARGV_ ); + aGen.Gen( SbiOpcode::PARAM_, i, sal::static_int_cast< sal_uInt16 >( eParType ) ); + aGen.Gen( SbiOpcode::ARGV_ ); sal_uInt16 nTyp = sal::static_int_cast< sal_uInt16 >( pParDef->GetType() ); if( pParDef->IsByVal() ) @@ -1094,13 +1094,13 @@ void SbiParser::DefDeclare( bool bPrivate ) pParDef->SetByVal( false ); nTyp |= 0x8000; } - aGen.Gen( ARGTYP_, nTyp ); + aGen.Gen( SbiOpcode::ARGTYP_, nTyp ); } } - aGen.Gen( LIB_, aGblStrings.Add( pDef->GetLib() ) ); + aGen.Gen( SbiOpcode::LIB_, aGblStrings.Add( pDef->GetLib() ) ); - SbiOpcode eOp = pDef->IsCdecl() ? CALLC_ : CALL_; + SbiOpcode eOp = pDef->IsCdecl() ? SbiOpcode::CALLC_ : SbiOpcode::CALL_; sal_uInt16 nId = pDef->GetId(); if( !pDef->GetAlias().isEmpty() ) { @@ -1114,9 +1114,9 @@ void SbiParser::DefDeclare( bool bPrivate ) if( bFunction ) { - aGen.Gen( PUT_ ); + aGen.Gen( SbiOpcode::PUT_ ); } - aGen.Gen( LEAVE_ ); + aGen.Gen( SbiOpcode::LEAVE_ ); } } } @@ -1151,7 +1151,7 @@ void SbiParser::Call() { SbiExpression aVar( this, SbSYMBOL ); aVar.Gen( FORCE_CALL ); - aGen.Gen( GET_ ); + aGen.Gen( SbiOpcode::GET_ ); } // SUB/FUNCTION @@ -1271,7 +1271,7 @@ void SbiParser::DefProc( bool bStatic, bool bPrivate ) // Open labels? pProc->GetLabels().CheckRefs(); CloseBlock(); - aGen.Gen( LEAVE_ ); + aGen.Gen( SbiOpcode::LEAVE_ ); pProc = nullptr; } @@ -1295,7 +1295,7 @@ void SbiParser::DefStatic( bool bPrivate ) // SbiParser::Parse() under these conditions if( bNewGblDefs && nGblChain == 0 ) { - nGblChain = aGen.Gen( JUMP_, 0 ); + nGblChain = aGen.Gen( SbiOpcode::JUMP_, 0 ); bNewGblDefs = false; } Next(); @@ -1310,7 +1310,7 @@ void SbiParser::DefStatic( bool bPrivate ) // global Pool p = pPool; pPool = &aPublics; - DefVar( STATIC_, true ); + DefVar( SbiOpcode::STATIC_, true ); pPool = p; break; } diff --git a/basic/source/comp/exprgen.cxx b/basic/source/comp/exprgen.cxx index e287e11..7581d6e 100644 --- a/basic/source/comp/exprgen.cxx +++ b/basic/source/comp/exprgen.cxx @@ -30,30 +30,30 @@ typedef struct { } OpTable; static const OpTable aOpTable [] = { - { EXPON,EXP_ }, - { MUL, MUL_ }, - { DIV, DIV_ }, - { IDIV, IDIV_ }, - { MOD, MOD_ }, - { PLUS, PLUS_ }, - { MINUS,MINUS_ }, - { EQ, EQ_ }, - { NE, NE_ }, - { LE, LE_ }, - { GE, GE_ }, - { LT, LT_ }, - { GT, GT_ }, - { AND, AND_ }, - { OR, OR_ }, - { XOR, XOR_ }, - { EQV, EQV_ }, - { IMP, IMP_ }, - { NOT, NOT_ }, - { NEG, NEG_ }, - { CAT, CAT_ }, - { LIKE, LIKE_ }, - { IS, IS_ }, - { NIL, NOP_ }}; + { EXPON,SbiOpcode::EXP_ }, + { MUL, SbiOpcode::MUL_ }, + { DIV, SbiOpcode::DIV_ }, + { IDIV, SbiOpcode::IDIV_ }, + { MOD, SbiOpcode::MOD_ }, + { PLUS, SbiOpcode::PLUS_ }, + { MINUS,SbiOpcode::MINUS_ }, + { EQ, SbiOpcode::EQ_ }, + { NE, SbiOpcode::NE_ }, + { LE, SbiOpcode::LE_ }, + { GE, SbiOpcode::GE_ }, + { LT, SbiOpcode::LT_ }, + { GT, SbiOpcode::GT_ }, + { AND, SbiOpcode::AND_ }, + { OR, SbiOpcode::OR_ }, + { XOR, SbiOpcode::XOR_ }, + { EQV, SbiOpcode::EQV_ }, + { IMP, SbiOpcode::IMP_ }, + { NOT, SbiOpcode::NOT_ }, + { NEG, SbiOpcode::NEG_ }, + { CAT, SbiOpcode::CAT_ }, + { LIKE, SbiOpcode::LIKE_ }, + { IS, SbiOpcode::IS_ }, + { NIL, SbiOpcode::NOP_ }}; // Output of an element void SbiExprNode::Gen( SbiCodeGen& rGen, RecursiveMode eRecMode ) @@ -65,18 +65,18 @@ void SbiExprNode::Gen( SbiCodeGen& rGen, RecursiveMode eRecMode ) switch( GetType() ) { case SbxEMPTY: - rGen.Gen( EMPTY_ ); + rGen.Gen( SbiOpcode::EMPTY_ ); break; case SbxINTEGER: - rGen.Gen( CONST_, (short) nVal ); + rGen.Gen( SbiOpcode::CONST_, (short) nVal ); break; case SbxSTRING: nStringId = rGen.GetParser()->aGblStrings.Add( aStrVal ); - rGen.Gen( SCONST_, nStringId ); + rGen.Gen( SbiOpcode::SCONST_, nStringId ); break; default: nStringId = rGen.GetParser()->aGblStrings.Add( nVal, eType ); - rGen.Gen( NUMBER_, nStringId ); + rGen.Gen( SbiOpcode::NUMBER_, nStringId ); break; } } @@ -86,7 +86,7 @@ void SbiExprNode::Gen( SbiCodeGen& rGen, RecursiveMode eRecMode ) SbiOpcode eOp; if( aVar.pDef->GetScope() == SbPARAM ) { - eOp = PARAM_; + eOp = SbiOpcode::PARAM_; if( 0 == aVar.pDef->GetPos() ) { bool bTreatFunctionAsParam = true; @@ -103,32 +103,32 @@ void SbiExprNode::Gen( SbiCodeGen& rGen, RecursiveMode eRecMode ) } if( !bTreatFunctionAsParam ) { - eOp = aVar.pDef->IsGlobal() ? FIND_G_ : FIND_; + eOp = aVar.pDef->IsGlobal() ? SbiOpcode::FIND_G_ : SbiOpcode::FIND_; } } } // special treatment for WITH else if( (pWithParent_ = GetWithParent()) != nullptr ) { - eOp = ELEM_; // .-Term in WITH + eOp = SbiOpcode::ELEM_; // .-Term in WITH } else { - eOp = ( aVar.pDef->GetScope() == SbRTL ) ? RTL_ : - (aVar.pDef->IsGlobal() ? FIND_G_ : FIND_); + eOp = ( aVar.pDef->GetScope() == SbRTL ) ? SbiOpcode::RTL_ : + (aVar.pDef->IsGlobal() ? SbiOpcode::FIND_G_ : SbiOpcode::FIND_); } - if( eOp == FIND_ ) + if( eOp == SbiOpcode::FIND_ ) { SbiProcDef* pProc = aVar.pDef->GetProcDef(); if ( rGen.GetParser()->bClassModule ) { - eOp = FIND_CM_; + eOp = SbiOpcode::FIND_CM_; } else if ( aVar.pDef->IsStatic() || (pProc && pProc->IsStatic()) ) { - eOp = FIND_STATIC_; + eOp = SbiOpcode::FIND_STATIC_; } } for( SbiExprNode* p = this; p; p = p->aVar.pNext ) @@ -138,17 +138,17 @@ void SbiExprNode::Gen( SbiCodeGen& rGen, RecursiveMode eRecMode ) pWithParent_->Gen(rGen); } p->GenElement( rGen, eOp ); - eOp = ELEM_; + eOp = SbiOpcode::ELEM_; } } else if( IsTypeOf() ) { pLeft->Gen(rGen); - rGen.Gen( TESTCLASS_, nTypeStrId ); + rGen.Gen( SbiOpcode::TESTCLASS_, nTypeStrId ); } else if( IsNew() ) { - rGen.Gen( CREATE_, 0, nTypeStrId ); + rGen.Gen( SbiOpcode::CREATE_, 0, nTypeStrId ); } else { @@ -172,14 +172,14 @@ void SbiExprNode::Gen( SbiCodeGen& rGen, RecursiveMode eRecMode ) void SbiExprNode::GenElement( SbiCodeGen& rGen, SbiOpcode eOp ) { #ifdef DBG_UTIL - if ((eOp < RTL_ || eOp > CALLC_) && eOp != FIND_G_ && eOp != FIND_CM_ && eOp != FIND_STATIC_) + if ((eOp < SbiOpcode::RTL_ || eOp > SbiOpcode::CALLC_) && eOp != SbiOpcode::FIND_G_ && eOp != SbiOpcode::FIND_CM_ && eOp != SbiOpcode::FIND_STATIC_) rGen.GetParser()->Error( ERRCODE_BASIC_INTERNAL_ERROR, "Opcode" ); #endif SbiSymDef* pDef = aVar.pDef; // The ID is either the position or the String-ID // If the bit Bit 0x8000 is set, the variable have // a parameter list. - sal_uInt16 nId = ( eOp == PARAM_ ) ? pDef->GetPos() : pDef->GetId(); + sal_uInt16 nId = ( eOp == SbiOpcode::PARAM_ ) ? pDef->GetPos() : pDef->GetId(); // Build a parameter list if( aVar.pPar && aVar.pPar->GetSize() ) { @@ -194,7 +194,7 @@ void SbiExprNode::GenElement( SbiCodeGen& rGen, SbiOpcode eOp ) for( auto& pExprList: *aVar.pvMorePar ) { pExprList->Gen(rGen); - rGen.Gen( ARRAYACCESS_ ); + rGen.Gen( SbiOpcode::ARRAYACCESS_ ); } } } @@ -207,7 +207,7 @@ void SbiExprList::Gen(SbiCodeGen& rGen) { if( !aData.empty() ) { - rGen.Gen( ARGC_ ); + rGen.Gen( SbiOpcode::ARGC_ ); // Type adjustment at DECLARE sal_uInt16 nCount = 1; @@ -218,7 +218,7 @@ void SbiExprList::Gen(SbiCodeGen& rGen) { // named arg sal_uInt16 nSid = rGen.GetParser()->aGblStrings.Add( pExpr->GetName() ); - rGen.Gen( ARGN_, nSid ); + rGen.Gen( SbiOpcode::ARGN_, nSid ); /* TODO: Check after Declare concept change // From 1996-01-10: Type adjustment at named -> search suitable parameter @@ -247,7 +247,7 @@ void SbiExprList::Gen(SbiCodeGen& rGen) } else { - rGen.Gen( ARGV_ ); + rGen.Gen( SbiOpcode::ARGV_ ); } nCount++; } @@ -261,7 +261,7 @@ void SbiExpression::Gen( RecursiveMode eRecMode ) pExpr->Gen( pParser->aGen, eRecMode ); if( bByVal ) { - pParser->aGen.Gen( BYVAL_ ); + pParser->aGen.Gen( SbiOpcode::BYVAL_ ); } if( bBased ) { @@ -270,8 +270,8 @@ void SbiExpression::Gen( RecursiveMode eRecMode ) { uBase |= 0x8000; // #109275 Flag compatibility } - pParser->aGen.Gen( BASED_, uBase ); - pParser->aGen.Gen( ARGV_ ); + pParser->aGen.Gen( SbiOpcode::BASED_, uBase ); + pParser->aGen.Gen( SbiOpcode::ARGV_ ); } } diff --git a/basic/source/comp/io.cxx b/basic/source/comp/io.cxx index 728039f..6e1c161 100644 --- a/basic/source/comp/io.cxx +++ b/basic/source/comp/io.cxx @@ -33,7 +33,7 @@ bool SbiParser::Channel( bool bAlways ) while( Peek() == COMMA || Peek() == SEMICOLON ) Next(); aExpr.Gen(); - aGen.Gen( CHANNEL_ ); + aGen.Gen( SbiOpcode::CHANNEL_ ); bRes = true; } else if( bAlways ) @@ -56,7 +56,7 @@ void SbiParser::Print() pExpr->Gen(); pExpr.reset(); Peek(); - aGen.Gen( eCurTok == COMMA ? PRINTF_ : BPRINT_ ); + aGen.Gen( eCurTok == COMMA ? SbiOpcode::PRINTF_ : SbiOpcode::BPRINT_ ); } if( eCurTok == COMMA || eCurTok == SEMICOLON ) { @@ -65,12 +65,12 @@ void SbiParser::Print() } else { - aGen.Gen( PRCHAR_, '\n' ); + aGen.Gen( SbiOpcode::PRCHAR_, '\n' ); break; } } if( bChan ) - aGen.Gen( CHAN0_ ); + aGen.Gen( SbiOpcode::CHAN0_ ); } // WRITE #chan, expr, ... @@ -84,21 +84,21 @@ void SbiParser::Write() std::unique_ptr<SbiExpression> pExpr(new SbiExpression( this )); pExpr->Gen(); pExpr.reset(); - aGen.Gen( BWRITE_ ); + aGen.Gen( SbiOpcode::BWRITE_ ); if( Peek() == COMMA ) { - aGen.Gen( PRCHAR_, ',' ); + aGen.Gen( SbiOpcode::PRCHAR_, ',' ); Next(); if( IsEoln( Peek() ) ) break; } else { - aGen.Gen( PRCHAR_, '\n' ); + aGen.Gen( SbiOpcode::PRCHAR_, '\n' ); break; } } if( bChan ) - aGen.Gen( CHAN0_ ); + aGen.Gen( SbiOpcode::CHAN0_ ); } @@ -136,16 +136,16 @@ void SbiParser::LineInput() if( pExpr->GetType() != SbxVARIANT && pExpr->GetType() != SbxSTRING ) Error( ERRCODE_BASIC_CONVERSION ); pExpr->Gen(); - aGen.Gen( LINPUT_ ); + aGen.Gen( SbiOpcode::LINPUT_ ); pExpr.reset(); - aGen.Gen( CHAN0_ ); // ResetChannel() not in StepLINPUT() anymore + aGen.Gen( SbiOpcode::CHAN0_ ); // ResetChannel() not in StepLINPUT() anymore } // INPUT void SbiParser::Input() { - aGen.Gen( RESTART_ ); + aGen.Gen( SbiOpcode::RESTART_ ); Channel( true ); std::unique_ptr<SbiExpression> pExpr(new SbiExpression( this, SbOPERAND )); while( !bAbort ) @@ -153,7 +153,7 @@ void SbiParser::Input() if( !pExpr->IsVariable() ) Error( ERRCODE_BASIC_VAR_EXPECTED ); pExpr->Gen(); - aGen.Gen( INPUT_ ); + aGen.Gen( SbiOpcode::INPUT_ ); if( Peek() == COMMA ) { Next(); @@ -162,7 +162,7 @@ void SbiParser::Input() else break; } pExpr.reset(); - aGen.Gen( CHAN0_ ); + aGen.Gen( SbiOpcode::CHAN0_ ); } // OPEN stringexpr FOR mode ACCESS access mode AS Channel [Len=n] @@ -266,7 +266,7 @@ void SbiParser::Open() if( pChan ) pChan->Gen(); aFileName.Gen(); - aGen.Gen( OPEN_, static_cast<sal_uInt32>(nMode), static_cast<sal_uInt32>(nFlags) ); + aGen.Gen( SbiOpcode::OPEN_, static_cast<sal_uInt32>(nMode), static_cast<sal_uInt32>(nFlags) ); bInStatement = false; } @@ -292,7 +292,7 @@ void SbiParser::Name() SbiExpression aExpr2( this ); aExpr1.Gen(); aExpr2.Gen(); - aGen.Gen( RENAME_ ); + aGen.Gen( SbiOpcode::RENAME_ ); } // CLOSE [n,...] @@ -301,7 +301,7 @@ void SbiParser::Close() { Peek(); if( IsEoln( eCurTok ) ) - aGen.Gen( CLOSE_, 0 ); + aGen.Gen( SbiOpcode::CLOSE_, 0 ); else for( ;; ) { @@ -309,8 +309,8 @@ void SbiParser::Close() while( Peek() == COMMA || Peek() == SEMICOLON ) Next(); aExpr.Gen(); - aGen.Gen( CHANNEL_ ); - aGen.Gen( CLOSE_, 1 ); + aGen.Gen( SbiOpcode::CHANNEL_ ); + aGen.Gen( SbiOpcode::CLOSE_, 1 ); if( IsEoln( Peek() ) ) break; diff --git a/basic/source/comp/loops.cxx b/basic/source/comp/loops.cxx index 7e2f6f8..c52113a 100644 --- a/basic/source/comp/loops.cxx +++ b/basic/source/comp/loops.cxx @@ -41,7 +41,7 @@ void SbiParser::If() sal_uInt16 iJmp = 0; // current table index // multiline IF - nEndLbl = aGen.Gen( JUMPF_, 0 ); + nEndLbl = aGen.Gen( SbiOpcode::JUMPF_, 0 ); eTok = Peek(); while( !( eTok == ELSEIF || eTok == ELSE || eTok == ENDIF ) && !bAbort && Parse() ) @@ -59,7 +59,7 @@ void SbiParser::If() { Error( ERRCODE_BASIC_PROG_TOO_LARGE ); bAbort = true; return; } - pnJmpToEndLbl[iJmp++] = aGen.Gen( JUMP_, 0 ); + pnJmpToEndLbl[iJmp++] = aGen.Gen( SbiOpcode::JUMP_, 0 ); Next(); aGen.BackChain( nEndLbl ); @@ -67,7 +67,7 @@ void SbiParser::If() aGen.Statement(); std::unique_ptr<SbiExpression> pCond(new SbiExpression( this )); pCond->Gen(); - nEndLbl = aGen.Gen( JUMPF_, 0 ); + nEndLbl = aGen.Gen( SbiOpcode::JUMPF_, 0 ); pCond.reset(); TestToken( THEN ); eTok = Peek(); @@ -85,7 +85,7 @@ void SbiParser::If() { Next(); sal_uInt32 nElseLbl = nEndLbl; - nEndLbl = aGen.Gen( JUMP_, 0 ); + nEndLbl = aGen.Gen( SbiOpcode::JUMP_, 0 ); aGen.BackChain( nElseLbl ); aGen.Statement(); @@ -105,7 +105,7 @@ void SbiParser::If() { // single line IF bSingleLineIf = true; - nEndLbl = aGen.Gen( JUMPF_, 0 ); + nEndLbl = aGen.Gen( SbiOpcode::JUMPF_, 0 ); Push( eCurTok ); while( !bAbort ) { @@ -118,7 +118,7 @@ void SbiParser::If() { Next(); sal_uInt32 nElseLbl = nEndLbl; - nEndLbl = aGen.Gen( JUMP_, 0 ); + nEndLbl = aGen.Gen( SbiOpcode::JUMP_, 0 ); aGen.BackChain( nElseLbl ); while( !bAbort ) { @@ -158,10 +158,10 @@ void SbiParser::DoLoop() { SbiExpression aExpr( this ); aExpr.Gen(); - aGen.Gen( eTok == UNTIL ? JUMPF_ : JUMPT_, nStartLbl ); + aGen.Gen( eTok == UNTIL ? SbiOpcode::JUMPF_ : SbiOpcode::JUMPT_, nStartLbl ); } else if (eTok == EOLN || eTok == REM) - aGen.Gen (JUMP_, nStartLbl); + aGen.Gen (SbiOpcode::JUMP_, nStartLbl); else Error( ERRCODE_BASIC_EXPECTED, WHILE ); } @@ -173,10 +173,10 @@ void SbiParser::DoLoop() SbiExpression aCond( this ); aCond.Gen(); } - sal_uInt32 nEndLbl = aGen.Gen( eTok == UNTIL ? JUMPT_ : JUMPF_, 0 ); + sal_uInt32 nEndLbl = aGen.Gen( eTok == UNTIL ? SbiOpcode::JUMPT_ : SbiOpcode::JUMPF_, 0 ); StmntBlock( LOOP ); TestEoln(); - aGen.Gen( JUMP_, nStartLbl ); + aGen.Gen( SbiOpcode::JUMP_, nStartLbl ); aGen.BackChain( nEndLbl ); } CloseBlock(); @@ -189,9 +189,9 @@ void SbiParser::While() SbiExpression aCond( this ); sal_uInt32 nStartLbl = aGen.GetPC(); aCond.Gen(); - sal_uInt32 nEndLbl = aGen.Gen( JUMPF_, 0 ); + sal_uInt32 nEndLbl = aGen.Gen( SbiOpcode::JUMPF_, 0 ); StmntBlock( WEND ); - aGen.Gen( JUMP_, nStartLbl ); + aGen.Gen( SbiOpcode::JUMP_, nStartLbl ); aGen.BackChain( nEndLbl ); } @@ -211,7 +211,7 @@ void SbiParser::For() SbiExpression aCollExpr( this, SbOPERAND ); aCollExpr.Gen(); // Collection var to for stack TestEoln(); - aGen.Gen( INITFOREACH_ ); + aGen.Gen( SbiOpcode::INITFOREACH_ ); } else { @@ -235,16 +235,16 @@ void SbiParser::For() TestEoln(); // The stack has all 4 elements now: variable, start, end, increment // bind start value - aGen.Gen( INITFOR_ ); + aGen.Gen( SbiOpcode::INITFOR_ ); } sal_uInt32 nLoop = aGen.GetPC(); // do tests, maybe free the stack - sal_uInt32 nEndTarget = aGen.Gen( TESTFOR_, 0 ); + sal_uInt32 nEndTarget = aGen.Gen( SbiOpcode::TESTFOR_, 0 ); OpenBlock( FOR ); StmntBlock( NEXT ); - aGen.Gen( NEXT_ ); - aGen.Gen( JUMP_, nLoop ); + aGen.Gen( SbiOpcode::NEXT_ ); + aGen.Gen( SbiOpcode::JUMP_, nLoop ); // are there variables after NEXT? if( Peek() == SYMBOL ) { @@ -294,7 +294,7 @@ void SbiParser::OnGoto() { SbiExpression aCond( this ); aCond.Gen(); - sal_uInt32 nLabelsTarget = aGen.Gen( ONJUMP_, 0 ); + sal_uInt32 nLabelsTarget = aGen.Gen( SbiOpcode::ONJUMP_, 0 ); SbiToken eTok = Next(); if( eTok != GOTO && eTok != GOSUB ) { @@ -309,7 +309,7 @@ void SbiParser::OnGoto() if( MayBeLabel() ) { sal_uInt32 nOff = pProc->GetLabels().Reference( aSym ); - aGen.Gen( JUMP_, nOff ); + aGen.Gen( SbiOpcode::JUMP_, nOff ); nLbl++; } else Error( ERRCODE_BASIC_LABEL_EXPECTED ); @@ -324,7 +324,7 @@ void SbiParser::OnGoto() void SbiParser::Goto() { - SbiOpcode eOp = eCurTok == GOTO ? JUMP_ : GOSUB_; + SbiOpcode eOp = eCurTok == GOTO ? SbiOpcode::JUMP_ : SbiOpcode::GOSUB_; Next(); if( MayBeLabel() ) { @@ -342,9 +342,9 @@ void SbiParser::Return() if( MayBeLabel() ) { sal_uInt32 nOff = pProc->GetLabels().Reference( aSym ); - aGen.Gen( RETURN_, nOff ); + aGen.Gen( SbiOpcode::RETURN_, nOff ); } - else aGen.Gen( RETURN_, 0 ); + else aGen.Gen( SbiOpcode::RETURN_, 0 ); } // SELECT CASE @@ -355,7 +355,7 @@ void SbiParser::Select() SbiExpression aCase( this ); SbiToken eTok = NIL; aCase.Gen(); - aGen.Gen( CASE_ ); + aGen.Gen( SbiOpcode::CASE_ ); TestEoln(); sal_uInt32 nNextTarget = 0; sal_uInt32 nDoneTarget = 0; @@ -397,7 +397,7 @@ void SbiParser::Select() SbiExpression aCompare( this ); aCompare.Gen(); nTrueTarget = aGen.Gen( - CASEIS_, nTrueTarget, + SbiOpcode::CASEIS_, nTrueTarget, sal::static_int_cast< sal_uInt16 >( SbxEQ + ( eTok2 - EQ ) ) ); } @@ -411,11 +411,11 @@ void SbiParser::Select() Next(); SbiExpression aCase2( this ); aCase2.Gen(); - nTrueTarget = aGen.Gen( CASETO_, nTrueTarget ); + nTrueTarget = aGen.Gen( SbiOpcode::CASETO_, nTrueTarget ); } else // CASE a - nTrueTarget = aGen.Gen( CASEIS_, nTrueTarget, SbxEQ ); + nTrueTarget = aGen.Gen( SbiOpcode::CASEIS_, nTrueTarget, SbxEQ ); } if( Peek() == COMMA ) Next(); @@ -428,7 +428,7 @@ void SbiParser::Select() if( !bElse ) { - nNextTarget = aGen.Gen( JUMP_, nNextTarget ); + nNextTarget = aGen.Gen( SbiOpcode::JUMP_, nNextTarget ); aGen.BackChain( nTrueTarget ); } // build the statement body @@ -443,7 +443,7 @@ void SbiParser::Select() break; } if( !bElse ) - nDoneTarget = aGen.Gen( JUMP_, nDoneTarget ); + nDoneTarget = aGen.Gen( SbiOpcode::JUMP_, nDoneTarget ); } else if( !IsEoln( eTok ) ) break; @@ -454,7 +454,7 @@ done: if( nNextTarget ) aGen.BackChain( nNextTarget ); aGen.BackChain( nDoneTarget ); - aGen.Gen( ENDCASE_ ); + aGen.Gen( SbiOpcode::ENDCASE_ ); } // ON Error/Variable @@ -489,12 +489,12 @@ void SbiParser::On() { if( eCurTok == NUMBER && !nVal ) { - aGen.Gen( STDERROR_ ); + aGen.Gen( SbiOpcode::STDERROR_ ); } else { sal_uInt32 nOff = pProc->GetLabels().Reference( aSym ); - aGen.Gen( ERRHDL_, nOff ); + aGen.Gen( SbiOpcode::ERRHDL_, nOff ); } } else if( eCurTok == MINUS ) @@ -502,7 +502,7 @@ void SbiParser::On() Next(); if( eCurTok == NUMBER && nVal == 1 ) { - aGen.Gen( STDERROR_ ); + aGen.Gen( SbiOpcode::STDERROR_ ); } else { @@ -517,7 +517,7 @@ void SbiParser::On() else if( eCurTok == RESUME ) { TestToken( NEXT ); - aGen.Gen( NOERROR_ ); + aGen.Gen( SbiOpcode::NOERROR_ ); } else Error( ERRCODE_BASIC_EXPECTED, "GoTo/Resume" ); } @@ -533,23 +533,23 @@ void SbiParser::Resume() { case EOS: case EOLN: - aGen.Gen( RESUME_, 0 ); + aGen.Gen( SbiOpcode::RESUME_, 0 ); break; case NEXT: - aGen.Gen( RESUME_, 1 ); + aGen.Gen( SbiOpcode::RESUME_, 1 ); Next(); break; case NUMBER: if( !nVal ) { - aGen.Gen( RESUME_, 0 ); + aGen.Gen( SbiOpcode::RESUME_, 0 ); break; } // fall through case SYMBOL: if( MayBeLabel() ) { nLbl = pProc->GetLabels().Reference( aSym ); - aGen.Gen( RESUME_, nLbl ); + aGen.Gen( SbiOpcode::RESUME_, nLbl ); Next(); break; } // fall through diff --git a/basic/source/comp/parser.cxx b/basic/source/comp/parser.cxx index 847636f..ca19e95 100644 --- a/basic/source/comp/parser.cxx +++ b/basic/source/comp/parser.cxx @@ -140,7 +140,7 @@ SbiParser::SbiParser( StarBASIC* pb, SbModule* pm ) aGlobals.SetParent( &aRtlSyms ); - nGblChain = aGen.Gen( JUMP_, 0 ); + nGblChain = aGen.Gen( SbiOpcode::JUMP_, 0 ); rTypeArray = new SbxArray; // array for user defined types rEnumArray = new SbxArray; // array for Enum types @@ -184,7 +184,7 @@ bool SbiParser::HasGlobalCode() if( bGblDefs && nGblChain ) { aGen.BackChain( nGblChain ); - aGen.Gen( LEAVE_ ); + aGen.Gen( SbiOpcode::LEAVE_ ); nGblChain = 0; } return bGblDefs; @@ -233,7 +233,7 @@ void SbiParser::Exit() if( eTok == eExitTok || (eTok == PROPERTY && (eExitTok == GET || eExitTok == LET) ) ) // #i109051 { - p->nChain = aGen.Gen( JUMP_, p->nChain ); + p->nChain = aGen.Gen( SbiOpcode::JUMP_, p->nChain ); return; } } @@ -333,7 +333,7 @@ bool SbiParser::Parse() // AB #40689: Due to the new static-handling there // can be another nGblChain, so ask for it before. if( bNewGblDefs && nGblChain == 0 ) - nGblChain = aGen.Gen( JUMP_, 0 ); + nGblChain = aGen.Gen( SbiOpcode::JUMP_, 0 ); return false; } @@ -427,7 +427,7 @@ bool SbiParser::Parse() if( bNewGblDefs && nGblChain == 0 && ( eCurTok == SUB || eCurTok == FUNCTION || eCurTok == PROPERTY ) ) { - nGblChain = aGen.Gen( JUMP_, 0 ); + nGblChain = aGen.Gen( SbiOpcode::JUMP_, 0 ); bNewGblDefs = false; } // statement-opcode at the beginning of a sub, too, please @@ -525,7 +525,7 @@ void SbiParser::Symbol( const KeywordSymbolInfo* pKeywordSymbolInfo ) { if( !bEQ ) { - aGen.Gen( GET_ ); + aGen.Gen( SbiOpcode::GET_ ); } else { @@ -535,17 +535,17 @@ void SbiParser::Symbol( const KeywordSymbolInfo* pKeywordSymbolInfo ) TestToken( EQ ); SbiExpression aExpr( this ); aExpr.Gen(); - SbiOpcode eOp = PUT_; + SbiOpcode eOp = SbiOpcode::PUT_; if( pDef ) { if( pDef->GetConstDef() ) Error( ERRCODE_BASIC_DUPLICATE_DEF, pDef->GetName() ); if( pDef->GetType() == SbxOBJECT ) { - eOp = SET_; + eOp = SbiOpcode::SET_; if( pDef->GetTypeId() ) { - aGen.Gen( SETCLASS_, pDef->GetTypeId() ); + aGen.Gen( SbiOpcode::SETCLASS_, pDef->GetTypeId() ); return; } } @@ -571,8 +571,8 @@ void SbiParser::Assign() nLen = aLvalue.GetRealVar()->GetLen(); } if( nLen ) - aGen.Gen( PAD_, nLen ); - aGen.Gen( PUT_ ); + aGen.Gen( SbiOpcode::PAD_, nLen ); + aGen.Gen( SbiOpcode::PUT_ ); } // assignments of an object-variable @@ -597,8 +597,8 @@ void SbiParser::Set() TypeDecl( *pTypeDef, true ); aLvalue.Gen(); - aGen.Gen( CREATE_, pDef->GetId(), pTypeDef->GetTypeId() ); - aGen.Gen( SETCLASS_, pDef->GetTypeId() ); + aGen.Gen( SbiOpcode::CREATE_, pDef->GetId(), pTypeDef->GetTypeId() ); + aGen.Gen( SbiOpcode::SETCLASS_, pDef->GetTypeId() ); } else { @@ -613,16 +613,16 @@ void SbiParser::Set() if( pDef->GetTypeId() ) { if ( bVBASupportOn ) - aGen.Gen( VBASETCLASS_, pDef->GetTypeId() ); + aGen.Gen( SbiOpcode::VBASETCLASS_, pDef->GetTypeId() ); else - aGen.Gen( SETCLASS_, pDef->GetTypeId() ); + aGen.Gen( SbiOpcode::SETCLASS_, pDef->GetTypeId() ); } else { if ( bVBASupportOn ) - aGen.Gen( VBASET_ ); + aGen.Gen( SbiOpcode::VBASET_ ); else - aGen.Gen( SET_ ); + aGen.Gen( SbiOpcode::SET_ ); } } } @@ -644,7 +644,7 @@ void SbiParser::LSet() SbiExpression aExpr( this ); aLvalue.Gen(); aExpr.Gen(); - aGen.Gen( LSET_ ); + aGen.Gen( SbiOpcode::LSET_ ); } // JSM 07.10.95 @@ -662,7 +662,7 @@ void SbiParser::RSet() SbiExpression aExpr( this ); aLvalue.Gen(); aExpr.Gen(); - aGen.Gen( RSET_ ); + aGen.Gen( SbiOpcode::RSET_ ); } // DEFINT, DEFLNG, DEFSNG, DEFDBL, DEFSTR and so on @@ -702,7 +702,7 @@ void SbiParser::DefXXX() void SbiParser::Stop() { - aGen.Gen( STOP_ ); + aGen.Gen( SbiOpcode::STOP_ ); Peek(); // #35694: only Peek(), so that EOL is recognized in Single-Line-If } @@ -875,7 +875,7 @@ void SbiParser::ErrorStmnt() { SbiExpression aPar( this ); aPar.Gen(); - aGen.Gen( ERROR_ ); + aGen.Gen( SbiOpcode::ERROR_ ); } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/basic/source/inc/opcodes.hxx b/basic/source/inc/opcodes.hxx index 79add0e..1f10d2d 100644 --- a/basic/source/inc/opcodes.hxx +++ b/basic/source/inc/opcodes.hxx @@ -25,7 +25,7 @@ // An opcode can have a length of 1, 3 or 5 bytes, // depending on its numeric value (see below). -enum SbiOpcode { +enum class SbiOpcode { // all opcodes without operands NOP_ = 0, diff --git a/basic/source/runtime/runtime.cxx b/basic/source/runtime/runtime.cxx index 76a7633..dade0d5 100644 --- a/basic/source/runtime/runtime.cxx +++ b/basic/source/runtime/runtime.cxx @@ -765,21 +765,21 @@ bool SbiRuntime::Step() SbiOpcode eOp = (SbiOpcode ) ( *pCode++ ); sal_uInt32 nOp1, nOp2; - if (eOp <= SbOP0_END) + if (eOp <= SbiOpcode::SbOP0_END) { - (this->*( aStep0[ eOp ] ) )(); + (this->*( aStep0[ int(eOp) ] ) )(); } - else if (eOp >= SbOP1_START && eOp <= SbOP1_END) + else if (eOp >= SbiOpcode::SbOP1_START && eOp <= SbiOpcode::SbOP1_END) { nOp1 = *pCode++; nOp1 |= *pCode++ << 8; nOp1 |= *pCode++ << 16; nOp1 |= *pCode++ << 24; - (this->*( aStep1[ eOp - SbOP1_START ] ) )( nOp1 ); + (this->*( aStep1[ int(eOp) - int(SbiOpcode::SbOP1_START) ] ) )( nOp1 ); } - else if (eOp >= SbOP2_START && eOp <= SbOP2_END) + else if (eOp >= SbiOpcode::SbOP2_START && eOp <= SbiOpcode::SbOP2_END) { nOp1 = *pCode++; nOp1 |= *pCode++ << 8; nOp1 |= *pCode++ << 16; nOp1 |= *pCode++ << 24; nOp2 = *pCode++; nOp2 |= *pCode++ << 8; nOp2 |= *pCode++ << 16; nOp2 |= *pCode++ << 24; - (this->*( aStep2[ eOp - SbOP2_START ] ) )( nOp1, nOp2 ); + (this->*( aStep2[ int(eOp) - int(SbiOpcode::SbOP2_START) ] ) )( nOp1, nOp2 ); } else { commit 7beeced463648fc67defea2ad48d58dd42f0ca1e Author: Stephan Bergmann <sberg...@redhat.com> Date: Tue Apr 5 21:04:31 2016 +0200 Avoid reserved identifiers Change-Id: I3fbc7cb107bdab770d5ce9ed3ecddb962d2d4666 diff --git a/basic/source/classes/sbxmod.cxx b/basic/source/classes/sbxmod.cxx index 82aedf5..d0ff0fb 100644 --- a/basic/source/classes/sbxmod.cxx +++ b/basic/source/classes/sbxmod.cxx @@ -1481,7 +1481,7 @@ const sal_uInt8* SbModule::FindNextStmnt( const sal_uInt8* p, sal_uInt16& nLine, { SbiOpcode eOp = (SbiOpcode ) ( *p++ ); nPC++; - if( bFollowJumps && eOp == _JUMP && pImg ) + if( bFollowJumps && eOp == JUMP_ && pImg ) { SAL_WARN_IF( !pImg, "basic", "FindNextStmnt: pImg==NULL with FollowJumps option" ); sal_uInt32 nOp1 = *p++; nOp1 |= *p++ << 8; @@ -1493,7 +1493,7 @@ const sal_uInt8* SbModule::FindNextStmnt( const sal_uInt8* p, sal_uInt16& nLine, p += 4; nPC += 4; } - else if( eOp == _STMNT ) + else if( eOp == STMNT_ ) { sal_uInt32 nl, nc; nl = *p++; nl |= *p++ << 8; diff --git a/basic/source/comp/codegen.cxx b/basic/source/comp/codegen.cxx index e11236f..9ef2cf9 100644 --- a/basic/source/comp/codegen.cxx +++ b/basic/source/comp/codegen.cxx @@ -71,7 +71,7 @@ void SbiCodeGen::GenStmnt() if( bStmnt ) { bStmnt = false; - Gen( _STMNT, nLine, nCol ); + Gen( STMNT_, nLine, nCol ); } } @@ -508,17 +508,17 @@ public: m_ConvertedBuf += (sal_uInt8)eOp; switch( eOp ) { - case _JUMP: - case _JUMPT: - case _JUMPF: - case _GOSUB: - case _CASEIS: - case _RETURN: - case _ERRHDL: - case _TESTFOR: + case JUMP_: + case JUMPT_: + case JUMPF_: + case GOSUB_: + case CASEIS_: + case RETURN_: + case ERRHDL_: + case TESTFOR_: nOp1 = static_cast<T>( convertBufferOffSet(m_pStart, nOp1) ); break; - case _RESUME: + case RESUME_: if ( nOp1 > 1 ) nOp1 = static_cast<T>( convertBufferOffSet(m_pStart, nOp1) ); break; @@ -531,7 +531,7 @@ public: virtual void processOpCode2( SbiOpcode eOp, T nOp1, T nOp2 ) override { m_ConvertedBuf += (sal_uInt8)eOp; - if ( eOp == _CASEIS ) + if ( eOp == CASEIS_ ) if ( nOp1 ) nOp1 = static_cast<T>( convertBufferOffSet(m_pStart, nOp1) ); m_ConvertedBuf += static_cast<S>(nOp1); diff --git a/basic/source/comp/dim.cxx b/basic/source/comp/dim.cxx index e13bd62..9c822a8 100644 --- a/basic/source/comp/dim.cxx +++ b/basic/source/comp/dim.cxx @@ -197,7 +197,7 @@ void SbiParser::TypeDecl( SbiSymDef& rDef, bool bAsNewAlreadyParsed ) void SbiParser::Dim() { - DefVar( _DIM, pProc && bVBASupportOn && pProc->IsStatic() ); + DefVar( DIM_, pProc && bVBASupportOn && pProc->IsStatic() ); } void SbiParser::DefVar( SbiOpcode eOp, bool bStatic ) @@ -248,7 +248,7 @@ void SbiParser::DefVar( SbiOpcode eOp, bool bStatic ) // SbiParser::Parse() under these conditions if( bNewGblDefs && nGblChain == 0 ) { - nGblChain = aGen.Gen( _JUMP, 0 ); + nGblChain = aGen.Gen( JUMP_, 0 ); bNewGblDefs = false; } Next(); @@ -290,8 +290,8 @@ void SbiParser::DefVar( SbiOpcode eOp, bool bStatic ) if( Peek() == PRESERVE ) { Next(); - if( eOp == _REDIM ) - eOp = _REDIMP; + if( eOp == REDIM_ ) + eOp = REDIMP_; else Error( ERRCODE_BASIC_UNEXPECTED, eCurTok ); } @@ -302,7 +302,7 @@ void SbiParser::DefVar( SbiOpcode eOp, bool bStatic ) sal_uInt32 nEndOfStaticLbl = 0; if( !bVBASupportOn && bStatic ) { - nEndOfStaticLbl = aGen.Gen( _JUMP, 0 ); + nEndOfStaticLbl = aGen.Gen( JUMP_, 0 ); aGen.Statement(); // catch up on static here } @@ -324,7 +324,7 @@ void SbiParser::DefVar( SbiOpcode eOp, bool bStatic ) if( pOld ) bRtlSym = true; } - if( pOld && !(eOp == _REDIM || eOp == _REDIMP) ) + if( pOld && !(eOp == REDIM_ || eOp == REDIMP_) ) { if( pDef->GetScope() == SbLOCAL && pOld->GetScope() != SbLOCAL ) pOld = nullptr; @@ -333,7 +333,7 @@ void SbiParser::DefVar( SbiOpcode eOp, bool bStatic ) { bDefined = true; // always an error at a RTL-S - if( !bRtlSym && (eOp == _REDIM || eOp == _REDIMP) ) + if( !bRtlSym && (eOp == REDIM_ || eOp == REDIMP_) ) { // compare the attributes at a REDIM SbxDataType eDefType; @@ -359,27 +359,27 @@ void SbiParser::DefVar( SbiOpcode eOp, bool bStatic ) // #36374: Create the variable in front of the distinction IsNew() // Otherwise error at Dim Identifier As New Type and option explicit - if( !bDefined && !(eOp == _REDIM || eOp == _REDIMP) + if( !bDefined && !(eOp == REDIM_ || eOp == REDIMP_) && ( !bConst || pDef->GetScope() == SbGLOBAL ) ) { // Declare variable or global constant SbiOpcode eOp2; switch ( pDef->GetScope() ) { - case SbGLOBAL: eOp2 = bPersistantGlobal ? _GLOBAL_P : _GLOBAL; + case SbGLOBAL: eOp2 = bPersistantGlobal ? GLOBAL_P_ : GLOBAL_; goto global; - case SbPUBLIC: eOp2 = bPersistantGlobal ? _PUBLIC_P : _PUBLIC; + case SbPUBLIC: eOp2 = bPersistantGlobal ? PUBLIC_P_ : PUBLIC_; // #40689, no own Opcode anymore if( bVBASupportOn && bStatic ) { - eOp2 = _STATIC; + eOp2 = STATIC_; break; } global: aGen.BackChain( nGblChain ); nGblChain = 0; bGblDefs = bNewGblDefs = true; break; - default: eOp2 = _LOCAL; + default: eOp2 = LOCAL_; } sal_uInt32 nOpnd2 = sal::static_int_cast< sal_uInt16 >( pDef->GetType() ); if( pDef->IsWithEvents() ) @@ -425,35 +425,35 @@ void SbiParser::DefVar( SbiOpcode eOp, bool bStatic ) if( pDim ) { - if( eOp == _REDIMP ) + if( eOp == REDIMP_ ) { SbiExpression aExpr( this, *pDef, nullptr ); aExpr.Gen(); - aGen.Gen( _REDIMP_ERASE ); + aGen.Gen( REDIMP_ERASE_ ); pDef->SetDims( pDim->GetDims() ); SbiExpression aExpr2( this, *pDef, std::move(pDim) ); aExpr2.Gen(); - aGen.Gen( _DCREATE_REDIMP, pDef->GetId(), pDef->GetTypeId() ); + aGen.Gen( DCREATE_REDIMP_, pDef->GetId(), pDef->GetTypeId() ); } else { pDef->SetDims( pDim->GetDims() ); SbiExpression aExpr( this, *pDef, std::move(pDim) ); aExpr.Gen(); - aGen.Gen( _DCREATE, pDef->GetId(), pDef->GetTypeId() ); + aGen.Gen( DCREATE_, pDef->GetId(), pDef->GetTypeId() ); } } else { SbiExpression aExpr( this, *pDef ); aExpr.Gen(); - SbiOpcode eOp_ = pDef->IsNew() ? _CREATE : _TCREATE; + SbiOpcode eOp_ = pDef->IsNew() ? CREATE_ : TCREATE_; aGen.Gen( eOp_, pDef->GetId(), pDef->GetTypeId() ); if ( bVBASupportOn ) - aGen.Gen( _VBASET ); + aGen.Gen( VBASET_ ); else - aGen.Gen( _SET ); + aGen.Gen( SET_ ); } } else @@ -476,7 +476,7 @@ void SbiParser::DefVar( SbiOpcode eOp, bool bStatic ) // Create code only for the global constant! aVar.Gen(); aExpr.Gen(); - aGen.Gen( _PUTC ); + aGen.Gen( PUTC_ ); } SbiConstDef* pConst = pDef->GetConstDef(); if( aExpr.GetType() == SbxSTRING ) @@ -489,7 +489,7 @@ void SbiParser::DefVar( SbiOpcode eOp, bool bStatic ) { // Dimension the variable // Delete the var at REDIM beforehand - if( eOp == _REDIM ) + if( eOp == REDIM_ ) { SbiExpression aExpr( this, *pDef, nullptr ); aExpr.Gen(); @@ -498,15 +498,15 @@ void SbiParser::DefVar( SbiOpcode eOp, bool bStatic ) // clear the variable ( this // allows the processing of // the param to happen as normal without errors ( ordinary ERASE just clears the array ) - aGen.Gen( _ERASE_CLEAR ); + aGen.Gen( ERASE_CLEAR_ ); else - aGen.Gen( _ERASE ); + aGen.Gen( ERASE_ ); } - else if( eOp == _REDIMP ) + else if( eOp == REDIMP_ ) { SbiExpression aExpr( this, *pDef, nullptr ); aExpr.Gen(); - aGen.Gen( _REDIMP_ERASE ); + aGen.Gen( REDIMP_ERASE_ ); } pDef->SetDims( pDim->GetDims() ); if( bPersistantGlobal ) @@ -514,7 +514,7 @@ void SbiParser::DefVar( SbiOpcode eOp, bool bStatic ) SbiExpression aExpr( this, *pDef, std::move(pDim) ); aExpr.Gen(); pDef->SetGlobal( false ); - aGen.Gen( (eOp == _STATIC) ? _DIM : eOp ); + aGen.Gen( (eOp == STATIC_) ? DIM_ : eOp ); } } if( !TestComma() ) @@ -536,7 +536,7 @@ void SbiParser::DefVar( SbiOpcode eOp, bool bStatic ) if( !bVBASupportOn && bStatic ) { // maintain the global chain - nGblChain = aGen.Gen( _JUMP, 0 ); + nGblChain = aGen.Gen( JUMP_, 0 ); bGblDefs = bNewGblDefs = true; // Register for Sub a jump to the end of statics @@ -549,7 +549,7 @@ void SbiParser::DefVar( SbiOpcode eOp, bool bStatic ) void SbiParser::ReDim() { - DefVar( _REDIM, pProc && bVBASupportOn && pProc->IsStatic() ); + DefVar( REDIM_, pProc && bVBASupportOn && pProc->IsStatic() ); } // ERASE array, ... @@ -560,7 +560,7 @@ void SbiParser::Erase() { SbiExpression aExpr( this, SbLVALUE ); aExpr.Gen(); - aGen.Gen( _ERASE ); + aGen.Gen( ERASE_ ); if( !TestComma() ) break; } } @@ -782,7 +782,7 @@ void SbiParser::DefEnum( bool bPrivate ) if( !bPrivate ) { - SbiOpcode eOp = _GLOBAL; + SbiOpcode eOp = GLOBAL_; aGen.BackChain( nGblChain ); nGblChain = 0; bGblDefs = bNewGblDefs = true; @@ -792,8 +792,8 @@ void SbiParser::DefEnum( bool bPrivate ) aVar.Gen(); sal_uInt16 nStringId = aGen.GetParser()->aGblStrings.Add( nCurrentEnumValue, SbxLONG ); - aGen.Gen( _NUMBER, nStringId ); - aGen.Gen( _PUTC ); + aGen.Gen( NUMBER_, nStringId ); + aGen.Gen( PUTC_ ); } SbiConstDef* pConst = pElem->GetConstDef(); @@ -1057,7 +1057,7 @@ void SbiParser::DefDeclare( bool bPrivate ) { if( bNewGblDefs && nGblChain == 0 ) { - nGblChain = aGen.Gen( _JUMP, 0 ); + nGblChain = aGen.Gen( JUMP_, 0 ); bNewGblDefs = false; } @@ -1073,19 +1073,19 @@ void SbiParser::DefDeclare( bool bPrivate ) SbxDataType eType = pDef->GetType(); if( bFunction ) { - aGen.Gen( _PARAM, 0, sal::static_int_cast< sal_uInt16 >( eType ) ); + aGen.Gen( PARAM_, 0, sal::static_int_cast< sal_uInt16 >( eType ) ); } if( nParCount > 1 ) { - aGen.Gen( _ARGC ); + aGen.Gen( ARGC_ ); for( sal_uInt16 i = 1 ; i < nParCount ; ++i ) { SbiSymDef* pParDef = rPool.Get( i ); SbxDataType eParType = pParDef->GetType(); - aGen.Gen( _PARAM, i, sal::static_int_cast< sal_uInt16 >( eParType ) ); - aGen.Gen( _ARGV ); + aGen.Gen( PARAM_, i, sal::static_int_cast< sal_uInt16 >( eParType ) ); + aGen.Gen( ARGV_ ); sal_uInt16 nTyp = sal::static_int_cast< sal_uInt16 >( pParDef->GetType() ); if( pParDef->IsByVal() ) @@ -1094,13 +1094,13 @@ void SbiParser::DefDeclare( bool bPrivate ) pParDef->SetByVal( false ); nTyp |= 0x8000; } - aGen.Gen( _ARGTYP, nTyp ); + aGen.Gen( ARGTYP_, nTyp ); } } - aGen.Gen( _LIB, aGblStrings.Add( pDef->GetLib() ) ); + aGen.Gen( LIB_, aGblStrings.Add( pDef->GetLib() ) ); - SbiOpcode eOp = pDef->IsCdecl() ? _CALLC : _CALL; + SbiOpcode eOp = pDef->IsCdecl() ? CALLC_ : CALL_; sal_uInt16 nId = pDef->GetId(); if( !pDef->GetAlias().isEmpty() ) { @@ -1114,9 +1114,9 @@ void SbiParser::DefDeclare( bool bPrivate ) if( bFunction ) { - aGen.Gen( _PUT ); + aGen.Gen( PUT_ ); } - aGen.Gen( _LEAVE ); + aGen.Gen( LEAVE_ ); } } } @@ -1151,7 +1151,7 @@ void SbiParser::Call() { SbiExpression aVar( this, SbSYMBOL ); aVar.Gen( FORCE_CALL ); - aGen.Gen( _GET ); + aGen.Gen( GET_ ); } // SUB/FUNCTION @@ -1271,7 +1271,7 @@ void SbiParser::DefProc( bool bStatic, bool bPrivate ) // Open labels? pProc->GetLabels().CheckRefs(); CloseBlock(); - aGen.Gen( _LEAVE ); + aGen.Gen( LEAVE_ ); pProc = nullptr; } @@ -1295,7 +1295,7 @@ void SbiParser::DefStatic( bool bPrivate ) // SbiParser::Parse() under these conditions if( bNewGblDefs && nGblChain == 0 ) { - nGblChain = aGen.Gen( _JUMP, 0 ); + nGblChain = aGen.Gen( JUMP_, 0 ); bNewGblDefs = false; } Next(); @@ -1310,7 +1310,7 @@ void SbiParser::DefStatic( bool bPrivate ) // global Pool p = pPool; pPool = &aPublics; - DefVar( _STATIC, true ); + DefVar( STATIC_, true ); pPool = p; break; } diff --git a/basic/source/comp/exprgen.cxx b/basic/source/comp/exprgen.cxx index 3d913b7..e287e11 100644 --- a/basic/source/comp/exprgen.cxx +++ b/basic/source/comp/exprgen.cxx @@ -30,30 +30,30 @@ typedef struct { } OpTable; static const OpTable aOpTable [] = { - { EXPON,_EXP }, - { MUL, _MUL }, - { DIV, _DIV }, - { IDIV, _IDIV }, - { MOD, _MOD }, - { PLUS, _PLUS }, - { MINUS,_MINUS }, - { EQ, _EQ }, - { NE, _NE }, - { LE, _LE }, - { GE, _GE }, - { LT, _LT }, - { GT, _GT }, - { AND, _AND }, - { OR, _OR }, - { XOR, _XOR }, - { EQV, _EQV }, - { IMP, _IMP }, - { NOT, _NOT }, - { NEG, _NEG }, - { CAT, _CAT }, - { LIKE, _LIKE }, - { IS, _IS }, - { NIL, _NOP }}; + { EXPON,EXP_ }, + { MUL, MUL_ }, + { DIV, DIV_ }, + { IDIV, IDIV_ }, + { MOD, MOD_ }, + { PLUS, PLUS_ }, + { MINUS,MINUS_ }, + { EQ, EQ_ }, + { NE, NE_ }, + { LE, LE_ }, + { GE, GE_ }, + { LT, LT_ }, + { GT, GT_ }, + { AND, AND_ }, + { OR, OR_ }, + { XOR, XOR_ }, + { EQV, EQV_ }, + { IMP, IMP_ }, + { NOT, NOT_ }, + { NEG, NEG_ }, + { CAT, CAT_ }, + { LIKE, LIKE_ }, + { IS, IS_ }, + { NIL, NOP_ }}; // Output of an element void SbiExprNode::Gen( SbiCodeGen& rGen, RecursiveMode eRecMode ) @@ -65,18 +65,18 @@ void SbiExprNode::Gen( SbiCodeGen& rGen, RecursiveMode eRecMode ) switch( GetType() ) { case SbxEMPTY: - rGen.Gen( _EMPTY ); + rGen.Gen( EMPTY_ ); break; case SbxINTEGER: - rGen.Gen( _CONST, (short) nVal ); + rGen.Gen( CONST_, (short) nVal ); break; case SbxSTRING: nStringId = rGen.GetParser()->aGblStrings.Add( aStrVal ); - rGen.Gen( _SCONST, nStringId ); + rGen.Gen( SCONST_, nStringId ); break; default: nStringId = rGen.GetParser()->aGblStrings.Add( nVal, eType ); - rGen.Gen( _NUMBER, nStringId ); + rGen.Gen( NUMBER_, nStringId ); break; } } @@ -86,7 +86,7 @@ void SbiExprNode::Gen( SbiCodeGen& rGen, RecursiveMode eRecMode ) SbiOpcode eOp; if( aVar.pDef->GetScope() == SbPARAM ) { - eOp = _PARAM; + eOp = PARAM_; if( 0 == aVar.pDef->GetPos() ) { bool bTreatFunctionAsParam = true; @@ -103,32 +103,32 @@ void SbiExprNode::Gen( SbiCodeGen& rGen, RecursiveMode eRecMode ) } if( !bTreatFunctionAsParam ) { - eOp = aVar.pDef->IsGlobal() ? _FIND_G : _FIND; + eOp = aVar.pDef->IsGlobal() ? FIND_G_ : FIND_; } } } // special treatment for WITH else if( (pWithParent_ = GetWithParent()) != nullptr ) { - eOp = _ELEM; // .-Term in WITH + eOp = ELEM_; // .-Term in WITH } else { - eOp = ( aVar.pDef->GetScope() == SbRTL ) ? _RTL : - (aVar.pDef->IsGlobal() ? _FIND_G : _FIND); + eOp = ( aVar.pDef->GetScope() == SbRTL ) ? RTL_ : + (aVar.pDef->IsGlobal() ? FIND_G_ : FIND_); } - if( eOp == _FIND ) + if( eOp == FIND_ ) { SbiProcDef* pProc = aVar.pDef->GetProcDef(); if ( rGen.GetParser()->bClassModule ) { - eOp = _FIND_CM; + eOp = FIND_CM_; } else if ( aVar.pDef->IsStatic() || (pProc && pProc->IsStatic()) ) { - eOp = _FIND_STATIC; + eOp = FIND_STATIC_; } } for( SbiExprNode* p = this; p; p = p->aVar.pNext ) @@ -138,17 +138,17 @@ void SbiExprNode::Gen( SbiCodeGen& rGen, RecursiveMode eRecMode ) pWithParent_->Gen(rGen); } p->GenElement( rGen, eOp ); - eOp = _ELEM; + eOp = ELEM_; } } else if( IsTypeOf() ) { pLeft->Gen(rGen); - rGen.Gen( _TESTCLASS, nTypeStrId ); + rGen.Gen( TESTCLASS_, nTypeStrId ); } else if( IsNew() ) { - rGen.Gen( _CREATE, 0, nTypeStrId ); + rGen.Gen( CREATE_, 0, nTypeStrId ); } else { @@ -172,14 +172,14 @@ void SbiExprNode::Gen( SbiCodeGen& rGen, RecursiveMode eRecMode ) void SbiExprNode::GenElement( SbiCodeGen& rGen, SbiOpcode eOp ) { #ifdef DBG_UTIL - if ((eOp < _RTL || eOp > _CALLC) && eOp != _FIND_G && eOp != _FIND_CM && eOp != _FIND_STATIC) + if ((eOp < RTL_ || eOp > CALLC_) && eOp != FIND_G_ && eOp != FIND_CM_ && eOp != FIND_STATIC_) rGen.GetParser()->Error( ERRCODE_BASIC_INTERNAL_ERROR, "Opcode" ); #endif SbiSymDef* pDef = aVar.pDef; // The ID is either the position or the String-ID // If the bit Bit 0x8000 is set, the variable have // a parameter list. - sal_uInt16 nId = ( eOp == _PARAM ) ? pDef->GetPos() : pDef->GetId(); + sal_uInt16 nId = ( eOp == PARAM_ ) ? pDef->GetPos() : pDef->GetId(); // Build a parameter list if( aVar.pPar && aVar.pPar->GetSize() ) { @@ -194,7 +194,7 @@ void SbiExprNode::GenElement( SbiCodeGen& rGen, SbiOpcode eOp ) for( auto& pExprList: *aVar.pvMorePar ) { pExprList->Gen(rGen); - rGen.Gen( _ARRAYACCESS ); + rGen.Gen( ARRAYACCESS_ ); } } } @@ -207,7 +207,7 @@ void SbiExprList::Gen(SbiCodeGen& rGen) { if( !aData.empty() ) { - rGen.Gen( _ARGC ); + rGen.Gen( ARGC_ ); // Type adjustment at DECLARE sal_uInt16 nCount = 1; @@ -218,7 +218,7 @@ void SbiExprList::Gen(SbiCodeGen& rGen) { // named arg sal_uInt16 nSid = rGen.GetParser()->aGblStrings.Add( pExpr->GetName() ); - rGen.Gen( _ARGN, nSid ); + rGen.Gen( ARGN_, nSid ); /* TODO: Check after Declare concept change // From 1996-01-10: Type adjustment at named -> search suitable parameter @@ -237,7 +237,7 @@ void SbiExprList::Gen(SbiCodeGen& rGen) // if( pExpr->GetName().ICompare( rName ) // == COMPARE_EQUAL ) // { - // pParser->aGen.Gen( _ARGTYP, pDef->GetType() ); + // pParser->aGen.Gen( ARGTYP_, pDef->GetType() ); // break; // } // } @@ -247,7 +247,7 @@ void SbiExprList::Gen(SbiCodeGen& rGen) } else { - rGen.Gen( _ARGV ); + rGen.Gen( ARGV_ ); } nCount++; } @@ -261,7 +261,7 @@ void SbiExpression::Gen( RecursiveMode eRecMode ) pExpr->Gen( pParser->aGen, eRecMode ); if( bByVal ) { - pParser->aGen.Gen( _BYVAL ); + pParser->aGen.Gen( BYVAL_ ); } if( bBased ) { @@ -270,8 +270,8 @@ void SbiExpression::Gen( RecursiveMode eRecMode ) { uBase |= 0x8000; // #109275 Flag compatibility } - pParser->aGen.Gen( _BASED, uBase ); - pParser->aGen.Gen( _ARGV ); + pParser->aGen.Gen( BASED_, uBase ); + pParser->aGen.Gen( ARGV_ ); } } diff --git a/basic/source/comp/io.cxx b/basic/source/comp/io.cxx index 4624f6a..728039f 100644 --- a/basic/source/comp/io.cxx +++ b/basic/source/comp/io.cxx @@ -33,7 +33,7 @@ bool SbiParser::Channel( bool bAlways ) while( Peek() == COMMA || Peek() == SEMICOLON ) Next(); aExpr.Gen(); - aGen.Gen( _CHANNEL ); + aGen.Gen( CHANNEL_ ); bRes = true; } else if( bAlways ) @@ -56,7 +56,7 @@ void SbiParser::Print() pExpr->Gen(); pExpr.reset(); Peek(); - aGen.Gen( eCurTok == COMMA ? _PRINTF : _BPRINT ); + aGen.Gen( eCurTok == COMMA ? PRINTF_ : BPRINT_ ); } if( eCurTok == COMMA || eCurTok == SEMICOLON ) { @@ -65,12 +65,12 @@ void SbiParser::Print() } else { - aGen.Gen( _PRCHAR, '\n' ); + aGen.Gen( PRCHAR_, '\n' ); break; } } if( bChan ) - aGen.Gen( _CHAN0 ); + aGen.Gen( CHAN0_ ); } // WRITE #chan, expr, ... @@ -84,21 +84,21 @@ void SbiParser::Write() std::unique_ptr<SbiExpression> pExpr(new SbiExpression( this )); pExpr->Gen(); pExpr.reset(); - aGen.Gen( _BWRITE ); + aGen.Gen( BWRITE_ ); if( Peek() == COMMA ) { - aGen.Gen( _PRCHAR, ',' ); + aGen.Gen( PRCHAR_, ',' ); Next(); if( IsEoln( Peek() ) ) break; } else { - aGen.Gen( _PRCHAR, '\n' ); + aGen.Gen( PRCHAR_, '\n' ); break; } } if( bChan ) - aGen.Gen( _CHAN0 ); + aGen.Gen( CHAN0_ ); } @@ -136,16 +136,16 @@ void SbiParser::LineInput() if( pExpr->GetType() != SbxVARIANT && pExpr->GetType() != SbxSTRING ) Error( ERRCODE_BASIC_CONVERSION ); pExpr->Gen(); - aGen.Gen( _LINPUT ); + aGen.Gen( LINPUT_ ); pExpr.reset(); - aGen.Gen( _CHAN0 ); // ResetChannel() not in StepLINPUT() anymore + aGen.Gen( CHAN0_ ); // ResetChannel() not in StepLINPUT() anymore } // INPUT void SbiParser::Input() { - aGen.Gen( _RESTART ); + aGen.Gen( RESTART_ ); Channel( true ); std::unique_ptr<SbiExpression> pExpr(new SbiExpression( this, SbOPERAND )); while( !bAbort ) @@ -153,7 +153,7 @@ void SbiParser::Input() if( !pExpr->IsVariable() ) Error( ERRCODE_BASIC_VAR_EXPECTED ); pExpr->Gen(); - aGen.Gen( _INPUT ); + aGen.Gen( INPUT_ ); if( Peek() == COMMA ) { Next(); @@ -162,7 +162,7 @@ void SbiParser::Input() else break; } pExpr.reset(); - aGen.Gen( _CHAN0 ); + aGen.Gen( CHAN0_ ); } // OPEN stringexpr FOR mode ACCESS access mode AS Channel [Len=n] @@ -266,7 +266,7 @@ void SbiParser::Open() if( pChan ) pChan->Gen(); aFileName.Gen(); - aGen.Gen( _OPEN, static_cast<sal_uInt32>(nMode), static_cast<sal_uInt32>(nFlags) ); + aGen.Gen( OPEN_, static_cast<sal_uInt32>(nMode), static_cast<sal_uInt32>(nFlags) ); bInStatement = false; } @@ -292,7 +292,7 @@ void SbiParser::Name() SbiExpression aExpr2( this ); aExpr1.Gen(); aExpr2.Gen(); - aGen.Gen( _RENAME ); + aGen.Gen( RENAME_ ); } // CLOSE [n,...] @@ -301,7 +301,7 @@ void SbiParser::Close() { Peek(); if( IsEoln( eCurTok ) ) - aGen.Gen( _CLOSE, 0 ); + aGen.Gen( CLOSE_, 0 ); else for( ;; ) { @@ -309,8 +309,8 @@ void SbiParser::Close() while( Peek() == COMMA || Peek() == SEMICOLON ) Next(); aExpr.Gen(); - aGen.Gen( _CHANNEL ); - aGen.Gen( _CLOSE, 1 ); + aGen.Gen( CHANNEL_ ); + aGen.Gen( CLOSE_, 1 ); if( IsEoln( Peek() ) ) break; diff --git a/basic/source/comp/loops.cxx b/basic/source/comp/loops.cxx index 1c744e8..7e2f6f8 100644 --- a/basic/source/comp/loops.cxx +++ b/basic/source/comp/loops.cxx @@ -41,7 +41,7 @@ void SbiParser::If() sal_uInt16 iJmp = 0; // current table index // multiline IF - nEndLbl = aGen.Gen( _JUMPF, 0 ); + nEndLbl = aGen.Gen( JUMPF_, 0 ); eTok = Peek(); while( !( eTok == ELSEIF || eTok == ELSE || eTok == ENDIF ) && !bAbort && Parse() ) @@ -59,7 +59,7 @@ void SbiParser::If() { Error( ERRCODE_BASIC_PROG_TOO_LARGE ); bAbort = true; return; } - pnJmpToEndLbl[iJmp++] = aGen.Gen( _JUMP, 0 ); + pnJmpToEndLbl[iJmp++] = aGen.Gen( JUMP_, 0 ); Next(); aGen.BackChain( nEndLbl ); @@ -67,7 +67,7 @@ void SbiParser::If() aGen.Statement(); std::unique_ptr<SbiExpression> pCond(new SbiExpression( this )); pCond->Gen(); - nEndLbl = aGen.Gen( _JUMPF, 0 ); + nEndLbl = aGen.Gen( JUMPF_, 0 ); pCond.reset(); TestToken( THEN ); eTok = Peek(); @@ -85,7 +85,7 @@ void SbiParser::If() { Next(); sal_uInt32 nElseLbl = nEndLbl; - nEndLbl = aGen.Gen( _JUMP, 0 ); + nEndLbl = aGen.Gen( JUMP_, 0 ); aGen.BackChain( nElseLbl ); aGen.Statement(); @@ -105,7 +105,7 @@ void SbiParser::If() { // single line IF bSingleLineIf = true; - nEndLbl = aGen.Gen( _JUMPF, 0 ); + nEndLbl = aGen.Gen( JUMPF_, 0 ); Push( eCurTok ); while( !bAbort ) { @@ -118,7 +118,7 @@ void SbiParser::If() { Next(); sal_uInt32 nElseLbl = nEndLbl; - nEndLbl = aGen.Gen( _JUMP, 0 ); + nEndLbl = aGen.Gen( JUMP_, 0 ); aGen.BackChain( nElseLbl ); while( !bAbort ) { @@ -158,10 +158,10 @@ void SbiParser::DoLoop() { SbiExpression aExpr( this ); aExpr.Gen(); - aGen.Gen( eTok == UNTIL ? _JUMPF : _JUMPT, nStartLbl ); + aGen.Gen( eTok == UNTIL ? JUMPF_ : JUMPT_, nStartLbl ); } else if (eTok == EOLN || eTok == REM) - aGen.Gen (_JUMP, nStartLbl); + aGen.Gen (JUMP_, nStartLbl); else Error( ERRCODE_BASIC_EXPECTED, WHILE ); } @@ -173,10 +173,10 @@ void SbiParser::DoLoop() SbiExpression aCond( this ); aCond.Gen(); } - sal_uInt32 nEndLbl = aGen.Gen( eTok == UNTIL ? _JUMPT : _JUMPF, 0 ); ... etc. - the rest is truncated _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits