aboutsummaryrefslogtreecommitdiffstats
path: root/pbx/pbx_ael.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 /pbx/pbx_ael.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 'pbx/pbx_ael.c')
-rw-r--r--pbx/pbx_ael.c16
1 files changed, 8 insertions, 8 deletions
diff --git a/pbx/pbx_ael.c b/pbx/pbx_ael.c
index d5d58b316..243193eee 100644
--- a/pbx/pbx_ael.c
+++ b/pbx/pbx_ael.c
@@ -90,7 +90,7 @@ void check_pval_item(pval *item, struct argapp *apps, int in_globals);
void check_switch_expr(pval *item, struct argapp *apps);
void ast_expr_register_extra_error_info(char *errmsg);
void ast_expr_clear_extra_error_info(void);
-int ast_expr(char *expr, char *buf, int length);
+int ast_expr(char *expr, char *buf, int length,struct ast_channel *chan);
struct pval *find_macro(char *name);
struct pval *find_context(char *name);
struct pval *find_context(char *name);
@@ -2640,7 +2640,7 @@ void check_pval_item(pval *item, struct argapp *apps, int in_globals)
if( !in_globals ) { /* don't check stuff inside the globals context; no wrapping in $[ ] there... */
snprintf(errmsg,sizeof(errmsg), "file %s, line %d, columns %d-%d, variable declaration expr '%s':", config, item->startline, item->startcol, item->endcol, item->u2.val);
ast_expr_register_extra_error_info(errmsg);
- ast_expr(item->u2.val, expr_output, sizeof(expr_output));
+ ast_expr(item->u2.val, expr_output, sizeof(expr_output),NULL);
ast_expr_clear_extra_error_info();
if ( strpbrk(item->u2.val,"~!-+<>=*/&^") && !strstr(item->u2.val,"${") ) {
ast_log(LOG_WARNING,"Warning: file %s, line %d-%d: expression %s has operators, but no variables. Interesting...\n",
@@ -2686,12 +2686,12 @@ void check_pval_item(pval *item, struct argapp *apps, int in_globals)
strp = strchr(item->u1.for_init, '=');
if (strp) {
- ast_expr(strp+1, expr_output, sizeof(expr_output));
+ ast_expr(strp+1, expr_output, sizeof(expr_output),NULL);
}
- ast_expr(item->u2.for_test, expr_output, sizeof(expr_output));
+ ast_expr(item->u2.for_test, expr_output, sizeof(expr_output),NULL);
strp = strchr(item->u3.for_inc, '=');
if (strp) {
- ast_expr(strp+1, expr_output, sizeof(expr_output));
+ ast_expr(strp+1, expr_output, sizeof(expr_output),NULL);
}
if ( strpbrk(item->u2.for_test,"~!-+<>=*/&^") && !strstr(item->u2.for_test,"${") ) {
ast_log(LOG_WARNING,"Warning: file %s, line %d-%d: expression %s has operators, but no variables. Interesting...\n",
@@ -2717,7 +2717,7 @@ void check_pval_item(pval *item, struct argapp *apps, int in_globals)
*/
snprintf(errmsg,sizeof(errmsg),"file %s, line %d, columns %d-%d, while expr '%s':", config, item->startline, item->startcol, item->endcol, item->u1.str);
ast_expr_register_extra_error_info(errmsg);
- ast_expr(item->u1.str, expr_output, sizeof(expr_output));
+ ast_expr(item->u1.str, expr_output, sizeof(expr_output),NULL);
ast_expr_clear_extra_error_info();
if ( strpbrk(item->u1.str,"~!-+<>=*/&^") && !strstr(item->u1.str,"${") ) {
ast_log(LOG_WARNING,"Warning: file %s, line %d-%d: expression %s has operators, but no variables. Interesting...\n",
@@ -2754,7 +2754,7 @@ void check_pval_item(pval *item, struct argapp *apps, int in_globals)
*/
snprintf(errmsg,sizeof(errmsg),"file %s, line %d, columns %d-%d, random expr '%s':", config, item->startline, item->startcol, item->endcol, item->u1.str);
ast_expr_register_extra_error_info(errmsg);
- ast_expr(item->u1.str, expr_output, sizeof(expr_output));
+ ast_expr(item->u1.str, expr_output, sizeof(expr_output),NULL);
ast_expr_clear_extra_error_info();
if ( strpbrk(item->u1.str,"~!-+<>=*/&^") && !strstr(item->u1.str,"${") ) {
ast_log(LOG_WARNING,"Warning: file %s, line %d-%d: random expression '%s' has operators, but no variables. Interesting...\n",
@@ -2797,7 +2797,7 @@ void check_pval_item(pval *item, struct argapp *apps, int in_globals)
*/
snprintf(errmsg,sizeof(errmsg),"file %s, line %d, columns %d-%d, if expr '%s':", config, item->startline, item->startcol, item->endcol, item->u1.str);
ast_expr_register_extra_error_info(errmsg);
- ast_expr(item->u1.str, expr_output, sizeof(expr_output));
+ ast_expr(item->u1.str, expr_output, sizeof(expr_output),NULL);
ast_expr_clear_extra_error_info();
if ( strpbrk(item->u1.str,"~!-+<>=*/&^") && !strstr(item->u1.str,"${") ) {
ast_log(LOG_WARNING,"Warning: file %s, line %d-%d: expression '%s' has operators, but no variables. Interesting...\n",