KiCad PCB EDA Suite
main.cpp File Reference
#include <stdio.h>
#include <assert.h>
#include "numeric_evaluator.h"

Go to the source code of this file.

Functions

int main ()
 

Function Documentation

int main ( )

Definition at line 25 of file main.cpp.

26 {
27  NumericEvaluator eval;
28 
29  eval.process("2.54mm+50mil");
30  if (eval.isValid()) printf("%s\n", eval.result());
31 
32  eval.process("x=1; y=5;");
33  if (eval.isValid()) printf("%s\n", eval.result());
34  eval.process("x+y");
35  if (eval.isValid()) printf("%s\n", eval.result());
36 
37  eval.setVar("posx", -3.14152);
38  bool retval = eval.process("posx");
39  assert(retval == eval.isValid());
40  if (eval.isValid()) printf("%s\n", eval.result());
41 
42  eval.process("x=1; y=2");
43  eval.setVar("z", 3);
44  eval.process("x+y+z");
45  printf("x+y+z=%s\n", eval.result());
46 
47  eval.process("1\"");
48  printf("1\" = %s\n", eval.result());
49  eval.process("12.7 - 0.1\" - 50mil");
50  printf("12.7 - 0.1\" - 50mil = %s\n", eval.result());
51 }