aboutsummaryrefslogtreecommitdiffstats
path: root/examples/calc_arg.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'examples/calc_arg.cpp')
-rw-r--r--examples/calc_arg.cpp22
1 files changed, 11 insertions, 11 deletions
diff --git a/examples/calc_arg.cpp b/examples/calc_arg.cpp
index 92e522c..e40669f 100644
--- a/examples/calc_arg.cpp
+++ b/examples/calc_arg.cpp
@@ -19,33 +19,33 @@ int main(int argc, char *argv[])
infix_calc::compiler cc;
cc.variables["x"] = 2.0;
cc.variables["y"] = 3.0;
- printf("Vars: %s\n", infix_calc::to_string(cc.variables).c_str());
+ printf("Vars: %s\n", rpn_calc::to_string(cc.variables).c_str());
{
- const bool pok = cc.parse (data, ::strlen(data));
- printf("Vanilla RPN: %s\n", infix_calc::to_string(cc.rpn_stack).c_str());
+ const bool pok = cc.parse(data, ::strlen(data));
+ printf("Vanilla RPN: %s\n", cc.rpn_expr.toString().c_str());
if( !pok ) {
std::cerr << "Error occurred @ parsing: " << cc.location() << std::endl;
return EXIT_FAILURE;
}
}
double res = 0.0;
- infix_calc::RPNStatus estatus = cc.eval(res);
- if( infix_calc::RPNStatus::No_Error != estatus ) {
- printf("Error occurred @ eval(Vanilla): %s\n", infix_calc::to_string(estatus).c_str());
+ rpn_calc::RPNStatus estatus = cc.eval(res);
+ if( rpn_calc::RPNStatus::No_Error != estatus ) {
+ printf("Error occurred @ eval(Vanilla): %s\n", rpn_calc::to_string(estatus).c_str());
return EXIT_FAILURE;
}
printf("Vanilla Result: %f\n", res);
estatus = cc.reduce();
- if( infix_calc::RPNStatus::No_Error != estatus ) {
- printf("Error occurred @ reduce: %s\n", infix_calc::to_string(estatus).c_str());
+ if( rpn_calc::RPNStatus::No_Error != estatus ) {
+ printf("Error occurred @ reduce: %s\n", rpn_calc::to_string(estatus).c_str());
return EXIT_FAILURE;
}
- printf("Reduced RPN: %s\n", infix_calc::to_string(cc.rpn_stack).c_str());
+ printf("Reduced RPN: %s\n", cc.rpn_expr.toString().c_str());
double res2 = 0.0;
estatus = cc.eval(res2);
- if( infix_calc::RPNStatus::No_Error != estatus ) {
- printf("Error occurred @ eval(Reduced): %s\n", infix_calc::to_string(estatus).c_str());
+ if( rpn_calc::RPNStatus::No_Error != estatus ) {
+ printf("Error occurred @ eval(Reduced): %s\n", rpn_calc::to_string(estatus).c_str());
return EXIT_FAILURE;
}
printf("Reduced Result: %f\n", res2);