~ubuntu-branches/ubuntu/maverick/gimp/maverick-updates

« back to all changes in this revision

Viewing changes to plug-ins/imagemap/imap_csim_parse.c

  • Committer: Bazaar Package Importer
  • Author(s): Daniel Holbach
  • Date: 2005-12-09 19:44:52 UTC
  • Revision ID: james.westby@ubuntu.com-20051209194452-yggpemjlofpjqyf4
Tags: upstream-2.2.9
ImportĀ upstreamĀ versionĀ 2.2.9

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/* A Bison parser, made by GNU Bison 2.0.  */
 
2
 
 
3
/* Skeleton parser for Yacc-like parsing with Bison,
 
4
   Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004 Free Software Foundation, Inc.
 
5
 
 
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)
 
9
   any later version.
 
10
 
 
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.
 
15
 
 
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.  */
 
20
 
 
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.  */
 
25
 
 
26
/* Written by Richard Stallman by simplifying the original so called
 
27
   ``semantic'' parser.  */
 
28
 
 
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.  */
 
35
 
 
36
/* Identify Bison output.  */
 
37
#define YYBISON 1
 
38
 
 
39
/* Skeleton name.  */
 
40
#define YYSKELETON_NAME "yacc.c"
 
41
 
 
42
/* Pure parsers.  */
 
43
#define YYPURE 0
 
44
 
 
45
/* Using locations.  */
 
46
#define YYLSP_NEEDED 0
 
47
 
 
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
 
56
 
 
57
 
 
58
/* Tokens.  */
 
59
#ifndef YYTOKENTYPE
 
60
# define YYTOKENTYPE
 
61
   /* Put the tokens into the symbol table, so that GDB and other debuggers
 
62
      know about them.  */
 
63
   enum yytokentype {
 
64
     IMG = 258,
 
65
     SRC = 259,
 
66
     WIDTH = 260,
 
67
     HEIGHT = 261,
 
68
     BORDER = 262,
 
69
     USEMAP = 263,
 
70
     START_MAP = 264,
 
71
     END_MAP = 265,
 
72
     NAME = 266,
 
73
     AREA = 267,
 
74
     SHAPE = 268,
 
75
     COORDS = 269,
 
76
     ALT = 270,
 
77
     HREF = 271,
 
78
     NOHREF = 272,
 
79
     TARGET = 273,
 
80
     ONMOUSEOVER = 274,
 
81
     ONMOUSEOUT = 275,
 
82
     ONFOCUS = 276,
 
83
     ONBLUR = 277,
 
84
     AUTHOR = 278,
 
85
     DESCRIPTION = 279,
 
86
     BEGIN_COMMENT = 280,
 
87
     END_COMMENT = 281,
 
88
     FLOAT = 282,
 
89
     STRING = 283
 
90
   };
 
91
#endif
 
92
#define IMG 258
 
93
#define SRC 259
 
94
#define WIDTH 260
 
95
#define HEIGHT 261
 
96
#define BORDER 262
 
97
#define USEMAP 263
 
98
#define START_MAP 264
 
99
#define END_MAP 265
 
100
#define NAME 266
 
101
#define AREA 267
 
102
#define SHAPE 268
 
103
#define COORDS 269
 
104
#define ALT 270
 
105
#define HREF 271
 
106
#define NOHREF 272
 
107
#define TARGET 273
 
108
#define ONMOUSEOVER 274
 
109
#define ONMOUSEOUT 275
 
110
#define ONFOCUS 276
 
111
#define ONBLUR 277
 
112
#define AUTHOR 278
 
113
#define DESCRIPTION 279
 
114
#define BEGIN_COMMENT 280
 
115
#define END_COMMENT 281
 
116
#define FLOAT 282
 
117
#define STRING 283
 
118
 
 
119
 
 
120
 
 
121
 
 
122
/* Copy the first part of user declarations.  */
 
123
#line 1 "imap_csim.y"
 
124
 
 
125
/*
 
126
 * This is a plug-in for the GIMP.
 
127
 *
 
128
 * Generates clickable image maps.
 
129
 *
 
130
 * Copyright (C) 1998-2005 Maurits Rijk  lpeek.mrijk@consunet.nl
 
131
 *
 
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.
 
136
 *
 
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.
 
141
 *
 
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.
 
145
 *
 
146
 */
 
147
 
 
148
#include <stdlib.h>
 
149
#include <string.h>
 
150
 
 
151
#include <gtk/gtk.h>
 
152
 
 
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"
 
159
 
 
160
extern int csim_lex();
 
161
extern int csim_restart();
 
162
static void csim_error(char* s);
 
163
 
 
164
static enum {UNDEFINED, RECTANGLE, CIRCLE, POLYGON} current_type;
 
165
static Object_t *current_object;
 
166
static MapInfo_t *_map_info;
 
167
 
 
168
 
 
169
 
 
170
/* Enabling traces.  */
 
171
#ifndef YYDEBUG
 
172
# define YYDEBUG 0
 
173
#endif
 
174
 
 
175
/* Enabling verbose error messages.  */
 
176
#ifdef YYERROR_VERBOSE
 
177
# undef YYERROR_VERBOSE
 
178
# define YYERROR_VERBOSE 1
 
179
#else
 
180
# define YYERROR_VERBOSE 0
 
181
#endif
 
182
 
 
183
#if ! defined (YYSTYPE) && ! defined (YYSTYPE_IS_DECLARED)
 
184
#line 47 "imap_csim.y"
 
185
typedef union YYSTYPE {
 
186
   int val;
 
187
   double value;
 
188
   char id[1024];
 
189
} YYSTYPE;
 
190
/* Line 190 of yacc.c.  */
 
191
#line 192 "y.tab.c"
 
192
# define yystype YYSTYPE /* obsolescent; will be withdrawn */
 
193
# define YYSTYPE_IS_DECLARED 1
 
194
# define YYSTYPE_IS_TRIVIAL 1
 
195
#endif
 
196
 
 
197
 
 
198
 
 
199
/* Copy the second part of user declarations.  */
 
200
 
 
201
 
 
202
/* Line 213 of yacc.c.  */
 
203
#line 204 "y.tab.c"
 
204
 
 
205
#if ! defined (yyoverflow) || YYERROR_VERBOSE
 
206
 
 
207
# ifndef YYFREE
 
208
#  define YYFREE free
 
209
# endif
 
210
# ifndef YYMALLOC
 
211
#  define YYMALLOC malloc
 
212
# endif
 
213
 
 
214
/* The parser invokes alloca or malloc; define the necessary symbols.  */
 
