aboutsummaryrefslogtreecommitdiffstats
path: root/utils
diff options
context:
space:
mode:
authormurf <murf@f38db490-d61c-443f-a65b-d21fe96a405b>2009-03-03 23:31:54 +0000
committermurf <murf@f38db490-d61c-443f-a65b-d21fe96a405b>2009-03-03 23:31:54 +0000
commitea97fc8339ea75afb8dae68cba5e82453b87140a (patch)
treeffaa4f7a56a00b7ed7f2e023aa0d2db44a46a786 /utils
parent5d66357b7fc3d809e91f4e0e3fb4dcdaa52a3516 (diff)
Merged revisions 179973 via svnmerge from
https://origsvn.digium.com/svn/asterisk/trunk ................ r179973 | murf | 2009-03-03 15:12:02 -0700 (Tue, 03 Mar 2009) | 33 lines Merged revisions 179807 via svnmerge from https://origsvn.digium.com/svn/asterisk/branches/1.4 I had some work to do to port these changes to trunk; the check_expr stuff hasn't been updated here for quite some time, it appears. I added some more tests to the check_expr2 suite. I had to play around with the makefile a bit, etc. I added STANDALONE2 #ifdefs to ast_expr2.y so as not to conflict structure with aelparse. ........ r179807 | murf | 2009-03-03 11:11:34 -0700 (Tue, 03 Mar 2009) | 19 lines These changes allow AEL to better check ${} constructs within $[...], that are concatenated with text. I modified and added rules in ast_expr2.fl to better handle the concatenations. I added some default routines to ast_expr2.y so the standalone would compile. It also looks like I haven't run this thru bison since 2.1, so it's good to get this updated. The Makefile has comments added now for check_expr2 and check_expr to explain what they are for, and how to run them. The testexpr2s stuff has been removed, in favor of check_expr2. expr2.testinput has been updated to include the two expressions that inspired these changes (from mcnobody on #asterisk this morning) The regression has been run and all looks well. ........ ................ git-svn-id: http://svn.digium.com/svn/asterisk/branches/1.6.1@180077 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'utils')
-rw-r--r--utils/Makefile38
-rw-r--r--utils/expr2.testinput8
2 files changed, 37 insertions, 9 deletions
diff --git a/utils/Makefile b/utils/Makefile
index 478ca9dc4..db546a314 100644
--- a/utils/Makefile
+++ b/utils/Makefile
@@ -16,10 +16,21 @@ ASTTOPDIR?=..
.PHONY: clean all uninstall
-ALL_UTILS:=astman smsq stereorize streamplayer muted check_expr hashtest2 hashtest astcanary refcounter aelparse conf2ael
+# to get check_expr, add it to the ALL_UTILS list -- this is a somewhat old checking
+# program that wants an ael file for input, and will check each $[] expr for
+# possible (old) problems, like spacing around operators, which dates back to
+# the 1.2 days. The neat part is that it will actually evaluate the expressions.
+# Users could use this to quickly check expressions in their .ael file.
+# to get check_expr2, add it to the ALL_UTILS list -- this is a program that will
+# read in a file containing expressions (as if they were in $[ ]), one per line.
+# It will, of course signal any syntax errors. Devs (like murf) should use this whenever
+# changes are made to ast_expr2.y or ast_expr2.fl (or the corresponding .c files),
+# as a regression test. Others (mere mortals?) need not bother, but they are
+# more than welcome to play! The regression test itself is in expr2.testinput.
+ALL_UTILS:=astman smsq stereorize streamplayer muted hashtest2 hashtest astcanary refcounter aelparse conf2ael
UTILS:=$(ALL_UTILS)
-LIBS += $(BKTR_LIB) # astobj2 with devmode uses backtrace
+LIBS += $(BKTR_LIB) # astobj2 with devmode uses backtrace
include $(ASTTOPDIR)/Makefile.rules
@@ -73,7 +84,7 @@ clean:
rm -f *.o $(ALL_UTILS) check_expr
rm -f .*.d
rm -f *.s *.i
- rm -f md5.c strcompat.c ast_expr2.c ast_expr2f.c pbx_ael.c pval.c hashtab.c
+ rm -f md5.c strcompat.c ast_expr2.c ast_expr2.h ast_expr2f.c pbx_ael.c pval.c hashtab.c
rm -f aelparse.c aelbison.c conf2ael
rm -f utils.c threadstorage.c sha1.c astobj2.c hashtest2 hashtest refcounter
@@ -104,6 +115,10 @@ ast_expr2.c: $(ASTTOPDIR)/main/ast_expr2.c
@cp "$<" "$@"
ast_expr2.o: ASTCFLAGS+=-DSTANDALONE
+ast_expr2.h: $(ASTTOPDIR)/main/ast_expr2.h
+ $(ECHO_PREFIX) echo " [CP] $(subst $(ASTTOPDIR)/,,$<) -> $@"
+ $(CMD_PREFIX) cp "$<" "$@"
+
ast_expr2f.c: $(ASTTOPDIR)/main/ast_expr2f.c
@cp "$<" "$@"
ast_expr2f.o: ASTCFLAGS+=-DSTANDALONE -I$(ASTTOPDIR)/main -Wno-unused
@@ -125,6 +140,7 @@ aelparse.c: $(ASTTOPDIR)/res/ael/ael_lex.c
ael_main.o: ASTCFLAGS+=-DSTANDALONE
aelparse.o: ASTCFLAGS+=-I$(ASTTOPDIR)/res -DSTANDALONE -Wno-unused
+aelparse: LIBS+=-lm
aelparse: aelparse.o aelbison.o pbx_ael.o hashtab.o ael_main.o ast_expr2f.o ast_expr2.o strcompat.o pval.o extconf.o
astobj2.c: $(ASTTOPDIR)/main/astobj2.c
@@ -156,12 +172,16 @@ extconf.o: extconf.c
conf2ael: conf2ael.o ast_expr2f.o ast_expr2.o hashtab.o aelbison.o aelparse.o pbx_ael.o pval.o extconf.o strcompat.o
-testexpr2s: $(ASTTOPDIR)/main/ast_expr2f.c $(ASTTOPDIR)/main/ast_expr2.c $(ASTTOPDIR)/main/ast_expr2.h
- $(CC) -g -c -I$(ASTTOPDIR)/include -DSTANDALONE $(ASTTOPDIR)/main/ast_expr2f.c -o ast_expr2f.o
- $(CC) -g -c -I$(ASTTOPDIR)/include -DSTANDALONE $(ASTTOPDIR)/main/ast_expr2.c -o ast_expr2.o
- $(CC) -g -o testexpr2s ast_expr2f.o ast_expr2.o
- rm ast_expr2.o ast_expr2f.o
- ./testexpr2s expr2.testinput
+check_expr2: $(ASTTOPDIR)/main/ast_expr2f.c $(ASTTOPDIR)/main/ast_expr2.c $(ASTTOPDIR)/main/ast_expr2.h
+ $(ECHO_PREFIX) echo " [CC] ast_expr2f.c -> ast_expr2fz.o"
+ $(CC) -g -c -I$(ASTTOPDIR)/include -DSTANDALONE $(ASTTOPDIR)/main/ast_expr2f.c -o ast_expr2fz.o
+ $(ECHO_PREFIX) echo " [CC] ast_expr2.c -> ast_expr2z.o"
+ $(CC) -g -c -I$(ASTTOPDIR)/include -DSTANDALONE2 $(ASTTOPDIR)/main/ast_expr2.c -o ast_expr2z.o
+ $(ECHO_PREFIX) echo " [LD] ast_expr2fz.o ast_expr2z.o -> check_expr2"
+ $(CC) -g -o check_expr2 ast_expr2fz.o ast_expr2z.o -lm
+ $(ECHO_PREFIX) echo " [RM] ast_expr2fz.o ast_expr2z.o"
+ rm ast_expr2z.o ast_expr2fz.o
+ ./check_expr2 expr2.testinput
smsq: smsq.o strcompat.o
smsq: LIBS+=$(POPT_LIB)
diff --git a/utils/expr2.testinput b/utils/expr2.testinput
index 9e1532b27..8e1169be7 100644
--- a/utils/expr2.testinput
+++ b/utils/expr2.testinput
@@ -123,4 +123,12 @@ ACOS(12)
ASIN(1)
ATAN(10)
SQRT(2)*SQRT(2)
+ATAN(12) + TRUNC(2.4) *ASIN(14.3) *ACOS(1.2)
+ATAN(.912)
+TRUNC(2.4)
+ASIN(0.705)
+ACOS(.12)
+ATAN(.912) + TRUNC(2.4) - ASIN(0.705) + ACOS(.12)
MATH(3*9)
+${GLOBAL(ULKOPREFIX)}9${x}
+512059${x}