[asterisk-commits] murf: branch murf/bug_7638 r77535 - /team/murf/bug_7638/main/pval.c
SVN commits to the Asterisk project
asterisk-commits at lists.digium.com
Fri Jul 27 11:25:02 CDT 2007
Author: murf
Date: Fri Jul 27 11:25:02 2007
New Revision: 77535
URL: http://svn.digium.com/view/asterisk?view=rev&rev=77535
Log:
trying to keep this up-to-date
Modified:
team/murf/bug_7638/main/pval.c
Modified: team/murf/bug_7638/main/pval.c
URL: http://svn.digium.com/view/asterisk/team/murf/bug_7638/main/pval.c?view=diff&rev=77535&r1=77534&r2=77535
==============================================================================
--- team/murf/bug_7638/main/pval.c (original)
+++ team/murf/bug_7638/main/pval.c Fri Jul 27 11:25:02 2007
@@ -104,21 +104,6 @@
static pval *get_extension_or_contxt(pval *p);
static pval *get_contxt(pval *p);
static void remove_spaces_before_equals(char *str);
-static void substitute_commas(char *str);
-
-/* I am adding this code to substitute commas with vertbars in the args to apps */
-static void substitute_commas(char *str)
-{
- char *p = str;
- while (p && *p)
- {
- if (*p == ',' && ((p != str && *(p-1) != '\\')
- || p == str))
- *p = '|';
- p++;
- }
-}
-
/* PRETTY PRINTER FOR AEL: ============================================================================= */
@@ -233,7 +218,7 @@
}
fprintf(fin,"%s", lp->u1.str); /* usually, words are encapsulated in something else */
if (lp->u2.arglist)
- fprintf(fin,"|%s|%s|%s|%s",
+ fprintf(fin,",%s,%s,%s,%s",
lp->u2.arglist->u1.str,
lp->u2.arglist->next->u1.str,
lp->u2.arglist->next->next->u1.str,
@@ -268,9 +253,9 @@
case PV_GOTO:
fprintf(fin,"goto %s", item->u1.list->u1.str);
if ( item->u1.list->next )
- fprintf(fin,"|%s", item->u1.list->next->u1.str);
+ fprintf(fin,",%s", item->u1.list->next->u1.str);
if ( item->u1.list->next && item->u1.list->next->next )
- fprintf(fin,"|%s", item->u1.list->next->next->u1.str);
+ fprintf(fin,",%s", item->u1.list->next->next->u1.str);
fprintf(fin,"\n");
break;
@@ -1271,7 +1256,7 @@
x = find_label_in_current_context((char *)item->u1.list->u1.str, (char *)item->u1.list->next->u1.str, z);
if (!x) {
- ast_log(LOG_ERROR,"Error: file %s, line %d-%d: goto: no label %s|%s exists in the current context, or any of its inclusions!\n",
+ ast_log(LOG_ERROR,"Error: file %s, line %d-%d: goto: no label '%s,%s' exists in the current context, or any of its inclusions!\n",
item->filename, item->startline, item->endline, item->u1.list->u1.str, item->u1.list->next->u1.str );
errs++;
}
@@ -3075,16 +3060,16 @@
if (!mother_exten)
pr->appargs = strdup(p->u1.list->u1.str);
else { /* for the case of simple within-extension gotos in case/pattern/default statement blocks: */
- snprintf(buf1,sizeof(buf1),"%s|%s", mother_exten->name, p->u1.list->u1.str);
+ snprintf(buf1,sizeof(buf1),"%s,%s", mother_exten->name, p->u1.list->u1.str);
pr->appargs = strdup(buf1);
}
} else if (p->u1.list->next && !p->u1.list->next->next) /* two */ {
- snprintf(buf1,sizeof(buf1),"%s|%s", p->u1.list->u1.str, p->u1.list->next->u1.str);
+ snprintf(buf1,sizeof(buf1),"%s,%s", p->u1.list->u1.str, p->u1.list->next->u1.str);
pr->app = strdup("Goto");
pr->appargs = strdup(buf1);
} else if (p->u1.list->next && p->u1.list->next->next) {
- snprintf(buf1,sizeof(buf1),"%s|%s|%s", p->u1.list->u1.str,
+ snprintf(buf1,sizeof(buf1),"%s,%s,%s", p->u1.list->u1.str,
p->u1.list->next->u1.str,
p->u1.list->next->next->u1.str);
pr->app = strdup("Goto");
@@ -3222,7 +3207,7 @@
switch_end = new_prio();
switch_test->type = AEL_APPCALL;
switch_end->type = AEL_APPCALL;
- snprintf(buf1,sizeof(buf1),"sw-%d-%s|10",control_statement_count, p->u1.str);
+ snprintf(buf1,sizeof(buf1),"sw-%d-%s,10",control_statement_count, p->u1.str);
switch_test->app = strdup("Goto");
switch_test->appargs = strdup(buf1);
snprintf(buf1,sizeof(buf1),"Finish switch-%s-%d", label, control_statement_count);
@@ -3268,7 +3253,7 @@
fall_thru = new_prio();
fall_thru->type = AEL_APPCALL;
fall_thru->app = strdup("Goto");
- snprintf(buf1,sizeof(buf1),"sw-%d-%s|10",local_control_statement_count, p2->next->u1.str);
+ snprintf(buf1,sizeof(buf1),"sw-%d-%s,10",local_control_statement_count, p2->next->u1.str);
fall_thru->appargs = strdup(buf1);
linkprio(switch_case, fall_thru);
} else if (p2->next && p2->next->type == PV_PATTERN) {
@@ -3276,14 +3261,14 @@
fall_thru->type = AEL_APPCALL;
fall_thru->app = strdup("Goto");
gen_match_to_pattern(p2->next->u1.str, buf2);
- snprintf(buf1,sizeof(buf1),"sw-%d-%s|10", local_control_statement_count, buf2);
+ snprintf(buf1,sizeof(buf1),"sw-%d-%s,10", local_control_statement_count, buf2);
fall_thru->appargs = strdup(buf1);
linkprio(switch_case, fall_thru);
} else if (p2->next && p2->next->type == PV_DEFAULT) {
fall_thru = new_prio();
fall_thru->type = AEL_APPCALL;
fall_thru->app = strdup("Goto");
- snprintf(buf1,sizeof(buf1),"sw-%d-.|10",local_control_statement_count);
+ snprintf(buf1,sizeof(buf1),"sw-%d-.,10",local_control_statement_count);
fall_thru->appargs = strdup(buf1);
linkprio(switch_case, fall_thru);
} else if (!p2->next) {
@@ -3331,7 +3316,7 @@
fall_thru = new_prio();
fall_thru->type = AEL_APPCALL;
fall_thru->app = strdup("Goto");
- snprintf(buf1,sizeof(buf1),"sw-%d-%s|10",local_control_statement_count, p2->next->u1.str);
+ snprintf(buf1,sizeof(buf1),"sw-%d-%s,10",local_control_statement_count, p2->next->u1.str);
fall_thru->appargs = strdup(buf1);
linkprio(switch_case, fall_thru);
} else if (p2->next && p2->next->type == PV_PATTERN) {
@@ -3339,14 +3324,14 @@
fall_thru->type = AEL_APPCALL;
fall_thru->app = strdup("Goto");
gen_match_to_pattern(p2->next->u1.str, buf2);
- snprintf(buf1,sizeof(buf1),"sw-%d-%s|10",local_control_statement_count, buf2);
+ snprintf(buf1,sizeof(buf1),"sw-%d-%s,10",local_control_statement_count, buf2);
fall_thru->appargs = strdup(buf1);
linkprio(switch_case, fall_thru);
} else if (p2->next && p2->next->type == PV_DEFAULT) {
fall_thru = new_prio();
fall_thru->type = AEL_APPCALL;
fall_thru->app = strdup("Goto");
- snprintf(buf1,sizeof(buf1),"sw-%d-.|10",local_control_statement_count);
+ snprintf(buf1,sizeof(buf1),"sw-%d-.,10",local_control_statement_count);
fall_thru->appargs = strdup(buf1);
linkprio(switch_case, fall_thru);
} else if (!p2->next) {
@@ -3396,7 +3381,7 @@
fall_thru = new_prio();
fall_thru->type = AEL_APPCALL;
fall_thru->app = strdup("Goto");
- snprintf(buf1,sizeof(buf1),"sw-%d-%s|10",local_control_statement_count, p2->next->u1.str);
+ snprintf(buf1,sizeof(buf1),"sw-%d-%s,10",local_control_statement_count, p2->next->u1.str);
fall_thru->appargs = strdup(buf1);
linkprio(switch_case, fall_thru);
} else if (p2->next && p2->next->type == PV_PATTERN) {
@@ -3404,14 +3389,14 @@
fall_thru->type = AEL_APPCALL;
fall_thru->app = strdup("Goto");
gen_match_to_pattern(p2->next->u1.str, buf2);
- snprintf(buf1,sizeof(buf1),"sw-%d-%s|10",local_control_statement_count, buf2);
+ snprintf(buf1,sizeof(buf1),"sw-%d-%s,10",local_control_statement_count, buf2);
fall_thru->appargs = strdup(buf1);
linkprio(switch_case, fall_thru);
} else if (p2->next && p2->next->type == PV_DEFAULT) {
fall_thru = new_prio();
fall_thru->type = AEL_APPCALL;
fall_thru->app = strdup("Goto");
- snprintf(buf1,sizeof(buf1),"sw-%d-.|10",local_control_statement_count);
+ snprintf(buf1,sizeof(buf1),"sw-%d-.,10",local_control_statement_count);
fall_thru->appargs = strdup(buf1);
linkprio(switch_case, fall_thru);
} else if (!p2->next) {
@@ -3446,7 +3431,7 @@
case PV_MACRO_CALL:
pr = new_prio();
pr->type = AEL_APPCALL;
- snprintf(buf1,sizeof(buf1),"%s|s|1", p->u1.str);
+ snprintf(buf1,sizeof(buf1),"%s,s,1", p->u1.str);
first = 1;
for (p2 = p->u2.arglist; p2; p2 = p2->next) {
if (first)
@@ -3455,7 +3440,7 @@
first = 0;
}
else
- strcat(buf1,"|");
+ strcat(buf1,",");
strcat(buf1,p2->u1.str);
}
if (!first)
@@ -3473,8 +3458,7 @@
buf1[0] = 0;
for (p2 = p->u2.arglist; p2; p2 = p2->next) {
if (p2 != p->u2.arglist )
- strcat(buf1,"|");
- substitute_commas(p2->u1.str);
+ strcat(buf1,",");
strcat(buf1,p2->u1.str);
}
pr->app = strdup(p->u1.str);
@@ -3515,7 +3499,7 @@
if_test = new_prio();
if_test->type = AEL_IFTIME_CONTROL;
- snprintf(buf1,sizeof(buf1),"%s|%s|%s|%s",
+ snprintf(buf1,sizeof(buf1),"%s,%s,%s,%s",
p->u1.list->u1.str,
p->u1.list->next->u1.str,
p->u1.list->next->next->u1.str,
@@ -3578,7 +3562,7 @@
if_test->type = AEL_IF_CONTROL;
if_end->type = AEL_APPCALL;
if ( p->type == PV_RANDOM )
- snprintf(buf1,sizeof(buf1),"$[${RAND(0|99)} < (%s)]",p->u1.str);
+ snprintf(buf1,sizeof(buf1),"$[${RAND(0,99)} < (%s)]",p->u1.str);
else
snprintf(buf1,sizeof(buf1),"$[%s]",p->u1.str);
if_test->app = 0;
@@ -3722,7 +3706,7 @@
/* simple, unconditional goto. */
strcpy(app,"Goto");
if (pr->goto_true->origin && pr->goto_true->origin->type == PV_SWITCH ) {
- snprintf(appargs,sizeof(appargs),"%s|%d", pr->goto_true->exten->name, pr->goto_true->priority_num);
+ snprintf(appargs,sizeof(appargs),"%s,%d", pr->goto_true->exten->name, pr->goto_true->priority_num);
} else if (pr->goto_true->origin && pr->goto_true->origin->type == PV_IFTIME && pr->goto_true->origin->u3.else_statements ) {
snprintf(appargs,sizeof(appargs),"%d", pr->goto_true->priority_num+1);
} else
@@ -3834,14 +3818,14 @@
p->appargs = 0;
if (!pv2->u1.list->next) /* just one -- it won't hurt to repeat the extension */ {
- snprintf(buf1,sizeof(buf1),"%s|%s", z->name, pv2->u1.list->u1.str);
+ snprintf(buf1,sizeof(buf1),"%s,%s", z->name, pv2->u1.list->u1.str);
p->appargs = strdup(buf1);
} else if (pv2->u1.list->next && !pv2->u1.list->next->next) /* two */ {
- snprintf(buf1,sizeof(buf1),"%s|%s", z->name, pv2->u1.list->next->u1.str);
+ snprintf(buf1,sizeof(buf1),"%s,%s", z->name, pv2->u1.list->next->u1.str);
p->appargs = strdup(buf1);
} else if (pv2->u1.list->next && pv2->u1.list->next->next) {
- snprintf(buf1,sizeof(buf1),"%s|%s|%s", pv2->u1.list->u1.str,
+ snprintf(buf1,sizeof(buf1),"%s,%s,%s", pv2->u1.list->u1.str,
z->name,
pv2->u1.list->next->next->u1.str);
p->appargs = strdup(buf1);
More information about the asterisk-commits
mailing list