215
 
 
216
# ifdef YYSTACK_USE_ALLOCA
 
217
#  if YYSTACK_USE_ALLOCA
 
218
#   ifdef __GNUC__
 
219
#    define YYSTACK_ALLOC __builtin_alloca
 
220
#   else
 
221
#    define YYSTACK_ALLOC alloca
 
222
#   endif
 
223
#  endif
 
224
# endif
 
225
 
 
226
# ifdef YYSTACK_ALLOC
 
227
   /* Pacify GCC's `empty if-body' warning. */
 
228
#  define YYSTACK_FREE(Ptr) do { /* empty */; } while (0)
 
229
# else
 
230
#  if defined (__STDC__) || defined (__cplusplus)
 
231
#   include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
 
232
#   define YYSIZE_T size_t
 
233
#  endif
 
234
#  define YYSTACK_ALLOC YYMALLOC
 
235
#  define YYSTACK_FREE YYFREE
 
236
# endif
 
237
#endif /* ! defined (yyoverflow) || YYERROR_VERBOSE */
 
238
 
 
239
 
 
240
#if (! defined (yyoverflow) \
 
241
     && (! defined (__cplusplus) \
 
242
         || (defined (YYSTYPE_IS_TRIVIAL) && YYSTYPE_IS_TRIVIAL)))
 
243
 
 
244
/* A type that is properly aligned for any stack member.  */
 
245
union yyalloc
 
246
{
 
247
  short int yyss;
 
248
  YYSTYPE yyvs;
 
249
  };
 
250
 
 
251
/* The size of the maximum gap between one aligned stack and the next.  */
 
252
# define YYSTACK_GAP_MAXIMUM (sizeof (union yyalloc) - 1)
 
253
 
 
254
/* The size of an array large to enough to hold all stacks, each with
 
255
   N elements.  */
 
256
# define YYSTACK_BYTES(N) \
 
257
     ((N) * (sizeof (short int) + sizeof (YYSTYPE))                     \
 
258
      + YYSTACK_GAP_MAXIMUM)
 
259
 
 
260
/* Copy COUNT objects from FROM to TO.  The source and destination do
 
261
   not overlap.  */
 
262
# ifndef YYCOPY
 
263
#  if defined (__GNUC__) && 1 < __GNUC__
 
264
#   define YYCOPY(To, From, Count) \
 
265
      __builtin_memcpy (To, From, (Count) * sizeof (*(From)))
 
266
#  else
 
267
#   define YYCOPY(To, From, Count)              \
 
268
      do                                        \
 
269
        {                                       \
 
270
          register YYSIZE_T yyi;                \
 
271
          for (yyi = 0; yyi < (Count); yyi++)   \
 
272
            (To)[yyi] = (From)[yyi];            \
 
273
        }                                       \
 
274
      while (0)
 
275
#  endif
 
276
# endif
 
277
 
 
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
 
282
   stack.  */
 
283
# define YYSTACK_RELOCATE(Stack)                                        \
 
284
    do                                                                  \
 
285
      {                                                                 \
 
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);                          \
 
291
      }                                                                 \
 
292
    while (0)
 
293
 
 
294
#endif
 
295
 
 
296
#if defined (__STDC__) || defined (__cplusplus)
 
297
   typedef signed char yysigned_char;
 
298
#else
 
299
   typedef short int yysigned_char;
 
300
#endif
 
301
 
 
302
/* YYFINAL -- State number of the termination state. */
 
303
#define YYFINAL  5
 
304
/* YYLAST -- Last index in YYTABLE.  */
 
305
#define YYLAST   84
 
306
 
 
307
/* YYNTOKENS -- Number of terminals. */
 
308
#define YYNTOKENS  33
 
309
/* YYNNTS -- Number of nonterminals. */
 
310
#define YYNNTS  31
 
311
/* YYNRULES -- Number of rules. */
 
312
#define YYNRULES  53
 
313
/* YYNRULES -- Number of states. */
 
314
#define YYNSTATES  106
 
315
 
 
316
/* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX.  */
 
317
#define YYUNDEFTOK  2
 
318
#define YYMAXUTOK   283
 
319
 
 
320
#define YYTRANSLATE(YYX)                                                \
 
321
  ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK)
 
322
 
 
323
/* YYTRANSLATE[YYLEX] -- Bison symbol number corresponding to YYLEX.  */
 
324
static const unsigned char yytranslate[] =
 
325
{
 
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,
 
354
      25,    26,    27,    28
 
355
};
 
356
 
 
357
#if YYDEBUG
 
358
/* YYPRHS[YYN] -- Index of the first RHS symbol of rule number YYN in
 
359
   YYRHS.  */
 
360
static const unsigned char yyprhs[] =
 
361
{
 
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,
 
367
     147,   151,   155,   159
 
368
};
 
369
 
 
370
/* YYRHS -- A `-1'-separated list of the rules' RHS. */
 
371
static const yysigned_char yyrhs[] =
 
372
{
 
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,
 
389
      10,    31,    -1
 
390
};
 
391
 
 
392
/* YYRLINE[YYN] -- source line where rule number YYN was defined.  */
 
393
static const unsigned short int yyrline[] =
 
394
{
 
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,
 
400
     288,   294,   300,   306
 
401
};
 
402
#endif
 
403
 
 
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[] =
 
408
{
 
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
 
421
};
 
422
#endif
 
423
 
 
424
# ifdef YYPRINT
 
425
/* YYTOKNUM[YYLEX-NUM] -- Internal token number corresponding to
 
426
   token YYLEX-NUM.  */
 
427
static const unsigned short int yytoknum[] =
 
428
{
 
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,
 
432
      61,    62,    47
 
433
};
 
434
# endif
 
435
 
 
436
/* YYR1[YYN] -- Symbol number of symbol that rule YYN derives.  */
 
437
static const unsigned char yyr1[] =
 
438
{
 
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,
 
444
      60,    61,    62,    63
 
445
};
 
446
 
 
447
/* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN.  */
 
448
static const unsigned char yyr2[] =
 
449
{
 
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,
 
455
       3,     3,     3,     3
 
456
};
 
457
 
 
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[] =
 
462
{
 
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
 
474
};
 
475
 
 
476
/* YYDEFGOTO[NTERM-NUM]. */
 
477
static const yysigned_char yydefgoto[] =
 
478
{
 
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,
 
482
      28
 
483
};
 
484
 
 
485
/* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
 
486
   STATE-NUM.  */
 
487
#define YYPACT_NINF -29
 
