[svn-commits] murf: trunk r41150 - in /trunk: pbx/ pbx/ael/ael-test/ pbx/ael/ael-test/ael-t...

svn-commits at lists.digium.com svn-commits at lists.digium.com
Fri Aug 25 13:43:52 MST 2006


Author: murf
Date: Fri Aug 25 15:43:51 2006
New Revision: 41150

URL: http://svn.digium.com/view/asterisk?rev=41150&view=rev
Log:
Changes to fix all problems reported in 7804 are included here.

Added:
    trunk/pbx/ael/ael-test/ael-test14/
      - copied from r41149, team/murf/bug7804/pbx/ael/ael-test/ael-test14/
    trunk/pbx/ael/ael-test/ael-test14/extensions.ael   (props changed)
      - copied unchanged from r41149, team/murf/bug7804/pbx/ael/ael-test/ael-test14/extensions.ael
    trunk/pbx/ael/ael-test/ref.ael-test14   (props changed)
      - copied unchanged from r41149, team/murf/bug7804/pbx/ael/ael-test/ref.ael-test14
Modified:
    trunk/pbx/pbx_ael.c
    trunk/utils/Makefile
    trunk/utils/ael_main.c

Propchange: trunk/pbx/ael/ael-test/ael-test14/extensions.ael
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: trunk/pbx/ael/ael-test/ael-test14/extensions.ael
------------------------------------------------------------------------------
    svn:keywords = Author Id Date Revision

Propchange: trunk/pbx/ael/ael-test/ael-test14/extensions.ael
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Propchange: trunk/pbx/ael/ael-test/ref.ael-test14
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: trunk/pbx/ael/ael-test/ref.ael-test14
------------------------------------------------------------------------------
    svn:keywords = Author Id Date Revision

Propchange: trunk/pbx/ael/ael-test/ref.ael-test14
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Modified: trunk/pbx/pbx_ael.c
URL: http://svn.digium.com/view/asterisk/trunk/pbx/pbx_ael.c?rev=41150&r1=41149&r2=41150&view=diff
==============================================================================
--- trunk/pbx/pbx_ael.c (original)
+++ trunk/pbx/pbx_ael.c Fri Aug 25 15:43:51 2006
@@ -58,11 +58,10 @@
 
 static char *config = "extensions.ael";
 static char *registrar = "pbx_ael";
+static int pbx_load_module(void);
 
 static int errs, warns;
-#ifndef STANDALONE_AEL
 static int notes;
-#endif
 
 #ifndef AAL_ARGCHECK
 /* for the time being, short circuit all the AAL related structures
@@ -1009,6 +1008,46 @@
 		e = s;
 }
 
+static int check_break(pval *item)
+{
+	pval *p = item;
+	
+	while( p && p->type != PV_MACRO && p->type != PV_CONTEXT ) /* early cutout, sort of */ {
+		/* a break is allowed in WHILE, FOR, CASE, DEFAULT, PATTERN; otherwise, it don't make
+		   no sense */
+		if( p->type == PV_CASE || p->type == PV_DEFAULT || p->type == PV_PATTERN 
+			|| p->type == PV_WHILE || p->type == PV_FOR   ) {
+			return 1;
+		}
+		p = p->dad;
+	}
+	ast_log(LOG_ERROR,"Error: file %s, line %d-%d: 'break' not in switch, for, or while statement!\n",
+			item->filename, item->startline, item->endline);
+	errs++;
+	
+	return 0;
+}
+
+static int check_continue(pval *item)
+{
+	pval *p = item;
+	
+	while( p && p->type != PV_MACRO && p->type != PV_CONTEXT ) /* early cutout, sort of */ {
+		/* a break is allowed in WHILE, FOR, CASE, DEFAULT, PATTERN; otherwise, it don't make
+		   no sense */
+		if( p->type == PV_WHILE || p->type == PV_FOR   ) {
+			return 1;
+		}
+		p = p->dad;
+	}
+	ast_log(LOG_ERROR,"Error: file %s, line %d-%d: 'continue' not in 'for' or 'while' statement!\n",
+			item->filename, item->startline, item->endline);
+	errs++;
+	
+	return 0;
+}
+
+
 /* general purpose goto finder */
 
 static void check_label(pval *item)
@@ -2092,7 +2131,6 @@
 #endif
 }
 
-#ifndef STANDALONE_AEL
 static void check_context_names(void)
 {
 	pval *i,*j;
@@ -2111,7 +2149,6 @@
 		}
 	}
 }
-#endif
 
 static void check_abstract_reference(pval *abstract_context)
 {
@@ -2438,6 +2475,7 @@
 	case PV_BREAK:
 		/* fields: none
 		*/
+		check_break(item);
 		break;
 			
 	case PV_RETURN:
@@ -2448,6 +2486,7 @@
 	case PV_CONTINUE:
 		/* fields: none
 		*/
+		check_continue(item);
 		break;
 			
 	case PV_RANDOM:
@@ -2576,7 +2615,6 @@
 	}
 }
 
-#ifndef STANDALONE_AEL
 static void ael2_semantic_check(pval *item, int *arg_errs, int *arg_warns, int *arg_notes)
 {
 	
@@ -2607,7 +2645,6 @@
 	*arg_warns = warns;
 	*arg_notes = notes;
 }
