1
/* A Bison parser, made by GNU Bison 2.0. */
3
/* Skeleton parser for Yacc-like parsing with Bison,
4
Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004 Free Software Foundation, Inc.
6
This program is free software; you can redistribute it and/or modify
7
it under the terms of the GNU General Public License as published by
8
the Free Software Foundation; either version 2, or (at your option)
11
This program is distributed in the hope that it will be useful,
12
but WITHOUT ANY WARRANTY; without even the implied warranty of
13
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14
GNU General Public License for more details.
16
You should have received a copy of the GNU General Public License
17
along with this program; if not, write to the Free Software
18
Foundation, Inc., 59 Temple Place - Suite 330,
19
Boston, MA 02111-1307, USA. */
21
/* As a special exception, when this file is copied by Bison into a
22
Bison output file, you may use that output file without restriction.
23
This special exception was added by the Free Software Foundation
24
in version 1.24 of Bison. */
26
/* Written by Richard Stallman by simplifying the original so called
27
``semantic'' parser. */
29
/* All symbols defined below should begin with yy or YY, to avoid
30
infringing on user name space. This should be done even for local
31
variables, as they might otherwise be expanded by user macros.
32
There are some unavoidable exceptions within include files to
33
define necessary library symbols; they are noted "INFRINGES ON
34
USER NAME SPACE" below. */
36
/* Identify Bison output. */
40
#define YYSKELETON_NAME "yacc.c"
45
/* Using locations. */
46
#define YYLSP_NEEDED 0
48
/* Substitute the variable and function names. */
49
#define yyparse csim_parse
50
#define yylex csim_lex
51
#define yyerror csim_error
52
#define yylval csim_lval
53
#define yychar csim_char
54
#define yydebug csim_debug
55
#define yynerrs csim_nerrs
61
/* Put the tokens into the symbol table, so that GDB and other debuggers
108
#define ONMOUSEOVER 274
109
#define ONMOUSEOUT 275
113
#define DESCRIPTION 279
114
#define BEGIN_COMMENT 280
115
#define END_COMMENT 281
122
/* Copy the first part of user declarations. */
123
#line 1 "imap_csim.y"
126
* This is a plug-in for the GIMP.
128
* Generates clickable image maps.
130
* Copyright (C) 1998-2005 Maurits Rijk lpeek.mrijk@consunet.nl
132
* This program is free software; you can redistribute it and/or modify
133
* it under the terms of the GNU General Public License as published by
134
* the Free Software Foundation; either version 2 of the License, or
135
* (at your option) any later version.
137
* This program is distributed in the hope that it will be useful,
138
* but WITHOUT ANY WARRANTY; without even the implied warranty of
139
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
140
* GNU General Public License for more details.
142
* You should have received a copy of the GNU General Public License
143
* along with this program; if not, write to the Free Software
144
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
153
#include "imap_circle.h"
154
#include "imap_file.h"
155
#include "imap_main.h"
156
#include "imap_polygon.h"
157
#include "imap_rectangle.h"
158
#include "imap_string.h"
160
extern int csim_lex();
161
extern int csim_restart();
162
static void csim_error(char* s);
164
static enum {UNDEFINED, RECTANGLE, CIRCLE, POLYGON} current_type;
165
static Object_t *current_object;
166
static MapInfo_t *_map_info;
170
/* Enabling traces. */
175
/* Enabling verbose error messages. */
176
#ifdef YYERROR_VERBOSE
177
# undef YYERROR_VERBOSE
178
# define YYERROR_VERBOSE 1
180
# define YYERROR_VERBOSE 0
183
#if ! defined (YYSTYPE) && ! defined (YYSTYPE_IS_DECLARED)
184
#line 47 "imap_csim.y"
185
typedef union YYSTYPE {
190
/* Line 190 of yacc.c. */
192
# define yystype YYSTYPE /* obsolescent; will be withdrawn */
193
# define YYSTYPE_IS_DECLARED 1
194
# define YYSTYPE_IS_TRIVIAL 1
199
/* Copy the second part of user declarations. */
202
/* Line 213 of yacc.c. */
205
#if ! defined (yyoverflow) || YYERROR_VERBOSE
211
# define YYMALLOC malloc
214
/* The parser invokes alloca or malloc; define the necessary symbols. */
216
# ifdef YYSTACK_USE_ALLOCA
217
# if YYSTACK_USE_ALLOCA
219
# define YYSTACK_ALLOC __builtin_alloca
221
# define YYSTACK_ALLOC alloca
226
# ifdef YYSTACK_ALLOC
227
/* Pacify GCC's `empty if-body' warning. */
228
# define YYSTACK_FREE(Ptr) do { /* empty */; } while (0)
230
# if defined (__STDC__) || defined (__cplusplus)
231
# include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
232
# define YYSIZE_T size_t
234
# define YYSTACK_ALLOC YYMALLOC
235
# define YYSTACK_FREE YYFREE
237
#endif /* ! defined (yyoverflow) || YYERROR_VERBOSE */
240
#if (! defined (yyoverflow) \
241
&& (! defined (__cplusplus) \
242
|| (defined (YYSTYPE_IS_TRIVIAL) && YYSTYPE_IS_TRIVIAL)))
244
/* A type that is properly aligned for any stack member. */
251
/* The size of the maximum gap between one aligned stack and the next. */
252
# define YYSTACK_GAP_MAXIMUM (sizeof (union yyalloc) - 1)
254
/* The size of an array large to enough to hold all stacks, each with
256
# define YYSTACK_BYTES(N) \
257
((N) * (sizeof (short int) + sizeof (YYSTYPE)) \
258
+ YYSTACK_GAP_MAXIMUM)
260
/* Copy COUNT objects from FROM to TO. The source and destination do
263
# if defined (__GNUC__) && 1 < __GNUC__
264
# define YYCOPY(To, From, Count) \
265
__builtin_memcpy (To, From, (Count) * sizeof (*(From)))
267
# define YYCOPY(To, From, Count) \
270
register YYSIZE_T yyi; \
271
for (yyi = 0; yyi < (Count); yyi++) \
272
(To)[yyi] = (From)[yyi]; \
278
/* Relocate STACK from its old location to the new one. The
279
local variables YYSIZE and YYSTACKSIZE give the old and new number of
280
elements in the stack, and YYPTR gives the new location of the
281
stack. Advance YYPTR to a properly aligned location for the next
283
# define YYSTACK_RELOCATE(Stack) \
286
YYSIZE_T yynewbytes; \
287
YYCOPY (&yyptr->Stack, Stack, yysize); \
288
Stack = &yyptr->Stack; \
289
yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \
290
yyptr += yynewbytes / sizeof (*yyptr); \
296
#if defined (__STDC__) || defined (__cplusplus)
297
typedef signed char yysigned_char;
299
typedef short int yysigned_char;
302
/* YYFINAL -- State number of the termination state. */
304
/* YYLAST -- Last index in YYTABLE. */
307
/* YYNTOKENS -- Number of terminals. */
309
/* YYNNTS -- Number of nonterminals. */
311
/* YYNRULES -- Number of rules. */
313
/* YYNRULES -- Number of states. */
314
#define YYNSTATES 106
316
/* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */
318
#define YYMAXUTOK 283
320
#define YYTRANSLATE(YYX) \
321
((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK)
323
/* YYTRANSLATE[YYLEX] -- Bison symbol number corresponding to YYLEX. */
324
static const unsigned char yytranslate[] =
326
0, 2, 2, 2, 2, 2, 2, 2, 2, 2,
327
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
328
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
329
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
330
2, 2, 2, 2, 2, 2, 2, 32, 2, 2,
331
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
332
29, 30, 31, 2, 2, 2, 2, 2, 2, 2,
333
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
334
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
335
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
336
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
337
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
338
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
339
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
340
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
341
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
342
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
343
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
344
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
345
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
346
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
347
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
348
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
349
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
350
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
351
2, 2, 2, 2, 2, 2, 1, 2, 3, 4,
352
5, 6, 7, 8, 9, 10, 11, 12, 13, 14,
353
15, 16, 17, 18, 19, 20, 21, 22, 23, 24,
358
/* YYPRHS[YYN] -- Index of the first RHS symbol of rule number YYN in
360
static const unsigned char yyprhs[] =
362
0, 0, 3, 9, 17, 18, 21, 23, 25, 29,
363
33, 37, 41, 45, 47, 49, 56, 57, 60, 62,
364
64, 66, 70, 74, 78, 79, 82, 87, 89, 92,
365
93, 96, 98, 100, 102, 104, 106, 108, 110, 112,
366
114, 116, 120, 124, 128, 131, 132, 135, 139, 143,
370
/* YYRHS -- A `-1'-separated list of the rules' RHS. */
371
static const yysigned_char yyrhs[] =
373
34, 0, -1, 35, 41, 42, 47, 63, -1, 29,
374
3, 4, 30, 28, 36, 49, -1, -1, 36, 37,
375
-1, 38, -1, 39, -1, 7, 30, 40, -1, 8,
376
30, 28, -1, 15, 30, 28, -1, 5, 30, 40,
377
-1, 6, 30, 40, -1, 27, -1, 28, -1, 29,
378
9, 11, 30, 28, 31, -1, -1, 42, 43, -1,
379
45, -1, 46, -1, 44, -1, 25, 28, 26, -1,
380
23, 28, 26, -1, 24, 28, 26, -1, -1, 47,
381
48, -1, 29, 12, 50, 49, -1, 31, -1, 32,
382
31, -1, -1, 50, 51, -1, 52, -1, 53, -1,
383
54, -1, 55, -1, 57, -1, 58, -1, 59, -1,
384
60, -1, 61, -1, 62, -1, 13, 30, 28, -1,
385
14, 30, 28, -1, 16, 30, 28, -1, 17, 56,
386
-1, -1, 30, 28, -1, 15, 30, 28, -1, 18,
387
30, 28, -1, 19, 30, 28, -1, 20, 30, 28,
388
-1, 21, 30, 28, -1, 22, 30, 28, -1, 29,
392
/* YYRLINE[YYN] -- source line where rule number YYN was defined. */
393
static const unsigned short int yyrline[] =
395
0, 64, 64, 67, 73, 74, 77, 78, 79, 80,
396
81, 84, 90, 96, 100, 106, 112, 113, 116, 117,
397
118, 121, 126, 133, 143, 144, 147, 154, 155, 158,
398
159, 162, 163, 164, 165, 166, 167, 168, 169, 170,
399
171, 174, 191, 249, 259, 264, 265, 270, 276, 282,
404
#if YYDEBUG || YYERROR_VERBOSE
405
/* YYTNME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM.
406
First, the terminals, then, starting at YYNTOKENS, nonterminals. */
407
static const char *const yytname[] =
409
"$end", "error", "$undefined", "IMG", "SRC", "WIDTH", "HEIGHT",
410
"BORDER", "USEMAP", "START_MAP", "END_MAP", "NAME", "AREA", "SHAPE",
411
"COORDS", "ALT", "HREF", "NOHREF", "TARGET", "ONMOUSEOVER", "ONMOUSEOUT",
412
"ONFOCUS", "ONBLUR", "AUTHOR", "DESCRIPTION", "BEGIN_COMMENT",
413
"END_COMMENT", "FLOAT", "STRING", "'<'", "'='", "'>'", "'/'", "$accept",
414
"csim_file", "image", "image_tags", "image_tag", "image_width",
415
"image_height", "integer_value", "start_map", "comment_lines",
416
"comment_line", "real_comment", "author_line", "description_line",
417
"area_list", "area", "xhtml_close", "tag_list", "tag", "shape_tag",
418
"coords_tag", "href_tag", "nohref_tag", "optional_value", "alt_tag",
419
"target_tag", "onmouseover_tag", "onmouseout_tag", "onfocus_tag",
420
"onblur_tag", "end_map", 0
425
/* YYTOKNUM[YYLEX-NUM] -- Internal token number corresponding to
427
static const unsigned short int yytoknum[] =
429
0, 256, 257, 258, 259, 260, 261, 262, 263, 264,
430
265, 266, 267, 268, 269, 270, 271, 272, 273, 274,
431
275, 276, 277, 278, 279, 280, 281, 282, 283, 60,
436
/* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */
437
static const unsigned char yyr1[] =
439
0, 33, 34, 35, 36, 36, 37, 37, 37, 37,
440
37, 38, 39, 40, 40, 41, 42, 42, 43, 43,
441
43, 44, 45, 46, 47, 47, 48, 49, 49, 50,
442
50, 51, 51, 51, 51, 51, 51, 51, 51, 51,
443
51, 52, 53, 54, 55, 56, 56, 57, 58, 59,
447
/* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */
448
static const unsigned char yyr2[] =
450
0, 2, 5, 7, 0, 2, 1, 1, 3, 3,
451
3, 3, 3, 1, 1, 6, 0, 2, 1, 1,
452
1, 3, 3, 3, 0, 2, 4, 1, 2, 0,
453
2, 1, 1, 1, 1, 1, 1, 1, 1, 1,
454
1, 3, 3, 3, 2, 0, 2, 3, 3, 3,
458
/* YYDEFACT[STATE-NAME] -- Default rule to reduce with in state
459
STATE-NUM when YYTABLE doesn't specify something else to do. Zero
460
means the default is an error. */
461
static const unsigned char yydefact[] =
463
0, 0, 0, 0, 0, 1, 0, 16, 0, 0,
464
24, 0, 0, 0, 0, 0, 17, 20, 18, 19,
465
0, 4, 0, 0, 0, 0, 0, 25, 2, 0,
466
0, 22, 23, 21, 0, 29, 0, 0, 0, 0,
467
0, 27, 0, 5, 6, 7, 3, 15, 53, 0,
468
0, 0, 0, 0, 0, 28, 0, 0, 0, 0,
469
45, 0, 0, 0, 0, 0, 26, 30, 31, 32,
470
33, 34, 35, 36, 37, 38, 39, 40, 13, 14,
471
11, 12, 8, 9, 10, 0, 0, 0, 0, 0,
472
44, 0, 0, 0, 0, 0, 41, 42, 47, 43,
473
46, 48, 49, 50, 51, 52
476
/* YYDEFGOTO[NTERM-NUM]. */
477
static const yysigned_char yydefgoto[] =
479
-1, 2, 3, 29, 43, 44, 45, 80, 7, 10,
480
16, 17, 18, 19, 20, 27, 46, 49, 67, 68,
481
69, 70, 71, 90, 72, 73, 74, 75, 76, 77,
485
/* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
487
#define YYPACT_NINF -29
488
static const yysigned_char yypact[] =
490
-21, 22, 28, 2, 29, -29, 23, -29, 4, 24,
491
-19, 8, 7, 10, 11, 12, -29, -29, -29, -29,
492
13, -29, 15, 18, 19, 20, -3, -29, -29, -5,
493
16, -29, -29, -29, 17, -29, 21, 25, 26, 27,
494
30, -29, 31, -29, -29, -29, -29, -29, -29, -2,
495
-6, -6, -6, 33, 35, -29, 34, 36, 37, 38,
496
39, 40, 41, 42, 43, 44, -29, -29, -29, -29,
497
-29, -29, -29, -29, -29, -29, -29, -29, -29, -29,
498
-29, -29, -29, -29, -29, 47, 48, 49, 50, 51,
499
-29, 52, 53, 54, 55, 56, -29, -29, -29, -29,
500
-29, -29, -29, -29, -29, -29
503
/* YYPGOTO[NTERM-NUM]. */
504
static const yysigned_char yypgoto[] =
506
-29, -29, -29, -29, -29, -29, -29, -28, -29, -29,
507
-29, -29, -29, -29, -29, -29, -8, -29, -29, -29,
508
-29, -29, -29, -29, -29, -29, -29, -29, -29, -29,
512
/* YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If
513
positive, shift that token. If negative, reduce the rule which
514
number is the opposite. If zero, do what YYDEFACT says.
515
If YYTABLE_NINF, syntax error. */
516
#define YYTABLE_NINF -1
517
static const unsigned char yytable[] =
519
36, 37, 38, 39, 13, 14, 15, 34, 1, 35,
520
40, 56, 57, 58, 59, 60, 61, 62, 63, 64,
521
65, 78, 79, 81, 82, 4, 41, 42, 5, 41,
522
42, 6, 9, 8, 11, 12, 21, 22, 23, 24,
523
25, 66, 26, 30, 31, 32, 33, 47, 48, 0,
524
0, 50, 0, 0, 0, 51, 52, 53, 0, 0,
525
54, 83, 55, 84, 85, 0, 86, 87, 88, 89,
526
91, 92, 93, 94, 95, 96, 97, 98, 99, 100,
527
101, 102, 103, 104, 105
530
static const yysigned_char yycheck[] =
532
5, 6, 7, 8, 23, 24, 25, 10, 29, 12,
533
15, 13, 14, 15, 16, 17, 18, 19, 20, 21,
534
22, 27, 28, 51, 52, 3, 31, 32, 0, 31,
535
32, 29, 9, 4, 30, 11, 28, 30, 28, 28,
536
28, 49, 29, 28, 26, 26, 26, 31, 31, -1,
537
-1, 30, -1, -1, -1, 30, 30, 30, -1, -1,
538
30, 28, 31, 28, 30, -1, 30, 30, 30, 30,
539
30, 30, 30, 30, 30, 28, 28, 28, 28, 28,
543
/* YYSTOS[STATE-NUM] -- The (internal number of the) accessing
544
symbol of state STATE-NUM. */
545
static const unsigned char yystos[] =
547
0, 29, 34, 35, 3, 0, 29, 41, 4, 9,
548
42, 30, 11, 23, 24, 25, 43, 44, 45, 46,
549
47, 28, 30, 28, 28, 28, 29, 48, 63, 36,
550
28, 26, 26, 26, 10, 12, 5, 6, 7, 8,
551
15, 31, 32, 37, 38, 39, 49, 31, 31, 50,
552
30, 30, 30, 30, 30, 31, 13, 14, 15, 16,
553
17, 18, 19, 20, 21, 22, 49, 51, 52, 53,
554
54, 55, 57, 58, 59, 60, 61, 62, 27, 28,
555
40, 40, 40, 28, 28, 30, 30, 30, 30, 30,
556
56, 30, 30, 30, 30, 30, 28, 28, 28, 28,
557
28, 28, 28, 28, 28, 28
560
#if ! defined (YYSIZE_T) && defined (__SIZE_TYPE__)
561
# define YYSIZE_T __SIZE_TYPE__
563
#if ! defined (YYSIZE_T) && defined (size_t)
564
# define YYSIZE_T size_t
566
#if ! defined (YYSIZE_T)
567
# if defined (__STDC__) || defined (__cplusplus)
568
# include <stddef.h> /* INFRINGES ON USER NAME SPACE */
569
# define YYSIZE_T size_t
572
#if ! defined (YYSIZE_T)
573
# define YYSIZE_T unsigned int
576
#define yyerrok (yyerrstatus = 0)
577
#define yyclearin (yychar = YYEMPTY)
581
#define YYACCEPT goto yyacceptlab
582
#define YYABORT goto yyabortlab
583
#define YYERROR goto yyerrorlab
586
/* Like YYERROR except do call yyerror. This remains here temporarily
587
to ease the transition to the new meaning of YYERROR, for GCC.
588
Once GCC version 2 has supplanted version 1, this can go. */
590
#define YYFAIL goto yyerrlab
592
#define YYRECOVERING() (!!yyerrstatus)
594
#define YYBACKUP(Token, Value) \
596
if (yychar == YYEMPTY && yylen == 1) \
600
yytoken = YYTRANSLATE (yychar); \
606
yyerror ("syntax error: cannot back up");\
613
#define YYERRCODE 256
616
/* YYLLOC_DEFAULT -- Set CURRENT to span from RHS[1] to RHS[N].
617
If N is 0, then set CURRENT to the empty location which ends
618
the previous symbol: RHS[0] (always defined). */
620
#define YYRHSLOC(Rhs, K) ((Rhs)[K])
621
#ifndef YYLLOC_DEFAULT
622
# define YYLLOC_DEFAULT(Current, Rhs, N) \
626
(Current).first_line = YYRHSLOC (Rhs, 1).first_line; \
627
(Current).first_column = YYRHSLOC (Rhs, 1).first_column; \
628
(Current).last_line = YYRHSLOC (Rhs, N).last_line; \
629
(Current).last_column = YYRHSLOC (Rhs, N).last_column; \
633
(Current).first_line = (Current).last_line = \
634
YYRHSLOC (Rhs, 0).last_line; \
635
(Current).first_column = (Current).last_column = \
636
YYRHSLOC (Rhs, 0).last_column; \
642
/* YY_LOCATION_PRINT -- Print the location on the stream.
643
This macro was not mandated originally: define only if we know
644
we won't break user code: when these are the locations we know. */
646
#ifndef YY_LOCATION_PRINT
647
# if YYLTYPE_IS_TRIVIAL
648
# define YY_LOCATION_PRINT(File, Loc) \
649
fprintf (File, "%d.%d-%d.%d", \
650
(Loc).first_line, (Loc).first_column, \
651
(Loc).last_line, (Loc).last_column)
653
# define YY_LOCATION_PRINT(File, Loc) ((void) 0)
658
/* YYLEX -- calling `yylex' with the right arguments. */
661
# define YYLEX yylex (YYLEX_PARAM)
663
# define YYLEX yylex ()
666
/* Enable debugging if requested. */
670
# include <stdio.h> /* INFRINGES ON USER NAME SPACE */
671
# define YYFPRINTF fprintf
674
# define YYDPRINTF(Args) \
680
# define YY_SYMBOL_PRINT(Title, Type, Value, Location) \
684
YYFPRINTF (stderr, "%s ", Title); \
685
yysymprint (stderr, \
687
YYFPRINTF (stderr, "\n"); \
691
/*------------------------------------------------------------------.
692
| yy_stack_print -- Print the state stack from its BOTTOM up to its |
694
`------------------------------------------------------------------*/
696
#if defined (__STDC__) || defined (__cplusplus)
698
yy_stack_print (short int *bottom, short int *top)
701
yy_stack_print (bottom, top)
706
YYFPRINTF (stderr, "Stack now");
707
for (/* Nothing. */; bottom <= top; ++bottom)
708
YYFPRINTF (stderr, " %d", *bottom);
709
YYFPRINTF (stderr, "\n");
712
# define YY_STACK_PRINT(Bottom, Top) \
715
yy_stack_print ((Bottom), (Top)); \
719
/*------------------------------------------------.
720
| Report that the YYRULE is going to be reduced. |
721
`------------------------------------------------*/
723
#if defined (__STDC__) || defined (__cplusplus)
725
yy_reduce_print (int yyrule)
728
yy_reduce_print (yyrule)
733
unsigned int yylno = yyrline[yyrule];
734
YYFPRINTF (stderr, "Reducing stack by rule %d (line %u), ",
736
/* Print the symbols being reduced, and their result. */
737
for (yyi = yyprhs[yyrule]; 0 <= yyrhs[yyi]; yyi++)
738
YYFPRINTF (stderr, "%s ", yytname [yyrhs[yyi]]);
739
YYFPRINTF (stderr, "-> %s\n", yytname [yyr1[yyrule]]);
742
# define YY_REDUCE_PRINT(Rule) \
745
yy_reduce_print (Rule); \
748
/* Nonzero means print parse trace. It is left uninitialized so that
749
multiple parsers can coexist. */
752
# define YYDPRINTF(Args)
753
# define YY_SYMBOL_PRINT(Title, Type, Value, Location)
754
# define YY_STACK_PRINT(Bottom, Top)
755
# define YY_REDUCE_PRINT(Rule)
756
#endif /* !YYDEBUG */
759
/* YYINITDEPTH -- initial size of the parser's stacks. */
761
# define YYINITDEPTH 200
764
/* YYMAXDEPTH -- maximum size the stacks can grow to (effective only
765
if the built-in stack extension method is used).
767
Do not make this value too large; the results are undefined if
768
SIZE_MAX < YYSTACK_BYTES (YYMAXDEPTH)
769
evaluated with infinite-precision integer arithmetic. */
772
# define YYMAXDEPTH 10000
780
# if defined (__GLIBC__) && defined (_STRING_H)
781
# define yystrlen strlen
783
/* Return the length of YYSTR. */
785
# if defined (__STDC__) || defined (__cplusplus)
786
yystrlen (const char *yystr)
792
register const char *yys = yystr;
794
while (*yys++ != '\0')
797
return yys - yystr - 1;
803
# if defined (__GLIBC__) && defined (_STRING_H) && defined (_GNU_SOURCE)
804
# define yystpcpy stpcpy
806
/* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in
809
# if defined (__STDC__) || defined (__cplusplus)
810
yystpcpy (char *yydest, const char *yysrc)
812
yystpcpy (yydest, yysrc)
817
register char *yyd = yydest;
818
register const char *yys = yysrc;
820
while ((*yyd++ = *yys++) != '\0')
828
#endif /* !YYERROR_VERBOSE */
833
/*--------------------------------.
834
| Print this symbol on YYOUTPUT. |
835
`--------------------------------*/
837
#if defined (__STDC__) || defined (__cplusplus)
839
yysymprint (FILE *yyoutput, int yytype, YYSTYPE *yyvaluep)
842
yysymprint (yyoutput, yytype, yyvaluep)
848
/* Pacify ``unused variable'' warnings. */
851
if (yytype < YYNTOKENS)
852
YYFPRINTF (yyoutput, "token %s (", yytname[yytype]);
854
YYFPRINTF (yyoutput, "nterm %s (", yytname[yytype]);
858
if (yytype < YYNTOKENS)
859
YYPRINT (yyoutput, yytoknum[yytype], *yyvaluep);
866
YYFPRINTF (yyoutput, ")");
869
#endif /* ! YYDEBUG */
870
/*-----------------------------------------------.
871
| Release the memory associated to this symbol. |
872
`-----------------------------------------------*/
874
#if defined (__STDC__) || defined (__cplusplus)
876
yydestruct (const char *yymsg, int yytype, YYSTYPE *yyvaluep)
879
yydestruct (yymsg, yytype, yyvaluep)
885
/* Pacify ``unused variable'' warnings. */
890
YY_SYMBOL_PRINT (yymsg, yytype, yyvaluep, yylocationp);
901
/* Prevent warnings from -Wmissing-prototypes. */
904
# if defined (__STDC__) || defined (__cplusplus)
905
int yyparse (void *YYPARSE_PARAM);
909
#else /* ! YYPARSE_PARAM */
910
#if defined (__STDC__) || defined (__cplusplus)
915
#endif /* ! YYPARSE_PARAM */
919
/* The look-ahead symbol. */
922
/* The semantic value of the look-ahead symbol. */
925
/* Number of syntax errors so far. */
935
# if defined (__STDC__) || defined (__cplusplus)
936
int yyparse (void *YYPARSE_PARAM)
938
int yyparse (YYPARSE_PARAM)
941
#else /* ! YYPARSE_PARAM */
942
#if defined (__STDC__) || defined (__cplusplus)
953
register int yystate;
956
/* Number of tokens to shift before error messages enabled. */
958
/* Look-ahead token as an internal (translated) token number. */
961
/* Three stacks and their tools:
962
`yyss': related to states,
963
`yyvs': related to semantic values,
964
`yyls': related to locations.
966
Refer to the stacks thru separate pointers, to allow yyoverflow
967
to reallocate them elsewhere. */
969
/* The state stack. */
970
short int yyssa[YYINITDEPTH];
971
short int *yyss = yyssa;
972
register short int *yyssp;
974
/* The semantic value stack. */
975
YYSTYPE yyvsa[YYINITDEPTH];
976
YYSTYPE *yyvs = yyvsa;
977
register YYSTYPE *yyvsp;
981
#define YYPOPSTACK (yyvsp--, yyssp--)
983
YYSIZE_T yystacksize = YYINITDEPTH;
985
/* The variables used to return semantic value and location from the
990
/* When reducing, the number of symbols on the RHS of the reduced
994
YYDPRINTF ((stderr, "Starting parse\n"));
999
yychar = YYEMPTY; /* Cause a token to be read. */
1001
/* Initialize stack pointers.
1002
Waste one element of value and location stack
1003
so that they stay on the same level as the state stack.
1004
The wasted elements are never initialized. */
1014
/*------------------------------------------------------------.
1015
| yynewstate -- Push a new state, which is found in yystate. |
1016
`------------------------------------------------------------*/
1018
/* In all cases, when you get here, the value and location stacks
1019
have just been pushed. so pushing a state here evens the stacks.
1026
if (yyss + yystacksize - 1 <= yyssp)
1028
/* Get the current used size of the three stacks, in elements. */
1029
YYSIZE_T yysize = yyssp - yyss + 1;
1033
/* Give user a chance to reallocate the stack. Use copies of
1034
these so that the &'s don't force the real ones into
1036
YYSTYPE *yyvs1 = yyvs;
1037
short int *yyss1 = yyss;
1040
/* Each stack pointer address is followed by the size of the
1041
data in use in that stack, in bytes. This used to be a
1042
conditional around just the two extra args, but that might
1043
be undefined if yyoverflow is a macro. */
1044
yyoverflow ("parser stack overflow",
1045
&yyss1, yysize * sizeof (*yyssp),
1046
&yyvs1, yysize * sizeof (*yyvsp),
1053
#else /* no yyoverflow */
1054
# ifndef YYSTACK_RELOCATE
1057
/* Extend the stack our own way. */
1058
if (YYMAXDEPTH <= yystacksize)
1061
if (YYMAXDEPTH < yystacksize)
1062
yystacksize = YYMAXDEPTH;
1065
short int *yyss1 = yyss;
1066
union yyalloc *yyptr =
1067
(union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize));
1070
YYSTACK_RELOCATE (yyss);
1071
YYSTACK_RELOCATE (yyvs);
1073
# undef YYSTACK_RELOCATE
1075
YYSTACK_FREE (yyss1);
1078
#endif /* no yyoverflow */
1080
yyssp = yyss + yysize - 1;
1081
yyvsp = yyvs + yysize - 1;
1084
YYDPRINTF ((stderr, "Stack size increased to %lu\n",
1085
(unsigned long int) yystacksize));
1087
if (yyss + yystacksize - 1 <= yyssp)
1091
YYDPRINTF ((stderr, "Entering state %d\n", yystate));
1100
/* Do appropriate processing given the current state. */
1101
/* Read a look-ahead token if we need one and don't already have one. */
1104
/* First try to decide what to do without reference to look-ahead token. */
1106
yyn = yypact[yystate];
1107
if (yyn == YYPACT_NINF)
1110
/* Not known => get a look-ahead token if don't already have one. */
1112
/* YYCHAR is either YYEMPTY or YYEOF or a valid look-ahead symbol. */
1113
if (yychar == YYEMPTY)
1115
YYDPRINTF ((stderr, "Reading a token: "));
1119
if (yychar <= YYEOF)
1121
yychar = yytoken = YYEOF;
1122
YYDPRINTF ((stderr, "Now at end of input.\n"));
1126
yytoken = YYTRANSLATE (yychar);
1127
YY_SYMBOL_PRINT ("Next token is", yytoken, &yylval, &yylloc);
1130
/* If the proper action on seeing token YYTOKEN is to reduce or to
1131
detect an error, take that action. */
1133
if (yyn < 0 || YYLAST < yyn || yycheck[yyn] != yytoken)
1138
if (yyn == 0 || yyn == YYTABLE_NINF)
1147
/* Shift the look-ahead token. */
1148
YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc);
1150
/* Discard the token being shifted unless it is eof. */
1151
if (yychar != YYEOF)
1157
/* Count tokens shifted since error; after three, turn off error
1166
/*-----------------------------------------------------------.
1167
| yydefault -- do the default action for the current state. |
1168
`-----------------------------------------------------------*/
1170
yyn = yydefact[yystate];
1176
/*-----------------------------.
1177
| yyreduce -- Do a reduction. |
1178
`-----------------------------*/
1180
/* yyn is the number of a rule to reduce with. */
1183
/* If YYLEN is nonzero, implement the default value of the action:
1186
Otherwise, the following line sets YYVAL to garbage.
1187
This behavior is undocumented and Bison
1188
users should not rely upon it. Assigning to YYVAL
1189
unconditionally makes the parser a bit smaller, and it avoids a
1190
GCC warning that YYVAL may be used uninitialized. */
1191
yyval = yyvsp[1-yylen];
1194
YY_REDUCE_PRINT (yyn);
1198
#line 68 "imap_csim.y"
1200
g_strreplace(&_map_info->image_name, (yyvsp[-2].id));
1205
#line 79 "imap_csim.y"
1210
#line 80 "imap_csim.y"
1215
#line 81 "imap_csim.y"
1220
#line 85 "imap_csim.y"
1222
_map_info->old_image_width = (yyvsp[0].val);
1227
#line 91 "imap_csim.y"
1229
_map_info->old_image_height = (yyvsp[0].val);
1234
#line 97 "imap_csim.y"
1236
(yyval.val) = (gint) (yyvsp[0].value);
1241
#line 101 "imap_csim.y"
1243
(yyval.val) = (gint) atof((yyvsp[0].id));
1248
#line 107 "imap_csim.y"
1250
g_strreplace(&_map_info->title, (yyvsp[-1].id));
1255
#line 122 "imap_csim.y"
1261
#line 127 "imap_csim.y"
1263
g_strreplace(&_map_info->author, (yyvsp[-1].id));
1269
#line 134 "imap_csim.y"
1273
description = g_strconcat(_map_info->description, (yyvsp[-1].id), "\n",
1275
g_strreplace(&_map_info->description, description);
1280
#line 148 "imap_csim.y"
1282
if (current_type != UNDEFINED)
1283
add_shape(current_object);
1288
#line 175 "imap_csim.y"
1290
if (!g_ascii_strcasecmp((yyvsp[0].id), "RECT")) {
1291
current_object = create_rectangle(0, 0, 0, 0);
1292
current_type = RECTANGLE;
1293
} else if (!g_ascii_strcasecmp((yyvsp[0].id), "CIRCLE")) {
1294
current_object = create_circle(0, 0, 0);
1295
current_type = CIRCLE;
1296
} else if (!g_ascii_strcasecmp((yyvsp[0].id), "POLY")) {
1297
current_object = create_polygon(NULL);
1298
current_type = POLYGON;
1299
} else if (!g_ascii_strcasecmp((yyvsp[0].id), "DEFAULT")) {
1300
current_type = UNDEFINED;
1306
#line 192 "imap_csim.y"
1309
if (current_type == RECTANGLE) {
1310
Rectangle_t *rectangle;
1312
rectangle = ObjectToRectangle(current_object);
1313
p = strtok((yyvsp[0].id), ",");
1314
rectangle->x = atoi(p);
1315
p = strtok(NULL, ",");
1316
rectangle->y = atoi(p);
1317
p = strtok(NULL, ",");
1318
rectangle->width = atoi(p) - rectangle->x;
1319
p = strtok(NULL, ",");
1320
rectangle->height = atoi(p) - rectangle->y;
1321
} else if (current_type == CIRCLE) {
1324
circle = ObjectToCircle(current_object);
1325
p = strtok((yyvsp[0].id), ",");
1326
circle->x = atoi(p);
1327
p = strtok(NULL, ",");
1328
circle->y = atoi(p);
1329
p = strtok(NULL, ",");
1330
circle->r = atoi(p);
1331
} else if (current_type == POLYGON) {
1332
Polygon_t *polygon = ObjectToPolygon(current_object);
1334
GdkPoint *point, *first;
1337
p = strtok((yyvsp[0].id), ",");
1339
p = strtok(NULL, ",");
1341
point = new_point(x, y);
1342
points = g_list_append(NULL, (gpointer) point);
1345
p = strtok(NULL, ",");
1349
p = strtok(NULL, ",");
1351
point = new_point(x, y);
1352
g_list_append(points, (gpointer) point);
1354
/* Remove last point if duplicate */
1355
first = (GdkPoint*) points->data;
1356
polygon->points = points;
1357
if (first->x == point->x && first->y == point->y)
1358
polygon_remove_last_point(polygon);
1359
polygon->points = points;
1365
#line 250 "imap_csim.y"
1367
if (current_type == UNDEFINED) {
1368
g_strreplace(&_map_info->default_url, (yyvsp[0].id));
1370
object_set_url(current_object, (yyvsp[0].id));
1376
#line 260 "imap_csim.y"
1382
#line 266 "imap_csim.y"
1388
#line 271 "imap_csim.y"
1390
object_set_comment(current_object, (yyvsp[0].id));
1395
#line 277 "imap_csim.y"
1397
object_set_target(current_object, (yyvsp[0].id));
1402
#line 283 "imap_csim.y"
1404
object_set_mouse_over(current_object, (yyvsp[0].id));
1409
#line 289 "imap_csim.y"
1411
object_set_mouse_out(current_object, (yyvsp[0].id));
1416
#line 295 "imap_csim.y"
1418
object_set_focus(current_object, (yyvsp[0].id));
1423
#line 301 "imap_csim.y"
1425
object_set_blur(current_object, (yyvsp[0].id));
1432
/* Line 1037 of yacc.c. */
1433
#line 1434 "y.tab.c"
1439
YY_STACK_PRINT (yyss, yyssp);
1444
/* Now `shift' the result of the reduction. Determine what state
1445
that goes to, based on the state we popped back to and the rule
1446
number reduced by. */
1450
yystate = yypgoto[yyn - YYNTOKENS] + *yyssp;
1451
if (0 <= yystate && yystate <= YYLAST && yycheck[yystate] == *yyssp)
1452
yystate = yytable[yystate];
1454
yystate = yydefgoto[yyn - YYNTOKENS];
1459
/*------------------------------------.
1460
| yyerrlab -- here on detecting error |
1461
`------------------------------------*/
1463
/* If not already recovering from an error, report this error. */
1468
yyn = yypact[yystate];
1470
if (YYPACT_NINF < yyn && yyn < YYLAST)
1472
YYSIZE_T yysize = 0;
1473
int yytype = YYTRANSLATE (yychar);
1474
const char* yyprefix;
1478
/* Start YYX at -YYN if negative to avoid negative indexes in
1480
int yyxbegin = yyn < 0 ? -yyn : 0;
1482
/* Stay within bounds of both yycheck and yytname. */
1483
int yychecklim = YYLAST - yyn;
1484
int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS;
1487
yyprefix = ", expecting ";
1488
for (yyx = yyxbegin; yyx < yyxend; ++yyx)
1489
if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR)
1491
yysize += yystrlen (yyprefix) + yystrlen (yytname [yyx]);
1499
yysize += (sizeof ("syntax error, unexpected ")
1500
+ yystrlen (yytname[yytype]));
1501
yymsg = (char *) YYSTACK_ALLOC (yysize);
1504
char *yyp = yystpcpy (yymsg, "syntax error, unexpected ");
1505
yyp = yystpcpy (yyp, yytname[yytype]);
1509
yyprefix = ", expecting ";
1510
for (yyx = yyxbegin; yyx < yyxend; ++yyx)
1511
if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR)
1513
yyp = yystpcpy (yyp, yyprefix);
1514
yyp = yystpcpy (yyp, yytname[yyx]);
1519
YYSTACK_FREE (yymsg);
1522
yyerror ("syntax error; also virtual memory exhausted");
1525
#endif /* YYERROR_VERBOSE */
1526
yyerror ("syntax error");
1531
if (yyerrstatus == 3)
1533
/* If just tried and failed to reuse look-ahead token after an
1534
error, discard it. */
1536
if (yychar <= YYEOF)
1538
/* If at end of input, pop the error token,
1539
then the rest of the stack, then return failure. */
1540
if (yychar == YYEOF)
1547
yydestruct ("Error: popping",
1548
yystos[*yyssp], yyvsp);
1553
yydestruct ("Error: discarding", yytoken, &yylval);
1558
/* Else will try to reuse look-ahead token after shifting the error
1563
/*---------------------------------------------------.
1564
| yyerrorlab -- error raised explicitly by YYERROR. |
1565
`---------------------------------------------------*/
1569
/* Pacify GCC when the user code never invokes YYERROR and the label
1570
yyerrorlab therefore never appears in user code. */
1581
/*-------------------------------------------------------------.
1582
| yyerrlab1 -- common code for both syntax error and YYERROR. |
1583
`-------------------------------------------------------------*/
1585
yyerrstatus = 3; /* Each real token shifted decrements this. */
1589
yyn = yypact[yystate];
1590
if (yyn != YYPACT_NINF)
1593
if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR)
1601
/* Pop the current state because it cannot handle the error token. */
1606
yydestruct ("Error: popping", yystos[yystate], yyvsp);
1609
YY_STACK_PRINT (yyss, yyssp);
1618
/* Shift the error token. */
1619
YY_SYMBOL_PRINT ("Shifting", yystos[yyn], yyvsp, yylsp);
1625
/*-------------------------------------.
1626
| yyacceptlab -- YYACCEPT comes here. |
1627
`-------------------------------------*/
1632
/*-----------------------------------.
1633
| yyabortlab -- YYABORT comes here. |
1634
`-----------------------------------*/
1636
yydestruct ("Error: discarding lookahead",
1643
/*----------------------------------------------.
1644
| yyoverflowlab -- parser overflow comes here. |
1645
`----------------------------------------------*/
1647
yyerror ("parser stack overflow");
1655
YYSTACK_FREE (yyss);
1661
#line 309 "imap_csim.y"
1667
extern FILE *csim_in;
1668
csim_restart(csim_in);
1672
load_csim (const char* filename)
1675
extern FILE *csim_in;
1676
csim_in = fopen(filename, "r");
1678
_map_info = get_map_info();
1679
status = !csim_parse();