488
static const yysigned_char yypact[] =
 
489
{
 
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
 
501
};
 
502
 
 
503
/* YYPGOTO[NTERM-NUM].  */
 
504
static const yysigned_char yypgoto[] =
 
505
{
 
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,
 
509
     -29
 
510
};
 
511
 
 
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[] =
 
518
{
 
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
 
528
};
 
529
 
 
530
static const yysigned_char yycheck[] =
 
531
{
 
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,
 
540
      28,    28,    28,    28,    28
 
541
};
 
542
 
 
543
/* YYSTOS[STATE-NUM] -- The (internal number of the) accessing
 
544
   symbol of state STATE-NUM.  */
 
545
static const unsigned char yystos[] =
 
546
{
 
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
 
558
};
 
559
 
 
560
#if ! defined (YYSIZE_T) && defined (__SIZE_TYPE__)
 
561
# define YYSIZE_T __SIZE_TYPE__
 
562
#endif
 
563
#if ! defined (YYSIZE_T) && defined (size_t)
 
564
# define YYSIZE_T size_t
 
565
#endif
 
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
 
570
# endif
 
571
#endif
 
572
#if ! defined (YYSIZE_T)
 
573
# define YYSIZE_T unsigned int
 
574
#endif
 
575
 
 
576
#define yyerrok         (yyerrstatus = 0)
 
577
#define yyclearin       (yychar = YYEMPTY)
 
578
#define YYEMPTY         (-2)
 
579
#define YYEOF           0
 
580
 
 
581
#define YYACCEPT        goto yyacceptlab
 
582
#define YYABORT         goto yyabortlab
 
583
#define YYERROR         goto yyerrorlab
 
584
 
 
585
 
 
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.  */
 
589
 
 
590
#define YYFAIL          goto yyerrlab
 
591
 
 
592
#define YYRECOVERING()  (!!yyerrstatus)
 
593
 
 
594
#define YYBACKUP(Token, Value)                                  \
 
595
do                                                              \
 
596
  if (yychar == YYEMPTY && yylen == 1)                          \
 
597
    {                                                           \
 
598
      yychar = (Token);                                         \
 
599
      yylval = (Value);                                         \
 
600
      yytoken = YYTRANSLATE (yychar);                           \
 
601
      YYPOPSTACK;                                               \
 
602
      goto yybackup;                                            \
 
603
    }                                                           \
 
604
  else                                                          \
 
605
    {                                                           \
 
606
      yyerror ("syntax error: cannot back up");\
 
607
      YYERROR;                                                  \
 
608
    }                                                           \
 
609
while (0)
 
610
 
 
611
 
 
612
#define YYTERROR        1
 
613
#define YYERRCODE       256
 
614
 
 
615
 
 
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).  */
 
619
 
 
620
#define YYRHSLOC(Rhs, K) ((Rhs)[K])
 
621
#ifndef YYLLOC_DEFAULT
 
622
# define YYLLOC_DEFAULT(Current, Rhs, N)                                \
 
623
    do                                                                  \
 
624
      if (N)                                                            \
 
625
        {                                                               \
 
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;       \
 
630
        }                                                               \
 
631
      else                                                              \
 
632
        {                                                               \
 
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;                              \
 
637
        }                                                               \
 
638
    while (0)
 
639
#endif
 
640
 
 
641
 
 
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.  */
 
645
 
 
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)
 
652
# else
 
653
#  define YY_LOCATION_PRINT(File, Loc) ((void) 0)
 
654
# endif
 
655
#endif
 
656
 
 
657
 
 
658
/* YYLEX -- calling `yylex' with the right arguments.  */
 
659
 
 
660
#ifdef YYLEX_PARAM
 
661
# define YYLEX yylex (YYLEX_PARAM)
 
662
#else
 
663
# define YYLEX yylex ()
 
664
#endif
 
665
 
 
666
/* Enable debugging if requested.  */
 
667
#if YYDEBUG
 
668
 
 
669
# ifndef YYFPRINTF
 
670
#  include <stdio.h> /* INFRINGES ON USER NAME SPACE */
 
671
#  define YYFPRINTF fprintf
 
672
# endif
 
673
 
 
674
# define YYDPRINTF(Args)                        \
 
675
do {                                            \
 
676
  if (yydebug)                                  \
 
677
    YYFPRINTF Args;                             \
 
678
} while (0)
 
679
 
 
680
# define YY_SYMBOL_PRINT(Title, Type, Value, Location)          \
 
681
do {                                                            \
 
682
  if (yydebug)                                                  \
 
683
    {                                                           \
 
684
      YYFPRINTF (stderr, "%s ", Title);                         \
 
685
      yysymprint (stderr,                                       \
 
686
                  Type, Value); \
 
687
      YYFPRINTF (stderr, "\n");                                 \
 
688
    }                                                           \
 
689
} while (0)
 
690
 
 
691
/*------------------------------------------------------------------.
 
692
| yy_stack_print -- Print the state stack from its BOTTOM up to its |
 
693
| TOP (included).                                                   |
 
694
`------------------------------------------------------------------*/
 
695
 
 
696
#if defined (__STDC__) || defined (__cplusplus)
 
697
static void
 
698
yy_stack_print (short int *bottom, short int *top)
 
699
#else
 
700
static void
 
701
yy_stack_print (bottom, top)
 
702
    short int *bottom;
 
703
    short int *top;
 
704
#endif
 
705
{
 
706
  YYFPRINTF (stderr, "Stack now");
 
707
  for (/* Nothing. */; bottom <= top; ++bottom)
 
708
    YYFPRINTF (stderr, " %d", *bottom);
 
709
  YYFPRINTF (stderr, "\n");
 
710
}
 
711
 
 
712
# define YY_STACK_PRINT(Bottom, Top)                            \
 
713
do {                                                            \
 
714
  if (yydebug)                                                  \
 
715
    yy_stack_print ((Bottom), (Top));                           \
 
716
} while (0)
 
717
 
 
718
 
 
719
/*------------------------------------------------.
 
720
| Report that the YYRULE is going to be reduced.  |
 
721
`------------------------------------------------*/
 
722
 
 
723
#if defined (__STDC__) || defined (__cplusplus)
 
724
static void
 
725
yy_reduce_print (int yyrule)
 
726
#else
 
727
static void
 
728
yy_reduce_print (yyrule)
 
729
    int yyrule;
 
730
#endif
 
731
{
 
732
  int yyi;
 
733
  unsigned int yylno = yyrline[yyrule];
 
734
  YYFPRINTF (stderr, "Reducing stack by rule %d (line %u), ",
 
735
             yyrule - 1, yylno);
 
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]]);
 
