From 0580d6a85fda454b05620aa4415a53f3dbcd3475 Mon Sep 17 00:00:00 2001 From: Mike Buland Date: Mon, 19 Dec 2016 15:52:04 -0700 Subject: It actually sorta' works again! --- src/scriptengine.cpp | 31 ++++++++++++++++++++++++++++--- 1 file changed, 28 insertions(+), 3 deletions(-) (limited to 'src/scriptengine.cpp') diff --git a/src/scriptengine.cpp b/src/scriptengine.cpp index e4c5c2e..6a00af8 100644 --- a/src/scriptengine.cpp +++ b/src/scriptengine.cpp @@ -105,7 +105,7 @@ void ScriptEngine::exec( Expression *pExpr ) } } - if( sigNumResult.isSet() ) + if( sigNumResult.isSet() && !sNums.isEmpty() ) sigNumResult( sNums.peekPop() ); } @@ -134,12 +134,34 @@ void ScriptEngine::command( Expression::iterator &i ) } if( sigMessage.isSet() ) sigMessage(Bu::String("Changed scale to: %1").arg( iScale )); - for( VarHash::iterator i = hVarState.begin(); i; i++ ) - (*i).setScale( iScale ); + for( VarHash::iterator j = hVarState.begin(); j; j++ ) + (*j).setScale( iScale ); + i++; } break; case Token::tCmdRadix: + { + if( !(++i) ) + { + if( sigError.isSet() ) + sigError("You must provide a positive integer."); + return; + } + int32_t iRadix = strtol( (*i).sVal->getStr(), 0, 10 ); + if( iRadix < 0 ) + { + if( sigError.isSet() ) + sigError("You must provide a positive integer."); + return; + } + if( sigMessage.isSet() ) + sigMessage(Bu::String("Changed radix to: %1").arg( iRadix )); + hVarState.clear(); +// for( VarHash::iterator i = hVarState.begin(); i; i++ ) +// (*i).setRadix( iRadix ); + i++; + } break; case Token::tCmdExtended: @@ -155,5 +177,8 @@ void ScriptEngine::command( Expression::iterator &i ) }*/ break; } + + if( (*i).eType != Token::tCmdEndParams ) + sigError("Too many parameters."); } -- cgit v1.2.3