-#endif
 
 /* =============================================================================================== */
 /* "CODE" GENERATOR -- Convert the AEL representation to asterisk extension language */
@@ -3658,7 +3695,13 @@
 						exten-> return_target = np2;
 					}
 					/* is the last priority in the extension a label? Then add a trailing no-op */
-					if ( exten->plist_last->type == AEL_LABEL ) {
+					if( !exten->plist_last )
+					{
+						ast_log(LOG_WARNING, "Warning: file %s, line %d-%d: Empty Extension!\n",
+								p2->filename, p2->startline, p2->endline);
+					}
+					
+					if ( exten->plist_last && exten->plist_last->type == AEL_LABEL ) {
 						struct ael_priority *np2 = new_prio();
 						np2->type = AEL_APPCALL;
 						np2->app = strdup("NoOp");
@@ -3737,10 +3780,12 @@
 	
 }
 
-#ifndef STANDALONE_AEL
+
 static int aeldebug = 0;
 
 /* interface stuff */
+
+/* if all the below are static, who cares if they are present? */
 
 static int pbx_load_module(void)
 {
@@ -3844,12 +3889,22 @@
 	return pbx_load_module();
 }
 
+#ifdef STANDALONE_AEL
+#define AST_MODULE "ael"
+int ael_external_load_module(void);
+int ael_external_load_module(void)
+{
+	pbx_load_module();
+	return 1;
+}
+#endif
+
 AST_MODULE_INFO(ASTERISK_GPL_KEY, AST_MODFLAG_DEFAULT, "Asterisk Extension Language Compiler",
 		.load = load_module,
 		.unload = unload_module,
 		.reload = reload,
 	       );
-#endif
+
 
 /* DESTROY the PVAL tree ============================================================================ */
 

Modified: trunk/utils/Makefile
URL: http://svn.digium.com/view/asterisk/trunk/utils/Makefile?rev=41150&r1=41149&r2=41150&view=diff
==============================================================================
--- trunk/utils/Makefile (original)
+++ trunk/utils/Makefile Fri Aug 25 15:43:51 2006
@@ -68,12 +68,12 @@
 $(eval $(call ast_make_o_c,ast_expr2.o,../main/ast_expr2.c))
 
 $(eval $(call ast_make_o_c,ast_expr2f.o,../main/ast_expr2f.c))
-ast_expr2f.o: CFLAGS+=-DSTANDALONE
+ast_expr2f.o: CFLAGS+=-DSTANDALONE_AEL
 
 $(eval $(call ast_make_final,check_expr,check_expr.c ast_expr2.o ast_expr2f.o))
 
 $(eval $(call ast_make_o_c,aelflex.o,../pbx/ael/ael_lex.c ../include/asterisk/ael_structs.h ../pbx/ael/ael.tab.h))
-aelflex.o: CFLAGS+=-I../pbx -DSTANDALONE
+aelflex.o: CFLAGS+=-I../pbx -DSTANDALONE_AEL
 
 $(eval $(call ast_make_o_c,aelbison.o,../pbx/ael/ael.tab.c ../pbx/ael/ael.tab.h ../include/asterisk/ael_structs.h))
 aelbison.o: CFLAGS+=-I../pbx
@@ -86,8 +86,8 @@
 $(eval $(call ast_make_o_c,ael_main.o,ael_main.c ../include/asterisk/ael_structs.h))
 
 testexpr2s: ../main/ast_expr2f.c ../main/ast_expr2.c ../main/ast_expr2.h
-	$(CC) -g -c -I../include -DSTANDALONE ../main/ast_expr2f.c -o ast_expr2f.o
-	$(CC) -g -c -I../include -DSTANDALONE ../main/ast_expr2.c -o ast_expr2.o
+	$(CC) -g -c -I../include -DSTANDALONE_AEL ../main/ast_expr2f.c -o ast_expr2f.o
+	$(CC) -g -c -I../include -DSTANDALONE_AEL ../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

Modified: trunk/utils/ael_main.c
URL: http://svn.digium.com/view/asterisk/trunk/utils/ael_main.c?rev=41150&r1=41149&r2=41150&view=diff
==============================================================================
--- trunk/utils/ael_main.c (original)
+++ trunk/utils/ael_main.c Fri Aug 25 15:43:51 2006
@@ -119,6 +119,24 @@
 		printf("Executed ast_add_profile();\n");
 }
 
+int ast_loader_register(int (*updater)(void))
+{
+	return 1;
+}
+
+int ast_loader_unregister(int (*updater)(void))
+{
+	return 1;
+}
+void ast_module_register(const struct ast_module_info *x)
+{
+}
+
+void ast_module_unregister(const struct ast_module_info *x)
+{
+}
+
+
 void ast_cli_register_multiple(void)
 {
 	if(!no_comp)
@@ -406,6 +424,7 @@
 
 
 extern struct module_symbols mod_data;
+extern ael_external_load_module(void);
 
 int main(int argc, char **argv)
 {
@@ -455,7 +474,7 @@
 
 	FIRST_TIME = 1;
 	
-	ast_module_info->load();
+	ael_external_load_module();
 	
 	ast_log(4, "ael2_parse", __LINE__, "main", "%d contexts, %d extensions, %d priorities\n", conts, extens, priors);
 



More information about the svn-commits mailing list