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) {
342 #define YYFLAG -32768
345 #define YYTRANSLATE(x) ((unsigned)(x) <= 290 ? yytranslate[x] : 88)
347 static const char yytranslate[] = { 0,
348 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
349 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
350 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
351 2, 2, 48, 2, 2, 2, 2, 2, 2, 39,
352 40, 44, 2, 45, 49, 2, 2, 2, 2, 2,
353 2, 2, 2, 2, 2, 2, 2, 2, 41, 47,
354 42, 46, 2, 2, 2, 2, 2, 2, 2, 2,
355 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
356 2, 2, 2, 2, 2, 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, 37, 43, 38, 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, 2, 2, 2, 2, 2,
370 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
371 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
372 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
373 2, 2, 2, 2, 2, 1, 3, 4, 5, 6,
374 7, 8, 9, 10, 11, 12, 13, 14, 15, 16,
375 17, 18, 19, 20, 21, 22, 23, 24, 25, 26,
376 27, 28, 29, 30, 31, 32, 33, 34, 35, 36
380 static const short yyprhs[] = { 0,
381 0, 4, 7, 10, 12, 14, 16, 18, 20, 22,
382 24, 27, 29, 34, 38, 44, 45, 51, 57, 60,
383 62, 64, 67, 69, 71, 73, 75, 77, 79, 81,
384 84, 88, 91, 95, 98, 101, 103, 105, 106, 112,
385 119, 131, 140, 146, 152, 154, 158, 159, 163, 165,
386 168, 170, 172, 174, 177, 180, 183, 187, 191, 194,
387 197, 200, 202, 205, 207, 210, 212, 214, 216, 218,
388 220, 222, 224, 226, 228, 230, 232, 234, 236, 239,
389 242, 246, 249, 251, 255, 259, 262, 264, 269, 273,
390 275, 278, 280, 291, 303, 313, 323, 332, 344, 353,
391 359, 362, 367, 368, 370, 373, 375, 377, 380, 383,
392 387, 392, 397, 399, 403, 405, 409, 411, 414, 418,
393 425, 433, 436, 438, 440, 443, 446, 450, 454, 458,
397 static const short yyrhs[] = { 52,
398 53, 52, 0, 53, 52, 0, 52, 53, 0, 53,
399 0, 23, 0, 26, 0, 24, 0, 25, 0, 27,
400 0, 28, 0, 52, 51, 0, 51, 0, 54, 37,
401 56, 38, 0, 54, 37, 38, 0, 3, 21, 4,
402 21, 55, 0, 0, 39, 19, 19, 40, 55, 0,
403 39, 19, 20, 40, 55, 0, 56, 57, 0, 57,
404 0, 78, 0, 19, 78, 0, 62, 0, 63, 0,
405 41, 0, 29, 0, 30, 0, 31, 0, 32, 0,
406 19, 19, 0, 19, 37, 23, 0, 42, 87, 0,
407 42, 37, 23, 0, 59, 60, 0, 60, 59, 0,
408 60, 0, 59, 0, 0, 58, 67, 19, 61, 41,
409 0, 58, 67, 19, 22, 61, 41, 0, 33, 65,
410 64, 19, 19, 37, 23, 19, 37, 23, 41, 0,
411 33, 65, 64, 19, 19, 37, 23, 41, 0, 33,
412 65, 64, 19, 19, 0, 19, 39, 19, 67, 40,
413 0, 19, 0, 39, 66, 40, 0, 0, 19, 43,
414 66, 0, 19, 0, 68, 72, 0, 68, 0, 69,
415 0, 19, 0, 5, 19, 0, 19, 5, 0, 71,
416 19, 0, 5, 71, 19, 0, 71, 19, 5, 0,
417 70, 69, 0, 21, 69, 0, 5, 69, 0, 21,
418 0, 21, 5, 0, 70, 0, 70, 5, 0, 6,
419 0, 18, 0, 14, 0, 15, 0, 13, 0, 16,
420 0, 17, 0, 11, 0, 12, 0, 7, 0, 8,
421 0, 9, 0, 44, 0, 44, 5, 0, 44, 72,
422 0, 44, 5, 72, 0, 19, 75, 0, 75, 0,
423 58, 19, 75, 0, 19, 58, 75, 0, 58, 75,
424 0, 73, 0, 19, 39, 76, 40, 0, 76, 45,
425 19, 0, 19, 0, 37, 23, 0, 41, 0, 35,
426 65, 74, 67, 19, 39, 81, 40, 79, 77, 0,
427 58, 35, 65, 73, 67, 19, 39, 81, 40, 79,
428 77, 0, 34, 58, 67, 19, 39, 81, 40, 79,
429 77, 0, 58, 34, 67, 19, 39, 81, 40, 79,
430 77, 0, 34, 67, 19, 39, 81, 40, 79, 77,
431 0, 36, 39, 21, 40, 67, 19, 39, 81, 40,
432 79, 77, 0, 58, 67, 19, 39, 81, 40, 79,
433 77, 0, 19, 39, 19, 40, 77, 0, 19, 80,
434 0, 19, 80, 19, 80, 0, 0, 87, 0, 37,
435 23, 0, 6, 0, 19, 0, 19, 5, 0, 5,
436 19, 0, 19, 45, 82, 0, 19, 5, 45, 82,
437 0, 5, 19, 45, 82, 0, 82, 0, 83, 45,
438 10, 0, 83, 0, 83, 45, 84, 0, 84, 0,
439 67, 19, 0, 67, 19, 22, 0, 67, 19, 39,
440 19, 85, 40, 0, 67, 19, 22, 39, 19, 85,
441 40, 0, 85, 86, 0, 86, 0, 19, 0, 46,
442 87, 0, 47, 87, 0, 46, 42, 87, 0, 47,
443 42, 87, 0, 42, 42, 87, 0, 48, 42, 87,
444 0, 20, 0, 49, 20, 0, 19, 0
450 static const short yyrline[] = { 0,
451 316, 317, 318, 319, 322, 328, 334, 340, 346, 352,
452 360, 361, 364, 369, 376, 382, 383, 395, 409, 410,
453 413, 414, 422, 423, 424, 427, 428, 429, 430, 433,
454 446, 462, 466, 474, 475, 476, 477, 478, 484, 487,
455 491, 527, 556, 628, 637, 643, 644, 647, 650, 656,
456 660, 667, 670, 673, 677, 681, 685, 690, 698, 702,
457 707, 711, 714, 718, 721, 726, 727, 728, 729, 730,
458 731, 732, 733, 734, 737, 738, 739, 742, 743, 744,
459 748, 755, 767, 773, 785, 797, 800, 806, 811, 814,
460 819, 820, 824, 840, 856, 872, 888, 899, 905, 915,
461 938, 949, 968, 974, 975, 981, 982, 993, 1004, 1015,
462 1025, 1035, 1045, 1048, 1049, 1052, 1053, 1056, 1059, 1062,
463 1070, 1080, 1081, 1084, 1097, 1101, 1105, 1109, 1113, 1117,
469 #if YYDEBUG != 0 || defined (YYERROR_VERBOSE)
471 static const char * const yytname[] = { "$","error","$undefined.","CLASS",
472 "FROM","CONST","VOID","STRUCT","UNION","ENUM","THREEDOTS","SIGNED","UNSIGNED",
473 "LONG","SHORT","INT","FLOAT","DOUBLE","CHAR","TOKEN","NUMBER","TYPETOKEN","ARRAY_DIM",
474 "CCODE","HTCODE","PHCODE","HCODE","ACODE","ATCODE","PUBLIC","PRIVATE","PROTECTED",
475 "CLASSWIDE","ARGUMENT","VIRTUAL","SIGNAL","OVERRIDE","'{'","'}'","'('","')'",
476 "';'","'='","'|'","'*'","','","'>'","'<'","'!'","'-'","prog","ccode","ccodes",
477 "class","classdec","classflags","classcode","thing","scope","destructor","initializer",
478 "varoptions","variable","argument","argtype","flags","flaglist","type","specifier_list",
479 "spec_list","specifier","strunionenum","pointer","simplesigtype","fullsigtype",
480 "sigtype","tokenlist","codenocode","method","returnvals","retcode","funcargs",
481 "arglist","arglist1","arg","checklist","check","numtok", NULL
485 static const short yyr1[] = { 0,
486 50, 50, 50, 50, 51, 51, 51, 51, 51, 51,
487 52, 52, 53, 53, 54, 55, 55, 55, 56, 56,
488 57, 57, 57, 57, 57, 58, 58, 58, 58, 59,
489 59, 60, 60, 61, 61, 61, 61, 61, 62, 62,
490 63, 63, 63, 64, 64, 65, 65, 66, 66, 67,
491 67, 68, 68, 68, 68, 68, 68, 68, 69, 69,
492 69, 69, 69, 69, 69, 70, 70, 70, 70, 70,
493 70, 70, 70, 70, 71, 71, 71, 72, 72, 72,
494 72, 73, 73, 74, 74, 74, 74, 75, 76, 76,
495 77, 77, 78, 78, 78, 78, 78, 78, 78, 78,
496 79, 79, 79, 80, 80, 81, 81, 81, 81, 81,
497 81, 81, 81, 82, 82, 83, 83, 84, 84, 84,
498 84, 85, 85, 86, 86, 86, 86, 86, 86, 86,
502 static const short yyr2[] = { 0,
503 3, 2, 2, 1, 1, 1, 1, 1, 1, 1,
504 2, 1, 4, 3, 5, 0, 5, 5, 2, 1,
505 1, 2, 1, 1, 1, 1, 1, 1, 1, 2,
506 3, 2, 3, 2, 2, 1, 1, 0, 5, 6,
507 11, 8, 5, 5, 1, 3, 0, 3, 1, 2,
508 1, 1, 1, 2, 2, 2, 3, 3, 2, 2,
509 2, 1, 2, 1, 2, 1, 1, 1, 1, 1,
510 1, 1, 1, 1, 1, 1, 1, 1, 2, 2,
511 3, 2, 1, 3, 3, 2, 1, 4, 3, 1,
512 2, 1, 10, 11, 9, 9, 8, 11, 8, 5,
513 2, 4, 0, 1, 2, 1, 1, 2, 2, 3,
514 4, 4, 1, 3, 1, 3, 1, 2, 3, 6,
515 7, 2, 1, 1, 2, 2, 3, 3, 3, 3,
519 static const short yydefact[] = { 0,
520 0, 5, 7, 8, 6, 9, 10, 12, 0, 4,
521 0, 0, 11, 3, 2, 0, 0, 1, 0, 26,
522 27, 28, 29, 47, 0, 47, 0, 14, 25, 0,
523 20, 0, 23, 24, 21, 16, 0, 0, 0, 22,
524 0, 0, 0, 66, 75, 76, 77, 73, 74, 70,
525 68, 69, 71, 72, 67, 53, 62, 0, 0, 51,
526 52, 64, 0, 0, 0, 13, 19, 0, 47, 0,
527 0, 15, 0, 0, 49, 0, 45, 0, 0, 54,
528 61, 0, 55, 63, 60, 0, 0, 78, 50, 65,
529 59, 56, 0, 0, 87, 0, 83, 0, 0, 0,
530 38, 0, 0, 0, 0, 46, 0, 0, 57, 0,
531 0, 79, 80, 58, 0, 0, 0, 82, 0, 86,
532 0, 0, 0, 0, 0, 0, 38, 0, 0, 37,
533 36, 0, 0, 0, 0, 92, 100, 48, 0, 43,
534 0, 0, 66, 53, 0, 0, 113, 115, 117, 81,
535 90, 0, 85, 84, 0, 0, 0, 0, 30, 0,
536 0, 0, 133, 131, 0, 0, 32, 34, 35, 39,
537 16, 16, 91, 0, 0, 0, 54, 55, 0, 118,
538 103, 0, 88, 0, 0, 0, 0, 0, 31, 40,
539 103, 33, 132, 17, 18, 44, 0, 103, 0, 0,
540 110, 119, 0, 0, 0, 114, 116, 89, 0, 0,
541 103, 0, 0, 0, 42, 0, 112, 111, 0, 0,
542 0, 101, 104, 97, 103, 0, 0, 0, 99, 0,
543 95, 0, 124, 0, 0, 0, 0, 0, 123, 105,
544 0, 0, 103, 96, 103, 0, 0, 0, 0, 125,
545 0, 126, 0, 120, 122, 102, 93, 0, 0, 41,
546 121, 129, 127, 128, 130, 98, 94, 0, 0, 0
549 static const short yydefgoto[] = { 268,
550 8, 9, 10, 11, 72, 30, 31, 32, 130, 131,
551 132, 33, 34, 78, 42, 76, 145, 60, 61, 62,
552 63, 89, 95, 96, 97, 152, 137, 35, 205, 222,
553 146, 147, 148, 149, 238, 239, 223
556 static const short yypact[] = { 172,
557 -4,-32768,-32768,-32768,-32768,-32768,-32768,-32768, 172, 370,
558 -5, 93,-32768, 370, 370, 173, 87, 370, 209,-32768,
559 -32768,-32768,-32768, 72, 155, 72, 84,-32768,-32768, 191,
560 -32768, 120,-32768,-32768,-32768, 104, 107, 128, 120,-32768,
561 132, 133, 275,-32768,-32768,-32768,-32768,-32768,-32768,-32768,
562 -32768,-32768,-32768,-32768,-32768, 151, 343, 292, 146, 135,
563 -32768, 357, 158, 159, 160,-32768,-32768, 292, 72, 161,
564 163,-32768, 143, 174, 169, 154, 162, 194, 371,-32768,
565 -32768, 196,-32768, 371,-32768, 197, 178, 16,-32768, 371,
566 -32768, 213, 223, 200,-32768, 292,-32768, 190, 212, 214,
567 52, 11, 41, 195, 132,-32768, 216, 217,-32768, 198,
568 309, 135,-32768,-32768, 207, 228, 230,-32768, 61,-32768,
569 232, 292, 218, 61, 292, 68, 7, 309, 9, 219,
570 239, 237, 220, 245, 272,-32768,-32768,-32768, 292, 265,
571 309, 326, 279, 17, 293, 289,-32768, 291,-32768,-32768,
572 -32768, -20,-32768,-32768, 307, 331, 309, 332,-32768, 329,
573 312, 325,-32768,-32768, 344, 346,-32768,-32768,-32768,-32768,
574 104, 104,-32768, 339, 358, 340, 64, 100, 292, -6,
575 372, 258,-32768, 380, 309, 351, 360, 362,-32768,-32768,
576 372,-32768,-32768,-32768,-32768,-32768, 45, 372, 292, 292,
577 -32768, 363, 384, 28, 41,-32768,-32768,-32768, 364, 309,
578 372, 309, 41, 368,-32768, 41,-32768,-32768, 387, 111,
579 385, 388,-32768,-32768, 372, 369, 41, 373,-32768, 389,
580 -32768, 111,-32768, 374, 34, 50, 375, 70,-32768,-32768,
581 28, 41, 372,-32768, 372, 377, 102, 18, 18,-32768,
582 18,-32768, 18,-32768,-32768,-32768,-32768, 41, 41,-32768,
583 -32768,-32768,-32768,-32768,-32768,-32768,-32768, 410, 411,-32768
586 static const short yypgoto[] = {-32768,
587 241, 71, 405,-32768, -58,-32768, 390, -14, 284, 294,
588 295,-32768,-32768,-32768, -17, 314, -24,-32768, -39,-32768,
589 -40, -76, 321,-32768, -51,-32768, -203, 404, -184, 184,
590 -122, -104,-32768, 244, 199, -154, -129
597 static const short yytable[] = { 167,
598 59, 224, 82, 81, 39, 162, 213, 70, 64, 229,
599 58, 113, 231, 216, 74, 202, 12, 85, 176, 183,
600 112, 178, 91, 244, 184, 126, 227, 163, 164, 133,
601 134, 16, 203, 86, 187, 150, 163, 164, 257, 81,
602 242, 118, 120, 99, 81, 165, 163, 164, 129, 94,
603 81, 100, 163, 164, 266, 267, -107, 166, 258, 88,
604 259, 179, 209, 214, 221, 153, 166, 154, 163, 164,
605 126, 121, 118, 127, 201, 249, 166, 135, 117, 115,
606 15, 136, 166, 255, 18, 215, 159, 226, 233, 228,
607 128, 251, 255, 129, 217, 218, 17, 156, 166, 116,
608 158, 82, 81, -109, 160, 250, 252, 36, 199, 254,
609 41, 234, 194, 195, 174, 235, 236, 237, 262, 263,
610 233, 264, 65, 265, 43, 44, 45, 46, 47, 233,
611 48, 49, 50, 51, 52, 53, 54, 55, 56, -108,
612 57, 261, 71, 234, 200, 38, 73, 235, 236, 237,
613 75, 77, 234, 68, 69, 83, 235, 236, 237, 43,
614 44, 45, 46, 47, 87, 48, 49, 50, 51, 52,
615 53, 54, 55, 56, 1, 57, 92, 93, 88, 101,
616 98, 102, 103, 20, 21, 22, 23, 20, 21, 22,
617 23, 19, 104, 106, 2, 3, 4, 5, 6, 7,
618 107, 20, 21, 22, 23, 24, 25, 26, 27, 19,
619 28, 105, 108, 29, 109, 110, 111, 114, 119, 20,
620 21, 22, 23, 24, 25, 26, 27, 37, 66, 122,
621 123, 29, 124, 128, 139, 140, 141, 20, 21, 22,
622 23, 115, 25, 26, 27, 116, 151, 38, 115, 13,
623 155, 20, 21, 22, 23, 13, 157, 126, 13, 171,
624 129, 116, 43, 44, 45, 46, 47, 206, 48, 49,
625 50, 51, 52, 53, 54, 55, 56, 170, 57, 79,
626 44, 45, 46, 47, 172, 48, 49, 50, 51, 52,
627 53, 54, 55, 80, 173, 57, 43, 44, 45, 46,
628 47, 175, 48, 49, 50, 51, 52, 53, 54, 55,
629 56, 180, 57, 142, 143, 45, 46, 47, -106, 48,
630 49, 50, 51, 52, 53, 54, 55, 144, 181, 57,
631 79, 44, 45, 46, 47, 182, 48, 49, 50, 51,
632 52, 53, 54, 55, 177, 185, 57, 84, 44, 186,
633 188, 189, 190, 48, 49, 50, 51, 52, 53, 54,
634 55, 90, 44, 57, 191, 193, 192, 48, 49, 50,
635 51, 52, 53, 54, 55, 79, 44, 57, 196, 198,
636 197, 48, 49, 50, 51, 52, 53, 54, 55, 210,
637 204, 57, 2, 3, 4, 5, 6, 7, 208, 211,
638 212, 219, 220, 225, 230, 232, 241, 240, 243, 269,
639 270, 246, 245, 14, 169, 248, 253, 260, 138, 67,
640 125, 161, 40, 168, 256, 207, 0, 0, 0, 0,
644 static const short yycheck[] = { 129,
645 25, 205, 43, 43, 19, 128, 191, 32, 26, 213,
646 25, 88, 216, 198, 39, 22, 21, 57, 141, 40,
647 5, 5, 62, 227, 45, 19, 211, 19, 20, 19,
648 20, 37, 39, 58, 157, 112, 19, 20, 242, 79,
649 225, 93, 94, 68, 84, 37, 19, 20, 42, 64,
650 90, 69, 19, 20, 258, 259, 40, 49, 243, 44,
651 245, 45, 185, 19, 37, 117, 49, 119, 19, 20,
652 19, 96, 124, 22, 179, 42, 49, 37, 93, 19,
653 10, 41, 49, 238, 14, 41, 19, 210, 19, 212,
654 39, 42, 247, 42, 199, 200, 4, 122, 49, 39,
655 125, 142, 142, 40, 37, 235, 236, 21, 45, 40,
656 39, 42, 171, 172, 139, 46, 47, 48, 248, 249,
657 19, 251, 39, 253, 5, 6, 7, 8, 9, 19,
658 11, 12, 13, 14, 15, 16, 17, 18, 19, 40,
659 21, 40, 39, 42, 45, 39, 19, 46, 47, 48,
660 19, 19, 42, 34, 35, 5, 46, 47, 48, 5,
661 6, 7, 8, 9, 19, 11, 12, 13, 14, 15,
662 16, 17, 18, 19, 3, 21, 19, 19, 44, 19,
663 21, 19, 40, 29, 30, 31, 32, 29, 30, 31,
664 32, 19, 19, 40, 23, 24, 25, 26, 27, 28,
665 39, 29, 30, 31, 32, 33, 34, 35, 36, 19,
666 38, 43, 19, 41, 19, 19, 39, 5, 19, 29,
667 30, 31, 32, 33, 34, 35, 36, 19, 38, 40,
668 19, 41, 19, 39, 19, 19, 39, 29, 30, 31,
669 32, 19, 34, 35, 36, 39, 19, 39, 19, 9,
670 19, 29, 30, 31, 32, 15, 39, 19, 18, 40,
671 42, 39, 5, 6, 7, 8, 9, 10, 11, 12,
672 13, 14, 15, 16, 17, 18, 19, 41, 21, 5,
673 6, 7, 8, 9, 40, 11, 12, 13, 14, 15,
674 16, 17, 18, 19, 23, 21, 5, 6, 7, 8,
675 9, 37, 11, 12, 13, 14, 15, 16, 17, 18,
676 19, 19, 21, 5, 6, 7, 8, 9, 40, 11,
677 12, 13, 14, 15, 16, 17, 18, 19, 40, 21,
678 5, 6, 7, 8, 9, 45, 11, 12, 13, 14,
679 15, 16, 17, 18, 19, 39, 21, 5, 6, 19,
680 19, 23, 41, 11, 12, 13, 14, 15, 16, 17,
681 18, 5, 6, 21, 40, 20, 23, 11, 12, 13,
682 14, 15, 16, 17, 18, 5, 6, 21, 40, 40,
683 23, 11, 12, 13, 14, 15, 16, 17, 18, 39,
684 19, 21, 23, 24, 25, 26, 27, 28, 19, 40,
685 39, 39, 19, 40, 37, 19, 19, 23, 40, 0,
686 0, 23, 40, 9, 131, 42, 42, 41, 105, 30,
687 100, 127, 19, 130, 241, 182, -1, -1, -1, -1,
690 /* -*-C-*- Note some compilers choke on comments on `#line' lines. */
691 #line 3 "/usr/lib/bison.simple"
692 /* This file comes from bison-1.28. */
694 /* Skeleton output parser for bison,
695 Copyright (C) 1984, 1989, 1990 Free Software Foundation, Inc.
697 This program is free software; you can redistribute it and/or modify
698 it under the terms of the GNU General Public License as published by
699 the Free Software Foundation; either version 2, or (at your option)
702 This program is distributed in the hope that it will be useful,
703 but WITHOUT ANY WARRANTY; without even the implied warranty of
704 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
705 GNU General Public License for more details.
707 You should have received a copy of the GNU General Public License
708 along with this program; if not, write to the Free Software
709 Foundation, Inc., 59 Temple Place - Suite 330,
710 Boston, MA 02111-1307, USA. */
712 /* As a special exception, when this file is copied by Bison into a
713 Bison output file, you may use that output file without restriction.
714 This special exception was added by the Free Software Foundation
715 in version 1.24 of Bison. */
717 /* This is the parser code that is written into each bison parser
718 when the %semantic_parser declaration is not specified in the grammar.
719 It was written by Richard Stallman by simplifying the hairy parser
720 used when %semantic_parser is specified. */
722 #ifndef YYSTACK_USE_ALLOCA
724 #define YYSTACK_USE_ALLOCA
725 #else /* alloca not defined */
727 #define YYSTACK_USE_ALLOCA
728 #define alloca __builtin_alloca
729 #else /* not GNU C. */
730 #if (!defined (__STDC__) && defined (sparc)) || defined (__sparc__) || defined (__sparc) || defined (__sgi) || (defined (__sun) && defined (__i386))
731 #define YYSTACK_USE_ALLOCA
733 #else /* not sparc */
734 /* We think this test detects Watcom and Microsoft C. */
735 /* This used to test MSDOS, but that is a bad idea
736 since that symbol is in the user namespace. */
737 #if (defined (_MSDOS) || defined (_MSDOS_)) && !defined (__TURBOC__)
738 #if 0 /* No need for malloc.h, which pollutes the namespace;
739 instead, just don't use alloca. */
742 #else /* not MSDOS, or __TURBOC__ */
744 /* I don't know what this was needed for, but it pollutes the namespace.
745 So I turned it off. rms, 2 May 1997. */
746 /* #include <malloc.h> */
748 #define YYSTACK_USE_ALLOCA
749 #else /* not MSDOS, or __TURBOC__, or _AIX */
751 #ifdef __hpux /* haible@ilog.fr says this works for HPUX 9.05 and up,
752 and on HPUX 10. Eventually we can turn this on. */
753 #define YYSTACK_USE_ALLOCA
754 #define alloca __builtin_alloca
757 #endif /* not _AIX */
758 #endif /* not MSDOS, or __TURBOC__ */
759 #endif /* not sparc */
760 #endif /* not GNU C */
761 #endif /* alloca not defined */
762 #endif /* YYSTACK_USE_ALLOCA not defined */
764 #ifdef YYSTACK_USE_ALLOCA
765 #define YYSTACK_ALLOC alloca
767 #define YYSTACK_ALLOC malloc
770 /* Note: there must be only one dollar sign in this file.
771 It is replaced by the list of actions, each action
772 as one case of the switch. */
774 #define yyerrok (yyerrstatus = 0)
775 #define yyclearin (yychar = YYEMPTY)
778 #define YYACCEPT goto yyacceptlab
779 #define YYABORT goto yyabortlab
780 #define YYERROR goto yyerrlab1
781 /* Like YYERROR except do call yyerror.
782 This remains here temporarily to ease the
783 transition to the new meaning of YYERROR, for GCC.
784 Once GCC version 2 has supplanted version 1, this can go. */
785 #define YYFAIL goto yyerrlab
786 #define YYRECOVERING() (!!yyerrstatus)
787 #define YYBACKUP(token, value) \
789 if (yychar == YYEMPTY && yylen == 1) \
790 { yychar = (token), yylval = (value); \
791 yychar1 = YYTRANSLATE (yychar); \
796 { yyerror ("syntax error: cannot back up"); YYERROR; } \
800 #define YYERRCODE 256
803 #define YYLEX yylex()
809 #define YYLEX yylex(&yylval, &yylloc, YYLEX_PARAM)
811 #define YYLEX yylex(&yylval, &yylloc)
813 #else /* not YYLSP_NEEDED */
815 #define YYLEX yylex(&yylval, YYLEX_PARAM)
817 #define YYLEX yylex(&yylval)
819 #endif /* not YYLSP_NEEDED */
822 /* If nonreentrant, generate the variables here */
826 int yychar; /* the lookahead symbol */
827 YYSTYPE yylval; /* the semantic value of the */
828 /* lookahead symbol */
831 YYLTYPE yylloc; /* location data for the lookahead */
835 int yynerrs; /* number of parse errors so far */
836 #endif /* not YYPURE */
839 int yydebug; /* nonzero means print parse trace */
840 /* Since this is uninitialized, it does not stop multiple parsers
844 /* YYINITDEPTH indicates the initial size of the parser's stacks */
847 #define YYINITDEPTH 200
850 /* YYMAXDEPTH is the maximum size the stacks can grow to
851 (effective only if the built-in stack extension method is used). */
858 #define YYMAXDEPTH 10000
861 /* Define __yy_memcpy. Note that the size argument
862 should be passed with type unsigned int, because that is what the non-GCC
863 definitions require. With GCC, __builtin_memcpy takes an arg
864 of type size_t, but it can handle unsigned int. */
866 #if __GNUC__ > 1 /* GNU C and GNU C++ define this. */
867 #define __yy_memcpy(TO,FROM,COUNT) __builtin_memcpy(TO,FROM,COUNT)
868 #else /* not GNU C or C++ */
871 /* This is the most reliable way to avoid incompatibilities
872 in available built-in functions on various systems. */
874 __yy_memcpy (to, from, count)
879 register char *f = from;
880 register char *t = to;
881 register int i = count;
887 #else /* __cplusplus */
889 /* This is the most reliable way to avoid incompatibilities
890 in available built-in functions on various systems. */
892 __yy_memcpy (char *to, char *from, unsigned int count)
894 register char *t = to;
895 register char *f = from;
896 register int i = count;
905 #line 217 "/usr/lib/bison.simple"
907 /* The user can define YYPARSE_PARAM as the name of an argument to be passed
908 into yyparse. The argument should have type void *.
909 It should actually point to an object.
910 Grammar actions can access the variable by casting it
911 to the proper pointer type. */
915 #define YYPARSE_PARAM_ARG void *YYPARSE_PARAM
916 #define YYPARSE_PARAM_DECL
917 #else /* not __cplusplus */
918 #define YYPARSE_PARAM_ARG YYPARSE_PARAM
919 #define YYPARSE_PARAM_DECL void *YYPARSE_PARAM;
920 #endif /* not __cplusplus */
921 #else /* not YYPARSE_PARAM */
922 #define YYPARSE_PARAM_ARG
923 #define YYPARSE_PARAM_DECL
924 #endif /* not YYPARSE_PARAM */
926 /* Prevent warning if -Wstrict-prototypes. */
929 int yyparse (void *);
936 yyparse(YYPARSE_PARAM_ARG)
939 register int yystate;
941 register short *yyssp;
942 register YYSTYPE *yyvsp;
943 int yyerrstatus; /* number of tokens to shift before error messages enabled */
944 int yychar1 = 0; /* lookahead token as an internal (translated) token number */
946 short yyssa[YYINITDEPTH]; /* the state stack */
947 YYSTYPE yyvsa[YYINITDEPTH]; /* the semantic value stack */
949 short *yyss = yyssa; /* refer to the stacks thru separate pointers */
950 YYSTYPE *yyvs = yyvsa; /* to allow yyoverflow to reallocate them elsewhere */
953 YYLTYPE yylsa[YYINITDEPTH]; /* the location stack */
954 YYLTYPE *yyls = yylsa;
957 #define YYPOPSTACK (yyvsp--, yyssp--, yylsp--)
959 #define YYPOPSTACK (yyvsp--, yyssp--)
962 int yystacksize = YYINITDEPTH;
963 int yyfree_stacks = 0;
974 YYSTYPE yyval; /* the variable used to return */
975 /* semantic values from the action */
982 fprintf(stderr, "Starting parse\n");
988 yychar = YYEMPTY; /* Cause a token to be read. */
990 /* Initialize stack pointers.
991 Waste one element of value and location stack
992 so that they stay on the same level as the state stack.
993 The wasted elements are never initialized. */
1001 /* Push a new state, which is found in yystate . */
1002 /* In all cases, when you get here, the value and location stacks
1003 have just been pushed. so pushing a state here evens the stacks. */
1008 if (yyssp >= yyss + yystacksize - 1)
1010 /* Give user a chance to reallocate the stack */
1011 /* Use copies of these so that the &'s don't force the real ones into memory. */
1012 YYSTYPE *yyvs1 = yyvs;
1013 short *yyss1 = yyss;
1015 YYLTYPE *yyls1 = yyls;
1018 /* Get the current used size of the three stacks, in elements. */
1019 int size = yyssp - yyss + 1;
1022 /* Each stack pointer address is followed by the size of
1023 the data in use in that stack, in bytes. */
1025 /* This used to be a conditional around just the two extra args,
1026 but that might be undefined if yyoverflow is a macro. */
1027 yyoverflow("parser stack overflow",
1028 &yyss1, size * sizeof (*yyssp),
1029 &yyvs1, size * sizeof (*yyvsp),
1030 &yyls1, size * sizeof (*yylsp),
1033 yyoverflow("parser stack overflow",
1034 &yyss1, size * sizeof (*yyssp),
1035 &yyvs1, size * sizeof (*yyvsp),
1039 yyss = yyss1; yyvs = yyvs1;
1043 #else /* no yyoverflow */
1044 /* Extend the stack our own way. */
1045 if (yystacksize >= YYMAXDEPTH)
1047 yyerror("parser stack overflow");
1059 if (yystacksize > YYMAXDEPTH)
1060 yystacksize = YYMAXDEPTH;
1061 #ifndef YYSTACK_USE_ALLOCA
1064 yyss = (short *) YYSTACK_ALLOC (yystacksize * sizeof (*yyssp));
1065 __yy_memcpy ((char *)yyss, (char *)yyss1,
1066 size * (unsigned int) sizeof (*yyssp));
1067 yyvs = (YYSTYPE *) YYSTACK_ALLOC (yystacksize * sizeof (*yyvsp));
1068 __yy_memcpy ((char *)yyvs, (char *)yyvs1,
1069 size * (unsigned int) sizeof (*yyvsp));
1071 yyls = (YYLTYPE *) YYSTACK_ALLOC (yystacksize * sizeof (*yylsp));
1072 __yy_memcpy ((char *)yyls, (char *)yyls1,
1073 size * (unsigned int) sizeof (*yylsp));
1075 #endif /* no yyoverflow */
1077 yyssp = yyss + size - 1;
1078 yyvsp = yyvs + size - 1;
1080 yylsp = yyls + size - 1;
1085 fprintf(stderr, "Stack size increased to %d\n", yystacksize);
1088 if (yyssp >= yyss + yystacksize - 1)
1094 fprintf(stderr, "Entering state %d\n", yystate);
1100 /* Do appropriate processing given the current state. */
1101 /* Read a lookahead token if we need one and don't already have one. */
1104 /* First try to decide what to do without reference to lookahead token. */
1106 yyn = yypact[yystate];
1110 /* Not known => get a lookahead token if don't already have one. */
1112 /* yychar is either YYEMPTY or YYEOF
1113 or a valid token in external form. */
1115 if (yychar == YYEMPTY)
1119 fprintf(stderr, "Reading a token: ");
1124 /* Convert token to internal form (in yychar1) for indexing tables with */
1126 if (yychar <= 0) /* This means end of input. */
1129 yychar = YYEOF; /* Don't call YYLEX any more */
1133 fprintf(stderr, "Now at end of input.\n");
1138 yychar1 = YYTRANSLATE(yychar);
1143 fprintf (stderr, "Next token is %d (%s", yychar, yytname[yychar1]);
1144 /* Give the individual parser a way to print the precise meaning
1145 of a token, for further debugging info. */
1147 YYPRINT (stderr, yychar, yylval);
1149 fprintf (stderr, ")\n");
1155 if (yyn < 0 || yyn > YYLAST || yycheck[yyn] != yychar1)
1160 /* yyn is what to do for this token type in this state.
1161 Negative => reduce, -yyn is rule number.
1162 Positive => shift, yyn is new state.
1163 New state is final state => don't bother to shift,
1164 just return success.
1165 0, or most negative number => error. */
1180 /* Shift the lookahead token. */
1184 fprintf(stderr, "Shifting token %d (%s), ", yychar, yytname[yychar1]);
1187 /* Discard the token being shifted unless it is eof. */
1188 if (yychar != YYEOF)
1196 /* count tokens shifted since error; after three, turn off error status. */
1197 if (yyerrstatus) yyerrstatus--;
1202 /* Do the default action for the current state. */
1205 yyn = yydefact[yystate];
1209 /* Do a reduction. yyn is the number of a rule to reduce with. */
1213 yyval = yyvsp[1-yylen]; /* implement default value of the action */
1220 fprintf (stderr, "Reducing via rule %d (line %d), ",
1223 /* Print the symbols being reduced, and their result. */
1224 for (i = yyprhs[yyn]; yyrhs[i] > 0; i++)
1225 fprintf (stderr, "%s ", yytname[yyrhs[i]]);
1226 fprintf (stderr, " -> %s\n", yytname[yyr1[yyn]]);
1252 Node *node = new_ccode(C_CCODE,(yyvsp[0].cbuf)->str,
1254 nodes = g_list_append(nodes,node);
1255 g_string_free(yyvsp[0].cbuf,FALSE);
1261 Node *node = new_ccode(H_CCODE,(yyvsp[0].cbuf)->str,
1263 nodes = g_list_append(nodes,node);
1264 g_string_free(yyvsp[0].cbuf,FALSE);
1270 Node *node = new_ccode(HT_CCODE,(yyvsp[0].cbuf)->str,
1272 nodes = g_list_append(nodes,node);
1273 g_string_free(yyvsp[0].cbuf,FALSE);
1279 Node *node = new_ccode(PH_CCODE,(yyvsp[0].cbuf)->str,
1281 nodes = g_list_append(nodes,node);
1282 g_string_free(yyvsp[0].cbuf,FALSE);
1288 Node *node = new_ccode(A_CCODE,(yyvsp[0].cbuf)->str,
1290 nodes = g_list_append(nodes,node);
1291 g_string_free(yyvsp[0].cbuf,FALSE);
1297 Node *node = new_ccode(AT_CCODE,(yyvsp[0].cbuf)->str,
1299 nodes = g_list_append(nodes,node);
1300 g_string_free(yyvsp[0].cbuf,FALSE);
1314 ((Class *)class)->nodes = class_nodes;
1316 nodes = g_list_append(nodes,class);
1322 ((Class *)class)->nodes = NULL;
1324 nodes = g_list_append(nodes,class);
1330 class = new_class (yyvsp[-3].id, yyvsp[-1].id,
1331 bonobo_x_class, chunk_size, NULL);
1337 if(strcmp(yyvsp[-3].id,"chunks") == 0) {
1338 g_free (chunk_size);
1339 chunk_size = g_strdup(yyvsp[-2].id);
1340 } else if(strcmp(yyvsp[-3].id,"BonoboX") == 0) {
1341 g_free (bonobo_x_class);
1342 bonobo_x_class = g_strdup(yyvsp[-2].id);
1344 yyerror(_("parse error"));
1352 if(strcmp(yyvsp[-3].id,"chunks") == 0) {
1353 g_free (chunk_size);
1354 if(atoi(yyvsp[-2].id) != 0)
1355 chunk_size = g_strdup(yyvsp[-2].id);
1359 yyerror(_("parse error"));
1379 if (strcmp (yyvsp[-1].id, "BonoboX") != 0) {
1380 g_free(yyvsp[-1].id);
1381 yyerror(_("parse error"));
1384 last_added_method->bonobo_x_func = TRUE;
1401 { the_scope = PUBLIC_SCOPE; ;
1405 { the_scope = PRIVATE_SCOPE; ;
1409 { the_scope = PROTECTED_SCOPE; ;
1413 { the_scope = CLASS_SCOPE; ;
1418 if(strcmp(yyvsp[-1].id, "destroywith")==0) {
1419 g_free(yyvsp[-1].id);
1420 destructor = yyvsp[0].id;
1421 destructor_line = line_no;
1422 destructor_simple = TRUE;
1424 g_free(yyvsp[-1].id);
1425 g_free(yyvsp[0].id);
1426 yyerror(_("parse error"));
1434 if(strcmp(yyvsp[-2].id, "destroy")==0) {
1435 g_free(yyvsp[-2].id);
1436 destructor = (yyvsp[0].cbuf)->str;
1437 g_string_free(yyvsp[0].cbuf, FALSE);
1438 destructor_line = ccode_line;
1439 destructor_simple = FALSE;
1441 g_free(yyvsp[-2].id);
1442 g_string_free(yyvsp[0].cbuf, TRUE);
1443 yyerror(_("parse error"));
1451 initializer = yyvsp[0].id;
1452 initializer_line = ccode_line;
1458 initializer = (yyvsp[0].cbuf)->str;
1459 initializer_line = ccode_line;
1460 g_string_free(yyvsp[0].cbuf, FALSE);
1473 { destructor = NULL; ;
1477 { initializer = NULL; ;
1489 push_variable(yyvsp[-2].id, the_scope,yyvsp[-4].line, NULL);
1495 push_variable(yyvsp[-3].id, the_scope, yyvsp[-5].line, yyvsp[-2].id);
1501 if(strcmp(yyvsp[-6].id,"get")==0 &&
1502 strcmp(yyvsp[-3].id,"set")==0) {
1504 Type *type = pop_type();
1505 g_free(yyvsp[-6].id); g_free(yyvsp[-3].id);
1506 node = new_argument(yyvsp[-8].id,type,yyvsp[-9].list,yyvsp[-7].id,
1507 (yyvsp[-4].cbuf)->str,yyvsp[-5].line,
1508 (yyvsp[-1].cbuf)->str,yyvsp[-2].line,
1510 g_string_free(yyvsp[-4].cbuf,FALSE);
1511 g_string_free(yyvsp[-1].cbuf,FALSE);
1512 class_nodes = g_list_append(class_nodes,node);
1513 } else if(strcmp(yyvsp[-6].id,"set")==0 &&
1514 strcmp(yyvsp[-3].id,"get")==0) {
1516 Type *type = pop_type();
1517 g_free(yyvsp[-6].id); g_free(yyvsp[-3].id);
1518 node = new_argument(yyvsp[-8].id,type,yyvsp[-9].list,yyvsp[-7].id,
1519 (yyvsp[-1].cbuf)->str,yyvsp[-2].line,
1520 (yyvsp[-4].cbuf)->str,yyvsp[-5].line,
1522 g_string_free(yyvsp[-1].cbuf,FALSE);
1523 g_string_free(yyvsp[-4].cbuf,FALSE);
1524 class_nodes = g_list_append(class_nodes,node);
1526 g_free(yyvsp[-8].id); g_free(yyvsp[-7].id);
1527 g_free(yyvsp[-6].id); g_free(yyvsp[-3].id);
1528 g_list_foreach(yyvsp[-9].list,(GFunc)g_free,NULL);
1529 g_list_free(yyvsp[-9].list);
1530 g_string_free(yyvsp[-1].cbuf,TRUE);
1531 g_string_free(yyvsp[-4].cbuf,TRUE);
1532 yyerror(_("parse error"));
1540 if(strcmp(yyvsp[-3].id, "get") == 0) {
1542 Type *type = pop_type();
1543 g_free(yyvsp[-3].id);
1544 node = new_argument(yyvsp[-5].id, type, yyvsp[-6].list, yyvsp[-4].id,
1545 (yyvsp[-1].cbuf)->str, yyvsp[-2].line,
1546 NULL, 0, yyvsp[-7].line);
1547 g_string_free(yyvsp[-1].cbuf, FALSE);
1548 class_nodes = g_list_append(class_nodes, node);
1549 } else if(strcmp(yyvsp[-3].id, "set") == 0) {
1551 Type *type = pop_type();
1552 g_free(yyvsp[-3].id);
1553 node = new_argument(yyvsp[-5].id, type, yyvsp[-6].list, yyvsp[-4].id,
1554 NULL, 0, (yyvsp[-1].cbuf)->str,
1555 yyvsp[-2].line, yyvsp[-7].line);
1556 g_string_free(yyvsp[-1].cbuf, FALSE);
1557 class_nodes = g_list_append(class_nodes, node);
1559 g_free(yyvsp[-3].id); g_free(yyvsp[-5].id);
1560 g_free(yyvsp[-4].id);
1561 g_list_foreach(yyvsp[-6].list, (GFunc)g_free, NULL);
1562 g_list_free(yyvsp[-6].list);
1563 g_string_free(yyvsp[-1].cbuf, TRUE);
1564 yyerror(_("parse error"));
1573 char *get, *set = NULL;
1578 if(strcmp(yyvsp[0].id, "link")!=0 &&
1579 strcmp(yyvsp[0].id, "stringlink")!=0 &&
1580 strcmp(yyvsp[0].id, "objectlink")!=0) {
1581 g_free(yyvsp[0].id); g_free(yyvsp[-2].id);
1582 g_free(yyvsp[-1].id);
1583 g_list_foreach(yyvsp[-3].list,(GFunc)g_free,NULL);
1584 g_list_free(yyvsp[-3].list);
1585 yyerror(_("parse error"));
1591 var = find_var_or_die(yyvsp[-1].id, yyvsp[-4].line);
1592 if(var->scope == PRIVATE_SCOPE)
1593 root = "self->_priv";
1594 else if(var->scope == CLASS_SCOPE) {
1595 root = "SELF_GET_CLASS(self)";
1597 error_print(GOB_ERROR, yyvsp[-4].line,
1598 _("Self aliases needed when autolinking to a classwide member"));
1602 if(strcmp(yyvsp[0].id, "link")==0) {
1603 set = g_strdup_printf("%s->%s = ARG;",
1604 root, yyvsp[-1].id);
1605 } else if(strcmp(yyvsp[0].id, "stringlink")==0) {
1606 set = g_strdup_printf("g_free(%s->%s); "
1607 "%s->%s = g_strdup(ARG);",
1609 root, yyvsp[-1].id);
1610 } else if(strcmp(yyvsp[0].id, "objectlink")==0) {
1611 set = g_strdup_printf(
1613 "gtk_object_ref (GTK_OBJECT (ARG)); "
1614 "if (%s->%s != NULL) "
1615 "gtk_object_unref (GTK_OBJECT (%s->%s)); "
1619 root, yyvsp[-1].id);
1621 g_assert_not_reached();
1624 if(strcmp(yyvsp[0].id, "stringlink")==0) {
1625 get = g_strdup_printf("ARG = g_strdup(%s->%s);", root, yyvsp[-1].id);
1627 /* For everything else, get is just straight assignment */
1628 get = g_strdup_printf("ARG = %s->%s;", root, yyvsp[-1].id);
1630 g_free(yyvsp[0].id);
1634 type = copy_type(var->vtype);
1636 node = new_argument(yyvsp[-2].id, type, yyvsp[-3].list,
1637 yyvsp[-1].id, get, yyvsp[-4].line,
1638 set, yyvsp[-4].line, yyvsp[-4].line);
1639 class_nodes = g_list_append(class_nodes,node);
1645 if(strcmp(yyvsp[-2].id,"type")!=0) {
1646 g_free(yyvsp[-4].id);
1647 g_free(yyvsp[-2].id);
1648 yyerror(_("parse error"));
1651 yyval.id = yyvsp[-4].id;
1657 yyval.id = yyvsp[0].id;
1658 typestack = g_list_prepend(typestack,NULL);
1663 { yyval.list = yyvsp[-1].list; ;
1667 { yyval.list = NULL; ;
1672 yyval.list = g_list_append(yyvsp[0].list,yyvsp[-2].id);
1678 yyval.list = g_list_append(NULL,yyvsp[0].id);
1684 Node *node = new_type(yyvsp[-1].id, yyvsp[0].id, NULL);
1685 typestack = g_list_prepend(typestack,node);
1691 Node *node = new_type(yyvsp[0].id, NULL, NULL);
1692 typestack = g_list_prepend(typestack,node);
1698 yyval.id = yyvsp[0].id;
1704 yyval.id = yyvsp[0].id;
1710 yyval.id = g_strconcat("const ", yyvsp[0].id, NULL);
1711 g_free(yyvsp[0].id);
1717 yyval.id = g_strconcat(yyvsp[-1].id, " const", NULL);
1718 g_free(yyvsp[-1].id);
1724 yyval.id = g_strconcat(yyvsp[-1].id, " ", yyvsp[0].id, NULL);
1725 g_free(yyvsp[0].id);
1731 yyval.id = g_strconcat("const ", yyvsp[-1].id, " ",
1733 g_free(yyvsp[0].id);
1739 yyval.id = g_strconcat(yyvsp[-2].id, " ",
1740 yyvsp[-1].id, " const", NULL);
1741 g_free(yyvsp[-1].id);
1747 yyval.id = g_strconcat(yyvsp[-1].id, " ", yyvsp[0].id, NULL);
1748 g_free(yyvsp[0].id);
1754 yyval.id = g_strconcat(yyvsp[-1].id, " ", yyvsp[0].id, NULL);
1755 g_free(yyvsp[-1].id);
1756 g_free(yyvsp[0].id);
1762 yyval.id = g_strconcat("const ", yyvsp[0].id, NULL);
1763 g_free(yyvsp[0].id);
1769 yyval.id = yyvsp[0].id;
1775 yyval.id = g_strconcat(yyvsp[-1].id, " const", NULL);
1776 g_free(yyvsp[-1].id);
1782 yyval.id = g_strdup(yyvsp[0].id);
1788 yyval.id = g_strconcat(yyvsp[-1].id, " const", NULL);
1793 { yyval.id = "void"; ;
1797 { yyval.id = "char"; ;
1801 { yyval.id = "short"; ;
1805 { yyval.id = "int"; ;
1809 { yyval.id = "long"; ;
1813 { yyval.id = "float"; ;
1817 { yyval.id = "double"; ;
1821 { yyval.id = "signed"; ;
1825 { yyval.id = "unsigned"; ;
1829 { yyval.id = "struct"; ;
1833 { yyval.id = "union"; ;
1837 { yyval.id = "enum"; ;
1841 { yyval.id = g_strdup("*"); ;
1845 { yyval.id = g_strdup("* const"); ;
1850 yyval.id = g_strconcat("*", yyvsp[0].id, NULL);
1851 g_free(yyvsp[0].id);
1857 yyval.id = g_strconcat("* const", yyvsp[0].id, NULL);
1858 g_free(yyvsp[0].id);
1864 if(strcmp(yyvsp[-1].id, "first")==0)
1865 yyval.sigtype = SIGNAL_FIRST_METHOD;
1866 else if(strcmp(yyvsp[-1].id, "last")==0)
1867 yyval.sigtype = SIGNAL_LAST_METHOD;
1869 yyerror(_("signal must be 'first' or 'last'"));
1870 g_free(yyvsp[-1].id);
1873 g_free(yyvsp[-1].id);
1879 yyval.sigtype = SIGNAL_LAST_METHOD;
1885 if(strcmp(yyvsp[-1].id,"first")==0)
1886 yyval.sigtype = SIGNAL_FIRST_METHOD;
1887 else if(strcmp(yyvsp[-1].id,"last")==0)
1888 yyval.sigtype = SIGNAL_LAST_METHOD;
1890 yyerror(_("signal must be 'first' or 'last'"));
1891 g_free(yyvsp[-1].id);
1894 g_free(yyvsp[-1].id);
1900 if(strcmp(yyvsp[-2].id,"first")==0)
1901 yyval.sigtype = SIGNAL_FIRST_METHOD;
1902 else if(strcmp(yyvsp[-2].id,"last")==0)
1903 yyval.sigtype = SIGNAL_LAST_METHOD;
1905 yyerror(_("signal must be 'first' or 'last'"));
1906 g_free(yyvsp[-2].id);
1909 g_free(yyvsp[-2].id);
1915 yyval.sigtype = SIGNAL_LAST_METHOD;
1921 /* the_scope was default thus public */
1922 the_scope = PUBLIC_SCOPE;
1928 gtktypes = g_list_prepend(gtktypes, yyvsp[-3].id);
1934 gtktypes = g_list_append(gtktypes, yyvsp[0].id);
1940 gtktypes = g_list_append(gtktypes, yyvsp[0].id);
1945 { yyval.cbuf = yyvsp[0].cbuf; ;
1949 { yyval.cbuf = NULL; ;
1955 yyerror(_("signal without 'self' as "
1956 "first parameter"));
1957 free_all_global_state();
1960 if(the_scope == CLASS_SCOPE) {
1961 yyerror(_("a method cannot be of class scope"));
1962 free_all_global_state();
1965 push_function(the_scope, yyvsp[-7].sigtype,NULL,
1966 yyvsp[-5].id, yyvsp[0].cbuf,yyvsp[-9].line,
1967 ccode_line, vararg, yyvsp[-8].list);
1974 yyerror(_("signal without 'self' as "
1975 "first parameter"));
1976 free_all_global_state();
1979 if(the_scope == CLASS_SCOPE) {
1980 yyerror(_("a method cannot be of class scope"));
1981 free_all_global_state();
1984 push_function(the_scope, yyvsp[-7].sigtype, NULL,
1985 yyvsp[-5].id, yyvsp[0].cbuf, yyvsp[-9].line,
1986 ccode_line, vararg, yyvsp[-8].list);
1993 yyerror(_("virtual method without 'self' as "
1994 "first parameter"));
1995 free_all_global_state();
1998 if(the_scope == CLASS_SCOPE) {
1999 yyerror(_("a method cannot be of class scope"));
2000 free_all_global_state();
2003 push_function(the_scope, VIRTUAL_METHOD, NULL, yyvsp[-5].id,
2004 yyvsp[0].cbuf, yyvsp[-8].line,
2005 ccode_line, vararg, NULL);
2012 yyerror(_("virtual method without 'self' as "
2013 "first parameter"));
2014 free_all_global_state();
2017 if(the_scope == CLASS_SCOPE) {
2018 yyerror(_("a method cannot be of class scope"));
2019 free_all_global_state();
2022 push_function(the_scope, VIRTUAL_METHOD, NULL, yyvsp[-5].id,
2023 yyvsp[0].cbuf, yyvsp[-7].line,
2024 ccode_line, vararg, NULL);
2031 yyerror(_("virtual method without 'self' as "
2032 "first parameter"));
2033 free_all_global_state();
2036 push_function(PUBLIC_SCOPE, VIRTUAL_METHOD, NULL,
2037 yyvsp[-5].id, yyvsp[0].cbuf, yyvsp[-7].line,
2038 ccode_line, vararg, NULL);
2044 push_function(NO_SCOPE, OVERRIDE_METHOD, yyvsp[-8].id,
2045 yyvsp[-5].id, yyvsp[0].cbuf,
2046 yyvsp[-10].line, ccode_line,
2053 if(the_scope == CLASS_SCOPE) {
2054 yyerror(_("a method cannot be of class scope"));
2055 free_all_global_state();
2058 push_function(the_scope, REGULAR_METHOD, NULL, yyvsp[-5].id,
2059 yyvsp[0].cbuf, yyvsp[-7].line, ccode_line,
2066 if(strcmp(yyvsp[-4].id, "init")==0) {
2067 push_init_arg(yyvsp[-2].id,FALSE);
2068 push_function(NO_SCOPE, INIT_METHOD, NULL,
2069 yyvsp[-4].id, yyvsp[0].cbuf, yyvsp[-3].line,
2070 ccode_line, FALSE, NULL);
2071 } else if(strcmp(yyvsp[-4].id, "class_init")==0) {
2072 push_init_arg(yyvsp[-2].id,TRUE);
2073 push_function(NO_SCOPE, CLASS_INIT_METHOD, NULL,
2074 yyvsp[-4].id, yyvsp[0].cbuf, yyvsp[-3].line,
2075 ccode_line, FALSE, NULL);
2077 g_free(yyvsp[-4].id);
2078 g_free(yyvsp[-2].id);
2079 g_string_free(yyvsp[0].cbuf,TRUE);
2080 yyerror(_("parse error "
2081 "(untyped blocks must be init or "
2090 g_free(onerror); onerror = NULL;
2091 g_free(defreturn); defreturn = NULL;
2092 if(!set_return_value(yyvsp[-1].id, yyvsp[0].id)) {
2093 g_free(yyvsp[-1].id);
2094 g_free(yyvsp[0].id);
2095 yyerror(_("parse error"));
2098 g_free(yyvsp[-1].id);
2104 g_free(onerror); onerror = NULL;
2105 g_free(defreturn); defreturn = NULL;
2106 if(!set_return_value(yyvsp[-3].id, yyvsp[-2].id)) {
2107 g_free(yyvsp[-3].id); g_free(yyvsp[-2].id);
2108 g_free(yyvsp[-1].id); g_free(yyvsp[0].id);
2109 yyerror(_("parse error"));
2112 if(!set_return_value(yyvsp[-1].id, yyvsp[0].id)) {
2113 onerror = defreturn = NULL;
2114 g_free(yyvsp[-3].id); g_free(yyvsp[-2].id);
2115 g_free(yyvsp[-1].id); g_free(yyvsp[0].id);
2116 yyerror(_("parse error"));
2119 g_free(yyvsp[-3].id);
2120 g_free(yyvsp[-1].id);
2126 g_free(onerror); onerror = NULL;
2127 g_free(defreturn); defreturn = NULL;
2132 { yyval.id = yyvsp[0].id; ;
2137 yyval.id = (yyvsp[1].cbuf)->str;
2138 g_string_free(yyvsp[1].cbuf, FALSE);
2143 { vararg = FALSE; has_self = FALSE; ;
2150 if(strcmp(yyvsp[0].id,"self")==0)
2151 push_self(yyvsp[0].id, FALSE);
2153 g_free(yyvsp[0].id);
2154 yyerror(_("parse error"));
2164 if(strcmp(yyvsp[-1].id,"self")==0)
2165 push_self(yyvsp[-1].id, TRUE);
2167 g_free(yyvsp[-1].id);
2168 yyerror(_("parse error"));
2174 #line 1004 "parse.y"
2178 if(strcmp(yyvsp[0].id,"self")==0)
2179 push_self(yyvsp[0].id, TRUE);
2181 g_free(yyvsp[0].id);
2182 yyerror(_("parse error"));
2188 #line 1015 "parse.y"
2191 if(strcmp(yyvsp[-2].id,"self")==0)
2192 push_self(yyvsp[-2].id, FALSE);
2194 g_free(yyvsp[-2].id);
2195 yyerror(_("parse error"));
2201 #line 1025 "parse.y"
2204 if(strcmp(yyvsp[-3].id,"self")==0)
2205 push_self(yyvsp[-3].id, TRUE);
2207 g_free(yyvsp[-3].id);
2208 yyerror(_("parse error"));
2214 #line 1035 "parse.y"
2217 if(strcmp(yyvsp[-2].id,"self")==0)
2218 push_self(yyvsp[-2].id, TRUE);
2220 g_free(yyvsp[-2].id);
2221 yyerror(_("parse error"));
2227 #line 1045 "parse.y"
2228 { has_self = FALSE; ;
2231 #line 1048 "parse.y"
2235 #line 1049 "parse.y"
2239 #line 1052 "parse.y"
2243 #line 1053 "parse.y"
2247 #line 1056 "parse.y"
2249 push_funcarg(yyvsp[0].id,NULL);
2253 #line 1059 "parse.y"
2255 push_funcarg(yyvsp[-1].id,yyvsp[0].id);
2259 #line 1062 "parse.y"
2261 if(strcmp(yyvsp[-2].id,"check")!=0) {
2262 yyerror(_("parse error"));
2265 g_free(yyvsp[-2].id);
2266 push_funcarg(yyvsp[-4].id,NULL);
2270 #line 1070 "parse.y"
2272 if(strcmp(yyvsp[-2].id,"check")!=0) {
2273 yyerror(_("parse error"));
2276 g_free(yyvsp[-2].id);
2277 push_funcarg(yyvsp[-5].id,yyvsp[-4].id);
2281 #line 1080 "parse.y"
2285 #line 1081 "parse.y"
2289 #line 1084 "parse.y"
2291 if(strcmp(yyvsp[0].id,"type")==0) {
2292 Node *node = new_check(TYPE_CHECK,NULL);
2293 checks = g_list_append(checks,node);
2294 } else if(strcmp(yyvsp[0].id,"null")==0) {
2295 Node *node = new_check(NULL_CHECK,NULL);
2296 checks = g_list_append(checks,node);
2298 yyerror(_("parse error"));
2301 g_free(yyvsp[0].id);
2305 #line 1097 "parse.y"
2307 Node *node = new_check(GT_CHECK,yyvsp[0].id);
2308 checks = g_list_append(checks,node);
2312 #line 1101 "parse.y"
2314 Node *node = new_check(LT_CHECK,yyvsp[0].id);
2315 checks = g_list_append(checks,node);
2319 #line 1105 "parse.y"
2321 Node *node = new_check(GE_CHECK,yyvsp[0].id);
2322 checks = g_list_append(checks,node);
2326 #line 1109 "parse.y"
2328 Node *node = new_check(LE_CHECK,yyvsp[0].id);
2329 checks = g_list_append(checks,node);
2333 #line 1113 "parse.y"
2335 Node *node = new_check(EQ_CHECK,yyvsp[0].id);
2336 checks = g_list_append(checks,node);
2340 #line 1117 "parse.y"
2342 Node *node = new_check(NE_CHECK,yyvsp[0].id);
2343 checks = g_list_append(checks,node);
2347 #line 1123 "parse.y"
2348 { yyval.id = yyvsp[0].id; ;
2351 #line 1124 "parse.y"
2353 yyval.id = g_strconcat("-",yyvsp[0].id,NULL);
2354 g_free(yyvsp[0].id);
2358 #line 1128 "parse.y"
2359 { yyval.id = yyvsp[0].id; ;
2362 /* the action file gets copied in in place of this dollarsign */
2363 #line 543 "/usr/lib/bison.simple"
2374 short *ssp1 = yyss - 1;
2375 fprintf (stderr, "state stack now");
2376 while (ssp1 != yyssp)
2377 fprintf (stderr, " %d", *++ssp1);
2378 fprintf (stderr, "\n");
2388 yylsp->first_line = yylloc.first_line;
2389 yylsp->first_column = yylloc.first_column;
2390 yylsp->last_line = (yylsp-1)->last_line;
2391 yylsp->last_column = (yylsp-1)->last_column;
2396 yylsp->last_line = (yylsp+yylen-1)->last_line;
2397 yylsp->last_column = (yylsp+yylen-1)->last_column;
2401 /* Now "shift" the result of the reduction.
2402 Determine what state that goes to,
2403 based on the state we popped back to
2404 and the rule number reduced by. */
2408 yystate = yypgoto[yyn - YYNTBASE] + *yyssp;
2409 if (yystate >= 0 && yystate <= YYLAST && yycheck[yystate] == *yyssp)
2410 yystate = yytable[yystate];
2412 yystate = yydefgoto[yyn - YYNTBASE];
2416 yyerrlab: /* here on detecting error */
2419 /* If not already recovering from an error, report this error. */
2423 #ifdef YYERROR_VERBOSE
2424 yyn = yypact[yystate];
2426 if (yyn > YYFLAG && yyn < YYLAST)
2433 /* Start X at -yyn if nec to avoid negative indexes in yycheck. */
2434 for (x = (yyn < 0 ? -yyn : 0);
2435 x < (sizeof(yytname) / sizeof(char *)); x++)
2436 if (yycheck[x + yyn] == x)
2437 size += strlen(yytname[x]) + 15, count++;
2438 msg = (char *) malloc(size + 15);
2441 strcpy(msg, "parse error");
2446 for (x = (yyn < 0 ? -yyn : 0);
2447 x < (sizeof(yytname) / sizeof(char *)); x++)
2448 if (yycheck[x + yyn] == x)
2450 strcat(msg, count == 0 ? ", expecting `" : " or `");
2451 strcat(msg, yytname[x]);
2460 yyerror ("parse error; also virtual memory exceeded");
2463 #endif /* YYERROR_VERBOSE */
2464 yyerror("parse error");
2468 yyerrlab1: /* here on error raised explicitly by an action */
2470 if (yyerrstatus == 3)
2472 /* if just tried and failed to reuse lookahead token after an error, discard it. */
2474 /* return failure if at end of input */
2475 if (yychar == YYEOF)
2480 fprintf(stderr, "Discarding token %d (%s).\n", yychar, yytname[yychar1]);
2486 /* Else will try to reuse lookahead token
2487 after shifting the error token. */
2489 yyerrstatus = 3; /* Each real token shifted decrements this */
2493 yyerrdefault: /* current state does not do anything special for the error token. */
2496 /* This is wrong; only states that explicitly want error tokens
2497 should shift them. */
2498 yyn = yydefact[yystate]; /* If its default is to accept any token, ok. Otherwise pop it.*/
2499 if (yyn) goto yydefault;
2502 yyerrpop: /* pop the current state because it cannot handle the error token */
2504 if (yyssp == yyss) YYABORT;
2514 short *ssp1 = yyss - 1;
2515 fprintf (stderr, "Error: state stack now");
2516 while (ssp1 != yyssp)
2517 fprintf (stderr, " %d", *++ssp1);
2518 fprintf (stderr, "\n");
2524 yyn = yypact[yystate];
2529 if (yyn < 0 || yyn > YYLAST || yycheck[yyn] != YYTERROR)
2548 fprintf(stderr, "Shifting error token, ");
2560 /* YYACCEPT comes here. */
2572 /* YYABORT comes here. */
2583 #line 1131 "parse.y"