2 /* A Bison parser, made by GNU Bison 2.4.1. */
4 /* Skeleton implementation for Bison's Yacc-like parsers in C
6 Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005, 2006
7 Free Software Foundation, Inc.
9 This program is free software: you can redistribute it and/or modify
10 it under the terms of the GNU General Public License as published by
11 the Free Software Foundation, either version 3 of the License, or
12 (at your option) any later version.
14 This program is distributed in the hope that it will be useful,
15 but WITHOUT ANY WARRANTY; without even the implied warranty of
16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 GNU General Public License for more details.
19 You should have received a copy of the GNU General Public License
20 along with this program. If not, see <http://www.gnu.org/licenses/>. */
22 /* As a special exception, you may create a larger work that contains
23 part or all of the Bison parser skeleton and distribute that work
24 under terms of your choice, so long as that work isn't itself a
25 parser generator using the skeleton or a modified version thereof
26 as a parser skeleton. Alternatively, if you modify or redistribute
27 the parser skeleton itself, you may (at your option) remove this
28 special exception, which will cause the skeleton and the resulting
29 Bison output files to be licensed under the GNU General Public
30 License without this special exception.
32 This special exception was added by the Free Software Foundation in
33 version 2.2 of Bison. */
35 /* C LALR(1) parser skeleton written by Richard Stallman, by
36 simplifying the original so-called "semantic" parser. */
38 /* All symbols defined below should begin with yy or YY, to avoid
39 infringing on user name space. This should be done even for local
40 variables, as they might otherwise be expanded by user macros.
41 There are some unavoidable exceptions within include files to
42 define necessary library symbols; they are noted "INFRINGES ON
43 USER NAME SPACE" below. */
45 /* Identify Bison output. */
49 #define YYBISON_VERSION "2.4.1"
52 #define YYSKELETON_NAME "yacc.c"
63 /* Using locations. */
64 #define YYLSP_NEEDED 0
66 /* Substitute the variable and function names. */
67 #define yyparse cond_parse
68 #define yylex cond_lex
69 #define yyerror cond_error
70 #define yylval cond_lval
71 #define yychar cond_char
72 #define yydebug cond_debug
73 #define yynerrs cond_nerrs
76 /* Copy the first part of user declarations. */
78 /* Line 189 of yacc.c */
83 * Implementation of the Microsoft Installer (msi.dll)
85 * Copyright 2003 Mike McCormack for CodeWeavers
87 * This library is free software; you can redistribute it and/or
88 * modify it under the terms of the GNU Lesser General Public
89 * License as published by the Free Software Foundation; either
90 * version 2.1 of the License, or (at your option) any later version.
92 * This library is distributed in the hope that it will be useful,
93 * but WITHOUT ANY WARRANTY; without even the implied warranty of
94 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
95 * Lesser General Public License for more details.
97 * You should have received a copy of the GNU Lesser General Public
98 * License along with this library; if not, write to the Free Software
99 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
102 #define WIN32_NO_STATUS
104 #define COM_NO_WINDOWS_H
112 //#include <stdlib.h>
118 //#include "msiquery.h"
123 #include <msiserver.h>
124 #include <wine/debug.h>
125 #include <wine/unicode.h>
126 //#include "wine/list.h"
128 #define YYLEX_PARAM info
129 #define YYPARSE_PARAM info
131 static int cond_error(const char *str
);
133 WINE_DEFAULT_DEBUG_CHANNEL(msi
);
135 typedef struct tag_yyinput
149 static LPWSTR
COND_GetString( COND_input
*info
, const struct cond_str
*str
);
150 static LPWSTR
COND_GetLiteral( COND_input
*info
, const struct cond_str
*str
);
151 static int cond_lex( void *COND_lval
, COND_input
*info
);
153 static void *cond_alloc( COND_input
*cond
, unsigned int sz
);
154 static void *cond_track_mem( COND_input
*cond
, void *ptr
, unsigned int sz
);
155 static void cond_free( void *ptr
);
157 static INT
compare_int( INT a
, INT
operator, INT b
);
158 static INT
compare_string( LPCWSTR a
, INT
operator, LPCWSTR b
, BOOL convert
);
160 static INT
compare_and_free_strings( LPWSTR a
, INT op
, LPWSTR b
, BOOL convert
)
164 r
= compare_string( a
, op
, b
, convert
);
170 static BOOL
num_from_prop( LPCWSTR p
, INT
*val
)
172 INT ret
= 0, sign
= 1;
185 if( *p
< '0' || *p
> '9' )
187 ret
= ret
*10 + (*p
- '0');
196 /* Line 189 of yacc.c */
197 #line 194 "cond.tab.c"
199 /* Enabling traces. */
204 /* Enabling verbose error messages. */
205 #ifdef YYERROR_VERBOSE
206 # undef YYERROR_VERBOSE
207 # define YYERROR_VERBOSE 1
209 # define YYERROR_VERBOSE 0
212 /* Enabling the token table. */
213 #ifndef YYTOKEN_TABLE
214 # define YYTOKEN_TABLE 0
221 /* Put the tokens into the symbol table, so that GDB and other debuggers
267 #if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED
268 typedef union YYSTYPE
271 /* Line 214 of yacc.c */
280 /* Line 214 of yacc.c */
281 #line 278 "cond.tab.c"
283 # define YYSTYPE_IS_TRIVIAL 1
284 # define yystype YYSTYPE /* obsolescent; will be withdrawn */
285 # define YYSTYPE_IS_DECLARED 1
289 /* Copy the second part of user declarations. */
292 /* Line 264 of yacc.c */
293 #line 290 "cond.tab.c"
300 typedef YYTYPE_UINT8 yytype_uint8
;
302 typedef unsigned char yytype_uint8
;
306 typedef YYTYPE_INT8 yytype_int8
;
307 #elif (defined __STDC__ || defined __C99__FUNC__ \
308 || defined __cplusplus || defined _MSC_VER)
309 typedef signed char yytype_int8
;
311 typedef short int yytype_int8
;
315 typedef YYTYPE_UINT16 yytype_uint16
;
317 typedef unsigned short int yytype_uint16
;
321 typedef YYTYPE_INT16 yytype_int16
;
323 typedef short int yytype_int16
;
327 # ifdef __SIZE_TYPE__
328 # define YYSIZE_T __SIZE_TYPE__
329 # elif defined size_t
330 # define YYSIZE_T size_t
331 # elif ! defined YYSIZE_T && (defined __STDC__ || defined __C99__FUNC__ \
332 || defined __cplusplus || defined _MSC_VER)
333 # include <stddef.h> /* INFRINGES ON USER NAME SPACE */
334 # define YYSIZE_T size_t
336 # define YYSIZE_T unsigned int
340 #define YYSIZE_MAXIMUM ((YYSIZE_T) -1)
345 # include <libintl.h> /* INFRINGES ON USER NAME SPACE */
346 # define YY_(msgid) dgettext ("bison-runtime", msgid)
350 # define YY_(msgid) msgid
354 /* Suppress unused-variable warnings by "using" E. */
355 #if ! defined lint || defined __GNUC__
356 # define YYUSE(e) ((void) (e))
358 # define YYUSE(e) /* empty */
361 /* Identity function, used to suppress warnings about constant conditions. */
365 #if (defined __STDC__ || defined __C99__FUNC__ \
366 || defined __cplusplus || defined _MSC_VER)
379 #if ! defined yyoverflow || YYERROR_VERBOSE
381 /* The parser invokes alloca or malloc; define the necessary symbols. */
383 # ifdef YYSTACK_USE_ALLOCA
384 # if YYSTACK_USE_ALLOCA
386 # define YYSTACK_ALLOC __builtin_alloca
387 # elif defined __BUILTIN_VA_ARG_INCR
388 # include <alloca.h> /* INFRINGES ON USER NAME SPACE */
390 # define YYSTACK_ALLOC __alloca
391 # elif defined _MSC_VER
392 # include <malloc.h> /* INFRINGES ON USER NAME SPACE */
393 # define alloca _alloca
395 # define YYSTACK_ALLOC alloca
396 # if ! defined _ALLOCA_H && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \
397 || defined __cplusplus || defined _MSC_VER)
398 # include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
407 # ifdef YYSTACK_ALLOC
408 /* Pacify GCC's `empty if-body' warning. */
409 # define YYSTACK_FREE(Ptr) do { /* empty */; } while (YYID (0))
410 # ifndef YYSTACK_ALLOC_MAXIMUM
411 /* The OS might guarantee only one guard page at the bottom of the stack,
412 and a page size can be as small as 4096 bytes. So we cannot safely
413 invoke alloca (N) if N exceeds 4096. Use a slightly smaller number
414 to allow for a few compiler-allocated temporary stack slots. */
415 # define YYSTACK_ALLOC_MAXIMUM 4032 /* reasonable circa 2006 */
418 # define YYSTACK_ALLOC YYMALLOC
419 # define YYSTACK_FREE YYFREE
420 # ifndef YYSTACK_ALLOC_MAXIMUM
421 # define YYSTACK_ALLOC_MAXIMUM YYSIZE_MAXIMUM
423 # if (defined __cplusplus && ! defined _STDLIB_H \
424 && ! ((defined YYMALLOC || defined malloc) \
425 && (defined YYFREE || defined free)))
426 # include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
432 # define YYMALLOC malloc
433 # if ! defined malloc && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \
434 || defined __cplusplus || defined _MSC_VER)
435 void *malloc (YYSIZE_T
); /* INFRINGES ON USER NAME SPACE */
440 # if ! defined free && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \
441 || defined __cplusplus || defined _MSC_VER)
442 void free (void *); /* INFRINGES ON USER NAME SPACE */
446 #endif /* ! defined yyoverflow || YYERROR_VERBOSE */
449 #if (! defined yyoverflow \
450 && (! defined __cplusplus \
451 || (defined YYSTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL)))
453 /* A type that is properly aligned for any stack member. */
456 yytype_int16 yyss_alloc
;
460 /* The size of the maximum gap between one aligned stack and the next. */
461 # define YYSTACK_GAP_MAXIMUM (sizeof (union yyalloc) - 1)
463 /* The size of an array large to enough to hold all stacks, each with
465 # define YYSTACK_BYTES(N) \
466 ((N) * (sizeof (yytype_int16) + sizeof (YYSTYPE)) \
467 + YYSTACK_GAP_MAXIMUM)
469 /* Copy COUNT objects from FROM to TO. The source and destination do
472 # if defined __GNUC__ && 1 < __GNUC__
473 # define YYCOPY(To, From, Count) \
474 __builtin_memcpy (To, From, (Count) * sizeof (*(From)))
476 # define YYCOPY(To, From, Count) \
480 for (yyi = 0; yyi < (Count); yyi++) \
481 (To)[yyi] = (From)[yyi]; \
487 /* Relocate STACK from its old location to the new one. The
488 local variables YYSIZE and YYSTACKSIZE give the old and new number of
489 elements in the stack, and YYPTR gives the new location of the
490 stack. Advance YYPTR to a properly aligned location for the next
492 # define YYSTACK_RELOCATE(Stack_alloc, Stack) \
495 YYSIZE_T yynewbytes; \
496 YYCOPY (&yyptr->Stack_alloc, Stack, yysize); \
497 Stack = &yyptr->Stack_alloc; \
498 yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \
499 yyptr += yynewbytes / sizeof (*yyptr); \
505 /* YYFINAL -- State number of the termination state. */
507 /* YYLAST -- Last index in YYTABLE. */
510 /* YYNTOKENS -- Number of terminals. */
512 /* YYNNTS -- Number of nonterminals. */
514 /* YYNRULES -- Number of rules. */
516 /* YYNRULES -- Number of states. */
519 /* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */
521 #define YYMAXUTOK 295
523 #define YYTRANSLATE(YYX) \
524 ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK)
526 /* YYTRANSLATE[YYLEX] -- Bison symbol number corresponding to YYLEX. */
527 static const yytype_uint8 yytranslate
[] =
529 0, 2, 2, 2, 2, 2, 2, 2, 2, 2,
530 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
531 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
532 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
533 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
534 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
535 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
536 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
537 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
538 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
539 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
540 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
541 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
542 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
543 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
544 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
545 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
546 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
547 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
548 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
549 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
550 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
551 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
552 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
553 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
554 2, 2, 2, 2, 2, 2, 1, 2, 3, 4,
555 5, 6, 7, 8, 9, 10, 11, 12, 13, 14,
556 15, 16, 17, 18, 19, 20, 21, 22, 23, 24,
557 25, 26, 27, 28, 29, 30, 31, 32, 33, 34,
558 35, 36, 37, 38, 39, 40
562 /* YYPRHS[YYN] -- Index of the first RHS symbol of rule number YYN in
564 static const yytype_uint8 yyprhs
[] =
566 0, 0, 3, 5, 6, 8, 12, 16, 20, 24,
567 26, 30, 33, 35, 37, 41, 45, 49, 53, 57,
568 61, 65, 69, 73, 77, 79, 81, 83, 85, 87,
569 89, 91, 93, 95, 97, 99, 101, 103, 105, 107,
570 109, 111, 113, 115, 117, 119, 121, 124, 127, 130,
574 /* YYRHS -- A `-1'-separated list of the rules' RHS. */
575 static const yytype_int8 yyrhs
[] =
577 42, 0, -1, 43, -1, -1, 44, -1, 43, 5,
578 44, -1, 43, 9, 44, -1, 43, 8, 44, -1,
579 43, 10, 44, -1, 45, -1, 44, 6, 45, -1,
580 7, 45, -1, 49, -1, 47, -1, 49, 46, 49,
581 -1, 50, 46, 49, -1, 49, 46, 50, -1, 50,
582 46, 50, -1, 50, 46, 48, -1, 48, 46, 50,
583 -1, 48, 46, 48, -1, 48, 46, 49, -1, 49,
584 46, 48, -1, 23, 43, 24, -1, 13, -1, 14,
585 -1, 11, -1, 12, -1, 16, -1, 15, -1, 26,
586 -1, 19, -1, 20, -1, 17, -1, 18, -1, 22,
587 -1, 21, -1, 27, -1, 30, -1, 31, -1, 28,
588 -1, 29, -1, 50, -1, 48, -1, 39, -1, 52,
589 -1, 33, 51, -1, 34, 51, -1, 35, 51, -1,
590 36, 51, -1, 51, -1, 32, 51, -1, 37, -1,
594 /* YYRLINE[YYN] -- source line where rule number YYN was defined. */
595 static const yytype_uint16 yyrline
[] =
597 0, 140, 140, 146, 153, 157, 161, 165, 169, 176,
598 180, 187, 191, 195, 200, 204, 213, 222, 226, 230,
599 234, 238, 243, 248, 256, 257, 258, 259, 260, 261,
600 262, 263, 264, 265, 266, 267, 268, 269, 270, 271,
601 272, 273, 277, 281, 288, 298, 302, 311, 320, 333,
606 #if YYDEBUG || YYERROR_VERBOSE || YYTOKEN_TABLE
607 /* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM.
608 First, the terminals, then, starting at YYNTOKENS, nonterminals. */
609 static const char *const yytname
[] =
611 "$end", "error", "$undefined", "COND_SPACE", "COND_EOF", "COND_OR",
612 "COND_AND", "COND_NOT", "COND_XOR", "COND_IMP", "COND_EQV", "COND_LT",
613 "COND_GT", "COND_EQ", "COND_NE", "COND_GE", "COND_LE", "COND_ILT",
614 "COND_IGT", "COND_IEQ", "COND_INE", "COND_IGE", "COND_ILE", "COND_LPAR",
615 "COND_RPAR", "COND_TILDA", "COND_SS", "COND_ISS", "COND_ILHS",
616 "COND_IRHS", "COND_LHS", "COND_RHS", "COND_PERCENT", "COND_DOLLARS",
617 "COND_QUESTION", "COND_AMPER", "COND_EXCLAM", "COND_IDENT",
618 "COND_NUMBER", "COND_LITER", "COND_ERROR", "$accept", "condition",
619 "expression", "boolean_term", "boolean_factor", "operator", "value_s",
620 "literal", "value_i", "symbol_s", "identifier", "integer", 0
625 /* YYTOKNUM[YYLEX-NUM] -- Internal token number corresponding to
627 static const yytype_uint16 yytoknum
[] =
629 0, 256, 257, 258, 259, 260, 261, 262, 263, 264,
630 265, 266, 267, 268, 269, 270, 271, 272, 273, 274,
631 275, 276, 277, 278, 279, 280, 281, 282, 283, 284,
632 285, 286, 287, 288, 289, 290, 291, 292, 293, 294,
637 /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */
638 static const yytype_uint8 yyr1
[] =
640 0, 41, 42, 42, 43, 43, 43, 43, 43, 44,
641 44, 45, 45, 45, 45, 45, 45, 45, 45, 45,
642 45, 45, 45, 45, 46, 46, 46, 46, 46, 46,
643 46, 46, 46, 46, 46, 46, 46, 46, 46, 46,
644 46, 46, 47, 47, 48, 49, 49, 49, 49, 49,
648 /* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */
649 static const yytype_uint8 yyr2
[] =
651 0, 2, 1, 0, 1, 3, 3, 3, 3, 1,
652 3, 2, 1, 1, 3, 3, 3, 3, 3, 3,
653 3, 3, 3, 3, 1, 1, 1, 1, 1, 1,
654 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
655 1, 1, 1, 1, 1, 1, 2, 2, 2, 2,
659 /* YYDEFACT[STATE-NAME] -- Default rule to reduce with in state
660 STATE-NUM when YYTABLE doesn't specify something else to do. Zero
661 means the default is an error. */
662 static const yytype_uint8 yydefact
[] =
664 3, 0, 0, 0, 0, 0, 0, 0, 52, 53,
665 44, 0, 2, 4, 9, 13, 43, 12, 42, 50,
666 45, 11, 0, 51, 46, 47, 48, 49, 1, 0,
667 0, 0, 0, 0, 26, 27, 24, 25, 29, 28,
668 33, 34, 31, 32, 36, 35, 30, 37, 40, 41,
669 38, 39, 0, 0, 0, 23, 5, 7, 6, 8,
670 10, 20, 21, 19, 22, 14, 16, 18, 15, 17
673 /* YYDEFGOTO[NTERM-NUM]. */
674 static const yytype_int8 yydefgoto
[] =
676 -1, 11, 12, 13, 14, 52, 15, 16, 17, 18,
680 /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
682 #define YYPACT_NINF -15
683 static const yytype_int8 yypact
[] =
685 -7, -7, -7, -14, -14, -14, -14, -14, -15, -15,
686 -15, 24, 46, 30, -15, -15, -9, -9, -9, -15,
687 -15, -15, 29, -15, -15, -15, -15, -15, -15, -7,
688 -7, -7, -7, -7, -15, -15, -15, -15, -15, -15,
689 -15, -15, -15, -15, -15, -15, -15, -15, -15, -15,
690 -15, -15, 8, 8, 8, -15, 30, 30, 30, 30,
691 -15, -15, -15, -15, -15, -15, -15, -15, -15, -15
694 /* YYPGOTO[NTERM-NUM]. */
695 static const yytype_int8 yypgoto
[] =
697 -15, -15, 50, 33, 0, -3, -15, -4, 14, 17,
701 /* YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If
702 positive, shift that token. If negative, reduce the rule which
703 number is the opposite. If zero, do what YYDEFACT says.
704 If YYTABLE_NINF, syntax error. */
705 #define YYTABLE_NINF -1
706 static const yytype_uint8 yytable
[] =
708 1, 21, 34, 35, 36, 37, 38, 39, 40, 41,
709 42, 43, 44, 45, 53, 54, 2, 46, 47, 48,
710 49, 50, 51, 8, 28, 3, 4, 5, 6, 7,
711 8, 9, 10, 60, 29, 0, 33, 30, 31, 32,
712 3, 4, 5, 6, 7, 8, 9, 10, 61, 64,
713 67, 29, 22, 55, 30, 31, 32, 23, 24, 25,
714 26, 27, 56, 57, 58, 59, 62, 65, 68, 63,
718 static const yytype_int8 yycheck
[] =
720 7, 1, 11, 12, 13, 14, 15, 16, 17, 18,
721 19, 20, 21, 22, 17, 18, 23, 26, 27, 28,
722 29, 30, 31, 37, 0, 32, 33, 34, 35, 36,
723 37, 38, 39, 33, 5, -1, 6, 8, 9, 10,
724 32, 33, 34, 35, 36, 37, 38, 39, 52, 53,
725 54, 5, 2, 24, 8, 9, 10, 3, 4, 5,
726 6, 7, 29, 30, 31, 32, 52, 53, 54, 52,
730 /* YYSTOS[STATE-NUM] -- The (internal number of the) accessing
731 symbol of state STATE-NUM. */
732 static const yytype_uint8 yystos
[] =
734 0, 7, 23, 32, 33, 34, 35, 36, 37, 38,
735 39, 42, 43, 44, 45, 47, 48, 49, 50, 51,
736 52, 45, 43, 51, 51, 51, 51, 51, 0, 5,
737 8, 9, 10, 6, 11, 12, 13, 14, 15, 16,
738 17, 18, 19, 20, 21, 22, 26, 27, 28, 29,
739 30, 31, 46, 46, 46, 24, 44, 44, 44, 44,
740 45, 48, 49, 50, 48, 49, 50, 48, 49, 50
743 #define yyerrok (yyerrstatus = 0)
744 #define yyclearin (yychar = YYEMPTY)
748 #define YYACCEPT goto yyacceptlab
749 #define YYABORT goto yyabortlab
750 #define YYERROR goto yyerrorlab
753 /* Like YYERROR except do call yyerror. This remains here temporarily
754 to ease the transition to the new meaning of YYERROR, for GCC.
755 Once GCC version 2 has supplanted version 1, this can go. */
757 #define YYFAIL goto yyerrlab
759 #define YYRECOVERING() (!!yyerrstatus)
761 #define YYBACKUP(Token, Value) \
763 if (yychar == YYEMPTY && yylen == 1) \
767 yytoken = YYTRANSLATE (yychar); \
773 yyerror (YY_("syntax error: cannot back up")); \
780 #define YYERRCODE 256
783 /* YYLLOC_DEFAULT -- Set CURRENT to span from RHS[1] to RHS[N].
784 If N is 0, then set CURRENT to the empty location which ends
785 the previous symbol: RHS[0] (always defined). */
787 #define YYRHSLOC(Rhs, K) ((Rhs)[K])
788 #ifndef YYLLOC_DEFAULT
789 # define YYLLOC_DEFAULT(Current, Rhs, N) \
793 (Current).first_line = YYRHSLOC (Rhs, 1).first_line; \
794 (Current).first_column = YYRHSLOC (Rhs, 1).first_column; \
795 (Current).last_line = YYRHSLOC (Rhs, N).last_line; \
796 (Current).last_column = YYRHSLOC (Rhs, N).last_column; \
800 (Current).first_line = (Current).last_line = \
801 YYRHSLOC (Rhs, 0).last_line; \
802 (Current).first_column = (Current).last_column = \
803 YYRHSLOC (Rhs, 0).last_column; \
809 /* YY_LOCATION_PRINT -- Print the location on the stream.
810 This macro was not mandated originally: define only if we know
811 we won't break user code: when these are the locations we know. */
813 #ifndef YY_LOCATION_PRINT
814 # if YYLTYPE_IS_TRIVIAL
815 # define YY_LOCATION_PRINT(File, Loc) \
816 fprintf (File, "%d.%d-%d.%d", \
817 (Loc).first_line, (Loc).first_column, \
818 (Loc).last_line, (Loc).last_column)
820 # define YY_LOCATION_PRINT(File, Loc) ((void) 0)
825 /* YYLEX -- calling `yylex' with the right arguments. */
828 # define YYLEX yylex (&yylval, YYLEX_PARAM)
830 # define YYLEX yylex (&yylval)
833 /* Enable debugging if requested. */
837 # include <stdio.h> /* INFRINGES ON USER NAME SPACE */
838 # define YYFPRINTF fprintf
841 # define YYDPRINTF(Args) \
847 # define YY_SYMBOL_PRINT(Title, Type, Value, Location) \
851 YYFPRINTF (stderr, "%s ", Title); \
852 yy_symbol_print (stderr, \
854 YYFPRINTF (stderr, "\n"); \
859 /*--------------------------------.
860 | Print this symbol on YYOUTPUT. |
861 `--------------------------------*/
864 #if (defined __STDC__ || defined __C99__FUNC__ \
865 || defined __cplusplus || defined _MSC_VER)
867 yy_symbol_value_print (FILE *yyoutput
, int yytype
, YYSTYPE
const * const yyvaluep
)
870 yy_symbol_value_print (yyoutput
, yytype
, yyvaluep
)
873 YYSTYPE
const * const yyvaluep
;
879 if (yytype
< YYNTOKENS
)
880 YYPRINT (yyoutput
, yytoknum
[yytype
], *yyvaluep
);
892 /*--------------------------------.
893 | Print this symbol on YYOUTPUT. |
894 `--------------------------------*/
896 #if (defined __STDC__ || defined __C99__FUNC__ \
897 || defined __cplusplus || defined _MSC_VER)
899 yy_symbol_print (FILE *yyoutput
, int yytype
, YYSTYPE
const * const yyvaluep
)
902 yy_symbol_print (yyoutput
, yytype
, yyvaluep
)
905 YYSTYPE
const * const yyvaluep
;
908 if (yytype
< YYNTOKENS
)
909 YYFPRINTF (yyoutput
, "token %s (", yytname
[yytype
]);
911 YYFPRINTF (yyoutput
, "nterm %s (", yytname
[yytype
]);
913 yy_symbol_value_print (yyoutput
, yytype
, yyvaluep
);
914 YYFPRINTF (yyoutput
, ")");
917 /*------------------------------------------------------------------.
918 | yy_stack_print -- Print the state stack from its BOTTOM up to its |
920 `------------------------------------------------------------------*/
922 #if (defined __STDC__ || defined __C99__FUNC__ \
923 || defined __cplusplus || defined _MSC_VER)
925 yy_stack_print (yytype_int16
*yybottom
, yytype_int16
*yytop
)
928 yy_stack_print (yybottom
, yytop
)
929 yytype_int16
*yybottom
;
933 YYFPRINTF (stderr
, "Stack now");
934 for (; yybottom
<= yytop
; yybottom
++)
936 int yybot
= *yybottom
;
937 YYFPRINTF (stderr
, " %d", yybot
);
939 YYFPRINTF (stderr
, "\n");
942 # define YY_STACK_PRINT(Bottom, Top) \
945 yy_stack_print ((Bottom), (Top)); \
949 /*------------------------------------------------.
950 | Report that the YYRULE is going to be reduced. |
951 `------------------------------------------------*/
953 #if (defined __STDC__ || defined __C99__FUNC__ \
954 || defined __cplusplus || defined _MSC_VER)
956 yy_reduce_print (YYSTYPE
*yyvsp
, int yyrule
)
959 yy_reduce_print (yyvsp
, yyrule
)
964 int yynrhs
= yyr2
[yyrule
];
966 unsigned long int yylno
= yyrline
[yyrule
];
967 YYFPRINTF (stderr
, "Reducing stack by rule %d (line %lu):\n",
969 /* The symbols being reduced. */
970 for (yyi
= 0; yyi
< yynrhs
; yyi
++)
972 YYFPRINTF (stderr
, " $%d = ", yyi
+ 1);
973 yy_symbol_print (stderr
, yyrhs
[yyprhs
[yyrule
] + yyi
],
974 &(yyvsp
[(yyi
+ 1) - (yynrhs
)])
976 YYFPRINTF (stderr
, "\n");
980 # define YY_REDUCE_PRINT(Rule) \
983 yy_reduce_print (yyvsp, Rule); \
986 /* Nonzero means print parse trace. It is left uninitialized so that
987 multiple parsers can coexist. */
990 # define YYDPRINTF(Args)
991 # define YY_SYMBOL_PRINT(Title, Type, Value, Location)
992 # define YY_STACK_PRINT(Bottom, Top)
993 # define YY_REDUCE_PRINT(Rule)
994 #endif /* !YYDEBUG */
997 /* YYINITDEPTH -- initial size of the parser's stacks. */
999 # define YYINITDEPTH 200
1002 /* YYMAXDEPTH -- maximum size the stacks can grow to (effective only
1003 if the built-in stack extension method is used).
1005 Do not make this value too large; the results are undefined if
1006 YYSTACK_ALLOC_MAXIMUM < YYSTACK_BYTES (YYMAXDEPTH)
1007 evaluated with infinite-precision integer arithmetic. */
1010 # define YYMAXDEPTH 10000
1018 # if defined __GLIBC__ && defined _STRING_H
1019 # define yystrlen strlen
1021 /* Return the length of YYSTR. */
1022 #if (defined __STDC__ || defined __C99__FUNC__ \
1023 || defined __cplusplus || defined _MSC_VER)
1025 yystrlen (const char *yystr
)
1033 for (yylen
= 0; yystr
[yylen
]; yylen
++)
1041 # if defined __GLIBC__ && defined _STRING_H && defined _GNU_SOURCE
1042 # define yystpcpy stpcpy
1044 /* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in
1046 #if (defined __STDC__ || defined __C99__FUNC__ \
1047 || defined __cplusplus || defined _MSC_VER)
1049 yystpcpy (char *yydest
, const char *yysrc
)
1052 yystpcpy (yydest
, yysrc
)
1058 const char *yys
= yysrc
;
1060 while ((*yyd
++ = *yys
++) != '\0')
1069 /* Copy to YYRES the contents of YYSTR after stripping away unnecessary
1070 quotes and backslashes, so that it's suitable for yyerror. The
1071 heuristic is that double-quoting is unnecessary unless the string
1072 contains an apostrophe, a comma, or backslash (other than
1073 backslash-backslash). YYSTR is taken from yytname. If YYRES is
1074 null, do not copy; instead, return the length of what the result
1077 yytnamerr (char *yyres
, const char *yystr
)
1082 char const *yyp
= yystr
;
1089 goto do_not_strip_quotes
;
1093 goto do_not_strip_quotes
;
1106 do_not_strip_quotes
: ;
1110 return yystrlen (yystr
);
1112 return yystpcpy (yyres
, yystr
) - yyres
;
1116 /* Copy into YYRESULT an error message about the unexpected token
1117 YYCHAR while in state YYSTATE. Return the number of bytes copied,
1118 including the terminating null byte. If YYRESULT is null, do not
1119 copy anything; just return the number of bytes that would be
1120 copied. As a special case, return 0 if an ordinary "syntax error"
1121 message will do. Return YYSIZE_MAXIMUM if overflow occurs during
1122 size calculation. */
1124 yysyntax_error (char *yyresult
, int yystate
, int yychar
)
1126 int yyn
= yypact
[yystate
];
1128 if (! (YYPACT_NINF
< yyn
&& yyn
<= YYLAST
))
1132 int yytype
= YYTRANSLATE (yychar
);
1133 YYSIZE_T yysize0
= yytnamerr (0, yytname
[yytype
]);
1134 YYSIZE_T yysize
= yysize0
;
1136 int yysize_overflow
= 0;
1137 enum { YYERROR_VERBOSE_ARGS_MAXIMUM
= 5 };
1138 char const *yyarg
[YYERROR_VERBOSE_ARGS_MAXIMUM
];
1142 /* This is so xgettext sees the translatable formats that are
1143 constructed on the fly. */
1144 YY_("syntax error, unexpected %s");
1145 YY_("syntax error, unexpected %s, expecting %s");
1146 YY_("syntax error, unexpected %s, expecting %s or %s");
1147 YY_("syntax error, unexpected %s, expecting %s or %s or %s");
1148 YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s");
1152 static char const yyunexpected
[] = "syntax error, unexpected %s";
1153 static char const yyexpecting
[] = ", expecting %s";
1154 static char const yyor
[] = " or %s";
1155 char yyformat
[sizeof yyunexpected
1156 + sizeof yyexpecting
- 1
1157 + ((YYERROR_VERBOSE_ARGS_MAXIMUM
- 2)
1158 * (sizeof yyor
- 1))];
1159 char const *yyprefix
= yyexpecting
;
1161 /* Start YYX at -YYN if negative to avoid negative indexes in
1163 int yyxbegin
= yyn
< 0 ? -yyn
: 0;
1165 /* Stay within bounds of both yycheck and yytname. */
1166 int yychecklim
= YYLAST
- yyn
+ 1;
1167 int yyxend
= yychecklim
< YYNTOKENS
? yychecklim
: YYNTOKENS
;
1170 yyarg
[0] = yytname
[yytype
];
1171 yyfmt
= yystpcpy (yyformat
, yyunexpected
);
1173 for (yyx
= yyxbegin
; yyx
< yyxend
; ++yyx
)
1174 if (yycheck
[yyx
+ yyn
] == yyx
&& yyx
!= YYTERROR
)
1176 if (yycount
== YYERROR_VERBOSE_ARGS_MAXIMUM
)
1180 yyformat
[sizeof yyunexpected
- 1] = '\0';
1183 yyarg
[yycount
++] = yytname
[yyx
];
1184 yysize1
= yysize
+ yytnamerr (0, yytname
[yyx
]);
1185 yysize_overflow
|= (yysize1
< yysize
);
1187 yyfmt
= yystpcpy (yyfmt
, yyprefix
);
1191 yyf
= YY_(yyformat
);
1192 yysize1
= yysize
+ yystrlen (yyf
);
1193 yysize_overflow
|= (yysize1
< yysize
);
1196 if (yysize_overflow
)
1197 return YYSIZE_MAXIMUM
;
1201 /* Avoid sprintf, as that infringes on the user's name space.
1202 Don't have undefined behavior even if the translation
1203 produced a string with the wrong number of "%s"s. */
1204 char *yyp
= yyresult
;
1206 while ((*yyp
= *yyf
) != '\0')
1208 if (*yyp
== '%' && yyf
[1] == 's' && yyi
< yycount
)
1210 yyp
+= yytnamerr (yyp
, yyarg
[yyi
++]);
1223 #endif /* YYERROR_VERBOSE */
1226 /*-----------------------------------------------.
1227 | Release the memory associated to this symbol. |
1228 `-----------------------------------------------*/
1231 #if (defined __STDC__ || defined __C99__FUNC__ \
1232 || defined __cplusplus || defined _MSC_VER)
1234 yydestruct (const char *yymsg
, int yytype
, YYSTYPE
*yyvaluep
)
1237 yydestruct (yymsg
, yytype
, yyvaluep
)
1247 YY_SYMBOL_PRINT (yymsg
, yytype
, yyvaluep
, yylocationp
);
1257 /* Prevent warnings from -Wmissing-prototypes. */
1258 #ifdef YYPARSE_PARAM
1259 #if defined __STDC__ || defined __cplusplus
1260 int yyparse (void *YYPARSE_PARAM
);
1264 #else /* ! YYPARSE_PARAM */
1265 #if defined __STDC__ || defined __cplusplus
1270 #endif /* ! YYPARSE_PARAM */
1276 /*-------------------------.
1277 | yyparse or yypush_parse. |
1278 `-------------------------*/
1280 #ifdef YYPARSE_PARAM
1281 #if (defined __STDC__ || defined __C99__FUNC__ \
1282 || defined __cplusplus || defined _MSC_VER)
1284 yyparse (void *YYPARSE_PARAM
)
1287 yyparse (YYPARSE_PARAM
)
1288 void *YYPARSE_PARAM
;
1290 #else /* ! YYPARSE_PARAM */
1291 #if (defined __STDC__ || defined __C99__FUNC__ \
1292 || defined __cplusplus || defined _MSC_VER)
1302 /* The lookahead symbol. */
1305 /* The semantic value of the lookahead symbol. */
1308 /* Number of syntax errors so far. */
1312 /* Number of tokens to shift before error messages enabled. */
1315 /* The stacks and their tools:
1316 `yyss': related to states.
1317 `yyvs': related to semantic values.
1319 Refer to the stacks thru separate pointers, to allow yyoverflow
1320 to reallocate them elsewhere. */
1322 /* The state stack. */
1323 yytype_int16 yyssa
[YYINITDEPTH
];
1325 yytype_int16
*yyssp
;
1327 /* The semantic value stack. */
1328 YYSTYPE yyvsa
[YYINITDEPTH
];
1332 YYSIZE_T yystacksize
;
1336 /* Lookahead token as an internal (translated) token number. */
1338 /* The variables used to return semantic value and location from the
1343 /* Buffer for error messages, and its allocated size. */
1345 char *yymsg
= yymsgbuf
;
1346 YYSIZE_T yymsg_alloc
= sizeof yymsgbuf
;
1349 #define YYPOPSTACK(N) (yyvsp -= (N), yyssp -= (N))
1351 /* The number of symbols on the RHS of the reduced rule.
1352 Keep to zero when no symbol should be popped. */
1358 yystacksize
= YYINITDEPTH
;
1360 YYDPRINTF ((stderr
, "Starting parse\n"));
1365 yychar
= YYEMPTY
; /* Cause a token to be read. */
1367 /* Initialize stack pointers.
1368 Waste one element of value and location stack
1369 so that they stay on the same level as the state stack.
1370 The wasted elements are never initialized. */
1376 /*------------------------------------------------------------.
1377 | yynewstate -- Push a new state, which is found in yystate. |
1378 `------------------------------------------------------------*/
1380 /* In all cases, when you get here, the value and location stacks
1381 have just been pushed. So pushing a state here evens the stacks. */
1387 if (yyss
+ yystacksize
- 1 <= yyssp
)
1389 /* Get the current used size of the three stacks, in elements. */
1390 YYSIZE_T yysize
= yyssp
- yyss
+ 1;
1394 /* Give user a chance to reallocate the stack. Use copies of
1395 these so that the &'s don't force the real ones into
1397 YYSTYPE
*yyvs1
= yyvs
;
1398 yytype_int16
*yyss1
= yyss
;
1400 /* Each stack pointer address is followed by the size of the
1401 data in use in that stack, in bytes. This used to be a
1402 conditional around just the two extra args, but that might
1403 be undefined if yyoverflow is a macro. */
1404 yyoverflow (YY_("memory exhausted"),
1405 &yyss1
, yysize
* sizeof (*yyssp
),
1406 &yyvs1
, yysize
* sizeof (*yyvsp
),
1412 #else /* no yyoverflow */
1413 # ifndef YYSTACK_RELOCATE
1414 goto yyexhaustedlab
;
1416 /* Extend the stack our own way. */
1417 if (YYMAXDEPTH
<= yystacksize
)
1418 goto yyexhaustedlab
;
1420 if (YYMAXDEPTH
< yystacksize
)
1421 yystacksize
= YYMAXDEPTH
;
1424 yytype_int16
*yyss1
= yyss
;
1425 union yyalloc
*yyptr
=
1426 (union yyalloc
*) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize
));
1428 goto yyexhaustedlab
;
1429 YYSTACK_RELOCATE (yyss_alloc
, yyss
);
1430 YYSTACK_RELOCATE (yyvs_alloc
, yyvs
);
1431 # undef YYSTACK_RELOCATE
1433 YYSTACK_FREE (yyss1
);
1436 #endif /* no yyoverflow */
1438 yyssp
= yyss
+ yysize
- 1;
1439 yyvsp
= yyvs
+ yysize
- 1;
1441 YYDPRINTF ((stderr
, "Stack size increased to %lu\n",
1442 (unsigned long int) yystacksize
));
1444 if (yyss
+ yystacksize
- 1 <= yyssp
)
1448 YYDPRINTF ((stderr
, "Entering state %d\n", yystate
));
1450 if (yystate
== YYFINAL
)
1460 /* Do appropriate processing given the current state. Read a
1461 lookahead token if we need one and don't already have one. */
1463 /* First try to decide what to do without reference to lookahead token. */
1464 yyn
= yypact
[yystate
];
1465 if (yyn
== YYPACT_NINF
)
1468 /* Not known => get a lookahead token if don't already have one. */
1470 /* YYCHAR is either YYEMPTY or YYEOF or a valid lookahead symbol. */
1471 if (yychar
== YYEMPTY
)
1473 YYDPRINTF ((stderr
, "Reading a token: "));
1477 if (yychar
<= YYEOF
)
1479 yychar
= yytoken
= YYEOF
;
1480 YYDPRINTF ((stderr
, "Now at end of input.\n"));
1484 yytoken
= YYTRANSLATE (yychar
);
1485 YY_SYMBOL_PRINT ("Next token is", yytoken
, &yylval
, &yylloc
);
1488 /* If the proper action on seeing token YYTOKEN is to reduce or to
1489 detect an error, take that action. */
1491 if (yyn
< 0 || YYLAST
< yyn
|| yycheck
[yyn
] != yytoken
)
1496 if (yyn
== 0 || yyn
== YYTABLE_NINF
)
1502 /* Count tokens shifted since error; after three, turn off error
1507 /* Shift the lookahead token. */
1508 YY_SYMBOL_PRINT ("Shifting", yytoken
, &yylval
, &yylloc
);
1510 /* Discard the shifted token. */
1519 /*-----------------------------------------------------------.
1520 | yydefault -- do the default action for the current state. |
1521 `-----------------------------------------------------------*/
1523 yyn
= yydefact
[yystate
];
1529 /*-----------------------------.
1530 | yyreduce -- Do a reduction. |
1531 `-----------------------------*/
1533 /* yyn is the number of a rule to reduce with. */
1536 /* If YYLEN is nonzero, implement the default value of the action:
1539 Otherwise, the following line sets YYVAL to garbage.
1540 This behavior is undocumented and Bison
1541 users should not rely upon it. Assigning to YYVAL
1542 unconditionally makes the parser a bit smaller, and it avoids a
1543 GCC warning that YYVAL may be used uninitialized. */
1544 yyval
= yyvsp
[1-yylen
];
1547 YY_REDUCE_PRINT (yyn
);
1552 /* Line 1455 of yacc.c */
1555 COND_input
* cond
= (COND_input
*) info
;
1556 cond
->result
= (yyvsp
[(1) - (1)].value
);
1562 /* Line 1455 of yacc.c */
1565 COND_input
* cond
= (COND_input
*) info
;
1566 cond
->result
= MSICONDITION_NONE
;
1572 /* Line 1455 of yacc.c */
1575 (yyval
.value
) = (yyvsp
[(1) - (1)].value
);
1581 /* Line 1455 of yacc.c */
1584 (yyval
.value
) = (yyvsp
[(1) - (3)].value
) || (yyvsp
[(3) - (3)].value
);
1590 /* Line 1455 of yacc.c */
1593 (yyval
.value
) = !(yyvsp
[(1) - (3)].value
) || (yyvsp
[(3) - (3)].value
);
1599 /* Line 1455 of yacc.c */
1602 (yyval
.value
) = ( (yyvsp
[(1) - (3)].value
) || (yyvsp
[(3) - (3)].value
) ) && !( (yyvsp
[(1) - (3)].value
) && (yyvsp
[(3) - (3)].value
) );
1608 /* Line 1455 of yacc.c */
1611 (yyval
.value
) = ( (yyvsp
[(1) - (3)].value
) && (yyvsp
[(3) - (3)].value
) ) || ( !(yyvsp
[(1) - (3)].value
) && !(yyvsp
[(3) - (3)].value
) );
1617 /* Line 1455 of yacc.c */
1620 (yyval
.value
) = (yyvsp
[(1) - (1)].value
);
1626 /* Line 1455 of yacc.c */
1629 (yyval
.value
) = (yyvsp
[(1) - (3)].value
) && (yyvsp
[(3) - (3)].value
);
1635 /* Line 1455 of yacc.c */
1638 (yyval
.value
) = (yyvsp
[(2) - (2)].value
) ? 0 : 1;
1644 /* Line 1455 of yacc.c */
1647 (yyval
.value
) = (yyvsp
[(1) - (1)].value
) ? 1 : 0;
1653 /* Line 1455 of yacc.c */
1656 (yyval
.value
) = ((yyvsp
[(1) - (1)].string
) && (yyvsp
[(1) - (1)].string
)[0]) ? 1 : 0;
1657 cond_free( (yyvsp
[(1) - (1)].string
) );
1663 /* Line 1455 of yacc.c */
1666 (yyval
.value
) = compare_int( (yyvsp
[(1) - (3)].value
), (yyvsp
[(2) - (3)].value
), (yyvsp
[(3) - (3)].value
) );
1672 /* Line 1455 of yacc.c */
1676 if (num_from_prop( (yyvsp
[(1) - (3)].string
), &num
))
1677 (yyval
.value
) = compare_int( num
, (yyvsp
[(2) - (3)].value
), (yyvsp
[(3) - (3)].value
) );
1679 (yyval
.value
) = ((yyvsp
[(2) - (3)].value
) == COND_NE
|| (yyvsp
[(2) - (3)].value
) == COND_INE
);
1680 cond_free( (yyvsp
[(1) - (3)].string
) );
1686 /* Line 1455 of yacc.c */
1690 if (num_from_prop( (yyvsp
[(3) - (3)].string
), &num
))
1691 (yyval
.value
) = compare_int( (yyvsp
[(1) - (3)].value
), (yyvsp
[(2) - (3)].value
), num
);
1693 (yyval
.value
) = ((yyvsp
[(2) - (3)].value
) == COND_NE
|| (yyvsp
[(2) - (3)].value
) == COND_INE
);
1694 cond_free( (yyvsp
[(3) - (3)].string
) );
1700 /* Line 1455 of yacc.c */
1703 (yyval
.value
) = compare_and_free_strings( (yyvsp
[(1) - (3)].string
), (yyvsp
[(2) - (3)].value
), (yyvsp
[(3) - (3)].string
), TRUE
);
1709 /* Line 1455 of yacc.c */
1712 (yyval
.value
) = compare_and_free_strings( (yyvsp
[(1) - (3)].string
), (yyvsp
[(2) - (3)].value
), (yyvsp
[(3) - (3)].string
), TRUE
);
1718 /* Line 1455 of yacc.c */
1721 (yyval
.value
) = compare_and_free_strings( (yyvsp
[(1) - (3)].string
), (yyvsp
[(2) - (3)].value
), (yyvsp
[(3) - (3)].string
), TRUE
);
1727 /* Line 1455 of yacc.c */
1730 (yyval
.value
) = compare_and_free_strings( (yyvsp
[(1) - (3)].string
), (yyvsp
[(2) - (3)].value
), (yyvsp
[(3) - (3)].string
), FALSE
);
1736 /* Line 1455 of yacc.c */
1740 cond_free( (yyvsp
[(1) - (3)].string
) );
1746 /* Line 1455 of yacc.c */
1750 cond_free( (yyvsp
[(3) - (3)].string
) );
1756 /* Line 1455 of yacc.c */
1759 (yyval
.value
) = (yyvsp
[(2) - (3)].value
);
1765 /* Line 1455 of yacc.c */
1767 { (yyval
.value
) = COND_EQ
; ;}
1772 /* Line 1455 of yacc.c */
1774 { (yyval
.value
) = COND_NE
; ;}
1779 /* Line 1455 of yacc.c */
1781 { (yyval
.value
) = COND_LT
; ;}
1786 /* Line 1455 of yacc.c */
1788 { (yyval
.value
) = COND_GT
; ;}
1793 /* Line 1455 of yacc.c */
1795 { (yyval
.value
) = COND_LE
; ;}
1800 /* Line 1455 of yacc.c */
1802 { (yyval
.value
) = COND_GE
; ;}
1807 /* Line 1455 of yacc.c */
1809 { (yyval
.value
) = COND_SS
; ;}
1814 /* Line 1455 of yacc.c */
1816 { (yyval
.value
) = COND_IEQ
; ;}
1821 /* Line 1455 of yacc.c */
1823 { (yyval
.value
) = COND_INE
; ;}
1828 /* Line 1455 of yacc.c */
1830 { (yyval
.value
) = COND_ILT
; ;}
1835 /* Line 1455 of yacc.c */
1837 { (yyval
.value
) = COND_IGT
; ;}
1842 /* Line 1455 of yacc.c */
1844 { (yyval
.value
) = COND_ILE
; ;}
1849 /* Line 1455 of yacc.c */
1851 { (yyval
.value
) = COND_IGE
; ;}
1856 /* Line 1455 of yacc.c */
1858 { (yyval
.value
) = COND_ISS
; ;}
1863 /* Line 1455 of yacc.c */
1865 { (yyval
.value
) = COND_LHS
; ;}
1870 /* Line 1455 of yacc.c */
1872 { (yyval
.value
) = COND_RHS
; ;}
1877 /* Line 1455 of yacc.c */
1879 { (yyval
.value
) = COND_ILHS
; ;}
1884 /* Line 1455 of yacc.c */
1886 { (yyval
.value
) = COND_IRHS
; ;}
1891 /* Line 1455 of yacc.c */
1894 (yyval
.string
) = (yyvsp
[(1) - (1)].string
);
1900 /* Line 1455 of yacc.c */
1903 (yyval
.string
) = (yyvsp
[(1) - (1)].string
);
1909 /* Line 1455 of yacc.c */
1912 COND_input
* cond
= (COND_input
*) info
;
1913 (yyval
.string
) = COND_GetLiteral( cond
, &(yyvsp
[(1) - (1)].str
) );
1914 if( !(yyval
.string
) )
1921 /* Line 1455 of yacc.c */
1924 (yyval
.value
) = (yyvsp
[(1) - (1)].value
);
1930 /* Line 1455 of yacc.c */
1933 COND_input
* cond
= (COND_input
*) info
;
1934 INSTALLSTATE install
= INSTALLSTATE_UNKNOWN
, action
= INSTALLSTATE_UNKNOWN
;
1936 MSI_GetComponentStateW(cond
->package
, (yyvsp
[(2) - (2)].string
), &install
, &action
);
1937 (yyval
.value
) = action
;
1938 cond_free( (yyvsp
[(2) - (2)].string
) );
1944 /* Line 1455 of yacc.c */
1947 COND_input
* cond
= (COND_input
*) info
;
1948 INSTALLSTATE install
= INSTALLSTATE_UNKNOWN
, action
= INSTALLSTATE_UNKNOWN
;
1950 MSI_GetComponentStateW(cond
->package
, (yyvsp
[(2) - (2)].string
), &install
, &action
);
1951 (yyval
.value
) = install
;
1952 cond_free( (yyvsp
[(2) - (2)].string
) );
1958 /* Line 1455 of yacc.c */
1961 COND_input
* cond
= (COND_input
*) info
;
1962 INSTALLSTATE install
= INSTALLSTATE_UNKNOWN
, action
= INSTALLSTATE_UNKNOWN
;
1964 MSI_GetFeatureStateW(cond
->package
, (yyvsp
[(2) - (2)].string
), &install
, &action
);
1965 if (action
== INSTALLSTATE_UNKNOWN
)
1966 (yyval
.value
) = MSICONDITION_FALSE
;
1968 (yyval
.value
) = action
;
1970 cond_free( (yyvsp
[(2) - (2)].string
) );
1976 /* Line 1455 of yacc.c */
1979 COND_input
* cond
= (COND_input
*) info
;
1980 INSTALLSTATE install
= INSTALLSTATE_UNKNOWN
, action
= INSTALLSTATE_UNKNOWN
;
1982 MSI_GetFeatureStateW(cond
->package
, (yyvsp
[(2) - (2)].string
), &install
, &action
);
1983 (yyval
.value
) = install
;
1984 cond_free( (yyvsp
[(2) - (2)].string
) );
1990 /* Line 1455 of yacc.c */
1993 COND_input
* cond
= (COND_input
*) info
;
1996 (yyval
.string
) = msi_dup_property( cond
->package
->db
, (yyvsp
[(1) - (1)].string
) );
1999 len
= (lstrlenW((yyval
.string
)) + 1) * sizeof (WCHAR
);
2000 (yyval
.string
) = cond_track_mem( cond
, (yyval
.string
), len
);
2002 cond_free( (yyvsp
[(1) - (1)].string
) );
2008 /* Line 1455 of yacc.c */
2011 COND_input
* cond
= (COND_input
*) info
;
2012 UINT len
= GetEnvironmentVariableW( (yyvsp
[(2) - (2)].string
), NULL
, 0 );
2013 (yyval
.string
) = NULL
;
2016 (yyval
.string
) = cond_alloc( cond
, len
*sizeof (WCHAR
) );
2017 if( !(yyval
.string
) )
2019 GetEnvironmentVariableW( (yyvsp
[(2) - (2)].string
), (yyval
.string
), len
);
2021 cond_free( (yyvsp
[(2) - (2)].string
) );
2027 /* Line 1455 of yacc.c */
2030 COND_input
* cond
= (COND_input
*) info
;
2031 (yyval
.string
) = COND_GetString( cond
, &(yyvsp
[(1) - (1)].str
) );
2032 if( !(yyval
.string
) )
2039 /* Line 1455 of yacc.c */
2042 COND_input
* cond
= (COND_input
*) info
;
2043 LPWSTR szNum
= COND_GetString( cond
, &(yyvsp
[(1) - (1)].str
) );
2046 (yyval
.value
) = atoiW( szNum
);
2053 /* Line 1455 of yacc.c */
2054 #line 2051 "cond.tab.c"
2057 YY_SYMBOL_PRINT ("-> $$ =", yyr1
[yyn
], &yyval
, &yyloc
);
2061 YY_STACK_PRINT (yyss
, yyssp
);
2065 /* Now `shift' the result of the reduction. Determine what state
2066 that goes to, based on the state we popped back to and the rule
2067 number reduced by. */
2071 yystate
= yypgoto
[yyn
- YYNTOKENS
] + *yyssp
;
2072 if (0 <= yystate
&& yystate
<= YYLAST
&& yycheck
[yystate
] == *yyssp
)
2073 yystate
= yytable
[yystate
];
2075 yystate
= yydefgoto
[yyn
- YYNTOKENS
];
2080 /*------------------------------------.
2081 | yyerrlab -- here on detecting error |
2082 `------------------------------------*/
2084 /* If not already recovering from an error, report this error. */
2088 #if ! YYERROR_VERBOSE
2089 yyerror (YY_("syntax error"));
2092 YYSIZE_T yysize
= yysyntax_error (0, yystate
, yychar
);
2093 if (yymsg_alloc
< yysize
&& yymsg_alloc
< YYSTACK_ALLOC_MAXIMUM
)
2095 YYSIZE_T yyalloc
= 2 * yysize
;
2096 if (! (yysize
<= yyalloc
&& yyalloc
<= YYSTACK_ALLOC_MAXIMUM
))
2097 yyalloc
= YYSTACK_ALLOC_MAXIMUM
;
2098 if (yymsg
!= yymsgbuf
)
2099 YYSTACK_FREE (yymsg
);
2100 yymsg
= (char *) YYSTACK_ALLOC (yyalloc
);
2102 yymsg_alloc
= yyalloc
;
2106 yymsg_alloc
= sizeof yymsgbuf
;
2110 if (0 < yysize
&& yysize
<= yymsg_alloc
)
2112 (void) yysyntax_error (yymsg
, yystate
, yychar
);
2117 yyerror (YY_("syntax error"));
2119 goto yyexhaustedlab
;
2127 if (yyerrstatus
== 3)
2129 /* If just tried and failed to reuse lookahead token after an
2130 error, discard it. */
2132 if (yychar
<= YYEOF
)
2134 /* Return failure if at end of input. */
2135 if (yychar
== YYEOF
)
2140 yydestruct ("Error: discarding",
2146 /* Else will try to reuse lookahead token after shifting the error
2151 /*---------------------------------------------------.
2152 | yyerrorlab -- error raised explicitly by YYERROR. |
2153 `---------------------------------------------------*/
2156 /* Pacify compilers like GCC when the user code never invokes
2157 YYERROR and the label yyerrorlab therefore never appears in user
2159 if (/*CONSTCOND*/ 0)
2162 /* Do not reclaim the symbols of the rule which action triggered
2166 YY_STACK_PRINT (yyss
, yyssp
);
2171 /*-------------------------------------------------------------.
2172 | yyerrlab1 -- common code for both syntax error and YYERROR. |
2173 `-------------------------------------------------------------*/
2175 yyerrstatus
= 3; /* Each real token shifted decrements this. */
2179 yyn
= yypact
[yystate
];
2180 if (yyn
!= YYPACT_NINF
)
2183 if (0 <= yyn
&& yyn
<= YYLAST
&& yycheck
[yyn
] == YYTERROR
)
2191 /* Pop the current state because it cannot handle the error token. */
2196 yydestruct ("Error: popping",
2197 yystos
[yystate
], yyvsp
);
2200 YY_STACK_PRINT (yyss
, yyssp
);
2206 /* Shift the error token. */
2207 YY_SYMBOL_PRINT ("Shifting", yystos
[yyn
], yyvsp
, yylsp
);
2213 /*-------------------------------------.
2214 | yyacceptlab -- YYACCEPT comes here. |
2215 `-------------------------------------*/
2220 /*-----------------------------------.
2221 | yyabortlab -- YYABORT comes here. |
2222 `-----------------------------------*/
2227 #if !defined(yyoverflow) || YYERROR_VERBOSE
2228 /*-------------------------------------------------.
2229 | yyexhaustedlab -- memory exhaustion comes here. |
2230 `-------------------------------------------------*/
2232 yyerror (YY_("memory exhausted"));
2238 if (yychar
!= YYEMPTY
)
2239 yydestruct ("Cleanup: discarding lookahead",
2241 /* Do not reclaim the symbols of the rule which action triggered
2242 this YYABORT or YYACCEPT. */
2244 YY_STACK_PRINT (yyss
, yyssp
);
2245 while (yyssp
!= yyss
)
2247 yydestruct ("Cleanup: popping",
2248 yystos
[*yyssp
], yyvsp
);
2253 YYSTACK_FREE (yyss
);
2256 if (yymsg
!= yymsgbuf
)
2257 YYSTACK_FREE (yymsg
);
2259 /* Make sure YYID is used. */
2260 return YYID (yyresult
);
2265 /* Line 1675 of yacc.c */
2270 static int COND_IsAlpha( WCHAR x
)
2272 return( ( ( x
>= 'A' ) && ( x
<= 'Z' ) ) ||
2273 ( ( x
>= 'a' ) && ( x
<= 'z' ) ) ||
2277 static int COND_IsNumber( WCHAR x
)
2279 return( (( x
>= '0' ) && ( x
<= '9' )) || (x
=='-') || (x
=='.') );
2282 static WCHAR
*strstriW( const WCHAR
*str
, const WCHAR
*sub
)
2284 LPWSTR strlower
, sublower
, r
;
2285 strlower
= CharLowerW( strdupW( str
) );
2286 sublower
= CharLowerW( strdupW( sub
) );
2287 r
= strstrW( strlower
, sublower
);
2289 r
= (LPWSTR
)str
+ (r
- strlower
);
2290 msi_free( strlower
);
2291 msi_free( sublower
);
2295 static BOOL
str_is_number( LPCWSTR str
)
2302 for (i
= 0; i
< lstrlenW( str
); i
++)
2303 if (!isdigitW(str
[i
]))
2309 static INT
compare_substring( LPCWSTR a
, INT
operator, LPCWSTR b
)
2313 /* substring operators return 0 if LHS is missing */
2317 /* substring operators return 1 if RHS is missing */
2321 /* if both strings contain only numbers, use integer comparison */
2324 if (str_is_number(a
) && str_is_number(b
))
2325 return compare_int( lhs
, operator, rhs
);
2330 return strstrW( a
, b
) != 0;
2332 return strstriW( a
, b
) != 0;
2335 int l
= strlenW( a
);
2336 int r
= strlenW( b
);
2337 if (r
> l
) return 0;
2338 return !strncmpW( a
, b
, r
);
2342 int l
= strlenW( a
);
2343 int r
= strlenW( b
);
2344 if (r
> l
) return 0;
2345 return !strncmpW( a
+ (l
- r
), b
, r
);
2349 int l
= strlenW( a
);
2350 int r
= strlenW( b
);
2351 if (r
> l
) return 0;
2352 return !strncmpiW( a
, b
, r
);
2356 int l
= strlenW( a
);
2357 int r
= strlenW( b
);
2358 if (r
> l
) return 0;
2359 return !strncmpiW( a
+ (l
- r
), b
, r
);
2362 ERR("invalid substring operator\n");
2368 static INT
compare_string( LPCWSTR a
, INT
operator, LPCWSTR b
, BOOL convert
)
2370 if (operator >= COND_SS
&& operator <= COND_RHS
)
2371 return compare_substring( a
, operator, b
);
2373 /* null and empty string are equivalent */
2374 if (!a
) a
= szEmpty
;
2375 if (!b
) b
= szEmpty
;
2377 if (convert
&& str_is_number(a
) && str_is_number(b
))
2378 return compare_int( atoiW(a
), operator, atoiW(b
) );
2380 /* a or b may be NULL */
2384 return strcmpW( a
, b
) < 0;
2386 return strcmpW( a
, b
) > 0;
2388 return strcmpW( a
, b
) == 0;
2390 return strcmpW( a
, b
) != 0;
2392 return strcmpW( a
, b
) >= 0;
2394 return strcmpW( a
, b
) <= 0;
2396 return strcmpiW( a
, b
) < 0;
2398 return strcmpiW( a
, b
) > 0;
2400 return strcmpiW( a
, b
) == 0;
2402 return strcmpiW( a
, b
) != 0;
2404 return strcmpiW( a
, b
) >= 0;
2406 return strcmpiW( a
, b
) <= 0;
2408 ERR("invalid string operator\n");
2415 static INT
compare_int( INT a
, INT
operator, INT b
)
2439 return ( a
& b
) ? 1 : 0;
2441 return ( ( a
& 0xffff ) == b
) ? 1 : 0;
2443 return ( ( (a
>>16) & 0xffff ) == b
) ? 1 : 0;
2445 ERR("invalid integer operator\n");
2452 static int COND_IsIdent( WCHAR x
)
2454 return( COND_IsAlpha( x
) || COND_IsNumber( x
) || ( x
== '_' )
2455 || ( x
== '#' ) || (x
== '.') );
2458 static int COND_GetOperator( COND_input
*cond
)
2460 static const struct {
2464 { {'~','<','=',0}, COND_ILE
},
2465 { {'~','>','<',0}, COND_ISS
},
2466 { {'~','>','>',0}, COND_IRHS
},
2467 { {'~','<','>',0}, COND_INE
},
2468 { {'~','>','=',0}, COND_IGE
},
2469 { {'~','<','<',0}, COND_ILHS
},
2470 { {'~','=',0}, COND_IEQ
},
2471 { {'~','<',0}, COND_ILT
},
2472 { {'~','>',0}, COND_IGT
},
2473 { {'>','=',0}, COND_GE
},
2474 { {'>','<',0}, COND_SS
},
2475 { {'<','<',0}, COND_LHS
},
2476 { {'<','>',0}, COND_NE
},
2477 { {'<','=',0}, COND_LE
},
2478 { {'>','>',0}, COND_RHS
},
2479 { {'>',0}, COND_GT
},
2480 { {'<',0}, COND_LT
},
2483 LPCWSTR p
= &cond
->str
[cond
->n
];
2488 len
= lstrlenW( table
[i
].str
);
2489 if ( !len
|| 0 == strncmpW( table
[i
].str
, p
, len
) )
2497 static int COND_GetOne( struct cond_str
*str
, COND_input
*cond
)
2502 str
->data
= &cond
->str
[cond
->n
];
2509 case '(': rc
= COND_LPAR
; break;
2510 case ')': rc
= COND_RPAR
; break;
2511 case '&': rc
= COND_AMPER
; break;
2512 case '!': rc
= COND_EXCLAM
; break;
2513 case '$': rc
= COND_DOLLARS
; break;
2514 case '?': rc
= COND_QUESTION
; break;
2515 case '%': rc
= COND_PERCENT
; break;
2516 case ' ': rc
= COND_SPACE
; break;
2517 case '=': rc
= COND_EQ
; break;
2522 rc
= COND_GetOperator( cond
);
2538 LPCWSTR p
= strchrW( str
->data
+ 1, '"' );
2539 if (!p
) return COND_ERROR
;
2540 len
= p
- str
->data
+ 1;
2543 else if( COND_IsAlpha( ch
) )
2545 static const WCHAR szNot
[] = {'N','O','T',0};
2546 static const WCHAR szAnd
[] = {'A','N','D',0};
2547 static const WCHAR szXor
[] = {'X','O','R',0};
2548 static const WCHAR szEqv
[] = {'E','Q','V',0};
2549 static const WCHAR szImp
[] = {'I','M','P',0};
2550 static const WCHAR szOr
[] = {'O','R',0};
2552 while( COND_IsIdent( str
->data
[len
] ) )
2558 if ( !strncmpiW( str
->data
, szNot
, len
) )
2560 else if( !strncmpiW( str
->data
, szAnd
, len
) )
2562 else if( !strncmpiW( str
->data
, szXor
, len
) )
2564 else if( !strncmpiW( str
->data
, szEqv
, len
) )
2566 else if( !strncmpiW( str
->data
, szImp
, len
) )
2569 else if( (len
== 2) && !strncmpiW( str
->data
, szOr
, len
) )
2572 else if( COND_IsNumber( ch
) )
2574 while( COND_IsNumber( str
->data
[len
] ) )
2580 ERR("Got unknown character %c(%x)\n",ch
,ch
);
2590 static int cond_lex( void *COND_lval
, COND_input
*cond
)
2593 struct cond_str
*str
= COND_lval
;
2596 rc
= COND_GetOne( str
, cond
);
2597 } while (rc
== COND_SPACE
);
2602 static LPWSTR
COND_GetString( COND_input
*cond
, const struct cond_str
*str
)
2606 ret
= cond_alloc( cond
, (str
->len
+1) * sizeof (WCHAR
) );
2609 memcpy( ret
, str
->data
, str
->len
* sizeof(WCHAR
));
2612 TRACE("Got identifier %s\n",debugstr_w(ret
));
2616 static LPWSTR
COND_GetLiteral( COND_input
*cond
, const struct cond_str
*str
)
2620 ret
= cond_alloc( cond
, (str
->len
-1) * sizeof (WCHAR
) );
2623 memcpy( ret
, str
->data
+1, (str
->len
-2) * sizeof(WCHAR
) );
2624 ret
[str
->len
- 2]=0;
2626 TRACE("Got literal %s\n",debugstr_w(ret
));
2630 static void *cond_alloc( COND_input
*cond
, unsigned int sz
)
2634 mem
= msi_alloc( sizeof (struct list
) + sz
);
2638 list_add_head( &(cond
->mem
), mem
);
2642 static void *cond_track_mem( COND_input
*cond
, void *ptr
, unsigned int sz
)
2649 new_ptr
= cond_alloc( cond
, sz
);
2656 memcpy( new_ptr
, ptr
, sz
);
2661 static void cond_free( void *ptr
)
2663 struct list
*mem
= (struct list
*)ptr
- 1;
2672 static int cond_error(const char *str
)
2674 TRACE("%s\n", str
);
2678 MSICONDITION
MSI_EvaluateConditionW( MSIPACKAGE
*package
, LPCWSTR szCondition
)
2682 struct list
*mem
, *safety
;
2684 TRACE("%s\n", debugstr_w( szCondition
) );
2686 if (szCondition
== NULL
) return MSICONDITION_NONE
;
2688 cond
.package
= package
;
2689 cond
.str
= szCondition
;
2691 cond
.result
= MSICONDITION_ERROR
;
2693 list_init( &cond
.mem
);
2695 if ( !cond_parse( &cond
) )
2698 r
= MSICONDITION_ERROR
;
2700 LIST_FOR_EACH_SAFE( mem
, safety
, &cond
.mem
)
2702 /* The tracked memory lives directly after the list struct */
2703 void *ptr
= mem
+ 1;
2704 if ( r
!= MSICONDITION_ERROR
)
2705 WARN( "condition parser failed to free up some memory: %p\n", ptr
);
2709 TRACE("%i <- %s\n", r
, debugstr_w(szCondition
));
2713 MSICONDITION WINAPI
MsiEvaluateConditionW( MSIHANDLE hInstall
, LPCWSTR szCondition
)
2715 MSIPACKAGE
*package
;
2718 package
= msihandle2msiinfo( hInstall
, MSIHANDLETYPE_PACKAGE
);
2723 IWineMsiRemotePackage
*remote_package
;
2725 remote_package
= (IWineMsiRemotePackage
*)msi_get_remote( hInstall
);
2726 if (!remote_package
)
2727 return MSICONDITION_ERROR
;
2729 condition
= SysAllocString( szCondition
);
2732 IWineMsiRemotePackage_Release( remote_package
);
2733 return ERROR_OUTOFMEMORY
;
2736 hr
= IWineMsiRemotePackage_EvaluateCondition( remote_package
, condition
);
2738 SysFreeString( condition
);
2739 IWineMsiRemotePackage_Release( remote_package
);
2743 if (HRESULT_FACILITY(hr
) == FACILITY_WIN32
)
2744 return HRESULT_CODE(hr
);
2746 return ERROR_FUNCTION_FAILED
;
2749 return ERROR_SUCCESS
;
2752 ret
= MSI_EvaluateConditionW( package
, szCondition
);
2753 msiobj_release( &package
->hdr
);
2757 MSICONDITION WINAPI
MsiEvaluateConditionA( MSIHANDLE hInstall
, LPCSTR szCondition
)
2759 LPWSTR szwCond
= NULL
;
2762 szwCond
= strdupAtoW( szCondition
);
2763 if( szCondition
&& !szwCond
)
2764 return MSICONDITION_ERROR
;
2766 r
= MsiEvaluateConditionW( hInstall
, szwCond
);
2767 msi_free( szwCond
);