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"
122 #include "wine/list.h"
124 #define YYLEX_PARAM info
125 #define YYPARSE_PARAM info
127 static int cond_error(const char *str
);
129 WINE_DEFAULT_DEBUG_CHANNEL(msi
);
131 typedef struct tag_yyinput
145 static LPWSTR
COND_GetString( COND_input
*info
, const struct cond_str
*str
);
146 static LPWSTR
COND_GetLiteral( COND_input
*info
, const struct cond_str
*str
);
147 static int cond_lex( void *COND_lval
, COND_input
*info
);
149 static void *cond_alloc( COND_input
*cond
, unsigned int sz
);
150 static void *cond_track_mem( COND_input
*cond
, void *ptr
, unsigned int sz
);
151 static void cond_free( void *ptr
);
153 static INT
compare_int( INT a
, INT
operator, INT b
);
154 static INT
compare_string( LPCWSTR a
, INT
operator, LPCWSTR b
, BOOL convert
);
156 static INT
compare_and_free_strings( LPWSTR a
, INT op
, LPWSTR b
, BOOL convert
)
160 r
= compare_string( a
, op
, b
, convert
);
166 static BOOL
num_from_prop( LPCWSTR p
, INT
*val
)
168 INT ret
= 0, sign
= 1;
181 if( *p
< '0' || *p
> '9' )
183 ret
= ret
*10 + (*p
- '0');
192 /* Line 189 of yacc.c */
193 #line 194 "cond.tab.c"
195 /* Enabling traces. */
200 /* Enabling verbose error messages. */
201 #ifdef YYERROR_VERBOSE
202 # undef YYERROR_VERBOSE
203 # define YYERROR_VERBOSE 1
205 # define YYERROR_VERBOSE 0
208 /* Enabling the token table. */
209 #ifndef YYTOKEN_TABLE
210 # define YYTOKEN_TABLE 0
217 /* Put the tokens into the symbol table, so that GDB and other debuggers
263 #if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED
264 typedef union YYSTYPE
267 /* Line 214 of yacc.c */
276 /* Line 214 of yacc.c */
277 #line 278 "cond.tab.c"
279 # define YYSTYPE_IS_TRIVIAL 1
280 # define yystype YYSTYPE /* obsolescent; will be withdrawn */
281 # define YYSTYPE_IS_DECLARED 1
285 /* Copy the second part of user declarations. */
288 /* Line 264 of yacc.c */
289 #line 290 "cond.tab.c"
296 typedef YYTYPE_UINT8 yytype_uint8
;
298 typedef unsigned char yytype_uint8
;
302 typedef YYTYPE_INT8 yytype_int8
;
303 #elif (defined __STDC__ || defined __C99__FUNC__ \
304 || defined __cplusplus || defined _MSC_VER)
305 typedef signed char yytype_int8
;
307 typedef short int yytype_int8
;
311 typedef YYTYPE_UINT16 yytype_uint16
;
313 typedef unsigned short int yytype_uint16
;
317 typedef YYTYPE_INT16 yytype_int16
;
319 typedef short int yytype_int16
;
323 # ifdef __SIZE_TYPE__
324 # define YYSIZE_T __SIZE_TYPE__
325 # elif defined size_t
326 # define YYSIZE_T size_t
327 # elif ! defined YYSIZE_T && (defined __STDC__ || defined __C99__FUNC__ \
328 || defined __cplusplus || defined _MSC_VER)
329 # include <stddef.h> /* INFRINGES ON USER NAME SPACE */
330 # define YYSIZE_T size_t
332 # define YYSIZE_T unsigned int
336 #define YYSIZE_MAXIMUM ((YYSIZE_T) -1)
341 # include <libintl.h> /* INFRINGES ON USER NAME SPACE */
342 # define YY_(msgid) dgettext ("bison-runtime", msgid)
346 # define YY_(msgid) msgid
350 /* Suppress unused-variable warnings by "using" E. */
351 #if ! defined lint || defined __GNUC__
352 # define YYUSE(e) ((void) (e))
354 # define YYUSE(e) /* empty */
357 /* Identity function, used to suppress warnings about constant conditions. */
361 #if (defined __STDC__ || defined __C99__FUNC__ \
362 || defined __cplusplus || defined _MSC_VER)
375 #if ! defined yyoverflow || YYERROR_VERBOSE
377 /* The parser invokes alloca or malloc; define the necessary symbols. */
379 # ifdef YYSTACK_USE_ALLOCA
380 # if YYSTACK_USE_ALLOCA
382 # define YYSTACK_ALLOC __builtin_alloca
383 # elif defined __BUILTIN_VA_ARG_INCR
384 # include <alloca.h> /* INFRINGES ON USER NAME SPACE */
386 # define YYSTACK_ALLOC __alloca
387 # elif defined _MSC_VER
388 # include <malloc.h> /* INFRINGES ON USER NAME SPACE */
389 # define alloca _alloca
391 # define YYSTACK_ALLOC alloca
392 # if ! defined _ALLOCA_H && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \
393 || defined __cplusplus || defined _MSC_VER)
394 # include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
403 # ifdef YYSTACK_ALLOC
404 /* Pacify GCC's `empty if-body' warning. */
405 # define YYSTACK_FREE(Ptr) do { /* empty */; } while (YYID (0))
406 # ifndef YYSTACK_ALLOC_MAXIMUM
407 /* The OS might guarantee only one guard page at the bottom of the stack,
408 and a page size can be as small as 4096 bytes. So we cannot safely
409 invoke alloca (N) if N exceeds 4096. Use a slightly smaller number
410 to allow for a few compiler-allocated temporary stack slots. */
411 # define YYSTACK_ALLOC_MAXIMUM 4032 /* reasonable circa 2006 */
414 # define YYSTACK_ALLOC YYMALLOC
415 # define YYSTACK_FREE YYFREE
416 # ifndef YYSTACK_ALLOC_MAXIMUM
417 # define YYSTACK_ALLOC_MAXIMUM YYSIZE_MAXIMUM
419 # if (defined __cplusplus && ! defined _STDLIB_H \
420 && ! ((defined YYMALLOC || defined malloc) \
421 && (defined YYFREE || defined free)))
422 # include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
428 # define YYMALLOC malloc
429 # if ! defined malloc && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \
430 || defined __cplusplus || defined _MSC_VER)
431 void *malloc (YYSIZE_T
); /* INFRINGES ON USER NAME SPACE */
436 # if ! defined free && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \
437 || defined __cplusplus || defined _MSC_VER)
438 void free (void *); /* INFRINGES ON USER NAME SPACE */
442 #endif /* ! defined yyoverflow || YYERROR_VERBOSE */
445 #if (! defined yyoverflow \
446 && (! defined __cplusplus \
447 || (defined YYSTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL)))
449 /* A type that is properly aligned for any stack member. */
452 yytype_int16 yyss_alloc
;
456 /* The size of the maximum gap between one aligned stack and the next. */
457 # define YYSTACK_GAP_MAXIMUM (sizeof (union yyalloc) - 1)
459 /* The size of an array large to enough to hold all stacks, each with
461 # define YYSTACK_BYTES(N) \
462 ((N) * (sizeof (yytype_int16) + sizeof (YYSTYPE)) \
463 + YYSTACK_GAP_MAXIMUM)
465 /* Copy COUNT objects from FROM to TO. The source and destination do
468 # if defined __GNUC__ && 1 < __GNUC__
469 # define YYCOPY(To, From, Count) \
470 __builtin_memcpy (To, From, (Count) * sizeof (*(From)))
472 # define YYCOPY(To, From, Count) \
476 for (yyi = 0; yyi < (Count); yyi++) \
477 (To)[yyi] = (From)[yyi]; \
483 /* Relocate STACK from its old location to the new one. The
484 local variables YYSIZE and YYSTACKSIZE give the old and new number of
485 elements in the stack, and YYPTR gives the new location of the
486 stack. Advance YYPTR to a properly aligned location for the next
488 # define YYSTACK_RELOCATE(Stack_alloc, Stack) \
491 YYSIZE_T yynewbytes; \
492 YYCOPY (&yyptr->Stack_alloc, Stack, yysize); \
493 Stack = &yyptr->Stack_alloc; \
494 yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \
495 yyptr += yynewbytes / sizeof (*yyptr); \
501 /* YYFINAL -- State number of the termination state. */
503 /* YYLAST -- Last index in YYTABLE. */
506 /* YYNTOKENS -- Number of terminals. */
508 /* YYNNTS -- Number of nonterminals. */
510 /* YYNRULES -- Number of rules. */
512 /* YYNRULES -- Number of states. */
515 /* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */
517 #define YYMAXUTOK 295
519 #define YYTRANSLATE(YYX) \
520 ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK)
522 /* YYTRANSLATE[YYLEX] -- Bison symbol number corresponding to YYLEX. */
523 static const yytype_uint8 yytranslate
[] =
525 0, 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, 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, 1, 2, 3, 4,
551 5, 6, 7, 8, 9, 10, 11, 12, 13, 14,
552 15, 16, 17, 18, 19, 20, 21, 22, 23, 24,
553 25, 26, 27, 28, 29, 30, 31, 32, 33, 34,
554 35, 36, 37, 38, 39, 40
558 /* YYPRHS[YYN] -- Index of the first RHS symbol of rule number YYN in
560 static const yytype_uint8 yyprhs
[] =
562 0, 0, 3, 5, 6, 8, 12, 16, 20, 24,
563 26, 30, 33, 35, 37, 41, 45, 49, 53, 57,
564 61, 65, 69, 73, 77, 79, 81, 83, 85, 87,
565 89, 91, 93, 95, 97, 99, 101, 103, 105, 107,
566 109, 111, 113, 115, 117, 119, 121, 124, 127, 130,
570 /* YYRHS -- A `-1'-separated list of the rules' RHS. */
571 static const yytype_int8 yyrhs
[] =
573 42, 0, -1, 43, -1, -1, 44, -1, 43, 5,
574 44, -1, 43, 9, 44, -1, 43, 8, 44, -1,
575 43, 10, 44, -1, 45, -1, 44, 6, 45, -1,
576 7, 45, -1, 49, -1, 47, -1, 49, 46, 49,
577 -1, 50, 46, 49, -1, 49, 46, 50, -1, 50,
578 46, 50, -1, 50, 46, 48, -1, 48, 46, 50,
579 -1, 48, 46, 48, -1, 48, 46, 49, -1, 49,
580 46, 48, -1, 23, 43, 24, -1, 13, -1, 14,
581 -1, 11, -1, 12, -1, 16, -1, 15, -1, 26,
582 -1, 19, -1, 20, -1, 17, -1, 18, -1, 22,
583 -1, 21, -1, 27, -1, 30, -1, 31, -1, 28,
584 -1, 29, -1, 50, -1, 48, -1, 39, -1, 52,
585 -1, 33, 51, -1, 34, 51, -1, 35, 51, -1,
586 36, 51, -1, 51, -1, 32, 51, -1, 37, -1,
590 /* YYRLINE[YYN] -- source line where rule number YYN was defined. */
591 static const yytype_uint16 yyrline
[] =
593 0, 140, 140, 146, 153, 157, 161, 165, 169, 176,
594 180, 187, 191, 195, 200, 204, 213, 222, 226, 230,
595 234, 238, 243, 248, 256, 257, 258, 259, 260, 261,
596 262, 263, 264, 265, 266, 267, 268, 269, 270, 271,
597 272, 273, 277, 281, 288, 298, 302, 311, 320, 333,
602 #if YYDEBUG || YYERROR_VERBOSE || YYTOKEN_TABLE
603 /* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM.
604 First, the terminals, then, starting at YYNTOKENS, nonterminals. */
605 static const char *const yytname
[] =
607 "$end", "error", "$undefined", "COND_SPACE", "COND_EOF", "COND_OR",
608 "COND_AND", "COND_NOT", "COND_XOR", "COND_IMP", "COND_EQV", "COND_LT",
609 "COND_GT", "COND_EQ", "COND_NE", "COND_GE", "COND_LE", "COND_ILT",
610 "COND_IGT", "COND_IEQ", "COND_INE", "COND_IGE", "COND_ILE", "COND_LPAR",
611 "COND_RPAR", "COND_TILDA", "COND_SS", "COND_ISS", "COND_ILHS",
612 "COND_IRHS", "COND_LHS", "COND_RHS", "COND_PERCENT", "COND_DOLLARS",
613 "COND_QUESTION", "COND_AMPER", "COND_EXCLAM", "COND_IDENT",
614 "COND_NUMBER", "COND_LITER", "COND_ERROR", "$accept", "condition",
615 "expression", "boolean_term", "boolean_factor", "operator", "value_s",
616 "literal", "value_i", "symbol_s", "identifier", "integer", 0
621 /* YYTOKNUM[YYLEX-NUM] -- Internal token number corresponding to
623 static const yytype_uint16 yytoknum
[] =
625 0, 256, 257, 258, 259, 260, 261, 262, 263, 264,
626 265, 266, 267, 268, 269, 270, 271, 272, 273, 274,
627 275, 276, 277, 278, 279, 280, 281, 282, 283, 284,
628 285, 286, 287, 288, 289, 290, 291, 292, 293, 294,
633 /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */
634 static const yytype_uint8 yyr1
[] =
636 0, 41, 42, 42, 43, 43, 43, 43, 43, 44,
637 44, 45, 45, 45, 45, 45, 45, 45, 45, 45,
638 45, 45, 45, 45, 46, 46, 46, 46, 46, 46,
639 46, 46, 46, 46, 46, 46, 46, 46, 46, 46,
640 46, 46, 47, 47, 48, 49, 49, 49, 49, 49,
644 /* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */
645 static const yytype_uint8 yyr2
[] =
647 0, 2, 1, 0, 1, 3, 3, 3, 3, 1,
648 3, 2, 1, 1, 3, 3, 3, 3, 3, 3,
649 3, 3, 3, 3, 1, 1, 1, 1, 1, 1,
650 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
651 1, 1, 1, 1, 1, 1, 2, 2, 2, 2,
655 /* YYDEFACT[STATE-NAME] -- Default rule to reduce with in state
656 STATE-NUM when YYTABLE doesn't specify something else to do. Zero
657 means the default is an error. */
658 static const yytype_uint8 yydefact
[] =
660 3, 0, 0, 0, 0, 0, 0, 0, 52, 53,
661 44, 0, 2, 4, 9, 13, 43, 12, 42, 50,
662 45, 11, 0, 51, 46, 47, 48, 49, 1, 0,
663 0, 0, 0, 0, 26, 27, 24, 25, 29, 28,
664 33, 34, 31, 32, 36, 35, 30, 37, 40, 41,
665 38, 39, 0, 0, 0, 23, 5, 7, 6, 8,
666 10, 20, 21, 19, 22, 14, 16, 18, 15, 17
669 /* YYDEFGOTO[NTERM-NUM]. */
670 static const yytype_int8 yydefgoto
[] =
672 -1, 11, 12, 13, 14, 52, 15, 16, 17, 18,
676 /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
678 #define YYPACT_NINF -15
679 static const yytype_int8 yypact
[] =
681 -7, -7, -7, -14, -14, -14, -14, -14, -15, -15,
682 -15, 24, 46, 30, -15, -15, -9, -9, -9, -15,
683 -15, -15, 29, -15, -15, -15, -15, -15, -15, -7,
684 -7, -7, -7, -7, -15, -15, -15, -15, -15, -15,
685 -15, -15, -15, -15, -15, -15, -15, -15, -15, -15,
686 -15, -15, 8, 8, 8, -15, 30, 30, 30, 30,
687 -15, -15, -15, -15, -15, -15, -15, -15, -15, -15
690 /* YYPGOTO[NTERM-NUM]. */
691 static const yytype_int8 yypgoto
[] =
693 -15, -15, 50, 33, 0, -3, -15, -4, 14, 17,
697 /* YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If
698 positive, shift that token. If negative, reduce the rule which
699 number is the opposite. If zero, do what YYDEFACT says.
700 If YYTABLE_NINF, syntax error. */
701 #define YYTABLE_NINF -1
702 static const yytype_uint8 yytable
[] =
704 1, 21, 34, 35, 36, 37, 38, 39, 40, 41,
705 42, 43, 44, 45, 53, 54, 2, 46, 47, 48,
706 49, 50, 51, 8, 28, 3, 4, 5, 6, 7,
707 8, 9, 10, 60, 29, 0, 33, 30, 31, 32,
708 3, 4, 5, 6, 7, 8, 9, 10, 61, 64,
709 67, 29, 22, 55, 30, 31, 32, 23, 24, 25,
710 26, 27, 56, 57, 58, 59, 62, 65, 68, 63,
714 static const yytype_int8 yycheck
[] =
716 7, 1, 11, 12, 13, 14, 15, 16, 17, 18,
717 19, 20, 21, 22, 17, 18, 23, 26, 27, 28,
718 29, 30, 31, 37, 0, 32, 33, 34, 35, 36,
719 37, 38, 39, 33, 5, -1, 6, 8, 9, 10,
720 32, 33, 34, 35, 36, 37, 38, 39, 52, 53,
721 54, 5, 2, 24, 8, 9, 10, 3, 4, 5,
722 6, 7, 29, 30, 31, 32, 52, 53, 54, 52,
726 /* YYSTOS[STATE-NUM] -- The (internal number of the) accessing
727 symbol of state STATE-NUM. */
728 static const yytype_uint8 yystos
[] =
730 0, 7, 23, 32, 33, 34, 35, 36, 37, 38,
731 39, 42, 43, 44, 45, 47, 48, 49, 50, 51,
732 52, 45, 43, 51, 51, 51, 51, 51, 0, 5,
733 8, 9, 10, 6, 11, 12, 13, 14, 15, 16,
734 17, 18, 19, 20, 21, 22, 26, 27, 28, 29,
735 30, 31, 46, 46, 46, 24, 44, 44, 44, 44,
736 45, 48, 49, 50, 48, 49, 50, 48, 49, 50
739 #define yyerrok (yyerrstatus = 0)
740 #define yyclearin (yychar = YYEMPTY)
744 #define YYACCEPT goto yyacceptlab
745 #define YYABORT goto yyabortlab
746 #define YYERROR goto yyerrorlab
749 /* Like YYERROR except do call yyerror. This remains here temporarily
750 to ease the transition to the new meaning of YYERROR, for GCC.
751 Once GCC version 2 has supplanted version 1, this can go. */
753 #define YYFAIL goto yyerrlab
755 #define YYRECOVERING() (!!yyerrstatus)
757 #define YYBACKUP(Token, Value) \
759 if (yychar == YYEMPTY && yylen == 1) \
763 yytoken = YYTRANSLATE (yychar); \
769 yyerror (YY_("syntax error: cannot back up")); \
776 #define YYERRCODE 256
779 /* YYLLOC_DEFAULT -- Set CURRENT to span from RHS[1] to RHS[N].
780 If N is 0, then set CURRENT to the empty location which ends
781 the previous symbol: RHS[0] (always defined). */
783 #define YYRHSLOC(Rhs, K) ((Rhs)[K])
784 #ifndef YYLLOC_DEFAULT
785 # define YYLLOC_DEFAULT(Current, Rhs, N) \
789 (Current).first_line = YYRHSLOC (Rhs, 1).first_line; \
790 (Current).first_column = YYRHSLOC (Rhs, 1).first_column; \
791 (Current).last_line = YYRHSLOC (Rhs, N).last_line; \
792 (Current).last_column = YYRHSLOC (Rhs, N).last_column; \
796 (Current).first_line = (Current).last_line = \
797 YYRHSLOC (Rhs, 0).last_line; \
798 (Current).first_column = (Current).last_column = \
799 YYRHSLOC (Rhs, 0).last_column; \
805 /* YY_LOCATION_PRINT -- Print the location on the stream.
806 This macro was not mandated originally: define only if we know
807 we won't break user code: when these are the locations we know. */
809 #ifndef YY_LOCATION_PRINT
810 # if YYLTYPE_IS_TRIVIAL
811 # define YY_LOCATION_PRINT(File, Loc) \
812 fprintf (File, "%d.%d-%d.%d", \
813 (Loc).first_line, (Loc).first_column, \
814 (Loc).last_line, (Loc).last_column)
816 # define YY_LOCATION_PRINT(File, Loc) ((void) 0)
821 /* YYLEX -- calling `yylex' with the right arguments. */
824 # define YYLEX yylex (&yylval, YYLEX_PARAM)
826 # define YYLEX yylex (&yylval)
829 /* Enable debugging if requested. */
833 # include <stdio.h> /* INFRINGES ON USER NAME SPACE */
834 # define YYFPRINTF fprintf
837 # define YYDPRINTF(Args) \
843 # define YY_SYMBOL_PRINT(Title, Type, Value, Location) \
847 YYFPRINTF (stderr, "%s ", Title); \
848 yy_symbol_print (stderr, \
850 YYFPRINTF (stderr, "\n"); \
855 /*--------------------------------.
856 | Print this symbol on YYOUTPUT. |
857 `--------------------------------*/
860 #if (defined __STDC__ || defined __C99__FUNC__ \
861 || defined __cplusplus || defined _MSC_VER)
863 yy_symbol_value_print (FILE *yyoutput
, int yytype
, YYSTYPE
const * const yyvaluep
)
866 yy_symbol_value_print (yyoutput
, yytype
, yyvaluep
)
869 YYSTYPE
const * const yyvaluep
;
875 if (yytype
< YYNTOKENS
)
876 YYPRINT (yyoutput
, yytoknum
[yytype
], *yyvaluep
);
888 /*--------------------------------.
889 | Print this symbol on YYOUTPUT. |
890 `--------------------------------*/
892 #if (defined __STDC__ || defined __C99__FUNC__ \
893 || defined __cplusplus || defined _MSC_VER)
895 yy_symbol_print (FILE *yyoutput
, int yytype
, YYSTYPE
const * const yyvaluep
)
898 yy_symbol_print (yyoutput
, yytype
, yyvaluep
)
901 YYSTYPE
const * const yyvaluep
;
904 if (yytype
< YYNTOKENS
)
905 YYFPRINTF (yyoutput
, "token %s (", yytname
[yytype
]);
907 YYFPRINTF (yyoutput
, "nterm %s (", yytname
[yytype
]);
909 yy_symbol_value_print (yyoutput
, yytype
, yyvaluep
);
910 YYFPRINTF (yyoutput
, ")");
913 /*------------------------------------------------------------------.
914 | yy_stack_print -- Print the state stack from its BOTTOM up to its |
916 `------------------------------------------------------------------*/
918 #if (defined __STDC__ || defined __C99__FUNC__ \
919 || defined __cplusplus || defined _MSC_VER)
921 yy_stack_print (yytype_int16
*yybottom
, yytype_int16
*yytop
)
924 yy_stack_print (yybottom
, yytop
)
925 yytype_int16
*yybottom
;
929 YYFPRINTF (stderr
, "Stack now");
930 for (; yybottom
<= yytop
; yybottom
++)
932 int yybot
= *yybottom
;
933 YYFPRINTF (stderr
, " %d", yybot
);
935 YYFPRINTF (stderr
, "\n");
938 # define YY_STACK_PRINT(Bottom, Top) \
941 yy_stack_print ((Bottom), (Top)); \
945 /*------------------------------------------------.
946 | Report that the YYRULE is going to be reduced. |
947 `------------------------------------------------*/
949 #if (defined __STDC__ || defined __C99__FUNC__ \
950 || defined __cplusplus || defined _MSC_VER)
952 yy_reduce_print (YYSTYPE
*yyvsp
, int yyrule
)
955 yy_reduce_print (yyvsp
, yyrule
)
960 int yynrhs
= yyr2
[yyrule
];
962 unsigned long int yylno
= yyrline
[yyrule
];
963 YYFPRINTF (stderr
, "Reducing stack by rule %d (line %lu):\n",
965 /* The symbols being reduced. */
966 for (yyi
= 0; yyi
< yynrhs
; yyi
++)
968 YYFPRINTF (stderr
, " $%d = ", yyi
+ 1);
969 yy_symbol_print (stderr
, yyrhs
[yyprhs
[yyrule
] + yyi
],
970 &(yyvsp
[(yyi
+ 1) - (yynrhs
)])
972 YYFPRINTF (stderr
, "\n");
976 # define YY_REDUCE_PRINT(Rule) \
979 yy_reduce_print (yyvsp, Rule); \
982 /* Nonzero means print parse trace. It is left uninitialized so that
983 multiple parsers can coexist. */
986 # define YYDPRINTF(Args)
987 # define YY_SYMBOL_PRINT(Title, Type, Value, Location)
988 # define YY_STACK_PRINT(Bottom, Top)
989 # define YY_REDUCE_PRINT(Rule)
990 #endif /* !YYDEBUG */
993 /* YYINITDEPTH -- initial size of the parser's stacks. */
995 # define YYINITDEPTH 200
998 /* YYMAXDEPTH -- maximum size the stacks can grow to (effective only
999 if the built-in stack extension method is used).
1001 Do not make this value too large; the results are undefined if
1002 YYSTACK_ALLOC_MAXIMUM < YYSTACK_BYTES (YYMAXDEPTH)
1003 evaluated with infinite-precision integer arithmetic. */
1006 # define YYMAXDEPTH 10000
1014 # if defined __GLIBC__ && defined _STRING_H
1015 # define yystrlen strlen
1017 /* Return the length of YYSTR. */
1018 #if (defined __STDC__ || defined __C99__FUNC__ \
1019 || defined __cplusplus || defined _MSC_VER)
1021 yystrlen (const char *yystr
)
1029 for (yylen
= 0; yystr
[yylen
]; yylen
++)
1037 # if defined __GLIBC__ && defined _STRING_H && defined _GNU_SOURCE
1038 # define yystpcpy stpcpy
1040 /* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in
1042 #if (defined __STDC__ || defined __C99__FUNC__ \
1043 || defined __cplusplus || defined _MSC_VER)
1045 yystpcpy (char *yydest
, const char *yysrc
)
1048 yystpcpy (yydest
, yysrc
)
1054 const char *yys
= yysrc
;
1056 while ((*yyd
++ = *yys
++) != '\0')
1065 /* Copy to YYRES the contents of YYSTR after stripping away unnecessary
1066 quotes and backslashes, so that it's suitable for yyerror. The
1067 heuristic is that double-quoting is unnecessary unless the string
1068 contains an apostrophe, a comma, or backslash (other than
1069 backslash-backslash). YYSTR is taken from yytname. If YYRES is
1070 null, do not copy; instead, return the length of what the result
1073 yytnamerr (char *yyres
, const char *yystr
)
1078 char const *yyp
= yystr
;
1085 goto do_not_strip_quotes
;
1089 goto do_not_strip_quotes
;
1102 do_not_strip_quotes
: ;
1106 return yystrlen (yystr
);
1108 return yystpcpy (yyres
, yystr
) - yyres
;
1112 /* Copy into YYRESULT an error message about the unexpected token
1113 YYCHAR while in state YYSTATE. Return the number of bytes copied,
1114 including the terminating null byte. If YYRESULT is null, do not
1115 copy anything; just return the number of bytes that would be
1116 copied. As a special case, return 0 if an ordinary "syntax error"
1117 message will do. Return YYSIZE_MAXIMUM if overflow occurs during
1118 size calculation. */
1120 yysyntax_error (char *yyresult
, int yystate
, int yychar
)
1122 int yyn
= yypact
[yystate
];
1124 if (! (YYPACT_NINF
< yyn
&& yyn
<= YYLAST
))
1128 int yytype
= YYTRANSLATE (yychar
);
1129 YYSIZE_T yysize0
= yytnamerr (0, yytname
[yytype
]);
1130 YYSIZE_T yysize
= yysize0
;
1132 int yysize_overflow
= 0;
1133 enum { YYERROR_VERBOSE_ARGS_MAXIMUM
= 5 };
1134 char const *yyarg
[YYERROR_VERBOSE_ARGS_MAXIMUM
];
1138 /* This is so xgettext sees the translatable formats that are
1139 constructed on the fly. */
1140 YY_("syntax error, unexpected %s");
1141 YY_("syntax error, unexpected %s, expecting %s");
1142 YY_("syntax error, unexpected %s, expecting %s or %s");
1143 YY_("syntax error, unexpected %s, expecting %s or %s or %s");
1144 YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s");
1148 static char const yyunexpected
[] = "syntax error, unexpected %s";
1149 static char const yyexpecting
[] = ", expecting %s";
1150 static char const yyor
[] = " or %s";
1151 char yyformat
[sizeof yyunexpected
1152 + sizeof yyexpecting
- 1
1153 + ((YYERROR_VERBOSE_ARGS_MAXIMUM
- 2)
1154 * (sizeof yyor
- 1))];
1155 char const *yyprefix
= yyexpecting
;
1157 /* Start YYX at -YYN if negative to avoid negative indexes in
1159 int yyxbegin
= yyn
< 0 ? -yyn
: 0;
1161 /* Stay within bounds of both yycheck and yytname. */
1162 int yychecklim
= YYLAST
- yyn
+ 1;
1163 int yyxend
= yychecklim
< YYNTOKENS
? yychecklim
: YYNTOKENS
;
1166 yyarg
[0] = yytname
[yytype
];
1167 yyfmt
= yystpcpy (yyformat
, yyunexpected
);
1169 for (yyx
= yyxbegin
; yyx
< yyxend
; ++yyx
)
1170 if (yycheck
[yyx
+ yyn
] == yyx
&& yyx
!= YYTERROR
)
1172 if (yycount
== YYERROR_VERBOSE_ARGS_MAXIMUM
)
1176 yyformat
[sizeof yyunexpected
- 1] = '\0';
1179 yyarg
[yycount
++] = yytname
[yyx
];
1180 yysize1
= yysize
+ yytnamerr (0, yytname
[yyx
]);
1181 yysize_overflow
|= (yysize1
< yysize
);
1183 yyfmt
= yystpcpy (yyfmt
, yyprefix
);
1187 yyf
= YY_(yyformat
);
1188 yysize1
= yysize
+ yystrlen (yyf
);
1189 yysize_overflow
|= (yysize1
< yysize
);
1192 if (yysize_overflow
)
1193 return YYSIZE_MAXIMUM
;
1197 /* Avoid sprintf, as that infringes on the user's name space.
1198 Don't have undefined behavior even if the translation
1199 produced a string with the wrong number of "%s"s. */
1200 char *yyp
= yyresult
;
1202 while ((*yyp
= *yyf
) != '\0')
1204 if (*yyp
== '%' && yyf
[1] == 's' && yyi
< yycount
)
1206 yyp
+= yytnamerr (yyp
, yyarg
[yyi
++]);
1219 #endif /* YYERROR_VERBOSE */
1222 /*-----------------------------------------------.
1223 | Release the memory associated to this symbol. |
1224 `-----------------------------------------------*/
1227 #if (defined __STDC__ || defined __C99__FUNC__ \
1228 || defined __cplusplus || defined _MSC_VER)
1230 yydestruct (const char *yymsg
, int yytype
, YYSTYPE
*yyvaluep
)
1233 yydestruct (yymsg
, yytype
, yyvaluep
)
1243 YY_SYMBOL_PRINT (yymsg
, yytype
, yyvaluep
, yylocationp
);
1253 /* Prevent warnings from -Wmissing-prototypes. */
1254 #ifdef YYPARSE_PARAM
1255 #if defined __STDC__ || defined __cplusplus
1256 int yyparse (void *YYPARSE_PARAM
);
1260 #else /* ! YYPARSE_PARAM */
1261 #if defined __STDC__ || defined __cplusplus
1266 #endif /* ! YYPARSE_PARAM */
1272 /*-------------------------.
1273 | yyparse or yypush_parse. |
1274 `-------------------------*/
1276 #ifdef YYPARSE_PARAM
1277 #if (defined __STDC__ || defined __C99__FUNC__ \
1278 || defined __cplusplus || defined _MSC_VER)
1280 yyparse (void *YYPARSE_PARAM
)
1283 yyparse (YYPARSE_PARAM
)
1284 void *YYPARSE_PARAM
;
1286 #else /* ! YYPARSE_PARAM */
1287 #if (defined __STDC__ || defined __C99__FUNC__ \
1288 || defined __cplusplus || defined _MSC_VER)
1298 /* The lookahead symbol. */
1301 /* The semantic value of the lookahead symbol. */
1304 /* Number of syntax errors so far. */
1308 /* Number of tokens to shift before error messages enabled. */
1311 /* The stacks and their tools:
1312 `yyss': related to states.
1313 `yyvs': related to semantic values.
1315 Refer to the stacks thru separate pointers, to allow yyoverflow
1316 to reallocate them elsewhere. */
1318 /* The state stack. */
1319 yytype_int16 yyssa
[YYINITDEPTH
];
1321 yytype_int16
*yyssp
;
1323 /* The semantic value stack. */
1324 YYSTYPE yyvsa
[YYINITDEPTH
];
1328 YYSIZE_T yystacksize
;
1332 /* Lookahead token as an internal (translated) token number. */
1334 /* The variables used to return semantic value and location from the
1339 /* Buffer for error messages, and its allocated size. */
1341 char *yymsg
= yymsgbuf
;
1342 YYSIZE_T yymsg_alloc
= sizeof yymsgbuf
;
1345 #define YYPOPSTACK(N) (yyvsp -= (N), yyssp -= (N))
1347 /* The number of symbols on the RHS of the reduced rule.
1348 Keep to zero when no symbol should be popped. */
1354 yystacksize
= YYINITDEPTH
;
1356 YYDPRINTF ((stderr
, "Starting parse\n"));
1361 yychar
= YYEMPTY
; /* Cause a token to be read. */
1363 /* Initialize stack pointers.
1364 Waste one element of value and location stack
1365 so that they stay on the same level as the state stack.
1366 The wasted elements are never initialized. */
1372 /*------------------------------------------------------------.
1373 | yynewstate -- Push a new state, which is found in yystate. |
1374 `------------------------------------------------------------*/
1376 /* In all cases, when you get here, the value and location stacks
1377 have just been pushed. So pushing a state here evens the stacks. */
1383 if (yyss
+ yystacksize
- 1 <= yyssp
)
1385 /* Get the current used size of the three stacks, in elements. */
1386 YYSIZE_T yysize
= yyssp
- yyss
+ 1;
1390 /* Give user a chance to reallocate the stack. Use copies of
1391 these so that the &'s don't force the real ones into
1393 YYSTYPE
*yyvs1
= yyvs
;
1394 yytype_int16
*yyss1
= yyss
;
1396 /* Each stack pointer address is followed by the size of the
1397 data in use in that stack, in bytes. This used to be a
1398 conditional around just the two extra args, but that might
1399 be undefined if yyoverflow is a macro. */
1400 yyoverflow (YY_("memory exhausted"),
1401 &yyss1
, yysize
* sizeof (*yyssp
),
1402 &yyvs1
, yysize
* sizeof (*yyvsp
),
1408 #else /* no yyoverflow */
1409 # ifndef YYSTACK_RELOCATE
1410 goto yyexhaustedlab
;
1412 /* Extend the stack our own way. */
1413 if (YYMAXDEPTH
<= yystacksize
)
1414 goto yyexhaustedlab
;
1416 if (YYMAXDEPTH
< yystacksize
)
1417 yystacksize
= YYMAXDEPTH
;
1420 yytype_int16
*yyss1
= yyss
;
1421 union yyalloc
*yyptr
=
1422 (union yyalloc
*) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize
));
1424 goto yyexhaustedlab
;
1425 YYSTACK_RELOCATE (yyss_alloc
, yyss
);
1426 YYSTACK_RELOCATE (yyvs_alloc
, yyvs
);
1427 # undef YYSTACK_RELOCATE
1429 YYSTACK_FREE (yyss1
);
1432 #endif /* no yyoverflow */
1434 yyssp
= yyss
+ yysize
- 1;
1435 yyvsp
= yyvs
+ yysize
- 1;
1437 YYDPRINTF ((stderr
, "Stack size increased to %lu\n",
1438 (unsigned long int) yystacksize
));
1440 if (yyss
+ yystacksize
- 1 <= yyssp
)
1444 YYDPRINTF ((stderr
, "Entering state %d\n", yystate
));
1446 if (yystate
== YYFINAL
)
1456 /* Do appropriate processing given the current state. Read a
1457 lookahead token if we need one and don't already have one. */
1459 /* First try to decide what to do without reference to lookahead token. */
1460 yyn
= yypact
[yystate
];
1461 if (yyn
== YYPACT_NINF
)
1464 /* Not known => get a lookahead token if don't already have one. */
1466 /* YYCHAR is either YYEMPTY or YYEOF or a valid lookahead symbol. */
1467 if (yychar
== YYEMPTY
)
1469 YYDPRINTF ((stderr
, "Reading a token: "));
1473 if (yychar
<= YYEOF
)
1475 yychar
= yytoken
= YYEOF
;
1476 YYDPRINTF ((stderr
, "Now at end of input.\n"));
1480 yytoken
= YYTRANSLATE (yychar
);
1481 YY_SYMBOL_PRINT ("Next token is", yytoken
, &yylval
, &yylloc
);
1484 /* If the proper action on seeing token YYTOKEN is to reduce or to
1485 detect an error, take that action. */
1487 if (yyn
< 0 || YYLAST
< yyn
|| yycheck
[yyn
] != yytoken
)
1492 if (yyn
== 0 || yyn
== YYTABLE_NINF
)
1498 /* Count tokens shifted since error; after three, turn off error
1503 /* Shift the lookahead token. */
1504 YY_SYMBOL_PRINT ("Shifting", yytoken
, &yylval
, &yylloc
);
1506 /* Discard the shifted token. */
1515 /*-----------------------------------------------------------.
1516 | yydefault -- do the default action for the current state. |
1517 `-----------------------------------------------------------*/
1519 yyn
= yydefact
[yystate
];
1525 /*-----------------------------.
1526 | yyreduce -- Do a reduction. |
1527 `-----------------------------*/
1529 /* yyn is the number of a rule to reduce with. */
1532 /* If YYLEN is nonzero, implement the default value of the action:
1535 Otherwise, the following line sets YYVAL to garbage.
1536 This behavior is undocumented and Bison
1537 users should not rely upon it. Assigning to YYVAL
1538 unconditionally makes the parser a bit smaller, and it avoids a
1539 GCC warning that YYVAL may be used uninitialized. */
1540 yyval
= yyvsp
[1-yylen
];
1543 YY_REDUCE_PRINT (yyn
);
1548 /* Line 1455 of yacc.c */
1551 COND_input
* cond
= (COND_input
*) info
;
1552 cond
->result
= (yyvsp
[(1) - (1)].value
);
1558 /* Line 1455 of yacc.c */
1561 COND_input
* cond
= (COND_input
*) info
;
1562 cond
->result
= MSICONDITION_NONE
;
1568 /* Line 1455 of yacc.c */
1571 (yyval
.value
) = (yyvsp
[(1) - (1)].value
);
1577 /* Line 1455 of yacc.c */
1580 (yyval
.value
) = (yyvsp
[(1) - (3)].value
) || (yyvsp
[(3) - (3)].value
);
1586 /* Line 1455 of yacc.c */
1589 (yyval
.value
) = !(yyvsp
[(1) - (3)].value
) || (yyvsp
[(3) - (3)].value
);
1595 /* Line 1455 of yacc.c */
1598 (yyval
.value
) = ( (yyvsp
[(1) - (3)].value
) || (yyvsp
[(3) - (3)].value
) ) && !( (yyvsp
[(1) - (3)].value
) && (yyvsp
[(3) - (3)].value
) );
1604 /* Line 1455 of yacc.c */
1607 (yyval
.value
) = ( (yyvsp
[(1) - (3)].value
) && (yyvsp
[(3) - (3)].value
) ) || ( !(yyvsp
[(1) - (3)].value
) && !(yyvsp
[(3) - (3)].value
) );
1613 /* Line 1455 of yacc.c */
1616 (yyval
.value
) = (yyvsp
[(1) - (1)].value
);
1622 /* Line 1455 of yacc.c */
1625 (yyval
.value
) = (yyvsp
[(1) - (3)].value
) && (yyvsp
[(3) - (3)].value
);
1631 /* Line 1455 of yacc.c */
1634 (yyval
.value
) = (yyvsp
[(2) - (2)].value
) ? 0 : 1;
1640 /* Line 1455 of yacc.c */
1643 (yyval
.value
) = (yyvsp
[(1) - (1)].value
) ? 1 : 0;
1649 /* Line 1455 of yacc.c */
1652 (yyval
.value
) = ((yyvsp
[(1) - (1)].string
) && (yyvsp
[(1) - (1)].string
)[0]) ? 1 : 0;
1653 cond_free( (yyvsp
[(1) - (1)].string
) );
1659 /* Line 1455 of yacc.c */
1662 (yyval
.value
) = compare_int( (yyvsp
[(1) - (3)].value
), (yyvsp
[(2) - (3)].value
), (yyvsp
[(3) - (3)].value
) );
1668 /* Line 1455 of yacc.c */
1672 if (num_from_prop( (yyvsp
[(1) - (3)].string
), &num
))
1673 (yyval
.value
) = compare_int( num
, (yyvsp
[(2) - (3)].value
), (yyvsp
[(3) - (3)].value
) );
1675 (yyval
.value
) = ((yyvsp
[(2) - (3)].value
) == COND_NE
|| (yyvsp
[(2) - (3)].value
) == COND_INE
);
1676 cond_free( (yyvsp
[(1) - (3)].string
) );
1682 /* Line 1455 of yacc.c */
1686 if (num_from_prop( (yyvsp
[(3) - (3)].string
), &num
))
1687 (yyval
.value
) = compare_int( (yyvsp
[(1) - (3)].value
), (yyvsp
[(2) - (3)].value
), num
);
1689 (yyval
.value
) = ((yyvsp
[(2) - (3)].value
) == COND_NE
|| (yyvsp
[(2) - (3)].value
) == COND_INE
);
1690 cond_free( (yyvsp
[(3) - (3)].string
) );
1696 /* Line 1455 of yacc.c */
1699 (yyval
.value
) = compare_and_free_strings( (yyvsp
[(1) - (3)].string
), (yyvsp
[(2) - (3)].value
), (yyvsp
[(3) - (3)].string
), TRUE
);
1705 /* Line 1455 of yacc.c */
1708 (yyval
.value
) = compare_and_free_strings( (yyvsp
[(1) - (3)].string
), (yyvsp
[(2) - (3)].value
), (yyvsp
[(3) - (3)].string
), TRUE
);
1714 /* Line 1455 of yacc.c */
1717 (yyval
.value
) = compare_and_free_strings( (yyvsp
[(1) - (3)].string
), (yyvsp
[(2) - (3)].value
), (yyvsp
[(3) - (3)].string
), TRUE
);
1723 /* Line 1455 of yacc.c */
1726 (yyval
.value
) = compare_and_free_strings( (yyvsp
[(1) - (3)].string
), (yyvsp
[(2) - (3)].value
), (yyvsp
[(3) - (3)].string
), FALSE
);
1732 /* Line 1455 of yacc.c */
1736 cond_free( (yyvsp
[(1) - (3)].string
) );
1742 /* Line 1455 of yacc.c */
1746 cond_free( (yyvsp
[(3) - (3)].string
) );
1752 /* Line 1455 of yacc.c */
1755 (yyval
.value
) = (yyvsp
[(2) - (3)].value
);
1761 /* Line 1455 of yacc.c */
1763 { (yyval
.value
) = COND_EQ
; ;}
1768 /* Line 1455 of yacc.c */
1770 { (yyval
.value
) = COND_NE
; ;}
1775 /* Line 1455 of yacc.c */
1777 { (yyval
.value
) = COND_LT
; ;}
1782 /* Line 1455 of yacc.c */
1784 { (yyval
.value
) = COND_GT
; ;}
1789 /* Line 1455 of yacc.c */
1791 { (yyval
.value
) = COND_LE
; ;}
1796 /* Line 1455 of yacc.c */
1798 { (yyval
.value
) = COND_GE
; ;}
1803 /* Line 1455 of yacc.c */
1805 { (yyval
.value
) = COND_SS
; ;}
1810 /* Line 1455 of yacc.c */
1812 { (yyval
.value
) = COND_IEQ
; ;}
1817 /* Line 1455 of yacc.c */
1819 { (yyval
.value
) = COND_INE
; ;}
1824 /* Line 1455 of yacc.c */
1826 { (yyval
.value
) = COND_ILT
; ;}
1831 /* Line 1455 of yacc.c */
1833 { (yyval
.value
) = COND_IGT
; ;}
1838 /* Line 1455 of yacc.c */
1840 { (yyval
.value
) = COND_ILE
; ;}
1845 /* Line 1455 of yacc.c */
1847 { (yyval
.value
) = COND_IGE
; ;}
1852 /* Line 1455 of yacc.c */
1854 { (yyval
.value
) = COND_ISS
; ;}
1859 /* Line 1455 of yacc.c */
1861 { (yyval
.value
) = COND_LHS
; ;}
1866 /* Line 1455 of yacc.c */
1868 { (yyval
.value
) = COND_RHS
; ;}
1873 /* Line 1455 of yacc.c */
1875 { (yyval
.value
) = COND_ILHS
; ;}
1880 /* Line 1455 of yacc.c */
1882 { (yyval
.value
) = COND_IRHS
; ;}
1887 /* Line 1455 of yacc.c */
1890 (yyval
.string
) = (yyvsp
[(1) - (1)].string
);
1896 /* Line 1455 of yacc.c */
1899 (yyval
.string
) = (yyvsp
[(1) - (1)].string
);
1905 /* Line 1455 of yacc.c */
1908 COND_input
* cond
= (COND_input
*) info
;
1909 (yyval
.string
) = COND_GetLiteral( cond
, &(yyvsp
[(1) - (1)].str
) );
1910 if( !(yyval
.string
) )
1917 /* Line 1455 of yacc.c */
1920 (yyval
.value
) = (yyvsp
[(1) - (1)].value
);
1926 /* Line 1455 of yacc.c */
1929 COND_input
* cond
= (COND_input
*) info
;
1930 INSTALLSTATE install
= INSTALLSTATE_UNKNOWN
, action
= INSTALLSTATE_UNKNOWN
;
1932 MSI_GetComponentStateW(cond
->package
, (yyvsp
[(2) - (2)].string
), &install
, &action
);
1933 (yyval
.value
) = action
;
1934 cond_free( (yyvsp
[(2) - (2)].string
) );
1940 /* Line 1455 of yacc.c */
1943 COND_input
* cond
= (COND_input
*) info
;
1944 INSTALLSTATE install
= INSTALLSTATE_UNKNOWN
, action
= INSTALLSTATE_UNKNOWN
;
1946 MSI_GetComponentStateW(cond
->package
, (yyvsp
[(2) - (2)].string
), &install
, &action
);
1947 (yyval
.value
) = install
;
1948 cond_free( (yyvsp
[(2) - (2)].string
) );
1954 /* Line 1455 of yacc.c */
1957 COND_input
* cond
= (COND_input
*) info
;
1958 INSTALLSTATE install
= INSTALLSTATE_UNKNOWN
, action
= INSTALLSTATE_UNKNOWN
;
1960 MSI_GetFeatureStateW(cond
->package
, (yyvsp
[(2) - (2)].string
), &install
, &action
);
1961 if (action
== INSTALLSTATE_UNKNOWN
)
1962 (yyval
.value
) = MSICONDITION_FALSE
;
1964 (yyval
.value
) = action
;
1966 cond_free( (yyvsp
[(2) - (2)].string
) );
1972 /* Line 1455 of yacc.c */
1975 COND_input
* cond
= (COND_input
*) info
;
1976 INSTALLSTATE install
= INSTALLSTATE_UNKNOWN
, action
= INSTALLSTATE_UNKNOWN
;
1978 MSI_GetFeatureStateW(cond
->package
, (yyvsp
[(2) - (2)].string
), &install
, &action
);
1979 (yyval
.value
) = install
;
1980 cond_free( (yyvsp
[(2) - (2)].string
) );
1986 /* Line 1455 of yacc.c */
1989 COND_input
* cond
= (COND_input
*) info
;
1992 (yyval
.string
) = msi_dup_property( cond
->package
->db
, (yyvsp
[(1) - (1)].string
) );
1995 len
= (lstrlenW((yyval
.string
)) + 1) * sizeof (WCHAR
);
1996 (yyval
.string
) = cond_track_mem( cond
, (yyval
.string
), len
);
1998 cond_free( (yyvsp
[(1) - (1)].string
) );
2004 /* Line 1455 of yacc.c */
2007 COND_input
* cond
= (COND_input
*) info
;
2008 UINT len
= GetEnvironmentVariableW( (yyvsp
[(2) - (2)].string
), NULL
, 0 );
2009 (yyval
.string
) = NULL
;
2012 (yyval
.string
) = cond_alloc( cond
, len
*sizeof (WCHAR
) );
2013 if( !(yyval
.string
) )
2015 GetEnvironmentVariableW( (yyvsp
[(2) - (2)].string
), (yyval
.string
), len
);
2017 cond_free( (yyvsp
[(2) - (2)].string
) );
2023 /* Line 1455 of yacc.c */
2026 COND_input
* cond
= (COND_input
*) info
;
2027 (yyval
.string
) = COND_GetString( cond
, &(yyvsp
[(1) - (1)].str
) );
2028 if( !(yyval
.string
) )
2035 /* Line 1455 of yacc.c */
2038 COND_input
* cond
= (COND_input
*) info
;
2039 LPWSTR szNum
= COND_GetString( cond
, &(yyvsp
[(1) - (1)].str
) );
2042 (yyval
.value
) = atoiW( szNum
);
2049 /* Line 1455 of yacc.c */
2050 #line 2051 "cond.tab.c"
2053 YY_SYMBOL_PRINT ("-> $$ =", yyr1
[yyn
], &yyval
, &yyloc
);
2057 YY_STACK_PRINT (yyss
, yyssp
);
2061 /* Now `shift' the result of the reduction. Determine what state
2062 that goes to, based on the state we popped back to and the rule
2063 number reduced by. */
2067 yystate
= yypgoto
[yyn
- YYNTOKENS
] + *yyssp
;
2068 if (0 <= yystate
&& yystate
<= YYLAST
&& yycheck
[yystate
] == *yyssp
)
2069 yystate
= yytable
[yystate
];
2071 yystate
= yydefgoto
[yyn
- YYNTOKENS
];
2076 /*------------------------------------.
2077 | yyerrlab -- here on detecting error |
2078 `------------------------------------*/
2080 /* If not already recovering from an error, report this error. */
2084 #if ! YYERROR_VERBOSE
2085 yyerror (YY_("syntax error"));
2088 YYSIZE_T yysize
= yysyntax_error (0, yystate
, yychar
);
2089 if (yymsg_alloc
< yysize
&& yymsg_alloc
< YYSTACK_ALLOC_MAXIMUM
)
2091 YYSIZE_T yyalloc
= 2 * yysize
;
2092 if (! (yysize
<= yyalloc
&& yyalloc
<= YYSTACK_ALLOC_MAXIMUM
))
2093 yyalloc
= YYSTACK_ALLOC_MAXIMUM
;
2094 if (yymsg
!= yymsgbuf
)
2095 YYSTACK_FREE (yymsg
);
2096 yymsg
= (char *) YYSTACK_ALLOC (yyalloc
);
2098 yymsg_alloc
= yyalloc
;
2102 yymsg_alloc
= sizeof yymsgbuf
;
2106 if (0 < yysize
&& yysize
<= yymsg_alloc
)
2108 (void) yysyntax_error (yymsg
, yystate
, yychar
);
2113 yyerror (YY_("syntax error"));
2115 goto yyexhaustedlab
;
2123 if (yyerrstatus
== 3)
2125 /* If just tried and failed to reuse lookahead token after an
2126 error, discard it. */
2128 if (yychar
<= YYEOF
)
2130 /* Return failure if at end of input. */
2131 if (yychar
== YYEOF
)
2136 yydestruct ("Error: discarding",
2142 /* Else will try to reuse lookahead token after shifting the error
2147 /*---------------------------------------------------.
2148 | yyerrorlab -- error raised explicitly by YYERROR. |
2149 `---------------------------------------------------*/
2152 /* Pacify compilers like GCC when the user code never invokes
2153 YYERROR and the label yyerrorlab therefore never appears in user
2155 if (/*CONSTCOND*/ 0)
2158 /* Do not reclaim the symbols of the rule which action triggered
2162 YY_STACK_PRINT (yyss
, yyssp
);
2167 /*-------------------------------------------------------------.
2168 | yyerrlab1 -- common code for both syntax error and YYERROR. |
2169 `-------------------------------------------------------------*/
2171 yyerrstatus
= 3; /* Each real token shifted decrements this. */
2175 yyn
= yypact
[yystate
];
2176 if (yyn
!= YYPACT_NINF
)
2179 if (0 <= yyn
&& yyn
<= YYLAST
&& yycheck
[yyn
] == YYTERROR
)
2187 /* Pop the current state because it cannot handle the error token. */
2192 yydestruct ("Error: popping",
2193 yystos
[yystate
], yyvsp
);
2196 YY_STACK_PRINT (yyss
, yyssp
);
2202 /* Shift the error token. */
2203 YY_SYMBOL_PRINT ("Shifting", yystos
[yyn
], yyvsp
, yylsp
);
2209 /*-------------------------------------.
2210 | yyacceptlab -- YYACCEPT comes here. |
2211 `-------------------------------------*/
2216 /*-----------------------------------.
2217 | yyabortlab -- YYABORT comes here. |
2218 `-----------------------------------*/
2223 #if !defined(yyoverflow) || YYERROR_VERBOSE
2224 /*-------------------------------------------------.
2225 | yyexhaustedlab -- memory exhaustion comes here. |
2226 `-------------------------------------------------*/
2228 yyerror (YY_("memory exhausted"));
2234 if (yychar
!= YYEMPTY
)
2235 yydestruct ("Cleanup: discarding lookahead",
2237 /* Do not reclaim the symbols of the rule which action triggered
2238 this YYABORT or YYACCEPT. */
2240 YY_STACK_PRINT (yyss
, yyssp
);
2241 while (yyssp
!= yyss
)
2243 yydestruct ("Cleanup: popping",
2244 yystos
[*yyssp
], yyvsp
);
2249 YYSTACK_FREE (yyss
);
2252 if (yymsg
!= yymsgbuf
)
2253 YYSTACK_FREE (yymsg
);
2255 /* Make sure YYID is used. */
2256 return YYID (yyresult
);
2261 /* Line 1675 of yacc.c */
2266 static int COND_IsAlpha( WCHAR x
)
2268 return( ( ( x
>= 'A' ) && ( x
<= 'Z' ) ) ||
2269 ( ( x
>= 'a' ) && ( x
<= 'z' ) ) ||
2273 static int COND_IsNumber( WCHAR x
)
2275 return( (( x
>= '0' ) && ( x
<= '9' )) || (x
=='-') || (x
=='.') );
2278 static WCHAR
*strstriW( const WCHAR
*str
, const WCHAR
*sub
)
2280 LPWSTR strlower
, sublower
, r
;
2281 strlower
= CharLowerW( strdupW( str
) );
2282 sublower
= CharLowerW( strdupW( sub
) );
2283 r
= strstrW( strlower
, sublower
);
2285 r
= (LPWSTR
)str
+ (r
- strlower
);
2286 msi_free( strlower
);
2287 msi_free( sublower
);
2291 static BOOL
str_is_number( LPCWSTR str
)
2298 for (i
= 0; i
< lstrlenW( str
); i
++)
2299 if (!isdigitW(str
[i
]))
2305 static INT
compare_substring( LPCWSTR a
, INT
operator, LPCWSTR b
)
2309 /* substring operators return 0 if LHS is missing */
2313 /* substring operators return 1 if RHS is missing */
2317 /* if both strings contain only numbers, use integer comparison */
2320 if (str_is_number(a
) && str_is_number(b
))
2321 return compare_int( lhs
, operator, rhs
);
2326 return strstrW( a
, b
) != 0;
2328 return strstriW( a
, b
) != 0;
2331 int l
= strlenW( a
);
2332 int r
= strlenW( b
);
2333 if (r
> l
) return 0;
2334 return !strncmpW( a
, b
, r
);
2338 int l
= strlenW( a
);
2339 int r
= strlenW( b
);
2340 if (r
> l
) return 0;
2341 return !strncmpW( a
+ (l
- r
), b
, r
);
2345 int l
= strlenW( a
);
2346 int r
= strlenW( b
);
2347 if (r
> l
) return 0;
2348 return !strncmpiW( a
, b
, r
);
2352 int l
= strlenW( a
);
2353 int r
= strlenW( b
);
2354 if (r
> l
) return 0;
2355 return !strncmpiW( a
+ (l
- r
), b
, r
);
2358 ERR("invalid substring operator\n");
2364 static INT
compare_string( LPCWSTR a
, INT
operator, LPCWSTR b
, BOOL convert
)
2366 if (operator >= COND_SS
&& operator <= COND_RHS
)
2367 return compare_substring( a
, operator, b
);
2369 /* null and empty string are equivalent */
2370 if (!a
) a
= szEmpty
;
2371 if (!b
) b
= szEmpty
;
2373 if (convert
&& str_is_number(a
) && str_is_number(b
))
2374 return compare_int( atoiW(a
), operator, atoiW(b
) );
2376 /* a or b may be NULL */
2380 return strcmpW( a
, b
) < 0;
2382 return strcmpW( a
, b
) > 0;
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 strcmpiW( a
, b
) < 0;
2394 return strcmpiW( 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 ERR("invalid string operator\n");
2411 static INT
compare_int( INT a
, INT
operator, INT b
)
2435 return ( a
& b
) ? 1 : 0;
2437 return ( ( a
& 0xffff ) == b
) ? 1 : 0;
2439 return ( ( (a
>>16) & 0xffff ) == b
) ? 1 : 0;
2441 ERR("invalid integer operator\n");
2448 static int COND_IsIdent( WCHAR x
)
2450 return( COND_IsAlpha( x
) || COND_IsNumber( x
) || ( x
== '_' )
2451 || ( x
== '#' ) || (x
== '.') );
2454 static int COND_GetOperator( COND_input
*cond
)
2456 static const struct {
2460 { {'~','<','=',0}, COND_ILE
},
2461 { {'~','>','<',0}, COND_ISS
},
2462 { {'~','>','>',0}, COND_IRHS
},
2463 { {'~','<','>',0}, COND_INE
},
2464 { {'~','>','=',0}, COND_IGE
},
2465 { {'~','<','<',0}, COND_ILHS
},
2466 { {'~','=',0}, COND_IEQ
},
2467 { {'~','<',0}, COND_ILT
},
2468 { {'~','>',0}, COND_IGT
},
2469 { {'>','=',0}, COND_GE
},
2470 { {'>','<',0}, COND_SS
},
2471 { {'<','<',0}, COND_LHS
},
2472 { {'<','>',0}, COND_NE
},
2473 { {'<','=',0}, COND_LE
},
2474 { {'>','>',0}, COND_RHS
},
2475 { {'>',0}, COND_GT
},
2476 { {'<',0}, COND_LT
},
2479 LPCWSTR p
= &cond
->str
[cond
->n
];
2484 len
= lstrlenW( table
[i
].str
);
2485 if ( !len
|| 0 == strncmpW( table
[i
].str
, p
, len
) )
2493 static int COND_GetOne( struct cond_str
*str
, COND_input
*cond
)
2498 str
->data
= &cond
->str
[cond
->n
];
2505 case '(': rc
= COND_LPAR
; break;
2506 case ')': rc
= COND_RPAR
; break;
2507 case '&': rc
= COND_AMPER
; break;
2508 case '!': rc
= COND_EXCLAM
; break;
2509 case '$': rc
= COND_DOLLARS
; break;
2510 case '?': rc
= COND_QUESTION
; break;
2511 case '%': rc
= COND_PERCENT
; break;
2512 case ' ': rc
= COND_SPACE
; break;
2513 case '=': rc
= COND_EQ
; break;
2518 rc
= COND_GetOperator( cond
);
2534 LPCWSTR p
= strchrW( str
->data
+ 1, '"' );
2537 len
= p
- str
->data
+ 1;
2540 else if( COND_IsAlpha( ch
) )
2542 static const WCHAR szNot
[] = {'N','O','T',0};
2543 static const WCHAR szAnd
[] = {'A','N','D',0};
2544 static const WCHAR szXor
[] = {'X','O','R',0};
2545 static const WCHAR szEqv
[] = {'E','Q','V',0};
2546 static const WCHAR szImp
[] = {'I','M','P',0};
2547 static const WCHAR szOr
[] = {'O','R',0};
2549 while( COND_IsIdent( str
->data
[len
] ) )
2555 if ( !strncmpiW( str
->data
, szNot
, len
) )
2557 else if( !strncmpiW( str
->data
, szAnd
, len
) )
2559 else if( !strncmpiW( str
->data
, szXor
, len
) )
2561 else if( !strncmpiW( str
->data
, szEqv
, len
) )
2563 else if( !strncmpiW( str
->data
, szImp
, len
) )
2566 else if( (len
== 2) && !strncmpiW( str
->data
, szOr
, len
) )
2569 else if( COND_IsNumber( ch
) )
2571 while( COND_IsNumber( str
->data
[len
] ) )
2577 ERR("Got unknown character %c(%x)\n",ch
,ch
);
2587 static int cond_lex( void *COND_lval
, COND_input
*cond
)
2590 struct cond_str
*str
= COND_lval
;
2593 rc
= COND_GetOne( str
, cond
);
2594 } while (rc
== COND_SPACE
);
2599 static LPWSTR
COND_GetString( COND_input
*cond
, const struct cond_str
*str
)
2603 ret
= cond_alloc( cond
, (str
->len
+1) * sizeof (WCHAR
) );
2606 memcpy( ret
, str
->data
, str
->len
* sizeof(WCHAR
));
2609 TRACE("Got identifier %s\n",debugstr_w(ret
));
2613 static LPWSTR
COND_GetLiteral( COND_input
*cond
, const struct cond_str
*str
)
2617 ret
= cond_alloc( cond
, (str
->len
-1) * sizeof (WCHAR
) );
2620 memcpy( ret
, str
->data
+1, (str
->len
-2) * sizeof(WCHAR
) );
2621 ret
[str
->len
- 2]=0;
2623 TRACE("Got literal %s\n",debugstr_w(ret
));
2627 static void *cond_alloc( COND_input
*cond
, unsigned int sz
)
2631 mem
= msi_alloc( sizeof (struct list
) + sz
);
2635 list_add_head( &(cond
->mem
), mem
);
2639 static void *cond_track_mem( COND_input
*cond
, void *ptr
, unsigned int sz
)
2646 new_ptr
= cond_alloc( cond
, sz
);
2653 memcpy( new_ptr
, ptr
, sz
);
2658 static void cond_free( void *ptr
)
2660 struct list
*mem
= (struct list
*)ptr
- 1;
2669 static int cond_error(const char *str
)
2671 TRACE("%s\n", str
);
2675 MSICONDITION
MSI_EvaluateConditionW( MSIPACKAGE
*package
, LPCWSTR szCondition
)
2679 struct list
*mem
, *safety
;
2681 TRACE("%s\n", debugstr_w( szCondition
) );
2683 if ( szCondition
== NULL
)
2684 return MSICONDITION_NONE
;
2686 cond
.package
= package
;
2687 cond
.str
= szCondition
;
2689 cond
.result
= MSICONDITION_ERROR
;
2691 list_init( &cond
.mem
);
2693 if ( !cond_parse( &cond
) )
2696 r
= MSICONDITION_ERROR
;
2698 LIST_FOR_EACH_SAFE( mem
, safety
, &cond
.mem
)
2700 /* The tracked memory lives directly after the list struct */
2701 void *ptr
= mem
+ 1;
2702 if ( r
!= MSICONDITION_ERROR
)
2703 WARN( "condition parser failed to free up some memory: %p\n", ptr
);
2707 TRACE("%i <- %s\n", r
, debugstr_w(szCondition
));
2711 MSICONDITION WINAPI
MsiEvaluateConditionW( MSIHANDLE hInstall
, LPCWSTR szCondition
)
2713 MSIPACKAGE
*package
;
2716 package
= msihandle2msiinfo( hInstall
, MSIHANDLETYPE_PACKAGE
);
2721 IWineMsiRemotePackage
*remote_package
;
2723 remote_package
= (IWineMsiRemotePackage
*)msi_get_remote( hInstall
);
2724 if (!remote_package
)
2725 return MSICONDITION_ERROR
;
2727 condition
= SysAllocString( szCondition
);
2730 IWineMsiRemotePackage_Release( remote_package
);
2731 return ERROR_OUTOFMEMORY
;
2734 hr
= IWineMsiRemotePackage_EvaluateCondition( remote_package
, condition
);
2736 SysFreeString( condition
);
2737 IWineMsiRemotePackage_Release( remote_package
);
2741 if (HRESULT_FACILITY(hr
) == FACILITY_WIN32
)
2742 return HRESULT_CODE(hr
);
2744 return ERROR_FUNCTION_FAILED
;
2747 return ERROR_SUCCESS
;
2750 ret
= MSI_EvaluateConditionW( package
, szCondition
);
2751 msiobj_release( &package
->hdr
);
2755 MSICONDITION WINAPI
MsiEvaluateConditionA( MSIHANDLE hInstall
, LPCSTR szCondition
)
2757 LPWSTR szwCond
= NULL
;
2760 szwCond
= strdupAtoW( szCondition
);
2761 if( szCondition
&& !szwCond
)
2762 return MSICONDITION_ERROR
;
2764 r
= MsiEvaluateConditionW( hInstall
, szwCond
);
2765 msi_free( szwCond
);