From a611f21fab136f64bbf979bd62b2fc6ecb62933c Mon Sep 17 00:00:00 2001 From: George Lebl Date: Thu, 25 Nov 1999 22:12:00 -0800 Subject: [PATCH] Release 0.90.5 --- ChangeLog | 24 ++++++ NEWS | 5 ++ configure | 2 +- configure.in | 2 +- doc/gob.1.in | 29 ++++--- gob.spec | 2 +- src/main.c | 32 ++++++-- src/parse.c | 224 +++++++++++++++++++++++++++------------------------ src/parse.y | 14 ++++ src/test.gob | 4 +- 10 files changed, 210 insertions(+), 128 deletions(-) diff --git a/ChangeLog b/ChangeLog index 687bdc9..70a1891 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,27 @@ +Thu Nov 25 13:09:08 1999 George Lebl + + * Release 0.90.5 + +Thu Nov 25 13:00:52 1999 George Lebl + + * src/main.c: don't error out on a symbol conflict if the types of + the symbol node don't match (variable,method) + +Sat Nov 20 16:15:42 1999 George Lebl + + * src/main.c: add PARENT_HANDLER macro to make calling parent + handlers in override functions easier + +Fri Nov 19 16:41:09 1999 George Lebl + + * src/main.c: add a type macro + +Thu Nov 18 22:56:09 1999 George Lebl + + * src/parse.y: add a warning check if the number of GTK types of + a signal doesn't seem to be correct for the given number of + function arguments + Tue Nov 16 01:23:45 1999 George Lebl * src/main.c: support a "no-touch-headers" mode in which the diff --git a/NEWS b/NEWS index 5fa1488..3bd328b 100644 --- a/NEWS +++ b/NEWS @@ -1,3 +1,8 @@ +0.90.5 + * added PARENT_HANDLE macro for overrides + * added _TYPE_ macro for _get_type method + * warn if signal parameter lists seem mismatched + 0.90.4 * fix buggy class structure generation * can generate C++ friendly code diff --git a/configure b/configure index fb8174c..84c691a 100755 --- a/configure +++ b/configure @@ -703,7 +703,7 @@ fi PACKAGE=gob -VERSION=0.90.4 +VERSION=0.90.5 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 cc2e1eb..8200f52 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/tree.h) AM_CONFIG_HEADER(config.h) -AM_INIT_AUTOMAKE(gob,0.90.4) +AM_INIT_AUTOMAKE(gob,0.90.5) if test -f ../NOINST_GOB ; then DOINSTGOB= diff --git a/doc/gob.1.in b/doc/gob.1.in index 7691736..4268580 100644 --- a/doc/gob.1.in +++ b/doc/gob.1.in @@ -45,19 +45,26 @@ so it is not enabled by default. .SH TYPENAMES .PP -Because we need to parse out different parts of the typename, -sometimes you need to specify the typename with some special syntax. -Types are specified in capitalized form and words are separated by ':'. -The first word of the type (which can be empty) is the "namespace". This -fact is for example used for the type checking macro. For "Gtk:New:Button", -the macro will be GTK_IS_NEW_BUTTON. This format of typenames is used in -the class declaration header and for method argument types. +Because we need to parse out different parts of the typename, sometimes you +need to specify the typename with some special syntax. Types are specified in +capitalized form and words are separated by ':'. The first word of the type +(which can be empty) is the "namespace". This fact is for example used for the +type checking macro and the type macro. For "Gtk:New:Button", the macros will +be GTK_IS_NEW_BUTTON and GTK_TYPE_NEW_BUTTON. This colon separated format of +typenames is used in the class declaration header and for method argument +types. -.SH OUTPUT FILE NAMES +.SH OUTPUT FILES .PP The filenames are created from the typename. The words are separated by '-' and all in lower case. For example for an object named "Gtk:New:Button", the files are gtk-new-button.c and gtk-new-button.h. +The header file is created to be human readable and to be used as a +reference to the object. The .c source file is not created as a human +readable source and is littered with #line statements, which make the +compiler attempt to point you to the right line in your .gob file in +case of parsing errors. The output should not be editted by hand, and +you should only edit the .gob file. .SH INCLUDING NORMAL C CODE IN THE OUTPUT FILES .PP @@ -259,13 +266,15 @@ override method. After the "override" keyword, you should put the typename of the class you are overriding a method from. Other then that it is the same as for other methods. The "self" pointer in this case should be the type of the method you are overriding so that you don't -get warnings during compilation. Example: +get warnings during compilation. Also to call the method of the parent +class, you can use the PARENT_HANDLER macro with your arguments. Example: .nf override (Gtk:Container) void add (Gtk:Container *self (check null type), Gtk:Widget *wid (check null type)) { - ... + /* some code here */ + PARENT_HANDLER(self, wid); } .fi .PP diff --git a/gob.spec b/gob.spec index bd03877..32372a2 100644 --- a/gob.spec +++ b/gob.spec @@ -1,4 +1,4 @@ -%define ver 0.90.4 +%define ver 0.90.5 %define rel 1 %define prefix /usr diff --git a/src/main.c b/src/main.c index 35ebda6..e556006 100644 --- a/src/main.c +++ b/src/main.c @@ -49,6 +49,7 @@ static char *funcbase; static char *pfuncbase; static char *macrobase; static char *macrois; +static char *macrotype; static char *typebase; static char *ptypebase; @@ -132,17 +133,19 @@ separns_replace_sep(char *base, char **ns, char **name, char r) *name = s; } +/* make a macro with some prefix before the name but after + namespace */ static char * -make_is_macro(char *base) +make_pre_macro(char *base, char *pre) { char *s1,*s2; char *s; separns_replace_sep(base,&s1,&s2,'_'); if(s1) - s = g_strconcat(s1,"_IS_",s2,NULL); + s = g_strconcat(s1,"_",pre,"_",s2,NULL); else - s = g_strconcat("IS_",s2,NULL); + s = g_strconcat(pre,"_",s2,NULL); g_strup(s); @@ -167,7 +170,8 @@ make_bases(void) macrobase = replace_sep(((Class *)class)->otype,'_'); g_strup(macrobase); - macrois = make_is_macro(((Class *)class)->otype); + macrois = make_pre_macro(((Class *)class)->otype,"IS"); + macrotype = make_pre_macro(((Class *)class)->otype,"TYPE"); typebase = remove_sep(((Class *)class)->otype); @@ -900,7 +904,7 @@ print_checks(Method *m, FuncArg *fa) out_printf(out,"%s != NULL",fa->name); break; case TYPE_CHECK: - s = make_is_macro(fa->atype->name); + s = make_pre_macro(fa->atype->name,"IS"); out_printf(out,"%s (%s)",s,fa->name); g_free(s); break; @@ -1075,7 +1079,15 @@ put_method(Method *m) case OVERRIDE_METHOD: out_addline_infile(out,m->line_no); print_method(out,"static ","\n"," ","\n",m,FALSE); + s = replace_sep(m->otype,'_'); + g_strup(s); + out_printf(out,"#define PARENT_HANDLER(args...) \\\n" + "\t{ if(%s_CLASS(parent_class)->%s) \\\n" + "\t\t(* %s_CLASS(parent_class)->%s)(##args); }\n", + s,m->id,s,m->id); + g_free(s); print_method_body(m,TRUE); + out_printf(out,"#undef PARENT_HANDLER\n"); break; default: break; @@ -1103,7 +1115,8 @@ check_duplicate(Class *c,Node *node,char *id, int line_no) continue; if(n==node || line_no>=nline_no || - strcmp(nid,id)!=0) + strcmp(nid,id)!=0 || + n->type != node->type) continue; s = g_strdup_printf("symbol '%s' redefined, " "first defined on line %d", @@ -1352,8 +1365,11 @@ generate_outfiles(void) signals = count_signals(c); arguments = count_arguments(c); overrides = count_overrides(c); - - out_printf(outh,"\n#define %s(obj)\t" + + out_printf(outh,"\n#define %s\t" + "(%s_get_type())\n", + macrotype,funcbase); + out_printf(outh,"#define %s(obj)\t" "GTK_CHECK_CAST((obj),%s_get_type(),%s)\n", macrobase,funcbase,typebase); out_printf(outh,"#define %s_CLASS(klass)\t" diff --git a/src/parse.c b/src/parse.c index 101d2e6..2316847 100644 --- a/src/parse.c +++ b/src/parse.c @@ -120,6 +120,20 @@ push_function(int scope, char *oid, char *id, char *onerror, type = (Type *)new_type(0,g_strdup("void")); } + /* a complicated and ugly test to figure out if we have + the wrong number of types for a signal */ + if((scope == SIGNAL_FIRST_METHOD || + scope == SIGNAL_LAST_METHOD || + scope == PRIVATE_SIGNAL_FIRST_METHOD || + scope == PRIVATE_SIGNAL_LAST_METHOD) && + g_list_length(gtktypes) != g_list_length(funcargs) && + !(g_list_length(funcargs) == 1 && + g_list_length(gtktypes) == 2 && + strcmp(gtktypes->next->data,"NONE")==0)) { + print_error(TRUE, _("The number of GTK arguments and " + "function arguments for a signal " + "don't seem to match"),line_no); + } node = new_method(scope,type,oid,gtktypes,id,funcargs, onerror,cbuf,line_no,ccode_line,vararg); gtktypes = NULL; @@ -172,7 +186,7 @@ push_self(char *id) } -#line 160 "parse.y" +#line 174 "parse.y" typedef union { char *id; GString *cbuf; @@ -286,16 +300,16 @@ static const short yyrhs[] = { 46, #if YYDEBUG != 0 static const short yyrline[] = { 0, - 179, 180, 181, 182, 185, 189, 193, 197, 203, 210, - 215, 216, 217, 218, 219, 220, 223, 226, 230, 259, - 285, 286, 289, 292, 298, 299, 307, 311, 318, 321, - 324, 327, 330, 333, 336, 339, 342, 345, 349, 352, - 357, 360, 363, 366, 369, 374, 377, 380, 385, 386, - 389, 401, 413, 416, 428, 433, 438, 441, 446, 447, - 451, 461, 471, 481, 487, 492, 497, 518, 519, 523, - 524, 527, 528, 539, 549, 552, 553, 556, 557, 560, - 563, 573, 574, 577, 590, 594, 598, 602, 606, 610, - 616, 617, 621 + 193, 194, 195, 196, 199, 203, 207, 211, 217, 224, + 229, 230, 231, 232, 233, 234, 237, 240, 244, 273, + 299, 300, 303, 306, 312, 313, 321, 325, 332, 335, + 338, 341, 344, 347, 350, 353, 356, 359, 363, 366, + 371, 374, 377, 380, 383, 388, 391, 394, 399, 400, + 403, 415, 427, 430, 442, 447, 452, 455, 460, 461, + 465, 475, 485, 495, 501, 506, 511, 532, 533, 537, + 538, 541, 542, 553, 563, 566, 567, 570, 571, 574, + 577, 587, 588, 591, 604, 608, 612, 616, 620, 624, + 630, 631, 635 }; #endif @@ -1005,51 +1019,51 @@ yyreduce: switch (yyn) { case 1: -#line 179 "parse.y" +#line 193 "parse.y" { ; ; break;} case 2: -#line 180 "parse.y" +#line 194 "parse.y" { ; ; break;} case 3: -#line 181 "parse.y" +#line 195 "parse.y" { ; ; break;} case 4: -#line 182 "parse.y" +#line 196 "parse.y" { ; ; break;} case 5: -#line 185 "parse.y" +#line 199 "parse.y" { Node *node = new_ccode(FALSE,yyvsp[0].cbuf,ccode_line); nodes = g_list_append(nodes,node); ; break;} case 6: -#line 189 "parse.y" +#line 203 "parse.y" { Node *node = new_ccode(TRUE,yyvsp[0].cbuf,ccode_line); nodes = g_list_append(nodes,node); ; break;} case 7: -#line 193 "parse.y" +#line 207 "parse.y" { Node *node = new_ccode(FALSE,yyvsp[0].cbuf,ccode_line); nodes = g_list_append(nodes,node); ; break;} case 8: -#line 197 "parse.y" +#line 211 "parse.y" { Node *node = new_ccode(TRUE,yyvsp[0].cbuf,ccode_line); nodes = g_list_append(nodes,node); ; break;} case 9: -#line 203 "parse.y" +#line 217 "parse.y" { ((Class *)class)->nodes = class_nodes; class_nodes = NULL; @@ -1057,49 +1071,49 @@ case 9: ; break;} case 10: -#line 210 "parse.y" +#line 224 "parse.y" { class = new_class(yyvsp[-2].id,yyvsp[0].id,NULL); ; break;} case 11: -#line 215 "parse.y" +#line 229 "parse.y" { ; ; break;} case 12: -#line 216 "parse.y" +#line 230 "parse.y" { ; ; break;} case 13: -#line 217 "parse.y" +#line 231 "parse.y" { ; ; break;} case 14: -#line 218 "parse.y" +#line 232 "parse.y" { ; ; break;} case 15: -#line 219 "parse.y" +#line 233 "parse.y" { ; ; break;} case 16: -#line 220 "parse.y" +#line 234 "parse.y" { ; ; break;} case 17: -#line 223 "parse.y" +#line 237 "parse.y" { push_variable(yyvsp[-1].id,PUBLIC_SCOPE,yyvsp[-3].line); ; break;} case 18: -#line 226 "parse.y" +#line 240 "parse.y" { push_variable(yyvsp[-1].id,PRIVATE_SCOPE,yyvsp[-3].line); ; break;} case 19: -#line 230 "parse.y" +#line 244 "parse.y" { if(strcmp(yyvsp[-6].id,"get")==0 && strcmp(yyvsp[-3].id,"set")==0) { @@ -1131,7 +1145,7 @@ case 19: ; break;} case 20: -#line 259 "parse.y" +#line 273 "parse.y" { if(strcmp(yyvsp[-3].id,"get")==0) { Node *node; @@ -1158,31 +1172,31 @@ case 20: ; break;} case 21: -#line 285 "parse.y" +#line 299 "parse.y" { yyval.list = yyvsp[-1].list; ; break;} case 22: -#line 286 "parse.y" +#line 300 "parse.y" { yyval.list = NULL; ; break;} case 23: -#line 289 "parse.y" +#line 303 "parse.y" { yyval.list = g_list_append(yyvsp[0].list,yyvsp[-2].id); ; break;} case 24: -#line 292 "parse.y" +#line 306 "parse.y" { yyval.list = g_list_append(NULL,yyvsp[0].id); ; break;} case 25: -#line 298 "parse.y" +#line 312 "parse.y" { ; ; break;} case 26: -#line 299 "parse.y" +#line 313 "parse.y" { Type *type = typestack->data; char *oldname = type->name; @@ -1191,14 +1205,14 @@ case 26: ; break;} case 27: -#line 307 "parse.y" +#line 321 "parse.y" { Node *node = new_type(0,yyvsp[0].id); typestack = g_list_prepend(typestack,node); ; break;} case 28: -#line 311 "parse.y" +#line 325 "parse.y" { Node *node = new_type(stars,yyvsp[-1].id); stars = 0; @@ -1206,136 +1220,136 @@ case 28: ; break;} case 29: -#line 318 "parse.y" +#line 332 "parse.y" { yyval.id = g_strconcat("unsigned ",yyvsp[0].id,NULL); ; break;} case 30: -#line 321 "parse.y" +#line 335 "parse.y" { yyval.id = g_strconcat("signed ",yyvsp[0].id,NULL); ; break;} case 31: -#line 324 "parse.y" +#line 338 "parse.y" { yyval.id = g_strdup(yyvsp[0].id); ; break;} case 32: -#line 327 "parse.y" +#line 341 "parse.y" { yyval.id = g_strdup("unsigned char"); ; break;} case 33: -#line 330 "parse.y" +#line 344 "parse.y" { yyval.id = g_strdup("signed char"); ; break;} case 34: -#line 333 "parse.y" +#line 347 "parse.y" { yyval.id = g_strdup("char"); ; break;} case 35: -#line 336 "parse.y" +#line 350 "parse.y" { yyval.id = g_strdup("double"); ; break;} case 36: -#line 339 "parse.y" +#line 353 "parse.y" { yyval.id = g_strdup("float"); ; break;} case 37: -#line 342 "parse.y" +#line 356 "parse.y" { yyval.id = yyvsp[0].id; ; break;} case 38: -#line 345 "parse.y" +#line 359 "parse.y" { yyval.id = g_strconcat(yyvsp[-1].id,yyvsp[0].id,NULL); g_free(yyvsp[0].id); ; break;} case 39: -#line 349 "parse.y" +#line 363 "parse.y" { yyval.id = yyvsp[0].id; ; break;} case 40: -#line 352 "parse.y" +#line 366 "parse.y" { yyval.id = g_strdup("void"); ; break;} case 41: -#line 357 "parse.y" +#line 371 "parse.y" { yyval.id = "long int"; ; break;} case 42: -#line 360 "parse.y" +#line 374 "parse.y" { yyval.id = "long"; ; break;} case 43: -#line 363 "parse.y" +#line 377 "parse.y" { yyval.id = "short int"; ; break;} case 44: -#line 366 "parse.y" +#line 380 "parse.y" { yyval.id = "short"; ; break;} case 45: -#line 369 "parse.y" +#line 383 "parse.y" { yyval.id = "int"; ; break;} case 46: -#line 374 "parse.y" +#line 388 "parse.y" { yyval.id = "enum "; ; break;} case 47: -#line 377 "parse.y" +#line 391 "parse.y" { yyval.id = "union "; ; break;} case 48: -#line 380 "parse.y" +#line 394 "parse.y" { yyval.id = "struct "; ; break;} case 49: -#line 385 "parse.y" +#line 399 "parse.y" { stars++; ; break;} case 50: -#line 386 "parse.y" +#line 400 "parse.y" { stars++; ; break;} case 51: -#line 389 "parse.y" +#line 403 "parse.y" { if(strcmp(yyvsp[-1].id,"first")==0) yyval.sigtype = PRIVATE_SIGNAL_FIRST_METHOD; @@ -1350,7 +1364,7 @@ case 51: ; break;} case 52: -#line 401 "parse.y" +#line 415 "parse.y" { if(strcmp(yyvsp[-2].id,"first")==0) yyval.sigtype = PRIVATE_SIGNAL_FIRST_METHOD; @@ -1365,13 +1379,13 @@ case 52: ; break;} case 53: -#line 413 "parse.y" +#line 427 "parse.y" { yyval.sigtype = PRIVATE_SIGNAL_LAST_METHOD; ; break;} case 54: -#line 416 "parse.y" +#line 430 "parse.y" { if(strcmp(yyvsp[-1].id,"first")==0) yyval.sigtype = SIGNAL_FIRST_METHOD; @@ -1386,39 +1400,39 @@ case 54: ; break;} case 55: -#line 428 "parse.y" +#line 442 "parse.y" { yyval.sigtype = SIGNAL_LAST_METHOD; ; break;} case 56: -#line 433 "parse.y" +#line 447 "parse.y" { gtktypes = g_list_prepend(gtktypes,yyvsp[-3].id); ; break;} case 57: -#line 438 "parse.y" +#line 452 "parse.y" { gtktypes = g_list_append(gtktypes,yyvsp[0].id); ; break;} case 58: -#line 441 "parse.y" +#line 455 "parse.y" { gtktypes = g_list_append(gtktypes,yyvsp[0].id); ; break;} case 59: -#line 446 "parse.y" +#line 460 "parse.y" { yyval.cbuf=yyvsp[0].cbuf; ; break;} case 60: -#line 447 "parse.y" +#line 461 "parse.y" { yyval.cbuf = NULL; ; break;} case 61: -#line 451 "parse.y" +#line 465 "parse.y" { if(!has_self) { yyerror(_("signal without 'self' as " @@ -1431,7 +1445,7 @@ case 61: ; break;} case 62: -#line 461 "parse.y" +#line 475 "parse.y" { if(!has_self) { yyerror(_("virtual method without 'self' as " @@ -1444,7 +1458,7 @@ case 62: ; break;} case 63: -#line 471 "parse.y" +#line 485 "parse.y" { if(!has_self) { yyerror(_("virtual method without 'self' as " @@ -1457,7 +1471,7 @@ case 63: ; break;} case 64: -#line 481 "parse.y" +#line 495 "parse.y" { push_function(OVERRIDE_METHOD, yyvsp[-9].id, yyvsp[-6].id, yyvsp[-2].id, yyvsp[0].cbuf, @@ -1466,7 +1480,7 @@ case 64: ; break;} case 65: -#line 487 "parse.y" +#line 501 "parse.y" { push_function(PUBLIC_SCOPE, NULL, yyvsp[-6].id, yyvsp[-2].id, yyvsp[0].cbuf,yyvsp[-8].line,yyvsp[-1].line, @@ -1474,7 +1488,7 @@ case 65: ; break;} case 66: -#line 492 "parse.y" +#line 506 "parse.y" { push_function(PRIVATE_SCOPE, NULL, yyvsp[-6].id, yyvsp[-2].id, yyvsp[0].cbuf,yyvsp[-8].line,yyvsp[-1].line, @@ -1482,7 +1496,7 @@ case 66: ; break;} case 67: -#line 497 "parse.y" +#line 511 "parse.y" { if(strcmp(yyvsp[-4].id,"init")==0) { push_init_arg(yyvsp[-2].id,FALSE); @@ -1504,30 +1518,30 @@ case 67: ; break;} case 68: -#line 518 "parse.y" +#line 532 "parse.y" { yyval.id = yyvsp[0].id; ; break;} case 69: -#line 519 "parse.y" +#line 533 "parse.y" { yyval.id = (yyvsp[0].cbuf)->str; g_string_free(yyvsp[0].cbuf,FALSE); ; break;} case 70: -#line 523 "parse.y" +#line 537 "parse.y" { ; ; break;} case 71: -#line 524 "parse.y" +#line 538 "parse.y" { yyval.id = NULL; ; break;} case 72: -#line 527 "parse.y" +#line 541 "parse.y" { vararg = FALSE; has_self = FALSE; ; break;} case 73: -#line 528 "parse.y" +#line 542 "parse.y" { vararg = FALSE; has_self = TRUE; @@ -1541,7 +1555,7 @@ case 73: ; break;} case 74: -#line 539 "parse.y" +#line 553 "parse.y" { has_self = TRUE; if(strcmp(yyvsp[-2].id,"self")==0) @@ -1554,33 +1568,33 @@ case 74: ; break;} case 75: -#line 549 "parse.y" +#line 563 "parse.y" { has_self = FALSE; ; break;} case 76: -#line 552 "parse.y" +#line 566 "parse.y" { vararg = TRUE; ; break;} case 77: -#line 553 "parse.y" +#line 567 "parse.y" { vararg = FALSE; ; break;} case 78: -#line 556 "parse.y" +#line 570 "parse.y" { ; ; break;} case 79: -#line 557 "parse.y" +#line 571 "parse.y" { ; ; break;} case 80: -#line 560 "parse.y" +#line 574 "parse.y" { push_funcarg(yyvsp[0].id); ; break;} case 81: -#line 563 "parse.y" +#line 577 "parse.y" { if(strcmp(yyvsp[-2].id,"check")!=0) { yyerror(_("parse error")); @@ -1591,15 +1605,15 @@ case 81: ; break;} case 82: -#line 573 "parse.y" +#line 587 "parse.y" { ; ; break;} case 83: -#line 574 "parse.y" +#line 588 "parse.y" { ; ; break;} case 84: -#line 577 "parse.y" +#line 591 "parse.y" { if(strcmp(yyvsp[0].id,"type")==0) { Node *node = new_check(TYPE_CHECK,NULL); @@ -1615,60 +1629,60 @@ case 84: ; break;} case 85: -#line 590 "parse.y" +#line 604 "parse.y" { Node *node = new_check(GT_CHECK,yyvsp[0].id); checks = g_list_append(checks,node); ; break;} case 86: -#line 594 "parse.y" +#line 608 "parse.y" { Node *node = new_check(LT_CHECK,yyvsp[0].id); checks = g_list_append(checks,node); ; break;} case 87: -#line 598 "parse.y" +#line 612 "parse.y" { Node *node = new_check(GE_CHECK,yyvsp[0].id); checks = g_list_append(checks,node); ; break;} case 88: -#line 602 "parse.y" +#line 616 "parse.y" { Node *node = new_check(LE_CHECK,yyvsp[0].id); checks = g_list_append(checks,node); ; break;} case 89: -#line 606 "parse.y" +#line 620 "parse.y" { Node *node = new_check(EQ_CHECK,yyvsp[0].id); checks = g_list_append(checks,node); ; break;} case 90: -#line 610 "parse.y" +#line 624 "parse.y" { Node *node = new_check(NE_CHECK,yyvsp[0].id); checks = g_list_append(checks,node); ; break;} case 91: -#line 616 "parse.y" +#line 630 "parse.y" { yyval.id = yyvsp[0].id; ; break;} case 92: -#line 617 "parse.y" +#line 631 "parse.y" { yyval.id = g_strconcat("-",yyvsp[0].id,NULL); g_free(yyvsp[0].id); ; break;} case 93: -#line 621 "parse.y" +#line 635 "parse.y" { yyval.id = yyvsp[0].id; ; break;} } @@ -1893,5 +1907,5 @@ yyerrhandle: } return 1; } -#line 624 "parse.y" +#line 638 "parse.y" diff --git a/src/parse.y b/src/parse.y index 46fdf6e..7d01a5d 100644 --- a/src/parse.y +++ b/src/parse.y @@ -104,6 +104,20 @@ push_function(int scope, char *oid, char *id, char *onerror, type = (Type *)new_type(0,g_strdup("void")); } + /* a complicated and ugly test to figure out if we have + the wrong number of types for a signal */ + if((scope == SIGNAL_FIRST_METHOD || + scope == SIGNAL_LAST_METHOD || + scope == PRIVATE_SIGNAL_FIRST_METHOD || + scope == PRIVATE_SIGNAL_LAST_METHOD) && + g_list_length(gtktypes) != g_list_length(funcargs) && + !(g_list_length(funcargs) == 1 && + g_list_length(gtktypes) == 2 && + strcmp(gtktypes->next->data,"NONE")==0)) { + print_error(TRUE, _("The number of GTK arguments and " + "function arguments for a signal " + "don't seem to match"),line_no); + } node = new_method(scope,type,oid,gtktypes,id,funcargs, onerror,cbuf,line_no,ccode_line,vararg); gtktypes = NULL; diff --git a/src/test.gob b/src/test.gob index 5dd5c2e..f7fbf8d 100644 --- a/src/test.gob +++ b/src/test.gob @@ -13,6 +13,7 @@ class Gtk:Weird:Button from Gtk:Button { argument INT i set { self->i = ARG; } get { ARG = self->i; } ; private int j; public GtkWidget * h; + public char *bleh; init(object) { GtkWeirdButton *but = GTK_WEIRD_BUTTON(object); @@ -46,8 +47,7 @@ class Gtk:Weird:Button from Gtk:Button { virtual int beh(self, int h (check > 0)); override(Gtk:Container) void add(Gtk:Container * self (check null type), Gtk:Widget * wid (check null type)) { - if (GTK_CONTAINER_CLASS (parent_class)->add) - (* GTK_CONTAINER_CLASS (parent_class)->add) (self,wid); + PARENT_HANDLER(self,wid); } public int consttest(self, const gchar *text, ...) { -- 2.43.0