]> git.draconx.ca Git - gob-dx.git/blob - src/parse.c
Release 1.0.2
[gob-dx.git] / src / parse.c
1
2 /*  A Bison parser, made from parse.y
3     by GNU Bison version 1.28  */
4
5 #define YYBISON 1  /* Identify Bison output.  */
6
7 #define CLASS   257
8 #define FROM    258
9 #define CONST   259
10 #define VOID    260
11 #define STRUCT  261
12 #define UNION   262
13 #define ENUM    263
14 #define THREEDOTS       264
15 #define SIGNED  265
16 #define UNSIGNED        266
17 #define LONG    267
18 #define SHORT   268
19 #define INT     269
20 #define FLOAT   270
21 #define DOUBLE  271
22 #define CHAR    272
23 #define TOKEN   273
24 #define NUMBER  274
25 #define TYPETOKEN       275
26 #define ARRAY_DIM       276
27 #define CCODE   277
28 #define HTCODE  278
29 #define PHCODE  279
30 #define HCODE   280
31 #define ACODE   281
32 #define ATCODE  282
33 #define PUBLIC  283
34 #define PRIVATE 284
35 #define PROTECTED       285
36 #define CLASSWIDE       286
37 #define ARGUMENT        287
38 #define VIRTUAL 288
39 #define SIGNAL  289
40 #define OVERRIDE        290
41
42 #line 21 "parse.y"
43
44
45 #include "config.h"
46 #include <glib.h>
47 #include <stdio.h>
48 #include <stdlib.h>
49 #include <string.h>
50
51 #include "treefuncs.h"
52 #include "main.h"
53 #include "util.h"
54
55 #define _(x) (x)
56         
57 GList *nodes = NULL;
58
59 static GList *class_nodes = NULL;
60 Node *class = NULL;
61 char *chunk_size = NULL;
62
63 static GList *typestack = NULL;
64 static GList *funcargs = NULL;
65 static GList *checks = NULL;
66 static int has_self = FALSE;
67 static int vararg = FALSE;
68
69 /* destructor and initializer for variables */
70 static char *destructor = NULL;
71 static int destructor_line = 0;
72 static gboolean destructor_simple = TRUE;
73 static char *initializer = NULL;
74 static int initializer_line = 0;
75
76 static char *onerror = NULL;
77 static char *defreturn = NULL;
78
79 static GList *gtktypes = NULL;
80
81 /* this can be a global as we will only do one function at a time
82    anyway */
83 static int the_scope = NO_SCOPE;
84
85 void free(void *ptr);
86 int yylex(void);
87
88 extern int ccode_line;
89 extern int line_no;
90
91 extern char *yytext;
92
93 static void
94 yyerror(char *str)
95 {
96         char *out=NULL;
97         char *p;
98         
99         if(strcmp(yytext,"\n")==0) {
100                 out=g_strconcat("Error: ",str," before newline",NULL);
101         } else if(yytext[0]=='\0') {
102                 out=g_strconcat("Error: ", str, " at end of input", NULL);
103         } else {
104                 char *tmp = g_strdup(yytext);
105                 while((p=strchr(tmp, '\n')))
106                         *p='.';
107
108                 out=g_strconcat("Error: ", str, " before '", tmp, "'", NULL);
109                 g_free(tmp);
110         }
111
112         fprintf(stderr, "%s:%d: %s\n", filename, line_no, out);
113         g_free(out);
114         
115         exit(1);
116 }
117
118 static Type *
119 pop_type(void)
120 {
121         Type *type = typestack->data;
122         typestack = g_list_remove(typestack,typestack->data);
123         return type;
124 }
125
126 static void
127 push_variable(char *name, int scope, int line_no, char *postfix)
128 {
129         Node *var;
130         Type *type = pop_type();
131
132         type->postfix = postfix;
133         
134         var = new_variable(scope, type, name, line_no,
135                            destructor, destructor_line,
136                            destructor_simple,
137                            initializer, initializer_line);
138         class_nodes = g_list_append(class_nodes, var);
139 }
140
141 static void
142 push_function(int scope, int method, char *oid, char *id,
143               GString *cbuf, int line_no, int ccode_line,
144               gboolean vararg, GList *flags)
145 {
146         Node *node;
147         Type *type;
148         char *c_cbuf;
149
150         g_assert(scope != CLASS_SCOPE);
151        
152         if(method == INIT_METHOD || method == CLASS_INIT_METHOD) {
153                 type = (Type *)new_type(g_strdup("void"), NULL, NULL);
154         } else {
155                 type = pop_type();
156         }
157         
158         /* a complicated and ugly test to figure out if we have
159            the wrong number of types for a signal */
160         if((method == SIGNAL_FIRST_METHOD ||
161             method == SIGNAL_LAST_METHOD) &&
162            g_list_length(gtktypes) != g_list_length(funcargs) &&
163            !(g_list_length(funcargs) == 1 &&
164              g_list_length(gtktypes) == 2 &&
165              strcmp(gtktypes->next->data, "NONE")==0)) {
166                 print_error(TRUE, _("The number of GTK arguments and "
167                                     "function arguments for a signal "
168                                     "don't seem to match"), line_no);
169         }
170         if(g_list_length(gtktypes) > 2) {
171                 GList *li;
172                 for(li = gtktypes->next; li; li = li->next) {
173                         if(strcmp(li->data, "NONE")==0) {
174                                 print_error(FALSE,
175                                             _("NONE can only appear in an "
176                                               "argument list by itself"),
177                                             line_no);
178                         }
179                 }
180         }
181         if(cbuf) {
182                 char *p;
183                 c_cbuf = p = cbuf->str;
184                 while(p && *p && (*p==' ' || *p=='\t' || *p=='\n' || *p=='\r'))
185                         p++;
186                 if(!p || !*p)
187                         c_cbuf = NULL;
188         } else
189                 c_cbuf = NULL;
190
191         node = new_method(scope, method, type, oid, gtktypes, flags,
192                           id, funcargs, onerror, defreturn, c_cbuf, line_no,
193                           ccode_line, vararg, method_unique_id++);
194
195         if(cbuf)
196                 g_string_free(cbuf,
197                               /*only free segment if we haven't passed it
198                                 above */
199                               c_cbuf?FALSE:TRUE);
200         gtktypes = NULL;
201         funcargs = NULL;
202
203         onerror = NULL;
204         defreturn = NULL;
205
206         class_nodes = g_list_append(class_nodes, node);
207 }
208
209 static void
210 free_all_global_state(void)
211 {
212         g_free(onerror);
213         onerror = NULL;
214         g_free(defreturn);
215         defreturn = NULL;
216
217         g_free(chunk_size);
218         chunk_size = NULL;
219         
220         g_list_foreach(gtktypes, (GFunc)g_free, NULL);
221         g_list_free(gtktypes);
222         gtktypes = NULL;
223
224         free_node_list(funcargs);
225         funcargs = NULL;
226 }
227
228 static void
229 push_funcarg(char *name, char *postfix)
230 {
231         Node *node;
232         Type *type = pop_type();
233
234         type->postfix = postfix;
235         
236         node = new_funcarg(type, name, checks);
237         checks = NULL;
238         
239         funcargs = g_list_append(funcargs, node);
240 }
241
242 static void
243 push_init_arg(char *name, int is_class)
244 {
245         Node *node;
246         Node *type;
247         char *tn;
248         
249         if(is_class)
250                 tn = g_strconcat(((Class *)class)->otype,":Class",NULL);
251         else
252                 tn = g_strdup(((Class *)class)->otype);
253
254         type = new_type(tn, g_strdup("*"), NULL);
255         node = new_funcarg((Type *)type,name,NULL);
256         funcargs = g_list_prepend(funcargs, node);
257 }
258
259 static void
260 push_self(char *id)
261 {
262         Node *node;
263         Node *type;
264         GList *ch = NULL;
265         type = new_type(g_strdup(((Class *)class)->otype), g_strdup("*"), NULL);
266         ch = g_list_append(ch,new_check(NULL_CHECK,NULL));
267         ch = g_list_append(ch,new_check(TYPE_CHECK,NULL));
268         node = new_funcarg((Type *)type,id,ch);
269         funcargs = g_list_prepend(funcargs, node);
270 }
271
272 static Variable *
273 find_var_or_die(const char *id, int line)
274 {
275         GList *li;
276         char *s;
277
278         for(li = class_nodes; li != NULL; li = li->next) {
279                 Variable *var;
280                 Node *node = li->data;
281                 if(node->type != VARIABLE_NODE)
282                         continue;
283                 var = li->data;
284                 if(strcmp(var->id, id)==0)
285                         return var;
286         }
287
288         s = g_strdup_printf(_("Variable %s not defined here"), id);
289         print_error(FALSE, s, line);
290
291         g_assert_not_reached();
292         return NULL;
293 }
294
295 static gboolean
296 set_return_value(char *type, char *val)
297 {
298         if(strcmp(type, "onerror")==0) {
299                 if(!onerror) {
300                         onerror = val;
301                         return TRUE;
302                 } else
303                         return FALSE;
304         } else if(strcmp(type, "defreturn")==0) {
305                 if(!defreturn) {
306                         defreturn = val;
307                         return TRUE;
308                 } else
309                         return FALSE;
310         }
311         return FALSE;
312 }
313
314
315 #line 294 "parse.y"
316 typedef union {
317         char *id;
318         GString *cbuf;
319         GList *list;
320         int line;
321         int sigtype;
322 } YYSTYPE;
323 #ifndef YYDEBUG
324 #define YYDEBUG 1
325 #endif
326
327 #include <stdio.h>
328
329 #ifndef __cplusplus
330 #ifndef __STDC__
331 #define const
332 #endif
333 #endif
334
335
336
337 #define YYFINAL         256
338 #define YYFLAG          -32768
339 #define YYNTBASE        50
340
341 #define YYTRANSLATE(x) ((unsigned)(x) <= 290 ? yytranslate[x] : 88)
342
343 static const char yytranslate[] = {     0,
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,    48,     2,     2,     2,     2,     2,     2,    39,
348     40,    44,     2,    45,    49,     2,     2,     2,     2,     2,
349      2,     2,     2,     2,     2,     2,     2,     2,    41,    47,
350     42,    46,     2,     2,     2,     2,     2,     2,     2,     2,
351      2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
352      2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
353      2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
354      2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
355      2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
356      2,     2,    37,    43,    38,     2,     2,     2,     2,     2,
357      2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
358      2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
359      2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
360      2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
361      2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
362      2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
363      2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
364      2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
365      2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
366      2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
367      2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
368      2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
369      2,     2,     2,     2,     2,     1,     3,     4,     5,     6,
370      7,     8,     9,    10,    11,    12,    13,    14,    15,    16,
371     17,    18,    19,    20,    21,    22,    23,    24,    25,    26,
372     27,    28,    29,    30,    31,    32,    33,    34,    35,    36
373 };
374
375 #if YYDEBUG != 0
376 static const short yyprhs[] = {     0,
377      0,     4,     7,    10,    12,    14,    16,    18,    20,    22,
378     24,    27,    29,    34,    38,    44,    45,    50,    55,    58,
379     60,    62,    64,    66,    68,    70,    72,    74,    76,    79,
380     83,    86,    90,    93,    96,    98,   100,   101,   107,   114,
381    126,   135,   141,   147,   149,   153,   154,   158,   160,   163,
382    165,   167,   169,   172,   175,   178,   182,   186,   189,   192,
383    195,   197,   200,   202,   205,   207,   209,   211,   213,   215,
384    217,   219,   221,   223,   225,   227,   229,   231,   234,   237,
385    241,   244,   246,   250,   254,   257,   259,   264,   268,   270,
386    273,   275,   286,   298,   308,   318,   327,   339,   348,   354,
387    357,   362,   363,   365,   368,   370,   372,   376,   378,   382,
388    384,   388,   390,   393,   397,   404,   412,   415,   417,   419,
389    422,   425,   429,   433,   437,   441,   443,   446
390 };
391
392 static const short yyrhs[] = {    52,
393     53,    52,     0,    53,    52,     0,    52,    53,     0,    53,
394      0,    23,     0,    26,     0,    24,     0,    25,     0,    27,
395      0,    28,     0,    52,    51,     0,    51,     0,    54,    37,
396     56,    38,     0,    54,    37,    38,     0,     3,    21,     4,
397     21,    55,     0,     0,    39,    19,    19,    40,     0,    39,
398     19,    20,    40,     0,    56,    57,     0,    57,     0,    78,
399      0,    62,     0,    63,     0,    41,     0,    29,     0,    30,
400      0,    31,     0,    32,     0,    19,    19,     0,    19,    37,
401     23,     0,    42,    87,     0,    42,    37,    23,     0,    59,
402     60,     0,    60,    59,     0,    60,     0,    59,     0,     0,
403     58,    67,    19,    61,    41,     0,    58,    67,    19,    22,
404     61,    41,     0,    33,    65,    64,    19,    19,    37,    23,
405     19,    37,    23,    41,     0,    33,    65,    64,    19,    19,
406     37,    23,    41,     0,    33,    65,    64,    19,    19,     0,
407     19,    39,    19,    67,    40,     0,    19,     0,    39,    66,
408     40,     0,     0,    19,    43,    66,     0,    19,     0,    68,
409     72,     0,    68,     0,    69,     0,    19,     0,     5,    19,
410      0,    19,     5,     0,    71,    19,     0,     5,    71,    19,
411      0,    71,    19,     5,     0,    70,    69,     0,    21,    69,
412      0,     5,    69,     0,    21,     0,    21,     5,     0,    70,
413      0,    70,     5,     0,     6,     0,    18,     0,    14,     0,
414     15,     0,    13,     0,    16,     0,    17,     0,    11,     0,
415     12,     0,     7,     0,     8,     0,     9,     0,    44,     0,
416     44,     5,     0,    44,    72,     0,    44,     5,    72,     0,
417     19,    75,     0,    75,     0,    58,    19,    75,     0,    19,
418     58,    75,     0,    58,    75,     0,    73,     0,    19,    39,
419     76,    40,     0,    76,    45,    19,     0,    19,     0,    37,
420     23,     0,    41,     0,    35,    65,    74,    67,    19,    39,
421     81,    40,    79,    77,     0,    58,    35,    65,    73,    67,
422     19,    39,    81,    40,    79,    77,     0,    34,    58,    67,
423     19,    39,    81,    40,    79,    77,     0,    58,    34,    67,
424     19,    39,    81,    40,    79,    77,     0,    34,    67,    19,
425     39,    81,    40,    79,    77,     0,    36,    39,    21,    40,
426     67,    19,    39,    81,    40,    79,    77,     0,    58,    67,
427     19,    39,    81,    40,    79,    77,     0,    19,    39,    19,
428     40,    77,     0,    19,    80,     0,    19,    80,    19,    80,
429      0,     0,    87,     0,    37,    23,     0,     6,     0,    19,
430      0,    19,    45,    82,     0,    82,     0,    83,    45,    10,
431      0,    83,     0,    83,    45,    84,     0,    84,     0,    67,
432     19,     0,    67,    19,    22,     0,    67,    19,    39,    19,
433     85,    40,     0,    67,    19,    22,    39,    19,    85,    40,
434      0,    85,    86,     0,    86,     0,    19,     0,    46,    87,
435      0,    47,    87,     0,    46,    42,    87,     0,    47,    42,
436     87,     0,    42,    42,    87,     0,    48,    42,    87,     0,
437     20,     0,    49,    20,     0,    19,     0
438 };
439
440 #endif
441
442 #if YYDEBUG != 0
443 static const short yyrline[] = { 0,
444    312,   313,   314,   315,   318,   324,   330,   336,   342,   348,
445    356,   357,   360,   365,   372,   377,   378,   386,   397,   398,
446    401,   402,   403,   404,   407,   408,   409,   410,   413,   426,
447    442,   446,   454,   455,   456,   457,   458,   464,   467,   471,
448    506,   534,   604,   613,   619,   620,   623,   626,   632,   636,
449    643,   646,   649,   653,   657,   661,   666,   674,   678,   683,
450    687,   690,   694,   697,   702,   703,   704,   705,   706,   707,
451    708,   709,   710,   713,   714,   715,   718,   719,   720,   724,
452    731,   743,   749,   761,   773,   776,   782,   787,   790,   795,
453    796,   800,   816,   832,   848,   864,   875,   881,   891,   914,
454    925,   944,   950,   951,   957,   958,   969,   979,   982,   983,
455    986,   987,   990,   993,   996,  1004,  1014,  1015,  1018,  1031,
456   1035,  1039,  1043,  1047,  1051,  1057,  1058,  1062
457 };
458 #endif
459
460
461 #if YYDEBUG != 0 || defined (YYERROR_VERBOSE)
462
463 static const char * const yytname[] = {   "$","error","$undefined.","CLASS",
464 "FROM","CONST","VOID","STRUCT","UNION","ENUM","THREEDOTS","SIGNED","UNSIGNED",
465 "LONG","SHORT","INT","FLOAT","DOUBLE","CHAR","TOKEN","NUMBER","TYPETOKEN","ARRAY_DIM",
466 "CCODE","HTCODE","PHCODE","HCODE","ACODE","ATCODE","PUBLIC","PRIVATE","PROTECTED",
467 "CLASSWIDE","ARGUMENT","VIRTUAL","SIGNAL","OVERRIDE","'{'","'}'","'('","')'",
468 "';'","'='","'|'","'*'","','","'>'","'<'","'!'","'-'","prog","ccode","ccodes",
469 "class","classdec","chunk","classcode","thing","scope","destructor","initializer",
470 "varoptions","variable","argument","argtype","flags","flaglist","type","specifier_list",
471 "spec_list","specifier","strunionenum","pointer","simplesigtype","fullsigtype",
472 "sigtype","tokenlist","codenocode","method","returnvals","retcode","funcargs",
473 "arglist","arglist1","arg","checklist","check","numtok", NULL
474 };
475 #endif
476
477 static const short yyr1[] = {     0,
478     50,    50,    50,    50,    51,    51,    51,    51,    51,    51,
479     52,    52,    53,    53,    54,    55,    55,    55,    56,    56,
480     57,    57,    57,    57,    58,    58,    58,    58,    59,    59,
481     60,    60,    61,    61,    61,    61,    61,    62,    62,    63,
482     63,    63,    64,    64,    65,    65,    66,    66,    67,    67,
483     68,    68,    68,    68,    68,    68,    68,    69,    69,    69,
484     69,    69,    69,    69,    70,    70,    70,    70,    70,    70,
485     70,    70,    70,    71,    71,    71,    72,    72,    72,    72,
486     73,    73,    74,    74,    74,    74,    75,    76,    76,    77,
487     77,    78,    78,    78,    78,    78,    78,    78,    78,    79,
488     79,    79,    80,    80,    81,    81,    81,    81,    82,    82,
489     83,    83,    84,    84,    84,    84,    85,    85,    86,    86,
490     86,    86,    86,    86,    86,    87,    87,    87
491 };
492
493 static const short yyr2[] = {     0,
494      3,     2,     2,     1,     1,     1,     1,     1,     1,     1,
495      2,     1,     4,     3,     5,     0,     4,     4,     2,     1,
496      1,     1,     1,     1,     1,     1,     1,     1,     2,     3,
497      2,     3,     2,     2,     1,     1,     0,     5,     6,    11,
498      8,     5,     5,     1,     3,     0,     3,     1,     2,     1,
499      1,     1,     2,     2,     2,     3,     3,     2,     2,     2,
500      1,     2,     1,     2,     1,     1,     1,     1,     1,     1,
501      1,     1,     1,     1,     1,     1,     1,     2,     2,     3,
502      2,     1,     3,     3,     2,     1,     4,     3,     1,     2,
503      1,    10,    11,     9,     9,     8,    11,     8,     5,     2,
504      4,     0,     1,     2,     1,     1,     3,     1,     3,     1,
505      3,     1,     2,     3,     6,     7,     2,     1,     1,     2,
506      2,     3,     3,     3,     3,     1,     2,     1
507 };
508
509 static const short yydefact[] = {     0,
510      0,     5,     7,     8,     6,     9,    10,    12,     0,     4,
511      0,     0,    11,     3,     2,     0,     0,     1,     0,    25,
512     26,    27,    28,    46,     0,    46,     0,    14,    24,     0,
513     20,     0,    22,    23,    21,    16,     0,     0,     0,     0,
514     65,    74,    75,    76,    72,    73,    69,    67,    68,    70,
515     71,    66,    52,    61,     0,     0,    50,    51,    63,     0,
516      0,     0,    13,    19,     0,    46,     0,     0,    15,     0,
517     48,     0,    44,     0,     0,    53,    60,     0,    54,    62,
518     59,     0,     0,    77,    49,    64,    58,    55,     0,     0,
519     86,     0,    82,     0,     0,     0,    37,     0,     0,     0,
520     45,     0,     0,    56,     0,     0,    78,    79,    57,     0,
521      0,     0,    81,     0,    85,     0,     0,     0,     0,     0,
522      0,    37,     0,     0,    36,    35,     0,     0,     0,     0,
523     91,    99,    47,     0,    42,     0,    65,    52,     0,     0,
524    108,   110,   112,    80,    89,     0,    84,    83,     0,     0,
525      0,     0,    29,     0,     0,     0,   128,   126,     0,     0,
526     31,    33,    34,    38,    17,    18,    90,     0,     0,     0,
527      0,   113,   102,     0,    87,     0,     0,     0,     0,     0,
528     30,    39,   102,    32,   127,    43,     0,   102,   107,   114,
529      0,     0,     0,   109,   111,    88,     0,     0,   102,     0,
530      0,     0,    41,     0,     0,     0,     0,   100,   103,    96,
531    102,     0,     0,     0,    98,     0,    94,     0,   119,     0,
532      0,     0,     0,     0,   118,   104,     0,     0,   102,    95,
533    102,     0,     0,     0,     0,   120,     0,   121,     0,   115,
534    117,   101,    92,     0,     0,    40,   116,   124,   122,   123,
535    125,    97,    93,     0,     0,     0
536 };
537
538 static const short yydefgoto[] = {   254,
539      8,     9,    10,    11,    69,    30,    31,    32,   125,   126,
540    127,    33,    34,    74,    39,    72,   139,    57,    58,    59,
541     60,    85,    91,    92,    93,   146,   132,    35,   193,   208,
542    140,   141,   142,   143,   224,   225,   209
543 };
544
545 static const short yypact[] = {   174,
546     -1,-32768,-32768,-32768,-32768,-32768,-32768,-32768,   174,   221,
547    -14,    38,-32768,   221,   221,   175,    23,   221,    29,-32768,
548 -32768,-32768,-32768,    39,   157,    39,    41,-32768,-32768,   193,
549 -32768,   112,-32768,-32768,-32768,    57,    72,    81,    84,   263,
550 -32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,
551 -32768,-32768,    99,   314,   280,    89,    90,-32768,   328,   117,
552    161,   116,-32768,-32768,   280,    39,   119,   123,-32768,   104,
553    105,   114,   118,   133,   342,-32768,-32768,   137,-32768,   342,
554 -32768,   139,   128,     5,-32768,   342,-32768,   176,   211,   160,
555 -32768,   280,-32768,   142,   164,   165,    67,     6,    17,    81,
556 -32768,   166,   177,-32768,   156,   297,    90,-32768,-32768,   178,
557    184,   195,-32768,    31,-32768,   196,   280,   179,    31,   280,
558     -2,   -15,   297,    44,   190,   200,   180,   197,   198,   210,
559 -32768,-32768,-32768,   280,   183,   297,   199,     3,   216,   226,
560 -32768,   191,-32768,-32768,-32768,    42,-32768,-32768,   234,   264,
561    297,   271,-32768,   277,   266,   281,-32768,-32768,   294,   302,
562 -32768,-32768,-32768,-32768,-32768,-32768,-32768,   283,   301,   296,
563    280,    51,   318,   246,-32768,   319,   297,   311,   312,   322,
564 -32768,-32768,   318,-32768,-32768,-32768,    -3,   318,-32768,   323,
565    332,    46,    17,-32768,-32768,-32768,   324,   297,   318,   297,
566     17,   329,-32768,    17,   346,    93,   344,   349,-32768,-32768,
567    318,   330,    17,   331,-32768,   350,-32768,    93,-32768,   327,
568     52,    65,   333,   103,-32768,-32768,    46,    17,   318,-32768,
569    318,   335,   113,    56,    56,-32768,    56,-32768,    56,-32768,
570 -32768,-32768,-32768,    17,    17,-32768,-32768,-32768,-32768,-32768,
571 -32768,-32768,-32768,   372,   374,-32768
572 };
573
574 static const short yypgoto[] = {-32768,
575     13,    78,   368,-32768,-32768,-32768,   348,   -22,   253,   255,
576    259,-32768,-32768,-32768,   -20,   282,   -18,-32768,   -35,-32768,
577    343,   -73,   288,-32768,   -57,-32768,  -192,-32768,  -170,   158,
578   -121,   215,-32768,   213,   170,  -164,  -124
579 };
580
581
582 #define YYLAST          388
583
584
585 static const short yytable[] = {   161,
586    210,   156,    55,   121,    77,    61,    56,    79,   215,   107,
587    108,   217,   201,    67,   170,   202,   153,   204,    81,    12,
588    230,    13,    16,    87,   128,   129,   124,    13,   213,   179,
589     13,   113,   115,   144,   154,   243,    82,   203,    90,    77,
590    228,    17,  -106,    36,    77,    96,    95,   171,    84,   110,
591     77,   252,   253,   130,   147,   197,   148,   131,   244,   241,
592    245,   113,   157,   158,   157,   158,   112,    37,   241,   111,
593    157,   158,   190,   116,   157,   158,   212,    38,   214,    62,
594    159,   175,   207,   157,   158,   121,   176,    15,   122,   191,
595     70,    18,   160,   235,   160,    68,   236,   238,   150,    71,
596    160,   152,    73,    79,   160,   123,   237,    83,   124,   248,
597    249,   219,   250,   160,   251,   168,    40,    41,    42,    43,
598     44,   219,    45,    46,    47,    48,    49,    50,    51,    52,
599     53,   219,    54,    84,   220,    88,    94,    97,   221,   222,
600    223,    98,   240,    99,   220,    65,    66,   100,   221,   222,
601    223,   103,   247,   101,   220,   104,   102,   105,   221,   222,
602    223,    40,    41,    42,    43,    44,   106,    45,    46,    47,
603     48,    49,    50,    51,    52,    53,     1,    54,   114,    89,
604    109,   117,   118,   119,   134,    20,    21,    22,    23,    20,
605     21,    22,    23,    19,   136,   135,     2,     3,     4,     5,
606      6,     7,   145,    20,    21,    22,    23,    24,    25,    26,
607     27,    19,    28,   110,   149,    29,   111,   151,   121,   169,
608    164,    20,    21,    22,    23,    24,    25,    26,    27,   110,
609     63,   124,   167,    29,   172,   174,   165,   166,  -105,    20,
610     21,    22,    23,     2,     3,     4,     5,     6,     7,   111,
611     40,    41,    42,    43,    44,   194,    45,    46,    47,    48,
612     49,    50,    51,    52,    53,   173,    54,    75,    41,    42,
613     43,    44,   177,    45,    46,    47,    48,    49,    50,    51,
614     52,    76,   178,    54,    40,    41,    42,    43,    44,   180,
615     45,    46,    47,    48,    49,    50,    51,    52,    53,   181,
616     54,    40,   137,    42,    43,    44,   182,    45,    46,    47,
617     48,    49,    50,    51,    52,   138,   184,    54,    80,    41,
618    183,   185,   186,   187,    45,    46,    47,    48,    49,    50,
619     51,    52,    86,    41,    54,   188,   192,   196,    45,    46,
620     47,    48,    49,    50,    51,    52,    75,    41,    54,   198,
621    206,   199,    45,    46,    47,    48,    49,    50,    51,    52,
622    200,   205,    54,   211,   218,   216,   226,   227,   234,   229,
623    231,   255,   232,   256,   239,   246,    14,    64,   163,   162,
624    155,   133,    78,   120,   242,   189,   195,   233
625 };
626
627 static const short yycheck[] = {   124,
628    193,   123,    25,    19,    40,    26,    25,     5,   201,     5,
629     84,   204,   183,    32,   136,    19,    19,   188,    54,    21,
630    213,     9,    37,    59,    19,    20,    42,    15,   199,   151,
631     18,    89,    90,   107,    37,   228,    55,    41,    61,    75,
632    211,     4,    40,    21,    80,    66,    65,    45,    44,    19,
633     86,   244,   245,    37,   112,   177,   114,    41,   229,   224,
634    231,   119,    19,    20,    19,    20,    89,    39,   233,    39,
635     19,    20,    22,    92,    19,    20,   198,    39,   200,    39,
636     37,    40,    37,    19,    20,    19,    45,    10,    22,    39,
637     19,    14,    49,    42,    49,    39,   221,   222,   117,    19,
638     49,   120,    19,     5,    49,    39,    42,    19,    42,   234,
639    235,    19,   237,    49,   239,   134,     5,     6,     7,     8,
640      9,    19,    11,    12,    13,    14,    15,    16,    17,    18,
641     19,    19,    21,    44,    42,    19,    21,    19,    46,    47,
642     48,    19,    40,    40,    42,    34,    35,    43,    46,    47,
643     48,    19,    40,    40,    42,    19,    39,    19,    46,    47,
644     48,     5,     6,     7,     8,     9,    39,    11,    12,    13,
645     14,    15,    16,    17,    18,    19,     3,    21,    19,    19,
646      5,    40,    19,    19,    19,    29,    30,    31,    32,    29,
647     30,    31,    32,    19,    39,    19,    23,    24,    25,    26,
648     27,    28,    19,    29,    30,    31,    32,    33,    34,    35,
649     36,    19,    38,    19,    19,    41,    39,    39,    19,    37,
650     41,    29,    30,    31,    32,    33,    34,    35,    36,    19,
651     38,    42,    23,    41,    19,    45,    40,    40,    40,    29,
652     30,    31,    32,    23,    24,    25,    26,    27,    28,    39,
653      5,     6,     7,     8,     9,    10,    11,    12,    13,    14,
654     15,    16,    17,    18,    19,    40,    21,     5,     6,     7,
655      8,     9,    39,    11,    12,    13,    14,    15,    16,    17,
656     18,    19,    19,    21,     5,     6,     7,     8,     9,    19,
657     11,    12,    13,    14,    15,    16,    17,    18,    19,    23,
658     21,     5,     6,     7,     8,     9,    41,    11,    12,    13,
659     14,    15,    16,    17,    18,    19,    23,    21,     5,     6,
660     40,    20,    40,    23,    11,    12,    13,    14,    15,    16,
661     17,    18,     5,     6,    21,    40,    19,    19,    11,    12,
662     13,    14,    15,    16,    17,    18,     5,     6,    21,    39,
663     19,    40,    11,    12,    13,    14,    15,    16,    17,    18,
664     39,    39,    21,    40,    19,    37,    23,    19,    42,    40,
665     40,     0,    23,     0,    42,    41,     9,    30,   126,   125,
666    122,   100,    40,    96,   227,   171,   174,   218
667 };
668 /* -*-C-*-  Note some compilers choke on comments on `#line' lines.  */
669 #line 3 "/usr/lib/bison.simple"
670 /* This file comes from bison-1.28.  */
671
672 /* Skeleton output parser for bison,
673    Copyright (C) 1984, 1989, 1990 Free Software Foundation, Inc.
674
675    This program is free software; you can redistribute it and/or modify
676    it under the terms of the GNU General Public License as published by
677    the Free Software Foundation; either version 2, or (at your option)
678    any later version.
679
680    This program is distributed in the hope that it will be useful,
681    but WITHOUT ANY WARRANTY; without even the implied warranty of
682    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
683    GNU General Public License for more details.
684
685    You should have received a copy of the GNU General Public License
686    along with this program; if not, write to the Free Software
687    Foundation, Inc., 59 Temple Place - Suite 330,
688    Boston, MA 02111-1307, USA.  */
689
690 /* As a special exception, when this file is copied by Bison into a
691    Bison output file, you may use that output file without restriction.
692    This special exception was added by the Free Software Foundation
693    in version 1.24 of Bison.  */
694
695 /* This is the parser code that is written into each bison parser
696   when the %semantic_parser declaration is not specified in the grammar.
697   It was written by Richard Stallman by simplifying the hairy parser
698   used when %semantic_parser is specified.  */
699
700 #ifndef YYSTACK_USE_ALLOCA
701 #ifdef alloca
702 #define YYSTACK_USE_ALLOCA
703 #else /* alloca not defined */
704 #ifdef __GNUC__
705 #define YYSTACK_USE_ALLOCA
706 #define alloca __builtin_alloca
707 #else /* not GNU C.  */
708 #if (!defined (__STDC__) && defined (sparc)) || defined (__sparc__) || defined (__sparc) || defined (__sgi) || (defined (__sun) && defined (__i386))
709 #define YYSTACK_USE_ALLOCA
710 #include <alloca.h>
711 #else /* not sparc */
712 /* We think this test detects Watcom and Microsoft C.  */
713 /* This used to test MSDOS, but that is a bad idea
714    since that symbol is in the user namespace.  */
715 #if (defined (_MSDOS) || defined (_MSDOS_)) && !defined (__TURBOC__)
716 #if 0 /* No need for malloc.h, which pollutes the namespace;
717          instead, just don't use alloca.  */
718 #include <malloc.h>
719 #endif
720 #else /* not MSDOS, or __TURBOC__ */
721 #if defined(_AIX)
722 /* I don't know what this was needed for, but it pollutes the namespace.
723    So I turned it off.   rms, 2 May 1997.  */
724 /* #include <malloc.h>  */
725  #pragma alloca
726 #define YYSTACK_USE_ALLOCA
727 #else /* not MSDOS, or __TURBOC__, or _AIX */
728 #if 0
729 #ifdef __hpux /* haible@ilog.fr says this works for HPUX 9.05 and up,
730                  and on HPUX 10.  Eventually we can turn this on.  */
731 #define YYSTACK_USE_ALLOCA
732 #define alloca __builtin_alloca
733 #endif /* __hpux */
734 #endif
735 #endif /* not _AIX */
736 #endif /* not MSDOS, or __TURBOC__ */
737 #endif /* not sparc */
738 #endif /* not GNU C */
739 #endif /* alloca not defined */
740 #endif /* YYSTACK_USE_ALLOCA not defined */
741
742 #ifdef YYSTACK_USE_ALLOCA
743 #define YYSTACK_ALLOC alloca
744 #else
745 #define YYSTACK_ALLOC malloc
746 #endif
747
748 /* Note: there must be only one dollar sign in this file.
749    It is replaced by the list of actions, each action
750    as one case of the switch.  */
751
752 #define yyerrok         (yyerrstatus = 0)
753 #define yyclearin       (yychar = YYEMPTY)
754 #define YYEMPTY         -2
755 #define YYEOF           0
756 #define YYACCEPT        goto yyacceptlab
757 #define YYABORT         goto yyabortlab
758 #define YYERROR         goto yyerrlab1
759 /* Like YYERROR except do call yyerror.
760    This remains here temporarily to ease the
761    transition to the new meaning of YYERROR, for GCC.
762    Once GCC version 2 has supplanted version 1, this can go.  */
763 #define YYFAIL          goto yyerrlab
764 #define YYRECOVERING()  (!!yyerrstatus)
765 #define YYBACKUP(token, value) \
766 do                                                              \
767   if (yychar == YYEMPTY && yylen == 1)                          \
768     { yychar = (token), yylval = (value);                       \
769       yychar1 = YYTRANSLATE (yychar);                           \
770       YYPOPSTACK;                                               \
771       goto yybackup;                                            \
772     }                                                           \
773   else                                                          \
774     { yyerror ("syntax error: cannot back up"); YYERROR; }      \
775 while (0)
776
777 #define YYTERROR        1
778 #define YYERRCODE       256
779
780 #ifndef YYPURE
781 #define YYLEX           yylex()
782 #endif
783
784 #ifdef YYPURE
785 #ifdef YYLSP_NEEDED
786 #ifdef YYLEX_PARAM
787 #define YYLEX           yylex(&yylval, &yylloc, YYLEX_PARAM)
788 #else
789 #define YYLEX           yylex(&yylval, &yylloc)
790 #endif
791 #else /* not YYLSP_NEEDED */
792 #ifdef YYLEX_PARAM
793 #define YYLEX           yylex(&yylval, YYLEX_PARAM)
794 #else
795 #define YYLEX           yylex(&yylval)
796 #endif
797 #endif /* not YYLSP_NEEDED */
798 #endif
799
800 /* If nonreentrant, generate the variables here */
801
802 #ifndef YYPURE
803
804 int     yychar;                 /*  the lookahead symbol                */
805 YYSTYPE yylval;                 /*  the semantic value of the           */
806                                 /*  lookahead symbol                    */
807
808 #ifdef YYLSP_NEEDED
809 YYLTYPE yylloc;                 /*  location data for the lookahead     */
810                                 /*  symbol                              */
811 #endif
812
813 int yynerrs;                    /*  number of parse errors so far       */
814 #endif  /* not YYPURE */
815
816 #if YYDEBUG != 0
817 int yydebug;                    /*  nonzero means print parse trace     */
818 /* Since this is uninitialized, it does not stop multiple parsers
819    from coexisting.  */
820 #endif
821
822 /*  YYINITDEPTH indicates the initial size of the parser's stacks       */
823
824 #ifndef YYINITDEPTH
825 #define YYINITDEPTH 200
826 #endif
827
828 /*  YYMAXDEPTH is the maximum size the stacks can grow to
829     (effective only if the built-in stack extension method is used).  */
830
831 #if YYMAXDEPTH == 0
832 #undef YYMAXDEPTH
833 #endif
834
835 #ifndef YYMAXDEPTH
836 #define YYMAXDEPTH 10000
837 #endif
838 \f
839 /* Define __yy_memcpy.  Note that the size argument
840    should be passed with type unsigned int, because that is what the non-GCC
841    definitions require.  With GCC, __builtin_memcpy takes an arg
842    of type size_t, but it can handle unsigned int.  */
843
844 #if __GNUC__ > 1                /* GNU C and GNU C++ define this.  */
845 #define __yy_memcpy(TO,FROM,COUNT)      __builtin_memcpy(TO,FROM,COUNT)
846 #else                           /* not GNU C or C++ */
847 #ifndef __cplusplus
848
849 /* This is the most reliable way to avoid incompatibilities
850    in available built-in functions on various systems.  */
851 static void
852 __yy_memcpy (to, from, count)
853      char *to;
854      char *from;
855      unsigned int count;
856 {
857   register char *f = from;
858   register char *t = to;
859   register int i = count;
860
861   while (i-- > 0)
862     *t++ = *f++;
863 }
864
865 #else /* __cplusplus */
866
867 /* This is the most reliable way to avoid incompatibilities
868    in available built-in functions on various systems.  */
869 static void
870 __yy_memcpy (char *to, char *from, unsigned int count)
871 {
872   register char *t = to;
873   register char *f = from;
874   register int i = count;
875
876   while (i-- > 0)
877     *t++ = *f++;
878 }
879
880 #endif
881 #endif
882 \f
883 #line 217 "/usr/lib/bison.simple"
884
885 /* The user can define YYPARSE_PARAM as the name of an argument to be passed
886    into yyparse.  The argument should have type void *.
887    It should actually point to an object.
888    Grammar actions can access the variable by casting it
889    to the proper pointer type.  */
890
891 #ifdef YYPARSE_PARAM
892 #ifdef __cplusplus
893 #define YYPARSE_PARAM_ARG void *YYPARSE_PARAM
894 #define YYPARSE_PARAM_DECL
895 #else /* not __cplusplus */
896 #define YYPARSE_PARAM_ARG YYPARSE_PARAM
897 #define YYPARSE_PARAM_DECL void *YYPARSE_PARAM;
898 #endif /* not __cplusplus */
899 #else /* not YYPARSE_PARAM */
900 #define YYPARSE_PARAM_ARG
901 #define YYPARSE_PARAM_DECL
902 #endif /* not YYPARSE_PARAM */
903
904 /* Prevent warning if -Wstrict-prototypes.  */
905 #ifdef __GNUC__
906 #ifdef YYPARSE_PARAM
907 int yyparse (void *);
908 #else
909 int yyparse (void);
910 #endif
911 #endif
912
913 int
914 yyparse(YYPARSE_PARAM_ARG)
915      YYPARSE_PARAM_DECL
916 {
917   register int yystate;
918   register int yyn;
919   register short *yyssp;
920   register YYSTYPE *yyvsp;
921   int yyerrstatus;      /*  number of tokens to shift before error messages enabled */
922   int yychar1 = 0;              /*  lookahead token as an internal (translated) token number */
923
924   short yyssa[YYINITDEPTH];     /*  the state stack                     */
925   YYSTYPE yyvsa[YYINITDEPTH];   /*  the semantic value stack            */
926
927   short *yyss = yyssa;          /*  refer to the stacks thru separate pointers */
928   YYSTYPE *yyvs = yyvsa;        /*  to allow yyoverflow to reallocate them elsewhere */
929
930 #ifdef YYLSP_NEEDED
931   YYLTYPE yylsa[YYINITDEPTH];   /*  the location stack                  */
932   YYLTYPE *yyls = yylsa;
933   YYLTYPE *yylsp;
934
935 #define YYPOPSTACK   (yyvsp--, yyssp--, yylsp--)
936 #else
937 #define YYPOPSTACK   (yyvsp--, yyssp--)
938 #endif
939
940   int yystacksize = YYINITDEPTH;
941   int yyfree_stacks = 0;
942
943 #ifdef YYPURE
944   int yychar;
945   YYSTYPE yylval;
946   int yynerrs;
947 #ifdef YYLSP_NEEDED
948   YYLTYPE yylloc;
949 #endif
950 #endif
951
952   YYSTYPE yyval;                /*  the variable used to return         */
953                                 /*  semantic values from the action     */
954                                 /*  routines                            */
955
956   int yylen;
957
958 #if YYDEBUG != 0
959   if (yydebug)
960     fprintf(stderr, "Starting parse\n");
961 #endif
962
963   yystate = 0;
964   yyerrstatus = 0;
965   yynerrs = 0;
966   yychar = YYEMPTY;             /* Cause a token to be read.  */
967
968   /* Initialize stack pointers.
969      Waste one element of value and location stack
970      so that they stay on the same level as the state stack.
971      The wasted elements are never initialized.  */
972
973   yyssp = yyss - 1;
974   yyvsp = yyvs;
975 #ifdef YYLSP_NEEDED
976   yylsp = yyls;
977 #endif
978
979 /* Push a new state, which is found in  yystate  .  */
980 /* In all cases, when you get here, the value and location stacks
981    have just been pushed. so pushing a state here evens the stacks.  */
982 yynewstate:
983
984   *++yyssp = yystate;
985
986   if (yyssp >= yyss + yystacksize - 1)
987     {
988       /* Give user a chance to reallocate the stack */
989       /* Use copies of these so that the &'s don't force the real ones into memory. */
990       YYSTYPE *yyvs1 = yyvs;
991       short *yyss1 = yyss;
992 #ifdef YYLSP_NEEDED
993       YYLTYPE *yyls1 = yyls;
994 #endif
995
996       /* Get the current used size of the three stacks, in elements.  */
997       int size = yyssp - yyss + 1;
998
999 #ifdef yyoverflow
1000       /* Each stack pointer address is followed by the size of
1001          the data in use in that stack, in bytes.  */
1002 #ifdef YYLSP_NEEDED
1003       /* This used to be a conditional around just the two extra args,
1004          but that might be undefined if yyoverflow is a macro.  */
1005       yyoverflow("parser stack overflow",
1006                  &yyss1, size * sizeof (*yyssp),
1007                  &yyvs1, size * sizeof (*yyvsp),
1008                  &yyls1, size * sizeof (*yylsp),
1009                  &yystacksize);
1010 #else
1011       yyoverflow("parser stack overflow",
1012                  &yyss1, size * sizeof (*yyssp),
1013                  &yyvs1, size * sizeof (*yyvsp),
1014                  &yystacksize);
1015 #endif
1016
1017       yyss = yyss1; yyvs = yyvs1;
1018 #ifdef YYLSP_NEEDED
1019       yyls = yyls1;
1020 #endif
1021 #else /* no yyoverflow */
1022       /* Extend the stack our own way.  */
1023       if (yystacksize >= YYMAXDEPTH)
1024         {
1025           yyerror("parser stack overflow");
1026           if (yyfree_stacks)
1027             {
1028               free (yyss);
1029               free (yyvs);
1030 #ifdef YYLSP_NEEDED
1031               free (yyls);
1032 #endif
1033             }
1034           return 2;
1035         }
1036       yystacksize *= 2;
1037       if (yystacksize > YYMAXDEPTH)
1038         yystacksize = YYMAXDEPTH;
1039 #ifndef YYSTACK_USE_ALLOCA
1040       yyfree_stacks = 1;
1041 #endif
1042       yyss = (short *) YYSTACK_ALLOC (yystacksize * sizeof (*yyssp));
1043       __yy_memcpy ((char *)yyss, (char *)yyss1,
1044                    size * (unsigned int) sizeof (*yyssp));
1045       yyvs = (YYSTYPE *) YYSTACK_ALLOC (yystacksize * sizeof (*yyvsp));
1046       __yy_memcpy ((char *)yyvs, (char *)yyvs1,
1047                    size * (unsigned int) sizeof (*yyvsp));
1048 #ifdef YYLSP_NEEDED
1049       yyls = (YYLTYPE *) YYSTACK_ALLOC (yystacksize * sizeof (*yylsp));
1050       __yy_memcpy ((char *)yyls, (char *)yyls1,
1051                    size * (unsigned int) sizeof (*yylsp));
1052 #endif
1053 #endif /* no yyoverflow */
1054
1055       yyssp = yyss + size - 1;
1056       yyvsp = yyvs + size - 1;
1057 #ifdef YYLSP_NEEDED
1058       yylsp = yyls + size - 1;
1059 #endif
1060
1061 #if YYDEBUG != 0
1062       if (yydebug)
1063         fprintf(stderr, "Stack size increased to %d\n", yystacksize);
1064 #endif
1065
1066       if (yyssp >= yyss + yystacksize - 1)
1067         YYABORT;
1068     }
1069
1070 #if YYDEBUG != 0
1071   if (yydebug)
1072     fprintf(stderr, "Entering state %d\n", yystate);
1073 #endif
1074
1075   goto yybackup;
1076  yybackup:
1077
1078 /* Do appropriate processing given the current state.  */
1079 /* Read a lookahead token if we need one and don't already have one.  */
1080 /* yyresume: */
1081
1082   /* First try to decide what to do without reference to lookahead token.  */
1083
1084   yyn = yypact[yystate];
1085   if (yyn == YYFLAG)
1086     goto yydefault;
1087
1088   /* Not known => get a lookahead token if don't already have one.  */
1089
1090   /* yychar is either YYEMPTY or YYEOF
1091      or a valid token in external form.  */
1092
1093   if (yychar == YYEMPTY)
1094     {
1095 #if YYDEBUG != 0
1096       if (yydebug)
1097         fprintf(stderr, "Reading a token: ");
1098 #endif
1099       yychar = YYLEX;
1100     }
1101
1102   /* Convert token to internal form (in yychar1) for indexing tables with */
1103
1104   if (yychar <= 0)              /* This means end of input. */
1105     {
1106       yychar1 = 0;
1107       yychar = YYEOF;           /* Don't call YYLEX any more */
1108
1109 #if YYDEBUG != 0
1110       if (yydebug)
1111         fprintf(stderr, "Now at end of input.\n");
1112 #endif
1113     }
1114   else
1115     {
1116       yychar1 = YYTRANSLATE(yychar);
1117
1118 #if YYDEBUG != 0
1119       if (yydebug)
1120         {
1121           fprintf (stderr, "Next token is %d (%s", yychar, yytname[yychar1]);
1122           /* Give the individual parser a way to print the precise meaning
1123              of a token, for further debugging info.  */
1124 #ifdef YYPRINT
1125           YYPRINT (stderr, yychar, yylval);
1126 #endif
1127           fprintf (stderr, ")\n");
1128         }
1129 #endif
1130     }
1131
1132   yyn += yychar1;
1133   if (yyn < 0 || yyn > YYLAST || yycheck[yyn] != yychar1)
1134     goto yydefault;
1135
1136   yyn = yytable[yyn];
1137
1138   /* yyn is what to do for this token type in this state.
1139      Negative => reduce, -yyn is rule number.
1140      Positive => shift, yyn is new state.
1141        New state is final state => don't bother to shift,
1142        just return success.
1143      0, or most negative number => error.  */
1144
1145   if (yyn < 0)
1146     {
1147       if (yyn == YYFLAG)
1148         goto yyerrlab;
1149       yyn = -yyn;
1150       goto yyreduce;
1151     }
1152   else if (yyn == 0)
1153     goto yyerrlab;
1154
1155   if (yyn == YYFINAL)
1156     YYACCEPT;
1157
1158   /* Shift the lookahead token.  */
1159
1160 #if YYDEBUG != 0
1161   if (yydebug)
1162     fprintf(stderr, "Shifting token %d (%s), ", yychar, yytname[yychar1]);
1163 #endif
1164
1165   /* Discard the token being shifted unless it is eof.  */
1166   if (yychar != YYEOF)
1167     yychar = YYEMPTY;
1168
1169   *++yyvsp = yylval;
1170 #ifdef YYLSP_NEEDED
1171   *++yylsp = yylloc;
1172 #endif
1173
1174   /* count tokens shifted since error; after three, turn off error status.  */
1175   if (yyerrstatus) yyerrstatus--;
1176
1177   yystate = yyn;
1178   goto yynewstate;
1179
1180 /* Do the default action for the current state.  */
1181 yydefault:
1182
1183   yyn = yydefact[yystate];
1184   if (yyn == 0)
1185     goto yyerrlab;
1186
1187 /* Do a reduction.  yyn is the number of a rule to reduce with.  */
1188 yyreduce:
1189   yylen = yyr2[yyn];
1190   if (yylen > 0)
1191     yyval = yyvsp[1-yylen]; /* implement default value of the action */
1192
1193 #if YYDEBUG != 0
1194   if (yydebug)
1195     {
1196       int i;
1197
1198       fprintf (stderr, "Reducing via rule %d (line %d), ",
1199                yyn, yyrline[yyn]);
1200
1201       /* Print the symbols being reduced, and their result.  */
1202       for (i = yyprhs[yyn]; yyrhs[i] > 0; i++)
1203         fprintf (stderr, "%s ", yytname[yyrhs[i]]);
1204       fprintf (stderr, " -> %s\n", yytname[yyr1[yyn]]);
1205     }
1206 #endif
1207
1208
1209   switch (yyn) {
1210
1211 case 1:
1212 #line 312 "parse.y"
1213 { ; ;
1214     break;}
1215 case 2:
1216 #line 313 "parse.y"
1217 { ; ;
1218     break;}
1219 case 3:
1220 #line 314 "parse.y"
1221 { ; ;
1222     break;}
1223 case 4:
1224 #line 315 "parse.y"
1225 { ; ;
1226     break;}
1227 case 5:
1228 #line 318 "parse.y"
1229 {
1230                         Node *node = new_ccode(C_CCODE,(yyvsp[0].cbuf)->str,
1231                                                ccode_line);
1232                         nodes = g_list_append(nodes,node);
1233                         g_string_free(yyvsp[0].cbuf,FALSE);
1234                                         ;
1235     break;}
1236 case 6:
1237 #line 324 "parse.y"
1238 {
1239                         Node *node = new_ccode(H_CCODE,(yyvsp[0].cbuf)->str,
1240                                                ccode_line);
1241                         nodes = g_list_append(nodes,node);
1242                         g_string_free(yyvsp[0].cbuf,FALSE);
1243                                         ;
1244     break;}
1245 case 7:
1246 #line 330 "parse.y"
1247 {
1248                         Node *node = new_ccode(HT_CCODE,(yyvsp[0].cbuf)->str,
1249                                                ccode_line);
1250                         nodes = g_list_append(nodes,node);
1251                         g_string_free(yyvsp[0].cbuf,FALSE);
1252                                         ;
1253     break;}
1254 case 8:
1255 #line 336 "parse.y"
1256 {
1257                         Node *node = new_ccode(PH_CCODE,(yyvsp[0].cbuf)->str,
1258                                                ccode_line);
1259                         nodes = g_list_append(nodes,node);
1260                         g_string_free(yyvsp[0].cbuf,FALSE);
1261                                         ;
1262     break;}
1263 case 9:
1264 #line 342 "parse.y"
1265 {
1266                         Node *node = new_ccode(A_CCODE,(yyvsp[0].cbuf)->str,
1267                                                ccode_line);
1268                         nodes = g_list_append(nodes,node);
1269                         g_string_free(yyvsp[0].cbuf,FALSE);
1270                                         ;
1271     break;}
1272 case 10:
1273 #line 348 "parse.y"
1274 {
1275                         Node *node = new_ccode(AT_CCODE,(yyvsp[0].cbuf)->str,
1276                                                ccode_line);
1277                         nodes = g_list_append(nodes,node);
1278                         g_string_free(yyvsp[0].cbuf,FALSE);
1279                                         ;
1280     break;}
1281 case 11:
1282 #line 356 "parse.y"
1283 { ; ;
1284     break;}
1285 case 12:
1286 #line 357 "parse.y"
1287 { ; ;
1288     break;}
1289 case 13:
1290 #line 360 "parse.y"
1291 {
1292                         ((Class *)class)->nodes = class_nodes;
1293                         class_nodes = NULL;
1294                         nodes = g_list_append(nodes,class);
1295                                                 ;
1296     break;}
1297 case 14:
1298 #line 365 "parse.y"
1299 {
1300                         ((Class *)class)->nodes = NULL;
1301                         class_nodes = NULL;
1302                         nodes = g_list_append(nodes,class);
1303                                                 ;
1304     break;}
1305 case 15:
1306 #line 372 "parse.y"
1307 {
1308                         class = new_class(yyvsp[-3].id,yyvsp[-1].id,chunk_size,NULL);
1309                                                 ;
1310     break;}
1311 case 17:
1312 #line 378 "parse.y"
1313 {
1314                         if(strcmp(yyvsp[-2].id,"chunks") == 0) {
1315                                         chunk_size = g_strdup(yyvsp[0].id);
1316                         } else {
1317                                 yyerror(_("parse error"));
1318                                 YYERROR;
1319                         }
1320                 ;
1321     break;}
1322 case 18:
1323 #line 386 "parse.y"
1324 {
1325                         if(strcmp(yyvsp[-2].id,"chunks") == 0) {
1326                                 if(atoi(yyvsp[0].id) != 0)
1327                                         chunk_size = g_strdup(yyvsp[0].id);
1328                         } else {
1329                                 yyerror(_("parse error"));
1330                                 YYERROR;
1331                         }
1332                 ;
1333     break;}
1334 case 19:
1335 #line 397 "parse.y"
1336 { ; ;
1337     break;}
1338 case 20:
1339 #line 398 "parse.y"
1340 { ; ;
1341     break;}
1342 case 21:
1343 #line 401 "parse.y"
1344 { ; ;
1345     break;}
1346 case 22:
1347 #line 402 "parse.y"
1348 { ; ;
1349     break;}
1350 case 23:
1351 #line 403 "parse.y"
1352 { ; ;
1353     break;}
1354 case 24:
1355 #line 404 "parse.y"
1356 { ; ;
1357     break;}
1358 case 25:
1359 #line 407 "parse.y"
1360 { the_scope = PUBLIC_SCOPE; ;
1361     break;}
1362 case 26:
1363 #line 408 "parse.y"
1364 { the_scope = PRIVATE_SCOPE; ;
1365     break;}
1366 case 27:
1367 #line 409 "parse.y"
1368 { the_scope = PROTECTED_SCOPE; ;
1369     break;}
1370 case 28:
1371 #line 410 "parse.y"
1372 { the_scope = CLASS_SCOPE; ;
1373     break;}
1374 case 29:
1375 #line 413 "parse.y"
1376 {
1377                         if(strcmp(yyvsp[-1].id, "destroywith")==0) {
1378                                 g_free(yyvsp[-1].id);
1379                                 destructor = yyvsp[0].id;
1380                                 destructor_line = line_no;
1381                                 destructor_simple = TRUE;
1382                         } else {
1383                                 g_free(yyvsp[-1].id);
1384                                 g_free(yyvsp[0].id);
1385                                 yyerror(_("parse error"));
1386                                 YYERROR;
1387                         }
1388                                 ;
1389     break;}
1390 case 30:
1391 #line 426 "parse.y"
1392 {
1393                         if(strcmp(yyvsp[-2].id, "destroy")==0) {
1394                                 g_free(yyvsp[-2].id);
1395                                 destructor = (yyvsp[0].cbuf)->str;
1396                                 g_string_free(yyvsp[0].cbuf, FALSE);
1397                                 destructor_line = ccode_line;
1398                                 destructor_simple = FALSE;
1399                         } else {
1400                                 g_free(yyvsp[-2].id);
1401                                 g_string_free(yyvsp[0].cbuf, TRUE);
1402                                 yyerror(_("parse error"));
1403                                 YYERROR;
1404                         }
1405                                         ;
1406     break;}
1407 case 31:
1408 #line 442 "parse.y"
1409 {
1410                         initializer = yyvsp[0].id;
1411                         initializer_line = ccode_line;
1412                                 ;
1413     break;}
1414 case 32:
1415 #line 446 "parse.y"
1416 {
1417                         initializer = (yyvsp[0].cbuf)->str;
1418                         initializer_line = ccode_line;
1419                         g_string_free(yyvsp[0].cbuf, FALSE);
1420                                 ;
1421     break;}
1422 case 33:
1423 #line 454 "parse.y"
1424 { ; ;
1425     break;}
1426 case 34:
1427 #line 455 "parse.y"
1428 { ; ;
1429     break;}
1430 case 35:
1431 #line 456 "parse.y"
1432 { destructor = NULL; ;
1433     break;}
1434 case 36:
1435 #line 457 "parse.y"
1436 { initializer = NULL; ;
1437     break;}
1438 case 37:
1439 #line 458 "parse.y"
1440 {
1441                         destructor = NULL;
1442                         initializer = NULL;
1443                                         ;
1444     break;}
1445 case 38:
1446 #line 464 "parse.y"
1447 {
1448                         push_variable(yyvsp[-2].id, the_scope,yyvsp[-4].line, NULL);
1449                                                 ;
1450     break;}
1451 case 39:
1452 #line 467 "parse.y"
1453 {
1454                         push_variable(yyvsp[-3].id, the_scope, yyvsp[-5].line, yyvsp[-2].id);
1455                                                 ;
1456     break;}
1457 case 40:
1458 #line 471 "parse.y"
1459 {
1460                         if(strcmp(yyvsp[-6].id,"get")==0 &&
1461                            strcmp(yyvsp[-3].id,"set")==0) {
1462                                 Node *node;
1463                                 Type *type = pop_type();
1464                                 g_free(yyvsp[-6].id); g_free(yyvsp[-3].id);
1465                                 node = new_argument(yyvsp[-8].id,type,yyvsp[-9].list,yyvsp[-7].id,
1466                                                     (yyvsp[-4].cbuf)->str,yyvsp[-5].line,
1467                                                     (yyvsp[-1].cbuf)->str,yyvsp[-2].line,
1468                                                     yyvsp[-10].line);
1469                                 g_string_free(yyvsp[-4].cbuf,FALSE);
1470                                 g_string_free(yyvsp[-1].cbuf,FALSE);
1471                                 class_nodes = g_list_append(class_nodes,node);
1472                         } else if(strcmp(yyvsp[-6].id,"set")==0 &&
1473                                 strcmp(yyvsp[-3].id,"get")==0) {
1474                                 Node *node;
1475                                 Type *type = pop_type();
1476                                 g_free(yyvsp[-6].id); g_free(yyvsp[-3].id);
1477                                 node = new_argument(yyvsp[-8].id,type,yyvsp[-9].list,yyvsp[-7].id,
1478                                                     (yyvsp[-1].cbuf)->str,yyvsp[-2].line,
1479                                                     (yyvsp[-4].cbuf)->str,yyvsp[-5].line,
1480                                                     yyvsp[-10].line);
1481                                 g_string_free(yyvsp[-1].cbuf,FALSE);
1482                                 g_string_free(yyvsp[-4].cbuf,FALSE);
1483                                 class_nodes = g_list_append(class_nodes,node);
1484                         } else {
1485                                 g_free(yyvsp[-8].id); g_free(yyvsp[-7].id);
1486                                 g_free(yyvsp[-6].id); g_free(yyvsp[-3].id);
1487                                 g_list_foreach(yyvsp[-9].list,(GFunc)g_free,NULL);
1488                                 g_string_free(yyvsp[-1].cbuf,TRUE);
1489                                 g_string_free(yyvsp[-4].cbuf,TRUE);
1490                                 yyerror(_("parse error"));
1491                                 YYERROR;
1492                         }
1493                                                 ;
1494     break;}
1495 case 41:
1496 #line 506 "parse.y"
1497 {
1498                         if(strcmp(yyvsp[-3].id,"get")==0) {
1499                                 Node *node;
1500                                 Type *type = pop_type();
1501                                 g_free(yyvsp[-3].id);
1502                                 node = new_argument(yyvsp[-5].id,type,yyvsp[-6].list,yyvsp[-4].id,
1503                                                     (yyvsp[-1].cbuf)->str,yyvsp[-2].line,
1504                                                     NULL,0, yyvsp[-7].line);
1505                                 g_string_free(yyvsp[-1].cbuf,FALSE);
1506                                 class_nodes = g_list_append(class_nodes,node);
1507                         } else if(strcmp(yyvsp[-3].id,"set")==0) {
1508                                 Node *node;
1509                                 Type *type = pop_type();
1510                                 g_free(yyvsp[-3].id);
1511                                 node = new_argument(yyvsp[-5].id,type,yyvsp[-6].list,yyvsp[-4].id,
1512                                                     NULL,0,(yyvsp[-1].cbuf)->str,
1513                                                     yyvsp[-2].line, yyvsp[-7].line);
1514                                 g_string_free(yyvsp[-1].cbuf,FALSE);
1515                                 class_nodes = g_list_append(class_nodes,node);
1516                         } else {
1517                                 g_free(yyvsp[-3].id); g_free(yyvsp[-5].id);
1518                                 g_free(yyvsp[-4].id);
1519                                 g_list_foreach(yyvsp[-6].list,(GFunc)g_free,NULL);
1520                                 g_string_free(yyvsp[-1].cbuf,TRUE);
1521                                 yyerror(_("parse error"));
1522                                 YYERROR;
1523                         }
1524                                                 ;
1525     break;}
1526 case 42:
1527 #line 534 "parse.y"
1528 {
1529                         Node *node;
1530                         char *get, *set = NULL;
1531                         Variable *var;
1532                         Type *type;
1533                         char *root;
1534                         
1535                         if(strcmp(yyvsp[0].id, "link")!=0 &&
1536                            strcmp(yyvsp[0].id, "stringlink")!=0 &&
1537                            strcmp(yyvsp[0].id, "objectlink")!=0) {
1538                                 g_free(yyvsp[0].id); g_free(yyvsp[-2].id);
1539                                 g_free(yyvsp[-1].id);
1540                                 g_list_foreach(yyvsp[-3].list,(GFunc)g_free,NULL);
1541                                 yyerror(_("parse error"));
1542                                 YYERROR;
1543                         }
1544
1545                         type = pop_type();
1546
1547                         var = find_var_or_die(yyvsp[-1].id, yyvsp[-4].line);
1548                         if(var->scope == PRIVATE_SCOPE)
1549                                 root = "self->_priv";
1550                         else if(var->scope == CLASS_SCOPE)
1551                                 root = "SELF_CLASS(GTK_OBJECT(self)->klass)";
1552                         else
1553                                 root = "self";
1554
1555                         if(strcmp(yyvsp[0].id, "link")==0) {
1556                                 set = g_strdup_printf("%s->%s = ARG;",
1557                                                       root, yyvsp[-1].id);
1558                         } else if(strcmp(yyvsp[0].id, "stringlink")==0) {
1559                                 set = g_strdup_printf("g_free(%s->%s); "
1560                                                       "%s->%s = g_strdup(ARG);",
1561                                                       root, yyvsp[-1].id,
1562                                                       root, yyvsp[-1].id);
1563                         } else if(strcmp(yyvsp[0].id, "objectlink")==0) {
1564                                 set = g_strdup_printf(
1565                                   "if(%s->%s) "
1566                                    "gtk_object_unref(GTK_OBJECT(%s->%s)); "
1567                                   "%s->%s = ARG; "
1568                                   "if(%s->%s) "
1569                                    "gtk_object_ref(GTK_OBJECT(%s->%s));",
1570                                   root, yyvsp[-1].id,
1571                                   root, yyvsp[-1].id,
1572                                   root, yyvsp[-1].id,
1573                                   root, yyvsp[-1].id,
1574                                   root, yyvsp[-1].id);
1575                         } else {
1576                                 g_assert_not_reached();
1577                         }
1578
1579                         if(strcmp(yyvsp[0].id, "stringlink")==0) {
1580                                 get = g_strdup_printf("ARG = g_strdup(%s->%s);", root, yyvsp[-1].id);
1581                         } else
1582                                 /* For everything else, get is just straight assignment */
1583                                 get = g_strdup_printf("ARG = %s->%s;", root, yyvsp[-1].id);
1584
1585                         g_free(yyvsp[0].id);
1586
1587
1588                         if(!type)
1589                                 type = copy_type(var->vtype);
1590
1591                         node = new_argument(yyvsp[-2].id, type, yyvsp[-3].list,
1592                                             yyvsp[-1].id, get, yyvsp[-4].line,
1593                                             set, yyvsp[-4].line, yyvsp[-4].line);
1594                         class_nodes = g_list_append(class_nodes,node);
1595                                                 ;
1596     break;}
1597 case 43:
1598 #line 604 "parse.y"
1599 {
1600                         if(strcmp(yyvsp[-2].id,"type")!=0) {
1601                                 g_free(yyvsp[-4].id);
1602                                 g_free(yyvsp[-2].id);
1603                                 yyerror(_("parse error"));
1604                                 YYERROR;
1605                         }
1606                         yyval.id = yyvsp[-4].id;
1607                                                 ;
1608     break;}
1609 case 44:
1610 #line 613 "parse.y"
1611 {
1612                         yyval.id = yyvsp[0].id;
1613                         typestack = g_list_prepend(typestack,NULL);
1614                                                 ;
1615     break;}
1616 case 45:
1617 #line 619 "parse.y"
1618 { yyval.list = yyvsp[-1].list; ;
1619     break;}
1620 case 46:
1621 #line 620 "parse.y"
1622 { yyval.list = NULL; ;
1623     break;}
1624 case 47:
1625 #line 623 "parse.y"
1626 {
1627                         yyval.list = g_list_append(yyvsp[0].list,yyvsp[-2].id);
1628                                                 ;
1629     break;}
1630 case 48:
1631 #line 626 "parse.y"
1632 {
1633                         yyval.list = g_list_append(NULL,yyvsp[0].id);
1634                                                 ;
1635     break;}
1636 case 49:
1637 #line 632 "parse.y"
1638 {
1639                         Node *node = new_type(yyvsp[-1].id, yyvsp[0].id, NULL);
1640                         typestack = g_list_prepend(typestack,node);
1641                                                         ;
1642     break;}
1643 case 50:
1644 #line 636 "parse.y"
1645 {
1646                         Node *node = new_type(yyvsp[0].id, NULL, NULL);
1647                         typestack = g_list_prepend(typestack,node);
1648                                                         ;
1649     break;}
1650 case 51:
1651 #line 643 "parse.y"
1652 {
1653                         yyval.id = yyvsp[0].id;
1654                                                         ;
1655     break;}
1656 case 52:
1657 #line 646 "parse.y"
1658 {
1659                         yyval.id = yyvsp[0].id;
1660                                                         ;
1661     break;}
1662 case 53:
1663 #line 649 "parse.y"
1664 {
1665                         yyval.id = g_strconcat("const ", yyvsp[0].id, NULL);
1666                         g_free(yyvsp[0].id);
1667                                                         ;
1668     break;}
1669 case 54:
1670 #line 653 "parse.y"
1671 {
1672                         yyval.id = g_strconcat(yyvsp[-1].id, " const", NULL);
1673                         g_free(yyvsp[-1].id);
1674                                                         ;
1675     break;}
1676 case 55:
1677 #line 657 "parse.y"
1678 {
1679                         yyval.id = g_strconcat(yyvsp[-1].id, " ", yyvsp[0].id, NULL);
1680                         g_free(yyvsp[0].id);
1681                                                         ;
1682     break;}
1683 case 56:
1684 #line 661 "parse.y"
1685 {
1686                         yyval.id = g_strconcat("const ", yyvsp[-1].id, " ",
1687                                              yyvsp[0].id, NULL);
1688                         g_free(yyvsp[0].id);
1689                                                         ;
1690     break;}
1691 case 57:
1692 #line 666 "parse.y"
1693 {
1694                         yyval.id = g_strconcat(yyvsp[-2].id, " ",
1695                                              yyvsp[-1].id, " const", NULL);
1696                         g_free(yyvsp[-1].id);
1697                                                         ;
1698     break;}
1699 case 58:
1700 #line 674 "parse.y"
1701 {
1702                         yyval.id = g_strconcat(yyvsp[-1].id, " ", yyvsp[0].id, NULL);
1703                         g_free(yyvsp[0].id);
1704                                                         ;
1705     break;}
1706 case 59:
1707 #line 678 "parse.y"
1708 {
1709                         yyval.id = g_strconcat(yyvsp[-1].id, " ", yyvsp[0].id, NULL);
1710                         g_free(yyvsp[-1].id);
1711                         g_free(yyvsp[0].id);
1712                                                         ;
1713     break;}
1714 case 60:
1715 #line 683 "parse.y"
1716 {
1717                         yyval.id = g_strconcat("const ", yyvsp[0].id, NULL);
1718                         g_free(yyvsp[0].id);
1719                                                         ;
1720     break;}
1721 case 61:
1722 #line 687 "parse.y"
1723 {
1724                         yyval.id = yyvsp[0].id;
1725                                                         ;
1726     break;}
1727 case 62:
1728 #line 690 "parse.y"
1729 {
1730                         yyval.id = g_strconcat(yyvsp[-1].id, " const", NULL);
1731                         g_free(yyvsp[-1].id);
1732                                                         ;
1733     break;}
1734 case 63:
1735 #line 694 "parse.y"
1736 {
1737                         yyval.id = g_strdup(yyvsp[0].id);
1738                                                         ;
1739     break;}
1740 case 64:
1741 #line 697 "parse.y"
1742 {
1743                         yyval.id = g_strconcat(yyvsp[-1].id, " const", NULL);
1744                                                         ;
1745     break;}
1746 case 65:
1747 #line 702 "parse.y"
1748 { yyval.id = "void"; ;
1749     break;}
1750 case 66:
1751 #line 703 "parse.y"
1752 { yyval.id = "char"; ;
1753     break;}
1754 case 67:
1755 #line 704 "parse.y"
1756 { yyval.id = "short"; ;
1757     break;}
1758 case 68:
1759 #line 705 "parse.y"
1760 { yyval.id = "int"; ;
1761     break;}
1762 case 69:
1763 #line 706 "parse.y"
1764 { yyval.id = "long"; ;
1765     break;}
1766 case 70:
1767 #line 707 "parse.y"
1768 { yyval.id = "float"; ;
1769     break;}
1770 case 71:
1771 #line 708 "parse.y"
1772 { yyval.id = "double"; ;
1773     break;}
1774 case 72:
1775 #line 709 "parse.y"
1776 { yyval.id = "signed"; ;
1777     break;}
1778 case 73:
1779 #line 710 "parse.y"
1780 { yyval.id = "unsigned"; ;
1781     break;}
1782 case 74:
1783 #line 713 "parse.y"
1784 { yyval.id = "struct"; ;
1785     break;}
1786 case 75:
1787 #line 714 "parse.y"
1788 { yyval.id = "union"; ;
1789     break;}
1790 case 76:
1791 #line 715 "parse.y"
1792 { yyval.id = "enum"; ;
1793     break;}
1794 case 77:
1795 #line 718 "parse.y"
1796 { yyval.id = g_strdup("*"); ;
1797     break;}
1798 case 78:
1799 #line 719 "parse.y"
1800 { yyval.id = g_strdup("* const"); ;
1801     break;}
1802 case 79:
1803 #line 720 "parse.y"
1804 {
1805                                 yyval.id = g_strconcat("*", yyvsp[0].id, NULL);
1806                                 g_free(yyvsp[0].id);
1807                                         ;
1808     break;}
1809 case 80:
1810 #line 724 "parse.y"
1811 {
1812                                 yyval.id = g_strconcat("* const", yyvsp[0].id, NULL);
1813                                 g_free(yyvsp[0].id);
1814                                         ;
1815     break;}
1816 case 81:
1817 #line 731 "parse.y"
1818 {
1819                         if(strcmp(yyvsp[-1].id, "first")==0)
1820                                 yyval.sigtype = SIGNAL_FIRST_METHOD;
1821                         else if(strcmp(yyvsp[-1].id, "last")==0)
1822                                 yyval.sigtype = SIGNAL_LAST_METHOD;
1823                         else {
1824                                 yyerror(_("signal must be 'first' or 'last'"));
1825                                 g_free(yyvsp[-1].id);
1826                                 YYERROR;
1827                         }
1828                         g_free(yyvsp[-1].id);
1829                                         ;
1830     break;}
1831 case 82:
1832 #line 743 "parse.y"
1833 {
1834                         yyval.sigtype = SIGNAL_LAST_METHOD;
1835                                         ;
1836     break;}
1837 case 83:
1838 #line 749 "parse.y"
1839 {
1840                         if(strcmp(yyvsp[-1].id,"first")==0)
1841                                 yyval.sigtype = SIGNAL_FIRST_METHOD;
1842                         else if(strcmp(yyvsp[-1].id,"last")==0)
1843                                 yyval.sigtype = SIGNAL_LAST_METHOD;
1844                         else {
1845                                 yyerror(_("signal must be 'first' or 'last'"));
1846                                 g_free(yyvsp[-1].id);
1847                                 YYERROR;
1848                         }
1849                         g_free(yyvsp[-1].id);
1850                                         ;
1851     break;}
1852 case 84:
1853 #line 761 "parse.y"
1854 {
1855                         if(strcmp(yyvsp[-2].id,"first")==0)
1856                                 yyval.sigtype = SIGNAL_FIRST_METHOD;
1857                         else if(strcmp(yyvsp[-2].id,"last")==0)
1858                                 yyval.sigtype = SIGNAL_LAST_METHOD;
1859                         else {
1860                                 yyerror(_("signal must be 'first' or 'last'"));
1861                                 g_free(yyvsp[-2].id);
1862                                 YYERROR;
1863                         }
1864                         g_free(yyvsp[-2].id);
1865                                         ;
1866     break;}
1867 case 85:
1868 #line 773 "parse.y"
1869 {
1870                         yyval.sigtype = SIGNAL_LAST_METHOD;
1871                                         ;
1872     break;}
1873 case 86:
1874 #line 776 "parse.y"
1875 {
1876                         /* the_scope was default thus public */
1877                         the_scope = PUBLIC_SCOPE;
1878                                         ;
1879     break;}
1880 case 87:
1881 #line 782 "parse.y"
1882 {
1883                         gtktypes = g_list_prepend(gtktypes, yyvsp[-3].id);
1884                                                 ;
1885     break;}
1886 case 88:
1887 #line 787 "parse.y"
1888 {
1889                         gtktypes = g_list_append(gtktypes, yyvsp[0].id);
1890                                                 ;
1891     break;}
1892 case 89:
1893 #line 790 "parse.y"
1894
1895                         gtktypes = g_list_append(gtktypes, yyvsp[0].id);
1896                                                 ;
1897     break;}
1898 case 90:
1899 #line 795 "parse.y"
1900 { yyval.cbuf = yyvsp[0].cbuf; ;
1901     break;}
1902 case 91:
1903 #line 796 "parse.y"
1904 { yyval.cbuf = NULL; ;
1905     break;}
1906 case 92:
1907 #line 800 "parse.y"
1908 {
1909                         if(!has_self) {
1910                                 yyerror(_("signal without 'self' as "
1911                                           "first parameter"));
1912                                 free_all_global_state();
1913                                 YYERROR;
1914                         }
1915                         if(the_scope == CLASS_SCOPE) {
1916                                 yyerror(_("a method cannot be of class scope"));
1917                                 free_all_global_state();
1918                                 YYERROR;
1919                         }
1920                         push_function(the_scope, yyvsp[-7].sigtype,NULL,
1921                                       yyvsp[-5].id, yyvsp[0].cbuf,yyvsp[-9].line,
1922                                       ccode_line, vararg, yyvsp[-8].list);
1923                                                                         ;
1924     break;}
1925 case 93:
1926 #line 816 "parse.y"
1927 {
1928                         if(!has_self) {
1929                                 yyerror(_("signal without 'self' as "
1930                                           "first parameter"));
1931                                 free_all_global_state();
1932                                 YYERROR;
1933                         }
1934                         if(the_scope == CLASS_SCOPE) {
1935                                 yyerror(_("a method cannot be of class scope"));
1936                                 free_all_global_state();
1937                                 YYERROR;
1938                         }
1939                         push_function(the_scope, yyvsp[-7].sigtype, NULL,
1940                                       yyvsp[-5].id, yyvsp[0].cbuf, yyvsp[-9].line,
1941                                       ccode_line, vararg, yyvsp[-8].list);
1942                                                                         ;
1943     break;}
1944 case 94:
1945 #line 832 "parse.y"
1946 {
1947                         if(!has_self) {
1948                                 yyerror(_("virtual method without 'self' as "
1949                                           "first parameter"));
1950                                 free_all_global_state();
1951                                 YYERROR;
1952                         }
1953                         if(the_scope == CLASS_SCOPE) {
1954                                 yyerror(_("a method cannot be of class scope"));
1955                                 free_all_global_state();
1956                                 YYERROR;
1957                         }
1958                         push_function(the_scope, VIRTUAL_METHOD, NULL, yyvsp[-5].id,
1959                                       yyvsp[0].cbuf, yyvsp[-8].line,
1960                                       ccode_line, vararg, NULL);
1961                                                                         ;
1962     break;}
1963 case 95:
1964 #line 848 "parse.y"
1965 {
1966                         if(!has_self) {
1967                                 yyerror(_("virtual method without 'self' as "
1968                                           "first parameter"));
1969                                 free_all_global_state();
1970                                 YYERROR;
1971                         }
1972                         if(the_scope == CLASS_SCOPE) {
1973                                 yyerror(_("a method cannot be of class scope"));
1974                                 free_all_global_state();
1975                                 YYERROR;
1976                         }
1977                         push_function(the_scope, VIRTUAL_METHOD, NULL, yyvsp[-5].id,
1978                                       yyvsp[0].cbuf, yyvsp[-7].line,
1979                                       ccode_line, vararg, NULL);
1980                                                                         ;
1981     break;}
1982 case 96:
1983 #line 864 "parse.y"
1984 {
1985                         if(!has_self) {
1986                                 yyerror(_("virtual method without 'self' as "
1987                                           "first parameter"));
1988                                 free_all_global_state();
1989                                 YYERROR;
1990                         }
1991                         push_function(PUBLIC_SCOPE, VIRTUAL_METHOD, NULL,
1992                                       yyvsp[-5].id, yyvsp[0].cbuf, yyvsp[-7].line,
1993                                       ccode_line, vararg, NULL);
1994                                                                         ;
1995     break;}
1996 case 97:
1997 #line 875 "parse.y"
1998 {
1999                         push_function(NO_SCOPE, OVERRIDE_METHOD, yyvsp[-8].id,
2000                                       yyvsp[-5].id, yyvsp[0].cbuf,
2001                                       yyvsp[-10].line, ccode_line,
2002                                       vararg, NULL);
2003                                                                         ;
2004     break;}
2005 case 98:
2006 #line 881 "parse.y"
2007 {
2008                         if(the_scope == CLASS_SCOPE) {
2009                                 yyerror(_("a method cannot be of class scope"));
2010                                 free_all_global_state();
2011                                 YYERROR;
2012                         }
2013                         push_function(the_scope, REGULAR_METHOD, NULL, yyvsp[-5].id,
2014                                       yyvsp[0].cbuf, yyvsp[-7].line, ccode_line,
2015                                       vararg, NULL);
2016                                                                 ;
2017     break;}
2018 case 99:
2019 #line 891 "parse.y"
2020 {
2021                         if(strcmp(yyvsp[-4].id, "init")==0) {
2022                                 push_init_arg(yyvsp[-2].id,FALSE);
2023                                 push_function(NO_SCOPE, INIT_METHOD, NULL,
2024                                               yyvsp[-4].id, yyvsp[0].cbuf, yyvsp[-3].line,
2025                                               ccode_line, FALSE, NULL);
2026                         } else if(strcmp(yyvsp[-4].id, "class_init")==0) {
2027                                 push_init_arg(yyvsp[-2].id,TRUE);
2028                                 push_function(NO_SCOPE, CLASS_INIT_METHOD, NULL,
2029                                               yyvsp[-4].id, yyvsp[0].cbuf, yyvsp[-3].line,
2030                                               ccode_line, FALSE, NULL);
2031                         } else {
2032                                 g_free(yyvsp[-4].id);
2033                                 g_free(yyvsp[-2].id);
2034                                 g_string_free(yyvsp[0].cbuf,TRUE);
2035                                 yyerror(_("parse error "
2036                                           "(untyped blocks must be init or "
2037                                           "class_init)"));
2038                                 YYERROR;
2039                         }
2040                                                 ;
2041     break;}
2042 case 100:
2043 #line 914 "parse.y"
2044 {
2045                         g_free(onerror); onerror = NULL;
2046                         g_free(defreturn); defreturn = NULL;
2047                         if(!set_return_value(yyvsp[-1].id, yyvsp[0].id)) {
2048                                 g_free(yyvsp[-1].id);
2049                                 g_free(yyvsp[0].id);
2050                                 yyerror(_("parse error"));
2051                                 YYERROR;
2052                         }
2053                         g_free(yyvsp[-1].id);
2054                                         ;
2055     break;}
2056 case 101:
2057 #line 925 "parse.y"
2058 {
2059                         g_free(onerror); onerror = NULL;
2060                         g_free(defreturn); defreturn = NULL;
2061                         if(!set_return_value(yyvsp[-3].id, yyvsp[-2].id)) {
2062                                 g_free(yyvsp[-3].id); g_free(yyvsp[-2].id);
2063                                 g_free(yyvsp[-1].id); g_free(yyvsp[0].id);
2064                                 yyerror(_("parse error"));
2065                                 YYERROR;
2066                         }
2067                         if(!set_return_value(yyvsp[-1].id, yyvsp[0].id)) {
2068                                 onerror = defreturn = NULL;
2069                                 g_free(yyvsp[-3].id); g_free(yyvsp[-2].id);
2070                                 g_free(yyvsp[-1].id); g_free(yyvsp[0].id);
2071                                 yyerror(_("parse error"));
2072                                 YYERROR;
2073                         }
2074                         g_free(yyvsp[-3].id);
2075                         g_free(yyvsp[-1].id);
2076                                                 ;
2077     break;}
2078 case 102:
2079 #line 944 "parse.y"
2080 {
2081                         g_free(onerror); onerror = NULL;
2082                         g_free(defreturn); defreturn = NULL;
2083                                         ;
2084     break;}
2085 case 103:
2086 #line 950 "parse.y"
2087 { yyval.id = yyvsp[0].id; ;
2088     break;}
2089 case 104:
2090 #line 951 "parse.y"
2091 {
2092                         yyval.id = (yyvsp[1].cbuf)->str;
2093                         g_string_free(yyvsp[1].cbuf, FALSE);
2094                                         ;
2095     break;}
2096 case 105:
2097 #line 957 "parse.y"
2098 { vararg = FALSE; has_self = FALSE; ;
2099     break;}
2100 case 106:
2101 #line 958 "parse.y"
2102 {
2103                         vararg = FALSE;
2104                         has_self = TRUE;
2105                         if(strcmp(yyvsp[0].id,"self")==0)
2106                                 push_self(yyvsp[0].id);
2107                         else {
2108                                 g_free(yyvsp[0].id);
2109                                 yyerror(_("parse error"));
2110                                 YYERROR;
2111                         }
2112                                         ;
2113     break;}
2114 case 107:
2115 #line 969 "parse.y"
2116 {
2117                         has_self = TRUE;
2118                         if(strcmp(yyvsp[-2].id,"self")==0)
2119                                 push_self(yyvsp[-2].id);
2120                         else {
2121                                 g_free(yyvsp[-2].id);
2122                                 yyerror(_("parse error"));
2123                                 YYERROR;
2124                         }
2125                                         ;
2126     break;}
2127 case 108:
2128 #line 979 "parse.y"
2129 { has_self = FALSE; ;
2130     break;}
2131 case 109:
2132 #line 982 "parse.y"
2133 { vararg = TRUE; ;
2134     break;}
2135 case 110:
2136 #line 983 "parse.y"
2137 { vararg = FALSE; ;
2138     break;}
2139 case 111:
2140 #line 986 "parse.y"
2141 { ; ;
2142     break;}
2143 case 112:
2144 #line 987 "parse.y"
2145 { ; ;
2146     break;}
2147 case 113:
2148 #line 990 "parse.y"
2149 {
2150                         push_funcarg(yyvsp[0].id,NULL);
2151                                                                 ;
2152     break;}
2153 case 114:
2154 #line 993 "parse.y"
2155 {
2156                         push_funcarg(yyvsp[-1].id,yyvsp[0].id);
2157                                                                 ;
2158     break;}
2159 case 115:
2160 #line 996 "parse.y"
2161 {
2162                         if(strcmp(yyvsp[-2].id,"check")!=0) {
2163                                 yyerror(_("parse error"));
2164                                 YYERROR;
2165                         }
2166                         g_free(yyvsp[-2].id);
2167                         push_funcarg(yyvsp[-4].id,NULL);
2168                                                                 ;
2169     break;}
2170 case 116:
2171 #line 1004 "parse.y"
2172 {
2173                         if(strcmp(yyvsp[-2].id,"check")!=0) {
2174                                 yyerror(_("parse error"));
2175                                 YYERROR;
2176                         }
2177                         g_free(yyvsp[-2].id);
2178                         push_funcarg(yyvsp[-5].id,yyvsp[-4].id);
2179                                                                 ;
2180     break;}
2181 case 117:
2182 #line 1014 "parse.y"
2183 { ; ;
2184     break;}
2185 case 118:
2186 #line 1015 "parse.y"
2187 { ; ;
2188     break;}
2189 case 119:
2190 #line 1018 "parse.y"
2191 {
2192                         if(strcmp(yyvsp[0].id,"type")==0) {
2193                                 Node *node = new_check(TYPE_CHECK,NULL);
2194                                 checks = g_list_append(checks,node);
2195                         } else if(strcmp(yyvsp[0].id,"null")==0) {
2196                                 Node *node = new_check(NULL_CHECK,NULL);
2197                                 checks = g_list_append(checks,node);
2198                         } else {
2199                                 yyerror(_("parse error"));
2200                                 YYERROR;
2201                         }
2202                         g_free(yyvsp[0].id);
2203                                         ;
2204     break;}
2205 case 120:
2206 #line 1031 "parse.y"
2207 {
2208                         Node *node = new_check(GT_CHECK,yyvsp[0].id);
2209                         checks = g_list_append(checks,node);
2210                                         ;
2211     break;}
2212 case 121:
2213 #line 1035 "parse.y"
2214 {
2215                         Node *node = new_check(LT_CHECK,yyvsp[0].id);
2216                         checks = g_list_append(checks,node);
2217                                         ;
2218     break;}
2219 case 122:
2220 #line 1039 "parse.y"
2221 {
2222                         Node *node = new_check(GE_CHECK,yyvsp[0].id);
2223                         checks = g_list_append(checks,node);
2224                                         ;
2225     break;}
2226 case 123:
2227 #line 1043 "parse.y"
2228 {
2229                         Node *node = new_check(LE_CHECK,yyvsp[0].id);
2230                         checks = g_list_append(checks,node);
2231                                         ;
2232     break;}
2233 case 124:
2234 #line 1047 "parse.y"
2235 {
2236                         Node *node = new_check(EQ_CHECK,yyvsp[0].id);
2237                         checks = g_list_append(checks,node);
2238                                         ;
2239     break;}
2240 case 125:
2241 #line 1051 "parse.y"
2242 {
2243                         Node *node = new_check(NE_CHECK,yyvsp[0].id);
2244                         checks = g_list_append(checks,node);
2245                                         ;
2246     break;}
2247 case 126:
2248 #line 1057 "parse.y"
2249 { yyval.id = yyvsp[0].id; ;
2250     break;}
2251 case 127:
2252 #line 1058 "parse.y"
2253 {
2254                         yyval.id = g_strconcat("-",yyvsp[0].id,NULL);
2255                         g_free(yyvsp[0].id);
2256                                         ;
2257     break;}
2258 case 128:
2259 #line 1062 "parse.y"
2260 { yyval.id = yyvsp[0].id; ;
2261     break;}
2262 }
2263    /* the action file gets copied in in place of this dollarsign */
2264 #line 543 "/usr/lib/bison.simple"
2265 \f
2266   yyvsp -= yylen;
2267   yyssp -= yylen;
2268 #ifdef YYLSP_NEEDED
2269   yylsp -= yylen;
2270 #endif
2271
2272 #if YYDEBUG != 0
2273   if (yydebug)
2274     {
2275       short *ssp1 = yyss - 1;
2276       fprintf (stderr, "state stack now");
2277       while (ssp1 != yyssp)
2278         fprintf (stderr, " %d", *++ssp1);
2279       fprintf (stderr, "\n");
2280     }
2281 #endif
2282
2283   *++yyvsp = yyval;
2284
2285 #ifdef YYLSP_NEEDED
2286   yylsp++;
2287   if (yylen == 0)
2288     {
2289       yylsp->first_line = yylloc.first_line;
2290       yylsp->first_column = yylloc.first_column;
2291       yylsp->last_line = (yylsp-1)->last_line;
2292       yylsp->last_column = (yylsp-1)->last_column;
2293       yylsp->text = 0;
2294     }
2295   else
2296     {
2297       yylsp->last_line = (yylsp+yylen-1)->last_line;
2298       yylsp->last_column = (yylsp+yylen-1)->last_column;
2299     }
2300 #endif
2301
2302   /* Now "shift" the result of the reduction.
2303      Determine what state that goes to,
2304      based on the state we popped back to
2305      and the rule number reduced by.  */
2306
2307   yyn = yyr1[yyn];
2308
2309   yystate = yypgoto[yyn - YYNTBASE] + *yyssp;
2310   if (yystate >= 0 && yystate <= YYLAST && yycheck[yystate] == *yyssp)
2311     yystate = yytable[yystate];
2312   else
2313     yystate = yydefgoto[yyn - YYNTBASE];
2314
2315   goto yynewstate;
2316
2317 yyerrlab:   /* here on detecting error */
2318
2319   if (! yyerrstatus)
2320     /* If not already recovering from an error, report this error.  */
2321     {
2322       ++yynerrs;
2323
2324 #ifdef YYERROR_VERBOSE
2325       yyn = yypact[yystate];
2326
2327       if (yyn > YYFLAG && yyn < YYLAST)
2328         {
2329           int size = 0;
2330           char *msg;
2331           int x, count;
2332
2333           count = 0;
2334           /* Start X at -yyn if nec to avoid negative indexes in yycheck.  */
2335           for (x = (yyn < 0 ? -yyn : 0);
2336                x < (sizeof(yytname) / sizeof(char *)); x++)
2337             if (yycheck[x + yyn] == x)
2338               size += strlen(yytname[x]) + 15, count++;
2339           msg = (char *) malloc(size + 15);
2340           if (msg != 0)
2341             {
2342               strcpy(msg, "parse error");
2343
2344               if (count < 5)
2345                 {
2346                   count = 0;
2347                   for (x = (yyn < 0 ? -yyn : 0);
2348                        x < (sizeof(yytname) / sizeof(char *)); x++)
2349                     if (yycheck[x + yyn] == x)
2350                       {
2351                         strcat(msg, count == 0 ? ", expecting `" : " or `");
2352                         strcat(msg, yytname[x]);
2353                         strcat(msg, "'");
2354                         count++;
2355                       }
2356                 }
2357               yyerror(msg);
2358               free(msg);
2359             }
2360           else
2361             yyerror ("parse error; also virtual memory exceeded");
2362         }
2363       else
2364 #endif /* YYERROR_VERBOSE */
2365         yyerror("parse error");
2366     }
2367
2368   goto yyerrlab1;
2369 yyerrlab1:   /* here on error raised explicitly by an action */
2370
2371   if (yyerrstatus == 3)
2372     {
2373       /* if just tried and failed to reuse lookahead token after an error, discard it.  */
2374
2375       /* return failure if at end of input */
2376       if (yychar == YYEOF)
2377         YYABORT;
2378
2379 #if YYDEBUG != 0
2380       if (yydebug)
2381         fprintf(stderr, "Discarding token %d (%s).\n", yychar, yytname[yychar1]);
2382 #endif
2383
2384       yychar = YYEMPTY;
2385     }
2386
2387   /* Else will try to reuse lookahead token
2388      after shifting the error token.  */
2389
2390   yyerrstatus = 3;              /* Each real token shifted decrements this */
2391
2392   goto yyerrhandle;
2393
2394 yyerrdefault:  /* current state does not do anything special for the error token. */
2395
2396 #if 0
2397   /* This is wrong; only states that explicitly want error tokens
2398      should shift them.  */
2399   yyn = yydefact[yystate];  /* If its default is to accept any token, ok.  Otherwise pop it.*/
2400   if (yyn) goto yydefault;
2401 #endif
2402
2403 yyerrpop:   /* pop the current state because it cannot handle the error token */
2404
2405   if (yyssp == yyss) YYABORT;
2406   yyvsp--;
2407   yystate = *--yyssp;
2408 #ifdef YYLSP_NEEDED
2409   yylsp--;
2410 #endif
2411
2412 #if YYDEBUG != 0
2413   if (yydebug)
2414     {
2415       short *ssp1 = yyss - 1;
2416       fprintf (stderr, "Error: state stack now");
2417       while (ssp1 != yyssp)
2418         fprintf (stderr, " %d", *++ssp1);
2419       fprintf (stderr, "\n");
2420     }
2421 #endif
2422
2423 yyerrhandle:
2424
2425   yyn = yypact[yystate];
2426   if (yyn == YYFLAG)
2427     goto yyerrdefault;
2428
2429   yyn += YYTERROR;
2430   if (yyn < 0 || yyn > YYLAST || yycheck[yyn] != YYTERROR)
2431     goto yyerrdefault;
2432
2433   yyn = yytable[yyn];
2434   if (yyn < 0)
2435     {
2436       if (yyn == YYFLAG)
2437         goto yyerrpop;
2438       yyn = -yyn;
2439       goto yyreduce;
2440     }
2441   else if (yyn == 0)
2442     goto yyerrpop;
2443
2444   if (yyn == YYFINAL)
2445     YYACCEPT;
2446
2447 #if YYDEBUG != 0
2448   if (yydebug)
2449     fprintf(stderr, "Shifting error token, ");
2450 #endif
2451
2452   *++yyvsp = yylval;
2453 #ifdef YYLSP_NEEDED
2454   *++yylsp = yylloc;
2455 #endif
2456
2457   yystate = yyn;
2458   goto yynewstate;
2459
2460  yyacceptlab:
2461   /* YYACCEPT comes here.  */
2462   if (yyfree_stacks)
2463     {
2464       free (yyss);
2465       free (yyvs);
2466 #ifdef YYLSP_NEEDED
2467       free (yyls);
2468 #endif
2469     }
2470   return 0;
2471
2472  yyabortlab:
2473   /* YYABORT comes here.  */
2474   if (yyfree_stacks)
2475     {
2476       free (yyss);
2477       free (yyvs);
2478 #ifdef YYLSP_NEEDED
2479       free (yyls);
2480 #endif
2481     }
2482   return 1;
2483 }
2484 #line 1065 "parse.y"
2485