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;
62 static char *chunk_size = NULL;
63 static char *bonobo_x_class = NULL;
64 static GList *typestack = NULL;
65 static GList *funcargs = NULL;
66 static GList *checks = NULL;
67 static int has_self = FALSE;
68 static int vararg = FALSE;
69 static Method *last_added_method = NULL;
71 /* destructor and initializer for variables */
72 static char *destructor = NULL;
73 static int destructor_line = 0;
74 static gboolean destructor_simple = TRUE;
75 static char *initializer = NULL;
76 static int initializer_line = 0;
78 static char *onerror = NULL;
79 static char *defreturn = NULL;
81 static GList *gtktypes = NULL;
83 /* this can be a global as we will only do one function at a time
85 static int the_scope = NO_SCOPE;
90 extern int ccode_line;
101 if(strcmp(yytext,"\n")==0) {
102 out=g_strconcat("Error: ",str," before newline",NULL);
103 } else if(yytext[0]=='\0') {
104 out=g_strconcat("Error: ", str, " at end of input", NULL);
106 char *tmp = g_strdup(yytext);
107 while((p=strchr(tmp, '\n')))
110 out=g_strconcat("Error: ", str, " before '", tmp, "'", NULL);
114 fprintf(stderr, "%s:%d: %s\n", filename, line_no, out);
123 Type *type = typestack->data;
124 typestack = g_list_remove(typestack,typestack->data);
129 push_variable(char *name, int scope, int line_no, char *postfix)
132 Type *type = pop_type();
134 type->postfix = postfix;
136 var = new_variable(scope, type, name, line_no,
137 destructor, destructor_line,
139 initializer, initializer_line);
140 class_nodes = g_list_append(class_nodes, var);
144 push_function(int scope, int method, char *oid, char *id,
145 GString *cbuf, int line_no, int ccode_line,
146 gboolean vararg, GList *flags)
152 g_assert(scope != CLASS_SCOPE);
154 if(method == INIT_METHOD || method == CLASS_INIT_METHOD) {
155 type = (Type *)new_type(g_strdup("void"), NULL, NULL);
160 /* a complicated and ugly test to figure out if we have
161 the wrong number of types for a signal */
162 if((method == SIGNAL_FIRST_METHOD ||
163 method == SIGNAL_LAST_METHOD) &&
164 g_list_length(gtktypes) != g_list_length(funcargs) &&
165 !(g_list_length(funcargs) == 1 &&
166 g_list_length(gtktypes) == 2 &&
167 strcmp(gtktypes->next->data, "NONE")==0)) {
168 error_print(GOB_WARN, line_no,
169 _("The number of GTK arguments and "
170 "function arguments for a signal "
171 "don't seem to match"));
173 if(g_list_length(gtktypes) > 2) {
175 for(li = gtktypes->next; li; li = li->next) {
176 if(strcmp(li->data, "NONE")==0) {
177 error_print(GOB_ERROR, line_no,
178 _("NONE can only appear in an "
179 "argument list by itself"));
185 c_cbuf = p = cbuf->str;
186 while(p && *p && (*p==' ' || *p=='\t' || *p=='\n' || *p=='\r'))
193 node = new_method(scope, method, type, oid, gtktypes, flags,
194 id, funcargs, onerror, defreturn, c_cbuf, line_no,
195 ccode_line, vararg, method_unique_id++,
198 last_added_method = (Method *)node;
202 /*only free segment if we haven't passed it
211 class_nodes = g_list_append(class_nodes, node);
215 free_all_global_state(void)
225 g_list_foreach(gtktypes, (GFunc)g_free, NULL);
226 g_list_free(gtktypes);
229 free_node_list(funcargs);
234 push_funcarg(char *name, char *postfix)
237 Type *type = pop_type();
239 type->postfix = postfix;
241 node = new_funcarg(type, name, checks);
244 funcargs = g_list_append(funcargs, node);
248 push_init_arg(char *name, int is_class)
255 tn = g_strconcat(((Class *)class)->otype,":Class",NULL);
257 tn = g_strdup(((Class *)class)->otype);
259 type = new_type(tn, g_strdup("*"), NULL);
260 node = new_funcarg((Type *)type,name,NULL);
261 funcargs = g_list_prepend(funcargs, node);
265 push_self(char *id, gboolean constant)
270 type = new_type(g_strdup(((Class *)class)->otype),
271 g_strdup(constant ? "const *" : "*"), NULL);
272 ch = g_list_append(ch,new_check(NULL_CHECK,NULL));
273 ch = g_list_append(ch,new_check(TYPE_CHECK,NULL));
274 node = new_funcarg((Type *)type,id,ch);
275 funcargs = g_list_prepend(funcargs, node);
279 find_var_or_die(const char *id, int line)
283 for(li = class_nodes; li != NULL; li = li->next) {
285 Node *node = li->data;
286 if(node->type != VARIABLE_NODE)
289 if(strcmp(var->id, id)==0)
293 error_printf(GOB_ERROR, line, _("Variable %s not defined here"), id);
295 g_assert_not_reached();
300 set_return_value(char *type, char *val)
302 if(strcmp(type, "onerror")==0) {
308 } else if(strcmp(type, "defreturn")==0) {
319 export_accessors (char *var_name,
328 char *get_id = g_strdup_printf ("get_%s", var_name);
329 GString *get_cbuf_copy = g_string_new (get_cbuf->str);
331 Node *node1 = new_type (type->name, type->pointer, type->postfix);
332 Node *node3 = new_type (class->class.otype, "*", NULL);
334 tmp = g_strdup_printf ("\t%s%s ARG;\n",
336 type->pointer ? type->pointer : "");
337 get_cbuf_copy = g_string_prepend (get_cbuf_copy, tmp);
340 tmp = g_strdup_printf ("\n\t\treturn ARG;\n");
341 get_cbuf_copy = g_string_append (get_cbuf_copy, tmp);
344 typestack = g_list_prepend (typestack, node1);
345 typestack = g_list_prepend (typestack, node3);
347 push_funcarg ("self", FALSE);
349 push_function (PUBLIC_SCOPE, REGULAR_METHOD, NULL,
350 get_id, get_cbuf_copy, get_lineno,
351 lineno, FALSE, NULL);
355 char *set_id = g_strdup_printf ("set_%s", var_name);
356 GString *set_cbuf_copy = g_string_new (set_cbuf->str);
357 Node *node1 = new_type (type->name, type->pointer, type->postfix);
358 Node *node2 = new_type ("void", NULL, NULL);
359 Node *node3 = new_type (class->class.otype, "*", NULL);
361 typestack = g_list_prepend (typestack, node2);
362 typestack = g_list_prepend (typestack, node1);
363 typestack = g_list_prepend (typestack, node3);
365 push_funcarg ("self", FALSE);
366 push_funcarg ("ARG", FALSE);
368 typestack = g_list_prepend (typestack, node2);
369 push_function (PUBLIC_SCOPE, REGULAR_METHOD, NULL,
370 set_id, set_cbuf_copy, set_lineno,
371 lineno, FALSE, NULL);
399 #define YYFLAG -32768
402 #define YYTRANSLATE(x) ((unsigned)(x) <= 290 ? yytranslate[x] : 89)
404 static const char yytranslate[] = { 0,
405 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
406 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
407 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
408 2, 2, 48, 2, 2, 2, 2, 2, 2, 39,
409 40, 44, 2, 45, 49, 2, 2, 2, 2, 2,
410 2, 2, 2, 2, 2, 2, 2, 2, 41, 47,
411 42, 46, 2, 2, 2, 2, 2, 2, 2, 2,
412 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
413 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
414 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
415 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
416 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
417 2, 2, 37, 43, 38, 2, 2, 2, 2, 2,
418 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
419 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
420 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
421 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
422 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
423 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
424 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
425 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
426 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
427 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
428 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
429 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
430 2, 2, 2, 2, 2, 1, 3, 4, 5, 6,
431 7, 8, 9, 10, 11, 12, 13, 14, 15, 16,
432 17, 18, 19, 20, 21, 22, 23, 24, 25, 26,
433 27, 28, 29, 30, 31, 32, 33, 34, 35, 36
437 static const short yyprhs[] = { 0,
438 0, 4, 7, 10, 12, 14, 16, 18, 20, 22,
439 24, 27, 29, 34, 38, 44, 45, 51, 57, 60,
440 62, 64, 67, 69, 71, 73, 75, 77, 79, 81,
441 84, 88, 91, 95, 98, 101, 103, 105, 106, 112,
442 119, 132, 142, 149, 153, 154, 160, 162, 166, 167,
443 171, 173, 176, 178, 180, 182, 185, 188, 191, 195,
444 199, 202, 205, 208, 210, 213, 215, 218, 220, 222,
445 224, 226, 228, 230, 232, 234, 236, 238, 240, 242,
446 244, 247, 250, 254, 257, 259, 263, 267, 270, 272,
447 277, 281, 283, 286, 288, 299, 311, 321, 331, 340,
448 352, 361, 367, 370, 375, 376, 378, 381, 383, 385,
449 388, 391, 395, 400, 405, 407, 411, 413, 417, 419,
450 422, 426, 433, 441, 444, 446, 448, 451, 454, 458,
451 462, 466, 470, 472, 475
454 static const short yyrhs[] = { 52,
455 53, 52, 0, 53, 52, 0, 52, 53, 0, 53,
456 0, 23, 0, 26, 0, 24, 0, 25, 0, 27,
457 0, 28, 0, 52, 51, 0, 51, 0, 54, 37,
458 56, 38, 0, 54, 37, 38, 0, 3, 21, 4,
459 21, 55, 0, 0, 39, 19, 19, 40, 55, 0,
460 39, 19, 20, 40, 55, 0, 56, 57, 0, 57,
461 0, 79, 0, 19, 79, 0, 62, 0, 63, 0,
462 41, 0, 29, 0, 30, 0, 31, 0, 32, 0,
463 19, 19, 0, 19, 37, 23, 0, 42, 88, 0,
464 42, 37, 23, 0, 59, 60, 0, 60, 59, 0,
465 60, 0, 59, 0, 0, 58, 68, 19, 61, 41,
466 0, 58, 68, 19, 22, 61, 41, 0, 33, 66,
467 65, 19, 64, 19, 37, 23, 19, 37, 23, 41,
468 0, 33, 66, 65, 19, 64, 19, 37, 23, 41,
469 0, 33, 66, 65, 19, 64, 19, 0, 39, 19,
470 40, 0, 0, 19, 39, 19, 68, 40, 0, 19,
471 0, 39, 67, 40, 0, 0, 19, 43, 67, 0,
472 19, 0, 69, 73, 0, 69, 0, 70, 0, 19,
473 0, 5, 19, 0, 19, 5, 0, 72, 19, 0,
474 5, 72, 19, 0, 72, 19, 5, 0, 71, 70,
475 0, 21, 70, 0, 5, 70, 0, 21, 0, 21,
476 5, 0, 71, 0, 71, 5, 0, 6, 0, 18,
477 0, 14, 0, 15, 0, 13, 0, 16, 0, 17,
478 0, 11, 0, 12, 0, 7, 0, 8, 0, 9,
479 0, 44, 0, 44, 5, 0, 44, 73, 0, 44,
480 5, 73, 0, 19, 76, 0, 76, 0, 58, 19,
481 76, 0, 19, 58, 76, 0, 58, 76, 0, 74,
482 0, 19, 39, 77, 40, 0, 77, 45, 19, 0,
483 19, 0, 37, 23, 0, 41, 0, 35, 66, 75,
484 68, 19, 39, 82, 40, 80, 78, 0, 58, 35,
485 66, 74, 68, 19, 39, 82, 40, 80, 78, 0,
486 34, 58, 68, 19, 39, 82, 40, 80, 78, 0,
487 58, 34, 68, 19, 39, 82, 40, 80, 78, 0,
488 34, 68, 19, 39, 82, 40, 80, 78, 0, 36,
489 39, 21, 40, 68, 19, 39, 82, 40, 80, 78,
490 0, 58, 68, 19, 39, 82, 40, 80, 78, 0,
491 19, 39, 19, 40, 78, 0, 19, 81, 0, 19,
492 81, 19, 81, 0, 0, 88, 0, 37, 23, 0,
493 6, 0, 19, 0, 19, 5, 0, 5, 19, 0,
494 19, 45, 83, 0, 19, 5, 45, 83, 0, 5,
495 19, 45, 83, 0, 83, 0, 84, 45, 10, 0,
496 84, 0, 84, 45, 85, 0, 85, 0, 68, 19,
497 0, 68, 19, 22, 0, 68, 19, 39, 19, 86,
498 40, 0, 68, 19, 22, 39, 19, 86, 40, 0,
499 86, 87, 0, 87, 0, 19, 0, 46, 88, 0,
500 47, 88, 0, 46, 42, 88, 0, 47, 42, 88,
501 0, 42, 42, 88, 0, 48, 42, 88, 0, 20,
508 static const short yyrline[] = { 0,
509 373, 374, 375, 376, 379, 385, 391, 397, 403, 409,
510 417, 418, 421, 426, 433, 439, 440, 452, 466, 467,
511 470, 471, 479, 480, 481, 484, 485, 486, 487, 490,
512 503, 519, 523, 531, 532, 533, 534, 535, 541, 544,
513 549, 600, 648, 731, 739, 741, 750, 756, 757, 760,
514 763, 769, 773, 780, 783, 786, 790, 794, 798, 803,
515 811, 815, 820, 824, 827, 831, 834, 839, 840, 841,
516 842, 843, 844, 845, 846, 847, 850, 851, 852, 855,
517 856, 857, 861, 868, 880, 886, 898, 910, 913, 919,
518 924, 927, 932, 933, 937, 953, 969, 985, 1001, 1012,
519 1018, 1028, 1051, 1062, 1081, 1087, 1088, 1094, 1095, 1106,
520 1117, 1128, 1138, 1148, 1158, 1161, 1162, 1165, 1166, 1169,
521 1172, 1175, 1183, 1193, 1194, 1197, 1210, 1214, 1218, 1222,
522 1226, 1230, 1236, 1237, 1241
527 #if YYDEBUG != 0 || defined (YYERROR_VERBOSE)
529 static const char * const yytname[] = { "$","error","$undefined.","CLASS",
530 "FROM","CONST","VOID","STRUCT","UNION","ENUM","THREEDOTS","SIGNED","UNSIGNED",
531 "LONG","SHORT","INT","FLOAT","DOUBLE","CHAR","TOKEN","NUMBER","TYPETOKEN","ARRAY_DIM",
532 "CCODE","HTCODE","PHCODE","HCODE","ACODE","ATCODE","PUBLIC","PRIVATE","PROTECTED",
533 "CLASSWIDE","ARGUMENT","VIRTUAL","SIGNAL","OVERRIDE","'{'","'}'","'('","')'",
534 "';'","'='","'|'","'*'","','","'>'","'<'","'!'","'-'","prog","ccode","ccodes",
535 "class","classdec","classflags","classcode","thing","scope","destructor","initializer",
536 "varoptions","variable","argument","export","argtype","flags","flaglist","type",
537 "specifier_list","spec_list","specifier","strunionenum","pointer","simplesigtype",
538 "fullsigtype","sigtype","tokenlist","codenocode","method","returnvals","retcode",
539 "funcargs","arglist","arglist1","arg","checklist","check","numtok", NULL
543 static const short yyr1[] = { 0,
544 50, 50, 50, 50, 51, 51, 51, 51, 51, 51,
545 52, 52, 53, 53, 54, 55, 55, 55, 56, 56,
546 57, 57, 57, 57, 57, 58, 58, 58, 58, 59,
547 59, 60, 60, 61, 61, 61, 61, 61, 62, 62,
548 63, 63, 63, 64, 64, 65, 65, 66, 66, 67,
549 67, 68, 68, 69, 69, 69, 69, 69, 69, 69,
550 70, 70, 70, 70, 70, 70, 70, 71, 71, 71,
551 71, 71, 71, 71, 71, 71, 72, 72, 72, 73,
552 73, 73, 73, 74, 74, 75, 75, 75, 75, 76,
553 77, 77, 78, 78, 79, 79, 79, 79, 79, 79,
554 79, 79, 80, 80, 80, 81, 81, 82, 82, 82,
555 82, 82, 82, 82, 82, 83, 83, 84, 84, 85,
556 85, 85, 85, 86, 86, 87, 87, 87, 87, 87,
560 static const short yyr2[] = { 0,
561 3, 2, 2, 1, 1, 1, 1, 1, 1, 1,
562 2, 1, 4, 3, 5, 0, 5, 5, 2, 1,
563 1, 2, 1, 1, 1, 1, 1, 1, 1, 2,
564 3, 2, 3, 2, 2, 1, 1, 0, 5, 6,
565 12, 9, 6, 3, 0, 5, 1, 3, 0, 3,
566 1, 2, 1, 1, 1, 2, 2, 2, 3, 3,
567 2, 2, 2, 1, 2, 1, 2, 1, 1, 1,
568 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
569 2, 2, 3, 2, 1, 3, 3, 2, 1, 4,
570 3, 1, 2, 1, 10, 11, 9, 9, 8, 11,
571 8, 5, 2, 4, 0, 1, 2, 1, 1, 2,
572 2, 3, 4, 4, 1, 3, 1, 3, 1, 2,
573 3, 6, 7, 2, 1, 1, 2, 2, 3, 3,
577 static const short yydefact[] = { 0,
578 0, 5, 7, 8, 6, 9, 10, 12, 0, 4,
579 0, 0, 11, 3, 2, 0, 0, 1, 0, 26,
580 27, 28, 29, 49, 0, 49, 0, 14, 25, 0,
581 20, 0, 23, 24, 21, 16, 0, 0, 0, 22,
582 0, 0, 0, 68, 77, 78, 79, 75, 76, 72,
583 70, 71, 73, 74, 69, 55, 64, 0, 0, 53,
584 54, 66, 0, 0, 0, 13, 19, 0, 49, 0,
585 0, 15, 0, 0, 51, 0, 47, 0, 0, 56,
586 63, 0, 57, 65, 62, 0, 0, 80, 52, 67,
587 61, 58, 0, 0, 89, 0, 85, 0, 0, 0,
588 38, 0, 0, 0, 0, 48, 0, 45, 59, 0,
589 0, 81, 82, 60, 0, 0, 0, 84, 0, 88,
590 0, 0, 0, 0, 0, 0, 38, 0, 0, 37,
591 36, 0, 0, 0, 0, 94, 102, 50, 0, 0,
592 0, 0, 0, 68, 55, 0, 0, 115, 117, 119,
593 83, 92, 0, 87, 86, 0, 0, 0, 0, 30,
594 0, 0, 0, 135, 133, 0, 0, 32, 34, 35,
595 39, 16, 16, 93, 0, 0, 43, 0, 56, 57,
596 0, 120, 105, 0, 90, 0, 0, 0, 0, 0,
597 31, 40, 105, 33, 134, 17, 18, 46, 44, 0,
598 105, 0, 0, 112, 121, 0, 0, 0, 116, 118,
599 91, 0, 0, 105, 0, 0, 0, 0, 114, 113,
600 0, 0, 0, 103, 106, 99, 105, 0, 0, 0,
601 101, 0, 42, 97, 0, 126, 0, 0, 0, 0,
602 0, 125, 107, 0, 0, 105, 98, 105, 0, 0,
603 0, 0, 127, 0, 128, 0, 122, 124, 104, 95,
604 0, 0, 0, 123, 131, 129, 130, 132, 100, 96,
608 static const short yydefgoto[] = { 272,
609 8, 9, 10, 11, 72, 30, 31, 32, 130, 131,
610 132, 33, 34, 141, 78, 42, 76, 146, 60, 61,
611 62, 63, 89, 95, 96, 97, 153, 137, 35, 208,
612 224, 147, 148, 149, 150, 241, 242, 225
615 static const short yypact[] = { 175,
616 34,-32768,-32768,-32768,-32768,-32768,-32768,-32768, 175, 236,
617 47, 104,-32768, 236, 236, 176, 96, 236, 212,-32768,
618 -32768,-32768,-32768, 107, 158, 107, 109,-32768,-32768, 194,
619 -32768, 123,-32768,-32768,-32768, 110, 111, 124, 123,-32768,
620 135, 136, 278,-32768,-32768,-32768,-32768,-32768,-32768,-32768,
621 -32768,-32768,-32768,-32768,-32768, 154, 346, 295, 149, 138,
622 -32768, 360, 161, 162, 163,-32768,-32768, 295, 107, 164,
623 166,-32768, 146, 177, 172, 157, 165, 197, 374,-32768,
624 -32768, 199,-32768, 374,-32768, 200, 181, 2,-32768, 374,
625 -32768, 216, 226, 203,-32768, 295,-32768, 193, 215, 217,
626 57, 74, 37, 198, 135,-32768, 219, 201,-32768, 210,
627 312, 138,-32768,-32768, 211, 220, 233,-32768, -2,-32768,
628 234, 295, 242, -2, 295, -8, -6, 312, 38, 246,
629 235, 257, 265, 275, 299,-32768,-32768,-32768, 295, 313,
630 320, 312, 329, 309, 5, 334, 314,-32768, 310,-32768,
631 -32768,-32768, -20,-32768,-32768, 317, 349, 312, 350,-32768,
632 347, 341, 343,-32768,-32768, 361, 373,-32768,-32768,-32768,
633 -32768, 110, 110,-32768, 354, 356, 362, 357, -18, 81,
634 295, 61, 379, 261,-32768, 381, 312, 363, 364, 366,
635 -32768,-32768, 379,-32768,-32768,-32768,-32768,-32768,-32768, 378,
636 379, 295, 295,-32768, 367, 384, 40, 37,-32768,-32768,
637 -32768, 368, 312, 379, 312, 37, 29, 37,-32768,-32768,
638 388, 114, 386, 391,-32768,-32768, 379, 371, 37, 372,
639 -32768, 376,-32768,-32768, 114,-32768, 375, 46, 62, 377,
640 72,-32768,-32768, 40, 37, 379,-32768, 379, 392, 105,
641 48, 48,-32768, 48,-32768, 48,-32768,-32768,-32768,-32768,
642 37, 37, 380,-32768,-32768,-32768,-32768,-32768,-32768,-32768,
643 -32768, 414, 416,-32768
646 static const short yypgoto[] = {-32768,
647 98, 14, 409,-32768, -67,-32768, 390, -13, 291, 293,
648 297,-32768,-32768,-32768,-32768, -22, 321, -24,-32768, -41,
649 -32768, -40, -79, 325,-32768, -63,-32768, -176, 408, -175,
650 184, -123, -140,-32768, 245, 195, -227, -129
657 static const short yytable[] = { 168,
658 59, 81, 82, 64, 163, 39, 112, 70, 113, 180,
659 160, 58, 126, 258, 74, 85, 115, 216, 178, 185,
660 91, -111, 258, 15, 186, 218, 202, 18, 161, 118,
661 120, 226, 151, 86, 189, 129, 116, 81, 229, 231,
662 204, 234, 81, 99, -109, 88, 100, 232, 81, 181,
663 94, 245, 247, 154, 12, 155, 164, 165, 164, 165,
664 118, 219, 220, 212, 164, 165, 164, 165, 260, 233,
665 261, 121, 262, 135, 166, 126, 223, 136, 127, 117,
666 164, 165, 205, 16, 269, 270, 167, 252, 167, 228,
667 236, 230, 133, 134, 167, 128, 167, 157, 129, 206,
668 159, 81, 82, 254, 196, 197, 13, 17, 253, 255,
669 167, 257, 13, 237, 175, 13, 36, 238, 239, 240,
670 -110, 265, 266, 236, 267, 203, 268, 43, 44, 45,
671 46, 47, 236, 48, 49, 50, 51, 52, 53, 54,
672 55, 56, 73, 57, 264, 41, 237, 65, 71, 38,
673 238, 239, 240, 75, 77, 237, 68, 69, 83, 238,
674 239, 240, 43, 44, 45, 46, 47, 87, 48, 49,
675 50, 51, 52, 53, 54, 55, 56, 1, 57, 92,
676 93, 88, 101, 98, 102, 103, 20, 21, 22, 23,
677 20, 21, 22, 23, 19, 104, 106, 2, 3, 4,
678 5, 6, 7, 107, 20, 21, 22, 23, 24, 25,
679 26, 27, 19, 28, 105, 108, 29, 109, 110, 111,
680 114, 119, 20, 21, 22, 23, 24, 25, 26, 27,
681 37, 66, 122, 123, 29, 124, 128, 139, 152, 140,
682 20, 21, 22, 23, 115, 25, 26, 27, 142, 116,
683 38, 115, 156, 126, 20, 21, 22, 23, 2, 3,
684 4, 5, 6, 7, 116, 43, 44, 45, 46, 47,
685 209, 48, 49, 50, 51, 52, 53, 54, 55, 56,
686 158, 57, 79, 44, 45, 46, 47, 129, 48, 49,
687 50, 51, 52, 53, 54, 55, 80, 171, 57, 43,
688 44, 45, 46, 47, 172, 48, 49, 50, 51, 52,
689 53, 54, 55, 56, 173, 57, 143, 144, 45, 46,
690 47, 174, 48, 49, 50, 51, 52, 53, 54, 55,
691 145, 176, 57, 79, 44, 45, 46, 47, 177, 48,
692 49, 50, 51, 52, 53, 54, 55, 179, -108, 57,
693 84, 44, 182, 183, 184, 187, 48, 49, 50, 51,
694 52, 53, 54, 55, 90, 44, 57, 188, 190, 191,
695 48, 49, 50, 51, 52, 53, 54, 55, 79, 44,
696 57, 192, 193, 194, 48, 49, 50, 51, 52, 53,
697 54, 55, 195, 198, 57, 199, 201, 207, 200, 211,
698 217, 213, 222, 214, 215, 221, 235, 227, 243, 244,
699 246, 248, 249, 273, 263, 274, 251, 14, 256, 67,
700 271, 170, 169, 162, 125, 138, 40, 259, 210, 250
703 static const short yycheck[] = { 129,
704 25, 43, 43, 26, 128, 19, 5, 32, 88, 5,
705 19, 25, 19, 241, 39, 57, 19, 193, 142, 40,
706 62, 40, 250, 10, 45, 201, 45, 14, 37, 93,
707 94, 208, 112, 58, 158, 42, 39, 79, 214, 216,
708 181, 218, 84, 68, 40, 44, 69, 19, 90, 45,
709 64, 227, 229, 117, 21, 119, 19, 20, 19, 20,
710 124, 202, 203, 187, 19, 20, 19, 20, 245, 41,
711 246, 96, 248, 37, 37, 19, 37, 41, 22, 93,
712 19, 20, 22, 37, 261, 262, 49, 42, 49, 213,
713 19, 215, 19, 20, 49, 39, 49, 122, 42, 39,
714 125, 143, 143, 42, 172, 173, 9, 4, 238, 239,
715 49, 40, 15, 42, 139, 18, 21, 46, 47, 48,
716 40, 251, 252, 19, 254, 45, 256, 5, 6, 7,
717 8, 9, 19, 11, 12, 13, 14, 15, 16, 17,
718 18, 19, 19, 21, 40, 39, 42, 39, 39, 39,
719 46, 47, 48, 19, 19, 42, 34, 35, 5, 46,
720 47, 48, 5, 6, 7, 8, 9, 19, 11, 12,
721 13, 14, 15, 16, 17, 18, 19, 3, 21, 19,
722 19, 44, 19, 21, 19, 40, 29, 30, 31, 32,
723 29, 30, 31, 32, 19, 19, 40, 23, 24, 25,
724 26, 27, 28, 39, 29, 30, 31, 32, 33, 34,
725 35, 36, 19, 38, 43, 19, 41, 19, 19, 39,
726 5, 19, 29, 30, 31, 32, 33, 34, 35, 36,
727 19, 38, 40, 19, 41, 19, 39, 19, 19, 39,
728 29, 30, 31, 32, 19, 34, 35, 36, 39, 39,
729 39, 19, 19, 19, 29, 30, 31, 32, 23, 24,
730 25, 26, 27, 28, 39, 5, 6, 7, 8, 9,
731 10, 11, 12, 13, 14, 15, 16, 17, 18, 19,
732 39, 21, 5, 6, 7, 8, 9, 42, 11, 12,
733 13, 14, 15, 16, 17, 18, 19, 41, 21, 5,
734 6, 7, 8, 9, 40, 11, 12, 13, 14, 15,
735 16, 17, 18, 19, 40, 21, 5, 6, 7, 8,
736 9, 23, 11, 12, 13, 14, 15, 16, 17, 18,
737 19, 19, 21, 5, 6, 7, 8, 9, 19, 11,
738 12, 13, 14, 15, 16, 17, 18, 19, 40, 21,
739 5, 6, 19, 40, 45, 39, 11, 12, 13, 14,
740 15, 16, 17, 18, 5, 6, 21, 19, 19, 23,
741 11, 12, 13, 14, 15, 16, 17, 18, 5, 6,
742 21, 41, 40, 23, 11, 12, 13, 14, 15, 16,
743 17, 18, 20, 40, 21, 40, 40, 19, 37, 19,
744 23, 39, 19, 40, 39, 39, 19, 40, 23, 19,
745 40, 40, 37, 0, 23, 0, 42, 9, 42, 30,
746 41, 131, 130, 127, 100, 105, 19, 244, 184, 235
748 /* -*-C-*- Note some compilers choke on comments on `#line' lines. */
749 #line 3 "/usr/lib/bison.simple"
750 /* This file comes from bison-1.28. */
752 /* Skeleton output parser for bison,
753 Copyright (C) 1984, 1989, 1990 Free Software Foundation, Inc.
755 This program is free software; you can redistribute it and/or modify
756 it under the terms of the GNU General Public License as published by
757 the Free Software Foundation; either version 2, or (at your option)
760 This program is distributed in the hope that it will be useful,
761 but WITHOUT ANY WARRANTY; without even the implied warranty of
762 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
763 GNU General Public License for more details.
765 You should have received a copy of the GNU General Public License
766 along with this program; if not, write to the Free Software
767 Foundation, Inc., 59 Temple Place - Suite 330,
768 Boston, MA 02111-1307, USA. */
770 /* As a special exception, when this file is copied by Bison into a
771 Bison output file, you may use that output file without restriction.
772 This special exception was added by the Free Software Foundation
773 in version 1.24 of Bison. */
775 /* This is the parser code that is written into each bison parser
776 when the %semantic_parser declaration is not specified in the grammar.
777 It was written by Richard Stallman by simplifying the hairy parser
778 used when %semantic_parser is specified. */
780 #ifndef YYSTACK_USE_ALLOCA
782 #define YYSTACK_USE_ALLOCA
783 #else /* alloca not defined */
785 #define YYSTACK_USE_ALLOCA
786 #define alloca __builtin_alloca
787 #else /* not GNU C. */
788 #if (!defined (__STDC__) && defined (sparc)) || defined (__sparc__) || defined (__sparc) || defined (__sgi) || (defined (__sun) && defined (__i386))
789 #define YYSTACK_USE_ALLOCA
791 #else /* not sparc */
792 /* We think this test detects Watcom and Microsoft C. */
793 /* This used to test MSDOS, but that is a bad idea
794 since that symbol is in the user namespace. */
795 #if (defined (_MSDOS) || defined (_MSDOS_)) && !defined (__TURBOC__)
796 #if 0 /* No need for malloc.h, which pollutes the namespace;
797 instead, just don't use alloca. */
800 #else /* not MSDOS, or __TURBOC__ */
802 /* I don't know what this was needed for, but it pollutes the namespace.
803 So I turned it off. rms, 2 May 1997. */
804 /* #include <malloc.h> */
806 #define YYSTACK_USE_ALLOCA
807 #else /* not MSDOS, or __TURBOC__, or _AIX */
809 #ifdef __hpux /* haible@ilog.fr says this works for HPUX 9.05 and up,
810 and on HPUX 10. Eventually we can turn this on. */
811 #define YYSTACK_USE_ALLOCA
812 #define alloca __builtin_alloca
815 #endif /* not _AIX */
816 #endif /* not MSDOS, or __TURBOC__ */
817 #endif /* not sparc */
818 #endif /* not GNU C */
819 #endif /* alloca not defined */
820 #endif /* YYSTACK_USE_ALLOCA not defined */
822 #ifdef YYSTACK_USE_ALLOCA
823 #define YYSTACK_ALLOC alloca
825 #define YYSTACK_ALLOC malloc
828 /* Note: there must be only one dollar sign in this file.
829 It is replaced by the list of actions, each action
830 as one case of the switch. */
832 #define yyerrok (yyerrstatus = 0)
833 #define yyclearin (yychar = YYEMPTY)
836 #define YYACCEPT goto yyacceptlab
837 #define YYABORT goto yyabortlab
838 #define YYERROR goto yyerrlab1
839 /* Like YYERROR except do call yyerror.
840 This remains here temporarily to ease the
841 transition to the new meaning of YYERROR, for GCC.
842 Once GCC version 2 has supplanted version 1, this can go. */
843 #define YYFAIL goto yyerrlab
844 #define YYRECOVERING() (!!yyerrstatus)
845 #define YYBACKUP(token, value) \
847 if (yychar == YYEMPTY && yylen == 1) \
848 { yychar = (token), yylval = (value); \
849 yychar1 = YYTRANSLATE (yychar); \
854 { yyerror ("syntax error: cannot back up"); YYERROR; } \
858 #define YYERRCODE 256
861 #define YYLEX yylex()
867 #define YYLEX yylex(&yylval, &yylloc, YYLEX_PARAM)
869 #define YYLEX yylex(&yylval, &yylloc)
871 #else /* not YYLSP_NEEDED */
873 #define YYLEX yylex(&yylval, YYLEX_PARAM)
875 #define YYLEX yylex(&yylval)
877 #endif /* not YYLSP_NEEDED */
880 /* If nonreentrant, generate the variables here */
884 int yychar; /* the lookahead symbol */
885 YYSTYPE yylval; /* the semantic value of the */
886 /* lookahead symbol */
889 YYLTYPE yylloc; /* location data for the lookahead */
893 int yynerrs; /* number of parse errors so far */
894 #endif /* not YYPURE */
897 int yydebug; /* nonzero means print parse trace */
898 /* Since this is uninitialized, it does not stop multiple parsers
902 /* YYINITDEPTH indicates the initial size of the parser's stacks */
905 #define YYINITDEPTH 200
908 /* YYMAXDEPTH is the maximum size the stacks can grow to
909 (effective only if the built-in stack extension method is used). */
916 #define YYMAXDEPTH 10000
919 /* Define __yy_memcpy. Note that the size argument
920 should be passed with type unsigned int, because that is what the non-GCC
921 definitions require. With GCC, __builtin_memcpy takes an arg
922 of type size_t, but it can handle unsigned int. */
924 #if __GNUC__ > 1 /* GNU C and GNU C++ define this. */
925 #define __yy_memcpy(TO,FROM,COUNT) __builtin_memcpy(TO,FROM,COUNT)
926 #else /* not GNU C or C++ */
929 /* This is the most reliable way to avoid incompatibilities
930 in available built-in functions on various systems. */
932 __yy_memcpy (to, from, count)
937 register char *f = from;
938 register char *t = to;
939 register int i = count;
945 #else /* __cplusplus */
947 /* This is the most reliable way to avoid incompatibilities
948 in available built-in functions on various systems. */
950 __yy_memcpy (char *to, char *from, unsigned int count)
952 register char *t = to;
953 register char *f = from;
954 register int i = count;
963 #line 217 "/usr/lib/bison.simple"
965 /* The user can define YYPARSE_PARAM as the name of an argument to be passed
966 into yyparse. The argument should have type void *.
967 It should actually point to an object.
968 Grammar actions can access the variable by casting it
969 to the proper pointer type. */
973 #define YYPARSE_PARAM_ARG void *YYPARSE_PARAM
974 #define YYPARSE_PARAM_DECL
975 #else /* not __cplusplus */
976 #define YYPARSE_PARAM_ARG YYPARSE_PARAM
977 #define YYPARSE_PARAM_DECL void *YYPARSE_PARAM;
978 #endif /* not __cplusplus */
979 #else /* not YYPARSE_PARAM */
980 #define YYPARSE_PARAM_ARG
981 #define YYPARSE_PARAM_DECL
982 #endif /* not YYPARSE_PARAM */
984 /* Prevent warning if -Wstrict-prototypes. */
987 int yyparse (void *);
994 yyparse(YYPARSE_PARAM_ARG)
997 register int yystate;
999 register short *yyssp;
1000 register YYSTYPE *yyvsp;
1001 int yyerrstatus; /* number of tokens to shift before error messages enabled */
1002 int yychar1 = 0; /* lookahead token as an internal (translated) token number */
1004 short yyssa[YYINITDEPTH]; /* the state stack */
1005 YYSTYPE yyvsa[YYINITDEPTH]; /* the semantic value stack */
1007 short *yyss = yyssa; /* refer to the stacks thru separate pointers */
1008 YYSTYPE *yyvs = yyvsa; /* to allow yyoverflow to reallocate them elsewhere */
1011 YYLTYPE yylsa[YYINITDEPTH]; /* the location stack */
1012 YYLTYPE *yyls = yylsa;
1015 #define YYPOPSTACK (yyvsp--, yyssp--, yylsp--)
1017 #define YYPOPSTACK (yyvsp--, yyssp--)
1020 int yystacksize = YYINITDEPTH;
1021 int yyfree_stacks = 0;
1032 YYSTYPE yyval; /* the variable used to return */
1033 /* semantic values from the action */
1040 fprintf(stderr, "Starting parse\n");
1046 yychar = YYEMPTY; /* Cause a token to be read. */
1048 /* Initialize stack pointers.
1049 Waste one element of value and location stack
1050 so that they stay on the same level as the state stack.
1051 The wasted elements are never initialized. */
1059 /* Push a new state, which is found in yystate . */
1060 /* In all cases, when you get here, the value and location stacks
1061 have just been pushed. so pushing a state here evens the stacks. */
1066 if (yyssp >= yyss + yystacksize - 1)
1068 /* Give user a chance to reallocate the stack */
1069 /* Use copies of these so that the &'s don't force the real ones into memory. */
1070 YYSTYPE *yyvs1 = yyvs;
1071 short *yyss1 = yyss;
1073 YYLTYPE *yyls1 = yyls;
1076 /* Get the current used size of the three stacks, in elements. */
1077 int size = yyssp - yyss + 1;
1080 /* Each stack pointer address is followed by the size of
1081 the data in use in that stack, in bytes. */
1083 /* This used to be a conditional around just the two extra args,
1084 but that might be undefined if yyoverflow is a macro. */
1085 yyoverflow("parser stack overflow",
1086 &yyss1, size * sizeof (*yyssp),
1087 &yyvs1, size * sizeof (*yyvsp),
1088 &yyls1, size * sizeof (*yylsp),
1091 yyoverflow("parser stack overflow",
1092 &yyss1, size * sizeof (*yyssp),
1093 &yyvs1, size * sizeof (*yyvsp),
1097 yyss = yyss1; yyvs = yyvs1;
1101 #else /* no yyoverflow */
1102 /* Extend the stack our own way. */
1103 if (yystacksize >= YYMAXDEPTH)
1105 yyerror("parser stack overflow");
1117 if (yystacksize > YYMAXDEPTH)
1118 yystacksize = YYMAXDEPTH;
1119 #ifndef YYSTACK_USE_ALLOCA
1122 yyss = (short *) YYSTACK_ALLOC (yystacksize * sizeof (*yyssp));
1123 __yy_memcpy ((char *)yyss, (char *)yyss1,
1124 size * (unsigned int) sizeof (*yyssp));
1125 yyvs = (YYSTYPE *) YYSTACK_ALLOC (yystacksize * sizeof (*yyvsp));
1126 __yy_memcpy ((char *)yyvs, (char *)yyvs1,
1127 size * (unsigned int) sizeof (*yyvsp));
1129 yyls = (YYLTYPE *) YYSTACK_ALLOC (yystacksize * sizeof (*yylsp));
1130 __yy_memcpy ((char *)yyls, (char *)yyls1,
1131 size * (unsigned int) sizeof (*yylsp));
1133 #endif /* no yyoverflow */
1135 yyssp = yyss + size - 1;
1136 yyvsp = yyvs + size - 1;
1138 yylsp = yyls + size - 1;
1143 fprintf(stderr, "Stack size increased to %d\n", yystacksize);
1146 if (yyssp >= yyss + yystacksize - 1)
1152 fprintf(stderr, "Entering state %d\n", yystate);
1158 /* Do appropriate processing given the current state. */
1159 /* Read a lookahead token if we need one and don't already have one. */
1162 /* First try to decide what to do without reference to lookahead token. */
1164 yyn = yypact[yystate];
1168 /* Not known => get a lookahead token if don't already have one. */
1170 /* yychar is either YYEMPTY or YYEOF
1171 or a valid token in external form. */
1173 if (yychar == YYEMPTY)
1177 fprintf(stderr, "Reading a token: ");
1182 /* Convert token to internal form (in yychar1) for indexing tables with */
1184 if (yychar <= 0) /* This means end of input. */
1187 yychar = YYEOF; /* Don't call YYLEX any more */
1191 fprintf(stderr, "Now at end of input.\n");
1196 yychar1 = YYTRANSLATE(yychar);
1201 fprintf (stderr, "Next token is %d (%s", yychar, yytname[yychar1]);
1202 /* Give the individual parser a way to print the precise meaning
1203 of a token, for further debugging info. */
1205 YYPRINT (stderr, yychar, yylval);
1207 fprintf (stderr, ")\n");
1213 if (yyn < 0 || yyn > YYLAST || yycheck[yyn] != yychar1)
1218 /* yyn is what to do for this token type in this state.
1219 Negative => reduce, -yyn is rule number.
1220 Positive => shift, yyn is new state.
1221 New state is final state => don't bother to shift,
1222 just return success.
1223 0, or most negative number => error. */
1238 /* Shift the lookahead token. */
1242 fprintf(stderr, "Shifting token %d (%s), ", yychar, yytname[yychar1]);
1245 /* Discard the token being shifted unless it is eof. */
1246 if (yychar != YYEOF)
1254 /* count tokens shifted since error; after three, turn off error status. */
1255 if (yyerrstatus) yyerrstatus--;
1260 /* Do the default action for the current state. */
1263 yyn = yydefact[yystate];
1267 /* Do a reduction. yyn is the number of a rule to reduce with. */
1271 yyval = yyvsp[1-yylen]; /* implement default value of the action */
1278 fprintf (stderr, "Reducing via rule %d (line %d), ",
1281 /* Print the symbols being reduced, and their result. */
1282 for (i = yyprhs[yyn]; yyrhs[i] > 0; i++)
1283 fprintf (stderr, "%s ", yytname[yyrhs[i]]);
1284 fprintf (stderr, " -> %s\n", yytname[yyr1[yyn]]);
1310 Node *node = new_ccode(C_CCODE,(yyvsp[0].cbuf)->str,
1312 nodes = g_list_append(nodes,node);
1313 g_string_free(yyvsp[0].cbuf,FALSE);
1319 Node *node = new_ccode(H_CCODE,(yyvsp[0].cbuf)->str,
1321 nodes = g_list_append(nodes,node);
1322 g_string_free(yyvsp[0].cbuf,FALSE);
1328 Node *node = new_ccode(HT_CCODE,(yyvsp[0].cbuf)->str,
1330 nodes = g_list_append(nodes,node);
1331 g_string_free(yyvsp[0].cbuf,FALSE);
1337 Node *node = new_ccode(PH_CCODE,(yyvsp[0].cbuf)->str,
1339 nodes = g_list_append(nodes,node);
1340 g_string_free(yyvsp[0].cbuf,FALSE);
1346 Node *node = new_ccode(A_CCODE,(yyvsp[0].cbuf)->str,
1348 nodes = g_list_append(nodes,node);
1349 g_string_free(yyvsp[0].cbuf,FALSE);
1355 Node *node = new_ccode(AT_CCODE,(yyvsp[0].cbuf)->str,
1357 nodes = g_list_append(nodes,node);
1358 g_string_free(yyvsp[0].cbuf,FALSE);
1372 ((Class *)class)->nodes = class_nodes;
1374 nodes = g_list_append(nodes,class);
1380 ((Class *)class)->nodes = NULL;
1382 nodes = g_list_append(nodes,class);
1388 class = new_class (yyvsp[-3].id, yyvsp[-1].id,
1389 bonobo_x_class, chunk_size, NULL);
1395 if(strcmp(yyvsp[-3].id,"chunks") == 0) {
1396 g_free (chunk_size);
1397 chunk_size = g_strdup(yyvsp[-2].id);
1398 } else if(strcmp(yyvsp[-3].id,"BonoboX") == 0) {
1399 g_free (bonobo_x_class);
1400 bonobo_x_class = g_strdup(yyvsp[-2].id);
1402 yyerror(_("parse error"));
1410 if(strcmp(yyvsp[-3].id,"chunks") == 0) {
1411 g_free (chunk_size);
1412 if(atoi(yyvsp[-2].id) != 0)
1413 chunk_size = g_strdup(yyvsp[-2].id);
1417 yyerror(_("parse error"));
1437 if (strcmp (yyvsp[-1].id, "BonoboX") != 0) {
1438 g_free(yyvsp[-1].id);
1439 yyerror(_("parse error"));
1442 last_added_method->bonobo_x_func = TRUE;
1459 { the_scope = PUBLIC_SCOPE; ;
1463 { the_scope = PRIVATE_SCOPE; ;
1467 { the_scope = PROTECTED_SCOPE; ;
1471 { the_scope = CLASS_SCOPE; ;
1476 if(strcmp(yyvsp[-1].id, "destroywith")==0) {
1477 g_free(yyvsp[-1].id);
1478 destructor = yyvsp[0].id;
1479 destructor_line = line_no;
1480 destructor_simple = TRUE;
1482 g_free(yyvsp[-1].id);
1483 g_free(yyvsp[0].id);
1484 yyerror(_("parse error"));
1492 if(strcmp(yyvsp[-2].id, "destroy")==0) {
1493 g_free(yyvsp[-2].id);
1494 destructor = (yyvsp[0].cbuf)->str;
1495 g_string_free(yyvsp[0].cbuf, FALSE);
1496 destructor_line = ccode_line;
1497 destructor_simple = FALSE;
1499 g_free(yyvsp[-2].id);
1500 g_string_free(yyvsp[0].cbuf, TRUE);
1501 yyerror(_("parse error"));
1509 initializer = yyvsp[0].id;
1510 initializer_line = ccode_line;
1516 initializer = (yyvsp[0].cbuf)->str;
1517 initializer_line = ccode_line;
1518 g_string_free(yyvsp[0].cbuf, FALSE);
1531 { destructor = NULL; ;
1535 { initializer = NULL; ;
1547 push_variable(yyvsp[-2].id, the_scope,yyvsp[-4].line, NULL);
1553 push_variable(yyvsp[-3].id, the_scope, yyvsp[-5].line, yyvsp[-2].id);
1559 if(strcmp(yyvsp[-6].id,"get")==0 &&
1560 strcmp(yyvsp[-3].id,"set")==0) {
1562 Type *type = pop_type();
1563 g_free (yyvsp[-6].id);
1564 g_free (yyvsp[-3].id);
1565 node = new_argument (yyvsp[-9].id, type, yyvsp[-10].list, yyvsp[-8].id,
1566 (yyvsp[-4].cbuf)->str, yyvsp[-5].line,
1567 (yyvsp[-1].cbuf)->str,yyvsp[-2].line,
1570 class_nodes = g_list_append(class_nodes,node);
1573 export_accessors (yyvsp[-8].id,
1574 yyvsp[-4].cbuf, yyvsp[-5].line,
1575 yyvsp[-1].cbuf, yyvsp[-2].line,
1580 g_string_free (yyvsp[-4].cbuf, FALSE);
1581 g_string_free (yyvsp[-1].cbuf, FALSE);
1583 } else if(strcmp(yyvsp[-6].id,"set")==0 &&
1584 strcmp(yyvsp[-3].id,"get")==0) {
1586 Type *type = pop_type();
1587 g_free (yyvsp[-6].id);
1588 g_free (yyvsp[-3].id);
1589 node = new_argument (yyvsp[-9].id, type, yyvsp[-10].list, yyvsp[-8].id,
1590 (yyvsp[-1].cbuf)->str,yyvsp[-2].line,
1591 (yyvsp[-4].cbuf)->str,yyvsp[-5].line,
1593 g_string_free (yyvsp[-1].cbuf, FALSE);
1594 g_string_free (yyvsp[-4].cbuf, FALSE);
1595 class_nodes = g_list_append(class_nodes,node);
1597 g_free (yyvsp[-9].id);
1598 g_free (yyvsp[-8].id);
1599 g_free (yyvsp[-6].id);
1600 g_free (yyvsp[-3].id);
1601 g_list_foreach (yyvsp[-10].list, (GFunc)g_free, NULL);
1602 g_list_free (yyvsp[-10].list);
1603 g_string_free (yyvsp[-1].cbuf, TRUE);
1604 g_string_free (yyvsp[-4].cbuf, TRUE);
1605 yyerror (_("parse error"));
1613 if(strcmp(yyvsp[-3].id, "get") == 0) {
1615 Type *type = pop_type();
1616 g_free (yyvsp[-3].id);
1617 node = new_argument (yyvsp[-6].id, type, yyvsp[-7].list, yyvsp[-5].id,
1618 (yyvsp[-1].cbuf)->str, yyvsp[-2].line,
1622 export_accessors (yyvsp[-5].id,
1623 yyvsp[-1].cbuf, yyvsp[-2].line,
1629 g_string_free (yyvsp[-1].cbuf, FALSE);
1630 class_nodes = g_list_append(class_nodes, node);
1631 } else if(strcmp(yyvsp[-3].id, "set") == 0) {
1633 Type *type = pop_type();
1634 g_free (yyvsp[-3].id);
1635 node = new_argument (yyvsp[-6].id, type, yyvsp[-7].list, yyvsp[-5].id,
1637 (yyvsp[-1].cbuf)->str, yyvsp[-2].line,
1640 export_accessors (yyvsp[-5].id,
1642 yyvsp[-1].cbuf, yyvsp[-2].line,
1647 g_string_free (yyvsp[-1].cbuf, FALSE);
1648 class_nodes = g_list_append (class_nodes, node);
1650 g_free (yyvsp[-3].id);
1651 g_free (yyvsp[-6].id);
1652 g_free (yyvsp[-5].id);
1653 g_list_foreach (yyvsp[-7].list, (GFunc)g_free, NULL);
1654 g_list_free (yyvsp[-7].list);
1655 g_string_free (yyvsp[-1].cbuf, TRUE);
1656 yyerror(_("parse error"));
1665 char *get, *set = NULL;
1670 if(strcmp(yyvsp[0].id, "link")!=0 &&
1671 strcmp(yyvsp[0].id, "stringlink")!=0 &&
1672 strcmp(yyvsp[0].id, "objectlink")!=0) {
1673 g_free(yyvsp[0].id);
1674 g_free(yyvsp[-3].id);
1675 g_free(yyvsp[-2].id);
1676 g_list_foreach(yyvsp[-4].list,(GFunc)g_free,NULL);
1677 g_list_free(yyvsp[-4].list);
1678 yyerror(_("parse error"));
1684 var = find_var_or_die(yyvsp[-2].id, yyvsp[-5].line);
1685 if(var->scope == PRIVATE_SCOPE)
1686 root = "self->_priv";
1687 else if(var->scope == CLASS_SCOPE) {
1688 root = "SELF_GET_CLASS(self)";
1690 error_print(GOB_ERROR, yyvsp[-5].line,
1691 _("Self aliases needed when autolinking to a classwide member"));
1695 if(strcmp(yyvsp[0].id, "link")==0) {
1696 set = g_strdup_printf("%s->%s = ARG;",
1697 root, yyvsp[-2].id);
1698 } else if(strcmp (yyvsp[0].id, "stringlink")==0) {
1699 set = g_strdup_printf("g_free(%s->%s); "
1700 "%s->%s = g_strdup(ARG);",
1702 root, yyvsp[-2].id);
1703 } else if(strcmp (yyvsp[0].id, "objectlink")==0) {
1704 set = g_strdup_printf(
1706 "gtk_object_ref (GTK_OBJECT (ARG)); "
1707 "if (%s->%s != NULL) "
1708 "gtk_object_unref (GTK_OBJECT (%s->%s)); "
1712 root, yyvsp[-2].id);
1714 g_assert_not_reached();
1717 if(strcmp (yyvsp[0].id, "stringlink")==0) {
1718 get = g_strdup_printf("ARG = g_strdup(%s->%s);", root, yyvsp[-2].id);
1720 /* For everything else, get is just straight assignment */
1721 get = g_strdup_printf("ARG = %s->%s;", root, yyvsp[-2].id);
1723 g_free (yyvsp[0].id);
1727 type = copy_type(var->vtype);
1729 node = new_argument (yyvsp[-3].id, type, yyvsp[-4].list,
1731 get, yyvsp[-5].line,
1732 set, yyvsp[-5].line,
1735 export_accessors (yyvsp[-2].id,
1736 g_string_new (get), yyvsp[-5].line,
1737 g_string_new (set), yyvsp[-5].line,
1742 class_nodes = g_list_append(class_nodes,node);
1748 if (strcmp (yyvsp[-1].id, "export")!=0) {
1749 g_free (yyvsp[-1].id);
1750 yyerror (_("parse error"));
1753 yyval.id = yyvsp[-1].id;
1758 { yyval.id = NULL; ;
1763 if(strcmp(yyvsp[-2].id,"type")!=0) {
1764 g_free(yyvsp[-4].id);
1765 g_free(yyvsp[-2].id);
1766 yyerror(_("parse error"));
1769 yyval.id = yyvsp[-4].id;
1775 yyval.id = yyvsp[0].id;
1776 typestack = g_list_prepend(typestack,NULL);
1781 { yyval.list = yyvsp[-1].list; ;
1785 { yyval.list = NULL; ;
1790 yyval.list = g_list_append(yyvsp[0].list,yyvsp[-2].id);
1796 yyval.list = g_list_append(NULL,yyvsp[0].id);
1802 Node *node = new_type(yyvsp[-1].id, yyvsp[0].id, NULL);
1803 typestack = g_list_prepend(typestack,node);
1809 Node *node = new_type(yyvsp[0].id, NULL, NULL);
1810 typestack = g_list_prepend(typestack,node);
1816 yyval.id = yyvsp[0].id;
1822 yyval.id = yyvsp[0].id;
1828 yyval.id = g_strconcat("const ", yyvsp[0].id, NULL);
1829 g_free(yyvsp[0].id);
1835 yyval.id = g_strconcat(yyvsp[-1].id, " const", NULL);
1836 g_free(yyvsp[-1].id);
1842 yyval.id = g_strconcat(yyvsp[-1].id, " ", yyvsp[0].id, NULL);
1843 g_free(yyvsp[0].id);
1849 yyval.id = g_strconcat("const ", yyvsp[-1].id, " ",
1851 g_free(yyvsp[0].id);
1857 yyval.id = g_strconcat(yyvsp[-2].id, " ",
1858 yyvsp[-1].id, " const", NULL);
1859 g_free(yyvsp[-1].id);
1865 yyval.id = g_strconcat(yyvsp[-1].id, " ", yyvsp[0].id, NULL);
1866 g_free(yyvsp[0].id);
1872 yyval.id = g_strconcat(yyvsp[-1].id, " ", yyvsp[0].id, NULL);
1873 g_free(yyvsp[-1].id);
1874 g_free(yyvsp[0].id);
1880 yyval.id = g_strconcat("const ", yyvsp[0].id, NULL);
1881 g_free(yyvsp[0].id);
1887 yyval.id = yyvsp[0].id;
1893 yyval.id = g_strconcat(yyvsp[-1].id, " const", NULL);
1894 g_free(yyvsp[-1].id);
1900 yyval.id = g_strdup(yyvsp[0].id);
1906 yyval.id = g_strconcat(yyvsp[-1].id, " const", NULL);
1911 { yyval.id = "void"; ;
1915 { yyval.id = "char"; ;
1919 { yyval.id = "short"; ;
1923 { yyval.id = "int"; ;
1927 { yyval.id = "long"; ;
1931 { yyval.id = "float"; ;
1935 { yyval.id = "double"; ;
1939 { yyval.id = "signed"; ;
1943 { yyval.id = "unsigned"; ;
1947 { yyval.id = "struct"; ;
1951 { yyval.id = "union"; ;
1955 { yyval.id = "enum"; ;
1959 { yyval.id = g_strdup("*"); ;
1963 { yyval.id = g_strdup("* const"); ;
1968 yyval.id = g_strconcat("*", yyvsp[0].id, NULL);
1969 g_free(yyvsp[0].id);
1975 yyval.id = g_strconcat("* const", yyvsp[0].id, NULL);
1976 g_free(yyvsp[0].id);
1982 if(strcmp(yyvsp[-1].id, "first")==0)
1983 yyval.sigtype = SIGNAL_FIRST_METHOD;
1984 else if(strcmp(yyvsp[-1].id, "last")==0)
1985 yyval.sigtype = SIGNAL_LAST_METHOD;
1987 yyerror(_("signal must be 'first' or 'last'"));
1988 g_free(yyvsp[-1].id);
1991 g_free(yyvsp[-1].id);
1997 yyval.sigtype = SIGNAL_LAST_METHOD;
2003 if(strcmp(yyvsp[-1].id,"first")==0)
2004 yyval.sigtype = SIGNAL_FIRST_METHOD;
2005 else if(strcmp(yyvsp[-1].id,"last")==0)
2006 yyval.sigtype = SIGNAL_LAST_METHOD;
2008 yyerror(_("signal must be 'first' or 'last'"));
2009 g_free(yyvsp[-1].id);
2012 g_free(yyvsp[-1].id);
2018 if(strcmp(yyvsp[-2].id,"first")==0)
2019 yyval.sigtype = SIGNAL_FIRST_METHOD;
2020 else if(strcmp(yyvsp[-2].id,"last")==0)
2021 yyval.sigtype = SIGNAL_LAST_METHOD;
2023 yyerror(_("signal must be 'first' or 'last'"));
2024 g_free(yyvsp[-2].id);
2027 g_free(yyvsp[-2].id);
2033 yyval.sigtype = SIGNAL_LAST_METHOD;
2039 /* the_scope was default thus public */
2040 the_scope = PUBLIC_SCOPE;
2046 gtktypes = g_list_prepend(gtktypes, yyvsp[-3].id);
2052 gtktypes = g_list_append(gtktypes, yyvsp[0].id);
2058 gtktypes = g_list_append(gtktypes, yyvsp[0].id);
2063 { yyval.cbuf = yyvsp[0].cbuf; ;
2067 { yyval.cbuf = NULL; ;
2073 yyerror(_("signal without 'self' as "
2074 "first parameter"));
2075 free_all_global_state();
2078 if(the_scope == CLASS_SCOPE) {
2079 yyerror(_("a method cannot be of class scope"));
2080 free_all_global_state();
2083 push_function(the_scope, yyvsp[-7].sigtype,NULL,
2084 yyvsp[-5].id, yyvsp[0].cbuf,yyvsp[-9].line,
2085 ccode_line, vararg, yyvsp[-8].list);
2092 yyerror(_("signal without 'self' as "
2093 "first parameter"));
2094 free_all_global_state();
2097 if(the_scope == CLASS_SCOPE) {
2098 yyerror(_("a method cannot be of class scope"));
2099 free_all_global_state();
2102 push_function(the_scope, yyvsp[-7].sigtype, NULL,
2103 yyvsp[-5].id, yyvsp[0].cbuf, yyvsp[-9].line,
2104 ccode_line, vararg, yyvsp[-8].list);
2111 yyerror(_("virtual method without 'self' as "
2112 "first parameter"));
2113 free_all_global_state();
2116 if(the_scope == CLASS_SCOPE) {
2117 yyerror(_("a method cannot be of class scope"));
2118 free_all_global_state();
2121 push_function(the_scope, VIRTUAL_METHOD, NULL, yyvsp[-5].id,
2122 yyvsp[0].cbuf, yyvsp[-8].line,
2123 ccode_line, vararg, NULL);
2130 yyerror(_("virtual method without 'self' as "
2131 "first parameter"));
2132 free_all_global_state();
2135 if(the_scope == CLASS_SCOPE) {
2136 yyerror(_("a method cannot be of class scope"));
2137 free_all_global_state();
2140 push_function(the_scope, VIRTUAL_METHOD, NULL, yyvsp[-5].id,
2141 yyvsp[0].cbuf, yyvsp[-7].line,
2142 ccode_line, vararg, NULL);
2146 #line 1001 "parse.y"
2149 yyerror(_("virtual method without 'self' as "
2150 "first parameter"));
2151 free_all_global_state();
2154 push_function(PUBLIC_SCOPE, VIRTUAL_METHOD, NULL,
2155 yyvsp[-5].id, yyvsp[0].cbuf, yyvsp[-7].line,
2156 ccode_line, vararg, NULL);
2160 #line 1012 "parse.y"
2162 push_function(NO_SCOPE, OVERRIDE_METHOD, yyvsp[-8].id,
2163 yyvsp[-5].id, yyvsp[0].cbuf,
2164 yyvsp[-10].line, ccode_line,
2169 #line 1018 "parse.y"
2171 if(the_scope == CLASS_SCOPE) {
2172 yyerror(_("a method cannot be of class scope"));
2173 free_all_global_state();
2176 push_function(the_scope, REGULAR_METHOD, NULL, yyvsp[-5].id,
2177 yyvsp[0].cbuf, yyvsp[-7].line, ccode_line,
2182 #line 1028 "parse.y"
2184 if(strcmp(yyvsp[-4].id, "init")==0) {
2185 push_init_arg(yyvsp[-2].id,FALSE);
2186 push_function(NO_SCOPE, INIT_METHOD, NULL,
2187 yyvsp[-4].id, yyvsp[0].cbuf, yyvsp[-3].line,
2188 ccode_line, FALSE, NULL);
2189 } else if(strcmp(yyvsp[-4].id, "class_init")==0) {
2190 push_init_arg(yyvsp[-2].id,TRUE);
2191 push_function(NO_SCOPE, CLASS_INIT_METHOD, NULL,
2192 yyvsp[-4].id, yyvsp[0].cbuf, yyvsp[-3].line,
2193 ccode_line, FALSE, NULL);
2195 g_free(yyvsp[-4].id);
2196 g_free(yyvsp[-2].id);
2197 g_string_free(yyvsp[0].cbuf,TRUE);
2198 yyerror(_("parse error "
2199 "(untyped blocks must be init or "
2206 #line 1051 "parse.y"
2208 g_free(onerror); onerror = NULL;
2209 g_free(defreturn); defreturn = NULL;
2210 if(!set_return_value(yyvsp[-1].id, yyvsp[0].id)) {
2211 g_free(yyvsp[-1].id);
2212 g_free(yyvsp[0].id);
2213 yyerror(_("parse error"));
2216 g_free(yyvsp[-1].id);
2220 #line 1062 "parse.y"
2222 g_free(onerror); onerror = NULL;
2223 g_free(defreturn); defreturn = NULL;
2224 if(!set_return_value(yyvsp[-3].id, yyvsp[-2].id)) {
2225 g_free(yyvsp[-3].id); g_free(yyvsp[-2].id);
2226 g_free(yyvsp[-1].id); g_free(yyvsp[0].id);
2227 yyerror(_("parse error"));
2230 if(!set_return_value(yyvsp[-1].id, yyvsp[0].id)) {
2231 onerror = defreturn = NULL;
2232 g_free(yyvsp[-3].id); g_free(yyvsp[-2].id);
2233 g_free(yyvsp[-1].id); g_free(yyvsp[0].id);
2234 yyerror(_("parse error"));
2237 g_free(yyvsp[-3].id);
2238 g_free(yyvsp[-1].id);
2242 #line 1081 "parse.y"
2244 g_free(onerror); onerror = NULL;
2245 g_free(defreturn); defreturn = NULL;
2249 #line 1087 "parse.y"
2250 { yyval.id = yyvsp[0].id; ;
2253 #line 1088 "parse.y"
2255 yyval.id = (yyvsp[1].cbuf)->str;
2256 g_string_free(yyvsp[1].cbuf, FALSE);
2260 #line 1094 "parse.y"
2261 { vararg = FALSE; has_self = FALSE; ;
2264 #line 1095 "parse.y"
2268 if(strcmp(yyvsp[0].id,"self")==0)
2269 push_self(yyvsp[0].id, FALSE);
2271 g_free(yyvsp[0].id);
2272 yyerror(_("parse error"));
2278 #line 1106 "parse.y"
2282 if(strcmp(yyvsp[-1].id,"self")==0)
2283 push_self(yyvsp[-1].id, TRUE);
2285 g_free(yyvsp[-1].id);
2286 yyerror(_("parse error"));
2292 #line 1117 "parse.y"
2296 if(strcmp(yyvsp[0].id,"self")==0)
2297 push_self(yyvsp[0].id, TRUE);
2299 g_free(yyvsp[0].id);
2300 yyerror(_("parse error"));
2306 #line 1128 "parse.y"
2309 if(strcmp(yyvsp[-2].id,"self")==0)
2310 push_self(yyvsp[-2].id, FALSE);
2312 g_free(yyvsp[-2].id);
2313 yyerror(_("parse error"));
2319 #line 1138 "parse.y"
2322 if(strcmp(yyvsp[-3].id,"self")==0)
2323 push_self(yyvsp[-3].id, TRUE);
2325 g_free(yyvsp[-3].id);
2326 yyerror(_("parse error"));
2332 #line 1148 "parse.y"
2335 if(strcmp(yyvsp[-2].id,"self")==0)
2336 push_self(yyvsp[-2].id, TRUE);
2338 g_free(yyvsp[-2].id);
2339 yyerror(_("parse error"));
2345 #line 1158 "parse.y"
2346 { has_self = FALSE; ;
2349 #line 1161 "parse.y"
2353 #line 1162 "parse.y"
2357 #line 1165 "parse.y"
2361 #line 1166 "parse.y"
2365 #line 1169 "parse.y"
2367 push_funcarg(yyvsp[0].id,NULL);
2371 #line 1172 "parse.y"
2373 push_funcarg(yyvsp[-1].id,yyvsp[0].id);
2377 #line 1175 "parse.y"
2379 if(strcmp(yyvsp[-2].id,"check")!=0) {
2380 yyerror(_("parse error"));
2383 g_free(yyvsp[-2].id);
2384 push_funcarg(yyvsp[-4].id,NULL);
2388 #line 1183 "parse.y"
2390 if(strcmp(yyvsp[-2].id,"check")!=0) {
2391 yyerror(_("parse error"));
2394 g_free(yyvsp[-2].id);
2395 push_funcarg(yyvsp[-5].id,yyvsp[-4].id);
2399 #line 1193 "parse.y"
2403 #line 1194 "parse.y"
2407 #line 1197 "parse.y"
2409 if(strcmp(yyvsp[0].id,"type")==0) {
2410 Node *node = new_check(TYPE_CHECK,NULL);
2411 checks = g_list_append(checks,node);
2412 } else if(strcmp(yyvsp[0].id,"null")==0) {
2413 Node *node = new_check(NULL_CHECK,NULL);
2414 checks = g_list_append(checks,node);
2416 yyerror(_("parse error"));
2419 g_free(yyvsp[0].id);
2423 #line 1210 "parse.y"
2425 Node *node = new_check(GT_CHECK,yyvsp[0].id);
2426 checks = g_list_append(checks,node);
2430 #line 1214 "parse.y"
2432 Node *node = new_check(LT_CHECK,yyvsp[0].id);
2433 checks = g_list_append(checks,node);
2437 #line 1218 "parse.y"
2439 Node *node = new_check(GE_CHECK,yyvsp[0].id);
2440 checks = g_list_append(checks,node);
2444 #line 1222 "parse.y"
2446 Node *node = new_check(LE_CHECK,yyvsp[0].id);
2447 checks = g_list_append(checks,node);
2451 #line 1226 "parse.y"
2453 Node *node = new_check(EQ_CHECK,yyvsp[0].id);
2454 checks = g_list_append(checks,node);
2458 #line 1230 "parse.y"
2460 Node *node = new_check(NE_CHECK,yyvsp[0].id);
2461 checks = g_list_append(checks,node);
2465 #line 1236 "parse.y"
2466 { yyval.id = yyvsp[0].id; ;
2469 #line 1237 "parse.y"
2471 yyval.id = g_strconcat("-",yyvsp[0].id,NULL);
2472 g_free(yyvsp[0].id);
2476 #line 1241 "parse.y"
2477 { yyval.id = yyvsp[0].id; ;
2480 /* the action file gets copied in in place of this dollarsign */
2481 #line 543 "/usr/lib/bison.simple"
2492 short *ssp1 = yyss - 1;
2493 fprintf (stderr, "state stack now");
2494 while (ssp1 != yyssp)
2495 fprintf (stderr, " %d", *++ssp1);
2496 fprintf (stderr, "\n");
2506 yylsp->first_line = yylloc.first_line;
2507 yylsp->first_column = yylloc.first_column;
2508 yylsp->last_line = (yylsp-1)->last_line;
2509 yylsp->last_column = (yylsp-1)->last_column;
2514 yylsp->last_line = (yylsp+yylen-1)->last_line;
2515 yylsp->last_column = (yylsp+yylen-1)->last_column;
2519 /* Now "shift" the result of the reduction.
2520 Determine what state that goes to,
2521 based on the state we popped back to
2522 and the rule number reduced by. */
2526 yystate = yypgoto[yyn - YYNTBASE] + *yyssp;
2527 if (yystate >= 0 && yystate <= YYLAST && yycheck[yystate] == *yyssp)
2528 yystate = yytable[yystate];
2530 yystate = yydefgoto[yyn - YYNTBASE];
2534 yyerrlab: /* here on detecting error */
2537 /* If not already recovering from an error, report this error. */
2541 #ifdef YYERROR_VERBOSE
2542 yyn = yypact[yystate];
2544 if (yyn > YYFLAG && yyn < YYLAST)
2551 /* Start X at -yyn if nec to avoid negative indexes in yycheck. */
2552 for (x = (yyn < 0 ? -yyn : 0);
2553 x < (sizeof(yytname) / sizeof(char *)); x++)
2554 if (yycheck[x + yyn] == x)
2555 size += strlen(yytname[x]) + 15, count++;
2556 msg = (char *) malloc(size + 15);
2559 strcpy(msg, "parse error");
2564 for (x = (yyn < 0 ? -yyn : 0);
2565 x < (sizeof(yytname) / sizeof(char *)); x++)
2566 if (yycheck[x + yyn] == x)
2568 strcat(msg, count == 0 ? ", expecting `" : " or `");
2569 strcat(msg, yytname[x]);
2578 yyerror ("parse error; also virtual memory exceeded");
2581 #endif /* YYERROR_VERBOSE */
2582 yyerror("parse error");
2586 yyerrlab1: /* here on error raised explicitly by an action */
2588 if (yyerrstatus == 3)
2590 /* if just tried and failed to reuse lookahead token after an error, discard it. */
2592 /* return failure if at end of input */
2593 if (yychar == YYEOF)
2598 fprintf(stderr, "Discarding token %d (%s).\n", yychar, yytname[yychar1]);
2604 /* Else will try to reuse lookahead token
2605 after shifting the error token. */
2607 yyerrstatus = 3; /* Each real token shifted decrements this */
2611 yyerrdefault: /* current state does not do anything special for the error token. */
2614 /* This is wrong; only states that explicitly want error tokens
2615 should shift them. */
2616 yyn = yydefact[yystate]; /* If its default is to accept any token, ok. Otherwise pop it.*/
2617 if (yyn) goto yydefault;
2620 yyerrpop: /* pop the current state because it cannot handle the error token */
2622 if (yyssp == yyss) YYABORT;
2632 short *ssp1 = yyss - 1;
2633 fprintf (stderr, "Error: state stack now");
2634 while (ssp1 != yyssp)
2635 fprintf (stderr, " %d", *++ssp1);
2636 fprintf (stderr, "\n");
2642 yyn = yypact[yystate];
2647 if (yyn < 0 || yyn > YYLAST || yycheck[yyn] != YYTERROR)
2666 fprintf(stderr, "Shifting error token, ");
2678 /* YYACCEPT comes here. */
2690 /* YYABORT comes here. */
2701 #line 1244 "parse.y"