740
}
 
741
 
 
742
# define YY_REDUCE_PRINT(Rule)          \
 
743
do {                                    \
 
744
  if (yydebug)                          \
 
745
    yy_reduce_print (Rule);             \
 
746
} while (0)
 
747
 
 
748
/* Nonzero means print parse trace.  It is left uninitialized so that
 
749
   multiple parsers can coexist.  */
 
750
int yydebug;
 
751
#else /* !YYDEBUG */
 
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 */
 
757
 
 
758
 
 
759
/* YYINITDEPTH -- initial size of the parser's stacks.  */
 
760
#ifndef YYINITDEPTH
 
761
# define YYINITDEPTH 200
 
762
#endif
 
763
 
 
764
/* YYMAXDEPTH -- maximum size the stacks can grow to (effective only
 
765
   if the built-in stack extension method is used).
 
766
 
 
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.  */
 
770
 
 
771
#ifndef YYMAXDEPTH
 
772
# define YYMAXDEPTH 10000
 
773
#endif
 
774
 
 
775
 
 
776
 
 
777
#if YYERROR_VERBOSE
 
778
 
 
779
# ifndef yystrlen
 
780
#  if defined (__GLIBC__) && defined (_STRING_H)
 
781
#   define yystrlen strlen
 
782
#  else
 
783
/* Return the length of YYSTR.  */
 
784
static YYSIZE_T
 
785
#   if defined (__STDC__) || defined (__cplusplus)
 
786
yystrlen (const char *yystr)
 
787
#   else
 
788
yystrlen (yystr)
 
789
     const char *yystr;
 
790
#   endif
 
791
{
 
792
  register const char *yys = yystr;
 
793
 
 
794
  while (*yys++ != '\0')
 
795
    continue;
 
796
 
 
797
  return yys - yystr - 1;
 
798
}
 
799
#  endif
 
800
# endif
 
801
 
 
802
# ifndef yystpcpy
 
803
#  if defined (__GLIBC__) && defined (_STRING_H) && defined (_GNU_SOURCE)
 
804
#   define yystpcpy stpcpy
 
805
#  else
 
806
/* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in
 
807
   YYDEST.  */
 
808
static char *
 
809
#   if defined (__STDC__) || defined (__cplusplus)
 
810
yystpcpy (char *yydest, const char *yysrc)
 
811
#   else
 
812
yystpcpy (yydest, yysrc)
 
813
     char *yydest;
 
814
     const char *yysrc;
 
815
#   endif
 
816
{
 
817
  register char *yyd = yydest;
 
818
  register const char *yys = yysrc;
 
819
 
 
820
  while ((*yyd++ = *yys++) != '\0')
 
821
    continue;
 
822
 
 
823
  return yyd - 1;
 
824
}
 
825
#  endif
 
826
# endif
 
827
 
 
828
#endif /* !YYERROR_VERBOSE */
 
829
 
 
830
 
 
831
 
 
832
#if YYDEBUG
 
833
/*--------------------------------.
 
834
| Print this symbol on YYOUTPUT.  |
 
835
`--------------------------------*/
 
836
 
 
837
#if defined (__STDC__) || defined (__cplusplus)
 
838
static void
 
839
yysymprint (FILE *yyoutput, int yytype, YYSTYPE *yyvaluep)
 
840
#else
 
841
static void
 
842
yysymprint (yyoutput, yytype, yyvaluep)
 
843
    FILE *yyoutput;
 
844
    int yytype;
 
845
    YYSTYPE *yyvaluep;
 
846
#endif
 
847
{
 
848
  /* Pacify ``unused variable'' warnings.  */
 
849
  (void) yyvaluep;
 
850
 
 
851
  if (yytype < YYNTOKENS)
 
852
    YYFPRINTF (yyoutput, "token %s (", yytname[yytype]);
 
853
  else
 
854
    YYFPRINTF (yyoutput, "nterm %s (", yytname[yytype]);
 
855
 
 
856
 
 
857
# ifdef YYPRINT
 
858
  if (yytype < YYNTOKENS)
 
859
    YYPRINT (yyoutput, yytoknum[yytype], *yyvaluep);
 
860
# endif
 
861
  switch (yytype)
 
862
    {
 
863
      default:
 
864
        break;
 
865
    }
 
866
  YYFPRINTF (yyoutput, ")");
 
867
}
 
868
 
 
869
#endif /* ! YYDEBUG */
 
870
/*-----------------------------------------------.
 
871
| Release the memory associated to this symbol.  |
 
872
`-----------------------------------------------*/
 
873
 
 
874
#if defined (__STDC__) || defined (__cplusplus)
 
875
static void
 
876
yydestruct (const char *yymsg, int yytype, YYSTYPE *yyvaluep)
 
877
#else
 
878
static void
 
879
yydestruct (yymsg, yytype, yyvaluep)
 
880
    const char *yymsg;
 
881
    int yytype;
 
882
    YYSTYPE *yyvaluep;
 
883
#endif
 
884
{
 
885
  /* Pacify ``unused variable'' warnings.  */
 
886
  (void) yyvaluep;
 
887
 
 
888
  if (!yymsg)
 
889
    yymsg = "Deleting";
 
890
  YY_SYMBOL_PRINT (yymsg, yytype, yyvaluep, yylocationp);
 
891
 
 
892
  switch (yytype)
 
893
    {
 
894
 
 
895
      default:
 
896
        break;
 
897
    }
 
898
}
 
899
 
 
900
 
 
901
/* Prevent warnings from -Wmissing-prototypes.  */
 
902
 
 
903
#ifdef YYPARSE_PARAM
 
904
# if defined (__STDC__) || defined (__cplusplus)
 
905
int yyparse (void *YYPARSE_PARAM);
 
906
# else
 
907
int yyparse ();
 
908
# endif
 
909
#else /* ! YYPARSE_PARAM */
 
910
#if defined (__STDC__) || defined (__cplusplus)
 
911
int yyparse (void);
 
912
#else
 
913
int yyparse ();
 
914
#endif
 
915
#endif /* ! YYPARSE_PARAM */
 
916
 
 
917
 
 
918
 
 
919
/* The look-ahead symbol.  */
 
920
int yychar;
 
921
 
 
922
/* The semantic value of the look-ahead symbol.  */
 
923
YYSTYPE yylval;
 
924
 
 
925
/* Number of syntax errors so far.  */
 
926
int yynerrs;
 
