]> git.draconx.ca Git - gob-dx.git/blob - src/parse.c
Release 0.0.2
[gob-dx.git] / src / parse.c
1
2 /*  A Bison parser, made from parse.y
3  by  GNU Bison version 1.27
4   */
5
6 #define YYBISON 1  /* Identify Bison output.  */
7
8 #define CLASS   257
9 #define FROM    258
10 #define VOID    259
11 #define STRUCT  260
12 #define UNION   261
13 #define ENUM    262
14 #define SIGNED  263
15 #define UNSIGNED        264
16 #define LONG    265
17 #define SHORT   266
18 #define INT     267
19 #define FLOAT   268
20 #define DOUBLE  269
21 #define CHAR    270
22 #define FIRST   271
23 #define LAST    272
24 #define CHECK   273
25 #define CNULL   274
26 #define TYPE    275
27 #define ONERROR 276
28 #define TOKEN   277
29 #define NUMBER  278
30 #define TYPETOKEN       279
31 #define CCODE   280
32 #define HCODE   281
33 #define PUBLIC  282
34 #define PRIVATE 283
35 #define ARGUMENT        284
36 #define VIRTUAL 285
37 #define SIGNAL  286
38 #define OVERRIDE        287
39
40 #line 21 "parse.y"
41
42
43 #include "config.h"
44 #include <glib.h>
45 #include <stdio.h>
46 #include <string.h>
47
48 #include "tree.h"
49
50 #define _(x) (x)
51         
52 extern char *filename;
53         
54 GList *nodes = NULL;
55
56 static GList *class_nodes = NULL;
57 Node *class = NULL;
58
59 static GList *typestack = NULL;
60 static int stars = 0;
61 static GList *funcargs = NULL;
62 static GList *checks = NULL;
63 static int has_this = FALSE;
64
65 static GList *gtktypes = NULL;
66
67 void free(void *ptr);
68 int yylex(void);
69
70 extern int line_no;
71
72 extern char *yytext;
73
74 static void
75 yyerror(char *str)
76 {
77         char *out=NULL;
78         char *p;
79         
80         if(strcmp(yytext,"\n")==0) {
81                 out=g_strconcat("Error: ",str," before newline",NULL);
82         } else if(yytext[0]=='\0') {
83                 out=g_strconcat("Error: ",str," at end of input",NULL);
84         } else {
85                 char *tmp = g_strdup(yytext);
86                 while((p=strchr(tmp,'\n')))
87                         *p='.';
88
89                 out=g_strconcat("Error: ",str," before '",tmp,"'",NULL);
90                 g_free(tmp);
91         }
92
93         fprintf(stderr,"%s:%d: %s\n",filename,line_no,out);
94         g_free(out);
95         
96         exit(1);
97 }
98
99 static void
100 push_variable(char *name, int scope)
101 {
102         Node *var;
103         Type *type = typestack->data;
104         typestack = g_list_remove(typestack,typestack->data);
105         
106         var = new_variable(scope,type,name);
107         class_nodes = g_list_append(class_nodes, var);
108 }
109
110 static void
111 push_function(int scope, char *oid, char *id, char *onerror,
112               GString *cbuf,int line_no)
113 {
114         Node *node;
115         Type *type;
116        
117         if(scope!=INIT_METHOD && scope!=CLASS_INIT_METHOD) {
118                 type = typestack->data;
119                 typestack = g_list_remove(typestack,typestack->data);
120         } else {
121                 type = (Type *)new_type(0,g_strdup("void"));
122         }
123         
124         node = new_method(scope,type,oid,gtktypes,id,funcargs,
125                           onerror,cbuf,line_no);
126         gtktypes = NULL;
127         funcargs = NULL;
128
129         class_nodes = g_list_append(class_nodes, node);
130 }
131
132 static void
133 push_funcarg(char *name)
134 {
135         Node *node;
136         Type *type = typestack->data;
137         typestack = g_list_remove(typestack,typestack->data);
138         
139         node = new_funcarg(type,name,checks);
140         checks = NULL;
141         
142         funcargs = g_list_append(funcargs, node);
143 }
144
145 static void
146 push_init_arg(char *name, int is_class)
147 {
148         Node *node;
149         Node *type;
150         char *tn;
151         
152         if(is_class)
153                 tn = g_strconcat(((Class *)class)->otype,":Class",NULL);
154         else
155                 tn = g_strdup(((Class *)class)->otype);
156
157         type = new_type(1,tn);
158         node = new_funcarg((Type *)type,name,NULL);
159         funcargs = g_list_prepend(funcargs, node);
160 }
161
162 static void
163 push_this(char *this)
164 {
165         Node *node;
166         Node *type;
167         GList *ch = NULL;
168         type = new_type(1,g_strdup(((Class *)class)->otype));
169         ch = g_list_append(ch,new_check(NULL_CHECK,NULL));
170         ch = g_list_append(ch,new_check(TYPE_CHECK,NULL));
171         node = new_funcarg((Type *)type,this,ch);
172         funcargs = g_list_prepend(funcargs, node);
173 }
174
175
176 #line 157 "parse.y"
177 typedef union {
178         char *id;
179         GString *cbuf;
180         GList *list;
181         int line;
182 } YYSTYPE;
183 #ifndef YYDEBUG
184 #define YYDEBUG 1
185 #endif
186
187 #include <stdio.h>
188
189 #ifndef __cplusplus
190 #ifndef __STDC__
191 #define const
192 #endif
193 #endif
194
195
196
197 #define YYFINAL         202
198 #define YYFLAG          -32768
199 #define YYNTBASE        48
200
201 #define YYTRANSLATE(x) ((unsigned)(x) <= 287 ? yytranslate[x] : 72)
202
203 static const char yytranslate[] = {     0,
204      2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
205      2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
206      2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
207      2,     2,    46,     2,     2,     2,     2,     2,     2,    37,
208     38,    40,     2,    41,    47,     2,     2,     2,    43,     2,
209      2,     2,     2,     2,     2,     2,     2,     2,    36,    45,
210     42,    44,     2,     2,     2,     2,     2,     2,     2,     2,
211      2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
212      2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
213      2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
214      2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
215      2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
216      2,     2,    34,    39,    35,     2,     2,     2,     2,     2,
217      2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
218      2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
219      2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
220      2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
221      2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
222      2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
223      2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
224      2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
225      2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
226      2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
227      2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
228      2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
229      2,     2,     2,     2,     2,     1,     3,     4,     5,     6,
230      7,     8,     9,    10,    11,    12,    13,    14,    15,    16,
231     17,    18,    19,    20,    21,    22,    23,    24,    25,    26,
232     27,    28,    29,    30,    31,    32,    33
233 };
234
235 #if YYDEBUG != 0
236 static const short yyprhs[] = {     0,
237      0,     4,     7,    10,    12,    15,    18,    20,    22,    27,
238     32,    35,    38,    41,    43,    45,    47,    52,    57,    69,
239     78,    82,    83,    87,    89,    91,    94,    97,   100,   102,
240    105,   108,   110,   112,   114,   116,   119,   121,   123,   126,
241    128,   131,   133,   135,   137,   139,   141,   144,   146,   151,
242    155,   157,   169,   180,   192,   203,   214,   224,   234,   243,
243    256,   266,   276,   282,   289,   292,   295,   299,   302,   303,
244    305,   307,   311,   313,   317,   319,   322,   329,   332,   334,
245    336,   338,   341,   344,   348,   352,   356,   360,   362
246 };
247
248 static const short yyrhs[] = {    49,
249     50,    49,     0,    50,    49,     0,    49,    50,     0,    50,
250      0,    49,    26,     0,    49,    27,     0,    26,     0,    27,
251      0,    51,    34,    52,    35,     0,     3,    25,     4,    25,
252      0,    52,    64,     0,    52,    53,     0,    52,    54,     0,
253     64,     0,    53,     0,    54,     0,    28,    57,    23,    36,
254      0,    29,    57,    23,    36,     0,    30,    55,    23,    23,
255     23,    34,    26,    23,    34,    26,    36,     0,    30,    55,
256     23,    23,    23,    34,    26,    36,     0,    37,    56,    38,
257      0,     0,    23,    39,    56,     0,    23,     0,    58,     0,
258     58,    61,     0,    10,    59,     0,     9,    59,     0,    59,
259      0,    10,    16,     0,     9,    16,     0,    16,     0,    15,
260      0,    14,     0,    23,     0,    60,    23,     0,    25,     0,
261      5,     0,    11,    13,     0,    11,     0,    12,    13,     0,
262     12,     0,    13,     0,     8,     0,     7,     0,     6,     0,
263     40,    61,     0,    40,     0,    23,    37,    63,    38,     0,
264     63,    41,    23,     0,    23,     0,    32,    18,    62,    57,
265     23,    37,    66,    38,    65,    34,    26,     0,    32,    18,
266     62,    57,    23,    37,    66,    38,    65,    36,     0,    32,
267     17,    62,    57,    23,    37,    66,    38,    65,    34,    26,
268      0,    32,    17,    62,    57,    23,    37,    66,    38,    65,
269     36,     0,    32,    62,    57,    23,    37,    66,    38,    65,
270     34,    26,     0,    32,    62,    57,    23,    37,    66,    38,
271     65,    36,     0,    31,    57,    23,    37,    66,    38,    65,
272     34,    26,     0,    31,    57,    23,    37,    66,    38,    65,
273     36,     0,    33,    37,    25,    38,    57,    23,    37,    66,
274     38,    65,    34,    26,     0,    28,    57,    23,    37,    66,
275     38,    65,    34,    26,     0,    29,    57,    23,    37,    66,
276     38,    65,    34,    26,     0,    23,    37,    23,    38,    36,
277      0,    23,    37,    23,    38,    34,    26,     0,    22,    23,
278      0,    22,    71,     0,    22,    34,    26,     0,    42,    43,
279      0,     0,     5,     0,    23,     0,    23,    41,    67,     0,
280     67,     0,    67,    41,    68,     0,    68,     0,    57,    23,
281      0,    57,    23,    37,    19,    69,    38,     0,    69,    70,
282      0,    70,     0,    20,     0,    21,     0,    44,    71,     0,
283     45,    71,     0,    44,    42,    71,     0,    45,    42,    71,
284      0,    42,    42,    71,     0,    46,    42,    71,     0,    24,
285      0,    47,    24,     0
286 };
287
288 #endif
289
290 #if YYDEBUG != 0
291 static const short yyrline[] = { 0,
292    175,   176,   177,   178,   181,   185,   189,   193,   199,   206,
293    211,   212,   213,   214,   215,   216,   219,   222,   226,   251,
294    275,   276,   279,   282,   288,   292,   299,   302,   305,   308,
295    311,   314,   317,   320,   323,   326,   330,   333,   338,   341,
296    344,   347,   350,   355,   358,   361,   366,   367,   370,   375,
297    378,   384,   393,   402,   411,   420,   429,   438,   442,   446,
298    450,   454,   458,   474,   493,   494,   495,   499,   500,   505,
299    506,   516,   526,   529,   530,   533,   536,   541,   542,   545,
300    549,   553,   557,   561,   565,   569,   573,   579,   580
301 };
302 #endif
303
304
305 #if YYDEBUG != 0 || defined (YYERROR_VERBOSE)
306
307 static const char * const yytname[] = {   "$","error","$undefined.","CLASS",
308 "FROM","VOID","STRUCT","UNION","ENUM","SIGNED","UNSIGNED","LONG","SHORT","INT",
309 "FLOAT","DOUBLE","CHAR","FIRST","LAST","CHECK","CNULL","TYPE","ONERROR","TOKEN",
310 "NUMBER","TYPETOKEN","CCODE","HCODE","PUBLIC","PRIVATE","ARGUMENT","VIRTUAL",
311 "SIGNAL","OVERRIDE","'{'","'}'","';'","'('","')'","'|'","'*'","','","'='","'1'",
312 "'>'","'<'","'!'","'-'","prog","ccodes","class","classdec","classcode","variable",
313 "argument","argflags","flaglist","type","type1","integer","tspecifier","stars",
314 "sigtype","tokenlist","method","onerror","funcargs","arglist","arg","checklist",
315 "check","number", NULL
316 };
317 #endif
318
319 static const short yyr1[] = {     0,
320     48,    48,    48,    48,    49,    49,    49,    49,    50,    51,
321     52,    52,    52,    52,    52,    52,    53,    53,    54,    54,
322     55,    55,    56,    56,    57,    57,    58,    58,    58,    58,
323     58,    58,    58,    58,    58,    58,    58,    58,    59,    59,
324     59,    59,    59,    60,    60,    60,    61,    61,    62,    63,
325     63,    64,    64,    64,    64,    64,    64,    64,    64,    64,
326     64,    64,    64,    64,    65,    65,    65,    65,    65,    66,
327     66,    66,    66,    67,    67,    68,    68,    69,    69,    70,
328     70,    70,    70,    70,    70,    70,    70,    71,    71
329 };
330
331 static const short yyr2[] = {     0,
332      3,     2,     2,     1,     2,     2,     1,     1,     4,     4,
333      2,     2,     2,     1,     1,     1,     4,     4,    11,     8,
334      3,     0,     3,     1,     1,     2,     2,     2,     1,     2,
335      2,     1,     1,     1,     1,     2,     1,     1,     2,     1,
336      2,     1,     1,     1,     1,     1,     2,     1,     4,     3,
337      1,    11,    10,    11,    10,    10,     9,     9,     8,    12,
338      9,     9,     5,     6,     2,     2,     3,     2,     0,     1,
339      1,     3,     1,     3,     1,     2,     6,     2,     1,     1,
340      1,     2,     2,     3,     3,     3,     3,     1,     2
341 };
342
343 static const short yydefact[] = {     0,
344      0,     7,     8,     0,     4,     0,     0,     5,     6,     3,
345      2,     0,     0,     1,     0,     0,     0,    22,     0,     0,
346      0,     0,    15,    16,    14,    10,     0,    38,    46,    45,
347     44,     0,     0,    40,    42,    43,    34,    33,    32,    35,
348     37,     0,    25,    29,     0,     0,     0,     0,     0,     0,
349      0,     0,     0,     0,     9,    12,    13,    11,     0,    31,
350     28,    30,    27,    39,    41,     0,    48,    26,    36,     0,
351     24,     0,     0,     0,     0,     0,     0,     0,     0,     0,
352     17,     0,    47,    18,     0,     0,    21,     0,     0,     0,
353      0,    51,     0,     0,     0,     0,    63,    38,    35,     0,
354      0,    73,    75,     0,    23,     0,     0,     0,     0,    49,
355      0,     0,     0,    64,     0,    76,    69,     0,    69,     0,
356     69,     0,     0,    50,     0,     0,    72,     0,     0,     0,
357      0,    74,     0,     0,     0,     0,     0,    69,     0,     0,
358     65,    88,     0,     0,    66,    68,     0,     0,     0,    20,
359      0,    59,    69,    69,     0,     0,    80,    81,     0,     0,
360      0,     0,     0,    79,    67,    89,    61,    62,     0,    58,
361      0,     0,     0,    57,    69,     0,     0,    82,     0,    83,
362      0,    77,    78,     0,     0,    55,     0,    53,    56,     0,
363     86,    84,    85,    87,    19,    54,    52,     0,    60,     0,
364      0,     0
365 };
366
367 static const short yydefgoto[] = {   200,
368      4,     5,     6,    22,    23,    24,    48,    72,   100,    43,
369     44,    45,    68,    53,    93,    25,   131,   101,   102,   103,
370    163,   164,   145
371 };
372
373 static const short yypact[] = {     3,
374    -23,-32768,-32768,    23,    69,   -25,    19,-32768,-32768,    69,
375    104,   105,     2,   104,    36,    75,    75,    40,    75,    -5,
376     62,    94,-32768,-32768,-32768,-32768,    34,-32768,-32768,-32768,
377 -32768,    81,   102,   126,   132,-32768,-32768,-32768,-32768,-32768,
378 -32768,    93,    80,-32768,   109,   133,   134,   135,   136,   137,
379    137,   118,    75,   138,-32768,-32768,-32768,-32768,   123,-32768,
380 -32768,-32768,-32768,-32768,-32768,   111,    80,-32768,-32768,   113,
381    125,   124,   142,   129,    75,    75,   144,   145,   131,    30,
382 -32768,    96,-32768,-32768,    96,   134,-32768,   147,    96,   148,
383    149,-32768,   -22,   139,    75,   151,-32768,   140,   -21,   150,
384    141,   143,-32768,   152,-32768,   146,   153,   155,   156,-32768,
385    158,    96,   159,-32768,    75,   157,    33,    75,    33,   160,
386     33,    96,    96,-32768,   161,   163,   143,   164,    -9,   154,
387    162,-32768,   167,    29,    42,   165,   166,    33,    96,     1,
388 -32768,-32768,   169,   174,-32768,-32768,   176,   179,   172,-32768,
389    181,-32768,    33,    33,   106,   170,-32768,-32768,   168,     9,
390     20,   171,   -10,-32768,-32768,-32768,-32768,-32768,   183,-32768,
391    107,   110,   185,-32768,    33,    24,    24,-32768,    24,-32768,
392     24,-32768,-32768,   178,   186,-32768,   189,-32768,-32768,   182,
393 -32768,-32768,-32768,-32768,-32768,-32768,-32768,   191,-32768,   175,
394    187,-32768
395 };
396
397 static const short yypgoto[] = {-32768,
398     58,   184,-32768,-32768,   196,   197,-32768,    88,   -16,-32768,
399    119,-32768,   122,   103,-32768,   198,  -114,   -81,    70,   108,
400 -32768,    59,  -107
401 };
402
403
404 #define YYLAST          226
405
406
407 static const short yytable[] = {    42,
408     46,     7,    49,   104,   133,     1,   135,   107,    12,   157,
409    158,    50,    51,   141,   142,   110,   -71,    52,   111,   115,
410    157,   158,    13,   155,   143,     1,    26,   182,     2,     3,
411    125,   159,   142,   160,   161,   162,    78,   144,   171,   172,
412    136,   137,   159,   142,   160,   161,   162,   142,     8,     9,
413    177,   149,   178,   180,   129,   144,    59,   156,    90,    91,
414    190,   179,    11,    96,   150,    97,   144,    14,   191,   192,
415    144,   193,    27,   194,   130,   151,    47,   152,   113,    28,
416     29,    30,    31,    32,    33,    34,    35,    36,    37,    38,
417     39,    34,    35,    36,     2,     3,    60,    40,    54,    41,
418     98,    29,    30,    31,    32,    33,    34,    35,    36,    37,
419     38,    39,    34,    35,    36,    66,    15,    62,    99,    67,
420     41,    16,    17,    18,    19,    20,    21,    15,    55,     8,
421      9,    69,    16,    17,    18,    19,    20,    21,    64,   173,
422    185,   174,   186,   187,    65,   188,    81,    82,    84,    85,
423     61,    63,    75,    76,    77,    70,    71,    73,    74,    52,
424     80,    87,    79,    86,    88,    89,    92,    94,    95,   106,
425    108,   109,   116,   105,   201,   112,   114,   -70,   117,   120,
426    124,   126,   140,   118,   127,   134,   202,    10,    83,   119,
427    121,   122,   123,   128,   165,   147,   146,   166,   138,   139,
428    148,   167,   153,   154,   168,   169,   170,   175,   184,   176,
429    189,   196,   181,   195,   197,   198,   199,    56,    57,    58,
430      0,   183,     0,     0,     0,   132
431 };
432
433 static const short yycheck[] = {    16,
434     17,    25,    19,    85,   119,     3,   121,    89,    34,    20,
435     21,    17,    18,    23,    24,    38,    38,    23,    41,    41,
436     20,    21,     4,   138,    34,     3,    25,    38,    26,    27,
437    112,    42,    24,    44,    45,    46,    53,    47,   153,   154,
438    122,   123,    42,    24,    44,    45,    46,    24,    26,    27,
439     42,    23,   160,   161,    22,    47,    23,   139,    75,    76,
440    175,    42,     5,    34,    36,    36,    47,    10,   176,   177,
441     47,   179,    37,   181,    42,    34,    37,    36,    95,     5,
442      6,     7,     8,     9,    10,    11,    12,    13,    14,    15,
443     16,    11,    12,    13,    26,    27,    16,    23,    37,    25,
444      5,     6,     7,     8,     9,    10,    11,    12,    13,    14,
445     15,    16,    11,    12,    13,    23,    23,    16,    23,    40,
446     25,    28,    29,    30,    31,    32,    33,    23,    35,    26,
447     27,    23,    28,    29,    30,    31,    32,    33,    13,    34,
448     34,    36,    36,    34,    13,    36,    36,    37,    36,    37,
449     32,    33,    50,    51,    37,    23,    23,    23,    23,    23,
450     38,    38,    25,    39,    23,    37,    23,    23,    38,    23,
451     23,    23,    23,    86,     0,    37,    26,    38,    38,    34,
452     23,    23,    19,    41,   115,    26,     0,     4,    67,    38,
453     38,    37,    37,    37,    26,    34,    43,    24,    38,    37,
454     34,    26,    38,    38,    26,    34,    26,    38,    26,    42,
455     26,    26,    42,    36,    26,    34,    26,    22,    22,    22,
456     -1,   163,    -1,    -1,    -1,   118
457 };
458 /* -*-C-*-  Note some compilers choke on comments on `#line' lines.  */
459 #line 3 "/usr/lib/bison.simple"
460 /* This file comes from bison-1.27.  */
461
462 /* Skeleton output parser for bison,
463    Copyright (C) 1984, 1989, 1990 Free Software Foundation, Inc.
464
465    This program is free software; you can redistribute it and/or modify
466    it under the terms of the GNU General Public License as published by
467    the Free Software Foundation; either version 2, or (at your option)
468    any later version.
469
470    This program is distributed in the hope that it will be useful,
471    but WITHOUT ANY WARRANTY; without even the implied warranty of
472    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
473    GNU General Public License for more details.
474
475    You should have received a copy of the GNU General Public License
476    along with this program; if not, write to the Free Software
477    Foundation, Inc., 59 Temple Place - Suite 330,
478    Boston, MA 02111-1307, USA.  */
479
480 /* As a special exception, when this file is copied by Bison into a
481    Bison output file, you may use that output file without restriction.
482    This special exception was added by the Free Software Foundation
483    in version 1.24 of Bison.  */
484
485 /* This is the parser code that is written into each bison parser
486   when the %semantic_parser declaration is not specified in the grammar.
487   It was written by Richard Stallman by simplifying the hairy parser
488   used when %semantic_parser is specified.  */
489
490 #ifndef YYSTACK_USE_ALLOCA
491 #ifdef alloca
492 #define YYSTACK_USE_ALLOCA
493 #else /* alloca not defined */
494 #ifdef __GNUC__
495 #define YYSTACK_USE_ALLOCA
496 #define alloca __builtin_alloca
497 #else /* not GNU C.  */
498 #if (!defined (__STDC__) && defined (sparc)) || defined (__sparc__) || defined (__sparc) || defined (__sgi) || (defined (__sun) && defined (__i386))
499 #define YYSTACK_USE_ALLOCA
500 #include <alloca.h>
501 #else /* not sparc */
502 /* We think this test detects Watcom and Microsoft C.  */
503 /* This used to test MSDOS, but that is a bad idea
504    since that symbol is in the user namespace.  */
505 #if (defined (_MSDOS) || defined (_MSDOS_)) && !defined (__TURBOC__)
506 #if 0 /* No need for malloc.h, which pollutes the namespace;
507          instead, just don't use alloca.  */
508 #include <malloc.h>
509 #endif
510 #else /* not MSDOS, or __TURBOC__ */
511 #if defined(_AIX)
512 /* I don't know what this was needed for, but it pollutes the namespace.
513    So I turned it off.   rms, 2 May 1997.  */
514 /* #include <malloc.h>  */
515  #pragma alloca
516 #define YYSTACK_USE_ALLOCA
517 #else /* not MSDOS, or __TURBOC__, or _AIX */
518 #if 0
519 #ifdef __hpux /* haible@ilog.fr says this works for HPUX 9.05 and up,
520                  and on HPUX 10.  Eventually we can turn this on.  */
521 #define YYSTACK_USE_ALLOCA
522 #define alloca __builtin_alloca
523 #endif /* __hpux */
524 #endif
525 #endif /* not _AIX */
526 #endif /* not MSDOS, or __TURBOC__ */
527 #endif /* not sparc */
528 #endif /* not GNU C */
529 #endif /* alloca not defined */
530 #endif /* YYSTACK_USE_ALLOCA not defined */
531
532 #ifdef YYSTACK_USE_ALLOCA
533 #define YYSTACK_ALLOC alloca
534 #else
535 #define YYSTACK_ALLOC malloc
536 #endif
537
538 /* Note: there must be only one dollar sign in this file.
539    It is replaced by the list of actions, each action
540    as one case of the switch.  */
541
542 #define yyerrok         (yyerrstatus = 0)
543 #define yyclearin       (yychar = YYEMPTY)
544 #define YYEMPTY         -2
545 #define YYEOF           0
546 #define YYACCEPT        goto yyacceptlab
547 #define YYABORT         goto yyabortlab
548 #define YYERROR         goto yyerrlab1
549 /* Like YYERROR except do call yyerror.
550    This remains here temporarily to ease the
551    transition to the new meaning of YYERROR, for GCC.
552    Once GCC version 2 has supplanted version 1, this can go.  */
553 #define YYFAIL          goto yyerrlab
554 #define YYRECOVERING()  (!!yyerrstatus)
555 #define YYBACKUP(token, value) \
556 do                                                              \
557   if (yychar == YYEMPTY && yylen == 1)                          \
558     { yychar = (token), yylval = (value);                       \
559       yychar1 = YYTRANSLATE (yychar);                           \
560       YYPOPSTACK;                                               \
561       goto yybackup;                                            \
562     }                                                           \
563   else                                                          \
564     { yyerror ("syntax error: cannot back up"); YYERROR; }      \
565 while (0)
566
567 #define YYTERROR        1
568 #define YYERRCODE       256
569
570 #ifndef YYPURE
571 #define YYLEX           yylex()
572 #endif
573
574 #ifdef YYPURE
575 #ifdef YYLSP_NEEDED
576 #ifdef YYLEX_PARAM
577 #define YYLEX           yylex(&yylval, &yylloc, YYLEX_PARAM)
578 #else
579 #define YYLEX           yylex(&yylval, &yylloc)
580 #endif
581 #else /* not YYLSP_NEEDED */
582 #ifdef YYLEX_PARAM
583 #define YYLEX           yylex(&yylval, YYLEX_PARAM)
584 #else
585 #define YYLEX           yylex(&yylval)
586 #endif
587 #endif /* not YYLSP_NEEDED */
588 #endif
589
590 /* If nonreentrant, generate the variables here */
591
592 #ifndef YYPURE
593
594 int     yychar;                 /*  the lookahead symbol                */
595 YYSTYPE yylval;                 /*  the semantic value of the           */
596                                 /*  lookahead symbol                    */
597
598 #ifdef YYLSP_NEEDED
599 YYLTYPE yylloc;                 /*  location data for the lookahead     */
600                                 /*  symbol                              */
601 #endif
602
603 int yynerrs;                    /*  number of parse errors so far       */
604 #endif  /* not YYPURE */
605
606 #if YYDEBUG != 0
607 int yydebug;                    /*  nonzero means print parse trace     */
608 /* Since this is uninitialized, it does not stop multiple parsers
609    from coexisting.  */
610 #endif
611
612 /*  YYINITDEPTH indicates the initial size of the parser's stacks       */
613
614 #ifndef YYINITDEPTH
615 #define YYINITDEPTH 200
616 #endif
617
618 /*  YYMAXDEPTH is the maximum size the stacks can grow to
619     (effective only if the built-in stack extension method is used).  */
620
621 #if YYMAXDEPTH == 0
622 #undef YYMAXDEPTH
623 #endif
624
625 #ifndef YYMAXDEPTH
626 #define YYMAXDEPTH 10000
627 #endif
628 \f
629 /* Define __yy_memcpy.  Note that the size argument
630    should be passed with type unsigned int, because that is what the non-GCC
631    definitions require.  With GCC, __builtin_memcpy takes an arg
632    of type size_t, but it can handle unsigned int.  */
633
634 #if __GNUC__ > 1                /* GNU C and GNU C++ define this.  */
635 #define __yy_memcpy(TO,FROM,COUNT)      __builtin_memcpy(TO,FROM,COUNT)
636 #else                           /* not GNU C or C++ */
637 #ifndef __cplusplus
638
639 /* This is the most reliable way to avoid incompatibilities
640    in available built-in functions on various systems.  */
641 static void
642 __yy_memcpy (to, from, count)
643      char *to;
644      char *from;
645      unsigned int count;
646 {
647   register char *f = from;
648   register char *t = to;
649   register int i = count;
650
651   while (i-- > 0)
652     *t++ = *f++;
653 }
654
655 #else /* __cplusplus */
656
657 /* This is the most reliable way to avoid incompatibilities
658    in available built-in functions on various systems.  */
659 static void
660 __yy_memcpy (char *to, char *from, unsigned int count)
661 {
662   register char *t = to;
663   register char *f = from;
664   register int i = count;
665
666   while (i-- > 0)
667     *t++ = *f++;
668 }
669
670 #endif
671 #endif
672 \f
673 #line 216 "/usr/lib/bison.simple"
674
675 /* The user can define YYPARSE_PARAM as the name of an argument to be passed
676    into yyparse.  The argument should have type void *.
677    It should actually point to an object.
678    Grammar actions can access the variable by casting it
679    to the proper pointer type.  */
680
681 #ifdef YYPARSE_PARAM
682 #ifdef __cplusplus
683 #define YYPARSE_PARAM_ARG void *YYPARSE_PARAM
684 #define YYPARSE_PARAM_DECL
685 #else /* not __cplusplus */
686 #define YYPARSE_PARAM_ARG YYPARSE_PARAM
687 #define YYPARSE_PARAM_DECL void *YYPARSE_PARAM;
688 #endif /* not __cplusplus */
689 #else /* not YYPARSE_PARAM */
690 #define YYPARSE_PARAM_ARG
691 #define YYPARSE_PARAM_DECL
692 #endif /* not YYPARSE_PARAM */
693
694 /* Prevent warning if -Wstrict-prototypes.  */
695 #ifdef __GNUC__
696 #ifdef YYPARSE_PARAM
697 int yyparse (void *);
698 #else
699 int yyparse (void);
700 #endif
701 #endif
702
703 int
704 yyparse(YYPARSE_PARAM_ARG)
705      YYPARSE_PARAM_DECL
706 {
707   register int yystate;
708   register int yyn;
709   register short *yyssp;
710   register YYSTYPE *yyvsp;
711   int yyerrstatus;      /*  number of tokens to shift before error messages enabled */
712   int yychar1 = 0;              /*  lookahead token as an internal (translated) token number */
713
714   short yyssa[YYINITDEPTH];     /*  the state stack                     */
715   YYSTYPE yyvsa[YYINITDEPTH];   /*  the semantic value stack            */
716
717   short *yyss = yyssa;          /*  refer to the stacks thru separate pointers */
718   YYSTYPE *yyvs = yyvsa;        /*  to allow yyoverflow to reallocate them elsewhere */
719
720 #ifdef YYLSP_NEEDED
721   YYLTYPE yylsa[YYINITDEPTH];   /*  the location stack                  */
722   YYLTYPE *yyls = yylsa;
723   YYLTYPE *yylsp;
724
725 #define YYPOPSTACK   (yyvsp--, yyssp--, yylsp--)
726 #else
727 #define YYPOPSTACK   (yyvsp--, yyssp--)
728 #endif
729
730   int yystacksize = YYINITDEPTH;
731   int yyfree_stacks = 0;
732
733 #ifdef YYPURE
734   int yychar;
735   YYSTYPE yylval;
736   int yynerrs;
737 #ifdef YYLSP_NEEDED
738   YYLTYPE yylloc;
739 #endif
740 #endif
741
742   YYSTYPE yyval;                /*  the variable used to return         */
743                                 /*  semantic values from the action     */
744                                 /*  routines                            */
745
746   int yylen;
747
748 #if YYDEBUG != 0
749   if (yydebug)
750     fprintf(stderr, "Starting parse\n");
751 #endif
752
753   yystate = 0;
754   yyerrstatus = 0;
755   yynerrs = 0;
756   yychar = YYEMPTY;             /* Cause a token to be read.  */
757
758   /* Initialize stack pointers.
759      Waste one element of value and location stack
760      so that they stay on the same level as the state stack.
761      The wasted elements are never initialized.  */
762
763   yyssp = yyss - 1;
764   yyvsp = yyvs;
765 #ifdef YYLSP_NEEDED
766   yylsp = yyls;
767 #endif
768
769 /* Push a new state, which is found in  yystate  .  */
770 /* In all cases, when you get here, the value and location stacks
771    have just been pushed. so pushing a state here evens the stacks.  */
772 yynewstate:
773
774   *++yyssp = yystate;
775
776   if (yyssp >= yyss + yystacksize - 1)
777     {
778       /* Give user a chance to reallocate the stack */
779       /* Use copies of these so that the &'s don't force the real ones into memory. */
780       YYSTYPE *yyvs1 = yyvs;
781       short *yyss1 = yyss;
782 #ifdef YYLSP_NEEDED
783       YYLTYPE *yyls1 = yyls;
784 #endif
785
786       /* Get the current used size of the three stacks, in elements.  */
787       int size = yyssp - yyss + 1;
788
789 #ifdef yyoverflow
790       /* Each stack pointer address is followed by the size of
791          the data in use in that stack, in bytes.  */
792 #ifdef YYLSP_NEEDED
793       /* This used to be a conditional around just the two extra args,
794          but that might be undefined if yyoverflow is a macro.  */
795       yyoverflow("parser stack overflow",
796                  &yyss1, size * sizeof (*yyssp),
797                  &yyvs1, size * sizeof (*yyvsp),
798                  &yyls1, size * sizeof (*yylsp),
799                  &yystacksize);
800 #else
801       yyoverflow("parser stack overflow",
802                  &yyss1, size * sizeof (*yyssp),
803                  &yyvs1, size * sizeof (*yyvsp),
804                  &yystacksize);
805 #endif
806
807       yyss = yyss1; yyvs = yyvs1;
808 #ifdef YYLSP_NEEDED
809       yyls = yyls1;
810 #endif
811 #else /* no yyoverflow */
812       /* Extend the stack our own way.  */
813       if (yystacksize >= YYMAXDEPTH)
814         {
815           yyerror("parser stack overflow");
816           if (yyfree_stacks)
817             {
818               free (yyss);
819               free (yyvs);
820 #ifdef YYLSP_NEEDED
821               free (yyls);
822 #endif
823             }
824           return 2;
825         }
826       yystacksize *= 2;
827       if (yystacksize > YYMAXDEPTH)
828         yystacksize = YYMAXDEPTH;
829 #ifndef YYSTACK_USE_ALLOCA
830       yyfree_stacks = 1;
831 #endif
832       yyss = (short *) YYSTACK_ALLOC (yystacksize * sizeof (*yyssp));
833       __yy_memcpy ((char *)yyss, (char *)yyss1,
834                    size * (unsigned int) sizeof (*yyssp));
835       yyvs = (YYSTYPE *) YYSTACK_ALLOC (yystacksize * sizeof (*yyvsp));
836       __yy_memcpy ((char *)yyvs, (char *)yyvs1,
837                    size * (unsigned int) sizeof (*yyvsp));
838 #ifdef YYLSP_NEEDED
839       yyls = (YYLTYPE *) YYSTACK_ALLOC (yystacksize * sizeof (*yylsp));
840       __yy_memcpy ((char *)yyls, (char *)yyls1,
841                    size * (unsigned int) sizeof (*yylsp));
842 #endif
843 #endif /* no yyoverflow */
844
845       yyssp = yyss + size - 1;
846       yyvsp = yyvs + size - 1;
847 #ifdef YYLSP_NEEDED
848       yylsp = yyls + size - 1;
849 #endif
850
851 #if YYDEBUG != 0
852       if (yydebug)
853         fprintf(stderr, "Stack size increased to %d\n", yystacksize);
854 #endif
855
856       if (yyssp >= yyss + yystacksize - 1)
857         YYABORT;
858     }
859
860 #if YYDEBUG != 0
861   if (yydebug)
862     fprintf(stderr, "Entering state %d\n", yystate);
863 #endif
864
865   goto yybackup;
866  yybackup:
867
868 /* Do appropriate processing given the current state.  */
869 /* Read a lookahead token if we need one and don't already have one.  */
870 /* yyresume: */
871
872   /* First try to decide what to do without reference to lookahead token.  */
873
874   yyn = yypact[yystate];
875   if (yyn == YYFLAG)
876     goto yydefault;
877
878   /* Not known => get a lookahead token if don't already have one.  */
879
880   /* yychar is either YYEMPTY or YYEOF
881      or a valid token in external form.  */
882
883   if (yychar == YYEMPTY)
884     {
885 #if YYDEBUG != 0
886       if (yydebug)
887         fprintf(stderr, "Reading a token: ");
888 #endif
889       yychar = YYLEX;
890     }
891
892   /* Convert token to internal form (in yychar1) for indexing tables with */
893
894   if (yychar <= 0)              /* This means end of input. */
895     {
896       yychar1 = 0;
897       yychar = YYEOF;           /* Don't call YYLEX any more */
898
899 #if YYDEBUG != 0
900       if (yydebug)
901         fprintf(stderr, "Now at end of input.\n");
902 #endif
903     }
904   else
905     {
906       yychar1 = YYTRANSLATE(yychar);
907
908 #if YYDEBUG != 0
909       if (yydebug)
910         {
911           fprintf (stderr, "Next token is %d (%s", yychar, yytname[yychar1]);
912           /* Give the individual parser a way to print the precise meaning
913              of a token, for further debugging info.  */
914 #ifdef YYPRINT
915           YYPRINT (stderr, yychar, yylval);
916 #endif
917           fprintf (stderr, ")\n");
918         }
919 #endif
920     }
921
922   yyn += yychar1;
923   if (yyn < 0 || yyn > YYLAST || yycheck[yyn] != yychar1)
924     goto yydefault;
925
926   yyn = yytable[yyn];
927
928   /* yyn is what to do for this token type in this state.
929      Negative => reduce, -yyn is rule number.
930      Positive => shift, yyn is new state.
931        New state is final state => don't bother to shift,
932        just return success.
933      0, or most negative number => error.  */
934
935   if (yyn < 0)
936     {
937       if (yyn == YYFLAG)
938         goto yyerrlab;
939       yyn = -yyn;
940       goto yyreduce;
941     }
942   else if (yyn == 0)
943     goto yyerrlab;
944
945   if (yyn == YYFINAL)
946     YYACCEPT;
947
948   /* Shift the lookahead token.  */
949
950 #if YYDEBUG != 0
951   if (yydebug)
952     fprintf(stderr, "Shifting token %d (%s), ", yychar, yytname[yychar1]);
953 #endif
954
955   /* Discard the token being shifted unless it is eof.  */
956   if (yychar != YYEOF)
957     yychar = YYEMPTY;
958
959   *++yyvsp = yylval;
960 #ifdef YYLSP_NEEDED
961   *++yylsp = yylloc;
962 #endif
963
964   /* count tokens shifted since error; after three, turn off error status.  */
965   if (yyerrstatus) yyerrstatus--;
966
967   yystate = yyn;
968   goto yynewstate;
969
970 /* Do the default action for the current state.  */
971 yydefault:
972
973   yyn = yydefact[yystate];
974   if (yyn == 0)
975     goto yyerrlab;
976
977 /* Do a reduction.  yyn is the number of a rule to reduce with.  */
978 yyreduce:
979   yylen = yyr2[yyn];
980   if (yylen > 0)
981     yyval = yyvsp[1-yylen]; /* implement default value of the action */
982
983 #if YYDEBUG != 0
984   if (yydebug)
985     {
986       int i;
987
988       fprintf (stderr, "Reducing via rule %d (line %d), ",
989                yyn, yyrline[yyn]);
990
991       /* Print the symbols being reduced, and their result.  */
992       for (i = yyprhs[yyn]; yyrhs[i] > 0; i++)
993         fprintf (stderr, "%s ", yytname[yyrhs[i]]);
994       fprintf (stderr, " -> %s\n", yytname[yyr1[yyn]]);
995     }
996 #endif
997
998
999   switch (yyn) {
1000
1001 case 1:
1002 #line 175 "parse.y"
1003 { ; ;
1004     break;}
1005 case 2:
1006 #line 176 "parse.y"
1007 { ; ;
1008     break;}
1009 case 3:
1010 #line 177 "parse.y"
1011 { ; ;
1012     break;}
1013 case 4:
1014 #line 178 "parse.y"
1015 { ; ;
1016     break;}
1017 case 5:
1018 #line 181 "parse.y"
1019 {
1020                         Node *node = new_ccode(FALSE,yyvsp[0].cbuf);
1021                         nodes = g_list_append(nodes,node);
1022                                         ;
1023     break;}
1024 case 6:
1025 #line 185 "parse.y"
1026 {
1027                         Node *node = new_ccode(TRUE,yyvsp[0].cbuf);
1028                         nodes = g_list_append(nodes,node);
1029                                         ;
1030     break;}
1031 case 7:
1032 #line 189 "parse.y"
1033 {
1034                         Node *node = new_ccode(FALSE,yyvsp[0].cbuf);
1035                         nodes = g_list_append(nodes,node);
1036                                         ;
1037     break;}
1038 case 8:
1039 #line 193 "parse.y"
1040 {
1041                         Node *node = new_ccode(TRUE,yyvsp[0].cbuf);
1042                         nodes = g_list_append(nodes,node);
1043                                         ;
1044     break;}
1045 case 9:
1046 #line 199 "parse.y"
1047 {
1048                         ((Class *)class)->nodes = class_nodes;
1049                         class_nodes = NULL;
1050                         nodes = g_list_append(nodes,class);
1051                                                 ;
1052     break;}
1053 case 10:
1054 #line 206 "parse.y"
1055 {
1056                         class = new_class(yyvsp[-2].id,yyvsp[0].id,NULL);
1057                                                 ;
1058     break;}
1059 case 11:
1060 #line 211 "parse.y"
1061 { ; ;
1062     break;}
1063 case 12:
1064 #line 212 "parse.y"
1065 { ; ;
1066     break;}
1067 case 13:
1068 #line 213 "parse.y"
1069 { ; ;
1070     break;}
1071 case 14:
1072 #line 214 "parse.y"
1073 { ; ;
1074     break;}
1075 case 15:
1076 #line 215 "parse.y"
1077 { ; ;
1078     break;}
1079 case 16:
1080 #line 216 "parse.y"
1081 { ; ;
1082     break;}
1083 case 17:
1084 #line 219 "parse.y"
1085 {
1086                         push_variable(yyvsp[-1].id,PUBLIC_SCOPE);
1087                                                 ;
1088     break;}
1089 case 18:
1090 #line 222 "parse.y"
1091 {
1092                         push_variable(yyvsp[-1].id,PRIVATE_SCOPE);
1093                                                 ;
1094     break;}
1095 case 19:
1096 #line 226 "parse.y"
1097 {
1098                         if(strcmp(yyvsp[-6].id,"get")==0 &&
1099                            strcmp(yyvsp[-3].id,"set")==0) {
1100                                 Node *node;
1101                                 g_free(yyvsp[-6].id); g_free(yyvsp[-3].id);
1102                                 node = new_argument(yyvsp[-8].id,yyvsp[-9].list,yyvsp[-7].id,
1103                                                     yyvsp[-4].cbuf,yyvsp[-1].cbuf);
1104                                 class_nodes = g_list_append(class_nodes,node);
1105                         } else if(strcmp(yyvsp[-6].id,"set")==0 &&
1106                                 strcmp(yyvsp[-3].id,"get")==0) {
1107                                 Node *node;
1108                                 g_free(yyvsp[-6].id); g_free(yyvsp[-3].id);
1109                                 node = new_argument(yyvsp[-8].id,yyvsp[-9].list,yyvsp[-7].id,
1110                                                     yyvsp[-1].cbuf,yyvsp[-4].cbuf);
1111                                 class_nodes = g_list_append(class_nodes,node);
1112                         } else {
1113                                 g_free(yyvsp[-8].id); g_free(yyvsp[-7].id);
1114                                 g_free(yyvsp[-6].id); g_free(yyvsp[-3].id);
1115                                 g_list_foreach(yyvsp[-9].list,(GFunc)g_free,NULL);
1116                                 g_string_free(yyvsp[-1].cbuf,TRUE);
1117                                 g_string_free(yyvsp[-4].cbuf,TRUE);
1118                                 yyerror(_("parse error"));
1119                                 YYERROR;
1120                         }
1121                                                 ;
1122     break;}
1123 case 20:
1124 #line 251 "parse.y"
1125 {
1126                         if(strcmp(yyvsp[-3].id,"get")==0) {
1127                                 Node *node;
1128                                 g_free(yyvsp[-3].id);
1129                                 node = new_argument(yyvsp[-5].id,yyvsp[-6].list,yyvsp[-4].id,
1130                                                     yyvsp[-1].cbuf,NULL);
1131                                 class_nodes = g_list_append(class_nodes,node);
1132                         } else if(strcmp(yyvsp[-3].id,"set")==0) {
1133                                 Node *node;
1134                                 g_free(yyvsp[-3].id);
1135                                 node = new_argument(yyvsp[-5].id,yyvsp[-6].list,yyvsp[-4].id,
1136                                                     NULL,yyvsp[-1].cbuf);
1137                                 class_nodes = g_list_append(class_nodes,node);
1138                         } else {
1139                                 g_free(yyvsp[-3].id); g_free(yyvsp[-5].id);
1140                                 g_free(yyvsp[-4].id);
1141                                 g_list_foreach(yyvsp[-6].list,(GFunc)g_free,NULL);
1142                                 g_string_free(yyvsp[-1].cbuf,TRUE);
1143                                 yyerror(_("parse error"));
1144                                 YYERROR;
1145                         }
1146                                                 ;
1147     break;}
1148 case 21:
1149 #line 275 "parse.y"
1150 { yyval.list = yyvsp[-1].list; ;
1151     break;}
1152 case 22:
1153 #line 276 "parse.y"
1154 { yyval.list = NULL; ;
1155     break;}
1156 case 23:
1157 #line 279 "parse.y"
1158 {
1159                         yyval.list = g_list_append(yyvsp[0].list,yyvsp[-2].id);
1160                                                 ;
1161     break;}
1162 case 24:
1163 #line 282 "parse.y"
1164 {
1165                         yyval.list = g_list_append(NULL,yyvsp[0].id);
1166                                                 ;
1167     break;}
1168 case 25:
1169 #line 288 "parse.y"
1170 {
1171                         Node *node = new_type(0,yyvsp[0].id);
1172                         typestack = g_list_prepend(typestack,node);
1173                                                 ;
1174     break;}
1175 case 26:
1176 #line 292 "parse.y"
1177 {
1178                         Node *node = new_type(stars,yyvsp[-1].id);
1179                         stars = 0;
1180                         typestack = g_list_prepend(typestack,node);
1181                                                 ;
1182     break;}
1183 case 27:
1184 #line 299 "parse.y"
1185 {
1186                         yyval.id = g_strconcat("unsigned ",yyvsp[0].id,NULL);
1187                                                 ;
1188     break;}
1189 case 28:
1190 #line 302 "parse.y"
1191 {
1192                         yyval.id = g_strconcat("signed ",yyvsp[0].id,NULL);
1193                                                 ;
1194     break;}
1195 case 29:
1196 #line 305 "parse.y"
1197 {
1198                         yyval.id = g_strdup(yyvsp[0].id);
1199                                                 ;
1200     break;}
1201 case 30:
1202 #line 308 "parse.y"
1203 {
1204                         yyval.id = g_strdup("unsigned char");
1205                                                 ;
1206     break;}
1207 case 31:
1208 #line 311 "parse.y"
1209 {
1210                         yyval.id = g_strdup("signed char");
1211                                                 ;
1212     break;}
1213 case 32:
1214 #line 314 "parse.y"
1215 {
1216                         yyval.id = g_strdup("char");
1217                                                 ;
1218     break;}
1219 case 33:
1220 #line 317 "parse.y"
1221 {
1222                         yyval.id = g_strdup("double");
1223                                                 ;
1224     break;}
1225 case 34:
1226 #line 320 "parse.y"
1227 {
1228                         yyval.id = g_strdup("float");
1229                                                 ;
1230     break;}
1231 case 35:
1232 #line 323 "parse.y"
1233 {
1234                         yyval.id = yyvsp[0].id;
1235                                                 ;
1236     break;}
1237 case 36:
1238 #line 326 "parse.y"
1239 {
1240                         yyval.id = g_strconcat(yyvsp[-1].id,yyvsp[0].id,NULL);
1241                         g_free(yyvsp[0].id);
1242                                                 ;
1243     break;}
1244 case 37:
1245 #line 330 "parse.y"
1246 {
1247                         yyval.id = yyvsp[0].id;
1248                                                 ;
1249     break;}
1250 case 38:
1251 #line 333 "parse.y"
1252 {
1253                         yyval.id = g_strdup("void");
1254                                                 ;
1255     break;}
1256 case 39:
1257 #line 338 "parse.y"
1258 {
1259                         yyval.id = "long int";
1260                                                 ;
1261     break;}
1262 case 40:
1263 #line 341 "parse.y"
1264 {
1265                         yyval.id = "long";
1266                                                 ;
1267     break;}
1268 case 41:
1269 #line 344 "parse.y"
1270 {
1271                         yyval.id = "short int";
1272                                                 ;
1273     break;}
1274 case 42:
1275 #line 347 "parse.y"
1276 {
1277                         yyval.id = "short";
1278                                                 ;
1279     break;}
1280 case 43:
1281 #line 350 "parse.y"
1282 {
1283                         yyval.id = "int";
1284                                                 ;
1285     break;}
1286 case 44:
1287 #line 355 "parse.y"
1288 {
1289                         yyval.id = "enum ";
1290                                                 ;
1291     break;}
1292 case 45:
1293 #line 358 "parse.y"
1294 {
1295                         yyval.id = "union ";
1296                                                 ;
1297     break;}
1298 case 46:
1299 #line 361 "parse.y"
1300 {
1301                         yyval.id = "struct ";
1302                                                 ;
1303     break;}
1304 case 47:
1305 #line 366 "parse.y"
1306 { stars++; ;
1307     break;}
1308 case 48:
1309 #line 367 "parse.y"
1310 { stars++; ;
1311     break;}
1312 case 49:
1313 #line 370 "parse.y"
1314 {
1315                         gtktypes = g_list_prepend(gtktypes,yyvsp[-3].id);
1316                                                 ;
1317     break;}
1318 case 50:
1319 #line 375 "parse.y"
1320 {
1321                         gtktypes = g_list_append(gtktypes,yyvsp[0].id);
1322                                                 ;
1323     break;}
1324 case 51:
1325 #line 378 "parse.y"
1326
1327                         gtktypes = g_list_append(gtktypes,yyvsp[0].id);
1328                                                 ;
1329     break;}
1330 case 52:
1331 #line 384 "parse.y"
1332 {
1333                         if(!has_this) {
1334                                 yyerror(_("signal without 'this' as "
1335                                           "first parameter"));
1336                                 YYERROR;
1337                         }
1338                         push_function(SIGNAL_LAST_METHOD,NULL,
1339                                       yyvsp[-6].id, yyvsp[-2].id, yyvsp[0].cbuf,yyvsp[-10].line);
1340                                                                         ;
1341     break;}
1342 case 53:
1343 #line 393 "parse.y"
1344 {
1345                         if(!has_this) {
1346                                 yyerror(_("signal without 'this' as "
1347                                           "first parameter"));
1348                                 YYERROR;
1349                         }
1350                         push_function(SIGNAL_LAST_METHOD, NULL,
1351                                       yyvsp[-5].id, yyvsp[-1].id, NULL,yyvsp[-9].line);
1352                                                                         ;
1353     break;}
1354 case 54:
1355 #line 402 "parse.y"
1356 {
1357                         if(!has_this) {
1358                                 yyerror(_("signal without 'this' as "
1359                                           "first parameter"));
1360                                 YYERROR;
1361                         }
1362                         push_function(SIGNAL_FIRST_METHOD, NULL,
1363                                       yyvsp[-6].id, yyvsp[-2].id, yyvsp[0].cbuf,yyvsp[-10].line);
1364                                                                         ;
1365     break;}
1366 case 55:
1367 #line 411 "parse.y"
1368 {
1369                         if(!has_this) {
1370                                 yyerror(_("signal without 'this' as "
1371                                           "first parameter"));
1372                                 YYERROR;
1373                         }
1374                         push_function(SIGNAL_FIRST_METHOD, NULL, yyvsp[-5].id,
1375                                       yyvsp[-1].id, NULL,yyvsp[-9].line);
1376                                                                         ;
1377     break;}
1378 case 56:
1379 #line 420 "parse.y"
1380 {
1381                         if(!has_this) {
1382                                 yyerror(_("signal without 'this' as "
1383                                           "first parameter"));
1384                                 YYERROR;
1385                         }
1386                         push_function(SIGNAL_LAST_METHOD, NULL,
1387                                       yyvsp[-6].id, yyvsp[-2].id, yyvsp[0].cbuf,yyvsp[-9].line);
1388                                                                         ;
1389     break;}
1390 case 57:
1391 #line 429 "parse.y"
1392 {
1393                         if(!has_this) {
1394                                 yyerror(_("signal without 'this' as "
1395                                           "first parameter"));
1396                                 YYERROR;
1397                         }
1398                         push_function(SIGNAL_LAST_METHOD, NULL, yyvsp[-5].id,
1399                                       yyvsp[-1].id, NULL,yyvsp[-8].line);
1400                                                                         ;
1401     break;}
1402 case 58:
1403 #line 438 "parse.y"
1404 {
1405                         push_function(VIRTUAL_METHOD, NULL, yyvsp[-6].id,
1406                                       yyvsp[-2].id, yyvsp[0].cbuf,yyvsp[-8].line);
1407                                                                         ;
1408     break;}
1409 case 59:
1410 #line 442 "parse.y"
1411 {
1412                         push_function(VIRTUAL_METHOD, NULL, yyvsp[-5].id,
1413                                       yyvsp[-1].id, NULL,yyvsp[-7].line);
1414                                                                         ;
1415     break;}
1416 case 60:
1417 #line 446 "parse.y"
1418 {
1419                         push_function(OVERRIDE_METHOD, yyvsp[-9].id,
1420                                       yyvsp[-6].id, yyvsp[-2].id, yyvsp[0].cbuf,yyvsp[-11].line);
1421                                                                         ;
1422     break;}
1423 case 61:
1424 #line 450 "parse.y"
1425 {
1426                         push_function(PUBLIC_SCOPE, NULL, yyvsp[-6].id,
1427                                       yyvsp[-2].id, yyvsp[0].cbuf,yyvsp[-8].line);
1428                                                                 ;
1429     break;}
1430 case 62:
1431 #line 454 "parse.y"
1432 {
1433                         push_function(PRIVATE_SCOPE, NULL, yyvsp[-6].id,
1434                                       yyvsp[-2].id, yyvsp[0].cbuf,yyvsp[-8].line);
1435                                                                 ;
1436     break;}
1437 case 63:
1438 #line 458 "parse.y"
1439 {
1440                         if(strcmp(yyvsp[-4].id,"init")==0) {
1441                                 push_init_arg(yyvsp[-2].id,FALSE);
1442                                 push_function(INIT_METHOD, NULL, yyvsp[-4].id, 
1443                                               NULL, NULL,yyvsp[-3].line);
1444                         } else if(strcmp(yyvsp[-4].id,"class_init")==0) {
1445                                 push_init_arg(yyvsp[-2].id,TRUE);
1446                                 push_function(CLASS_INIT_METHOD, NULL,
1447                                               yyvsp[-4].id, NULL, NULL,yyvsp[-3].line);
1448                         } else {
1449                                 g_free(yyvsp[-4].id);
1450                                 g_free(yyvsp[-2].id);
1451                                 yyerror(_("parse error"));
1452                                 YYERROR;
1453                         }
1454                                                 ;
1455     break;}
1456 case 64:
1457 #line 474 "parse.y"
1458 {
1459                         if(strcmp(yyvsp[-5].id,"init")==0) {
1460                                 push_init_arg(yyvsp[-3].id,FALSE);
1461                                 push_function(INIT_METHOD, NULL,
1462                                               yyvsp[-5].id, NULL, yyvsp[0].cbuf,yyvsp[-4].line);
1463                         } else if(strcmp(yyvsp[-5].id,"class_init")==0) {
1464                                 push_init_arg(yyvsp[-3].id,TRUE);
1465                                 push_function(CLASS_INIT_METHOD, NULL, 
1466                                               yyvsp[-5].id, NULL, yyvsp[0].cbuf,yyvsp[-4].line);
1467                         } else {
1468                                 g_free(yyvsp[-5].id);
1469                                 g_free(yyvsp[-3].id);
1470                                 g_string_free(yyvsp[-3].cbuf,TRUE);
1471                                 yyerror(_("parse error"));
1472                                 YYERROR;
1473                         }
1474                                                 ;
1475     break;}
1476 case 65:
1477 #line 493 "parse.y"
1478 { yyval.id = yyvsp[0].id; ;
1479     break;}
1480 case 66:
1481 #line 494 "parse.y"
1482 { yyval.id = yyvsp[0].id; ;
1483     break;}
1484 case 67:
1485 #line 495 "parse.y"
1486 {
1487                         yyval.id = (yyvsp[0].cbuf)->str;
1488                         g_string_free(yyvsp[0].cbuf,FALSE);
1489                                         ;
1490     break;}
1491 case 68:
1492 #line 499 "parse.y"
1493 { ; ;
1494     break;}
1495 case 69:
1496 #line 500 "parse.y"
1497 { yyval.id = NULL; ;
1498     break;}
1499 case 70:
1500 #line 505 "parse.y"
1501 { has_this = FALSE; ;
1502     break;}
1503 case 71:
1504 #line 506 "parse.y"
1505 {
1506                         has_this = TRUE;
1507                         if(strcmp(yyvsp[0].id,"this")==0)
1508                                 push_this(yyvsp[0].id);
1509                         else {
1510                                 g_free(yyvsp[0].id);
1511                                 yyerror(_("parse error"));
1512                                 YYERROR;
1513                         }
1514                                         ;
1515     break;}
1516 case 72:
1517 #line 516 "parse.y"
1518 {
1519                         has_this = TRUE;
1520                         if(strcmp(yyvsp[-2].id,"this")==0)
1521                                 push_this(yyvsp[-2].id);
1522                         else {
1523                                 g_free(yyvsp[-2].id);
1524                                 yyerror(_("parse error"));
1525                                 YYERROR;
1526                         }
1527                                         ;
1528     break;}
1529 case 73:
1530 #line 526 "parse.y"
1531 { has_this = FALSE; ;
1532     break;}
1533 case 74:
1534 #line 529 "parse.y"
1535 { ; ;
1536     break;}
1537 case 75:
1538 #line 530 "parse.y"
1539 { ; ;
1540     break;}
1541 case 76:
1542 #line 533 "parse.y"
1543 {
1544                         push_funcarg(yyvsp[0].id);
1545                                                                 ;
1546     break;}
1547 case 77:
1548 #line 536 "parse.y"
1549 {
1550                         push_funcarg(yyvsp[-4].id);
1551                                                                 ;
1552     break;}
1553 case 78:
1554 #line 541 "parse.y"
1555 { ; ;
1556     break;}
1557 case 79:
1558 #line 542 "parse.y"
1559 { ; ;
1560     break;}
1561 case 80:
1562 #line 545 "parse.y"
1563 {
1564                         Node *node = new_check(NULL_CHECK,NULL);
1565                         checks = g_list_append(checks,node);
1566                                         ;
1567     break;}
1568 case 81:
1569 #line 549 "parse.y"
1570 {
1571                         Node *node = new_check(TYPE_CHECK,NULL);
1572                         checks = g_list_append(checks,node);
1573                                         ;
1574     break;}
1575 case 82:
1576 #line 553 "parse.y"
1577 {
1578                         Node *node = new_check(GT_CHECK,yyvsp[0].id);
1579                         checks = g_list_append(checks,node);
1580                                         ;
1581     break;}
1582 case 83:
1583 #line 557 "parse.y"
1584 {
1585                         Node *node = new_check(LT_CHECK,yyvsp[0].id);
1586                         checks = g_list_append(checks,node);
1587                                         ;
1588     break;}
1589 case 84:
1590 #line 561 "parse.y"
1591 {
1592                         Node *node = new_check(GE_CHECK,yyvsp[0].id);
1593                         checks = g_list_append(checks,node);
1594                                         ;
1595     break;}
1596 case 85:
1597 #line 565 "parse.y"
1598 {
1599                         Node *node = new_check(LE_CHECK,yyvsp[0].id);
1600                         checks = g_list_append(checks,node);
1601                                         ;
1602     break;}
1603 case 86:
1604 #line 569 "parse.y"
1605 {
1606                         Node *node = new_check(EQ_CHECK,yyvsp[0].id);
1607                         checks = g_list_append(checks,node);
1608                                         ;
1609     break;}
1610 case 87:
1611 #line 573 "parse.y"
1612 {
1613                         Node *node = new_check(NE_CHECK,yyvsp[0].id);
1614                         checks = g_list_append(checks,node);
1615                                         ;
1616     break;}
1617 case 88:
1618 #line 579 "parse.y"
1619 { yyval.id = yyvsp[0].id; ;
1620     break;}
1621 case 89:
1622 #line 580 "parse.y"
1623 {
1624                         yyval.id = g_strconcat("-",yyvsp[0].id,NULL);
1625                         g_free(yyvsp[0].id);
1626                                         ;
1627     break;}
1628 }
1629    /* the action file gets copied in in place of this dollarsign */
1630 #line 542 "/usr/lib/bison.simple"
1631 \f
1632   yyvsp -= yylen;
1633   yyssp -= yylen;
1634 #ifdef YYLSP_NEEDED
1635   yylsp -= yylen;
1636 #endif
1637
1638 #if YYDEBUG != 0
1639   if (yydebug)
1640     {
1641       short *ssp1 = yyss - 1;
1642       fprintf (stderr, "state stack now");
1643       while (ssp1 != yyssp)
1644         fprintf (stderr, " %d", *++ssp1);
1645       fprintf (stderr, "\n");
1646     }
1647 #endif
1648
1649   *++yyvsp = yyval;
1650
1651 #ifdef YYLSP_NEEDED
1652   yylsp++;
1653   if (yylen == 0)
1654     {
1655       yylsp->first_line = yylloc.first_line;
1656       yylsp->first_column = yylloc.first_column;
1657       yylsp->last_line = (yylsp-1)->last_line;
1658       yylsp->last_column = (yylsp-1)->last_column;
1659       yylsp->text = 0;
1660     }
1661   else
1662     {
1663       yylsp->last_line = (yylsp+yylen-1)->last_line;
1664       yylsp->last_column = (yylsp+yylen-1)->last_column;
1665     }
1666 #endif
1667
1668   /* Now "shift" the result of the reduction.
1669      Determine what state that goes to,
1670      based on the state we popped back to
1671      and the rule number reduced by.  */
1672
1673   yyn = yyr1[yyn];
1674
1675   yystate = yypgoto[yyn - YYNTBASE] + *yyssp;
1676   if (yystate >= 0 && yystate <= YYLAST && yycheck[yystate] == *yyssp)
1677     yystate = yytable[yystate];
1678   else
1679     yystate = yydefgoto[yyn - YYNTBASE];
1680
1681   goto yynewstate;
1682
1683 yyerrlab:   /* here on detecting error */
1684
1685   if (! yyerrstatus)
1686     /* If not already recovering from an error, report this error.  */
1687     {
1688       ++yynerrs;
1689
1690 #ifdef YYERROR_VERBOSE
1691       yyn = yypact[yystate];
1692
1693       if (yyn > YYFLAG && yyn < YYLAST)
1694         {
1695           int size = 0;
1696           char *msg;
1697           int x, count;
1698
1699           count = 0;
1700           /* Start X at -yyn if nec to avoid negative indexes in yycheck.  */
1701           for (x = (yyn < 0 ? -yyn : 0);
1702                x < (sizeof(yytname) / sizeof(char *)); x++)
1703             if (yycheck[x + yyn] == x)
1704               size += strlen(yytname[x]) + 15, count++;
1705           msg = (char *) malloc(size + 15);
1706           if (msg != 0)
1707             {
1708               strcpy(msg, "parse error");
1709
1710               if (count < 5)
1711                 {
1712                   count = 0;
1713                   for (x = (yyn < 0 ? -yyn : 0);
1714                        x < (sizeof(yytname) / sizeof(char *)); x++)
1715                     if (yycheck[x + yyn] == x)
1716                       {
1717                         strcat(msg, count == 0 ? ", expecting `" : " or `");
1718                         strcat(msg, yytname[x]);
1719                         strcat(msg, "'");
1720                         count++;
1721                       }
1722                 }
1723               yyerror(msg);
1724               free(msg);
1725             }
1726           else
1727             yyerror ("parse error; also virtual memory exceeded");
1728         }
1729       else
1730 #endif /* YYERROR_VERBOSE */
1731         yyerror("parse error");
1732     }
1733
1734   goto yyerrlab1;
1735 yyerrlab1:   /* here on error raised explicitly by an action */
1736
1737   if (yyerrstatus == 3)
1738     {
1739       /* if just tried and failed to reuse lookahead token after an error, discard it.  */
1740
1741       /* return failure if at end of input */
1742       if (yychar == YYEOF)
1743         YYABORT;
1744
1745 #if YYDEBUG != 0
1746       if (yydebug)
1747         fprintf(stderr, "Discarding token %d (%s).\n", yychar, yytname[yychar1]);
1748 #endif
1749
1750       yychar = YYEMPTY;
1751     }
1752
1753   /* Else will try to reuse lookahead token
1754      after shifting the error token.  */
1755
1756   yyerrstatus = 3;              /* Each real token shifted decrements this */
1757
1758   goto yyerrhandle;
1759
1760 yyerrdefault:  /* current state does not do anything special for the error token. */
1761
1762 #if 0
1763   /* This is wrong; only states that explicitly want error tokens
1764      should shift them.  */
1765   yyn = yydefact[yystate];  /* If its default is to accept any token, ok.  Otherwise pop it.*/
1766   if (yyn) goto yydefault;
1767 #endif
1768
1769 yyerrpop:   /* pop the current state because it cannot handle the error token */
1770
1771   if (yyssp == yyss) YYABORT;
1772   yyvsp--;
1773   yystate = *--yyssp;
1774 #ifdef YYLSP_NEEDED
1775   yylsp--;
1776 #endif
1777
1778 #if YYDEBUG != 0
1779   if (yydebug)
1780     {
1781       short *ssp1 = yyss - 1;
1782       fprintf (stderr, "Error: state stack now");
1783       while (ssp1 != yyssp)
1784         fprintf (stderr, " %d", *++ssp1);
1785       fprintf (stderr, "\n");
1786     }
1787 #endif
1788
1789 yyerrhandle:
1790
1791   yyn = yypact[yystate];
1792   if (yyn == YYFLAG)
1793     goto yyerrdefault;
1794
1795   yyn += YYTERROR;
1796   if (yyn < 0 || yyn > YYLAST || yycheck[yyn] != YYTERROR)
1797     goto yyerrdefault;
1798
1799   yyn = yytable[yyn];
1800   if (yyn < 0)
1801     {
1802       if (yyn == YYFLAG)
1803         goto yyerrpop;
1804       yyn = -yyn;
1805       goto yyreduce;
1806     }
1807   else if (yyn == 0)
1808     goto yyerrpop;
1809
1810   if (yyn == YYFINAL)
1811     YYACCEPT;
1812
1813 #if YYDEBUG != 0
1814   if (yydebug)
1815     fprintf(stderr, "Shifting error token, ");
1816 #endif
1817
1818   *++yyvsp = yylval;
1819 #ifdef YYLSP_NEEDED
1820   *++yylsp = yylloc;
1821 #endif
1822
1823   yystate = yyn;
1824   goto yynewstate;
1825
1826  yyacceptlab:
1827   /* YYACCEPT comes here.  */
1828   if (yyfree_stacks)
1829     {
1830       free (yyss);
1831       free (yyvs);
1832 #ifdef YYLSP_NEEDED
1833       free (yyls);
1834 #endif
1835     }
1836   return 0;
1837
1838  yyabortlab:
1839   /* YYABORT comes here.  */
1840   if (yyfree_stacks)
1841     {
1842       free (yyss);
1843       free (yyvs);
1844 #ifdef YYLSP_NEEDED
1845       free (yyls);
1846 #endif
1847     }
1848   return 1;
1849 }
1850 #line 586 "parse.y"
1851