24 using namespace SeExpr2;
33 int main(
int argc,
char *argv[]) {
35 std::cerr <<
"need a filename as argument\n";
41 std::ifstream FSProfileData(argv[1], std::ifstream::in);
42 while (std::getline(FSProfileData, line)) {
43 if (!line.size() || line.at(0) ==
';')
continue;
45 string::size_type start = line.find_first_of(
'"');
47 string::size_type end = line.find_last_of(
'"');
48 string exprStr(line, start, end - start);
50 std::cout << left <<
"\n";
51 std::istringstream iss(
string(line, end + 1), std::istringstream::in);
54 std::cout <<
"exprStr: " << exprStr << std::endl;
55 std::cout <<
"dim: " << dim << std::endl;
63 const double *result = expr.
evalFP();
65 for (
int i = 0; i < dim; ++i) std::cout << result[i] <<
' ';
66 std::cout << std::endl;
69 if (!argv[2])
return 0;
70 FSProfileData.close();
73 FSProfileData.open(argv[2], std::ifstream::in);
74 while (std::getline(FSProfileData, line)) {
75 if (!line.size() || line.at(0) ==
';')
continue;
77 std::cout <<
"exprStr: " << line << std::endl;
84 const char *result = expr.
evalStr();
</pre >< h2 > Evaluating expressions</h2 > Evaluating an expression is pretty easy But before we can do that we need to make an instance< pre > GrapherExpr expr("x+x^2")
llvmexpr(const std::string &expr, const ExprType &type=ExprType().FP(3))
Constructor that takes the expression to parse.
const std::string & parseError() const
const double * evalFP(VarBlock *varBlock=nullptr) const
const char * evalStr(VarBlock *varBlock=nullptr) const
int main(int argc, char *argv[])