[asterisk-commits] tilghman: trunk r369940 - in /trunk: ./ funcs/ main/ res/ael/
SVN commits to the Asterisk project
asterisk-commits at lists.digium.com
Wed Jul 11 12:16:56 CDT 2012
Author: tilghman
Date: Wed Jul 11 12:16:50 2012
New Revision: 369940
URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=369940
Log:
Allow the REALTIME() function to report errors back to the caller.
Also, do more error checking on the arguments specified to the REALTIME()
function and clarify the documentation. While I was editing the file, a
few coding guidelines fixups, as well.
Review: https://reviewboard.asterisk.org/r/2031/
........
Merged revisions 369937 from http://svn.asterisk.org/svn/asterisk/branches/1.8
........
Merged revisions 369938 from http://svn.asterisk.org/svn/asterisk/branches/10
Modified:
trunk/ (props changed)
trunk/funcs/func_realtime.c
trunk/main/ast_expr2.c
trunk/main/ast_expr2.h
trunk/main/ast_expr2f.c
trunk/res/ael/ael_lex.c
Propchange: trunk/
------------------------------------------------------------------------------
Binary property 'branch-10-merged' - no diff available.
Modified: trunk/funcs/func_realtime.c
URL: http://svnview.digium.com/svn/asterisk/trunk/funcs/func_realtime.c?view=diff&rev=369940&r1=369939&r2=369940
==============================================================================
--- trunk/funcs/func_realtime.c (original)
+++ trunk/funcs/func_realtime.c Wed Jul 11 12:16:50 2012
@@ -2,10 +2,10 @@
* Asterisk -- An open source telephony toolkit.
*
* Copyright (C) 2005-2006, BJ Weschke. All rights reserved.
- *
+ *
* BJ Weschke <bweschke at btwtech.com>
- *
- * This code is released by the author with no restrictions on usage.
+ *
+ * This code is released by the author with no restrictions on usage.
*
* See http://www.asterisk.org for more information about
* the Asterisk project. Please do not directly contact
@@ -18,9 +18,9 @@
/*! \file
*
* \brief REALTIME dialplan function
- *
+ *
* \author BJ Weschke <bweschke at btwtech.com>
- *
+ *
* \ingroup functions
*/
@@ -49,7 +49,7 @@
<syntax>
<parameter name="family" required="true" />
<parameter name="fieldmatch" required="true" />
- <parameter name="value" />
+ <parameter name="matchvalue" />
<parameter name="delim1|field">
<para>Use <replaceable>delim1</replaceable> with <replaceable>delim2</replaceable> on
read and <replaceable>field</replaceable> without <replaceable>delim2</replaceable> on
@@ -63,11 +63,11 @@
</syntax>
<description>
<para>This function will read or write values from/to a RealTime repository.
- REALTIME(....) will read names/values from the repository, and
+ REALTIME(....) will read names/values from the repository, and
REALTIME(....)= will write a new value/field to the repository. On a
read, this function returns a delimited text string. The name/value
pairs are delimited by <replaceable>delim1</replaceable>, and the name and value are delimited
- between each other with delim2.
+ between each other with delim2.
If there is no match, NULL will be returned by the function.
On a write, this function will always return NULL.</para>
</description>
@@ -108,7 +108,7 @@
<syntax>
<parameter name="family" required="true" />
<parameter name="fieldmatch" required="true" />
- <parameter name="value" />
+ <parameter name="matchvalue" />
<parameter name="delim1" />
<parameter name="delim2" />
</syntax>
@@ -130,13 +130,13 @@
<syntax>
<parameter name="family" required="true" />
<parameter name="fieldmatch" required="true" />
- <parameter name="value" required="true" />
+ <parameter name="matchvalue" required="true" />
<parameter name="fieldname" required="true" />
</syntax>
<description>
<para>This function retrieves a single item, <replaceable>fieldname</replaceable>
from the RT engine, where <replaceable>fieldmatch</replaceable> contains the value
- <replaceable>value</replaceable>. When written to, the REALTIME_FIELD() function
+ <replaceable>matchvalue</replaceable>. When written to, the REALTIME_FIELD() function
performs identically to the REALTIME() function.</para>
</description>
<see-also>
@@ -153,12 +153,12 @@
<syntax>
<parameter name="family" required="true" />
<parameter name="fieldmatch" required="true" />
- <parameter name="value" required="true" />
+ <parameter name="matchvalue" required="true" />
</syntax>
<description>
<para>This function retrieves a single record from the RT engine, where
<replaceable>fieldmatch</replaceable> contains the value
- <replaceable>value</replaceable> and formats the output suitably, such that
+ <replaceable>matchvalue</replaceable> and formats the output suitably, such that
it can be assigned to the HASH() function. The HASH() function then provides
a suitable method for retrieving each field value of the record.</para>
</description>
@@ -175,7 +175,7 @@
AST_THREADSTORAGE(buf2);
AST_THREADSTORAGE(buf3);
-static int function_realtime_read(struct ast_channel *chan, const char *cmd, char *data, char *buf, size_t len)
+static int function_realtime_read(struct ast_channel *chan, const char *cmd, char *data, char *buf, size_t len)
{
struct ast_variable *var, *head;
struct ast_str *out;
@@ -190,7 +190,7 @@
);
if (ast_strlen_zero(data)) {
- ast_log(LOG_WARNING, "Syntax: REALTIME(family,fieldmatch[,value[,delim1[,delim2]]]) - missing argument!\n");
+ ast_log(LOG_WARNING, "Syntax: REALTIME(family,fieldmatch[,matchvalue[,delim1[,delim2]]]) - missing argument!\n");
return -1;
}
@@ -243,14 +243,20 @@
);
if (ast_strlen_zero(data)) {
- ast_log(LOG_WARNING, "Syntax: %s(family,fieldmatch,value,newcol) - missing argument!\n", cmd);
- return -1;
- }
-
- if (chan)
+ ast_log(LOG_WARNING, "Syntax: %s(family,fieldmatch,matchvalue,updatecol) - missing argument!\n", cmd);
+ return -1;
+ }
+
+ AST_STANDARD_APP_ARGS(args, data);
+
+ if (ast_strlen_zero(args.fieldmatch) || ast_strlen_zero(args.field)) {
+ ast_log(LOG_WARNING, "Syntax: %s(family,fieldmatch,matchvalue,updatecol) - missing argument!\n", cmd);
+ return -1;
+ }
+
+ if (chan) {
ast_autoservice_start(chan);
-
- AST_STANDARD_APP_ARGS(args, data);
+ }
res = ast_update_realtime(args.family, args.fieldmatch, args.value, args.field, (char *)value, SENTINEL);
@@ -258,13 +264,14 @@
ast_log(LOG_WARNING, "Failed to update. Check the debug log for possible data repository related entries.\n");
}
- if (chan)
+ if (chan) {
ast_autoservice_stop(chan);
-
- return 0;
-}
-
-static int realtimefield_read(struct ast_channel *chan, const char *cmd, char *data, char *buf, size_t len)
+ }
+
+ return res;
+}
+
+static int realtimefield_read(struct ast_channel *chan, const char *cmd, char *data, char *buf, size_t len)
{
struct ast_variable *var, *head;
struct ast_str *escapebuf = ast_str_thread_get(&buf1, 16);
@@ -286,14 +293,14 @@
}
if (ast_strlen_zero(data)) {
- ast_log(LOG_WARNING, "Syntax: %s(family,fieldmatch,value%s) - missing argument!\n", cmd, which == rtfield ? ",fieldname" : "");
+ ast_log(LOG_WARNING, "Syntax: %s(family,fieldmatch,matchvalue%s) - missing argument!\n", cmd, which == rtfield ? ",fieldname" : "");
return -1;
}
AST_STANDARD_APP_ARGS(args, data);
if ((which == rtfield && args.argc != 4) || (which == rthash && args.argc != 3)) {
- ast_log(LOG_WARNING, "Syntax: %s(family,fieldmatch,value%s) - missing argument!\n", cmd, which == rtfield ? ",fieldname" : "");
+ ast_log(LOG_WARNING, "Syntax: %s(family,fieldmatch,matchvalue%s) - missing argument!\n", cmd, which == rtfield ? ",fieldname" : "");
return -1;
}
@@ -366,7 +373,7 @@
AST_STANDARD_APP_ARGS(a, data);
AST_STANDARD_APP_ARGS(v, valcopy);
- res = ast_store_realtime(a.family,
+ res = ast_store_realtime(a.family,
a.f[0], v.v[0], a.f[1], v.v[1], a.f[2], v.v[2], a.f[3], v.v[3], a.f[4], v.v[4],
a.f[5], v.v[5], a.f[6], v.v[6], a.f[7], v.v[7], a.f[8], v.v[8], a.f[9], v.v[9],
a.f[10], v.v[10], a.f[11], v.v[11], a.f[12], v.v[12], a.f[13], v.v[13], a.f[14], v.v[14],
@@ -388,7 +395,7 @@
return 0;
}
-static int function_realtime_readdestroy(struct ast_channel *chan, const char *cmd, char *data, char *buf, size_t len)
+static int function_realtime_readdestroy(struct ast_channel *chan, const char *cmd, char *data, char *buf, size_t len)
{
struct ast_variable *var, *head;
struct ast_str *out;
@@ -403,7 +410,7 @@
);
if (ast_strlen_zero(data)) {
- ast_log(LOG_WARNING, "Syntax: REALTIME_DESTROY(family,fieldmatch[,value[,delim1[,delim2]]]) - missing argument!\n");
+ ast_log(LOG_WARNING, "Syntax: REALTIME_DESTROY(family,fieldmatch[,matchvalue[,delim1[,delim2]]]) - missing argument!\n");
return -1;
}
Modified: trunk/main/ast_expr2.c
URL: http://svnview.digium.com/svn/asterisk/trunk/main/ast_expr2.c?view=diff&rev=369940&r1=369939&r2=369940
==============================================================================
--- trunk/main/ast_expr2.c (original)
+++ trunk/main/ast_expr2.c Wed Jul 11 12:16:50 2012
@@ -1,8 +1,10 @@
-/* A Bison parser, made by GNU Bison 2.5. */
-
-/* Bison implementation for Yacc-like parsers in C
+
+/* A Bison parser, made by GNU Bison 2.4.1. */
+
+/* Skeleton implementation for Bison's Yacc-like parsers in C
- Copyright (C) 1984, 1989-1990, 2000-2011 Free Software Foundation, Inc.
+ 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
@@ -44,7 +46,7 @@
#define YYBISON 1
/* Bison version. */
-#define YYBISON_VERSION "2.5"
+#define YYBISON_VERSION "2.4.1"
/* Skeleton name. */
#define YYSKELETON_NAME "yacc.c"
@@ -73,7 +75,7 @@
/* Copy the first part of user declarations. */
-/* Line 268 of yacc.c */
+/* Line 189 of yacc.c */
#line 1 "ast_expr2.y"
/* Written by Pace Willisson (pace at blitz.com)
@@ -412,8 +414,8 @@
#define DESTROY(x) {if((x)->type == AST_EXPR_numeric_string || (x)->type == AST_EXPR_string) free((x)->u.s); (x)->u.s = 0; free(x);}
-/* Line 268 of yacc.c */
-#line 417 "ast_expr2.c"
+/* Line 189 of yacc.c */
+#line 419 "ast_expr2.c"
/* Enabling traces. */
#ifndef YYDEBUG
@@ -472,7 +474,7 @@
typedef union YYSTYPE
{
-/* Line 293 of yacc.c */
+/* Line 214 of yacc.c */
#line 345 "ast_expr2.y"
struct val *val;
@@ -480,8 +482,8 @@
-/* Line 293 of yacc.c */
-#line 485 "ast_expr2.c"
+/* Line 214 of yacc.c */
+#line 487 "ast_expr2.c"
} YYSTYPE;
# define YYSTYPE_IS_TRIVIAL 1
# define yystype YYSTYPE /* obsolescent; will be withdrawn */
@@ -504,14 +506,14 @@
/* Copy the second part of user declarations. */
-/* Line 343 of yacc.c */
+/* Line 264 of yacc.c */
#line 350 "ast_expr2.y"
extern int ast_yylex __P((YYSTYPE *, YYLTYPE *, yyscan_t));
-/* Line 343 of yacc.c */
-#line 515 "ast_expr2.c"
+/* Line 264 of yacc.c */
+#line 517 "ast_expr2.c"
#ifdef short
# undef short
@@ -561,7 +563,7 @@
#define YYSIZE_MAXIMUM ((YYSIZE_T) -1)
#ifndef YY_
-# if defined YYENABLE_NLS && YYENABLE_NLS
+# if YYENABLE_NLS
# if ENABLE_NLS
# include <libintl.h> /* INFRINGES ON USER NAME SPACE */
# define YY_(msgid) dgettext ("bison-runtime", msgid)
@@ -614,11 +616,11 @@
# define alloca _alloca
# else
# define YYSTACK_ALLOC alloca
-# if ! defined _ALLOCA_H && ! defined EXIT_SUCCESS && (defined __STDC__ || defined __C99__FUNC__ \
+# if ! defined _ALLOCA_H && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \
|| defined __cplusplus || defined _MSC_VER)
# include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
-# ifndef EXIT_SUCCESS
-# define EXIT_SUCCESS 0
+# ifndef _STDLIB_H
+# define _STDLIB_H 1
# endif
# endif
# endif
@@ -641,24 +643,24 @@
# ifndef YYSTACK_ALLOC_MAXIMUM
# define YYSTACK_ALLOC_MAXIMUM YYSIZE_MAXIMUM
# endif
-# if (defined __cplusplus && ! defined EXIT_SUCCESS \
+# if (defined __cplusplus && ! defined _STDLIB_H \
&& ! ((defined YYMALLOC || defined malloc) \
&& (defined YYFREE || defined free)))
# include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
-# ifndef EXIT_SUCCESS
-# define EXIT_SUCCESS 0
+# ifndef _STDLIB_H
+# define _STDLIB_H 1
# endif
# endif
# ifndef YYMALLOC
# define YYMALLOC malloc
-# if ! defined malloc && ! defined EXIT_SUCCESS && (defined __STDC__ || defined __C99__FUNC__ \
+# if ! defined malloc && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \
|| defined __cplusplus || defined _MSC_VER)
void *malloc (YYSIZE_T); /* INFRINGES ON USER NAME SPACE */
# endif
# endif
# ifndef YYFREE
# define YYFREE free
-# if ! defined free && ! defined EXIT_SUCCESS && (defined __STDC__ || defined __C99__FUNC__ \
+# if ! defined free && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \
|| defined __cplusplus || defined _MSC_VER)
void free (void *); /* INFRINGES ON USER NAME SPACE */
# endif
@@ -689,27 +691,6 @@
((N) * (sizeof (yytype_int16) + sizeof (YYSTYPE) + sizeof (YYLTYPE)) \
+ 2 * YYSTACK_GAP_MAXIMUM)
-# define YYCOPY_NEEDED 1
-
-/* Relocate STACK from its old location to the new one. The
- local variables YYSIZE and YYSTACKSIZE give the old and new number of
- elements in the stack, and YYPTR gives the new location of the
- stack. Advance YYPTR to a properly aligned location for the next
- stack. */
-# define YYSTACK_RELOCATE(Stack_alloc, Stack) \
- do \
- { \
- YYSIZE_T yynewbytes; \
- YYCOPY (&yyptr->Stack_alloc, Stack, yysize); \
- Stack = &yyptr->Stack_alloc; \
- yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \
- yyptr += yynewbytes / sizeof (*yyptr); \
- } \
- while (YYID (0))
-
-#endif
-
-#if defined YYCOPY_NEEDED && YYCOPY_NEEDED
/* Copy COUNT objects from FROM to TO. The source and destination do
not overlap. */
# ifndef YYCOPY
@@ -727,7 +708,24 @@
while (YYID (0))
# endif
# endif
-#endif /* !YYCOPY_NEEDED */
+
+/* Relocate STACK from its old location to the new one. The
+ local variables YYSIZE and YYSTACKSIZE give the old and new number of
+ elements in the stack, and YYPTR gives the new location of the
+ stack. Advance YYPTR to a properly aligned location for the next
+ stack. */
+# define YYSTACK_RELOCATE(Stack_alloc, Stack) \
+ do \
+ { \
+ YYSIZE_T yynewbytes; \
+ YYCOPY (&yyptr->Stack_alloc, Stack, yysize); \
+ Stack = &yyptr->Stack_alloc; \
+ yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \
+ yyptr += yynewbytes / sizeof (*yyptr); \
+ } \
+ while (YYID (0))
+
+#endif
/* YYFINAL -- State number of the termination state. */
#define YYFINAL 11
@@ -859,8 +857,8 @@
2, 2, 3, 3, 3, 3, 3, 5, 3
};
-/* YYDEFACT[STATE-NAME] -- Default reduction number in state STATE-NUM.
- Performed when YYTABLE doesn't specify something else to do. Zero
+/* YYDEFACT[STATE-NAME] -- Default rule to reduce with in state
+ STATE-NUM when YYTABLE doesn't specify something else to do. Zero
means the default is an error. */
static const yytype_uint8 yydefact[] =
{
@@ -899,7 +897,8 @@
/* YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If
positive, shift that token. If negative, reduce the rule which
- number is the opposite. If YYTABLE_NINF, syntax error. */
+ number is the opposite. If zero, do what YYDEFACT says.
+ If YYTABLE_NINF, syntax error. */
#define YYTABLE_NINF -1
static const yytype_uint8 yytable[] =
{
@@ -921,12 +920,6 @@
26, 27, 28, 23, 24, 25, 0, 26, 27, 28
};
-#define yypact_value_is_default(yystate) \
- ((yystate) == (-18))
-
-#define yytable_value_is_error(yytable_value) \
- YYID (0)
-
static const yytype_int8 yycheck[] =
{
1, 2, 3, 20, 21, 22, 0, 3, 23, 10,
@@ -971,18 +964,9 @@
/* Like YYERROR except do call yyerror. This remains here temporarily
to ease the transition to the new meaning of YYERROR, for GCC.
- Once GCC version 2 has supplanted version 1, this can go. However,
- YYFAIL appears to be in use. Nevertheless, it is formally deprecated
- in Bison 2.4.2's NEWS entry, where a plan to phase it out is
- discussed. */
+ Once GCC version 2 has supplanted version 1, this can go. */
#define YYFAIL goto yyerrlab
-#if defined YYFAIL
- /* This is here to suppress warnings from the GCC cpp's
- -Wunused-macros. Normally we don't worry about that warning, but
- some users do, and we want to make it easy for users to remove
- YYFAIL uses, which will produce warnings from Bison 2.5. */
-#endif
#define YYRECOVERING() (!!yyerrstatus)
@@ -992,6 +976,7 @@
{ \
yychar = (Token); \
yylval = (Value); \
+ yytoken = YYTRANSLATE (yychar); \
YYPOPSTACK (1); \
goto yybackup; \
} \
@@ -1038,7 +1023,7 @@
we won't break user code: when these are the locations we know. */
#ifndef YY_LOCATION_PRINT
-# if defined YYLTYPE_IS_TRIVIAL && YYLTYPE_IS_TRIVIAL
+# if YYLTYPE_IS_TRIVIAL
# define YY_LOCATION_PRINT(File, Loc) \
fprintf (File, "%d.%d-%d.%d", \
(Loc).first_line, (Loc).first_column, \
@@ -1243,6 +1228,7 @@
# define YYMAXDEPTH 10000
#endif
+
#if YYERROR_VERBOSE
@@ -1345,142 +1331,115 @@
}
# endif
-/* Copy into *YYMSG, which is of size *YYMSG_ALLOC, an error message
- about the unexpected token YYTOKEN for the state stack whose top is
- YYSSP.
-
- Return 0 if *YYMSG was successfully written. Return 1 if *YYMSG is
- not large enough to hold the message. In that case, also set
- *YYMSG_ALLOC to the required number of bytes. Return 2 if the
- required number of bytes is too large to store. */
-static int
-yysyntax_error (YYSIZE_T *yymsg_alloc, char **yymsg,
- yytype_int16 *yyssp, int yytoken)
-{
- YYSIZE_T yysize0 = yytnamerr (0, yytname[yytoken]);
- YYSIZE_T yysize = yysize0;
- YYSIZE_T yysize1;
- enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 };
- /* Internationalized format string. */
- const char *yyformat = 0;
- /* Arguments of yyformat. */
- char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM];
- /* Number of reported tokens (one for the "unexpected", one per
- "expected"). */
- int yycount = 0;
-
- /* There are many possibilities here to consider:
- - Assume YYFAIL is not used. It's too flawed to consider. See
- <http://lists.gnu.org/archive/html/bison-patches/2009-12/msg00024.html>
- for details. YYERROR is fine as it does not invoke this
- function.
- - If this state is a consistent state with a default action, then
- the only way this function was invoked is if the default action
- is an error action. In that case, don't check for expected
- tokens because there are none.
- - The only way there can be no lookahead present (in yychar) is if
- this state is a consistent state with a default action. Thus,
- detecting the absence of a lookahead is sufficient to determine
- that there is no unexpected or expected token to report. In that
- case, just report a simple "syntax error".
- - Don't assume there isn't a lookahead just because this state is a
- consistent state with a default action. There might have been a
- previous inconsistent state, consistent state with a non-default
- action, or user semantic action that manipulated yychar.
- - Of course, the expected token list depends on states to have
- correct lookahead information, and it depends on the parser not
- to perform extra reductions after fetching a lookahead from the
- scanner and before detecting a syntax error. Thus, state merging
- (from LALR or IELR) and default reductions corrupt the expected
- token list. However, the list is correct for canonical LR with
- one exception: it will still contain any token that will not be
- accepted due to an error action in a later state.
- */
- if (yytoken != YYEMPTY)
+/* Copy into YYRESULT an error message about the unexpected token
+ YYCHAR while in state YYSTATE. Return the number of bytes copied,
+ including the terminating null byte. If YYRESULT is null, do not
+ copy anything; just return the number of bytes that would be
+ copied. As a special case, return 0 if an ordinary "syntax error"
+ message will do. Return YYSIZE_MAXIMUM if overflow occurs during
+ size calculation. */
+static YYSIZE_T
+yysyntax_error (char *yyresult, int yystate, int yychar)
+{
+ int yyn = yypact[yystate];
+
+ if (! (YYPACT_NINF < yyn && yyn <= YYLAST))
+ return 0;
+ else
{
- int yyn = yypact[*yyssp];
- yyarg[yycount++] = yytname[yytoken];
- if (!yypact_value_is_default (yyn))
- {
- /* Start YYX at -YYN if negative to avoid negative indexes in
- YYCHECK. In other words, skip the first -YYN actions for
- this state because they are default actions. */
- int yyxbegin = yyn < 0 ? -yyn : 0;
- /* Stay within bounds of both yycheck and yytname. */
- int yychecklim = YYLAST - yyn + 1;
- int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS;
- int yyx;
-
- for (yyx = yyxbegin; yyx < yyxend; ++yyx)
- if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR
- && !yytable_value_is_error (yytable[yyx + yyn]))
- {
- if (yycount == YYERROR_VERBOSE_ARGS_MAXIMUM)
- {
- yycount = 1;
- yysize = yysize0;
- break;
- }
- yyarg[yycount++] = yytname[yyx];
- yysize1 = yysize + yytnamerr (0, yytname[yyx]);
- if (! (yysize <= yysize1
- && yysize1 <= YYSTACK_ALLOC_MAXIMUM))
- return 2;
- yysize = yysize1;
- }
- }
+ int yytype = YYTRANSLATE (yychar);
+ YYSIZE_T yysize0 = yytnamerr (0, yytname[yytype]);
+ YYSIZE_T yysize = yysize0;
+ YYSIZE_T yysize1;
+ int yysize_overflow = 0;
+ enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 };
+ char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM];
+ int yyx;
+
+# if 0
+ /* This is so xgettext sees the translatable formats that are
+ constructed on the fly. */
+ YY_("syntax error, unexpected %s");
+ YY_("syntax error, unexpected %s, expecting %s");
+ YY_("syntax error, unexpected %s, expecting %s or %s");
+ YY_("syntax error, unexpected %s, expecting %s or %s or %s");
+ YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s");
+# endif
+ char *yyfmt;
+ char const *yyf;
+ static char const yyunexpected[] = "syntax error, unexpected %s";
+ static char const yyexpecting[] = ", expecting %s";
+ static char const yyor[] = " or %s";
+ char yyformat[sizeof yyunexpected
+ + sizeof yyexpecting - 1
+ + ((YYERROR_VERBOSE_ARGS_MAXIMUM - 2)
+ * (sizeof yyor - 1))];
+ char const *yyprefix = yyexpecting;
+
+ /* Start YYX at -YYN if negative to avoid negative indexes in
+ YYCHECK. */
+ int yyxbegin = yyn < 0 ? -yyn : 0;
+
+ /* Stay within bounds of both yycheck and yytname. */
+ int yychecklim = YYLAST - yyn + 1;
+ int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS;
+ int yycount = 1;
+
+ yyarg[0] = yytname[yytype];
+ yyfmt = yystpcpy (yyformat, yyunexpected);
+
+ for (yyx = yyxbegin; yyx < yyxend; ++yyx)
+ if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR)
+ {
+ if (yycount == YYERROR_VERBOSE_ARGS_MAXIMUM)
+ {
+ yycount = 1;
+ yysize = yysize0;
+ yyformat[sizeof yyunexpected - 1] = '\0';
+ break;
+ }
+ yyarg[yycount++] = yytname[yyx];
+ yysize1 = yysize + yytnamerr (0, yytname[yyx]);
+ yysize_overflow |= (yysize1 < yysize);
+ yysize = yysize1;
+ yyfmt = yystpcpy (yyfmt, yyprefix);
+ yyprefix = yyor;
+ }
+
+ yyf = YY_(yyformat);
+ yysize1 = yysize + yystrlen (yyf);
+ yysize_overflow |= (yysize1 < yysize);
+ yysize = yysize1;
+
+ if (yysize_overflow)
+ return YYSIZE_MAXIMUM;
+
+ if (yyresult)
+ {
+ /* Avoid sprintf, as that infringes on the user's name space.
+ Don't have undefined behavior even if the translation
+ produced a string with the wrong number of "%s"s. */
+ char *yyp = yyresult;
+ int yyi = 0;
+ while ((*yyp = *yyf) != '\0')
+ {
+ if (*yyp == '%' && yyf[1] == 's' && yyi < yycount)
+ {
+ yyp += yytnamerr (yyp, yyarg[yyi++]);
+ yyf += 2;
+ }
+ else
+ {
+ yyp++;
+ yyf++;
+ }
+ }
+ }
+ return yysize;
}
-
- switch (yycount)
- {
-# define YYCASE_(N, S) \
- case N: \
- yyformat = S; \
- break
- YYCASE_(0, YY_("syntax error"));
- YYCASE_(1, YY_("syntax error, unexpected %s"));
- YYCASE_(2, YY_("syntax error, unexpected %s, expecting %s"));
- YYCASE_(3, YY_("syntax error, unexpected %s, expecting %s or %s"));
- YYCASE_(4, YY_("syntax error, unexpected %s, expecting %s or %s or %s"));
- YYCASE_(5, YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s"));
-# undef YYCASE_
- }
-
- yysize1 = yysize + yystrlen (yyformat);
- if (! (yysize <= yysize1 && yysize1 <= YYSTACK_ALLOC_MAXIMUM))
- return 2;
- yysize = yysize1;
-
- if (*yymsg_alloc < yysize)
- {
- *yymsg_alloc = 2 * yysize;
- if (! (yysize <= *yymsg_alloc
- && *yymsg_alloc <= YYSTACK_ALLOC_MAXIMUM))
- *yymsg_alloc = YYSTACK_ALLOC_MAXIMUM;
- return 1;
- }
-
- /* Avoid sprintf, as that infringes on the user's name space.
- Don't have undefined behavior even if the translation
- produced a string with the wrong number of "%s"s. */
- {
- char *yyp = *yymsg;
- int yyi = 0;
- while ((*yyp = *yyformat) != '\0')
- if (*yyp == '%' && yyformat[1] == 's' && yyi < yycount)
- {
- yyp += yytnamerr (yyp, yyarg[yyi++]);
- yyformat += 2;
- }
- else
- {
- yyp++;
- yyformat++;
- }
- }
- return 0;
}
#endif /* YYERROR_VERBOSE */
+
/*-----------------------------------------------.
| Release the memory associated to this symbol. |
@@ -1511,217 +1470,216 @@
{
case 4: /* "TOK_COLONCOLON" */
-/* Line 1391 of yacc.c */
+/* Line 1000 of yacc.c */
#line 368 "ast_expr2.y"
{ free_value((yyvaluep->val)); };
-/* Line 1391 of yacc.c */
-#line 1520 "ast_expr2.c"
+/* Line 1000 of yacc.c */
+#line 1479 "ast_expr2.c"
break;
case 5: /* "TOK_COND" */
-/* Line 1391 of yacc.c */
+/* Line 1000 of yacc.c */
#line 368 "ast_expr2.y"
{ free_value((yyvaluep->val)); };
-/* Line 1391 of yacc.c */
-#line 1529 "ast_expr2.c"
+/* Line 1000 of yacc.c */
+#line 1488 "ast_expr2.c"
break;
case 6: /* "TOK_OR" */
-/* Line 1391 of yacc.c */
+/* Line 1000 of yacc.c */
#line 368 "ast_expr2.y"
{ free_value((yyvaluep->val)); };
-/* Line 1391 of yacc.c */
-#line 1538 "ast_expr2.c"
+/* Line 1000 of yacc.c */
+#line 1497 "ast_expr2.c"
break;
case 7: /* "TOK_AND" */
-/* Line 1391 of yacc.c */
+/* Line 1000 of yacc.c */
#line 368 "ast_expr2.y"
{ free_value((yyvaluep->val)); };
-/* Line 1391 of yacc.c */
-#line 1547 "ast_expr2.c"
+/* Line 1000 of yacc.c */
+#line 1506 "ast_expr2.c"
break;
case 8: /* "TOK_NE" */
-/* Line 1391 of yacc.c */
+/* Line 1000 of yacc.c */
#line 368 "ast_expr2.y"
{ free_value((yyvaluep->val)); };
-/* Line 1391 of yacc.c */
-#line 1556 "ast_expr2.c"
+/* Line 1000 of yacc.c */
+#line 1515 "ast_expr2.c"
break;
case 9: /* "TOK_LE" */
-/* Line 1391 of yacc.c */
+/* Line 1000 of yacc.c */
#line 368 "ast_expr2.y"
{ free_value((yyvaluep->val)); };
-/* Line 1391 of yacc.c */
-#line 1565 "ast_expr2.c"
+/* Line 1000 of yacc.c */
+#line 1524 "ast_expr2.c"
break;
case 10: /* "TOK_GE" */
-/* Line 1391 of yacc.c */
+/* Line 1000 of yacc.c */
#line 368 "ast_expr2.y"
{ free_value((yyvaluep->val)); };
-/* Line 1391 of yacc.c */
-#line 1574 "ast_expr2.c"
+/* Line 1000 of yacc.c */
+#line 1533 "ast_expr2.c"
break;
case 11: /* "TOK_LT" */
-/* Line 1391 of yacc.c */
+/* Line 1000 of yacc.c */
#line 368 "ast_expr2.y"
{ free_value((yyvaluep->val)); };
-/* Line 1391 of yacc.c */
-#line 1583 "ast_expr2.c"
+/* Line 1000 of yacc.c */
+#line 1542 "ast_expr2.c"
break;
case 12: /* "TOK_GT" */
-/* Line 1391 of yacc.c */
+/* Line 1000 of yacc.c */
#line 368 "ast_expr2.y"
{ free_value((yyvaluep->val)); };
-/* Line 1391 of yacc.c */
-#line 1592 "ast_expr2.c"
+/* Line 1000 of yacc.c */
+#line 1551 "ast_expr2.c"
break;
case 13: /* "TOK_EQ" */
-/* Line 1391 of yacc.c */
+/* Line 1000 of yacc.c */
#line 368 "ast_expr2.y"
{ free_value((yyvaluep->val)); };
-/* Line 1391 of yacc.c */
-#line 1601 "ast_expr2.c"
+/* Line 1000 of yacc.c */
+#line 1560 "ast_expr2.c"
break;
case 14: /* "TOK_MINUS" */
-/* Line 1391 of yacc.c */
+/* Line 1000 of yacc.c */
#line 368 "ast_expr2.y"
{ free_value((yyvaluep->val)); };
-/* Line 1391 of yacc.c */
-#line 1610 "ast_expr2.c"
+/* Line 1000 of yacc.c */
+#line 1569 "ast_expr2.c"
break;
case 15: /* "TOK_PLUS" */
-/* Line 1391 of yacc.c */
+/* Line 1000 of yacc.c */
#line 368 "ast_expr2.y"
{ free_value((yyvaluep->val)); };
-/* Line 1391 of yacc.c */
-#line 1619 "ast_expr2.c"
+/* Line 1000 of yacc.c */
+#line 1578 "ast_expr2.c"
break;
case 16: /* "TOK_MOD" */
-/* Line 1391 of yacc.c */
+/* Line 1000 of yacc.c */
#line 368 "ast_expr2.y"
{ free_value((yyvaluep->val)); };
-/* Line 1391 of yacc.c */
-#line 1628 "ast_expr2.c"
+/* Line 1000 of yacc.c */
+#line 1587 "ast_expr2.c"
break;
case 17: /* "TOK_DIV" */
-/* Line 1391 of yacc.c */
+/* Line 1000 of yacc.c */
#line 368 "ast_expr2.y"
{ free_value((yyvaluep->val)); };
-/* Line 1391 of yacc.c */
-#line 1637 "ast_expr2.c"
+/* Line 1000 of yacc.c */
+#line 1596 "ast_expr2.c"
break;
case 18: /* "TOK_MULT" */
-/* Line 1391 of yacc.c */
+/* Line 1000 of yacc.c */
#line 368 "ast_expr2.y"
{ free_value((yyvaluep->val)); };
-/* Line 1391 of yacc.c */
-#line 1646 "ast_expr2.c"
+/* Line 1000 of yacc.c */
+#line 1605 "ast_expr2.c"
break;
case 19: /* "TOK_COMPL" */
-/* Line 1391 of yacc.c */
+/* Line 1000 of yacc.c */
#line 368 "ast_expr2.y"
{ free_value((yyvaluep->val)); };
-/* Line 1391 of yacc.c */
-#line 1655 "ast_expr2.c"
+/* Line 1000 of yacc.c */
+#line 1614 "ast_expr2.c"
break;
case 20: /* "TOK_TILDETILDE" */
-/* Line 1391 of yacc.c */
+/* Line 1000 of yacc.c */
#line 368 "ast_expr2.y"
{ free_value((yyvaluep->val)); };
-/* Line 1391 of yacc.c */
-#line 1664 "ast_expr2.c"
+/* Line 1000 of yacc.c */
+#line 1623 "ast_expr2.c"
break;
case 21: /* "TOK_EQTILDE" */
-/* Line 1391 of yacc.c */
+/* Line 1000 of yacc.c */
#line 368 "ast_expr2.y"
{ free_value((yyvaluep->val)); };
-/* Line 1391 of yacc.c */
-#line 1673 "ast_expr2.c"
+/* Line 1000 of yacc.c */
+#line 1632 "ast_expr2.c"
break;
case 22: /* "TOK_COLON" */
-/* Line 1391 of yacc.c */
+/* Line 1000 of yacc.c */
#line 368 "ast_expr2.y"
{ free_value((yyvaluep->val)); };
-/* Line 1391 of yacc.c */
-#line 1682 "ast_expr2.c"
+/* Line 1000 of yacc.c */
+#line 1641 "ast_expr2.c"
break;
case 23: /* "TOK_LP" */
-/* Line 1391 of yacc.c */
+/* Line 1000 of yacc.c */
#line 368 "ast_expr2.y"
{ free_value((yyvaluep->val)); };
-/* Line 1391 of yacc.c */
-#line 1691 "ast_expr2.c"
+/* Line 1000 of yacc.c */
+#line 1650 "ast_expr2.c"
break;
case 24: /* "TOK_RP" */
-/* Line 1391 of yacc.c */
+/* Line 1000 of yacc.c */
#line 368 "ast_expr2.y"
{ free_value((yyvaluep->val)); };
-/* Line 1391 of yacc.c */
-#line 1700 "ast_expr2.c"
+/* Line 1000 of yacc.c */
+#line 1659 "ast_expr2.c"
break;
case 25: /* "TOKEN" */
-/* Line 1391 of yacc.c */
+/* Line 1000 of yacc.c */
#line 368 "ast_expr2.y"
{ free_value((yyvaluep->val)); };
-/* Line 1391 of yacc.c */
-#line 1709 "ast_expr2.c"
+/* Line 1000 of yacc.c */
+#line 1668 "ast_expr2.c"
break;
case 29: /* "expr" */
-/* Line 1391 of yacc.c */
+/* Line 1000 of yacc.c */
#line 368 "ast_expr2.y"
{ free_value((yyvaluep->val)); };
-/* Line 1391 of yacc.c */
-#line 1718 "ast_expr2.c"
+/* Line 1000 of yacc.c */
+#line 1677 "ast_expr2.c"
break;
default:
break;
}
}
-
/* Prevent warnings from -Wmissing-prototypes. */
#ifdef YYPARSE_PARAM
@@ -1739,9 +1697,12 @@
#endif /* ! YYPARSE_PARAM */
-/*----------.
-| yyparse. |
-`----------*/
+
+
+
+/*-------------------------.
+| yyparse or yypush_parse. |
+`-------------------------*/
#ifdef YYPARSE_PARAM
#if (defined __STDC__ || defined __C99__FUNC__ \
@@ -1805,7 +1766,7 @@
YYLTYPE *yylsp;
/* The locations where the error started and ended. */
- YYLTYPE yyerror_range[3];
+ YYLTYPE yyerror_range[2];
YYSIZE_T yystacksize;
@@ -1852,7 +1813,7 @@
yyvsp = yyvs;
yylsp = yyls;
-#if defined YYLTYPE_IS_TRIVIAL && YYLTYPE_IS_TRIVIAL
+#if YYLTYPE_IS_TRIVIAL
/* Initialize the default location before parsing starts. */
yylloc.first_line = yylloc.last_line = 1;
yylloc.first_column = yylloc.last_column = 1;
@@ -1954,7 +1915,7 @@
/* First try to decide what to do without reference to lookahead token. */
yyn = yypact[yystate];
- if (yypact_value_is_default (yyn))
+ if (yyn == YYPACT_NINF)
goto yydefault;
/* Not known => get a lookahead token if don't already have one. */
@@ -1985,8 +1946,8 @@
yyn = yytable[yyn];
if (yyn <= 0)
{
- if (yytable_value_is_error (yyn))
- goto yyerrlab;
+ if (yyn == 0 || yyn == YYTABLE_NINF)
+ goto yyerrlab;
yyn = -yyn;
goto yyreduce;
}
@@ -2042,7 +2003,7 @@
{
case 2:
-/* Line 1806 of yacc.c */
+/* Line 1455 of yacc.c */
#line 374 "ast_expr2.y"
{ ((struct parse_io *)parseio)->val = (struct val *)calloc(sizeof(struct val),1);
((struct parse_io *)parseio)->val->type = (yyvsp[(1) - (1)].val)->type;
@@ -2051,287 +2012,276 @@
else
((struct parse_io *)parseio)->val->u.s = (yyvsp[(1) - (1)].val)->u.s;
free((yyvsp[(1) - (1)].val));
- }
+ ;}
break;
case 3:
-/* Line 1806 of yacc.c */
+/* Line 1455 of yacc.c */
#line 382 "ast_expr2.y"
{/* nothing */ ((struct parse_io *)parseio)->val = (struct val *)calloc(sizeof(struct val),1);
((struct parse_io *)parseio)->val->type = AST_EXPR_string;
((struct parse_io *)parseio)->val->u.s = strdup("");
- }
+ ;}
break;
case 4:
-/* Line 1806 of yacc.c */
+/* Line 1455 of yacc.c */
#line 389 "ast_expr2.y"
- { (yyval.arglist) = alloc_expr_node(AST_EXPR_NODE_VAL); (yyval.arglist)->val = (yyvsp[(1) - (1)].val);}
+ { (yyval.arglist) = alloc_expr_node(AST_EXPR_NODE_VAL); (yyval.arglist)->val = (yyvsp[(1) - (1)].val);;}
break;
case 5:
-/* Line 1806 of yacc.c */
+/* Line 1455 of yacc.c */
#line 390 "ast_expr2.y"
{struct expr_node *x = alloc_expr_node(AST_EXPR_NODE_VAL);
struct expr_node *t;
DESTROY((yyvsp[(2) - (3)].val));
for (t=(yyvsp[(1) - (3)].arglist);t->right;t=t->right)
;
- (yyval.arglist) = (yyvsp[(1) - (3)].arglist); t->right = x; x->val = (yyvsp[(3) - (3)].val);}
+ (yyval.arglist) = (yyvsp[(1) - (3)].arglist); t->right = x; x->val = (yyvsp[(3) - (3)].val);;}
break;
case 6:
-/* Line 1806 of yacc.c */
+/* Line 1455 of yacc.c */
#line 396 "ast_expr2.y"
{struct expr_node *x = alloc_expr_node(AST_EXPR_NODE_VAL);
struct expr_node *t; /* NULL args should OK */
DESTROY((yyvsp[(2) - (2)].val));
for (t=(yyvsp[(1) - (2)].arglist);t->right;t=t->right)
;
- (yyval.arglist) = (yyvsp[(1) - (2)].arglist); t->right = x; x->val = make_str("");}
+ (yyval.arglist) = (yyvsp[(1) - (2)].arglist); t->right = x; x->val = make_str("");;}
break;
case 7:
-/* Line 1806 of yacc.c */
+/* Line 1455 of yacc.c */
#line 405 "ast_expr2.y"
{ (yyval.val) = op_func((yyvsp[(1) - (4)].val),(yyvsp[(3) - (4)].arglist), ((struct parse_io *)parseio)->chan);
DESTROY((yyvsp[(2) - (4)].val));
DESTROY((yyvsp[(4) - (4)].val));
DESTROY((yyvsp[(1) - (4)].val));
destroy_arglist((yyvsp[(3) - (4)].arglist));
- }
+ ;}
break;
case 8:
-/* Line 1806 of yacc.c */
+/* Line 1455 of yacc.c */
#line 411 "ast_expr2.y"
- {(yyval.val) = (yyvsp[(1) - (1)].val);}
+ {(yyval.val) = (yyvsp[(1) - (1)].val);;}
break;
case 9:
-/* Line 1806 of yacc.c */
+/* Line 1455 of yacc.c */
#line 412 "ast_expr2.y"
{ (yyval.val) = (yyvsp[(2) - (3)].val);
(yyloc).first_column = (yylsp[(1) - (3)]).first_column; (yyloc).last_column = (yylsp[(3) - (3)]).last_column;
(yyloc).first_line=0; (yyloc).last_line=0;
- DESTROY((yyvsp[(1) - (3)].val)); DESTROY((yyvsp[(3) - (3)].val)); }
+ DESTROY((yyvsp[(1) - (3)].val)); DESTROY((yyvsp[(3) - (3)].val)); ;}
break;
case 10:
-/* Line 1806 of yacc.c */
+/* Line 1455 of yacc.c */
#line 416 "ast_expr2.y"
{ (yyval.val) = op_or ((yyvsp[(1) - (3)].val), (yyvsp[(3) - (3)].val));
DESTROY((yyvsp[(2) - (3)].val));
(yyloc).first_column = (yylsp[(1) - (3)]).first_column; (yyloc).last_column = (yylsp[(3) - (3)]).last_column;
- (yyloc).first_line=0; (yyloc).last_line=0;}
+ (yyloc).first_line=0; (yyloc).last_line=0;;}
break;
case 11:
-/* Line 1806 of yacc.c */
+/* Line 1455 of yacc.c */
#line 420 "ast_expr2.y"
{ (yyval.val) = op_and ((yyvsp[(1) - (3)].val), (yyvsp[(3) - (3)].val));
DESTROY((yyvsp[(2) - (3)].val));
(yyloc).first_column = (yylsp[(1) - (3)]).first_column; (yyloc).last_column = (yylsp[(3) - (3)]).last_column;
- (yyloc).first_line=0; (yyloc).last_line=0;}
+ (yyloc).first_line=0; (yyloc).last_line=0;;}
break;
case 12:
-/* Line 1806 of yacc.c */
+/* Line 1455 of yacc.c */
#line 424 "ast_expr2.y"
{ (yyval.val) = op_eq ((yyvsp[(1) - (3)].val), (yyvsp[(3) - (3)].val));
DESTROY((yyvsp[(2) - (3)].val));
(yyloc).first_column = (yylsp[(1) - (3)]).first_column; (yyloc).last_column = (yylsp[(3) - (3)]).last_column;
- (yyloc).first_line=0; (yyloc).last_line=0;}
+ (yyloc).first_line=0; (yyloc).last_line=0;;}
break;
case 13:
-/* Line 1806 of yacc.c */
+/* Line 1455 of yacc.c */
#line 428 "ast_expr2.y"
{ (yyval.val) = op_gt ((yyvsp[(1) - (3)].val), (yyvsp[(3) - (3)].val));
DESTROY((yyvsp[(2) - (3)].val));
(yyloc).first_column = (yylsp[(1) - (3)]).first_column; (yyloc).last_column = (yylsp[(3) - (3)]).last_column;
- (yyloc).first_line=0; (yyloc).last_line=0;}
+ (yyloc).first_line=0; (yyloc).last_line=0;;}
break;
case 14:
-/* Line 1806 of yacc.c */
+/* Line 1455 of yacc.c */
#line 432 "ast_expr2.y"
[... 628 lines stripped ...]
More information about the asterisk-commits
mailing list