mirror of
https://github.com/asterisk/asterisk.git
synced 2025-11-06 01:45:11 +00:00
Merged revisions 140824 via svnmerge from
https://origsvn.digium.com/svn/asterisk/trunk ........ r140824 | murf | 2008-09-03 08:01:27 -0600 (Wed, 03 Sep 2008) | 21 lines In these changes, I have added some explanation of changes to the Set and MSet apps, so people aren't so shocked and surprised when they upgrade from 1.4 to 1.6. Also, for the sake of those upgrading from 1.4 to 1.6 with AEL, I provide automatic support for the "old" way of using Set(), that still does the exact same old thing with quotes and backslashes and so on as 1.4 did, by having AEL compile in the use of MSet() instead of Set(), everywhere it inserts this code. But, if the app_set var is set to 1.6 or higher, it uses the "new", non-evaluative Set(). This only usually happens if the user manually inserts this into the asterisk.conf file, or runs the "make samples" command. (closes issue #13249) Reported by: dimas Patches: ael-MSet.diff uploaded by murf (license 17) Tested by: dimas, murf ........ git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.6.1@140886 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
File diff suppressed because it is too large
Load Diff
@@ -130,7 +130,7 @@
|
||||
|
||||
#if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED
|
||||
typedef union YYSTYPE
|
||||
#line 60 "ael.y"
|
||||
#line 59 "ael.y"
|
||||
{
|
||||
int intval; /* integer value, typically flags */
|
||||
char *str; /* strings */
|
||||
|
||||
@@ -52,7 +52,6 @@ extern char *my_file;
|
||||
int ael_is_funcname(char *name);
|
||||
#endif
|
||||
static char *ael_token_subst(const char *mess);
|
||||
static int only_one_app_set_warning = 0;
|
||||
|
||||
%}
|
||||
|
||||
@@ -242,10 +241,6 @@ global_statements : { $$ = NULL; }
|
||||
|
||||
assignment : word EQ { reset_semicount(parseio->scanner); } word SEMI {
|
||||
$$ = npval2(PV_VARDEC, &@1, &@5);
|
||||
if (!ast_compat_app_set && !only_one_app_set_warning && strchr($4,'"')) {
|
||||
ast_log(LOG_NOTICE,"Note: In asterisk.conf, in the [compat] section, the app_set is set to 1.6 or greater. The Set() function no longer removes double quotes from the value. If this is a surprise to you, you can set app_set to 1.4.\n");
|
||||
only_one_app_set_warning = 1;
|
||||
}
|
||||
$$->u1.str = $1;
|
||||
$$->u2.val = $4; }
|
||||
;
|
||||
|
||||
@@ -52,6 +52,7 @@ ASTERISK_FILE_VERSION(__FILE__, "$Revision$")
|
||||
#endif
|
||||
#include "asterisk/utils.h"
|
||||
|
||||
extern struct ast_flags ast_compat;
|
||||
extern int localized_pbx_load_module(void);
|
||||
|
||||
static char expr_output[2096];
|
||||
@@ -3361,7 +3362,11 @@ static void gen_prios(struct ael_extension *exten, char *label, pval *statement,
|
||||
if (!mother_exten->has_switch) {
|
||||
switch_set = new_prio();
|
||||
switch_set->type = AEL_APPCALL;
|
||||
switch_set->app = strdup("Set");
|
||||
if (!ast_compat_app_set) {
|
||||
switch_set->app = strdup("MSet");
|
||||
} else {
|
||||
switch_set->app = strdup("Set");
|
||||
}
|
||||
switch_set->appargs = strdup("~~EXTEN~~=${EXTEN}");
|
||||
linkprio(exten, switch_set, mother_exten);
|
||||
mother_exten->has_switch = 1;
|
||||
@@ -3375,7 +3380,11 @@ static void gen_prios(struct ael_extension *exten, char *label, pval *statement,
|
||||
if (!exten->has_switch) {
|
||||
switch_set = new_prio();
|
||||
switch_set->type = AEL_APPCALL;
|
||||
switch_set->app = strdup("Set");
|
||||
if (!ast_compat_app_set) {
|
||||
switch_set->app = strdup("MSet");
|
||||
} else {
|
||||
switch_set->app = strdup("Set");
|
||||
}
|
||||
switch_set->appargs = strdup("~~EXTEN~~=${EXTEN}");
|
||||
linkprio(exten, switch_set, mother_exten);
|
||||
exten->has_switch = 1;
|
||||
@@ -3401,7 +3410,11 @@ static void gen_prios(struct ael_extension *exten, char *label, pval *statement,
|
||||
pr = new_prio();
|
||||
pr->type = AEL_APPCALL;
|
||||
snprintf(buf1,sizeof(buf1),"%s=$[%s]", p->u1.str, p->u2.val);
|
||||
pr->app = strdup("Set");
|
||||
if (!ast_compat_app_set) {
|
||||
pr->app = strdup("MSet");
|
||||
} else {
|
||||
pr->app = strdup("Set");
|
||||
}
|
||||
remove_spaces_before_equals(buf1);
|
||||
pr->appargs = strdup(buf1);
|
||||
pr->origin = p;
|
||||
@@ -3412,7 +3425,11 @@ static void gen_prios(struct ael_extension *exten, char *label, pval *statement,
|
||||
pr = new_prio();
|
||||
pr->type = AEL_APPCALL;
|
||||
snprintf(buf1,sizeof(buf1),"LOCAL(%s)=$[%s]", p->u1.str, p->u2.val);
|
||||
pr->app = strdup("Set");
|
||||
if (!ast_compat_app_set) {
|
||||
pr->app = strdup("MSet");
|
||||
} else {
|
||||
pr->app = strdup("Set");
|
||||
}
|
||||
remove_spaces_before_equals(buf1);
|
||||
pr->appargs = strdup(buf1);
|
||||
pr->origin = p;
|
||||
@@ -3475,7 +3492,11 @@ static void gen_prios(struct ael_extension *exten, char *label, pval *statement,
|
||||
for_test->goto_false = for_end;
|
||||
for_loop->type = AEL_CONTROL1; /* simple goto */
|
||||
for_end->type = AEL_APPCALL;
|
||||
for_init->app = strdup("Set");
|
||||
if (!ast_compat_app_set) {
|
||||
for_init->app = strdup("MSet");
|
||||
} else {
|
||||
for_init->app = strdup("Set");
|
||||
}
|
||||
|
||||
strcpy(buf2,p->u1.for_init);
|
||||
remove_spaces_before_equals(buf2);
|
||||
@@ -3536,7 +3557,11 @@ static void gen_prios(struct ael_extension *exten, char *label, pval *statement,
|
||||
strncat(buf2,strp2+1, sizeof(buf2)-strlen(strp2+1)-2);
|
||||
strcat(buf2,"]");
|
||||
for_inc->appargs = strdup(buf2);
|
||||
for_inc->app = strdup("Set");
|
||||
if (!ast_compat_app_set) {
|
||||
for_inc->app = strdup("MSet");
|
||||
} else {
|
||||
for_inc->app = strdup("Set");
|
||||
}
|
||||
} else {
|
||||
strp2 = p->u3.for_inc;
|
||||
while (*strp2 && isspace(*strp2))
|
||||
@@ -4383,7 +4408,11 @@ void ast_compile_ael2(struct ast_context **local_contexts, struct ast_hashtab *l
|
||||
/* for each arg, set up a "Set" command */
|
||||
struct ael_priority *np2 = new_prio();
|
||||
np2->type = AEL_APPCALL;
|
||||
np2->app = strdup("Set");
|
||||
if (!ast_compat_app_set) {
|
||||
np2->app = strdup("MSet");
|
||||
} else {
|
||||
np2->app = strdup("Set");
|
||||
}
|
||||
snprintf(buf,sizeof(buf),"LOCAL(%s)=${ARG%d}", lp->u1.str, argc++);
|
||||
remove_spaces_before_equals(buf);
|
||||
np2->appargs = strdup(buf);
|
||||
|
||||
Reference in New Issue
Block a user