diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2016-11-23 12:31:54 +0200 |
---|---|---|
committer | Ashod Nakashian <ashod.nakashian@collabora.co.uk> | 2017-12-18 01:08:04 -0500 |
commit | 5fb3078cc992da133527a0b2f933553345c0b58e (patch) | |
tree | 39a832cbe27db435c30af7b83fcba04465e965f6 /basic | |
parent | d140cd702d6b1285c9ab7b5203feaf0e3fbf7bd8 (diff) |
convert SbDEBUG constants to o3tl::typed_flags
Change-Id: Ifcada5684bacae46ec90c5ce3e58980860fee29f
(cherry picked from commit 06dd5b9c9e34ad932b0a111c0ecb9f1e99008a19)
(cherry picked from commit 0740a13189dd0a1925489994fd542332e2e95c49)
Diffstat (limited to 'basic')
-rw-r--r-- | basic/source/classes/sb.cxx | 10 | ||||
-rw-r--r-- | basic/source/classes/sbxmod.cxx | 20 | ||||
-rw-r--r-- | basic/source/inc/runtime.hxx | 68 | ||||
-rw-r--r-- | basic/source/inc/sbintern.hxx | 4 | ||||
-rw-r--r-- | basic/source/runtime/runtime.cxx | 30 |
5 files changed, 63 insertions, 69 deletions
diff --git a/basic/source/classes/sb.cxx b/basic/source/classes/sb.cxx index b4e21a4c6e71..d03eaa35c34b 100644 --- a/basic/source/classes/sb.cxx +++ b/basic/source/classes/sb.cxx @@ -1430,7 +1430,7 @@ SbModule* StarBASIC::GetActiveModule() } } -sal_uInt16 StarBASIC::BreakPoint( sal_Int32 l, sal_Int32 c1, sal_Int32 c2 ) +BasicDebugFlags StarBASIC::BreakPoint( sal_Int32 l, sal_Int32 c1, sal_Int32 c2 ) { SetErrorData( 0, l, c1, c2 ); bBreak = true; @@ -1444,7 +1444,7 @@ sal_uInt16 StarBASIC::BreakPoint( sal_Int32 l, sal_Int32 c1, sal_Int32 c2 ) } } -sal_uInt16 StarBASIC::StepPoint( sal_Int32 l, sal_Int32 c1, sal_Int32 c2 ) +BasicDebugFlags StarBASIC::StepPoint( sal_Int32 l, sal_Int32 c1, sal_Int32 c2 ) { SetErrorData( 0, l, c1, c2 ); bBreak = false; @@ -1458,9 +1458,9 @@ sal_uInt16 StarBASIC::StepPoint( sal_Int32 l, sal_Int32 c1, sal_Int32 c2 ) } } -sal_uInt16 StarBASIC::BreakHdl() +BasicDebugFlags StarBASIC::BreakHdl() { - return aBreakHdl.IsSet() ? aBreakHdl.Call( this ) : SbDEBUG_CONTINUE; + return aBreakHdl.IsSet() ? aBreakHdl.Call( this ) : BasicDebugFlags::Continue; } // Calls for error handler and break handler @@ -1802,7 +1802,7 @@ void StarBASIC::SetGlobalErrorHdl( const Link<StarBASIC*,bool>& rLink ) GetSbData()->aErrHdl = rLink; } -void StarBASIC::SetGlobalBreakHdl( const Link<StarBASIC*,sal_uInt16>& rLink ) +void StarBASIC::SetGlobalBreakHdl( const Link<StarBASIC*,BasicDebugFlags>& rLink ) { GetSbData()->aBreakHdl = rLink; } diff --git a/basic/source/classes/sbxmod.cxx b/basic/source/classes/sbxmod.cxx index fef122064dc2..8b5b97ec3cc8 100644 --- a/basic/source/classes/sbxmod.cxx +++ b/basic/source/classes/sbxmod.cxx @@ -1181,10 +1181,10 @@ void SbModule::Run( SbMethod* pMeth ) GetSbData()->pInst->nCallLvl--; // Call-Level down again // Exist an higher-ranking runtime instance? - // Then take over SbDEBUG_BREAK, if set + // Then take over BasicDebugFlags::Break, if set SbiRuntime* pRtNext = pRt->pNext; - if( pRtNext && (pRt->GetDebugFlags() & SbDEBUG_BREAK) ) - pRtNext->SetDebugFlags( SbDEBUG_BREAK ); + if( pRtNext && (pRt->GetDebugFlags() & BasicDebugFlags::Break) ) + pRtNext->SetDebugFlags( BasicDebugFlags::Break ); delete pRt; GetSbData()->pMod = pOldMod; @@ -1558,9 +1558,9 @@ bool SbModule::SetBP( sal_uInt16 nLine ) } pBreaks->insert( pBreaks->begin() + i, nLine ); - // #38568: Set during runtime as well here SbDEBUG_BREAK + // #38568: Set during runtime as well here BasicDebugFlags::Break if( GetSbData()->pInst && GetSbData()->pInst->pRun ) - GetSbData()->pInst->pRun->SetDebugFlags( SbDEBUG_BREAK ); + GetSbData()->pInst->pRun->SetDebugFlags( BasicDebugFlags::Break ); return IsBreakable( nLine ); } @@ -1975,12 +1975,12 @@ SbMethod::SbMethod( const OUString& r, SbxDataType t, SbModule* p ) : SbxMethod( r, t ), pMod( p ) { bInvalid = true; - nStart = - nDebugFlags = - nLine1 = + nStart = 0; + nDebugFlags = BasicDebugFlags::NONE; + nLine1 = 0; nLine2 = 0; - refStatics = new SbxArray; - mCaller = nullptr; + refStatics = new SbxArray; + mCaller = nullptr; // HACK due to 'Referenz could not be saved' SetFlag( SbxFlagBits::NoModify ); } diff --git a/basic/source/inc/runtime.hxx b/basic/source/inc/runtime.hxx index 5a1e8c211d24..cf6d32a1e755 100644 --- a/basic/source/inc/runtime.hxx +++ b/basic/source/inc/runtime.hxx @@ -159,7 +159,7 @@ public: // explanation see runtime.cxx at SbiInstance::CalcBreakCallLevel() sal_uInt16 nCallLvl; sal_uInt16 nBreakCallLvl; - void CalcBreakCallLevel( sal_uInt16 nFlags ); + void CalcBreakCallLevel( BasicDebugFlags nFlags ); SbiInstance( StarBASIC* ); ~SbiInstance(); @@ -217,46 +217,46 @@ class SbiRuntime static pStep1 aStep1[]; static pStep2 aStep2[]; - StarBASIC& rBasic; // StarBASIC instance - SbiInstance* pInst; // current thread - SbModule* pMod; // current module - SbMethod* pMeth; // method instance - SbiIoSystem* pIosys; // I/O-System - const SbiImage* pImg; // Code-Image - SbxArrayRef refExprStk; // expression stack - SbxArrayRef refCaseStk; // CASE expression stack - SbxArrayRef refRedimpArray; // Array saved to use for REDIM PRESERVE - SbxVariableRef refRedim; // Array saved to use for REDIM - SbxVariableRef xDummyVar; // substitute for variables that weren't found - SbxVariable* mpExtCaller; // Caller ( external - e.g. button name, shape, range object etc. - only in vba mode ) - SbiForStack* pForStk; // FOR/NEXT-Stack - sal_uInt16 nExprLvl; // depth of the expr-stack - sal_uInt16 nForLvl; // #118235: Maintain for level + StarBASIC& rBasic; // StarBASIC instance + SbiInstance* pInst; // current thread + SbModule* pMod; // current module + SbMethod* pMeth; // method instance + SbiIoSystem* pIosys; // I/O-System + const SbiImage* pImg; // Code-Image + SbxArrayRef refExprStk; // expression stack + SbxArrayRef refCaseStk; // CASE expression stack + SbxArrayRef refRedimpArray; // Array saved to use for REDIM PRESERVE + SbxVariableRef refRedim; // Array saved to use for REDIM + SbxVariableRef xDummyVar; // substitute for variables that weren't found + SbxVariable* mpExtCaller; // Caller ( external - e.g. button name, shape, range object etc. - only in vba mode ) + SbiForStack* pForStk; // FOR/NEXT-Stack + sal_uInt16 nExprLvl; // depth of the expr-stack + sal_uInt16 nForLvl; // #118235: Maintain for level const sal_uInt8* pCode; // current Code-Pointer const sal_uInt8* pStmnt; // beginning of the last statement const sal_uInt8* pError; // address of the current error handler const sal_uInt8* pRestart; // restart-address const sal_uInt8* pErrCode; // restart-adresse RESUME NEXT const sal_uInt8* pErrStmnt; // Restart-Adresse RESUME 0 - OUString aLibName; // Lib-name for declare-call - SbxArrayRef refParams; // current procedure parameters - SbxArrayRef refLocals; // local variable - SbxArrayRef refArgv; + OUString aLibName; // Lib-name for declare-call + SbxArrayRef refParams; // current procedure parameters + SbxArrayRef refLocals; // local variable + SbxArrayRef refArgv; // #74254, one refSaveObj is not enough! new: pRefSaveList (see above) - short nArgc; - bool bRun; - bool bError; // true: handle errors - bool bInError; // true: in an error handler - bool bBlocked; // true: blocked by next call level, #i48868 - bool bVBAEnabled; - sal_uInt16 nFlags; // Debugging-Flags - SbError nError; - sal_uInt16 nOps; // opcode counter - sal_uInt32 m_nLastTime; + short nArgc; + bool bRun; + bool bError; // true: handle errors + bool bInError; // true: in an error handler + bool bBlocked; // true: blocked by next call level, #i48868 + bool bVBAEnabled; + BasicDebugFlags nFlags; // Debugging-Flags + SbError nError; + sal_uInt16 nOps; // opcode counter + sal_uInt32 m_nLastTime; std::vector<SbxVariableRef> aRefSaved; // #74254 save temporary references - std::vector<SbiGosub> pGosubStk; // GOSUB stack - std::vector<SbiArgv> pArgvStk; // ARGV-Stack + std::vector<SbiGosub> pGosubStk; // GOSUB stack + std::vector<SbiArgv> pArgvStk; // ARGV-Stack SbxVariable* FindElement @@ -364,8 +364,8 @@ public: void block() { bBlocked = true; } void unblock() { bBlocked = false; } SbModule* GetModule() { return pMod; } - sal_uInt16 GetDebugFlags() { return nFlags; } - void SetDebugFlags( sal_uInt16 nFl ) { nFlags = nFl; } + BasicDebugFlags GetDebugFlags() { return nFlags; } + void SetDebugFlags( BasicDebugFlags nFl ) { nFlags = nFl; } SbMethod* GetCaller() { return pMeth;} SbxVariable* GetExternalCaller(){ return mpExtCaller; } diff --git a/basic/source/inc/sbintern.hxx b/basic/source/inc/sbintern.hxx index 03ce05a3b2ac..900679f7b699 100644 --- a/basic/source/inc/sbintern.hxx +++ b/basic/source/inc/sbintern.hxx @@ -89,8 +89,8 @@ struct SbiGlobals SbModule* pMod; // currently active module SbModule* pCompMod; // currently compiled module short nInst; // number of BASICs - Link<StarBASIC*,bool> aErrHdl; // global error handler - Link<StarBASIC*,sal_uInt16> aBreakHdl; // global break handler + Link<StarBASIC*,bool> aErrHdl; // global error handler + Link<StarBASIC*,BasicDebugFlags> aBreakHdl; // global break handler SbError nCode; sal_Int32 nLine; sal_Int32 nCol1,nCol2; // from... to... diff --git a/basic/source/runtime/runtime.cxx b/basic/source/runtime/runtime.cxx index 67108d849f31..030a75f39986 100644 --- a/basic/source/runtime/runtime.cxx +++ b/basic/source/runtime/runtime.cxx @@ -283,26 +283,20 @@ SbiRTLData::~SbiRTLData() // (also have a look at: step2.cxx, SbiRuntime::StepSTMNT() ) -void SbiInstance::CalcBreakCallLevel( sal_uInt16 nFlags ) +void SbiInstance::CalcBreakCallLevel( BasicDebugFlags nFlags ) { - nFlags &= ~((sal_uInt16)SbDEBUG_BREAK); + nFlags &= ~BasicDebugFlags::Break; sal_uInt16 nRet; - switch( nFlags ) - { - case SbDEBUG_STEPINTO: + if (nFlags == BasicDebugFlags::StepInto) { nRet = nCallLvl + 1; // CallLevel+1 is also stopped - break; - case SbDEBUG_STEPOVER | SbDEBUG_STEPINTO: + } else if (nFlags == (BasicDebugFlags::StepOver | BasicDebugFlags::StepInto)) { nRet = nCallLvl; // current CallLevel is stopped - break; - case SbDEBUG_STEPOUT: + } else if (nFlags == BasicDebugFlags::StepOut) { nRet = nCallLvl - 1; // smaller CallLevel is stopped - break; - case SbDEBUG_CONTINUE: - // Basic-IDE returns 0 instead of SbDEBUG_CONTINUE, so also default=continue - default: + } else { + // Basic-IDE returns 0 instead of BasicDebugFlags::Continue, so also default=continue nRet = 0; // CallLevel is always > 0 -> no StepPoint } nBreakCallLvl = nRet; // take result @@ -448,7 +442,7 @@ SvNumberFormatter* SbiInstance::PrepareNumberFormatter( sal_uInt32 &rnStdDateIdx } -// Let engine run. If Flags == SbDEBUG_CONTINUE, take Flags over +// Let engine run. If Flags == BasicDebugFlags::Continue, take Flags over void SbiInstance::Stop() { @@ -572,7 +566,7 @@ SbiRuntime::SbiRuntime( SbModule* pm, SbMethod* pe, sal_uInt32 nStart ) : rBasic( *static_cast<StarBASIC*>(pm->pParent) ), pInst( GetSbData()->pInst ), pMod( pm ), pMeth( pe ), pImg( pMod->pImage ), mpExtCaller(nullptr), m_nLastTime(0) { - nFlags = pe ? pe->GetDebugFlags() : 0; + nFlags = pe ? pe->GetDebugFlags() : BasicDebugFlags::NONE; pIosys = pInst->GetIoSystem(); pForStk = nullptr; pError = nullptr; @@ -4228,18 +4222,18 @@ void SbiRuntime::StepSTMNT( sal_uInt32 nOp1, sal_uInt32 nOp2 ) if( pInst->nCallLvl <= pInst->nBreakCallLvl ) { StarBASIC* pStepBasic = GetCurrentBasic( &rBasic ); - sal_uInt16 nNewFlags = pStepBasic->StepPoint( nLine, nCol1, nCol2 ); + BasicDebugFlags nNewFlags = pStepBasic->StepPoint( nLine, nCol1, nCol2 ); pInst->CalcBreakCallLevel( nNewFlags ); } // break points only at STMNT-commands in a new line! else if( ( nOp1 != nOld ) - && ( nFlags & SbDEBUG_BREAK ) + && ( nFlags & BasicDebugFlags::Break ) && pMod->IsBP( static_cast<sal_uInt16>( nOp1 ) ) ) { StarBASIC* pBreakBasic = GetCurrentBasic( &rBasic ); - sal_uInt16 nNewFlags = pBreakBasic->BreakPoint( nLine, nCol1, nCol2 ); + BasicDebugFlags nNewFlags = pBreakBasic->BreakPoint( nLine, nCol1, nCol2 ); pInst->CalcBreakCallLevel( nNewFlags ); } |