From c9914e54f16c3315d47040f4cca2d3788228c504 Mon Sep 17 00:00:00 2001 From: George Lebl Date: Thu, 6 Jul 2000 11:42:00 -0800 Subject: [PATCH] Release 1.0.3 --- ChangeLog | 31 ++ NEWS | 6 + configure | 2 +- configure.in | 2 +- doc/gob.1.in | 10 +- examples/gtk-button-count.gob | 12 +- examples/my-person.gob | 6 + examples/my-person2.gob | 6 + gob.spec | 2 +- src/ChangeLog | 25 -- src/Makefile.in | 2 +- src/checks.c | 3 +- src/main.c | 125 ++++-- src/parse.c | 736 +++++++++++++++++++--------------- src/parse.y | 90 ++++- src/test.gob | 41 ++ 16 files changed, 685 insertions(+), 414 deletions(-) delete mode 100644 src/ChangeLog diff --git a/ChangeLog b/ChangeLog index df70dda..fe91ea3 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,34 @@ +Thu Jul 06 02:32:29 2000 George Lebl + + * Release 1.0.3 + +Wed Jul 05 19:37:20 2000 George Lebl + + * src/{main.c,parse.y}: couple of cleanups, and fixup the gtk 1.3 + support + +Wed Jul 05 18:57:13 2000 George Lebl + + * src/{checks.c, main.c, parse.y, test.gob}: Apply and fix up patch + from Bas van der Linden that adds the ability + to use const on the "self" argument as well. Also adds a CONST + casting macro to use. + + * src/main.c: Fix a memory leak when destroy wasn't overriden and + destructors were added, it now properly calls the parent handler. + Same with finalize. + + * src/main.c: Spit out some macro magic foo to hopefully make it + possible to compile objects with GTK+ 1.3/2.0 + + * doc/gob.1.in, examples/*.gob: We should never do + GTK_OBJECT(GET_NEW) as that's a memory leak due to some weird + GTK_OBJECT() semantics + +Fri Jun 30 14:08:53 2000 George Lebl + + * Release 1.0.2 + Fri Jun 30 13:11:05 2000 George Lebl * doc/gob.1.in: add doc for --always-private-struct diff --git a/NEWS b/NEWS index f63100d..fdffcc1 100644 --- a/NEWS +++ b/NEWS @@ -1,3 +1,9 @@ +1.0.3 + * Add "const self", and a _CONST cast macro (Bas van der Linden) + * Objects should compile with Glib/GTK+ 1.3 (to become 2.0) + * Parent handler is properly called for destroy and finalize + * Fixes in documentation and examples + 1.0.2 * Fix "const" handeling * Allow use of chunks for new object allocation (Bas van der Linden) diff --git a/configure b/configure index 2c41e7c..c0f07eb 100755 --- a/configure +++ b/configure @@ -703,7 +703,7 @@ fi PACKAGE=gob -VERSION=1.0.2 +VERSION=1.0.3 if test "`cd $srcdir && pwd`" != "`pwd`" && test -f $srcdir/config.status; then { echo "configure: error: source directory already configured; run "make distclean" there first" 1>&2; exit 1; } diff --git a/configure.in b/configure.in index cc28b67..1ebdb13 100644 --- a/configure.in +++ b/configure.in @@ -2,7 +2,7 @@ dnl Process this file with autoconf to produce a configure script. AC_PREREQ(2.2) AC_INIT(src/treefuncs.h) AM_CONFIG_HEADER(config.h) -AM_INIT_AUTOMAKE(gob,1.0.2) +AM_INIT_AUTOMAKE(gob,1.0.3) if test -f ../NOINST_GOB ; then DOINSTGOB= diff --git a/doc/gob.1.in b/doc/gob.1.in index 01d66cd..7d0c285 100644 --- a/doc/gob.1.in +++ b/doc/gob.1.in @@ -739,13 +739,17 @@ will fetch a new object, so a fairly standard new method would look like: public GtkObject * new(void) { - GtkObject *ret; - ret = GTK_OBJECT (GET_NEW); - return ret; + GtkObject *ret = GET_NEW; + return GTK_OBJECT (ret); } .fi .PP +You should not a subtle peculiarity of the GTK+ object system here. If there is any +code inside the GTK_OBJECT macro argument, it will get executed multiple times. This +means that things such as GTK_OBJECT(GET_NEW) would actually create 4 objects, leaking +3 of them. A good rule is to be careful with all macros. +.PP Self alias casts: .PP There are some standard casts defined for you. Instead of using the full diff --git a/examples/gtk-button-count.gob b/examples/gtk-button-count.gob index d0bf595..9061c5c 100644 --- a/examples/gtk-button-count.gob +++ b/examples/gtk-button-count.gob @@ -32,7 +32,9 @@ class Gtk:Button:Count from Gtk:Button { GtkWidget * new(void) { - return GTK_WIDGET(GET_NEW); + /* It's ok to use a normal cast here, as we are sure that we + * have gotten the right type */ + return (GtkWidget *)GET_NEW; } /** @@ -47,7 +49,13 @@ class Gtk:Button:Count from Gtk:Button { GtkWidget * new_with_label(char *label (check null)) onerror NULL { - return GTK_WIDGET(GET_NEW); + /* It's ok to use a normal cast here, as we are sure that we + * have gotten the right type */ + GtkWidget *widget = (GtkWidget *)GET_NEW; + GtkWidget *label_widget = gtk_label_new(label); + gtk_container_add(GTK_CONTAINER(widget), label_widget); + gtk_widget_show(label_widget); + return widget; } override (Gtk:Button) diff --git a/examples/my-person.gob b/examples/my-person.gob index 06a0aaa..cad0672 100644 --- a/examples/my-person.gob +++ b/examples/my-person.gob @@ -91,4 +91,10 @@ class My:Person from Gtk:Object { g_free(MY_PERSON(self)->name); PARENT_HANDLER(self); } + + public GtkObject * + new(void) + { + return (GtkObject *)GET_NEW; + } } diff --git a/examples/my-person2.gob b/examples/my-person2.gob index 749bfb0..b7f23ed 100644 --- a/examples/my-person2.gob +++ b/examples/my-person2.gob @@ -70,4 +70,10 @@ class My:Person2 from Gtk:Object { /* death is imminent if we shoot oneself in the head */ death(self, (long)time(NULL)); } + + public GtkObject * + new(void) + { + return (GtkObject *)GET_NEW; + } } diff --git a/gob.spec b/gob.spec index af07c4d..3a8a30f 100644 --- a/gob.spec +++ b/gob.spec @@ -1,4 +1,4 @@ -%define ver 1.0.2 +%define ver 1.0.3 %define rel 1 %define prefix /usr diff --git a/src/ChangeLog b/src/ChangeLog deleted file mode 100644 index 9110b93..0000000 --- a/src/ChangeLog +++ /dev/null @@ -1,25 +0,0 @@ -Sun Jun 25 03:34:02 2000 George Lebl - - * treefuncs.def, main.c, utils.[ch], parse.y: sane parsing of const. - Get rid of "stars" integer and just use a "pointer" string. Also - the types in general are more sanely parsed, thus recognizing - hopefully all legal (and some illegal) C types. - - * checks.[ch], main.c: checks the argument type to be one we can - truly check. - - * treefuncs.def, main.c, parse.y, lexer.l: Apply patch from - Bas van der Linden that adds the possibility to - use chunks to allocate objects. - - * main.c: Apply patch from Bas van der Linden - to add a __GOB_FUNCTION__ define to each function - - * Makefile.am, main.c, lexer.l, generate_treefuncs.pl: avoid and fix - warnings, and compile with all warnings - - * main.[ch]: add an --always-private-struct option to always put in the - private pointer, even if there are no private members. - - * test.gob: add some more tests for new stuff - diff --git a/src/Makefile.in b/src/Makefile.in index 3c0acd1..c27b02b 100644 --- a/src/Makefile.in +++ b/src/Makefile.in @@ -119,7 +119,7 @@ LEXLIB = @LEXLIB@ COMPILE = $(CC) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) CCLD = $(CC) LINK = $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(LDFLAGS) -o $@ -DIST_COMMON = ChangeLog Makefile.am Makefile.in lexer.c parse.c +DIST_COMMON = Makefile.am Makefile.in lexer.c parse.c DISTFILES = $(DIST_COMMON) $(SOURCES) $(HEADERS) $(TEXINFOS) $(EXTRA_DIST) diff --git a/src/checks.c b/src/checks.c index 7c675ee..8bbe1e4 100644 --- a/src/checks.c +++ b/src/checks.c @@ -428,7 +428,8 @@ check_func_arg_check_func_arg(Method *m, FuncArg *fa) if(fa->atype->pointer == NULL || (strcmp(fa->atype->pointer, "*") != 0 && - strcmp(fa->atype->pointer, "* const") != 0)) + strcmp(fa->atype->pointer, "* const") != 0 && + strcmp(fa->atype->pointer, "const *") != 0)) goto type_check_error; } } diff --git a/src/main.c b/src/main.c index 691d5df..a614e31 100644 --- a/src/main.c +++ b/src/main.c @@ -807,7 +807,7 @@ add_get_type(void) "\t\t\t(GtkObjectInitFunc) %s_init,\n" "\t\t\t/* reserved_1 */ NULL,\n" "\t\t\t/* reserved_2 */ NULL,\n" - "\t\t\t(GtkClassInitFunc) NULL,\n" + "\t\t\t(GtkClassInitFunc) NULL\n" "\t\t};\n\n" "\t\ttype = gtk_type_unique (%s_get_type(), &info);\n", funcbase, typebase, typebase, typebase, @@ -824,16 +824,18 @@ add_get_type(void) } static void -add_overrides(Class *c, char *oname, gboolean did_gtk_obj) +add_overrides(Class *c, char *oname, gboolean did_base_obj) { GList *li; GHashTable *done; char *s; done = g_hash_table_new(g_str_hash, g_str_equal); - if(did_gtk_obj) { + if(did_base_obj) { s = g_strdup("GtkObject"); /* This was already done */ g_hash_table_insert(done, s, s); + s = g_strdup("GObject"); /* This was probably already done as well (if using Gtk/Glib 1.3/2.0) */ + g_hash_table_insert(done, s, s); } for(li=c->nodes; li; li=g_list_next(li)) { Node *n = li->data; @@ -952,7 +954,7 @@ add_signals(Class *c) out_printf(out, "\tobject_signals[%s_SIGNAL] =\n" "\t\tgtk_signal_new (\"%s\",\n" "\t\t\t(GtkSignalRunType)(%s),\n" - "\t\t\tgtk_object_class->type,\n" + "\t\t\tGTK_CLASS_TYPE(gtk_object_class),\n" "\t\t\tGTK_SIGNAL_OFFSET (%sClass, %s),\n" "\t\t\t%s,\n" "\t\t\tGTK_TYPE_%s, %d", @@ -1018,8 +1020,12 @@ set_def_handlers(Class *c, char *oname) else if(need_finalize && finalize_handler && strcmp(m->id, "finalize") == 0) - out_printf(out, "\tgtk_object_class->finalize " - "= ___finalize;\n"); + out_printf(out, + "#ifdef G_OBJECT_CLASS\n" + "\tg_object_class->finalize = ___finalize;\n" + "#else /* !G_OBJECT_CLASS */\n" + "\tgtk_object_class->finalize = ___finalize;\n" + "#endif /* G_OBJECT_CLASS */\n"); else if(m->cbuf) out_printf(out, "\t%s_class->%s = ___%x_%s_%s;\n", @@ -1188,6 +1194,9 @@ add_destroy(Class *c) out_printf(out, "\nstatic void\n" "___destroy(GtkObject *obj_self)\n" "{\n"); + out_printf(out, + "#define __GOB_FUNCTION__ \"%s::destroy\"\n", + c->otype); if(destructors > 0) { out_printf(out, "\t%s *self G_GNUC_UNUSED = %s (obj_self);\n", @@ -1202,6 +1211,10 @@ add_destroy(Class *c) (guint)destroy_handler->unique_id, funcbase); if(destroy_handler->line_no > 0) out_addline_outfile(out); + } else { + out_printf(out, + "\tif(GTK_OBJECT_CLASS(parent_class)->destroy) \\\n" + "\t\t(* GTK_OBJECT_CLASS(parent_class)->destroy)(obj_self);\n"); } if(destructors > 0) { @@ -1217,15 +1230,26 @@ add_destroy(Class *c) } } - out_printf(out, "}\n\n"); + out_printf(out, "}\n" + "#undef __GOB_FUNCTION__\n\n"); } static void add_finalize(Class *c) { - out_printf(out, "\nstatic void\n" + /* Sort of a hack to make it work with gtk+ 1.3/2.0 */ + out_printf(out, + "\n#ifdef G_OBJECT_CLASS\n" + "static void\n" + "___finalize(GObject *obj_self)\n" + "#else /* !G_OBJECT_CLASS */\n" + "static void\n" "___finalize(GtkObject *obj_self)\n" + "#endif /* G_OBJECT_CLASS */\n" "{\n"); + out_printf(out, + "#define __GOB_FUNCTION__ \"%s::finalize\"\n", + c->otype); if(privates > 0) { out_printf(out, "\t%s *self = %s (obj_self);\n", @@ -1240,6 +1264,16 @@ add_finalize(Class *c) (guint)finalize_handler->unique_id, funcbase); if(finalize_handler->line_no > 0) out_addline_outfile(out); + } else { + /* Sort of a hack to make it work with gtk+ 1.3/2.0 */ + out_printf(out, + "#ifdef G_OBJECT_CLASS\n" + "\tif(G_OBJECT_CLASS(parent_class)->finalize) \\\n" + "\t\t(* G_OBJECT_CLASS(parent_class)->finalize)(obj_self);\n" + "#else /* !G_OBJECT_CLASS */\n" + "\tif(GTK_OBJECT_CLASS(parent_class)->finalize) \\\n" + "\t\t(* GTK_OBJECT_CLASS(parent_class)->finalize)(obj_self);\n" + "#endif /* G_OBJECT_CLASS */\n"); } if(privates > 0) { @@ -1247,7 +1281,8 @@ add_finalize(Class *c) "\tself->_priv = NULL;\n"); } - out_printf(out, "}\n\n"); + out_printf(out, "}\n" + "#undef __GOB_FUNCTION__\n\n"); } static void @@ -1293,7 +1328,7 @@ add_inits(Class *c) } } } else if(m->method == CLASS_INIT_METHOD) { - gboolean did_gtk_obj = FALSE; + gboolean did_base_obj = FALSE; if(m->line_no > 0) out_addline_infile(out, m->line_no); @@ -1310,16 +1345,23 @@ add_inits(Class *c) need_finalize) { out_printf(out, "\tGtkObjectClass *" - "gtk_object_class = " + "gtk_object_class G_GNUC_UNUSED = " "(GtkObjectClass*) %s;\n", ((FuncArg *)m->args->data)->name); - did_gtk_obj = TRUE; + out_printf(out, + "#ifdef G_OBJECT_CLASS\n" + "\tGObjectClass *" + "g_object_class G_GNUC_UNUSED = " + "(GObjectClass*) %s;\n" + "#endif /* G_OBJECT_CLASS */\n", + ((FuncArg *)m->args->data)->name); + did_base_obj = TRUE; } if(overrides > 0) add_overrides(c, ((FuncArg *)m->args->data)->name, - did_gtk_obj); + did_base_obj); if(initializers > 0) { GList *li; @@ -1352,8 +1394,12 @@ add_inits(Class *c) out_printf(out, "\tgtk_object_class->destroy " "= ___destroy;\n"); if(need_finalize && !finalize_handler) - out_printf(out, "\tgtk_object_class->finalize " - "= ___finalize;\n"); + out_printf(out, + "#ifdef G_OBJECT_CLASS\n" + "\tg_object_class->finalize = ___finalize;\n" + "#else /* !G_OBJECT_CLASS */\n" + "\tgtk_object_class->finalize = ___finalize;\n" + "#endif /* G_OBJECT_CLASS */\n"); if(arguments > 0) make_arguments(c); @@ -1704,7 +1750,7 @@ put_method(Method *m) out_printf(out, "{\n" "\t%sClass *klass;\n", typebase); print_preconditions(m); - out_printf(out, "\tklass = %s_CLASS(GTK_OBJECT(%s)->klass);\n\n" + out_printf(out, "\tklass = %s_GET_CLASS(%s);\n\n" "\tif(klass->%s)\n", macrobase, ((FuncArg *)m->args->data)->name, get_real_id(m->id)); @@ -2012,27 +2058,48 @@ print_class_block(Class *c) "(%s_get_type())\n", macrotype, funcbase); out_printf(outh, "#define %s(obj)\t" - "GTK_CHECK_CAST((obj), %s_get_type(),%s)\n", + "GTK_CHECK_CAST((obj), %s_get_type(), %s)\n", macrobase, funcbase, typebase); + out_printf(outh, "#define %s_CONST(obj)\t" + "GTK_CHECK_CAST((obj), %s_get_type(), %s const)\n", + macrobase, funcbase, typebase); out_printf(outh, "#define %s_CLASS(klass)\t" - "GTK_CHECK_CLASS_CAST((klass),%s_get_type(),%sClass)\n", + "GTK_CHECK_CLASS_CAST((klass), %s_get_type(), %sClass)\n", macrobase, funcbase, typebase); out_printf(outh, "#define %s(obj)\t" - "GTK_CHECK_TYPE((obj),%s_get_type ())\n\n", + "GTK_CHECK_TYPE((obj), %s_get_type ())\n\n", macrois, funcbase); + out_printf(outh, "#ifdef GTK_CHECK_GET_CLASS\n" + "#define %s_GET_CLASS(obj)\t" + "GTK_CHECK_GET_CLASS((obj), %s_get_type(), %sClass)\n", + macrobase, funcbase, typebase); + out_printf(outh, "#else /* !GTK_CHECK_GET_CLASS */\n" + "#define %s_GET_CLASS(obj)\t" + "((%sClass *)GTK_OBJECT(obj)->klass)\n" + "#endif /* GTK_CHECK_GET_CLASS */\n", + macrobase, typebase); if( ! no_self_alias) { out_printf(out, "/* self casting macros */\n"); out_printf(out, "#define SELF(x) %s(x)\n", macrobase); + out_printf(out, "#define SELF_CONST(x) %s_CONST(x)\n", macrobase); out_printf(out, "#define IS_SELF(x) %s(x)\n", macrois); out_printf(out, "#define SELF_CLASS(x) %s_CLASS(x)\n\n", macrobase); + out_printf(out, "#define SELF_GET_CLASS(x) %s_GET_CLASS(x)\n\n", + macrobase); out_printf(out, "/* self typedefs */\n"); out_printf(out, "typedef %s Self;\n", typebase); out_printf(out, "typedef %sClass SelfClass;\n\n", typebase); } + out_printf(out, "/* GTK_CLASS_TYPE for 1.2<->1.3/2.0 GTK+ compatibility */\n"); + out_printf(out, + "#ifndef GTK_CLASS_TYPE\n" + "#define GTK_CLASS_TYPE(x) (GTK_OBJECT_CLASS(x)->type)\n" + "#endif /* GTK_CLASS_TYPE */\n\n"); + if(privates > 0 || always_private_struct) { out_printf(outh, "\n/* Private structure type */\n"); out_printf(outh, "typedef struct _%sPrivate %sPrivate;\n", @@ -2121,13 +2188,13 @@ print_class_block(Class *c) out_printf(outh, "struct _%sClass {\n\t%sClass __parent__;\n", typebase, ptypebase); - for(l=c->nodes;l;l=g_list_next(l)) { + for(l = c->nodes; l != NULL; l = l->next) { Node *n = l->data; if(n->type == METHOD_NODE) put_vs_method((Method *)n); } /* put class scope variables */ - for(l=c->nodes;l;l=g_list_next(l)) { + for(l = c->nodes; l != NULL; l = l->next) { Node *n = l->data; Variable *v = (Variable *)n; if(n->type == VARIABLE_NODE && @@ -2137,7 +2204,7 @@ print_class_block(Class *c) out_printf(outh, "};\n\n"); out_printf(out, "/* here are local prototypes */\n"); - if(arguments>0) { + if(arguments > 0) { out_printf(out, "static void ___object_set_arg " "(GtkObject *object, GtkArg *arg, " "guint arg_id);\n" @@ -2151,7 +2218,7 @@ print_class_block(Class *c) " */\n"); out_printf(outh, "guint\t%s_get_type\t(void);\n", funcbase); - for(l=c->nodes;l;l=g_list_next(l)) { + for(l = c->nodes; l != NULL; l = l->next) { Node *n = l->data; if(n->type == METHOD_NODE) { put_pub_method((Method *)n); @@ -2179,7 +2246,7 @@ print_class_block(Class *c) /* argument wrapping macros */ - if(arguments>0 && !no_gnu) { + if(arguments > 0 && ! no_gnu) { out_printf(outh, "\n/*\n" " * Argument wrapping macros\n" " */\n"); @@ -2188,15 +2255,15 @@ print_class_block(Class *c) out_printf(outh, "#else /* __GNUC__ */\n"); put_argument_nongnu_wrappers(c); out_printf(outh, "#endif /* __GNUC__ */\n\n"); - } else if(arguments>0 && no_gnu) { + } else if(arguments > 0 && no_gnu) { out_printf(outh, "\n/*\n" " * Argument wrapping macros\n" " */\n"); put_argument_nongnu_wrappers(c); } - if(signals>0) { - for(l=c->nodes;l;l=g_list_next(l)) { + if(signals > 0) { + for(l = c->nodes; l != NULL; l = l->next) { Node *n = l->data; if(n->type == METHOD_NODE) add_signal_prots((Method *)n); @@ -2232,12 +2299,12 @@ print_class_block(Class *c) add_inits(c); - if(arguments>0) { + if(arguments > 0) { add_getset_arg(c, TRUE); add_getset_arg(c, FALSE); } - for(l=c->nodes;l;l=g_list_next(l)) { + for(l = c->nodes; l != NULL; l = l->next) { Node *n = l->data; if(n->type == METHOD_NODE) put_method((Method *)n); diff --git a/src/parse.c b/src/parse.c index 8cc0914..c41f9e4 100644 --- a/src/parse.c +++ b/src/parse.c @@ -257,12 +257,13 @@ push_init_arg(char *name, int is_class) } static void -push_self(char *id) +push_self(char *id, gboolean constant) { Node *node; Node *type; GList *ch = NULL; - type = new_type(g_strdup(((Class *)class)->otype), g_strdup("*"), NULL); + type = new_type(g_strdup(((Class *)class)->otype), + g_strdup(constant ? "const *" : "*"), NULL); ch = g_list_append(ch,new_check(NULL_CHECK,NULL)); ch = g_list_append(ch,new_check(TYPE_CHECK,NULL)); node = new_funcarg((Type *)type,id,ch); @@ -312,7 +313,7 @@ set_return_value(char *type, char *val) } -#line 294 "parse.y" +#line 295 "parse.y" typedef union { char *id; GString *cbuf; @@ -334,7 +335,7 @@ typedef union { -#define YYFINAL 256 +#define YYFINAL 263 #define YYFLAG -32768 #define YYNTBASE 50 @@ -384,9 +385,10 @@ static const short yyprhs[] = { 0, 217, 219, 221, 223, 225, 227, 229, 231, 234, 237, 241, 244, 246, 250, 254, 257, 259, 264, 268, 270, 273, 275, 286, 298, 308, 318, 327, 339, 348, 354, - 357, 362, 363, 365, 368, 370, 372, 376, 378, 382, - 384, 388, 390, 393, 397, 404, 412, 415, 417, 419, - 422, 425, 429, 433, 437, 441, 443, 446 + 357, 362, 363, 365, 368, 370, 372, 375, 378, 382, + 387, 392, 394, 398, 400, 404, 406, 409, 413, 420, + 428, 431, 433, 435, 438, 441, 445, 449, 453, 457, + 459, 462 }; static const short yyrhs[] = { 52, @@ -427,33 +429,36 @@ static const short yyrhs[] = { 52, 19, 39, 81, 40, 79, 77, 0, 19, 39, 19, 40, 77, 0, 19, 80, 0, 19, 80, 19, 80, 0, 0, 87, 0, 37, 23, 0, 6, 0, 19, - 0, 19, 45, 82, 0, 82, 0, 83, 45, 10, - 0, 83, 0, 83, 45, 84, 0, 84, 0, 67, - 19, 0, 67, 19, 22, 0, 67, 19, 39, 19, - 85, 40, 0, 67, 19, 22, 39, 19, 85, 40, - 0, 85, 86, 0, 86, 0, 19, 0, 46, 87, - 0, 47, 87, 0, 46, 42, 87, 0, 47, 42, - 87, 0, 42, 42, 87, 0, 48, 42, 87, 0, - 20, 0, 49, 20, 0, 19, 0 + 0, 19, 5, 0, 5, 19, 0, 19, 45, 82, + 0, 19, 5, 45, 82, 0, 5, 19, 45, 82, + 0, 82, 0, 83, 45, 10, 0, 83, 0, 83, + 45, 84, 0, 84, 0, 67, 19, 0, 67, 19, + 22, 0, 67, 19, 39, 19, 85, 40, 0, 67, + 19, 22, 39, 19, 85, 40, 0, 85, 86, 0, + 86, 0, 19, 0, 46, 87, 0, 47, 87, 0, + 46, 42, 87, 0, 47, 42, 87, 0, 42, 42, + 87, 0, 48, 42, 87, 0, 20, 0, 49, 20, + 0, 19, 0 }; #endif #if YYDEBUG != 0 static const short yyrline[] = { 0, - 312, 313, 314, 315, 318, 324, 330, 336, 342, 348, - 356, 357, 360, 365, 372, 377, 378, 386, 397, 398, - 401, 402, 403, 404, 407, 408, 409, 410, 413, 426, - 442, 446, 454, 455, 456, 457, 458, 464, 467, 471, - 506, 534, 604, 613, 619, 620, 623, 626, 632, 636, - 643, 646, 649, 653, 657, 661, 666, 674, 678, 683, - 687, 690, 694, 697, 702, 703, 704, 705, 706, 707, - 708, 709, 710, 713, 714, 715, 718, 719, 720, 724, - 731, 743, 749, 761, 773, 776, 782, 787, 790, 795, - 796, 800, 816, 832, 848, 864, 875, 881, 891, 914, - 925, 944, 950, 951, 957, 958, 969, 979, 982, 983, - 986, 987, 990, 993, 996, 1004, 1014, 1015, 1018, 1031, - 1035, 1039, 1043, 1047, 1051, 1057, 1058, 1062 + 313, 314, 315, 316, 319, 325, 331, 337, 343, 349, + 357, 358, 361, 366, 373, 378, 379, 387, 398, 399, + 402, 403, 404, 405, 408, 409, 410, 411, 414, 427, + 443, 447, 455, 456, 457, 458, 459, 465, 468, 472, + 508, 537, 612, 621, 627, 628, 631, 634, 640, 644, + 651, 654, 657, 661, 665, 669, 674, 682, 686, 691, + 695, 698, 702, 705, 710, 711, 712, 713, 714, 715, + 716, 717, 718, 721, 722, 723, 726, 727, 728, 732, + 739, 751, 757, 769, 781, 784, 790, 795, 798, 803, + 804, 808, 824, 840, 856, 872, 883, 889, 899, 922, + 933, 952, 958, 959, 965, 966, 977, 988, 999, 1009, + 1019, 1029, 1032, 1033, 1036, 1037, 1040, 1043, 1046, 1054, + 1064, 1065, 1068, 1081, 1085, 1089, 1093, 1097, 1101, 1107, + 1108, 1112 }; #endif @@ -485,9 +490,10 @@ static const short yyr1[] = { 0, 70, 70, 70, 71, 71, 71, 72, 72, 72, 72, 73, 73, 74, 74, 74, 74, 75, 76, 76, 77, 77, 78, 78, 78, 78, 78, 78, 78, 78, 79, - 79, 79, 80, 80, 81, 81, 81, 81, 82, 82, - 83, 83, 84, 84, 84, 84, 85, 85, 86, 86, - 86, 86, 86, 86, 86, 87, 87, 87 + 79, 79, 80, 80, 81, 81, 81, 81, 81, 81, + 81, 81, 82, 82, 83, 83, 84, 84, 84, 84, + 85, 85, 86, 86, 86, 86, 86, 86, 86, 87, + 87, 87 }; static const short yyr2[] = { 0, @@ -501,9 +507,10 @@ static const short yyr2[] = { 0, 1, 1, 1, 1, 1, 1, 1, 2, 2, 3, 2, 1, 3, 3, 2, 1, 4, 3, 1, 2, 1, 10, 11, 9, 9, 8, 11, 8, 5, 2, - 4, 0, 1, 2, 1, 1, 3, 1, 3, 1, - 3, 1, 2, 3, 6, 7, 2, 1, 1, 2, - 2, 3, 3, 3, 3, 1, 2, 1 + 4, 0, 1, 2, 1, 1, 2, 2, 3, 4, + 4, 1, 3, 1, 3, 1, 2, 3, 6, 7, + 2, 1, 1, 2, 2, 3, 3, 3, 3, 1, + 2, 1 }; static const short yydefact[] = { 0, @@ -520,150 +527,158 @@ static const short yydefact[] = { 0, 45, 0, 0, 56, 0, 0, 78, 79, 57, 0, 0, 0, 81, 0, 85, 0, 0, 0, 0, 0, 0, 37, 0, 0, 36, 35, 0, 0, 0, 0, - 91, 99, 47, 0, 42, 0, 65, 52, 0, 0, - 108, 110, 112, 80, 89, 0, 84, 83, 0, 0, - 0, 0, 29, 0, 0, 0, 128, 126, 0, 0, - 31, 33, 34, 38, 17, 18, 90, 0, 0, 0, - 0, 113, 102, 0, 87, 0, 0, 0, 0, 0, - 30, 39, 102, 32, 127, 43, 0, 102, 107, 114, - 0, 0, 0, 109, 111, 88, 0, 0, 102, 0, - 0, 0, 41, 0, 0, 0, 0, 100, 103, 96, - 102, 0, 0, 0, 98, 0, 94, 0, 119, 0, - 0, 0, 0, 0, 118, 104, 0, 0, 102, 95, - 102, 0, 0, 0, 0, 120, 0, 121, 0, 115, - 117, 101, 92, 0, 0, 40, 116, 124, 122, 123, - 125, 97, 93, 0, 0, 0 + 91, 99, 47, 0, 42, 0, 0, 65, 52, 0, + 0, 112, 114, 116, 80, 89, 0, 84, 83, 0, + 0, 0, 0, 29, 0, 0, 0, 132, 130, 0, + 0, 31, 33, 34, 38, 17, 18, 90, 0, 0, + 0, 53, 54, 0, 117, 102, 0, 87, 0, 0, + 0, 0, 0, 30, 39, 102, 32, 131, 43, 0, + 102, 0, 0, 109, 118, 0, 0, 0, 113, 115, + 88, 0, 0, 102, 0, 0, 0, 41, 0, 111, + 110, 0, 0, 0, 100, 103, 96, 102, 0, 0, + 0, 98, 0, 94, 0, 123, 0, 0, 0, 0, + 0, 122, 104, 0, 0, 102, 95, 102, 0, 0, + 0, 0, 124, 0, 125, 0, 119, 121, 101, 92, + 0, 0, 40, 120, 128, 126, 127, 129, 97, 93, + 0, 0, 0 }; -static const short yydefgoto[] = { 254, +static const short yydefgoto[] = { 261, 8, 9, 10, 11, 69, 30, 31, 32, 125, 126, - 127, 33, 34, 74, 39, 72, 139, 57, 58, 59, - 60, 85, 91, 92, 93, 146, 132, 35, 193, 208, - 140, 141, 142, 143, 224, 225, 209 + 127, 33, 34, 74, 39, 72, 140, 57, 58, 59, + 60, 85, 91, 92, 93, 147, 132, 35, 198, 215, + 141, 142, 143, 144, 231, 232, 216 }; -static const short yypact[] = { 174, - -1,-32768,-32768,-32768,-32768,-32768,-32768,-32768, 174, 221, - -14, 38,-32768, 221, 221, 175, 23, 221, 29,-32768, --32768,-32768,-32768, 39, 157, 39, 41,-32768,-32768, 193, --32768, 112,-32768,-32768,-32768, 57, 72, 81, 84, 263, +static const short yypact[] = { 88, + -12,-32768,-32768,-32768,-32768,-32768,-32768,-32768, 88, 347, + -15, 15,-32768, 347, 347, 157, 18, 347, 7,-32768, +-32768,-32768,-32768, 25, 153, 25, 36,-32768,-32768, 175, +-32768, 118,-32768,-32768,-32768, 67, 102, 122, 135, 245, -32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768, --32768,-32768, 99, 314, 280, 89, 90,-32768, 328, 117, - 161, 116,-32768,-32768, 280, 39, 119, 123,-32768, 104, - 105, 114, 118, 133, 342,-32768,-32768, 137,-32768, 342, --32768, 139, 128, 5,-32768, 342,-32768, 176, 211, 160, --32768, 280,-32768, 142, 164, 165, 67, 6, 17, 81, --32768, 166, 177,-32768, 156, 297, 90,-32768,-32768, 178, - 184, 195,-32768, 31,-32768, 196, 280, 179, 31, 280, - -2, -15, 297, 44, 190, 200, 180, 197, 198, 210, --32768,-32768,-32768, 280, 183, 297, 199, 3, 216, 226, --32768, 191,-32768,-32768,-32768, 42,-32768,-32768, 234, 264, - 297, 271,-32768, 277, 266, 281,-32768,-32768, 294, 302, --32768,-32768,-32768,-32768,-32768,-32768,-32768, 283, 301, 296, - 280, 51, 318, 246,-32768, 319, 297, 311, 312, 322, --32768,-32768, 318,-32768,-32768,-32768, -3, 318,-32768, 323, - 332, 46, 17,-32768,-32768,-32768, 324, 297, 318, 297, - 17, 329,-32768, 17, 346, 93, 344, 349,-32768,-32768, - 318, 330, 17, 331,-32768, 350,-32768, 93,-32768, 327, - 52, 65, 333, 103,-32768,-32768, 46, 17, 318,-32768, - 318, 335, 113, 56, 56,-32768, 56,-32768, 56,-32768, --32768,-32768,-32768, 17, 17,-32768,-32768,-32768,-32768,-32768, --32768,-32768,-32768, 372, 374,-32768 +-32768,-32768, 22, 313, 262, 144, 131,-32768, 327, 160, + 198, 159,-32768,-32768, 262, 25, 162, 180,-32768, 161, + 171, 178, 164, 181, 341,-32768,-32768, 183,-32768, 341, +-32768, 196, 182, 8,-32768, 341,-32768, 214, 193, 201, +-32768, 262,-32768, 186, 212, 229, 48, 62, 57, 122, +-32768, 236, 246,-32768, 233, 279, 131,-32768,-32768, 243, + 270, 280,-32768, 50,-32768, 287, 262, 277, 50, 262, + -1, 9, 279, -5, 278, 302, 281, 283, 295, 314, +-32768,-32768,-32768, 262, 299, 279, 296, 309, 0, 331, + 311,-32768, 316,-32768,-32768,-32768, 98,-32768,-32768, 324, + 345, 279, 346,-32768, 344, 335, 328,-32768,-32768, 354, + 358,-32768,-32768,-32768,-32768,-32768,-32768,-32768, 339, 357, + 342, 104, 105, 262, 38, 362, 228,-32768, 364, 279, + 348, 349, 352,-32768,-32768, 362,-32768,-32768,-32768, 16, + 362, 262, 262,-32768, 353, 365, 10, 57,-32768,-32768, +-32768, 350, 279, 362, 279, 57, 356,-32768, 57,-32768, +-32768, 366, 109, 363, 369,-32768,-32768, 362, 355, 57, + 359,-32768, 371,-32768, 109,-32768, 360, 43, 53, 361, + 61,-32768,-32768, 10, 57, 362,-32768, 362, 367, 100, + 6, 6,-32768, 6,-32768, 6,-32768,-32768,-32768,-32768, + 57, 57,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768, + 396, 397,-32768 }; static const short yypgoto[] = {-32768, - 13, 78, 368,-32768,-32768,-32768, 348, -22, 253, 255, - 259,-32768,-32768,-32768, -20, 282, -18,-32768, -35,-32768, - 343, -73, 288,-32768, -57,-32768, -192,-32768, -170, 158, - -121, 215,-32768, 213, 170, -164, -124 + 351, 163, 389,-32768,-32768,-32768, 370, -18, 275, 282, + 284,-32768,-32768,-32768, -16, 304, -24,-32768, -38,-32768, + -37, -10, 315,-32768, -36,-32768, -186,-32768, -180, 176, + -119, 4,-32768, 232, 187, -152, -124 }; -#define YYLAST 388 - - -static const short yytable[] = { 161, - 210, 156, 55, 121, 77, 61, 56, 79, 215, 107, - 108, 217, 201, 67, 170, 202, 153, 204, 81, 12, - 230, 13, 16, 87, 128, 129, 124, 13, 213, 179, - 13, 113, 115, 144, 154, 243, 82, 203, 90, 77, - 228, 17, -106, 36, 77, 96, 95, 171, 84, 110, - 77, 252, 253, 130, 147, 197, 148, 131, 244, 241, - 245, 113, 157, 158, 157, 158, 112, 37, 241, 111, - 157, 158, 190, 116, 157, 158, 212, 38, 214, 62, - 159, 175, 207, 157, 158, 121, 176, 15, 122, 191, - 70, 18, 160, 235, 160, 68, 236, 238, 150, 71, - 160, 152, 73, 79, 160, 123, 237, 83, 124, 248, - 249, 219, 250, 160, 251, 168, 40, 41, 42, 43, - 44, 219, 45, 46, 47, 48, 49, 50, 51, 52, - 53, 219, 54, 84, 220, 88, 94, 97, 221, 222, - 223, 98, 240, 99, 220, 65, 66, 100, 221, 222, - 223, 103, 247, 101, 220, 104, 102, 105, 221, 222, - 223, 40, 41, 42, 43, 44, 106, 45, 46, 47, - 48, 49, 50, 51, 52, 53, 1, 54, 114, 89, - 109, 117, 118, 119, 134, 20, 21, 22, 23, 20, - 21, 22, 23, 19, 136, 135, 2, 3, 4, 5, - 6, 7, 145, 20, 21, 22, 23, 24, 25, 26, - 27, 19, 28, 110, 149, 29, 111, 151, 121, 169, - 164, 20, 21, 22, 23, 24, 25, 26, 27, 110, - 63, 124, 167, 29, 172, 174, 165, 166, -105, 20, - 21, 22, 23, 2, 3, 4, 5, 6, 7, 111, - 40, 41, 42, 43, 44, 194, 45, 46, 47, 48, - 49, 50, 51, 52, 53, 173, 54, 75, 41, 42, - 43, 44, 177, 45, 46, 47, 48, 49, 50, 51, - 52, 76, 178, 54, 40, 41, 42, 43, 44, 180, - 45, 46, 47, 48, 49, 50, 51, 52, 53, 181, - 54, 40, 137, 42, 43, 44, 182, 45, 46, 47, - 48, 49, 50, 51, 52, 138, 184, 54, 80, 41, - 183, 185, 186, 187, 45, 46, 47, 48, 49, 50, - 51, 52, 86, 41, 54, 188, 192, 196, 45, 46, - 47, 48, 49, 50, 51, 52, 75, 41, 54, 198, - 206, 199, 45, 46, 47, 48, 49, 50, 51, 52, - 200, 205, 54, 211, 218, 216, 226, 227, 234, 229, - 231, 255, 232, 256, 239, 246, 14, 64, 163, 162, - 155, 133, 78, 120, 242, 189, 195, 233 +#define YYLAST 412 + + +static const short yytable[] = { 162, + 56, 77, 78, 157, 173, 206, 55, 67, 12, 61, + 209, 217, 107, 158, 159, 81, 171, 154, 17, 222, + 87, 16, 224, 220, 158, 159, 79, 121, 158, 159, + 82, 160, 182, 237, 207, 155, 77, 235, 36, -106, + 95, 77, 90, 161, 174, 37, 214, 77, 250, 96, + 124, 84, 113, 115, 161, 251, 208, 252, 161, 195, + 202, 158, 159, 38, 259, 260, 121, 116, 110, 122, + 112, 158, 159, 108, 62, 148, 196, 149, 248, 226, + 128, 129, 113, 219, 242, 221, 123, 248, 111, 124, + 1, 161, 151, 130, 244, 153, 145, 131, 77, 78, + 247, 161, 227, 243, 245, 68, 228, 229, 230, 169, + 2, 3, 4, 5, 6, 7, 255, 256, 226, 257, + 70, 258, 40, 41, 42, 43, 44, 226, 45, 46, + 47, 48, 49, 50, 51, 52, 53, 178, 54, 254, + 71, 227, 179, -108, -107, 228, 229, 230, 192, 193, + 227, 65, 66, 73, 228, 229, 230, 40, 41, 42, + 43, 44, 83, 45, 46, 47, 48, 49, 50, 51, + 52, 53, 15, 54, 84, 19, 18, 194, 88, 94, + 97, 20, 21, 22, 23, 20, 21, 22, 23, 24, + 25, 26, 27, 19, 28, 210, 211, 29, 98, 103, + 99, 104, 102, 20, 21, 22, 23, 24, 25, 26, + 27, 110, 63, 100, 105, 29, 89, 101, 109, 114, + 106, 20, 21, 22, 23, 117, 20, 21, 22, 23, + 118, 111, 40, 41, 42, 43, 44, 199, 45, 46, + 47, 48, 49, 50, 51, 52, 53, 119, 54, 75, + 41, 42, 43, 44, 134, 45, 46, 47, 48, 49, + 50, 51, 52, 76, 135, 54, 40, 41, 42, 43, + 44, 136, 45, 46, 47, 48, 49, 50, 51, 52, + 53, 111, 54, 137, 138, 42, 43, 44, 146, 45, + 46, 47, 48, 49, 50, 51, 52, 139, 110, 54, + 75, 41, 42, 43, 44, 150, 45, 46, 47, 48, + 49, 50, 51, 52, 172, 152, 54, 80, 41, 124, + 121, 165, 166, 45, 46, 47, 48, 49, 50, 51, + 52, 86, 41, 54, 167, 170, 168, 45, 46, 47, + 48, 49, 50, 51, 52, 75, 41, 54, -105, 175, + 176, 45, 46, 47, 48, 49, 50, 51, 52, 13, + 177, 54, 180, 181, 183, 13, 184, 186, 13, 2, + 3, 4, 5, 6, 7, 185, 187, 188, 189, 190, + 197, 191, 201, 213, 225, 233, 203, 234, 204, 218, + 205, 212, 223, 239, 236, 262, 263, 14, 238, 64, + 164, 241, 246, 133, 0, 156, 163, 253, 200, 249, + 120, 240 }; static const short yycheck[] = { 124, - 193, 123, 25, 19, 40, 26, 25, 5, 201, 5, - 84, 204, 183, 32, 136, 19, 19, 188, 54, 21, - 213, 9, 37, 59, 19, 20, 42, 15, 199, 151, - 18, 89, 90, 107, 37, 228, 55, 41, 61, 75, - 211, 4, 40, 21, 80, 66, 65, 45, 44, 19, - 86, 244, 245, 37, 112, 177, 114, 41, 229, 224, - 231, 119, 19, 20, 19, 20, 89, 39, 233, 39, - 19, 20, 22, 92, 19, 20, 198, 39, 200, 39, - 37, 40, 37, 19, 20, 19, 45, 10, 22, 39, - 19, 14, 49, 42, 49, 39, 221, 222, 117, 19, - 49, 120, 19, 5, 49, 39, 42, 19, 42, 234, - 235, 19, 237, 49, 239, 134, 5, 6, 7, 8, - 9, 19, 11, 12, 13, 14, 15, 16, 17, 18, - 19, 19, 21, 44, 42, 19, 21, 19, 46, 47, - 48, 19, 40, 40, 42, 34, 35, 43, 46, 47, - 48, 19, 40, 40, 42, 19, 39, 19, 46, 47, - 48, 5, 6, 7, 8, 9, 39, 11, 12, 13, - 14, 15, 16, 17, 18, 19, 3, 21, 19, 19, - 5, 40, 19, 19, 19, 29, 30, 31, 32, 29, - 30, 31, 32, 19, 39, 19, 23, 24, 25, 26, - 27, 28, 19, 29, 30, 31, 32, 33, 34, 35, - 36, 19, 38, 19, 19, 41, 39, 39, 19, 37, - 41, 29, 30, 31, 32, 33, 34, 35, 36, 19, - 38, 42, 23, 41, 19, 45, 40, 40, 40, 29, - 30, 31, 32, 23, 24, 25, 26, 27, 28, 39, - 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, - 15, 16, 17, 18, 19, 40, 21, 5, 6, 7, - 8, 9, 39, 11, 12, 13, 14, 15, 16, 17, - 18, 19, 19, 21, 5, 6, 7, 8, 9, 19, - 11, 12, 13, 14, 15, 16, 17, 18, 19, 23, - 21, 5, 6, 7, 8, 9, 41, 11, 12, 13, - 14, 15, 16, 17, 18, 19, 23, 21, 5, 6, - 40, 20, 40, 23, 11, 12, 13, 14, 15, 16, - 17, 18, 5, 6, 21, 40, 19, 19, 11, 12, - 13, 14, 15, 16, 17, 18, 5, 6, 21, 39, - 19, 40, 11, 12, 13, 14, 15, 16, 17, 18, - 39, 39, 21, 40, 19, 37, 23, 19, 42, 40, - 40, 0, 23, 0, 42, 41, 9, 30, 126, 125, - 122, 100, 40, 96, 227, 171, 174, 218 + 25, 40, 40, 123, 5, 186, 25, 32, 21, 26, + 191, 198, 5, 19, 20, 54, 136, 19, 4, 206, + 59, 37, 209, 204, 19, 20, 5, 19, 19, 20, + 55, 37, 152, 220, 19, 37, 75, 218, 21, 40, + 65, 80, 61, 49, 45, 39, 37, 86, 235, 66, + 42, 44, 89, 90, 49, 236, 41, 238, 49, 22, + 180, 19, 20, 39, 251, 252, 19, 92, 19, 22, + 89, 19, 20, 84, 39, 112, 39, 114, 231, 19, + 19, 20, 119, 203, 42, 205, 39, 240, 39, 42, + 3, 49, 117, 37, 42, 120, 107, 41, 137, 137, + 40, 49, 42, 228, 229, 39, 46, 47, 48, 134, + 23, 24, 25, 26, 27, 28, 241, 242, 19, 244, + 19, 246, 5, 6, 7, 8, 9, 19, 11, 12, + 13, 14, 15, 16, 17, 18, 19, 40, 21, 40, + 19, 42, 45, 40, 40, 46, 47, 48, 45, 45, + 42, 34, 35, 19, 46, 47, 48, 5, 6, 7, + 8, 9, 19, 11, 12, 13, 14, 15, 16, 17, + 18, 19, 10, 21, 44, 19, 14, 174, 19, 21, + 19, 29, 30, 31, 32, 29, 30, 31, 32, 33, + 34, 35, 36, 19, 38, 192, 193, 41, 19, 19, + 40, 19, 39, 29, 30, 31, 32, 33, 34, 35, + 36, 19, 38, 43, 19, 41, 19, 40, 5, 19, + 39, 29, 30, 31, 32, 40, 29, 30, 31, 32, + 19, 39, 5, 6, 7, 8, 9, 10, 11, 12, + 13, 14, 15, 16, 17, 18, 19, 19, 21, 5, + 6, 7, 8, 9, 19, 11, 12, 13, 14, 15, + 16, 17, 18, 19, 19, 21, 5, 6, 7, 8, + 9, 39, 11, 12, 13, 14, 15, 16, 17, 18, + 19, 39, 21, 5, 6, 7, 8, 9, 19, 11, + 12, 13, 14, 15, 16, 17, 18, 19, 19, 21, + 5, 6, 7, 8, 9, 19, 11, 12, 13, 14, + 15, 16, 17, 18, 19, 39, 21, 5, 6, 42, + 19, 41, 40, 11, 12, 13, 14, 15, 16, 17, + 18, 5, 6, 21, 40, 37, 23, 11, 12, 13, + 14, 15, 16, 17, 18, 5, 6, 21, 40, 19, + 40, 11, 12, 13, 14, 15, 16, 17, 18, 9, + 45, 21, 39, 19, 19, 15, 23, 40, 18, 23, + 24, 25, 26, 27, 28, 41, 23, 20, 40, 23, + 19, 40, 19, 19, 19, 23, 39, 19, 40, 40, + 39, 39, 37, 23, 40, 0, 0, 9, 40, 30, + 126, 42, 42, 100, -1, 122, 125, 41, 177, 234, + 96, 225 }; /* -*-C-*- Note some compilers choke on comments on `#line' lines. */ #line 3 "/usr/lib/bison.simple" @@ -1209,23 +1224,23 @@ yyreduce: switch (yyn) { case 1: -#line 312 "parse.y" +#line 313 "parse.y" { ; ; break;} case 2: -#line 313 "parse.y" +#line 314 "parse.y" { ; ; break;} case 3: -#line 314 "parse.y" +#line 315 "parse.y" { ; ; break;} case 4: -#line 315 "parse.y" +#line 316 "parse.y" { ; ; break;} case 5: -#line 318 "parse.y" +#line 319 "parse.y" { Node *node = new_ccode(C_CCODE,(yyvsp[0].cbuf)->str, ccode_line); @@ -1234,7 +1249,7 @@ case 5: ; break;} case 6: -#line 324 "parse.y" +#line 325 "parse.y" { Node *node = new_ccode(H_CCODE,(yyvsp[0].cbuf)->str, ccode_line); @@ -1243,7 +1258,7 @@ case 6: ; break;} case 7: -#line 330 "parse.y" +#line 331 "parse.y" { Node *node = new_ccode(HT_CCODE,(yyvsp[0].cbuf)->str, ccode_line); @@ -1252,7 +1267,7 @@ case 7: ; break;} case 8: -#line 336 "parse.y" +#line 337 "parse.y" { Node *node = new_ccode(PH_CCODE,(yyvsp[0].cbuf)->str, ccode_line); @@ -1261,7 +1276,7 @@ case 8: ; break;} case 9: -#line 342 "parse.y" +#line 343 "parse.y" { Node *node = new_ccode(A_CCODE,(yyvsp[0].cbuf)->str, ccode_line); @@ -1270,7 +1285,7 @@ case 9: ; break;} case 10: -#line 348 "parse.y" +#line 349 "parse.y" { Node *node = new_ccode(AT_CCODE,(yyvsp[0].cbuf)->str, ccode_line); @@ -1279,15 +1294,15 @@ case 10: ; break;} case 11: -#line 356 "parse.y" +#line 357 "parse.y" { ; ; break;} case 12: -#line 357 "parse.y" +#line 358 "parse.y" { ; ; break;} case 13: -#line 360 "parse.y" +#line 361 "parse.y" { ((Class *)class)->nodes = class_nodes; class_nodes = NULL; @@ -1295,7 +1310,7 @@ case 13: ; break;} case 14: -#line 365 "parse.y" +#line 366 "parse.y" { ((Class *)class)->nodes = NULL; class_nodes = NULL; @@ -1303,13 +1318,13 @@ case 14: ; break;} case 15: -#line 372 "parse.y" +#line 373 "parse.y" { class = new_class(yyvsp[-3].id,yyvsp[-1].id,chunk_size,NULL); ; break;} case 17: -#line 378 "parse.y" +#line 379 "parse.y" { if(strcmp(yyvsp[-2].id,"chunks") == 0) { chunk_size = g_strdup(yyvsp[0].id); @@ -1320,7 +1335,7 @@ case 17: ; break;} case 18: -#line 386 "parse.y" +#line 387 "parse.y" { if(strcmp(yyvsp[-2].id,"chunks") == 0) { if(atoi(yyvsp[0].id) != 0) @@ -1332,47 +1347,47 @@ case 18: ; break;} case 19: -#line 397 "parse.y" +#line 398 "parse.y" { ; ; break;} case 20: -#line 398 "parse.y" +#line 399 "parse.y" { ; ; break;} case 21: -#line 401 "parse.y" +#line 402 "parse.y" { ; ; break;} case 22: -#line 402 "parse.y" +#line 403 "parse.y" { ; ; break;} case 23: -#line 403 "parse.y" +#line 404 "parse.y" { ; ; break;} case 24: -#line 404 "parse.y" +#line 405 "parse.y" { ; ; break;} case 25: -#line 407 "parse.y" +#line 408 "parse.y" { the_scope = PUBLIC_SCOPE; ; break;} case 26: -#line 408 "parse.y" +#line 409 "parse.y" { the_scope = PRIVATE_SCOPE; ; break;} case 27: -#line 409 "parse.y" +#line 410 "parse.y" { the_scope = PROTECTED_SCOPE; ; break;} case 28: -#line 410 "parse.y" +#line 411 "parse.y" { the_scope = CLASS_SCOPE; ; break;} case 29: -#line 413 "parse.y" +#line 414 "parse.y" { if(strcmp(yyvsp[-1].id, "destroywith")==0) { g_free(yyvsp[-1].id); @@ -1388,7 +1403,7 @@ case 29: ; break;} case 30: -#line 426 "parse.y" +#line 427 "parse.y" { if(strcmp(yyvsp[-2].id, "destroy")==0) { g_free(yyvsp[-2].id); @@ -1405,14 +1420,14 @@ case 30: ; break;} case 31: -#line 442 "parse.y" +#line 443 "parse.y" { initializer = yyvsp[0].id; initializer_line = ccode_line; ; break;} case 32: -#line 446 "parse.y" +#line 447 "parse.y" { initializer = (yyvsp[0].cbuf)->str; initializer_line = ccode_line; @@ -1420,42 +1435,42 @@ case 32: ; break;} case 33: -#line 454 "parse.y" +#line 455 "parse.y" { ; ; break;} case 34: -#line 455 "parse.y" +#line 456 "parse.y" { ; ; break;} case 35: -#line 456 "parse.y" +#line 457 "parse.y" { destructor = NULL; ; break;} case 36: -#line 457 "parse.y" +#line 458 "parse.y" { initializer = NULL; ; break;} case 37: -#line 458 "parse.y" +#line 459 "parse.y" { destructor = NULL; initializer = NULL; ; break;} case 38: -#line 464 "parse.y" +#line 465 "parse.y" { push_variable(yyvsp[-2].id, the_scope,yyvsp[-4].line, NULL); ; break;} case 39: -#line 467 "parse.y" +#line 468 "parse.y" { push_variable(yyvsp[-3].id, the_scope, yyvsp[-5].line, yyvsp[-2].id); ; break;} case 40: -#line 471 "parse.y" +#line 472 "parse.y" { if(strcmp(yyvsp[-6].id,"get")==0 && strcmp(yyvsp[-3].id,"set")==0) { @@ -1485,6 +1500,7 @@ case 40: g_free(yyvsp[-8].id); g_free(yyvsp[-7].id); g_free(yyvsp[-6].id); g_free(yyvsp[-3].id); g_list_foreach(yyvsp[-9].list,(GFunc)g_free,NULL); + g_list_free(yyvsp[-9].list); g_string_free(yyvsp[-1].cbuf,TRUE); g_string_free(yyvsp[-4].cbuf,TRUE); yyerror(_("parse error")); @@ -1493,38 +1509,39 @@ case 40: ; break;} case 41: -#line 506 "parse.y" +#line 508 "parse.y" { - if(strcmp(yyvsp[-3].id,"get")==0) { + if(strcmp(yyvsp[-3].id, "get") == 0) { Node *node; Type *type = pop_type(); g_free(yyvsp[-3].id); - node = new_argument(yyvsp[-5].id,type,yyvsp[-6].list,yyvsp[-4].id, - (yyvsp[-1].cbuf)->str,yyvsp[-2].line, - NULL,0, yyvsp[-7].line); - g_string_free(yyvsp[-1].cbuf,FALSE); - class_nodes = g_list_append(class_nodes,node); - } else if(strcmp(yyvsp[-3].id,"set")==0) { + node = new_argument(yyvsp[-5].id, type, yyvsp[-6].list, yyvsp[-4].id, + (yyvsp[-1].cbuf)->str, yyvsp[-2].line, + NULL, 0, yyvsp[-7].line); + g_string_free(yyvsp[-1].cbuf, FALSE); + class_nodes = g_list_append(class_nodes, node); + } else if(strcmp(yyvsp[-3].id, "set") == 0) { Node *node; Type *type = pop_type(); g_free(yyvsp[-3].id); - node = new_argument(yyvsp[-5].id,type,yyvsp[-6].list,yyvsp[-4].id, - NULL,0,(yyvsp[-1].cbuf)->str, + node = new_argument(yyvsp[-5].id, type, yyvsp[-6].list, yyvsp[-4].id, + NULL, 0, (yyvsp[-1].cbuf)->str, yyvsp[-2].line, yyvsp[-7].line); - g_string_free(yyvsp[-1].cbuf,FALSE); - class_nodes = g_list_append(class_nodes,node); + g_string_free(yyvsp[-1].cbuf, FALSE); + class_nodes = g_list_append(class_nodes, node); } else { g_free(yyvsp[-3].id); g_free(yyvsp[-5].id); g_free(yyvsp[-4].id); - g_list_foreach(yyvsp[-6].list,(GFunc)g_free,NULL); - g_string_free(yyvsp[-1].cbuf,TRUE); + g_list_foreach(yyvsp[-6].list, (GFunc)g_free, NULL); + g_list_free(yyvsp[-6].list); + g_string_free(yyvsp[-1].cbuf, TRUE); yyerror(_("parse error")); YYERROR; } ; break;} case 42: -#line 534 "parse.y" +#line 537 "parse.y" { Node *node; char *get, *set = NULL; @@ -1538,6 +1555,7 @@ case 42: g_free(yyvsp[0].id); g_free(yyvsp[-2].id); g_free(yyvsp[-1].id); g_list_foreach(yyvsp[-3].list,(GFunc)g_free,NULL); + g_list_free(yyvsp[-3].list); yyerror(_("parse error")); YYERROR; } @@ -1547,9 +1565,13 @@ case 42: var = find_var_or_die(yyvsp[-1].id, yyvsp[-4].line); if(var->scope == PRIVATE_SCOPE) root = "self->_priv"; - else if(var->scope == CLASS_SCOPE) - root = "SELF_CLASS(GTK_OBJECT(self)->klass)"; - else + else if(var->scope == CLASS_SCOPE) { + root = "SELF_GET_CLASS(self)"; + if(no_self_alias) + print_error(FALSE, + _("Self aliases needed when autolinking to a classwide member"), + yyvsp[-4].line); + } else root = "self"; if(strcmp(yyvsp[0].id, "link")==0) { @@ -1595,7 +1617,7 @@ case 42: ; break;} case 43: -#line 604 "parse.y" +#line 612 "parse.y" { if(strcmp(yyvsp[-2].id,"type")!=0) { g_free(yyvsp[-4].id); @@ -1607,81 +1629,81 @@ case 43: ; break;} case 44: -#line 613 "parse.y" +#line 621 "parse.y" { yyval.id = yyvsp[0].id; typestack = g_list_prepend(typestack,NULL); ; break;} case 45: -#line 619 "parse.y" +#line 627 "parse.y" { yyval.list = yyvsp[-1].list; ; break;} case 46: -#line 620 "parse.y" +#line 628 "parse.y" { yyval.list = NULL; ; break;} case 47: -#line 623 "parse.y" +#line 631 "parse.y" { yyval.list = g_list_append(yyvsp[0].list,yyvsp[-2].id); ; break;} case 48: -#line 626 "parse.y" +#line 634 "parse.y" { yyval.list = g_list_append(NULL,yyvsp[0].id); ; break;} case 49: -#line 632 "parse.y" +#line 640 "parse.y" { Node *node = new_type(yyvsp[-1].id, yyvsp[0].id, NULL); typestack = g_list_prepend(typestack,node); ; break;} case 50: -#line 636 "parse.y" +#line 644 "parse.y" { Node *node = new_type(yyvsp[0].id, NULL, NULL); typestack = g_list_prepend(typestack,node); ; break;} case 51: -#line 643 "parse.y" +#line 651 "parse.y" { yyval.id = yyvsp[0].id; ; break;} case 52: -#line 646 "parse.y" +#line 654 "parse.y" { yyval.id = yyvsp[0].id; ; break;} case 53: -#line 649 "parse.y" +#line 657 "parse.y" { yyval.id = g_strconcat("const ", yyvsp[0].id, NULL); g_free(yyvsp[0].id); ; break;} case 54: -#line 653 "parse.y" +#line 661 "parse.y" { yyval.id = g_strconcat(yyvsp[-1].id, " const", NULL); g_free(yyvsp[-1].id); ; break;} case 55: -#line 657 "parse.y" +#line 665 "parse.y" { yyval.id = g_strconcat(yyvsp[-1].id, " ", yyvsp[0].id, NULL); g_free(yyvsp[0].id); ; break;} case 56: -#line 661 "parse.y" +#line 669 "parse.y" { yyval.id = g_strconcat("const ", yyvsp[-1].id, " ", yyvsp[0].id, NULL); @@ -1689,7 +1711,7 @@ case 56: ; break;} case 57: -#line 666 "parse.y" +#line 674 "parse.y" { yyval.id = g_strconcat(yyvsp[-2].id, " ", yyvsp[-1].id, " const", NULL); @@ -1697,14 +1719,14 @@ case 57: ; break;} case 58: -#line 674 "parse.y" +#line 682 "parse.y" { yyval.id = g_strconcat(yyvsp[-1].id, " ", yyvsp[0].id, NULL); g_free(yyvsp[0].id); ; break;} case 59: -#line 678 "parse.y" +#line 686 "parse.y" { yyval.id = g_strconcat(yyvsp[-1].id, " ", yyvsp[0].id, NULL); g_free(yyvsp[-1].id); @@ -1712,109 +1734,109 @@ case 59: ; break;} case 60: -#line 683 "parse.y" +#line 691 "parse.y" { yyval.id = g_strconcat("const ", yyvsp[0].id, NULL); g_free(yyvsp[0].id); ; break;} case 61: -#line 687 "parse.y" +#line 695 "parse.y" { yyval.id = yyvsp[0].id; ; break;} case 62: -#line 690 "parse.y" +#line 698 "parse.y" { yyval.id = g_strconcat(yyvsp[-1].id, " const", NULL); g_free(yyvsp[-1].id); ; break;} case 63: -#line 694 "parse.y" +#line 702 "parse.y" { yyval.id = g_strdup(yyvsp[0].id); ; break;} case 64: -#line 697 "parse.y" +#line 705 "parse.y" { yyval.id = g_strconcat(yyvsp[-1].id, " const", NULL); ; break;} case 65: -#line 702 "parse.y" +#line 710 "parse.y" { yyval.id = "void"; ; break;} case 66: -#line 703 "parse.y" +#line 711 "parse.y" { yyval.id = "char"; ; break;} case 67: -#line 704 "parse.y" +#line 712 "parse.y" { yyval.id = "short"; ; break;} case 68: -#line 705 "parse.y" +#line 713 "parse.y" { yyval.id = "int"; ; break;} case 69: -#line 706 "parse.y" +#line 714 "parse.y" { yyval.id = "long"; ; break;} case 70: -#line 707 "parse.y" +#line 715 "parse.y" { yyval.id = "float"; ; break;} case 71: -#line 708 "parse.y" +#line 716 "parse.y" { yyval.id = "double"; ; break;} case 72: -#line 709 "parse.y" +#line 717 "parse.y" { yyval.id = "signed"; ; break;} case 73: -#line 710 "parse.y" +#line 718 "parse.y" { yyval.id = "unsigned"; ; break;} case 74: -#line 713 "parse.y" +#line 721 "parse.y" { yyval.id = "struct"; ; break;} case 75: -#line 714 "parse.y" +#line 722 "parse.y" { yyval.id = "union"; ; break;} case 76: -#line 715 "parse.y" +#line 723 "parse.y" { yyval.id = "enum"; ; break;} case 77: -#line 718 "parse.y" +#line 726 "parse.y" { yyval.id = g_strdup("*"); ; break;} case 78: -#line 719 "parse.y" +#line 727 "parse.y" { yyval.id = g_strdup("* const"); ; break;} case 79: -#line 720 "parse.y" +#line 728 "parse.y" { yyval.id = g_strconcat("*", yyvsp[0].id, NULL); g_free(yyvsp[0].id); ; break;} case 80: -#line 724 "parse.y" +#line 732 "parse.y" { yyval.id = g_strconcat("* const", yyvsp[0].id, NULL); g_free(yyvsp[0].id); ; break;} case 81: -#line 731 "parse.y" +#line 739 "parse.y" { if(strcmp(yyvsp[-1].id, "first")==0) yyval.sigtype = SIGNAL_FIRST_METHOD; @@ -1829,13 +1851,13 @@ case 81: ; break;} case 82: -#line 743 "parse.y" +#line 751 "parse.y" { yyval.sigtype = SIGNAL_LAST_METHOD; ; break;} case 83: -#line 749 "parse.y" +#line 757 "parse.y" { if(strcmp(yyvsp[-1].id,"first")==0) yyval.sigtype = SIGNAL_FIRST_METHOD; @@ -1850,7 +1872,7 @@ case 83: ; break;} case 84: -#line 761 "parse.y" +#line 769 "parse.y" { if(strcmp(yyvsp[-2].id,"first")==0) yyval.sigtype = SIGNAL_FIRST_METHOD; @@ -1865,46 +1887,46 @@ case 84: ; break;} case 85: -#line 773 "parse.y" +#line 781 "parse.y" { yyval.sigtype = SIGNAL_LAST_METHOD; ; break;} case 86: -#line 776 "parse.y" +#line 784 "parse.y" { /* the_scope was default thus public */ the_scope = PUBLIC_SCOPE; ; break;} case 87: -#line 782 "parse.y" +#line 790 "parse.y" { gtktypes = g_list_prepend(gtktypes, yyvsp[-3].id); ; break;} case 88: -#line 787 "parse.y" +#line 795 "parse.y" { gtktypes = g_list_append(gtktypes, yyvsp[0].id); ; break;} case 89: -#line 790 "parse.y" +#line 798 "parse.y" { gtktypes = g_list_append(gtktypes, yyvsp[0].id); ; break;} case 90: -#line 795 "parse.y" +#line 803 "parse.y" { yyval.cbuf = yyvsp[0].cbuf; ; break;} case 91: -#line 796 "parse.y" +#line 804 "parse.y" { yyval.cbuf = NULL; ; break;} case 92: -#line 800 "parse.y" +#line 808 "parse.y" { if(!has_self) { yyerror(_("signal without 'self' as " @@ -1923,7 +1945,7 @@ case 92: ; break;} case 93: -#line 816 "parse.y" +#line 824 "parse.y" { if(!has_self) { yyerror(_("signal without 'self' as " @@ -1942,7 +1964,7 @@ case 93: ; break;} case 94: -#line 832 "parse.y" +#line 840 "parse.y" { if(!has_self) { yyerror(_("virtual method without 'self' as " @@ -1961,7 +1983,7 @@ case 94: ; break;} case 95: -#line 848 "parse.y" +#line 856 "parse.y" { if(!has_self) { yyerror(_("virtual method without 'self' as " @@ -1980,7 +2002,7 @@ case 95: ; break;} case 96: -#line 864 "parse.y" +#line 872 "parse.y" { if(!has_self) { yyerror(_("virtual method without 'self' as " @@ -1994,7 +2016,7 @@ case 96: ; break;} case 97: -#line 875 "parse.y" +#line 883 "parse.y" { push_function(NO_SCOPE, OVERRIDE_METHOD, yyvsp[-8].id, yyvsp[-5].id, yyvsp[0].cbuf, @@ -2003,7 +2025,7 @@ case 97: ; break;} case 98: -#line 881 "parse.y" +#line 889 "parse.y" { if(the_scope == CLASS_SCOPE) { yyerror(_("a method cannot be of class scope")); @@ -2016,7 +2038,7 @@ case 98: ; break;} case 99: -#line 891 "parse.y" +#line 899 "parse.y" { if(strcmp(yyvsp[-4].id, "init")==0) { push_init_arg(yyvsp[-2].id,FALSE); @@ -2040,7 +2062,7 @@ case 99: ; break;} case 100: -#line 914 "parse.y" +#line 922 "parse.y" { g_free(onerror); onerror = NULL; g_free(defreturn); defreturn = NULL; @@ -2054,7 +2076,7 @@ case 100: ; break;} case 101: -#line 925 "parse.y" +#line 933 "parse.y" { g_free(onerror); onerror = NULL; g_free(defreturn); defreturn = NULL; @@ -2076,34 +2098,34 @@ case 101: ; break;} case 102: -#line 944 "parse.y" +#line 952 "parse.y" { g_free(onerror); onerror = NULL; g_free(defreturn); defreturn = NULL; ; break;} case 103: -#line 950 "parse.y" +#line 958 "parse.y" { yyval.id = yyvsp[0].id; ; break;} case 104: -#line 951 "parse.y" +#line 959 "parse.y" { yyval.id = (yyvsp[1].cbuf)->str; g_string_free(yyvsp[1].cbuf, FALSE); ; break;} case 105: -#line 957 "parse.y" +#line 965 "parse.y" { vararg = FALSE; has_self = FALSE; ; break;} case 106: -#line 958 "parse.y" +#line 966 "parse.y" { vararg = FALSE; has_self = TRUE; if(strcmp(yyvsp[0].id,"self")==0) - push_self(yyvsp[0].id); + push_self(yyvsp[0].id, FALSE); else { g_free(yyvsp[0].id); yyerror(_("parse error")); @@ -2112,11 +2134,39 @@ case 106: ; break;} case 107: -#line 969 "parse.y" +#line 977 "parse.y" +{ + vararg = FALSE; + has_self = TRUE; + if(strcmp(yyvsp[-1].id,"self")==0) + push_self(yyvsp[-1].id, TRUE); + else { + g_free(yyvsp[-1].id); + yyerror(_("parse error")); + YYERROR; + } + ; + break;} +case 108: +#line 988 "parse.y" +{ + vararg = FALSE; + has_self = TRUE; + if(strcmp(yyvsp[0].id,"self")==0) + push_self(yyvsp[0].id, TRUE); + else { + g_free(yyvsp[0].id); + yyerror(_("parse error")); + YYERROR; + } + ; + break;} +case 109: +#line 999 "parse.y" { has_self = TRUE; if(strcmp(yyvsp[-2].id,"self")==0) - push_self(yyvsp[-2].id); + push_self(yyvsp[-2].id, FALSE); else { g_free(yyvsp[-2].id); yyerror(_("parse error")); @@ -2124,40 +2174,66 @@ case 107: } ; break;} -case 108: -#line 979 "parse.y" +case 110: +#line 1009 "parse.y" +{ + has_self = TRUE; + if(strcmp(yyvsp[-3].id,"self")==0) + push_self(yyvsp[-3].id, TRUE); + else { + g_free(yyvsp[-3].id); + yyerror(_("parse error")); + YYERROR; + } + ; + break;} +case 111: +#line 1019 "parse.y" +{ + has_self = TRUE; + if(strcmp(yyvsp[-2].id,"self")==0) + push_self(yyvsp[-2].id, TRUE); + else { + g_free(yyvsp[-2].id); + yyerror(_("parse error")); + YYERROR; + } + ; + break;} +case 112: +#line 1029 "parse.y" { has_self = FALSE; ; break;} -case 109: -#line 982 "parse.y" +case 113: +#line 1032 "parse.y" { vararg = TRUE; ; break;} -case 110: -#line 983 "parse.y" +case 114: +#line 1033 "parse.y" { vararg = FALSE; ; break;} -case 111: -#line 986 "parse.y" +case 115: +#line 1036 "parse.y" { ; ; break;} -case 112: -#line 987 "parse.y" +case 116: +#line 1037 "parse.y" { ; ; break;} -case 113: -#line 990 "parse.y" +case 117: +#line 1040 "parse.y" { push_funcarg(yyvsp[0].id,NULL); ; break;} -case 114: -#line 993 "parse.y" +case 118: +#line 1043 "parse.y" { push_funcarg(yyvsp[-1].id,yyvsp[0].id); ; break;} -case 115: -#line 996 "parse.y" +case 119: +#line 1046 "parse.y" { if(strcmp(yyvsp[-2].id,"check")!=0) { yyerror(_("parse error")); @@ -2167,8 +2243,8 @@ case 115: push_funcarg(yyvsp[-4].id,NULL); ; break;} -case 116: -#line 1004 "parse.y" +case 120: +#line 1054 "parse.y" { if(strcmp(yyvsp[-2].id,"check")!=0) { yyerror(_("parse error")); @@ -2178,16 +2254,16 @@ case 116: push_funcarg(yyvsp[-5].id,yyvsp[-4].id); ; break;} -case 117: -#line 1014 "parse.y" +case 121: +#line 1064 "parse.y" { ; ; break;} -case 118: -#line 1015 "parse.y" +case 122: +#line 1065 "parse.y" { ; ; break;} -case 119: -#line 1018 "parse.y" +case 123: +#line 1068 "parse.y" { if(strcmp(yyvsp[0].id,"type")==0) { Node *node = new_check(TYPE_CHECK,NULL); @@ -2202,61 +2278,61 @@ case 119: g_free(yyvsp[0].id); ; break;} -case 120: -#line 1031 "parse.y" +case 124: +#line 1081 "parse.y" { Node *node = new_check(GT_CHECK,yyvsp[0].id); checks = g_list_append(checks,node); ; break;} -case 121: -#line 1035 "parse.y" +case 125: +#line 1085 "parse.y" { Node *node = new_check(LT_CHECK,yyvsp[0].id); checks = g_list_append(checks,node); ; break;} -case 122: -#line 1039 "parse.y" +case 126: +#line 1089 "parse.y" { Node *node = new_check(GE_CHECK,yyvsp[0].id); checks = g_list_append(checks,node); ; break;} -case 123: -#line 1043 "parse.y" +case 127: +#line 1093 "parse.y" { Node *node = new_check(LE_CHECK,yyvsp[0].id); checks = g_list_append(checks,node); ; break;} -case 124: -#line 1047 "parse.y" +case 128: +#line 1097 "parse.y" { Node *node = new_check(EQ_CHECK,yyvsp[0].id); checks = g_list_append(checks,node); ; break;} -case 125: -#line 1051 "parse.y" +case 129: +#line 1101 "parse.y" { Node *node = new_check(NE_CHECK,yyvsp[0].id); checks = g_list_append(checks,node); ; break;} -case 126: -#line 1057 "parse.y" +case 130: +#line 1107 "parse.y" { yyval.id = yyvsp[0].id; ; break;} -case 127: -#line 1058 "parse.y" +case 131: +#line 1108 "parse.y" { yyval.id = g_strconcat("-",yyvsp[0].id,NULL); g_free(yyvsp[0].id); ; break;} -case 128: -#line 1062 "parse.y" +case 132: +#line 1112 "parse.y" { yyval.id = yyvsp[0].id; ; break;} } @@ -2481,5 +2557,5 @@ yyerrhandle: } return 1; } -#line 1065 "parse.y" +#line 1115 "parse.y" diff --git a/src/parse.y b/src/parse.y index 9764b67..f29f9de 100644 --- a/src/parse.y +++ b/src/parse.y @@ -235,12 +235,13 @@ push_init_arg(char *name, int is_class) } static void -push_self(char *id) +push_self(char *id, gboolean constant) { Node *node; Node *type; GList *ch = NULL; - type = new_type(g_strdup(((Class *)class)->otype), g_strdup("*"), NULL); + type = new_type(g_strdup(((Class *)class)->otype), + g_strdup(constant ? "const *" : "*"), NULL); ch = g_list_append(ch,new_check(NULL_CHECK,NULL)); ch = g_list_append(ch,new_check(TYPE_CHECK,NULL)); node = new_funcarg((Type *)type,id,ch); @@ -497,6 +498,7 @@ argument: ARGUMENT flags argtype TOKEN TOKEN '{' CCODE TOKEN '{' CCODE ';' { g_free($3); g_free($4); g_free($5); g_free($8); g_list_foreach($2,(GFunc)g_free,NULL); + g_list_free($2); g_string_free($10,TRUE); g_string_free($7,TRUE); yyerror(_("parse error")); @@ -504,29 +506,30 @@ argument: ARGUMENT flags argtype TOKEN TOKEN '{' CCODE TOKEN '{' CCODE ';' { } } | ARGUMENT flags argtype TOKEN TOKEN '{' CCODE ';' { - if(strcmp($5,"get")==0) { + if(strcmp($5, "get") == 0) { Node *node; Type *type = pop_type(); g_free($5); - node = new_argument($3,type,$2,$4, - ($7)->str,$6, - NULL,0, $1); - g_string_free($7,FALSE); - class_nodes = g_list_append(class_nodes,node); - } else if(strcmp($5,"set")==0) { + node = new_argument($3, type, $2, $4, + ($7)->str, $6, + NULL, 0, $1); + g_string_free($7, FALSE); + class_nodes = g_list_append(class_nodes, node); + } else if(strcmp($5, "set") == 0) { Node *node; Type *type = pop_type(); g_free($5); - node = new_argument($3,type,$2,$4, - NULL,0,($7)->str, + node = new_argument($3, type, $2, $4, + NULL, 0, ($7)->str, $6, $1); - g_string_free($7,FALSE); - class_nodes = g_list_append(class_nodes,node); + g_string_free($7, FALSE); + class_nodes = g_list_append(class_nodes, node); } else { g_free($5); g_free($3); g_free($4); - g_list_foreach($2,(GFunc)g_free,NULL); - g_string_free($7,TRUE); + g_list_foreach($2, (GFunc)g_free, NULL); + g_list_free($2); + g_string_free($7, TRUE); yyerror(_("parse error")); YYERROR; } @@ -544,6 +547,7 @@ argument: ARGUMENT flags argtype TOKEN TOKEN '{' CCODE TOKEN '{' CCODE ';' { g_free($5); g_free($3); g_free($4); g_list_foreach($2,(GFunc)g_free,NULL); + g_list_free($2); yyerror(_("parse error")); YYERROR; } @@ -553,9 +557,13 @@ argument: ARGUMENT flags argtype TOKEN TOKEN '{' CCODE TOKEN '{' CCODE ';' { var = find_var_or_die($4, $1); if(var->scope == PRIVATE_SCOPE) root = "self->_priv"; - else if(var->scope == CLASS_SCOPE) - root = "SELF_CLASS(GTK_OBJECT(self)->klass)"; - else + else if(var->scope == CLASS_SCOPE) { + root = "SELF_GET_CLASS(self)"; + if(no_self_alias) + print_error(FALSE, + _("Self aliases needed when autolinking to a classwide member"), + $1); + } else root = "self"; if(strcmp($5, "link")==0) { @@ -959,23 +967,65 @@ funcargs: VOID { vararg = FALSE; has_self = FALSE; } vararg = FALSE; has_self = TRUE; if(strcmp($1,"self")==0) - push_self($1); + push_self($1, FALSE); else { g_free($1); yyerror(_("parse error")); YYERROR; } } + | TOKEN CONST { + vararg = FALSE; + has_self = TRUE; + if(strcmp($1,"self")==0) + push_self($1, TRUE); + else { + g_free($1); + yyerror(_("parse error")); + YYERROR; + } + } + | CONST TOKEN { + vararg = FALSE; + has_self = TRUE; + if(strcmp($2,"self")==0) + push_self($2, TRUE); + else { + g_free($2); + yyerror(_("parse error")); + YYERROR; + } + } | TOKEN ',' arglist { has_self = TRUE; if(strcmp($1,"self")==0) - push_self($1); + push_self($1, FALSE); else { g_free($1); yyerror(_("parse error")); YYERROR; } } + | TOKEN CONST ',' arglist { + has_self = TRUE; + if(strcmp($1,"self")==0) + push_self($1, TRUE); + else { + g_free($1); + yyerror(_("parse error")); + YYERROR; + } + } + | CONST TOKEN ',' arglist { + has_self = TRUE; + if(strcmp($2,"self")==0) + push_self($2, TRUE); + else { + g_free($2); + yyerror(_("parse error")); + YYERROR; + } + } | arglist { has_self = FALSE; } ; diff --git a/src/test.gob b/src/test.gob index be3f543..711ec50 100644 --- a/src/test.gob +++ b/src/test.gob @@ -204,6 +204,37 @@ class Gtk:Weird:Button from Gtk:Button { { return 25; } + public int consttest4(const self) + { + return 25; + } + public int consttest5(self const) + { + return 25; + } + virtual int consttest6(const self) + { + return 25; + } + virtual int consttest7(self const) + { + return 25; + } + public int consttest8(self) + { + Self const *selfconst1, *selfconst2; + selfconst1 = SELF_CONST(self); + selfconst2 = GTK_WEIRD_BUTTON_CONST(self); + return 25; + } + public int consttest9(const self, int i, double b) + { + return 25; + } + public int consttest10(self const, int i, double b) + { + return 25; + } signal private first NONE (NONE) void googlegoogle(self) { @@ -228,6 +259,16 @@ class Gtk:Weird:Button from Gtk:Button { { puts("TEST4"); } + protected signal first NONE (NONE) + void googlegoogle_const1(const self) + { + puts("TEST4"); + } + protected signal first NONE (NONE) + void googlegoogle_const2(self const) + { + puts("TEST4"); + } virtual private void testprivvirtual(self, int some_array[5][8][9]) { -- 2.43.0