This finishes the changes for making Macro args LOCAL to the call, and allowing users to declare local variables.

git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@70461 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
Steve Murphy
2007-06-20 20:10:19 +00:00
parent ce2c52d519
commit c1bb0fc34b
9 changed files with 1322 additions and 1225 deletions

View File

@@ -315,6 +315,10 @@ static void print_pval(FILE *fin, pval *item, int depth)
fprintf(fin,"%s=%s;\n", item->u1.str, item->u2.val);
break;
case PV_LOCALVARDEC:
fprintf(fin,"local %s=%s;\n", item->u1.str, item->u2.val);
break;
case PV_GOTO:
fprintf(fin,"goto %s", item->u1.list->u1.str);
if ( item->u1.list->next )
@@ -565,6 +569,7 @@ void traverse_pval_item_template(pval *item, int depth)/* depth comes in handy f
break;
case PV_VARDEC:
case PV_LOCALVARDEC:
/* fields: item->u1.str == variable name
item->u2.val == variable value to assign
*/
@@ -2627,6 +2632,7 @@ void check_pval_item(pval *item, struct argapp *apps, int in_globals)
break;
case PV_VARDEC:
case PV_LOCALVARDEC:
/* fields: item->u1.str == variable name
item->u2.val == variable value to assign
*/
@@ -3064,6 +3070,17 @@ static void gen_prios(struct ael_extension *exten, char *label, pval *statement,
linkprio(exten, pr);
break;
case PV_LOCALVARDEC:
pr = new_prio();
pr->type = AEL_APPCALL;
snprintf(buf1,sizeof(buf1),"LOCAL(%s)=$[%s]", p->u1.str, p->u2.val);
pr->app = strdup("Set");
remove_spaces_before_equals(buf1);
pr->appargs = strdup(buf1);
pr->origin = p;
linkprio(exten, pr);
break;
case PV_GOTO:
pr = new_prio();
pr->type = AEL_APPCALL;
@@ -4335,6 +4352,7 @@ void destroy_pval_item(pval *item)
break;
case PV_VARDEC:
case PV_LOCALVARDEC:
/* fields: item->u1.str == variable name
item->u2.val == variable value to assign
*/