summaryrefslogtreecommitdiff
path: root/src/main.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/main.cpp')
-rw-r--r--src/main.cpp29
1 files changed, 28 insertions, 1 deletions
diff --git a/src/main.cpp b/src/main.cpp
index 667d19a..1365f1f 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -5,6 +5,8 @@
5#include "token.h" 5#include "token.h"
6#include "parser.h" 6#include "parser.h"
7#include "options.h" 7#include "options.h"
8#include "scriptengine.h"
9
8#include <math.h> 10#include <math.h>
9#include <sys/time.h> 11#include <sys/time.h>
10 12
@@ -14,6 +16,21 @@
14#include <bu/streamstack.h> 16#include <bu/streamstack.h>
15using namespace Bu; 17using namespace Bu;
16 18
19void numResult( const class Number &num )
20{
21 println("==> %1").arg( num );
22}
23
24void dispError( const Bu::String &sMsg )
25{
26 println(sMsg);
27}
28
29void dispMessage( const Bu::String &sMsg )
30{
31 println(sMsg);
32}
33
17int main( int argc, char *argv[] ) 34int main( int argc, char *argv[] )
18{ 35{
19 try 36 try
@@ -28,7 +45,17 @@ int main( int argc, char *argv[] )
28 lex.setScale( opt.getScale() ); 45 lex.setScale( opt.getScale() );
29 lex.setRadix( opt.getRadix() ); 46 lex.setRadix( opt.getRadix() );
30 Parser parser( lex ); 47 Parser parser( lex );
31 parser.parse(); 48
49 ScriptEngine se;
50 se.sigNumResult = Bu::slot(numResult);
51 se.sigError = Bu::slot(dispError);
52 se.sigMessage = Bu::slot(dispMessage);
53 for(;;)
54 {
55 Expression *pExpr = parser.parse();
56 se.exec( pExpr );
57 delete pExpr;
58 }
32 } 59 }
33 catch( std::exception &e ) 60 catch( std::exception &e )
34 { 61 {