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