927
 
 
928
 
 
929
 
 
930
/*----------.
 
931
| yyparse.  |
 
932
`----------*/
 
933
 
 
934
#ifdef YYPARSE_PARAM
 
935
# if defined (__STDC__) || defined (__cplusplus)
 
936
int yyparse (void *YYPARSE_PARAM)
 
937
# else
 
938
int yyparse (YYPARSE_PARAM)
 
939
  void *YYPARSE_PARAM;
 
940
# endif
 
941
#else /* ! YYPARSE_PARAM */
 
942
#if defined (__STDC__) || defined (__cplusplus)
 
943
int
 
944
yyparse (void)
 
945
#else
 
946
int
 
947
yyparse ()
 
948
 
 
949
#endif
 
950
#endif
 
951
{
 
952
  
 
953
  register int yystate;
 
954
  register int yyn;
 
955
  int yyresult;
 
956
  /* Number of tokens to shift before error messages enabled.  */
 
957
  int yyerrstatus;
 
958
  /* Look-ahead token as an internal (translated) token number.  */
 
959
  int yytoken = 0;
 
960
 
 
961
  /* Three stacks and their tools:
 
962
     `yyss': related to states,
 
963
     `yyvs': related to semantic values,
 
964
     `yyls': related to locations.
 
965
 
 
966
     Refer to the stacks thru separate pointers, to allow yyoverflow
 
967
     to reallocate them elsewhere.  */
 
968
 
 
969
  /* The state stack.  */
 
970
  short int yyssa[YYINITDEPTH];
 
971
  short int *yyss = yyssa;
 
972
  register short int *yyssp;
 
973
 
 
974
  /* The semantic value stack.  */
 
975
  YYSTYPE yyvsa[YYINITDEPTH];
 
976
  YYSTYPE *yyvs = yyvsa;
 
977
  register YYSTYPE *yyvsp;
 
978
 
 
979
 
 
980
 
 
981
#define YYPOPSTACK   (yyvsp--, yyssp--)
 
982
 
 
983
  YYSIZE_T yystacksize = YYINITDEPTH;
 
984
 
 
985
  /* The variables used to return semantic value and location from the
 
986
     action routines.  */
 
987
  YYSTYPE yyval;
 
988
 
 
989
 
 
990
  /* When reducing, the number of symbols on the RHS of the reduced
 
991
     rule.  */
 
992
  int yylen;
 
993
 
 
994
  YYDPRINTF ((stderr, "Starting parse\n"));
 
995
 
 
996
  yystate = 0;
 
997
  yyerrstatus = 0;
 
998
  yynerrs = 0;
 
999
  yychar = YYEMPTY;             /* Cause a token to be read.  */
 
1000
 
 
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.  */
 
1005
 
 
1006
  yyssp = yyss;
 
1007
  yyvsp = yyvs;
 
1008
 
 
1009
 
 
1010
  yyvsp[0] = yylval;
 
1011
 
 
1012
  goto yysetstate;
 
1013
 
 
1014
/*------------------------------------------------------------.
 
1015
| yynewstate -- Push a new state, which is found in yystate.  |
 
1016
`------------------------------------------------------------*/
 
1017
 yynewstate:
 
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.
 
1020
     */
 
1021
  yyssp++;
 
1022
 
 
1023
 yysetstate:
 
1024
  *yyssp = yystate;
 
1025
 
 
1026
  if (yyss + yystacksize - 1 <= yyssp)
 
1027
    {
 
1028
      /* Get the current used size of the three stacks, in elements.  */
 
1029
      YYSIZE_T yysize = yyssp - yyss + 1;
 
1030
 
 
1031
#ifdef yyoverflow
 
1032
      {
 
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
 
1035
           memory.  */
 
1036
        YYSTYPE *yyvs1 = yyvs;
 
1037
        short int *yyss1 = yyss;
 
1038
 
 
1039
 
 
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),
 
1047
 
 
1048
                    &yystacksize);
 
1049
 
 
1050
        yyss = yyss1;
 
1051
        yyvs = yyvs1;
 
1052
      }
 
1053
#else /* no yyoverflow */
 
1054
# ifndef YYSTACK_RELOCATE
 
1055
      goto yyoverflowlab;
 
1056
# else
 
1057
      /* Extend the stack our own way.  */
 
1058
      if (YYMAXDEPTH <= yystacksize)
 
1059
        goto yyoverflowlab;
 
1060
      yystacksize *= 2;
 
1061
      if (YYMAXDEPTH < yystacksize)
 
1062
        yystacksize = YYMAXDEPTH;
 
1063
 
 
1064
      {
 
1065
        short int *yyss1 = yyss;
 
1066
        union yyalloc *yyptr =
 
1067
          (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize));
 
1068
        if (! yyptr)
 
1069
          goto yyoverflowlab;
 
1070
        YYSTACK_RELOCATE (yyss);
 
1071
        YYSTACK_RELOCATE (yyvs);
 
1072
 
 
1073
#  undef YYSTACK_RELOCATE
 
1074
        if (yyss1 != yyssa)
 
1075
          YYSTACK_FREE (yyss1);
 
1076
      }
 
1077
# endif
 
1078
#endif /* no yyoverflow */
 
1079
 
 
1080
      yyssp = yyss + yysize - 1;
 
1081
      yyvsp = yyvs + yysize - 1;
 
1082
 
 
1083
 
 
1084
      YYDPRINTF ((stderr, "Stack size increased to %lu\n",
 
1085
                  (unsigned long int) yystacksize));
 
1086
 
 
1087
      if (yyss + yystacksize - 1 <= yyssp)
 
1088
        YYABORT;
 
1089
    }
 
1090
 
 
1091
  YYDPRINTF ((stderr, "Entering state %d\n", yystate));
 
1092
 
 
1093
  goto yybackup;
 
1094
 
 
1095
/*-----------.
 
1096
| yybackup.  |
 
1097
`-----------*/
 
1098
yybackup:
 
1099
 
 
1100
/* Do appropriate processing given the current state.  */
 
1101
/* Read a look-ahead token if we need one and don't already have one.  */
 
1102
/* yyresume: */
 
1103
 
 
1104
  /* First try to decide what to do without reference to look-ahead token.  */
 
1105
 
 
1106
  yyn = yypact[yystate];
 
1107
  if (yyn == YYPACT_NINF)
 
1108
    goto yydefault;
 
1109
 
 
1110
  /* Not known => get a look-ahead token if don't already have one.  */
 
1111
 
 
1112
  /* YYCHAR is either YYEMPTY or YYEOF or a valid look-ahead symbol.  */
 
