aboutsummaryrefslogtreecommitdiffstats
path: root/utils/check_expr.c
diff options
context:
space:
mode:
authormurf <murf@f38db490-d61c-443f-a65b-d21fe96a405b>2007-07-05 18:15:22 +0000
committermurf <murf@f38db490-d61c-443f-a65b-d21fe96a405b>2007-07-05 18:15:22 +0000
commitc66181df6174ec0fe12727a20d343eb908cbad0c (patch)
treee547079acc9ff3f5fd41827b21146c28d72030c8 /utils/check_expr.c
parent3d7a0fea3e3c0b971b63d23184db06196dd1a771 (diff)
In regards to changes for 9508, expr2 system choking on floating point numbers, I'm adding this update to round out (no pun intended) and make this FP-capable version of the Expr2 stuff interoperate better with previous integer-only usage, by providing Functions syntax, with 20 builtin functions for floating pt to integer conversions, and some general floating point math routines that might commonly be used also. Along with this, I made it so if a function was not a builtin, it will try and find it in the ast_custom_function list, and if found, execute it and collect the results. Thus, you can call system functions like CDR(), CHANNEL(), etc, from within $\[..\] exprs, without having to wrap them in $\{...\} (curly brace) notation. Did a valgrind on the standalone and made sure there's no mem leaks. Looks good. Updated the docs, too.
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@73449 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'utils/check_expr.c')
-rw-r--r--utils/check_expr.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/utils/check_expr.c b/utils/check_expr.c
index df74b7150..7f0378b16 100644
--- a/utils/check_expr.c
+++ b/utils/check_expr.c
@@ -161,6 +161,13 @@ unsigned int check_expr(char* buffer, char* error_report)
return warn_found;
}
+struct ast_custom_function *ast_custom_function_find(const char *name);
+
+struct ast_custom_function *ast_custom_function_find(const char *name)
+{
+ return 0;
+}
+
int check_eval(char *buffer, char *error_report)
{
char *cp, *ep;
@@ -221,7 +228,7 @@ int check_eval(char *buffer, char *error_report)
*ep++ = 0;
/* now, run the test */
- result = ast_expr(evalbuf, s, sizeof(s));
+ result = ast_expr(evalbuf, s, sizeof(s),NULL);
if (result) {
sprintf(error_report,"line %d, evaluation of $[ %s ] result: %s\n", global_lineno, evalbuf, s);
return 1;