2 /* A Bison parser, made from parse.y
3 by GNU Bison version 1.28 */
5 #define YYBISON 1 /* Identify Bison output. */
51 #include "treefuncs.h"
59 static GList *class_nodes = NULL;
61 char *chunk_size = NULL;
63 static GList *typestack = NULL;
64 static GList *funcargs = NULL;
65 static GList *checks = NULL;
66 static int has_self = FALSE;
67 static int vararg = FALSE;
69 /* destructor and initializer for variables */
70 static char *destructor = NULL;
71 static int destructor_line = 0;
72 static gboolean destructor_simple = TRUE;
73 static char *initializer = NULL;
74 static int initializer_line = 0;
76 static char *onerror = NULL;
77 static char *defreturn = NULL;
79 static GList *gtktypes = NULL;
81 /* this can be a global as we will only do one function at a time
83 static int the_scope = NO_SCOPE;
88 extern int ccode_line;
99 if(strcmp(yytext,"\n")==0) {
100 out=g_strconcat("Error: ",str," before newline",NULL);
101 } else if(yytext[0]=='\0') {
102 out=g_strconcat("Error: ", str, " at end of input", NULL);
104 char *tmp = g_strdup(yytext);
105 while((p=strchr(tmp, '\n')))
108 out=g_strconcat("Error: ", str, " before '", tmp, "'", NULL);
112 fprintf(stderr, "%s:%d: %s\n", filename, line_no, out);
121 Type *type = typestack->data;
122 typestack = g_list_remove(typestack,typestack->data);
127 push_variable(char *name, int scope, int line_no, char *postfix)
130 Type *type = pop_type();
132 type->postfix = postfix;
134 var = new_variable(scope, type, name, line_no,
135 destructor, destructor_line,
137 initializer, initializer_line);
138 class_nodes = g_list_append(class_nodes, var);
142 push_function(int scope, int method, char *oid, char *id,
143 GString *cbuf, int line_no, int ccode_line,
144 gboolean vararg, GList *flags)
150 g_assert(scope != CLASS_SCOPE);
152 if(method == INIT_METHOD || method == CLASS_INIT_METHOD) {
153 type = (Type *)new_type(g_strdup("void"), NULL, NULL);
158 /* a complicated and ugly test to figure out if we have
159 the wrong number of types for a signal */
160 if((method == SIGNAL_FIRST_METHOD ||
161 method == SIGNAL_LAST_METHOD) &&
162 g_list_length(gtktypes) != g_list_length(funcargs) &&
163 !(g_list_length(funcargs) == 1 &&
164 g_list_length(gtktypes) == 2 &&
165 strcmp(gtktypes->next->data, "NONE")==0)) {
166 print_error(TRUE, _("The number of GTK arguments and "
167 "function arguments for a signal "
168 "don't seem to match"), line_no);
170 if(g_list_length(gtktypes) > 2) {
172 for(li = gtktypes->next; li; li = li->next) {
173 if(strcmp(li->data, "NONE")==0) {
175 _("NONE can only appear in an "
176 "argument list by itself"),
183 c_cbuf = p = cbuf->str;
184 while(p && *p && (*p==' ' || *p=='\t' || *p=='\n' || *p=='\r'))
191 node = new_method(scope, method, type, oid, gtktypes, flags,
192 id, funcargs, onerror, defreturn, c_cbuf, line_no,
193 ccode_line, vararg, method_unique_id++);
197 /*only free segment if we haven't passed it
206 class_nodes = g_list_append(class_nodes, node);
210 free_all_global_state(void)
220 g_list_foreach(gtktypes, (GFunc)g_free, NULL);
221 g_list_free(gtktypes);
224 free_node_list(funcargs);
229 push_funcarg(char *name, char *postfix)
232 Type *type = pop_type();
234 type->postfix = postfix;
236 node = new_funcarg(type, name, checks);
239 funcargs = g_list_append(funcargs, node);
243 push_init_arg(char *name, int is_class)
250 tn = g_strconcat(((Class *)class)->otype,":Class",NULL);
252 tn = g_strdup(((Class *)class)->otype);
254 type = new_type(tn, g_strdup("*"), NULL);
255 node = new_funcarg((Type *)type,name,NULL);
256 funcargs = g_list_prepend(funcargs, node);
265 type = new_type(g_strdup(((Class *)class)->otype), g_strdup("*"), NULL);
266 ch = g_list_append(ch,new_check(NULL_CHECK,NULL));
267 ch = g_list_append(ch,new_check(TYPE_CHECK,NULL));
268 node = new_funcarg((Type *)type,id,ch);
269 funcargs = g_list_prepend(funcargs, node);
273 find_var_or_die(const char *id, int line)
278 for(li = class_nodes; li != NULL; li = li->next) {
280 Node *node = li->data;
281 if(node->type != VARIABLE_NODE)
284 if(strcmp(var->id, id)==0)
288 s = g_strdup_printf(_("Variable %s not defined here"), id);
289 print_error(FALSE, s, line);
291 g_assert_not_reached();
296 set_return_value(char *type, char *val)
298 if(strcmp(type, "onerror")==0) {
304 } else if(strcmp(type, "defreturn")==0) {
338 #define YYFLAG -32768
341 #define YYTRANSLATE(x) ((unsigned)(x) <= 290 ? yytranslate[x] : 88)
343 static const char yytranslate[] = { 0,
344 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
345 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
346 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
347 2, 2, 48, 2, 2, 2, 2, 2, 2, 39,
348 40, 44, 2, 45, 49, 2, 2, 2, 2, 2,
349 2, 2, 2, 2, 2, 2, 2, 2, 41, 47,
350 42, 46, 2, 2, 2, 2, 2, 2, 2, 2,
351 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
352 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
353 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
354 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
355 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
356 2, 2, 37, 43, 38, 2, 2, 2, 2, 2,
357 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
358 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
359 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
360 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
361 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
362 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
363 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
364 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
365 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
366 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
367 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
368 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
369 2, 2, 2, 2, 2, 1, 3, 4, 5, 6,
370 7, 8, 9, 10, 11, 12, 13, 14, 15, 16,
371 17, 18, 19, 20, 21, 22, 23, 24, 25, 26,
372 27, 28, 29, 30, 31, 32, 33, 34, 35, 36
376 static const short yyprhs[] = { 0,
377 0, 4, 7, 10, 12, 14, 16, 18, 20, 22,
378 24, 27, 29, 34, 38, 44, 45, 50, 55, 58,
379 60, 62, 64, 66, 68, 70, 72, 74, 76, 79,
380 83, 86, 90, 93, 96, 98, 100, 101, 107, 114,
381 126, 135, 141, 147, 149, 153, 154, 158, 160, 163,
382 165, 167, 169, 172, 175, 178, 182, 186, 189, 192,
383 195, 197, 200, 202, 205, 207, 209, 211, 213, 215,
384 217, 219, 221, 223, 225, 227, 229, 231, 234, 237,
385 241, 244, 246, 250, 254, 257, 259, 264, 268, 270,
386 273, 275, 286, 298, 308, 318, 327, 339, 348, 354,
387 357, 362, 363, 365, 368, 370, 372, 376, 378, 382,
388 384, 388, 390, 393, 397, 404, 412, 415, 417, 419,
389 422, 425, 429, 433, 437, 441, 443, 446
392 static const short yyrhs[] = { 52,
393 53, 52, 0, 53, 52, 0, 52, 53, 0, 53,
394 0, 23, 0, 26, 0, 24, 0, 25, 0, 27,
395 0, 28, 0, 52, 51, 0, 51, 0, 54, 37,
396 56, 38, 0, 54, 37, 38, 0, 3, 21, 4,
397 21, 55, 0, 0, 39, 19, 19, 40, 0, 39,
398 19, 20, 40, 0, 56, 57, 0, 57, 0, 78,
399 0, 62, 0, 63, 0, 41, 0, 29, 0, 30,
400 0, 31, 0, 32, 0, 19, 19, 0, 19, 37,
401 23, 0, 42, 87, 0, 42, 37, 23, 0, 59,
402 60, 0, 60, 59, 0, 60, 0, 59, 0, 0,
403 58, 67, 19, 61, 41, 0, 58, 67, 19, 22,
404 61, 41, 0, 33, 65, 64, 19, 19, 37, 23,
405 19, 37, 23, 41, 0, 33, 65, 64, 19, 19,
406 37, 23, 41, 0, 33, 65, 64, 19, 19, 0,
407 19, 39, 19, 67, 40, 0, 19, 0, 39, 66,
408 40, 0, 0, 19, 43, 66, 0, 19, 0, 68,
409 72, 0, 68, 0, 69, 0, 19, 0, 5, 19,
410 0, 19, 5, 0, 71, 19, 0, 5, 71, 19,
411 0, 71, 19, 5, 0, 70, 69, 0, 21, 69,
412 0, 5, 69, 0, 21, 0, 21, 5, 0, 70,
413 0, 70, 5, 0, 6, 0, 18, 0, 14, 0,
414 15, 0, 13, 0, 16, 0, 17, 0, 11, 0,
415 12, 0, 7, 0, 8, 0, 9, 0, 44, 0,
416 44, 5, 0, 44, 72, 0, 44, 5, 72, 0,
417 19, 75, 0, 75, 0, 58, 19, 75, 0, 19,
418 58, 75, 0, 58, 75, 0, 73, 0, 19, 39,
419 76, 40, 0, 76, 45, 19, 0, 19, 0, 37,
420 23, 0, 41, 0, 35, 65, 74, 67, 19, 39,
421 81, 40, 79, 77, 0, 58, 35, 65, 73, 67,
422 19, 39, 81, 40, 79, 77, 0, 34, 58, 67,
423 19, 39, 81, 40, 79, 77, 0, 58, 34, 67,
424 19, 39, 81, 40, 79, 77, 0, 34, 67, 19,
425 39, 81, 40, 79, 77, 0, 36, 39, 21, 40,
426 67, 19, 39, 81, 40, 79, 77, 0, 58, 67,
427 19, 39, 81, 40, 79, 77, 0, 19, 39, 19,
428 40, 77, 0, 19, 80, 0, 19, 80, 19, 80,
429 0, 0, 87, 0, 37, 23, 0, 6, 0, 19,
430 0, 19, 45, 82, 0, 82, 0, 83, 45, 10,
431 0, 83, 0, 83, 45, 84, 0, 84, 0, 67,
432 19, 0, 67, 19, 22, 0, 67, 19, 39, 19,
433 85, 40, 0, 67, 19, 22, 39, 19, 85, 40,
434 0, 85, 86, 0, 86, 0, 19, 0, 46, 87,
435 0, 47, 87, 0, 46, 42, 87, 0, 47, 42,
436 87, 0, 42, 42, 87, 0, 48, 42, 87, 0,
437 20, 0, 49, 20, 0, 19, 0
443 static const short yyrline[] = { 0,
444 312, 313, 314, 315, 318, 324, 330, 336, 342, 348,
445 356, 357, 360, 365, 372, 377, 378, 386, 397, 398,
446 401, 402, 403, 404, 407, 408, 409, 410, 413, 426,
447 442, 446, 454, 455, 456, 457, 458, 464, 467, 471,
448 506, 534, 604, 613, 619, 620, 623, 626, 632, 636,
449 643, 646, 649, 653, 657, 661, 666, 674, 678, 683,
450 687, 690, 694, 697, 702, 703, 704, 705, 706, 707,
451 708, 709, 710, 713, 714, 715, 718, 719, 720, 724,
452 731, 743, 749, 761, 773, 776, 782, 787, 790, 795,
453 796, 800, 816, 832, 848, 864, 875, 881, 891, 914,
454 925, 944, 950, 951, 957, 958, 969, 979, 982, 983,
455 986, 987, 990, 993, 996, 1004, 1014, 1015, 1018, 1031,
456 1035, 1039, 1043, 1047, 1051, 1057, 1058, 1062
461 #if YYDEBUG != 0 || defined (YYERROR_VERBOSE)
463 static const char * const yytname[] = { "$","error","$undefined.","CLASS",
464 "FROM","CONST","VOID","STRUCT","UNION","ENUM","THREEDOTS","SIGNED","UNSIGNED",
465 "LONG","SHORT","INT","FLOAT","DOUBLE","CHAR","TOKEN","NUMBER","TYPETOKEN","ARRAY_DIM",
466 "CCODE","HTCODE","PHCODE","HCODE","ACODE","ATCODE","PUBLIC","PRIVATE","PROTECTED",
467 "CLASSWIDE","ARGUMENT","VIRTUAL","SIGNAL","OVERRIDE","'{'","'}'","'('","')'",
468 "';'","'='","'|'","'*'","','","'>'","'<'","'!'","'-'","prog","ccode","ccodes",
469 "class","classdec","chunk","classcode","thing","scope","destructor","initializer",
470 "varoptions","variable","argument","argtype","flags","flaglist","type","specifier_list",
471 "spec_list","specifier","strunionenum","pointer","simplesigtype","fullsigtype",
472 "sigtype","tokenlist","codenocode","method","returnvals","retcode","funcargs",
473 "arglist","arglist1","arg","checklist","check","numtok", NULL
477 static const short yyr1[] = { 0,
478 50, 50, 50, 50, 51, 51, 51, 51, 51, 51,
479 52, 52, 53, 53, 54, 55, 55, 55, 56, 56,
480 57, 57, 57, 57, 58, 58, 58, 58, 59, 59,
481 60, 60, 61, 61, 61, 61, 61, 62, 62, 63,
482 63, 63, 64, 64, 65, 65, 66, 66, 67, 67,
483 68, 68, 68, 68, 68, 68, 68, 69, 69, 69,
484 69, 69, 69, 69, 70, 70, 70, 70, 70, 70,
485 70, 70, 70, 71, 71, 71, 72, 72, 72, 72,
486 73, 73, 74, 74, 74, 74, 75, 76, 76, 77,
487 77, 78, 78, 78, 78, 78, 78, 78, 78, 79,
488 79, 79, 80, 80, 81, 81, 81, 81, 82, 82,
489 83, 83, 84, 84, 84, 84, 85, 85, 86, 86,
490 86, 86, 86, 86, 86, 87, 87, 87
493 static const short yyr2[] = { 0,
494 3, 2, 2, 1, 1, 1, 1, 1, 1, 1,
495 2, 1, 4, 3, 5, 0, 4, 4, 2, 1,
496 1, 1, 1, 1, 1, 1, 1, 1, 2, 3,
497 2, 3, 2, 2, 1, 1, 0, 5, 6, 11,
498 8, 5, 5, 1, 3, 0, 3, 1, 2, 1,
499 1, 1, 2, 2, 2, 3, 3, 2, 2, 2,
500 1, 2, 1, 2, 1, 1, 1, 1, 1, 1,
501 1, 1, 1, 1, 1, 1, 1, 2, 2, 3,
502 2, 1, 3, 3, 2, 1, 4, 3, 1, 2,
503 1, 10, 11, 9, 9, 8, 11, 8, 5, 2,
504 4, 0, 1, 2, 1, 1, 3, 1, 3, 1,
505 3, 1, 2, 3, 6, 7, 2, 1, 1, 2,
506 2, 3, 3, 3, 3, 1, 2, 1
509 static const short yydefact[] = { 0,
510 0, 5, 7, 8, 6, 9, 10, 12, 0, 4,
511 0, 0, 11, 3, 2, 0, 0, 1, 0, 25,
512 26, 27, 28, 46, 0, 46, 0, 14, 24, 0,
513 20, 0, 22, 23, 21, 16, 0, 0, 0, 0,
514 65, 74, 75, 76, 72, 73, 69, 67, 68, 70,
515 71, 66, 52, 61, 0, 0, 50, 51, 63, 0,
516 0, 0, 13, 19, 0, 46, 0, 0, 15, 0,
517 48, 0, 44, 0, 0, 53, 60, 0, 54, 62,
518 59, 0, 0, 77, 49, 64, 58, 55, 0, 0,
519 86, 0, 82, 0, 0, 0, 37, 0, 0, 0,
520 45, 0, 0, 56, 0, 0, 78, 79, 57, 0,
521 0, 0, 81, 0, 85, 0, 0, 0, 0, 0,
522 0, 37, 0, 0, 36, 35, 0, 0, 0, 0,
523 91, 99, 47, 0, 42, 0, 65, 52, 0, 0,
524 108, 110, 112, 80, 89, 0, 84, 83, 0, 0,
525 0, 0, 29, 0, 0, 0, 128, 126, 0, 0,
526 31, 33, 34, 38, 17, 18, 90, 0, 0, 0,
527 0, 113, 102, 0, 87, 0, 0, 0, 0, 0,
528 30, 39, 102, 32, 127, 43, 0, 102, 107, 114,
529 0, 0, 0, 109, 111, 88, 0, 0, 102, 0,
530 0, 0, 41, 0, 0, 0, 0, 100, 103, 96,
531 102, 0, 0, 0, 98, 0, 94, 0, 119, 0,
532 0, 0, 0, 0, 118, 104, 0, 0, 102, 95,
533 102, 0, 0, 0, 0, 120, 0, 121, 0, 115,
534 117, 101, 92, 0, 0, 40, 116, 124, 122, 123,
538 static const short yydefgoto[] = { 254,
539 8, 9, 10, 11, 69, 30, 31, 32, 125, 126,
540 127, 33, 34, 74, 39, 72, 139, 57, 58, 59,
541 60, 85, 91, 92, 93, 146, 132, 35, 193, 208,
542 140, 141, 142, 143, 224, 225, 209
545 static const short yypact[] = { 174,
546 -1,-32768,-32768,-32768,-32768,-32768,-32768,-32768, 174, 221,
547 -14, 38,-32768, 221, 221, 175, 23, 221, 29,-32768,
548 -32768,-32768,-32768, 39, 157, 39, 41,-32768,-32768, 193,
549 -32768, 112,-32768,-32768,-32768, 57, 72, 81, 84, 263,
550 -32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,
551 -32768,-32768, 99, 314, 280, 89, 90,-32768, 328, 117,
552 161, 116,-32768,-32768, 280, 39, 119, 123,-32768, 104,
553 105, 114, 118, 133, 342,-32768,-32768, 137,-32768, 342,
554 -32768, 139, 128, 5,-32768, 342,-32768, 176, 211, 160,
555 -32768, 280,-32768, 142, 164, 165, 67, 6, 17, 81,
556 -32768, 166, 177,-32768, 156, 297, 90,-32768,-32768, 178,
557 184, 195,-32768, 31,-32768, 196, 280, 179, 31, 280,
558 -2, -15, 297, 44, 190, 200, 180, 197, 198, 210,
559 -32768,-32768,-32768, 280, 183, 297, 199, 3, 216, 226,
560 -32768, 191,-32768,-32768,-32768, 42,-32768,-32768, 234, 264,
561 297, 271,-32768, 277, 266, 281,-32768,-32768, 294, 302,
562 -32768,-32768,-32768,-32768,-32768,-32768,-32768, 283, 301, 296,
563 280, 51, 318, 246,-32768, 319, 297, 311, 312, 322,
564 -32768,-32768, 318,-32768,-32768,-32768, -3, 318,-32768, 323,
565 332, 46, 17,-32768,-32768,-32768, 324, 297, 318, 297,
566 17, 329,-32768, 17, 346, 93, 344, 349,-32768,-32768,
567 318, 330, 17, 331,-32768, 350,-32768, 93,-32768, 327,
568 52, 65, 333, 103,-32768,-32768, 46, 17, 318,-32768,
569 318, 335, 113, 56, 56,-32768, 56,-32768, 56,-32768,
570 -32768,-32768,-32768, 17, 17,-32768,-32768,-32768,-32768,-32768,
571 -32768,-32768,-32768, 372, 374,-32768
574 static const short yypgoto[] = {-32768,
575 13, 78, 368,-32768,-32768,-32768, 348, -22, 253, 255,
576 259,-32768,-32768,-32768, -20, 282, -18,-32768, -35,-32768,
577 343, -73, 288,-32768, -57,-32768, -192,-32768, -170, 158,
578 -121, 215,-32768, 213, 170, -164, -124
585 static const short yytable[] = { 161,
586 210, 156, 55, 121, 77, 61, 56, 79, 215, 107,
587 108, 217, 201, 67, 170, 202, 153, 204, 81, 12,
588 230, 13, 16, 87, 128, 129, 124, 13, 213, 179,
589 13, 113, 115, 144, 154, 243, 82, 203, 90, 77,
590 228, 17, -106, 36, 77, 96, 95, 171, 84, 110,
591 77, 252, 253, 130, 147, 197, 148, 131, 244, 241,
592 245, 113, 157, 158, 157, 158, 112, 37, 241, 111,
593 157, 158, 190, 116, 157, 158, 212, 38, 214, 62,
594 159, 175, 207, 157, 158, 121, 176, 15, 122, 191,
595 70, 18, 160, 235, 160, 68, 236, 238, 150, 71,
596 160, 152, 73, 79, 160, 123, 237, 83, 124, 248,
597 249, 219, 250, 160, 251, 168, 40, 41, 42, 43,
598 44, 219, 45, 46, 47, 48, 49, 50, 51, 52,
599 53, 219, 54, 84, 220, 88, 94, 97, 221, 222,
600 223, 98, 240, 99, 220, 65, 66, 100, 221, 222,
601 223, 103, 247, 101, 220, 104, 102, 105, 221, 222,
602 223, 40, 41, 42, 43, 44, 106, 45, 46, 47,
603 48, 49, 50, 51, 52, 53, 1, 54, 114, 89,
604 109, 117, 118, 119, 134, 20, 21, 22, 23, 20,
605 21, 22, 23, 19, 136, 135, 2, 3, 4, 5,
606 6, 7, 145, 20, 21, 22, 23, 24, 25, 26,
607 27, 19, 28, 110, 149, 29, 111, 151, 121, 169,
608 164, 20, 21, 22, 23, 24, 25, 26, 27, 110,
609 63, 124, 167, 29, 172, 174, 165, 166, -105, 20,
610 21, 22, 23, 2, 3, 4, 5, 6, 7, 111,
611 40, 41, 42, 43, 44, 194, 45, 46, 47, 48,
612 49, 50, 51, 52, 53, 173, 54, 75, 41, 42,
613 43, 44, 177, 45, 46, 47, 48, 49, 50, 51,
614 52, 76, 178, 54, 40, 41, 42, 43, 44, 180,
615 45, 46, 47, 48, 49, 50, 51, 52, 53, 181,
616 54, 40, 137, 42, 43, 44, 182, 45, 46, 47,
617 48, 49, 50, 51, 52, 138, 184, 54, 80, 41,
618 183, 185, 186, 187, 45, 46, 47, 48, 49, 50,
619 51, 52, 86, 41, 54, 188, 192, 196, 45, 46,
620 47, 48, 49, 50, 51, 52, 75, 41, 54, 198,
621 206, 199, 45, 46, 47, 48, 49, 50, 51, 52,
622 200, 205, 54, 211, 218, 216, 226, 227, 234, 229,
623 231, 255, 232, 256, 239, 246, 14, 64, 163, 162,
624 155, 133, 78, 120, 242, 189, 195, 233
627 static const short yycheck[] = { 124,
628 193, 123, 25, 19, 40, 26, 25, 5, 201, 5,
629 84, 204, 183, 32, 136, 19, 19, 188, 54, 21,
630 213, 9, 37, 59, 19, 20, 42, 15, 199, 151,
631 18, 89, 90, 107, 37, 228, 55, 41, 61, 75,
632 211, 4, 40, 21, 80, 66, 65, 45, 44, 19,
633 86, 244, 245, 37, 112, 177, 114, 41, 229, 224,
634 231, 119, 19, 20, 19, 20, 89, 39, 233, 39,
635 19, 20, 22, 92, 19, 20, 198, 39, 200, 39,
636 37, 40, 37, 19, 20, 19, 45, 10, 22, 39,
637 19, 14, 49, 42, 49, 39, 221, 222, 117, 19,
638 49, 120, 19, 5, 49, 39, 42, 19, 42, 234,
639 235, 19, 237, 49, 239, 134, 5, 6, 7, 8,
640 9, 19, 11, 12, 13, 14, 15, 16, 17, 18,
641 19, 19, 21, 44, 42, 19, 21, 19, 46, 47,
642 48, 19, 40, 40, 42, 34, 35, 43, 46, 47,
643 48, 19, 40, 40, 42, 19, 39, 19, 46, 47,
644 48, 5, 6, 7, 8, 9, 39, 11, 12, 13,
645 14, 15, 16, 17, 18, 19, 3, 21, 19, 19,
646 5, 40, 19, 19, 19, 29, 30, 31, 32, 29,
647 30, 31, 32, 19, 39, 19, 23, 24, 25, 26,
648 27, 28, 19, 29, 30, 31, 32, 33, 34, 35,
649 36, 19, 38, 19, 19, 41, 39, 39, 19, 37,
650 41, 29, 30, 31, 32, 33, 34, 35, 36, 19,
651 38, 42, 23, 41, 19, 45, 40, 40, 40, 29,
652 30, 31, 32, 23, 24, 25, 26, 27, 28, 39,
653 5, 6, 7, 8, 9, 10, 11, 12, 13, 14,
654 15, 16, 17, 18, 19, 40, 21, 5, 6, 7,
655 8, 9, 39, 11, 12, 13, 14, 15, 16, 17,
656 18, 19, 19, 21, 5, 6, 7, 8, 9, 19,
657 11, 12, 13, 14, 15, 16, 17, 18, 19, 23,
658 21, 5, 6, 7, 8, 9, 41, 11, 12, 13,
659 14, 15, 16, 17, 18, 19, 23, 21, 5, 6,
660 40, 20, 40, 23, 11, 12, 13, 14, 15, 16,
661 17, 18, 5, 6, 21, 40, 19, 19, 11, 12,
662 13, 14, 15, 16, 17, 18, 5, 6, 21, 39,
663 19, 40, 11, 12, 13, 14, 15, 16, 17, 18,
664 39, 39, 21, 40, 19, 37, 23, 19, 42, 40,
665 40, 0, 23, 0, 42, 41, 9, 30, 126, 125,
666 122, 100, 40, 96, 227, 171, 174, 218
668 /* -*-C-*- Note some compilers choke on comments on `#line' lines. */
669 #line 3 "/usr/lib/bison.simple"
670 /* This file comes from bison-1.28. */
672 /* Skeleton output parser for bison,
673 Copyright (C) 1984, 1989, 1990 Free Software Foundation, Inc.
675 This program is free software; you can redistribute it and/or modify
676 it under the terms of the GNU General Public License as published by
677 the Free Software Foundation; either version 2, or (at your option)
680 This program is distributed in the hope that it will be useful,
681 but WITHOUT ANY WARRANTY; without even the implied warranty of
682 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
683 GNU General Public License for more details.
685 You should have received a copy of the GNU General Public License
686 along with this program; if not, write to the Free Software
687 Foundation, Inc., 59 Temple Place - Suite 330,
688 Boston, MA 02111-1307, USA. */
690 /* As a special exception, when this file is copied by Bison into a
691 Bison output file, you may use that output file without restriction.
692 This special exception was added by the Free Software Foundation
693 in version 1.24 of Bison. */
695 /* This is the parser code that is written into each bison parser
696 when the %semantic_parser declaration is not specified in the grammar.
697 It was written by Richard Stallman by simplifying the hairy parser
698 used when %semantic_parser is specified. */
700 #ifndef YYSTACK_USE_ALLOCA
702 #define YYSTACK_USE_ALLOCA
703 #else /* alloca not defined */
705 #define YYSTACK_USE_ALLOCA
706 #define alloca __builtin_alloca
707 #else /* not GNU C. */
708 #if (!defined (__STDC__) && defined (sparc)) || defined (__sparc__) || defined (__sparc) || defined (__sgi) || (defined (__sun) && defined (__i386))
709 #define YYSTACK_USE_ALLOCA
711 #else /* not sparc */
712 /* We think this test detects Watcom and Microsoft C. */
713 /* This used to test MSDOS, but that is a bad idea
714 since that symbol is in the user namespace. */
715 #if (defined (_MSDOS) || defined (_MSDOS_)) && !defined (__TURBOC__)
716 #if 0 /* No need for malloc.h, which pollutes the namespace;
717 instead, just don't use alloca. */
720 #else /* not MSDOS, or __TURBOC__ */
722 /* I don't know what this was needed for, but it pollutes the namespace.
723 So I turned it off. rms, 2 May 1997. */
724 /* #include <malloc.h> */
726 #define YYSTACK_USE_ALLOCA
727 #else /* not MSDOS, or __TURBOC__, or _AIX */
729 #ifdef __hpux /* haible@ilog.fr says this works for HPUX 9.05 and up,
730 and on HPUX 10. Eventually we can turn this on. */
731 #define YYSTACK_USE_ALLOCA
732 #define alloca __builtin_alloca
735 #endif /* not _AIX */
736 #endif /* not MSDOS, or __TURBOC__ */
737 #endif /* not sparc */
738 #endif /* not GNU C */
739 #endif /* alloca not defined */
740 #endif /* YYSTACK_USE_ALLOCA not defined */
742 #ifdef YYSTACK_USE_ALLOCA
743 #define YYSTACK_ALLOC alloca
745 #define YYSTACK_ALLOC malloc
748 /* Note: there must be only one dollar sign in this file.
749 It is replaced by the list of actions, each action
750 as one case of the switch. */
752 #define yyerrok (yyerrstatus = 0)
753 #define yyclearin (yychar = YYEMPTY)
756 #define YYACCEPT goto yyacceptlab
757 #define YYABORT goto yyabortlab
758 #define YYERROR goto yyerrlab1
759 /* Like YYERROR except do call yyerror.
760 This remains here temporarily to ease the
761 transition to the new meaning of YYERROR, for GCC.
762 Once GCC version 2 has supplanted version 1, this can go. */
763 #define YYFAIL goto yyerrlab
764 #define YYRECOVERING() (!!yyerrstatus)
765 #define YYBACKUP(token, value) \
767 if (yychar == YYEMPTY && yylen == 1) \
768 { yychar = (token), yylval = (value); \
769 yychar1 = YYTRANSLATE (yychar); \
774 { yyerror ("syntax error: cannot back up"); YYERROR; } \
778 #define YYERRCODE 256
781 #define YYLEX yylex()
787 #define YYLEX yylex(&yylval, &yylloc, YYLEX_PARAM)
789 #define YYLEX yylex(&yylval, &yylloc)
791 #else /* not YYLSP_NEEDED */
793 #define YYLEX yylex(&yylval, YYLEX_PARAM)
795 #define YYLEX yylex(&yylval)
797 #endif /* not YYLSP_NEEDED */
800 /* If nonreentrant, generate the variables here */
804 int yychar; /* the lookahead symbol */
805 YYSTYPE yylval; /* the semantic value of the */
806 /* lookahead symbol */
809 YYLTYPE yylloc; /* location data for the lookahead */
813 int yynerrs; /* number of parse errors so far */
814 #endif /* not YYPURE */
817 int yydebug; /* nonzero means print parse trace */
818 /* Since this is uninitialized, it does not stop multiple parsers
822 /* YYINITDEPTH indicates the initial size of the parser's stacks */
825 #define YYINITDEPTH 200
828 /* YYMAXDEPTH is the maximum size the stacks can grow to
829 (effective only if the built-in stack extension method is used). */
836 #define YYMAXDEPTH 10000
839 /* Define __yy_memcpy. Note that the size argument
840 should be passed with type unsigned int, because that is what the non-GCC
841 definitions require. With GCC, __builtin_memcpy takes an arg
842 of type size_t, but it can handle unsigned int. */
844 #if __GNUC__ > 1 /* GNU C and GNU C++ define this. */
845 #define __yy_memcpy(TO,FROM,COUNT) __builtin_memcpy(TO,FROM,COUNT)
846 #else /* not GNU C or C++ */
849 /* This is the most reliable way to avoid incompatibilities
850 in available built-in functions on various systems. */
852 __yy_memcpy (to, from, count)
857 register char *f = from;
858 register char *t = to;
859 register int i = count;
865 #else /* __cplusplus */
867 /* This is the most reliable way to avoid incompatibilities
868 in available built-in functions on various systems. */
870 __yy_memcpy (char *to, char *from, unsigned int count)
872 register char *t = to;
873 register char *f = from;
874 register int i = count;
883 #line 217 "/usr/lib/bison.simple"
885 /* The user can define YYPARSE_PARAM as the name of an argument to be passed
886 into yyparse. The argument should have type void *.
887 It should actually point to an object.
888 Grammar actions can access the variable by casting it
889 to the proper pointer type. */
893 #define YYPARSE_PARAM_ARG void *YYPARSE_PARAM
894 #define YYPARSE_PARAM_DECL
895 #else /* not __cplusplus */
896 #define YYPARSE_PARAM_ARG YYPARSE_PARAM
897 #define YYPARSE_PARAM_DECL void *YYPARSE_PARAM;
898 #endif /* not __cplusplus */
899 #else /* not YYPARSE_PARAM */
900 #define YYPARSE_PARAM_ARG
901 #define YYPARSE_PARAM_DECL
902 #endif /* not YYPARSE_PARAM */
904 /* Prevent warning if -Wstrict-prototypes. */
907 int yyparse (void *);
914 yyparse(YYPARSE_PARAM_ARG)
917 register int yystate;
919 register short *yyssp;
920 register YYSTYPE *yyvsp;
921 int yyerrstatus; /* number of tokens to shift before error messages enabled */
922 int yychar1 = 0; /* lookahead token as an internal (translated) token number */
924 short yyssa[YYINITDEPTH]; /* the state stack */
925 YYSTYPE yyvsa[YYINITDEPTH]; /* the semantic value stack */
927 short *yyss = yyssa; /* refer to the stacks thru separate pointers */
928 YYSTYPE *yyvs = yyvsa; /* to allow yyoverflow to reallocate them elsewhere */
931 YYLTYPE yylsa[YYINITDEPTH]; /* the location stack */
932 YYLTYPE *yyls = yylsa;
935 #define YYPOPSTACK (yyvsp--, yyssp--, yylsp--)
937 #define YYPOPSTACK (yyvsp--, yyssp--)
940 int yystacksize = YYINITDEPTH;
941 int yyfree_stacks = 0;
952 YYSTYPE yyval; /* the variable used to return */
953 /* semantic values from the action */
960 fprintf(stderr, "Starting parse\n");
966 yychar = YYEMPTY; /* Cause a token to be read. */
968 /* Initialize stack pointers.
969 Waste one element of value and location stack
970 so that they stay on the same level as the state stack.
971 The wasted elements are never initialized. */
979 /* Push a new state, which is found in yystate . */
980 /* In all cases, when you get here, the value and location stacks
981 have just been pushed. so pushing a state here evens the stacks. */
986 if (yyssp >= yyss + yystacksize - 1)
988 /* Give user a chance to reallocate the stack */
989 /* Use copies of these so that the &'s don't force the real ones into memory. */
990 YYSTYPE *yyvs1 = yyvs;
993 YYLTYPE *yyls1 = yyls;
996 /* Get the current used size of the three stacks, in elements. */
997 int size = yyssp - yyss + 1;
1000 /* Each stack pointer address is followed by the size of
1001 the data in use in that stack, in bytes. */
1003 /* This used to be a conditional around just the two extra args,
1004 but that might be undefined if yyoverflow is a macro. */
1005 yyoverflow("parser stack overflow",
1006 &yyss1, size * sizeof (*yyssp),
1007 &yyvs1, size * sizeof (*yyvsp),
1008 &yyls1, size * sizeof (*yylsp),
1011 yyoverflow("parser stack overflow",
1012 &yyss1, size * sizeof (*yyssp),
1013 &yyvs1, size * sizeof (*yyvsp),
1017 yyss = yyss1; yyvs = yyvs1;
1021 #else /* no yyoverflow */
1022 /* Extend the stack our own way. */
1023 if (yystacksize >= YYMAXDEPTH)
1025 yyerror("parser stack overflow");
1037 if (yystacksize > YYMAXDEPTH)
1038 yystacksize = YYMAXDEPTH;
1039 #ifndef YYSTACK_USE_ALLOCA
1042 yyss = (short *) YYSTACK_ALLOC (yystacksize * sizeof (*yyssp));
1043 __yy_memcpy ((char *)yyss, (char *)yyss1,
1044 size * (unsigned int) sizeof (*yyssp));
1045 yyvs = (YYSTYPE *) YYSTACK_ALLOC (yystacksize * sizeof (*yyvsp));
1046 __yy_memcpy ((char *)yyvs, (char *)yyvs1,
1047 size * (unsigned int) sizeof (*yyvsp));
1049 yyls = (YYLTYPE *) YYSTACK_ALLOC (yystacksize * sizeof (*yylsp));
1050 __yy_memcpy ((char *)yyls, (char *)yyls1,
1051 size * (unsigned int) sizeof (*yylsp));
1053 #endif /* no yyoverflow */
1055 yyssp = yyss + size - 1;
1056 yyvsp = yyvs + size - 1;
1058 yylsp = yyls + size - 1;
1063 fprintf(stderr, "Stack size increased to %d\n", yystacksize);
1066 if (yyssp >= yyss + yystacksize - 1)
1072 fprintf(stderr, "Entering state %d\n", yystate);
1078 /* Do appropriate processing given the current state. */
1079 /* Read a lookahead token if we need one and don't already have one. */
1082 /* First try to decide what to do without reference to lookahead token. */
1084 yyn = yypact[yystate];
1088 /* Not known => get a lookahead token if don't already have one. */
1090 /* yychar is either YYEMPTY or YYEOF
1091 or a valid token in external form. */
1093 if (yychar == YYEMPTY)
1097 fprintf(stderr, "Reading a token: ");
1102 /* Convert token to internal form (in yychar1) for indexing tables with */
1104 if (yychar <= 0) /* This means end of input. */
1107 yychar = YYEOF; /* Don't call YYLEX any more */
1111 fprintf(stderr, "Now at end of input.\n");
1116 yychar1 = YYTRANSLATE(yychar);
1121 fprintf (stderr, "Next token is %d (%s", yychar, yytname[yychar1]);
1122 /* Give the individual parser a way to print the precise meaning
1123 of a token, for further debugging info. */
1125 YYPRINT (stderr, yychar, yylval);
1127 fprintf (stderr, ")\n");
1133 if (yyn < 0 || yyn > YYLAST || yycheck[yyn] != yychar1)
1138 /* yyn is what to do for this token type in this state.
1139 Negative => reduce, -yyn is rule number.
1140 Positive => shift, yyn is new state.
1141 New state is final state => don't bother to shift,
1142 just return success.
1143 0, or most negative number => error. */
1158 /* Shift the lookahead token. */
1162 fprintf(stderr, "Shifting token %d (%s), ", yychar, yytname[yychar1]);
1165 /* Discard the token being shifted unless it is eof. */
1166 if (yychar != YYEOF)
1174 /* count tokens shifted since error; after three, turn off error status. */
1175 if (yyerrstatus) yyerrstatus--;
1180 /* Do the default action for the current state. */
1183 yyn = yydefact[yystate];
1187 /* Do a reduction. yyn is the number of a rule to reduce with. */
1191 yyval = yyvsp[1-yylen]; /* implement default value of the action */
1198 fprintf (stderr, "Reducing via rule %d (line %d), ",
1201 /* Print the symbols being reduced, and their result. */
1202 for (i = yyprhs[yyn]; yyrhs[i] > 0; i++)
1203 fprintf (stderr, "%s ", yytname[yyrhs[i]]);
1204 fprintf (stderr, " -> %s\n", yytname[yyr1[yyn]]);
1230 Node *node = new_ccode(C_CCODE,(yyvsp[0].cbuf)->str,
1232 nodes = g_list_append(nodes,node);
1233 g_string_free(yyvsp[0].cbuf,FALSE);
1239 Node *node = new_ccode(H_CCODE,(yyvsp[0].cbuf)->str,
1241 nodes = g_list_append(nodes,node);
1242 g_string_free(yyvsp[0].cbuf,FALSE);
1248 Node *node = new_ccode(HT_CCODE,(yyvsp[0].cbuf)->str,
1250 nodes = g_list_append(nodes,node);
1251 g_string_free(yyvsp[0].cbuf,FALSE);
1257 Node *node = new_ccode(PH_CCODE,(yyvsp[0].cbuf)->str,
1259 nodes = g_list_append(nodes,node);
1260 g_string_free(yyvsp[0].cbuf,FALSE);
1266 Node *node = new_ccode(A_CCODE,(yyvsp[0].cbuf)->str,
1268 nodes = g_list_append(nodes,node);
1269 g_string_free(yyvsp[0].cbuf,FALSE);
1275 Node *node = new_ccode(AT_CCODE,(yyvsp[0].cbuf)->str,
1277 nodes = g_list_append(nodes,node);
1278 g_string_free(yyvsp[0].cbuf,FALSE);
1292 ((Class *)class)->nodes = class_nodes;
1294 nodes = g_list_append(nodes,class);
1300 ((Class *)class)->nodes = NULL;
1302 nodes = g_list_append(nodes,class);
1308 class = new_class(yyvsp[-3].id,yyvsp[-1].id,chunk_size,NULL);
1314 if(strcmp(yyvsp[-2].id,"chunks") == 0) {
1315 chunk_size = g_strdup(yyvsp[0].id);
1317 yyerror(_("parse error"));
1325 if(strcmp(yyvsp[-2].id,"chunks") == 0) {
1326 if(atoi(yyvsp[0].id) != 0)
1327 chunk_size = g_strdup(yyvsp[0].id);
1329 yyerror(_("parse error"));
1360 { the_scope = PUBLIC_SCOPE; ;
1364 { the_scope = PRIVATE_SCOPE; ;
1368 { the_scope = PROTECTED_SCOPE; ;
1372 { the_scope = CLASS_SCOPE; ;
1377 if(strcmp(yyvsp[-1].id, "destroywith")==0) {
1378 g_free(yyvsp[-1].id);
1379 destructor = yyvsp[0].id;
1380 destructor_line = line_no;
1381 destructor_simple = TRUE;
1383 g_free(yyvsp[-1].id);
1384 g_free(yyvsp[0].id);
1385 yyerror(_("parse error"));
1393 if(strcmp(yyvsp[-2].id, "destroy")==0) {
1394 g_free(yyvsp[-2].id);
1395 destructor = (yyvsp[0].cbuf)->str;
1396 g_string_free(yyvsp[0].cbuf, FALSE);
1397 destructor_line = ccode_line;
1398 destructor_simple = FALSE;
1400 g_free(yyvsp[-2].id);
1401 g_string_free(yyvsp[0].cbuf, TRUE);
1402 yyerror(_("parse error"));
1410 initializer = yyvsp[0].id;
1411 initializer_line = ccode_line;
1417 initializer = (yyvsp[0].cbuf)->str;
1418 initializer_line = ccode_line;
1419 g_string_free(yyvsp[0].cbuf, FALSE);
1432 { destructor = NULL; ;
1436 { initializer = NULL; ;
1448 push_variable(yyvsp[-2].id, the_scope,yyvsp[-4].line, NULL);
1454 push_variable(yyvsp[-3].id, the_scope, yyvsp[-5].line, yyvsp[-2].id);
1460 if(strcmp(yyvsp[-6].id,"get")==0 &&
1461 strcmp(yyvsp[-3].id,"set")==0) {
1463 Type *type = pop_type();
1464 g_free(yyvsp[-6].id); g_free(yyvsp[-3].id);
1465 node = new_argument(yyvsp[-8].id,type,yyvsp[-9].list,yyvsp[-7].id,
1466 (yyvsp[-4].cbuf)->str,yyvsp[-5].line,
1467 (yyvsp[-1].cbuf)->str,yyvsp[-2].line,
1469 g_string_free(yyvsp[-4].cbuf,FALSE);
1470 g_string_free(yyvsp[-1].cbuf,FALSE);
1471 class_nodes = g_list_append(class_nodes,node);
1472 } else if(strcmp(yyvsp[-6].id,"set")==0 &&
1473 strcmp(yyvsp[-3].id,"get")==0) {
1475 Type *type = pop_type();
1476 g_free(yyvsp[-6].id); g_free(yyvsp[-3].id);
1477 node = new_argument(yyvsp[-8].id,type,yyvsp[-9].list,yyvsp[-7].id,
1478 (yyvsp[-1].cbuf)->str,yyvsp[-2].line,
1479 (yyvsp[-4].cbuf)->str,yyvsp[-5].line,
1481 g_string_free(yyvsp[-1].cbuf,FALSE);
1482 g_string_free(yyvsp[-4].cbuf,FALSE);
1483 class_nodes = g_list_append(class_nodes,node);
1485 g_free(yyvsp[-8].id); g_free(yyvsp[-7].id);
1486 g_free(yyvsp[-6].id); g_free(yyvsp[-3].id);
1487 g_list_foreach(yyvsp[-9].list,(GFunc)g_free,NULL);
1488 g_string_free(yyvsp[-1].cbuf,TRUE);
1489 g_string_free(yyvsp[-4].cbuf,TRUE);
1490 yyerror(_("parse error"));
1498 if(strcmp(yyvsp[-3].id,"get")==0) {
1500 Type *type = pop_type();
1501 g_free(yyvsp[-3].id);
1502 node = new_argument(yyvsp[-5].id,type,yyvsp[-6].list,yyvsp[-4].id,
1503 (yyvsp[-1].cbuf)->str,yyvsp[-2].line,
1504 NULL,0, yyvsp[-7].line);
1505 g_string_free(yyvsp[-1].cbuf,FALSE);
1506 class_nodes = g_list_append(class_nodes,node);
1507 } else if(strcmp(yyvsp[-3].id,"set")==0) {
1509 Type *type = pop_type();
1510 g_free(yyvsp[-3].id);
1511 node = new_argument(yyvsp[-5].id,type,yyvsp[-6].list,yyvsp[-4].id,
1512 NULL,0,(yyvsp[-1].cbuf)->str,
1513 yyvsp[-2].line, yyvsp[-7].line);
1514 g_string_free(yyvsp[-1].cbuf,FALSE);
1515 class_nodes = g_list_append(class_nodes,node);
1517 g_free(yyvsp[-3].id); g_free(yyvsp[-5].id);
1518 g_free(yyvsp[-4].id);
1519 g_list_foreach(yyvsp[-6].list,(GFunc)g_free,NULL);
1520 g_string_free(yyvsp[-1].cbuf,TRUE);
1521 yyerror(_("parse error"));
1530 char *get, *set = NULL;
1535 if(strcmp(yyvsp[0].id, "link")!=0 &&
1536 strcmp(yyvsp[0].id, "stringlink")!=0 &&
1537 strcmp(yyvsp[0].id, "objectlink")!=0) {
1538 g_free(yyvsp[0].id); g_free(yyvsp[-2].id);
1539 g_free(yyvsp[-1].id);
1540 g_list_foreach(yyvsp[-3].list,(GFunc)g_free,NULL);
1541 yyerror(_("parse error"));
1547 var = find_var_or_die(yyvsp[-1].id, yyvsp[-4].line);
1548 if(var->scope == PRIVATE_SCOPE)
1549 root = "self->_priv";
1550 else if(var->scope == CLASS_SCOPE)
1551 root = "SELF_CLASS(GTK_OBJECT(self)->klass)";
1555 if(strcmp(yyvsp[0].id, "link")==0) {
1556 set = g_strdup_printf("%s->%s = ARG;",
1557 root, yyvsp[-1].id);
1558 } else if(strcmp(yyvsp[0].id, "stringlink")==0) {
1559 set = g_strdup_printf("g_free(%s->%s); "
1560 "%s->%s = g_strdup(ARG);",
1562 root, yyvsp[-1].id);
1563 } else if(strcmp(yyvsp[0].id, "objectlink")==0) {
1564 set = g_strdup_printf(
1566 "gtk_object_unref(GTK_OBJECT(%s->%s)); "
1569 "gtk_object_ref(GTK_OBJECT(%s->%s));",
1574 root, yyvsp[-1].id);
1576 g_assert_not_reached();
1579 if(strcmp(yyvsp[0].id, "stringlink")==0) {
1580 get = g_strdup_printf("ARG = g_strdup(%s->%s);", root, yyvsp[-1].id);
1582 /* For everything else, get is just straight assignment */
1583 get = g_strdup_printf("ARG = %s->%s;", root, yyvsp[-1].id);
1585 g_free(yyvsp[0].id);
1589 type = copy_type(var->vtype);
1591 node = new_argument(yyvsp[-2].id, type, yyvsp[-3].list,
1592 yyvsp[-1].id, get, yyvsp[-4].line,
1593 set, yyvsp[-4].line, yyvsp[-4].line);
1594 class_nodes = g_list_append(class_nodes,node);
1600 if(strcmp(yyvsp[-2].id,"type")!=0) {
1601 g_free(yyvsp[-4].id);
1602 g_free(yyvsp[-2].id);
1603 yyerror(_("parse error"));
1606 yyval.id = yyvsp[-4].id;
1612 yyval.id = yyvsp[0].id;
1613 typestack = g_list_prepend(typestack,NULL);
1618 { yyval.list = yyvsp[-1].list; ;
1622 { yyval.list = NULL; ;
1627 yyval.list = g_list_append(yyvsp[0].list,yyvsp[-2].id);
1633 yyval.list = g_list_append(NULL,yyvsp[0].id);
1639 Node *node = new_type(yyvsp[-1].id, yyvsp[0].id, NULL);
1640 typestack = g_list_prepend(typestack,node);
1646 Node *node = new_type(yyvsp[0].id, NULL, NULL);
1647 typestack = g_list_prepend(typestack,node);
1653 yyval.id = yyvsp[0].id;
1659 yyval.id = yyvsp[0].id;
1665 yyval.id = g_strconcat("const ", yyvsp[0].id, NULL);
1666 g_free(yyvsp[0].id);
1672 yyval.id = g_strconcat(yyvsp[-1].id, " const", NULL);
1673 g_free(yyvsp[-1].id);
1679 yyval.id = g_strconcat(yyvsp[-1].id, " ", yyvsp[0].id, NULL);
1680 g_free(yyvsp[0].id);
1686 yyval.id = g_strconcat("const ", yyvsp[-1].id, " ",
1688 g_free(yyvsp[0].id);
1694 yyval.id = g_strconcat(yyvsp[-2].id, " ",
1695 yyvsp[-1].id, " const", NULL);
1696 g_free(yyvsp[-1].id);
1702 yyval.id = g_strconcat(yyvsp[-1].id, " ", yyvsp[0].id, NULL);
1703 g_free(yyvsp[0].id);
1709 yyval.id = g_strconcat(yyvsp[-1].id, " ", yyvsp[0].id, NULL);
1710 g_free(yyvsp[-1].id);
1711 g_free(yyvsp[0].id);
1717 yyval.id = g_strconcat("const ", yyvsp[0].id, NULL);
1718 g_free(yyvsp[0].id);
1724 yyval.id = yyvsp[0].id;
1730 yyval.id = g_strconcat(yyvsp[-1].id, " const", NULL);
1731 g_free(yyvsp[-1].id);
1737 yyval.id = g_strdup(yyvsp[0].id);
1743 yyval.id = g_strconcat(yyvsp[-1].id, " const", NULL);
1748 { yyval.id = "void"; ;
1752 { yyval.id = "char"; ;
1756 { yyval.id = "short"; ;
1760 { yyval.id = "int"; ;
1764 { yyval.id = "long"; ;
1768 { yyval.id = "float"; ;
1772 { yyval.id = "double"; ;
1776 { yyval.id = "signed"; ;
1780 { yyval.id = "unsigned"; ;
1784 { yyval.id = "struct"; ;
1788 { yyval.id = "union"; ;
1792 { yyval.id = "enum"; ;
1796 { yyval.id = g_strdup("*"); ;
1800 { yyval.id = g_strdup("* const"); ;
1805 yyval.id = g_strconcat("*", yyvsp[0].id, NULL);
1806 g_free(yyvsp[0].id);
1812 yyval.id = g_strconcat("* const", yyvsp[0].id, NULL);
1813 g_free(yyvsp[0].id);
1819 if(strcmp(yyvsp[-1].id, "first")==0)
1820 yyval.sigtype = SIGNAL_FIRST_METHOD;
1821 else if(strcmp(yyvsp[-1].id, "last")==0)
1822 yyval.sigtype = SIGNAL_LAST_METHOD;
1824 yyerror(_("signal must be 'first' or 'last'"));
1825 g_free(yyvsp[-1].id);
1828 g_free(yyvsp[-1].id);
1834 yyval.sigtype = SIGNAL_LAST_METHOD;
1840 if(strcmp(yyvsp[-1].id,"first")==0)
1841 yyval.sigtype = SIGNAL_FIRST_METHOD;
1842 else if(strcmp(yyvsp[-1].id,"last")==0)
1843 yyval.sigtype = SIGNAL_LAST_METHOD;
1845 yyerror(_("signal must be 'first' or 'last'"));
1846 g_free(yyvsp[-1].id);
1849 g_free(yyvsp[-1].id);
1855 if(strcmp(yyvsp[-2].id,"first")==0)
1856 yyval.sigtype = SIGNAL_FIRST_METHOD;
1857 else if(strcmp(yyvsp[-2].id,"last")==0)
1858 yyval.sigtype = SIGNAL_LAST_METHOD;
1860 yyerror(_("signal must be 'first' or 'last'"));
1861 g_free(yyvsp[-2].id);
1864 g_free(yyvsp[-2].id);
1870 yyval.sigtype = SIGNAL_LAST_METHOD;
1876 /* the_scope was default thus public */
1877 the_scope = PUBLIC_SCOPE;
1883 gtktypes = g_list_prepend(gtktypes, yyvsp[-3].id);
1889 gtktypes = g_list_append(gtktypes, yyvsp[0].id);
1895 gtktypes = g_list_append(gtktypes, yyvsp[0].id);
1900 { yyval.cbuf = yyvsp[0].cbuf; ;
1904 { yyval.cbuf = NULL; ;
1910 yyerror(_("signal without 'self' as "
1911 "first parameter"));
1912 free_all_global_state();
1915 if(the_scope == CLASS_SCOPE) {
1916 yyerror(_("a method cannot be of class scope"));
1917 free_all_global_state();
1920 push_function(the_scope, yyvsp[-7].sigtype,NULL,
1921 yyvsp[-5].id, yyvsp[0].cbuf,yyvsp[-9].line,
1922 ccode_line, vararg, yyvsp[-8].list);
1929 yyerror(_("signal without 'self' as "
1930 "first parameter"));
1931 free_all_global_state();
1934 if(the_scope == CLASS_SCOPE) {
1935 yyerror(_("a method cannot be of class scope"));
1936 free_all_global_state();
1939 push_function(the_scope, yyvsp[-7].sigtype, NULL,
1940 yyvsp[-5].id, yyvsp[0].cbuf, yyvsp[-9].line,
1941 ccode_line, vararg, yyvsp[-8].list);
1948 yyerror(_("virtual method without 'self' as "
1949 "first parameter"));
1950 free_all_global_state();
1953 if(the_scope == CLASS_SCOPE) {
1954 yyerror(_("a method cannot be of class scope"));
1955 free_all_global_state();
1958 push_function(the_scope, VIRTUAL_METHOD, NULL, yyvsp[-5].id,
1959 yyvsp[0].cbuf, yyvsp[-8].line,
1960 ccode_line, vararg, NULL);
1967 yyerror(_("virtual method without 'self' as "
1968 "first parameter"));
1969 free_all_global_state();
1972 if(the_scope == CLASS_SCOPE) {
1973 yyerror(_("a method cannot be of class scope"));
1974 free_all_global_state();
1977 push_function(the_scope, VIRTUAL_METHOD, NULL, yyvsp[-5].id,
1978 yyvsp[0].cbuf, yyvsp[-7].line,
1979 ccode_line, vararg, NULL);
1986 yyerror(_("virtual method without 'self' as "
1987 "first parameter"));
1988 free_all_global_state();
1991 push_function(PUBLIC_SCOPE, VIRTUAL_METHOD, NULL,
1992 yyvsp[-5].id, yyvsp[0].cbuf, yyvsp[-7].line,
1993 ccode_line, vararg, NULL);
1999 push_function(NO_SCOPE, OVERRIDE_METHOD, yyvsp[-8].id,
2000 yyvsp[-5].id, yyvsp[0].cbuf,
2001 yyvsp[-10].line, ccode_line,
2008 if(the_scope == CLASS_SCOPE) {
2009 yyerror(_("a method cannot be of class scope"));
2010 free_all_global_state();
2013 push_function(the_scope, REGULAR_METHOD, NULL, yyvsp[-5].id,
2014 yyvsp[0].cbuf, yyvsp[-7].line, ccode_line,
2021 if(strcmp(yyvsp[-4].id, "init")==0) {
2022 push_init_arg(yyvsp[-2].id,FALSE);
2023 push_function(NO_SCOPE, INIT_METHOD, NULL,
2024 yyvsp[-4].id, yyvsp[0].cbuf, yyvsp[-3].line,
2025 ccode_line, FALSE, NULL);
2026 } else if(strcmp(yyvsp[-4].id, "class_init")==0) {
2027 push_init_arg(yyvsp[-2].id,TRUE);
2028 push_function(NO_SCOPE, CLASS_INIT_METHOD, NULL,
2029 yyvsp[-4].id, yyvsp[0].cbuf, yyvsp[-3].line,
2030 ccode_line, FALSE, NULL);
2032 g_free(yyvsp[-4].id);
2033 g_free(yyvsp[-2].id);
2034 g_string_free(yyvsp[0].cbuf,TRUE);
2035 yyerror(_("parse error "
2036 "(untyped blocks must be init or "
2045 g_free(onerror); onerror = NULL;
2046 g_free(defreturn); defreturn = NULL;
2047 if(!set_return_value(yyvsp[-1].id, yyvsp[0].id)) {
2048 g_free(yyvsp[-1].id);
2049 g_free(yyvsp[0].id);
2050 yyerror(_("parse error"));
2053 g_free(yyvsp[-1].id);
2059 g_free(onerror); onerror = NULL;
2060 g_free(defreturn); defreturn = NULL;
2061 if(!set_return_value(yyvsp[-3].id, yyvsp[-2].id)) {
2062 g_free(yyvsp[-3].id); g_free(yyvsp[-2].id);
2063 g_free(yyvsp[-1].id); g_free(yyvsp[0].id);
2064 yyerror(_("parse error"));
2067 if(!set_return_value(yyvsp[-1].id, yyvsp[0].id)) {
2068 onerror = defreturn = NULL;
2069 g_free(yyvsp[-3].id); g_free(yyvsp[-2].id);
2070 g_free(yyvsp[-1].id); g_free(yyvsp[0].id);
2071 yyerror(_("parse error"));
2074 g_free(yyvsp[-3].id);
2075 g_free(yyvsp[-1].id);
2081 g_free(onerror); onerror = NULL;
2082 g_free(defreturn); defreturn = NULL;
2087 { yyval.id = yyvsp[0].id; ;
2092 yyval.id = (yyvsp[1].cbuf)->str;
2093 g_string_free(yyvsp[1].cbuf, FALSE);
2098 { vararg = FALSE; has_self = FALSE; ;
2105 if(strcmp(yyvsp[0].id,"self")==0)
2106 push_self(yyvsp[0].id);
2108 g_free(yyvsp[0].id);
2109 yyerror(_("parse error"));
2118 if(strcmp(yyvsp[-2].id,"self")==0)
2119 push_self(yyvsp[-2].id);
2121 g_free(yyvsp[-2].id);
2122 yyerror(_("parse error"));
2129 { has_self = FALSE; ;
2150 push_funcarg(yyvsp[0].id,NULL);
2156 push_funcarg(yyvsp[-1].id,yyvsp[0].id);
2162 if(strcmp(yyvsp[-2].id,"check")!=0) {
2163 yyerror(_("parse error"));
2166 g_free(yyvsp[-2].id);
2167 push_funcarg(yyvsp[-4].id,NULL);
2171 #line 1004 "parse.y"
2173 if(strcmp(yyvsp[-2].id,"check")!=0) {
2174 yyerror(_("parse error"));
2177 g_free(yyvsp[-2].id);
2178 push_funcarg(yyvsp[-5].id,yyvsp[-4].id);
2182 #line 1014 "parse.y"
2186 #line 1015 "parse.y"
2190 #line 1018 "parse.y"
2192 if(strcmp(yyvsp[0].id,"type")==0) {
2193 Node *node = new_check(TYPE_CHECK,NULL);
2194 checks = g_list_append(checks,node);
2195 } else if(strcmp(yyvsp[0].id,"null")==0) {
2196 Node *node = new_check(NULL_CHECK,NULL);
2197 checks = g_list_append(checks,node);
2199 yyerror(_("parse error"));
2202 g_free(yyvsp[0].id);
2206 #line 1031 "parse.y"
2208 Node *node = new_check(GT_CHECK,yyvsp[0].id);
2209 checks = g_list_append(checks,node);
2213 #line 1035 "parse.y"
2215 Node *node = new_check(LT_CHECK,yyvsp[0].id);
2216 checks = g_list_append(checks,node);
2220 #line 1039 "parse.y"
2222 Node *node = new_check(GE_CHECK,yyvsp[0].id);
2223 checks = g_list_append(checks,node);
2227 #line 1043 "parse.y"
2229 Node *node = new_check(LE_CHECK,yyvsp[0].id);
2230 checks = g_list_append(checks,node);
2234 #line 1047 "parse.y"
2236 Node *node = new_check(EQ_CHECK,yyvsp[0].id);
2237 checks = g_list_append(checks,node);
2241 #line 1051 "parse.y"
2243 Node *node = new_check(NE_CHECK,yyvsp[0].id);
2244 checks = g_list_append(checks,node);
2248 #line 1057 "parse.y"
2249 { yyval.id = yyvsp[0].id; ;
2252 #line 1058 "parse.y"
2254 yyval.id = g_strconcat("-",yyvsp[0].id,NULL);
2255 g_free(yyvsp[0].id);
2259 #line 1062 "parse.y"
2260 { yyval.id = yyvsp[0].id; ;
2263 /* the action file gets copied in in place of this dollarsign */
2264 #line 543 "/usr/lib/bison.simple"
2275 short *ssp1 = yyss - 1;
2276 fprintf (stderr, "state stack now");
2277 while (ssp1 != yyssp)
2278 fprintf (stderr, " %d", *++ssp1);
2279 fprintf (stderr, "\n");
2289 yylsp->first_line = yylloc.first_line;
2290 yylsp->first_column = yylloc.first_column;
2291 yylsp->last_line = (yylsp-1)->last_line;
2292 yylsp->last_column = (yylsp-1)->last_column;
2297 yylsp->last_line = (yylsp+yylen-1)->last_line;
2298 yylsp->last_column = (yylsp+yylen-1)->last_column;
2302 /* Now "shift" the result of the reduction.
2303 Determine what state that goes to,
2304 based on the state we popped back to
2305 and the rule number reduced by. */
2309 yystate = yypgoto[yyn - YYNTBASE] + *yyssp;
2310 if (yystate >= 0 && yystate <= YYLAST && yycheck[yystate] == *yyssp)
2311 yystate = yytable[yystate];
2313 yystate = yydefgoto[yyn - YYNTBASE];
2317 yyerrlab: /* here on detecting error */
2320 /* If not already recovering from an error, report this error. */
2324 #ifdef YYERROR_VERBOSE
2325 yyn = yypact[yystate];
2327 if (yyn > YYFLAG && yyn < YYLAST)
2334 /* Start X at -yyn if nec to avoid negative indexes in yycheck. */
2335 for (x = (yyn < 0 ? -yyn : 0);
2336 x < (sizeof(yytname) / sizeof(char *)); x++)
2337 if (yycheck[x + yyn] == x)
2338 size += strlen(yytname[x]) + 15, count++;
2339 msg = (char *) malloc(size + 15);
2342 strcpy(msg, "parse error");
2347 for (x = (yyn < 0 ? -yyn : 0);
2348 x < (sizeof(yytname) / sizeof(char *)); x++)
2349 if (yycheck[x + yyn] == x)
2351 strcat(msg, count == 0 ? ", expecting `" : " or `");
2352 strcat(msg, yytname[x]);
2361 yyerror ("parse error; also virtual memory exceeded");
2364 #endif /* YYERROR_VERBOSE */
2365 yyerror("parse error");
2369 yyerrlab1: /* here on error raised explicitly by an action */
2371 if (yyerrstatus == 3)
2373 /* if just tried and failed to reuse lookahead token after an error, discard it. */
2375 /* return failure if at end of input */
2376 if (yychar == YYEOF)
2381 fprintf(stderr, "Discarding token %d (%s).\n", yychar, yytname[yychar1]);
2387 /* Else will try to reuse lookahead token
2388 after shifting the error token. */
2390 yyerrstatus = 3; /* Each real token shifted decrements this */
2394 yyerrdefault: /* current state does not do anything special for the error token. */
2397 /* This is wrong; only states that explicitly want error tokens
2398 should shift them. */
2399 yyn = yydefact[yystate]; /* If its default is to accept any token, ok. Otherwise pop it.*/
2400 if (yyn) goto yydefault;
2403 yyerrpop: /* pop the current state because it cannot handle the error token */
2405 if (yyssp == yyss) YYABORT;
2415 short *ssp1 = yyss - 1;
2416 fprintf (stderr, "Error: state stack now");
2417 while (ssp1 != yyssp)
2418 fprintf (stderr, " %d", *++ssp1);
2419 fprintf (stderr, "\n");
2425 yyn = yypact[yystate];
2430 if (yyn < 0 || yyn > YYLAST || yycheck[yyn] != YYTERROR)
2449 fprintf(stderr, "Shifting error token, ");
2461 /* YYACCEPT comes here. */
2473 /* YYABORT comes here. */
2484 #line 1065 "parse.y"