[asterisk-bugs] [Asterisk 0014629]: [patch] Add support in AEL for macro return values and direct assignment of them to variables and functions.

Asterisk Bug Tracker noreply at bugs.digium.com
Tue Jan 26 22:36:47 CST 2010


A NOTE has been added to this issue. 
====================================================================== 
https://issues.asterisk.org/view.php?id=14629 
====================================================================== 
Reported By:                Marquis
Assigned To:                
====================================================================== 
Project:                    Asterisk
Issue ID:                   14629
Category:                   PBX/pbx_ael
Reproducibility:            N/A
Severity:                   feature
Priority:                   normal
Status:                     acknowledged
Asterisk Version:           SVN 
JIRA:                       SWP-282 
Regression:                 No 
Reviewboard Link:            
SVN Branch (only for SVN checkouts, not tarball releases):  trunk 
SVN Revision (number only!):  
Request Review:              
====================================================================== 
Date Submitted:             2009-03-09 06:03 CDT
Last Modified:              2010-01-26 22:36 CST
====================================================================== 
Summary:                    [patch] Add support in AEL for macro return values
and direct assignment of them to variables and functions.
Description: 
This patch adds macro return value and simple assignment support to AEL.

This is the bug report for review request 114 as per Russell Bryant.
http://reviewboard.digium.com/r/114/
====================================================================== 

---------------------------------------------------------------------- 
 (0117229) crjw (reporter) - 2010-01-26 22:36
 https://issues.asterisk.org/view.php?id=14629#c117229 
---------------------------------------------------------------------- 
OK.
I applied macro_assignment_20100126.patch to latest trunk (version
243391M).

Now, referencing the two issues discussed on Jan 22: 

https://issues.asterisk.org/view.php?id=1: "Direct assignment of macro to
variable gives a syntax error"
This is still broken for me.  It may be a flex/bison issue (as suggested
by Marquis) but I don't know enough about flex or bison to troubleshoot
this.
#########################################################################
  WARNING[9417]:
   ast_expr2.fl:468 ast_yyerror: ast_yyerror(): file
/apps/asterisk/etc/extensions.ael, line 403, columns 8-31, variable
declaration expr '&returnmacro(1-2)': syntax error: syntax error,
unexpected '&', expecting $end; Input:
&returnmacro(1-2)
^
 WARNING[9417]:
  ast_expr2.fl:472 ast_yyerror: If you have questions, please refer to
doc/tex/channelvariables.tex in the asterisk source.
 WARNING[9417]:
  ael/pval.c:2662 check_pval_item: Warning: file
/apps/asterisk/etc/extensions.ael, line 403-403: expression
&returnmacro(1-2) has operators, but no variables. Interesting...
#########################################################################

https://issues.asterisk.org/view.php?id=2: "Arg to 'return' is subject to math
evaluation when it should not be"
I tested using 'Return(${xx}).  It works with any string. It no longer
generates a Warning.  This is nice.
I also tested using 'return ${xx}'.  This now gives a syntax error when
extensions.ael tries to load; I guess this was what you intended with the
new patch.
#########################################################################
ERROR[9417]: ael.y:840 ael_yyerror: ==== File:
/apps/asterisk/etc/extensions.ael, Line 18, Cols: 15-23: Error: syntax
error, unexpected word, expecting ';'
#########################################################################
I still think it would be best to let the parser map 'return ${xx}'
directly to 'Return(${xx})' instead of generating a syntax error.
The way it stands now:
If somebody wants to return from a macro without arguments there is a
choice of:
 'Return()'   or   'return'.
But if somebody wants to return with an argument it is necessary to use:
 'Return(arg)'.
This inconsistency may cause confusion for some! 

Issue History 
Date Modified    Username       Field                    Change               
====================================================================== 
2010-01-26 22:36 crjw           Note Added: 0117229                          
======================================================================




More information about the asterisk-bugs mailing list