Avoid reserved identifiers
Change-Id: I3fbc7cb107bdab770d5ce9ed3ecddb962d2d4666
This commit is contained in:
@@ -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;
|
||||
|
@@ -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);
|
||||
|
@@ -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;
|
||||
}
|
||||
|
@@ -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_ );
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -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;
|
||||
|
@@ -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 );
|
||||
sal_uInt32 nEndLbl = aGen.Gen( eTok == UNTIL ? JUMPT_ : JUMPF_, 0 );
|
||||
StmntBlock( LOOP );
|
||||
TestEoln();
|
||||
aGen.Gen( _JUMP, nStartLbl );
|
||||
aGen.Gen( 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( JUMPF_, 0 );
|
||||
StmntBlock( WEND );
|
||||
aGen.Gen( _JUMP, nStartLbl );
|
||||
aGen.Gen( 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( 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( INITFOR_ );
|
||||
}
|
||||
|
||||
sal_uInt32 nLoop = aGen.GetPC();
|
||||
// do tests, maybe free the stack
|
||||
sal_uInt32 nEndTarget = aGen.Gen( _TESTFOR, 0 );
|
||||
sal_uInt32 nEndTarget = aGen.Gen( TESTFOR_, 0 );
|
||||
OpenBlock( FOR );
|
||||
StmntBlock( NEXT );
|
||||
aGen.Gen( _NEXT );
|
||||
aGen.Gen( _JUMP, nLoop );
|
||||
aGen.Gen( NEXT_ );
|
||||
aGen.Gen( 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( 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( 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 ? JUMP_ : 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( RETURN_, nOff );
|
||||
}
|
||||
else aGen.Gen( _RETURN, 0 );
|
||||
else aGen.Gen( RETURN_, 0 );
|
||||
}
|
||||
|
||||
// SELECT CASE
|
||||
@@ -355,7 +355,7 @@ void SbiParser::Select()
|
||||
SbiExpression aCase( this );
|
||||
SbiToken eTok = NIL;
|
||||
aCase.Gen();
|
||||
aGen.Gen( _CASE );
|
||||
aGen.Gen( 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,
|
||||
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( CASETO_, nTrueTarget );
|
||||
}
|
||||
else
|
||||
// CASE a
|
||||
nTrueTarget = aGen.Gen( _CASEIS, nTrueTarget, SbxEQ );
|
||||
nTrueTarget = aGen.Gen( CASEIS_, nTrueTarget, SbxEQ );
|
||||
|
||||
}
|
||||
if( Peek() == COMMA ) Next();
|
||||
@@ -428,7 +428,7 @@ void SbiParser::Select()
|
||||
|
||||
if( !bElse )
|
||||
{
|
||||
nNextTarget = aGen.Gen( _JUMP, nNextTarget );
|
||||
nNextTarget = aGen.Gen( 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( 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( ENDCASE_ );
|
||||
}
|
||||
|
||||
// ON Error/Variable
|
||||
@@ -489,12 +489,12 @@ void SbiParser::On()
|
||||
{
|
||||
if( eCurTok == NUMBER && !nVal )
|
||||
{
|
||||
aGen.Gen( _STDERROR );
|
||||
aGen.Gen( STDERROR_ );
|
||||
}
|
||||
else
|
||||
{
|
||||
sal_uInt32 nOff = pProc->GetLabels().Reference( aSym );
|
||||
aGen.Gen( _ERRHDL, nOff );
|
||||
aGen.Gen( ERRHDL_, nOff );
|
||||
}
|
||||
}
|
||||
else if( eCurTok == MINUS )
|
||||
@@ -502,7 +502,7 @@ void SbiParser::On()
|
||||
Next();
|
||||
if( eCurTok == NUMBER && nVal == 1 )
|
||||
{
|
||||
aGen.Gen( _STDERROR );
|
||||
aGen.Gen( STDERROR_ );
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -517,7 +517,7 @@ void SbiParser::On()
|
||||
else if( eCurTok == RESUME )
|
||||
{
|
||||
TestToken( NEXT );
|
||||
aGen.Gen( _NOERROR );
|
||||
aGen.Gen( 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( RESUME_, 0 );
|
||||
break;
|
||||
case NEXT:
|
||||
aGen.Gen( _RESUME, 1 );
|
||||
aGen.Gen( RESUME_, 1 );
|
||||
Next();
|
||||
break;
|
||||
case NUMBER:
|
||||
if( !nVal )
|
||||
{
|
||||
aGen.Gen( _RESUME, 0 );
|
||||
aGen.Gen( RESUME_, 0 );
|
||||
break;
|
||||
} // fall through
|
||||
case SYMBOL:
|
||||
if( MayBeLabel() )
|
||||
{
|
||||
nLbl = pProc->GetLabels().Reference( aSym );
|
||||
aGen.Gen( _RESUME, nLbl );
|
||||
aGen.Gen( RESUME_, nLbl );
|
||||
Next();
|
||||
break;
|
||||
} // fall through
|
||||
|
@@ -140,7 +140,7 @@ SbiParser::SbiParser( StarBASIC* pb, SbModule* pm )
|
||||
aGlobals.SetParent( &aRtlSyms );
|
||||
|
||||
|
||||
nGblChain = aGen.Gen( _JUMP, 0 );
|
||||
nGblChain = aGen.Gen( 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( 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( 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( 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( 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( GET_ );
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -535,17 +535,17 @@ void SbiParser::Symbol( const KeywordSymbolInfo* pKeywordSymbolInfo )
|
||||
TestToken( EQ );
|
||||
SbiExpression aExpr( this );
|
||||
aExpr.Gen();
|
||||
SbiOpcode eOp = _PUT;
|
||||
SbiOpcode eOp = PUT_;
|
||||
if( pDef )
|
||||
{
|
||||
if( pDef->GetConstDef() )
|
||||
Error( ERRCODE_BASIC_DUPLICATE_DEF, pDef->GetName() );
|
||||
if( pDef->GetType() == SbxOBJECT )
|
||||
{
|
||||
eOp = _SET;
|
||||
eOp = SET_;
|
||||
if( pDef->GetTypeId() )
|
||||
{
|
||||
aGen.Gen( _SETCLASS, pDef->GetTypeId() );
|
||||
aGen.Gen( 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( PAD_, nLen );
|
||||
aGen.Gen( 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( CREATE_, pDef->GetId(), pTypeDef->GetTypeId() );
|
||||
aGen.Gen( SETCLASS_, pDef->GetTypeId() );
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -613,16 +613,16 @@ void SbiParser::Set()
|
||||
if( pDef->GetTypeId() )
|
||||
{
|
||||
if ( bVBASupportOn )
|
||||
aGen.Gen( _VBASETCLASS, pDef->GetTypeId() );
|
||||
aGen.Gen( VBASETCLASS_, pDef->GetTypeId() );
|
||||
else
|
||||
aGen.Gen( _SETCLASS, pDef->GetTypeId() );
|
||||
aGen.Gen( SETCLASS_, pDef->GetTypeId() );
|
||||
}
|
||||
else
|
||||
{
|
||||
if ( bVBASupportOn )
|
||||
aGen.Gen( _VBASET );
|
||||
aGen.Gen( VBASET_ );
|
||||
else
|
||||
aGen.Gen( _SET );
|
||||
aGen.Gen( SET_ );
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -644,7 +644,7 @@ void SbiParser::LSet()
|
||||
SbiExpression aExpr( this );
|
||||
aLvalue.Gen();
|
||||
aExpr.Gen();
|
||||
aGen.Gen( _LSET );
|
||||
aGen.Gen( LSET_ );
|
||||
}
|
||||
|
||||
// JSM 07.10.95
|
||||
@@ -662,7 +662,7 @@ void SbiParser::RSet()
|
||||
SbiExpression aExpr( this );
|
||||
aLvalue.Gen();
|
||||
aExpr.Gen();
|
||||
aGen.Gen( _RSET );
|
||||
aGen.Gen( RSET_ );
|
||||
}
|
||||
|
||||
// DEFINT, DEFLNG, DEFSNG, DEFDBL, DEFSTR and so on
|
||||
@@ -702,7 +702,7 @@ void SbiParser::DefXXX()
|
||||
|
||||
void SbiParser::Stop()
|
||||
{
|
||||
aGen.Gen( _STOP );
|
||||
aGen.Gen( STOP_ );
|
||||
Peek(); // #35694: only Peek(), so that EOL is recognized in Single-Line-If
|
||||
}
|
||||
|
||||
@@ -855,7 +855,7 @@ void SbiParser::AddConstants()
|
||||
addStringConst( aPublics, "vbCrLf", "\x0D\x0A" );
|
||||
addStringConst( aPublics, "vbFormFeed", "\x0C" );
|
||||
addStringConst( aPublics, "vbLf", "\x0A" );
|
||||
#ifndef _WIN32
|
||||
#ifndef WIN32_
|
||||
addStringConst( aPublics, "vbNewLine", "\x0D\x0A" );
|
||||
#else
|
||||
addStringConst( aPublics, "vbNewLine", "\x0A" );
|
||||
@@ -875,7 +875,7 @@ void SbiParser::ErrorStmnt()
|
||||
{
|
||||
SbiExpression aPar( this );
|
||||
aPar.Gen();
|
||||
aGen.Gen( _ERROR );
|
||||
aGen.Gen( ERROR_ );
|
||||
}
|
||||
|
||||
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|
||||
|
@@ -27,133 +27,133 @@
|
||||
|
||||
enum SbiOpcode {
|
||||
// all opcodes without operands
|
||||
_NOP = 0,
|
||||
NOP_ = 0,
|
||||
|
||||
SbOP0_START = _NOP,
|
||||
SbOP0_START = NOP_,
|
||||
|
||||
// operators
|
||||
// the following operators are ordered
|
||||
// the same way as the enum SbxVarOp
|
||||
_EXP, _MUL, _DIV, _MOD, _PLUS, _MINUS, _NEG,
|
||||
_EQ, _NE, _LT, _GT, _LE, _GE,
|
||||
_IDIV, _AND, _OR, _XOR, _EQV, _IMP, _NOT,
|
||||
_CAT,
|
||||
EXP_, MUL_, DIV_, MOD_, PLUS_, MINUS_, NEG_,
|
||||
EQ_, NE_, LT_, GT_, LE_, GE_,
|
||||
IDIV_, AND_, OR_, XOR_, EQV_, IMP_, NOT_,
|
||||
CAT_,
|
||||
// end of enum SbxVarOp
|
||||
_LIKE, _IS,
|
||||
LIKE_, IS_,
|
||||
// load/save
|
||||
_ARGC, // establish new Argv
|
||||
_ARGV, // TOS ==> current Argv
|
||||
_INPUT, // Input ==> TOS
|
||||
_LINPUT, // Line Input ==> TOS
|
||||
_GET, // touch TOS
|
||||
_SET, // save object TOS ==> TOS-1
|
||||
_PUT, // TOS ==> TOS-1
|
||||
_PUTC, // TOS ==> TOS-1, then ReadOnly
|
||||
_DIM, // DIM
|
||||
_REDIM, // REDIM
|
||||
_REDIMP, // REDIM PRESERVE
|
||||
_ERASE, // delete TOS
|
||||
ARGC_, // establish new Argv
|
||||
ARGV_, // TOS ==> current Argv
|
||||
INPUT_, // Input ==> TOS
|
||||
LINPUT_, // Line Input ==> TOS
|
||||
GET_, // touch TOS
|
||||
SET_, // save object TOS ==> TOS-1
|
||||
PUT_, // TOS ==> TOS-1
|
||||
PUTC_, // TOS ==> TOS-1, then ReadOnly
|
||||
DIM_, // DIM
|
||||
REDIM_, // REDIM
|
||||
REDIMP_, // REDIM PRESERVE
|
||||
ERASE_, // delete TOS
|
||||
// branch
|
||||
_STOP, // end of program
|
||||
_INITFOR, // initialize FOR-variable
|
||||
_NEXT, // increment FOR-variable
|
||||
_CASE, // beginning CASE
|
||||
_ENDCASE, // end CASE
|
||||
_STDERROR, // standard error handling
|
||||
_NOERROR, // no error handling
|
||||
_LEAVE, // leave UP
|
||||
STOP_, // end of program
|
||||
INITFOR_, // initialize FOR-variable
|
||||
NEXT_, // increment FOR-variable
|
||||
CASE_, // beginning CASE
|
||||
ENDCASE_, // end CASE
|
||||
STDERROR_, // standard error handling
|
||||
NOERROR_, // no error handling
|
||||
LEAVE_, // leave UP
|
||||
// E/A
|
||||
_CHANNEL, // TOS = channel number
|
||||
_BPRINT, // print TOS
|
||||
_PRINTF, // print TOS in field
|
||||
_BWRITE, // write TOS
|
||||
_RENAME, // Rename Tos+1 to Tos
|
||||
_PROMPT, // TOS = Prompt for Input
|
||||
_RESTART, // define restart point
|
||||
_CHAN0, // I/O-channel 0
|
||||
CHANNEL_, // TOS = channel number
|
||||
BPRINT_, // print TOS
|
||||
PRINTF_, // print TOS in field
|
||||
BWRITE_, // write TOS
|
||||
RENAME_, // Rename Tos+1 to Tos
|
||||
PROMPT_, // TOS = Prompt for Input
|
||||
RESTART_, // define restart point
|
||||
CHAN0_, // I/O-channel 0
|
||||
// miscellaneous
|
||||
_EMPTY, // empty expression on stack
|
||||
_ERROR, // TOS = error code
|
||||
_LSET, // saving object TOS ==> TOS-1
|
||||
_RSET, // saving object TOS ==> TOS-1
|
||||
_REDIMP_ERASE, // Copies array to be later used by REDIM PRESERVE before erasing it
|
||||
_INITFOREACH,
|
||||
_VBASET, // VBA-like Set
|
||||
_ERASE_CLEAR, // Erase array and clear variable
|
||||
_ARRAYACCESS, // Assign parameters to TOS and get value, used for array of arrays
|
||||
_BYVAL, // byref -> byval for lvalue parameter passed in call
|
||||
EMPTY_, // empty expression on stack
|
||||
ERROR_, // TOS = error code
|
||||
LSET_, // saving object TOS ==> TOS-1
|
||||
RSET_, // saving object TOS ==> TOS-1
|
||||
REDIMP_ERASE_, // Copies array to be later used by REDIM PRESERVE before erasing it
|
||||
INITFOREACH_,
|
||||
VBASET_, // VBA-like Set
|
||||
ERASE_CLEAR_, // Erase array and clear variable
|
||||
ARRAYACCESS_, // Assign parameters to TOS and get value, used for array of arrays
|
||||
BYVAL_, // byref -> byval for lvalue parameter passed in call
|
||||
|
||||
SbOP0_END = _BYVAL,
|
||||
SbOP0_END = BYVAL_,
|
||||
|
||||
// all opcodes with one operand
|
||||
|
||||
_NUMBER = 0x40, // loading a numeric constant (+ID)
|
||||
NUMBER_ = 0x40, // loading a numeric constant (+ID)
|
||||
|
||||
SbOP1_START = _NUMBER,
|
||||
SbOP1_START = NUMBER_,
|
||||
|
||||
_SCONST, // loading a stringconstant (+ID)
|
||||
_CONST, // Immediate Load (+ value)
|
||||
_ARGN, // saving a named Arg in Argv (+StringID)
|
||||
_PAD, // bring string to a firm length (+length)
|
||||
SCONST_, // loading a stringconstant (+ID)
|
||||
CONST_, // Immediate Load (+ value)
|
||||
ARGN_, // saving a named Arg in Argv (+StringID)
|
||||
PAD_, // bring string to a firm length (+length)
|
||||
// Verzweigungen
|
||||
_JUMP, // jump (+target)
|
||||
_JUMPT, // evaluate TOS, conditional jump (+target)
|
||||
_JUMPF, // evaluate TOS, conditional jump (+target)
|
||||
_ONJUMP, // evaluate TOS, jump into JUMP-table (+MaxVal)
|
||||
_GOSUB, // UP-call (+Target)
|
||||
_RETURN, // UP-return (+0 or Target)
|
||||
_TESTFOR, // test FOR-variable, increment (+Endlabel)
|
||||
_CASETO, // Tos+1 <= Case <= Tos, 2xremove (+Target)
|
||||
_ERRHDL, // error handler (+Offset)
|
||||
_RESUME, // Resume after errors (+0 or 1 or Label)
|
||||
JUMP_, // jump (+target)
|
||||
JUMPT_, // evaluate TOS, conditional jump (+target)
|
||||
JUMPF_, // evaluate TOS, conditional jump (+target)
|
||||
ONJUMP_, // evaluate TOS, jump into JUMP-table (+MaxVal)
|
||||
GOSUB_, // UP-call (+Target)
|
||||
RETURN_, // UP-return (+0 or Target)
|
||||
TESTFOR_, // test FOR-variable, increment (+Endlabel)
|
||||
CASETO_, // Tos+1 <= Case <= Tos, 2xremove (+Target)
|
||||
ERRHDL_, // error handler (+Offset)
|
||||
RESUME_, // Resume after errors (+0 or 1 or Label)
|
||||
// E/A
|
||||
_CLOSE, // (+channel/0)
|
||||
_PRCHAR, // (+char)
|
||||
CLOSE_, // (+channel/0)
|
||||
PRCHAR_, // (+char)
|
||||
// Verwaltung
|
||||
_SETCLASS, // test set + class names (+StringId)
|
||||
_TESTCLASS, // Check TOS class (+StringId)
|
||||
_LIB, // set lib name for declare-procs (+StringId)
|
||||
_BASED, // TOS is incremented by BASE, BASE is pushed before (+base)
|
||||
SETCLASS_, // test set + class names (+StringId)
|
||||
TESTCLASS_, // Check TOS class (+StringId)
|
||||
LIB_, // set lib name for declare-procs (+StringId)
|
||||
BASED_, // TOS is incremented by BASE, BASE is pushed before (+base)
|
||||
// type adjustment in the Argv
|
||||
_ARGTYP, // convert last parameter in Argv (+type)
|
||||
_VBASETCLASS, // VBA-like Set
|
||||
ARGTYP_, // convert last parameter in Argv (+type)
|
||||
VBASETCLASS_, // VBA-like Set
|
||||
|
||||
SbOP1_END = _VBASETCLASS,
|
||||
SbOP1_END = VBASETCLASS_,
|
||||
|
||||
// all opcodes with two operands
|
||||
|
||||
_RTL = 0x80, // load from the RTL (+StringID+Typ)
|
||||
RTL_ = 0x80, // load from the RTL (+StringID+Typ)
|
||||
|
||||
SbOP2_START = _RTL,
|
||||
SbOP2_START = RTL_,
|
||||
|
||||
_FIND, // load (+StringID+Typ)
|
||||
_ELEM, // load element (+StringID+Typ)
|
||||
_PARAM, // parameters (+Offset+Typ)
|
||||
FIND_, // load (+StringID+Typ)
|
||||
ELEM_, // load element (+StringID+Typ)
|
||||
PARAM_, // parameters (+Offset+Typ)
|
||||
// branch
|
||||
_CALL, // call DECLARE-method (+StringID+Typ)
|
||||
_CALLC, // call Cdecl-DECLARE-Method (+StringID+Typ)
|
||||
_CASEIS, // case-test (+Test-Opcode+True-Target)
|
||||
CALL_, // call DECLARE-method (+StringID+Typ)
|
||||
CALLC_, // call Cdecl-DECLARE-Method (+StringID+Typ)
|
||||
CASEIS_, // case-test (+Test-Opcode+True-Target)
|
||||
// management
|
||||
_STMNT, // begin of a statement (+Line+Col)
|
||||
STMNT_, // begin of a statement (+Line+Col)
|
||||
// E/A
|
||||
_OPEN, // (+StreamMode+Flags)
|
||||
OPEN_, // (+StreamMode+Flags)
|
||||
// objects
|
||||
_LOCAL, // define locals variables (+StringID+Typ)
|
||||
_PUBLIC, // module global variables (+StringID+Typ)
|
||||
_GLOBAL, // define global variables, public command (+StringID+Typ)
|
||||
_CREATE, // create object (+StringId+StringID)
|
||||
_STATIC, // static variable (+StringID+Typ) JSM
|
||||
_TCREATE, // create user-defined object
|
||||
_DCREATE, // create object-array (+StringId+StringID)
|
||||
_GLOBAL_P, // define global variable that's not overwritten on restarting
|
||||
LOCAL_, // define locals variables (+StringID+Typ)
|
||||
PUBLIC_, // module global variables (+StringID+Typ)
|
||||
GLOBAL_, // define global variables, public command (+StringID+Typ)
|
||||
CREATE_, // create object (+StringId+StringID)
|
||||
STATIC_, // static variable (+StringID+Typ) JSM
|
||||
TCREATE_, // create user-defined object
|
||||
DCREATE_, // create object-array (+StringId+StringID)
|
||||
GLOBAL_P_, // define global variable that's not overwritten on restarting
|
||||
// the Basic, P=PERSIST (+StringID+Typ)
|
||||
_FIND_G, // finds global variable with special treatment due to _GLOBAL_P
|
||||
_DCREATE_REDIMP, // redimension object-array (+StringId+StringID)
|
||||
_FIND_CM, // Search inside a class module (CM) to enable global search in time
|
||||
_PUBLIC_P, // Module global Variable (persisted between calls)(+StringID+Typ)
|
||||
_FIND_STATIC, // local static var lookup (+StringID+Typ)
|
||||
FIND_G_, // finds global variable with special treatment due to GLOBAL_P_
|
||||
DCREATE_REDIMP_, // redimension object-array (+StringId+StringID)
|
||||
FIND_CM_, // Search inside a class module (CM) to enable global search in time
|
||||
PUBLIC_P_, // Module global Variable (persisted between calls)(+StringID+Typ)
|
||||
FIND_STATIC_, // local static var lookup (+StringID+Typ)
|
||||
|
||||
SbOP2_END = _FIND_STATIC
|
||||
SbOP2_END = FIND_STATIC_
|
||||
};
|
||||
|
||||
#endif
|
||||
|
Reference in New Issue
Block a user