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 error_print(GOB_WARN, line_no,
167 _("The number of GTK arguments and "
168 "function arguments for a signal "
169 "don't seem to match"));
171 if(g_list_length(gtktypes) > 2) {
173 for(li = gtktypes->next; li; li = li->next) {
174 if(strcmp(li->data, "NONE")==0) {
175 error_print(GOB_ERROR, line_no,
176 _("NONE can only appear in an "
177 "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)
278 for(li = class_nodes; li != NULL; li = li->next) {
280 Node *node = li->data;
281 if(node->type != VARIABLE_NODE)
284 if(strcmp(var->id, id)==0)
288 error_printf(GOB_ERROR, line, _("Variable %s not defined here"), id);
290 g_assert_not_reached();
295 set_return_value(char *type, char *val)
297 if(strcmp(type, "onerror")==0) {
303 } else if(strcmp(type, "defreturn")==0) {
337 #define YYFLAG -32768
340 #define YYTRANSLATE(x) ((unsigned)(x) <= 290 ? yytranslate[x] : 88)
342 static const char yytranslate[] = { 0,
343 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
344 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
345 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
346 2, 2, 48, 2, 2, 2, 2, 2, 2, 39,
347 40, 44, 2, 45, 49, 2, 2, 2, 2, 2,
348 2, 2, 2, 2, 2, 2, 2, 2, 41, 47,
349 42, 46, 2, 2, 2, 2, 2, 2, 2, 2,
350 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
351 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
352 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
353 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
354 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
355 2, 2, 37, 43, 38, 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, 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, 1, 3, 4, 5, 6,
369 7, 8, 9, 10, 11, 12, 13, 14, 15, 16,
370 17, 18, 19, 20, 21, 22, 23, 24, 25, 26,
371 27, 28, 29, 30, 31, 32, 33, 34, 35, 36
375 static const short yyprhs[] = { 0,
376 0, 4, 7, 10, 12, 14, 16, 18, 20, 22,
377 24, 27, 29, 34, 38, 44, 45, 50, 55, 58,
378 60, 62, 64, 66, 68, 70, 72, 74, 76, 79,
379 83, 86, 90, 93, 96, 98, 100, 101, 107, 114,
380 126, 135, 141, 147, 149, 153, 154, 158, 160, 163,
381 165, 167, 169, 172, 175, 178, 182, 186, 189, 192,
382 195, 197, 200, 202, 205, 207, 209, 211, 213, 215,
383 217, 219, 221, 223, 225, 227, 229, 231, 234, 237,
384 241, 244, 246, 250, 254, 257, 259, 264, 268, 270,
385 273, 275, 286, 298, 308, 318, 327, 339, 348, 354,
386 357, 362, 363, 365, 368, 370, 372, 375, 378, 382,
387 387, 392, 394, 398, 400, 404, 406, 409, 413, 420,
388 428, 431, 433, 435, 438, 441, 445, 449, 453, 457,
392 static const short yyrhs[] = { 52,
393 53, 52, 0, 53, 52, 0, 52, 53, 0, 53,
394 0, 23, 0, 26, 0, 24, 0, 25, 0, 27,
395 0, 28, 0, 52, 51, 0, 51, 0, 54, 37,
396 56, 38, 0, 54, 37, 38, 0, 3, 21, 4,
397 21, 55, 0, 0, 39, 19, 19, 40, 0, 39,
398 19, 20, 40, 0, 56, 57, 0, 57, 0, 78,
399 0, 62, 0, 63, 0, 41, 0, 29, 0, 30,
400 0, 31, 0, 32, 0, 19, 19, 0, 19, 37,
401 23, 0, 42, 87, 0, 42, 37, 23, 0, 59,
402 60, 0, 60, 59, 0, 60, 0, 59, 0, 0,
403 58, 67, 19, 61, 41, 0, 58, 67, 19, 22,
404 61, 41, 0, 33, 65, 64, 19, 19, 37, 23,
405 19, 37, 23, 41, 0, 33, 65, 64, 19, 19,
406 37, 23, 41, 0, 33, 65, 64, 19, 19, 0,
407 19, 39, 19, 67, 40, 0, 19, 0, 39, 66,
408 40, 0, 0, 19, 43, 66, 0, 19, 0, 68,
409 72, 0, 68, 0, 69, 0, 19, 0, 5, 19,
410 0, 19, 5, 0, 71, 19, 0, 5, 71, 19,
411 0, 71, 19, 5, 0, 70, 69, 0, 21, 69,
412 0, 5, 69, 0, 21, 0, 21, 5, 0, 70,
413 0, 70, 5, 0, 6, 0, 18, 0, 14, 0,
414 15, 0, 13, 0, 16, 0, 17, 0, 11, 0,
415 12, 0, 7, 0, 8, 0, 9, 0, 44, 0,
416 44, 5, 0, 44, 72, 0, 44, 5, 72, 0,
417 19, 75, 0, 75, 0, 58, 19, 75, 0, 19,
418 58, 75, 0, 58, 75, 0, 73, 0, 19, 39,
419 76, 40, 0, 76, 45, 19, 0, 19, 0, 37,
420 23, 0, 41, 0, 35, 65, 74, 67, 19, 39,
421 81, 40, 79, 77, 0, 58, 35, 65, 73, 67,
422 19, 39, 81, 40, 79, 77, 0, 34, 58, 67,
423 19, 39, 81, 40, 79, 77, 0, 58, 34, 67,
424 19, 39, 81, 40, 79, 77, 0, 34, 67, 19,
425 39, 81, 40, 79, 77, 0, 36, 39, 21, 40,
426 67, 19, 39, 81, 40, 79, 77, 0, 58, 67,
427 19, 39, 81, 40, 79, 77, 0, 19, 39, 19,
428 40, 77, 0, 19, 80, 0, 19, 80, 19, 80,
429 0, 0, 87, 0, 37, 23, 0, 6, 0, 19,
430 0, 19, 5, 0, 5, 19, 0, 19, 45, 82,
431 0, 19, 5, 45, 82, 0, 5, 19, 45, 82,
432 0, 82, 0, 83, 45, 10, 0, 83, 0, 83,
433 45, 84, 0, 84, 0, 67, 19, 0, 67, 19,
434 22, 0, 67, 19, 39, 19, 85, 40, 0, 67,
435 19, 22, 39, 19, 85, 40, 0, 85, 86, 0,
436 86, 0, 19, 0, 46, 87, 0, 47, 87, 0,
437 46, 42, 87, 0, 47, 42, 87, 0, 42, 42,
438 87, 0, 48, 42, 87, 0, 20, 0, 49, 20,
445 static const short yyrline[] = { 0,
446 311, 312, 313, 314, 317, 323, 329, 335, 341, 347,
447 355, 356, 359, 364, 371, 376, 377, 385, 396, 397,
448 400, 401, 402, 403, 406, 407, 408, 409, 412, 425,
449 441, 445, 453, 454, 455, 456, 457, 463, 466, 470,
450 506, 535, 609, 618, 624, 625, 628, 631, 637, 641,
451 648, 651, 654, 658, 662, 666, 671, 679, 683, 688,
452 692, 695, 699, 702, 707, 708, 709, 710, 711, 712,
453 713, 714, 715, 718, 719, 720, 723, 724, 725, 729,
454 736, 748, 754, 766, 778, 781, 787, 792, 795, 800,
455 801, 805, 821, 837, 853, 869, 880, 886, 896, 919,
456 930, 949, 955, 956, 962, 963, 974, 985, 996, 1006,
457 1016, 1026, 1029, 1030, 1033, 1034, 1037, 1040, 1043, 1051,
458 1061, 1062, 1065, 1078, 1082, 1086, 1090, 1094, 1098, 1104,
464 #if YYDEBUG != 0 || defined (YYERROR_VERBOSE)
466 static const char * const yytname[] = { "$","error","$undefined.","CLASS",
467 "FROM","CONST","VOID","STRUCT","UNION","ENUM","THREEDOTS","SIGNED","UNSIGNED",
468 "LONG","SHORT","INT","FLOAT","DOUBLE","CHAR","TOKEN","NUMBER","TYPETOKEN","ARRAY_DIM",
469 "CCODE","HTCODE","PHCODE","HCODE","ACODE","ATCODE","PUBLIC","PRIVATE","PROTECTED",
470 "CLASSWIDE","ARGUMENT","VIRTUAL","SIGNAL","OVERRIDE","'{'","'}'","'('","')'",
471 "';'","'='","'|'","'*'","','","'>'","'<'","'!'","'-'","prog","ccode","ccodes",
472 "class","classdec","chunk","classcode","thing","scope","destructor","initializer",
473 "varoptions","variable","argument","argtype","flags","flaglist","type","specifier_list",
474 "spec_list","specifier","strunionenum","pointer","simplesigtype","fullsigtype",
475 "sigtype","tokenlist","codenocode","method","returnvals","retcode","funcargs",
476 "arglist","arglist1","arg","checklist","check","numtok", NULL
480 static const short yyr1[] = { 0,
481 50, 50, 50, 50, 51, 51, 51, 51, 51, 51,
482 52, 52, 53, 53, 54, 55, 55, 55, 56, 56,
483 57, 57, 57, 57, 58, 58, 58, 58, 59, 59,
484 60, 60, 61, 61, 61, 61, 61, 62, 62, 63,
485 63, 63, 64, 64, 65, 65, 66, 66, 67, 67,
486 68, 68, 68, 68, 68, 68, 68, 69, 69, 69,
487 69, 69, 69, 69, 70, 70, 70, 70, 70, 70,
488 70, 70, 70, 71, 71, 71, 72, 72, 72, 72,
489 73, 73, 74, 74, 74, 74, 75, 76, 76, 77,
490 77, 78, 78, 78, 78, 78, 78, 78, 78, 79,
491 79, 79, 80, 80, 81, 81, 81, 81, 81, 81,
492 81, 81, 82, 82, 83, 83, 84, 84, 84, 84,
493 85, 85, 86, 86, 86, 86, 86, 86, 86, 87,
497 static const short yyr2[] = { 0,
498 3, 2, 2, 1, 1, 1, 1, 1, 1, 1,
499 2, 1, 4, 3, 5, 0, 4, 4, 2, 1,
500 1, 1, 1, 1, 1, 1, 1, 1, 2, 3,
501 2, 3, 2, 2, 1, 1, 0, 5, 6, 11,
502 8, 5, 5, 1, 3, 0, 3, 1, 2, 1,
503 1, 1, 2, 2, 2, 3, 3, 2, 2, 2,
504 1, 2, 1, 2, 1, 1, 1, 1, 1, 1,
505 1, 1, 1, 1, 1, 1, 1, 2, 2, 3,
506 2, 1, 3, 3, 2, 1, 4, 3, 1, 2,
507 1, 10, 11, 9, 9, 8, 11, 8, 5, 2,
508 4, 0, 1, 2, 1, 1, 2, 2, 3, 4,
509 4, 1, 3, 1, 3, 1, 2, 3, 6, 7,
510 2, 1, 1, 2, 2, 3, 3, 3, 3, 1,
514 static const short yydefact[] = { 0,
515 0, 5, 7, 8, 6, 9, 10, 12, 0, 4,
516 0, 0, 11, 3, 2, 0, 0, 1, 0, 25,
517 26, 27, 28, 46, 0, 46, 0, 14, 24, 0,
518 20, 0, 22, 23, 21, 16, 0, 0, 0, 0,
519 65, 74, 75, 76, 72, 73, 69, 67, 68, 70,
520 71, 66, 52, 61, 0, 0, 50, 51, 63, 0,
521 0, 0, 13, 19, 0, 46, 0, 0, 15, 0,
522 48, 0, 44, 0, 0, 53, 60, 0, 54, 62,
523 59, 0, 0, 77, 49, 64, 58, 55, 0, 0,
524 86, 0, 82, 0, 0, 0, 37, 0, 0, 0,
525 45, 0, 0, 56, 0, 0, 78, 79, 57, 0,
526 0, 0, 81, 0, 85, 0, 0, 0, 0, 0,
527 0, 37, 0, 0, 36, 35, 0, 0, 0, 0,
528 91, 99, 47, 0, 42, 0, 0, 65, 52, 0,
529 0, 112, 114, 116, 80, 89, 0, 84, 83, 0,
530 0, 0, 0, 29, 0, 0, 0, 132, 130, 0,
531 0, 31, 33, 34, 38, 17, 18, 90, 0, 0,
532 0, 53, 54, 0, 117, 102, 0, 87, 0, 0,
533 0, 0, 0, 30, 39, 102, 32, 131, 43, 0,
534 102, 0, 0, 109, 118, 0, 0, 0, 113, 115,
535 88, 0, 0, 102, 0, 0, 0, 41, 0, 111,
536 110, 0, 0, 0, 100, 103, 96, 102, 0, 0,
537 0, 98, 0, 94, 0, 123, 0, 0, 0, 0,
538 0, 122, 104, 0, 0, 102, 95, 102, 0, 0,
539 0, 0, 124, 0, 125, 0, 119, 121, 101, 92,
540 0, 0, 40, 120, 128, 126, 127, 129, 97, 93,
544 static const short yydefgoto[] = { 261,
545 8, 9, 10, 11, 69, 30, 31, 32, 125, 126,
546 127, 33, 34, 74, 39, 72, 140, 57, 58, 59,
547 60, 85, 91, 92, 93, 147, 132, 35, 198, 215,
548 141, 142, 143, 144, 231, 232, 216
551 static const short yypact[] = { 88,
552 -12,-32768,-32768,-32768,-32768,-32768,-32768,-32768, 88, 347,
553 -15, 15,-32768, 347, 347, 157, 18, 347, 7,-32768,
554 -32768,-32768,-32768, 25, 153, 25, 36,-32768,-32768, 175,
555 -32768, 118,-32768,-32768,-32768, 67, 102, 122, 135, 245,
556 -32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,
557 -32768,-32768, 22, 313, 262, 144, 131,-32768, 327, 160,
558 198, 159,-32768,-32768, 262, 25, 162, 180,-32768, 161,
559 171, 178, 164, 181, 341,-32768,-32768, 183,-32768, 341,
560 -32768, 196, 182, 8,-32768, 341,-32768, 214, 193, 201,
561 -32768, 262,-32768, 186, 212, 229, 48, 62, 57, 122,
562 -32768, 236, 246,-32768, 233, 279, 131,-32768,-32768, 243,
563 270, 280,-32768, 50,-32768, 287, 262, 277, 50, 262,
564 -1, 9, 279, -5, 278, 302, 281, 283, 295, 314,
565 -32768,-32768,-32768, 262, 299, 279, 296, 309, 0, 331,
566 311,-32768, 316,-32768,-32768,-32768, 98,-32768,-32768, 324,
567 345, 279, 346,-32768, 344, 335, 328,-32768,-32768, 354,
568 358,-32768,-32768,-32768,-32768,-32768,-32768,-32768, 339, 357,
569 342, 104, 105, 262, 38, 362, 228,-32768, 364, 279,
570 348, 349, 352,-32768,-32768, 362,-32768,-32768,-32768, 16,
571 362, 262, 262,-32768, 353, 365, 10, 57,-32768,-32768,
572 -32768, 350, 279, 362, 279, 57, 356,-32768, 57,-32768,
573 -32768, 366, 109, 363, 369,-32768,-32768, 362, 355, 57,
574 359,-32768, 371,-32768, 109,-32768, 360, 43, 53, 361,
575 61,-32768,-32768, 10, 57, 362,-32768, 362, 367, 100,
576 6, 6,-32768, 6,-32768, 6,-32768,-32768,-32768,-32768,
577 57, 57,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,
581 static const short yypgoto[] = {-32768,
582 351, 163, 389,-32768,-32768,-32768, 370, -18, 275, 282,
583 284,-32768,-32768,-32768, -16, 304, -24,-32768, -38,-32768,
584 -37, -10, 315,-32768, -36,-32768, -186,-32768, -180, 176,
585 -119, 4,-32768, 232, 187, -152, -124
592 static const short yytable[] = { 162,
593 56, 77, 78, 157, 173, 206, 55, 67, 12, 61,
594 209, 217, 107, 158, 159, 81, 171, 154, 17, 222,
595 87, 16, 224, 220, 158, 159, 79, 121, 158, 159,
596 82, 160, 182, 237, 207, 155, 77, 235, 36, -106,
597 95, 77, 90, 161, 174, 37, 214, 77, 250, 96,
598 124, 84, 113, 115, 161, 251, 208, 252, 161, 195,
599 202, 158, 159, 38, 259, 260, 121, 116, 110, 122,
600 112, 158, 159, 108, 62, 148, 196, 149, 248, 226,
601 128, 129, 113, 219, 242, 221, 123, 248, 111, 124,
602 1, 161, 151, 130, 244, 153, 145, 131, 77, 78,
603 247, 161, 227, 243, 245, 68, 228, 229, 230, 169,
604 2, 3, 4, 5, 6, 7, 255, 256, 226, 257,
605 70, 258, 40, 41, 42, 43, 44, 226, 45, 46,
606 47, 48, 49, 50, 51, 52, 53, 178, 54, 254,
607 71, 227, 179, -108, -107, 228, 229, 230, 192, 193,
608 227, 65, 66, 73, 228, 229, 230, 40, 41, 42,
609 43, 44, 83, 45, 46, 47, 48, 49, 50, 51,
610 52, 53, 15, 54, 84, 19, 18, 194, 88, 94,
611 97, 20, 21, 22, 23, 20, 21, 22, 23, 24,
612 25, 26, 27, 19, 28, 210, 211, 29, 98, 103,
613 99, 104, 102, 20, 21, 22, 23, 24, 25, 26,
614 27, 110, 63, 100, 105, 29, 89, 101, 109, 114,
615 106, 20, 21, 22, 23, 117, 20, 21, 22, 23,
616 118, 111, 40, 41, 42, 43, 44, 199, 45, 46,
617 47, 48, 49, 50, 51, 52, 53, 119, 54, 75,
618 41, 42, 43, 44, 134, 45, 46, 47, 48, 49,
619 50, 51, 52, 76, 135, 54, 40, 41, 42, 43,
620 44, 136, 45, 46, 47, 48, 49, 50, 51, 52,
621 53, 111, 54, 137, 138, 42, 43, 44, 146, 45,
622 46, 47, 48, 49, 50, 51, 52, 139, 110, 54,
623 75, 41, 42, 43, 44, 150, 45, 46, 47, 48,
624 49, 50, 51, 52, 172, 152, 54, 80, 41, 124,
625 121, 165, 166, 45, 46, 47, 48, 49, 50, 51,
626 52, 86, 41, 54, 167, 170, 168, 45, 46, 47,
627 48, 49, 50, 51, 52, 75, 41, 54, -105, 175,
628 176, 45, 46, 47, 48, 49, 50, 51, 52, 13,
629 177, 54, 180, 181, 183, 13, 184, 186, 13, 2,
630 3, 4, 5, 6, 7, 185, 187, 188, 189, 190,
631 197, 191, 201, 213, 225, 233, 203, 234, 204, 218,
632 205, 212, 223, 239, 236, 262, 263, 14, 238, 64,
633 164, 241, 246, 133, 0, 156, 163, 253, 200, 249,
637 static const short yycheck[] = { 124,
638 25, 40, 40, 123, 5, 186, 25, 32, 21, 26,
639 191, 198, 5, 19, 20, 54, 136, 19, 4, 206,
640 59, 37, 209, 204, 19, 20, 5, 19, 19, 20,
641 55, 37, 152, 220, 19, 37, 75, 218, 21, 40,
642 65, 80, 61, 49, 45, 39, 37, 86, 235, 66,
643 42, 44, 89, 90, 49, 236, 41, 238, 49, 22,
644 180, 19, 20, 39, 251, 252, 19, 92, 19, 22,
645 89, 19, 20, 84, 39, 112, 39, 114, 231, 19,
646 19, 20, 119, 203, 42, 205, 39, 240, 39, 42,
647 3, 49, 117, 37, 42, 120, 107, 41, 137, 137,
648 40, 49, 42, 228, 229, 39, 46, 47, 48, 134,
649 23, 24, 25, 26, 27, 28, 241, 242, 19, 244,
650 19, 246, 5, 6, 7, 8, 9, 19, 11, 12,
651 13, 14, 15, 16, 17, 18, 19, 40, 21, 40,
652 19, 42, 45, 40, 40, 46, 47, 48, 45, 45,
653 42, 34, 35, 19, 46, 47, 48, 5, 6, 7,
654 8, 9, 19, 11, 12, 13, 14, 15, 16, 17,
655 18, 19, 10, 21, 44, 19, 14, 174, 19, 21,
656 19, 29, 30, 31, 32, 29, 30, 31, 32, 33,
657 34, 35, 36, 19, 38, 192, 193, 41, 19, 19,
658 40, 19, 39, 29, 30, 31, 32, 33, 34, 35,
659 36, 19, 38, 43, 19, 41, 19, 40, 5, 19,
660 39, 29, 30, 31, 32, 40, 29, 30, 31, 32,
661 19, 39, 5, 6, 7, 8, 9, 10, 11, 12,
662 13, 14, 15, 16, 17, 18, 19, 19, 21, 5,
663 6, 7, 8, 9, 19, 11, 12, 13, 14, 15,
664 16, 17, 18, 19, 19, 21, 5, 6, 7, 8,
665 9, 39, 11, 12, 13, 14, 15, 16, 17, 18,
666 19, 39, 21, 5, 6, 7, 8, 9, 19, 11,
667 12, 13, 14, 15, 16, 17, 18, 19, 19, 21,
668 5, 6, 7, 8, 9, 19, 11, 12, 13, 14,
669 15, 16, 17, 18, 19, 39, 21, 5, 6, 42,
670 19, 41, 40, 11, 12, 13, 14, 15, 16, 17,
671 18, 5, 6, 21, 40, 37, 23, 11, 12, 13,
672 14, 15, 16, 17, 18, 5, 6, 21, 40, 19,
673 40, 11, 12, 13, 14, 15, 16, 17, 18, 9,
674 45, 21, 39, 19, 19, 15, 23, 40, 18, 23,
675 24, 25, 26, 27, 28, 41, 23, 20, 40, 23,
676 19, 40, 19, 19, 19, 23, 39, 19, 40, 40,
677 39, 39, 37, 23, 40, 0, 0, 9, 40, 30,
678 126, 42, 42, 100, -1, 122, 125, 41, 177, 234,
681 /* -*-C-*- Note some compilers choke on comments on `#line' lines. */
682 #line 3 "/usr/lib/bison.simple"
683 /* This file comes from bison-1.28. */
685 /* Skeleton output parser for bison,
686 Copyright (C) 1984, 1989, 1990 Free Software Foundation, Inc.
688 This program is free software; you can redistribute it and/or modify
689 it under the terms of the GNU General Public License as published by
690 the Free Software Foundation; either version 2, or (at your option)
693 This program is distributed in the hope that it will be useful,
694 but WITHOUT ANY WARRANTY; without even the implied warranty of
695 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
696 GNU General Public License for more details.
698 You should have received a copy of the GNU General Public License
699 along with this program; if not, write to the Free Software
700 Foundation, Inc., 59 Temple Place - Suite 330,
701 Boston, MA 02111-1307, USA. */
703 /* As a special exception, when this file is copied by Bison into a
704 Bison output file, you may use that output file without restriction.
705 This special exception was added by the Free Software Foundation
706 in version 1.24 of Bison. */
708 /* This is the parser code that is written into each bison parser
709 when the %semantic_parser declaration is not specified in the grammar.
710 It was written by Richard Stallman by simplifying the hairy parser
711 used when %semantic_parser is specified. */
713 #ifndef YYSTACK_USE_ALLOCA
715 #define YYSTACK_USE_ALLOCA
716 #else /* alloca not defined */
718 #define YYSTACK_USE_ALLOCA
719 #define alloca __builtin_alloca
720 #else /* not GNU C. */
721 #if (!defined (__STDC__) && defined (sparc)) || defined (__sparc__) || defined (__sparc) || defined (__sgi) || (defined (__sun) && defined (__i386))
722 #define YYSTACK_USE_ALLOCA
724 #else /* not sparc */
725 /* We think this test detects Watcom and Microsoft C. */
726 /* This used to test MSDOS, but that is a bad idea
727 since that symbol is in the user namespace. */
728 #if (defined (_MSDOS) || defined (_MSDOS_)) && !defined (__TURBOC__)
729 #if 0 /* No need for malloc.h, which pollutes the namespace;
730 instead, just don't use alloca. */
733 #else /* not MSDOS, or __TURBOC__ */
735 /* I don't know what this was needed for, but it pollutes the namespace.
736 So I turned it off. rms, 2 May 1997. */
737 /* #include <malloc.h> */
739 #define YYSTACK_USE_ALLOCA
740 #else /* not MSDOS, or __TURBOC__, or _AIX */
742 #ifdef __hpux /* haible@ilog.fr says this works for HPUX 9.05 and up,
743 and on HPUX 10. Eventually we can turn this on. */
744 #define YYSTACK_USE_ALLOCA
745 #define alloca __builtin_alloca
748 #endif /* not _AIX */
749 #endif /* not MSDOS, or __TURBOC__ */
750 #endif /* not sparc */
751 #endif /* not GNU C */
752 #endif /* alloca not defined */
753 #endif /* YYSTACK_USE_ALLOCA not defined */
755 #ifdef YYSTACK_USE_ALLOCA
756 #define YYSTACK_ALLOC alloca
758 #define YYSTACK_ALLOC malloc
761 /* Note: there must be only one dollar sign in this file.
762 It is replaced by the list of actions, each action
763 as one case of the switch. */
765 #define yyerrok (yyerrstatus = 0)
766 #define yyclearin (yychar = YYEMPTY)
769 #define YYACCEPT goto yyacceptlab
770 #define YYABORT goto yyabortlab
771 #define YYERROR goto yyerrlab1
772 /* Like YYERROR except do call yyerror.
773 This remains here temporarily to ease the
774 transition to the new meaning of YYERROR, for GCC.
775 Once GCC version 2 has supplanted version 1, this can go. */
776 #define YYFAIL goto yyerrlab
777 #define YYRECOVERING() (!!yyerrstatus)
778 #define YYBACKUP(token, value) \
780 if (yychar == YYEMPTY && yylen == 1) \
781 { yychar = (token), yylval = (value); \
782 yychar1 = YYTRANSLATE (yychar); \
787 { yyerror ("syntax error: cannot back up"); YYERROR; } \
791 #define YYERRCODE 256
794 #define YYLEX yylex()
800 #define YYLEX yylex(&yylval, &yylloc, YYLEX_PARAM)
802 #define YYLEX yylex(&yylval, &yylloc)
804 #else /* not YYLSP_NEEDED */
806 #define YYLEX yylex(&yylval, YYLEX_PARAM)
808 #define YYLEX yylex(&yylval)
810 #endif /* not YYLSP_NEEDED */
813 /* If nonreentrant, generate the variables here */
817 int yychar; /* the lookahead symbol */
818 YYSTYPE yylval; /* the semantic value of the */
819 /* lookahead symbol */
822 YYLTYPE yylloc; /* location data for the lookahead */
826 int yynerrs; /* number of parse errors so far */
827 #endif /* not YYPURE */
830 int yydebug; /* nonzero means print parse trace */
831 /* Since this is uninitialized, it does not stop multiple parsers
835 /* YYINITDEPTH indicates the initial size of the parser's stacks */
838 #define YYINITDEPTH 200
841 /* YYMAXDEPTH is the maximum size the stacks can grow to
842 (effective only if the built-in stack extension method is used). */
849 #define YYMAXDEPTH 10000
852 /* Define __yy_memcpy. Note that the size argument
853 should be passed with type unsigned int, because that is what the non-GCC
854 definitions require. With GCC, __builtin_memcpy takes an arg
855 of type size_t, but it can handle unsigned int. */
857 #if __GNUC__ > 1 /* GNU C and GNU C++ define this. */
858 #define __yy_memcpy(TO,FROM,COUNT) __builtin_memcpy(TO,FROM,COUNT)
859 #else /* not GNU C or C++ */
862 /* This is the most reliable way to avoid incompatibilities
863 in available built-in functions on various systems. */
865 __yy_memcpy (to, from, count)
870 register char *f = from;
871 register char *t = to;
872 register int i = count;
878 #else /* __cplusplus */
880 /* This is the most reliable way to avoid incompatibilities
881 in available built-in functions on various systems. */
883 __yy_memcpy (char *to, char *from, unsigned int count)
885 register char *t = to;
886 register char *f = from;
887 register int i = count;
896 #line 217 "/usr/lib/bison.simple"
898 /* The user can define YYPARSE_PARAM as the name of an argument to be passed
899 into yyparse. The argument should have type void *.
900 It should actually point to an object.
901 Grammar actions can access the variable by casting it
902 to the proper pointer type. */
906 #define YYPARSE_PARAM_ARG void *YYPARSE_PARAM
907 #define YYPARSE_PARAM_DECL
908 #else /* not __cplusplus */
909 #define YYPARSE_PARAM_ARG YYPARSE_PARAM
910 #define YYPARSE_PARAM_DECL void *YYPARSE_PARAM;
911 #endif /* not __cplusplus */
912 #else /* not YYPARSE_PARAM */
913 #define YYPARSE_PARAM_ARG
914 #define YYPARSE_PARAM_DECL
915 #endif /* not YYPARSE_PARAM */
917 /* Prevent warning if -Wstrict-prototypes. */
920 int yyparse (void *);
927 yyparse(YYPARSE_PARAM_ARG)
930 register int yystate;
932 register short *yyssp;
933 register YYSTYPE *yyvsp;
934 int yyerrstatus; /* number of tokens to shift before error messages enabled */
935 int yychar1 = 0; /* lookahead token as an internal (translated) token number */
937 short yyssa[YYINITDEPTH]; /* the state stack */
938 YYSTYPE yyvsa[YYINITDEPTH]; /* the semantic value stack */
940 short *yyss = yyssa; /* refer to the stacks thru separate pointers */
941 YYSTYPE *yyvs = yyvsa; /* to allow yyoverflow to reallocate them elsewhere */
944 YYLTYPE yylsa[YYINITDEPTH]; /* the location stack */
945 YYLTYPE *yyls = yylsa;
948 #define YYPOPSTACK (yyvsp--, yyssp--, yylsp--)
950 #define YYPOPSTACK (yyvsp--, yyssp--)
953 int yystacksize = YYINITDEPTH;
954 int yyfree_stacks = 0;
965 YYSTYPE yyval; /* the variable used to return */
966 /* semantic values from the action */
973 fprintf(stderr, "Starting parse\n");
979 yychar = YYEMPTY; /* Cause a token to be read. */
981 /* Initialize stack pointers.
982 Waste one element of value and location stack
983 so that they stay on the same level as the state stack.
984 The wasted elements are never initialized. */
992 /* Push a new state, which is found in yystate . */
993 /* In all cases, when you get here, the value and location stacks
994 have just been pushed. so pushing a state here evens the stacks. */
999 if (yyssp >= yyss + yystacksize - 1)
1001 /* Give user a chance to reallocate the stack */
1002 /* Use copies of these so that the &'s don't force the real ones into memory. */
1003 YYSTYPE *yyvs1 = yyvs;
1004 short *yyss1 = yyss;
1006 YYLTYPE *yyls1 = yyls;
1009 /* Get the current used size of the three stacks, in elements. */
1010 int size = yyssp - yyss + 1;
1013 /* Each stack pointer address is followed by the size of
1014 the data in use in that stack, in bytes. */
1016 /* This used to be a conditional around just the two extra args,
1017 but that might be undefined if yyoverflow is a macro. */
1018 yyoverflow("parser stack overflow",
1019 &yyss1, size * sizeof (*yyssp),
1020 &yyvs1, size * sizeof (*yyvsp),
1021 &yyls1, size * sizeof (*yylsp),
1024 yyoverflow("parser stack overflow",
1025 &yyss1, size * sizeof (*yyssp),
1026 &yyvs1, size * sizeof (*yyvsp),
1030 yyss = yyss1; yyvs = yyvs1;
1034 #else /* no yyoverflow */
1035 /* Extend the stack our own way. */
1036 if (yystacksize >= YYMAXDEPTH)
1038 yyerror("parser stack overflow");
1050 if (yystacksize > YYMAXDEPTH)
1051 yystacksize = YYMAXDEPTH;
1052 #ifndef YYSTACK_USE_ALLOCA
1055 yyss = (short *) YYSTACK_ALLOC (yystacksize * sizeof (*yyssp));
1056 __yy_memcpy ((char *)yyss, (char *)yyss1,
1057 size * (unsigned int) sizeof (*yyssp));
1058 yyvs = (YYSTYPE *) YYSTACK_ALLOC (yystacksize * sizeof (*yyvsp));
1059 __yy_memcpy ((char *)yyvs, (char *)yyvs1,
1060 size * (unsigned int) sizeof (*yyvsp));
1062 yyls = (YYLTYPE *) YYSTACK_ALLOC (yystacksize * sizeof (*yylsp));
1063 __yy_memcpy ((char *)yyls, (char *)yyls1,
1064 size * (unsigned int) sizeof (*yylsp));
1066 #endif /* no yyoverflow */
1068 yyssp = yyss + size - 1;
1069 yyvsp = yyvs + size - 1;
1071 yylsp = yyls + size - 1;
1076 fprintf(stderr, "Stack size increased to %d\n", yystacksize);
1079 if (yyssp >= yyss + yystacksize - 1)
1085 fprintf(stderr, "Entering state %d\n", yystate);
1091 /* Do appropriate processing given the current state. */
1092 /* Read a lookahead token if we need one and don't already have one. */
1095 /* First try to decide what to do without reference to lookahead token. */
1097 yyn = yypact[yystate];
1101 /* Not known => get a lookahead token if don't already have one. */
1103 /* yychar is either YYEMPTY or YYEOF
1104 or a valid token in external form. */
1106 if (yychar == YYEMPTY)
1110 fprintf(stderr, "Reading a token: ");
1115 /* Convert token to internal form (in yychar1) for indexing tables with */
1117 if (yychar <= 0) /* This means end of input. */
1120 yychar = YYEOF; /* Don't call YYLEX any more */
1124 fprintf(stderr, "Now at end of input.\n");
1129 yychar1 = YYTRANSLATE(yychar);
1134 fprintf (stderr, "Next token is %d (%s", yychar, yytname[yychar1]);
1135 /* Give the individual parser a way to print the precise meaning
1136 of a token, for further debugging info. */
1138 YYPRINT (stderr, yychar, yylval);
1140 fprintf (stderr, ")\n");
1146 if (yyn < 0 || yyn > YYLAST || yycheck[yyn] != yychar1)
1151 /* yyn is what to do for this token type in this state.
1152 Negative => reduce, -yyn is rule number.
1153 Positive => shift, yyn is new state.
1154 New state is final state => don't bother to shift,
1155 just return success.
1156 0, or most negative number => error. */
1171 /* Shift the lookahead token. */
1175 fprintf(stderr, "Shifting token %d (%s), ", yychar, yytname[yychar1]);
1178 /* Discard the token being shifted unless it is eof. */
1179 if (yychar != YYEOF)
1187 /* count tokens shifted since error; after three, turn off error status. */
1188 if (yyerrstatus) yyerrstatus--;
1193 /* Do the default action for the current state. */
1196 yyn = yydefact[yystate];
1200 /* Do a reduction. yyn is the number of a rule to reduce with. */
1204 yyval = yyvsp[1-yylen]; /* implement default value of the action */
1211 fprintf (stderr, "Reducing via rule %d (line %d), ",
1214 /* Print the symbols being reduced, and their result. */
1215 for (i = yyprhs[yyn]; yyrhs[i] > 0; i++)
1216 fprintf (stderr, "%s ", yytname[yyrhs[i]]);
1217 fprintf (stderr, " -> %s\n", yytname[yyr1[yyn]]);
1243 Node *node = new_ccode(C_CCODE,(yyvsp[0].cbuf)->str,
1245 nodes = g_list_append(nodes,node);
1246 g_string_free(yyvsp[0].cbuf,FALSE);
1252 Node *node = new_ccode(H_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(HT_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(PH_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(A_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(AT_CCODE,(yyvsp[0].cbuf)->str,
1290 nodes = g_list_append(nodes,node);
1291 g_string_free(yyvsp[0].cbuf,FALSE);
1305 ((Class *)class)->nodes = class_nodes;
1307 nodes = g_list_append(nodes,class);
1313 ((Class *)class)->nodes = NULL;
1315 nodes = g_list_append(nodes,class);
1321 class = new_class(yyvsp[-3].id,yyvsp[-1].id,chunk_size,NULL);
1327 if(strcmp(yyvsp[-2].id,"chunks") == 0) {
1328 chunk_size = g_strdup(yyvsp[0].id);
1330 yyerror(_("parse error"));
1338 if(strcmp(yyvsp[-2].id,"chunks") == 0) {
1339 if(atoi(yyvsp[0].id) != 0)
1340 chunk_size = g_strdup(yyvsp[0].id);
1342 yyerror(_("parse error"));
1373 { the_scope = PUBLIC_SCOPE; ;
1377 { the_scope = PRIVATE_SCOPE; ;
1381 { the_scope = PROTECTED_SCOPE; ;
1385 { the_scope = CLASS_SCOPE; ;
1390 if(strcmp(yyvsp[-1].id, "destroywith")==0) {
1391 g_free(yyvsp[-1].id);
1392 destructor = yyvsp[0].id;
1393 destructor_line = line_no;
1394 destructor_simple = TRUE;
1396 g_free(yyvsp[-1].id);
1397 g_free(yyvsp[0].id);
1398 yyerror(_("parse error"));
1406 if(strcmp(yyvsp[-2].id, "destroy")==0) {
1407 g_free(yyvsp[-2].id);
1408 destructor = (yyvsp[0].cbuf)->str;
1409 g_string_free(yyvsp[0].cbuf, FALSE);
1410 destructor_line = ccode_line;
1411 destructor_simple = FALSE;
1413 g_free(yyvsp[-2].id);
1414 g_string_free(yyvsp[0].cbuf, TRUE);
1415 yyerror(_("parse error"));
1423 initializer = yyvsp[0].id;
1424 initializer_line = ccode_line;
1430 initializer = (yyvsp[0].cbuf)->str;
1431 initializer_line = ccode_line;
1432 g_string_free(yyvsp[0].cbuf, FALSE);
1445 { destructor = NULL; ;
1449 { initializer = NULL; ;
1461 push_variable(yyvsp[-2].id, the_scope,yyvsp[-4].line, NULL);
1467 push_variable(yyvsp[-3].id, the_scope, yyvsp[-5].line, yyvsp[-2].id);
1473 if(strcmp(yyvsp[-6].id,"get")==0 &&
1474 strcmp(yyvsp[-3].id,"set")==0) {
1476 Type *type = pop_type();
1477 g_free(yyvsp[-6].id); g_free(yyvsp[-3].id);
1478 node = new_argument(yyvsp[-8].id,type,yyvsp[-9].list,yyvsp[-7].id,
1479 (yyvsp[-4].cbuf)->str,yyvsp[-5].line,
1480 (yyvsp[-1].cbuf)->str,yyvsp[-2].line,
1482 g_string_free(yyvsp[-4].cbuf,FALSE);
1483 g_string_free(yyvsp[-1].cbuf,FALSE);
1484 class_nodes = g_list_append(class_nodes,node);
1485 } else if(strcmp(yyvsp[-6].id,"set")==0 &&
1486 strcmp(yyvsp[-3].id,"get")==0) {
1488 Type *type = pop_type();
1489 g_free(yyvsp[-6].id); g_free(yyvsp[-3].id);
1490 node = new_argument(yyvsp[-8].id,type,yyvsp[-9].list,yyvsp[-7].id,
1491 (yyvsp[-1].cbuf)->str,yyvsp[-2].line,
1492 (yyvsp[-4].cbuf)->str,yyvsp[-5].line,
1494 g_string_free(yyvsp[-1].cbuf,FALSE);
1495 g_string_free(yyvsp[-4].cbuf,FALSE);
1496 class_nodes = g_list_append(class_nodes,node);
1498 g_free(yyvsp[-8].id); g_free(yyvsp[-7].id);
1499 g_free(yyvsp[-6].id); g_free(yyvsp[-3].id);
1500 g_list_foreach(yyvsp[-9].list,(GFunc)g_free,NULL);
1501 g_list_free(yyvsp[-9].list);
1502 g_string_free(yyvsp[-1].cbuf,TRUE);
1503 g_string_free(yyvsp[-4].cbuf,TRUE);
1504 yyerror(_("parse error"));
1512 if(strcmp(yyvsp[-3].id, "get") == 0) {
1514 Type *type = pop_type();
1515 g_free(yyvsp[-3].id);
1516 node = new_argument(yyvsp[-5].id, type, yyvsp[-6].list, yyvsp[-4].id,
1517 (yyvsp[-1].cbuf)->str, yyvsp[-2].line,
1518 NULL, 0, yyvsp[-7].line);
1519 g_string_free(yyvsp[-1].cbuf, FALSE);
1520 class_nodes = g_list_append(class_nodes, node);
1521 } else if(strcmp(yyvsp[-3].id, "set") == 0) {
1523 Type *type = pop_type();
1524 g_free(yyvsp[-3].id);
1525 node = new_argument(yyvsp[-5].id, type, yyvsp[-6].list, yyvsp[-4].id,
1526 NULL, 0, (yyvsp[-1].cbuf)->str,
1527 yyvsp[-2].line, yyvsp[-7].line);
1528 g_string_free(yyvsp[-1].cbuf, FALSE);
1529 class_nodes = g_list_append(class_nodes, node);
1531 g_free(yyvsp[-3].id); g_free(yyvsp[-5].id);
1532 g_free(yyvsp[-4].id);
1533 g_list_foreach(yyvsp[-6].list, (GFunc)g_free, NULL);
1534 g_list_free(yyvsp[-6].list);
1535 g_string_free(yyvsp[-1].cbuf, TRUE);
1536 yyerror(_("parse error"));
1545 char *get, *set = NULL;
1550 if(strcmp(yyvsp[0].id, "link")!=0 &&
1551 strcmp(yyvsp[0].id, "stringlink")!=0 &&
1552 strcmp(yyvsp[0].id, "objectlink")!=0) {
1553 g_free(yyvsp[0].id); g_free(yyvsp[-2].id);
1554 g_free(yyvsp[-1].id);
1555 g_list_foreach(yyvsp[-3].list,(GFunc)g_free,NULL);
1556 g_list_free(yyvsp[-3].list);
1557 yyerror(_("parse error"));
1563 var = find_var_or_die(yyvsp[-1].id, yyvsp[-4].line);
1564 if(var->scope == PRIVATE_SCOPE)
1565 root = "self->_priv";
1566 else if(var->scope == CLASS_SCOPE) {
1567 root = "SELF_GET_CLASS(self)";
1569 error_print(GOB_ERROR, yyvsp[-4].line,
1570 _("Self aliases needed when autolinking to a classwide member"));
1574 if(strcmp(yyvsp[0].id, "link")==0) {
1575 set = g_strdup_printf("%s->%s = ARG;",
1576 root, yyvsp[-1].id);
1577 } else if(strcmp(yyvsp[0].id, "stringlink")==0) {
1578 set = g_strdup_printf("g_free(%s->%s); "
1579 "%s->%s = g_strdup(ARG);",
1581 root, yyvsp[-1].id);
1582 } else if(strcmp(yyvsp[0].id, "objectlink")==0) {
1583 set = g_strdup_printf(
1585 "gtk_object_unref(GTK_OBJECT(%s->%s)); "
1588 "gtk_object_ref(GTK_OBJECT(%s->%s));",
1593 root, yyvsp[-1].id);
1595 g_assert_not_reached();
1598 if(strcmp(yyvsp[0].id, "stringlink")==0) {
1599 get = g_strdup_printf("ARG = g_strdup(%s->%s);", root, yyvsp[-1].id);
1601 /* For everything else, get is just straight assignment */
1602 get = g_strdup_printf("ARG = %s->%s;", root, yyvsp[-1].id);
1604 g_free(yyvsp[0].id);
1608 type = copy_type(var->vtype);
1610 node = new_argument(yyvsp[-2].id, type, yyvsp[-3].list,
1611 yyvsp[-1].id, get, yyvsp[-4].line,
1612 set, yyvsp[-4].line, yyvsp[-4].line);
1613 class_nodes = g_list_append(class_nodes,node);
1619 if(strcmp(yyvsp[-2].id,"type")!=0) {
1620 g_free(yyvsp[-4].id);
1621 g_free(yyvsp[-2].id);
1622 yyerror(_("parse error"));
1625 yyval.id = yyvsp[-4].id;
1631 yyval.id = yyvsp[0].id;
1632 typestack = g_list_prepend(typestack,NULL);
1637 { yyval.list = yyvsp[-1].list; ;
1641 { yyval.list = NULL; ;
1646 yyval.list = g_list_append(yyvsp[0].list,yyvsp[-2].id);
1652 yyval.list = g_list_append(NULL,yyvsp[0].id);
1658 Node *node = new_type(yyvsp[-1].id, yyvsp[0].id, NULL);
1659 typestack = g_list_prepend(typestack,node);
1665 Node *node = new_type(yyvsp[0].id, NULL, NULL);
1666 typestack = g_list_prepend(typestack,node);
1672 yyval.id = yyvsp[0].id;
1678 yyval.id = yyvsp[0].id;
1684 yyval.id = g_strconcat("const ", yyvsp[0].id, NULL);
1685 g_free(yyvsp[0].id);
1691 yyval.id = g_strconcat(yyvsp[-1].id, " const", NULL);
1692 g_free(yyvsp[-1].id);
1698 yyval.id = g_strconcat(yyvsp[-1].id, " ", yyvsp[0].id, NULL);
1699 g_free(yyvsp[0].id);
1705 yyval.id = g_strconcat("const ", yyvsp[-1].id, " ",
1707 g_free(yyvsp[0].id);
1713 yyval.id = g_strconcat(yyvsp[-2].id, " ",
1714 yyvsp[-1].id, " const", NULL);
1715 g_free(yyvsp[-1].id);
1721 yyval.id = g_strconcat(yyvsp[-1].id, " ", yyvsp[0].id, NULL);
1722 g_free(yyvsp[0].id);
1728 yyval.id = g_strconcat(yyvsp[-1].id, " ", yyvsp[0].id, NULL);
1729 g_free(yyvsp[-1].id);
1730 g_free(yyvsp[0].id);
1736 yyval.id = g_strconcat("const ", yyvsp[0].id, NULL);
1737 g_free(yyvsp[0].id);
1743 yyval.id = yyvsp[0].id;
1749 yyval.id = g_strconcat(yyvsp[-1].id, " const", NULL);
1750 g_free(yyvsp[-1].id);
1756 yyval.id = g_strdup(yyvsp[0].id);
1762 yyval.id = g_strconcat(yyvsp[-1].id, " const", NULL);
1767 { yyval.id = "void"; ;
1771 { yyval.id = "char"; ;
1775 { yyval.id = "short"; ;
1779 { yyval.id = "int"; ;
1783 { yyval.id = "long"; ;
1787 { yyval.id = "float"; ;
1791 { yyval.id = "double"; ;
1795 { yyval.id = "signed"; ;
1799 { yyval.id = "unsigned"; ;
1803 { yyval.id = "struct"; ;
1807 { yyval.id = "union"; ;
1811 { yyval.id = "enum"; ;
1815 { yyval.id = g_strdup("*"); ;
1819 { yyval.id = g_strdup("* const"); ;
1824 yyval.id = g_strconcat("*", yyvsp[0].id, NULL);
1825 g_free(yyvsp[0].id);
1831 yyval.id = g_strconcat("* const", yyvsp[0].id, NULL);
1832 g_free(yyvsp[0].id);
1838 if(strcmp(yyvsp[-1].id, "first")==0)
1839 yyval.sigtype = SIGNAL_FIRST_METHOD;
1840 else if(strcmp(yyvsp[-1].id, "last")==0)
1841 yyval.sigtype = SIGNAL_LAST_METHOD;
1843 yyerror(_("signal must be 'first' or 'last'"));
1844 g_free(yyvsp[-1].id);
1847 g_free(yyvsp[-1].id);
1853 yyval.sigtype = SIGNAL_LAST_METHOD;
1859 if(strcmp(yyvsp[-1].id,"first")==0)
1860 yyval.sigtype = SIGNAL_FIRST_METHOD;
1861 else if(strcmp(yyvsp[-1].id,"last")==0)
1862 yyval.sigtype = SIGNAL_LAST_METHOD;
1864 yyerror(_("signal must be 'first' or 'last'"));
1865 g_free(yyvsp[-1].id);
1868 g_free(yyvsp[-1].id);
1874 if(strcmp(yyvsp[-2].id,"first")==0)
1875 yyval.sigtype = SIGNAL_FIRST_METHOD;
1876 else if(strcmp(yyvsp[-2].id,"last")==0)
1877 yyval.sigtype = SIGNAL_LAST_METHOD;
1879 yyerror(_("signal must be 'first' or 'last'"));
1880 g_free(yyvsp[-2].id);
1883 g_free(yyvsp[-2].id);
1889 yyval.sigtype = SIGNAL_LAST_METHOD;
1895 /* the_scope was default thus public */
1896 the_scope = PUBLIC_SCOPE;
1902 gtktypes = g_list_prepend(gtktypes, yyvsp[-3].id);
1908 gtktypes = g_list_append(gtktypes, yyvsp[0].id);
1914 gtktypes = g_list_append(gtktypes, yyvsp[0].id);
1919 { yyval.cbuf = yyvsp[0].cbuf; ;
1923 { yyval.cbuf = NULL; ;
1929 yyerror(_("signal without 'self' as "
1930 "first parameter"));
1931 free_all_global_state();
1934 if(the_scope == CLASS_SCOPE) {
1935 yyerror(_("a method cannot be of class scope"));
1936 free_all_global_state();
1939 push_function(the_scope, yyvsp[-7].sigtype,NULL,
1940 yyvsp[-5].id, yyvsp[0].cbuf,yyvsp[-9].line,
1941 ccode_line, vararg, yyvsp[-8].list);
1948 yyerror(_("signal without 'self' as "
1949 "first parameter"));
1950 free_all_global_state();
1953 if(the_scope == CLASS_SCOPE) {
1954 yyerror(_("a method cannot be of class scope"));
1955 free_all_global_state();
1958 push_function(the_scope, yyvsp[-7].sigtype, NULL,
1959 yyvsp[-5].id, yyvsp[0].cbuf, yyvsp[-9].line,
1960 ccode_line, vararg, yyvsp[-8].list);
1967 yyerror(_("virtual method without 'self' as "
1968 "first parameter"));
1969 free_all_global_state();
1972 if(the_scope == CLASS_SCOPE) {
1973 yyerror(_("a method cannot be of class scope"));
1974 free_all_global_state();
1977 push_function(the_scope, VIRTUAL_METHOD, NULL, yyvsp[-5].id,
1978 yyvsp[0].cbuf, yyvsp[-8].line,
1979 ccode_line, vararg, NULL);
1986 yyerror(_("virtual method without 'self' as "
1987 "first parameter"));
1988 free_all_global_state();
1991 if(the_scope == CLASS_SCOPE) {
1992 yyerror(_("a method cannot be of class scope"));
1993 free_all_global_state();
1996 push_function(the_scope, VIRTUAL_METHOD, NULL, yyvsp[-5].id,
1997 yyvsp[0].cbuf, yyvsp[-7].line,
1998 ccode_line, vararg, NULL);
2005 yyerror(_("virtual method without 'self' as "
2006 "first parameter"));
2007 free_all_global_state();
2010 push_function(PUBLIC_SCOPE, VIRTUAL_METHOD, NULL,
2011 yyvsp[-5].id, yyvsp[0].cbuf, yyvsp[-7].line,
2012 ccode_line, vararg, NULL);
2018 push_function(NO_SCOPE, OVERRIDE_METHOD, yyvsp[-8].id,
2019 yyvsp[-5].id, yyvsp[0].cbuf,
2020 yyvsp[-10].line, ccode_line,
2027 if(the_scope == CLASS_SCOPE) {
2028 yyerror(_("a method cannot be of class scope"));
2029 free_all_global_state();
2032 push_function(the_scope, REGULAR_METHOD, NULL, yyvsp[-5].id,
2033 yyvsp[0].cbuf, yyvsp[-7].line, ccode_line,
2040 if(strcmp(yyvsp[-4].id, "init")==0) {
2041 push_init_arg(yyvsp[-2].id,FALSE);
2042 push_function(NO_SCOPE, INIT_METHOD, NULL,
2043 yyvsp[-4].id, yyvsp[0].cbuf, yyvsp[-3].line,
2044 ccode_line, FALSE, NULL);
2045 } else if(strcmp(yyvsp[-4].id, "class_init")==0) {
2046 push_init_arg(yyvsp[-2].id,TRUE);
2047 push_function(NO_SCOPE, CLASS_INIT_METHOD, NULL,
2048 yyvsp[-4].id, yyvsp[0].cbuf, yyvsp[-3].line,
2049 ccode_line, FALSE, NULL);
2051 g_free(yyvsp[-4].id);
2052 g_free(yyvsp[-2].id);
2053 g_string_free(yyvsp[0].cbuf,TRUE);
2054 yyerror(_("parse error "
2055 "(untyped blocks must be init or "
2064 g_free(onerror); onerror = NULL;
2065 g_free(defreturn); defreturn = NULL;
2066 if(!set_return_value(yyvsp[-1].id, yyvsp[0].id)) {
2067 g_free(yyvsp[-1].id);
2068 g_free(yyvsp[0].id);
2069 yyerror(_("parse error"));
2072 g_free(yyvsp[-1].id);
2078 g_free(onerror); onerror = NULL;
2079 g_free(defreturn); defreturn = NULL;
2080 if(!set_return_value(yyvsp[-3].id, yyvsp[-2].id)) {
2081 g_free(yyvsp[-3].id); g_free(yyvsp[-2].id);
2082 g_free(yyvsp[-1].id); g_free(yyvsp[0].id);
2083 yyerror(_("parse error"));
2086 if(!set_return_value(yyvsp[-1].id, yyvsp[0].id)) {
2087 onerror = defreturn = NULL;
2088 g_free(yyvsp[-3].id); g_free(yyvsp[-2].id);
2089 g_free(yyvsp[-1].id); g_free(yyvsp[0].id);
2090 yyerror(_("parse error"));
2093 g_free(yyvsp[-3].id);
2094 g_free(yyvsp[-1].id);
2100 g_free(onerror); onerror = NULL;
2101 g_free(defreturn); defreturn = NULL;
2106 { yyval.id = yyvsp[0].id; ;
2111 yyval.id = (yyvsp[1].cbuf)->str;
2112 g_string_free(yyvsp[1].cbuf, FALSE);
2117 { vararg = FALSE; has_self = FALSE; ;
2124 if(strcmp(yyvsp[0].id,"self")==0)
2125 push_self(yyvsp[0].id, FALSE);
2127 g_free(yyvsp[0].id);
2128 yyerror(_("parse error"));
2138 if(strcmp(yyvsp[-1].id,"self")==0)
2139 push_self(yyvsp[-1].id, TRUE);
2141 g_free(yyvsp[-1].id);
2142 yyerror(_("parse error"));
2152 if(strcmp(yyvsp[0].id,"self")==0)
2153 push_self(yyvsp[0].id, TRUE);
2155 g_free(yyvsp[0].id);
2156 yyerror(_("parse error"));
2165 if(strcmp(yyvsp[-2].id,"self")==0)
2166 push_self(yyvsp[-2].id, FALSE);
2168 g_free(yyvsp[-2].id);
2169 yyerror(_("parse error"));
2175 #line 1006 "parse.y"
2178 if(strcmp(yyvsp[-3].id,"self")==0)
2179 push_self(yyvsp[-3].id, TRUE);
2181 g_free(yyvsp[-3].id);
2182 yyerror(_("parse error"));
2188 #line 1016 "parse.y"
2191 if(strcmp(yyvsp[-2].id,"self")==0)
2192 push_self(yyvsp[-2].id, TRUE);
2194 g_free(yyvsp[-2].id);
2195 yyerror(_("parse error"));
2201 #line 1026 "parse.y"
2202 { has_self = FALSE; ;
2205 #line 1029 "parse.y"
2209 #line 1030 "parse.y"
2213 #line 1033 "parse.y"
2217 #line 1034 "parse.y"
2221 #line 1037 "parse.y"
2223 push_funcarg(yyvsp[0].id,NULL);
2227 #line 1040 "parse.y"
2229 push_funcarg(yyvsp[-1].id,yyvsp[0].id);
2233 #line 1043 "parse.y"
2235 if(strcmp(yyvsp[-2].id,"check")!=0) {
2236 yyerror(_("parse error"));
2239 g_free(yyvsp[-2].id);
2240 push_funcarg(yyvsp[-4].id,NULL);
2244 #line 1051 "parse.y"
2246 if(strcmp(yyvsp[-2].id,"check")!=0) {
2247 yyerror(_("parse error"));
2250 g_free(yyvsp[-2].id);
2251 push_funcarg(yyvsp[-5].id,yyvsp[-4].id);
2255 #line 1061 "parse.y"
2259 #line 1062 "parse.y"
2263 #line 1065 "parse.y"
2265 if(strcmp(yyvsp[0].id,"type")==0) {
2266 Node *node = new_check(TYPE_CHECK,NULL);
2267 checks = g_list_append(checks,node);
2268 } else if(strcmp(yyvsp[0].id,"null")==0) {
2269 Node *node = new_check(NULL_CHECK,NULL);
2270 checks = g_list_append(checks,node);
2272 yyerror(_("parse error"));
2275 g_free(yyvsp[0].id);
2279 #line 1078 "parse.y"
2281 Node *node = new_check(GT_CHECK,yyvsp[0].id);
2282 checks = g_list_append(checks,node);
2286 #line 1082 "parse.y"
2288 Node *node = new_check(LT_CHECK,yyvsp[0].id);
2289 checks = g_list_append(checks,node);
2293 #line 1086 "parse.y"
2295 Node *node = new_check(GE_CHECK,yyvsp[0].id);
2296 checks = g_list_append(checks,node);
2300 #line 1090 "parse.y"
2302 Node *node = new_check(LE_CHECK,yyvsp[0].id);
2303 checks = g_list_append(checks,node);
2307 #line 1094 "parse.y"
2309 Node *node = new_check(EQ_CHECK,yyvsp[0].id);
2310 checks = g_list_append(checks,node);
2314 #line 1098 "parse.y"
2316 Node *node = new_check(NE_CHECK,yyvsp[0].id);
2317 checks = g_list_append(checks,node);
2321 #line 1104 "parse.y"
2322 { yyval.id = yyvsp[0].id; ;
2325 #line 1105 "parse.y"
2327 yyval.id = g_strconcat("-",yyvsp[0].id,NULL);
2328 g_free(yyvsp[0].id);
2332 #line 1109 "parse.y"
2333 { yyval.id = yyvsp[0].id; ;
2336 /* the action file gets copied in in place of this dollarsign */
2337 #line 543 "/usr/lib/bison.simple"
2348 short *ssp1 = yyss - 1;
2349 fprintf (stderr, "state stack now");
2350 while (ssp1 != yyssp)
2351 fprintf (stderr, " %d", *++ssp1);
2352 fprintf (stderr, "\n");
2362 yylsp->first_line = yylloc.first_line;
2363 yylsp->first_column = yylloc.first_column;
2364 yylsp->last_line = (yylsp-1)->last_line;
2365 yylsp->last_column = (yylsp-1)->last_column;
2370 yylsp->last_line = (yylsp+yylen-1)->last_line;
2371 yylsp->last_column = (yylsp+yylen-1)->last_column;
2375 /* Now "shift" the result of the reduction.
2376 Determine what state that goes to,
2377 based on the state we popped back to
2378 and the rule number reduced by. */
2382 yystate = yypgoto[yyn - YYNTBASE] + *yyssp;
2383 if (yystate >= 0 && yystate <= YYLAST && yycheck[yystate] == *yyssp)
2384 yystate = yytable[yystate];
2386 yystate = yydefgoto[yyn - YYNTBASE];
2390 yyerrlab: /* here on detecting error */
2393 /* If not already recovering from an error, report this error. */
2397 #ifdef YYERROR_VERBOSE
2398 yyn = yypact[yystate];
2400 if (yyn > YYFLAG && yyn < YYLAST)
2407 /* Start X at -yyn if nec to avoid negative indexes in yycheck. */
2408 for (x = (yyn < 0 ? -yyn : 0);
2409 x < (sizeof(yytname) / sizeof(char *)); x++)
2410 if (yycheck[x + yyn] == x)
2411 size += strlen(yytname[x]) + 15, count++;
2412 msg = (char *) malloc(size + 15);
2415 strcpy(msg, "parse error");
2420 for (x = (yyn < 0 ? -yyn : 0);
2421 x < (sizeof(yytname) / sizeof(char *)); x++)
2422 if (yycheck[x + yyn] == x)
2424 strcat(msg, count == 0 ? ", expecting `" : " or `");
2425 strcat(msg, yytname[x]);
2434 yyerror ("parse error; also virtual memory exceeded");
2437 #endif /* YYERROR_VERBOSE */
2438 yyerror("parse error");
2442 yyerrlab1: /* here on error raised explicitly by an action */
2444 if (yyerrstatus == 3)
2446 /* if just tried and failed to reuse lookahead token after an error, discard it. */
2448 /* return failure if at end of input */
2449 if (yychar == YYEOF)
2454 fprintf(stderr, "Discarding token %d (%s).\n", yychar, yytname[yychar1]);
2460 /* Else will try to reuse lookahead token
2461 after shifting the error token. */
2463 yyerrstatus = 3; /* Each real token shifted decrements this */
2467 yyerrdefault: /* current state does not do anything special for the error token. */
2470 /* This is wrong; only states that explicitly want error tokens
2471 should shift them. */
2472 yyn = yydefact[yystate]; /* If its default is to accept any token, ok. Otherwise pop it.*/
2473 if (yyn) goto yydefault;
2476 yyerrpop: /* pop the current state because it cannot handle the error token */
2478 if (yyssp == yyss) YYABORT;
2488 short *ssp1 = yyss - 1;
2489 fprintf (stderr, "Error: state stack now");
2490 while (ssp1 != yyssp)
2491 fprintf (stderr, " %d", *++ssp1);
2492 fprintf (stderr, "\n");
2498 yyn = yypact[yystate];
2503 if (yyn < 0 || yyn > YYLAST || yycheck[yyn] != YYTERROR)
2522 fprintf(stderr, "Shifting error token, ");
2534 /* YYACCEPT comes here. */
2546 /* YYABORT comes here. */
2557 #line 1112 "parse.y"