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: https://origsvn.digium.com/svn/asterisk/trunk@179973 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
Steve Murphy
2009-03-03 22:12:02 +00:00
parent ae786501f1
commit f47b03877b
7 changed files with 346 additions and 190 deletions

View File

@@ -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 check_expr2
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 strings.c threadstorage.c sha1.c astobj2.c hashtest2 hashtest refcounter
@@ -110,6 +121,10 @@ ast_expr2.c: $(ASTTOPDIR)/main/ast_expr2.c
$(CMD_PREFIX) 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
$(ECHO_PREFIX) echo " [CP] $(subst $(ASTTOPDIR)/,,$<) -> $@"
$(CMD_PREFIX) cp "$<" "$@"
@@ -135,6 +150,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
@@ -175,12 +191,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)

View File

@@ -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}