[asterisk-commits] murf: branch murf/bug_7638 r49044 - in
/team/murf/bug_7638: include/asterisk/...
asterisk-commits at lists.digium.com
asterisk-commits at lists.digium.com
Thu Dec 28 17:22:39 MST 2006
Author: murf
Date: Thu Dec 28 18:22:38 2006
New Revision: 49044
URL: http://svn.digium.com/view/asterisk?view=rev&rev=49044
Log:
The beginnings of conf2ael. Very beginnings, that is. It reads extensions.conf; it traverses just the contexts and extensions; it dumps an AEL file with just contexts/extens; more to come
Added:
team/murf/bug_7638/utils/conf2ael.c (with props)
team/murf/bug_7638/utils/config_external.c (with props)
Modified:
team/murf/bug_7638/include/asterisk/ael_structs.h
team/murf/bug_7638/pbx/ael/ael.tab.c
team/murf/bug_7638/pbx/ael/ael.tab.h
team/murf/bug_7638/pbx/ael/ael.y
team/murf/bug_7638/pbx/pbx_ael.c
team/murf/bug_7638/utils/Makefile
Modified: team/murf/bug_7638/include/asterisk/ael_structs.h
URL: http://svn.digium.com/view/asterisk/team/murf/bug_7638/include/asterisk/ael_structs.h?view=diff&rev=49044&r1=49043&r2=49044
==============================================================================
--- team/murf/bug_7638/include/asterisk/ael_structs.h (original)
+++ team/murf/bug_7638/include/asterisk/ael_structs.h Thu Dec 28 18:22:38 2006
@@ -120,8 +120,6 @@
typedef struct pval pval;
#if 0
-pval *npval(pvaltype type, int first_line, int last_line, int first_column, int last_column);
-void linku1(pval *head, pval *tail);
void print_pval_list(FILE *f, pval *item, int depth);
void print_pval(FILE *f, pval *item, int depth);
void ael2_semantic_check(pval *item, int *errs, int *warns, int *notes);
@@ -129,11 +127,13 @@
struct pval *find_label_in_current_extension(char *label);
int count_labels_in_current_context(char *label);
struct pval *find_label_in_current_db(char *context, char *exten, char *label);
+#endif
+pval *npval(pvaltype type, int first_line, int last_line, int first_column, int last_column);
+pval *linku1(pval *head, pval *tail);
void ael2_print(char *fname, pval *tree);
-#endif
struct pval *ael2_parse(char *fname, int *errs); /* in ael.flex */
void destroy_pval(pval *item);
-
+
extern char *prev_word; /* in ael.flex */
#ifndef YY_TYPEDEF_YY_SCANNER_T
Modified: team/murf/bug_7638/pbx/ael/ael.tab.c
URL: http://svn.digium.com/view/asterisk/team/murf/bug_7638/pbx/ael/ael.tab.c?view=diff&rev=49044&r1=49043&r2=49044
==============================================================================
--- team/murf/bug_7638/pbx/ael/ael.tab.c (original)
+++ team/murf/bug_7638/pbx/ael/ael.tab.c Thu Dec 28 18:22:38 2006
@@ -1,7 +1,9 @@
-/* A Bison parser, made by GNU Bison 2.1a. */
-
-/* Skeleton parser for Yacc-like parsing with Bison,
- Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005, 2006 Free Software Foundation, Inc.
+/* A Bison parser, made by GNU Bison 2.3. */
+
+/* Skeleton implementation for Bison's Yacc-like parsers in C
+
+ Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005, 2006
+ Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -18,10 +20,18 @@
Foundation, Inc., 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301, USA. */
-/* As a special exception, when this file is copied by Bison into a
- Bison output file, you may use that output file without restriction.
- This special exception was added by the Free Software Foundation
- in version 1.24 of Bison. */
+/* As a special exception, you may create a larger work that contains
+ part or all of the Bison parser skeleton and distribute that work
+ under terms of your choice, so long as that work isn't itself a
+ parser generator using the skeleton or a modified version thereof
+ as a parser skeleton. Alternatively, if you modify or redistribute
+ the parser skeleton itself, you may (at your option) remove this
+ special exception, which will cause the skeleton and the resulting
+ Bison output files to be licensed under the GNU General Public
+ License without this special exception.
+
+ This special exception was added by the Free Software Foundation in
+ version 2.2 of Bison. */
/* C LALR(1) parser skeleton written by Richard Stallman, by
simplifying the original so-called "semantic" parser. */
@@ -37,7 +47,7 @@
#define YYBISON 1
/* Bison version. */
-#define YYBISON_VERSION "2.1a"
+#define YYBISON_VERSION "2.3"
/* Skeleton name. */
#define YYSKELETON_NAME "yacc.c"
@@ -186,12 +196,12 @@
#include "asterisk/logger.h"
#include "asterisk/ael_structs.h"
-static pval * linku1(pval *head, pval *tail);
+pval * linku1(pval *head, pval *tail);
static void set_dads(pval *dad, pval *child_list);
void reset_parencount(yyscan_t yyscanner);
void reset_semicount(yyscan_t yyscanner);
void reset_argcount(yyscan_t yyscanner );
-
+
#define YYLEX_PARAM ((struct parse_io *)parseio)->scanner
#define YYERROR_VERBOSE 1
@@ -229,8 +239,8 @@
char *str; /* strings */
struct pval *pval; /* full objects */
}
-/* Line 198 of yacc.c. */
-#line 234 "ael.tab.c"
+/* Line 193 of yacc.c. */
+#line 244 "ael.tab.c"
YYSTYPE;
# define yystype YYSTYPE /* obsolescent; will be withdrawn */
# define YYSTYPE_IS_DECLARED 1
@@ -259,7 +269,7 @@
int ael_yylex (YYSTYPE * yylval_param, YYLTYPE * yylloc_param , void * yyscanner);
/* create a new object with start-end marker */
-static pval *npval(pvaltype type, int first_line, int last_line,
+pval *npval(pvaltype type, int first_line, int last_line,
int first_column, int last_column);
/* create a new object with start-end marker, simplified interface.
@@ -274,8 +284,8 @@
static pval *update_last(pval *, YYLTYPE *);
-/* Line 221 of yacc.c. */
-#line 279 "ael.tab.c"
+/* Line 216 of yacc.c. */
+#line 289 "ael.tab.c"
#ifdef short
# undef short
@@ -405,8 +415,13 @@
# ifndef YYSTACK_ALLOC_MAXIMUM
# define YYSTACK_ALLOC_MAXIMUM YYSIZE_MAXIMUM
# endif
-# ifdef __cplusplus
-extern "C" {
+# if (defined __cplusplus && ! defined _STDLIB_H \
+ && ! ((defined YYMALLOC || defined malloc) \
+ && (defined YYFREE || defined free)))
+# include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
+# ifndef _STDLIB_H
+# define _STDLIB_H 1
+# endif
# endif
# ifndef YYMALLOC
# define YYMALLOC malloc
@@ -421,9 +436,6 @@
|| defined __cplusplus || defined _MSC_VER)
void free (void *); /* INFRINGES ON USER NAME SPACE */
# endif
-# endif
-# ifdef __cplusplus
-}
# endif
# endif
#endif /* ! defined yyoverflow || YYERROR_VERBOSE */
@@ -1029,14 +1041,14 @@
#if (defined __STDC__ || defined __C99__FUNC__ \
|| defined __cplusplus || defined _MSC_VER)
static void
-yy_symbol_value_print (FILE *yyoutput, int yytype, const YYSTYPE * const yyvaluep, const YYLTYPE * const yylocationp, struct parse_io *parseio)
+yy_symbol_value_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep, YYLTYPE const * const yylocationp, struct parse_io *parseio)
#else
static void
yy_symbol_value_print (yyoutput, yytype, yyvaluep, yylocationp, parseio)
FILE *yyoutput;
int yytype;
- const YYSTYPE * const yyvaluep;
- const YYLTYPE * const yylocationp;
+ YYSTYPE const * const yyvaluep;
+ YYLTYPE const * const yylocationp;
struct parse_io *parseio;
#endif
{
@@ -1065,14 +1077,14 @@
#if (defined __STDC__ || defined __C99__FUNC__ \
|| defined __cplusplus || defined _MSC_VER)
static void
-yy_symbol_print (FILE *yyoutput, int yytype, const YYSTYPE * const yyvaluep, const YYLTYPE * const yylocationp, struct parse_io *parseio)
+yy_symbol_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep, YYLTYPE const * const yylocationp, struct parse_io *parseio)
#else
static void
yy_symbol_print (yyoutput, yytype, yyvaluep, yylocationp, parseio)
FILE *yyoutput;
int yytype;
- const YYSTYPE * const yyvaluep;
- const YYLTYPE * const yylocationp;
+ YYSTYPE const * const yyvaluep;
+ YYLTYPE const * const yylocationp;
struct parse_io *parseio;
#endif
{
@@ -1250,7 +1262,7 @@
{
if (*yystr == '"')
{
- size_t yyn = 0;
+ YYSIZE_T yyn = 0;
char const *yyp = yystr;
for (;;)
@@ -1297,7 +1309,7 @@
{
int yyn = yypact[yystate];
- if (! (YYPACT_NINF < yyn && yyn < YYLAST))
+ if (! (YYPACT_NINF < yyn && yyn <= YYLAST))
return 0;
else
{
@@ -1335,7 +1347,7 @@
int yyxbegin = yyn < 0 ? -yyn : 0;
/* Stay within bounds of both yycheck and yytname. */
- int yychecklim = YYLAST - yyn;
+ int yychecklim = YYLAST - yyn + 1;
int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS;
int yycount = 1;
@@ -1427,7 +1439,7 @@
case 41: /* "word" */
#line 177 "ael.y"
{ free((yyvaluep->str));};
-#line 1431 "ael.tab.c"
+#line 1443 "ael.tab.c"
break;
case 44: /* "objects" */
#line 164 "ael.y"
@@ -1435,7 +1447,7 @@
destroy_pval((yyvaluep->pval));
prev_word=0;
};
-#line 1439 "ael.tab.c"
+#line 1451 "ael.tab.c"
break;
case 45: /* "object" */
#line 164 "ael.y"
@@ -1443,12 +1455,12 @@
destroy_pval((yyvaluep->pval));
prev_word=0;
};
-#line 1447 "ael.tab.c"
+#line 1459 "ael.tab.c"
break;
case 46: /* "context_name" */
#line 177 "ael.y"
{ free((yyvaluep->str));};
-#line 1452 "ael.tab.c"
+#line 1464 "ael.tab.c"
break;
case 47: /* "context" */
#line 164 "ael.y"
@@ -1456,7 +1468,7 @@
destroy_pval((yyvaluep->pval));
prev_word=0;
};
-#line 1460 "ael.tab.c"
+#line 1472 "ael.tab.c"
break;
case 49: /* "macro" */
#line 164 "ael.y"
@@ -1464,7 +1476,7 @@
destroy_pval((yyvaluep->pval));
prev_word=0;
};
-#line 1468 "ael.tab.c"
+#line 1480 "ael.tab.c"
break;
case 50: /* "globals" */
#line 164 "ael.y"
@@ -1472,7 +1484,7 @@
destroy_pval((yyvaluep->pval));
prev_word=0;
};
-#line 1476 "ael.tab.c"
+#line 1488 "ael.tab.c"
break;
case 51: /* "global_statements" */
#line 164 "ael.y"
@@ -1480,7 +1492,7 @@
destroy_pval((yyvaluep->pval));
prev_word=0;
};
-#line 1484 "ael.tab.c"
+#line 1496 "ael.tab.c"
break;
case 52: /* "assignment" */
#line 164 "ael.y"
@@ -1488,7 +1500,7 @@
destroy_pval((yyvaluep->pval));
prev_word=0;
};
-#line 1492 "ael.tab.c"
+#line 1504 "ael.tab.c"
break;
case 54: /* "arglist" */
#line 164 "ael.y"
@@ -1496,7 +1508,7 @@
destroy_pval((yyvaluep->pval));
prev_word=0;
};
-#line 1500 "ael.tab.c"
+#line 1512 "ael.tab.c"
break;
case 55: /* "elements" */
#line 164 "ael.y"
@@ -1504,7 +1516,7 @@
destroy_pval((yyvaluep->pval));
prev_word=0;
};
-#line 1508 "ael.tab.c"
+#line 1520 "ael.tab.c"
break;
case 56: /* "element" */
#line 164 "ael.y"
@@ -1512,7 +1524,7 @@
destroy_pval((yyvaluep->pval));
prev_word=0;
};
-#line 1516 "ael.tab.c"
+#line 1528 "ael.tab.c"
break;
case 57: /* "ignorepat" */
#line 164 "ael.y"
@@ -1520,7 +1532,7 @@
destroy_pval((yyvaluep->pval));
prev_word=0;
};
-#line 1524 "ael.tab.c"
+#line 1536 "ael.tab.c"
break;
case 58: /* "extension" */
#line 164 "ael.y"
@@ -1528,7 +1540,7 @@
destroy_pval((yyvaluep->pval));
prev_word=0;
};
-#line 1532 "ael.tab.c"
+#line 1544 "ael.tab.c"
break;
case 59: /* "statements" */
#line 164 "ael.y"
@@ -1536,12 +1548,12 @@
destroy_pval((yyvaluep->pval));
prev_word=0;
};
-#line 1540 "ael.tab.c"
+#line 1552 "ael.tab.c"
break;
case 60: /* "timerange" */
#line 177 "ael.y"
{ free((yyvaluep->str));};
-#line 1545 "ael.tab.c"
+#line 1557 "ael.tab.c"
break;
case 61: /* "timespec" */
#line 164 "ael.y"
@@ -1549,12 +1561,12 @@
destroy_pval((yyvaluep->pval));
prev_word=0;
};
-#line 1553 "ael.tab.c"
+#line 1565 "ael.tab.c"
break;
case 62: /* "test_expr" */
#line 177 "ael.y"
{ free((yyvaluep->str));};
-#line 1558 "ael.tab.c"
+#line 1570 "ael.tab.c"
break;
case 64: /* "if_like_head" */
#line 164 "ael.y"
@@ -1562,22 +1574,22 @@
destroy_pval((yyvaluep->pval));
prev_word=0;
};
-#line 1566 "ael.tab.c"
+#line 1578 "ael.tab.c"
break;
case 65: /* "word_list" */
#line 177 "ael.y"
{ free((yyvaluep->str));};
-#line 1571 "ael.tab.c"
+#line 1583 "ael.tab.c"
break;
case 67: /* "word3_list" */
#line 177 "ael.y"
{ free((yyvaluep->str));};
-#line 1576 "ael.tab.c"
+#line 1588 "ael.tab.c"
break;
case 68: /* "goto_word" */
#line 177 "ael.y"
{ free((yyvaluep->str));};
-#line 1581 "ael.tab.c"
+#line 1593 "ael.tab.c"
break;
case 69: /* "switch_statement" */
#line 164 "ael.y"
@@ -1585,7 +1597,7 @@
destroy_pval((yyvaluep->pval));
prev_word=0;
};
-#line 1589 "ael.tab.c"
+#line 1601 "ael.tab.c"
break;
case 70: /* "statement" */
#line 164 "ael.y"
@@ -1593,7 +1605,7 @@
destroy_pval((yyvaluep->pval));
prev_word=0;
};
-#line 1597 "ael.tab.c"
+#line 1609 "ael.tab.c"
break;
case 75: /* "opt_else" */
#line 164 "ael.y"
@@ -1601,7 +1613,7 @@
destroy_pval((yyvaluep->pval));
prev_word=0;
};
-#line 1605 "ael.tab.c"
+#line 1617 "ael.tab.c"
break;
case 76: /* "target" */
#line 164 "ael.y"
@@ -1609,12 +1621,12 @@
destroy_pval((yyvaluep->pval));
prev_word=0;
};
-#line 1613 "ael.tab.c"
+#line 1625 "ael.tab.c"
break;
case 77: /* "opt_pri" */
#line 177 "ael.y"
{ free((yyvaluep->str));};
-#line 1618 "ael.tab.c"
+#line 1630 "ael.tab.c"
break;
case 78: /* "jumptarget" */
#line 164 "ael.y"
@@ -1622,7 +1634,7 @@
destroy_pval((yyvaluep->pval));
prev_word=0;
};
-#line 1626 "ael.tab.c"
+#line 1638 "ael.tab.c"
break;
case 79: /* "macro_call" */
#line 164 "ael.y"
@@ -1630,7 +1642,7 @@
destroy_pval((yyvaluep->pval));
prev_word=0;
};
-#line 1634 "ael.tab.c"
+#line 1646 "ael.tab.c"
break;
case 81: /* "application_call_head" */
#line 164 "ael.y"
@@ -1638,7 +1650,7 @@
destroy_pval((yyvaluep->pval));
prev_word=0;
};
-#line 1642 "ael.tab.c"
+#line 1654 "ael.tab.c"
break;
case 83: /* "application_call" */
#line 164 "ael.y"
@@ -1646,12 +1658,12 @@
destroy_pval((yyvaluep->pval));
prev_word=0;
};
-#line 1650 "ael.tab.c"
+#line 1662 "ael.tab.c"
break;
case 84: /* "opt_word" */
#line 177 "ael.y"
{ free((yyvaluep->str));};
-#line 1655 "ael.tab.c"
+#line 1667 "ael.tab.c"
break;
case 85: /* "eval_arglist" */
#line 164 "ael.y"
@@ -1659,7 +1671,7 @@
destroy_pval((yyvaluep->pval));
prev_word=0;
};
-#line 1663 "ael.tab.c"
+#line 1675 "ael.tab.c"
break;
case 86: /* "case_statements" */
#line 164 "ael.y"
@@ -1667,7 +1679,7 @@
destroy_pval((yyvaluep->pval));
prev_word=0;
};
-#line 1671 "ael.tab.c"
+#line 1683 "ael.tab.c"
break;
case 87: /* "case_statement" */
#line 164 "ael.y"
@@ -1675,7 +1687,7 @@
destroy_pval((yyvaluep->pval));
prev_word=0;
};
-#line 1679 "ael.tab.c"
+#line 1691 "ael.tab.c"
break;
case 88: /* "macro_statements" */
#line 164 "ael.y"
@@ -1683,7 +1695,7 @@
destroy_pval((yyvaluep->pval));
prev_word=0;
};
-#line 1687 "ael.tab.c"
+#line 1699 "ael.tab.c"
break;
case 89: /* "macro_statement" */
#line 164 "ael.y"
@@ -1691,7 +1703,7 @@
destroy_pval((yyvaluep->pval));
prev_word=0;
};
-#line 1695 "ael.tab.c"
+#line 1707 "ael.tab.c"
break;
case 90: /* "switches" */
#line 164 "ael.y"
@@ -1699,7 +1711,7 @@
destroy_pval((yyvaluep->pval));
prev_word=0;
};
-#line 1703 "ael.tab.c"
+#line 1715 "ael.tab.c"
break;
case 91: /* "eswitches" */
#line 164 "ael.y"
@@ -1707,7 +1719,7 @@
destroy_pval((yyvaluep->pval));
prev_word=0;
};
-#line 1711 "ael.tab.c"
+#line 1723 "ael.tab.c"
break;
case 92: /* "switchlist" */
#line 164 "ael.y"
@@ -1715,7 +1727,7 @@
destroy_pval((yyvaluep->pval));
prev_word=0;
};
-#line 1719 "ael.tab.c"
+#line 1731 "ael.tab.c"
break;
case 93: /* "included_entry" */
#line 164 "ael.y"
@@ -1723,7 +1735,7 @@
destroy_pval((yyvaluep->pval));
prev_word=0;
};
-#line 1727 "ael.tab.c"
+#line 1739 "ael.tab.c"
break;
case 94: /* "includeslist" */
#line 164 "ael.y"
@@ -1731,7 +1743,7 @@
destroy_pval((yyvaluep->pval));
prev_word=0;
};
-#line 1735 "ael.tab.c"
+#line 1747 "ael.tab.c"
break;
case 95: /* "includes" */
#line 164 "ael.y"
@@ -1739,7 +1751,7 @@
destroy_pval((yyvaluep->pval));
prev_word=0;
};
-#line 1743 "ael.tab.c"
+#line 1755 "ael.tab.c"
break;
default:
@@ -2911,8 +2923,8 @@
break;
-/* Line 1270 of yacc.c. */
-#line 2916 "ael.tab.c"
+/* Line 1267 of yacc.c. */
+#line 2928 "ael.tab.c"
default: break;
}
YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc);
@@ -3127,7 +3139,8 @@
if (yymsg != yymsgbuf)
YYSTACK_FREE (yymsg);
#endif
- return yyresult;
+ /* Make sure YYID is used. */
+ return YYID (yyresult);
}
@@ -3270,7 +3283,7 @@
parseio->syntax_error_count++;
}
-static struct pval *npval(pvaltype type, int first_line, int last_line,
+struct pval *npval(pvaltype type, int first_line, int last_line,
int first_column, int last_column)
{
pval *z = calloc(1, sizeof(struct pval));
@@ -3306,7 +3319,7 @@
}
/* append second element to the list in the first one */
-static pval * linku1(pval *head, pval *tail)
+pval * linku1(pval *head, pval *tail)
{
if (!head)
return tail;
Modified: team/murf/bug_7638/pbx/ael/ael.tab.h
URL: http://svn.digium.com/view/asterisk/team/murf/bug_7638/pbx/ael/ael.tab.h?view=diff&rev=49044&r1=49043&r2=49044
==============================================================================
--- team/murf/bug_7638/pbx/ael/ael.tab.h (original)
+++ team/murf/bug_7638/pbx/ael/ael.tab.h Thu Dec 28 18:22:38 2006
@@ -1,7 +1,9 @@
-/* A Bison parser, made by GNU Bison 2.1a. */
+/* A Bison parser, made by GNU Bison 2.3. */
-/* Skeleton parser for Yacc-like parsing with Bison,
- Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005, 2006 Free Software Foundation, Inc.
+/* Skeleton interface for Bison's Yacc-like parsers in C
+
+ Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005, 2006
+ Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -18,10 +20,18 @@
Foundation, Inc., 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301, USA. */
-/* As a special exception, when this file is copied by Bison into a
- Bison output file, you may use that output file without restriction.
- This special exception was added by the Free Software Foundation
- in version 1.24 of Bison. */
+/* As a special exception, you may create a larger work that contains
+ part or all of the Bison parser skeleton and distribute that work
+ under terms of your choice, so long as that work isn't itself a
+ parser generator using the skeleton or a modified version thereof
+ as a parser skeleton. Alternatively, if you modify or redistribute
+ the parser skeleton itself, you may (at your option) remove this
+ special exception, which will cause the skeleton and the resulting
+ Bison output files to be licensed under the GNU General Public
+ License without this special exception.
+
+ This special exception was added by the Free Software Foundation in
+ version 2.2 of Bison. */
/* Tokens. */
#ifndef YYTOKENTYPE
@@ -122,8 +132,8 @@
char *str; /* strings */
struct pval *pval; /* full objects */
}
-/* Line 1536 of yacc.c. */
-#line 127 "ael.tab.h"
+/* Line 1529 of yacc.c. */
+#line 137 "ael.tab.h"
YYSTYPE;
# define yystype YYSTYPE /* obsolescent; will be withdrawn */
# define YYSTYPE_IS_DECLARED 1
@@ -146,5 +156,3 @@
#endif
-
-
Modified: team/murf/bug_7638/pbx/ael/ael.y
URL: http://svn.digium.com/view/asterisk/team/murf/bug_7638/pbx/ael/ael.y?view=diff&rev=49044&r1=49043&r2=49044
==============================================================================
--- team/murf/bug_7638/pbx/ael/ael.y (original)
+++ team/murf/bug_7638/pbx/ael/ael.y Thu Dec 28 18:22:38 2006
@@ -33,12 +33,12 @@
#include "asterisk/logger.h"
#include "asterisk/ael_structs.h"
-static pval * linku1(pval *head, pval *tail);
+pval * linku1(pval *head, pval *tail);
static void set_dads(pval *dad, pval *child_list);
void reset_parencount(yyscan_t yyscanner);
void reset_semicount(yyscan_t yyscanner);
void reset_argcount(yyscan_t yyscanner );
-
+
#define YYLEX_PARAM ((struct parse_io *)parseio)->scanner
#define YYERROR_VERBOSE 1
@@ -63,7 +63,7 @@
int ael_yylex (YYSTYPE * yylval_param, YYLTYPE * yylloc_param , void * yyscanner);
/* create a new object with start-end marker */
-static pval *npval(pvaltype type, int first_line, int last_line,
+pval *npval(pvaltype type, int first_line, int last_line,
int first_column, int last_column);
/* create a new object with start-end marker, simplified interface.
@@ -757,7 +757,7 @@
parseio->syntax_error_count++;
}
-static struct pval *npval(pvaltype type, int first_line, int last_line,
+struct pval *npval(pvaltype type, int first_line, int last_line,
int first_column, int last_column)
{
pval *z = calloc(1, sizeof(struct pval));
@@ -793,7 +793,7 @@
}
/* append second element to the list in the first one */
-static pval * linku1(pval *head, pval *tail)
+pval * linku1(pval *head, pval *tail)
{
if (!head)
return tail;
Modified: team/murf/bug_7638/pbx/pbx_ael.c
URL: http://svn.digium.com/view/asterisk/team/murf/bug_7638/pbx/pbx_ael.c?view=diff&rev=49044&r1=49043&r2=49044
==============================================================================
--- team/murf/bug_7638/pbx/pbx_ael.c (original)
+++ team/murf/bug_7638/pbx/pbx_ael.c Thu Dec 28 18:22:38 2006
@@ -416,8 +416,7 @@
}
}
-#if 0
-static void ael2_print(char *fname, pval *tree)
+void ael2_print(char *fname, pval *tree)
{
FILE *fin = fopen(fname,"w");
if ( !fin ) {
@@ -427,7 +426,6 @@
print_pval_list(fin, tree, 0);
fclose(fin);
}
-#endif
/* EMPTY TEMPLATE FUNCS FOR AEL TRAVERSAL: ============================================================================= */
Modified: team/murf/bug_7638/utils/Makefile
URL: http://svn.digium.com/view/asterisk/team/murf/bug_7638/utils/Makefile?view=diff&rev=49044&r1=49043&r2=49044
==============================================================================
--- team/murf/bug_7638/utils/Makefile (original)
+++ team/murf/bug_7638/utils/Makefile Thu Dec 28 18:22:38 2006
@@ -97,9 +97,6 @@
@cp $< $@
pbx_ael.o: ASTCFLAGS+=-DSTANDALONE_AEL
-config.c: ../main/config.c
- @cp $< $@
-
ael_main.o: ael_main.c ../include/asterisk/ael_structs.h
aelparse.c: ../pbx/ael/ael_lex.c
@@ -109,7 +106,9 @@
aelparse: aelparse.o aelbison.o pbx_ael.o ael_main.o ast_expr2f.o ast_expr2.o strcompat.o
-conf2ael: conf2ael.o config.o pbx_ael.o
+config_external.o : config_external.c
+
+conf2ael: conf2ael.o config_external.o ast_expr2f.o ast_expr2.o aelbison.o aelparse.o pbx_ael.o
testexpr2s: ../main/ast_expr2f.c ../main/ast_expr2.c ../main/ast_expr2.h
Added: team/murf/bug_7638/utils/conf2ael.c
URL: http://svn.digium.com/view/asterisk/team/murf/bug_7638/utils/conf2ael.c?view=auto&rev=49044
==============================================================================
--- team/murf/bug_7638/utils/conf2ael.c (added)
+++ team/murf/bug_7638/utils/conf2ael.c Thu Dec 28 18:22:38 2006
@@ -1,0 +1,2848 @@
+/*
+ * Asterisk -- An open source telephony toolkit.
+ *
+ * Copyright (C) 2006, Digium, Inc.
+ *
+ * Steve Murphy <murf at digium.com>
+ *
+ * See http://www.asterisk.org for more information about
+ * the Asterisk project. Please do not directly contact
+ * any of the maintainers of this project for assistance;
+ * the project provides a web site, mailing lists and IRC
+ * channels for your use.
+ *
+ * This program is free software, distributed under the terms of
+ * the GNU General Public License Version 2. See the LICENSE file
+ * at the top of the source tree.
+ */
+
+/*
+ *
+ * Reverse compile extensions.conf code into prototype AEL code
+ *
+ */
+
+
+
+#include "asterisk/autoconfig.h"
+
+#include <stdio.h>
+#include <sys/types.h>
+#include <stdlib.h>
+#include <stdarg.h>
+#include <string.h>
+#include <locale.h>
+#include <ctype.h>
+#if !defined(SOLARIS) && !defined(__CYGWIN__)
+#include <err.h>
+#endif
+#include <errno.h>
+#include <regex.h>
+#include <limits.h>
+
+#include "asterisk/pbx.h"
+#include "asterisk/ast_expr.h"
+#include "asterisk/channel.h"
+#include "asterisk/chanvars.h"
+#include "asterisk/module.h"
+#include "asterisk/app.h"
+#include "asterisk/config.h"
+#include "asterisk/options.h"
+#include "asterisk/callerid.h"
+#include "asterisk/ael_structs.h"
+#include "asterisk/devicestate.h"
+#include "asterisk/stringfields.h"
+#include "asterisk/ael_structs.h"
+
+
+static char *config = "extensions.conf";
+static char *registrar = "conf2ael";
+static char userscontext[AST_MAX_EXTENSION] = "default";
+static int static_config = 0;
+static int write_protect_config = 1;
+static int autofallthrough_config = 0;
+static int clearglobalvars_config = 0;
+char ast_config_AST_SYSTEM_NAME[20] = "";
+/*! Go no deeper than this through includes (not counting loops) */
+#define AST_PBX_MAX_STACK 128
+static AST_RWLIST_HEAD_STATIC(acf_root, ast_custom_function);
+char ast_config_AST_CONFIG_DIR[PATH_MAX];
+extern char *my_file;
+
+/* modulation */
+void ast_register_file_version(void);
+void ast_unregister_file_version(void);
+
+void ast_register_file_version(void)
+{
+ /* if(!no_comp)
+ printf("Executed ast_register_file_version();\n"); */
+ /* I'm erasing this, because I don't think anyone really ever needs to see it anyway */
+}
+
+void ast_unregister_file_version(void)
+{
+ /* if(!no_comp)
+ printf("Executed ast_unregister_file_version();\n"); */
+ /* I'm erasing this, because I don't think anyone really ever needs to see it anyway */
+
+}
+
+/* stolen from callerid.c */
+
+/*! \brief Clean up phone string
+ * remove '(', ' ', ')', non-trailing '.', and '-' not in square brackets.
+ * Basically, remove anything that could be invalid in a pattern.
+ */
+void ast_shrink_phone_number(char *n)
+{
+ int x, y=0;
+ int bracketed = 0;
+
+ for (x=0; n[x]; x++) {
+ switch(n[x]) {
+ case '[':
+ bracketed++;
+ n[y++] = n[x];
+ break;
+ case ']':
+ bracketed--;
+ n[y++] = n[x];
+ break;
+ case '-':
+ if (bracketed)
+ n[y++] = n[x];
+ break;
+ case '.':
+ if (!n[x+1])
+ n[y++] = n[x];
+ break;
+ default:
+ if (!strchr("()", n[x]))
+ n[y++] = n[x];
+ }
+ }
+ n[y] = '\0';
+}
+
+
+/* stolen from chanvars.c */
+
+const char *ast_var_name(const struct ast_var_t *var)
+{
+ const char *name;
+
+ if (var == NULL || (name = var->name) == NULL)
+ return NULL;
+ /* Return the name without the initial underscores */
+ if (name[0] == '_') {
+ name++;
+ if (name[0] == '_')
+ name++;
+ }
+ return name;
+}
+
+const char *ast_var_value(const struct ast_var_t *var)
+{
+ return (var ? var->value : NULL);
+}
+
+
+/* stolen from asterisk.c */
+struct ast_flags ast_options = { AST_DEFAULT_OPTIONS };
+int option_verbose = 0; /*!< Verbosity level */
+int option_debug = 0; /*!< Debug level */
+
+
+/* experiment 1: see if it's easier just to use existing config code
+ * to read in the extensions.conf file. In this scenario,
+ I have to rip/copy code from other modules, because they
+ are staticly declared as-is. A solution would be to move
+ the ripped code to another location and make them available
+ to other modules and standalones */
+
+/* Our own version of ast_log, since the expr parser uses it. -- stolen from utils/check_expr.c */
+void ast_log(int level, const char *file, int line, const char *function, const char *fmt, ...) __attribute__ ((format (printf,5,6)));
+
+void ast_log(int level, const char *file, int line, const char *function, const char *fmt, ...)
+{
+ va_list vars;
+ va_start(vars,fmt);
+
+ printf("LOG: lev:%d file:%s line:%d func: %s ",
+ level, file, line, function);
+ vprintf(fmt, vars);
+ fflush(stdout);
+ va_end(vars);
+}
+
+void ast_verbose(const char *fmt, ...)
+{
+ va_list vars;
+ va_start(vars,fmt);
+
+ printf("VERBOSE: ");
+ vprintf(fmt, vars);
+ fflush(stdout);
+ va_end(vars);
+}
+
+/* stolen from main/utils.c */
+char *ast_process_quotes_and_slashes(char *start, char find, char replace_with)
+{
+ char *dataPut = start;
+ int inEscape = 0;
+ int inQuotes = 0;
+
+ for (; *start; start++) {
+ if (inEscape) {
+ *dataPut++ = *start; /* Always goes verbatim */
+ inEscape = 0;
+ } else {
+ if (*start == '\\') {
+ inEscape = 1; /* Do not copy \ into the data */
+ } else if (*start == '\'') {
+ inQuotes = 1 - inQuotes; /* Do not copy ' into the data */
+ } else {
+ /* Replace , with |, unless in quotes */
+ *dataPut++ = inQuotes ? *start : ((*start == find) ? replace_with : *start);
+ }
+ }
+ }
+ if (start != dataPut)
+ *dataPut = 0;
+ return dataPut;
+}
+
+int ast_true(const char *s)
+{
+ if (ast_strlen_zero(s))
+ return 0;
+
+ /* Determine if this is a true value */
+ if (!strcasecmp(s, "yes") ||
+ !strcasecmp(s, "true") ||
+ !strcasecmp(s, "y") ||
+ !strcasecmp(s, "t") ||
+ !strcasecmp(s, "1") ||
+ !strcasecmp(s, "on"))
+ return -1;
+
+ return 0;
+}
+
+int ast_false(const char *s)
+{
+ if (ast_strlen_zero(s))
+ return 0;
+
+ /* Determine if this is a false value */
+ if (!strcasecmp(s, "no") ||
+ !strcasecmp(s, "false") ||
+ !strcasecmp(s, "n") ||
+ !strcasecmp(s, "f") ||
+ !strcasecmp(s, "0") ||
+ !strcasecmp(s, "off"))
+ return -1;
+
+ return 0;
+}
+
+/* stolen from pbx.c */
+struct ast_context;
+struct ast_app;
+#ifdef LOW_MEMORY
+#define EXT_DATA_SIZE 256
+#else
+#define EXT_DATA_SIZE 8192
+#endif
+/*!
+ * When looking up extensions, we can have different requests
+ * identified by the 'action' argument, as follows.
+ * Note that the coding is such that the low 4 bits are the
+ * third argument to extension_match_core.
+ */
+enum ext_match_t {
+ E_MATCHMORE = 0x00, /* extension can match but only with more 'digits' */
+ E_CANMATCH = 0x01, /* extension can match with or without more 'digits' */
+ E_MATCH = 0x02, /* extension is an exact match */
+ E_MATCH_MASK = 0x03, /* mask for the argument to extension_match_core() */
+ E_SPAWN = 0x12, /* want to spawn an extension. Requires exact match */
+ E_FINDLABEL = 0x22 /* returns the priority for a given label. Requires exact match */
+};
+
+static AST_RWLIST_HEAD_STATIC(switches, ast_switch);
+
+#define SWITCH_DATA_LENGTH 256
+
+#define VAR_BUF_SIZE 4096
+
+#define VAR_NORMAL 1
+#define VAR_SOFTTRAN 2
+#define VAR_HARDTRAN 3
+
+#define BACKGROUND_SKIP (1 << 0)
+#define BACKGROUND_NOANSWER (1 << 1)
+#define BACKGROUND_MATCHEXTEN (1 << 2)
+#define BACKGROUND_PLAYBACK (1 << 3)
+
+/*!
+ \brief ast_exten: An extension
+ The dialplan is saved as a linked list with each context
+ having it's own linked list of extensions - one item per
+ priority.
+*/
+struct ast_exten {
+ char *exten; /*!< Extension name */
+ int matchcid; /*!< Match caller id ? */
+ const char *cidmatch; /*!< Caller id to match for this extension */
+ int priority; /*!< Priority */
+ const char *label; /*!< Label */
+ struct ast_context *parent; /*!< The context this extension belongs to */
+ const char *app; /*!< Application to execute */
+ struct ast_app *cached_app; /*!< Cached location of application */
+ void *data; /*!< Data to use (arguments) */
+ void (*datad)(void *); /*!< Data destructor */
+ struct ast_exten *peer; /*!< Next higher priority with our extension */
+ const char *registrar; /*!< Registrar */
+ struct ast_exten *next; /*!< Extension with a greater ID */
+ char stuff[0];
+};
+
+/*! \brief ast_include: include= support in extensions.conf */
+struct ast_include {
+ const char *name;
+ const char *rname; /*!< Context to include */
+ const char *registrar; /*!< Registrar */
+ int hastime; /*!< If time construct exists */
+ struct ast_timing timing; /*!< time construct */
+ struct ast_include *next; /*!< Link them together */
+ char stuff[0];
+};
+
+/*! \brief ast_sw: Switch statement in extensions.conf */
+struct ast_sw {
+ char *name;
+ const char *registrar; /*!< Registrar */
+ char *data; /*!< Data load */
+ int eval;
+ AST_LIST_ENTRY(ast_sw) list;
+ char *tmpdata;
+ char stuff[0];
+};
+
+/*! \brief ast_ignorepat: Ignore patterns in dial plan */
+struct ast_ignorepat {
+ const char *registrar;
+ struct ast_ignorepat *next;
+ const char pattern[0];
+};
+
+/*! \brief ast_context: An extension context */
+struct ast_context {
+ ast_mutex_t lock; /*!< A lock to prevent multiple threads from clobbering the context */
+ struct ast_exten *root; /*!< The root of the list of extensions */
+ struct ast_context *next; /*!< Link them together */
+ struct ast_include *includes; /*!< Include other contexts */
+ struct ast_ignorepat *ignorepats; /*!< Patterns for which to continue playing dialtone */
+ const char *registrar; /*!< Registrar */
+ AST_LIST_HEAD_NOLOCK(, ast_sw) alts; /*!< Alternative switches */
+ ast_mutex_t macrolock; /*!< A lock to implement "exclusive" macros - held whilst a call is executing in the macro */
+ char name[0]; /*!< Name of the context */
+};
+
+
+/*! \brief ast_app: A registered application */
+struct ast_app {
+ int (*execute)(struct ast_channel *chan, void *data);
+ const char *synopsis; /*!< Synopsis text for 'show applications' */
+ const char *description; /*!< Description (help text) for 'show application <name>' */
+ AST_RWLIST_ENTRY(ast_app) list; /*!< Next app in list */
+ struct module *module; /*!< Module this app belongs to */
+ char name[0]; /*!< Name of the application */
+};
+
+/*! \brief ast_state_cb: An extension state notify register item */
+struct ast_state_cb {
+ int id;
+ void *data;
+ ast_state_cb_type callback;
+ struct ast_state_cb *next;
+};
+
+/*! \brief Structure for dial plan hints
+
+ \note Hints are pointers from an extension in the dialplan to one or
+ more devices (tech/name)
+ - See \ref AstExtState
+*/
+struct ast_hint {
+ struct ast_exten *exten; /*!< Extension */
+ int laststate; /*!< Last known state */
+ struct ast_state_cb *callbacks; /*!< Callback list for this extension */
+ AST_RWLIST_ENTRY(ast_hint) list;/*!< Pointer to next hint in list */
+};
+
+struct store_hint {
+ char *context;
+ char *exten;
+ struct ast_state_cb *callbacks;
+ int laststate;
+ AST_LIST_ENTRY(store_hint) list;
+ char data[1];
+};
+
+AST_LIST_HEAD(store_hints, store_hint);
+
+static const struct cfextension_states {
+ int extension_state;
+ const char * const text;
+} extension_states[] = {
+ { AST_EXTENSION_NOT_INUSE, "Idle" },
+ { AST_EXTENSION_INUSE, "InUse" },
+ { AST_EXTENSION_BUSY, "Busy" },
+ { AST_EXTENSION_UNAVAILABLE, "Unavailable" },
+ { AST_EXTENSION_RINGING, "Ringing" },
+ { AST_EXTENSION_INUSE | AST_EXTENSION_RINGING, "InUse&Ringing" },
+ { AST_EXTENSION_ONHOLD, "Hold" },
+ { AST_EXTENSION_INUSE | AST_EXTENSION_ONHOLD, "InUse&Hold" }
+};
+#define STATUS_NO_CONTEXT 1
+#define STATUS_NO_EXTENSION 2
+#define STATUS_NO_PRIORITY 3
+#define STATUS_NO_LABEL 4
+#define STATUS_SUCCESS 5
+static struct ast_context *local_contexts = NULL;
+static struct ast_context *contexts = NULL;
+static struct varshead globals = AST_LIST_HEAD_NOLOCK_INIT_VALUE;
+
+static AST_RWLIST_HEAD_STATIC(hints, ast_hint);
+struct ast_state_cb *statecbs = NULL;
+
+/* request and result for pbx_find_extension */
+struct pbx_find_info {
+#if 0
+ const char *context;
+ const char *exten;
+ int priority;
+#endif
+
+ char *incstack[AST_PBX_MAX_STACK]; /* filled during the search */
+ int stacklen; /* modified during the search */
+ int status; /* set on return */
+ struct ast_switch *swo; /* set on return */
+ const char *data; /* set on return */
+ const char *foundcontext; /* set on return */
+};
+
+/*
+ * Internal function for ast_extension_{match|close}
+ * return 0 on no-match, 1 on match, 2 on early match.
+ * mode is as follows:
+ * E_MATCH success only on exact match
+ * E_MATCHMORE success only on partial match (i.e. leftover digits in pattern)
+ * E_CANMATCH either of the above.
+ */
+
+static int _extension_match_core(const char *pattern, const char *data, enum ext_match_t mode)
+{
+ mode &= E_MATCH_MASK; /* only consider the relevant bits */
+
+ if ( (mode == E_MATCH) && (pattern[0] == '_') && (strcasecmp(pattern,data)==0) ) /* note: if this test is left out, then _x. will not match _x. !!! */
+ return 1;
+
+ if (pattern[0] != '_') { /* not a pattern, try exact or partial match */
+ int ld = strlen(data), lp = strlen(pattern);
+
+ if (lp < ld) /* pattern too short, cannot match */
+ return 0;
+ /* depending on the mode, accept full or partial match or both */
+ if (mode == E_MATCH)
+ return !strcmp(pattern, data); /* 1 on match, 0 on fail */
+ if (ld == 0 || !strncasecmp(pattern, data, ld)) /* partial or full match */
+ return (mode == E_MATCHMORE) ? lp > ld : 1; /* XXX should consider '!' and '/' ? */
+ else
+ return 0;
+ }
+ pattern++; /* skip leading _ */
+ /*
+ * XXX below we stop at '/' which is a separator for the CID info. However we should
+ * not store '/' in the pattern at all. When we insure it, we can remove the checks.
+ */
+ while (*data && *pattern && *pattern != '/') {
+ const char *end;
+
+ if (*data == '-') { /* skip '-' in data (just a separator) */
+ data++;
+ continue;
+ }
+ switch (toupper(*pattern)) {
+ case '[': /* a range */
+ end = strchr(pattern+1, ']'); /* XXX should deal with escapes ? */
+ if (end == NULL) {
+ ast_log(LOG_WARNING, "Wrong usage of [] in the extension\n");
+ return 0; /* unconditional failure */
+ }
+ for (pattern++; pattern != end; pattern++) {
+ if (pattern+2 < end && pattern[1] == '-') { /* this is a range */
+ if (*data >= pattern[0] && *data <= pattern[2])
+ break; /* match found */
+ else {
+ pattern += 2; /* skip a total of 3 chars */
+ continue;
+ }
+ } else if (*data == pattern[0])
+ break; /* match found */
+ }
+ if (pattern == end)
+ return 0;
+ pattern = end; /* skip and continue */
+ break;
+ case 'N':
+ if (*data < '2' || *data > '9')
+ return 0;
+ break;
+ case 'X':
+ if (*data < '0' || *data > '9')
+ return 0;
+ break;
+ case 'Z':
+ if (*data < '1' || *data > '9')
+ return 0;
+ break;
+ case '.': /* Must match, even with more digits */
+ return 1;
+ case '!': /* Early match */
+ return 2;
+ case ' ':
+ case '-': /* Ignore these in patterns */
+ data--; /* compensate the final data++ */
+ break;
+ default:
+ if (*data != *pattern)
+ return 0;
+ }
+ data++;
+ pattern++;
+ }
+ if (*data) /* data longer than pattern, no match */
+ return 0;
+ /*
+ * match so far, but ran off the end of the data.
+ * Depending on what is next, determine match or not.
+ */
+ if (*pattern == '\0' || *pattern == '/') /* exact match */
+ return (mode == E_MATCHMORE) ? 0 : 1; /* this is a failure for E_MATCHMORE */
+ else if (*pattern == '!') /* early match */
+ return 2;
+ else /* partial match */
+ return (mode == E_MATCH) ? 0 : 1; /* this is a failure for E_MATCH */
+}
+
+/*
+ * Wrapper around _extension_match_core() to do performance measurement
+ * using the profiling code.
+ */
+int ast_check_timing(const struct ast_timing *i)
+{
+ struct tm tm;
+ time_t t = time(NULL);
+
+ localtime_r(&t,&tm);
+
+ /* If it's not the right month, return */
+ if (!(i->monthmask & (1 << tm.tm_mon)))
+ return 0;
+
+ /* If it's not that time of the month.... */
+ /* Warning, tm_mday has range 1..31! */
+ if (!(i->daymask & (1 << (tm.tm_mday-1))))
+ return 0;
+
+ /* If it's not the right day of the week */
[... 3729 lines stripped ...]
More information about the asterisk-commits
mailing list