1113
  if (yychar == YYEMPTY)
 
1114
    {
 
1115
      YYDPRINTF ((stderr, "Reading a token: "));
 
1116
      yychar = YYLEX;
 
1117
    }
 
1118
 
 
1119
  if (yychar <= YYEOF)
 
1120
    {
 
1121
      yychar = yytoken = YYEOF;
 
1122
      YYDPRINTF ((stderr, "Now at end of input.\n"));
 
1123
    }
 
1124
  else
 
1125
    {
 
1126
      yytoken = YYTRANSLATE (yychar);
 
1127
      YY_SYMBOL_PRINT ("Next token is", yytoken, &yylval, &yylloc);
 
1128
    }
 
1129
 
 
1130
  /* If the proper action on seeing token YYTOKEN is to reduce or to
 
1131
     detect an error, take that action.  */
 
1132
  yyn += yytoken;
 
1133
  if (yyn < 0 || YYLAST < yyn || yycheck[yyn] != yytoken)
 
1134
    goto yydefault;
 
1135
  yyn = yytable[yyn];
 
1136
  if (yyn <= 0)
 
1137
    {
 
1138
      if (yyn == 0 || yyn == YYTABLE_NINF)
 
1139
        goto yyerrlab;
 
1140
      yyn = -yyn;
 
1141
      goto yyreduce;
 
1142
    }
 
1143
 
 
1144
  if (yyn == YYFINAL)
 
1145
    YYACCEPT;
 
1146
 
 
1147
  /* Shift the look-ahead token.  */
 
1148
  YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc);
 
1149
 
 
1150
  /* Discard the token being shifted unless it is eof.  */
 
1151
  if (yychar != YYEOF)
 
1152
    yychar = YYEMPTY;
 
1153
 
 
1154
  *++yyvsp = yylval;
 
1155
 
 
1156
 
 
1157
  /* Count tokens shifted since error; after three, turn off error
 
1158
     status.  */
 
1159
  if (yyerrstatus)
 
1160
    yyerrstatus--;
 
1161
 
 
1162
  yystate = yyn;
 
1163
  goto yynewstate;
 
1164
 
 
1165
 
 
1166
/*-----------------------------------------------------------.
 
1167
| yydefault -- do the default action for the current state.  |
 
1168
`-----------------------------------------------------------*/
 
1169
yydefault:
 
1170
  yyn = yydefact[yystate];
 
1171
  if (yyn == 0)
 
1172
    goto yyerrlab;
 
1173
  goto yyreduce;
 
1174
 
 
1175
 
 
1176
/*-----------------------------.
 
1177
| yyreduce -- Do a reduction.  |
 
1178
`-----------------------------*/
 
1179
yyreduce:
 
1180
  /* yyn is the number of a rule to reduce with.  */
 
1181
  yylen = yyr2[yyn];
 
1182
 
 
1183
  /* If YYLEN is nonzero, implement the default value of the action:
 
1184
     `$$ = $1'.
 
1185
 
 
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];
 
1192
 
 
1193
 
 
1194
  YY_REDUCE_PRINT (yyn);
 
1195
  switch (yyn)
 
1196
    {
 
1197
        case 3:
 
1198
#line 68 "imap_csim.y"
 
1199
    {
 
1200
                   g_strreplace(&_map_info->image_name, (yyvsp[-2].id));
 
1201
                }
 
1202
    break;
 
1203
 
 
1204
  case 8:
 
1205
#line 79 "imap_csim.y"
 
1206
    {}
 
1207
    break;
 
1208
 
 
1209
  case 9:
 
1210
#line 80 "imap_csim.y"
 
1211
    {}
 
1212
    break;
 
1213
 
 
1214
  case 10:
 
1215
#line 81 "imap_csim.y"
 
1216
    {}
 
1217
    break;
 
1218
 
 
1219
  case 11:
 
1220
#line 85 "imap_csim.y"
 
1221
    {
 
1222
                   _map_info->old_image_width = (yyvsp[0].val);
 
1223
                }
 
1224
    break;
 
1225
 
 
1226
  case 12:
 
1227
#line 91 "imap_csim.y"
 
1228
    {
 
1229
                   _map_info->old_image_height = (yyvsp[0].val);
 
1230
                }
 
1231
    break;
 
1232
 
 
1233
  case 13:
 
1234
#line 97 "imap_csim.y"
 
1235
    {
 
1236
                  (yyval.val) = (gint) (yyvsp[0].value);
 
1237
                }
 
1238
    break;
 
1239
 
 
1240
  case 14:
 
1241
#line 101 "imap_csim.y"
 
1242
    {
 
1243
                  (yyval.val) = (gint) atof((yyvsp[0].id));
 
1244
                }
 
1245
    break;
 
1246
 
 
1247
  case 15:
 
1248
#line 107 "imap_csim.y"
 
1249
    {
 
1250
                   g_strreplace(&_map_info->title, (yyvsp[-1].id));
 
1251
                }
 
1252
    break;
 
1253
 
 
1254
  case 21:
 
1255
#line 122 "imap_csim.y"
 
1256
    {
 
1257
                }
 
1258
    break;
 
1259
 
 
1260
  case 22:
 
1261
#line 127 "imap_csim.y"
 
1262
    {
 
1263
                   g_strreplace(&_map_info->author, (yyvsp[-1].id));
 
1264
 
 
1265
                }
 
1266
    break;
 
1267
 
 
1268
  case 23:
 
1269
#line 134 "imap_csim.y"
 
1270
    {
 
1271
                   gchar *description;
 
1272
 
 
1273
                   description = g_strconcat(_map_info->description, (yyvsp[-1].id), "\n", 
 
1274
                                             NULL);
 
1275
                   g_strreplace(&_map_info->description, description);
 
1276
                }
 
1277
    break;
 
1278
 
 
1279
  case 26:
 
1280
#line 148 "imap_csim.y"
 
1281
    {
 
1282
                   if (current_type != UNDEFINED)
 
1283
                      add_shape(current_object);
 
1284
                }
 
1285
    break;
 
1286
 
 
1287
  case 41:
 
1288
#line 175 "imap_csim.y"
 
1289
    {
 
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;
 
1301
                   }
 
1302
                }
 
1303
    break;
 
1304
 
 
1305
  case 42:
 
1306
#line 192 "imap_csim.y"
 
1307
    {
 
1308
                   char *p;
 
1309
                   if (current_type == RECTANGLE) {
 
1310
                      Rectangle_t *rectangle;
 
1311
 
 
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) {
 
1322
                      Circle_t *circle;
 
1323
 
 
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);
 
1333
                      GList *points;
 
1334
                      GdkPoint *point, *first;
 
1335
                      gint x, y;
 
1336
 
 
1337
                      p = strtok((yyvsp[0].id), ",");
 
1338
                      x = atoi(p);
 
1339
                      p = strtok(NULL, ",");
 
1340
                      y = atoi(p);
 
1341
                      point = new_point(x, y);
 
1342
                      points = g_list_append(NULL, (gpointer) point);
 
1343
 
 
1344
                      while(1) {
 
1345
                         p = strtok(NULL, ",");
 
1346
                         if (!p)
 
1347
                            break;
 
1348
                         x = atoi(p);
 
1349
                         p = strtok(NULL, ",");
 
1350
                         y = atoi(p);
 
1351
                         point = new_point(x, y);
 
1352
                         g_list_append(points, (gpointer) point);
 
1353
                      }
 
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;
 
1360
                   }
 
1361
                }
 
1362
    break;
 
1363
 
 
1364
  case 43:
 
1365
#line 250 "imap_csim.y"
 
1366
    {
 
1367
                   if (current_type == UNDEFINED) {
 
1368
                      g_strreplace(&_map_info->default_url, (yyvsp[0].id));
 
1369
                   } else {
 
1370
                      object_set_url(current_object, (yyvsp[0].id));
 
1371
                   }
 
1372
                }
 
1373
    break;
 
1374
 
 
1375
  case 44:
 
1376
#line 260 "imap_csim.y"
 
1377
    {
 
1378
                }
 
1379
    break;
 
1380
 
 
1381
  case 46:
 
1382
#line 266 "imap_csim.y"
 
1383
    {
 
1384
                }
 
1385
    break;
 
1386
 
 
1387
  case 47:
 
1388
#line 271 "imap_csim.y"
 
1389
    {
 
1390
                   object_set_comment(current_object, (yyvsp[0].id));
 
1391
                }
 
1392
    break;
 
1393
 
 
1394
  case 48:
 
1395
#line 277 "imap_csim.y"
 
1396
    {
 
1397
                   object_set_target(current_object, (yyvsp[0].id));
 
1398
                }
 
1399
    break;
 
1400
 
 
1401
  case 49:
 
1402
#line 283 "imap_csim.y"
 
1403
    {
 
1404
                   object_set_mouse_over(current_object, (yyvsp[0].id));
 
1405
                }
 
1406
    break;
 
1407
 
 
1408
  case 50:
 
1409
#line 289 "imap_csim.y"
 
1410
    {
 
1411
                   object_set_mouse_out(current_object, (yyvsp[0].id));
 
1412
                }
 
1413
    break;
 
1414
 
 
1415
  case 51:
 
1416
#line 295 "imap_csim.y"
 
1417
    {
 
1418
                   object_set_focus(current_object, (yyvsp[0].id));
 
1419
                }
 
1420
    break;
 
1421
 
 
1422
  case 52:
 
1423
#line 301 "imap_csim.y"
 
1424
    {
 
1425
                   object_set_blur(current_object, (yyvsp[0].id));
 
1426
                }
 
1427
    break;
 
1428
 
 
1429
 
 
1430
    }
 
1431
 
 
1432
/* Line 1037 of yacc.c.  */
 
