1 /* A Bison parser, made by GNU Bison 1.875b. */
3 /* Skeleton parser for Yacc-like parsing with Bison,
4 Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003 Free Software Foundation, Inc.
6 This program is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 2, or (at your option)
11 This program is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
16 You should have received a copy of the GNU General Public License
17 along with this program; if not, write to the Free Software
18 Foundation, Inc., 59 Temple Place - Suite 330,
19 Boston, MA 02111-1307, USA. */
21 /* As a special exception, when this file is copied by Bison into a
22 Bison output file, you may use that output file without restriction.
23 This special exception was added by the Free Software Foundation
24 in version 1.24 of Bison. */
26 /* Written by Richard Stallman by simplifying the original so called
27 ``semantic'' parser. */
29 /* All symbols defined below should begin with yy or YY, to avoid
30 infringing on user name space. This should be done even for local
31 variables, as they might otherwise be expanded by user macros.
32 There are some unavoidable exceptions within include files to
33 define necessary library symbols; they are noted "INFRINGES ON
34 USER NAME SPACE" below. */
36 /* Identify Bison output. */
40 #define YYSKELETON_NAME "yacc.c"
45 /* Using locations. */
46 #define YYLSP_NEEDED 0
48 /* If NAME_PREFIX is specified substitute the variables and functions
50 #define yyparse COND_parse
51 #define yylex COND_lex
52 #define yyerror COND_error
53 #define yylval COND_lval
54 #define yychar COND_char
55 #define yydebug COND_debug
56 #define yynerrs COND_nerrs
62 /* Put the tokens into the symbol table, so that GDB and other debuggers
87 #define COND_SPACE 258
97 #define COND_TILDA 268
98 #define COND_PERCENT 269
99 #define COND_DOLLARS 270
100 #define COND_QUESTION 271
101 #define COND_AMPER 272
102 #define COND_EXCLAM 273
103 #define COND_IDENT 274
104 #define COND_NUMBER 275
105 #define COND_LITER 276
106 #define COND_ERROR 277
111 /* Copy the first part of user declarations. */
116 * Implementation of the Microsoft Installer (msi.dll)
118 * Copyright 2003 Mike McCormack for CodeWeavers
120 * This library is free software; you can redistribute it and/or
121 * modify it under the terms of the GNU Lesser General Public
122 * License as published by the Free Software Foundation; either
123 * version 2.1 of the License, or (at your option) any later version.
125 * This library is distributed in the hope that it will be useful,
126 * but WITHOUT ANY WARRANTY; without even the implied warranty of
127 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
128 * Lesser General Public License for more details.
130 * You should have received a copy of the GNU Lesser General Public
131 * License along with this library; if not, write to the Free Software
132 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
143 #include "wine/debug.h"
144 #include "wine/unicode.h"
147 #include "msiquery.h"
150 #define YYLEX_PARAM info
151 #define YYPARSE_PARAM info
153 static int COND_error(char *str
);
155 WINE_DEFAULT_DEBUG_CHANNEL(msi
);
157 typedef struct tag_yyinput
170 static LPWSTR
COND_GetString( struct cond_str
*str
);
171 static LPWSTR
COND_GetLiteral( struct cond_str
*str
);
172 static int COND_lex( void *COND_lval
, COND_input
*info
);
174 typedef INT (*comp_int
)(INT a
, INT b
);
175 typedef INT (*comp_str
)(LPWSTR a
, LPWSTR b
, BOOL caseless
);
176 typedef INT (*comp_m1
)(LPWSTR a
,int b
);
177 typedef INT (*comp_m2
)(int a
,LPWSTR b
);
179 static INT
comp_lt_i(INT a
, INT b
);
180 static INT
comp_gt_i(INT a
, INT b
);
181 static INT
comp_le_i(INT a
, INT b
);
182 static INT
comp_ge_i(INT a
, INT b
);
183 static INT
comp_eq_i(INT a
, INT b
);
184 static INT
comp_ne_i(INT a
, INT b
);
185 static INT
comp_bitand(INT a
, INT b
);
186 static INT
comp_highcomp(INT a
, INT b
);
187 static INT
comp_lowcomp(INT a
, INT b
);
189 static INT
comp_eq_s(LPWSTR a
, LPWSTR b
, BOOL casless
);
190 static INT
comp_ne_s(LPWSTR a
, LPWSTR b
, BOOL casless
);
191 static INT
comp_lt_s(LPWSTR a
, LPWSTR b
, BOOL casless
);
192 static INT
comp_gt_s(LPWSTR a
, LPWSTR b
, BOOL casless
);
193 static INT
comp_le_s(LPWSTR a
, LPWSTR b
, BOOL casless
);
194 static INT
comp_ge_s(LPWSTR a
, LPWSTR b
, BOOL casless
);
195 static INT
comp_substring(LPWSTR a
, LPWSTR b
, BOOL casless
);
196 static INT
comp_start(LPWSTR a
, LPWSTR b
, BOOL casless
);
197 static INT
comp_end(LPWSTR a
, LPWSTR b
, BOOL casless
);
199 static INT
comp_eq_m1(LPWSTR a
, INT b
);
200 static INT
comp_ne_m1(LPWSTR a
, INT b
);
201 static INT
comp_lt_m1(LPWSTR a
, INT b
);
202 static INT
comp_gt_m1(LPWSTR a
, INT b
);
203 static INT
comp_le_m1(LPWSTR a
, INT b
);
204 static INT
comp_ge_m1(LPWSTR a
, INT b
);
206 static INT
comp_eq_m2(INT a
, LPWSTR b
);
207 static INT
comp_ne_m2(INT a
, LPWSTR b
);
208 static INT
comp_lt_m2(INT a
, LPWSTR b
);
209 static INT
comp_gt_m2(INT a
, LPWSTR b
);
210 static INT
comp_le_m2(INT a
, LPWSTR b
);
211 static INT
comp_ge_m2(INT a
, LPWSTR b
);
215 /* Enabling traces. */
220 /* Enabling verbose error messages. */
221 #ifdef YYERROR_VERBOSE
222 # undef YYERROR_VERBOSE
223 # define YYERROR_VERBOSE 1
225 # define YYERROR_VERBOSE 0
228 #if ! defined (YYSTYPE) && ! defined (YYSTYPE_IS_DECLARED)
230 typedef union YYSTYPE
{
234 comp_int fn_comp_int
;
235 comp_str fn_comp_str
;
239 /* Line 191 of yacc.c. */
240 #line 241 "cond.tab.c"
241 # define yystype YYSTYPE /* obsolescent; will be withdrawn */
242 # define YYSTYPE_IS_DECLARED 1
243 # define YYSTYPE_IS_TRIVIAL 1
248 /* Copy the second part of user declarations. */
251 /* Line 214 of yacc.c. */
252 #line 253 "cond.tab.c"
254 #if ! defined (yyoverflow) || YYERROR_VERBOSE
256 /* The parser invokes alloca or malloc; define the necessary symbols. */
258 # if YYSTACK_USE_ALLOCA
259 # define YYSTACK_ALLOC alloca
261 # ifndef YYSTACK_USE_ALLOCA
262 # if defined (alloca) || defined (_ALLOCA_H)
263 # define YYSTACK_ALLOC alloca
266 # define YYSTACK_ALLOC __builtin_alloca
272 # ifdef YYSTACK_ALLOC
273 /* Pacify GCC's `empty if-body' warning. */
274 # define YYSTACK_FREE(Ptr) do { /* empty */; } while (0)
276 # if defined (__STDC__) || defined (__cplusplus)
277 # include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
278 # define YYSIZE_T size_t
280 # define YYSTACK_ALLOC malloc
281 # define YYSTACK_FREE free
283 #endif /* ! defined (yyoverflow) || YYERROR_VERBOSE */
286 #if (! defined (yyoverflow) \
287 && (! defined (__cplusplus) \
288 || (YYSTYPE_IS_TRIVIAL)))
290 /* A type that is properly aligned for any stack member. */
297 /* The size of the maximum gap between one aligned stack and the next. */
298 # define YYSTACK_GAP_MAXIMUM (sizeof (union yyalloc) - 1)
300 /* The size of an array large to enough to hold all stacks, each with
302 # define YYSTACK_BYTES(N) \
303 ((N) * (sizeof (short) + sizeof (YYSTYPE)) \
304 + YYSTACK_GAP_MAXIMUM)
306 /* Copy COUNT objects from FROM to TO. The source and destination do
310 # define YYCOPY(To, From, Count) \
311 __builtin_memcpy (To, From, (Count) * sizeof (*(From)))
313 # define YYCOPY(To, From, Count) \
316 register YYSIZE_T yyi; \
317 for (yyi = 0; yyi < (Count); yyi++) \
318 (To)[yyi] = (From)[yyi]; \
324 /* Relocate STACK from its old location to the new one. The
325 local variables YYSIZE and YYSTACKSIZE give the old and new number of
326 elements in the stack, and YYPTR gives the new location of the
327 stack. Advance YYPTR to a properly aligned location for the next
329 # define YYSTACK_RELOCATE(Stack) \
332 YYSIZE_T yynewbytes; \
333 YYCOPY (&yyptr->Stack, Stack, yysize); \
334 Stack = &yyptr->Stack; \
335 yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \
336 yyptr += yynewbytes / sizeof (*yyptr); \
342 #if defined (__STDC__) || defined (__cplusplus)
343 typedef signed char yysigned_char
;
345 typedef short yysigned_char
;
348 /* YYFINAL -- State number of the termination state. */
350 /* YYLAST -- Last index in YYTABLE. */
353 /* YYNTOKENS -- Number of terminals. */
355 /* YYNNTS -- Number of nonterminals. */
357 /* YYNRULES -- Number of rules. */
359 /* YYNRULES -- Number of states. */
362 /* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */
364 #define YYMAXUTOK 277
366 #define YYTRANSLATE(YYX) \
367 ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK)
369 /* YYTRANSLATE[YYLEX] -- Bison symbol number corresponding to YYLEX. */
370 static const unsigned char yytranslate
[] =
372 0, 2, 2, 2, 2, 2, 2, 2, 2, 2,
373 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
374 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
375 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
376 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
377 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
378 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
379 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
380 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
381 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
382 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
383 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
384 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
385 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
386 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
387 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
388 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
389 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
390 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
391 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
392 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
393 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
394 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
395 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
396 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
397 2, 2, 2, 2, 2, 2, 1, 2, 3, 4,
398 5, 6, 7, 8, 9, 10, 11, 12, 13, 14,
399 15, 16, 17, 18, 19, 20, 21, 22
403 /* YYPRHS[YYN] -- Index of the first RHS symbol of rule number YYN in
405 static const unsigned char yyprhs
[] =
407 0, 0, 3, 5, 7, 11, 13, 17, 19, 22,
408 24, 26, 30, 34, 39, 43, 47, 51, 53, 56,
409 58, 60, 63, 66, 69, 72, 75, 77, 80, 82,
410 84, 87, 90, 93, 96, 99, 101, 104, 106, 108,
411 111, 114, 117, 120, 123, 125, 128, 130, 132, 135,
412 138, 141, 144, 147, 149, 151, 153, 155, 157, 160,
413 163, 166, 169, 171, 174, 176
416 /* YYRHS -- A `-1'-separated list of the rules' RHS. */
417 static const yysigned_char yyrhs
[] =
419 24, 0, -1, 25, -1, 26, -1, 26, 5, 25,
420 -1, 27, -1, 26, 6, 27, -1, 28, -1, 7,
421 28, -1, 33, -1, 34, -1, 33, 29, 33, -1,
422 34, 30, 34, -1, 34, 13, 30, 34, -1, 34,
423 31, 33, -1, 33, 32, 34, -1, 11, 25, 12,
424 -1, 10, -1, 8, 9, -1, 8, -1, 9, -1,
425 8, 10, -1, 9, 10, -1, 9, 8, -1, 8,
426 8, -1, 9, 9, -1, 10, -1, 8, 9, -1,
427 8, -1, 9, -1, 8, 10, -1, 9, 10, -1,
428 9, 8, -1, 8, 8, -1, 9, 9, -1, 10,
429 -1, 8, 9, -1, 8, -1, 9, -1, 8, 10,
430 -1, 9, 10, -1, 9, 8, -1, 8, 8, -1,
431 9, 9, -1, 10, -1, 8, 9, -1, 8, -1,
432 9, -1, 8, 10, -1, 9, 10, -1, 9, 8,
433 -1, 8, 8, -1, 9, 9, -1, 36, -1, 39,
434 -1, 37, -1, 35, -1, 21, -1, 15, 38, -1,
435 16, 38, -1, 17, 38, -1, 18, 38, -1, 38,
436 -1, 14, 38, -1, 19, -1, 20, -1
439 /* YYRLINE[YYN] -- source line where rule number YYN was defined. */
440 static const unsigned short yyrline
[] =
442 0, 136, 136, 144, 148, 155, 159, 166, 170, 178,
443 182, 186, 190, 194, 198, 202, 206, 214, 218, 222,
444 226, 230, 234, 239, 243, 247, 255, 259, 263, 267,
445 271, 275, 280, 284, 288, 296, 300, 304, 308, 312,
446 316, 321, 325, 329, 337, 341, 345, 349, 353, 357,
447 362, 366, 370, 377, 381, 388, 392, 399, 408, 417,
448 426, 435, 447, 470, 484, 493
452 #if YYDEBUG || YYERROR_VERBOSE
453 /* YYTNME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM.
454 First, the terminals, then, starting at YYNTOKENS, nonterminals. */
455 static const char *const yytname
[] =
457 "$end", "error", "$undefined", "COND_SPACE", "COND_EOF", "COND_OR",
458 "COND_AND", "COND_NOT", "COND_LT", "COND_GT", "COND_EQ", "COND_LPAR",
459 "COND_RPAR", "COND_TILDA", "COND_PERCENT", "COND_DOLLARS",
460 "COND_QUESTION", "COND_AMPER", "COND_EXCLAM", "COND_IDENT",
461 "COND_NUMBER", "COND_LITER", "COND_ERROR", "$accept", "condition",
462 "expression", "boolean_term", "boolean_factor", "term", "comp_op_i",
463 "comp_op_s", "comp_op_m1", "comp_op_m2", "value_i", "value_s",
464 "literal", "symbol_i", "symbol_s", "identifier", "integer", 0
469 /* YYTOKNUM[YYLEX-NUM] -- Internal token number corresponding to
471 static const unsigned short yytoknum
[] =
473 0, 256, 257, 258, 259, 260, 261, 262, 263, 264,
474 265, 266, 267, 268, 269, 270, 271, 272, 273, 274,
479 /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */
480 static const unsigned char yyr1
[] =
482 0, 23, 24, 25, 25, 26, 26, 27, 27, 28,
483 28, 28, 28, 28, 28, 28, 28, 29, 29, 29,
484 29, 29, 29, 29, 29, 29, 30, 30, 30, 30,
485 30, 30, 30, 30, 30, 31, 31, 31, 31, 31,
486 31, 31, 31, 31, 32, 32, 32, 32, 32, 32,
487 32, 32, 32, 33, 33, 34, 34, 35, 36, 36,
488 36, 36, 37, 37, 38, 39
491 /* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */
492 static const unsigned char yyr2
[] =
494 0, 2, 1, 1, 3, 1, 3, 1, 2, 1,
495 1, 3, 3, 4, 3, 3, 3, 1, 2, 1,
496 1, 2, 2, 2, 2, 2, 1, 2, 1, 1,
497 2, 2, 2, 2, 2, 1, 2, 1, 1, 2,
498 2, 2, 2, 2, 1, 2, 1, 1, 2, 2,
499 2, 2, 2, 1, 1, 1, 1, 1, 2, 2,
503 /* YYDEFACT[STATE-NAME] -- Default rule to reduce with in state
504 STATE-NUM when YYTABLE doesn't specify something else to do. Zero
505 means the default is an error. */
506 static const unsigned char yydefact
[] =
508 0, 0, 0, 0, 0, 0, 0, 0, 64, 65,
509 57, 0, 2, 3, 5, 7, 9, 10, 56, 53,
510 55, 62, 54, 8, 0, 63, 58, 59, 60, 61,
511 1, 0, 0, 19, 20, 17, 0, 0, 37, 38,
512 35, 0, 0, 0, 16, 4, 6, 24, 18, 21,
513 23, 25, 22, 11, 15, 42, 36, 39, 41, 43,
514 40, 28, 29, 26, 0, 12, 14, 33, 27, 30,
518 /* YYDEFGOTO[NTERM-NUM]. */
519 static const yysigned_char yydefgoto
[] =
521 -1, 11, 12, 13, 14, 15, 36, 42, 43, 37,
522 16, 17, 18, 19, 20, 21, 22
525 /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
527 #define YYPACT_NINF -37
528 static const short yypact
[] =
530 -4, 51, -4, -11, -11, -11, -11, -11, -37, -37,
531 -37, 18, -37, -1, -37, -37, 49, 14, -37, -37,
532 -37, -37, -37, -37, 19, -37, -37, -37, -37, -37,
533 -37, -4, -4, 11, 25, 34, 111, 59, 28, 42,
534 60, 130, 59, 111, -37, -37, -37, 63, 69, 72,
535 73, 81, 82, -37, -37, 85, 91, 94, 95, 103,
536 104, 133, 136, -37, 59, -37, -37, -37, -37, -37,
540 /* YYPGOTO[NTERM-NUM]. */
541 static const short yypgoto
[] =
543 -37, -37, -2, -37, -6, 39, -37, 0, -37, -37,
544 -34, -36, -37, -37, -37, 129, -37
547 /* YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If
548 positive, shift that token. If negative, reduce the rule which
549 number is the opposite. If zero, do what YYDEFACT says.
550 If YYTABLE_NINF, syntax error. */
551 #define YYTABLE_NINF -53
552 static const yysigned_char yytable
[] =
554 24, 54, 53, 1, 31, 32, 65, 2, 8, 66,
555 3, 4, 5, 6, 7, 8, 9, 10, 30, 47,
556 48, 49, 38, 39, 40, -46, 46, 41, 73, 45,
557 -46, 44, -46, 50, 51, 52, 55, 56, 57, -47,
558 23, 64, -28, 0, -47, 0, -47, -28, -44, -28,
559 58, 59, 60, -44, 0, -44, -29, 33, 34, 35,
560 0, -29, 2, -29, 0, 3, 4, 5, 6, 7,
561 8, 9, 10, 3, -26, 0, 0, -51, 8, -26,
562 10, -26, -51, -45, -51, 0, -48, -50, -45, 0,
563 -45, -48, -50, -48, -50, -52, -49, 0, 0, -33,
564 -52, -49, -52, -49, -33, -27, -33, 0, -30, -32,
565 -27, 0, -27, -30, -32, -30, -32, -34, -31, 0,
566 0, 0, -34, -31, -34, -31, 4, 5, 6, 7,
567 0, 9, 25, 26, 27, 28, 29, 0, 61, 62,
568 63, 67, 68, 69, 70, 71, 72
571 static const yysigned_char yycheck
[] =
573 2, 37, 36, 7, 5, 6, 42, 11, 19, 43,
574 14, 15, 16, 17, 18, 19, 20, 21, 0, 8,
575 9, 10, 8, 9, 10, 14, 32, 13, 64, 31,
576 19, 12, 21, 8, 9, 10, 8, 9, 10, 14,
577 1, 41, 14, -1, 19, -1, 21, 19, 14, 21,
578 8, 9, 10, 19, -1, 21, 14, 8, 9, 10,
579 -1, 19, 11, 21, -1, 14, 15, 16, 17, 18,
580 19, 20, 21, 14, 14, -1, -1, 14, 19, 19,
581 21, 21, 19, 14, 21, -1, 14, 14, 19, -1,
582 21, 19, 19, 21, 21, 14, 14, -1, -1, 14,
583 19, 19, 21, 21, 19, 14, 21, -1, 14, 14,
584 19, -1, 21, 19, 19, 21, 21, 14, 14, -1,
585 -1, -1, 19, 19, 21, 21, 15, 16, 17, 18,
586 -1, 20, 3, 4, 5, 6, 7, -1, 8, 9,
587 10, 8, 9, 10, 8, 9, 10
590 /* YYSTOS[STATE-NUM] -- The (internal number of the) accessing
591 symbol of state STATE-NUM. */
592 static const unsigned char yystos
[] =
594 0, 7, 11, 14, 15, 16, 17, 18, 19, 20,
595 21, 24, 25, 26, 27, 28, 33, 34, 35, 36,
596 37, 38, 39, 28, 25, 38, 38, 38, 38, 38,
597 0, 5, 6, 8, 9, 10, 29, 32, 8, 9,
598 10, 13, 30, 31, 12, 25, 27, 8, 9, 10,
599 8, 9, 10, 33, 34, 8, 9, 10, 8, 9,
600 10, 8, 9, 10, 30, 34, 33, 8, 9, 10,
604 #if ! defined (YYSIZE_T) && defined (__SIZE_TYPE__)
605 # define YYSIZE_T __SIZE_TYPE__
607 #if ! defined (YYSIZE_T) && defined (size_t)
608 # define YYSIZE_T size_t
610 #if ! defined (YYSIZE_T)
611 # if defined (__STDC__) || defined (__cplusplus)
612 # include <stddef.h> /* INFRINGES ON USER NAME SPACE */
613 # define YYSIZE_T size_t
616 #if ! defined (YYSIZE_T)
617 # define YYSIZE_T unsigned int
620 #define yyerrok (yyerrstatus = 0)
621 #define yyclearin (yychar = YYEMPTY)
625 #define YYACCEPT goto yyacceptlab
626 #define YYABORT goto yyabortlab
627 #define YYERROR goto yyerrlab1
630 /* Like YYERROR except do call yyerror. This remains here temporarily
631 to ease the transition to the new meaning of YYERROR, for GCC.
632 Once GCC version 2 has supplanted version 1, this can go. */
634 #define YYFAIL goto yyerrlab
636 #define YYRECOVERING() (!!yyerrstatus)
638 #define YYBACKUP(Token, Value) \
640 if (yychar == YYEMPTY && yylen == 1) \
644 yytoken = YYTRANSLATE (yychar); \
650 yyerror ("syntax error: cannot back up");\
656 #define YYERRCODE 256
658 /* YYLLOC_DEFAULT -- Compute the default location (before the actions
661 #ifndef YYLLOC_DEFAULT
662 # define YYLLOC_DEFAULT(Current, Rhs, N) \
663 Current.first_line = Rhs[1].first_line; \
664 Current.first_column = Rhs[1].first_column; \
665 Current.last_line = Rhs[N].last_line; \
666 Current.last_column = Rhs[N].last_column;
669 /* YYLEX -- calling `yylex' with the right arguments. */
672 # define YYLEX yylex (&yylval, YYLEX_PARAM)
674 # define YYLEX yylex (&yylval)
677 /* Enable debugging if requested. */
681 # include <stdio.h> /* INFRINGES ON USER NAME SPACE */
682 # define YYFPRINTF fprintf
685 # define YYDPRINTF(Args) \
691 # define YYDSYMPRINT(Args) \
697 # define YYDSYMPRINTF(Title, Token, Value, Location) \
701 YYFPRINTF (stderr, "%s ", Title); \
702 yysymprint (stderr, \
704 YYFPRINTF (stderr, "\n"); \
708 /*------------------------------------------------------------------.
709 | yy_stack_print -- Print the state stack from its BOTTOM up to its |
711 `------------------------------------------------------------------*/
713 #if defined (__STDC__) || defined (__cplusplus)
715 yy_stack_print (short *bottom
, short *top
)
718 yy_stack_print (bottom
, top
)
723 YYFPRINTF (stderr
, "Stack now");
724 for (/* Nothing. */; bottom
<= top
; ++bottom
)
725 YYFPRINTF (stderr
, " %d", *bottom
);
726 YYFPRINTF (stderr
, "\n");
729 # define YY_STACK_PRINT(Bottom, Top) \
732 yy_stack_print ((Bottom), (Top)); \
736 /*------------------------------------------------.
737 | Report that the YYRULE is going to be reduced. |
738 `------------------------------------------------*/
740 #if defined (__STDC__) || defined (__cplusplus)
742 yy_reduce_print (int yyrule
)
745 yy_reduce_print (yyrule
)
750 unsigned int yylno
= yyrline
[yyrule
];
751 YYFPRINTF (stderr
, "Reducing stack by rule %d (line %u), ",
753 /* Print the symbols being reduced, and their result. */
754 for (yyi
= yyprhs
[yyrule
]; 0 <= yyrhs
[yyi
]; yyi
++)
755 YYFPRINTF (stderr
, "%s ", yytname
[yyrhs
[yyi
]]);
756 YYFPRINTF (stderr
, "-> %s\n", yytname
[yyr1
[yyrule
]]);
759 # define YY_REDUCE_PRINT(Rule) \
762 yy_reduce_print (Rule); \
765 /* Nonzero means print parse trace. It is left uninitialized so that
766 multiple parsers can coexist. */
769 # define YYDPRINTF(Args)
770 # define YYDSYMPRINT(Args)
771 # define YYDSYMPRINTF(Title, Token, Value, Location)
772 # define YY_STACK_PRINT(Bottom, Top)
773 # define YY_REDUCE_PRINT(Rule)
774 #endif /* !YYDEBUG */
777 /* YYINITDEPTH -- initial size of the parser's stacks. */
779 # define YYINITDEPTH 200
782 /* YYMAXDEPTH -- maximum size the stacks can grow to (effective only
783 if the built-in stack extension method is used).
785 Do not make this value too large; the results are undefined if
786 SIZE_MAX < YYSTACK_BYTES (YYMAXDEPTH)
787 evaluated with infinite-precision integer arithmetic. */
794 # define YYMAXDEPTH 10000
802 # if defined (__GLIBC__) && defined (_STRING_H)
803 # define yystrlen strlen
805 /* Return the length of YYSTR. */
807 # if defined (__STDC__) || defined (__cplusplus)
808 yystrlen (const char *yystr
)
814 register const char *yys
= yystr
;
816 while (*yys
++ != '\0')
819 return yys
- yystr
- 1;
825 # if defined (__GLIBC__) && defined (_STRING_H) && defined (_GNU_SOURCE)
826 # define yystpcpy stpcpy
828 /* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in
831 # if defined (__STDC__) || defined (__cplusplus)
832 yystpcpy (char *yydest
, const char *yysrc
)
834 yystpcpy (yydest
, yysrc
)
839 register char *yyd
= yydest
;
840 register const char *yys
= yysrc
;
842 while ((*yyd
++ = *yys
++) != '\0')
850 #endif /* !YYERROR_VERBOSE */
855 /*--------------------------------.
856 | Print this symbol on YYOUTPUT. |
857 `--------------------------------*/
859 #if defined (__STDC__) || defined (__cplusplus)
861 yysymprint (FILE *yyoutput
, int yytype
, YYSTYPE
*yyvaluep
)
864 yysymprint (yyoutput
, yytype
, yyvaluep
)
870 /* Pacify ``unused variable'' warnings. */
873 if (yytype
< YYNTOKENS
)
875 YYFPRINTF (yyoutput
, "token %s (", yytname
[yytype
]);
877 YYPRINT (yyoutput
, yytoknum
[yytype
], *yyvaluep
);
881 YYFPRINTF (yyoutput
, "nterm %s (", yytname
[yytype
]);
888 YYFPRINTF (yyoutput
, ")");
891 #endif /* ! YYDEBUG */
892 /*-----------------------------------------------.
893 | Release the memory associated to this symbol. |
894 `-----------------------------------------------*/
896 #if defined (__STDC__) || defined (__cplusplus)
898 yydestruct (int yytype
, YYSTYPE
*yyvaluep
)
901 yydestruct (yytype
, yyvaluep
)
906 /* Pacify ``unused variable'' warnings. */
918 /* Prevent warnings from -Wmissing-prototypes. */
921 # if defined (__STDC__) || defined (__cplusplus)
922 int yyparse (void *YYPARSE_PARAM
);
926 #else /* ! YYPARSE_PARAM */
927 #if defined (__STDC__) || defined (__cplusplus)
932 #endif /* ! YYPARSE_PARAM */
944 # if defined (__STDC__) || defined (__cplusplus)
945 int yyparse (void *YYPARSE_PARAM
)
947 int yyparse (YYPARSE_PARAM
)
950 #else /* ! YYPARSE_PARAM */
951 #if defined (__STDC__) || defined (__cplusplus)
961 /* The lookahead symbol. */
964 /* The semantic value of the lookahead symbol. */
967 /* Number of syntax errors so far. */
970 register int yystate
;
973 /* Number of tokens to shift before error messages enabled. */
975 /* Lookahead token as an internal (translated) token number. */
978 /* Three stacks and their tools:
979 `yyss': related to states,
980 `yyvs': related to semantic values,
981 `yyls': related to locations.
983 Refer to the stacks thru separate pointers, to allow yyoverflow
984 to reallocate them elsewhere. */
986 /* The state stack. */
987 short yyssa
[YYINITDEPTH
];
989 register short *yyssp
;
991 /* The semantic value stack. */
992 YYSTYPE yyvsa
[YYINITDEPTH
];
993 YYSTYPE
*yyvs
= yyvsa
;
994 register YYSTYPE
*yyvsp
;
998 #define YYPOPSTACK (yyvsp--, yyssp--)
1000 YYSIZE_T yystacksize
= YYINITDEPTH
;
1002 /* The variables used to return semantic value and location from the
1007 /* When reducing, the number of symbols on the RHS of the reduced
1011 YYDPRINTF ((stderr
, "Starting parse\n"));
1016 yychar
= YYEMPTY
; /* Cause a token to be read. */
1018 /* Initialize stack pointers.
1019 Waste one element of value and location stack
1020 so that they stay on the same level as the state stack.
1021 The wasted elements are never initialized. */
1028 /*------------------------------------------------------------.
1029 | yynewstate -- Push a new state, which is found in yystate. |
1030 `------------------------------------------------------------*/
1032 /* In all cases, when you get here, the value and location stacks
1033 have just been pushed. so pushing a state here evens the stacks.
1040 if (yyss
+ yystacksize
- 1 <= yyssp
)
1042 /* Get the current used size of the three stacks, in elements. */
1043 YYSIZE_T yysize
= yyssp
- yyss
+ 1;
1047 /* Give user a chance to reallocate the stack. Use copies of
1048 these so that the &'s don't force the real ones into
1050 YYSTYPE
*yyvs1
= yyvs
;
1051 short *yyss1
= yyss
;
1054 /* Each stack pointer address is followed by the size of the
1055 data in use in that stack, in bytes. This used to be a
1056 conditional around just the two extra args, but that might
1057 be undefined if yyoverflow is a macro. */
1058 yyoverflow ("parser stack overflow",
1059 &yyss1
, yysize
* sizeof (*yyssp
),
1060 &yyvs1
, yysize
* sizeof (*yyvsp
),
1067 #else /* no yyoverflow */
1068 # ifndef YYSTACK_RELOCATE
1071 /* Extend the stack our own way. */
1072 if (YYMAXDEPTH
<= yystacksize
)
1075 if (YYMAXDEPTH
< yystacksize
)
1076 yystacksize
= YYMAXDEPTH
;
1079 short *yyss1
= yyss
;
1080 union yyalloc
*yyptr
=
1081 (union yyalloc
*) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize
));
1084 YYSTACK_RELOCATE (yyss
);
1085 YYSTACK_RELOCATE (yyvs
);
1087 # undef YYSTACK_RELOCATE
1089 YYSTACK_FREE (yyss1
);
1092 #endif /* no yyoverflow */
1094 yyssp
= yyss
+ yysize
- 1;
1095 yyvsp
= yyvs
+ yysize
- 1;
1098 YYDPRINTF ((stderr
, "Stack size increased to %lu\n",
1099 (unsigned long int) yystacksize
));
1101 if (yyss
+ yystacksize
- 1 <= yyssp
)
1105 YYDPRINTF ((stderr
, "Entering state %d\n", yystate
));
1114 /* Do appropriate processing given the current state. */
1115 /* Read a lookahead token if we need one and don't already have one. */
1118 /* First try to decide what to do without reference to lookahead token. */
1120 yyn
= yypact
[yystate
];
1121 if (yyn
== YYPACT_NINF
)
1124 /* Not known => get a lookahead token if don't already have one. */
1126 /* YYCHAR is either YYEMPTY or YYEOF or a valid lookahead symbol. */
1127 if (yychar
== YYEMPTY
)
1129 YYDPRINTF ((stderr
, "Reading a token: "));
1133 if (yychar
<= YYEOF
)
1135 yychar
= yytoken
= YYEOF
;
1136 YYDPRINTF ((stderr
, "Now at end of input.\n"));
1140 yytoken
= YYTRANSLATE (yychar
);
1141 YYDSYMPRINTF ("Next token is", yytoken
, &yylval
, &yylloc
);
1144 /* If the proper action on seeing token YYTOKEN is to reduce or to
1145 detect an error, take that action. */
1147 if (yyn
< 0 || YYLAST
< yyn
|| yycheck
[yyn
] != yytoken
)
1152 if (yyn
== 0 || yyn
== YYTABLE_NINF
)
1161 /* Shift the lookahead token. */
1162 YYDPRINTF ((stderr
, "Shifting token %s, ", yytname
[yytoken
]));
1164 /* Discard the token being shifted unless it is eof. */
1165 if (yychar
!= YYEOF
)
1171 /* Count tokens shifted since error; after three, turn off error
1180 /*-----------------------------------------------------------.
1181 | yydefault -- do the default action for the current state. |
1182 `-----------------------------------------------------------*/
1184 yyn
= yydefact
[yystate
];
1190 /*-----------------------------.
1191 | yyreduce -- Do a reduction. |
1192 `-----------------------------*/
1194 /* yyn is the number of a rule to reduce with. */
1197 /* If YYLEN is nonzero, implement the default value of the action:
1200 Otherwise, the following line sets YYVAL to garbage.
1201 This behavior is undocumented and Bison
1202 users should not rely upon it. Assigning to YYVAL
1203 unconditionally makes the parser a bit smaller, and it avoids a
1204 GCC warning that YYVAL may be used uninitialized. */
1205 yyval
= yyvsp
[1-yylen
];
1208 YY_REDUCE_PRINT (yyn
);
1212 #line 137 "./cond.y"
1214 COND_input
* cond
= (COND_input
*) info
;
1215 cond
->result
= yyvsp
[0].value
;
1220 #line 145 "./cond.y"
1222 yyval
.value
= yyvsp
[0].value
;
1227 #line 149 "./cond.y"
1229 yyval
.value
= yyvsp
[-2].value
|| yyvsp
[0].value
;
1234 #line 156 "./cond.y"
1236 yyval
.value
= yyvsp
[0].value
;
1241 #line 160 "./cond.y"
1243 yyval
.value
= yyvsp
[-2].value
&& yyvsp
[0].value
;
1248 #line 167 "./cond.y"
1250 yyval
.value
= yyvsp
[0].value
;
1255 #line 171 "./cond.y"
1257 yyval
.value
= ! yyvsp
[0].value
;
1262 #line 179 "./cond.y"
1264 yyval
.value
= yyvsp
[0].value
;
1269 #line 183 "./cond.y"
1271 yyval
.value
= yyvsp
[0].string
[0] ? MSICONDITION_TRUE
: MSICONDITION_FALSE
;
1276 #line 187 "./cond.y"
1278 yyval
.value
= yyvsp
[-1].fn_comp_int( yyvsp
[-2].value
, yyvsp
[0].value
);
1283 #line 191 "./cond.y"
1285 yyval
.value
= yyvsp
[-1].fn_comp_str( yyvsp
[-2].string
, yyvsp
[0].string
, FALSE
);
1290 #line 195 "./cond.y"
1292 yyval
.value
= yyvsp
[-1].fn_comp_str( yyvsp
[-3].string
, yyvsp
[0].string
, TRUE
);
1297 #line 199 "./cond.y"
1299 yyval
.value
= yyvsp
[-1].fn_comp_m1( yyvsp
[-2].string
, yyvsp
[0].value
);
1304 #line 203 "./cond.y"
1306 yyval
.value
= yyvsp
[-1].fn_comp_m2( yyvsp
[-2].value
, yyvsp
[0].string
);
1311 #line 207 "./cond.y"
1313 yyval
.value
= yyvsp
[-1].value
;
1318 #line 215 "./cond.y"
1320 yyval
.fn_comp_int
= comp_eq_i
;
1325 #line 219 "./cond.y"
1327 yyval
.fn_comp_int
= comp_ne_i
;
1332 #line 223 "./cond.y"
1334 yyval
.fn_comp_int
= comp_lt_i
;
1339 #line 227 "./cond.y"
1341 yyval
.fn_comp_int
= comp_gt_i
;
1346 #line 231 "./cond.y"
1348 yyval
.fn_comp_int
= comp_le_i
;
1353 #line 235 "./cond.y"
1355 yyval
.fn_comp_int
= comp_ge_i
;
1360 #line 240 "./cond.y"
1362 yyval
.fn_comp_int
= comp_bitand
;
1367 #line 244 "./cond.y"
1369 yyval
.fn_comp_int
= comp_highcomp
;
1374 #line 248 "./cond.y"
1376 yyval
.fn_comp_int
= comp_lowcomp
;
1381 #line 256 "./cond.y"
1383 yyval
.fn_comp_str
= comp_eq_s
;
1388 #line 260 "./cond.y"
1390 yyval
.fn_comp_str
= comp_ne_s
;
1395 #line 264 "./cond.y"
1397 yyval
.fn_comp_str
= comp_lt_s
;
1402 #line 268 "./cond.y"
1404 yyval
.fn_comp_str
= comp_gt_s
;
1409 #line 272 "./cond.y"
1411 yyval
.fn_comp_str
= comp_le_s
;
1416 #line 276 "./cond.y"
1418 yyval
.fn_comp_str
= comp_ge_s
;
1423 #line 281 "./cond.y"
1425 yyval
.fn_comp_str
= comp_substring
;
1430 #line 285 "./cond.y"
1432 yyval
.fn_comp_str
= comp_start
;
1437 #line 289 "./cond.y"
1439 yyval
.fn_comp_str
= comp_end
;
1444 #line 297 "./cond.y"
1446 yyval
.fn_comp_m1
= comp_eq_m1
;
1451 #line 301 "./cond.y"
1453 yyval
.fn_comp_m1
= comp_ne_m1
;
1458 #line 305 "./cond.y"
1460 yyval
.fn_comp_m1
= comp_lt_m1
;
1465 #line 309 "./cond.y"
1467 yyval
.fn_comp_m1
= comp_gt_m1
;
1472 #line 313 "./cond.y"
1474 yyval
.fn_comp_m1
= comp_le_m1
;
1479 #line 317 "./cond.y"
1481 yyval
.fn_comp_m1
= comp_ge_m1
;
1486 #line 322 "./cond.y"
1488 yyval
.fn_comp_m1
= 0;
1493 #line 326 "./cond.y"
1495 yyval
.fn_comp_m1
= 0;
1500 #line 330 "./cond.y"
1502 yyval
.fn_comp_m1
= 0;
1507 #line 338 "./cond.y"
1509 yyval
.fn_comp_m2
= comp_eq_m2
;
1514 #line 342 "./cond.y"
1516 yyval
.fn_comp_m2
= comp_ne_m2
;
1521 #line 346 "./cond.y"
1523 yyval
.fn_comp_m2
= comp_lt_m2
;
1528 #line 350 "./cond.y"
1530 yyval
.fn_comp_m2
= comp_gt_m2
;
1535 #line 354 "./cond.y"
1537 yyval
.fn_comp_m2
= comp_le_m2
;
1542 #line 358 "./cond.y"
1544 yyval
.fn_comp_m2
= comp_ge_m2
;
1549 #line 363 "./cond.y"
1551 yyval
.fn_comp_m2
= 0;
1556 #line 367 "./cond.y"
1558 yyval
.fn_comp_m2
= 0;
1563 #line 371 "./cond.y"
1565 yyval
.fn_comp_m2
= 0;
1570 #line 378 "./cond.y"
1572 yyval
.value
= yyvsp
[0].value
;
1577 #line 382 "./cond.y"
1579 yyval
.value
= yyvsp
[0].value
;
1584 #line 389 "./cond.y"
1586 yyval
.string
= yyvsp
[0].string
;
1591 #line 393 "./cond.y"
1593 yyval
.string
= yyvsp
[0].string
;
1598 #line 400 "./cond.y"
1600 yyval
.string
= COND_GetLiteral(&yyvsp
[0].str
);
1607 #line 409 "./cond.y"
1609 COND_input
* cond
= (COND_input
*) info
;
1610 INSTALLSTATE install
= INSTALLSTATE_UNKNOWN
, action
= INSTALLSTATE_UNKNOWN
;
1612 MSI_GetComponentStateW(cond
->package
, yyvsp
[0].string
, &install
, &action
);
1613 yyval
.value
= action
;
1614 HeapFree( GetProcessHeap(), 0, yyvsp
[0].string
);
1619 #line 418 "./cond.y"
1621 COND_input
* cond
= (COND_input
*) info
;
1622 INSTALLSTATE install
= INSTALLSTATE_UNKNOWN
, action
= INSTALLSTATE_UNKNOWN
;
1624 MSI_GetComponentStateW(cond
->package
, yyvsp
[0].string
, &install
, &action
);
1625 yyval
.value
= install
;
1626 HeapFree( GetProcessHeap(), 0, yyvsp
[0].string
);
1631 #line 427 "./cond.y"
1633 COND_input
* cond
= (COND_input
*) info
;
1634 INSTALLSTATE install
= INSTALLSTATE_UNKNOWN
, action
= INSTALLSTATE_UNKNOWN
;
1636 MSI_GetFeatureStateW(cond
->package
, yyvsp
[0].string
, &install
, &action
);
1637 yyval
.value
= action
;
1638 HeapFree( GetProcessHeap(), 0, yyvsp
[0].string
);
1643 #line 436 "./cond.y"
1645 COND_input
* cond
= (COND_input
*) info
;
1646 INSTALLSTATE install
= INSTALLSTATE_UNKNOWN
, action
= INSTALLSTATE_UNKNOWN
;
1648 MSI_GetFeatureStateW(cond
->package
, yyvsp
[0].string
, &install
, &action
);
1649 yyval
.value
= install
;
1650 HeapFree( GetProcessHeap(), 0, yyvsp
[0].string
);
1655 #line 448 "./cond.y"
1658 COND_input
* cond
= (COND_input
*) info
;
1661 MSI_GetPropertyW(cond
->package
, yyvsp
[0].string
, NULL
, &sz
);
1664 yyval
.string
= HeapAlloc( GetProcessHeap(), 0 ,sizeof(WCHAR
));
1665 yyval
.string
[0] = 0;
1670 yyval
.string
= HeapAlloc( GetProcessHeap(), 0, sz
*sizeof (WCHAR
) );
1672 /* Lookup the identifier */
1674 MSI_GetPropertyW(cond
->package
,yyvsp
[0].string
,yyval
.string
,&sz
);
1676 HeapFree( GetProcessHeap(), 0, yyvsp
[0].string
);
1681 #line 471 "./cond.y"
1683 UINT len
= GetEnvironmentVariableW( yyvsp
[0].string
, NULL
, 0 );
1686 yyval
.string
= HeapAlloc( GetProcessHeap(), 0, len
*sizeof (WCHAR
) );
1688 GetEnvironmentVariableW( yyvsp
[0].string
, yyval
.string
, len
);
1690 HeapFree( GetProcessHeap(), 0, yyvsp
[0].string
);
1695 #line 485 "./cond.y"
1697 yyval
.string
= COND_GetString(&yyvsp
[0].str
);
1704 #line 494 "./cond.y"
1706 LPWSTR szNum
= COND_GetString(&yyvsp
[0].str
);
1709 yyval
.value
= atoiW( szNum
);
1710 HeapFree( GetProcessHeap(), 0, szNum
);
1717 /* Line 999 of yacc.c. */
1718 #line 1719 "cond.tab.c"
1724 YY_STACK_PRINT (yyss
, yyssp
);
1729 /* Now `shift' the result of the reduction. Determine what state
1730 that goes to, based on the state we popped back to and the rule
1731 number reduced by. */
1735 yystate
= yypgoto
[yyn
- YYNTOKENS
] + *yyssp
;
1736 if (0 <= yystate
&& yystate
<= YYLAST
&& yycheck
[yystate
] == *yyssp
)
1737 yystate
= yytable
[yystate
];
1739 yystate
= yydefgoto
[yyn
- YYNTOKENS
];
1744 /*------------------------------------.
1745 | yyerrlab -- here on detecting error |
1746 `------------------------------------*/
1748 /* If not already recovering from an error, report this error. */
1753 yyn
= yypact
[yystate
];
1755 if (YYPACT_NINF
< yyn
&& yyn
< YYLAST
)
1757 YYSIZE_T yysize
= 0;
1758 int yytype
= YYTRANSLATE (yychar
);
1759 const char* yyprefix
;
1763 /* Start YYX at -YYN if negative to avoid negative indexes in
1765 int yyxbegin
= yyn
< 0 ? -yyn
: 0;
1767 /* Stay within bounds of both yycheck and yytname. */
1768 int yychecklim
= YYLAST
- yyn
;
1769 int yyxend
= yychecklim
< YYNTOKENS
? yychecklim
: YYNTOKENS
;
1772 yyprefix
= ", expecting ";
1773 for (yyx
= yyxbegin
; yyx
< yyxend
; ++yyx
)
1774 if (yycheck
[yyx
+ yyn
] == yyx
&& yyx
!= YYTERROR
)
1776 yysize
+= yystrlen (yyprefix
) + yystrlen (yytname
[yyx
]);
1784 yysize
+= (sizeof ("syntax error, unexpected ")
1785 + yystrlen (yytname
[yytype
]));
1786 yymsg
= (char *) YYSTACK_ALLOC (yysize
);
1789 char *yyp
= yystpcpy (yymsg
, "syntax error, unexpected ");
1790 yyp
= yystpcpy (yyp
, yytname
[yytype
]);
1794 yyprefix
= ", expecting ";
1795 for (yyx
= yyxbegin
; yyx
< yyxend
; ++yyx
)
1796 if (yycheck
[yyx
+ yyn
] == yyx
&& yyx
!= YYTERROR
)
1798 yyp
= yystpcpy (yyp
, yyprefix
);
1799 yyp
= yystpcpy (yyp
, yytname
[yyx
]);
1804 YYSTACK_FREE (yymsg
);
1807 yyerror ("syntax error; also virtual memory exhausted");
1810 #endif /* YYERROR_VERBOSE */
1811 yyerror ("syntax error");
1816 if (yyerrstatus
== 3)
1818 /* If just tried and failed to reuse lookahead token after an
1819 error, discard it. */
1821 /* Return failure if at end of input. */
1822 if (yychar
== YYEOF
)
1824 /* Pop the error token. */
1826 /* Pop the rest of the stack. */
1827 while (yyss
< yyssp
)
1829 YYDSYMPRINTF ("Error: popping", yystos
[*yyssp
], yyvsp
, yylsp
);
1830 yydestruct (yystos
[*yyssp
], yyvsp
);
1836 YYDSYMPRINTF ("Error: discarding", yytoken
, &yylval
, &yylloc
);
1837 yydestruct (yytoken
, &yylval
);
1842 /* Else will try to reuse lookahead token after shifting the error
1847 /*----------------------------------------------------.
1848 | yyerrlab1 -- error raised explicitly by an action. |
1849 `----------------------------------------------------*/
1851 yyerrstatus
= 3; /* Each real token shifted decrements this. */
1855 yyn
= yypact
[yystate
];
1856 if (yyn
!= YYPACT_NINF
)
1859 if (0 <= yyn
&& yyn
<= YYLAST
&& yycheck
[yyn
] == YYTERROR
)
1867 /* Pop the current state because it cannot handle the error token. */
1871 YYDSYMPRINTF ("Error: popping", yystos
[*yyssp
], yyvsp
, yylsp
);
1872 yydestruct (yystos
[yystate
], yyvsp
);
1876 YY_STACK_PRINT (yyss
, yyssp
);
1882 YYDPRINTF ((stderr
, "Shifting error token, "));
1891 /*-------------------------------------.
1892 | yyacceptlab -- YYACCEPT comes here. |
1893 `-------------------------------------*/
1898 /*-----------------------------------.
1899 | yyabortlab -- YYABORT comes here. |
1900 `-----------------------------------*/
1906 /*----------------------------------------------.
1907 | yyoverflowlab -- parser overflow comes here. |
1908 `----------------------------------------------*/
1910 yyerror ("parser stack overflow");
1918 YYSTACK_FREE (yyss
);
1924 #line 503 "./cond.y"
1928 static int COND_IsAlpha( WCHAR x
)
1930 return( ( ( x
>= 'A' ) && ( x
<= 'Z' ) ) ||
1931 ( ( x
>= 'a' ) && ( x
<= 'z' ) ) ||
1935 static int COND_IsNumber( WCHAR x
)
1937 return( (( x
>= '0' ) && ( x
<= '9' )) || (x
=='-') || (x
=='.') );
1941 /* the mess of comparison functions */
1943 static INT
comp_lt_i(INT a
, INT b
)
1945 static INT
comp_gt_i(INT a
, INT b
)
1947 static INT
comp_le_i(INT a
, INT b
)
1948 { return (a
<= b
); }
1949 static INT
comp_ge_i(INT a
, INT b
)
1950 { return (a
>= b
); }
1951 static INT
comp_eq_i(INT a
, INT b
)
1952 { return (a
== b
); }
1953 static INT
comp_ne_i(INT a
, INT b
)
1954 { return (a
!= b
); }
1955 static INT
comp_bitand(INT a
, INT b
)
1957 static INT
comp_highcomp(INT a
, INT b
)
1958 { return HIWORD(a
)==b
; }
1959 static INT
comp_lowcomp(INT a
, INT b
)
1960 { return LOWORD(a
)==b
; }
1962 static INT
comp_eq_s(LPWSTR a
, LPWSTR b
, BOOL casless
)
1963 { if (casless
) return !strcmpiW(a
,b
); else return !strcmpW(a
,b
);}
1964 static INT
comp_ne_s(LPWSTR a
, LPWSTR b
, BOOL casless
)
1965 { if (casless
) return strcmpiW(a
,b
); else return strcmpW(a
,b
);}
1966 static INT
comp_lt_s(LPWSTR a
, LPWSTR b
, BOOL casless
)
1967 { if (casless
) return strcmpiW(a
,b
)<0; else return strcmpW(a
,b
)<0;}
1968 static INT
comp_gt_s(LPWSTR a
, LPWSTR b
, BOOL casless
)
1969 { if (casless
) return strcmpiW(a
,b
)>0; else return strcmpW(a
,b
)>0;}
1970 static INT
comp_le_s(LPWSTR a
, LPWSTR b
, BOOL casless
)
1971 { if (casless
) return strcmpiW(a
,b
)<=0; else return strcmpW(a
,b
)<=0;}
1972 static INT
comp_ge_s(LPWSTR a
, LPWSTR b
, BOOL casless
)
1973 { if (casless
) return strcmpiW(a
,b
)>=0; else return strcmpW(a
,b
)>=0;}
1974 static INT
comp_substring(LPWSTR a
, LPWSTR b
, BOOL casless
)
1975 /* ERROR NOT WORKING REWRITE */
1976 { if (casless
) return strstrW(a
,b
)!=NULL
; else return strstrW(a
,b
)!=NULL
;}
1977 static INT
comp_start(LPWSTR a
, LPWSTR b
, BOOL casless
)
1978 { if (casless
) return strncmpiW(a
,b
,strlenW(b
))==0;
1979 else return strncmpW(a
,b
,strlenW(b
))==0;}
1980 static INT
comp_end(LPWSTR a
, LPWSTR b
, BOOL casless
)
1986 if (casless
) return (!strcmpiW(&a
[i
-j
-1],b
));
1987 else return (!strcmpW(&a
[i
-j
-1],b
));
1991 static INT
comp_eq_m1(LPWSTR a
, INT b
)
1992 { if (COND_IsNumber(a
[0])) return atoiW(a
)==b
; else return 0;}
1993 static INT
comp_ne_m1(LPWSTR a
, INT b
)
1994 { if (COND_IsNumber(a
[0])) return atoiW(a
)!=b
; else return 1;}
1995 static INT
comp_lt_m1(LPWSTR a
, INT b
)
1996 { if (COND_IsNumber(a
[0])) return atoiW(a
)<b
; else return 0;}
1997 static INT
comp_gt_m1(LPWSTR a
, INT b
)
1998 { if (COND_IsNumber(a
[0])) return atoiW(a
)>b
; else return 0;}
1999 static INT
comp_le_m1(LPWSTR a
, INT b
)
2000 { if (COND_IsNumber(a
[0])) return atoiW(a
)<=b
; else return 0;}
2001 static INT
comp_ge_m1(LPWSTR a
, INT b
)
2002 { if (COND_IsNumber(a
[0])) return atoiW(a
)>=b
; else return 0;}
2004 static INT
comp_eq_m2(INT a
, LPWSTR b
)
2005 { if (COND_IsNumber(b
[0])) return a
== atoiW(b
); else return 0;}
2006 static INT
comp_ne_m2(INT a
, LPWSTR b
)
2007 { if (COND_IsNumber(b
[0])) return a
!= atoiW(b
); else return 1;}
2008 static INT
comp_lt_m2(INT a
, LPWSTR b
)
2009 { if (COND_IsNumber(b
[0])) return a
< atoiW(b
); else return 0;}
2010 static INT
comp_gt_m2(INT a
, LPWSTR b
)
2011 { if (COND_IsNumber(b
[0])) return a
> atoiW(b
); else return 0;}
2012 static INT
comp_le_m2(INT a
, LPWSTR b
)
2013 { if (COND_IsNumber(b
[0])) return a
<= atoiW(b
); else return 0;}
2014 static INT
comp_ge_m2(INT a
, LPWSTR b
)
2015 { if (COND_IsNumber(b
[0])) return a
>= atoiW(b
); else return 0;}
2019 static int COND_IsIdent( WCHAR x
)
2021 return( COND_IsAlpha( x
) || COND_IsNumber( x
) || ( x
== '_' )
2022 || ( x
== '#' ) || (x
== '.') );
2025 static int COND_GetOne( struct cond_str
*str
, COND_input
*cond
)
2027 static const WCHAR szNot
[] = {'N','O','T',0};
2028 static const WCHAR szAnd
[] = {'A','N','D',0};
2029 static const WCHAR szOr
[] = {'O','R',0};
2033 str
->data
= &cond
->str
[cond
->n
];
2039 case '(': rc
= COND_LPAR
; break;
2040 case ')': rc
= COND_RPAR
; break;
2041 case '&': rc
= COND_AMPER
; break;
2042 case '!': rc
= COND_EXCLAM
; break;
2043 case '$': rc
= COND_DOLLARS
; break;
2044 case '?': rc
= COND_QUESTION
; break;
2045 case '%': rc
= COND_PERCENT
; break;
2046 case ' ': rc
= COND_SPACE
; break;
2047 case '=': rc
= COND_EQ
; break;
2048 case '~': rc
= COND_TILDA
; break;
2049 case '<': rc
= COND_LT
; break;
2050 case '>': rc
= COND_GT
; break;
2053 const WCHAR
*ch2
= str
->data
+ 1;
2056 while ( *ch2
&& *ch2
!= '"' )
2060 len
= ch2
- str
->data
+ 1;
2065 ERR("Unterminated string\n");
2069 if( COND_IsAlpha( ch
) )
2071 while( COND_IsIdent( str
->data
[len
] ) )
2077 if( COND_IsNumber( ch
) )
2079 while( COND_IsNumber( str
->data
[len
] ) )
2085 ERR("Got unknown character %c(%x)\n",ch
,ch
);
2090 /* keyword identifiers */
2091 if( rc
== COND_IDENT
)
2093 if( (len
==3) && (strncmpiW(str
->data
,szNot
,len
)==0) )
2095 else if( (len
==3) && (strncmpiW(str
->data
,szAnd
,len
)==0) )
2097 else if( (len
==2) && (strncmpiW(str
->data
,szOr
,len
)==0) )
2107 static int COND_lex( void *COND_lval
, COND_input
*cond
)
2110 struct cond_str
*str
= COND_lval
;
2113 rc
= COND_GetOne( str
, cond
);
2114 } while (rc
== COND_SPACE
);
2119 static LPWSTR
COND_GetString( struct cond_str
*str
)
2123 ret
= HeapAlloc( GetProcessHeap(), 0, (str
->len
+1) * sizeof (WCHAR
) );
2126 strncpyW( ret
, str
->data
, str
->len
);
2129 TRACE("Got identifier %s\n",debugstr_w(ret
));
2133 static LPWSTR
COND_GetLiteral( struct cond_str
*str
)
2137 ret
= HeapAlloc( GetProcessHeap(), 0, (str
->len
-1) * sizeof (WCHAR
) );
2140 memcpy( ret
, str
->data
+1, (str
->len
-2) * sizeof(WCHAR
) );
2141 ret
[str
->len
- 2]=0;
2143 TRACE("Got literal %s\n",debugstr_w(ret
));
2147 static int COND_error(char *str
)
2152 MSICONDITION
MSI_EvaluateConditionW( MSIPACKAGE
*package
, LPCWSTR szCondition
)
2157 cond
.package
= package
;
2158 cond
.str
= szCondition
;
2162 TRACE("Evaluating %s\n",debugstr_w(szCondition
));
2164 if( szCondition
&& !COND_parse( &cond
) )
2167 r
= MSICONDITION_ERROR
;
2169 TRACE("Evaluates to %i\n",r
);
2173 MSICONDITION WINAPI
MsiEvaluateConditionW( MSIHANDLE hInstall
, LPCWSTR szCondition
)
2175 MSIPACKAGE
*package
;
2178 package
= msihandle2msiinfo( hInstall
, MSIHANDLETYPE_PACKAGE
);
2180 return ERROR_INVALID_HANDLE
;
2181 ret
= MSI_EvaluateConditionW( package
, szCondition
);
2182 msiobj_release( &package
->hdr
);
2186 MSICONDITION WINAPI
MsiEvaluateConditionA( MSIHANDLE hInstall
, LPCSTR szCondition
)
2188 LPWSTR szwCond
= NULL
;
2193 UINT len
= MultiByteToWideChar( CP_ACP
, 0, szCondition
, -1, NULL
, 0 );
2194 szwCond
= HeapAlloc( GetProcessHeap(), 0, len
* sizeof (WCHAR
) );
2195 MultiByteToWideChar( CP_ACP
, 0, szCondition
, -1, szwCond
, len
);
2198 r
= MsiEvaluateConditionW( hInstall
, szwCond
);
2200 HeapFree( GetProcessHeap(), 0, szwCond
);