summaryrefslogtreecommitdiffstats
path: root/basic
diff options
context:
space:
mode:
authorStephan Bergmann <sbergman@redhat.com>2016-04-05 21:22:43 +0200
committerStephan Bergmann <sbergman@redhat.com>2016-04-06 08:31:46 +0200
commitf7a3bdf623ca0c8db81997d2b60ed4acb3b51149 (patch)
treeed2995f10be032dce3490dada57ab0e49c93e299 /basic
parentAvoid reserved identifiers (diff)
downloadcore-f7a3bdf623ca0c8db81997d2b60ed4acb3b51149.tar.gz
core-f7a3bdf623ca0c8db81997d2b60ed4acb3b51149.zip
Turn SbiOpcode into scoped enum
Change-Id: I75d808dd3a42e57e7f55bad97e24fef65bb62dc6
Diffstat (limited to 'basic')
-rw-r--r--basic/source/classes/sbxmod.cxx10
-rw-r--r--basic/source/comp/codegen.cxx34
-rw-r--r--basic/source/comp/dim.cxx92
-rw-r--r--basic/source/comp/exprgen.cxx96
-rw-r--r--basic/source/comp/io.cxx36
-rw-r--r--basic/source/comp/loops.cxx74
-rw-r--r--basic/source/comp/parser.cxx42
-rw-r--r--basic/source/inc/opcodes.hxx2
-rw-r--r--basic/source/runtime/runtime.cxx12
9 files changed, 199 insertions, 199 deletions
diff --git a/basic/source/classes/sbxmod.cxx b/basic/source/classes/sbxmod.cxx
index d0ff0fb3055c..628b5332cf1f 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 9ef2cf9ac42e..3ad73e04ce0a 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 9c822a8ea3c3..031bf81f9c1d 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 e287e110e0a2..7581d6e2029c 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 728039f882c8..6e1c161923e7 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 7e2f6f805ed8..c52113a87f40 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 847636ff9087..ca19e9593973 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 79add0e6e79b..1f10d2d84943 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 76a763391dbc..dade0d5a5610 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
{