1433
#line 1434 "y.tab.c"
 
1434
 
 
1435
  yyvsp -= yylen;
 
1436
  yyssp -= yylen;
 
1437
 
 
1438
 
 
1439
  YY_STACK_PRINT (yyss, yyssp);
 
1440
 
 
1441
  *++yyvsp = yyval;
 
1442
 
 
1443
 
 
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.  */
 
1447
 
 
1448
  yyn = yyr1[yyn];
 
1449
 
 
1450
  yystate = yypgoto[yyn - YYNTOKENS] + *yyssp;
 
1451
  if (0 <= yystate && yystate <= YYLAST && yycheck[yystate] == *yyssp)
 
1452
    yystate = yytable[yystate];
 
1453
  else
 
1454
    yystate = yydefgoto[yyn - YYNTOKENS];
 
1455
 
 
1456
  goto yynewstate;
 
1457
 
 
1458
 
 
1459
/*------------------------------------.
 
1460
| yyerrlab -- here on detecting error |
 
1461
`------------------------------------*/
 
1462
yyerrlab:
 
1463
  /* If not already recovering from an error, report this error.  */
 
1464
  if (!yyerrstatus)
 
1465
    {
 
1466
      ++yynerrs;
 
1467
#if YYERROR_VERBOSE
 
1468
      yyn = yypact[yystate];
 
1469
 
 
1470
      if (YYPACT_NINF < yyn && yyn < YYLAST)
 
1471
        {
 
1472
          YYSIZE_T yysize = 0;
 
1473
          int yytype = YYTRANSLATE (yychar);
 
1474
          const char* yyprefix;
 
1475
          char *yymsg;
 
1476
          int yyx;
 
1477
 
 
1478
          /* Start YYX at -YYN if negative to avoid negative indexes in
 
1479
             YYCHECK.  */
 
1480
          int yyxbegin = yyn < 0 ? -yyn : 0;
 
1481
 
 
1482
          /* Stay within bounds of both yycheck and yytname.  */
 
1483
          int yychecklim = YYLAST - yyn;
 
1484
          int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS;
 
1485
          int yycount = 0;
 
1486
 
 
1487
          yyprefix = ", expecting ";
 
1488
          for (yyx = yyxbegin; yyx < yyxend; ++yyx)
 
1489
            if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR)
 
1490
              {
 
1491
                yysize += yystrlen (yyprefix) + yystrlen (yytname [yyx]);
 
1492
                yycount += 1;
 
1493
                if (yycount == 5)
 
1494
                  {
 
1495
                    yysize = 0;
 
1496
                    break;
 
1497
                  }
 
1498
              }
 
1499
          yysize += (sizeof ("syntax error, unexpected ")
 
1500
                     + yystrlen (yytname[yytype]));
 
1501
          yymsg = (char *) YYSTACK_ALLOC (yysize);
 
1502
          if (yymsg != 0)
 
1503
            {
 
1504
              char *yyp = yystpcpy (yymsg, "syntax error, unexpected ");
 
1505
              yyp = yystpcpy (yyp, yytname[yytype]);
 
1506
 
 
1507
              if (yycount < 5)
 
1508
                {
 
1509
                  yyprefix = ", expecting ";
 
1510
                  for (yyx = yyxbegin; yyx < yyxend; ++yyx)
 
1511
                    if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR)
 
1512
                      {
 
1513
                        yyp = yystpcpy (yyp, yyprefix);
 
1514
                        yyp = yystpcpy (yyp, yytname[yyx]);
 
1515
                        yyprefix = " or ";
 
1516
                      }
 
1517
                }
 
1518
              yyerror (yymsg);
 
1519
              YYSTACK_FREE (yymsg);
 
1520
            }
 
