diff options
Diffstat (limited to 'utils')
-rwxr-xr-x | utils/Makefile | 11 | ||||
-rwxr-xr-x | utils/check_expr.c | 13 |
2 files changed, 16 insertions, 8 deletions
diff --git a/utils/Makefile b/utils/Makefile index 137b0b748..2ee6a5901 100755 --- a/utils/Makefile +++ b/utils/Makefile @@ -40,6 +40,7 @@ install: clean: rm -f *.o astman smsq stereorize check_expr .depend + rm -f ast_expr2.o ast_expr2f.o astman: astman.o ../md5.o $(CC) $(CFLAGS) -o astman astman.o ../md5.o -lnewt @@ -47,8 +48,14 @@ astman: astman.o ../md5.o stereorize: stereorize.o frame.o $(CC) $(CFLAGS) -o stereorize stereorize.o frame.o -lm -check_expr : check_expr.c ../ast_expr.a - $(CC) $(CFLAGS) -o check_expr check_expr.c ../ast_expr.a +ast_expr2.o: ../ast_expr2.c + gcc -g -c -o $@ $< + +ast_expr2f.o: ../ast_expr2f.c + gcc -g -c -DSTANDALONE -o $@ $< + +check_expr: check_expr.c ast_expr2.o ast_expr2f.o + $(CC) $(CFLAGS) -o $@ $^ smsq: smsq.o $(CC) $(CFLAGS) -o smsq ${SOL} smsq.o -lpopt diff --git a/utils/check_expr.c b/utils/check_expr.c index 0814f1dae..89ff155b9 100755 --- a/utils/check_expr.c +++ b/utils/check_expr.c @@ -3,6 +3,7 @@ #include <stdarg.h> #include <string.h> #include <stdlib.h> +#include <../include/asterisk/ast_expr.h> int global_lineno = 1; int global_expr_count = 0; @@ -120,11 +121,12 @@ int check_expr(char *buffer, char *error_report) int check_eval(char *buffer, char *error_report) { - char *cp, *ep, *xp, *s; + char *cp, *ep, *xp; + char s[4096]; char evalbuf[80000]; - extern char *ast_expr(char *); int oplen = 0; int warn_found = 0; + int result; error_report[0] = 0; ep = evalbuf; @@ -179,12 +181,11 @@ int check_eval(char *buffer, char *error_report) *ep++ = 0; /* now, run the test */ - s = ast_expr(evalbuf); - if (s) { + result = ast_expr(evalbuf, s, sizeof(s)); + if (result) { sprintf(error_report,"line %d, evaluation of $[ %s ] result: %s\n", global_lineno, evalbuf, s); return 1; - } - else { + } else { sprintf(error_report,"line %d, evaluation of $[ %s ] result: ****SYNTAX ERROR****\n", global_lineno, evalbuf); return 1; } |