[MSI]
[reactos.git] / reactos / dll / win32 / msi / cond.tab.c
1 /* A Bison parser, made by GNU Bison 2.5. */
2
3 /* Bison implementation for Yacc-like parsers in C
4
5 Copyright (C) 1984, 1989-1990, 2000-2011 Free Software Foundation, Inc.
6
7 This program is free software: you can redistribute it and/or modify
8 it under the terms of the GNU General Public License as published by
9 the Free Software Foundation, either version 3 of the License, or
10 (at your option) any later version.
11
12 This program is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU General Public License for more details.
16
17 You should have received a copy of the GNU General Public License
18 along with this program. If not, see <http://www.gnu.org/licenses/>. */
19
20 /* As a special exception, you may create a larger work that contains
21 part or all of the Bison parser skeleton and distribute that work
22 under terms of your choice, so long as that work isn't itself a
23 parser generator using the skeleton or a modified version thereof
24 as a parser skeleton. Alternatively, if you modify or redistribute
25 the parser skeleton itself, you may (at your option) remove this
26 special exception, which will cause the skeleton and the resulting
27 Bison output files to be licensed under the GNU General Public
28 License without this special exception.
29
30 This special exception was added by the Free Software Foundation in
31 version 2.2 of Bison. */
32
33 /* C LALR(1) parser skeleton written by Richard Stallman, by
34 simplifying the original so-called "semantic" parser. */
35
36 /* All symbols defined below should begin with yy or YY, to avoid
37 infringing on user name space. This should be done even for local
38 variables, as they might otherwise be expanded by user macros.
39 There are some unavoidable exceptions within include files to
40 define necessary library symbols; they are noted "INFRINGES ON
41 USER NAME SPACE" below. */
42
43 /* Identify Bison output. */
44 #define YYBISON 1
45
46 /* Bison version. */
47 #define YYBISON_VERSION "2.5"
48
49 /* Skeleton name. */
50 #define YYSKELETON_NAME "yacc.c"
51
52 /* Pure parsers. */
53 #define YYPURE 1
54
55 /* Push parsers. */
56 #define YYPUSH 0
57
58 /* Pull parsers. */
59 #define YYPULL 1
60
61 /* Using locations. */
62 #define YYLSP_NEEDED 0
63
64 /* Substitute the variable and function names. */
65 #define yyparse cond_parse
66 #define yylex cond_lex
67 #define yyerror cond_error
68 #define yylval cond_lval
69 #define yychar cond_char
70 #define yydebug cond_debug
71 #define yynerrs cond_nerrs
72
73
74 /* Copy the first part of user declarations. */
75
76 /* Line 268 of yacc.c */
77 #line 1 "cond.y"
78
79
80 /*
81 * Implementation of the Microsoft Installer (msi.dll)
82 *
83 * Copyright 2003 Mike McCormack for CodeWeavers
84 *
85 * This library is free software; you can redistribute it and/or
86 * modify it under the terms of the GNU Lesser General Public
87 * License as published by the Free Software Foundation; either
88 * version 2.1 of the License, or (at your option) any later version.
89 *
90 * This library is distributed in the hope that it will be useful,
91 * but WITHOUT ANY WARRANTY; without even the implied warranty of
92 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
93 * Lesser General Public License for more details.
94 *
95 * You should have received a copy of the GNU Lesser General Public
96 * License along with this library; if not, write to the Free Software
97 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
98 */
99
100 #include "msipriv.h"
101
102 WINE_DEFAULT_DEBUG_CHANNEL(msi);
103
104 typedef struct tag_yyinput
105 {
106 MSIPACKAGE *package;
107 LPCWSTR str;
108 INT n;
109 MSICONDITION result;
110 struct list mem;
111 } COND_input;
112
113 struct cond_str {
114 LPCWSTR data;
115 INT len;
116 };
117
118 static LPWSTR COND_GetString( COND_input *info, const struct cond_str *str );
119 static LPWSTR COND_GetLiteral( COND_input *info, const struct cond_str *str );
120 static int cond_lex( void *COND_lval, COND_input *info);
121 static int cond_error( COND_input *info, const char *str);
122
123 static void *cond_alloc( COND_input *cond, unsigned int sz );
124 static void *cond_track_mem( COND_input *cond, void *ptr, unsigned int sz );
125 static void cond_free( void *ptr );
126
127 static INT compare_int( INT a, INT operator, INT b );
128 static INT compare_string( LPCWSTR a, INT operator, LPCWSTR b, BOOL convert );
129
130 static INT compare_and_free_strings( LPWSTR a, INT op, LPWSTR b, BOOL convert )
131 {
132 INT r;
133
134 r = compare_string( a, op, b, convert );
135 cond_free( a );
136 cond_free( b );
137 return r;
138 }
139
140 static BOOL num_from_prop( LPCWSTR p, INT *val )
141 {
142 INT ret = 0, sign = 1;
143
144 if (!p)
145 return FALSE;
146 if (*p == '-')
147 {
148 sign = -1;
149 p++;
150 }
151 if (!*p)
152 return FALSE;
153 while (*p)
154 {
155 if( *p < '0' || *p > '9' )
156 return FALSE;
157 ret = ret*10 + (*p - '0');
158 p++;
159 }
160 *val = ret*sign;
161 return TRUE;
162 }
163
164
165
166 /* Line 268 of yacc.c */
167 #line 188 "cond.tab.c"
168
169 /* Enabling traces. */
170 #ifndef YYDEBUG
171 # define YYDEBUG 0
172 #endif
173
174 /* Enabling verbose error messages. */
175 #ifdef YYERROR_VERBOSE
176 # undef YYERROR_VERBOSE
177 # define YYERROR_VERBOSE 1
178 #else
179 # define YYERROR_VERBOSE 0
180 #endif
181
182 /* Enabling the token table. */
183 #ifndef YYTOKEN_TABLE
184 # define YYTOKEN_TABLE 0
185 #endif
186
187
188 /* Tokens. */
189 #ifndef YYTOKENTYPE
190 # define YYTOKENTYPE
191 /* Put the tokens into the symbol table, so that GDB and other debuggers
192 know about them. */
193 enum yytokentype {
194 COND_SPACE = 258,
195 COND_EOF = 259,
196 COND_OR = 260,
197 COND_AND = 261,
198 COND_NOT = 262,
199 COND_XOR = 263,
200 COND_IMP = 264,
201 COND_EQV = 265,
202 COND_LT = 266,
203 COND_GT = 267,
204 COND_EQ = 268,
205 COND_NE = 269,
206 COND_GE = 270,
207 COND_LE = 271,
208 COND_ILT = 272,
209 COND_IGT = 273,
210 COND_IEQ = 274,
211 COND_INE = 275,
212 COND_IGE = 276,
213 COND_ILE = 277,
214 COND_LPAR = 278,
215 COND_RPAR = 279,
216 COND_TILDA = 280,
217 COND_SS = 281,
218 COND_ISS = 282,
219 COND_ILHS = 283,
220 COND_IRHS = 284,
221 COND_LHS = 285,
222 COND_RHS = 286,
223 COND_PERCENT = 287,
224 COND_DOLLARS = 288,
225 COND_QUESTION = 289,
226 COND_AMPER = 290,
227 COND_EXCLAM = 291,
228 COND_IDENT = 292,
229 COND_NUMBER = 293,
230 COND_LITER = 294,
231 COND_ERROR = 295
232 };
233 #endif
234
235
236
237 #if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED
238 typedef union YYSTYPE
239 {
240
241 /* Line 293 of yacc.c */
242 #line 114 "cond.y"
243
244 struct cond_str str;
245 LPWSTR string;
246 INT value;
247
248
249
250 /* Line 293 of yacc.c */
251 #line 272 "cond.tab.c"
252 } YYSTYPE;
253 # define YYSTYPE_IS_TRIVIAL 1
254 # define yystype YYSTYPE /* obsolescent; will be withdrawn */
255 # define YYSTYPE_IS_DECLARED 1
256 #endif
257
258
259 /* Copy the second part of user declarations. */
260
261
262 /* Line 343 of yacc.c */
263 #line 284 "cond.tab.c"
264
265 #ifdef short
266 # undef short
267 #endif
268
269 #ifdef YYTYPE_UINT8
270 typedef YYTYPE_UINT8 yytype_uint8;
271 #else
272 typedef unsigned char yytype_uint8;
273 #endif
274
275 #ifdef YYTYPE_INT8
276 typedef YYTYPE_INT8 yytype_int8;
277 #elif (defined __STDC__ || defined __C99__FUNC__ \
278 || defined __cplusplus || defined _MSC_VER)
279 typedef signed char yytype_int8;
280 #else
281 typedef short int yytype_int8;
282 #endif
283
284 #ifdef YYTYPE_UINT16
285 typedef YYTYPE_UINT16 yytype_uint16;
286 #else
287 typedef unsigned short int yytype_uint16;
288 #endif
289
290 #ifdef YYTYPE_INT16
291 typedef YYTYPE_INT16 yytype_int16;
292 #else
293 typedef short int yytype_int16;
294 #endif
295
296 #ifndef YYSIZE_T
297 # ifdef __SIZE_TYPE__
298 # define YYSIZE_T __SIZE_TYPE__
299 # elif defined size_t
300 # define YYSIZE_T size_t
301 # elif ! defined YYSIZE_T && (defined __STDC__ || defined __C99__FUNC__ \
302 || defined __cplusplus || defined _MSC_VER)
303 # include <stddef.h> /* INFRINGES ON USER NAME SPACE */
304 # define YYSIZE_T size_t
305 # else
306 # define YYSIZE_T unsigned int
307 # endif
308 #endif
309
310 #define YYSIZE_MAXIMUM ((YYSIZE_T) -1)
311
312 #ifndef YY_
313 # if defined YYENABLE_NLS && YYENABLE_NLS
314 # if ENABLE_NLS
315 # include <libintl.h> /* INFRINGES ON USER NAME SPACE */
316 # define YY_(msgid) dgettext ("bison-runtime", msgid)
317 # endif
318 # endif
319 # ifndef YY_
320 # define YY_(msgid) msgid
321 # endif
322 #endif
323
324 /* Suppress unused-variable warnings by "using" E. */
325 #if ! defined lint || defined __GNUC__
326 # define YYUSE(e) ((void) (e))
327 #else
328 # define YYUSE(e) /* empty */
329 #endif
330
331 /* Identity function, used to suppress warnings about constant conditions. */
332 #ifndef lint
333 # define YYID(n) (n)
334 #else
335 #if (defined __STDC__ || defined __C99__FUNC__ \
336 || defined __cplusplus || defined _MSC_VER)
337 static int
338 YYID (int yyi)
339 #else
340 static int
341 YYID (yyi)
342 int yyi;
343 #endif
344 {
345 return yyi;
346 }
347 #endif
348
349 #if ! defined yyoverflow || YYERROR_VERBOSE
350
351 /* The parser invokes alloca or malloc; define the necessary symbols. */
352
353 # ifdef YYSTACK_USE_ALLOCA
354 # if YYSTACK_USE_ALLOCA
355 # ifdef __GNUC__
356 # define YYSTACK_ALLOC __builtin_alloca
357 # elif defined __BUILTIN_VA_ARG_INCR
358 # include <alloca.h> /* INFRINGES ON USER NAME SPACE */
359 # elif defined _AIX
360 # define YYSTACK_ALLOC __alloca
361 # elif defined _MSC_VER
362 # include <malloc.h> /* INFRINGES ON USER NAME SPACE */
363 # define alloca _alloca
364 # else
365 # define YYSTACK_ALLOC alloca
366 # if ! defined _ALLOCA_H && ! defined EXIT_SUCCESS && (defined __STDC__ || defined __C99__FUNC__ \
367 || defined __cplusplus || defined _MSC_VER)
368 # include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
369 # ifndef EXIT_SUCCESS
370 # define EXIT_SUCCESS 0
371 # endif
372 # endif
373 # endif
374 # endif
375 # endif
376
377 # ifdef YYSTACK_ALLOC
378 /* Pacify GCC's `empty if-body' warning. */
379 # define YYSTACK_FREE(Ptr) do { /* empty */; } while (YYID (0))
380 # ifndef YYSTACK_ALLOC_MAXIMUM
381 /* The OS might guarantee only one guard page at the bottom of the stack,
382 and a page size can be as small as 4096 bytes. So we cannot safely
383 invoke alloca (N) if N exceeds 4096. Use a slightly smaller number
384 to allow for a few compiler-allocated temporary stack slots. */
385 # define YYSTACK_ALLOC_MAXIMUM 4032 /* reasonable circa 2006 */
386 # endif
387 # else
388 # define YYSTACK_ALLOC YYMALLOC
389 # define YYSTACK_FREE YYFREE
390 # ifndef YYSTACK_ALLOC_MAXIMUM
391 # define YYSTACK_ALLOC_MAXIMUM YYSIZE_MAXIMUM
392 # endif
393 # if (defined __cplusplus && ! defined EXIT_SUCCESS \
394 && ! ((defined YYMALLOC || defined malloc) \
395 && (defined YYFREE || defined free)))
396 # include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
397 # ifndef EXIT_SUCCESS
398 # define EXIT_SUCCESS 0
399 # endif
400 # endif
401 # ifndef YYMALLOC
402 # define YYMALLOC malloc
403 # if ! defined malloc && ! defined EXIT_SUCCESS && (defined __STDC__ || defined __C99__FUNC__ \
404 || defined __cplusplus || defined _MSC_VER)
405 void *malloc (YYSIZE_T); /* INFRINGES ON USER NAME SPACE */
406 # endif
407 # endif
408 # ifndef YYFREE
409 # define YYFREE free
410 # if ! defined free && ! defined EXIT_SUCCESS && (defined __STDC__ || defined __C99__FUNC__ \
411 || defined __cplusplus || defined _MSC_VER)
412 void free (void *); /* INFRINGES ON USER NAME SPACE */
413 # endif
414 # endif
415 # endif
416 #endif /* ! defined yyoverflow || YYERROR_VERBOSE */
417
418
419 #if (! defined yyoverflow \
420 && (! defined __cplusplus \
421 || (defined YYSTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL)))
422
423 /* A type that is properly aligned for any stack member. */
424 union yyalloc
425 {
426 yytype_int16 yyss_alloc;
427 YYSTYPE yyvs_alloc;
428 };
429
430 /* The size of the maximum gap between one aligned stack and the next. */
431 # define YYSTACK_GAP_MAXIMUM (sizeof (union yyalloc) - 1)
432
433 /* The size of an array large to enough to hold all stacks, each with
434 N elements. */
435 # define YYSTACK_BYTES(N) \
436 ((N) * (sizeof (yytype_int16) + sizeof (YYSTYPE)) \
437 + YYSTACK_GAP_MAXIMUM)
438
439 # define YYCOPY_NEEDED 1
440
441 /* Relocate STACK from its old location to the new one. The
442 local variables YYSIZE and YYSTACKSIZE give the old and new number of
443 elements in the stack, and YYPTR gives the new location of the
444 stack. Advance YYPTR to a properly aligned location for the next
445 stack. */
446 # define YYSTACK_RELOCATE(Stack_alloc, Stack) \
447 do \
448 { \
449 YYSIZE_T yynewbytes; \
450 YYCOPY (&yyptr->Stack_alloc, Stack, yysize); \
451 Stack = &yyptr->Stack_alloc; \
452 yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \
453 yyptr += yynewbytes / sizeof (*yyptr); \
454 } \
455 while (YYID (0))
456
457 #endif
458
459 #if defined YYCOPY_NEEDED && YYCOPY_NEEDED
460 /* Copy COUNT objects from FROM to TO. The source and destination do
461 not overlap. */
462 # ifndef YYCOPY
463 # if defined __GNUC__ && 1 < __GNUC__
464 # define YYCOPY(To, From, Count) \
465 __builtin_memcpy (To, From, (Count) * sizeof (*(From)))
466 # else
467 # define YYCOPY(To, From, Count) \
468 do \
469 { \
470 YYSIZE_T yyi; \
471 for (yyi = 0; yyi < (Count); yyi++) \
472 (To)[yyi] = (From)[yyi]; \
473 } \
474 while (YYID (0))
475 # endif
476 # endif
477 #endif /* !YYCOPY_NEEDED */
478
479 /* YYFINAL -- State number of the termination state. */
480 #define YYFINAL 28
481 /* YYLAST -- Last index in YYTABLE. */
482 #define YYLAST 71
483
484 /* YYNTOKENS -- Number of terminals. */
485 #define YYNTOKENS 41
486 /* YYNNTS -- Number of nonterminals. */
487 #define YYNNTS 12
488 /* YYNRULES -- Number of rules. */
489 #define YYNRULES 53
490 /* YYNRULES -- Number of states. */
491 #define YYNSTATES 70
492
493 /* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */
494 #define YYUNDEFTOK 2
495 #define YYMAXUTOK 295
496
497 #define YYTRANSLATE(YYX) \
498 ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK)
499
500 /* YYTRANSLATE[YYLEX] -- Bison symbol number corresponding to YYLEX. */
501 static const yytype_uint8 yytranslate[] =
502 {
503 0, 2, 2, 2, 2, 2, 2, 2, 2, 2,
504 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
505 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
506 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
507 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
508 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
509 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
510 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
511 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
512 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
513 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
514 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
515 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
516 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
517 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
518 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
519 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
520 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
521 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
522 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
523 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
524 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
525 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
526 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
527 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
528 2, 2, 2, 2, 2, 2, 1, 2, 3, 4,
529 5, 6, 7, 8, 9, 10, 11, 12, 13, 14,
530 15, 16, 17, 18, 19, 20, 21, 22, 23, 24,
531 25, 26, 27, 28, 29, 30, 31, 32, 33, 34,
532 35, 36, 37, 38, 39, 40
533 };
534
535 #if YYDEBUG
536 /* YYPRHS[YYN] -- Index of the first RHS symbol of rule number YYN in
537 YYRHS. */
538 static const yytype_uint8 yyprhs[] =
539 {
540 0, 0, 3, 5, 6, 8, 12, 16, 20, 24,
541 26, 30, 33, 35, 37, 41, 45, 49, 53, 57,
542 61, 65, 69, 73, 77, 79, 81, 83, 85, 87,
543 89, 91, 93, 95, 97, 99, 101, 103, 105, 107,
544 109, 111, 113, 115, 117, 119, 121, 124, 127, 130,
545 133, 135, 138, 140
546 };
547
548 /* YYRHS -- A `-1'-separated list of the rules' RHS. */
549 static const yytype_int8 yyrhs[] =
550 {
551 42, 0, -1, 43, -1, -1, 44, -1, 43, 5,
552 44, -1, 43, 9, 44, -1, 43, 8, 44, -1,
553 43, 10, 44, -1, 45, -1, 44, 6, 45, -1,
554 7, 45, -1, 49, -1, 47, -1, 49, 46, 49,
555 -1, 50, 46, 49, -1, 49, 46, 50, -1, 50,
556 46, 50, -1, 50, 46, 48, -1, 48, 46, 50,
557 -1, 48, 46, 48, -1, 48, 46, 49, -1, 49,
558 46, 48, -1, 23, 43, 24, -1, 13, -1, 14,
559 -1, 11, -1, 12, -1, 16, -1, 15, -1, 26,
560 -1, 19, -1, 20, -1, 17, -1, 18, -1, 22,
561 -1, 21, -1, 27, -1, 30, -1, 31, -1, 28,
562 -1, 29, -1, 50, -1, 48, -1, 39, -1, 52,
563 -1, 33, 51, -1, 34, 51, -1, 35, 51, -1,
564 36, 51, -1, 51, -1, 32, 51, -1, 37, -1,
565 38, -1
566 };
567
568 /* YYRLINE[YYN] -- source line where rule number YYN was defined. */
569 static const yytype_uint16 yyrline[] =
570 {
571 0, 138, 138, 144, 151, 155, 159, 163, 167, 174,
572 178, 185, 189, 193, 198, 202, 211, 220, 224, 228,
573 232, 236, 241, 246, 254, 255, 256, 257, 258, 259,
574 260, 261, 262, 263, 264, 265, 266, 267, 268, 269,
575 270, 271, 275, 279, 286, 296, 300, 309, 318, 331,
576 343, 356, 373, 383
577 };
578 #endif
579
580 #if YYDEBUG || YYERROR_VERBOSE || YYTOKEN_TABLE
581 /* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM.
582 First, the terminals, then, starting at YYNTOKENS, nonterminals. */
583 static const char *const yytname[] =
584 {
585 "$end", "error", "$undefined", "COND_SPACE", "COND_EOF", "COND_OR",
586 "COND_AND", "COND_NOT", "COND_XOR", "COND_IMP", "COND_EQV", "COND_LT",
587 "COND_GT", "COND_EQ", "COND_NE", "COND_GE", "COND_LE", "COND_ILT",
588 "COND_IGT", "COND_IEQ", "COND_INE", "COND_IGE", "COND_ILE", "COND_LPAR",
589 "COND_RPAR", "COND_TILDA", "COND_SS", "COND_ISS", "COND_ILHS",
590 "COND_IRHS", "COND_LHS", "COND_RHS", "COND_PERCENT", "COND_DOLLARS",
591 "COND_QUESTION", "COND_AMPER", "COND_EXCLAM", "COND_IDENT",
592 "COND_NUMBER", "COND_LITER", "COND_ERROR", "$accept", "condition",
593 "expression", "boolean_term", "boolean_factor", "operator", "value_s",
594 "literal", "value_i", "symbol_s", "identifier", "integer", 0
595 };
596 #endif
597
598 # ifdef YYPRINT
599 /* YYTOKNUM[YYLEX-NUM] -- Internal token number corresponding to
600 token YYLEX-NUM. */
601 static const yytype_uint16 yytoknum[] =
602 {
603 0, 256, 257, 258, 259, 260, 261, 262, 263, 264,
604 265, 266, 267, 268, 269, 270, 271, 272, 273, 274,
605 275, 276, 277, 278, 279, 280, 281, 282, 283, 284,
606 285, 286, 287, 288, 289, 290, 291, 292, 293, 294,
607 295
608 };
609 # endif
610
611 /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */
612 static const yytype_uint8 yyr1[] =
613 {
614 0, 41, 42, 42, 43, 43, 43, 43, 43, 44,
615 44, 45, 45, 45, 45, 45, 45, 45, 45, 45,
616 45, 45, 45, 45, 46, 46, 46, 46, 46, 46,
617 46, 46, 46, 46, 46, 46, 46, 46, 46, 46,
618 46, 46, 47, 47, 48, 49, 49, 49, 49, 49,
619 50, 50, 51, 52
620 };
621
622 /* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */
623 static const yytype_uint8 yyr2[] =
624 {
625 0, 2, 1, 0, 1, 3, 3, 3, 3, 1,
626 3, 2, 1, 1, 3, 3, 3, 3, 3, 3,
627 3, 3, 3, 3, 1, 1, 1, 1, 1, 1,
628 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
629 1, 1, 1, 1, 1, 1, 2, 2, 2, 2,
630 1, 2, 1, 1
631 };
632
633 /* YYDEFACT[STATE-NAME] -- Default reduction number in state STATE-NUM.
634 Performed when YYTABLE doesn't specify something else to do. Zero
635 means the default is an error. */
636 static const yytype_uint8 yydefact[] =
637 {
638 3, 0, 0, 0, 0, 0, 0, 0, 52, 53,
639 44, 0, 2, 4, 9, 13, 43, 12, 42, 50,
640 45, 11, 0, 51, 46, 47, 48, 49, 1, 0,
641 0, 0, 0, 0, 26, 27, 24, 25, 29, 28,
642 33, 34, 31, 32, 36, 35, 30, 37, 40, 41,
643 38, 39, 0, 0, 0, 23, 5, 7, 6, 8,
644 10, 20, 21, 19, 22, 14, 16, 18, 15, 17
645 };
646
647 /* YYDEFGOTO[NTERM-NUM]. */
648 static const yytype_int8 yydefgoto[] =
649 {
650 -1, 11, 12, 13, 14, 52, 15, 16, 17, 18,
651 19, 20
652 };
653
654 /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
655 STATE-NUM. */
656 #define YYPACT_NINF -15
657 static const yytype_int8 yypact[] =
658 {
659 -7, -7, -7, -14, -14, -14, -14, -14, -15, -15,
660 -15, 24, 46, 30, -15, -15, -9, -9, -9, -15,
661 -15, -15, 29, -15, -15, -15, -15, -15, -15, -7,
662 -7, -7, -7, -7, -15, -15, -15, -15, -15, -15,
663 -15, -15, -15, -15, -15, -15, -15, -15, -15, -15,
664 -15, -15, 8, 8, 8, -15, 30, 30, 30, 30,
665 -15, -15, -15, -15, -15, -15, -15, -15, -15, -15
666 };
667
668 /* YYPGOTO[NTERM-NUM]. */
669 static const yytype_int8 yypgoto[] =
670 {
671 -15, -15, 50, 33, 0, -3, -15, -4, 14, 17,
672 54, -15
673 };
674
675 /* YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If
676 positive, shift that token. If negative, reduce the rule which
677 number is the opposite. If YYTABLE_NINF, syntax error. */
678 #define YYTABLE_NINF -1
679 static const yytype_uint8 yytable[] =
680 {
681 1, 21, 34, 35, 36, 37, 38, 39, 40, 41,
682 42, 43, 44, 45, 53, 54, 2, 46, 47, 48,
683 49, 50, 51, 8, 28, 3, 4, 5, 6, 7,
684 8, 9, 10, 60, 29, 0, 33, 30, 31, 32,
685 3, 4, 5, 6, 7, 8, 9, 10, 61, 64,
686 67, 29, 22, 55, 30, 31, 32, 23, 24, 25,
687 26, 27, 56, 57, 58, 59, 62, 65, 68, 63,
688 66, 69
689 };
690
691 #define yypact_value_is_default(yystate) \
692 ((yystate) == (-15))
693
694 #define yytable_value_is_error(yytable_value) \
695 YYID (0)
696
697 static const yytype_int8 yycheck[] =
698 {
699 7, 1, 11, 12, 13, 14, 15, 16, 17, 18,
700 19, 20, 21, 22, 17, 18, 23, 26, 27, 28,
701 29, 30, 31, 37, 0, 32, 33, 34, 35, 36,
702 37, 38, 39, 33, 5, -1, 6, 8, 9, 10,
703 32, 33, 34, 35, 36, 37, 38, 39, 52, 53,
704 54, 5, 2, 24, 8, 9, 10, 3, 4, 5,
705 6, 7, 29, 30, 31, 32, 52, 53, 54, 52,
706 53, 54
707 };
708
709 /* YYSTOS[STATE-NUM] -- The (internal number of the) accessing
710 symbol of state STATE-NUM. */
711 static const yytype_uint8 yystos[] =
712 {
713 0, 7, 23, 32, 33, 34, 35, 36, 37, 38,
714 39, 42, 43, 44, 45, 47, 48, 49, 50, 51,
715 52, 45, 43, 51, 51, 51, 51, 51, 0, 5,
716 8, 9, 10, 6, 11, 12, 13, 14, 15, 16,
717 17, 18, 19, 20, 21, 22, 26, 27, 28, 29,
718 30, 31, 46, 46, 46, 24, 44, 44, 44, 44,
719 45, 48, 49, 50, 48, 49, 50, 48, 49, 50
720 };
721
722 #define yyerrok (yyerrstatus = 0)
723 #define yyclearin (yychar = YYEMPTY)
724 #define YYEMPTY (-2)
725 #define YYEOF 0
726
727 #define YYACCEPT goto yyacceptlab
728 #define YYABORT goto yyabortlab
729 #define YYERROR goto yyerrorlab
730
731
732 /* Like YYERROR except do call yyerror. This remains here temporarily
733 to ease the transition to the new meaning of YYERROR, for GCC.
734 Once GCC version 2 has supplanted version 1, this can go. However,
735 YYFAIL appears to be in use. Nevertheless, it is formally deprecated
736 in Bison 2.4.2's NEWS entry, where a plan to phase it out is
737 discussed. */
738
739 #define YYFAIL goto yyerrlab
740 #if defined YYFAIL
741 /* This is here to suppress warnings from the GCC cpp's
742 -Wunused-macros. Normally we don't worry about that warning, but
743 some users do, and we want to make it easy for users to remove
744 YYFAIL uses, which will produce warnings from Bison 2.5. */
745 #endif
746
747 #define YYRECOVERING() (!!yyerrstatus)
748
749 #define YYBACKUP(Token, Value) \
750 do \
751 if (yychar == YYEMPTY && yylen == 1) \
752 { \
753 yychar = (Token); \
754 yylval = (Value); \
755 YYPOPSTACK (1); \
756 goto yybackup; \
757 } \
758 else \
759 { \
760 yyerror (info, YY_("syntax error: cannot back up")); \
761 YYERROR; \
762 } \
763 while (YYID (0))
764
765
766 #define YYTERROR 1
767 #define YYERRCODE 256
768
769
770 /* YYLLOC_DEFAULT -- Set CURRENT to span from RHS[1] to RHS[N].
771 If N is 0, then set CURRENT to the empty location which ends
772 the previous symbol: RHS[0] (always defined). */
773
774 #define YYRHSLOC(Rhs, K) ((Rhs)[K])
775 #ifndef YYLLOC_DEFAULT
776 # define YYLLOC_DEFAULT(Current, Rhs, N) \
777 do \
778 if (YYID (N)) \
779 { \
780 (Current).first_line = YYRHSLOC (Rhs, 1).first_line; \
781 (Current).first_column = YYRHSLOC (Rhs, 1).first_column; \
782 (Current).last_line = YYRHSLOC (Rhs, N).last_line; \
783 (Current).last_column = YYRHSLOC (Rhs, N).last_column; \
784 } \
785 else \
786 { \
787 (Current).first_line = (Current).last_line = \
788 YYRHSLOC (Rhs, 0).last_line; \
789 (Current).first_column = (Current).last_column = \
790 YYRHSLOC (Rhs, 0).last_column; \
791 } \
792 while (YYID (0))
793 #endif
794
795
796 /* This macro is provided for backward compatibility. */
797
798 #ifndef YY_LOCATION_PRINT
799 # define YY_LOCATION_PRINT(File, Loc) ((void) 0)
800 #endif
801
802
803 /* YYLEX -- calling `yylex' with the right arguments. */
804
805 #ifdef YYLEX_PARAM
806 # define YYLEX yylex (&yylval, YYLEX_PARAM)
807 #else
808 # define YYLEX yylex (&yylval, info)
809 #endif
810
811 /* Enable debugging if requested. */
812 #if YYDEBUG
813
814 # ifndef YYFPRINTF
815 # include <stdio.h> /* INFRINGES ON USER NAME SPACE */
816 # define YYFPRINTF fprintf
817 # endif
818
819 # define YYDPRINTF(Args) \
820 do { \
821 if (yydebug) \
822 YYFPRINTF Args; \
823 } while (YYID (0))
824
825 # define YY_SYMBOL_PRINT(Title, Type, Value, Location) \
826 do { \
827 if (yydebug) \
828 { \
829 YYFPRINTF (stderr, "%s ", Title); \
830 yy_symbol_print (stderr, \
831 Type, Value, info); \
832 YYFPRINTF (stderr, "\n"); \
833 } \
834 } while (YYID (0))
835
836
837 /*--------------------------------.
838 | Print this symbol on YYOUTPUT. |
839 `--------------------------------*/
840
841 /*ARGSUSED*/
842 #if (defined __STDC__ || defined __C99__FUNC__ \
843 || defined __cplusplus || defined _MSC_VER)
844 static void
845 yy_symbol_value_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep, COND_input *info)
846 #else
847 static void
848 yy_symbol_value_print (yyoutput, yytype, yyvaluep, info)
849 FILE *yyoutput;
850 int yytype;
851 YYSTYPE const * const yyvaluep;
852 COND_input *info;
853 #endif
854 {
855 if (!yyvaluep)
856 return;
857 YYUSE (info);
858 # ifdef YYPRINT
859 if (yytype < YYNTOKENS)
860 YYPRINT (yyoutput, yytoknum[yytype], *yyvaluep);
861 # else
862 YYUSE (yyoutput);
863 # endif
864 switch (yytype)
865 {
866 default:
867 break;
868 }
869 }
870
871
872 /*--------------------------------.
873 | Print this symbol on YYOUTPUT. |
874 `--------------------------------*/
875
876 #if (defined __STDC__ || defined __C99__FUNC__ \
877 || defined __cplusplus || defined _MSC_VER)
878 static void
879 yy_symbol_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep, COND_input *info)
880 #else
881 static void
882 yy_symbol_print (yyoutput, yytype, yyvaluep, info)
883 FILE *yyoutput;
884 int yytype;
885 YYSTYPE const * const yyvaluep;
886 COND_input *info;
887 #endif
888 {
889 if (yytype < YYNTOKENS)
890 YYFPRINTF (yyoutput, "token %s (", yytname[yytype]);
891 else
892 YYFPRINTF (yyoutput, "nterm %s (", yytname[yytype]);
893
894 yy_symbol_value_print (yyoutput, yytype, yyvaluep, info);
895 YYFPRINTF (yyoutput, ")");
896 }
897
898 /*------------------------------------------------------------------.
899 | yy_stack_print -- Print the state stack from its BOTTOM up to its |
900 | TOP (included). |
901 `------------------------------------------------------------------*/
902
903 #if (defined __STDC__ || defined __C99__FUNC__ \
904 || defined __cplusplus || defined _MSC_VER)
905 static void
906 yy_stack_print (yytype_int16 *yybottom, yytype_int16 *yytop)
907 #else
908 static void
909 yy_stack_print (yybottom, yytop)
910 yytype_int16 *yybottom;
911 yytype_int16 *yytop;
912 #endif
913 {
914 YYFPRINTF (stderr, "Stack now");
915 for (; yybottom <= yytop; yybottom++)
916 {
917 int yybot = *yybottom;
918 YYFPRINTF (stderr, " %d", yybot);
919 }
920 YYFPRINTF (stderr, "\n");
921 }
922
923 # define YY_STACK_PRINT(Bottom, Top) \
924 do { \
925 if (yydebug) \
926 yy_stack_print ((Bottom), (Top)); \
927 } while (YYID (0))
928
929
930 /*------------------------------------------------.
931 | Report that the YYRULE is going to be reduced. |
932 `------------------------------------------------*/
933
934 #if (defined __STDC__ || defined __C99__FUNC__ \
935 || defined __cplusplus || defined _MSC_VER)
936 static void
937 yy_reduce_print (YYSTYPE *yyvsp, int yyrule, COND_input *info)
938 #else
939 static void
940 yy_reduce_print (yyvsp, yyrule, info)
941 YYSTYPE *yyvsp;
942 int yyrule;
943 COND_input *info;
944 #endif
945 {
946 int yynrhs = yyr2[yyrule];
947 int yyi;
948 unsigned long int yylno = yyrline[yyrule];
949 YYFPRINTF (stderr, "Reducing stack by rule %d (line %lu):\n",
950 yyrule - 1, yylno);
951 /* The symbols being reduced. */
952 for (yyi = 0; yyi < yynrhs; yyi++)
953 {
954 YYFPRINTF (stderr, " $%d = ", yyi + 1);
955 yy_symbol_print (stderr, yyrhs[yyprhs[yyrule] + yyi],
956 &(yyvsp[(yyi + 1) - (yynrhs)])
957 , info);
958 YYFPRINTF (stderr, "\n");
959 }
960 }
961
962 # define YY_REDUCE_PRINT(Rule) \
963 do { \
964 if (yydebug) \
965 yy_reduce_print (yyvsp, Rule, info); \
966 } while (YYID (0))
967
968 /* Nonzero means print parse trace. It is left uninitialized so that
969 multiple parsers can coexist. */
970 int yydebug;
971 #else /* !YYDEBUG */
972 # define YYDPRINTF(Args)
973 # define YY_SYMBOL_PRINT(Title, Type, Value, Location)
974 # define YY_STACK_PRINT(Bottom, Top)
975 # define YY_REDUCE_PRINT(Rule)
976 #endif /* !YYDEBUG */
977
978
979 /* YYINITDEPTH -- initial size of the parser's stacks. */
980 #ifndef YYINITDEPTH
981 # define YYINITDEPTH 200
982 #endif
983
984 /* YYMAXDEPTH -- maximum size the stacks can grow to (effective only
985 if the built-in stack extension method is used).
986
987 Do not make this value too large; the results are undefined if
988 YYSTACK_ALLOC_MAXIMUM < YYSTACK_BYTES (YYMAXDEPTH)
989 evaluated with infinite-precision integer arithmetic. */
990
991 #ifndef YYMAXDEPTH
992 # define YYMAXDEPTH 10000
993 #endif
994
995
996 #if YYERROR_VERBOSE
997
998 # ifndef yystrlen
999 # if defined __GLIBC__ && defined _STRING_H
1000 # define yystrlen strlen
1001 # else
1002 /* Return the length of YYSTR. */
1003 #if (defined __STDC__ || defined __C99__FUNC__ \
1004 || defined __cplusplus || defined _MSC_VER)
1005 static YYSIZE_T
1006 yystrlen (const char *yystr)
1007 #else
1008 static YYSIZE_T
1009 yystrlen (yystr)
1010 const char *yystr;
1011 #endif
1012 {
1013 YYSIZE_T yylen;
1014 for (yylen = 0; yystr[yylen]; yylen++)
1015 continue;
1016 return yylen;
1017 }
1018 # endif
1019 # endif
1020
1021 # ifndef yystpcpy
1022 # if defined __GLIBC__ && defined _STRING_H && defined _GNU_SOURCE
1023 # define yystpcpy stpcpy
1024 # else
1025 /* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in
1026 YYDEST. */
1027 #if (defined __STDC__ || defined __C99__FUNC__ \
1028 || defined __cplusplus || defined _MSC_VER)
1029 static char *
1030 yystpcpy (char *yydest, const char *yysrc)
1031 #else
1032 static char *
1033 yystpcpy (yydest, yysrc)
1034 char *yydest;
1035 const char *yysrc;
1036 #endif
1037 {
1038 char *yyd = yydest;
1039 const char *yys = yysrc;
1040
1041 while ((*yyd++ = *yys++) != '\0')
1042 continue;
1043
1044 return yyd - 1;
1045 }
1046 # endif
1047 # endif
1048
1049 # ifndef yytnamerr
1050 /* Copy to YYRES the contents of YYSTR after stripping away unnecessary
1051 quotes and backslashes, so that it's suitable for yyerror. The
1052 heuristic is that double-quoting is unnecessary unless the string
1053 contains an apostrophe, a comma, or backslash (other than
1054 backslash-backslash). YYSTR is taken from yytname. If YYRES is
1055 null, do not copy; instead, return the length of what the result
1056 would have been. */
1057 static YYSIZE_T
1058 yytnamerr (char *yyres, const char *yystr)
1059 {
1060 if (*yystr == '"')
1061 {
1062 YYSIZE_T yyn = 0;
1063 char const *yyp = yystr;
1064
1065 for (;;)
1066 switch (*++yyp)
1067 {
1068 case '\'':
1069 case ',':
1070 goto do_not_strip_quotes;
1071
1072 case '\\':
1073 if (*++yyp != '\\')
1074 goto do_not_strip_quotes;
1075 /* Fall through. */
1076 default:
1077 if (yyres)
1078 yyres[yyn] = *yyp;
1079 yyn++;
1080 break;
1081
1082 case '"':
1083 if (yyres)
1084 yyres[yyn] = '\0';
1085 return yyn;
1086 }
1087 do_not_strip_quotes: ;
1088 }
1089
1090 if (! yyres)
1091 return yystrlen (yystr);
1092
1093 return yystpcpy (yyres, yystr) - yyres;
1094 }
1095 # endif
1096
1097 /* Copy into *YYMSG, which is of size *YYMSG_ALLOC, an error message
1098 about the unexpected token YYTOKEN for the state stack whose top is
1099 YYSSP.
1100
1101 Return 0 if *YYMSG was successfully written. Return 1 if *YYMSG is
1102 not large enough to hold the message. In that case, also set
1103 *YYMSG_ALLOC to the required number of bytes. Return 2 if the
1104 required number of bytes is too large to store. */
1105 static int
1106 yysyntax_error (YYSIZE_T *yymsg_alloc, char **yymsg,
1107 yytype_int16 *yyssp, int yytoken)
1108 {
1109 YYSIZE_T yysize0 = yytnamerr (0, yytname[yytoken]);
1110 YYSIZE_T yysize = yysize0;
1111 YYSIZE_T yysize1;
1112 enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 };
1113 /* Internationalized format string. */
1114 const char *yyformat = 0;
1115 /* Arguments of yyformat. */
1116 char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM];
1117 /* Number of reported tokens (one for the "unexpected", one per
1118 "expected"). */
1119 int yycount = 0;
1120
1121 /* There are many possibilities here to consider:
1122 - Assume YYFAIL is not used. It's too flawed to consider. See
1123 <http://lists.gnu.org/archive/html/bison-patches/2009-12/msg00024.html>
1124 for details. YYERROR is fine as it does not invoke this
1125 function.
1126 - If this state is a consistent state with a default action, then
1127 the only way this function was invoked is if the default action
1128 is an error action. In that case, don't check for expected
1129 tokens because there are none.
1130 - The only way there can be no lookahead present (in yychar) is if
1131 this state is a consistent state with a default action. Thus,
1132 detecting the absence of a lookahead is sufficient to determine
1133 that there is no unexpected or expected token to report. In that
1134 case, just report a simple "syntax error".
1135 - Don't assume there isn't a lookahead just because this state is a
1136 consistent state with a default action. There might have been a
1137 previous inconsistent state, consistent state with a non-default
1138 action, or user semantic action that manipulated yychar.
1139 - Of course, the expected token list depends on states to have
1140 correct lookahead information, and it depends on the parser not
1141 to perform extra reductions after fetching a lookahead from the
1142 scanner and before detecting a syntax error. Thus, state merging
1143 (from LALR or IELR) and default reductions corrupt the expected
1144 token list. However, the list is correct for canonical LR with
1145 one exception: it will still contain any token that will not be
1146 accepted due to an error action in a later state.
1147 */
1148 if (yytoken != YYEMPTY)
1149 {
1150 int yyn = yypact[*yyssp];
1151 yyarg[yycount++] = yytname[yytoken];
1152 if (!yypact_value_is_default (yyn))
1153 {
1154 /* Start YYX at -YYN if negative to avoid negative indexes in
1155 YYCHECK. In other words, skip the first -YYN actions for
1156 this state because they are default actions. */
1157 int yyxbegin = yyn < 0 ? -yyn : 0;
1158 /* Stay within bounds of both yycheck and yytname. */
1159 int yychecklim = YYLAST - yyn + 1;
1160 int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS;
1161 int yyx;
1162
1163 for (yyx = yyxbegin; yyx < yyxend; ++yyx)
1164 if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR
1165 && !yytable_value_is_error (yytable[yyx + yyn]))
1166 {
1167 if (yycount == YYERROR_VERBOSE_ARGS_MAXIMUM)
1168 {
1169 yycount = 1;
1170 yysize = yysize0;
1171 break;
1172 }
1173 yyarg[yycount++] = yytname[yyx];
1174 yysize1 = yysize + yytnamerr (0, yytname[yyx]);
1175 if (! (yysize <= yysize1
1176 && yysize1 <= YYSTACK_ALLOC_MAXIMUM))
1177 return 2;
1178 yysize = yysize1;
1179 }
1180 }
1181 }
1182
1183 switch (yycount)
1184 {
1185 # define YYCASE_(N, S) \
1186 case N: \
1187 yyformat = S; \
1188 break
1189 YYCASE_(0, YY_("syntax error"));
1190 YYCASE_(1, YY_("syntax error, unexpected %s"));
1191 YYCASE_(2, YY_("syntax error, unexpected %s, expecting %s"));
1192 YYCASE_(3, YY_("syntax error, unexpected %s, expecting %s or %s"));
1193 YYCASE_(4, YY_("syntax error, unexpected %s, expecting %s or %s or %s"));
1194 YYCASE_(5, YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s"));
1195 # undef YYCASE_
1196 }
1197
1198 yysize1 = yysize + yystrlen (yyformat);
1199 if (! (yysize <= yysize1 && yysize1 <= YYSTACK_ALLOC_MAXIMUM))
1200 return 2;
1201 yysize = yysize1;
1202
1203 if (*yymsg_alloc < yysize)
1204 {
1205 *yymsg_alloc = 2 * yysize;
1206 if (! (yysize <= *yymsg_alloc
1207 && *yymsg_alloc <= YYSTACK_ALLOC_MAXIMUM))
1208 *yymsg_alloc = YYSTACK_ALLOC_MAXIMUM;
1209 return 1;
1210 }
1211
1212 /* Avoid sprintf, as that infringes on the user's name space.
1213 Don't have undefined behavior even if the translation
1214 produced a string with the wrong number of "%s"s. */
1215 {
1216 char *yyp = *yymsg;
1217 int yyi = 0;
1218 while ((*yyp = *yyformat) != '\0')
1219 if (*yyp == '%' && yyformat[1] == 's' && yyi < yycount)
1220 {
1221 yyp += yytnamerr (yyp, yyarg[yyi++]);
1222 yyformat += 2;
1223 }
1224 else
1225 {
1226 yyp++;
1227 yyformat++;
1228 }
1229 }
1230 return 0;
1231 }
1232 #endif /* YYERROR_VERBOSE */
1233
1234 /*-----------------------------------------------.
1235 | Release the memory associated to this symbol. |
1236 `-----------------------------------------------*/
1237
1238 /*ARGSUSED*/
1239 #if (defined __STDC__ || defined __C99__FUNC__ \
1240 || defined __cplusplus || defined _MSC_VER)
1241 static void
1242 yydestruct (const char *yymsg, int yytype, YYSTYPE *yyvaluep, COND_input *info)
1243 #else
1244 static void
1245 yydestruct (yymsg, yytype, yyvaluep, info)
1246 const char *yymsg;
1247 int yytype;
1248 YYSTYPE *yyvaluep;
1249 COND_input *info;
1250 #endif
1251 {
1252 YYUSE (yyvaluep);
1253 YYUSE (info);
1254
1255 if (!yymsg)
1256 yymsg = "Deleting";
1257 YY_SYMBOL_PRINT (yymsg, yytype, yyvaluep, yylocationp);
1258
1259 switch (yytype)
1260 {
1261
1262 default:
1263 break;
1264 }
1265 }
1266
1267
1268 /* Prevent warnings from -Wmissing-prototypes. */
1269 #ifdef YYPARSE_PARAM
1270 #if defined __STDC__ || defined __cplusplus
1271 int yyparse (void *YYPARSE_PARAM);
1272 #else
1273 int yyparse ();
1274 #endif
1275 #else /* ! YYPARSE_PARAM */
1276 #if defined __STDC__ || defined __cplusplus
1277 int yyparse (COND_input *info);
1278 #else
1279 int yyparse ();
1280 #endif
1281 #endif /* ! YYPARSE_PARAM */
1282
1283
1284 /*----------.
1285 | yyparse. |
1286 `----------*/
1287
1288 #ifdef YYPARSE_PARAM
1289 #if (defined __STDC__ || defined __C99__FUNC__ \
1290 || defined __cplusplus || defined _MSC_VER)
1291 int
1292 yyparse (void *YYPARSE_PARAM)
1293 #else
1294 int
1295 yyparse (YYPARSE_PARAM)
1296 void *YYPARSE_PARAM;
1297 #endif
1298 #else /* ! YYPARSE_PARAM */
1299 #if (defined __STDC__ || defined __C99__FUNC__ \
1300 || defined __cplusplus || defined _MSC_VER)
1301 int
1302 yyparse (COND_input *info)
1303 #else
1304 int
1305 yyparse (info)
1306 COND_input *info;
1307 #endif
1308 #endif
1309 {
1310 /* The lookahead symbol. */
1311 int yychar;
1312
1313 /* The semantic value of the lookahead symbol. */
1314 YYSTYPE yylval;
1315
1316 /* Number of syntax errors so far. */
1317 int yynerrs;
1318
1319 int yystate;
1320 /* Number of tokens to shift before error messages enabled. */
1321 int yyerrstatus;
1322
1323 /* The stacks and their tools:
1324 `yyss': related to states.
1325 `yyvs': related to semantic values.
1326
1327 Refer to the stacks thru separate pointers, to allow yyoverflow
1328 to reallocate them elsewhere. */
1329
1330 /* The state stack. */
1331 yytype_int16 yyssa[YYINITDEPTH];
1332 yytype_int16 *yyss;
1333 yytype_int16 *yyssp;
1334
1335 /* The semantic value stack. */
1336 YYSTYPE yyvsa[YYINITDEPTH];
1337 YYSTYPE *yyvs;
1338 YYSTYPE *yyvsp;
1339
1340 YYSIZE_T yystacksize;
1341
1342 int yyn;
1343 int yyresult;
1344 /* Lookahead token as an internal (translated) token number. */
1345 int yytoken;
1346 /* The variables used to return semantic value and location from the
1347 action routines. */
1348 YYSTYPE yyval;
1349
1350 #if YYERROR_VERBOSE
1351 /* Buffer for error messages, and its allocated size. */
1352 char yymsgbuf[128];
1353 char *yymsg = yymsgbuf;
1354 YYSIZE_T yymsg_alloc = sizeof yymsgbuf;
1355 #endif
1356
1357 #define YYPOPSTACK(N) (yyvsp -= (N), yyssp -= (N))
1358
1359 /* The number of symbols on the RHS of the reduced rule.
1360 Keep to zero when no symbol should be popped. */
1361 int yylen = 0;
1362
1363 yytoken = 0;
1364 yyss = yyssa;
1365 yyvs = yyvsa;
1366 yystacksize = YYINITDEPTH;
1367
1368 YYDPRINTF ((stderr, "Starting parse\n"));
1369
1370 yystate = 0;
1371 yyerrstatus = 0;
1372 yynerrs = 0;
1373 yychar = YYEMPTY; /* Cause a token to be read. */
1374
1375 /* Initialize stack pointers.
1376 Waste one element of value and location stack
1377 so that they stay on the same level as the state stack.
1378 The wasted elements are never initialized. */
1379 yyssp = yyss;
1380 yyvsp = yyvs;
1381
1382 goto yysetstate;
1383
1384 /*------------------------------------------------------------.
1385 | yynewstate -- Push a new state, which is found in yystate. |
1386 `------------------------------------------------------------*/
1387 yynewstate:
1388 /* In all cases, when you get here, the value and location stacks
1389 have just been pushed. So pushing a state here evens the stacks. */
1390 yyssp++;
1391
1392 yysetstate:
1393 *yyssp = yystate;
1394
1395 if (yyss + yystacksize - 1 <= yyssp)
1396 {
1397 /* Get the current used size of the three stacks, in elements. */
1398 YYSIZE_T yysize = yyssp - yyss + 1;
1399
1400 #ifdef yyoverflow
1401 {
1402 /* Give user a chance to reallocate the stack. Use copies of
1403 these so that the &'s don't force the real ones into
1404 memory. */
1405 YYSTYPE *yyvs1 = yyvs;
1406 yytype_int16 *yyss1 = yyss;
1407
1408 /* Each stack pointer address is followed by the size of the
1409 data in use in that stack, in bytes. This used to be a
1410 conditional around just the two extra args, but that might
1411 be undefined if yyoverflow is a macro. */
1412 yyoverflow (YY_("memory exhausted"),
1413 &yyss1, yysize * sizeof (*yyssp),
1414 &yyvs1, yysize * sizeof (*yyvsp),
1415 &yystacksize);
1416
1417 yyss = yyss1;
1418 yyvs = yyvs1;
1419 }
1420 #else /* no yyoverflow */
1421 # ifndef YYSTACK_RELOCATE
1422 goto yyexhaustedlab;
1423 # else
1424 /* Extend the stack our own way. */
1425 if (YYMAXDEPTH <= yystacksize)
1426 goto yyexhaustedlab;
1427 yystacksize *= 2;
1428 if (YYMAXDEPTH < yystacksize)
1429 yystacksize = YYMAXDEPTH;
1430
1431 {
1432 yytype_int16 *yyss1 = yyss;
1433 union yyalloc *yyptr =
1434 (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize));
1435 if (! yyptr)
1436 goto yyexhaustedlab;
1437 YYSTACK_RELOCATE (yyss_alloc, yyss);
1438 YYSTACK_RELOCATE (yyvs_alloc, yyvs);
1439 # undef YYSTACK_RELOCATE
1440 if (yyss1 != yyssa)
1441 YYSTACK_FREE (yyss1);
1442 }
1443 # endif
1444 #endif /* no yyoverflow */
1445
1446 yyssp = yyss + yysize - 1;
1447 yyvsp = yyvs + yysize - 1;
1448
1449 YYDPRINTF ((stderr, "Stack size increased to %lu\n",
1450 (unsigned long int) yystacksize));
1451
1452 if (yyss + yystacksize - 1 <= yyssp)
1453 YYABORT;
1454 }
1455
1456 YYDPRINTF ((stderr, "Entering state %d\n", yystate));
1457
1458 if (yystate == YYFINAL)
1459 YYACCEPT;
1460
1461 goto yybackup;
1462
1463 /*-----------.
1464 | yybackup. |
1465 `-----------*/
1466 yybackup:
1467
1468 /* Do appropriate processing given the current state. Read a
1469 lookahead token if we need one and don't already have one. */
1470
1471 /* First try to decide what to do without reference to lookahead token. */
1472 yyn = yypact[yystate];
1473 if (yypact_value_is_default (yyn))
1474 goto yydefault;
1475
1476 /* Not known => get a lookahead token if don't already have one. */
1477
1478 /* YYCHAR is either YYEMPTY or YYEOF or a valid lookahead symbol. */
1479 if (yychar == YYEMPTY)
1480 {
1481 YYDPRINTF ((stderr, "Reading a token: "));
1482 yychar = YYLEX;
1483 }
1484
1485 if (yychar <= YYEOF)
1486 {
1487 yychar = yytoken = YYEOF;
1488 YYDPRINTF ((stderr, "Now at end of input.\n"));
1489 }
1490 else
1491 {
1492 yytoken = YYTRANSLATE (yychar);
1493 YY_SYMBOL_PRINT ("Next token is", yytoken, &yylval, &yylloc);
1494 }
1495
1496 /* If the proper action on seeing token YYTOKEN is to reduce or to
1497 detect an error, take that action. */
1498 yyn += yytoken;
1499 if (yyn < 0 || YYLAST < yyn || yycheck[yyn] != yytoken)
1500 goto yydefault;
1501 yyn = yytable[yyn];
1502 if (yyn <= 0)
1503 {
1504 if (yytable_value_is_error (yyn))
1505 goto yyerrlab;
1506 yyn = -yyn;
1507 goto yyreduce;
1508 }
1509
1510 /* Count tokens shifted since error; after three, turn off error
1511 status. */
1512 if (yyerrstatus)
1513 yyerrstatus--;
1514
1515 /* Shift the lookahead token. */
1516 YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc);
1517
1518 /* Discard the shifted token. */
1519 yychar = YYEMPTY;
1520
1521 yystate = yyn;
1522 *++yyvsp = yylval;
1523
1524 goto yynewstate;
1525
1526
1527 /*-----------------------------------------------------------.
1528 | yydefault -- do the default action for the current state. |
1529 `-----------------------------------------------------------*/
1530 yydefault:
1531 yyn = yydefact[yystate];
1532 if (yyn == 0)
1533 goto yyerrlab;
1534 goto yyreduce;
1535
1536
1537 /*-----------------------------.
1538 | yyreduce -- Do a reduction. |
1539 `-----------------------------*/
1540 yyreduce:
1541 /* yyn is the number of a rule to reduce with. */
1542 yylen = yyr2[yyn];
1543
1544 /* If YYLEN is nonzero, implement the default value of the action:
1545 `$$ = $1'.
1546
1547 Otherwise, the following line sets YYVAL to garbage.
1548 This behavior is undocumented and Bison
1549 users should not rely upon it. Assigning to YYVAL
1550 unconditionally makes the parser a bit smaller, and it avoids a
1551 GCC warning that YYVAL may be used uninitialized. */
1552 yyval = yyvsp[1-yylen];
1553
1554
1555 YY_REDUCE_PRINT (yyn);
1556 switch (yyn)
1557 {
1558 case 2:
1559
1560 /* Line 1806 of yacc.c */
1561 #line 139 "cond.y"
1562 {
1563 COND_input* cond = (COND_input*) info;
1564 cond->result = (yyvsp[(1) - (1)].value);
1565 }
1566 break;
1567
1568 case 3:
1569
1570 /* Line 1806 of yacc.c */
1571 #line 144 "cond.y"
1572 {
1573 COND_input* cond = (COND_input*) info;
1574 cond->result = MSICONDITION_NONE;
1575 }
1576 break;
1577
1578 case 4:
1579
1580 /* Line 1806 of yacc.c */
1581 #line 152 "cond.y"
1582 {
1583 (yyval.value) = (yyvsp[(1) - (1)].value);
1584 }
1585 break;
1586
1587 case 5:
1588
1589 /* Line 1806 of yacc.c */
1590 #line 156 "cond.y"
1591 {
1592 (yyval.value) = (yyvsp[(1) - (3)].value) || (yyvsp[(3) - (3)].value);
1593 }
1594 break;
1595
1596 case 6:
1597
1598 /* Line 1806 of yacc.c */
1599 #line 160 "cond.y"
1600 {
1601 (yyval.value) = !(yyvsp[(1) - (3)].value) || (yyvsp[(3) - (3)].value);
1602 }
1603 break;
1604
1605 case 7:
1606
1607 /* Line 1806 of yacc.c */
1608 #line 164 "cond.y"
1609 {
1610 (yyval.value) = ( (yyvsp[(1) - (3)].value) || (yyvsp[(3) - (3)].value) ) && !( (yyvsp[(1) - (3)].value) && (yyvsp[(3) - (3)].value) );
1611 }
1612 break;
1613
1614 case 8:
1615
1616 /* Line 1806 of yacc.c */
1617 #line 168 "cond.y"
1618 {
1619 (yyval.value) = ( (yyvsp[(1) - (3)].value) && (yyvsp[(3) - (3)].value) ) || ( !(yyvsp[(1) - (3)].value) && !(yyvsp[(3) - (3)].value) );
1620 }
1621 break;
1622
1623 case 9:
1624
1625 /* Line 1806 of yacc.c */
1626 #line 175 "cond.y"
1627 {
1628 (yyval.value) = (yyvsp[(1) - (1)].value);
1629 }
1630 break;
1631
1632 case 10:
1633
1634 /* Line 1806 of yacc.c */
1635 #line 179 "cond.y"
1636 {
1637 (yyval.value) = (yyvsp[(1) - (3)].value) && (yyvsp[(3) - (3)].value);
1638 }
1639 break;
1640
1641 case 11:
1642
1643 /* Line 1806 of yacc.c */
1644 #line 186 "cond.y"
1645 {
1646 (yyval.value) = (yyvsp[(2) - (2)].value) ? 0 : 1;
1647 }
1648 break;
1649
1650 case 12:
1651
1652 /* Line 1806 of yacc.c */
1653 #line 190 "cond.y"
1654 {
1655 (yyval.value) = (yyvsp[(1) - (1)].value) ? 1 : 0;
1656 }
1657 break;
1658
1659 case 13:
1660
1661 /* Line 1806 of yacc.c */
1662 #line 194 "cond.y"
1663 {
1664 (yyval.value) = ((yyvsp[(1) - (1)].string) && (yyvsp[(1) - (1)].string)[0]) ? 1 : 0;
1665 cond_free( (yyvsp[(1) - (1)].string) );
1666 }
1667 break;
1668
1669 case 14:
1670
1671 /* Line 1806 of yacc.c */
1672 #line 199 "cond.y"
1673 {
1674 (yyval.value) = compare_int( (yyvsp[(1) - (3)].value), (yyvsp[(2) - (3)].value), (yyvsp[(3) - (3)].value) );
1675 }
1676 break;
1677
1678 case 15:
1679
1680 /* Line 1806 of yacc.c */
1681 #line 203 "cond.y"
1682 {
1683 int num;
1684 if (num_from_prop( (yyvsp[(1) - (3)].string), &num ))
1685 (yyval.value) = compare_int( num, (yyvsp[(2) - (3)].value), (yyvsp[(3) - (3)].value) );
1686 else
1687 (yyval.value) = ((yyvsp[(2) - (3)].value) == COND_NE || (yyvsp[(2) - (3)].value) == COND_INE );
1688 cond_free( (yyvsp[(1) - (3)].string) );
1689 }
1690 break;
1691
1692 case 16:
1693
1694 /* Line 1806 of yacc.c */
1695 #line 212 "cond.y"
1696 {
1697 int num;
1698 if (num_from_prop( (yyvsp[(3) - (3)].string), &num ))
1699 (yyval.value) = compare_int( (yyvsp[(1) - (3)].value), (yyvsp[(2) - (3)].value), num );
1700 else
1701 (yyval.value) = ((yyvsp[(2) - (3)].value) == COND_NE || (yyvsp[(2) - (3)].value) == COND_INE );
1702 cond_free( (yyvsp[(3) - (3)].string) );
1703 }
1704 break;
1705
1706 case 17:
1707
1708 /* Line 1806 of yacc.c */
1709 #line 221 "cond.y"
1710 {
1711 (yyval.value) = compare_and_free_strings( (yyvsp[(1) - (3)].string), (yyvsp[(2) - (3)].value), (yyvsp[(3) - (3)].string), TRUE );
1712 }
1713 break;
1714
1715 case 18:
1716
1717 /* Line 1806 of yacc.c */
1718 #line 225 "cond.y"
1719 {
1720 (yyval.value) = compare_and_free_strings( (yyvsp[(1) - (3)].string), (yyvsp[(2) - (3)].value), (yyvsp[(3) - (3)].string), TRUE );
1721 }
1722 break;
1723
1724 case 19:
1725
1726 /* Line 1806 of yacc.c */
1727 #line 229 "cond.y"
1728 {
1729 (yyval.value) = compare_and_free_strings( (yyvsp[(1) - (3)].string), (yyvsp[(2) - (3)].value), (yyvsp[(3) - (3)].string), TRUE );
1730 }
1731 break;
1732
1733 case 20:
1734
1735 /* Line 1806 of yacc.c */
1736 #line 233 "cond.y"
1737 {
1738 (yyval.value) = compare_and_free_strings( (yyvsp[(1) - (3)].string), (yyvsp[(2) - (3)].value), (yyvsp[(3) - (3)].string), FALSE );
1739 }
1740 break;
1741
1742 case 21:
1743
1744 /* Line 1806 of yacc.c */
1745 #line 237 "cond.y"
1746 {
1747 (yyval.value) = 0;
1748 cond_free( (yyvsp[(1) - (3)].string) );
1749 }
1750 break;
1751
1752 case 22:
1753
1754 /* Line 1806 of yacc.c */
1755 #line 242 "cond.y"
1756 {
1757 (yyval.value) = 0;
1758 cond_free( (yyvsp[(3) - (3)].string) );
1759 }
1760 break;
1761
1762 case 23:
1763
1764 /* Line 1806 of yacc.c */
1765 #line 247 "cond.y"
1766 {
1767 (yyval.value) = (yyvsp[(2) - (3)].value);
1768 }
1769 break;
1770
1771 case 24:
1772
1773 /* Line 1806 of yacc.c */
1774 #line 254 "cond.y"
1775 { (yyval.value) = COND_EQ; }
1776 break;
1777
1778 case 25:
1779
1780 /* Line 1806 of yacc.c */
1781 #line 255 "cond.y"
1782 { (yyval.value) = COND_NE; }
1783 break;
1784
1785 case 26:
1786
1787 /* Line 1806 of yacc.c */
1788 #line 256 "cond.y"
1789 { (yyval.value) = COND_LT; }
1790 break;
1791
1792 case 27:
1793
1794 /* Line 1806 of yacc.c */
1795 #line 257 "cond.y"
1796 { (yyval.value) = COND_GT; }
1797 break;
1798
1799 case 28:
1800
1801 /* Line 1806 of yacc.c */
1802 #line 258 "cond.y"
1803 { (yyval.value) = COND_LE; }
1804 break;
1805
1806 case 29:
1807
1808 /* Line 1806 of yacc.c */
1809 #line 259 "cond.y"
1810 { (yyval.value) = COND_GE; }
1811 break;
1812
1813 case 30:
1814
1815 /* Line 1806 of yacc.c */
1816 #line 260 "cond.y"
1817 { (yyval.value) = COND_SS; }
1818 break;
1819
1820 case 31:
1821
1822 /* Line 1806 of yacc.c */
1823 #line 261 "cond.y"
1824 { (yyval.value) = COND_IEQ; }
1825 break;
1826
1827 case 32:
1828
1829 /* Line 1806 of yacc.c */
1830 #line 262 "cond.y"
1831 { (yyval.value) = COND_INE; }
1832 break;
1833
1834 case 33:
1835
1836 /* Line 1806 of yacc.c */
1837 #line 263 "cond.y"
1838 { (yyval.value) = COND_ILT; }
1839 break;
1840
1841 case 34:
1842
1843 /* Line 1806 of yacc.c */
1844 #line 264 "cond.y"
1845 { (yyval.value) = COND_IGT; }
1846 break;
1847
1848 case 35:
1849
1850 /* Line 1806 of yacc.c */
1851 #line 265 "cond.y"
1852 { (yyval.value) = COND_ILE; }
1853 break;
1854
1855 case 36:
1856
1857 /* Line 1806 of yacc.c */
1858 #line 266 "cond.y"
1859 { (yyval.value) = COND_IGE; }
1860 break;
1861
1862 case 37:
1863
1864 /* Line 1806 of yacc.c */
1865 #line 267 "cond.y"
1866 { (yyval.value) = COND_ISS; }
1867 break;
1868
1869 case 38:
1870
1871 /* Line 1806 of yacc.c */
1872 #line 268 "cond.y"
1873 { (yyval.value) = COND_LHS; }
1874 break;
1875
1876 case 39:
1877
1878 /* Line 1806 of yacc.c */
1879 #line 269 "cond.y"
1880 { (yyval.value) = COND_RHS; }
1881 break;
1882
1883 case 40:
1884
1885 /* Line 1806 of yacc.c */
1886 #line 270 "cond.y"
1887 { (yyval.value) = COND_ILHS; }
1888 break;
1889
1890 case 41:
1891
1892 /* Line 1806 of yacc.c */
1893 #line 271 "cond.y"
1894 { (yyval.value) = COND_IRHS; }
1895 break;
1896
1897 case 42:
1898
1899 /* Line 1806 of yacc.c */
1900 #line 276 "cond.y"
1901 {
1902 (yyval.string) = (yyvsp[(1) - (1)].string);
1903 }
1904 break;
1905
1906 case 43:
1907
1908 /* Line 1806 of yacc.c */
1909 #line 280 "cond.y"
1910 {
1911 (yyval.string) = (yyvsp[(1) - (1)].string);
1912 }
1913 break;
1914
1915 case 44:
1916
1917 /* Line 1806 of yacc.c */
1918 #line 287 "cond.y"
1919 {
1920 COND_input* cond = (COND_input*) info;
1921 (yyval.string) = COND_GetLiteral( cond, &(yyvsp[(1) - (1)].str) );
1922 if( !(yyval.string) )
1923 YYABORT;
1924 }
1925 break;
1926
1927 case 45:
1928
1929 /* Line 1806 of yacc.c */
1930 #line 297 "cond.y"
1931 {
1932 (yyval.value) = (yyvsp[(1) - (1)].value);
1933 }
1934 break;
1935
1936 case 46:
1937
1938 /* Line 1806 of yacc.c */
1939 #line 301 "cond.y"
1940 {
1941 COND_input* cond = (COND_input*) info;
1942 INSTALLSTATE install = INSTALLSTATE_UNKNOWN, action = INSTALLSTATE_UNKNOWN;
1943
1944 MSI_GetComponentStateW(cond->package, (yyvsp[(2) - (2)].string), &install, &action );
1945 (yyval.value) = action;
1946 cond_free( (yyvsp[(2) - (2)].string) );
1947 }
1948 break;
1949
1950 case 47:
1951
1952 /* Line 1806 of yacc.c */
1953 #line 310 "cond.y"
1954 {
1955 COND_input* cond = (COND_input*) info;
1956 INSTALLSTATE install = INSTALLSTATE_UNKNOWN, action = INSTALLSTATE_UNKNOWN;
1957
1958 MSI_GetComponentStateW(cond->package, (yyvsp[(2) - (2)].string), &install, &action );
1959 (yyval.value) = install;
1960 cond_free( (yyvsp[(2) - (2)].string) );
1961 }
1962 break;
1963
1964 case 48:
1965
1966 /* Line 1806 of yacc.c */
1967 #line 319 "cond.y"
1968 {
1969 COND_input* cond = (COND_input*) info;
1970 INSTALLSTATE install = INSTALLSTATE_UNKNOWN, action = INSTALLSTATE_UNKNOWN;
1971
1972 MSI_GetFeatureStateW(cond->package, (yyvsp[(2) - (2)].string), &install, &action );
1973 if (action == INSTALLSTATE_UNKNOWN)
1974 (yyval.value) = MSICONDITION_FALSE;
1975 else
1976 (yyval.value) = action;
1977
1978 cond_free( (yyvsp[(2) - (2)].string) );
1979 }
1980 break;
1981
1982 case 49:
1983
1984 /* Line 1806 of yacc.c */
1985 #line 332 "cond.y"
1986 {
1987 COND_input* cond = (COND_input*) info;
1988 INSTALLSTATE install = INSTALLSTATE_UNKNOWN, action = INSTALLSTATE_UNKNOWN;
1989
1990 MSI_GetFeatureStateW(cond->package, (yyvsp[(2) - (2)].string), &install, &action );
1991 (yyval.value) = install;
1992 cond_free( (yyvsp[(2) - (2)].string) );
1993 }
1994 break;
1995
1996 case 50:
1997
1998 /* Line 1806 of yacc.c */
1999 #line 344 "cond.y"
2000 {
2001 COND_input* cond = (COND_input*) info;
2002 UINT len;
2003
2004 (yyval.string) = msi_dup_property( cond->package->db, (yyvsp[(1) - (1)].string) );
2005 if ((yyval.string))
2006 {
2007 len = (lstrlenW((yyval.string)) + 1) * sizeof (WCHAR);
2008 (yyval.string) = cond_track_mem( cond, (yyval.string), len );
2009 }
2010 cond_free( (yyvsp[(1) - (1)].string) );
2011 }
2012 break;
2013
2014 case 51:
2015
2016 /* Line 1806 of yacc.c */
2017 #line 357 "cond.y"
2018 {
2019 COND_input* cond = (COND_input*) info;
2020 UINT len = GetEnvironmentVariableW( (yyvsp[(2) - (2)].string), NULL, 0 );
2021 (yyval.string) = NULL;
2022 if (len++)
2023 {
2024 (yyval.string) = cond_alloc( cond, len*sizeof (WCHAR) );
2025 if( !(yyval.string) )
2026 YYABORT;
2027 GetEnvironmentVariableW( (yyvsp[(2) - (2)].string), (yyval.string), len );
2028 }
2029 cond_free( (yyvsp[(2) - (2)].string) );
2030 }
2031 break;
2032
2033 case 52:
2034
2035 /* Line 1806 of yacc.c */
2036 #line 374 "cond.y"
2037 {
2038 COND_input* cond = (COND_input*) info;
2039 (yyval.string) = COND_GetString( cond, &(yyvsp[(1) - (1)].str) );
2040 if( !(yyval.string) )
2041 YYABORT;
2042 }
2043 break;
2044
2045 case 53:
2046
2047 /* Line 1806 of yacc.c */
2048 #line 384 "cond.y"
2049 {
2050 COND_input* cond = (COND_input*) info;
2051 LPWSTR szNum = COND_GetString( cond, &(yyvsp[(1) - (1)].str) );
2052 if( !szNum )
2053 YYABORT;
2054 (yyval.value) = atoiW( szNum );
2055 cond_free( szNum );
2056 }
2057 break;
2058
2059
2060
2061 /* Line 1806 of yacc.c */
2062 #line 2083 "cond.tab.c"
2063 default: break;
2064 }
2065 /* User semantic actions sometimes alter yychar, and that requires
2066 that yytoken be updated with the new translation. We take the
2067 approach of translating immediately before every use of yytoken.
2068 One alternative is translating here after every semantic action,
2069 but that translation would be missed if the semantic action invokes
2070 YYABORT, YYACCEPT, or YYERROR immediately after altering yychar or
2071 if it invokes YYBACKUP. In the case of YYABORT or YYACCEPT, an
2072 incorrect destructor might then be invoked immediately. In the
2073 case of YYERROR or YYBACKUP, subsequent parser actions might lead
2074 to an incorrect destructor call or verbose syntax error message
2075 before the lookahead is translated. */
2076 YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc);
2077
2078 YYPOPSTACK (yylen);
2079 yylen = 0;
2080 YY_STACK_PRINT (yyss, yyssp);
2081
2082 *++yyvsp = yyval;
2083
2084 /* Now `shift' the result of the reduction. Determine what state
2085 that goes to, based on the state we popped back to and the rule
2086 number reduced by. */
2087
2088 yyn = yyr1[yyn];
2089
2090 yystate = yypgoto[yyn - YYNTOKENS] + *yyssp;
2091 if (0 <= yystate && yystate <= YYLAST && yycheck[yystate] == *yyssp)
2092 yystate = yytable[yystate];
2093 else
2094 yystate = yydefgoto[yyn - YYNTOKENS];
2095
2096 goto yynewstate;
2097
2098
2099 /*------------------------------------.
2100 | yyerrlab -- here on detecting error |
2101 `------------------------------------*/
2102 yyerrlab:
2103 /* Make sure we have latest lookahead translation. See comments at
2104 user semantic actions for why this is necessary. */
2105 yytoken = yychar == YYEMPTY ? YYEMPTY : YYTRANSLATE (yychar);
2106
2107 /* If not already recovering from an error, report this error. */
2108 if (!yyerrstatus)
2109 {
2110 ++yynerrs;
2111 #if ! YYERROR_VERBOSE
2112 yyerror (info, YY_("syntax error"));
2113 #else
2114 # define YYSYNTAX_ERROR yysyntax_error (&yymsg_alloc, &yymsg, \
2115 yyssp, yytoken)
2116 {
2117 char const *yymsgp = YY_("syntax error");
2118 int yysyntax_error_status;
2119 yysyntax_error_status = YYSYNTAX_ERROR;
2120 if (yysyntax_error_status == 0)
2121 yymsgp = yymsg;
2122 else if (yysyntax_error_status == 1)
2123 {
2124 if (yymsg != yymsgbuf)
2125 YYSTACK_FREE (yymsg);
2126 yymsg = (char *) YYSTACK_ALLOC (yymsg_alloc);
2127 if (!yymsg)
2128 {
2129 yymsg = yymsgbuf;
2130 yymsg_alloc = sizeof yymsgbuf;
2131 yysyntax_error_status = 2;
2132 }
2133 else
2134 {
2135 yysyntax_error_status = YYSYNTAX_ERROR;
2136 yymsgp = yymsg;
2137 }
2138 }
2139 yyerror (info, yymsgp);
2140 if (yysyntax_error_status == 2)
2141 goto yyexhaustedlab;
2142 }
2143 # undef YYSYNTAX_ERROR
2144 #endif
2145 }
2146
2147
2148
2149 if (yyerrstatus == 3)
2150 {
2151 /* If just tried and failed to reuse lookahead token after an
2152 error, discard it. */
2153
2154 if (yychar <= YYEOF)
2155 {
2156 /* Return failure if at end of input. */
2157 if (yychar == YYEOF)
2158 YYABORT;
2159 }
2160 else
2161 {
2162 yydestruct ("Error: discarding",
2163 yytoken, &yylval, info);
2164 yychar = YYEMPTY;
2165 }
2166 }
2167
2168 /* Else will try to reuse lookahead token after shifting the error
2169 token. */
2170 goto yyerrlab1;
2171
2172
2173 /*---------------------------------------------------.
2174 | yyerrorlab -- error raised explicitly by YYERROR. |
2175 `---------------------------------------------------*/
2176 yyerrorlab:
2177
2178 /* Pacify compilers like GCC when the user code never invokes
2179 YYERROR and the label yyerrorlab therefore never appears in user
2180 code. */
2181 if (/*CONSTCOND*/ 0)
2182 goto yyerrorlab;
2183
2184 /* Do not reclaim the symbols of the rule which action triggered
2185 this YYERROR. */
2186 YYPOPSTACK (yylen);
2187 yylen = 0;
2188 YY_STACK_PRINT (yyss, yyssp);
2189 yystate = *yyssp;
2190 goto yyerrlab1;
2191
2192
2193 /*-------------------------------------------------------------.
2194 | yyerrlab1 -- common code for both syntax error and YYERROR. |
2195 `-------------------------------------------------------------*/
2196 yyerrlab1:
2197 yyerrstatus = 3; /* Each real token shifted decrements this. */
2198
2199 for (;;)
2200 {
2201 yyn = yypact[yystate];
2202 if (!yypact_value_is_default (yyn))
2203 {
2204 yyn += YYTERROR;
2205 if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR)
2206 {
2207 yyn = yytable[yyn];
2208 if (0 < yyn)
2209 break;
2210 }
2211 }
2212
2213 /* Pop the current state because it cannot handle the error token. */
2214 if (yyssp == yyss)
2215 YYABORT;
2216
2217
2218 yydestruct ("Error: popping",
2219 yystos[yystate], yyvsp, info);
2220 YYPOPSTACK (1);
2221 yystate = *yyssp;
2222 YY_STACK_PRINT (yyss, yyssp);
2223 }
2224
2225 *++yyvsp = yylval;
2226
2227
2228 /* Shift the error token. */
2229 YY_SYMBOL_PRINT ("Shifting", yystos[yyn], yyvsp, yylsp);
2230
2231 yystate = yyn;
2232 goto yynewstate;
2233
2234
2235 /*-------------------------------------.
2236 | yyacceptlab -- YYACCEPT comes here. |
2237 `-------------------------------------*/
2238 yyacceptlab:
2239 yyresult = 0;
2240 goto yyreturn;
2241
2242 /*-----------------------------------.
2243 | yyabortlab -- YYABORT comes here. |
2244 `-----------------------------------*/
2245 yyabortlab:
2246 yyresult = 1;
2247 goto yyreturn;
2248
2249 #if !defined(yyoverflow) || YYERROR_VERBOSE
2250 /*-------------------------------------------------.
2251 | yyexhaustedlab -- memory exhaustion comes here. |
2252 `-------------------------------------------------*/
2253 yyexhaustedlab:
2254 yyerror (info, YY_("memory exhausted"));
2255 yyresult = 2;
2256 /* Fall through. */
2257 #endif
2258
2259 yyreturn:
2260 if (yychar != YYEMPTY)
2261 {
2262 /* Make sure we have latest lookahead translation. See comments at
2263 user semantic actions for why this is necessary. */
2264 yytoken = YYTRANSLATE (yychar);
2265 yydestruct ("Cleanup: discarding lookahead",
2266 yytoken, &yylval, info);
2267 }
2268 /* Do not reclaim the symbols of the rule which action triggered
2269 this YYABORT or YYACCEPT. */
2270 YYPOPSTACK (yylen);
2271 YY_STACK_PRINT (yyss, yyssp);
2272 while (yyssp != yyss)
2273 {
2274 yydestruct ("Cleanup: popping",
2275 yystos[*yyssp], yyvsp, info);
2276 YYPOPSTACK (1);
2277 }
2278 #ifndef yyoverflow
2279 if (yyss != yyssa)
2280 YYSTACK_FREE (yyss);
2281 #endif
2282 #if YYERROR_VERBOSE
2283 if (yymsg != yymsgbuf)
2284 YYSTACK_FREE (yymsg);
2285 #endif
2286 /* Make sure YYID is used. */
2287 return YYID (yyresult);
2288 }
2289
2290
2291
2292 /* Line 2067 of yacc.c */
2293 #line 394 "cond.y"
2294
2295
2296
2297 static int COND_IsAlpha( WCHAR x )
2298 {
2299 return( ( ( x >= 'A' ) && ( x <= 'Z' ) ) ||
2300 ( ( x >= 'a' ) && ( x <= 'z' ) ) ||
2301 ( ( x == '_' ) ) );
2302 }
2303
2304 static int COND_IsNumber( WCHAR x )
2305 {
2306 return( (( x >= '0' ) && ( x <= '9' )) || (x =='-') || (x =='.') );
2307 }
2308
2309 static WCHAR *strstriW( const WCHAR *str, const WCHAR *sub )
2310 {
2311 LPWSTR strlower, sublower, r;
2312 strlower = CharLowerW( strdupW( str ) );
2313 sublower = CharLowerW( strdupW( sub ) );
2314 r = strstrW( strlower, sublower );
2315 if (r)
2316 r = (LPWSTR)str + (r - strlower);
2317 msi_free( strlower );
2318 msi_free( sublower );
2319 return r;
2320 }
2321
2322 static BOOL str_is_number( LPCWSTR str )
2323 {
2324 int i;
2325
2326 if (!*str)
2327 return FALSE;
2328
2329 for (i = 0; i < lstrlenW( str ); i++)
2330 if (!isdigitW(str[i]))
2331 return FALSE;
2332
2333 return TRUE;
2334 }
2335
2336 static INT compare_substring( LPCWSTR a, INT operator, LPCWSTR b )
2337 {
2338 int lhs, rhs;
2339
2340 /* substring operators return 0 if LHS is missing */
2341 if (!a || !*a)
2342 return 0;
2343
2344 /* substring operators return 1 if RHS is missing */
2345 if (!b || !*b)
2346 return 1;
2347
2348 /* if both strings contain only numbers, use integer comparison */
2349 lhs = atoiW(a);
2350 rhs = atoiW(b);
2351 if (str_is_number(a) && str_is_number(b))
2352 return compare_int( lhs, operator, rhs );
2353
2354 switch (operator)
2355 {
2356 case COND_SS:
2357 return strstrW( a, b ) != 0;
2358 case COND_ISS:
2359 return strstriW( a, b ) != 0;
2360 case COND_LHS:
2361 {
2362 int l = strlenW( a );
2363 int r = strlenW( b );
2364 if (r > l) return 0;
2365 return !strncmpW( a, b, r );
2366 }
2367 case COND_RHS:
2368 {
2369 int l = strlenW( a );
2370 int r = strlenW( b );
2371 if (r > l) return 0;
2372 return !strncmpW( a + (l - r), b, r );
2373 }
2374 case COND_ILHS:
2375 {
2376 int l = strlenW( a );
2377 int r = strlenW( b );
2378 if (r > l) return 0;
2379 return !strncmpiW( a, b, r );
2380 }
2381 case COND_IRHS:
2382 {
2383 int l = strlenW( a );
2384 int r = strlenW( b );
2385 if (r > l) return 0;
2386 return !strncmpiW( a + (l - r), b, r );
2387 }
2388 default:
2389 ERR("invalid substring operator\n");
2390 return 0;
2391 }
2392 return 0;
2393 }
2394
2395 static INT compare_string( LPCWSTR a, INT operator, LPCWSTR b, BOOL convert )
2396 {
2397 if (operator >= COND_SS && operator <= COND_RHS)
2398 return compare_substring( a, operator, b );
2399
2400 /* null and empty string are equivalent */
2401 if (!a) a = szEmpty;
2402 if (!b) b = szEmpty;
2403
2404 if (convert && str_is_number(a) && str_is_number(b))
2405 return compare_int( atoiW(a), operator, atoiW(b) );
2406
2407 /* a or b may be NULL */
2408 switch (operator)
2409 {
2410 case COND_LT:
2411 return strcmpW( a, b ) < 0;
2412 case COND_GT:
2413 return strcmpW( a, b ) > 0;
2414 case COND_EQ:
2415 return strcmpW( a, b ) == 0;
2416 case COND_NE:
2417 return strcmpW( a, b ) != 0;
2418 case COND_GE:
2419 return strcmpW( a, b ) >= 0;
2420 case COND_LE:
2421 return strcmpW( a, b ) <= 0;
2422 case COND_ILT:
2423 return strcmpiW( a, b ) < 0;
2424 case COND_IGT:
2425 return strcmpiW( a, b ) > 0;
2426 case COND_IEQ:
2427 return strcmpiW( a, b ) == 0;
2428 case COND_INE:
2429 return strcmpiW( a, b ) != 0;
2430 case COND_IGE:
2431 return strcmpiW( a, b ) >= 0;
2432 case COND_ILE:
2433 return strcmpiW( a, b ) <= 0;
2434 default:
2435 ERR("invalid string operator\n");
2436 return 0;
2437 }
2438 return 0;
2439 }
2440
2441
2442 static INT compare_int( INT a, INT operator, INT b )
2443 {
2444 switch (operator)
2445 {
2446 case COND_LT:
2447 case COND_ILT:
2448 return a < b;
2449 case COND_GT:
2450 case COND_IGT:
2451 return a > b;
2452 case COND_EQ:
2453 case COND_IEQ:
2454 return a == b;
2455 case COND_NE:
2456 case COND_INE:
2457 return a != b;
2458 case COND_GE:
2459 case COND_IGE:
2460 return a >= b;
2461 case COND_LE:
2462 case COND_ILE:
2463 return a <= b;
2464 case COND_SS:
2465 case COND_ISS:
2466 return ( a & b ) ? 1 : 0;
2467 case COND_RHS:
2468 return ( ( a & 0xffff ) == b ) ? 1 : 0;
2469 case COND_LHS:
2470 return ( ( (a>>16) & 0xffff ) == b ) ? 1 : 0;
2471 default:
2472 ERR("invalid integer operator\n");
2473 return 0;
2474 }
2475 return 0;
2476 }
2477
2478
2479 static int COND_IsIdent( WCHAR x )
2480 {
2481 return( COND_IsAlpha( x ) || COND_IsNumber( x ) || ( x == '_' )
2482 || ( x == '#' ) || (x == '.') );
2483 }
2484
2485 static int COND_GetOperator( COND_input *cond )
2486 {
2487 static const struct {
2488 const WCHAR str[4];
2489 int id;
2490 } table[] = {
2491 { {'~','<','=',0}, COND_ILE },
2492 { {'~','>','<',0}, COND_ISS },
2493 { {'~','>','>',0}, COND_IRHS },
2494 { {'~','<','>',0}, COND_INE },
2495 { {'~','>','=',0}, COND_IGE },
2496 { {'~','<','<',0}, COND_ILHS },
2497 { {'~','=',0}, COND_IEQ },
2498 { {'~','<',0}, COND_ILT },
2499 { {'~','>',0}, COND_IGT },
2500 { {'>','=',0}, COND_GE },
2501 { {'>','<',0}, COND_SS },
2502 { {'<','<',0}, COND_LHS },
2503 { {'<','>',0}, COND_NE },
2504 { {'<','=',0}, COND_LE },
2505 { {'>','>',0}, COND_RHS },
2506 { {'>',0}, COND_GT },
2507 { {'<',0}, COND_LT },
2508 { {0}, 0 }
2509 };
2510 LPCWSTR p = &cond->str[cond->n];
2511 int i = 0, len;
2512
2513 while ( 1 )
2514 {
2515 len = lstrlenW( table[i].str );
2516 if ( !len || 0 == strncmpW( table[i].str, p, len ) )
2517 break;
2518 i++;
2519 }
2520 cond->n += len;
2521 return table[i].id;
2522 }
2523
2524 static int COND_GetOne( struct cond_str *str, COND_input *cond )
2525 {
2526 int rc, len = 1;
2527 WCHAR ch;
2528
2529 str->data = &cond->str[cond->n];
2530
2531 ch = str->data[0];
2532
2533 switch( ch )
2534 {
2535 case 0: return 0;
2536 case '(': rc = COND_LPAR; break;
2537 case ')': rc = COND_RPAR; break;
2538 case '&': rc = COND_AMPER; break;
2539 case '!': rc = COND_EXCLAM; break;
2540 case '$': rc = COND_DOLLARS; break;
2541 case '?': rc = COND_QUESTION; break;
2542 case '%': rc = COND_PERCENT; break;
2543 case ' ': rc = COND_SPACE; break;
2544 case '=': rc = COND_EQ; break;
2545
2546 case '~':
2547 case '<':
2548 case '>':
2549 rc = COND_GetOperator( cond );
2550 if (!rc)
2551 rc = COND_ERROR;
2552 return rc;
2553 default:
2554 rc = 0;
2555 }
2556
2557 if ( rc )
2558 {
2559 cond->n += len;
2560 return rc;
2561 }
2562
2563 if (ch == '"' )
2564 {
2565 LPCWSTR p = strchrW( str->data + 1, '"' );
2566 if (!p) return COND_ERROR;
2567 len = p - str->data + 1;
2568 rc = COND_LITER;
2569 }
2570 else if( COND_IsAlpha( ch ) )
2571 {
2572 static const WCHAR szNot[] = {'N','O','T',0};
2573 static const WCHAR szAnd[] = {'A','N','D',0};
2574 static const WCHAR szXor[] = {'X','O','R',0};
2575 static const WCHAR szEqv[] = {'E','Q','V',0};
2576 static const WCHAR szImp[] = {'I','M','P',0};
2577 static const WCHAR szOr[] = {'O','R',0};
2578
2579 while( COND_IsIdent( str->data[len] ) )
2580 len++;
2581 rc = COND_IDENT;
2582
2583 if ( len == 3 )
2584 {
2585 if ( !strncmpiW( str->data, szNot, len ) )
2586 rc = COND_NOT;
2587 else if( !strncmpiW( str->data, szAnd, len ) )
2588 rc = COND_AND;
2589 else if( !strncmpiW( str->data, szXor, len ) )
2590 rc = COND_XOR;
2591 else if( !strncmpiW( str->data, szEqv, len ) )
2592 rc = COND_EQV;
2593 else if( !strncmpiW( str->data, szImp, len ) )
2594 rc = COND_IMP;
2595 }
2596 else if( (len == 2) && !strncmpiW( str->data, szOr, len ) )
2597 rc = COND_OR;
2598 }
2599 else if( COND_IsNumber( ch ) )
2600 {
2601 while( COND_IsNumber( str->data[len] ) )
2602 len++;
2603 rc = COND_NUMBER;
2604 }
2605 else
2606 {
2607 ERR("Got unknown character %c(%x)\n",ch,ch);
2608 return COND_ERROR;
2609 }
2610
2611 cond->n += len;
2612 str->len = len;
2613
2614 return rc;
2615 }
2616
2617 static int cond_lex( void *COND_lval, COND_input *cond )
2618 {
2619 int rc;
2620 struct cond_str *str = COND_lval;
2621
2622 do {
2623 rc = COND_GetOne( str, cond );
2624 } while (rc == COND_SPACE);
2625
2626 return rc;
2627 }
2628
2629 static LPWSTR COND_GetString( COND_input *cond, const struct cond_str *str )
2630 {
2631 LPWSTR ret;
2632
2633 ret = cond_alloc( cond, (str->len+1) * sizeof (WCHAR) );
2634 if( ret )
2635 {
2636 memcpy( ret, str->data, str->len * sizeof(WCHAR));
2637 ret[str->len]=0;
2638 }
2639 TRACE("Got identifier %s\n",debugstr_w(ret));
2640 return ret;
2641 }
2642
2643 static LPWSTR COND_GetLiteral( COND_input *cond, const struct cond_str *str )
2644 {
2645 LPWSTR ret;
2646
2647 ret = cond_alloc( cond, (str->len-1) * sizeof (WCHAR) );
2648 if( ret )
2649 {
2650 memcpy( ret, str->data+1, (str->len-2) * sizeof(WCHAR) );
2651 ret[str->len - 2]=0;
2652 }
2653 TRACE("Got literal %s\n",debugstr_w(ret));
2654 return ret;
2655 }
2656
2657 static void *cond_alloc( COND_input *cond, unsigned int sz )
2658 {
2659 struct list *mem;
2660
2661 mem = msi_alloc( sizeof (struct list) + sz );
2662 if( !mem )
2663 return NULL;
2664
2665 list_add_head( &(cond->mem), mem );
2666 return mem + 1;
2667 }
2668
2669 static void *cond_track_mem( COND_input *cond, void *ptr, unsigned int sz )
2670 {
2671 void *new_ptr;
2672
2673 if( !ptr )
2674 return ptr;
2675
2676 new_ptr = cond_alloc( cond, sz );
2677 if( !new_ptr )
2678 {
2679 msi_free( ptr );
2680 return NULL;
2681 }
2682
2683 memcpy( new_ptr, ptr, sz );
2684 msi_free( ptr );
2685 return new_ptr;
2686 }
2687
2688 static void cond_free( void *ptr )
2689 {
2690 struct list *mem = (struct list *)ptr - 1;
2691
2692 if( ptr )
2693 {
2694 list_remove( mem );
2695 msi_free( mem );
2696 }
2697 }
2698
2699 static int cond_error( COND_input *info, const char *str )
2700 {
2701 TRACE("%s\n", str );
2702 return 0;
2703 }
2704
2705 MSICONDITION MSI_EvaluateConditionW( MSIPACKAGE *package, LPCWSTR szCondition )
2706 {
2707 COND_input cond;
2708 MSICONDITION r;
2709 struct list *mem, *safety;
2710
2711 TRACE("%s\n", debugstr_w( szCondition ) );
2712
2713 if (szCondition == NULL) return MSICONDITION_NONE;
2714
2715 cond.package = package;
2716 cond.str = szCondition;
2717 cond.n = 0;
2718 cond.result = MSICONDITION_ERROR;
2719
2720 list_init( &cond.mem );
2721
2722 if ( !cond_parse( &cond ) )
2723 r = cond.result;
2724 else
2725 r = MSICONDITION_ERROR;
2726
2727 LIST_FOR_EACH_SAFE( mem, safety, &cond.mem )
2728 {
2729 /* The tracked memory lives directly after the list struct */
2730 void *ptr = mem + 1;
2731 if ( r != MSICONDITION_ERROR )
2732 WARN( "condition parser failed to free up some memory: %p\n", ptr );
2733 cond_free( ptr );
2734 }
2735
2736 TRACE("%i <- %s\n", r, debugstr_w(szCondition));
2737 return r;
2738 }
2739
2740 MSICONDITION WINAPI MsiEvaluateConditionW( MSIHANDLE hInstall, LPCWSTR szCondition )
2741 {
2742 MSIPACKAGE *package;
2743 UINT ret;
2744
2745 package = msihandle2msiinfo( hInstall, MSIHANDLETYPE_PACKAGE);
2746 if( !package )
2747 {
2748 HRESULT hr;
2749 BSTR condition;
2750 IWineMsiRemotePackage *remote_package;
2751
2752 remote_package = (IWineMsiRemotePackage *)msi_get_remote( hInstall );
2753 if (!remote_package)
2754 return MSICONDITION_ERROR;
2755
2756 condition = SysAllocString( szCondition );
2757 if (!condition)
2758 {
2759 IWineMsiRemotePackage_Release( remote_package );
2760 return ERROR_OUTOFMEMORY;
2761 }
2762
2763 hr = IWineMsiRemotePackage_EvaluateCondition( remote_package, condition );
2764
2765 SysFreeString( condition );
2766 IWineMsiRemotePackage_Release( remote_package );
2767
2768 if (FAILED(hr))
2769 {
2770 if (HRESULT_FACILITY(hr) == FACILITY_WIN32)
2771 return HRESULT_CODE(hr);
2772
2773 return ERROR_FUNCTION_FAILED;
2774 }
2775
2776 return ERROR_SUCCESS;
2777 }
2778
2779 ret = MSI_EvaluateConditionW( package, szCondition );
2780 msiobj_release( &package->hdr );
2781 return ret;
2782 }
2783
2784 MSICONDITION WINAPI MsiEvaluateConditionA( MSIHANDLE hInstall, LPCSTR szCondition )
2785 {
2786 LPWSTR szwCond = NULL;
2787 MSICONDITION r;
2788
2789 szwCond = strdupAtoW( szCondition );
2790 if( szCondition && !szwCond )
2791 return MSICONDITION_ERROR;
2792
2793 r = MsiEvaluateConditionW( hInstall, szwCond );
2794 msi_free( szwCond );
2795 return r;
2796 }
2797