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
114 #include "msiquery.h"
119 #include "msiserver.h"
120 #include "wine/debug.h"
121 #include "wine/unicode.h"
123 #define YYLEX_PARAM info
124 #define YYPARSE_PARAM info
126 static int cond_error(const char *str
);
128 WINE_DEFAULT_DEBUG_CHANNEL(msi
);
130 typedef struct tag_yyinput
143 static LPWSTR
COND_GetString( const struct cond_str
*str
);
144 static LPWSTR
COND_GetLiteral( const struct cond_str
*str
);
145 static int cond_lex( void *COND_lval
, COND_input
*info
);
147 static INT
compare_int( INT a
, INT
operator, INT b
);
148 static INT
compare_string( LPCWSTR a
, INT
operator, LPCWSTR b
, BOOL convert
);
150 static INT
compare_and_free_strings( LPWSTR a
, INT op
, LPWSTR b
, BOOL convert
)
154 r
= compare_string( a
, op
, b
, convert
);
160 static BOOL
num_from_prop( LPCWSTR p
, INT
*val
)
162 INT ret
= 0, sign
= 1;
175 if( *p
< '0' || *p
> '9' )
177 ret
= ret
*10 + (*p
- '0');
186 /* Line 189 of yacc.c */
187 #line 188 "cond.tab.c"
189 /* Enabling traces. */
194 /* Enabling verbose error messages. */
195 #ifdef YYERROR_VERBOSE
196 # undef YYERROR_VERBOSE
197 # define YYERROR_VERBOSE 1
199 # define YYERROR_VERBOSE 0
202 /* Enabling the token table. */
203 #ifndef YYTOKEN_TABLE
204 # define YYTOKEN_TABLE 0
211 /* Put the tokens into the symbol table, so that GDB and other debuggers
257 #if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED
258 typedef union YYSTYPE
261 /* Line 214 of yacc.c */
270 /* Line 214 of yacc.c */
271 #line 272 "cond.tab.c"
273 # define YYSTYPE_IS_TRIVIAL 1
274 # define yystype YYSTYPE /* obsolescent; will be withdrawn */
275 # define YYSTYPE_IS_DECLARED 1
279 /* Copy the second part of user declarations. */
282 /* Line 264 of yacc.c */
283 #line 284 "cond.tab.c"
290 typedef YYTYPE_UINT8 yytype_uint8
;
292 typedef unsigned char yytype_uint8
;
296 typedef YYTYPE_INT8 yytype_int8
;
297 #elif (defined __STDC__ || defined __C99__FUNC__ \
298 || defined __cplusplus || defined _MSC_VER)
299 typedef signed char yytype_int8
;
301 typedef short int yytype_int8
;
305 typedef YYTYPE_UINT16 yytype_uint16
;
307 typedef unsigned short int yytype_uint16
;
311 typedef YYTYPE_INT16 yytype_int16
;
313 typedef short int yytype_int16
;
317 # ifdef __SIZE_TYPE__
318 # define YYSIZE_T __SIZE_TYPE__
319 # elif defined size_t
320 # define YYSIZE_T size_t
321 # elif ! defined YYSIZE_T && (defined __STDC__ || defined __C99__FUNC__ \
322 || defined __cplusplus || defined _MSC_VER)
323 # include <stddef.h> /* INFRINGES ON USER NAME SPACE */
324 # define YYSIZE_T size_t
326 # define YYSIZE_T unsigned int
330 #define YYSIZE_MAXIMUM ((YYSIZE_T) -1)
335 # include <libintl.h> /* INFRINGES ON USER NAME SPACE */
336 # define YY_(msgid) dgettext ("bison-runtime", msgid)
340 # define YY_(msgid) msgid
344 /* Suppress unused-variable warnings by "using" E. */
345 #if ! defined lint || defined __GNUC__
346 # define YYUSE(e) ((void) (e))
348 # define YYUSE(e) /* empty */
351 /* Identity function, used to suppress warnings about constant conditions. */
355 #if (defined __STDC__ || defined __C99__FUNC__ \
356 || defined __cplusplus || defined _MSC_VER)
369 #if ! defined yyoverflow || YYERROR_VERBOSE
371 /* The parser invokes alloca or malloc; define the necessary symbols. */
373 # ifdef YYSTACK_USE_ALLOCA
374 # if YYSTACK_USE_ALLOCA
376 # define YYSTACK_ALLOC __builtin_alloca
377 # elif defined __BUILTIN_VA_ARG_INCR
378 # include <alloca.h> /* INFRINGES ON USER NAME SPACE */
380 # define YYSTACK_ALLOC __alloca
381 # elif defined _MSC_VER
382 # include <malloc.h> /* INFRINGES ON USER NAME SPACE */
383 # define alloca _alloca
385 # define YYSTACK_ALLOC alloca
386 # if ! defined _ALLOCA_H && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \
387 || defined __cplusplus || defined _MSC_VER)
388 # include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
397 # ifdef YYSTACK_ALLOC
398 /* Pacify GCC's `empty if-body' warning. */
399 # define YYSTACK_FREE(Ptr) do { /* empty */; } while (YYID (0))
400 # ifndef YYSTACK_ALLOC_MAXIMUM
401 /* The OS might guarantee only one guard page at the bottom of the stack,
402 and a page size can be as small as 4096 bytes. So we cannot safely
403 invoke alloca (N) if N exceeds 4096. Use a slightly smaller number
404 to allow for a few compiler-allocated temporary stack slots. */
405 # define YYSTACK_ALLOC_MAXIMUM 4032 /* reasonable circa 2006 */
408 # define YYSTACK_ALLOC YYMALLOC
409 # define YYSTACK_FREE YYFREE
410 # ifndef YYSTACK_ALLOC_MAXIMUM
411 # define YYSTACK_ALLOC_MAXIMUM YYSIZE_MAXIMUM
413 # if (defined __cplusplus && ! defined _STDLIB_H \
414 && ! ((defined YYMALLOC || defined malloc) \
415 && (defined YYFREE || defined free)))
416 # include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
422 # define YYMALLOC malloc
423 # if ! defined malloc && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \
424 || defined __cplusplus || defined _MSC_VER)
425 void *malloc (YYSIZE_T
); /* INFRINGES ON USER NAME SPACE */
430 # if ! defined free && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \
431 || defined __cplusplus || defined _MSC_VER)
432 void free (void *); /* INFRINGES ON USER NAME SPACE */
436 #endif /* ! defined yyoverflow || YYERROR_VERBOSE */
439 #if (! defined yyoverflow \
440 && (! defined __cplusplus \
441 || (defined YYSTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL)))
443 /* A type that is properly aligned for any stack member. */
446 yytype_int16 yyss_alloc
;
450 /* The size of the maximum gap between one aligned stack and the next. */
451 # define YYSTACK_GAP_MAXIMUM (sizeof (union yyalloc) - 1)
453 /* The size of an array large to enough to hold all stacks, each with
455 # define YYSTACK_BYTES(N) \
456 ((N) * (sizeof (yytype_int16) + sizeof (YYSTYPE)) \
457 + YYSTACK_GAP_MAXIMUM)
459 /* Copy COUNT objects from FROM to TO. The source and destination do
462 # if defined __GNUC__ && 1 < __GNUC__
463 # define YYCOPY(To, From, Count) \
464 __builtin_memcpy (To, From, (Count) * sizeof (*(From)))
466 # define YYCOPY(To, From, Count) \
470 for (yyi = 0; yyi < (Count); yyi++) \
471 (To)[yyi] = (From)[yyi]; \
477 /* Relocate STACK from its old location to the new one. The
478 local variables YYSIZE and YYSTACKSIZE give the old and new number of
479 elements in the stack, and YYPTR gives the new location of the
480 stack. Advance YYPTR to a properly aligned location for the next
482 # define YYSTACK_RELOCATE(Stack_alloc, Stack) \
485 YYSIZE_T yynewbytes; \
486 YYCOPY (&yyptr->Stack_alloc, Stack, yysize); \
487 Stack = &yyptr->Stack_alloc; \
488 yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \
489 yyptr += yynewbytes / sizeof (*yyptr); \
495 /* YYFINAL -- State number of the termination state. */
497 /* YYLAST -- Last index in YYTABLE. */
500 /* YYNTOKENS -- Number of terminals. */
502 /* YYNNTS -- Number of nonterminals. */
504 /* YYNRULES -- Number of rules. */
506 /* YYNRULES -- Number of states. */
509 /* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */
511 #define YYMAXUTOK 295
513 #define YYTRANSLATE(YYX) \
514 ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK)
516 /* YYTRANSLATE[YYLEX] -- Bison symbol number corresponding to YYLEX. */
517 static const yytype_uint8 yytranslate
[] =
519 0, 2, 2, 2, 2, 2, 2, 2, 2, 2,
520 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
521 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
522 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
523 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
524 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
525 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
526 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
527 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
528 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
529 2, 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, 1, 2, 3, 4,
545 5, 6, 7, 8, 9, 10, 11, 12, 13, 14,
546 15, 16, 17, 18, 19, 20, 21, 22, 23, 24,
547 25, 26, 27, 28, 29, 30, 31, 32, 33, 34,
548 35, 36, 37, 38, 39, 40
552 /* YYPRHS[YYN] -- Index of the first RHS symbol of rule number YYN in
554 static const yytype_uint8 yyprhs
[] =
556 0, 0, 3, 5, 6, 8, 12, 16, 20, 24,
557 26, 30, 33, 35, 37, 41, 45, 49, 53, 57,
558 61, 65, 69, 73, 77, 79, 81, 83, 85, 87,
559 89, 91, 93, 95, 97, 99, 101, 103, 105, 107,
560 109, 111, 113, 115, 117, 119, 121, 124, 127, 130,
564 /* YYRHS -- A `-1'-separated list of the rules' RHS. */
565 static const yytype_int8 yyrhs
[] =
567 42, 0, -1, 43, -1, -1, 44, -1, 43, 5,
568 44, -1, 43, 9, 44, -1, 43, 8, 44, -1,
569 43, 10, 44, -1, 45, -1, 44, 6, 45, -1,
570 7, 45, -1, 49, -1, 47, -1, 49, 46, 49,
571 -1, 50, 46, 49, -1, 49, 46, 50, -1, 50,
572 46, 50, -1, 50, 46, 48, -1, 48, 46, 50,
573 -1, 48, 46, 48, -1, 48, 46, 49, -1, 49,
574 46, 48, -1, 23, 43, 24, -1, 13, -1, 14,
575 -1, 11, -1, 12, -1, 16, -1, 15, -1, 26,
576 -1, 19, -1, 20, -1, 17, -1, 18, -1, 22,
577 -1, 21, -1, 27, -1, 30, -1, 31, -1, 28,
578 -1, 29, -1, 50, -1, 48, -1, 39, -1, 52,
579 -1, 33, 51, -1, 34, 51, -1, 35, 51, -1,
580 36, 51, -1, 51, -1, 32, 51, -1, 37, -1,
584 /* YYRLINE[YYN] -- source line where rule number YYN was defined. */
585 static const yytype_uint16 yyrline
[] =
587 0, 134, 134, 140, 147, 151, 155, 159, 163, 170,
588 174, 181, 185, 189, 194, 198, 207, 216, 220, 224,
589 228, 232, 237, 242, 250, 251, 252, 253, 254, 255,
590 256, 257, 258, 259, 260, 261, 262, 263, 264, 265,
591 266, 267, 271, 275, 282, 291, 295, 304, 313, 326,
596 #if YYDEBUG || YYERROR_VERBOSE || YYTOKEN_TABLE
597 /* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM.
598 First, the terminals, then, starting at YYNTOKENS, nonterminals. */
599 static const char *const yytname
[] =
601 "$end", "error", "$undefined", "COND_SPACE", "COND_EOF", "COND_OR",
602 "COND_AND", "COND_NOT", "COND_XOR", "COND_IMP", "COND_EQV", "COND_LT",
603 "COND_GT", "COND_EQ", "COND_NE", "COND_GE", "COND_LE", "COND_ILT",
604 "COND_IGT", "COND_IEQ", "COND_INE", "COND_IGE", "COND_ILE", "COND_LPAR",
605 "COND_RPAR", "COND_TILDA", "COND_SS", "COND_ISS", "COND_ILHS",
606 "COND_IRHS", "COND_LHS", "COND_RHS", "COND_PERCENT", "COND_DOLLARS",
607 "COND_QUESTION", "COND_AMPER", "COND_EXCLAM", "COND_IDENT",
608 "COND_NUMBER", "COND_LITER", "COND_ERROR", "$accept", "condition",
609 "expression", "boolean_term", "boolean_factor", "operator", "value_s",
610 "literal", "value_i", "symbol_s", "identifier", "integer", 0
615 /* YYTOKNUM[YYLEX-NUM] -- Internal token number corresponding to
617 static const yytype_uint16 yytoknum
[] =
619 0, 256, 257, 258, 259, 260, 261, 262, 263, 264,
620 265, 266, 267, 268, 269, 270, 271, 272, 273, 274,
621 275, 276, 277, 278, 279, 280, 281, 282, 283, 284,
622 285, 286, 287, 288, 289, 290, 291, 292, 293, 294,
627 /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */
628 static const yytype_uint8 yyr1
[] =
630 0, 41, 42, 42, 43, 43, 43, 43, 43, 44,
631 44, 45, 45, 45, 45, 45, 45, 45, 45, 45,
632 45, 45, 45, 45, 46, 46, 46, 46, 46, 46,
633 46, 46, 46, 46, 46, 46, 46, 46, 46, 46,
634 46, 46, 47, 47, 48, 49, 49, 49, 49, 49,
638 /* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */
639 static const yytype_uint8 yyr2
[] =
641 0, 2, 1, 0, 1, 3, 3, 3, 3, 1,
642 3, 2, 1, 1, 3, 3, 3, 3, 3, 3,
643 3, 3, 3, 3, 1, 1, 1, 1, 1, 1,
644 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
645 1, 1, 1, 1, 1, 1, 2, 2, 2, 2,
649 /* YYDEFACT[STATE-NAME] -- Default rule to reduce with in state
650 STATE-NUM when YYTABLE doesn't specify something else to do. Zero
651 means the default is an error. */
652 static const yytype_uint8 yydefact
[] =
654 3, 0, 0, 0, 0, 0, 0, 0, 52, 53,
655 44, 0, 2, 4, 9, 13, 43, 12, 42, 50,
656 45, 11, 0, 51, 46, 47, 48, 49, 1, 0,
657 0, 0, 0, 0, 26, 27, 24, 25, 29, 28,
658 33, 34, 31, 32, 36, 35, 30, 37, 40, 41,
659 38, 39, 0, 0, 0, 23, 5, 7, 6, 8,
660 10, 20, 21, 19, 22, 14, 16, 18, 15, 17
663 /* YYDEFGOTO[NTERM-NUM]. */
664 static const yytype_int8 yydefgoto
[] =
666 -1, 11, 12, 13, 14, 52, 15, 16, 17, 18,
670 /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
672 #define YYPACT_NINF -15
673 static const yytype_int8 yypact
[] =
675 -7, -7, -7, -14, -14, -14, -14, -14, -15, -15,
676 -15, 24, 46, 30, -15, -15, -9, -9, -9, -15,
677 -15, -15, 29, -15, -15, -15, -15, -15, -15, -7,
678 -7, -7, -7, -7, -15, -15, -15, -15, -15, -15,
679 -15, -15, -15, -15, -15, -15, -15, -15, -15, -15,
680 -15, -15, 8, 8, 8, -15, 30, 30, 30, 30,
681 -15, -15, -15, -15, -15, -15, -15, -15, -15, -15
684 /* YYPGOTO[NTERM-NUM]. */
685 static const yytype_int8 yypgoto
[] =
687 -15, -15, 50, 33, 0, -3, -15, -4, 14, 17,
691 /* YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If
692 positive, shift that token. If negative, reduce the rule which
693 number is the opposite. If zero, do what YYDEFACT says.
694 If YYTABLE_NINF, syntax error. */
695 #define YYTABLE_NINF -1
696 static const yytype_uint8 yytable
[] =
698 1, 21, 34, 35, 36, 37, 38, 39, 40, 41,
699 42, 43, 44, 45, 53, 54, 2, 46, 47, 48,
700 49, 50, 51, 8, 28, 3, 4, 5, 6, 7,
701 8, 9, 10, 60, 29, 0, 33, 30, 31, 32,
702 3, 4, 5, 6, 7, 8, 9, 10, 61, 64,
703 67, 29, 22, 55, 30, 31, 32, 23, 24, 25,
704 26, 27, 56, 57, 58, 59, 62, 65, 68, 63,
708 static const yytype_int8 yycheck
[] =
710 7, 1, 11, 12, 13, 14, 15, 16, 17, 18,
711 19, 20, 21, 22, 17, 18, 23, 26, 27, 28,
712 29, 30, 31, 37, 0, 32, 33, 34, 35, 36,
713 37, 38, 39, 33, 5, -1, 6, 8, 9, 10,
714 32, 33, 34, 35, 36, 37, 38, 39, 52, 53,
715 54, 5, 2, 24, 8, 9, 10, 3, 4, 5,
716 6, 7, 29, 30, 31, 32, 52, 53, 54, 52,
720 /* YYSTOS[STATE-NUM] -- The (internal number of the) accessing
721 symbol of state STATE-NUM. */
722 static const yytype_uint8 yystos
[] =
724 0, 7, 23, 32, 33, 34, 35, 36, 37, 38,
725 39, 42, 43, 44, 45, 47, 48, 49, 50, 51,
726 52, 45, 43, 51, 51, 51, 51, 51, 0, 5,
727 8, 9, 10, 6, 11, 12, 13, 14, 15, 16,
728 17, 18, 19, 20, 21, 22, 26, 27, 28, 29,
729 30, 31, 46, 46, 46, 24, 44, 44, 44, 44,
730 45, 48, 49, 50, 48, 49, 50, 48, 49, 50
733 #define yyerrok (yyerrstatus = 0)
734 #define yyclearin (yychar = YYEMPTY)
738 #define YYACCEPT goto yyacceptlab
739 #define YYABORT goto yyabortlab
740 #define YYERROR goto yyerrorlab
743 /* Like YYERROR except do call yyerror. This remains here temporarily
744 to ease the transition to the new meaning of YYERROR, for GCC.
745 Once GCC version 2 has supplanted version 1, this can go. */
747 #define YYFAIL goto yyerrlab
749 #define YYRECOVERING() (!!yyerrstatus)
751 #define YYBACKUP(Token, Value) \
753 if (yychar == YYEMPTY && yylen == 1) \
757 yytoken = YYTRANSLATE (yychar); \
763 yyerror (YY_("syntax error: cannot back up")); \
770 #define YYERRCODE 256
773 /* YYLLOC_DEFAULT -- Set CURRENT to span from RHS[1] to RHS[N].
774 If N is 0, then set CURRENT to the empty location which ends
775 the previous symbol: RHS[0] (always defined). */
777 #define YYRHSLOC(Rhs, K) ((Rhs)[K])
778 #ifndef YYLLOC_DEFAULT
779 # define YYLLOC_DEFAULT(Current, Rhs, N) \
783 (Current).first_line = YYRHSLOC (Rhs, 1).first_line; \
784 (Current).first_column = YYRHSLOC (Rhs, 1).first_column; \
785 (Current).last_line = YYRHSLOC (Rhs, N).last_line; \
786 (Current).last_column = YYRHSLOC (Rhs, N).last_column; \
790 (Current).first_line = (Current).last_line = \
791 YYRHSLOC (Rhs, 0).last_line; \
792 (Current).first_column = (Current).last_column = \
793 YYRHSLOC (Rhs, 0).last_column; \
799 /* YY_LOCATION_PRINT -- Print the location on the stream.
800 This macro was not mandated originally: define only if we know
801 we won't break user code: when these are the locations we know. */
803 #ifndef YY_LOCATION_PRINT
804 # if YYLTYPE_IS_TRIVIAL
805 # define YY_LOCATION_PRINT(File, Loc) \
806 fprintf (File, "%d.%d-%d.%d", \
807 (Loc).first_line, (Loc).first_column, \
808 (Loc).last_line, (Loc).last_column)
810 # define YY_LOCATION_PRINT(File, Loc) ((void) 0)
815 /* YYLEX -- calling `yylex' with the right arguments. */
818 # define YYLEX yylex (&yylval, YYLEX_PARAM)
820 # define YYLEX yylex (&yylval)
823 /* Enable debugging if requested. */
827 # include <stdio.h> /* INFRINGES ON USER NAME SPACE */
828 # define YYFPRINTF fprintf
831 # define YYDPRINTF(Args) \
837 # define YY_SYMBOL_PRINT(Title, Type, Value, Location) \
841 YYFPRINTF (stderr, "%s ", Title); \
842 yy_symbol_print (stderr, \
844 YYFPRINTF (stderr, "\n"); \
849 /*--------------------------------.
850 | Print this symbol on YYOUTPUT. |
851 `--------------------------------*/
854 #if (defined __STDC__ || defined __C99__FUNC__ \
855 || defined __cplusplus || defined _MSC_VER)
857 yy_symbol_value_print (FILE *yyoutput
, int yytype
, YYSTYPE
const * const yyvaluep
)
860 yy_symbol_value_print (yyoutput
, yytype
, yyvaluep
)
863 YYSTYPE
const * const yyvaluep
;
869 if (yytype
< YYNTOKENS
)
870 YYPRINT (yyoutput
, yytoknum
[yytype
], *yyvaluep
);
882 /*--------------------------------.
883 | Print this symbol on YYOUTPUT. |
884 `--------------------------------*/
886 #if (defined __STDC__ || defined __C99__FUNC__ \
887 || defined __cplusplus || defined _MSC_VER)
889 yy_symbol_print (FILE *yyoutput
, int yytype
, YYSTYPE
const * const yyvaluep
)
892 yy_symbol_print (yyoutput
, yytype
, yyvaluep
)
895 YYSTYPE
const * const yyvaluep
;
898 if (yytype
< YYNTOKENS
)
899 YYFPRINTF (yyoutput
, "token %s (", yytname
[yytype
]);
901 YYFPRINTF (yyoutput
, "nterm %s (", yytname
[yytype
]);
903 yy_symbol_value_print (yyoutput
, yytype
, yyvaluep
);
904 YYFPRINTF (yyoutput
, ")");
907 /*------------------------------------------------------------------.
908 | yy_stack_print -- Print the state stack from its BOTTOM up to its |
910 `------------------------------------------------------------------*/
912 #if (defined __STDC__ || defined __C99__FUNC__ \
913 || defined __cplusplus || defined _MSC_VER)
915 yy_stack_print (yytype_int16
*yybottom
, yytype_int16
*yytop
)
918 yy_stack_print (yybottom
, yytop
)
919 yytype_int16
*yybottom
;
923 YYFPRINTF (stderr
, "Stack now");
924 for (; yybottom
<= yytop
; yybottom
++)
926 int yybot
= *yybottom
;
927 YYFPRINTF (stderr
, " %d", yybot
);
929 YYFPRINTF (stderr
, "\n");
932 # define YY_STACK_PRINT(Bottom, Top) \
935 yy_stack_print ((Bottom), (Top)); \
939 /*------------------------------------------------.
940 | Report that the YYRULE is going to be reduced. |
941 `------------------------------------------------*/
943 #if (defined __STDC__ || defined __C99__FUNC__ \
944 || defined __cplusplus || defined _MSC_VER)
946 yy_reduce_print (YYSTYPE
*yyvsp
, int yyrule
)
949 yy_reduce_print (yyvsp
, yyrule
)
954 int yynrhs
= yyr2
[yyrule
];
956 unsigned long int yylno
= yyrline
[yyrule
];
957 YYFPRINTF (stderr
, "Reducing stack by rule %d (line %lu):\n",
959 /* The symbols being reduced. */
960 for (yyi
= 0; yyi
< yynrhs
; yyi
++)
962 YYFPRINTF (stderr
, " $%d = ", yyi
+ 1);
963 yy_symbol_print (stderr
, yyrhs
[yyprhs
[yyrule
] + yyi
],
964 &(yyvsp
[(yyi
+ 1) - (yynrhs
)])
966 YYFPRINTF (stderr
, "\n");
970 # define YY_REDUCE_PRINT(Rule) \
973 yy_reduce_print (yyvsp, Rule); \
976 /* Nonzero means print parse trace. It is left uninitialized so that
977 multiple parsers can coexist. */
980 # define YYDPRINTF(Args)
981 # define YY_SYMBOL_PRINT(Title, Type, Value, Location)
982 # define YY_STACK_PRINT(Bottom, Top)
983 # define YY_REDUCE_PRINT(Rule)
984 #endif /* !YYDEBUG */
987 /* YYINITDEPTH -- initial size of the parser's stacks. */
989 # define YYINITDEPTH 200
992 /* YYMAXDEPTH -- maximum size the stacks can grow to (effective only
993 if the built-in stack extension method is used).
995 Do not make this value too large; the results are undefined if
996 YYSTACK_ALLOC_MAXIMUM < YYSTACK_BYTES (YYMAXDEPTH)
997 evaluated with infinite-precision integer arithmetic. */
1000 # define YYMAXDEPTH 10000
1008 # if defined __GLIBC__ && defined _STRING_H
1009 # define yystrlen strlen
1011 /* Return the length of YYSTR. */
1012 #if (defined __STDC__ || defined __C99__FUNC__ \
1013 || defined __cplusplus || defined _MSC_VER)
1015 yystrlen (const char *yystr
)
1023 for (yylen
= 0; yystr
[yylen
]; yylen
++)
1031 # if defined __GLIBC__ && defined _STRING_H && defined _GNU_SOURCE
1032 # define yystpcpy stpcpy
1034 /* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in
1036 #if (defined __STDC__ || defined __C99__FUNC__ \
1037 || defined __cplusplus || defined _MSC_VER)
1039 yystpcpy (char *yydest
, const char *yysrc
)
1042 yystpcpy (yydest
, yysrc
)
1048 const char *yys
= yysrc
;
1050 while ((*yyd
++ = *yys
++) != '\0')
1059 /* Copy to YYRES the contents of YYSTR after stripping away unnecessary
1060 quotes and backslashes, so that it's suitable for yyerror. The
1061 heuristic is that double-quoting is unnecessary unless the string
1062 contains an apostrophe, a comma, or backslash (other than
1063 backslash-backslash). YYSTR is taken from yytname. If YYRES is
1064 null, do not copy; instead, return the length of what the result
1067 yytnamerr (char *yyres
, const char *yystr
)
1072 char const *yyp
= yystr
;
1079 goto do_not_strip_quotes
;
1083 goto do_not_strip_quotes
;
1096 do_not_strip_quotes
: ;
1100 return yystrlen (yystr
);
1102 return yystpcpy (yyres
, yystr
) - yyres
;
1106 /* Copy into YYRESULT an error message about the unexpected token
1107 YYCHAR while in state YYSTATE. Return the number of bytes copied,
1108 including the terminating null byte. If YYRESULT is null, do not
1109 copy anything; just return the number of bytes that would be
1110 copied. As a special case, return 0 if an ordinary "syntax error"
1111 message will do. Return YYSIZE_MAXIMUM if overflow occurs during
1112 size calculation. */
1114 yysyntax_error (char *yyresult
, int yystate
, int yychar
)
1116 int yyn
= yypact
[yystate
];
1118 if (! (YYPACT_NINF
< yyn
&& yyn
<= YYLAST
))
1122 int yytype
= YYTRANSLATE (yychar
);
1123 YYSIZE_T yysize0
= yytnamerr (0, yytname
[yytype
]);
1124 YYSIZE_T yysize
= yysize0
;
1126 int yysize_overflow
= 0;
1127 enum { YYERROR_VERBOSE_ARGS_MAXIMUM
= 5 };
1128 char const *yyarg
[YYERROR_VERBOSE_ARGS_MAXIMUM
];
1132 /* This is so xgettext sees the translatable formats that are
1133 constructed on the fly. */
1134 YY_("syntax error, unexpected %s");
1135 YY_("syntax error, unexpected %s, expecting %s");
1136 YY_("syntax error, unexpected %s, expecting %s or %s");
1137 YY_("syntax error, unexpected %s, expecting %s or %s or %s");
1138 YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s");
1142 static char const yyunexpected
[] = "syntax error, unexpected %s";
1143 static char const yyexpecting
[] = ", expecting %s";
1144 static char const yyor
[] = " or %s";
1145 char yyformat
[sizeof yyunexpected
1146 + sizeof yyexpecting
- 1
1147 + ((YYERROR_VERBOSE_ARGS_MAXIMUM
- 2)
1148 * (sizeof yyor
- 1))];
1149 char const *yyprefix
= yyexpecting
;
1151 /* Start YYX at -YYN if negative to avoid negative indexes in
1153 int yyxbegin
= yyn
< 0 ? -yyn
: 0;
1155 /* Stay within bounds of both yycheck and yytname. */
1156 int yychecklim
= YYLAST
- yyn
+ 1;
1157 int yyxend
= yychecklim
< YYNTOKENS
? yychecklim
: YYNTOKENS
;
1160 yyarg
[0] = yytname
[yytype
];
1161 yyfmt
= yystpcpy (yyformat
, yyunexpected
);
1163 for (yyx
= yyxbegin
; yyx
< yyxend
; ++yyx
)
1164 if (yycheck
[yyx
+ yyn
] == yyx
&& yyx
!= YYTERROR
)
1166 if (yycount
== YYERROR_VERBOSE_ARGS_MAXIMUM
)
1170 yyformat
[sizeof yyunexpected
- 1] = '\0';
1173 yyarg
[yycount
++] = yytname
[yyx
];
1174 yysize1
= yysize
+ yytnamerr (0, yytname
[yyx
]);
1175 yysize_overflow
|= (yysize1
< yysize
);
1177 yyfmt
= yystpcpy (yyfmt
, yyprefix
);
1181 yyf
= YY_(yyformat
);
1182 yysize1
= yysize
+ yystrlen (yyf
);
1183 yysize_overflow
|= (yysize1
< yysize
);
1186 if (yysize_overflow
)
1187 return YYSIZE_MAXIMUM
;
1191 /* Avoid sprintf, as that infringes on the user's name space.
1192 Don't have undefined behavior even if the translation
1193 produced a string with the wrong number of "%s"s. */
1194 char *yyp
= yyresult
;
1196 while ((*yyp
= *yyf
) != '\0')
1198 if (*yyp
== '%' && yyf
[1] == 's' && yyi
< yycount
)
1200 yyp
+= yytnamerr (yyp
, yyarg
[yyi
++]);
1213 #endif /* YYERROR_VERBOSE */
1216 /*-----------------------------------------------.
1217 | Release the memory associated to this symbol. |
1218 `-----------------------------------------------*/
1221 #if (defined __STDC__ || defined __C99__FUNC__ \
1222 || defined __cplusplus || defined _MSC_VER)
1224 yydestruct (const char *yymsg
, int yytype
, YYSTYPE
*yyvaluep
)
1227 yydestruct (yymsg
, yytype
, yyvaluep
)
1237 YY_SYMBOL_PRINT (yymsg
, yytype
, yyvaluep
, yylocationp
);
1247 /* Prevent warnings from -Wmissing-prototypes. */
1248 #ifdef YYPARSE_PARAM
1249 #if defined __STDC__ || defined __cplusplus
1250 int yyparse (void *YYPARSE_PARAM
);
1254 #else /* ! YYPARSE_PARAM */
1255 #if defined __STDC__ || defined __cplusplus
1260 #endif /* ! YYPARSE_PARAM */
1266 /*-------------------------.
1267 | yyparse or yypush_parse. |
1268 `-------------------------*/
1270 #ifdef YYPARSE_PARAM
1271 #if (defined __STDC__ || defined __C99__FUNC__ \
1272 || defined __cplusplus || defined _MSC_VER)
1274 yyparse (void *YYPARSE_PARAM
)
1277 yyparse (YYPARSE_PARAM
)
1278 void *YYPARSE_PARAM
;
1280 #else /* ! YYPARSE_PARAM */
1281 #if (defined __STDC__ || defined __C99__FUNC__ \
1282 || defined __cplusplus || defined _MSC_VER)
1292 /* The lookahead symbol. */
1295 /* The semantic value of the lookahead symbol. */
1298 /* Number of syntax errors so far. */
1302 /* Number of tokens to shift before error messages enabled. */
1305 /* The stacks and their tools:
1306 `yyss': related to states.
1307 `yyvs': related to semantic values.
1309 Refer to the stacks thru separate pointers, to allow yyoverflow
1310 to reallocate them elsewhere. */
1312 /* The state stack. */
1313 yytype_int16 yyssa
[YYINITDEPTH
];
1315 yytype_int16
*yyssp
;
1317 /* The semantic value stack. */
1318 YYSTYPE yyvsa
[YYINITDEPTH
];
1322 YYSIZE_T yystacksize
;
1326 /* Lookahead token as an internal (translated) token number. */
1328 /* The variables used to return semantic value and location from the
1333 /* Buffer for error messages, and its allocated size. */
1335 char *yymsg
= yymsgbuf
;
1336 YYSIZE_T yymsg_alloc
= sizeof yymsgbuf
;
1339 #define YYPOPSTACK(N) (yyvsp -= (N), yyssp -= (N))
1341 /* The number of symbols on the RHS of the reduced rule.
1342 Keep to zero when no symbol should be popped. */
1348 yystacksize
= YYINITDEPTH
;
1350 YYDPRINTF ((stderr
, "Starting parse\n"));
1355 yychar
= YYEMPTY
; /* Cause a token to be read. */
1357 /* Initialize stack pointers.
1358 Waste one element of value and location stack
1359 so that they stay on the same level as the state stack.
1360 The wasted elements are never initialized. */
1366 /*------------------------------------------------------------.
1367 | yynewstate -- Push a new state, which is found in yystate. |
1368 `------------------------------------------------------------*/
1370 /* In all cases, when you get here, the value and location stacks
1371 have just been pushed. So pushing a state here evens the stacks. */
1377 if (yyss
+ yystacksize
- 1 <= yyssp
)
1379 /* Get the current used size of the three stacks, in elements. */
1380 YYSIZE_T yysize
= yyssp
- yyss
+ 1;
1384 /* Give user a chance to reallocate the stack. Use copies of
1385 these so that the &'s don't force the real ones into
1387 YYSTYPE
*yyvs1
= yyvs
;
1388 yytype_int16
*yyss1
= yyss
;
1390 /* Each stack pointer address is followed by the size of the
1391 data in use in that stack, in bytes. This used to be a
1392 conditional around just the two extra args, but that might
1393 be undefined if yyoverflow is a macro. */
1394 yyoverflow (YY_("memory exhausted"),
1395 &yyss1
, yysize
* sizeof (*yyssp
),
1396 &yyvs1
, yysize
* sizeof (*yyvsp
),
1402 #else /* no yyoverflow */
1403 # ifndef YYSTACK_RELOCATE
1404 goto yyexhaustedlab
;
1406 /* Extend the stack our own way. */
1407 if (YYMAXDEPTH
<= yystacksize
)
1408 goto yyexhaustedlab
;
1410 if (YYMAXDEPTH
< yystacksize
)
1411 yystacksize
= YYMAXDEPTH
;
1414 yytype_int16
*yyss1
= yyss
;
1415 union yyalloc
*yyptr
=
1416 (union yyalloc
*) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize
));
1418 goto yyexhaustedlab
;
1419 YYSTACK_RELOCATE (yyss_alloc
, yyss
);
1420 YYSTACK_RELOCATE (yyvs_alloc
, yyvs
);
1421 # undef YYSTACK_RELOCATE
1423 YYSTACK_FREE (yyss1
);
1426 #endif /* no yyoverflow */
1428 yyssp
= yyss
+ yysize
- 1;
1429 yyvsp
= yyvs
+ yysize
- 1;
1431 YYDPRINTF ((stderr
, "Stack size increased to %lu\n",
1432 (unsigned long int) yystacksize
));
1434 if (yyss
+ yystacksize
- 1 <= yyssp
)
1438 YYDPRINTF ((stderr
, "Entering state %d\n", yystate
));
1440 if (yystate
== YYFINAL
)
1450 /* Do appropriate processing given the current state. Read a
1451 lookahead token if we need one and don't already have one. */
1453 /* First try to decide what to do without reference to lookahead token. */
1454 yyn
= yypact
[yystate
];
1455 if (yyn
== YYPACT_NINF
)
1458 /* Not known => get a lookahead token if don't already have one. */
1460 /* YYCHAR is either YYEMPTY or YYEOF or a valid lookahead symbol. */
1461 if (yychar
== YYEMPTY
)
1463 YYDPRINTF ((stderr
, "Reading a token: "));
1467 if (yychar
<= YYEOF
)
1469 yychar
= yytoken
= YYEOF
;
1470 YYDPRINTF ((stderr
, "Now at end of input.\n"));
1474 yytoken
= YYTRANSLATE (yychar
);
1475 YY_SYMBOL_PRINT ("Next token is", yytoken
, &yylval
, &yylloc
);
1478 /* If the proper action on seeing token YYTOKEN is to reduce or to
1479 detect an error, take that action. */
1481 if (yyn
< 0 || YYLAST
< yyn
|| yycheck
[yyn
] != yytoken
)
1486 if (yyn
== 0 || yyn
== YYTABLE_NINF
)
1492 /* Count tokens shifted since error; after three, turn off error
1497 /* Shift the lookahead token. */
1498 YY_SYMBOL_PRINT ("Shifting", yytoken
, &yylval
, &yylloc
);
1500 /* Discard the shifted token. */
1509 /*-----------------------------------------------------------.
1510 | yydefault -- do the default action for the current state. |
1511 `-----------------------------------------------------------*/
1513 yyn
= yydefact
[yystate
];
1519 /*-----------------------------.
1520 | yyreduce -- Do a reduction. |
1521 `-----------------------------*/
1523 /* yyn is the number of a rule to reduce with. */
1526 /* If YYLEN is nonzero, implement the default value of the action:
1529 Otherwise, the following line sets YYVAL to garbage.
1530 This behavior is undocumented and Bison
1531 users should not rely upon it. Assigning to YYVAL
1532 unconditionally makes the parser a bit smaller, and it avoids a
1533 GCC warning that YYVAL may be used uninitialized. */
1534 yyval
= yyvsp
[1-yylen
];
1537 YY_REDUCE_PRINT (yyn
);
1542 /* Line 1455 of yacc.c */
1545 COND_input
* cond
= (COND_input
*) info
;
1546 cond
->result
= (yyvsp
[(1) - (1)].value
);
1552 /* Line 1455 of yacc.c */
1555 COND_input
* cond
= (COND_input
*) info
;
1556 cond
->result
= MSICONDITION_NONE
;
1562 /* Line 1455 of yacc.c */
1565 (yyval
.value
) = (yyvsp
[(1) - (1)].value
);
1571 /* Line 1455 of yacc.c */
1574 (yyval
.value
) = (yyvsp
[(1) - (3)].value
) || (yyvsp
[(3) - (3)].value
);
1580 /* Line 1455 of yacc.c */
1583 (yyval
.value
) = !(yyvsp
[(1) - (3)].value
) || (yyvsp
[(3) - (3)].value
);
1589 /* Line 1455 of yacc.c */
1592 (yyval
.value
) = ( (yyvsp
[(1) - (3)].value
) || (yyvsp
[(3) - (3)].value
) ) && !( (yyvsp
[(1) - (3)].value
) && (yyvsp
[(3) - (3)].value
) );
1598 /* Line 1455 of yacc.c */
1601 (yyval
.value
) = ( (yyvsp
[(1) - (3)].value
) && (yyvsp
[(3) - (3)].value
) ) || ( !(yyvsp
[(1) - (3)].value
) && !(yyvsp
[(3) - (3)].value
) );
1607 /* Line 1455 of yacc.c */
1610 (yyval
.value
) = (yyvsp
[(1) - (1)].value
);
1616 /* Line 1455 of yacc.c */
1619 (yyval
.value
) = (yyvsp
[(1) - (3)].value
) && (yyvsp
[(3) - (3)].value
);
1625 /* Line 1455 of yacc.c */
1628 (yyval
.value
) = (yyvsp
[(2) - (2)].value
) ? 0 : 1;
1634 /* Line 1455 of yacc.c */
1637 (yyval
.value
) = (yyvsp
[(1) - (1)].value
) ? 1 : 0;
1643 /* Line 1455 of yacc.c */
1646 (yyval
.value
) = ((yyvsp
[(1) - (1)].string
) && (yyvsp
[(1) - (1)].string
)[0]) ? 1 : 0;
1647 msi_free((yyvsp
[(1) - (1)].string
));
1653 /* Line 1455 of yacc.c */
1656 (yyval
.value
) = compare_int( (yyvsp
[(1) - (3)].value
), (yyvsp
[(2) - (3)].value
), (yyvsp
[(3) - (3)].value
) );
1662 /* Line 1455 of yacc.c */
1666 if (num_from_prop( (yyvsp
[(1) - (3)].string
), &num
))
1667 (yyval
.value
) = compare_int( num
, (yyvsp
[(2) - (3)].value
), (yyvsp
[(3) - (3)].value
) );
1669 (yyval
.value
) = ((yyvsp
[(2) - (3)].value
) == COND_NE
|| (yyvsp
[(2) - (3)].value
) == COND_INE
);
1670 msi_free((yyvsp
[(1) - (3)].string
));
1676 /* Line 1455 of yacc.c */
1680 if (num_from_prop( (yyvsp
[(3) - (3)].string
), &num
))
1681 (yyval
.value
) = compare_int( (yyvsp
[(1) - (3)].value
), (yyvsp
[(2) - (3)].value
), num
);
1683 (yyval
.value
) = ((yyvsp
[(2) - (3)].value
) == COND_NE
|| (yyvsp
[(2) - (3)].value
) == COND_INE
);
1684 msi_free((yyvsp
[(3) - (3)].string
));
1690 /* Line 1455 of yacc.c */
1693 (yyval
.value
) = compare_and_free_strings( (yyvsp
[(1) - (3)].string
), (yyvsp
[(2) - (3)].value
), (yyvsp
[(3) - (3)].string
), TRUE
);
1699 /* Line 1455 of yacc.c */
1702 (yyval
.value
) = compare_and_free_strings( (yyvsp
[(1) - (3)].string
), (yyvsp
[(2) - (3)].value
), (yyvsp
[(3) - (3)].string
), TRUE
);
1708 /* Line 1455 of yacc.c */
1711 (yyval
.value
) = compare_and_free_strings( (yyvsp
[(1) - (3)].string
), (yyvsp
[(2) - (3)].value
), (yyvsp
[(3) - (3)].string
), TRUE
);
1717 /* Line 1455 of yacc.c */
1720 (yyval
.value
) = compare_and_free_strings( (yyvsp
[(1) - (3)].string
), (yyvsp
[(2) - (3)].value
), (yyvsp
[(3) - (3)].string
), FALSE
);
1726 /* Line 1455 of yacc.c */
1730 msi_free((yyvsp
[(1) - (3)].string
));
1736 /* Line 1455 of yacc.c */
1740 msi_free((yyvsp
[(3) - (3)].string
));
1746 /* Line 1455 of yacc.c */
1749 (yyval
.value
) = (yyvsp
[(2) - (3)].value
);
1755 /* Line 1455 of yacc.c */
1757 { (yyval
.value
) = COND_EQ
; ;}
1762 /* Line 1455 of yacc.c */
1764 { (yyval
.value
) = COND_NE
; ;}
1769 /* Line 1455 of yacc.c */
1771 { (yyval
.value
) = COND_LT
; ;}
1776 /* Line 1455 of yacc.c */
1778 { (yyval
.value
) = COND_GT
; ;}
1783 /* Line 1455 of yacc.c */
1785 { (yyval
.value
) = COND_LE
; ;}
1790 /* Line 1455 of yacc.c */
1792 { (yyval
.value
) = COND_GE
; ;}
1797 /* Line 1455 of yacc.c */
1799 { (yyval
.value
) = COND_SS
; ;}
1804 /* Line 1455 of yacc.c */
1806 { (yyval
.value
) = COND_IEQ
; ;}
1811 /* Line 1455 of yacc.c */
1813 { (yyval
.value
) = COND_INE
; ;}
1818 /* Line 1455 of yacc.c */
1820 { (yyval
.value
) = COND_ILT
; ;}
1825 /* Line 1455 of yacc.c */
1827 { (yyval
.value
) = COND_IGT
; ;}
1832 /* Line 1455 of yacc.c */
1834 { (yyval
.value
) = COND_ILE
; ;}
1839 /* Line 1455 of yacc.c */
1841 { (yyval
.value
) = COND_IGE
; ;}
1846 /* Line 1455 of yacc.c */
1848 { (yyval
.value
) = COND_ISS
; ;}
1853 /* Line 1455 of yacc.c */
1855 { (yyval
.value
) = COND_LHS
; ;}
1860 /* Line 1455 of yacc.c */
1862 { (yyval
.value
) = COND_RHS
; ;}
1867 /* Line 1455 of yacc.c */
1869 { (yyval
.value
) = COND_ILHS
; ;}
1874 /* Line 1455 of yacc.c */
1876 { (yyval
.value
) = COND_IRHS
; ;}
1881 /* Line 1455 of yacc.c */
1884 (yyval
.string
) = (yyvsp
[(1) - (1)].string
);
1890 /* Line 1455 of yacc.c */
1893 (yyval
.string
) = (yyvsp
[(1) - (1)].string
);
1899 /* Line 1455 of yacc.c */
1902 (yyval
.string
) = COND_GetLiteral(&(yyvsp
[(1) - (1)].str
));
1903 if( !(yyval
.string
) )
1910 /* Line 1455 of yacc.c */
1913 (yyval
.value
) = (yyvsp
[(1) - (1)].value
);
1919 /* Line 1455 of yacc.c */
1922 COND_input
* cond
= (COND_input
*) info
;
1923 INSTALLSTATE install
= INSTALLSTATE_UNKNOWN
, action
= INSTALLSTATE_UNKNOWN
;
1925 MSI_GetComponentStateW(cond
->package
, (yyvsp
[(2) - (2)].string
), &install
, &action
);
1926 (yyval
.value
) = action
;
1927 msi_free( (yyvsp
[(2) - (2)].string
) );
1933 /* Line 1455 of yacc.c */
1936 COND_input
* cond
= (COND_input
*) info
;
1937 INSTALLSTATE install
= INSTALLSTATE_UNKNOWN
, action
= INSTALLSTATE_UNKNOWN
;
1939 MSI_GetComponentStateW(cond
->package
, (yyvsp
[(2) - (2)].string
), &install
, &action
);
1940 (yyval
.value
) = install
;
1941 msi_free( (yyvsp
[(2) - (2)].string
) );
1947 /* Line 1455 of yacc.c */
1950 COND_input
* cond
= (COND_input
*) info
;
1951 INSTALLSTATE install
= INSTALLSTATE_UNKNOWN
, action
= INSTALLSTATE_UNKNOWN
;
1953 MSI_GetFeatureStateW(cond
->package
, (yyvsp
[(2) - (2)].string
), &install
, &action
);
1954 if (action
== INSTALLSTATE_UNKNOWN
)
1955 (yyval
.value
) = MSICONDITION_FALSE
;
1957 (yyval
.value
) = action
;
1959 msi_free( (yyvsp
[(2) - (2)].string
) );
1965 /* Line 1455 of yacc.c */
1968 COND_input
* cond
= (COND_input
*) info
;
1969 INSTALLSTATE install
= INSTALLSTATE_UNKNOWN
, action
= INSTALLSTATE_UNKNOWN
;
1971 MSI_GetFeatureStateW(cond
->package
, (yyvsp
[(2) - (2)].string
), &install
, &action
);
1972 (yyval
.value
) = install
;
1973 msi_free( (yyvsp
[(2) - (2)].string
) );
1979 /* Line 1455 of yacc.c */
1982 COND_input
* cond
= (COND_input
*) info
;
1984 (yyval
.string
) = msi_dup_property( cond
->package
, (yyvsp
[(1) - (1)].string
) );
1985 msi_free( (yyvsp
[(1) - (1)].string
) );
1991 /* Line 1455 of yacc.c */
1994 UINT len
= GetEnvironmentVariableW( (yyvsp
[(2) - (2)].string
), NULL
, 0 );
1995 (yyval
.string
) = NULL
;
1998 (yyval
.string
) = msi_alloc( len
*sizeof (WCHAR
) );
1999 GetEnvironmentVariableW( (yyvsp
[(2) - (2)].string
), (yyval
.string
), len
);
2001 msi_free( (yyvsp
[(2) - (2)].string
) );
2007 /* Line 1455 of yacc.c */
2010 (yyval
.string
) = COND_GetString(&(yyvsp
[(1) - (1)].str
));
2011 if( !(yyval
.string
) )
2018 /* Line 1455 of yacc.c */
2021 LPWSTR szNum
= COND_GetString(&(yyvsp
[(1) - (1)].str
));
2024 (yyval
.value
) = atoiW( szNum
);
2031 /* Line 1455 of yacc.c */
2032 #line 2033 "cond.tab.c"
2035 YY_SYMBOL_PRINT ("-> $$ =", yyr1
[yyn
], &yyval
, &yyloc
);
2039 YY_STACK_PRINT (yyss
, yyssp
);
2043 /* Now `shift' the result of the reduction. Determine what state
2044 that goes to, based on the state we popped back to and the rule
2045 number reduced by. */
2049 yystate
= yypgoto
[yyn
- YYNTOKENS
] + *yyssp
;
2050 if (0 <= yystate
&& yystate
<= YYLAST
&& yycheck
[yystate
] == *yyssp
)
2051 yystate
= yytable
[yystate
];
2053 yystate
= yydefgoto
[yyn
- YYNTOKENS
];
2058 /*------------------------------------.
2059 | yyerrlab -- here on detecting error |
2060 `------------------------------------*/
2062 /* If not already recovering from an error, report this error. */
2066 #if ! YYERROR_VERBOSE
2067 yyerror (YY_("syntax error"));
2070 YYSIZE_T yysize
= yysyntax_error (0, yystate
, yychar
);
2071 if (yymsg_alloc
< yysize
&& yymsg_alloc
< YYSTACK_ALLOC_MAXIMUM
)
2073 YYSIZE_T yyalloc
= 2 * yysize
;
2074 if (! (yysize
<= yyalloc
&& yyalloc
<= YYSTACK_ALLOC_MAXIMUM
))
2075 yyalloc
= YYSTACK_ALLOC_MAXIMUM
;
2076 if (yymsg
!= yymsgbuf
)
2077 YYSTACK_FREE (yymsg
);
2078 yymsg
= (char *) YYSTACK_ALLOC (yyalloc
);
2080 yymsg_alloc
= yyalloc
;
2084 yymsg_alloc
= sizeof yymsgbuf
;
2088 if (0 < yysize
&& yysize
<= yymsg_alloc
)
2090 (void) yysyntax_error (yymsg
, yystate
, yychar
);
2095 yyerror (YY_("syntax error"));
2097 goto yyexhaustedlab
;
2105 if (yyerrstatus
== 3)
2107 /* If just tried and failed to reuse lookahead token after an
2108 error, discard it. */
2110 if (yychar
<= YYEOF
)
2112 /* Return failure if at end of input. */
2113 if (yychar
== YYEOF
)
2118 yydestruct ("Error: discarding",
2124 /* Else will try to reuse lookahead token after shifting the error
2129 /*---------------------------------------------------.
2130 | yyerrorlab -- error raised explicitly by YYERROR. |
2131 `---------------------------------------------------*/
2134 /* Pacify compilers like GCC when the user code never invokes
2135 YYERROR and the label yyerrorlab therefore never appears in user
2137 if (/*CONSTCOND*/ 0)
2140 /* Do not reclaim the symbols of the rule which action triggered
2144 YY_STACK_PRINT (yyss
, yyssp
);
2149 /*-------------------------------------------------------------.
2150 | yyerrlab1 -- common code for both syntax error and YYERROR. |
2151 `-------------------------------------------------------------*/
2153 yyerrstatus
= 3; /* Each real token shifted decrements this. */
2157 yyn
= yypact
[yystate
];
2158 if (yyn
!= YYPACT_NINF
)
2161 if (0 <= yyn
&& yyn
<= YYLAST
&& yycheck
[yyn
] == YYTERROR
)
2169 /* Pop the current state because it cannot handle the error token. */
2174 yydestruct ("Error: popping",
2175 yystos
[yystate
], yyvsp
);
2178 YY_STACK_PRINT (yyss
, yyssp
);
2184 /* Shift the error token. */
2185 YY_SYMBOL_PRINT ("Shifting", yystos
[yyn
], yyvsp
, yylsp
);
2191 /*-------------------------------------.
2192 | yyacceptlab -- YYACCEPT comes here. |
2193 `-------------------------------------*/
2198 /*-----------------------------------.
2199 | yyabortlab -- YYABORT comes here. |
2200 `-----------------------------------*/
2205 #if !defined(yyoverflow) || YYERROR_VERBOSE
2206 /*-------------------------------------------------.
2207 | yyexhaustedlab -- memory exhaustion comes here. |
2208 `-------------------------------------------------*/
2210 yyerror (YY_("memory exhausted"));
2216 if (yychar
!= YYEMPTY
)
2217 yydestruct ("Cleanup: discarding lookahead",
2219 /* Do not reclaim the symbols of the rule which action triggered
2220 this YYABORT or YYACCEPT. */
2222 YY_STACK_PRINT (yyss
, yyssp
);
2223 while (yyssp
!= yyss
)
2225 yydestruct ("Cleanup: popping",
2226 yystos
[*yyssp
], yyvsp
);
2231 YYSTACK_FREE (yyss
);
2234 if (yymsg
!= yymsgbuf
)
2235 YYSTACK_FREE (yymsg
);
2237 /* Make sure YYID is used. */
2238 return YYID (yyresult
);
2243 /* Line 1675 of yacc.c */
2248 static int COND_IsAlpha( WCHAR x
)
2250 return( ( ( x
>= 'A' ) && ( x
<= 'Z' ) ) ||
2251 ( ( x
>= 'a' ) && ( x
<= 'z' ) ) ||
2255 static int COND_IsNumber( WCHAR x
)
2257 return( (( x
>= '0' ) && ( x
<= '9' )) || (x
=='-') || (x
=='.') );
2260 static WCHAR
*strstriW( const WCHAR
*str
, const WCHAR
*sub
)
2262 LPWSTR strlower
, sublower
, r
;
2263 strlower
= CharLowerW( strdupW( str
) );
2264 sublower
= CharLowerW( strdupW( sub
) );
2265 r
= strstrW( strlower
, sublower
);
2267 r
= (LPWSTR
)str
+ (r
- strlower
);
2268 msi_free( strlower
);
2269 msi_free( sublower
);
2273 static BOOL
str_is_number( LPCWSTR str
)
2280 for (i
= 0; i
< lstrlenW( str
); i
++)
2281 if (!isdigitW(str
[i
]))
2287 static INT
compare_substring( LPCWSTR a
, INT
operator, LPCWSTR b
)
2291 /* substring operators return 0 if LHS is missing */
2295 /* substring operators return 1 if RHS is missing */
2299 /* if both strings contain only numbers, use integer comparison */
2302 if (str_is_number(a
) && str_is_number(b
))
2303 return compare_int( lhs
, operator, rhs
);
2308 return strstrW( a
, b
) ? 1 : 0;
2310 return strstriW( a
, b
) ? 1 : 0;
2312 return 0 == strncmpW( a
, b
, lstrlenW( b
) );
2314 return 0 == lstrcmpW( a
+ (lstrlenW( a
) - lstrlenW( b
)), b
);
2316 return 0 == strncmpiW( a
, b
, lstrlenW( b
) );
2318 return 0 == lstrcmpiW( a
+ (lstrlenW( a
) - lstrlenW( b
)), b
);
2320 ERR("invalid substring operator\n");
2326 static INT
compare_string( LPCWSTR a
, INT
operator, LPCWSTR b
, BOOL convert
)
2328 if (operator >= COND_SS
&& operator <= COND_RHS
)
2329 return compare_substring( a
, operator, b
);
2331 /* null and empty string are equivalent */
2332 if (!a
) a
= szEmpty
;
2333 if (!b
) b
= szEmpty
;
2335 if (convert
&& str_is_number(a
) && str_is_number(b
))
2336 return compare_int( atoiW(a
), operator, atoiW(b
) );
2338 /* a or b may be NULL */
2342 return -1 == lstrcmpW( a
, b
);
2344 return 1 == lstrcmpW( a
, b
);
2346 return 0 == lstrcmpW( a
, b
);
2348 return 0 != lstrcmpW( a
, b
);
2350 return -1 != lstrcmpW( a
, b
);
2352 return 1 != lstrcmpW( a
, b
);
2354 return -1 == lstrcmpiW( a
, b
);
2356 return 1 == lstrcmpiW( a
, b
);
2358 return 0 == lstrcmpiW( a
, b
);
2360 return 0 != lstrcmpiW( a
, b
);
2362 return -1 != lstrcmpiW( a
, b
);
2364 return 1 != lstrcmpiW( a
, b
);
2366 ERR("invalid string operator\n");
2373 static INT
compare_int( INT a
, INT
operator, INT b
)
2397 return ( a
& b
) ? 1 : 0;
2399 return ( ( a
& 0xffff ) == b
) ? 1 : 0;
2401 return ( ( (a
>>16) & 0xffff ) == b
) ? 1 : 0;
2403 ERR("invalid integer operator\n");
2410 static int COND_IsIdent( WCHAR x
)
2412 return( COND_IsAlpha( x
) || COND_IsNumber( x
) || ( x
== '_' )
2413 || ( x
== '#' ) || (x
== '.') );
2416 static int COND_GetOperator( COND_input
*cond
)
2418 static const struct {
2422 { {'~','<','=',0}, COND_ILE
},
2423 { {'~','>','<',0}, COND_ISS
},
2424 { {'~','>','>',0}, COND_IRHS
},
2425 { {'~','<','>',0}, COND_INE
},
2426 { {'~','>','=',0}, COND_IGE
},
2427 { {'~','<','<',0}, COND_ILHS
},
2428 { {'~','=',0}, COND_IEQ
},
2429 { {'~','<',0}, COND_ILT
},
2430 { {'~','>',0}, COND_IGT
},
2431 { {'>','=',0}, COND_GE
},
2432 { {'>','<',0}, COND_SS
},
2433 { {'<','<',0}, COND_LHS
},
2434 { {'<','>',0}, COND_NE
},
2435 { {'<','=',0}, COND_LE
},
2436 { {'>','>',0}, COND_RHS
},
2437 { {'>',0}, COND_GT
},
2438 { {'<',0}, COND_LT
},
2441 LPCWSTR p
= &cond
->str
[cond
->n
];
2446 len
= lstrlenW( table
[i
].str
);
2447 if ( !len
|| 0 == strncmpW( table
[i
].str
, p
, len
) )
2455 static int COND_GetOne( struct cond_str
*str
, COND_input
*cond
)
2460 str
->data
= &cond
->str
[cond
->n
];
2467 case '(': rc
= COND_LPAR
; break;
2468 case ')': rc
= COND_RPAR
; break;
2469 case '&': rc
= COND_AMPER
; break;
2470 case '!': rc
= COND_EXCLAM
; break;
2471 case '$': rc
= COND_DOLLARS
; break;
2472 case '?': rc
= COND_QUESTION
; break;
2473 case '%': rc
= COND_PERCENT
; break;
2474 case ' ': rc
= COND_SPACE
; break;
2475 case '=': rc
= COND_EQ
; break;
2480 rc
= COND_GetOperator( cond
);
2496 LPCWSTR p
= strchrW( str
->data
+ 1, '"' );
2499 len
= p
- str
->data
+ 1;
2502 else if( COND_IsAlpha( ch
) )
2504 static const WCHAR szNot
[] = {'N','O','T',0};
2505 static const WCHAR szAnd
[] = {'A','N','D',0};
2506 static const WCHAR szXor
[] = {'X','O','R',0};
2507 static const WCHAR szEqv
[] = {'E','Q','V',0};
2508 static const WCHAR szImp
[] = {'I','M','P',0};
2509 static const WCHAR szOr
[] = {'O','R',0};
2511 while( COND_IsIdent( str
->data
[len
] ) )
2517 if ( !strncmpiW( str
->data
, szNot
, len
) )
2519 else if( !strncmpiW( str
->data
, szAnd
, len
) )
2521 else if( !strncmpiW( str
->data
, szXor
, len
) )
2523 else if( !strncmpiW( str
->data
, szEqv
, len
) )
2525 else if( !strncmpiW( str
->data
, szImp
, len
) )
2528 else if( (len
== 2) && !strncmpiW( str
->data
, szOr
, len
) )
2531 else if( COND_IsNumber( ch
) )
2533 while( COND_IsNumber( str
->data
[len
] ) )
2539 ERR("Got unknown character %c(%x)\n",ch
,ch
);
2549 static int cond_lex( void *COND_lval
, COND_input
*cond
)
2552 struct cond_str
*str
= COND_lval
;
2555 rc
= COND_GetOne( str
, cond
);
2556 } while (rc
== COND_SPACE
);
2561 static LPWSTR
COND_GetString( const struct cond_str
*str
)
2565 ret
= msi_alloc( (str
->len
+1) * sizeof (WCHAR
) );
2568 memcpy( ret
, str
->data
, str
->len
* sizeof(WCHAR
));
2571 TRACE("Got identifier %s\n",debugstr_w(ret
));
2575 static LPWSTR
COND_GetLiteral( const struct cond_str
*str
)
2579 ret
= msi_alloc( (str
->len
-1) * sizeof (WCHAR
) );
2582 memcpy( ret
, str
->data
+1, (str
->len
-2) * sizeof(WCHAR
) );
2583 ret
[str
->len
- 2]=0;
2585 TRACE("Got literal %s\n",debugstr_w(ret
));
2589 static int cond_error(const char *str
)
2591 TRACE("%s\n", str
);
2595 MSICONDITION
MSI_EvaluateConditionW( MSIPACKAGE
*package
, LPCWSTR szCondition
)
2600 TRACE("%s\n", debugstr_w( szCondition
) );
2602 if ( szCondition
== NULL
)
2603 return MSICONDITION_NONE
;
2605 cond
.package
= package
;
2606 cond
.str
= szCondition
;
2608 cond
.result
= MSICONDITION_ERROR
;
2610 if ( !cond_parse( &cond
) )
2613 r
= MSICONDITION_ERROR
;
2615 TRACE("%i <- %s\n", r
, debugstr_w(szCondition
));
2619 MSICONDITION WINAPI
MsiEvaluateConditionW( MSIHANDLE hInstall
, LPCWSTR szCondition
)
2621 MSIPACKAGE
*package
;
2624 package
= msihandle2msiinfo( hInstall
, MSIHANDLETYPE_PACKAGE
);
2629 IWineMsiRemotePackage
*remote_package
;
2631 remote_package
= (IWineMsiRemotePackage
*)msi_get_remote( hInstall
);
2632 if (!remote_package
)
2633 return MSICONDITION_ERROR
;
2635 condition
= SysAllocString( szCondition
);
2638 IWineMsiRemotePackage_Release( remote_package
);
2639 return ERROR_OUTOFMEMORY
;
2642 hr
= IWineMsiRemotePackage_EvaluateCondition( remote_package
, condition
);
2644 SysFreeString( condition
);
2645 IWineMsiRemotePackage_Release( remote_package
);
2649 if (HRESULT_FACILITY(hr
) == FACILITY_WIN32
)
2650 return HRESULT_CODE(hr
);
2652 return ERROR_FUNCTION_FAILED
;
2655 return ERROR_SUCCESS
;
2658 ret
= MSI_EvaluateConditionW( package
, szCondition
);
2659 msiobj_release( &package
->hdr
);
2663 MSICONDITION WINAPI
MsiEvaluateConditionA( MSIHANDLE hInstall
, LPCSTR szCondition
)
2665 LPWSTR szwCond
= NULL
;
2668 szwCond
= strdupAtoW( szCondition
);
2669 if( szCondition
&& !szwCond
)
2670 return MSICONDITION_ERROR
;
2672 r
= MsiEvaluateConditionW( hInstall
, szwCond
);
2673 msi_free( szwCond
);