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