*/
#include "squid.h"
+#include "Debug.h"
#include "esi/Expression.h"
+#include "profiler/Profiler.h"
+
+#if HAVE_MATH_H
+#include <math.h>
+#endif
+#if HAVE_ERRNO_H
+#include <errno.h>
+#endif
/* stack precedence rules:
* before pushing an operator onto the stack, the
return 0;
} else {
/* TODO: numeric to string conversion ? */
- debugs(86, 1, "strcmp with non-string");
+ debugs(86, DBG_IMPORTANT, "strcmp with non-string");
return -2;
}
} else if (a.valuestored == ESI_LITERAL_FLOAT) {
return 1;
} else {
/* TODO: attempt numeric converson again? */
- debugs(86, 1, "floatcomp with non float or int");
+ debugs(86, DBG_IMPORTANT, "floatcomp with non float or int");
return -2;
}
} else if (a.valuestored == ESI_LITERAL_INT) {
return 1;
} else {
/* TODO: attempt numeric converson again? */
- debugs(86, 1, "intcomp vs non float non int");
+ debugs(86, DBG_IMPORTANT, "intcomp vs non float non int");
return -2;
}
}
int
evalliteral(stackmember * stack, int *depth, int whereAmI, stackmember * candidate)
{
- debugs(86, 1, "attempt to evaluate a literal");
+ debugs(86, DBG_IMPORTANT, "attempt to evaluate a literal");
/* literals can't be evaluated */
return 1;
}
int
evalexpr(stackmember * stack, int *depth, int whereAmI, stackmember * candidate)
{
- debugs(86, 1, "attempt to evaluate a sub-expression result");
+ debugs(86, DBG_IMPORTANT, "attempt to evaluate a sub-expression result");
/* sub-scpr's can't be evaluated */
return 1;
}
-
int
evalor(stackmember * stack, int *depth, int whereAmI, stackmember * candidate)
{
/* Something wrong upstream */
return 1;
- /* debugs(86, 1, "?= " << srv.value.integral << " "); */
+ /* debugs(86, DBG_IMPORTANT, "?= " << srv.value.integral << " "); */
return 0;
-
}
int
/* Something wrong upstream */
return 1;
- /* debugs(86, 1, "?= " << srv.value.integral << " "); */
+ /* debugs(86, DBG_IMPORTANT, "?= " << srv.value.integral << " "); */
return 0;
-
}
int
/* Something wrong upstream */
return 1;
- /* debugs(86, 1, "?= " << srv.value.integral << " "); */
+ /* debugs(86, DBG_IMPORTANT, "?= " << srv.value.integral << " "); */
return 0;
-
}
int
/* Something wrong upstream */
return 1;
- /* debugs(86, 1, "?= " << srv.value.integral << " "); */
+ /* debugs(86, DBG_IMPORTANT, "?= " << srv.value.integral << " "); */
return 0;
}
/* Something wrong upstream */
return 1;
- /* debugs(86, 1, "?= " << srv.value.integral << " "); */
+ /* debugs(86, DBG_IMPORTANT, "?= " << srv.value.integral << " "); */
return 0;
}
/* Something wrong upstream */
return 1;
- /* debugs(86, 1, "?= " << srv.value.integral << " "); */
+ /* debugs(86, DBG_IMPORTANT, "?= " << srv.value.integral << " "); */
return 0;
}
int
evalstartexpr(stackmember * stack, int *depth, int whereAmI, stackmember * candidate)
{
- /* debugs(86, 1, "?("); */
+ /* debugs(86, DBG_IMPORTANT, "?("); */
if (whereAmI != *depth - 2)
/* invalid stack */
if (s == end || errno) {
/* Couldn't convert to float */
- debugs(86, 1, "failed to convert '" << s << "' to float ");
+ debugs(86, DBG_IMPORTANT, "failed to convert '" << s << "' to float ");
*endptr = origs;
} else {
debugs(86,6, "found " << rv.value.floating << " of length " << end - s);
if (s == end || errno) {
/* Couldn't convert to int */
- debugs(86, 1, "failed to convert '" << s << "' to int ");
+ debugs(86, DBG_IMPORTANT, "failed to convert '" << s << "' to int ");
*endptr = origs;
} else {
debugs(86,6, "found " << rv.value.integral << " of length " << end - s);
++t;
if (!*t) {
- debugs(86, 1, "missing end \' in '" << s << "'");
+ debugs(86, DBG_IMPORTANT, "missing end \' in '" << s << "'");
*endptr = origs;
} else {
*endptr = t + 1;
rv.precedence = 5;
rv.eval = evalequals;
} else {
- debugs(86, 1, "invalid expr '" << s << "'");
+ debugs(86, DBG_IMPORTANT, "invalid expr '" << s << "'");
*endptr = origs;
}
} else if ('<' == *s) {
rv.precedence = 1;
rv.eval = evalexpr;
} else {
- debugs(86, 1, "invalid expr '" << s << "'");
+ debugs(86, DBG_IMPORTANT, "invalid expr '" << s << "'");
*endptr = origs;
}
/* cleanup candidate and stack */
dumpstack(stack, *stackdepth);
cleanmember(candidate);
- debugs(86, 1, "invalid expression");
+ debugs(86, DBG_IMPORTANT, "invalid expression");
return 0;
}
} else {
s = end;
} else {
assert (s == end);
- debugs(86, 1, "failed parsing expression");
+ debugs(86, DBG_IMPORTANT, "failed parsing expression");
PROF_stop(esiExpressionEval);
return 0;
}
if (stack[stackdepth - 2].
eval(stack, &stackdepth, stackdepth - 2, &rv)) {
/* special case - leading operator failed */
- debugs(86, 1, "invalid expression");
+ debugs(86, DBG_IMPORTANT, "invalid expression");
PROF_stop(esiExpressionEval);
return 0;
}