summaryrefslogtreecommitdiff
path: root/src/main.cpp
blob: 50b143ee73daeec09c592b612f9b2caf7f284a61 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
#include "number.h"
#include "packedintarray.h"
#include "lexer.h"
#include "token.h"
#include "parser.h"
#include "options.h"
#include <math.h>
#include <sys/time.h>

#include <bu/sio.h>
#include <bu/streamstack.h>
using namespace Bu;

#define mathTestP( sc, anum, op, bnum, answ ) \
    Bu::println(">>%1<<").arg((Number(anum, sc) op Number(bnum, sc)).toString())

int main( int argc, char *argv[] )
{
    try
    {
    mathTestP( 5, "63.6", /, "504", "0.12619" );
    mathTestP( 5, "63.61", /, "504", "0.12621" );
    mathTestP( 7, "63.610123", /, "5041", "0.12621" );
    mathTestP( 7, "63.610123", /, "50412", "0.12621" );
//    return 0;
        Options opt( argc, argv );

        println("CliC - 0.08");
        println("Try \\exit, \\help, \\scale, and \\radix commands.");
        println("");

        Lexer lex( sioRaw );
        lex.setScale( opt.getScale() );
        lex.setRadix( opt.getRadix() );
        Parser parser( lex, sioRaw );
        parser.parse();
    }
    catch( std::exception &e )
    {
        Bu::println("Error: %1").arg( e.what() );
    }

    return 0;
}