1521
          else
 
1522
            yyerror ("syntax error; also virtual memory exhausted");
 
1523
        }
 
1524
      else
 
1525
#endif /* YYERROR_VERBOSE */
 
1526
        yyerror ("syntax error");
 
1527
    }
 
1528
 
 
1529
 
 
1530
 
 
1531
  if (yyerrstatus == 3)
 
1532
    {
 
1533
      /* If just tried and failed to reuse look-ahead token after an
 
1534
         error, discard it.  */
 
1535
 
 
1536
      if (yychar <= YYEOF)
 
1537
        {
 
1538
          /* If at end of input, pop the error token,
 
1539
             then the rest of the stack, then return failure.  */
 
1540
          if (yychar == YYEOF)
 
1541
             for (;;)
 
1542
               {
 
1543
 
 
1544
                 YYPOPSTACK;
 
1545
                 if (yyssp == yyss)
 
1546
                   YYABORT;
 
1547
                 yydestruct ("Error: popping",
 
1548
                             yystos[*yyssp], yyvsp);
 
1549
               }
 
1550
        }
 
1551
      else
 
1552
        {
 
1553
          yydestruct ("Error: discarding", yytoken, &yylval);
 
1554
          yychar = YYEMPTY;
 
1555
        }
 
1556
    }
 
1557
 
 
1558
  /* Else will try to reuse look-ahead token after shifting the error
 
1559
     token.  */
 
1560
  goto yyerrlab1;
 
1561
 
 
1562
 
 
1563
/*---------------------------------------------------.
 
1564
| yyerrorlab -- error raised explicitly by YYERROR.  |
 
1565
`---------------------------------------------------*/
 
1566
yyerrorlab:
 
1567
 
 
1568
#ifdef __GNUC__
 
1569
  /* Pacify GCC when the user code never invokes YYERROR and the label
 
1570
     yyerrorlab therefore never appears in user code.  */
 
1571
  if (0)
 
1572
     goto yyerrorlab;
 
1573
#endif
 
1574
 
 
1575
yyvsp -= yylen;
 
1576
  yyssp -= yylen;
 
1577
  yystate = *yyssp;
 
1578
  goto yyerrlab1;
 
1579
 
 
1580
 
 
1581
/*-------------------------------------------------------------.
 
1582
| yyerrlab1 -- common code for both syntax error and YYERROR.  |
 
1583
`-------------------------------------------------------------*/
 
1584
yyerrlab1:
 
1585
  yyerrstatus = 3;      /* Each real token shifted decrements this.  */
 
1586
 
 
1587
  for (;;)
 
1588
    {
 
1589
      yyn = yypact[yystate];
 
1590
      if (yyn != YYPACT_NINF)
 
1591
        {
 
1592
          yyn += YYTERROR;
 
1593
          if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR)
 
1594
            {
 
1595
              yyn = yytable[yyn];
 
1596
              if (0 < yyn)
 
1597
                break;
 
1598
            }
 
1599
        }
 
1600
 
 
1601
      /* Pop the current state because it cannot handle the error token.  */
 
1602
      if (yyssp == yyss)
 
1603
        YYABORT;
 
1604
 
 
1605
 
 
1606
      yydestruct ("Error: popping", yystos[yystate], yyvsp);
 
1607
      YYPOPSTACK;
 
1608
      yystate = *yyssp;
 
1609
      YY_STACK_PRINT (yyss, yyssp);
 
1610
    }
 
1611
 
 
1612
  if (yyn == YYFINAL)
 
1613
    YYACCEPT;
 
1614
 
 
1615
  *++yyvsp = yylval;
 
1616
 
 
1617
 
 
1618
  /* Shift the error token. */
 
1619
  YY_SYMBOL_PRINT ("Shifting", yystos[yyn], yyvsp, yylsp);
 
1620
 
 
1621
  yystate = yyn;
 
1622
  goto yynewstate;
 
1623
 
 
1624
 
 
1625
/*-------------------------------------.
 
1626
| yyacceptlab -- YYACCEPT comes here.  |
 
1627
`-------------------------------------*/
 
1628
yyacceptlab:
 
1629
  yyresult = 0;
 
1630
  goto yyreturn;
 
1631
 
 
1632
/*-----------------------------------.
 
1633
| yyabortlab -- YYABORT comes here.  |
 
1634
`-----------------------------------*/
 
1635
yyabortlab:
 
1636
  yydestruct ("Error: discarding lookahead",
 
1637
              yytoken, &yylval);
 
1638
  yychar = YYEMPTY;
 
1639
  yyresult = 1;
 
1640
  goto yyreturn;
 
1641
 
 
1642
#ifndef yyoverflow
 
1643
/*----------------------------------------------.
 
1644
| yyoverflowlab -- parser overflow comes here.  |
 
1645
`----------------------------------------------*/
 
1646
yyoverflowlab:
 
1647
  yyerror ("parser stack overflow");
 
1648
  yyresult = 2;
 
1649
  /* Fall through.  */
 
1650
#endif
 
1651
 
 
1652
yyreturn:
 
1653
#ifndef yyoverflow
 
1654
  if (yyss != yyssa)
 
1655
    YYSTACK_FREE (yyss);
 
1656
#endif
 
1657
  return yyresult;
 
1658
}
 
1659
 
 
1660
 
 
1661
#line 309 "imap_csim.y"
 
1662
 
 
1663
 
 
1664
static void 
 
1665
csim_error(char* s)
 
1666
{
 
1667
   extern FILE *csim_in;
 
1668
   csim_restart(csim_in);
 
1669
}
 
1670
 
 
1671
gboolean
 
1672
load_csim (const char* filename)
 
1673
{
 
1674
  gboolean status;
 
1675
  extern FILE *csim_in;
 
1676
  csim_in = fopen(filename, "r");
 
1677
  if (csim_in) {
 
1678
    _map_info = get_map_info();
 
1679
    status = !csim_parse();
 
1680
    fclose(csim_in);
 
1681
  } else {
 
1682
    status = FALSE;
 
1683
  }
 
1684
  return status;
 
1685
}
 
1686