summaryrefslogtreecommitdiffabout
path: root/libkcal/versit/vcc.c
Unidiff
Diffstat (limited to 'libkcal/versit/vcc.c') (more/less context) (show whitespace changes)
-rw-r--r--libkcal/versit/vcc.c1491
1 files changed, 824 insertions, 667 deletions
diff --git a/libkcal/versit/vcc.c b/libkcal/versit/vcc.c
index 350cac3..9be752d 100644
--- a/libkcal/versit/vcc.c
+++ b/libkcal/versit/vcc.c
@@ -1,4 +1,3 @@
1 1/* A Bison parser, made from vcc.y
2/* A Bison parser, made from ./vcc.y 2 by GNU bison 1.35. */
3 by GNU Bison version 1.28 */
4 3
@@ -6,6 +5,2 @@
6 5
7#ifdef _WIN32_
8#define strcasecmp _stricmp
9#endif
10
11 #define EQ257 6 #define EQ257
@@ -29,3 +24,3 @@
29 24
30#line 1 "./vcc.y" 25#line 1 "vcc.y"
31 26
@@ -88,2 +83,7 @@ DFARS 252.227-7013 or 48 CFR 52.227-19, as applicable.
88 83
84#ifdef WIN32
85#define snprintf _snprintf
86#define strcasecmp stricmp
87#endif
88
89/**** External Functions ****/ 89/**** External Functions ****/
@@ -122,3 +122,2 @@ DFARS 252.227-7013 or 48 CFR 52.227-19, as applicable.
122#define yyrule mime_rule 122#define yyrule mime_rule
123#undef YYPREFIX
124#define YYPREFIX "mime_" 123#define YYPREFIX "mime_"
@@ -130,6 +129,12 @@ DFARS 252.227-7013 or 48 CFR 52.227-19, as applicable.
130 129
131#include <string.h> 130/* undef below if compile with MFC */
132#ifndef __FreeBSD__ 131/* #define INCLUDEMFC 1 */
133#include <malloc.h> 132
133#if defined(WIN32) || defined(_WIN32)
134#ifdef INCLUDEMFC
135#include <afx.h>
136#endif
134#endif 137#endif
138
139#include <string.h>
135#include <stdio.h> 140#include <stdio.h>
@@ -139,16 +144,7 @@ DFARS 252.227-7013 or 48 CFR 52.227-19, as applicable.
139 144
140/* The following is a hack that I hope will get things compiling
141 * on SunOS 4.1.x systems
142 */
143#ifndef SEEK_SET
144#define SEEK_SET 0 /* Seek from beginning of file. */
145#define SEEK_CUR 1 /* Seek from current position. */
146#define SEEK_END 2 /* Seek from end of file. */
147#endif
148
149/**** Types, Constants ****/ 145/**** Types, Constants ****/
150 146
151 #define YYDEBUG 0/* 1 to compile in some debugging code */ 147 #define YYDEBUG 1/* 1 to compile in some debugging code */
152 #define MAXTOKEN 256/* maximum token (line) length */ 148 #define MAXTOKEN 256/* maximum token (line) length */
153 #define YYSTACKSIZE 1000/* ~unref ? */ 149 #define YYSTACKSIZE 50/* ~unref ? */
154 #define MAXLEVEL 10/* max # of nested objects parseable */ 150 #define MAXLEVEL 10/* max # of nested objects parseable */
@@ -171,3 +167,3 @@ extern "C" {
171 167
172 /* static void Parse_Debug(const char *s);*/ 168 extern void Parse_Debug(const char *s);
173 static void yyerror(char *s); 169 static void yyerror(char *s);
@@ -179,3 +175,3 @@ extern "C" {
179int yyparse(); 175int yyparse();
180static int yylex(); 176
181enum LexMode { 177enum LexMode {
@@ -194,3 +190,2 @@ static int pushVObject(const char *prop);
194static VObject* popVObject(); 190static VObject* popVObject();
195char* lexDataFromBase64();
196static void lexPopMode(int top); 191static void lexPopMode(int top);
@@ -200,4 +195,3 @@ static void enterProps(const char *s);
200static void enterAttr(const char *s1, const char *s2); 195static void enterAttr(const char *s1, const char *s2);
201/* static void enterValues(const char *value); */ 196static void enterValues(const char *value);
202static void appendValue(const char *value);
203static void mime_error_(char *s); 197static void mime_error_(char *s);
@@ -205,3 +199,4 @@ static void mime_error_(char *s);
205 199
206#line 181 "./vcc.y" 200#line 180 "vcc.y"
201#ifndef YYSTYPE
207typedef union { 202typedef union {
@@ -209,9 +204,8 @@ typedef union {
209 VObject *vobj; 204 VObject *vobj;
210 } YYSTYPE; 205 } yystype;
211#include <stdio.h> 206# define YYSTYPE yystype
212 207# define YYSTYPE_IS_TRIVIAL 1
213#ifndef __cplusplus
214#ifndef __STDC__
215#define const
216#endif 208#endif
209#ifndef YYDEBUG
210# define YYDEBUG 0
217#endif 211#endif
@@ -224,6 +218,9 @@ typedef union {
224 218
219/* YYTRANSLATE(YYLEX) -- Bison token number corresponding to YYLEX. */
225#define YYTRANSLATE(x) ((unsigned)(x) <= 274 ? yytranslate[x] : 51) 220#define YYTRANSLATE(x) ((unsigned)(x) <= 274 ? yytranslate[x] : 51)
226 221
227static const char yytranslate[] = { 0, 222/* YYTRANSLATE[YYLEX] -- Bison token number corresponding to YYLEX. */
228 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 223static const char yytranslate[] =
224{
225 0, 2, 2, 2, 2, 2, 2, 2, 2, 2,
229 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 226 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
@@ -252,29 +249,30 @@ static const char yytranslate[] = { 0,
252 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 249 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
253 2, 2, 2, 2, 2, 1, 3, 4, 5, 6, 250 2, 2, 2, 2, 2, 2, 1, 3, 4, 5,
254 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 251 6, 7, 8, 9, 10, 11, 12, 13, 14, 15,
255 17, 18, 19, 20 252 16, 17, 18, 19, 20
256}; 253};
257 254
258#if YYDEBUG != 0 255#if YYDEBUG
259static const short yyprhs[] = { 0, 256static const short yyprhs[] =
260 0, 2, 3, 7, 9, 11, 13, 14, 19, 20, 257{
261 24, 27, 29, 30, 36, 38, 39, 43, 45, 48, 258 0, 0, 2, 3, 7, 9, 11, 13, 14, 19,
262 50, 53, 55, 59, 61, 62, 67, 69, 71, 72, 259 20, 24, 27, 29, 30, 36, 38, 39, 43, 45,
263 73, 78, 79, 83, 86, 88, 90, 92, 94, 95, 260 48, 50, 53, 55, 59, 61, 62, 67, 69, 71,
264 100, 101, 105, 106, 111, 112 261 72, 73, 78, 79, 83, 86, 88, 90, 92, 94,
262 95, 100, 101, 105, 106, 111, 112
265}; 263};
266 264static const short yyrhs[] =
267static const short yyrhs[] = { 22, 265{
268 0, 0, 24, 23, 22, 0, 24, 0, 25, 0, 266 22, 0, 0, 24, 23, 22, 0, 24, 0, 25,
269 40, 0, 0, 11, 26, 28, 12, 0, 0, 11, 267 0, 40, 0, 0, 11, 26, 28, 12, 0, 0,
270 27, 12, 0, 29, 28, 0, 29, 0, 0, 31, 268 11, 27, 12, 0, 29, 28, 0, 29, 0, 0,
271 4, 30, 37, 9, 0, 1, 0, 0, 36, 32, 269 31, 4, 30, 37, 9, 0, 1, 0, 0, 36,
272 33, 0, 36, 0, 34, 33, 0, 34, 0, 6, 270 32, 33, 0, 36, 0, 34, 33, 0, 34, 0,
273 35, 0, 36, 0, 36, 3, 36, 0, 19, 0, 271 6, 35, 0, 36, 0, 36, 3, 36, 0, 19,
274 0, 39, 6, 38, 37, 0, 39, 0, 20, 0, 272 0, 0, 39, 6, 38, 37, 0, 39, 0, 20,
275 0, 0, 13, 41, 43, 14, 0, 0, 13, 42, 273 0, 0, 0, 13, 41, 43, 14, 0, 0, 13,
276 14, 0, 44, 43, 0, 44, 0, 45, 0, 48, 274 42, 14, 0, 44, 43, 0, 44, 0, 45, 0,
277 0, 28, 0, 0, 15, 46, 28, 16, 0, 0, 275 48, 0, 28, 0, 0, 15, 46, 28, 16, 0,
278 15, 47, 16, 0, 0, 17, 49, 28, 18, 0, 276 0, 15, 47, 16, 0, 0, 17, 49, 28, 18,
279 0, 17, 50, 18, 0 277 0, 0, 17, 50, 18, 0
280}; 278};
@@ -283,9 +281,11 @@ static const short yyrhs[] = { 22,
283 281
284#if YYDEBUG != 0 282#if YYDEBUG
285static const short yyrline[] = { 0, 283/* YYRLINE[YYN] -- source line where rule number YYN was defined. */
286 209, 212, 215, 215, 219, 220, 223, 229, 234, 240, 284static const short yyrline[] =
287 246, 247, 250, 254, 260, 263, 268, 268, 274, 275, 285{
288 278, 281, 285, 292, 295, 296, 296, 300, 301, 305, 286 0, 208, 211, 211, 214, 218, 219, 222, 222, 233,
289 309, 311, 314, 317, 318, 321, 323, 324, 327, 334, 287 233, 245, 246, 249, 249, 259, 262, 262, 267, 273,
290 339, 345, 351, 358, 363, 369 288 274, 277, 280, 284, 291, 294, 294, 295, 299, 300,
289 303, 303, 309, 309, 315, 316, 319, 321, 322, 325,
290 325, 337, 337, 349, 349, 361, 361
291}; 291};
@@ -294,11 +294,14 @@ static const short yyrline[] = { 0,
294 294
295#if YYDEBUG != 0 || defined (YYERROR_VERBOSE) 295#if (YYDEBUG) || defined YYERROR_VERBOSE
296 296
297static const char * const yytname[] = { "$","error","$undefined.","EQ","COLON", 297/* YYTNAME[TOKEN_NUM] -- String name of the token TOKEN_NUM. */
298"DOT","SEMICOLON","SPACE","HTAB","LINESEP","NEWLINE","BEGIN_VCARD","END_VCARD", 298static const char *const yytname[] =
299"BEGIN_VCAL","END_VCAL","BEGIN_VEVENT","END_VEVENT","BEGIN_VTODO","END_VTODO", 299{
300"ID","STRING","mime","vobjects","@1","vobject","vcard","@2","@3","items","item", 300 "$", "error", "$undefined.", "EQ", "COLON", "DOT", "SEMICOLON", "SPACE",
301"@4","prop","@5","attr_params","attr_param","attr","name","values","@6","value", 301 "HTAB", "LINESEP", "NEWLINE", "BEGIN_VCARD", "END_VCARD", "BEGIN_VCAL",
302"vcal","@7","@8","calitems","calitem","eventitem","@9","@10","todoitem","@11", 302 "END_VCAL", "BEGIN_VEVENT", "END_VEVENT", "BEGIN_VTODO", "END_VTODO",
303"@12", NULL 303 "ID", "STRING", "mime", "vobjects", "@1", "vobject", "vcard", "@2",
304 "@3", "items", "item", "@4", "prop", "@5", "attr_params", "attr_param",
305 "attr", "name", "values", "@6", "value", "vcal", "@7", "@8", "calitems",
306 "calitem", "eventitem", "@9", "@10", "todoitem", "@11", "@12", 0
304}; 307};
@@ -306,48 +309,59 @@ static const char * const yytname[] = { "$","error","$undefined.","EQ","COLON"
306 309
307static const short yyr1[] = { 0, 310/* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */
308 21, 23, 22, 22, 24, 24, 26, 25, 27, 25, 311static const short yyr1[] =
309 28, 28, 30, 29, 29, 32, 31, 31, 33, 33, 312{
310 34, 35, 35, 36, 38, 37, 37, 39, 39, 41, 313 0, 21, 23, 22, 22, 24, 24, 26, 25, 27,
311 40, 42, 40, 43, 43, 44, 44, 44, 46, 45, 314 25, 28, 28, 30, 29, 29, 32, 31, 31, 33,
312 47, 45, 49, 48, 50, 48 315 33, 34, 35, 35, 36, 38, 37, 37, 39, 39,
316 41, 40, 42, 40, 43, 43, 44, 44, 44, 46,
317 45, 47, 45, 49, 48, 50, 48
313}; 318};
314 319
315static const short yyr2[] = { 0, 320/* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */
316 1, 0, 3, 1, 1, 1, 0, 4, 0, 3, 321static const short yyr2[] =
317 2, 1, 0, 5, 1, 0, 3, 1, 2, 1, 322{
318 2, 1, 3, 1, 0, 4, 1, 1, 0, 0, 323 0, 1, 0, 3, 1, 1, 1, 0, 4, 0,
319 4, 0, 3, 2, 1, 1, 1, 1, 0, 4, 324 3, 2, 1, 0, 5, 1, 0, 3, 1, 2,
320 0, 3, 0, 4, 0, 3 325 1, 2, 1, 3, 1, 0, 4, 1, 1, 0,
326 0, 4, 0, 3, 2, 1, 1, 1, 1, 0,
327 4, 0, 3, 0, 4, 0, 3
321}; 328};
322 329
323static const short yydefact[] = { 0, 330/* YYDEFACT[S] -- default rule to reduce with in state S when YYTABLE
324 7, 30, 1, 2, 5, 6, 0, 0, 0, 0, 331 doesn't specify something else to do. Zero means the default is an
325 0, 15, 24, 0, 0, 0, 16, 10, 39, 43, 332 error. */
326 38, 0, 0, 36, 37, 33, 3, 8, 11, 13, 333static const short yydefact[] =
327 0, 0, 0, 0, 0, 31, 34, 29, 0, 17, 334{
328 20, 0, 42, 0, 46, 28, 0, 27, 21, 22, 335 0, 7, 30, 1, 2, 5, 6, 0, 0, 0,
329 19, 40, 44, 14, 25, 0, 29, 23, 26, 0, 336 0, 0, 15, 24, 0, 0, 0, 16, 10, 39,
330 0, 0 337 43, 38, 0, 0, 36, 37, 33, 3, 8, 11,
338 13, 0, 0, 0, 0, 0, 31, 34, 29, 0,
339 17, 20, 0, 42, 0, 46, 28, 0, 27, 21,
340 22, 19, 40, 44, 14, 25, 0, 29, 23, 26,
341 0, 0, 0
331}; 342};
332 343
333static const short yydefgoto[] = { 60, 344static const short yydefgoto[] =
334 3, 11, 4, 5, 7, 8, 21, 15, 38, 16, 345{
335 31, 40, 41, 49, 17, 47, 57, 48, 6, 9, 346 60, 3, 11, 4, 5, 7, 8, 21, 15, 38,
336 10, 22, 23, 24, 32, 33, 25, 34, 35 347 16, 31, 40, 41, 49, 17, 47, 57, 48, 6,
348 9, 10, 22, 23, 24, 32, 33, 25, 34, 35
337}; 349};
338 350
339static const short yypact[] = { -9, 351static const short yypact[] =
340 -6, -5,-32768, 7,-32768,-32768, 2, -1, 19, 15, 352{
341 -9,-32768,-32768, 1, 0, 26, 27,-32768, 16, 17, 353 -9, -6, -5,-32768, 7,-32768,-32768, 2, -1, 19,
342-32768, 23, 9,-32768,-32768,-32768,-32768,-32768,-32768,-32768, 354 15, -9,-32768,-32768, 1, 0, 26, 27,-32768, 16,
343 33, 2, 24, 2, 25,-32768,-32768, 13, 22,-32768, 355 17,-32768, 23, 9,-32768,-32768,-32768,-32768,-32768,-32768,
344 33, 28,-32768, 29,-32768,-32768, 36, 40,-32768, 39, 356 -32768, 33, 2, 24, 2, 25,-32768,-32768, 13, 22,
345-32768,-32768,-32768,-32768,-32768, 22, 13,-32768,-32768, 48, 357 -32768, 33, 28,-32768, 29,-32768,-32768, 36, 40,-32768,
346 49,-32768 358 39,-32768,-32768,-32768,-32768,-32768, 22, 13,-32768,-32768,
359 48, 49,-32768
347}; 360};
348 361
349static const short yypgoto[] = {-32768, 362static const short yypgoto[] =
350 41,-32768,-32768,-32768,-32768,-32768, -7,-32768,-32768,-32768, 363{
351-32768, 10,-32768,-32768, -34, -4,-32768,-32768,-32768,-32768, 364 -32768, 41,-32768,-32768,-32768,-32768,-32768, -7,-32768,-32768,
352-32768, 31,-32768,-32768,-32768,-32768,-32768,-32768,-32768 365 -32768,-32768, 10,-32768,-32768, -34, -4,-32768,-32768,-32768,
366 -32768,-32768, 31,-32768,-32768,-32768,-32768,-32768,-32768,-32768
353}; 367};
@@ -358,25 +372,28 @@ static const short yypgoto[] = {-32768,
358 372
359static const short yytable[] = { 14, 373static const short yytable[] =
360 12, 1, 12, 2, 50, -9, -4, 29, -32, 12, 374{
361 18, -12, 28, -12, -12, -12, -12, -12, 13, 12, 375 14, 12, 1, 12, 2, 50, -9, -4, 29, -32,
362 13, 58, -35, 19, 42, 20, 44, 13, 26, 30, 376 12, 18, -12, 28, -12, -12, -12, -12, -12, 13,
363 -18, -41, 46, 19, -45, 20, 36, 13, 39, 43, 377 12, 13, 58, -35, 19, 42, 20, 44, 13, 26,
364 13, 56, 45, 52, 54, 55, 53, 61, 62, 0, 378 30, -18, -41, 46, 19, -45, 20, 36, 13, 39,
365 51, 27, 59, 37 379 43, 13, 56, 45, 52, 54, 55, 53, 61, 62,
380 0, 51, 27, 59, 37
366}; 381};
367 382
368static const short yycheck[] = { 7, 383static const short yycheck[] =
369 1, 11, 1, 13, 39, 12, 0, 15, 14, 1, 384{
370 12, 12, 12, 14, 15, 16, 17, 18, 19, 1, 385 7, 1, 11, 1, 13, 39, 12, 0, 15, 14,
371 19, 56, 14, 15, 32, 17, 34, 19, 14, 4, 386 1, 12, 12, 12, 14, 15, 16, 17, 18, 19,
372 4, 16, 20, 15, 18, 17, 14, 19, 6, 16, 387 1, 19, 56, 14, 15, 32, 17, 34, 19, 14,
373 19, 3, 18, 16, 9, 6, 18, 0, 0, -1, 388 4, 4, 16, 20, 15, 18, 17, 14, 19, 6,
374 41, 11, 57, 23 389 16, 19, 3, 18, 16, 9, 6, 18, 0, 0,
390 -1, 41, 11, 57, 23
375}; 391};
376/* -*-C-*- Note some compilers choke on comments on `#line' lines. */ 392/* -*-C-*- Note some compilers choke on comments on `#line' lines. */
377#line 3 "/usr/share/bison.simple" 393#line 3 "/usr/share/bison/bison.simple"
378/* This file comes from bison-1.28. */
379 394
380/* Skeleton output parser for bison, 395/* Skeleton output parser for bison,
381 Copyright (C) 1984, 1989, 1990 Free Software Foundation, Inc. 396
397 Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002 Free Software
398 Foundation, Inc.
382 399
@@ -402,4 +419,4 @@ static const short yycheck[] = { 7,
402 419
403/* This is the parser code that is written into each bison parser 420/* This is the parser code that is written into each bison parser when
404 when the %semantic_parser declaration is not specified in the grammar. 421 the %semantic_parser declaration is not specified in the grammar.
405 It was written by Richard Stallman by simplifying the hairy parser 422 It was written by Richard Stallman by simplifying the hairy parser
@@ -407,53 +424,122 @@ static const short yycheck[] = { 7,
407 424
425/* All symbols defined below should begin with yy or YY, to avoid
426 infringing on user name space. This should be done even for local
427 variables, as they might otherwise be expanded by user macros.
428 There are some unavoidable exceptions within include files to
429 define necessary library symbols; they are noted "INFRINGES ON
430 USER NAME SPACE" below. */
431
432#if ! defined (yyoverflow) || defined (YYERROR_VERBOSE)
433
434/* The parser invokes alloca or malloc; define the necessary symbols. */
435
436# if YYSTACK_USE_ALLOCA
437# define YYSTACK_ALLOC alloca
438# else
408#ifndef YYSTACK_USE_ALLOCA 439#ifndef YYSTACK_USE_ALLOCA
409#ifdef alloca 440# if defined (alloca) || defined (_ALLOCA_H)
410#define YYSTACK_USE_ALLOCA
411#else /* alloca not defined */
412#ifdef __GNUC__
413#define YYSTACK_USE_ALLOCA
414#define alloca __builtin_alloca
415#else /* not GNU C. */
416#if (!defined (__STDC__) && defined (sparc)) || defined (__sparc__) || defined (__sparc) || defined (__sgi) || (defined (__sun) && defined (__i386))
417#define YYSTACK_USE_ALLOCA
418#include <alloca.h>
419#else /* not sparc */
420/* We think this test detects Watcom and Microsoft C. */
421/* This used to test MSDOS, but that is a bad idea
422 since that symbol is in the user namespace. */
423#if (defined (_MSDOS) || defined (_MSDOS_)) && !defined (__TURBOC__)
424#if 0 /* No need for malloc.h, which pollutes the namespace;
425 instead, just don't use alloca. */
426#include <malloc.h>
427#endif
428#else /* not MSDOS, or __TURBOC__ */
429#if defined(_AIX)
430/* I don't know what this was needed for, but it pollutes the namespace.
431 So I turned it off. rms, 2 May 1997. */
432/* #include <malloc.h> */
433 #pragma alloca
434#define YYSTACK_USE_ALLOCA
435#else /* not MSDOS, or __TURBOC__, or _AIX */
436#if 0
437#ifdef __hpux /* haible@ilog.fr says this works for HPUX 9.05 and up,
438 and on HPUX 10. Eventually we can turn this on. */
439#define YYSTACK_USE_ALLOCA
440#define alloca __builtin_alloca
441#endif /* __hpux */
442#endif
443#endif /* not _AIX */
444#endif /* not MSDOS, or __TURBOC__ */
445#endif /* not sparc */
446#endif /* not GNU C */
447#endif /* alloca not defined */
448#endif /* YYSTACK_USE_ALLOCA not defined */
449
450#ifdef YYSTACK_USE_ALLOCA
451#define YYSTACK_ALLOC alloca 441#define YYSTACK_ALLOC alloca
452#else 442#else
443# ifdef __GNUC__
444# define YYSTACK_ALLOC __builtin_alloca
445# endif
446# endif
447# endif
448# endif
449
450# ifdef YYSTACK_ALLOC
451 /* Pacify GCC's `empty if-body' warning. */
452# define YYSTACK_FREE(Ptr) do { /* empty */; } while (0)
453# else
454# if defined (__STDC__) || defined (__cplusplus)
455# include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
456# define YYSIZE_T size_t
457# endif
453#define YYSTACK_ALLOC malloc 458#define YYSTACK_ALLOC malloc
459# define YYSTACK_FREE free
460# endif
461#endif /* ! defined (yyoverflow) || defined (YYERROR_VERBOSE) */
462
463
464#if (! defined (yyoverflow) \
465 && (! defined (__cplusplus) \
466 || (YYLTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL)))
467
468/* A type that is properly aligned for any stack member. */
469union yyalloc
470{
471 short yyss;
472 YYSTYPE yyvs;
473# if YYLSP_NEEDED
474 YYLTYPE yyls;
475# endif
476};
477
478/* The size of the maximum gap between one aligned stack and the next. */
479# define YYSTACK_GAP_MAX (sizeof (union yyalloc) - 1)
480
481/* The size of an array large to enough to hold all stacks, each with
482 N elements. */
483# if YYLSP_NEEDED
484# define YYSTACK_BYTES(N) \
485 ((N) * (sizeof (short) + sizeof (YYSTYPE) + sizeof (YYLTYPE))\
486 + 2 * YYSTACK_GAP_MAX)
487# else
488# define YYSTACK_BYTES(N) \
489 ((N) * (sizeof (short) + sizeof (YYSTYPE)) \
490 + YYSTACK_GAP_MAX)
491# endif
492
493/* Copy COUNT objects from FROM to TO. The source and destination do
494 not overlap. */
495# ifndef YYCOPY
496# if 1 < __GNUC__
497# define YYCOPY(To, From, Count) \
498 __builtin_memcpy (To, From, (Count) * sizeof (*(From)))
499# else
500 # define YYCOPY(To, From, Count) \
501 do \
502 { \
503 register YYSIZE_T yyi; \
504 for (yyi = 0; yyi < (Count); yyi++)\
505 (To)[yyi] = (From)[yyi]; \
506 } \
507 while (0)
454#endif 508#endif
509# endif
510
511/* Relocate STACK from its old location to the new one. The
512 local variables YYSIZE and YYSTACKSIZE give the old and new number of
513 elements in the stack, and YYPTR gives the new location of the
514 stack. Advance YYPTR to a properly aligned location for the next
515 stack. */
516 # define YYSTACK_RELOCATE(Stack) \
517 do \
518 { \
519 YYSIZE_T yynewbytes; \
520 YYCOPY (&yyptr->Stack, Stack, yysize); \
521 Stack = &yyptr->Stack; \
522 yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAX;\
523 yyptr += yynewbytes / sizeof (*yyptr); \
524 } \
525 while (0)
455 526
456/* Note: there must be only one dollar sign in this file. 527#endif
457 It is replaced by the list of actions, each action 528
458 as one case of the switch. */ 529
530#if ! defined (YYSIZE_T) && defined (__SIZE_TYPE__)
531# define YYSIZE_T __SIZE_TYPE__
532#endif
533#if ! defined (YYSIZE_T) && defined (size_t)
534# define YYSIZE_T size_t
535#endif
536#if ! defined (YYSIZE_T)
537# if defined (__STDC__) || defined (__cplusplus)
538# include <stddef.h> /* INFRINGES ON USER NAME SPACE */
539# define YYSIZE_T size_t
540# endif
541#endif
542#if ! defined (YYSIZE_T)
543# define YYSIZE_T unsigned int
544#endif
459 545
@@ -466,5 +552,4 @@ static const short yycheck[] = { 7,
466 #define YYERROR goto yyerrlab1 552 #define YYERROR goto yyerrlab1
467/* Like YYERROR except do call yyerror. 553/* Like YYERROR except do call yyerror. This remains here temporarily
468 This remains here temporarily to ease the 554 to ease the transition to the new meaning of YYERROR, for GCC.
469 transition to the new meaning of YYERROR, for GCC.
470 Once GCC version 2 has supplanted version 1, this can go. */ 555 Once GCC version 2 has supplanted version 1, this can go. */
@@ -472,6 +557,8 @@ static const short yycheck[] = { 7,
472#define YYRECOVERING() (!!yyerrstatus) 557#define YYRECOVERING() (!!yyerrstatus)
473#define YYBACKUP(token, value) \ 558 #define YYBACKUP(Token, Value) \
474 do \ 559 do \
475 if (yychar == YYEMPTY && yylen == 1) \ 560 if (yychar == YYEMPTY && yylen == 1) \
476 { yychar = (token), yylval = (value); \ 561 { \
562 yychar = (Token); \
563 yylval = (Value); \
477 yychar1 = YYTRANSLATE (yychar); \ 564 yychar1 = YYTRANSLATE (yychar); \
@@ -481,3 +568,6 @@ do \
481 else \ 568 else \
482 { yyerror ("syntax error: cannot back up"); YYERROR; }\ 569 { \
570 yyerror ("syntax error: cannot back up"); \
571 YYERROR; \
572 } \
483while (0) 573while (0)
@@ -487,8 +577,21 @@ while (0)
487 577
488#ifndef YYPURE 578
489 #define YYLEX yylex() 579/* YYLLOC_DEFAULT -- Compute the default location (before the actions
580 are run).
581
582 When YYLLOC_DEFAULT is run, CURRENT is set the location of the
583 first token. By default, to implement support for ranges, extend
584 its range to the last symbol. */
585
586#ifndef YYLLOC_DEFAULT
587 # define YYLLOC_DEFAULT(Current, Rhs, N) \
588 Current.last_line = Rhs[N].last_line;\
589 Current.last_column = Rhs[N].last_column;
490#endif 590#endif
491 591
492#ifdef YYPURE 592
493#ifdef YYLSP_NEEDED 593/* YYLEX -- calling `yylex' with the right arguments. */
594
595#if YYPURE
596# if YYLSP_NEEDED
494#ifdef YYLEX_PARAM 597#ifdef YYLEX_PARAM
@@ -498,3 +601,3 @@ while (0)
498#endif 601#endif
499#else /* not YYLSP_NEEDED */ 602# else /* !YYLSP_NEEDED */
500#ifdef YYLEX_PARAM 603#ifdef YYLEX_PARAM
@@ -504,29 +607,29 @@ while (0)
504#endif 607#endif
505#endif /* not YYLSP_NEEDED */ 608# endif /* !YYLSP_NEEDED */
506#endif 609#else /* !YYPURE */
507 610 # define YYLEX yylex ()
508/* If nonreentrant, generate the variables here */ 611#endif /* !YYPURE */
509
510#ifndef YYPURE
511
512 int yychar; /* the lookahead symbol */
513 YYSTYPE yylval; /* the semantic value of the */
514 /* lookahead symbol */
515 612
516#ifdef YYLSP_NEEDED
517 YYLTYPE yylloc; /* location data for the lookahead*/
518 /* symbol */
519#endif
520 613
521 int yynerrs; /* number of parse errors so far */ 614/* Enable debugging if requested. */
522#endif /* not YYPURE */ 615#if YYDEBUG
523 616
524#if YYDEBUG != 0 617# ifndef YYFPRINTF
525 int yydebug; /* nonzero means print parse trace*/ 618# include <stdio.h> /* INFRINGES ON USER NAME SPACE */
526/* Since this is uninitialized, it does not stop multiple parsers 619# define YYFPRINTF fprintf
527 from coexisting. */
528#endif 620#endif
529 621
530 /* YYINITDEPTH indicates the initial size of the parser's stacks*/ 622 # define YYDPRINTF(Args) \
531 623 do { \
624 if (yydebug) \
625 YYFPRINTF Args; \
626} while (0)
627/* Nonzero means print parse trace. It is left uninitialized so that
628 multiple parsers can coexist. */
629int yydebug;
630#else /* !YYDEBUG */
631# define YYDPRINTF(Args)
632#endif /* !YYDEBUG */
633
634/* YYINITDEPTH -- initial size of the parser's stacks. */
532 #ifndefYYINITDEPTH 635 #ifndefYYINITDEPTH
@@ -535,4 +638,8 @@ int yydebug; /* nonzero means print parse trace */
535 638
536/* YYMAXDEPTH is the maximum size the stacks can grow to 639/* YYMAXDEPTH -- maximum size the stacks can grow to (effective only
537 (effective only if the built-in stack extension method is used). */ 640 if the built-in stack extension method is used).
641
642 Do not make this value too large; the results are undefined if
643 SIZE_MAX < YYSTACK_BYTES (YYMAXDEPTH)
644 evaluated with infinite-precision integer arithmetic. */
538 645
@@ -546,47 +653,56 @@ int yydebug; /* nonzero means print parse trace */
546 653
547/* Define __yy_memcpy. Note that the size argument 654#ifdef YYERROR_VERBOSE
548 should be passed with type unsigned int, because that is what the non-GCC
549 definitions require. With GCC, __builtin_memcpy takes an arg
550 of type size_t, but it can handle unsigned int. */
551
552 #if __GNUC__ > 1 /* GNU C and GNU C++ define this. */
553 #define __yy_memcpy(TO,FROM,COUNT)__builtin_memcpy(TO,FROM,COUNT)
554 #else /* not GNU C or C++ */
555#ifndef __cplusplus
556 655
557/* This is the most reliable way to avoid incompatibilities 656# ifndef yystrlen
558 in available built-in functions on various systems. */ 657# if defined (__GLIBC__) && defined (_STRING_H)
559static void 658# define yystrlen strlen
560__yy_memcpy (to, from, count) 659# else
561 char *to; 660/* Return the length of YYSTR. */
562 char *from; 661static YYSIZE_T
563 unsigned int count; 662# if defined (__STDC__) || defined (__cplusplus)
663yystrlen (const char *yystr)
664# else
665yystrlen (yystr)
666 const char *yystr;
667# endif
564{ 668{
565 register char *f = from; 669 register const char *yys = yystr;
566 register char *t = to;
567 register int i = count;
568 670
569 while (i-- > 0) 671 while (*yys++ != '\0')
570 *t++ = *f++; 672 continue;
571}
572 673
573#else /* __cplusplus */ 674 return yys - yystr - 1;
675}
676# endif
677# endif
574 678
575/* This is the most reliable way to avoid incompatibilities 679# ifndef yystpcpy
576 in available built-in functions on various systems. */ 680# if defined (__GLIBC__) && defined (_STRING_H) && defined (_GNU_SOURCE)
577static void 681# define yystpcpy stpcpy
578__yy_memcpy (char *to, char *from, unsigned int count) 682# else
683/* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in
684 YYDEST. */
685static char *
686# if defined (__STDC__) || defined (__cplusplus)
687yystpcpy (char *yydest, const char *yysrc)
688# else
689yystpcpy (yydest, yysrc)
690 char *yydest;
691 const char *yysrc;
692# endif
579{ 693{
580 register char *t = to; 694 register char *yyd = yydest;
581 register char *f = from; 695 register const char *yys = yysrc;
582 register int i = count;
583 696
584 while (i-- > 0) 697 while ((*yyd++ = *yys++) != '\0')
585 *t++ = *f++; 698 continue;
586}
587 699
700 return yyd - 1;
701}
588#endif 702#endif
589#endif 703#endif
704#endif
705
706#line 315 "/usr/share/bison/bison.simple"
590 707
591#line 217 "/usr/share/bison.simple"
592 708
@@ -599,16 +715,16 @@ __yy_memcpy (char *to, char *from, unsigned int count)
599#ifdef YYPARSE_PARAM 715#ifdef YYPARSE_PARAM
600#ifdef __cplusplus 716# if defined (__STDC__) || defined (__cplusplus)
601#define YYPARSE_PARAM_ARG void *YYPARSE_PARAM 717#define YYPARSE_PARAM_ARG void *YYPARSE_PARAM
602#define YYPARSE_PARAM_DECL 718#define YYPARSE_PARAM_DECL
603#else /* not __cplusplus */ 719# else
604#define YYPARSE_PARAM_ARG YYPARSE_PARAM 720#define YYPARSE_PARAM_ARG YYPARSE_PARAM
605#define YYPARSE_PARAM_DECL void *YYPARSE_PARAM; 721#define YYPARSE_PARAM_DECL void *YYPARSE_PARAM;
606#endif /* not __cplusplus */ 722# endif
607#else /* not YYPARSE_PARAM */ 723#else /* !YYPARSE_PARAM */
608#define YYPARSE_PARAM_ARG 724#define YYPARSE_PARAM_ARG
609#define YYPARSE_PARAM_DECL 725#define YYPARSE_PARAM_DECL
610#endif /* not YYPARSE_PARAM */ 726#endif /* !YYPARSE_PARAM */
611 727
612/* Prevent warning if -Wstrict-prototypes. */ 728/* Prevent warning if -Wstrict-prototypes. */
613#if defined (__GNUC__) && ! defined (__cplusplus) 729#ifdef __GNUC__
614#ifdef YYPARSE_PARAM 730#ifdef YYPARSE_PARAM
@@ -620,2 +736,33 @@ int yyparse (void);
620 736
737/* YY_DECL_VARIABLES -- depending whether we use a pure parser,
738 variables are global, or local to YYPARSE. */
739
740 #define YY_DECL_NON_LSP_VARIABLES \
741 /* The lookahead symbol. */ \
742 int yychar; \
743 \
744 /* The semantic value of the lookahead symbol. */\
745 YYSTYPE yylval; \
746 \
747 /* Number of parse errors so far. */ \
748int yynerrs;
749
750#if YYLSP_NEEDED
751 # define YY_DECL_VARIABLES \
752 YY_DECL_NON_LSP_VARIABLES \
753 \
754 /* Location data for the lookahead symbol. */\
755YYLTYPE yylloc;
756#else
757 # define YY_DECL_VARIABLES \
758YY_DECL_NON_LSP_VARIABLES
759#endif
760
761
762/* If nonreentrant, generate the variables here. */
763
764#if !YYPURE
765YY_DECL_VARIABLES
766#endif /* !YYPURE */
767
621int 768int
@@ -624,20 +771,41 @@ yyparse(YYPARSE_PARAM_ARG)
624{ 771{
772 /* If reentrant, generate the variables here. */
773#if YYPURE
774 YY_DECL_VARIABLES
775#endif /* !YYPURE */
776
625 register int yystate; 777 register int yystate;
626 register int yyn; 778 register int yyn;
779 int yyresult;
780 /* Number of tokens to shift before error messages enabled. */
781 int yyerrstatus;
782 /* Lookahead token as an internal (translated) token number. */
783 int yychar1 = 0;
784
785 /* Three stacks and their tools:
786 `yyss': related to states,
787 `yyvs': related to semantic values,
788 `yyls': related to locations.
789
790 Refer to the stacks thru separate pointers, to allow yyoverflow
791 to reallocate them elsewhere. */
792
793 /* The state stack. */
794 shortyyssa[YYINITDEPTH];
795 short *yyss = yyssa;
627 register short *yyssp; 796 register short *yyssp;
628 register YYSTYPE *yyvsp;
629 int yyerrstatus;/* number of tokens to shift before error messages enabled */
630 int yychar1 = 0; /* lookahead token as an internal (translated) token number */
631
632 short yyssa[YYINITDEPTH]; /* the state stack */
633 YYSTYPE yyvsa[YYINITDEPTH]; /* the semantic value stack */
634 797
635 short *yyss = yyssa; /* refer to the stacks thru separate pointers */ 798 /* The semantic value stack. */
636 YYSTYPE *yyvs = yyvsa;/* to allow yyoverflow to reallocate them elsewhere */ 799 YYSTYPE yyvsa[YYINITDEPTH];
800 YYSTYPE *yyvs = yyvsa;
801 register YYSTYPE *yyvsp;
637 802
638#ifdef YYLSP_NEEDED 803#if YYLSP_NEEDED
639 YYLTYPE yylsa[YYINITDEPTH]; /* the location stack */ 804 /* The location stack. */
805 YYLTYPE yylsa[YYINITDEPTH];
640 YYLTYPE *yyls = yylsa; 806 YYLTYPE *yyls = yylsa;
641 YYLTYPE *yylsp; 807 YYLTYPE *yylsp;
808#endif
642 809
810#if YYLSP_NEEDED
643#define YYPOPSTACK (yyvsp--, yyssp--, yylsp--) 811#define YYPOPSTACK (yyvsp--, yyssp--, yylsp--)
@@ -647,24 +815,17 @@ yyparse(YYPARSE_PARAM_ARG)
647 815
648 int yystacksize = YYINITDEPTH; 816 YYSIZE_T yystacksize = YYINITDEPTH;
649 int yyfree_stacks = 0;
650 817
651#ifdef YYPURE
652 int yychar;
653 YYSTYPE yylval;
654 int yynerrs;
655#ifdef YYLSP_NEEDED
656 YYLTYPE yylloc;
657#endif
658#endif
659 818
660 YYSTYPE yyval; /* the variable used to return */ 819 /* The variables used to return semantic value and location from the
661 /* semantic values from the action*/ 820 action routines. */
662 /* routines */ 821 YYSTYPE yyval;
822#if YYLSP_NEEDED
823 YYLTYPE yyloc;
824#endif
663 825
826 /* When reducing, the number of symbols on the RHS of the reduced
827 rule. */
664 int yylen; 828 int yylen;
665 829
666#if YYDEBUG != 0 830 YYDPRINTF ((stderr, "Starting parse\n"));
667 if (yydebug)
668 fprintf(stderr, "Starting parse\n");
669#endif
670 831
@@ -680,14 +841,20 @@ yyparse(YYPARSE_PARAM_ARG)
680 841
681 yyssp = yyss - 1; 842 yyssp = yyss;
682 yyvsp = yyvs; 843 yyvsp = yyvs;
683#ifdef YYLSP_NEEDED 844#if YYLSP_NEEDED
684 yylsp = yyls; 845 yylsp = yyls;
685#endif 846#endif
847 goto yysetstate;
686 848
687/* Push a new state, which is found in yystate . */ 849/*------------------------------------------------------------.
688/* In all cases, when you get here, the value and location stacks 850| yynewstate -- Push a new state, which is found in yystate. |
689 have just been pushed. so pushing a state here evens the stacks. */ 851`------------------------------------------------------------*/
690yynewstate: 852yynewstate:
853 /* In all cases, when you get here, the value and location stacks
854 have just been pushed. so pushing a state here evens the stacks.
855 */
856 yyssp++;
691 857
692 *++yyssp = yystate; 858 yysetstate:
859 *yyssp = yystate;
693 860
@@ -695,17 +862,17 @@ yynewstate:
695 { 862 {
696 /* Give user a chance to reallocate the stack */
697 /* Use copies of these so that the &'s don't force the real ones into memory. */
698 YYSTYPE *yyvs1 = yyvs;
699 short *yyss1 = yyss;
700#ifdef YYLSP_NEEDED
701 YYLTYPE *yyls1 = yyls;
702#endif
703
704 /* Get the current used size of the three stacks, in elements. */ 863 /* Get the current used size of the three stacks, in elements. */
705 int size = yyssp - yyss + 1; 864 YYSIZE_T yysize = yyssp - yyss + 1;
706 865
707#ifdef yyoverflow 866#ifdef yyoverflow
708 /* Each stack pointer address is followed by the size of 867 {
709 the data in use in that stack, in bytes. */ 868 /* Give user a chance to reallocate the stack. Use copies of
710#ifdef YYLSP_NEEDED 869 these so that the &'s don't force the real ones into
870 memory. */
871 YYSTYPE *yyvs1 = yyvs;
872 short *yyss1 = yyss;
873
874 /* Each stack pointer address is followed by the size of the
875 data in use in that stack, in bytes. */
876# if YYLSP_NEEDED
877 YYLTYPE *yyls1 = yyls;
711 /* This used to be a conditional around just the two extra args, 878 /* This used to be a conditional around just the two extra args,
@@ -713,32 +880,23 @@ yynewstate:
713 yyoverflow("parser stack overflow", 880 yyoverflow("parser stack overflow",
714 &yyss1, size * sizeof (*yyssp), 881 &yyss1, yysize * sizeof (*yyssp),
715 &yyvs1, size * sizeof (*yyvsp), 882 &yyvs1, yysize * sizeof (*yyvsp),
716 &yyls1, size * sizeof (*yylsp), 883 &yyls1, yysize * sizeof (*yylsp),
717 &yystacksize); 884 &yystacksize);
885 yyls = yyls1;
718#else 886#else
719 yyoverflow("parser stack overflow", 887 yyoverflow("parser stack overflow",
720 &yyss1, size * sizeof (*yyssp), 888 &yyss1, yysize * sizeof (*yyssp),
721 &yyvs1, size * sizeof (*yyvsp), 889 &yyvs1, yysize * sizeof (*yyvsp),
722 &yystacksize); 890 &yystacksize);
723#endif 891#endif
724 892 yyss = yyss1;
725 yyss = yyss1; yyvs = yyvs1; 893 yyvs = yyvs1;
726#ifdef YYLSP_NEEDED 894 }
727 yyls = yyls1;
728#endif
729#else /* no yyoverflow */ 895#else /* no yyoverflow */
896# ifndef YYSTACK_RELOCATE
897 goto yyoverflowlab;
898# else
730 /* Extend the stack our own way. */ 899 /* Extend the stack our own way. */
731 if (yystacksize >= YYMAXDEPTH) 900 if (yystacksize >= YYMAXDEPTH)
732 { 901 goto yyoverflowlab;
733 yyerror("parser stack overflow");
734 if (yyfree_stacks)
735 {
736 free (yyss);
737 free (yyvs);
738#ifdef YYLSP_NEEDED
739 free (yyls);
740#endif
741 }
742 return 2;
743 }
744 yystacksize *= 2; 902 yystacksize *= 2;
@@ -746,15 +904,18 @@ yynewstate:
746 yystacksize = YYMAXDEPTH; 904 yystacksize = YYMAXDEPTH;
747#ifndef YYSTACK_USE_ALLOCA 905
748 yyfree_stacks = 1; 906 {
749#endif 907 short *yyss1 = yyss;
750 yyss = (short *) YYSTACK_ALLOC (yystacksize * sizeof (*yyssp)); 908 union yyalloc *yyptr =
751 __yy_memcpy ((char *)yyss, (char *)yyss1, 909 (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize));
752 size * (unsigned int) sizeof (*yyssp)); 910 if (! yyptr)
753 yyvs = (YYSTYPE *) YYSTACK_ALLOC (yystacksize * sizeof (*yyvsp)); 911 goto yyoverflowlab;
754 __yy_memcpy ((char *)yyvs, (char *)yyvs1, 912 YYSTACK_RELOCATE (yyss);
755 size * (unsigned int) sizeof (*yyvsp)); 913 YYSTACK_RELOCATE (yyvs);
756#ifdef YYLSP_NEEDED 914# if YYLSP_NEEDED
757 yyls = (YYLTYPE *) YYSTACK_ALLOC (yystacksize * sizeof (*yylsp)); 915 YYSTACK_RELOCATE (yyls);
758 __yy_memcpy ((char *)yyls, (char *)yyls1, 916# endif
759 size * (unsigned int) sizeof (*yylsp)); 917# undef YYSTACK_RELOCATE
918 if (yyss1 != yyssa)
919 YYSTACK_FREE (yyss1);
920 }
760#endif 921#endif
@@ -762,12 +923,10 @@ yynewstate:
762 923
763 yyssp = yyss + size - 1; 924 yyssp = yyss + yysize - 1;
764 yyvsp = yyvs + size - 1; 925 yyvsp = yyvs + yysize - 1;
765#ifdef YYLSP_NEEDED 926#if YYLSP_NEEDED
766 yylsp = yyls + size - 1; 927 yylsp = yyls + yysize - 1;
767#endif 928#endif
768 929
769#if YYDEBUG != 0 930 YYDPRINTF ((stderr, "Stack size increased to %lu\n",
770 if (yydebug) 931 (unsigned long int) yystacksize));
771 fprintf(stderr, "Stack size increased to %d\n", yystacksize);
772#endif
773 932
@@ -777,8 +936,10 @@ yynewstate:
777 936
778#if YYDEBUG != 0 937 YYDPRINTF ((stderr, "Entering state %d\n", yystate));
779 if (yydebug)
780 fprintf(stderr, "Entering state %d\n", yystate);
781#endif
782 938
783 goto yybackup; 939 goto yybackup;
940
941
942/*-----------.
943| yybackup. |
944`-----------*/
784 yybackup: 945 yybackup:
@@ -802,6 +963,3 @@ yynewstate:
802 { 963 {
803#if YYDEBUG != 0 964 YYDPRINTF ((stderr, "Reading a token: "));
804 if (yydebug)
805 fprintf(stderr, "Reading a token: ");
806#endif
807 yychar = YYLEX; 965 yychar = YYLEX;
@@ -816,6 +974,3 @@ yynewstate:
816 974
817#if YYDEBUG != 0 975 YYDPRINTF ((stderr, "Now at end of input.\n"));
818 if (yydebug)
819 fprintf(stderr, "Now at end of input.\n");
820#endif
821 } 976 }
@@ -825,8 +980,11 @@ yynewstate:
825 980
826#if YYDEBUG != 0 981#if YYDEBUG
982 /* We have to keep this `#if YYDEBUG', since we use variables
983 which are defined only if `YYDEBUG' is set. */
827 if (yydebug) 984 if (yydebug)
828 { 985 {
829 fprintf (stderr, "Next token is %d (%s", yychar, yytname[yychar1]); 986 YYFPRINTF (stderr, "Next token is %d (%s",
830 /* Give the individual parser a way to print the precise meaning 987 yychar, yytname[yychar1]);
831 of a token, for further debugging info. */ 988 /* Give the individual parser a way to print the precise
989 meaning of a token, for further debugging info. */
832#ifdef YYPRINT 990#ifdef YYPRINT
@@ -834,3 +992,3 @@ yynewstate:
834#endif 992#endif
835 fprintf (stderr, ")\n"); 993 YYFPRINTF (stderr, ")\n");
836 } 994 }
@@ -866,7 +1024,4 @@ yynewstate:
866 /* Shift the lookahead token. */ 1024 /* Shift the lookahead token. */
867 1025 YYDPRINTF ((stderr, "Shifting token %d (%s), ",
868#if YYDEBUG != 0 1026 yychar, yytname[yychar1]));
869 if (yydebug)
870 fprintf(stderr, "Shifting token %d (%s), ", yychar, yytname[yychar1]);
871#endif
872 1027
@@ -877,3 +1032,3 @@ yynewstate:
877 *++yyvsp = yylval; 1032 *++yyvsp = yylval;
878#ifdef YYLSP_NEEDED 1033#if YYLSP_NEEDED
879 *++yylsp = yylloc; 1034 *++yylsp = yylloc;
@@ -881,4 +1036,6 @@ yynewstate:
881 1036
882 /* count tokens shifted since error; after three, turn off error status. */ 1037 /* Count tokens shifted since error; after three, turn off error
883 if (yyerrstatus) yyerrstatus--; 1038 status. */
1039 if (yyerrstatus)
1040 yyerrstatus--;
884 1041
@@ -887,5 +1044,7 @@ yynewstate:
887 1044
888/* Do the default action for the current state. */
889yydefault:
890 1045
1046/*-----------------------------------------------------------.
1047| yydefault -- do the default action for the current state. |
1048`-----------------------------------------------------------*/
1049yydefault:
891 yyn = yydefact[yystate]; 1050 yyn = yydefact[yystate];
@@ -893,15 +1052,37 @@ yydefault:
893 goto yyerrlab; 1052 goto yyerrlab;
1053 goto yyreduce;
894 1054
895/* Do a reduction. yyn is the number of a rule to reduce with. */ 1055
1056/*-----------------------------.
1057| yyreduce -- Do a reduction. |
1058`-----------------------------*/
896yyreduce: 1059yyreduce:
1060 /* yyn is the number of a rule to reduce with. */
897 yylen = yyr2[yyn]; 1061 yylen = yyr2[yyn];
898 if (yylen > 0)
899 yyval = yyvsp[1-yylen]; /* implement default value of the action */
900 1062
901#if YYDEBUG != 0 1063 /* If YYLEN is nonzero, implement the default value of the action:
1064 `$$ = $1'.
1065
1066 Otherwise, the following line sets YYVAL to the semantic value of
1067 the lookahead token. This behavior is undocumented and Bison
1068 users should not rely upon it. Assigning to YYVAL
1069 unconditionally makes the parser a bit smaller, and it avoids a
1070 GCC warning that YYVAL may be used uninitialized. */
1071 yyval = yyvsp[1-yylen];
1072
1073#if YYLSP_NEEDED
1074 /* Similarly for the default location. Let the user run additional
1075 commands if for instance locations are ranges. */
1076 yyloc = yylsp[1-yylen];
1077 YYLLOC_DEFAULT (yyloc, (yylsp - yylen), yylen);
1078#endif
1079
1080#if YYDEBUG
1081 /* We have to keep this `#if YYDEBUG', since we use variables which
1082 are defined only if `YYDEBUG' is set. */
902 if (yydebug) 1083 if (yydebug)
903 { 1084 {
904 int i; 1085 int yyi;
905 1086
906 fprintf (stderr, "Reducing via rule %d (line %d), ", 1087 YYFPRINTF (stderr, "Reducing via rule %d (line %d), ",
907 yyn, yyrline[yyn]); 1088 yyn, yyrline[yyn]);
@@ -909,5 +1090,5 @@ yyreduce:
909 /* Print the symbols being reduced, and their result. */ 1090 /* Print the symbols being reduced, and their result. */
910 for (i = yyprhs[yyn]; yyrhs[i] > 0; i++) 1091 for (yyi = yyprhs[yyn]; yyrhs[yyi] > 0; yyi++)
911 fprintf (stderr, "%s ", yytname[yyrhs[i]]); 1092 YYFPRINTF (stderr, "%s ", yytname[yyrhs[yyi]]);
912 fprintf (stderr, " -> %s\n", yytname[yyr1[yyn]]); 1093 YYFPRINTF (stderr, " -> %s\n", yytname[yyr1[yyn]]);
913 } 1094 }
@@ -915,3 +1096,2 @@ yyreduce:
915 1096
916
917 switch (yyn) { 1097 switch (yyn) {
@@ -919,11 +1099,11 @@ yyreduce:
919case 2: 1099case 2:
920#line 213 "./vcc.y" 1100#line 212 "vcc.y"
921{ addList(&vObjList, yyvsp[0].vobj); curObj = 0; ; 1101{ addList(&vObjList, yyvsp[0].vobj); curObj = 0; }
922 break;} 1102 break;
923case 4: 1103case 4:
924#line 216 "./vcc.y" 1104#line 215 "vcc.y"
925{ addList(&vObjList, yyvsp[0].vobj); curObj = 0; ; 1105{ addList(&vObjList, yyvsp[0].vobj); curObj = 0; }
926 break;} 1106 break;
927case 7: 1107case 7:
928#line 225 "./vcc.y" 1108#line 224 "vcc.y"
929{ 1109{
@@ -931,6 +1111,6 @@ case 7:
931 if (!pushVObject(VCCardProp)) YYERROR; 1111 if (!pushVObject(VCCardProp)) YYERROR;
932 ; 1112 }
933 break;} 1113 break;
934case 8: 1114case 8:
935#line 230 "./vcc.y" 1115#line 229 "vcc.y"
936{ 1116{
@@ -938,6 +1118,6 @@ case 8:
938 yyval.vobj = popVObject(); 1118 yyval.vobj = popVObject();
939 ; 1119 }
940 break;} 1120 break;
941case 9: 1121case 9:
942#line 235 "./vcc.y" 1122#line 234 "vcc.y"
943{ 1123{
@@ -945,6 +1125,6 @@ case 9:
945 if (!pushVObject(VCCardProp)) YYERROR; 1125 if (!pushVObject(VCCardProp)) YYERROR;
946 ; 1126 }
947 break;} 1127 break;
948case 10: 1128case 10:
949#line 240 "./vcc.y" 1129#line 239 "vcc.y"
950{ 1130{
@@ -952,12 +1132,12 @@ case 10:
952 yyval.vobj = popVObject(); 1132 yyval.vobj = popVObject();
953 ; 1133 }
954 break;} 1134 break;
955case 13: 1135case 13:
956#line 251 "./vcc.y" 1136#line 250 "vcc.y"
957{ 1137{
958 lexPushMode(L_VALUES); 1138 lexPushMode(L_VALUES);
959 ; 1139 }
960 break;} 1140 break;
961case 14: 1141case 14:
962#line 255 "./vcc.y" 1142#line 254 "vcc.y"
963{ 1143{
@@ -966,24 +1146,24 @@ case 14:
966 lexPopMode(0); 1146 lexPopMode(0);
967 ; 1147 }
968 break;} 1148 break;
969case 16: 1149case 16:
970#line 264 "./vcc.y" 1150#line 263 "vcc.y"
971{ 1151{
972 enterProps(yyvsp[0].str); 1152 enterProps(yyvsp[0].str);
973 ; 1153 }
974 break;} 1154 break;
975case 18: 1155case 18:
976#line 269 "./vcc.y" 1156#line 268 "vcc.y"
977{ 1157{
978 enterProps(yyvsp[0].str); 1158 enterProps(yyvsp[0].str);
979 ; 1159 }
980 break;} 1160 break;
981case 22: 1161case 22:
982#line 282 "./vcc.y" 1162#line 281 "vcc.y"
983{ 1163{
984 enterAttr(yyvsp[0].str,0); 1164 enterAttr(yyvsp[0].str,0);
985 ; 1165 }
986 break;} 1166 break;
987case 23: 1167case 23:
988#line 286 "./vcc.y" 1168#line 285 "vcc.y"
989{ 1169{
@@ -991,34 +1171,34 @@ case 23:
991 1171
992 ; 1172 }
993 break;} 1173 break;
994case 25: 1174case 25:
995#line 295 "./vcc.y" 1175#line 294 "vcc.y"
996{ appendValue(yyvsp[-1].str); ; 1176{ enterValues(yyvsp[-1].str); }
997 break;} 1177 break;
998case 27: 1178case 27:
999#line 297 "./vcc.y" 1179#line 296 "vcc.y"
1000{ appendValue(yyvsp[0].str); ; 1180{ enterValues(yyvsp[0].str); }
1001 break;} 1181 break;
1002case 29: 1182case 29:
1003#line 302 "./vcc.y" 1183#line 300 "vcc.y"
1004{ yyval.str = 0; ; 1184{ yyval.str = 0; }
1005 break;} 1185 break;
1006case 30: 1186case 30:
1007#line 307 "./vcc.y" 1187#line 305 "vcc.y"
1008{ if (!pushVObject(VCCalProp)) YYERROR; ; 1188{ if (!pushVObject(VCCalProp)) YYERROR; }
1009 break;} 1189 break;
1010case 31: 1190case 31:
1011#line 310 "./vcc.y" 1191#line 308 "vcc.y"
1012{ yyval.vobj = popVObject(); ; 1192{ yyval.vobj = popVObject(); }
1013 break;} 1193 break;
1014case 32: 1194case 32:
1015#line 312 "./vcc.y" 1195#line 310 "vcc.y"
1016{ if (!pushVObject(VCCalProp)) YYERROR; ; 1196{ if (!pushVObject(VCCalProp)) YYERROR; }
1017 break;} 1197 break;
1018case 33: 1198case 33:
1019#line 314 "./vcc.y" 1199#line 312 "vcc.y"
1020{ yyval.vobj = popVObject(); ; 1200{ yyval.vobj = popVObject(); }
1021 break;} 1201 break;
1022case 39: 1202case 39:
1023#line 329 "./vcc.y" 1203#line 327 "vcc.y"
1024{ 1204{
@@ -1026,6 +1206,6 @@ case 39:
1026 if (!pushVObject(VCEventProp)) YYERROR; 1206 if (!pushVObject(VCEventProp)) YYERROR;
1027 ; 1207 }
1028 break;} 1208 break;
1029case 40: 1209case 40:
1030#line 335 "./vcc.y" 1210#line 333 "vcc.y"
1031{ 1211{
@@ -1033,6 +1213,6 @@ case 40:
1033 popVObject(); 1213 popVObject();
1034 ; 1214 }
1035 break;} 1215 break;
1036case 41: 1216case 41:
1037#line 340 "./vcc.y" 1217#line 338 "vcc.y"
1038{ 1218{
@@ -1040,6 +1220,6 @@ case 41:
1040 if (!pushVObject(VCEventProp)) YYERROR; 1220 if (!pushVObject(VCEventProp)) YYERROR;
1041 ; 1221 }
1042 break;} 1222 break;
1043case 42: 1223case 42:
1044#line 345 "./vcc.y" 1224#line 343 "vcc.y"
1045{ 1225{
@@ -1047,6 +1227,6 @@ case 42:
1047 popVObject(); 1227 popVObject();
1048 ; 1228 }
1049 break;} 1229 break;
1050case 43: 1230case 43:
1051#line 353 "./vcc.y" 1231#line 351 "vcc.y"
1052{ 1232{
@@ -1054,6 +1234,6 @@ case 43:
1054 if (!pushVObject(VCTodoProp)) YYERROR; 1234 if (!pushVObject(VCTodoProp)) YYERROR;
1055 ; 1235 }
1056 break;} 1236 break;
1057case 44: 1237case 44:
1058#line 359 "./vcc.y" 1238#line 357 "vcc.y"
1059{ 1239{
@@ -1061,6 +1241,6 @@ case 44:
1061 popVObject(); 1241 popVObject();
1062 ; 1242 }
1063 break;} 1243 break;
1064case 45: 1244case 45:
1065#line 364 "./vcc.y" 1245#line 362 "vcc.y"
1066{ 1246{
@@ -1068,6 +1248,6 @@ case 45:
1068 if (!pushVObject(VCTodoProp)) YYERROR; 1248 if (!pushVObject(VCTodoProp)) YYERROR;
1069 ; 1249 }
1070 break;} 1250 break;
1071case 46: 1251case 46:
1072#line 369 "./vcc.y" 1252#line 367 "vcc.y"
1073{ 1253{
@@ -1075,7 +1255,8 @@ case 46:
1075 popVObject(); 1255 popVObject();
1076 ;
1077 break;}
1078} 1256}
1079 /* the action file gets copied in in place of this dollarsign */ 1257 break;
1080#line 543 "/usr/share/bison.simple" 1258}
1259
1260#line 705 "/usr/share/bison/bison.simple"
1261
1081 1262
@@ -1083,3 +1264,3 @@ case 46:
1083 yyssp -= yylen; 1264 yyssp -= yylen;
1084#ifdef YYLSP_NEEDED 1265#if YYLSP_NEEDED
1085 yylsp -= yylen; 1266 yylsp -= yylen;
@@ -1087,10 +1268,10 @@ case 46:
1087 1268
1088#if YYDEBUG != 0 1269#if YYDEBUG
1089 if (yydebug) 1270 if (yydebug)
1090 { 1271 {
1091 short *ssp1 = yyss - 1; 1272 short *yyssp1 = yyss - 1;
1092 fprintf (stderr, "state stack now"); 1273 YYFPRINTF (stderr, "state stack now");
1093 while (ssp1 != yyssp) 1274 while (yyssp1 != yyssp)
1094 fprintf (stderr, " %d", *++ssp1); 1275 YYFPRINTF (stderr, " %d", *++yyssp1);
1095 fprintf (stderr, "\n"); 1276 YYFPRINTF (stderr, "\n");
1096 } 1277 }
@@ -1099,24 +1280,9 @@ case 46:
1099 *++yyvsp = yyval; 1280 *++yyvsp = yyval;
1100 1281#if YYLSP_NEEDED
1101#ifdef YYLSP_NEEDED 1282 *++yylsp = yyloc;
1102 yylsp++;
1103 if (yylen == 0)
1104 {
1105 yylsp->first_line = yylloc.first_line;
1106 yylsp->first_column = yylloc.first_column;
1107 yylsp->last_line = (yylsp-1)->last_line;
1108 yylsp->last_column = (yylsp-1)->last_column;
1109 yylsp->text = 0;
1110 }
1111 else
1112 {
1113 yylsp->last_line = (yylsp+yylen-1)->last_line;
1114 yylsp->last_column = (yylsp+yylen-1)->last_column;
1115 }
1116#endif 1283#endif
1117 1284
1118 /* Now "shift" the result of the reduction. 1285 /* Now `shift' the result of the reduction. Determine what state
1119 Determine what state that goes to, 1286 that goes to, based on the state we popped back to and the rule
1120 based on the state we popped back to 1287 number reduced by. */
1121 and the rule number reduced by. */
1122 1288
@@ -1132,6 +1298,9 @@ case 46:
1132 1298
1133yyerrlab: /* here on detecting error */
1134 1299
1135 if (! yyerrstatus) 1300/*------------------------------------.
1301| yyerrlab -- here on detecting error |
1302`------------------------------------*/
1303yyerrlab:
1136 /* If not already recovering from an error, report this error. */ 1304 /* If not already recovering from an error, report this error. */
1305 if (!yyerrstatus)
1137 { 1306 {
@@ -1144,47 +1313,56 @@ yyerrlab: /* here on detecting error */
1144 { 1313 {
1145 int size = 0; 1314 YYSIZE_T yysize = 0;
1146 char *msg; 1315 char *yymsg;
1147 int x, count; 1316 int yyx, yycount;
1148 1317
1149 count = 0; 1318 yycount = 0;
1150 /* Start X at -yyn if nec to avoid negative indexes in yycheck. */ 1319 /* Start YYX at -YYN if negative to avoid negative indexes in
1151 for (x = (yyn < 0 ? -yyn : 0); 1320 YYCHECK. */
1152 x < (sizeof(yytname) / sizeof(char *)); x++) 1321 for (yyx = yyn < 0 ? -yyn : 0;
1153 if (yycheck[x + yyn] == x) 1322 yyx < (int) (sizeof (yytname) / sizeof (char *)); yyx++)
1154 size += strlen(yytname[x]) + 15, count++; 1323 if (yycheck[yyx + yyn] == yyx)
1155 msg = (char *) malloc(size + 15); 1324 yysize += yystrlen (yytname[yyx]) + 15, yycount++;
1156 if (msg != 0) 1325 yysize += yystrlen ("parse error, unexpected ") + 1;
1326 yysize += yystrlen (yytname[YYTRANSLATE (yychar)]);
1327 yymsg = (char *) YYSTACK_ALLOC (yysize);
1328 if (yymsg != 0)
1157 { 1329 {
1158 strcpy(msg, "parse error"); 1330 char *yyp = yystpcpy (yymsg, "parse error, unexpected ");
1331 yyp = yystpcpy (yyp, yytname[YYTRANSLATE (yychar)]);
1159 1332
1160 if (count < 5) 1333 if (yycount < 5)
1161 { 1334 {
1162 count = 0; 1335 yycount = 0;
1163 for (x = (yyn < 0 ? -yyn : 0); 1336 for (yyx = yyn < 0 ? -yyn : 0;
1164 x < (sizeof(yytname) / sizeof(char *)); x++) 1337 yyx < (int) (sizeof (yytname) / sizeof (char *));
1165 if (yycheck[x + yyn] == x) 1338 yyx++)
1339 if (yycheck[yyx + yyn] == yyx)
1166 { 1340 {
1167 strcat(msg, count == 0 ? ", expecting `" : " or `"); 1341 const char *yyq = ! yycount ? ", expecting " : " or ";
1168 strcat(msg, yytname[x]); 1342 yyp = yystpcpy (yyp, yyq);
1169 strcat(msg, "'"); 1343 yyp = yystpcpy (yyp, yytname[yyx]);
1170 count++; 1344 yycount++;
1171 } 1345 }
1172 } 1346 }
1173 yyerror(msg); 1347 yyerror (yymsg);
1174 free(msg); 1348 YYSTACK_FREE (yymsg);
1175 } 1349 }
1176 else 1350 else
1177 yyerror ("parse error; also virtual memory exceeded"); 1351 yyerror ("parse error; also virtual memory exhausted");
1178 } 1352 }
1179 else 1353 else
1180#endif /* YYERROR_VERBOSE */ 1354#endif /* defined (YYERROR_VERBOSE) */
1181 yyerror("parse error"); 1355 yyerror("parse error");
1182 } 1356 }
1183
1184 goto yyerrlab1; 1357 goto yyerrlab1;
1185yyerrlab1: /* here on error raised explicitly by an action */
1186 1358
1359
1360/*--------------------------------------------------.
1361| yyerrlab1 -- error raised explicitly by an action |
1362`--------------------------------------------------*/
1363yyerrlab1:
1187 if (yyerrstatus == 3) 1364 if (yyerrstatus == 3)
1188 { 1365 {
1189 /* if just tried and failed to reuse lookahead token after an error, discard it. */ 1366 /* If just tried and failed to reuse lookahead token after an
1367 error, discard it. */
1190 1368
@@ -1193,8 +1371,4 @@ yyerrlab1: /* here on error raised explicitly by an action */
1193 YYABORT; 1371 YYABORT;
1194 1372 YYDPRINTF ((stderr, "Discarding token %d (%s).\n",
1195#if YYDEBUG != 0 1373 yychar, yytname[yychar1]));
1196 if (yydebug)
1197 fprintf(stderr, "Discarding token %d (%s).\n", yychar, yytname[yychar1]);
1198#endif
1199
1200 yychar = YYEMPTY; 1374 yychar = YYEMPTY;
@@ -1202,4 +1376,4 @@ yyerrlab1: /* here on error raised explicitly by an action */
1202 1376
1203 /* Else will try to reuse lookahead token 1377 /* Else will try to reuse lookahead token after shifting the error
1204 after shifting the error token. */ 1378 token. */
1205 1379
@@ -1209,4 +1383,8 @@ yyerrlab1: /* here on error raised explicitly by an action */
1209 1383
1210yyerrdefault: /* current state does not do anything special for the error token. */
1211 1384
1385/*-------------------------------------------------------------------.
1386| yyerrdefault -- current state does not do anything special for the |
1387| error token. |
1388`-------------------------------------------------------------------*/
1389yyerrdefault:
1212#if 0 1390#if 0
@@ -1214,12 +1392,20 @@ yyerrdefault: /* current state does not do anything special for the error token
1214 should shift them. */ 1392 should shift them. */
1215 yyn = yydefact[yystate]; /* If its default is to accept any token, ok. Otherwise pop it.*/ 1393
1216 if (yyn) goto yydefault; 1394 /* If its default is to accept any token, ok. Otherwise pop it. */
1395 yyn = yydefact[yystate];
1396 if (yyn)
1397 goto yydefault;
1217#endif 1398#endif
1218 1399
1219yyerrpop: /* pop the current state because it cannot handle the error token */
1220 1400
1221 if (yyssp == yyss) YYABORT; 1401/*---------------------------------------------------------------.
1402| yyerrpop -- pop the current state because it cannot handle the |
1403| error token |
1404`---------------------------------------------------------------*/
1405yyerrpop:
1406 if (yyssp == yyss)
1407 YYABORT;
1222 yyvsp--; 1408 yyvsp--;
1223 yystate = *--yyssp; 1409 yystate = *--yyssp;
1224#ifdef YYLSP_NEEDED 1410#if YYLSP_NEEDED
1225 yylsp--; 1411 yylsp--;
@@ -1227,10 +1413,10 @@ yyerrpop: /* pop the current state because it cannot handle the error token */
1227 1413
1228#if YYDEBUG != 0 1414#if YYDEBUG
1229 if (yydebug) 1415 if (yydebug)
1230 { 1416 {
1231 short *ssp1 = yyss - 1; 1417 short *yyssp1 = yyss - 1;
1232 fprintf (stderr, "Error: state stack now"); 1418 YYFPRINTF (stderr, "Error: state stack now");
1233 while (ssp1 != yyssp) 1419 while (yyssp1 != yyssp)
1234 fprintf (stderr, " %d", *++ssp1); 1420 YYFPRINTF (stderr, " %d", *++yyssp1);
1235 fprintf (stderr, "\n"); 1421 YYFPRINTF (stderr, "\n");
1236 } 1422 }
@@ -1238,4 +1424,6 @@ yyerrpop: /* pop the current state because it cannot handle the error token */
1238 1424
1425/*--------------.
1426| yyerrhandle. |
1427`--------------*/
1239yyerrhandle: 1428yyerrhandle:
1240
1241 yyn = yypact[yystate]; 1429 yyn = yypact[yystate];
@@ -1262,9 +1450,6 @@ yyerrhandle:
1262 1450
1263#if YYDEBUG != 0 1451 YYDPRINTF ((stderr, "Shifting error token, "));
1264 if (yydebug)
1265 fprintf(stderr, "Shifting error token, ");
1266#endif
1267 1452
1268 *++yyvsp = yylval; 1453 *++yyvsp = yylval;
1269#ifdef YYLSP_NEEDED 1454#if YYLSP_NEEDED
1270 *++yylsp = yylloc; 1455 *++yylsp = yylloc;
@@ -1275,29 +1460,34 @@ yyerrhandle:
1275 1460
1461
1462/*-------------------------------------.
1463| yyacceptlab -- YYACCEPT comes here. |
1464`-------------------------------------*/
1276 yyacceptlab: 1465 yyacceptlab:
1277 /* YYACCEPT comes here. */ 1466 yyresult = 0;
1278 if (yyfree_stacks) 1467 goto yyreturn;
1279 {
1280 free (yyss);
1281 free (yyvs);
1282#ifdef YYLSP_NEEDED
1283 free (yyls);
1284#endif
1285 }
1286 return 0;
1287 1468
1469/*-----------------------------------.
1470| yyabortlab -- YYABORT comes here. |
1471`-----------------------------------*/
1288 yyabortlab: 1472 yyabortlab:
1289 /* YYABORT comes here. */ 1473 yyresult = 1;
1290 if (yyfree_stacks) 1474 goto yyreturn;
1291 { 1475
1292 free (yyss); 1476/*---------------------------------------------.
1293 free (yyvs); 1477| yyoverflowab -- parser overflow comes here. |
1294#ifdef YYLSP_NEEDED 1478`---------------------------------------------*/
1295 free (yyls); 1479yyoverflowlab:
1480 yyerror ("parser stack overflow");
1481 yyresult = 2;
1482 /* Fall through. */
1483
1484yyreturn:
1485#ifndef yyoverflow
1486 if (yyss != yyssa)
1487 YYSTACK_FREE (yyss);
1296#endif 1488#endif
1489 return yyresult;
1297 } 1490 }
1298 return 1; 1491#line 373 "vcc.y"
1299}
1300#line 375 "./vcc.y"
1301 1492
1302/****************************************************************************/
1303static int pushVObject(const char *prop) 1493static int pushVObject(const char *prop)
@@ -1321,3 +1511,2 @@ static int pushVObject(const char *prop)
1321 1511
1322/****************************************************************************/
1323/* This pops the recently built vCard off the stack and returns it. */ 1512/* This pops the recently built vCard off the stack and returns it. */
@@ -1337,25 +1526,4 @@ static VObject* popVObject()
1337 1526
1338/* static void enterValues(const char *value) */ 1527static void enterValues(const char *value)
1339/* { */
1340/* if (fieldedProp && *fieldedProp) { */
1341 /* if (value) { */
1342 /* addPropValue(curProp,*fieldedProp,value); */
1343 /* } */
1344 /* else this field is empty, advance to next field */
1345 /* fieldedProp++; */
1346 /* } */
1347/* else { */
1348 /* if (value) { */
1349 /* setVObjectUStringZValue_(curProp,fakeUnicode(value,0)); */
1350 /* } */
1351 /* } */
1352/* deleteStr(value); */
1353/* } */
1354
1355static void appendValue(const char *value)
1356{ 1528{
1357 char *p1, *p2;
1358 wchar_t *p3;
1359 int i;
1360
1361 if (fieldedProp && *fieldedProp) { 1529 if (fieldedProp && *fieldedProp) {
@@ -1366,7 +1534,14 @@ static void appendValue(const char *value)
1366 fieldedProp++; 1534 fieldedProp++;
1367 } else { 1535 }
1536 else {
1368 if (value) { 1537 if (value) {
1538 char *p1, *p2;
1539 wchar_t *p3;
1540 int i;
1541
1542 /* If the property already has a string value, we append this one,
1543 using ';' to separate the values. */
1369 if (vObjectUStringZValue(curProp)) { 1544 if (vObjectUStringZValue(curProp)) {
1370 p1 = fakeCString(vObjectUStringZValue(curProp)); 1545 p1 = fakeCString(vObjectUStringZValue(curProp));
1371 p2 = malloc(sizeof(char *) * (strlen(p1)+strlen(value)+1)); 1546 p2 = malloc((strlen(p1)+strlen(value)+1));
1372 strcpy(p2, p1); 1547 strcpy(p2, p1);
@@ -1375,3 +1550,3 @@ static void appendValue(const char *value)
1375 i = strlen(p2); 1550 i = strlen(p2);
1376 p2[i] = ','; 1551 p2[i] = ';';
1377 p2[i+1] = '\0'; 1552 p2[i+1] = '\0';
@@ -1390,3 +1565,2 @@ static void appendValue(const char *value)
1390 1565
1391
1392static void enterProps(const char *s) 1566static void enterProps(const char *s)
@@ -1399,3 +1573,3 @@ static void enterAttr(const char *s1, const char *s2)
1399 { 1573 {
1400 const char *p1=0L, *p2=0L; 1574 const char *p1, *p2;
1401 p1 = lookupProp_(s1); 1575 p1 = lookupProp_(s1);
@@ -1409,6 +1583,6 @@ static void enterAttr(const char *s1, const char *s2)
1409 addProp(curProp,p1); 1583 addProp(curProp,p1);
1410 if (strcasecmp(p1,VCBase64Prop) == 0 || (s2 && strcasecmp(p2,VCBase64Prop)==0)) 1584 if (stricmp(p1,VCBase64Prop) == 0 || (s2 && stricmp(p2,VCBase64Prop)==0))
1411 lexPushMode(L_BASE64); 1585 lexPushMode(L_BASE64);
1412 else if (strcasecmp(p1,VCQuotedPrintableProp) == 0 1586 else if (stricmp(p1,VCQuotedPrintableProp) == 0
1413 || (s2 && strcasecmp(p2,VCQuotedPrintableProp)==0)) 1587 || (s2 && stricmp(p2,VCQuotedPrintableProp)==0))
1414 lexPushMode(L_QUOTED_PRINTABLE); 1588 lexPushMode(L_QUOTED_PRINTABLE);
@@ -1425,3 +1599,7 @@ struct LexBuf {
1425 /* input */ 1599 /* input */
1600#ifdef INCLUDEMFC
1601 CFile *inputFile;
1602#else
1426 FILE *inputFile; 1603 FILE *inputFile;
1604#endif
1427 char *inputString; 1605 char *inputString;
@@ -1471,3 +1649,3 @@ static int lexWithinMode(enum LexMode mode) {
1471 1649
1472static int lexGetc_() 1650static char lexGetc_()
1473 { 1651 {
@@ -1479,6 +1657,8 @@ static int lexGetc_()
1479 else { 1657 else {
1480 if (!feof(lexBuf.inputFile)) 1658#ifdef INCLUDEMFC
1659 char result;
1660 return lexBuf.inputFile->Read(&result, 1) == 1 ? result : EOF;
1661#else
1481 return fgetc(lexBuf.inputFile); 1662 return fgetc(lexBuf.inputFile);
1482 else 1663#endif
1483 return EOF;
1484 } 1664 }
@@ -1521,7 +1701,5 @@ static int lexLookahead() {
1521 else if (c == '\n') { 1701 else if (c == '\n') {
1522 int a; 1702 int a = (lexBuf.len>1)?
1523 if (lexBuf.len > 1) 1703 lexBuf.buf[lexBuf.getPtr+1]:
1524 a = lexBuf.buf[lexBuf.getPtr]; 1704 lexGeta_(1);
1525 else
1526 a = lexGeta_(1);
1527 if (a == '\r') { 1705 if (a == '\r') {
@@ -1558,4 +1736,2 @@ static void lexAppendc(int c)
1558 { 1736 {
1559 /* not sure if I am doing this right to fix purify report -- PGB */
1560 lexBuf.strs = (char *) realloc(lexBuf.strs, (size_t) lexBuf.strsLen + 1);
1561 lexBuf.strs[lexBuf.strsLen] = c; 1737 lexBuf.strs[lexBuf.strsLen] = c;
@@ -1588,6 +1764,3 @@ static char* lexGetWord() {
1588 c = lexLookahead(); 1764 c = lexLookahead();
1589 /* some "words" have a space in them, like "NEEDS ACTION". 1765 while (c != EOF && !strchr("\t\n ;:=",c)) {
1590 this may be an oversight of the spec, but it is true nevertheless.
1591 while (c != EOF && !strchr("\t\n ;:=",c)) { */
1592 while (c != EOF && !strchr("\n;:=",c)) {
1593 lexAppendc(c); 1766 lexAppendc(c);
@@ -1600,18 +1773,2 @@ static char* lexGetWord() {
1600 1773
1601void lexPushLookahead(char *s, int len) {
1602 int putptr;
1603 if (len == 0) len = strlen(s);
1604 putptr = (int)lexBuf.getPtr - len;
1605 /* this function assumes that length of word to push back
1606 / is not greater than MAX_LEX_LOOKAHEAD.
1607 */
1608 if (putptr < 0) putptr += MAX_LEX_LOOKAHEAD;
1609 lexBuf.getPtr = putptr;
1610 while (*s) {
1611 lexBuf.buf[putptr] = *s++;
1612 putptr = (putptr + 1) % MAX_LEX_LOOKAHEAD;
1613 }
1614 lexBuf.len += len;
1615 }
1616
1617static void lexPushLookaheadc(int c) { 1774static void lexPushLookaheadc(int c) {
@@ -1724,13 +1881,2 @@ static char* lexGet1Value() {
1724 1881
1725char* lexGetStrUntil(char *termset) {
1726 int c = lexLookahead();
1727 lexClearToken();
1728 while (c != EOF && !strchr(termset,c)) {
1729 lexAppendc(c);
1730 lexSkipLookahead();
1731 c = lexLookahead();
1732 }
1733 lexAppendc(0);
1734 return c==EOF?0:lexStr();
1735 }
1736 1882
@@ -1740,6 +1886,6 @@ static int match_begin_name(int end) {
1740 if (n) { 1886 if (n) {
1741 if (!strcasecmp(n,"vcard")) token = end?END_VCARD:BEGIN_VCARD; 1887 if (!stricmp(n,"vcard")) token = end?END_VCARD:BEGIN_VCARD;
1742 else if (!strcasecmp(n,"vcalendar")) token = end?END_VCAL:BEGIN_VCAL; 1888 else if (!stricmp(n,"vcalendar")) token = end?END_VCAL:BEGIN_VCAL;
1743 else if (!strcasecmp(n,"vevent")) token = end?END_VEVENT:BEGIN_VEVENT; 1889 else if (!stricmp(n,"vevent")) token = end?END_VEVENT:BEGIN_VEVENT;
1744 else if (!strcasecmp(n,"vtodo")) token = end?END_VTODO:BEGIN_VTODO; 1890 else if (!stricmp(n,"vtodo")) token = end?END_VTODO:BEGIN_VTODO;
1745 deleteStr(n); 1891 deleteStr(n);
@@ -1751,3 +1897,7 @@ static int match_begin_name(int end) {
1751 1897
1898#ifdef INCLUDEMFC
1899void initLex(const char *inputstring, unsigned long inputlen, CFile *inputfile)
1900#else
1752void initLex(const char *inputstring, unsigned long inputlen, FILE *inputfile) 1901void initLex(const char *inputstring, unsigned long inputlen, FILE *inputfile)
1902#endif
1753 { 1903 {
@@ -1776,3 +1926,2 @@ static void finiLex() {
1776 1926
1777/****************************************************************************/
1778/* This parses and converts the base64 format for binary encoding into 1927/* This parses and converts the base64 format for binary encoding into
@@ -1959,3 +2108,3 @@ EndString:
1959 2108
1960static int yylex() { 2109int yylex() {
1961 2110
@@ -1967,3 +2116,5 @@ static int yylex() {
1967 lexPushLookaheadc(c); 2116 lexPushLookaheadc(c);
2117#ifdef _SUPPORT_LINE_FOLDING
1968 handleMoreRFC822LineBreak(c); 2118 handleMoreRFC822LineBreak(c);
2119#endif
1969 lexSkipLookahead(); 2120 lexSkipLookahead();
@@ -2010,3 +2161,2 @@ static int yylex() {
2010 } 2161 }
2011
2012 else { 2162 else {
@@ -2019,3 +2169,3 @@ static int yylex() {
2019 /* ignoring linesep immediately after colon. */ 2169 /* ignoring linesep immediately after colon. */
2020 c = lexLookahead(); 2170 /* c = lexLookahead();
2021 while (strchr("\n",c)) { 2171 while (strchr("\n",c)) {
@@ -2024,3 +2174,3 @@ static int yylex() {
2024 ++mime_lineNum; 2174 ++mime_lineNum;
2025 } 2175 }*/
2026 DBG_(("db: COLON\n")); 2176 DBG_(("db: COLON\n"));
@@ -2034,5 +2184,5 @@ static int yylex() {
2034 return EQ; 2184 return EQ;
2035 /* ignore tabs/newlines in this mode. We can't ignore 2185 /* ignore whitespace in this mode */
2036 * spaces, because values like NEEDS ACTION have a space. */ 2186 case '\t':
2037 case '\t': continue; 2187 case ' ': continue;
2038 case '\n': { 2188 case '\n': {
@@ -2045,12 +2195,9 @@ static int yylex() {
2045 lexPushLookaheadc(c); 2195 lexPushLookaheadc(c);
2046 /* pending lutz : why linker error with isalpha(c)? */ 2196 if (isalpha(c)) {
2047 /*if ( isalpha(c) || c == ' ') { */
2048 if ( ( c >= 'A' && c <= 'Z') || ( c >= 'a' && c <= 'z') || c == ' ') {
2049
2050 char *t = lexGetWord(); 2197 char *t = lexGetWord();
2051 yylval.str = t; 2198 yylval.str = t;
2052 if (!strcasecmp(t, "begin")) { 2199 if (!stricmp(t, "begin")) {
2053 return match_begin_end_name(0); 2200 return match_begin_end_name(0);
2054 } 2201 }
2055 else if (!strcasecmp(t,"end")) { 2202 else if (!stricmp(t,"end")) {
2056 return match_begin_end_name(1); 2203 return match_begin_end_name(1);
@@ -2063,3 +2210,3 @@ static int yylex() {
2063 else { 2210 else {
2064 /* unknown token */ 2211 /* unknow token */
2065 return 0; 2212 return 0;
@@ -2071,3 +2218,2 @@ static int yylex() {
2071 } 2218 }
2072
2073 return 0; 2219 return 0;
@@ -2095,4 +2241,3 @@ static VObject* Parse_MIMEHelper()
2095 2241
2096/****************************************************************************/ 2242DLLEXPORT(VObject*) Parse_MIME(const char *input, unsigned long len)
2097VObject* Parse_MIME(const char *input, unsigned long len)
2098 { 2243 {
@@ -2103,2 +2248,18 @@ VObject* Parse_MIME(const char *input, unsigned long len)
2103 2248
2249#if INCLUDEMFC
2250
2251DLLEXPORT(VObject*) Parse_MIME_FromFile(CFile *file)
2252 {
2253 unsigned long startPos;
2254 VObject *result;
2255
2256 initLex(0,-1,file);
2257 startPos = file->GetPosition();
2258 if (!(result = Parse_MIMEHelper()))
2259 file->Seek(startPos, CFile::begin);
2260 return result;
2261 }
2262
2263#else
2264
2104VObject* Parse_MIME_FromFile(FILE *file) 2265VObject* Parse_MIME_FromFile(FILE *file)
@@ -2116,3 +2277,3 @@ VObject* Parse_MIME_FromFile(FILE *file)
2116 2277
2117VObject* Parse_MIME_FromFileName(const char *fname) 2278DLLEXPORT(VObject*) Parse_MIME_FromFileName(char *fname)
2118 { 2279 {
@@ -2125,4 +2286,4 @@ VObject* Parse_MIME_FromFileName(const char *fname)
2125 else { 2286 else {
2126 char msg[255]; 2287 char msg[256];
2127 sprintf(msg, "can't open file '%s' for reading\n", fname); 2288 snprintf(msg, sizeof(msg), "can't open file '%s' for reading\n", fname);
2128 mime_error_(msg); 2289 mime_error_(msg);
@@ -2132,7 +2293,3 @@ VObject* Parse_MIME_FromFileName(const char *fname)
2132 2293
2133/****************************************************************************/ 2294#endif
2134void YYDebug(const char *s)
2135{
2136 Parse_Debug(s);
2137}
2138 2295
@@ -2141,3 +2298,3 @@ static MimeErrorHandler mimeErrorHandler;
2141 2298
2142void registerMimeErrorHandler(MimeErrorHandler me) 2299DLLEXPORT(void) registerMimeErrorHandler(MimeErrorHandler me)
2143 { 2300 {