Bug Summary

File:libglusterfs/src/y.tab.c
Location:line 1214, column 3
Description:Value stored to 'yytoken' is never read

Annotated Source Code

1/* A Bison parser, made by GNU Bison 2.5. */
2
3/* Bison implementation for Yacc-like parsers in C
4
5 Copyright (C) 1984, 1989-1990, 2000-2011 Free Software Foundation, Inc.
6
7 This program is free software: you can redistribute it and/or modify
8 it under the terms of the GNU General Public License as published by
9 the Free Software Foundation, either version 3 of the License, or
10 (at your option) any later version.
11
12 This program is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU General Public License for more details.
16
17 You should have received a copy of the GNU General Public License
18 along with this program. If not, see <http://www.gnu.org/licenses/>. */
19
20/* As a special exception, you may create a larger work that contains
21 part or all of the Bison parser skeleton and distribute that work
22 under terms of your choice, so long as that work isn't itself a
23 parser generator using the skeleton or a modified version thereof
24 as a parser skeleton. Alternatively, if you modify or redistribute
25 the parser skeleton itself, you may (at your option) remove this
26 special exception, which will cause the skeleton and the resulting
27 Bison output files to be licensed under the GNU General Public
28 License without this special exception.
29
30 This special exception was added by the Free Software Foundation in
31 version 2.2 of Bison. */
32
33/* C LALR(1) parser skeleton written by Richard Stallman, by
34 simplifying the original so-called "semantic" parser. */
35
36/* All symbols defined below should begin with yy or YY, to avoid
37 infringing on user name space. This should be done even for local
38 variables, as they might otherwise be expanded by user macros.
39 There are some unavoidable exceptions within include files to
40 define necessary library symbols; they are noted "INFRINGES ON
41 USER NAME SPACE" below. */
42
43/* Identify Bison output. */
44#define YYBISON1 1
45
46/* Bison version. */
47#define YYBISON_VERSION"2.5" "2.5"
48
49/* Skeleton name. */
50#define YYSKELETON_NAME"yacc.c" "yacc.c"
51
52/* Pure parsers. */
53#define YYPURE0 0
54
55/* Push parsers. */
56#define YYPUSH0 0
57
58/* Pull parsers. */
59#define YYPULL1 1
60
61/* Using locations. */
62#define YYLSP_NEEDED0 0
63
64
65
66/* Copy the first part of user declarations. */
67
68/* Line 268 of yacc.c */
69#line 13 "./graph.y"
70
71#include <stdio.h>
72#include <string.h>
73#include <stdlib.h>
74#include <errno(*__errno_location ()).h>
75#include <sys/mman.h>
76#include <sys/types.h>
77#include <sys/wait.h>
78
79#define RELAX_POISONING
80
81#include "xlator.h"
82#include "graph-utils.h"
83#include "logging.h"
84
85static int new_volume (char *name);
86static int volume_type (char *type);
87static int volume_option (char *key, char *value);
88static int volume_sub (char *sub);
89static int volume_end (void);
90static void sub_error (void);
91static void type_error (void);
92static void option_error (void);
93
94#define YYSTYPEchar * char *
95#define GF_CMD_BUFFER_LEN(8 * 1024ULL) (8 * GF_UNIT_KB1024ULL)
96
97int yyerror (const char *);
98int yylex ();
99
100
101/* Line 268 of yacc.c */
102#line 103 "y.tab.c"
103
104/* Enabling traces. */
105#ifndef YYDEBUG0
106# define YYDEBUG0 0
107#endif
108
109/* Enabling verbose error messages. */
110#ifdef YYERROR_VERBOSE0
111# undef YYERROR_VERBOSE0
112# define YYERROR_VERBOSE0 1
113#else
114# define YYERROR_VERBOSE0 0
115#endif
116
117/* Enabling the token table. */
118#ifndef YYTOKEN_TABLE0
119# define YYTOKEN_TABLE0 0
120#endif
121
122
123/* Tokens. */
124#ifndef YYTOKENTYPE
125# define YYTOKENTYPE
126 /* Put the tokens into the symbol table, so that GDB and other debuggers
127 know about them. */
128 enum yytokentype {
129 VOLUME_BEGIN258 = 258,
130 VOLUME_END259 = 259,
131 OPTION260 = 260,
132 NEWLINE261 = 261,
133 SUBVOLUME262 = 262,
134 ID263 = 263,
135 WHITESPACE264 = 264,
136 COMMENT265 = 265,
137 TYPE266 = 266,
138 STRING_TOK267 = 267
139 };
140#endif
141/* Tokens. */
142#define VOLUME_BEGIN258 258
143#define VOLUME_END259 259
144#define OPTION260 260
145#define NEWLINE261 261
146#define SUBVOLUME262 262
147#define ID263 263
148#define WHITESPACE264 264
149#define COMMENT265 265
150#define TYPE266 266
151#define STRING_TOK267 267
152
153
154
155
156#if ! defined YYSTYPEchar * && ! defined YYSTYPE_IS_DECLARED
157typedef int YYSTYPEchar *;
158# define YYSTYPE_IS_TRIVIAL 1
159# define yystype YYSTYPEchar * /* obsolescent; will be withdrawn */
160# define YYSTYPE_IS_DECLARED 1
161#endif
162
163
164/* Copy the second part of user declarations. */
165
166
167/* Line 343 of yacc.c */
168#line 169 "y.tab.c"
169
170#ifdef short
171# undef short
172#endif
173
174#ifdef YYTYPE_UINT8
175typedef YYTYPE_UINT8 yytype_uint8;
176#else
177typedef unsigned char yytype_uint8;
178#endif
179
180#ifdef YYTYPE_INT8
181typedef YYTYPE_INT8 yytype_int8;
182#elif (defined __STDC__1 || defined __C99__FUNC__ \
183 || defined __cplusplus || defined _MSC_VER)
184typedef signed char yytype_int8;
185#else
186typedef short int yytype_int8;
187#endif
188
189#ifdef YYTYPE_UINT16
190typedef YYTYPE_UINT16 yytype_uint16;
191#else
192typedef unsigned short int yytype_uint16;
193#endif
194
195#ifdef YYTYPE_INT16
196typedef YYTYPE_INT16 yytype_int16;
197#else
198typedef short int yytype_int16;
199#endif
200
201#ifndef YYSIZE_Tunsigned int
202# ifdef __SIZE_TYPE__unsigned int
203# define YYSIZE_Tunsigned int __SIZE_TYPE__unsigned int
204# elif defined size_t
205# define YYSIZE_Tunsigned int size_t
206# elif ! defined YYSIZE_Tunsigned int && (defined __STDC__1 || defined __C99__FUNC__ \
207 || defined __cplusplus || defined _MSC_VER)
208# include <stddef.h> /* INFRINGES ON USER NAME SPACE */
209# define YYSIZE_Tunsigned int size_t
210# else
211# define YYSIZE_Tunsigned int unsigned int
212# endif
213#endif
214
215#define YYSIZE_MAXIMUM((unsigned int) -1) ((YYSIZE_Tunsigned int) -1)
216
217#ifndef YY_
218# if defined YYENABLE_NLS && YYENABLE_NLS
219# if ENABLE_NLS
220# include <libintl.h> /* INFRINGES ON USER NAME SPACE */
221# define YY_(msgid)msgid dgettext ("bison-runtime", msgid)
222# endif
223# endif
224# ifndef YY_
225# define YY_(msgid)msgid msgid
226# endif
227#endif
228
229/* Suppress unused-variable warnings by "using" E. */
230#if ! defined lint || defined __GNUC__4
231# define YYUSE(e)((void) (e)) ((void) (e))
232#else
233# define YYUSE(e)((void) (e)) /* empty */
234#endif
235
236/* Identity function, used to suppress warnings about constant conditions. */
237#ifndef lint
238# define YYID(n)(n) (n)
239#else
240#if (defined __STDC__1 || defined __C99__FUNC__ \
241 || defined __cplusplus || defined _MSC_VER)
242static int
243YYID (int yyi)(int yyi)
244#else
245static int
246YYID (yyi)(yyi)
247 int yyi;
248#endif
249{
250 return yyi;
251}
252#endif
253
254#if ! defined yyoverflow || YYERROR_VERBOSE0
255
256/* The parser invokes alloca or malloc; define the necessary symbols. */
257
258# ifdef YYSTACK_USE_ALLOCA
259# if YYSTACK_USE_ALLOCA
260# ifdef __GNUC__4
261# define YYSTACK_ALLOCmalloc __builtin_alloca
262# elif defined __BUILTIN_VA_ARG_INCR
263# include <alloca.h> /* INFRINGES ON USER NAME SPACE */
264# elif defined _AIX
265# define YYSTACK_ALLOCmalloc __alloca
266# elif defined _MSC_VER
267# include <malloc.h> /* INFRINGES ON USER NAME SPACE */
268# define alloca _alloca
269# else
270# define YYSTACK_ALLOCmalloc alloca
271# if ! defined _ALLOCA_H1 && ! defined EXIT_SUCCESS0 && (defined __STDC__1 || defined __C99__FUNC__ \
272 || defined __cplusplus || defined _MSC_VER)
273# include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
274# ifndef EXIT_SUCCESS0
275# define EXIT_SUCCESS0 0
276# endif
277# endif
278# endif
279# endif
280# endif
281
282# ifdef YYSTACK_ALLOCmalloc
283 /* Pacify GCC's `empty if-body' warning. */
284# define YYSTACK_FREEfree(Ptr) do { /* empty */; } while (YYID (0)(0))
285# ifndef YYSTACK_ALLOC_MAXIMUM((unsigned int) -1)
286 /* The OS might guarantee only one guard page at the bottom of the stack,
287 and a page size can be as small as 4096 bytes. So we cannot safely
288 invoke alloca (N) if N exceeds 4096. Use a slightly smaller number
289 to allow for a few compiler-allocated temporary stack slots. */
290# define YYSTACK_ALLOC_MAXIMUM((unsigned int) -1) 4032 /* reasonable circa 2006 */
291# endif
292# else
293# define YYSTACK_ALLOCmalloc YYMALLOCmalloc
294# define YYSTACK_FREEfree YYFREEfree
295# ifndef YYSTACK_ALLOC_MAXIMUM((unsigned int) -1)
296# define YYSTACK_ALLOC_MAXIMUM((unsigned int) -1) YYSIZE_MAXIMUM((unsigned int) -1)
297# endif
298# if (defined __cplusplus && ! defined EXIT_SUCCESS0 \
299 && ! ((defined YYMALLOCmalloc || defined malloc) \
300 && (defined YYFREEfree || defined free)))
301# include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
302# ifndef EXIT_SUCCESS0
303# define EXIT_SUCCESS0 0
304# endif
305# endif
306# ifndef YYMALLOCmalloc
307# define YYMALLOCmalloc malloc
308# if ! defined malloc && ! defined EXIT_SUCCESS0 && (defined __STDC__1 || defined __C99__FUNC__ \
309 || defined __cplusplus || defined _MSC_VER)
310void *malloc (YYSIZE_Tunsigned int); /* INFRINGES ON USER NAME SPACE */
311# endif
312# endif
313# ifndef YYFREEfree
314# define YYFREEfree free
315# if ! defined free && ! defined EXIT_SUCCESS0 && (defined __STDC__1 || defined __C99__FUNC__ \
316 || defined __cplusplus || defined _MSC_VER)
317void free (void *); /* INFRINGES ON USER NAME SPACE */
318# endif
319# endif
320# endif
321#endif /* ! defined yyoverflow || YYERROR_VERBOSE */
322
323
324#if (! defined yyoverflow \
325 && (! defined __cplusplus \
326 || (defined YYSTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL)))
327
328/* A type that is properly aligned for any stack member. */
329union yyalloc
330{
331 yytype_int16 yyss_alloc;
332 YYSTYPEchar * yyvs_alloc;
333};
334
335/* The size of the maximum gap between one aligned stack and the next. */
336# define YYSTACK_GAP_MAXIMUM(sizeof (union yyalloc) - 1) (sizeof (union yyalloc) - 1)
337
338/* The size of an array large to enough to hold all stacks, each with
339 N elements. */
340# define YYSTACK_BYTES(N)((N) * (sizeof (yytype_int16) + sizeof (char *)) + (sizeof (union
yyalloc) - 1))
\
341 ((N) * (sizeof (yytype_int16) + sizeof (YYSTYPEchar *)) \
342 + YYSTACK_GAP_MAXIMUM(sizeof (union yyalloc) - 1))
343
344# define YYCOPY_NEEDED1 1
345
346/* Relocate STACK from its old location to the new one. The
347 local variables YYSIZE and YYSTACKSIZE give the old and new number of
348 elements in the stack, and YYPTR gives the new location of the
349 stack. Advance YYPTR to a properly aligned location for the next
350 stack. */
351# define YYSTACK_RELOCATE(Stack_alloc, Stack) \
352 do \
353 { \
354 YYSIZE_Tunsigned int yynewbytes; \
355 YYCOPY (&yyptr->Stack_alloc, Stack, yysize)__builtin_memcpy (&yyptr->Stack_alloc, Stack, (yysize)
* sizeof (*(Stack)))
; \
356 Stack = &yyptr->Stack_alloc; \
357 yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM(sizeof (union yyalloc) - 1); \
358 yyptr += yynewbytes / sizeof (*yyptr); \
359 } \
360 while (YYID (0)(0))
361
362#endif
363
364#if defined YYCOPY_NEEDED1 && YYCOPY_NEEDED1
365/* Copy COUNT objects from FROM to TO. The source and destination do
366 not overlap. */
367# ifndef YYCOPY
368# if defined __GNUC__4 && 1 < __GNUC__4
369# define YYCOPY(To, From, Count)__builtin_memcpy (To, From, (Count) * sizeof (*(From))) \
370 __builtin_memcpy (To, From, (Count) * sizeof (*(From)))
371# else
372# define YYCOPY(To, From, Count)__builtin_memcpy (To, From, (Count) * sizeof (*(From))) \
373 do \
374 { \
375 YYSIZE_Tunsigned int yyi; \
376 for (yyi = 0; yyi < (Count); yyi++) \
377 (To)[yyi] = (From)[yyi]; \
378 } \
379 while (YYID (0)(0))
380# endif
381# endif
382#endif /* !YYCOPY_NEEDED */
383
384/* YYFINAL -- State number of the termination state. */
385#define YYFINAL8 8
386/* YYLAST -- Last index in YYTABLE. */
387#define YYLAST27 27
388
389/* YYNTOKENS -- Number of terminals. */
390#define YYNTOKENS13 13
391/* YYNNTS -- Number of nonterminals. */
392#define YYNNTS12 12
393/* YYNRULES -- Number of rules. */
394#define YYNRULES26 26
395/* YYNRULES -- Number of states. */
396#define YYNSTATES33 33
397
398/* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */
399#define YYUNDEFTOK2 2
400#define YYMAXUTOK267 267
401
402#define YYTRANSLATE(YYX)((unsigned int) (YYX) <= 267 ? yytranslate[YYX] : 2) \
403 ((unsigned int) (YYX) <= YYMAXUTOK267 ? yytranslate[YYX] : YYUNDEFTOK2)
404
405/* YYTRANSLATE[YYLEX] -- Bison symbol number corresponding to YYLEX. */
406static const yytype_uint8 yytranslate[] =
407{
408 0, 2, 2, 2, 2, 2, 2, 2, 2, 2,
409 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
410 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
411 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
412 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
413 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
414 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
415 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
416 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
417 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
418 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
419 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
420 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
421 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
422 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
423 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
424 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
425 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
426 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
427 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
428 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
429 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
430 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
431 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
432 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
433 2, 2, 2, 2, 2, 2, 1, 2, 3, 4,
434 5, 6, 7, 8, 9, 10, 11, 12
435};
436
437#if YYDEBUG0
438/* YYPRHS[YYN] -- Index of the first RHS symbol of rule number YYN in
439 YYRHS. */
440static const yytype_uint8 yyprhs[] =
441{
442 0, 0, 3, 5, 8, 12, 15, 17, 22, 26,
443 30, 33, 36, 40, 42, 45, 47, 50, 52, 54,
444 57, 61, 64, 66, 68, 71, 73
445};
446
447/* YYRHS -- A `-1'-separated list of the rules' RHS. */
448static const yytype_int8 yyrhs[] =
449{
450 14, 0, -1, 15, -1, 14, 15, -1, 16, 18,
451 17, -1, 3, 24, -1, 4, -1, 19, 21, 20,
452 21, -1, 19, 20, 21, -1, 19, 21, 20, -1,
453 19, 20, -1, 19, 21, -1, 21, 20, 21, -1,
454 21, -1, 11, 24, -1, 11, -1, 7, 23, -1,
455 7, -1, 22, -1, 21, 22, -1, 5, 24, 24,
456 -1, 5, 24, -1, 5, -1, 24, -1, 23, 24,
457 -1, 8, -1, 12, -1
458};
459
460/* YYRLINE[YYN] -- source line where rule number YYN was defined. */
461static const yytype_uint8 yyrline[] =
462{
463 0, 46, 46, 46, 48, 49, 50, 52, 53, 54,
464 55, 56, 57, 58, 60, 60, 62, 62, 64, 64,
465 66, 67, 68, 70, 70, 71, 71
466};
467#endif
468
469#if YYDEBUG0 || YYERROR_VERBOSE0 || YYTOKEN_TABLE0
470/* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM.
471 First, the terminals, then, starting at YYNTOKENS, nonterminals. */
472static const char *const yytname[] =
473{
474 "$end", "error", "$undefined", "VOLUME_BEGIN", "VOLUME_END", "OPTION",
475 "NEWLINE", "SUBVOLUME", "ID", "WHITESPACE", "COMMENT", "TYPE",
476 "STRING_TOK", "$accept", "VOLUMES", "VOLUME", "VOLUME_HEADER",
477 "VOLUME_FOOTER", "VOLUME_DATA", "TYPE_LINE", "SUBVOLUME_LINE",
478 "OPTIONS_LINE", "OPTION_LINE", "WORDS", "WORD", 0
479};
480#endif
481
482# ifdef YYPRINT
483/* YYTOKNUM[YYLEX-NUM] -- Internal token number corresponding to
484 token YYLEX-NUM. */
485static const yytype_uint16 yytoknum[] =
486{
487 0, 256, 257, 258, 259, 260, 261, 262, 263, 264,
488 265, 266, 267
489};
490# endif
491
492/* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */
493static const yytype_uint8 yyr1[] =
494{
495 0, 13, 14, 14, 15, 16, 17, 18, 18, 18,
496 18, 18, 18, 18, 19, 19, 20, 20, 21, 21,
497 22, 22, 22, 23, 23, 24, 24
498};
499
500/* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */
501static const yytype_uint8 yyr2[] =
502{
503 0, 2, 1, 2, 3, 2, 1, 4, 3, 3,
504 2, 2, 3, 1, 2, 1, 2, 1, 1, 2,
505 3, 2, 1, 1, 2, 1, 1
506};
507
508/* YYDEFACT[STATE-NAME] -- Default reduction number in state STATE-NUM.
509 Performed when YYTABLE doesn't specify something else to do. Zero
510 means the default is an error. */
511static const yytype_uint8 yydefact[] =
512{
513 0, 0, 0, 2, 0, 25, 26, 5, 1, 3,
514 22, 15, 0, 0, 13, 18, 21, 14, 6, 4,
515 17, 10, 11, 0, 19, 20, 16, 23, 8, 9,
516 12, 24, 7
517};
518
519/* YYDEFGOTO[NTERM-NUM]. */
520static const yytype_int8 yydefgoto[] =
521{
522 -1, 2, 3, 4, 19, 12, 13, 21, 14, 15,
523 26, 7
524};
525
526/* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
527 STATE-NUM. */
528#define YYPACT_NINF-15 -15
529static const yytype_int8 yypact[] =
530{
531 3, 11, 22, -15, -2, -15, -15, -15, -15, -15,
532 11, 11, 6, 19, 19, -15, 11, -15, -15, -15,
533 11, 15, 19, 15, -15, -15, 11, -15, 15, 15,
534 15, -15, 15
535};
536
537/* YYPGOTO[NTERM-NUM]. */
538static const yytype_int8 yypgoto[] =
539{
540 -15, -15, 25, -15, -15, -15, -15, -10, -8, -14,
541 -15, -9
542};
543
544/* YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If
545 positive, shift that token. If negative, reduce the rule which
546 number is the opposite. If YYTABLE_NINF, syntax error. */
547#define YYTABLE_NINF-1 -1
548static const yytype_uint8 yytable[] =
549{
550 24, 16, 17, 10, 23, 22, 1, 25, 24, 11,
551 18, 27, 29, 28, 24, 30, 24, 31, 24, 5,
552 10, 32, 8, 6, 10, 1, 20, 9
553};
554
555#define yypact_value_is_default(yystate)((yystate) == (-15)) \
556 ((yystate) == (-15))
557
558#define yytable_value_is_error(yytable_value)(0) \
559 YYID (0)(0)
560
561static const yytype_uint8 yycheck[] =
562{
563 14, 10, 11, 5, 14, 13, 3, 16, 22, 11,
564 4, 20, 22, 21, 28, 23, 30, 26, 32, 8,
565 5, 29, 0, 12, 5, 3, 7, 2
566};
567
568/* YYSTOS[STATE-NUM] -- The (internal number of the) accessing
569 symbol of state STATE-NUM. */
570static const yytype_uint8 yystos[] =
571{
572 0, 3, 14, 15, 16, 8, 12, 24, 0, 15,
573 5, 11, 18, 19, 21, 22, 24, 24, 4, 17,
574 7, 20, 21, 20, 22, 24, 23, 24, 21, 20,
575 21, 24, 21
576};
577
578#define yyerrok(yyerrstatus = 0) (yyerrstatus = 0)
579#define yyclearin(yychar = (-2)) (yychar = YYEMPTY(-2))
580#define YYEMPTY(-2) (-2)
581#define YYEOF0 0
582
583#define YYACCEPTgoto yyacceptlab goto yyacceptlab
584#define YYABORTgoto yyabortlab goto yyabortlab
585#define YYERRORgoto yyerrorlab goto yyerrorlab
586
587
588/* Like YYERROR except do call yyerror. This remains here temporarily
589 to ease the transition to the new meaning of YYERROR, for GCC.
590 Once GCC version 2 has supplanted version 1, this can go. However,
591 YYFAIL appears to be in use. Nevertheless, it is formally deprecated
592 in Bison 2.4.2's NEWS entry, where a plan to phase it out is
593 discussed. */
594
595#define YYFAILgoto yyerrlab goto yyerrlab
596#if defined YYFAILgoto yyerrlab
597 /* This is here to suppress warnings from the GCC cpp's
598 -Wunused-macros. Normally we don't worry about that warning, but
599 some users do, and we want to make it easy for users to remove
600 YYFAIL uses, which will produce warnings from Bison 2.5. */
601#endif
602
603#define YYRECOVERING()(!!yyerrstatus) (!!yyerrstatus)
604
605#define YYBACKUP(Token, Value)do if (yychar == (-2) && yylen == 1) { yychar = (Token
); yylval = (Value); (yyvsp -= (1), yyssp -= (1)); goto yybackup
; } else { yyerror ("syntax error: cannot back up"); goto yyerrorlab
; } while ((0))
\
606do \
607 if (yychar == YYEMPTY(-2) && yylen == 1) \
608 { \
609 yychar = (Token); \
610 yylval = (Value); \
611 YYPOPSTACK (1)(yyvsp -= (1), yyssp -= (1)); \
612 goto yybackup; \
613 } \
614 else \
615 { \
616 yyerror (YY_("syntax error: cannot back up")"syntax error: cannot back up"); \
617 YYERRORgoto yyerrorlab; \
618 } \
619while (YYID (0)(0))
620
621
622#define YYTERROR1 1
623#define YYERRCODE256 256
624
625
626/* YYLLOC_DEFAULT -- Set CURRENT to span from RHS[1] to RHS[N].
627 If N is 0, then set CURRENT to the empty location which ends
628 the previous symbol: RHS[0] (always defined). */
629
630#define YYRHSLOC(Rhs, K)((Rhs)[K]) ((Rhs)[K])
631#ifndef YYLLOC_DEFAULT
632# define YYLLOC_DEFAULT(Current, Rhs, N)do if ((N)) { (Current).first_line = ((Rhs)[1]).first_line; (
Current).first_column = ((Rhs)[1]).first_column; (Current).last_line
= ((Rhs)[N]).last_line; (Current).last_column = ((Rhs)[N]).last_column
; } else { (Current).first_line = (Current).last_line = ((Rhs
)[0]).last_line; (Current).first_column = (Current).last_column
= ((Rhs)[0]).last_column; } while ((0))
\
633 do \
634 if (YYID (N)(N)) \
635 { \
636 (Current).first_line = YYRHSLOC (Rhs, 1)((Rhs)[1]).first_line; \
637 (Current).first_column = YYRHSLOC (Rhs, 1)((Rhs)[1]).first_column; \
638 (Current).last_line = YYRHSLOC (Rhs, N)((Rhs)[N]).last_line; \
639 (Current).last_column = YYRHSLOC (Rhs, N)((Rhs)[N]).last_column; \
640 } \
641 else \
642 { \
643 (Current).first_line = (Current).last_line = \
644 YYRHSLOC (Rhs, 0)((Rhs)[0]).last_line; \
645 (Current).first_column = (Current).last_column = \
646 YYRHSLOC (Rhs, 0)((Rhs)[0]).last_column; \
647 } \
648 while (YYID (0)(0))
649#endif
650
651
652/* This macro is provided for backward compatibility. */
653
654#ifndef YY_LOCATION_PRINT
655# define YY_LOCATION_PRINT(File, Loc)((void) 0) ((void) 0)
656#endif
657
658
659/* YYLEX -- calling `yylex' with the right arguments. */
660
661#ifdef YYLEX_PARAM
662# define YYLEXyylex () yylex (YYLEX_PARAM)
663#else
664# define YYLEXyylex () yylex ()
665#endif
666
667/* Enable debugging if requested. */
668#if YYDEBUG0
669
670# ifndef YYFPRINTF
671# include <stdio.h> /* INFRINGES ON USER NAME SPACE */
672# define YYFPRINTF fprintf
673# endif
674
675# define YYDPRINTF(Args) \
676do { \
677 if (yydebug) \
678 YYFPRINTF Args; \
679} while (YYID (0)(0))
680
681# define YY_SYMBOL_PRINT(Title, Type, Value, Location) \
682do { \
683 if (yydebug) \
684 { \
685 YYFPRINTF (stderrstderr, "%s ", Title); \
686 yy_symbol_print (stderrstderr, \
687 Type, Value); \
688 YYFPRINTF (stderrstderr, "\n"); \
689 } \
690} while (YYID (0)(0))
691
692
693/*--------------------------------.
694| Print this symbol on YYOUTPUT. |
695`--------------------------------*/
696
697/*ARGSUSED*/
698#if (defined __STDC__1 || defined __C99__FUNC__ \
699 || defined __cplusplus || defined _MSC_VER)
700static void
701yy_symbol_value_print (FILE *yyoutput, int yytype, YYSTYPEchar * const * const yyvaluep)
702#else
703static void
704yy_symbol_value_print (yyoutput, yytype, yyvaluep)
705 FILE *yyoutput;
706 int yytype;
707 YYSTYPEchar * const * const yyvaluep;
708#endif
709{
710 if (!yyvaluep)
711 return;
712# ifdef YYPRINT
713 if (yytype < YYNTOKENS13)
714 YYPRINT (yyoutput, yytoknum[yytype], *yyvaluep);
715# else
716 YYUSE (yyoutput)((void) (yyoutput));
717# endif
718 switch (yytype)
719 {
720 default:
721 break;
722 }
723}
724
725
726/*--------------------------------.
727| Print this symbol on YYOUTPUT. |
728`--------------------------------*/
729
730#if (defined __STDC__1 || defined __C99__FUNC__ \
731 || defined __cplusplus || defined _MSC_VER)
732static void
733yy_symbol_print (FILE *yyoutput, int yytype, YYSTYPEchar * const * const yyvaluep)
734#else
735static void
736yy_symbol_print (yyoutput, yytype, yyvaluep)
737 FILE *yyoutput;
738 int yytype;
739 YYSTYPEchar * const * const yyvaluep;
740#endif
741{
742 if (yytype < YYNTOKENS13)
743 YYFPRINTF (yyoutput, "token %s (", yytname[yytype]);
744 else
745 YYFPRINTF (yyoutput, "nterm %s (", yytname[yytype]);
746
747 yy_symbol_value_print (yyoutput, yytype, yyvaluep);
748 YYFPRINTF (yyoutput, ")");
749}
750
751/*------------------------------------------------------------------.
752| yy_stack_print -- Print the state stack from its BOTTOM up to its |
753| TOP (included). |
754`------------------------------------------------------------------*/
755
756#if (defined __STDC__1 || defined __C99__FUNC__ \
757 || defined __cplusplus || defined _MSC_VER)
758static void
759yy_stack_print (yytype_int16 *yybottom, yytype_int16 *yytop)
760#else
761static void
762yy_stack_print (yybottom, yytop)
763 yytype_int16 *yybottom;
764 yytype_int16 *yytop;
765#endif
766{
767 YYFPRINTF (stderrstderr, "Stack now");
768 for (; yybottom <= yytop; yybottom++)
769 {
770 int yybot = *yybottom;
771 YYFPRINTF (stderrstderr, " %d", yybot);
772 }
773 YYFPRINTF (stderrstderr, "\n");
774}
775
776# define YY_STACK_PRINT(Bottom, Top) \
777do { \
778 if (yydebug) \
779 yy_stack_print ((Bottom), (Top)); \
780} while (YYID (0)(0))
781
782
783/*------------------------------------------------.
784| Report that the YYRULE is going to be reduced. |
785`------------------------------------------------*/
786
787#if (defined __STDC__1 || defined __C99__FUNC__ \
788 || defined __cplusplus || defined _MSC_VER)
789static void
790yy_reduce_print (YYSTYPEchar * *yyvsp, int yyrule)
791#else
792static void
793yy_reduce_print (yyvsp, yyrule)
794 YYSTYPEchar * *yyvsp;
795 int yyrule;
796#endif
797{
798 int yynrhs = yyr2[yyrule];
799 int yyi;
800 unsigned long int yylno = yyrline[yyrule];
801 YYFPRINTF (stderrstderr, "Reducing stack by rule %d (line %lu):\n",
802 yyrule - 1, yylno);
803 /* The symbols being reduced. */
804 for (yyi = 0; yyi < yynrhs; yyi++)
805 {
806 YYFPRINTF (stderrstderr, " $%d = ", yyi + 1);
807 yy_symbol_print (stderrstderr, yyrhs[yyprhs[yyrule] + yyi],
808 &(yyvsp[(yyi + 1) - (yynrhs)])
809 );
810 YYFPRINTF (stderrstderr, "\n");
811 }
812}
813
814# define YY_REDUCE_PRINT(Rule) \
815do { \
816 if (yydebug) \
817 yy_reduce_print (yyvsp, Rule); \
818} while (YYID (0)(0))
819
820/* Nonzero means print parse trace. It is left uninitialized so that
821 multiple parsers can coexist. */
822int yydebug;
823#else /* !YYDEBUG */
824# define YYDPRINTF(Args)
825# define YY_SYMBOL_PRINT(Title, Type, Value, Location)
826# define YY_STACK_PRINT(Bottom, Top)
827# define YY_REDUCE_PRINT(Rule)
828#endif /* !YYDEBUG */
829
830
831/* YYINITDEPTH -- initial size of the parser's stacks. */
832#ifndef YYINITDEPTH200
833# define YYINITDEPTH200 200
834#endif
835
836/* YYMAXDEPTH -- maximum size the stacks can grow to (effective only
837 if the built-in stack extension method is used).
838
839 Do not make this value too large; the results are undefined if
840 YYSTACK_ALLOC_MAXIMUM < YYSTACK_BYTES (YYMAXDEPTH)
841 evaluated with infinite-precision integer arithmetic. */
842
843#ifndef YYMAXDEPTH10000
844# define YYMAXDEPTH10000 10000
845#endif
846
847
848#if YYERROR_VERBOSE0
849
850# ifndef yystrlen
851# if defined __GLIBC__2 && defined _STRING_H1
852# define yystrlen strlen
853# else
854/* Return the length of YYSTR. */
855#if (defined __STDC__1 || defined __C99__FUNC__ \
856 || defined __cplusplus || defined _MSC_VER)
857static YYSIZE_Tunsigned int
858yystrlen (const char *yystr)
859#else
860static YYSIZE_Tunsigned int
861yystrlen (yystr)
862 const char *yystr;
863#endif
864{
865 YYSIZE_Tunsigned int yylen;
866 for (yylen = 0; yystr[yylen]; yylen++)
867 continue;
868 return yylen;
869}
870# endif
871# endif
872
873# ifndef yystpcpy
874# if defined __GLIBC__2 && defined _STRING_H1 && defined _GNU_SOURCE1
875# define yystpcpy stpcpy
876# else
877/* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in
878 YYDEST. */
879#if (defined __STDC__1 || defined __C99__FUNC__ \
880 || defined __cplusplus || defined _MSC_VER)
881static char *
882yystpcpy (char *yydest, const char *yysrc)
883#else
884static char *
885yystpcpy (yydest, yysrc)
886 char *yydest;
887 const char *yysrc;
888#endif
889{
890 char *yyd = yydest;
891 const char *yys = yysrc;
892
893 while ((*yyd++ = *yys++) != '\0')
894 continue;
895
896 return yyd - 1;
897}
898# endif
899# endif
900
901# ifndef yytnamerr
902/* Copy to YYRES the contents of YYSTR after stripping away unnecessary
903 quotes and backslashes, so that it's suitable for yyerror. The
904 heuristic is that double-quoting is unnecessary unless the string
905 contains an apostrophe, a comma, or backslash (other than
906 backslash-backslash). YYSTR is taken from yytname. If YYRES is
907 null, do not copy; instead, return the length of what the result
908 would have been. */
909static YYSIZE_Tunsigned int
910yytnamerr (char *yyres, const char *yystr)
911{
912 if (*yystr == '"')
913 {
914 YYSIZE_Tunsigned int yyn = 0;
915 char const *yyp = yystr;
916
917 for (;;)
918 switch (*++yyp)
919 {
920 case '\'':
921 case ',':
922 goto do_not_strip_quotes;
923
924 case '\\':
925 if (*++yyp != '\\')
926 goto do_not_strip_quotes;
927 /* Fall through. */
928 default:
929 if (yyres)
930 yyres[yyn] = *yyp;
931 yyn++;
932 break;
933
934 case '"':
935 if (yyres)
936 yyres[yyn] = '\0';
937 return yyn;
938 }
939 do_not_strip_quotes: ;
940 }
941
942 if (! yyres)
943 return yystrlen (yystr);
944
945 return yystpcpy (yyres, yystr) - yyres;
946}
947# endif
948
949/* Copy into *YYMSG, which is of size *YYMSG_ALLOC, an error message
950 about the unexpected token YYTOKEN for the state stack whose top is
951 YYSSP.
952
953 Return 0 if *YYMSG was successfully written. Return 1 if *YYMSG is
954 not large enough to hold the message. In that case, also set
955 *YYMSG_ALLOC to the required number of bytes. Return 2 if the
956 required number of bytes is too large to store. */
957static int
958yysyntax_error (YYSIZE_Tunsigned int *yymsg_alloc, char **yymsg,
959 yytype_int16 *yyssp, int yytoken)
960{
961 YYSIZE_Tunsigned int yysize0 = yytnamerr (0, yytname[yytoken]);
962 YYSIZE_Tunsigned int yysize = yysize0;
963 YYSIZE_Tunsigned int yysize1;
964 enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 };
965 /* Internationalized format string. */
966 const char *yyformat = 0;
967 /* Arguments of yyformat. */
968 char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM];
969 /* Number of reported tokens (one for the "unexpected", one per
970 "expected"). */
971 int yycount = 0;
972
973 /* There are many possibilities here to consider:
974 - Assume YYFAIL is not used. It's too flawed to consider. See
975 <http://lists.gnu.org/archive/html/bison-patches/2009-12/msg00024.html>
976 for details. YYERROR is fine as it does not invoke this
977 function.
978 - If this state is a consistent state with a default action, then
979 the only way this function was invoked is if the default action
980 is an error action. In that case, don't check for expected
981 tokens because there are none.
982 - The only way there can be no lookahead present (in yychar) is if
983 this state is a consistent state with a default action. Thus,
984 detecting the absence of a lookahead is sufficient to determine
985 that there is no unexpected or expected token to report. In that
986 case, just report a simple "syntax error".
987 - Don't assume there isn't a lookahead just because this state is a
988 consistent state with a default action. There might have been a
989 previous inconsistent state, consistent state with a non-default
990 action, or user semantic action that manipulated yychar.
991 - Of course, the expected token list depends on states to have
992 correct lookahead information, and it depends on the parser not
993 to perform extra reductions after fetching a lookahead from the
994 scanner and before detecting a syntax error. Thus, state merging
995 (from LALR or IELR) and default reductions corrupt the expected
996 token list. However, the list is correct for canonical LR with
997 one exception: it will still contain any token that will not be
998 accepted due to an error action in a later state.
999 */
1000 if (yytoken != YYEMPTY(-2))
1001 {
1002 int yyn = yypact[*yyssp];
1003 yyarg[yycount++] = yytname[yytoken];
1004 if (!yypact_value_is_default (yyn)((yyn) == (-15)))
1005 {
1006 /* Start YYX at -YYN if negative to avoid negative indexes in
1007 YYCHECK. In other words, skip the first -YYN actions for
1008 this state because they are default actions. */
1009 int yyxbegin = yyn < 0 ? -yyn : 0;
1010 /* Stay within bounds of both yycheck and yytname. */
1011 int yychecklim = YYLAST27 - yyn + 1;
1012 int yyxend = yychecklim < YYNTOKENS13 ? yychecklim : YYNTOKENS13;
1013 int yyx;
1014
1015 for (yyx = yyxbegin; yyx < yyxend; ++yyx)
1016 if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR1
1017 && !yytable_value_is_error (yytable[yyx + yyn])(0))
1018 {
1019 if (yycount == YYERROR_VERBOSE_ARGS_MAXIMUM)
1020 {
1021 yycount = 1;
1022 yysize = yysize0;
1023 break;
1024 }
1025 yyarg[yycount++] = yytname[yyx];
1026 yysize1 = yysize + yytnamerr (0, yytname[yyx]);
1027 if (! (yysize <= yysize1
1028 && yysize1 <= YYSTACK_ALLOC_MAXIMUM((unsigned int) -1)))
1029 return 2;
1030 yysize = yysize1;
1031 }
1032 }
1033 }
1034
1035 switch (yycount)
1036 {
1037# define YYCASE_(N, S) \
1038 case N: \
1039 yyformat = S; \
1040 break
1041 YYCASE_(0, YY_("syntax error")"syntax error");
1042 YYCASE_(1, YY_("syntax error, unexpected %s")"syntax error, unexpected %s");
1043 YYCASE_(2, YY_("syntax error, unexpected %s, expecting %s")"syntax error, unexpected %s, expecting %s");
1044 YYCASE_(3, YY_("syntax error, unexpected %s, expecting %s or %s")"syntax error, unexpected %s, expecting %s or %s");
1045 YYCASE_(4, YY_("syntax error, unexpected %s, expecting %s or %s or %s")"syntax error, unexpected %s, expecting %s or %s or %s");
1046 YYCASE_(5, YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s")"syntax error, unexpected %s, expecting %s or %s or %s or %s");
1047# undef YYCASE_
1048 }
1049
1050 yysize1 = yysize + yystrlen (yyformat);
1051 if (! (yysize <= yysize1 && yysize1 <= YYSTACK_ALLOC_MAXIMUM((unsigned int) -1)))
1052 return 2;
1053 yysize = yysize1;
1054
1055 if (*yymsg_alloc < yysize)
1056 {
1057 *yymsg_alloc = 2 * yysize;
1058 if (! (yysize <= *yymsg_alloc
1059 && *yymsg_alloc <= YYSTACK_ALLOC_MAXIMUM((unsigned int) -1)))
1060 *yymsg_alloc = YYSTACK_ALLOC_MAXIMUM((unsigned int) -1);
1061 return 1;
1062 }
1063
1064 /* Avoid sprintf, as that infringes on the user's name space.
1065 Don't have undefined behavior even if the translation
1066 produced a string with the wrong number of "%s"s. */
1067 {
1068 char *yyp = *yymsg;
1069 int yyi = 0;
1070 while ((*yyp = *yyformat) != '\0')
1071 if (*yyp == '%' && yyformat[1] == 's' && yyi < yycount)
1072 {
1073 yyp += yytnamerr (yyp, yyarg[yyi++]);
1074 yyformat += 2;
1075 }
1076 else
1077 {
1078 yyp++;
1079 yyformat++;
1080 }
1081 }
1082 return 0;
1083}
1084#endif /* YYERROR_VERBOSE */
1085
1086/*-----------------------------------------------.
1087| Release the memory associated to this symbol. |
1088`-----------------------------------------------*/
1089
1090/*ARGSUSED*/
1091#if (defined __STDC__1 || defined __C99__FUNC__ \
1092 || defined __cplusplus || defined _MSC_VER)
1093static void
1094yydestruct (const char *yymsg, int yytype, YYSTYPEchar * *yyvaluep)
1095#else
1096static void
1097yydestruct (yymsg, yytype, yyvaluep)
1098 const char *yymsg;
1099 int yytype;
1100 YYSTYPEchar * *yyvaluep;
1101#endif
1102{
1103 YYUSE (yyvaluep)((void) (yyvaluep));
1104
1105 if (!yymsg)
1106 yymsg = "Deleting";
1107 YY_SYMBOL_PRINT (yymsg, yytype, yyvaluep, yylocationp);
1108
1109 switch (yytype)
1110 {
1111
1112 default:
1113 break;
1114 }
1115}
1116
1117
1118/* Prevent warnings from -Wmissing-prototypes. */
1119#ifdef YYPARSE_PARAM
1120#if defined __STDC__1 || defined __cplusplus
1121int yyparse (void *YYPARSE_PARAM);
1122#else
1123int yyparse ();
1124#endif
1125#else /* ! YYPARSE_PARAM */
1126#if defined __STDC__1 || defined __cplusplus
1127int yyparse (void);
1128#else
1129int yyparse ();
1130#endif
1131#endif /* ! YYPARSE_PARAM */
1132
1133
1134/* The lookahead symbol. */
1135int yychar;
1136
1137/* The semantic value of the lookahead symbol. */
1138YYSTYPEchar * yylval;
1139
1140/* Number of syntax errors so far. */
1141int yynerrs;
1142
1143
1144/*----------.
1145| yyparse. |
1146`----------*/
1147
1148#ifdef YYPARSE_PARAM
1149#if (defined __STDC__1 || defined __C99__FUNC__ \
1150 || defined __cplusplus || defined _MSC_VER)
1151int
1152yyparse (void *YYPARSE_PARAM)
1153#else
1154int
1155yyparse (YYPARSE_PARAM)
1156 void *YYPARSE_PARAM;
1157#endif
1158#else /* ! YYPARSE_PARAM */
1159#if (defined __STDC__1 || defined __C99__FUNC__ \
1160 || defined __cplusplus || defined _MSC_VER)
1161int
1162yyparse (void)
1163#else
1164int
1165yyparse ()
1166
1167#endif
1168#endif
1169{
1170 int yystate;
1171 /* Number of tokens to shift before error messages enabled. */
1172 int yyerrstatus;
1173
1174 /* The stacks and their tools:
1175 `yyss': related to states.
1176 `yyvs': related to semantic values.
1177
1178 Refer to the stacks thru separate pointers, to allow yyoverflow
1179 to reallocate them elsewhere. */
1180
1181 /* The state stack. */
1182 yytype_int16 yyssa[YYINITDEPTH200];
1183 yytype_int16 *yyss;
1184 yytype_int16 *yyssp;
1185
1186 /* The semantic value stack. */
1187 YYSTYPEchar * yyvsa[YYINITDEPTH200];
1188 YYSTYPEchar * *yyvs;
1189 YYSTYPEchar * *yyvsp;
1190
1191 YYSIZE_Tunsigned int yystacksize;
1192
1193 int yyn;
1194 int yyresult;
1195 /* Lookahead token as an internal (translated) token number. */
1196 int yytoken;
1197 /* The variables used to return semantic value and location from the
1198 action routines. */
1199 YYSTYPEchar * yyval;
1200
1201#if YYERROR_VERBOSE0
1202 /* Buffer for error messages, and its allocated size. */
1203 char yymsgbuf[128];
1204 char *yymsg = yymsgbuf;
1205 YYSIZE_Tunsigned int yymsg_alloc = sizeof yymsgbuf;
1206#endif
1207
1208#define YYPOPSTACK(N)(yyvsp -= (N), yyssp -= (N)) (yyvsp -= (N), yyssp -= (N))
1209
1210 /* The number of symbols on the RHS of the reduced rule.
1211 Keep to zero when no symbol should be popped. */
1212 int yylen = 0;
1213
1214 yytoken = 0;
Value stored to 'yytoken' is never read
1215 yyss = yyssa;
1216 yyvs = yyvsa;
1217 yystacksize = YYINITDEPTH200;
1218
1219 YYDPRINTF ((stderr, "Starting parse\n"));
1220
1221 yystate = 0;
1222 yyerrstatus = 0;
1223 yynerrs = 0;
1224 yychar = YYEMPTY(-2); /* Cause a token to be read. */
1225
1226 /* Initialize stack pointers.
1227 Waste one element of value and location stack
1228 so that they stay on the same level as the state stack.
1229 The wasted elements are never initialized. */
1230 yyssp = yyss;
1231 yyvsp = yyvs;
1232
1233 goto yysetstate;
1234
1235/*------------------------------------------------------------.
1236| yynewstate -- Push a new state, which is found in yystate. |
1237`------------------------------------------------------------*/
1238 yynewstate:
1239 /* In all cases, when you get here, the value and location stacks
1240 have just been pushed. So pushing a state here evens the stacks. */
1241 yyssp++;
1242
1243 yysetstate:
1244 *yyssp = yystate;
1245
1246 if (yyss + yystacksize - 1 <= yyssp)
1247 {
1248 /* Get the current used size of the three stacks, in elements. */
1249 YYSIZE_Tunsigned int yysize = yyssp - yyss + 1;
1250
1251#ifdef yyoverflow
1252 {
1253 /* Give user a chance to reallocate the stack. Use copies of
1254 these so that the &'s don't force the real ones into
1255 memory. */
1256 YYSTYPEchar * *yyvs1 = yyvs;
1257 yytype_int16 *yyss1 = yyss;
1258
1259 /* Each stack pointer address is followed by the size of the
1260 data in use in that stack, in bytes. This used to be a
1261 conditional around just the two extra args, but that might
1262 be undefined if yyoverflow is a macro. */
1263 yyoverflow (YY_("memory exhausted")"memory exhausted",
1264 &yyss1, yysize * sizeof (*yyssp),
1265 &yyvs1, yysize * sizeof (*yyvsp),
1266 &yystacksize);
1267
1268 yyss = yyss1;
1269 yyvs = yyvs1;
1270 }
1271#else /* no yyoverflow */
1272# ifndef YYSTACK_RELOCATE
1273 goto yyexhaustedlab;
1274# else
1275 /* Extend the stack our own way. */
1276 if (YYMAXDEPTH10000 <= yystacksize)
1277 goto yyexhaustedlab;
1278 yystacksize *= 2;
1279 if (YYMAXDEPTH10000 < yystacksize)
1280 yystacksize = YYMAXDEPTH10000;
1281
1282 {
1283 yytype_int16 *yyss1 = yyss;
1284 union yyalloc *yyptr =
1285 (union yyalloc *) YYSTACK_ALLOCmalloc (YYSTACK_BYTES (yystacksize)((yystacksize) * (sizeof (yytype_int16) + sizeof (char *)) + (
sizeof (union yyalloc) - 1))
);
1286 if (! yyptr)
1287 goto yyexhaustedlab;
1288 YYSTACK_RELOCATE (yyss_alloc, yyss);
1289 YYSTACK_RELOCATE (yyvs_alloc, yyvs);
1290# undef YYSTACK_RELOCATE
1291 if (yyss1 != yyssa)
1292 YYSTACK_FREEfree (yyss1);
1293 }
1294# endif
1295#endif /* no yyoverflow */
1296
1297 yyssp = yyss + yysize - 1;
1298 yyvsp = yyvs + yysize - 1;
1299
1300 YYDPRINTF ((stderr, "Stack size increased to %lu\n",
1301 (unsigned long int) yystacksize));
1302
1303 if (yyss + yystacksize - 1 <= yyssp)
1304 YYABORTgoto yyabortlab;
1305 }
1306
1307 YYDPRINTF ((stderr, "Entering state %d\n", yystate));
1308
1309 if (yystate == YYFINAL8)
1310 YYACCEPTgoto yyacceptlab;
1311
1312 goto yybackup;
1313
1314/*-----------.
1315| yybackup. |
1316`-----------*/
1317yybackup:
1318
1319 /* Do appropriate processing given the current state. Read a
1320 lookahead token if we need one and don't already have one. */
1321
1322 /* First try to decide what to do without reference to lookahead token. */
1323 yyn = yypact[yystate];
1324 if (yypact_value_is_default (yyn)((yyn) == (-15)))
1325 goto yydefault;
1326
1327 /* Not known => get a lookahead token if don't already have one. */
1328
1329 /* YYCHAR is either YYEMPTY or YYEOF or a valid lookahead symbol. */
1330 if (yychar == YYEMPTY(-2))
1331 {
1332 YYDPRINTF ((stderr, "Reading a token: "));
1333 yychar = YYLEXyylex ();
1334 }
1335
1336 if (yychar <= YYEOF0)
1337 {
1338 yychar = yytoken = YYEOF0;
1339 YYDPRINTF ((stderr, "Now at end of input.\n"));
1340 }
1341 else
1342 {
1343 yytoken = YYTRANSLATE (yychar)((unsigned int) (yychar) <= 267 ? yytranslate[yychar] : 2);
1344 YY_SYMBOL_PRINT ("Next token is", yytoken, &yylval, &yylloc);
1345 }
1346
1347 /* If the proper action on seeing token YYTOKEN is to reduce or to
1348 detect an error, take that action. */
1349 yyn += yytoken;
1350 if (yyn < 0 || YYLAST27 < yyn || yycheck[yyn] != yytoken)
1351 goto yydefault;
1352 yyn = yytable[yyn];
1353 if (yyn <= 0)
1354 {
1355 if (yytable_value_is_error (yyn)(0))
1356 goto yyerrlab;
1357 yyn = -yyn;
1358 goto yyreduce;
1359 }
1360
1361 /* Count tokens shifted since error; after three, turn off error
1362 status. */
1363 if (yyerrstatus)
1364 yyerrstatus--;
1365
1366 /* Shift the lookahead token. */
1367 YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc);
1368
1369 /* Discard the shifted token. */
1370 yychar = YYEMPTY(-2);
1371
1372 yystate = yyn;
1373 *++yyvsp = yylval;
1374
1375 goto yynewstate;
1376
1377
1378/*-----------------------------------------------------------.
1379| yydefault -- do the default action for the current state. |
1380`-----------------------------------------------------------*/
1381yydefault:
1382 yyn = yydefact[yystate];
1383 if (yyn == 0)
1384 goto yyerrlab;
1385 goto yyreduce;
1386
1387
1388/*-----------------------------.
1389| yyreduce -- Do a reduction. |
1390`-----------------------------*/
1391yyreduce:
1392 /* yyn is the number of a rule to reduce with. */
1393 yylen = yyr2[yyn];
1394
1395 /* If YYLEN is nonzero, implement the default value of the action:
1396 `$$ = $1'.
1397
1398 Otherwise, the following line sets YYVAL to garbage.
1399 This behavior is undocumented and Bison
1400 users should not rely upon it. Assigning to YYVAL
1401 unconditionally makes the parser a bit smaller, and it avoids a
1402 GCC warning that YYVAL may be used uninitialized. */
1403 yyval = yyvsp[1-yylen];
1404
1405
1406 YY_REDUCE_PRINT (yyn);
1407 switch (yyn)
1408 {
1409 case 5:
1410
1411/* Line 1806 of yacc.c */
1412#line 49 "./graph.y"
1413 {if (new_volume ((yyvsp[(2) - (2)])) == -1) { YYABORTgoto yyabortlab; }}
1414 break;
1415
1416 case 6:
1417
1418/* Line 1806 of yacc.c */
1419#line 50 "./graph.y"
1420 {if (volume_end () == -1) { YYABORTgoto yyabortlab; }}
1421 break;
1422
1423 case 14:
1424
1425/* Line 1806 of yacc.c */
1426#line 60 "./graph.y"
1427 {if (volume_type ((yyvsp[(2) - (2)])) == -1) { YYABORTgoto yyabortlab; }}
1428 break;
1429
1430 case 15:
1431
1432/* Line 1806 of yacc.c */
1433#line 60 "./graph.y"
1434 { type_error(); YYABORTgoto yyabortlab; }
1435 break;
1436
1437 case 17:
1438
1439/* Line 1806 of yacc.c */
1440#line 62 "./graph.y"
1441 { sub_error (); YYABORTgoto yyabortlab; }
1442 break;
1443
1444 case 20:
1445
1446/* Line 1806 of yacc.c */
1447#line 66 "./graph.y"
1448 {if (volume_option ((yyvsp[(2) - (3)]), (yyvsp[(3) - (3)])) == -1) { YYABORTgoto yyabortlab; }}
1449 break;
1450
1451 case 21:
1452
1453/* Line 1806 of yacc.c */
1454#line 67 "./graph.y"
1455 { option_error (); YYABORTgoto yyabortlab; }
1456 break;
1457
1458 case 22:
1459
1460/* Line 1806 of yacc.c */
1461#line 68 "./graph.y"
1462 { option_error (); YYABORTgoto yyabortlab; }
1463 break;
1464
1465 case 23:
1466
1467/* Line 1806 of yacc.c */
1468#line 70 "./graph.y"
1469 {if (volume_sub ((yyvsp[(1) - (1)])) == -1) {YYABORTgoto yyabortlab; }}
1470 break;
1471
1472 case 24:
1473
1474/* Line 1806 of yacc.c */
1475#line 70 "./graph.y"
1476 { if (volume_sub ((yyvsp[(2) - (2)])) == -1) { YYABORTgoto yyabortlab; }}
1477 break;
1478
1479
1480
1481/* Line 1806 of yacc.c */
1482#line 1483 "y.tab.c"
1483 default: break;
1484 }
1485 /* User semantic actions sometimes alter yychar, and that requires
1486 that yytoken be updated with the new translation. We take the
1487 approach of translating immediately before every use of yytoken.
1488 One alternative is translating here after every semantic action,
1489 but that translation would be missed if the semantic action invokes
1490 YYABORT, YYACCEPT, or YYERROR immediately after altering yychar or
1491 if it invokes YYBACKUP. In the case of YYABORT or YYACCEPT, an
1492 incorrect destructor might then be invoked immediately. In the
1493 case of YYERROR or YYBACKUP, subsequent parser actions might lead
1494 to an incorrect destructor call or verbose syntax error message
1495 before the lookahead is translated. */
1496 YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc);
1497
1498 YYPOPSTACK (yylen)(yyvsp -= (yylen), yyssp -= (yylen));
1499 yylen = 0;
1500 YY_STACK_PRINT (yyss, yyssp);
1501
1502 *++yyvsp = yyval;
1503
1504 /* Now `shift' the result of the reduction. Determine what state
1505 that goes to, based on the state we popped back to and the rule
1506 number reduced by. */
1507
1508 yyn = yyr1[yyn];
1509
1510 yystate = yypgoto[yyn - YYNTOKENS13] + *yyssp;
1511 if (0 <= yystate && yystate <= YYLAST27 && yycheck[yystate] == *yyssp)
1512 yystate = yytable[yystate];
1513 else
1514 yystate = yydefgoto[yyn - YYNTOKENS13];
1515
1516 goto yynewstate;
1517
1518
1519/*------------------------------------.
1520| yyerrlab -- here on detecting error |
1521`------------------------------------*/
1522yyerrlab:
1523 /* Make sure we have latest lookahead translation. See comments at
1524 user semantic actions for why this is necessary. */
1525 yytoken = yychar == YYEMPTY(-2) ? YYEMPTY(-2) : YYTRANSLATE (yychar)((unsigned int) (yychar) <= 267 ? yytranslate[yychar] : 2);
1526
1527 /* If not already recovering from an error, report this error. */
1528 if (!yyerrstatus)
1529 {
1530 ++yynerrs;
1531#if ! YYERROR_VERBOSE0
1532 yyerror (YY_("syntax error")"syntax error");
1533#else
1534# define YYSYNTAX_ERROR yysyntax_error (&yymsg_alloc, &yymsg, \
1535 yyssp, yytoken)
1536 {
1537 char const *yymsgp = YY_("syntax error")"syntax error";
1538 int yysyntax_error_status;
1539 yysyntax_error_status = YYSYNTAX_ERROR;
1540 if (yysyntax_error_status == 0)
1541 yymsgp = yymsg;
1542 else if (yysyntax_error_status == 1)
1543 {
1544 if (yymsg != yymsgbuf)
1545 YYSTACK_FREEfree (yymsg);
1546 yymsg = (char *) YYSTACK_ALLOCmalloc (yymsg_alloc);
1547 if (!yymsg)
1548 {
1549 yymsg = yymsgbuf;
1550 yymsg_alloc = sizeof yymsgbuf;
1551 yysyntax_error_status = 2;
1552 }
1553 else
1554 {
1555 yysyntax_error_status = YYSYNTAX_ERROR;
1556 yymsgp = yymsg;
1557 }
1558 }
1559 yyerror (yymsgp);
1560 if (yysyntax_error_status == 2)
1561 goto yyexhaustedlab;
1562 }
1563# undef YYSYNTAX_ERROR
1564#endif
1565 }
1566
1567
1568
1569 if (yyerrstatus == 3)
1570 {
1571 /* If just tried and failed to reuse lookahead token after an
1572 error, discard it. */
1573
1574 if (yychar <= YYEOF0)
1575 {
1576 /* Return failure if at end of input. */
1577 if (yychar == YYEOF0)
1578 YYABORTgoto yyabortlab;
1579 }
1580 else
1581 {
1582 yydestruct ("Error: discarding",
1583 yytoken, &yylval);
1584 yychar = YYEMPTY(-2);
1585 }
1586 }
1587
1588 /* Else will try to reuse lookahead token after shifting the error
1589 token. */
1590 goto yyerrlab1;
1591
1592
1593/*---------------------------------------------------.
1594| yyerrorlab -- error raised explicitly by YYERROR. |
1595`---------------------------------------------------*/
1596yyerrorlab:
1597
1598 /* Pacify compilers like GCC when the user code never invokes
1599 YYERROR and the label yyerrorlab therefore never appears in user
1600 code. */
1601 if (/*CONSTCOND*/ 0)
1602 goto yyerrorlab;
1603
1604 /* Do not reclaim the symbols of the rule which action triggered
1605 this YYERROR. */
1606 YYPOPSTACK (yylen)(yyvsp -= (yylen), yyssp -= (yylen));
1607 yylen = 0;
1608 YY_STACK_PRINT (yyss, yyssp);
1609 yystate = *yyssp;
1610 goto yyerrlab1;
1611
1612
1613/*-------------------------------------------------------------.
1614| yyerrlab1 -- common code for both syntax error and YYERROR. |
1615`-------------------------------------------------------------*/
1616yyerrlab1:
1617 yyerrstatus = 3; /* Each real token shifted decrements this. */
1618
1619 for (;;)
1620 {
1621 yyn = yypact[yystate];
1622 if (!yypact_value_is_default (yyn)((yyn) == (-15)))
1623 {
1624 yyn += YYTERROR1;
1625 if (0 <= yyn && yyn <= YYLAST27 && yycheck[yyn] == YYTERROR1)
1626 {
1627 yyn = yytable[yyn];
1628 if (0 < yyn)
1629 break;
1630 }
1631 }
1632
1633 /* Pop the current state because it cannot handle the error token. */
1634 if (yyssp == yyss)
1635 YYABORTgoto yyabortlab;
1636
1637
1638 yydestruct ("Error: popping",
1639 yystos[yystate], yyvsp);
1640 YYPOPSTACK (1)(yyvsp -= (1), yyssp -= (1));
1641 yystate = *yyssp;
1642 YY_STACK_PRINT (yyss, yyssp);
1643 }
1644
1645 *++yyvsp = yylval;
1646
1647
1648 /* Shift the error token. */
1649 YY_SYMBOL_PRINT ("Shifting", yystos[yyn], yyvsp, yylsp);
1650
1651 yystate = yyn;
1652 goto yynewstate;
1653
1654
1655/*-------------------------------------.
1656| yyacceptlab -- YYACCEPT comes here. |
1657`-------------------------------------*/
1658yyacceptlab:
1659 yyresult = 0;
1660 goto yyreturn;
1661
1662/*-----------------------------------.
1663| yyabortlab -- YYABORT comes here. |
1664`-----------------------------------*/
1665yyabortlab:
1666 yyresult = 1;
1667 goto yyreturn;
1668
1669#if !defined(yyoverflow) || YYERROR_VERBOSE0
1670/*-------------------------------------------------.
1671| yyexhaustedlab -- memory exhaustion comes here. |
1672`-------------------------------------------------*/
1673yyexhaustedlab:
1674 yyerror (YY_("memory exhausted")"memory exhausted");
1675 yyresult = 2;
1676 /* Fall through. */
1677#endif
1678
1679yyreturn:
1680 if (yychar != YYEMPTY(-2))
1681 {
1682 /* Make sure we have latest lookahead translation. See comments at
1683 user semantic actions for why this is necessary. */
1684 yytoken = YYTRANSLATE (yychar)((unsigned int) (yychar) <= 267 ? yytranslate[yychar] : 2);
1685 yydestruct ("Cleanup: discarding lookahead",
1686 yytoken, &yylval);
1687 }
1688 /* Do not reclaim the symbols of the rule which action triggered
1689 this YYABORT or YYACCEPT. */
1690 YYPOPSTACK (yylen)(yyvsp -= (yylen), yyssp -= (yylen));
1691 YY_STACK_PRINT (yyss, yyssp);
1692 while (yyssp != yyss)
1693 {
1694 yydestruct ("Cleanup: popping",
1695 yystos[*yyssp], yyvsp);
1696 YYPOPSTACK (1)(yyvsp -= (1), yyssp -= (1));
1697 }
1698#ifndef yyoverflow
1699 if (yyss != yyssa)
1700 YYSTACK_FREEfree (yyss);
1701#endif
1702#if YYERROR_VERBOSE0
1703 if (yymsg != yymsgbuf)
1704 YYSTACK_FREEfree (yymsg);
1705#endif
1706 /* Make sure YYID is used. */
1707 return YYID (yyresult)(yyresult);
1708}
1709
1710
1711
1712/* Line 2067 of yacc.c */
1713#line 72 "./graph.y"
1714
1715
1716xlator_t *curr;
1717glusterfs_graph_t *construct;
1718
1719
1720static void
1721type_error (void)
1722{
1723 extern int yylineno;
1724
1725 gf_log ("parser", GF_LOG_ERROR,do { do { if (0) printf ("Volume %s, before line %d: Please specify volume type"
, curr->name, yylineno); } while (0); _gf_log ("parser", "./graph.y"
, __FUNCTION__, 85, GF_LOG_ERROR, "Volume %s, before line %d: Please specify volume type"
, curr->name, yylineno); } while (0)
1726 "Volume %s, before line %d: Please specify volume type",do { do { if (0) printf ("Volume %s, before line %d: Please specify volume type"
, curr->name, yylineno); } while (0); _gf_log ("parser", "./graph.y"
, __FUNCTION__, 85, GF_LOG_ERROR, "Volume %s, before line %d: Please specify volume type"
, curr->name, yylineno); } while (0)
1727 curr->name, yylineno)do { do { if (0) printf ("Volume %s, before line %d: Please specify volume type"
, curr->name, yylineno); } while (0); _gf_log ("parser", "./graph.y"
, __FUNCTION__, 85, GF_LOG_ERROR, "Volume %s, before line %d: Please specify volume type"
, curr->name, yylineno); } while (0)
;
1728 return;
1729}
1730
1731
1732static void
1733sub_error (void)
1734{
1735 extern int yylineno;
1736
1737 gf_log ("parser", GF_LOG_ERROR,do { do { if (0) printf ("Volume %s, before line %d: Please specify subvolumes"
, curr->name, yylineno); } while (0); _gf_log ("parser", "./graph.y"
, __FUNCTION__, 97, GF_LOG_ERROR, "Volume %s, before line %d: Please specify subvolumes"
, curr->name, yylineno); } while (0)
1738 "Volume %s, before line %d: Please specify subvolumes",do { do { if (0) printf ("Volume %s, before line %d: Please specify subvolumes"
, curr->name, yylineno); } while (0); _gf_log ("parser", "./graph.y"
, __FUNCTION__, 97, GF_LOG_ERROR, "Volume %s, before line %d: Please specify subvolumes"
, curr->name, yylineno); } while (0)
1739 curr->name, yylineno)do { do { if (0) printf ("Volume %s, before line %d: Please specify subvolumes"
, curr->name, yylineno); } while (0); _gf_log ("parser", "./graph.y"
, __FUNCTION__, 97, GF_LOG_ERROR, "Volume %s, before line %d: Please specify subvolumes"
, curr->name, yylineno); } while (0)
;
1740 return;
1741}
1742
1743
1744static void
1745option_error (void)
1746{
1747 extern int yylineno;
1748
1749 gf_log ("parser", GF_LOG_ERROR,do { do { if (0) printf ("Volume %s, before line %d: Please specify "
"option <key> <value>", curr->name, yylineno)
; } while (0); _gf_log ("parser", "./graph.y", __FUNCTION__, 110
, GF_LOG_ERROR, "Volume %s, before line %d: Please specify " "option <key> <value>"
, curr->name, yylineno); } while (0)
1750 "Volume %s, before line %d: Please specify "do { do { if (0) printf ("Volume %s, before line %d: Please specify "
"option <key> <value>", curr->name, yylineno)
; } while (0); _gf_log ("parser", "./graph.y", __FUNCTION__, 110
, GF_LOG_ERROR, "Volume %s, before line %d: Please specify " "option <key> <value>"
, curr->name, yylineno); } while (0)
1751 "option <key> <value>",do { do { if (0) printf ("Volume %s, before line %d: Please specify "
"option <key> <value>", curr->name, yylineno)
; } while (0); _gf_log ("parser", "./graph.y", __FUNCTION__, 110
, GF_LOG_ERROR, "Volume %s, before line %d: Please specify " "option <key> <value>"
, curr->name, yylineno); } while (0)
1752 curr->name, yylineno)do { do { if (0) printf ("Volume %s, before line %d: Please specify "
"option <key> <value>", curr->name, yylineno)
; } while (0); _gf_log ("parser", "./graph.y", __FUNCTION__, 110
, GF_LOG_ERROR, "Volume %s, before line %d: Please specify " "option <key> <value>"
, curr->name, yylineno); } while (0)
;
1753 return;
1754}
1755
1756
1757static int
1758new_volume (char *name)
1759{
1760 extern int yylineno;
1761 xlator_t *trav = NULL((void*)0);
1762 int ret = 0;
1763
1764 if (!name) {
1765 gf_log ("parser", GF_LOG_DEBUG,do { do { if (0) printf ("Invalid argument name: '%s'", name)
; } while (0); _gf_log ("parser", "./graph.y", __FUNCTION__, 124
, GF_LOG_DEBUG, "Invalid argument name: '%s'", name); } while
(0)
1766 "Invalid argument name: '%s'", name)do { do { if (0) printf ("Invalid argument name: '%s'", name)
; } while (0); _gf_log ("parser", "./graph.y", __FUNCTION__, 124
, GF_LOG_DEBUG, "Invalid argument name: '%s'", name); } while
(0)
;
1767 ret = -1;
1768 goto out;
1769 }
1770
1771 if (curr) {
1772 gf_log ("parser", GF_LOG_ERROR,do { do { if (0) printf ("new volume (%s) defintion in line %d unexpected"
, name, yylineno); } while (0); _gf_log ("parser", "./graph.y"
, __FUNCTION__, 132, GF_LOG_ERROR, "new volume (%s) defintion in line %d unexpected"
, name, yylineno); } while (0)
1773 "new volume (%s) defintion in line %d unexpected",do { do { if (0) printf ("new volume (%s) defintion in line %d unexpected"
, name, yylineno); } while (0); _gf_log ("parser", "./graph.y"
, __FUNCTION__, 132, GF_LOG_ERROR, "new volume (%s) defintion in line %d unexpected"
, name, yylineno); } while (0)
1774 name, yylineno)do { do { if (0) printf ("new volume (%s) defintion in line %d unexpected"
, name, yylineno); } while (0); _gf_log ("parser", "./graph.y"
, __FUNCTION__, 132, GF_LOG_ERROR, "new volume (%s) defintion in line %d unexpected"
, name, yylineno); } while (0)
;
1775 ret = -1;
1776 goto out;
1777 }
1778
1779 curr = (void *) GF_CALLOC (1, sizeof (*curr),__gf_calloc (1, sizeof (*curr), gf_common_mt_xlator_t)
1780 gf_common_mt_xlator_t)__gf_calloc (1, sizeof (*curr), gf_common_mt_xlator_t);
1781
1782 if (!curr) {
1783 gf_log ("parser", GF_LOG_ERROR, "Out of memory")do { do { if (0) printf ("Out of memory"); } while (0); _gf_log
("parser", "./graph.y", __FUNCTION__, 141, GF_LOG_ERROR, "Out of memory"
); } while (0)
;
1784 ret = -1;
1785 goto out;
1786 }
1787
1788 trav = construct->first;
1789
1790 while (trav) {
1791 if (!strcmp (name, trav->name)) {
1792 gf_log ("parser", GF_LOG_ERROR,do { do { if (0) printf ("Line %d: volume '%s' defined again"
, yylineno, name); } while (0); _gf_log ("parser", "./graph.y"
, __FUNCTION__, 152, GF_LOG_ERROR, "Line %d: volume '%s' defined again"
, yylineno, name); } while (0)
1793 "Line %d: volume '%s' defined again",do { do { if (0) printf ("Line %d: volume '%s' defined again"
, yylineno, name); } while (0); _gf_log ("parser", "./graph.y"
, __FUNCTION__, 152, GF_LOG_ERROR, "Line %d: volume '%s' defined again"
, yylineno, name); } while (0)
1794 yylineno, name)do { do { if (0) printf ("Line %d: volume '%s' defined again"
, yylineno, name); } while (0); _gf_log ("parser", "./graph.y"
, __FUNCTION__, 152, GF_LOG_ERROR, "Line %d: volume '%s' defined again"
, yylineno, name); } while (0)
;
1795 ret = -1;
1796 goto out;
1797 }
1798 trav = trav->next;
1799 }
1800
1801 curr->name = gf_strdup (name);
1802 if (!curr->name) {
1803 GF_FREE (curr)__gf_free (curr);
1804 ret = -1;
1805 goto out;
1806 }
1807
1808 curr->options = get_new_dict ();
1809
1810 if (!curr->options) {
1811 GF_FREE (curr->name)__gf_free (curr->name);
1812 GF_FREE (curr)__gf_free (curr);
1813 ret = -1;
1814 goto out;
1815 }
1816
1817 curr->next = construct->first;
1818 if (curr->next)
1819 curr->next->prev = curr;
1820
1821 curr->graph = construct;
1822
1823 construct->first = curr;
1824
1825 construct->xl_count++;
1826
1827 gf_log ("parser", GF_LOG_TRACE, "New node for '%s'", name)do { do { if (0) printf ("New node for '%s'", name); } while (
0); _gf_log ("parser", "./graph.y", __FUNCTION__, 185, GF_LOG_TRACE
, "New node for '%s'", name); } while (0)
;
1828
1829out:
1830 GF_FREE (name)__gf_free (name);
1831
1832 return ret;
1833}
1834
1835
1836static int
1837volume_type (char *type)
1838{
1839 extern int yylineno;
1840 int32_t ret = 0;
1841
1842 if (!type) {
1843 gf_log ("parser", GF_LOG_DEBUG, "Invalid argument type")do { do { if (0) printf ("Invalid argument type"); } while (0
); _gf_log ("parser", "./graph.y", __FUNCTION__, 201, GF_LOG_DEBUG
, "Invalid argument type"); } while (0)
;
1844 ret = -1;
1845 goto out;
1846 }
1847
1848 ret = xlator_set_type (curr, type);
1849 if (ret) {
1850 gf_log ("parser", GF_LOG_ERROR,do { do { if (0) printf ("Volume '%s', line %d: type '%s' is not valid or "
"not found on this machine", curr->name, yylineno, type);
} while (0); _gf_log ("parser", "./graph.y", __FUNCTION__, 211
, GF_LOG_ERROR, "Volume '%s', line %d: type '%s' is not valid or "
"not found on this machine", curr->name, yylineno, type);
} while (0)
1851 "Volume '%s', line %d: type '%s' is not valid or "do { do { if (0) printf ("Volume '%s', line %d: type '%s' is not valid or "
"not found on this machine", curr->name, yylineno, type);
} while (0); _gf_log ("parser", "./graph.y", __FUNCTION__, 211
, GF_LOG_ERROR, "Volume '%s', line %d: type '%s' is not valid or "
"not found on this machine", curr->name, yylineno, type);
} while (0)
1852 "not found on this machine",do { do { if (0) printf ("Volume '%s', line %d: type '%s' is not valid or "
"not found on this machine", curr->name, yylineno, type);
} while (0); _gf_log ("parser", "./graph.y", __FUNCTION__, 211
, GF_LOG_ERROR, "Volume '%s', line %d: type '%s' is not valid or "
"not found on this machine", curr->name, yylineno, type);
} while (0)
1853 curr->name, yylineno, type)do { do { if (0) printf ("Volume '%s', line %d: type '%s' is not valid or "
"not found on this machine", curr->name, yylineno, type);
} while (0); _gf_log ("parser", "./graph.y", __FUNCTION__, 211
, GF_LOG_ERROR, "Volume '%s', line %d: type '%s' is not valid or "
"not found on this machine", curr->name, yylineno, type);
} while (0)
;
1854 ret = -1;
1855 goto out;
1856 }
1857
1858 gf_log ("parser", GF_LOG_TRACE, "Type:%s:%s", curr->name, type)do { do { if (0) printf ("Type:%s:%s", curr->name, type); }
while (0); _gf_log ("parser", "./graph.y", __FUNCTION__, 216
, GF_LOG_TRACE, "Type:%s:%s", curr->name, type); } while (
0)
;
1859
1860out:
1861 GF_FREE (type)__gf_free (type);
1862
1863 return 0;
1864}
1865
1866
1867static int
1868volume_option (char *key, char *value)
1869{
1870 extern int yylineno;
1871 int ret = 0;
1872 char *set_value = NULL((void*)0);
1873
1874 if (!key || !value){
1875 gf_log ("parser", GF_LOG_ERROR, "Invalid argument")do { do { if (0) printf ("Invalid argument"); } while (0); _gf_log
("parser", "./graph.y", __FUNCTION__, 233, GF_LOG_ERROR, "Invalid argument"
); } while (0)
;
1876 ret = -1;
1877 goto out;
1878 }
1879
1880 set_value = gf_strdup (value);
1881 ret = dict_set_dynstr (curr->options, key, set_value);
1882
1883 if (ret == 1) {
1884 gf_log ("parser", GF_LOG_ERROR,do { do { if (0) printf ("Volume '%s', line %d: duplicate entry "
"('option %s') present", curr->name, yylineno, key); } while
(0); _gf_log ("parser", "./graph.y", __FUNCTION__, 245, GF_LOG_ERROR
, "Volume '%s', line %d: duplicate entry " "('option %s') present"
, curr->name, yylineno, key); } while (0)
1885 "Volume '%s', line %d: duplicate entry "do { do { if (0) printf ("Volume '%s', line %d: duplicate entry "
"('option %s') present", curr->name, yylineno, key); } while
(0); _gf_log ("parser", "./graph.y", __FUNCTION__, 245, GF_LOG_ERROR
, "Volume '%s', line %d: duplicate entry " "('option %s') present"
, curr->name, yylineno, key); } while (0)
1886 "('option %s') present",do { do { if (0) printf ("Volume '%s', line %d: duplicate entry "
"('option %s') present", curr->name, yylineno, key); } while
(0); _gf_log ("parser", "./graph.y", __FUNCTION__, 245, GF_LOG_ERROR
, "Volume '%s', line %d: duplicate entry " "('option %s') present"
, curr->name, yylineno, key); } while (0)
1887 curr->name, yylineno, key)do { do { if (0) printf ("Volume '%s', line %d: duplicate entry "
"('option %s') present", curr->name, yylineno, key); } while
(0); _gf_log ("parser", "./graph.y", __FUNCTION__, 245, GF_LOG_ERROR
, "Volume '%s', line %d: duplicate entry " "('option %s') present"
, curr->name, yylineno, key); } while (0)
;
1888 ret = -1;
1889 goto out;
1890 }
1891
1892 gf_log ("parser", GF_LOG_TRACE, "Option:%s:%s:%s",do { do { if (0) printf ("Option:%s:%s:%s", curr->name, key
, value); } while (0); _gf_log ("parser", "./graph.y", __FUNCTION__
, 251, GF_LOG_TRACE, "Option:%s:%s:%s", curr->name, key, value
); } while (0)
1893 curr->name, key, value)do { do { if (0) printf ("Option:%s:%s:%s", curr->name, key
, value); } while (0); _gf_log ("parser", "./graph.y", __FUNCTION__
, 251, GF_LOG_TRACE, "Option:%s:%s:%s", curr->name, key, value
); } while (0)
;
1894
1895out:
1896 GF_FREE (key)__gf_free (key);
1897 GF_FREE (value)__gf_free (value);
1898
1899 return 0;
1900}
1901
1902
1903static int
1904volume_sub (char *sub)
1905{
1906 extern int yylineno;
1907 xlator_t *trav = NULL((void*)0);
1908 int ret = 0;
1909
1910 if (!sub) {
1911 gf_log ("parser", GF_LOG_ERROR, "Invalid subvolumes argument")do { do { if (0) printf ("Invalid subvolumes argument"); } while
(0); _gf_log ("parser", "./graph.y", __FUNCTION__, 269, GF_LOG_ERROR
, "Invalid subvolumes argument"); } while (0)
;
1912 ret = -1;
1913 goto out;
1914 }
1915
1916 trav = construct->first;
1917
1918 while (trav) {
1919 if (!strcmp (sub, trav->name))
1920 break;
1921 trav = trav->next;
1922 }
1923
1924 if (!trav) {
1925 gf_log ("parser", GF_LOG_ERROR,do { do { if (0) printf ("Volume '%s', line %d: subvolume '%s' is not defined "
"prior to usage", curr->name, yylineno, sub); } while (0)
; _gf_log ("parser", "./graph.y", __FUNCTION__, 286, GF_LOG_ERROR
, "Volume '%s', line %d: subvolume '%s' is not defined " "prior to usage"
, curr->name, yylineno, sub); } while (0)
1926 "Volume '%s', line %d: subvolume '%s' is not defined "do { do { if (0) printf ("Volume '%s', line %d: subvolume '%s' is not defined "
"prior to usage", curr->name, yylineno, sub); } while (0)
; _gf_log ("parser", "./graph.y", __FUNCTION__, 286, GF_LOG_ERROR
, "Volume '%s', line %d: subvolume '%s' is not defined " "prior to usage"
, curr->name, yylineno, sub); } while (0)
1927 "prior to usage",do { do { if (0) printf ("Volume '%s', line %d: subvolume '%s' is not defined "
"prior to usage", curr->name, yylineno, sub); } while (0)
; _gf_log ("parser", "./graph.y", __FUNCTION__, 286, GF_LOG_ERROR
, "Volume '%s', line %d: subvolume '%s' is not defined " "prior to usage"
, curr->name, yylineno, sub); } while (0)
1928 curr->name, yylineno, sub)do { do { if (0) printf ("Volume '%s', line %d: subvolume '%s' is not defined "
"prior to usage", curr->name, yylineno, sub); } while (0)
; _gf_log ("parser", "./graph.y", __FUNCTION__, 286, GF_LOG_ERROR
, "Volume '%s', line %d: subvolume '%s' is not defined " "prior to usage"
, curr->name, yylineno, sub); } while (0)
;
1929 ret = -1;
1930 goto out;
1931 }
1932
1933 if (trav == curr) {
1934 gf_log ("parser", GF_LOG_ERROR,do { do { if (0) printf ("Volume '%s', line %d: has '%s' itself as subvolume"
, curr->name, yylineno, sub); } while (0); _gf_log ("parser"
, "./graph.y", __FUNCTION__, 294, GF_LOG_ERROR, "Volume '%s', line %d: has '%s' itself as subvolume"
, curr->name, yylineno, sub); } while (0)
1935 "Volume '%s', line %d: has '%s' itself as subvolume",do { do { if (0) printf ("Volume '%s', line %d: has '%s' itself as subvolume"
, curr->name, yylineno, sub); } while (0); _gf_log ("parser"
, "./graph.y", __FUNCTION__, 294, GF_LOG_ERROR, "Volume '%s', line %d: has '%s' itself as subvolume"
, curr->name, yylineno, sub); } while (0)
1936 curr->name, yylineno, sub)do { do { if (0) printf ("Volume '%s', line %d: has '%s' itself as subvolume"
, curr->name, yylineno, sub); } while (0); _gf_log ("parser"
, "./graph.y", __FUNCTION__, 294, GF_LOG_ERROR, "Volume '%s', line %d: has '%s' itself as subvolume"
, curr->name, yylineno, sub); } while (0)
;
1937 ret = -1;
1938 goto out;
1939 }
1940
1941 ret = glusterfs_xlator_link (curr, trav);
1942 if (ret) {
1943 gf_log ("parser", GF_LOG_ERROR, "Out of memory")do { do { if (0) printf ("Out of memory"); } while (0); _gf_log
("parser", "./graph.y", __FUNCTION__, 301, GF_LOG_ERROR, "Out of memory"
); } while (0)
;
1944 ret = -1;
1945 goto out;
1946 }
1947
1948 gf_log ("parser", GF_LOG_TRACE, "child:%s->%s", curr->name, sub)do { do { if (0) printf ("child:%s->%s", curr->name, sub
); } while (0); _gf_log ("parser", "./graph.y", __FUNCTION__,
306, GF_LOG_TRACE, "child:%s->%s", curr->name, sub); }
while (0)
;
1949
1950out:
1951 GF_FREE (sub)__gf_free (sub);
1952
1953 return 0;
1954}
1955
1956
1957static int
1958volume_end (void)
1959{
1960 if (!curr->fops) {
1961 gf_log ("parser", GF_LOG_ERROR,do { do { if (0) printf ("\"type\" not specified for volume %s"
, curr->name); } while (0); _gf_log ("parser", "./graph.y"
, __FUNCTION__, 320, GF_LOG_ERROR, "\"type\" not specified for volume %s"
, curr->name); } while (0)
1962 "\"type\" not specified for volume %s", curr->name)do { do { if (0) printf ("\"type\" not specified for volume %s"
, curr->name); } while (0); _gf_log ("parser", "./graph.y"
, __FUNCTION__, 320, GF_LOG_ERROR, "\"type\" not specified for volume %s"
, curr->name); } while (0)
;
1963 return -1;
1964 }
1965 gf_log ("parser", GF_LOG_TRACE, "end:%s", curr->name)do { do { if (0) printf ("end:%s", curr->name); } while (0
); _gf_log ("parser", "./graph.y", __FUNCTION__, 323, GF_LOG_TRACE
, "end:%s", curr->name); } while (0)
;
1966
1967 curr = NULL((void*)0);
1968 return 0;
1969}
1970
1971
1972int
1973yywrap ()
1974{
1975 return 1;
1976}
1977
1978
1979int
1980yyerror (const char *str)
1981{
1982 extern char *yytext;
1983 extern int yylineno;
1984
1985 if (curr && curr->name && yytext) {
1986 if (!strcmp (yytext, "volume")) {
1987 gf_log ("parser", GF_LOG_ERROR,do { do { if (0) printf ("'end-volume' not defined for volume '%s'"
, curr->name); } while (0); _gf_log ("parser", "./graph.y"
, __FUNCTION__, 347, GF_LOG_ERROR, "'end-volume' not defined for volume '%s'"
, curr->name); } while (0)
1988 "'end-volume' not defined for volume '%s'",do { do { if (0) printf ("'end-volume' not defined for volume '%s'"
, curr->name); } while (0); _gf_log ("parser", "./graph.y"
, __FUNCTION__, 347, GF_LOG_ERROR, "'end-volume' not defined for volume '%s'"
, curr->name); } while (0)
1989 curr->name)do { do { if (0) printf ("'end-volume' not defined for volume '%s'"
, curr->name); } while (0); _gf_log ("parser", "./graph.y"
, __FUNCTION__, 347, GF_LOG_ERROR, "'end-volume' not defined for volume '%s'"
, curr->name); } while (0)
;
1990 } else if (!strcmp (yytext, "type")) {
1991 gf_log ("parser", GF_LOG_ERROR,do { do { if (0) printf ("line %d: duplicate 'type' defined for "
"volume '%s'", yylineno, curr->name); } while (0); _gf_log
("parser", "./graph.y", __FUNCTION__, 352, GF_LOG_ERROR, "line %d: duplicate 'type' defined for "
"volume '%s'", yylineno, curr->name); } while (0)
1992 "line %d: duplicate 'type' defined for "do { do { if (0) printf ("line %d: duplicate 'type' defined for "
"volume '%s'", yylineno, curr->name); } while (0); _gf_log
("parser", "./graph.y", __FUNCTION__, 352, GF_LOG_ERROR, "line %d: duplicate 'type' defined for "
"volume '%s'", yylineno, curr->name); } while (0)
1993 "volume '%s'",do { do { if (0) printf ("line %d: duplicate 'type' defined for "
"volume '%s'", yylineno, curr->name); } while (0); _gf_log
("parser", "./graph.y", __FUNCTION__, 352, GF_LOG_ERROR, "line %d: duplicate 'type' defined for "
"volume '%s'", yylineno, curr->name); } while (0)
1994 yylineno, curr->name)do { do { if (0) printf ("line %d: duplicate 'type' defined for "
"volume '%s'", yylineno, curr->name); } while (0); _gf_log
("parser", "./graph.y", __FUNCTION__, 352, GF_LOG_ERROR, "line %d: duplicate 'type' defined for "
"volume '%s'", yylineno, curr->name); } while (0)
;
1995 } else if (!strcmp (yytext, "subvolumes")) {
1996 gf_log ("parser", GF_LOG_ERROR,do { do { if (0) printf ("line %d: duplicate 'subvolumes' defined for "
"volume '%s'", yylineno, curr->name); } while (0); _gf_log
("parser", "./graph.y", __FUNCTION__, 357, GF_LOG_ERROR, "line %d: duplicate 'subvolumes' defined for "
"volume '%s'", yylineno, curr->name); } while (0)
1997 "line %d: duplicate 'subvolumes' defined for "do { do { if (0) printf ("line %d: duplicate 'subvolumes' defined for "
"volume '%s'", yylineno, curr->name); } while (0); _gf_log
("parser", "./graph.y", __FUNCTION__, 357, GF_LOG_ERROR, "line %d: duplicate 'subvolumes' defined for "
"volume '%s'", yylineno, curr->name); } while (0)
1998 "volume '%s'",do { do { if (0) printf ("line %d: duplicate 'subvolumes' defined for "
"volume '%s'", yylineno, curr->name); } while (0); _gf_log
("parser", "./graph.y", __FUNCTION__, 357, GF_LOG_ERROR, "line %d: duplicate 'subvolumes' defined for "
"volume '%s'", yylineno, curr->name); } while (0)
1999 yylineno, curr->name)do { do { if (0) printf ("line %d: duplicate 'subvolumes' defined for "
"volume '%s'", yylineno, curr->name); } while (0); _gf_log
("parser", "./graph.y", __FUNCTION__, 357, GF_LOG_ERROR, "line %d: duplicate 'subvolumes' defined for "
"volume '%s'", yylineno, curr->name); } while (0)
;
2000 } else if (curr) {
2001 gf_log ("parser", GF_LOG_ERROR,do { do { if (0) printf ("syntax error: line %d (volume '%s'): \"%s\""
"\nallowed tokens are 'volume', 'type', " "'subvolumes', 'option', 'end-volume'()"
, yylineno, curr->name, yytext); } while (0); _gf_log ("parser"
, "./graph.y", __FUNCTION__, 364, GF_LOG_ERROR, "syntax error: line %d (volume '%s'): \"%s\""
"\nallowed tokens are 'volume', 'type', " "'subvolumes', 'option', 'end-volume'()"
, yylineno, curr->name, yytext); } while (0)
2002 "syntax error: line %d (volume '%s'): \"%s\""do { do { if (0) printf ("syntax error: line %d (volume '%s'): \"%s\""
"\nallowed tokens are 'volume', 'type', " "'subvolumes', 'option', 'end-volume'()"
, yylineno, curr->name, yytext); } while (0); _gf_log ("parser"
, "./graph.y", __FUNCTION__, 364, GF_LOG_ERROR, "syntax error: line %d (volume '%s'): \"%s\""
"\nallowed tokens are 'volume', 'type', " "'subvolumes', 'option', 'end-volume'()"
, yylineno, curr->name, yytext); } while (0)
2003 "\nallowed tokens are 'volume', 'type', "do { do { if (0) printf ("syntax error: line %d (volume '%s'): \"%s\""
"\nallowed tokens are 'volume', 'type', " "'subvolumes', 'option', 'end-volume'()"
, yylineno, curr->name, yytext); } while (0); _gf_log ("parser"
, "./graph.y", __FUNCTION__, 364, GF_LOG_ERROR, "syntax error: line %d (volume '%s'): \"%s\""
"\nallowed tokens are 'volume', 'type', " "'subvolumes', 'option', 'end-volume'()"
, yylineno, curr->name, yytext); } while (0)
2004 "'subvolumes', 'option', 'end-volume'()",do { do { if (0) printf ("syntax error: line %d (volume '%s'): \"%s\""
"\nallowed tokens are 'volume', 'type', " "'subvolumes', 'option', 'end-volume'()"
, yylineno, curr->name, yytext); } while (0); _gf_log ("parser"
, "./graph.y", __FUNCTION__, 364, GF_LOG_ERROR, "syntax error: line %d (volume '%s'): \"%s\""
"\nallowed tokens are 'volume', 'type', " "'subvolumes', 'option', 'end-volume'()"
, yylineno, curr->name, yytext); } while (0)
2005 yylineno, curr->name,do { do { if (0) printf ("syntax error: line %d (volume '%s'): \"%s\""
"\nallowed tokens are 'volume', 'type', " "'subvolumes', 'option', 'end-volume'()"
, yylineno, curr->name, yytext); } while (0); _gf_log ("parser"
, "./graph.y", __FUNCTION__, 364, GF_LOG_ERROR, "syntax error: line %d (volume '%s'): \"%s\""
"\nallowed tokens are 'volume', 'type', " "'subvolumes', 'option', 'end-volume'()"
, yylineno, curr->name, yytext); } while (0)
2006 yytext)do { do { if (0) printf ("syntax error: line %d (volume '%s'): \"%s\""
"\nallowed tokens are 'volume', 'type', " "'subvolumes', 'option', 'end-volume'()"
, yylineno, curr->name, yytext); } while (0); _gf_log ("parser"
, "./graph.y", __FUNCTION__, 364, GF_LOG_ERROR, "syntax error: line %d (volume '%s'): \"%s\""
"\nallowed tokens are 'volume', 'type', " "'subvolumes', 'option', 'end-volume'()"
, yylineno, curr->name, yytext); } while (0)
;
2007 } else {
2008 gf_log ("parser", GF_LOG_ERROR,do { do { if (0) printf ("syntax error: line %d (just after volume "
"'%s'): \"%s\"\n(%s)", yylineno, curr->name, yytext, "allowed tokens are 'volume', 'type', "
"'subvolumes', 'option', 'end-volume'"); } while (0); _gf_log
("parser", "./graph.y", __FUNCTION__, 372, GF_LOG_ERROR, "syntax error: line %d (just after volume "
"'%s'): \"%s\"\n(%s)", yylineno, curr->name, yytext, "allowed tokens are 'volume', 'type', "
"'subvolumes', 'option', 'end-volume'"); } while (0)
2009 "syntax error: line %d (just after volume "do { do { if (0) printf ("syntax error: line %d (just after volume "
"'%s'): \"%s\"\n(%s)", yylineno, curr->name, yytext, "allowed tokens are 'volume', 'type', "
"'subvolumes', 'option', 'end-volume'"); } while (0); _gf_log
("parser", "./graph.y", __FUNCTION__, 372, GF_LOG_ERROR, "syntax error: line %d (just after volume "
"'%s'): \"%s\"\n(%s)", yylineno, curr->name, yytext, "allowed tokens are 'volume', 'type', "
"'subvolumes', 'option', 'end-volume'"); } while (0)
2010 "'%s'): \"%s\"\n(%s)",do { do { if (0) printf ("syntax error: line %d (just after volume "
"'%s'): \"%s\"\n(%s)", yylineno, curr->name, yytext, "allowed tokens are 'volume', 'type', "
"'subvolumes', 'option', 'end-volume'"); } while (0); _gf_log
("parser", "./graph.y", __FUNCTION__, 372, GF_LOG_ERROR, "syntax error: line %d (just after volume "
"'%s'): \"%s\"\n(%s)", yylineno, curr->name, yytext, "allowed tokens are 'volume', 'type', "
"'subvolumes', 'option', 'end-volume'"); } while (0)
2011 yylineno, curr->name,do { do { if (0) printf ("syntax error: line %d (just after volume "
"'%s'): \"%s\"\n(%s)", yylineno, curr->name, yytext, "allowed tokens are 'volume', 'type', "
"'subvolumes', 'option', 'end-volume'"); } while (0); _gf_log
("parser", "./graph.y", __FUNCTION__, 372, GF_LOG_ERROR, "syntax error: line %d (just after volume "
"'%s'): \"%s\"\n(%s)", yylineno, curr->name, yytext, "allowed tokens are 'volume', 'type', "
"'subvolumes', 'option', 'end-volume'"); } while (0)
2012 yytext,do { do { if (0) printf ("syntax error: line %d (just after volume "
"'%s'): \"%s\"\n(%s)", yylineno, curr->name, yytext, "allowed tokens are 'volume', 'type', "
"'subvolumes', 'option', 'end-volume'"); } while (0); _gf_log
("parser", "./graph.y", __FUNCTION__, 372, GF_LOG_ERROR, "syntax error: line %d (just after volume "
"'%s'): \"%s\"\n(%s)", yylineno, curr->name, yytext, "allowed tokens are 'volume', 'type', "
"'subvolumes', 'option', 'end-volume'"); } while (0)
2013 "allowed tokens are 'volume', 'type', "do { do { if (0) printf ("syntax error: line %d (just after volume "
"'%s'): \"%s\"\n(%s)", yylineno, curr->name, yytext, "allowed tokens are 'volume', 'type', "
"'subvolumes', 'option', 'end-volume'"); } while (0); _gf_log
("parser", "./graph.y", __FUNCTION__, 372, GF_LOG_ERROR, "syntax error: line %d (just after volume "
"'%s'): \"%s\"\n(%s)", yylineno, curr->name, yytext, "allowed tokens are 'volume', 'type', "
"'subvolumes', 'option', 'end-volume'"); } while (0)
2014 "'subvolumes', 'option', 'end-volume'")do { do { if (0) printf ("syntax error: line %d (just after volume "
"'%s'): \"%s\"\n(%s)", yylineno, curr->name, yytext, "allowed tokens are 'volume', 'type', "
"'subvolumes', 'option', 'end-volume'"); } while (0); _gf_log
("parser", "./graph.y", __FUNCTION__, 372, GF_LOG_ERROR, "syntax error: line %d (just after volume "
"'%s'): \"%s\"\n(%s)", yylineno, curr->name, yytext, "allowed tokens are 'volume', 'type', "
"'subvolumes', 'option', 'end-volume'"); } while (0)
;
2015 }
2016 } else {
2017 gf_log ("parser", GF_LOG_ERROR,do { do { if (0) printf ("syntax error in line %d: \"%s\" \n"
"(allowed tokens are 'volume', 'type', " "'subvolumes', 'option', 'end-volume')\n"
, yylineno, yytext); } while (0); _gf_log ("parser", "./graph.y"
, __FUNCTION__, 379, GF_LOG_ERROR, "syntax error in line %d: \"%s\" \n"
"(allowed tokens are 'volume', 'type', " "'subvolumes', 'option', 'end-volume')\n"
, yylineno, yytext); } while (0)
2018 "syntax error in line %d: \"%s\" \n"do { do { if (0) printf ("syntax error in line %d: \"%s\" \n"
"(allowed tokens are 'volume', 'type', " "'subvolumes', 'option', 'end-volume')\n"
, yylineno, yytext); } while (0); _gf_log ("parser", "./graph.y"
, __FUNCTION__, 379, GF_LOG_ERROR, "syntax error in line %d: \"%s\" \n"
"(allowed tokens are 'volume', 'type', " "'subvolumes', 'option', 'end-volume')\n"
, yylineno, yytext); } while (0)
2019 "(allowed tokens are 'volume', 'type', "do { do { if (0) printf ("syntax error in line %d: \"%s\" \n"
"(allowed tokens are 'volume', 'type', " "'subvolumes', 'option', 'end-volume')\n"
, yylineno, yytext); } while (0); _gf_log ("parser", "./graph.y"
, __FUNCTION__, 379, GF_LOG_ERROR, "syntax error in line %d: \"%s\" \n"
"(allowed tokens are 'volume', 'type', " "'subvolumes', 'option', 'end-volume')\n"
, yylineno, yytext); } while (0)
2020 "'subvolumes', 'option', 'end-volume')\n",do { do { if (0) printf ("syntax error in line %d: \"%s\" \n"
"(allowed tokens are 'volume', 'type', " "'subvolumes', 'option', 'end-volume')\n"
, yylineno, yytext); } while (0); _gf_log ("parser", "./graph.y"
, __FUNCTION__, 379, GF_LOG_ERROR, "syntax error in line %d: \"%s\" \n"
"(allowed tokens are 'volume', 'type', " "'subvolumes', 'option', 'end-volume')\n"
, yylineno, yytext); } while (0)
2021 yylineno, yytext)do { do { if (0) printf ("syntax error in line %d: \"%s\" \n"
"(allowed tokens are 'volume', 'type', " "'subvolumes', 'option', 'end-volume')\n"
, yylineno, yytext); } while (0); _gf_log ("parser", "./graph.y"
, __FUNCTION__, 379, GF_LOG_ERROR, "syntax error in line %d: \"%s\" \n"
"(allowed tokens are 'volume', 'type', " "'subvolumes', 'option', 'end-volume')\n"
, yylineno, yytext); } while (0)
;
2022 }
2023
2024 return -1;
2025}
2026
2027
2028static int
2029execute_cmd (char *cmd, char **result, size_t size)
2030{
2031 FILE *fpp = NULL((void*)0);
2032 int i = 0;
2033 int status = 0;
2034 int character = 0;
2035 char *buf = *result;
2036
2037 fpp = popen (cmd, "r");
2038 if (!fpp) {
2039 gf_log ("parser", GF_LOG_ERROR, "%s: failed to popen", cmd)do { do { if (0) printf ("%s: failed to popen", cmd); } while
(0); _gf_log ("parser", "./graph.y", __FUNCTION__, 397, GF_LOG_ERROR
, "%s: failed to popen", cmd); } while (0)
;
2040 return -1;
2041 }
2042
2043 while ((character = fgetc (fpp)) != EOF(-1)) {
2044 if (i == size) {
2045 size *= 2;
2046 buf = *result = GF_REALLOC (*result, size)__gf_realloc (*result, size);
2047 }
2048
2049 buf[i++] = character;
2050 }
2051
2052 if (i > 0) {
2053 i--;
2054 buf[i] = '\0';
2055 }
2056
2057 status = pclose (fpp);
2058 if (status == -1 || !WIFEXITED (status)((((__extension__ (((union { __typeof(status) __in; int __i; }
) { .__in = (status) }).__i))) & 0x7f) == 0)
||
2059 ((WEXITSTATUS (status)((((__extension__ (((union { __typeof(status) __in; int __i; }
) { .__in = (status) }).__i))) & 0xff00) >> 8)
) != 0)) {
2060 i = -1;
2061 buf[0] = '\0';
2062 }
2063
2064 return i;
2065}
2066
2067
2068static int
2069preprocess (FILE *srcfp, FILE *dstfp)
2070{
2071 int ret = 0;
2072 int i = 0;
2073 char *cmd = NULL((void*)0);
2074 char *result = NULL((void*)0);
2075 size_t cmd_buf_size = GF_CMD_BUFFER_LEN(8 * 1024ULL);
2076 char escaped = 0;
2077 char in_backtick = 0;
2078 int line = 1;
2079 int column = 0;
2080 int character = 0;
2081
2082
2083 fseek (srcfp, 0L, SEEK_SET0);
2084 fseek (dstfp, 0L, SEEK_SET0);
2085
2086 cmd = GF_CALLOC (cmd_buf_size, 1,__gf_calloc (cmd_buf_size, 1, gf_common_mt_char)
2087 gf_common_mt_char)__gf_calloc (cmd_buf_size, 1, gf_common_mt_char);
2088 if (cmd == NULL((void*)0)) {
2089 gf_log ("parser", GF_LOG_ERROR, "Out of memory")do { do { if (0) printf ("Out of memory"); } while (0); _gf_log
("parser", "./graph.y", __FUNCTION__, 447, GF_LOG_ERROR, "Out of memory"
); } while (0)
;
2090 return -1;
2091 }
2092
2093 result = GF_CALLOC (cmd_buf_size * 2, 1,__gf_calloc (cmd_buf_size * 2, 1, gf_common_mt_char)
2094 gf_common_mt_char)__gf_calloc (cmd_buf_size * 2, 1, gf_common_mt_char);
2095 if (result == NULL((void*)0)) {
2096 GF_FREE (cmd)__gf_free (cmd);
2097 gf_log ("parser", GF_LOG_ERROR, "Out of memory")do { do { if (0) printf ("Out of memory"); } while (0); _gf_log
("parser", "./graph.y", __FUNCTION__, 455, GF_LOG_ERROR, "Out of memory"
); } while (0)
;
2098 return -1;
2099 }
2100
2101 while ((character = fgetc (srcfp)) != EOF(-1)) {
2102 if ((character == '`') && !escaped) {
2103 if (in_backtick) {
2104 cmd[i] = '\0';
2105 result[0] = '\0';
2106
2107 ret = execute_cmd (cmd, &result,
2108 2 * cmd_buf_size);
2109 if (ret < 0) {
2110 ret = -1;
2111 goto out;
2112 }
2113 fwrite (result, ret, 1, dstfp);
2114 } else {
2115 i = 0;
2116 cmd[i] = '\0';
2117 }
2118
2119 in_backtick = !in_backtick;
2120 } else {
2121 if (in_backtick) {
2122 if (i == cmd_buf_size) {
2123 cmd_buf_size *= 2;
2124 cmd = GF_REALLOC (cmd, cmd_buf_size)__gf_realloc (cmd, cmd_buf_size);
2125 if (cmd == NULL((void*)0)) {
2126 return -1;
2127 }
2128
2129 result = GF_REALLOC (result,__gf_realloc (result, 2 * cmd_buf_size)
2130 2 * cmd_buf_size)__gf_realloc (result, 2 * cmd_buf_size);
2131 if (result == NULL((void*)0)) {
2132 GF_FREE (cmd)__gf_free (cmd);
2133 return -1;
2134 }
2135 }
2136
2137 cmd[i++] = character;
2138 } else {
2139 fputc (character, dstfp);
2140 }
2141 }
2142
2143 if (character == '\\') {
2144 escaped = !escaped;
2145 } else {
2146 escaped = 0;
2147 }
2148
2149 if (character == '\n') {
2150 line++;
2151 column = 0;
2152 } else {
2153 column++;
2154 }
2155 }
2156
2157 if (in_backtick) {
2158 gf_log ("parser", GF_LOG_ERROR,do { do { if (0) printf ("Unterminated backtick in volume specfication file at line (%d), column (%d)."
, line, column); } while (0); _gf_log ("parser", "./graph.y",
__FUNCTION__, 518, GF_LOG_ERROR, "Unterminated backtick in volume specfication file at line (%d), column (%d)."
, line, column); } while (0)
2159 "Unterminated backtick in volume specfication file at line (%d), column (%d).",do { do { if (0) printf ("Unterminated backtick in volume specfication file at line (%d), column (%d)."
, line, column); } while (0); _gf_log ("parser", "./graph.y",
__FUNCTION__, 518, GF_LOG_ERROR, "Unterminated backtick in volume specfication file at line (%d), column (%d)."
, line, column); } while (0)
2160 line, column)do { do { if (0) printf ("Unterminated backtick in volume specfication file at line (%d), column (%d)."
, line, column); } while (0); _gf_log ("parser", "./graph.y",
__FUNCTION__, 518, GF_LOG_ERROR, "Unterminated backtick in volume specfication file at line (%d), column (%d)."
, line, column); } while (0)
;
2161 ret = -1;
2162 }
2163
2164out:
2165 fseek (srcfp, 0L, SEEK_SET0);
2166 fseek (dstfp, 0L, SEEK_SET0);
2167 GF_FREE (cmd)__gf_free (cmd);
2168 GF_FREE (result)__gf_free (result);
2169
2170 return ret;
2171}
2172
2173
2174extern FILE *yyin;
2175
2176glusterfs_graph_t *
2177glusterfs_graph_new ()
2178{
2179 glusterfs_graph_t *graph = NULL((void*)0);
2180
2181 graph = GF_CALLOC (1, sizeof (*graph),__gf_calloc (1, sizeof (*graph), gf_common_mt_glusterfs_graph_t
)
2182 gf_common_mt_glusterfs_graph_t)__gf_calloc (1, sizeof (*graph), gf_common_mt_glusterfs_graph_t
)
;
2183 if (!graph)
2184 return NULL((void*)0);
2185
2186 INIT_LIST_HEAD (&graph->list)do { (&graph->list)->next = (&graph->list)->
prev = &graph->list; } while (0)
;
2187
2188 gettimeofday (&graph->dob, NULL((void*)0));
2189
2190 return graph;
2191}
2192
2193
2194glusterfs_graph_t *
2195glusterfs_graph_construct (FILE *fp)
2196{
2197 int ret = 0;
2198 int tmp_fd = -1;
2199 glusterfs_graph_t *graph = NULL((void*)0);
2200 FILE *tmp_file = NULL((void*)0);
2201 char template[PATH_MAX4096] = {0};
2202
2203 graph = glusterfs_graph_new ();
2204 if (!graph)
2205 goto err;
2206
2207 strcpy (template, "/tmp/tmp.XXXXXX");
2208 tmp_fd = mkstemp (template);
2209 if (-1 == tmp_fd)
2210 goto err;
2211
2212 ret = unlink (template);
2213 if (ret < 0) {
2214 gf_log ("parser", GF_LOG_WARNING, "Unable to delete file: %s",do { do { if (0) printf ("Unable to delete file: %s", template
); } while (0); _gf_log ("parser", "./graph.y", __FUNCTION__,
573, GF_LOG_WARNING, "Unable to delete file: %s", template);
} while (0)
2215 template)do { do { if (0) printf ("Unable to delete file: %s", template
); } while (0); _gf_log ("parser", "./graph.y", __FUNCTION__,
573, GF_LOG_WARNING, "Unable to delete file: %s", template);
} while (0)
;
2216 }
2217
2218 tmp_file = fdopen (tmp_fd, "w+b");
2219 if (!tmp_file)
2220 goto err;
2221
2222 ret = preprocess (fp, tmp_file);
2223 if (ret < 0) {
2224 gf_log ("parser", GF_LOG_ERROR, "parsing of backticks failed")do { do { if (0) printf ("parsing of backticks failed"); } while
(0); _gf_log ("parser", "./graph.y", __FUNCTION__, 582, GF_LOG_ERROR
, "parsing of backticks failed"); } while (0)
;
2225 goto err;
2226 }
2227
2228 yyin = tmp_file;
2229 construct = graph;
2230 ret = yyparse ();
2231 construct = NULL((void*)0);
2232
2233 if (ret == 1) {
2234 gf_log ("parser", GF_LOG_DEBUG,do { do { if (0) printf ("parsing of volfile failed, please review it "
"once more"); } while (0); _gf_log ("parser", "./graph.y", __FUNCTION__
, 594, GF_LOG_DEBUG, "parsing of volfile failed, please review it "
"once more"); } while (0)
2235 "parsing of volfile failed, please review it "do { do { if (0) printf ("parsing of volfile failed, please review it "
"once more"); } while (0); _gf_log ("parser", "./graph.y", __FUNCTION__
, 594, GF_LOG_DEBUG, "parsing of volfile failed, please review it "
"once more"); } while (0)
2236 "once more")do { do { if (0) printf ("parsing of volfile failed, please review it "
"once more"); } while (0); _gf_log ("parser", "./graph.y", __FUNCTION__
, 594, GF_LOG_DEBUG, "parsing of volfile failed, please review it "
"once more"); } while (0)
;
2237 goto err;
2238 }
2239
2240 fclose (tmp_file);
2241 return graph;
2242err:
2243 if (tmp_file) {
2244 fclose (tmp_file);
2245 } else {
2246 gf_log ("parser", GF_LOG_ERROR, "cannot create temporary file")do { do { if (0) printf ("cannot create temporary file"); } while
(0); _gf_log ("parser", "./graph.y", __FUNCTION__, 604, GF_LOG_ERROR
, "cannot create temporary file"); } while (0)
;
2247 if (-1 != tmp_fd)
2248 close (tmp_fd);
2249 }
2250
2251 glusterfs_graph_destroy (graph);
2252 return NULL((void*)0);
2253}
2254
2255