2 /* A Bison parser, made from parse.y
3 by GNU Bison version 1.28 */
5 #define YYBISON 1 /* Identify Bison output. */
51 #include "treefuncs.h"
59 static GList *class_nodes = NULL;
61 char *chunk_size = NULL;
63 static GList *typestack = NULL;
64 static GList *funcargs = NULL;
65 static GList *checks = NULL;
66 static int has_self = FALSE;
67 static int vararg = FALSE;
69 /* destructor and initializer for variables */
70 static char *destructor = NULL;
71 static int destructor_line = 0;
72 static gboolean destructor_simple = TRUE;
73 static char *initializer = NULL;
74 static int initializer_line = 0;
76 static char *onerror = NULL;
77 static char *defreturn = NULL;
79 static GList *gtktypes = NULL;
81 /* this can be a global as we will only do one function at a time
83 static int the_scope = NO_SCOPE;
88 extern int ccode_line;
99 if(strcmp(yytext,"\n")==0) {
100 out=g_strconcat("Error: ",str," before newline",NULL);
101 } else if(yytext[0]=='\0') {
102 out=g_strconcat("Error: ", str, " at end of input", NULL);
104 char *tmp = g_strdup(yytext);
105 while((p=strchr(tmp, '\n')))
108 out=g_strconcat("Error: ", str, " before '", tmp, "'", NULL);
112 fprintf(stderr, "%s:%d: %s\n", filename, line_no, out);
121 Type *type = typestack->data;
122 typestack = g_list_remove(typestack,typestack->data);
127 push_variable(char *name, int scope, int line_no, char *postfix)
130 Type *type = pop_type();
132 type->postfix = postfix;
134 var = new_variable(scope, type, name, line_no,
135 destructor, destructor_line,
137 initializer, initializer_line);
138 class_nodes = g_list_append(class_nodes, var);
142 push_function(int scope, int method, char *oid, char *id,
143 GString *cbuf, int line_no, int ccode_line,
144 gboolean vararg, GList *flags)
150 g_assert(scope != CLASS_SCOPE);
152 if(method == INIT_METHOD || method == CLASS_INIT_METHOD) {
153 type = (Type *)new_type(g_strdup("void"), NULL, NULL);
158 /* a complicated and ugly test to figure out if we have
159 the wrong number of types for a signal */
160 if((method == SIGNAL_FIRST_METHOD ||
161 method == SIGNAL_LAST_METHOD) &&
162 g_list_length(gtktypes) != g_list_length(funcargs) &&
163 !(g_list_length(funcargs) == 1 &&
164 g_list_length(gtktypes) == 2 &&
165 strcmp(gtktypes->next->data, "NONE")==0)) {
166 print_error(TRUE, _("The number of GTK arguments and "
167 "function arguments for a signal "
168 "don't seem to match"), line_no);
170 if(g_list_length(gtktypes) > 2) {
172 for(li = gtktypes->next; li; li = li->next) {
173 if(strcmp(li->data, "NONE")==0) {
175 _("NONE can only appear in an "
176 "argument list by itself"),
183 c_cbuf = p = cbuf->str;
184 while(p && *p && (*p==' ' || *p=='\t' || *p=='\n' || *p=='\r'))
191 node = new_method(scope, method, type, oid, gtktypes, flags,
192 id, funcargs, onerror, defreturn, c_cbuf, line_no,
193 ccode_line, vararg, method_unique_id++);
197 /*only free segment if we haven't passed it
206 class_nodes = g_list_append(class_nodes, node);
210 free_all_global_state(void)
220 g_list_foreach(gtktypes, (GFunc)g_free, NULL);
221 g_list_free(gtktypes);
224 free_node_list(funcargs);
229 push_funcarg(char *name, char *postfix)
232 Type *type = pop_type();
234 type->postfix = postfix;
236 node = new_funcarg(type, name, checks);
239 funcargs = g_list_append(funcargs, node);
243 push_init_arg(char *name, int is_class)
250 tn = g_strconcat(((Class *)class)->otype,":Class",NULL);
252 tn = g_strdup(((Class *)class)->otype);
254 type = new_type(tn, g_strdup("*"), NULL);
255 node = new_funcarg((Type *)type,name,NULL);
256 funcargs = g_list_prepend(funcargs, node);
260 push_self(char *id, gboolean constant)
265 type = new_type(g_strdup(((Class *)class)->otype),
266 g_strdup(constant ? "const *" : "*"), NULL);
267 ch = g_list_append(ch,new_check(NULL_CHECK,NULL));
268 ch = g_list_append(ch,new_check(TYPE_CHECK,NULL));
269 node = new_funcarg((Type *)type,id,ch);
270 funcargs = g_list_prepend(funcargs, node);
274 find_var_or_die(const char *id, int line)
279 for(li = class_nodes; li != NULL; li = li->next) {
281 Node *node = li->data;
282 if(node->type != VARIABLE_NODE)
285 if(strcmp(var->id, id)==0)
289 s = g_strdup_printf(_("Variable %s not defined here"), id);
290 print_error(FALSE, s, line);
292 g_assert_not_reached();
297 set_return_value(char *type, char *val)
299 if(strcmp(type, "onerror")==0) {
305 } else if(strcmp(type, "defreturn")==0) {
339 #define YYFLAG -32768
342 #define YYTRANSLATE(x) ((unsigned)(x) <= 290 ? yytranslate[x] : 88)
344 static const char yytranslate[] = { 0,
345 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
346 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
347 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
348 2, 2, 48, 2, 2, 2, 2, 2, 2, 39,
349 40, 44, 2, 45, 49, 2, 2, 2, 2, 2,
350 2, 2, 2, 2, 2, 2, 2, 2, 41, 47,
351 42, 46, 2, 2, 2, 2, 2, 2, 2, 2,
352 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
353 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
354 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
355 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
356 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
357 2, 2, 37, 43, 38, 2, 2, 2, 2, 2,
358 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
359 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
360 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
361 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
362 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
363 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
364 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
365 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
366 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
367 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
368 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
369 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
370 2, 2, 2, 2, 2, 1, 3, 4, 5, 6,
371 7, 8, 9, 10, 11, 12, 13, 14, 15, 16,
372 17, 18, 19, 20, 21, 22, 23, 24, 25, 26,
373 27, 28, 29, 30, 31, 32, 33, 34, 35, 36
377 static const short yyprhs[] = { 0,
378 0, 4, 7, 10, 12, 14, 16, 18, 20, 22,
379 24, 27, 29, 34, 38, 44, 45, 50, 55, 58,
380 60, 62, 64, 66, 68, 70, 72, 74, 76, 79,
381 83, 86, 90, 93, 96, 98, 100, 101, 107, 114,
382 126, 135, 141, 147, 149, 153, 154, 158, 160, 163,
383 165, 167, 169, 172, 175, 178, 182, 186, 189, 192,
384 195, 197, 200, 202, 205, 207, 209, 211, 213, 215,
385 217, 219, 221, 223, 225, 227, 229, 231, 234, 237,
386 241, 244, 246, 250, 254, 257, 259, 264, 268, 270,
387 273, 275, 286, 298, 308, 318, 327, 339, 348, 354,
388 357, 362, 363, 365, 368, 370, 372, 375, 378, 382,
389 387, 392, 394, 398, 400, 404, 406, 409, 413, 420,
390 428, 431, 433, 435, 438, 441, 445, 449, 453, 457,
394 static const short yyrhs[] = { 52,
395 53, 52, 0, 53, 52, 0, 52, 53, 0, 53,
396 0, 23, 0, 26, 0, 24, 0, 25, 0, 27,
397 0, 28, 0, 52, 51, 0, 51, 0, 54, 37,
398 56, 38, 0, 54, 37, 38, 0, 3, 21, 4,
399 21, 55, 0, 0, 39, 19, 19, 40, 0, 39,
400 19, 20, 40, 0, 56, 57, 0, 57, 0, 78,
401 0, 62, 0, 63, 0, 41, 0, 29, 0, 30,
402 0, 31, 0, 32, 0, 19, 19, 0, 19, 37,
403 23, 0, 42, 87, 0, 42, 37, 23, 0, 59,
404 60, 0, 60, 59, 0, 60, 0, 59, 0, 0,
405 58, 67, 19, 61, 41, 0, 58, 67, 19, 22,
406 61, 41, 0, 33, 65, 64, 19, 19, 37, 23,
407 19, 37, 23, 41, 0, 33, 65, 64, 19, 19,
408 37, 23, 41, 0, 33, 65, 64, 19, 19, 0,
409 19, 39, 19, 67, 40, 0, 19, 0, 39, 66,
410 40, 0, 0, 19, 43, 66, 0, 19, 0, 68,
411 72, 0, 68, 0, 69, 0, 19, 0, 5, 19,
412 0, 19, 5, 0, 71, 19, 0, 5, 71, 19,
413 0, 71, 19, 5, 0, 70, 69, 0, 21, 69,
414 0, 5, 69, 0, 21, 0, 21, 5, 0, 70,
415 0, 70, 5, 0, 6, 0, 18, 0, 14, 0,
416 15, 0, 13, 0, 16, 0, 17, 0, 11, 0,
417 12, 0, 7, 0, 8, 0, 9, 0, 44, 0,
418 44, 5, 0, 44, 72, 0, 44, 5, 72, 0,
419 19, 75, 0, 75, 0, 58, 19, 75, 0, 19,
420 58, 75, 0, 58, 75, 0, 73, 0, 19, 39,
421 76, 40, 0, 76, 45, 19, 0, 19, 0, 37,
422 23, 0, 41, 0, 35, 65, 74, 67, 19, 39,
423 81, 40, 79, 77, 0, 58, 35, 65, 73, 67,
424 19, 39, 81, 40, 79, 77, 0, 34, 58, 67,
425 19, 39, 81, 40, 79, 77, 0, 58, 34, 67,
426 19, 39, 81, 40, 79, 77, 0, 34, 67, 19,
427 39, 81, 40, 79, 77, 0, 36, 39, 21, 40,
428 67, 19, 39, 81, 40, 79, 77, 0, 58, 67,
429 19, 39, 81, 40, 79, 77, 0, 19, 39, 19,
430 40, 77, 0, 19, 80, 0, 19, 80, 19, 80,
431 0, 0, 87, 0, 37, 23, 0, 6, 0, 19,
432 0, 19, 5, 0, 5, 19, 0, 19, 45, 82,
433 0, 19, 5, 45, 82, 0, 5, 19, 45, 82,
434 0, 82, 0, 83, 45, 10, 0, 83, 0, 83,
435 45, 84, 0, 84, 0, 67, 19, 0, 67, 19,
436 22, 0, 67, 19, 39, 19, 85, 40, 0, 67,
437 19, 22, 39, 19, 85, 40, 0, 85, 86, 0,
438 86, 0, 19, 0, 46, 87, 0, 47, 87, 0,
439 46, 42, 87, 0, 47, 42, 87, 0, 42, 42,
440 87, 0, 48, 42, 87, 0, 20, 0, 49, 20,
447 static const short yyrline[] = { 0,
448 313, 314, 315, 316, 319, 325, 331, 337, 343, 349,
449 357, 358, 361, 366, 373, 378, 379, 387, 398, 399,
450 402, 403, 404, 405, 408, 409, 410, 411, 414, 427,
451 443, 447, 455, 456, 457, 458, 459, 465, 468, 472,
452 508, 537, 612, 621, 627, 628, 631, 634, 640, 644,
453 651, 654, 657, 661, 665, 669, 674, 682, 686, 691,
454 695, 698, 702, 705, 710, 711, 712, 713, 714, 715,
455 716, 717, 718, 721, 722, 723, 726, 727, 728, 732,
456 739, 751, 757, 769, 781, 784, 790, 795, 798, 803,
457 804, 808, 824, 840, 856, 872, 883, 889, 899, 922,
458 933, 952, 958, 959, 965, 966, 977, 988, 999, 1009,
459 1019, 1029, 1032, 1033, 1036, 1037, 1040, 1043, 1046, 1054,
460 1064, 1065, 1068, 1081, 1085, 1089, 1093, 1097, 1101, 1107,
466 #if YYDEBUG != 0 || defined (YYERROR_VERBOSE)
468 static const char * const yytname[] = { "$","error","$undefined.","CLASS",
469 "FROM","CONST","VOID","STRUCT","UNION","ENUM","THREEDOTS","SIGNED","UNSIGNED",
470 "LONG","SHORT","INT","FLOAT","DOUBLE","CHAR","TOKEN","NUMBER","TYPETOKEN","ARRAY_DIM",
471 "CCODE","HTCODE","PHCODE","HCODE","ACODE","ATCODE","PUBLIC","PRIVATE","PROTECTED",
472 "CLASSWIDE","ARGUMENT","VIRTUAL","SIGNAL","OVERRIDE","'{'","'}'","'('","')'",
473 "';'","'='","'|'","'*'","','","'>'","'<'","'!'","'-'","prog","ccode","ccodes",
474 "class","classdec","chunk","classcode","thing","scope","destructor","initializer",
475 "varoptions","variable","argument","argtype","flags","flaglist","type","specifier_list",
476 "spec_list","specifier","strunionenum","pointer","simplesigtype","fullsigtype",
477 "sigtype","tokenlist","codenocode","method","returnvals","retcode","funcargs",
478 "arglist","arglist1","arg","checklist","check","numtok", NULL
482 static const short yyr1[] = { 0,
483 50, 50, 50, 50, 51, 51, 51, 51, 51, 51,
484 52, 52, 53, 53, 54, 55, 55, 55, 56, 56,
485 57, 57, 57, 57, 58, 58, 58, 58, 59, 59,
486 60, 60, 61, 61, 61, 61, 61, 62, 62, 63,
487 63, 63, 64, 64, 65, 65, 66, 66, 67, 67,
488 68, 68, 68, 68, 68, 68, 68, 69, 69, 69,
489 69, 69, 69, 69, 70, 70, 70, 70, 70, 70,
490 70, 70, 70, 71, 71, 71, 72, 72, 72, 72,
491 73, 73, 74, 74, 74, 74, 75, 76, 76, 77,
492 77, 78, 78, 78, 78, 78, 78, 78, 78, 79,
493 79, 79, 80, 80, 81, 81, 81, 81, 81, 81,
494 81, 81, 82, 82, 83, 83, 84, 84, 84, 84,
495 85, 85, 86, 86, 86, 86, 86, 86, 86, 87,
499 static const short yyr2[] = { 0,
500 3, 2, 2, 1, 1, 1, 1, 1, 1, 1,
501 2, 1, 4, 3, 5, 0, 4, 4, 2, 1,
502 1, 1, 1, 1, 1, 1, 1, 1, 2, 3,
503 2, 3, 2, 2, 1, 1, 0, 5, 6, 11,
504 8, 5, 5, 1, 3, 0, 3, 1, 2, 1,
505 1, 1, 2, 2, 2, 3, 3, 2, 2, 2,
506 1, 2, 1, 2, 1, 1, 1, 1, 1, 1,
507 1, 1, 1, 1, 1, 1, 1, 2, 2, 3,
508 2, 1, 3, 3, 2, 1, 4, 3, 1, 2,
509 1, 10, 11, 9, 9, 8, 11, 8, 5, 2,
510 4, 0, 1, 2, 1, 1, 2, 2, 3, 4,
511 4, 1, 3, 1, 3, 1, 2, 3, 6, 7,
512 2, 1, 1, 2, 2, 3, 3, 3, 3, 1,
516 static const short yydefact[] = { 0,
517 0, 5, 7, 8, 6, 9, 10, 12, 0, 4,
518 0, 0, 11, 3, 2, 0, 0, 1, 0, 25,
519 26, 27, 28, 46, 0, 46, 0, 14, 24, 0,
520 20, 0, 22, 23, 21, 16, 0, 0, 0, 0,
521 65, 74, 75, 76, 72, 73, 69, 67, 68, 70,
522 71, 66, 52, 61, 0, 0, 50, 51, 63, 0,
523 0, 0, 13, 19, 0, 46, 0, 0, 15, 0,
524 48, 0, 44, 0, 0, 53, 60, 0, 54, 62,
525 59, 0, 0, 77, 49, 64, 58, 55, 0, 0,
526 86, 0, 82, 0, 0, 0, 37, 0, 0, 0,
527 45, 0, 0, 56, 0, 0, 78, 79, 57, 0,
528 0, 0, 81, 0, 85, 0, 0, 0, 0, 0,
529 0, 37, 0, 0, 36, 35, 0, 0, 0, 0,
530 91, 99, 47, 0, 42, 0, 0, 65, 52, 0,
531 0, 112, 114, 116, 80, 89, 0, 84, 83, 0,
532 0, 0, 0, 29, 0, 0, 0, 132, 130, 0,
533 0, 31, 33, 34, 38, 17, 18, 90, 0, 0,
534 0, 53, 54, 0, 117, 102, 0, 87, 0, 0,
535 0, 0, 0, 30, 39, 102, 32, 131, 43, 0,
536 102, 0, 0, 109, 118, 0, 0, 0, 113, 115,
537 88, 0, 0, 102, 0, 0, 0, 41, 0, 111,
538 110, 0, 0, 0, 100, 103, 96, 102, 0, 0,
539 0, 98, 0, 94, 0, 123, 0, 0, 0, 0,
540 0, 122, 104, 0, 0, 102, 95, 102, 0, 0,
541 0, 0, 124, 0, 125, 0, 119, 121, 101, 92,
542 0, 0, 40, 120, 128, 126, 127, 129, 97, 93,
546 static const short yydefgoto[] = { 261,
547 8, 9, 10, 11, 69, 30, 31, 32, 125, 126,
548 127, 33, 34, 74, 39, 72, 140, 57, 58, 59,
549 60, 85, 91, 92, 93, 147, 132, 35, 198, 215,
550 141, 142, 143, 144, 231, 232, 216
553 static const short yypact[] = { 88,
554 -12,-32768,-32768,-32768,-32768,-32768,-32768,-32768, 88, 347,
555 -15, 15,-32768, 347, 347, 157, 18, 347, 7,-32768,
556 -32768,-32768,-32768, 25, 153, 25, 36,-32768,-32768, 175,
557 -32768, 118,-32768,-32768,-32768, 67, 102, 122, 135, 245,
558 -32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,
559 -32768,-32768, 22, 313, 262, 144, 131,-32768, 327, 160,
560 198, 159,-32768,-32768, 262, 25, 162, 180,-32768, 161,
561 171, 178, 164, 181, 341,-32768,-32768, 183,-32768, 341,
562 -32768, 196, 182, 8,-32768, 341,-32768, 214, 193, 201,
563 -32768, 262,-32768, 186, 212, 229, 48, 62, 57, 122,
564 -32768, 236, 246,-32768, 233, 279, 131,-32768,-32768, 243,
565 270, 280,-32768, 50,-32768, 287, 262, 277, 50, 262,
566 -1, 9, 279, -5, 278, 302, 281, 283, 295, 314,
567 -32768,-32768,-32768, 262, 299, 279, 296, 309, 0, 331,
568 311,-32768, 316,-32768,-32768,-32768, 98,-32768,-32768, 324,
569 345, 279, 346,-32768, 344, 335, 328,-32768,-32768, 354,
570 358,-32768,-32768,-32768,-32768,-32768,-32768,-32768, 339, 357,
571 342, 104, 105, 262, 38, 362, 228,-32768, 364, 279,
572 348, 349, 352,-32768,-32768, 362,-32768,-32768,-32768, 16,
573 362, 262, 262,-32768, 353, 365, 10, 57,-32768,-32768,
574 -32768, 350, 279, 362, 279, 57, 356,-32768, 57,-32768,
575 -32768, 366, 109, 363, 369,-32768,-32768, 362, 355, 57,
576 359,-32768, 371,-32768, 109,-32768, 360, 43, 53, 361,
577 61,-32768,-32768, 10, 57, 362,-32768, 362, 367, 100,
578 6, 6,-32768, 6,-32768, 6,-32768,-32768,-32768,-32768,
579 57, 57,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,
583 static const short yypgoto[] = {-32768,
584 351, 163, 389,-32768,-32768,-32768, 370, -18, 275, 282,
585 284,-32768,-32768,-32768, -16, 304, -24,-32768, -38,-32768,
586 -37, -10, 315,-32768, -36,-32768, -186,-32768, -180, 176,
587 -119, 4,-32768, 232, 187, -152, -124
594 static const short yytable[] = { 162,
595 56, 77, 78, 157, 173, 206, 55, 67, 12, 61,
596 209, 217, 107, 158, 159, 81, 171, 154, 17, 222,
597 87, 16, 224, 220, 158, 159, 79, 121, 158, 159,
598 82, 160, 182, 237, 207, 155, 77, 235, 36, -106,
599 95, 77, 90, 161, 174, 37, 214, 77, 250, 96,
600 124, 84, 113, 115, 161, 251, 208, 252, 161, 195,
601 202, 158, 159, 38, 259, 260, 121, 116, 110, 122,
602 112, 158, 159, 108, 62, 148, 196, 149, 248, 226,
603 128, 129, 113, 219, 242, 221, 123, 248, 111, 124,
604 1, 161, 151, 130, 244, 153, 145, 131, 77, 78,
605 247, 161, 227, 243, 245, 68, 228, 229, 230, 169,
606 2, 3, 4, 5, 6, 7, 255, 256, 226, 257,
607 70, 258, 40, 41, 42, 43, 44, 226, 45, 46,
608 47, 48, 49, 50, 51, 52, 53, 178, 54, 254,
609 71, 227, 179, -108, -107, 228, 229, 230, 192, 193,
610 227, 65, 66, 73, 228, 229, 230, 40, 41, 42,
611 43, 44, 83, 45, 46, 47, 48, 49, 50, 51,
612 52, 53, 15, 54, 84, 19, 18, 194, 88, 94,
613 97, 20, 21, 22, 23, 20, 21, 22, 23, 24,
614 25, 26, 27, 19, 28, 210, 211, 29, 98, 103,
615 99, 104, 102, 20, 21, 22, 23, 24, 25, 26,
616 27, 110, 63, 100, 105, 29, 89, 101, 109, 114,
617 106, 20, 21, 22, 23, 117, 20, 21, 22, 23,
618 118, 111, 40, 41, 42, 43, 44, 199, 45, 46,
619 47, 48, 49, 50, 51, 52, 53, 119, 54, 75,
620 41, 42, 43, 44, 134, 45, 46, 47, 48, 49,
621 50, 51, 52, 76, 135, 54, 40, 41, 42, 43,
622 44, 136, 45, 46, 47, 48, 49, 50, 51, 52,
623 53, 111, 54, 137, 138, 42, 43, 44, 146, 45,
624 46, 47, 48, 49, 50, 51, 52, 139, 110, 54,
625 75, 41, 42, 43, 44, 150, 45, 46, 47, 48,
626 49, 50, 51, 52, 172, 152, 54, 80, 41, 124,
627 121, 165, 166, 45, 46, 47, 48, 49, 50, 51,
628 52, 86, 41, 54, 167, 170, 168, 45, 46, 47,
629 48, 49, 50, 51, 52, 75, 41, 54, -105, 175,
630 176, 45, 46, 47, 48, 49, 50, 51, 52, 13,
631 177, 54, 180, 181, 183, 13, 184, 186, 13, 2,
632 3, 4, 5, 6, 7, 185, 187, 188, 189, 190,
633 197, 191, 201, 213, 225, 233, 203, 234, 204, 218,
634 205, 212, 223, 239, 236, 262, 263, 14, 238, 64,
635 164, 241, 246, 133, 0, 156, 163, 253, 200, 249,
639 static const short yycheck[] = { 124,
640 25, 40, 40, 123, 5, 186, 25, 32, 21, 26,
641 191, 198, 5, 19, 20, 54, 136, 19, 4, 206,
642 59, 37, 209, 204, 19, 20, 5, 19, 19, 20,
643 55, 37, 152, 220, 19, 37, 75, 218, 21, 40,
644 65, 80, 61, 49, 45, 39, 37, 86, 235, 66,
645 42, 44, 89, 90, 49, 236, 41, 238, 49, 22,
646 180, 19, 20, 39, 251, 252, 19, 92, 19, 22,
647 89, 19, 20, 84, 39, 112, 39, 114, 231, 19,
648 19, 20, 119, 203, 42, 205, 39, 240, 39, 42,
649 3, 49, 117, 37, 42, 120, 107, 41, 137, 137,
650 40, 49, 42, 228, 229, 39, 46, 47, 48, 134,
651 23, 24, 25, 26, 27, 28, 241, 242, 19, 244,
652 19, 246, 5, 6, 7, 8, 9, 19, 11, 12,
653 13, 14, 15, 16, 17, 18, 19, 40, 21, 40,
654 19, 42, 45, 40, 40, 46, 47, 48, 45, 45,
655 42, 34, 35, 19, 46, 47, 48, 5, 6, 7,
656 8, 9, 19, 11, 12, 13, 14, 15, 16, 17,
657 18, 19, 10, 21, 44, 19, 14, 174, 19, 21,
658 19, 29, 30, 31, 32, 29, 30, 31, 32, 33,
659 34, 35, 36, 19, 38, 192, 193, 41, 19, 19,
660 40, 19, 39, 29, 30, 31, 32, 33, 34, 35,
661 36, 19, 38, 43, 19, 41, 19, 40, 5, 19,
662 39, 29, 30, 31, 32, 40, 29, 30, 31, 32,
663 19, 39, 5, 6, 7, 8, 9, 10, 11, 12,
664 13, 14, 15, 16, 17, 18, 19, 19, 21, 5,
665 6, 7, 8, 9, 19, 11, 12, 13, 14, 15,
666 16, 17, 18, 19, 19, 21, 5, 6, 7, 8,
667 9, 39, 11, 12, 13, 14, 15, 16, 17, 18,
668 19, 39, 21, 5, 6, 7, 8, 9, 19, 11,
669 12, 13, 14, 15, 16, 17, 18, 19, 19, 21,
670 5, 6, 7, 8, 9, 19, 11, 12, 13, 14,
671 15, 16, 17, 18, 19, 39, 21, 5, 6, 42,
672 19, 41, 40, 11, 12, 13, 14, 15, 16, 17,
673 18, 5, 6, 21, 40, 37, 23, 11, 12, 13,
674 14, 15, 16, 17, 18, 5, 6, 21, 40, 19,
675 40, 11, 12, 13, 14, 15, 16, 17, 18, 9,
676 45, 21, 39, 19, 19, 15, 23, 40, 18, 23,
677 24, 25, 26, 27, 28, 41, 23, 20, 40, 23,
678 19, 40, 19, 19, 19, 23, 39, 19, 40, 40,
679 39, 39, 37, 23, 40, 0, 0, 9, 40, 30,
680 126, 42, 42, 100, -1, 122, 125, 41, 177, 234,
683 /* -*-C-*- Note some compilers choke on comments on `#line' lines. */
684 #line 3 "/usr/lib/bison.simple"
685 /* This file comes from bison-1.28. */
687 /* Skeleton output parser for bison,
688 Copyright (C) 1984, 1989, 1990 Free Software Foundation, Inc.
690 This program is free software; you can redistribute it and/or modify
691 it under the terms of the GNU General Public License as published by
692 the Free Software Foundation; either version 2, or (at your option)
695 This program is distributed in the hope that it will be useful,
696 but WITHOUT ANY WARRANTY; without even the implied warranty of
697 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
698 GNU General Public License for more details.
700 You should have received a copy of the GNU General Public License
701 along with this program; if not, write to the Free Software
702 Foundation, Inc., 59 Temple Place - Suite 330,
703 Boston, MA 02111-1307, USA. */
705 /* As a special exception, when this file is copied by Bison into a
706 Bison output file, you may use that output file without restriction.
707 This special exception was added by the Free Software Foundation
708 in version 1.24 of Bison. */
710 /* This is the parser code that is written into each bison parser
711 when the %semantic_parser declaration is not specified in the grammar.
712 It was written by Richard Stallman by simplifying the hairy parser
713 used when %semantic_parser is specified. */
715 #ifndef YYSTACK_USE_ALLOCA
717 #define YYSTACK_USE_ALLOCA
718 #else /* alloca not defined */
720 #define YYSTACK_USE_ALLOCA
721 #define alloca __builtin_alloca
722 #else /* not GNU C. */
723 #if (!defined (__STDC__) && defined (sparc)) || defined (__sparc__) || defined (__sparc) || defined (__sgi) || (defined (__sun) && defined (__i386))
724 #define YYSTACK_USE_ALLOCA
726 #else /* not sparc */
727 /* We think this test detects Watcom and Microsoft C. */
728 /* This used to test MSDOS, but that is a bad idea
729 since that symbol is in the user namespace. */
730 #if (defined (_MSDOS) || defined (_MSDOS_)) && !defined (__TURBOC__)
731 #if 0 /* No need for malloc.h, which pollutes the namespace;
732 instead, just don't use alloca. */
735 #else /* not MSDOS, or __TURBOC__ */
737 /* I don't know what this was needed for, but it pollutes the namespace.
738 So I turned it off. rms, 2 May 1997. */
739 /* #include <malloc.h> */
741 #define YYSTACK_USE_ALLOCA
742 #else /* not MSDOS, or __TURBOC__, or _AIX */
744 #ifdef __hpux /* haible@ilog.fr says this works for HPUX 9.05 and up,
745 and on HPUX 10. Eventually we can turn this on. */
746 #define YYSTACK_USE_ALLOCA
747 #define alloca __builtin_alloca
750 #endif /* not _AIX */
751 #endif /* not MSDOS, or __TURBOC__ */
752 #endif /* not sparc */
753 #endif /* not GNU C */
754 #endif /* alloca not defined */
755 #endif /* YYSTACK_USE_ALLOCA not defined */
757 #ifdef YYSTACK_USE_ALLOCA
758 #define YYSTACK_ALLOC alloca
760 #define YYSTACK_ALLOC malloc
763 /* Note: there must be only one dollar sign in this file.
764 It is replaced by the list of actions, each action
765 as one case of the switch. */
767 #define yyerrok (yyerrstatus = 0)
768 #define yyclearin (yychar = YYEMPTY)
771 #define YYACCEPT goto yyacceptlab
772 #define YYABORT goto yyabortlab
773 #define YYERROR goto yyerrlab1
774 /* Like YYERROR except do call yyerror.
775 This remains here temporarily to ease the
776 transition to the new meaning of YYERROR, for GCC.
777 Once GCC version 2 has supplanted version 1, this can go. */
778 #define YYFAIL goto yyerrlab
779 #define YYRECOVERING() (!!yyerrstatus)
780 #define YYBACKUP(token, value) \
782 if (yychar == YYEMPTY && yylen == 1) \
783 { yychar = (token), yylval = (value); \
784 yychar1 = YYTRANSLATE (yychar); \
789 { yyerror ("syntax error: cannot back up"); YYERROR; } \
793 #define YYERRCODE 256
796 #define YYLEX yylex()
802 #define YYLEX yylex(&yylval, &yylloc, YYLEX_PARAM)
804 #define YYLEX yylex(&yylval, &yylloc)
806 #else /* not YYLSP_NEEDED */
808 #define YYLEX yylex(&yylval, YYLEX_PARAM)
810 #define YYLEX yylex(&yylval)
812 #endif /* not YYLSP_NEEDED */
815 /* If nonreentrant, generate the variables here */
819 int yychar; /* the lookahead symbol */
820 YYSTYPE yylval; /* the semantic value of the */
821 /* lookahead symbol */
824 YYLTYPE yylloc; /* location data for the lookahead */
828 int yynerrs; /* number of parse errors so far */
829 #endif /* not YYPURE */
832 int yydebug; /* nonzero means print parse trace */
833 /* Since this is uninitialized, it does not stop multiple parsers
837 /* YYINITDEPTH indicates the initial size of the parser's stacks */
840 #define YYINITDEPTH 200
843 /* YYMAXDEPTH is the maximum size the stacks can grow to
844 (effective only if the built-in stack extension method is used). */
851 #define YYMAXDEPTH 10000
854 /* Define __yy_memcpy. Note that the size argument
855 should be passed with type unsigned int, because that is what the non-GCC
856 definitions require. With GCC, __builtin_memcpy takes an arg
857 of type size_t, but it can handle unsigned int. */
859 #if __GNUC__ > 1 /* GNU C and GNU C++ define this. */
860 #define __yy_memcpy(TO,FROM,COUNT) __builtin_memcpy(TO,FROM,COUNT)
861 #else /* not GNU C or C++ */
864 /* This is the most reliable way to avoid incompatibilities
865 in available built-in functions on various systems. */
867 __yy_memcpy (to, from, count)
872 register char *f = from;
873 register char *t = to;
874 register int i = count;
880 #else /* __cplusplus */
882 /* This is the most reliable way to avoid incompatibilities
883 in available built-in functions on various systems. */
885 __yy_memcpy (char *to, char *from, unsigned int count)
887 register char *t = to;
888 register char *f = from;
889 register int i = count;
898 #line 217 "/usr/lib/bison.simple"
900 /* The user can define YYPARSE_PARAM as the name of an argument to be passed
901 into yyparse. The argument should have type void *.
902 It should actually point to an object.
903 Grammar actions can access the variable by casting it
904 to the proper pointer type. */
908 #define YYPARSE_PARAM_ARG void *YYPARSE_PARAM
909 #define YYPARSE_PARAM_DECL
910 #else /* not __cplusplus */
911 #define YYPARSE_PARAM_ARG YYPARSE_PARAM
912 #define YYPARSE_PARAM_DECL void *YYPARSE_PARAM;
913 #endif /* not __cplusplus */
914 #else /* not YYPARSE_PARAM */
915 #define YYPARSE_PARAM_ARG
916 #define YYPARSE_PARAM_DECL
917 #endif /* not YYPARSE_PARAM */
919 /* Prevent warning if -Wstrict-prototypes. */
922 int yyparse (void *);
929 yyparse(YYPARSE_PARAM_ARG)
932 register int yystate;
934 register short *yyssp;
935 register YYSTYPE *yyvsp;
936 int yyerrstatus; /* number of tokens to shift before error messages enabled */
937 int yychar1 = 0; /* lookahead token as an internal (translated) token number */
939 short yyssa[YYINITDEPTH]; /* the state stack */
940 YYSTYPE yyvsa[YYINITDEPTH]; /* the semantic value stack */
942 short *yyss = yyssa; /* refer to the stacks thru separate pointers */
943 YYSTYPE *yyvs = yyvsa; /* to allow yyoverflow to reallocate them elsewhere */
946 YYLTYPE yylsa[YYINITDEPTH]; /* the location stack */
947 YYLTYPE *yyls = yylsa;
950 #define YYPOPSTACK (yyvsp--, yyssp--, yylsp--)
952 #define YYPOPSTACK (yyvsp--, yyssp--)
955 int yystacksize = YYINITDEPTH;
956 int yyfree_stacks = 0;
967 YYSTYPE yyval; /* the variable used to return */
968 /* semantic values from the action */
975 fprintf(stderr, "Starting parse\n");
981 yychar = YYEMPTY; /* Cause a token to be read. */
983 /* Initialize stack pointers.
984 Waste one element of value and location stack
985 so that they stay on the same level as the state stack.
986 The wasted elements are never initialized. */
994 /* Push a new state, which is found in yystate . */
995 /* In all cases, when you get here, the value and location stacks
996 have just been pushed. so pushing a state here evens the stacks. */
1001 if (yyssp >= yyss + yystacksize - 1)
1003 /* Give user a chance to reallocate the stack */
1004 /* Use copies of these so that the &'s don't force the real ones into memory. */
1005 YYSTYPE *yyvs1 = yyvs;
1006 short *yyss1 = yyss;
1008 YYLTYPE *yyls1 = yyls;
1011 /* Get the current used size of the three stacks, in elements. */
1012 int size = yyssp - yyss + 1;
1015 /* Each stack pointer address is followed by the size of
1016 the data in use in that stack, in bytes. */
1018 /* This used to be a conditional around just the two extra args,
1019 but that might be undefined if yyoverflow is a macro. */
1020 yyoverflow("parser stack overflow",
1021 &yyss1, size * sizeof (*yyssp),
1022 &yyvs1, size * sizeof (*yyvsp),
1023 &yyls1, size * sizeof (*yylsp),
1026 yyoverflow("parser stack overflow",
1027 &yyss1, size * sizeof (*yyssp),
1028 &yyvs1, size * sizeof (*yyvsp),
1032 yyss = yyss1; yyvs = yyvs1;
1036 #else /* no yyoverflow */
1037 /* Extend the stack our own way. */
1038 if (yystacksize >= YYMAXDEPTH)
1040 yyerror("parser stack overflow");
1052 if (yystacksize > YYMAXDEPTH)
1053 yystacksize = YYMAXDEPTH;
1054 #ifndef YYSTACK_USE_ALLOCA
1057 yyss = (short *) YYSTACK_ALLOC (yystacksize * sizeof (*yyssp));
1058 __yy_memcpy ((char *)yyss, (char *)yyss1,
1059 size * (unsigned int) sizeof (*yyssp));
1060 yyvs = (YYSTYPE *) YYSTACK_ALLOC (yystacksize * sizeof (*yyvsp));
1061 __yy_memcpy ((char *)yyvs, (char *)yyvs1,
1062 size * (unsigned int) sizeof (*yyvsp));
1064 yyls = (YYLTYPE *) YYSTACK_ALLOC (yystacksize * sizeof (*yylsp));
1065 __yy_memcpy ((char *)yyls, (char *)yyls1,
1066 size * (unsigned int) sizeof (*yylsp));
1068 #endif /* no yyoverflow */
1070 yyssp = yyss + size - 1;
1071 yyvsp = yyvs + size - 1;
1073 yylsp = yyls + size - 1;
1078 fprintf(stderr, "Stack size increased to %d\n", yystacksize);
1081 if (yyssp >= yyss + yystacksize - 1)
1087 fprintf(stderr, "Entering state %d\n", yystate);
1093 /* Do appropriate processing given the current state. */
1094 /* Read a lookahead token if we need one and don't already have one. */
1097 /* First try to decide what to do without reference to lookahead token. */
1099 yyn = yypact[yystate];
1103 /* Not known => get a lookahead token if don't already have one. */
1105 /* yychar is either YYEMPTY or YYEOF
1106 or a valid token in external form. */
1108 if (yychar == YYEMPTY)
1112 fprintf(stderr, "Reading a token: ");
1117 /* Convert token to internal form (in yychar1) for indexing tables with */
1119 if (yychar <= 0) /* This means end of input. */
1122 yychar = YYEOF; /* Don't call YYLEX any more */
1126 fprintf(stderr, "Now at end of input.\n");
1131 yychar1 = YYTRANSLATE(yychar);
1136 fprintf (stderr, "Next token is %d (%s", yychar, yytname[yychar1]);
1137 /* Give the individual parser a way to print the precise meaning
1138 of a token, for further debugging info. */
1140 YYPRINT (stderr, yychar, yylval);
1142 fprintf (stderr, ")\n");
1148 if (yyn < 0 || yyn > YYLAST || yycheck[yyn] != yychar1)
1153 /* yyn is what to do for this token type in this state.
1154 Negative => reduce, -yyn is rule number.
1155 Positive => shift, yyn is new state.
1156 New state is final state => don't bother to shift,
1157 just return success.
1158 0, or most negative number => error. */
1173 /* Shift the lookahead token. */
1177 fprintf(stderr, "Shifting token %d (%s), ", yychar, yytname[yychar1]);
1180 /* Discard the token being shifted unless it is eof. */
1181 if (yychar != YYEOF)
1189 /* count tokens shifted since error; after three, turn off error status. */
1190 if (yyerrstatus) yyerrstatus--;
1195 /* Do the default action for the current state. */
1198 yyn = yydefact[yystate];
1202 /* Do a reduction. yyn is the number of a rule to reduce with. */
1206 yyval = yyvsp[1-yylen]; /* implement default value of the action */
1213 fprintf (stderr, "Reducing via rule %d (line %d), ",
1216 /* Print the symbols being reduced, and their result. */
1217 for (i = yyprhs[yyn]; yyrhs[i] > 0; i++)
1218 fprintf (stderr, "%s ", yytname[yyrhs[i]]);
1219 fprintf (stderr, " -> %s\n", yytname[yyr1[yyn]]);
1245 Node *node = new_ccode(C_CCODE,(yyvsp[0].cbuf)->str,
1247 nodes = g_list_append(nodes,node);
1248 g_string_free(yyvsp[0].cbuf,FALSE);
1254 Node *node = new_ccode(H_CCODE,(yyvsp[0].cbuf)->str,
1256 nodes = g_list_append(nodes,node);
1257 g_string_free(yyvsp[0].cbuf,FALSE);
1263 Node *node = new_ccode(HT_CCODE,(yyvsp[0].cbuf)->str,
1265 nodes = g_list_append(nodes,node);
1266 g_string_free(yyvsp[0].cbuf,FALSE);
1272 Node *node = new_ccode(PH_CCODE,(yyvsp[0].cbuf)->str,
1274 nodes = g_list_append(nodes,node);
1275 g_string_free(yyvsp[0].cbuf,FALSE);
1281 Node *node = new_ccode(A_CCODE,(yyvsp[0].cbuf)->str,
1283 nodes = g_list_append(nodes,node);
1284 g_string_free(yyvsp[0].cbuf,FALSE);
1290 Node *node = new_ccode(AT_CCODE,(yyvsp[0].cbuf)->str,
1292 nodes = g_list_append(nodes,node);
1293 g_string_free(yyvsp[0].cbuf,FALSE);
1307 ((Class *)class)->nodes = class_nodes;
1309 nodes = g_list_append(nodes,class);
1315 ((Class *)class)->nodes = NULL;
1317 nodes = g_list_append(nodes,class);
1323 class = new_class(yyvsp[-3].id,yyvsp[-1].id,chunk_size,NULL);
1329 if(strcmp(yyvsp[-2].id,"chunks") == 0) {
1330 chunk_size = g_strdup(yyvsp[0].id);
1332 yyerror(_("parse error"));
1340 if(strcmp(yyvsp[-2].id,"chunks") == 0) {
1341 if(atoi(yyvsp[0].id) != 0)
1342 chunk_size = g_strdup(yyvsp[0].id);
1344 yyerror(_("parse error"));
1375 { the_scope = PUBLIC_SCOPE; ;
1379 { the_scope = PRIVATE_SCOPE; ;
1383 { the_scope = PROTECTED_SCOPE; ;
1387 { the_scope = CLASS_SCOPE; ;
1392 if(strcmp(yyvsp[-1].id, "destroywith")==0) {
1393 g_free(yyvsp[-1].id);
1394 destructor = yyvsp[0].id;
1395 destructor_line = line_no;
1396 destructor_simple = TRUE;
1398 g_free(yyvsp[-1].id);
1399 g_free(yyvsp[0].id);
1400 yyerror(_("parse error"));
1408 if(strcmp(yyvsp[-2].id, "destroy")==0) {
1409 g_free(yyvsp[-2].id);
1410 destructor = (yyvsp[0].cbuf)->str;
1411 g_string_free(yyvsp[0].cbuf, FALSE);
1412 destructor_line = ccode_line;
1413 destructor_simple = FALSE;
1415 g_free(yyvsp[-2].id);
1416 g_string_free(yyvsp[0].cbuf, TRUE);
1417 yyerror(_("parse error"));
1425 initializer = yyvsp[0].id;
1426 initializer_line = ccode_line;
1432 initializer = (yyvsp[0].cbuf)->str;
1433 initializer_line = ccode_line;
1434 g_string_free(yyvsp[0].cbuf, FALSE);
1447 { destructor = NULL; ;
1451 { initializer = NULL; ;
1463 push_variable(yyvsp[-2].id, the_scope,yyvsp[-4].line, NULL);
1469 push_variable(yyvsp[-3].id, the_scope, yyvsp[-5].line, yyvsp[-2].id);
1475 if(strcmp(yyvsp[-6].id,"get")==0 &&
1476 strcmp(yyvsp[-3].id,"set")==0) {
1478 Type *type = pop_type();
1479 g_free(yyvsp[-6].id); g_free(yyvsp[-3].id);
1480 node = new_argument(yyvsp[-8].id,type,yyvsp[-9].list,yyvsp[-7].id,
1481 (yyvsp[-4].cbuf)->str,yyvsp[-5].line,
1482 (yyvsp[-1].cbuf)->str,yyvsp[-2].line,
1484 g_string_free(yyvsp[-4].cbuf,FALSE);
1485 g_string_free(yyvsp[-1].cbuf,FALSE);
1486 class_nodes = g_list_append(class_nodes,node);
1487 } else if(strcmp(yyvsp[-6].id,"set")==0 &&
1488 strcmp(yyvsp[-3].id,"get")==0) {
1490 Type *type = pop_type();
1491 g_free(yyvsp[-6].id); g_free(yyvsp[-3].id);
1492 node = new_argument(yyvsp[-8].id,type,yyvsp[-9].list,yyvsp[-7].id,
1493 (yyvsp[-1].cbuf)->str,yyvsp[-2].line,
1494 (yyvsp[-4].cbuf)->str,yyvsp[-5].line,
1496 g_string_free(yyvsp[-1].cbuf,FALSE);
1497 g_string_free(yyvsp[-4].cbuf,FALSE);
1498 class_nodes = g_list_append(class_nodes,node);
1500 g_free(yyvsp[-8].id); g_free(yyvsp[-7].id);
1501 g_free(yyvsp[-6].id); g_free(yyvsp[-3].id);
1502 g_list_foreach(yyvsp[-9].list,(GFunc)g_free,NULL);
1503 g_list_free(yyvsp[-9].list);
1504 g_string_free(yyvsp[-1].cbuf,TRUE);
1505 g_string_free(yyvsp[-4].cbuf,TRUE);
1506 yyerror(_("parse error"));
1514 if(strcmp(yyvsp[-3].id, "get") == 0) {
1516 Type *type = pop_type();
1517 g_free(yyvsp[-3].id);
1518 node = new_argument(yyvsp[-5].id, type, yyvsp[-6].list, yyvsp[-4].id,
1519 (yyvsp[-1].cbuf)->str, yyvsp[-2].line,
1520 NULL, 0, yyvsp[-7].line);
1521 g_string_free(yyvsp[-1].cbuf, FALSE);
1522 class_nodes = g_list_append(class_nodes, node);
1523 } else if(strcmp(yyvsp[-3].id, "set") == 0) {
1525 Type *type = pop_type();
1526 g_free(yyvsp[-3].id);
1527 node = new_argument(yyvsp[-5].id, type, yyvsp[-6].list, yyvsp[-4].id,
1528 NULL, 0, (yyvsp[-1].cbuf)->str,
1529 yyvsp[-2].line, yyvsp[-7].line);
1530 g_string_free(yyvsp[-1].cbuf, FALSE);
1531 class_nodes = g_list_append(class_nodes, node);
1533 g_free(yyvsp[-3].id); g_free(yyvsp[-5].id);
1534 g_free(yyvsp[-4].id);
1535 g_list_foreach(yyvsp[-6].list, (GFunc)g_free, NULL);
1536 g_list_free(yyvsp[-6].list);
1537 g_string_free(yyvsp[-1].cbuf, TRUE);
1538 yyerror(_("parse error"));
1547 char *get, *set = NULL;
1552 if(strcmp(yyvsp[0].id, "link")!=0 &&
1553 strcmp(yyvsp[0].id, "stringlink")!=0 &&
1554 strcmp(yyvsp[0].id, "objectlink")!=0) {
1555 g_free(yyvsp[0].id); g_free(yyvsp[-2].id);
1556 g_free(yyvsp[-1].id);
1557 g_list_foreach(yyvsp[-3].list,(GFunc)g_free,NULL);
1558 g_list_free(yyvsp[-3].list);
1559 yyerror(_("parse error"));
1565 var = find_var_or_die(yyvsp[-1].id, yyvsp[-4].line);
1566 if(var->scope == PRIVATE_SCOPE)
1567 root = "self->_priv";
1568 else if(var->scope == CLASS_SCOPE) {
1569 root = "SELF_GET_CLASS(self)";
1572 _("Self aliases needed when autolinking to a classwide member"),
1577 if(strcmp(yyvsp[0].id, "link")==0) {
1578 set = g_strdup_printf("%s->%s = ARG;",
1579 root, yyvsp[-1].id);
1580 } else if(strcmp(yyvsp[0].id, "stringlink")==0) {
1581 set = g_strdup_printf("g_free(%s->%s); "
1582 "%s->%s = g_strdup(ARG);",
1584 root, yyvsp[-1].id);
1585 } else if(strcmp(yyvsp[0].id, "objectlink")==0) {
1586 set = g_strdup_printf(
1588 "gtk_object_unref(GTK_OBJECT(%s->%s)); "
1591 "gtk_object_ref(GTK_OBJECT(%s->%s));",
1596 root, yyvsp[-1].id);
1598 g_assert_not_reached();
1601 if(strcmp(yyvsp[0].id, "stringlink")==0) {
1602 get = g_strdup_printf("ARG = g_strdup(%s->%s);", root, yyvsp[-1].id);
1604 /* For everything else, get is just straight assignment */
1605 get = g_strdup_printf("ARG = %s->%s;", root, yyvsp[-1].id);
1607 g_free(yyvsp[0].id);
1611 type = copy_type(var->vtype);
1613 node = new_argument(yyvsp[-2].id, type, yyvsp[-3].list,
1614 yyvsp[-1].id, get, yyvsp[-4].line,
1615 set, yyvsp[-4].line, yyvsp[-4].line);
1616 class_nodes = g_list_append(class_nodes,node);
1622 if(strcmp(yyvsp[-2].id,"type")!=0) {
1623 g_free(yyvsp[-4].id);
1624 g_free(yyvsp[-2].id);
1625 yyerror(_("parse error"));
1628 yyval.id = yyvsp[-4].id;
1634 yyval.id = yyvsp[0].id;
1635 typestack = g_list_prepend(typestack,NULL);
1640 { yyval.list = yyvsp[-1].list; ;
1644 { yyval.list = NULL; ;
1649 yyval.list = g_list_append(yyvsp[0].list,yyvsp[-2].id);
1655 yyval.list = g_list_append(NULL,yyvsp[0].id);
1661 Node *node = new_type(yyvsp[-1].id, yyvsp[0].id, NULL);
1662 typestack = g_list_prepend(typestack,node);
1668 Node *node = new_type(yyvsp[0].id, NULL, NULL);
1669 typestack = g_list_prepend(typestack,node);
1675 yyval.id = yyvsp[0].id;
1681 yyval.id = yyvsp[0].id;
1687 yyval.id = g_strconcat("const ", yyvsp[0].id, NULL);
1688 g_free(yyvsp[0].id);
1694 yyval.id = g_strconcat(yyvsp[-1].id, " const", NULL);
1695 g_free(yyvsp[-1].id);
1701 yyval.id = g_strconcat(yyvsp[-1].id, " ", yyvsp[0].id, NULL);
1702 g_free(yyvsp[0].id);
1708 yyval.id = g_strconcat("const ", yyvsp[-1].id, " ",
1710 g_free(yyvsp[0].id);
1716 yyval.id = g_strconcat(yyvsp[-2].id, " ",
1717 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(yyvsp[-1].id, " ", yyvsp[0].id, NULL);
1732 g_free(yyvsp[-1].id);
1733 g_free(yyvsp[0].id);
1739 yyval.id = g_strconcat("const ", yyvsp[0].id, NULL);
1740 g_free(yyvsp[0].id);
1746 yyval.id = yyvsp[0].id;
1752 yyval.id = g_strconcat(yyvsp[-1].id, " const", NULL);
1753 g_free(yyvsp[-1].id);
1759 yyval.id = g_strdup(yyvsp[0].id);
1765 yyval.id = g_strconcat(yyvsp[-1].id, " const", NULL);
1770 { yyval.id = "void"; ;
1774 { yyval.id = "char"; ;
1778 { yyval.id = "short"; ;
1782 { yyval.id = "int"; ;
1786 { yyval.id = "long"; ;
1790 { yyval.id = "float"; ;
1794 { yyval.id = "double"; ;
1798 { yyval.id = "signed"; ;
1802 { yyval.id = "unsigned"; ;
1806 { yyval.id = "struct"; ;
1810 { yyval.id = "union"; ;
1814 { yyval.id = "enum"; ;
1818 { yyval.id = g_strdup("*"); ;
1822 { yyval.id = g_strdup("* const"); ;
1827 yyval.id = g_strconcat("*", yyvsp[0].id, NULL);
1828 g_free(yyvsp[0].id);
1834 yyval.id = g_strconcat("* const", yyvsp[0].id, NULL);
1835 g_free(yyvsp[0].id);
1841 if(strcmp(yyvsp[-1].id, "first")==0)
1842 yyval.sigtype = SIGNAL_FIRST_METHOD;
1843 else if(strcmp(yyvsp[-1].id, "last")==0)
1844 yyval.sigtype = SIGNAL_LAST_METHOD;
1846 yyerror(_("signal must be 'first' or 'last'"));
1847 g_free(yyvsp[-1].id);
1850 g_free(yyvsp[-1].id);
1856 yyval.sigtype = SIGNAL_LAST_METHOD;
1862 if(strcmp(yyvsp[-1].id,"first")==0)
1863 yyval.sigtype = SIGNAL_FIRST_METHOD;
1864 else if(strcmp(yyvsp[-1].id,"last")==0)
1865 yyval.sigtype = SIGNAL_LAST_METHOD;
1867 yyerror(_("signal must be 'first' or 'last'"));
1868 g_free(yyvsp[-1].id);
1871 g_free(yyvsp[-1].id);
1877 if(strcmp(yyvsp[-2].id,"first")==0)
1878 yyval.sigtype = SIGNAL_FIRST_METHOD;
1879 else if(strcmp(yyvsp[-2].id,"last")==0)
1880 yyval.sigtype = SIGNAL_LAST_METHOD;
1882 yyerror(_("signal must be 'first' or 'last'"));
1883 g_free(yyvsp[-2].id);
1886 g_free(yyvsp[-2].id);
1892 yyval.sigtype = SIGNAL_LAST_METHOD;
1898 /* the_scope was default thus public */
1899 the_scope = PUBLIC_SCOPE;
1905 gtktypes = g_list_prepend(gtktypes, yyvsp[-3].id);
1911 gtktypes = g_list_append(gtktypes, yyvsp[0].id);
1917 gtktypes = g_list_append(gtktypes, yyvsp[0].id);
1922 { yyval.cbuf = yyvsp[0].cbuf; ;
1926 { yyval.cbuf = NULL; ;
1932 yyerror(_("signal without 'self' as "
1933 "first parameter"));
1934 free_all_global_state();
1937 if(the_scope == CLASS_SCOPE) {
1938 yyerror(_("a method cannot be of class scope"));
1939 free_all_global_state();
1942 push_function(the_scope, yyvsp[-7].sigtype,NULL,
1943 yyvsp[-5].id, yyvsp[0].cbuf,yyvsp[-9].line,
1944 ccode_line, vararg, yyvsp[-8].list);
1951 yyerror(_("signal without 'self' as "
1952 "first parameter"));
1953 free_all_global_state();
1956 if(the_scope == CLASS_SCOPE) {
1957 yyerror(_("a method cannot be of class scope"));
1958 free_all_global_state();
1961 push_function(the_scope, yyvsp[-7].sigtype, NULL,
1962 yyvsp[-5].id, yyvsp[0].cbuf, yyvsp[-9].line,
1963 ccode_line, vararg, yyvsp[-8].list);
1970 yyerror(_("virtual method without 'self' as "
1971 "first parameter"));
1972 free_all_global_state();
1975 if(the_scope == CLASS_SCOPE) {
1976 yyerror(_("a method cannot be of class scope"));
1977 free_all_global_state();
1980 push_function(the_scope, VIRTUAL_METHOD, NULL, yyvsp[-5].id,
1981 yyvsp[0].cbuf, yyvsp[-8].line,
1982 ccode_line, vararg, NULL);
1989 yyerror(_("virtual method without 'self' as "
1990 "first parameter"));
1991 free_all_global_state();
1994 if(the_scope == CLASS_SCOPE) {
1995 yyerror(_("a method cannot be of class scope"));
1996 free_all_global_state();
1999 push_function(the_scope, VIRTUAL_METHOD, NULL, yyvsp[-5].id,
2000 yyvsp[0].cbuf, yyvsp[-7].line,
2001 ccode_line, vararg, NULL);
2008 yyerror(_("virtual method without 'self' as "
2009 "first parameter"));
2010 free_all_global_state();
2013 push_function(PUBLIC_SCOPE, VIRTUAL_METHOD, NULL,
2014 yyvsp[-5].id, yyvsp[0].cbuf, yyvsp[-7].line,
2015 ccode_line, vararg, NULL);
2021 push_function(NO_SCOPE, OVERRIDE_METHOD, yyvsp[-8].id,
2022 yyvsp[-5].id, yyvsp[0].cbuf,
2023 yyvsp[-10].line, ccode_line,
2030 if(the_scope == CLASS_SCOPE) {
2031 yyerror(_("a method cannot be of class scope"));
2032 free_all_global_state();
2035 push_function(the_scope, REGULAR_METHOD, NULL, yyvsp[-5].id,
2036 yyvsp[0].cbuf, yyvsp[-7].line, ccode_line,
2043 if(strcmp(yyvsp[-4].id, "init")==0) {
2044 push_init_arg(yyvsp[-2].id,FALSE);
2045 push_function(NO_SCOPE, INIT_METHOD, NULL,
2046 yyvsp[-4].id, yyvsp[0].cbuf, yyvsp[-3].line,
2047 ccode_line, FALSE, NULL);
2048 } else if(strcmp(yyvsp[-4].id, "class_init")==0) {
2049 push_init_arg(yyvsp[-2].id,TRUE);
2050 push_function(NO_SCOPE, CLASS_INIT_METHOD, NULL,
2051 yyvsp[-4].id, yyvsp[0].cbuf, yyvsp[-3].line,
2052 ccode_line, FALSE, NULL);
2054 g_free(yyvsp[-4].id);
2055 g_free(yyvsp[-2].id);
2056 g_string_free(yyvsp[0].cbuf,TRUE);
2057 yyerror(_("parse error "
2058 "(untyped blocks must be init or "
2067 g_free(onerror); onerror = NULL;
2068 g_free(defreturn); defreturn = NULL;
2069 if(!set_return_value(yyvsp[-1].id, yyvsp[0].id)) {
2070 g_free(yyvsp[-1].id);
2071 g_free(yyvsp[0].id);
2072 yyerror(_("parse error"));
2075 g_free(yyvsp[-1].id);
2081 g_free(onerror); onerror = NULL;
2082 g_free(defreturn); defreturn = NULL;
2083 if(!set_return_value(yyvsp[-3].id, yyvsp[-2].id)) {
2084 g_free(yyvsp[-3].id); g_free(yyvsp[-2].id);
2085 g_free(yyvsp[-1].id); g_free(yyvsp[0].id);
2086 yyerror(_("parse error"));
2089 if(!set_return_value(yyvsp[-1].id, yyvsp[0].id)) {
2090 onerror = defreturn = NULL;
2091 g_free(yyvsp[-3].id); g_free(yyvsp[-2].id);
2092 g_free(yyvsp[-1].id); g_free(yyvsp[0].id);
2093 yyerror(_("parse error"));
2096 g_free(yyvsp[-3].id);
2097 g_free(yyvsp[-1].id);
2103 g_free(onerror); onerror = NULL;
2104 g_free(defreturn); defreturn = NULL;
2109 { yyval.id = yyvsp[0].id; ;
2114 yyval.id = (yyvsp[1].cbuf)->str;
2115 g_string_free(yyvsp[1].cbuf, FALSE);
2120 { vararg = FALSE; has_self = FALSE; ;
2127 if(strcmp(yyvsp[0].id,"self")==0)
2128 push_self(yyvsp[0].id, FALSE);
2130 g_free(yyvsp[0].id);
2131 yyerror(_("parse error"));
2141 if(strcmp(yyvsp[-1].id,"self")==0)
2142 push_self(yyvsp[-1].id, TRUE);
2144 g_free(yyvsp[-1].id);
2145 yyerror(_("parse error"));
2155 if(strcmp(yyvsp[0].id,"self")==0)
2156 push_self(yyvsp[0].id, TRUE);
2158 g_free(yyvsp[0].id);
2159 yyerror(_("parse error"));
2168 if(strcmp(yyvsp[-2].id,"self")==0)
2169 push_self(yyvsp[-2].id, FALSE);
2171 g_free(yyvsp[-2].id);
2172 yyerror(_("parse error"));
2178 #line 1009 "parse.y"
2181 if(strcmp(yyvsp[-3].id,"self")==0)
2182 push_self(yyvsp[-3].id, TRUE);
2184 g_free(yyvsp[-3].id);
2185 yyerror(_("parse error"));
2191 #line 1019 "parse.y"
2194 if(strcmp(yyvsp[-2].id,"self")==0)
2195 push_self(yyvsp[-2].id, TRUE);
2197 g_free(yyvsp[-2].id);
2198 yyerror(_("parse error"));
2204 #line 1029 "parse.y"
2205 { has_self = FALSE; ;
2208 #line 1032 "parse.y"
2212 #line 1033 "parse.y"
2216 #line 1036 "parse.y"
2220 #line 1037 "parse.y"
2224 #line 1040 "parse.y"
2226 push_funcarg(yyvsp[0].id,NULL);
2230 #line 1043 "parse.y"
2232 push_funcarg(yyvsp[-1].id,yyvsp[0].id);
2236 #line 1046 "parse.y"
2238 if(strcmp(yyvsp[-2].id,"check")!=0) {
2239 yyerror(_("parse error"));
2242 g_free(yyvsp[-2].id);
2243 push_funcarg(yyvsp[-4].id,NULL);
2247 #line 1054 "parse.y"
2249 if(strcmp(yyvsp[-2].id,"check")!=0) {
2250 yyerror(_("parse error"));
2253 g_free(yyvsp[-2].id);
2254 push_funcarg(yyvsp[-5].id,yyvsp[-4].id);
2258 #line 1064 "parse.y"
2262 #line 1065 "parse.y"
2266 #line 1068 "parse.y"
2268 if(strcmp(yyvsp[0].id,"type")==0) {
2269 Node *node = new_check(TYPE_CHECK,NULL);
2270 checks = g_list_append(checks,node);
2271 } else if(strcmp(yyvsp[0].id,"null")==0) {
2272 Node *node = new_check(NULL_CHECK,NULL);
2273 checks = g_list_append(checks,node);
2275 yyerror(_("parse error"));
2278 g_free(yyvsp[0].id);
2282 #line 1081 "parse.y"
2284 Node *node = new_check(GT_CHECK,yyvsp[0].id);
2285 checks = g_list_append(checks,node);
2289 #line 1085 "parse.y"
2291 Node *node = new_check(LT_CHECK,yyvsp[0].id);
2292 checks = g_list_append(checks,node);
2296 #line 1089 "parse.y"
2298 Node *node = new_check(GE_CHECK,yyvsp[0].id);
2299 checks = g_list_append(checks,node);
2303 #line 1093 "parse.y"
2305 Node *node = new_check(LE_CHECK,yyvsp[0].id);
2306 checks = g_list_append(checks,node);
2310 #line 1097 "parse.y"
2312 Node *node = new_check(EQ_CHECK,yyvsp[0].id);
2313 checks = g_list_append(checks,node);
2317 #line 1101 "parse.y"
2319 Node *node = new_check(NE_CHECK,yyvsp[0].id);
2320 checks = g_list_append(checks,node);
2324 #line 1107 "parse.y"
2325 { yyval.id = yyvsp[0].id; ;
2328 #line 1108 "parse.y"
2330 yyval.id = g_strconcat("-",yyvsp[0].id,NULL);
2331 g_free(yyvsp[0].id);
2335 #line 1112 "parse.y"
2336 { yyval.id = yyvsp[0].id; ;
2339 /* the action file gets copied in in place of this dollarsign */
2340 #line 543 "/usr/lib/bison.simple"
2351 short *ssp1 = yyss - 1;
2352 fprintf (stderr, "state stack now");
2353 while (ssp1 != yyssp)
2354 fprintf (stderr, " %d", *++ssp1);
2355 fprintf (stderr, "\n");
2365 yylsp->first_line = yylloc.first_line;
2366 yylsp->first_column = yylloc.first_column;
2367 yylsp->last_line = (yylsp-1)->last_line;
2368 yylsp->last_column = (yylsp-1)->last_column;
2373 yylsp->last_line = (yylsp+yylen-1)->last_line;
2374 yylsp->last_column = (yylsp+yylen-1)->last_column;
2378 /* Now "shift" the result of the reduction.
2379 Determine what state that goes to,
2380 based on the state we popped back to
2381 and the rule number reduced by. */
2385 yystate = yypgoto[yyn - YYNTBASE] + *yyssp;
2386 if (yystate >= 0 && yystate <= YYLAST && yycheck[yystate] == *yyssp)
2387 yystate = yytable[yystate];
2389 yystate = yydefgoto[yyn - YYNTBASE];
2393 yyerrlab: /* here on detecting error */
2396 /* If not already recovering from an error, report this error. */
2400 #ifdef YYERROR_VERBOSE
2401 yyn = yypact[yystate];
2403 if (yyn > YYFLAG && yyn < YYLAST)
2410 /* Start X at -yyn if nec to avoid negative indexes in yycheck. */
2411 for (x = (yyn < 0 ? -yyn : 0);
2412 x < (sizeof(yytname) / sizeof(char *)); x++)
2413 if (yycheck[x + yyn] == x)
2414 size += strlen(yytname[x]) + 15, count++;
2415 msg = (char *) malloc(size + 15);
2418 strcpy(msg, "parse error");
2423 for (x = (yyn < 0 ? -yyn : 0);
2424 x < (sizeof(yytname) / sizeof(char *)); x++)
2425 if (yycheck[x + yyn] == x)
2427 strcat(msg, count == 0 ? ", expecting `" : " or `");
2428 strcat(msg, yytname[x]);
2437 yyerror ("parse error; also virtual memory exceeded");
2440 #endif /* YYERROR_VERBOSE */
2441 yyerror("parse error");
2445 yyerrlab1: /* here on error raised explicitly by an action */
2447 if (yyerrstatus == 3)
2449 /* if just tried and failed to reuse lookahead token after an error, discard it. */
2451 /* return failure if at end of input */
2452 if (yychar == YYEOF)
2457 fprintf(stderr, "Discarding token %d (%s).\n", yychar, yytname[yychar1]);
2463 /* Else will try to reuse lookahead token
2464 after shifting the error token. */
2466 yyerrstatus = 3; /* Each real token shifted decrements this */
2470 yyerrdefault: /* current state does not do anything special for the error token. */
2473 /* This is wrong; only states that explicitly want error tokens
2474 should shift them. */
2475 yyn = yydefact[yystate]; /* If its default is to accept any token, ok. Otherwise pop it.*/
2476 if (yyn) goto yydefault;
2479 yyerrpop: /* pop the current state because it cannot handle the error token */
2481 if (yyssp == yyss) YYABORT;
2491 short *ssp1 = yyss - 1;
2492 fprintf (stderr, "Error: state stack now");
2493 while (ssp1 != yyssp)
2494 fprintf (stderr, " %d", *++ssp1);
2495 fprintf (stderr, "\n");
2501 yyn = yypact[yystate];
2506 if (yyn < 0 || yyn > YYLAST || yycheck[yyn] != YYTERROR)
2525 fprintf(stderr, "Shifting error token, ");
2537 /* YYACCEPT comes here. */
2549 /* YYABORT comes here. */
2560 #line 1115 "parse.y"