summaryrefslogtreecommitdiff
path: root/res/ael/ael_lex.c
diff options
context:
space:
mode:
authorSteve Murphy <murf@digium.com>2008-03-07 18:57:57 +0000
committerSteve Murphy <murf@digium.com>2008-03-07 18:57:57 +0000
commit377e51c4d4737f2fe72b92f84378c96681d18e0d (patch)
tree740aed3494bebd2dc7c2423c0aed891a4aa5237d /res/ael/ael_lex.c
parent121bc8141f1413d62eeb89b0bffcc3df406e04d7 (diff)
(closes issue #6002)
Reported by: rizzo Tested by: murf Proposal of the changes to be made, and then an announcement of how they were accomplished: http://lists.digium.com/pipermail/asterisk-dev/2008-February/032065.html and: http://lists.digium.com/pipermail/asterisk-dev/2008-March/032124.html Here is a recap, file by file, of what I have done: pbx/pbx_config.c pbx/pbx_ael.c All funcs that were passed a ptr to the context list, now will ALSO be passed a hashtab ptr to the same set. Why? because (for the time being), the dialplan is stored in both, to facilitate a quick, low-cost move to hash-tables to speed up dialplan processing. If it was deemed necessary to pass the context LIST, well, it is just as necessary to have the TABLE available. This is because the list/table in question might not be the global one, but temporary ones we would use to stage the dialplan on, and then swap into the global position when things are ready. We now have one external function for apps to use, "ast_context_find_or_create()" instead of the pre-existing "find" and "create", as all existing usages used both in tandem anyway. pbx_config, and pbx_ael, will stage the reloaded dialplan into local lists and tables, and then call merge_contexts_and_delete, which will merge (now) existing contexts and priorities from other registrars into this local set by copying them. Then, merge_contexts_and_delete will lock down the contexts, swap the lists and tables, and unlock (real quick), and then destroy the old dialplan. chan_sip.c chan_iax.c chan_skinny.c All the channel drivers that would add regcontexts now use the ast_context_find_or_create now. chan_sip also includes a small fix to get rid of warnings about removing priorities that never got entered. apps/app_meetme.c apps/app_dial.c apps/app_queue.c All the apps that added a context/exten/priority were also modified to use ast_context_find_or_create instead. include/asterisk/pbx.h ast_context_create() is removed. Find_or_create_ is the new method. ast_context_find_or_create() interface gets the hashtab added. ast_merge_contexts_and_delete() gets the local hashtab arg added. ast_wrlock_contexts_version() is added so you can detect if someone else got a writelock between your readlocking and writelocking. ast_hashtab_compare_contexts was made public for use in pbx_config/pbx_ael ast_hashtab_hash_contexts was in like fashion make public. include/asterisk/pval.h ast_compile_ael2() interface changed to include the local hashtab table ptr. main/features.c For the sake of the parking context, we use ast_context_find_or_create(). main/pbx.c I changed all the "tree" names to "table" instead. That's because the original implementation was based on binary trees. (had a free library). Then I moved to hashtabs. Now, the names move forward too. refcount field added to contexts, so you can keep track of how many modules wanted this context to exist. Some log messages that are warnings were inflated from LOG_NOTICE to LOG_WARNING. Added some calls to ast_verb(3,...) for debug messages Lots of little mods to ast_context_remove_extension2, which is now excersized in ways it was not previously; one definite bug fixed. find_or_create was upgraded to handle both local lists/tables as well as the globals. context_merge() was added to do the per-context merging of the old/present contexts/extens/prios into the new/proposed local list/tables ast_merge_contexts_and_delete() was heavily modified. ast_add_extension2() was also upgraded to handle changes. the context_destroy() code was re-engineered to handle the new way of doing things, by exten/prio instead of by context. res/ael/pval.c res/ael/ael.tab.c res/ael/ael.tab.h res/ael/ael.y res/ael/ael_lex.c res/ael/ael.flex utils/ael_main.c utils/extconf.c utils/conf2ael.c utils/Makefile Had to change the interface to ast_compile_ael2(), to include the hashtab ptr. This ended up involving several external apps. The main gotcha was I had to include lock.h and hashtab.h in several places. As a side note, I tested this stuff pretty thoroughly, I replicated the problems originally reported by Luigi, and made triply sure that reloads worked, and everything worked thru "stop gracefully". I found a and fixed a few bugs as I was merging into trunk, that did not appear in my tests of bug6002. How's this for verbose commit messages? git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@106757 65c4cc65-6c06-0410-ace0-fbb531ad65f3
Diffstat (limited to 'res/ael/ael_lex.c')
-rw-r--r--res/ael/ael_lex.c141
1 files changed, 71 insertions, 70 deletions
diff --git a/res/ael/ael_lex.c b/res/ael/ael_lex.c
index 26206af5d..8b7436374 100644
--- a/res/ael/ael_lex.c
+++ b/res/ael/ael_lex.c
@@ -803,9 +803,10 @@ ASTERISK_FILE_VERSION(__FILE__, "$Revision$")
#define GLOB_ABORTED GLOB_ABEND
#endif
# include <glob.h>
-
#include "asterisk/logger.h"
#include "asterisk/utils.h"
+#include "asterisk/lock.h"
+#include "asterisk/hashtab.h"
#include "ael/ael.tab.h"
#include "asterisk/ael_structs.h"
@@ -906,7 +907,7 @@ static void pbcwhere(const char *text, int *line, int *col )
#define STORE_POS
#define STORE_LOC
#endif
-#line 909 "ael_lex.c"
+#line 911 "ael_lex.c"
#define INITIAL 0
#define paren 1
@@ -1145,10 +1146,10 @@ YY_DECL
register int yy_act;
struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
-#line 187 "ael.flex"
+#line 189 "ael.flex"
-#line 1151 "ael_lex.c"
+#line 1153 "ael_lex.c"
yylval = yylval_param;
@@ -1239,260 +1240,260 @@ do_action: /* This label is used only to access EOF actions. */
case 1:
YY_RULE_SETUP
-#line 189 "ael.flex"
+#line 191 "ael.flex"
{ STORE_POS; return LC;}
YY_BREAK
case 2:
YY_RULE_SETUP
-#line 190 "ael.flex"
+#line 192 "ael.flex"
{ STORE_POS; return RC;}
YY_BREAK
case 3:
YY_RULE_SETUP
-#line 191 "ael.flex"
+#line 193 "ael.flex"
{ STORE_POS; return LP;}
YY_BREAK
case 4:
YY_RULE_SETUP
-#line 192 "ael.flex"
+#line 194 "ael.flex"
{ STORE_POS; return RP;}
YY_BREAK
case 5:
YY_RULE_SETUP
-#line 193 "ael.flex"
+#line 195 "ael.flex"
{ STORE_POS; return SEMI;}
YY_BREAK
case 6:
YY_RULE_SETUP
-#line 194 "ael.flex"
+#line 196 "ael.flex"
{ STORE_POS; return EQ;}
YY_BREAK
case 7:
YY_RULE_SETUP
-#line 195 "ael.flex"
+#line 197 "ael.flex"
{ STORE_POS; return COMMA;}
YY_BREAK
case 8:
YY_RULE_SETUP
-#line 196 "ael.flex"
+#line 198 "ael.flex"
{ STORE_POS; return COLON;}
YY_BREAK
case 9:
YY_RULE_SETUP
-#line 197 "ael.flex"
+#line 199 "ael.flex"
{ STORE_POS; return AMPER;}
YY_BREAK
case 10:
YY_RULE_SETUP
-#line 198 "ael.flex"
+#line 200 "ael.flex"
{ STORE_POS; return BAR;}
YY_BREAK
case 11:
YY_RULE_SETUP
-#line 199 "ael.flex"
+#line 201 "ael.flex"
{ STORE_POS; return EXTENMARK;}
YY_BREAK
case 12:
YY_RULE_SETUP
-#line 200 "ael.flex"
+#line 202 "ael.flex"
{ STORE_POS; return AT;}
YY_BREAK
case 13:
YY_RULE_SETUP
-#line 201 "ael.flex"
+#line 203 "ael.flex"
{/*comment*/}
YY_BREAK
case 14:
YY_RULE_SETUP
-#line 202 "ael.flex"
+#line 204 "ael.flex"
{ STORE_POS; return KW_CONTEXT;}
YY_BREAK
case 15:
YY_RULE_SETUP
-#line 203 "ael.flex"
+#line 205 "ael.flex"
{ STORE_POS; return KW_ABSTRACT;}
YY_BREAK
case 16:
YY_RULE_SETUP
-#line 204 "ael.flex"
+#line 206 "ael.flex"
{ STORE_POS; return KW_EXTEND;}
YY_BREAK
case 17:
YY_RULE_SETUP
-#line 205 "ael.flex"
+#line 207 "ael.flex"
{ STORE_POS; return KW_MACRO;};
YY_BREAK
case 18:
YY_RULE_SETUP
-#line 206 "ael.flex"
+#line 208 "ael.flex"
{ STORE_POS; return KW_GLOBALS;}
YY_BREAK
case 19:
YY_RULE_SETUP
-#line 207 "ael.flex"
+#line 209 "ael.flex"
{ STORE_POS; return KW_LOCAL;}
YY_BREAK
case 20:
YY_RULE_SETUP
-#line 208 "ael.flex"
+#line 210 "ael.flex"
{ STORE_POS; return KW_IGNOREPAT;}
YY_BREAK
case 21:
YY_RULE_SETUP
-#line 209 "ael.flex"
+#line 211 "ael.flex"
{ STORE_POS; return KW_SWITCH;}
YY_BREAK
case 22:
YY_RULE_SETUP
-#line 210 "ael.flex"
+#line 212 "ael.flex"
{ STORE_POS; return KW_IF;}
YY_BREAK
case 23:
YY_RULE_SETUP
-#line 211 "ael.flex"
+#line 213 "ael.flex"
{ STORE_POS; return KW_IFTIME;}
YY_BREAK
case 24:
YY_RULE_SETUP
-#line 212 "ael.flex"
+#line 214 "ael.flex"
{ STORE_POS; return KW_RANDOM;}
YY_BREAK
case 25:
YY_RULE_SETUP
-#line 213 "ael.flex"
+#line 215 "ael.flex"
{ STORE_POS; return KW_REGEXTEN;}
YY_BREAK
case 26:
YY_RULE_SETUP
-#line 214 "ael.flex"
+#line 216 "ael.flex"
{ STORE_POS; return KW_HINT;}
YY_BREAK
case 27:
YY_RULE_SETUP
-#line 215 "ael.flex"
+#line 217 "ael.flex"
{ STORE_POS; return KW_ELSE;}
YY_BREAK
case 28:
YY_RULE_SETUP
-#line 216 "ael.flex"
+#line 218 "ael.flex"
{ STORE_POS; return KW_GOTO;}
YY_BREAK
case 29:
YY_RULE_SETUP
-#line 217 "ael.flex"
+#line 219 "ael.flex"
{ STORE_POS; return KW_JUMP;}
YY_BREAK
case 30:
YY_RULE_SETUP
-#line 218 "ael.flex"
+#line 220 "ael.flex"
{ STORE_POS; return KW_RETURN;}
YY_BREAK
case 31:
YY_RULE_SETUP
-#line 219 "ael.flex"
+#line 221 "ael.flex"
{ STORE_POS; return KW_BREAK;}
YY_BREAK
case 32:
YY_RULE_SETUP
-#line 220 "ael.flex"
+#line 222 "ael.flex"
{ STORE_POS; return KW_CONTINUE;}
YY_BREAK
case 33:
YY_RULE_SETUP
-#line 221 "ael.flex"
+#line 223 "ael.flex"
{ STORE_POS; return KW_FOR;}
YY_BREAK
case 34:
YY_RULE_SETUP
-#line 222 "ael.flex"
+#line 224 "ael.flex"
{ STORE_POS; return KW_WHILE;}
YY_BREAK
case 35:
YY_RULE_SETUP
-#line 223 "ael.flex"
+#line 225 "ael.flex"
{ STORE_POS; return KW_CASE;}
YY_BREAK
case 36:
YY_RULE_SETUP
-#line 224 "ael.flex"
+#line 226 "ael.flex"
{ STORE_POS; return KW_DEFAULT;}
YY_BREAK
case 37:
YY_RULE_SETUP
-#line 225 "ael.flex"
+#line 227 "ael.flex"
{ STORE_POS; return KW_PATTERN;}
YY_BREAK
case 38:
YY_RULE_SETUP
-#line 226 "ael.flex"
+#line 228 "ael.flex"
{ STORE_POS; return KW_CATCH;}
YY_BREAK
case 39:
YY_RULE_SETUP
-#line 227 "ael.flex"
+#line 229 "ael.flex"
{ STORE_POS; return KW_SWITCHES;}
YY_BREAK
case 40:
YY_RULE_SETUP
-#line 228 "ael.flex"
+#line 230 "ael.flex"
{ STORE_POS; return KW_ESWITCHES;}
YY_BREAK
case 41:
YY_RULE_SETUP
-#line 229 "ael.flex"
+#line 231 "ael.flex"
{ STORE_POS; return KW_INCLUDES;}
YY_BREAK
case 42:
YY_RULE_SETUP
-#line 230 "ael.flex"
+#line 232 "ael.flex"
{ BEGIN(comment); my_col += 2; }
YY_BREAK
case 43:
YY_RULE_SETUP
-#line 232 "ael.flex"
+#line 234 "ael.flex"
{ my_col += yyleng; }
YY_BREAK
case 44:
/* rule 44 can match eol */
YY_RULE_SETUP
-#line 233 "ael.flex"
+#line 235 "ael.flex"
{ ++my_lineno; my_col=1;}
YY_BREAK
case 45:
YY_RULE_SETUP
-#line 234 "ael.flex"
+#line 236 "ael.flex"
{ my_col += yyleng; }
YY_BREAK
case 46:
/* rule 46 can match eol */
YY_RULE_SETUP
-#line 235 "ael.flex"
+#line 237 "ael.flex"
{ ++my_lineno; my_col=1;}
YY_BREAK
case 47:
YY_RULE_SETUP
-#line 236 "ael.flex"
+#line 238 "ael.flex"
{ my_col += 2; BEGIN(INITIAL); }
YY_BREAK
case 48:
/* rule 48 can match eol */
YY_RULE_SETUP
-#line 238 "ael.flex"
+#line 240 "ael.flex"
{ my_lineno++; my_col = 1; }
YY_BREAK
case 49:
YY_RULE_SETUP
-#line 239 "ael.flex"
+#line 241 "ael.flex"
{ my_col += yyleng; }
YY_BREAK
case 50:
YY_RULE_SETUP
-#line 240 "ael.flex"
+#line 242 "ael.flex"
{ my_col += (yyleng*8)-(my_col%8); }
YY_BREAK
case 51:
YY_RULE_SETUP
-#line 242 "ael.flex"
+#line 244 "ael.flex"
{
STORE_POS;
yylval->str = strdup(yytext);
@@ -1510,7 +1511,7 @@ YY_RULE_SETUP
case 52:
/* rule 52 can match eol */
YY_RULE_SETUP
-#line 258 "ael.flex"
+#line 260 "ael.flex"
{
if ( pbcpop(')') ) { /* error */
STORE_LOC;
@@ -1536,7 +1537,7 @@ YY_RULE_SETUP
case 53:
/* rule 53 can match eol */
YY_RULE_SETUP
-#line 280 "ael.flex"
+#line 282 "ael.flex"
{
char c = yytext[yyleng-1];
if (c == '(')
@@ -1548,7 +1549,7 @@ YY_RULE_SETUP
case 54:
/* rule 54 can match eol */
YY_RULE_SETUP
-#line 288 "ael.flex"
+#line 290 "ael.flex"
{
char c = yytext[yyleng-1];
if ( pbcpop(c)) { /* error */
@@ -1573,7 +1574,7 @@ YY_RULE_SETUP
case 55:
/* rule 55 can match eol */
YY_RULE_SETUP
-#line 310 "ael.flex"
+#line 312 "ael.flex"
{
char c = yytext[yyleng-1];
if (c == '(')
@@ -1585,7 +1586,7 @@ YY_RULE_SETUP
case 56:
/* rule 56 can match eol */
YY_RULE_SETUP
-#line 318 "ael.flex"
+#line 320 "ael.flex"
{
if ( pbcpop(')') ) { /* error */
STORE_LOC;
@@ -1613,7 +1614,7 @@ YY_RULE_SETUP
case 57:
/* rule 57 can match eol */
YY_RULE_SETUP
-#line 342 "ael.flex"
+#line 344 "ael.flex"
{
if( parencount != 0) { /* printf("Folding in a comma!\n"); */
yymore();
@@ -1631,7 +1632,7 @@ YY_RULE_SETUP
case 58:
/* rule 58 can match eol */
YY_RULE_SETUP
-#line 356 "ael.flex"
+#line 358 "ael.flex"
{
char c = yytext[yyleng-1];
if ( pbcpop(c) ) { /* error */
@@ -1652,7 +1653,7 @@ YY_RULE_SETUP
case 59:
/* rule 59 can match eol */
YY_RULE_SETUP
-#line 373 "ael.flex"
+#line 375 "ael.flex"
{
char c = yytext[yyleng-1];
yymore();
@@ -1662,7 +1663,7 @@ YY_RULE_SETUP
case 60:
/* rule 60 can match eol */
YY_RULE_SETUP
-#line 379 "ael.flex"
+#line 381 "ael.flex"
{
char c = yytext[yyleng-1];
if ( pbcpop(c) ) { /* error */
@@ -1678,7 +1679,7 @@ YY_RULE_SETUP
case 61:
/* rule 61 can match eol */
YY_RULE_SETUP
-#line 391 "ael.flex"
+#line 393 "ael.flex"
{
STORE_LOC;
yylval->str = strdup(yytext);
@@ -1691,7 +1692,7 @@ YY_RULE_SETUP
case 62:
/* rule 62 can match eol */
YY_RULE_SETUP
-#line 400 "ael.flex"
+#line 402 "ael.flex"
{
char fnamebuf[1024],*p1,*p2;
int glob_ret;
@@ -1741,7 +1742,7 @@ case YY_STATE_EOF(paren):
case YY_STATE_EOF(semic):
case YY_STATE_EOF(argg):
case YY_STATE_EOF(comment):
-#line 445 "ael.flex"
+#line 447 "ael.flex"
{
char fnamebuf[2048];
if (include_stack_index > 0 && include_stack[include_stack_index-1].globbuf_pos < include_stack[include_stack_index-1].globbuf.gl_pathc-1) {
@@ -1778,10 +1779,10 @@ case YY_STATE_EOF(comment):
YY_BREAK
case 63:
YY_RULE_SETUP
-#line 479 "ael.flex"
+#line 481 "ael.flex"
ECHO;
YY_BREAK
-#line 1784 "ael_lex.c"
+#line 1786 "ael_lex.c"
case YY_END_OF_BUFFER:
{
@@ -2906,7 +2907,7 @@ void *ael_yyrealloc (void * ptr, yy_size_t size , yyscan_t yyscanner)
#define YYTABLES_NAME "yytables"
-#line 479 "ael.flex"
+#line 481 "ael.flex"