From 4f7cfa972623842e64e3a8468696f1f6f40fd202 Mon Sep 17 00:00:00 2001 From: George Lebl Date: Sat, 29 Apr 2000 23:51:00 -0800 Subject: [PATCH] Release 0.93.4 --- ChangeLog | 41 +- NEWS | 4 + configure | 2 +- configure.in | 2 +- doc/gob.1.in | 34 +- gob.spec | 2 +- src/checks.c | 74 ++-- src/checks.h | 2 - src/lexer.c | 768 +++++++++++++++++++------------------ src/lexer.l | 3 +- src/main.c | 524 +++++++++++++------------ src/main.h | 9 +- src/parse.c | 953 ++++++++++++++++++++++++---------------------- src/parse.y | 49 ++- src/test.gob | 3 + src/treefuncs.def | 3 +- src/treefuncs.h | 3 +- 17 files changed, 1325 insertions(+), 1151 deletions(-) diff --git a/ChangeLog b/ChangeLog index da67a18..46b1904 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,6 +1,41 @@ +Sat Apr 29 14:41:42 2000 George Lebl + + * Release 0.93.4 + +Sat Apr 29 14:40:40 2000 George Lebl + + * src/checks.c: code prettification + + * src/lexer.l, src/parse.y, src/test.gob: change "class" scope to + "classwide" scope, not to overload the class keyword + + * src/main.[ch]: make private header files be generated by default, + and cleanup that part a bit + + * doc/gob.1.in: add documentation of classwide + + * NEWS: + +Fri Apr 21 17:15:09 2000 George Lebl + + * src/main.c: add spaces after commas + + * src/lexer.l, src/main.c, src/parse.y: add class scope variables + which are put into the class structure + + * src/test.gob: added a test for class variables + + * src/treefuncs.def: added CLASS_SCOPE + + * src/treefuncs.h: regenerated + +Mon Apr 17 20:13:47 2000 George Lebl + + * src/parse.y: on objectlink instead of just ref, do ref/sink. + Sat Apr 15 23:07:30 2000 George Lebl - * Released 0.93.3 + * Release 0.93.3 Sat Apr 15 22:42:20 2000 George Lebl @@ -625,7 +660,7 @@ Sun Sep 05 21:45:54 1999 George Lebl Sun Sep 04 17:44:37 1999 George Lebl - * Released 0.90.1 + * Release 0.90.1 Sat Sep 04 17:18:22 1999 George Lebl @@ -678,7 +713,7 @@ Thu Aug 19 03:08:49 1999 George Lebl Wed Aug 18 12:54:17 1999 George Lebl - * Released 0.0.3 + * Release 0.0.3 Tue Aug 17 22:24:47 1999 George Lebl diff --git a/NEWS b/NEWS index 0dc8c75..4d7bebd 100644 --- a/NEWS +++ b/NEWS @@ -1,3 +1,7 @@ +0.93.4 + * classwide (global) datamembers + * private header file always generated by default + 0.93.3 * fix signals with return values but no arguments * more input file checking diff --git a/configure b/configure index f303b3f..697bf96 100755 --- a/configure +++ b/configure @@ -703,7 +703,7 @@ fi PACKAGE=gob -VERSION=0.93.3 +VERSION=0.93.4 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 b897cfc..8577526 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,0.93.3) +AM_INIT_AUTOMAKE(gob,0.93.4) if test -f ../NOINST_GOB ; then DOINSTGOB= diff --git a/doc/gob.1.in b/doc/gob.1.in index a2724c6..5afe3bb 100644 --- a/doc/gob.1.in +++ b/doc/gob.1.in @@ -188,14 +188,14 @@ For example: .PP Data members: .PP -There are four types of data members. Three of them are normal -data numbers, and one is a virtual one, usually linked to a normal -data member. The three normal data members are public, protected and -private. Public and protected are basically just entries in the object -structure, while private has it's own dynamically allocated private -structure. Protected members are always put after the public one in the -structure and are marked protected in the header file. There is only one -identifier allowed per typename unlike in normal C. Example: +There are five types of data members. Three of them are normal data numbers, +one is class wide (global) in scope and one is a virtual one, usually linked to +a normal data member or a class wide data member. The three normal data +members are public, protected and private. Public and protected are basically +just entries in the object structure, while private has it's own dynamically +allocated private structure. Protected members are always put after the public +one in the structure and are marked protected in the header file. There is +only one identifier allowed per typename unlike in normal C. Example: .nf public int i; @@ -230,6 +230,24 @@ In case you use the \fB--no-private-header\fR option, no private header file is created and you can only access the _priv pointer below the class definition in the .gob file. .PP +Classwide data members: +.PP +Sometimes you want a datamember to be shared by all objects. You then need +the "classwide" scope keyword. So for example the following adds a global +member foo: +.nf + + classwide int foo; + +.fi +To access the member you do the standard voodoo of getting the class from the +object and casting it to your class pointer. Thus the following would work: +.nf + + SELF_CLASS(GTK_OBJECT(object)->klass)->foo = 20; + +.fi +.PP Automatic Initialization (0.93.0 and higher only): .PP You can automatically initialize the public private and protected data members diff --git a/gob.spec b/gob.spec index cb14cd5..d715d37 100644 --- a/gob.spec +++ b/gob.spec @@ -1,4 +1,4 @@ -%define ver 0.93.3 +%define ver 0.93.4 %define rel 1 %define prefix /usr diff --git a/src/checks.c b/src/checks.c index d287341..726dad9 100644 --- a/src/checks.c +++ b/src/checks.c @@ -30,11 +30,11 @@ #include "checks.h" -void +static void check_duplicate(Class *c, Node *node, char *id, int line_no) { GList *l; - for(l=c->nodes;l;l=g_list_next(l)) { + for(l = c->nodes; l != NULL; l = g_list_next(l)) { Node *n = l->data; char *nid; int nline_no; @@ -49,15 +49,15 @@ check_duplicate(Class *c, Node *node, char *id, int line_no) nline_no = v->line_no; } else continue; - if(n==node || - line_no>=nline_no || - strcmp(nid,id)!=0 || + if(n == node || + line_no >= nline_no || + strcmp(nid, id) != 0 || n->type != node->type) continue; s = g_strdup_printf("symbol '%s' redefined, " "first defined on line %d", - id,line_no); - print_error(FALSE,s,nline_no); + id, line_no); + print_error(FALSE, s, nline_no); } } @@ -65,14 +65,14 @@ void check_duplicate_symbols(Class *c) { GList *l; - for(l=c->nodes;l;l=g_list_next(l)) { + for(l = c->nodes; l != NULL; l = g_list_next(l)) { Node *n = l->data; if(n->type == METHOD_NODE) { Method *m = (Method *)n; - check_duplicate(c,n,m->id,m->line_no); + check_duplicate(c, n, m->id, m->line_no); } else if(n->type == VARIABLE_NODE) { Variable *v = (Variable *)n; - check_duplicate(c,n,v->id,v->line_no); + check_duplicate(c, n, v->id, v->line_no); } } } @@ -81,14 +81,14 @@ void check_bad_symbols(Class *c) { GList *l; - for(l=c->nodes;l;l=g_list_next(l)) { + for(l = c->nodes; l != NULL; l = g_list_next(l)) { Node *n = l->data; if(n->type == METHOD_NODE) { Method *m = (Method *)n; if((m->method == SIGNAL_LAST_METHOD || m->method == SIGNAL_FIRST_METHOD || m->method == VIRTUAL_METHOD) && - strcmp(m->id,"__parent__")==0) { + strcmp(m->id, "__parent__")==0) { char *s; s = g_strdup_printf("'%s' not allowed as an " "identifier of signal " @@ -99,33 +99,32 @@ check_bad_symbols(Class *c) } if(m->method != INIT_METHOD && m->method != CLASS_INIT_METHOD && - (strcmp(m->id,"init")==0 || - strcmp(m->id,"class_init")==0)) { + (strcmp(m->id, "init")==0 || + strcmp(m->id, "class_init")==0)) { print_error(FALSE,"init, or class_init not " "allowed as an " "identifier of non-" - "constructor methods",m->line_no); + "constructor methods", m->line_no); } } else if(n->type == VARIABLE_NODE) { Variable *v = (Variable *)n; - if(strcmp(v->id,"_priv")==0 || - strcmp(v->id,"__parent__")==0) { + if(strcmp(v->id, "_priv")==0 || + strcmp(v->id, "__parent__")==0) { char *s; s = g_strdup_printf("'%s' not allowed as a " - "data member name",v->id); - print_error(FALSE,s,v->line_no); + "data member name", v->id); + print_error(FALSE, s, v->line_no); g_free(s); } } } } - -void -check_duplicate_named(Class *c,Node *node,char *id, int line_no) +static void +check_duplicate_named(Class *c, Node *node, char *id, int line_no) { GList *l; - for(l=c->nodes;l;l=g_list_next(l)) { + for(l = c->nodes; l != NULL; l = g_list_next(l)) { Node *n = l->data; char *nid; int nline_no; @@ -160,7 +159,7 @@ void check_duplicate_signals_args(Class *c) { GList *l; - for(l=c->nodes;l;l=g_list_next(l)) { + for(l = c->nodes; l != NULL; l = g_list_next(l)) { Node *n = l->data; if(n->type == METHOD_NODE) { Method *m = (Method *)n; @@ -178,7 +177,7 @@ void check_public_new(Class *c) { GList *l; - for(l=c->nodes;l;l=g_list_next(l)) { + for(l = c->nodes; l != NULL; l = g_list_next(l)) { Node *n = l->data; if(n->type == METHOD_NODE) { Method *m = (Method *)n; @@ -197,7 +196,7 @@ void check_vararg(Class *c) { GList *l; - for(l=c->nodes;l;l=g_list_next(l)) { + for(l = c->nodes; l != NULL; l = g_list_next(l)) { Node *n = l->data; if(n->type == METHOD_NODE) { Method *m = (Method *)n; @@ -221,7 +220,7 @@ void check_firstarg(Class *c) { GList *l; - for(l=c->nodes;l;l=g_list_next(l)) { + for(l = c->nodes; l != NULL; l = g_list_next(l)) { Node *n = l->data; if(n->type == METHOD_NODE) { Method *m = (Method *)n; @@ -244,7 +243,7 @@ void check_nonvoidempty(Class *c) { GList *li; - for(li=c->nodes; li; li=g_list_next(li)) { + for(li = c->nodes; li != NULL; li = g_list_next(li)) { Node *n = li->data; if(n->type == METHOD_NODE) { Method *m = (Method *)n; @@ -273,7 +272,7 @@ void check_signal_args(Class *c) { GList *li; - for(li=c->nodes; li; li=g_list_next(li)) { + for(li = c->nodes; li != NULL; li = g_list_next(li)) { Node *n = li->data; if(n->type == METHOD_NODE) { Method *m = (Method *)n; @@ -300,7 +299,7 @@ void check_argument_types(Class *c) { GList *l; - for(l=c->nodes;l;l=g_list_next(l)) { + for(l = c->nodes; l != NULL; l = g_list_next(l)) { Node *n = l->data; if(n->type == ARGUMENT_NODE) { Argument *a = (Argument *)n; @@ -324,7 +323,7 @@ count_signals(Class *c) { int num = 0; GList *l; - for(l=c->nodes;l;l=g_list_next(l)) { + for(l = c->nodes; l != NULL; l = g_list_next(l)) { Node *n = l->data; if(n->type == METHOD_NODE) { Method *m = (Method *)n; @@ -341,8 +340,7 @@ count_arguments(Class *c) { int num = 0; GList *li; - - for(li=c->nodes;li;li=g_list_next(li)) { + for(li = c->nodes; li != NULL; li = g_list_next(li)) { Node *n = li->data; if(n->type == ARGUMENT_NODE) num ++; @@ -355,7 +353,7 @@ count_overrides(Class *c) { int num = 0; GList *l; - for(l=c->nodes;l;l=g_list_next(l)) { + for(l = c->nodes; l != NULL; l = g_list_next(l)) { Node *n = l->data; if(n->type == METHOD_NODE) { Method *m = (Method *)n; @@ -371,7 +369,7 @@ count_privates(Class *c) { int num = 0; GList *l; - for(l=c->nodes;l;l=g_list_next(l)) { + for(l = c->nodes; l != NULL; l = g_list_next(l)) { Node *n = l->data; if(n->type == VARIABLE_NODE) { Variable *v = (Variable *)n; @@ -387,7 +385,7 @@ count_protecteds(Class *c) { int num = 0; GList *l; - for(l=c->nodes;l;l=g_list_next(l)) { + for(l = c->nodes; l != NULL; l = g_list_next(l)) { Node *n = l->data; if(n->type == METHOD_NODE) { Method *m = (Method *)n; @@ -403,7 +401,7 @@ count_destructors(Class *c) { int num = 0; GList *l; - for(l=c->nodes;l;l=g_list_next(l)) { + for(l = c->nodes; l != NULL; l = g_list_next(l)) { Node *n = l->data; if(n->type == VARIABLE_NODE) { Variable *v = (Variable *)n; @@ -419,7 +417,7 @@ count_initializers(Class *c) { int num = 0; GList *l; - for(l=c->nodes;l;l=g_list_next(l)) { + for(l = c->nodes; l != NULL; l = g_list_next(l)) { Node *n = l->data; if(n->type == VARIABLE_NODE) { Variable *v = (Variable *)n; diff --git a/src/checks.h b/src/checks.h index b6e9171..e2933d2 100644 --- a/src/checks.h +++ b/src/checks.h @@ -22,10 +22,8 @@ #ifndef _CHECKS_H_ #define _CHECKS_H_ -void check_duplicate(Class *c, Node *node, char *id, int line_no); void check_duplicate_symbols(Class *c); void check_bad_symbols(Class *c); -void check_duplicate_named(Class *c,Node *node,char *id, int line_no); void check_duplicate_signals_args(Class *c); void check_public_new(Class *c); void check_vararg(Class *c); diff --git a/src/lexer.c b/src/lexer.c index f9fb3e8..3cd236c 100644 --- a/src/lexer.c +++ b/src/lexer.c @@ -284,55 +284,57 @@ static void yy_fatal_error YY_PROTO(( yyconst char msg[] )); *yy_cp = '\0'; \ yy_c_buf_p = yy_cp; -#define YY_NUM_RULES 87 -#define YY_END_OF_BUFFER 88 -static yyconst short int yy_acclist[389] = +#define YY_NUM_RULES 88 +#define YY_END_OF_BUFFER 89 +static yyconst short int yy_acclist[399] = { 0, - 88, 85, 87, 84, 85, 87, 1, 86, 87, 85, - 86, 87, 85, 87, 85, 87, 84, 85, 87, 85, - 87, 85, 87, 26, 85, 87, 1, 27, 86, 87, - 26, 85, 86, 87, 26, 85, 87, 26, 85, 87, - 49, 85, 87, 1, 50, 86, 87, 49, 85, 86, - 87, 42, 49, 85, 87, 49, 85, 87, 49, 85, - 87, 49, 85, 87, 47, 49, 85, 87, 48, 49, - 85, 87, 49, 85, 87, 49, 85, 87, 45, 85, - 87, 1, 46, 86, 87, 45, 85, 86, 87, 44, - 45, 85, 87, 45, 85, 87, 85, 87, 85, 87, - - 79, 85, 87, 79, 85, 87, 79, 85, 87, 79, - 85, 87, 81, 85, 87, 85, 87, 85, 87, 76, - 85, 87, 76, 85, 87, 85, 87, 79, 85, 87, - 79, 85, 87, 79, 85, 87, 79, 85, 87, 79, - 85, 87, 79, 85, 87, 79, 85, 87, 79, 85, - 87, 79, 85, 87, 79, 85, 87, 79, 85, 87, - 79, 85, 87, 82, 85, 87, 83, 85, 87, 9, - 85, 87, 9, 85, 86, 87, 9, 85, 87, 9, - 85, 87, 9, 85, 87, 14, 85, 87, 14, 85, - 86, 87, 14, 85, 87, 14, 85, 87, 14, 85, - - 87, 17, 85, 87, 17, 85, 86, 87, 17, 85, - 87, 21, 33, 25, 22, 41, 34, 43, 23, 78, - 79, 77, 79, 79, 79, 76, 24, 76, 76, 80, - 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, - 79, 79, 79, 79, 79, 79, 79, 8, 6, 13, - 10, 12, 11, 13, 16, 15, 3, 28, 32, 39, - 35, 37, 18, 19, 78, 78, 77, 79, 79, 79, - 68, 76, 20, 76, 76, 79, 79, 79, 79, 79, - 79, 63, 79, 79, 79, 79, 79, 79, 79, 79, - 79, 79, 79, 79, 79, 11, 29, 30, 31, 40, - - 36, 38, 78, 79, 54, 79, 53, 79, 5, 79, - 66, 79, 79, 79, 58, 79, 79, 61, 79, 79, - 79, 79, 79, 79, 79, 79, 79, 79, 79, 55, - 79, 7, 51, 79, 67, 79, 79, 64, 79, 79, - 79, 79, 79, 62, 79, 79, 79, 79, 57, 79, - 79, 79, 79, 65, 79, 79, 79, 79, 69, 79, - 74, 79, 59, 79, 56, 79, 79, 79, 79, 79, - 70, 79, 79, 79, 73, 79, 72, 79, 75, 79, - 79, 60, 79, 71, 79, 2, 4, 52 + 89, 86, 88, 85, 86, 88, 1, 87, 88, 86, + 87, 88, 86, 88, 86, 88, 85, 86, 88, 86, + 88, 86, 88, 26, 86, 88, 1, 27, 87, 88, + 26, 86, 87, 88, 26, 86, 88, 26, 86, 88, + 49, 86, 88, 1, 50, 87, 88, 49, 86, 87, + 88, 42, 49, 86, 88, 49, 86, 88, 49, 86, + 88, 49, 86, 88, 47, 49, 86, 88, 48, 49, + 86, 88, 49, 86, 88, 49, 86, 88, 45, 86, + 88, 1, 46, 87, 88, 45, 86, 87, 88, 44, + 45, 86, 88, 45, 86, 88, 86, 88, 86, 88, + + 80, 86, 88, 80, 86, 88, 80, 86, 88, 80, + 86, 88, 82, 86, 88, 86, 88, 86, 88, 77, + 86, 88, 77, 86, 88, 86, 88, 80, 86, 88, + 80, 86, 88, 80, 86, 88, 80, 86, 88, 80, + 86, 88, 80, 86, 88, 80, 86, 88, 80, 86, + 88, 80, 86, 88, 80, 86, 88, 80, 86, 88, + 80, 86, 88, 83, 86, 88, 84, 86, 88, 9, + 86, 88, 9, 86, 87, 88, 9, 86, 88, 9, + 86, 88, 9, 86, 88, 14, 86, 88, 14, 86, + 87, 88, 14, 86, 88, 14, 86, 88, 14, 86, + + 88, 17, 86, 88, 17, 86, 87, 88, 17, 86, + 88, 21, 33, 25, 22, 41, 34, 43, 23, 79, + 80, 78, 80, 80, 80, 77, 24, 77, 77, 81, + 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, + 80, 80, 80, 80, 80, 80, 80, 80, 8, 6, + 13, 10, 12, 11, 13, 16, 15, 3, 28, 32, + 39, 35, 37, 18, 19, 79, 79, 78, 80, 80, + 80, 68, 77, 20, 77, 77, 80, 80, 80, 80, + 80, 80, 80, 63, 80, 80, 80, 80, 80, 80, + 80, 80, 80, 80, 80, 80, 80, 11, 29, 30, + + 31, 40, 36, 38, 79, 80, 54, 80, 53, 80, + 5, 80, 66, 80, 80, 80, 80, 58, 80, 80, + 61, 80, 80, 80, 80, 80, 80, 80, 80, 80, + 80, 80, 55, 80, 7, 51, 80, 53, 80, 67, + 80, 80, 64, 80, 80, 80, 80, 80, 62, 80, + 80, 80, 80, 57, 80, 80, 80, 80, 80, 65, + 80, 80, 80, 80, 69, 80, 75, 80, 59, 80, + 56, 80, 80, 80, 80, 80, 80, 70, 80, 80, + 80, 74, 80, 73, 80, 80, 76, 80, 80, 60, + 80, 72, 80, 71, 80, 2, 4, 52 + } ; -static yyconst short int yy_accept[348] = +static yyconst short int yy_accept[356] = { 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, @@ -349,29 +351,30 @@ static yyconst short int yy_accept[348] = 218, 219, 220, 220, 221, 222, 223, 224, 225, 226, 226, 227, 228, 228, 228, 229, 229, 229, 230, 230, 231, 232, 233, 234, 235, 236, 237, 238, 239, 240, - 241, 242, 243, 244, 245, 246, 247, 248, 249, 249, - 249, 249, 250, 250, 251, 251, 251, 251, 252, 253, - 253, 255, 256, 257, 257, 258, 258, 258, 258, 259, - 259, 259, 260, 260, 260, 260, 260, 261, 261, 261, - 261, 262, 263, 263, 264, 264, 264, 265, 266, 267, - 268, 269, 270, 271, 272, 273, 273, 273, 274, 275, - - 276, 276, 277, 278, 279, 280, 281, 282, 284, 285, + 241, 242, 243, 244, 245, 246, 247, 248, 249, 250, + 250, 250, 250, 251, 251, 252, 252, 252, 252, 253, + 254, 254, 256, 257, 258, 258, 259, 259, 259, 259, + 260, 260, 260, 261, 261, 261, 261, 261, 262, 262, + 262, 262, 263, 264, 264, 265, 265, 265, 266, 267, + 268, 269, 270, 271, 272, 273, 274, 274, 274, 275, + + 276, 277, 277, 278, 279, 280, 281, 282, 283, 284, 286, 287, 288, 289, 290, 291, 292, 293, 294, 295, - 296, 296, 297, 297, 297, 298, 298, 299, 300, 300, - 300, 300, 301, 302, 303, 303, 304, 305, 307, 309, - 309, 310, 311, 313, 314, 315, 317, 318, 320, 321, - 322, 323, 324, 325, 326, 327, 328, 329, 330, 332, - 332, 333, 333, 333, 334, 334, 334, 334, 334, 334, - 334, 335, 337, 338, 340, 341, 342, 343, 344, 346, - 347, 348, 349, 351, 352, 353, 353, 353, 353, 353, - 353, 353, 354, 356, 357, 358, 359, 361, 363, 365, - - 367, 368, 369, 369, 369, 369, 369, 369, 370, 371, - 373, 374, 375, 377, 377, 377, 377, 377, 377, 379, - 381, 382, 384, 384, 384, 384, 384, 384, 384, 386, - 386, 386, 386, 387, 387, 387, 387, 387, 388, 388, - 388, 388, 388, 388, 388, 389, 389 + 296, 297, 298, 298, 299, 299, 299, 300, 300, 301, + 302, 302, 302, 302, 303, 304, 305, 305, 306, 307, + 309, 311, 311, 312, 313, 315, 316, 317, 318, 320, + 321, 323, 324, 325, 326, 327, 328, 329, 330, 331, + 332, 333, 335, 335, 336, 336, 336, 337, 337, 337, + 337, 337, 337, 337, 338, 340, 342, 343, 345, 346, + 347, 348, 349, 351, 352, 353, 354, 356, 357, 358, + 358, 358, 358, 358, 358, 358, 359, 360, 362, 363, + + 364, 365, 367, 369, 371, 373, 374, 375, 375, 375, + 375, 375, 375, 376, 377, 378, 380, 381, 382, 384, + 384, 384, 384, 384, 384, 386, 387, 389, 390, 392, + 392, 392, 392, 392, 392, 392, 394, 396, 396, 396, + 396, 397, 397, 397, 397, 397, 398, 398, 398, 398, + 398, 398, 398, 399, 399 } ; static yyconst int yy_ec[256] = @@ -388,8 +391,8 @@ static yyconst int yy_ec[256] = 28, 29, 30, 1, 24, 1, 31, 32, 33, 34, 35, 36, 37, 38, 39, 24, 24, 40, 41, 42, - 43, 44, 45, 46, 47, 48, 49, 50, 24, 51, - 24, 24, 52, 1, 53, 1, 1, 1, 1, 1, + 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, + 24, 24, 53, 1, 54, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, @@ -406,300 +409,304 @@ static yyconst int yy_ec[256] = 1, 1, 1, 1, 1 } ; -static yyconst int yy_meta[54] = +static yyconst int yy_meta[55] = { 0, 1, 2, 3, 1, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 4, 4, 4, 4, 5, 1, 1, 6, 6, 7, 7, 7, 7, 1, 1, 1, 6, 6, 6, 6, 6, 6, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, - 7, 1, 1 + 7, 7, 1, 1 } ; -static yyconst short int yy_base[371] = +static yyconst short int yy_base[379] = { 0, - 0, 32, 3, 5, 76, 127, 15, 19, 180, 0, - 221, 0, 8, 47, 35, 51, 54, 57, 809, 810, - 810, 810, 810, 12, 768, 26, 37, 772, 810, 810, - 810, 792, 778, 810, 810, 810, 810, 35, 15, 0, - 810, 810, 65, 751, 810, 810, 810, 810, 0, 31, - 0, 784, 43, 52, 54, 810, 78, 62, 93, 84, - 97, 97, 99, 102, 65, 84, 98, 103, 100, 106, - 119, 107, 129, 810, 810, 810, 810, 788, 149, 157, - 810, 810, 787, 161, 239, 797, 796, 150, 810, 795, - 766, 238, 761, 210, 211, 131, 810, 750, 810, 0, - - 785, 239, 784, 783, 810, 788, 810, 264, 748, 810, - 810, 810, 786, 769, 768, 767, 101, 104, 228, 772, - 260, 772, 780, 264, 270, 280, 0, 289, 293, 754, - 253, 270, 275, 280, 281, 293, 294, 295, 296, 300, - 146, 297, 301, 299, 302, 305, 307, 810, 320, 345, - 350, 810, 354, 810, 356, 360, 364, 810, 368, 767, - 810, 810, 810, 777, 810, 732, 738, 725, 810, 745, - 723, 810, 722, 734, 723, 745, 810, 761, 760, 759, - 810, 810, 764, 810, 733, 762, 810, 745, 744, 743, - 335, 345, 341, 810, 360, 378, 758, 810, 374, 0, - - 378, 360, 365, 366, 368, 378, 379, 741, 380, 382, - 383, 384, 385, 388, 387, 386, 393, 399, 395, 396, - 418, 810, 712, 122, 810, 724, 810, 810, 707, 717, - 730, 810, 810, 810, 714, 734, 397, 733, 732, 437, - 810, 405, 731, 403, 407, 730, 408, 729, 412, 422, - 309, 426, 429, 431, 430, 433, 435, 436, 728, 465, - 810, 471, 476, 810, 703, 710, 713, 693, 0, 683, - 445, 698, 452, 697, 450, 438, 463, 464, 693, 465, - 469, 472, 658, 473, 475, 613, 604, 546, 558, 569, - 557, 474, 571, 476, 479, 480, 569, 565, 554, 544, - - 482, 481, 456, 526, 502, 538, 506, 483, 488, 520, - 490, 492, 518, 487, 480, 8, 317, 517, 494, 442, - 493, 441, 415, 292, 527, 518, 535, 518, 229, 145, - 541, 549, 810, 534, 141, 553, 541, 810, 51, 559, - 31, 563, 580, 584, 810, 810, 598, 605, 612, 619, - 626, 633, 640, 647, 654, 656, 660, 667, 674, 681, - 688, 692, 696, 703, 707, 712, 716, 722, 729, 736 + 0, 4, 7, 13, 17, 69, 24, 36, 123, 0, + 165, 0, 31, 52, 48, 77, 55, 81, 822, 823, + 823, 823, 823, 1, 781, 42, 56, 785, 823, 823, + 823, 805, 791, 823, 823, 823, 823, 57, 10, 0, + 823, 823, 27, 763, 823, 823, 823, 823, 0, 78, + 0, 797, 22, 49, 77, 823, 86, 93, 171, 101, + 209, 171, 173, 26, 55, 72, 178, 187, 172, 183, + 202, 191, 209, 823, 823, 823, 823, 801, 232, 233, + 823, 823, 800, 241, 252, 810, 809, 228, 823, 808, + 779, 254, 774, 220, 210, 75, 823, 763, 823, 0, + + 798, 243, 797, 796, 823, 801, 823, 260, 761, 823, + 823, 823, 799, 782, 781, 780, 17, 232, 242, 785, + 254, 785, 793, 261, 267, 273, 0, 288, 277, 767, + 166, 30, 89, 268, 279, 283, 290, 289, 292, 294, + 296, 175, 293, 301, 295, 303, 297, 305, 823, 343, + 316, 344, 823, 349, 823, 351, 355, 359, 823, 363, + 780, 823, 823, 823, 790, 823, 745, 751, 737, 823, + 758, 735, 823, 734, 747, 736, 758, 823, 774, 773, + 772, 823, 823, 777, 823, 746, 775, 823, 758, 757, + 756, 312, 351, 352, 823, 357, 374, 771, 823, 365, + + 0, 370, 359, 365, 370, 371, 298, 372, 374, 754, + 375, 376, 377, 378, 379, 382, 383, 384, 387, 385, + 388, 306, 418, 823, 725, 361, 823, 737, 823, 823, + 720, 730, 743, 823, 823, 823, 727, 747, 391, 746, + 745, 429, 823, 410, 744, 396, 397, 416, 743, 420, + 742, 421, 422, 423, 425, 427, 428, 429, 430, 433, + 431, 741, 452, 823, 471, 476, 823, 716, 723, 726, + 710, 0, 706, 442, 441, 735, 447, 734, 446, 450, + 464, 467, 733, 465, 468, 469, 732, 452, 470, 706, + 703, 700, 712, 723, 711, 472, 474, 721, 476, 477, + + 480, 714, 699, 698, 694, 484, 485, 458, 643, 611, + 641, 560, 488, 489, 496, 575, 497, 490, 574, 549, + 553, 321, 504, 524, 570, 499, 566, 508, 555, 520, + 527, 528, 522, 536, 529, 531, 308, 243, 542, 550, + 823, 535, 233, 554, 542, 823, 160, 560, 60, 564, + 581, 585, 823, 823, 599, 606, 613, 620, 627, 634, + 641, 648, 655, 657, 661, 668, 675, 682, 689, 693, + 697, 704, 708, 713, 717, 723, 730, 737 } ; -static yyconst short int yy_def[371] = +static yyconst short int yy_def[379] = { 0, - 347, 347, 348, 348, 349, 349, 350, 350, 346, 9, - 9, 11, 351, 351, 352, 352, 353, 353, 346, 346, - 346, 346, 346, 346, 346, 346, 346, 346, 346, 346, - 346, 346, 346, 346, 346, 346, 346, 346, 346, 354, - 346, 346, 346, 346, 346, 346, 346, 346, 355, 346, - 356, 357, 357, 357, 357, 346, 346, 346, 346, 346, - 346, 357, 357, 357, 357, 357, 357, 357, 357, 357, - 357, 357, 357, 346, 346, 346, 346, 346, 346, 346, - 346, 346, 346, 346, 346, 346, 346, 346, 346, 358, - 346, 346, 346, 346, 346, 346, 346, 346, 346, 359, - - 346, 346, 346, 346, 346, 360, 346, 346, 346, 346, - 346, 346, 361, 362, 357, 363, 357, 357, 357, 346, - 346, 346, 364, 346, 346, 346, 365, 346, 346, 346, - 357, 357, 357, 357, 357, 357, 357, 357, 357, 357, - 357, 357, 357, 357, 357, 357, 357, 346, 346, 346, - 346, 346, 366, 346, 346, 346, 346, 346, 346, 346, - 346, 346, 346, 358, 346, 346, 346, 346, 346, 346, - 346, 346, 346, 346, 346, 346, 346, 346, 346, 346, - 346, 346, 360, 346, 346, 361, 346, 362, 367, 363, - 357, 357, 357, 346, 346, 346, 364, 346, 346, 365, - - 346, 357, 357, 357, 357, 357, 357, 357, 357, 357, - 357, 357, 357, 357, 357, 357, 357, 357, 357, 357, - 368, 346, 346, 346, 346, 346, 346, 346, 346, 346, - 346, 346, 346, 346, 346, 367, 357, 357, 357, 346, - 346, 357, 357, 357, 357, 357, 357, 357, 357, 357, - 357, 357, 357, 357, 357, 357, 357, 357, 357, 346, - 346, 368, 346, 346, 346, 346, 346, 346, 369, 346, - 357, 357, 357, 357, 357, 357, 357, 357, 357, 357, - 357, 357, 357, 357, 357, 346, 346, 346, 346, 346, - 346, 357, 357, 357, 357, 357, 357, 357, 357, 357, - - 357, 357, 346, 346, 346, 346, 346, 357, 357, 357, - 357, 357, 357, 346, 346, 346, 346, 346, 357, 357, - 357, 357, 346, 346, 346, 346, 346, 346, 357, 346, - 346, 346, 346, 370, 346, 346, 370, 346, 346, 346, - 346, 346, 346, 346, 346, 0, 346, 346, 346, 346, - 346, 346, 346, 346, 346, 346, 346, 346, 346, 346, - 346, 346, 346, 346, 346, 346, 346, 346, 346, 346 + 355, 355, 356, 356, 357, 357, 358, 358, 354, 9, + 9, 11, 359, 359, 360, 360, 361, 361, 354, 354, + 354, 354, 354, 354, 354, 354, 354, 354, 354, 354, + 354, 354, 354, 354, 354, 354, 354, 354, 354, 362, + 354, 354, 354, 354, 354, 354, 354, 354, 363, 354, + 364, 365, 365, 365, 365, 354, 354, 354, 354, 354, + 354, 365, 365, 365, 365, 365, 365, 365, 365, 365, + 365, 365, 365, 354, 354, 354, 354, 354, 354, 354, + 354, 354, 354, 354, 354, 354, 354, 354, 354, 366, + 354, 354, 354, 354, 354, 354, 354, 354, 354, 367, + + 354, 354, 354, 354, 354, 368, 354, 354, 354, 354, + 354, 354, 369, 370, 365, 371, 365, 365, 365, 354, + 354, 354, 372, 354, 354, 354, 373, 354, 354, 354, + 365, 365, 365, 365, 365, 365, 365, 365, 365, 365, + 365, 365, 365, 365, 365, 365, 365, 365, 354, 354, + 354, 354, 354, 374, 354, 354, 354, 354, 354, 354, + 354, 354, 354, 354, 366, 354, 354, 354, 354, 354, + 354, 354, 354, 354, 354, 354, 354, 354, 354, 354, + 354, 354, 354, 368, 354, 354, 369, 354, 370, 375, + 371, 365, 365, 365, 354, 354, 354, 372, 354, 354, + + 373, 354, 365, 365, 365, 365, 365, 365, 365, 365, + 365, 365, 365, 365, 365, 365, 365, 365, 365, 365, + 365, 365, 376, 354, 354, 354, 354, 354, 354, 354, + 354, 354, 354, 354, 354, 354, 354, 375, 365, 365, + 365, 354, 354, 365, 365, 365, 365, 365, 365, 365, + 365, 365, 365, 365, 365, 365, 365, 365, 365, 365, + 365, 365, 354, 354, 376, 354, 354, 354, 354, 354, + 354, 377, 354, 365, 365, 365, 365, 365, 365, 365, + 365, 365, 365, 365, 365, 365, 365, 365, 365, 354, + 354, 354, 354, 354, 354, 365, 365, 365, 365, 365, + + 365, 365, 365, 365, 365, 365, 365, 354, 354, 354, + 354, 354, 365, 365, 365, 365, 365, 365, 365, 354, + 354, 354, 354, 354, 365, 365, 365, 365, 365, 354, + 354, 354, 354, 354, 354, 365, 365, 354, 354, 354, + 354, 378, 354, 354, 378, 354, 354, 354, 354, 354, + 354, 354, 354, 0, 354, 354, 354, 354, 354, 354, + 354, 354, 354, 354, 354, 354, 354, 354, 354, 354, + 354, 354, 354, 354, 354, 354, 354, 354 } ; -static yyconst short int yy_nxt[864] = +static yyconst short int yy_nxt[878] = { 0, - 346, 21, 22, 23, 21, 30, 31, 30, 31, 325, - 22, 77, 325, 24, 32, 346, 32, 46, 47, 78, - 48, 46, 47, 89, 48, 90, 105, 92, 106, 33, - 92, 346, 25, 26, 22, 23, 26, 22, 82, 27, - 101, 346, 112, 49, 113, 24, 83, 49, 79, 22, - 77, 79, 84, 22, 82, 84, 22, 87, 80, 22, - 87, 116, 85, 102, 25, 88, 108, 94, 88, 108, - 116, 93, 116, 122, 95, 123, 173, 28, 35, 36, - 96, 37, 117, 116, 38, 341, 103, 104, 97, 39, - 120, 119, 121, 121, 121, 121, 124, 118, 128, 128, - - 128, 128, 116, 109, 40, 124, 135, 125, 125, 125, - 126, 129, 129, 129, 129, 116, 116, 116, 116, 116, - 116, 116, 116, 136, 116, 116, 130, 41, 42, 35, - 36, 191, 37, 43, 44, 38, 132, 116, 117, 137, - 39, 133, 131, 127, 134, 138, 192, 116, 145, 139, - 149, 140, 162, 149, 141, 40, 142, 143, 151, 152, - 150, 153, 155, 163, 116, 155, 144, 146, 173, 265, - 148, 147, 156, 169, 339, 335, 174, 213, 41, 42, - 20, 21, 22, 23, 21, 20, 20, 20, 20, 20, - 20, 20, 20, 50, 20, 20, 20, 20, 51, 20, - - 20, 52, 52, 52, 52, 52, 52, 20, 20, 20, - 52, 52, 53, 52, 52, 54, 52, 52, 52, 52, - 52, 52, 52, 52, 52, 52, 52, 55, 52, 52, - 52, 56, 20, 57, 58, 59, 60, 60, 60, 92, - 157, 158, 92, 159, 178, 170, 116, 116, 61, 167, - 160, 62, 161, 63, 64, 65, 66, 168, 171, 67, - 68, 169, 172, 69, 70, 108, 193, 71, 108, 72, - 73, 116, 74, 75, 195, 195, 195, 195, 199, 199, - 199, 199, 124, 93, 125, 125, 125, 126, 116, 202, - 179, 180, 124, 116, 126, 126, 126, 126, 116, 116, - - 203, 124, 109, 128, 128, 128, 128, 129, 129, 129, - 129, 116, 116, 116, 116, 116, 204, 116, 116, 116, - 116, 149, 130, 116, 149, 116, 330, 116, 205, 206, - 210, 150, 326, 327, 327, 207, 209, 215, 211, 214, - 217, 208, 212, 277, 216, 220, 151, 152, 218, 153, - 219, 151, 152, 116, 151, 151, 152, 155, 151, 116, - 155, 157, 158, 116, 159, 157, 158, 156, 157, 157, - 158, 160, 157, 222, 195, 195, 195, 195, 116, 240, - 241, 237, 240, 116, 116, 238, 116, 239, 199, 199, - 199, 199, 129, 129, 129, 129, 116, 116, 116, 245, - - 116, 116, 116, 116, 116, 116, 116, 130, 242, 247, - 243, 116, 244, 116, 116, 116, 248, 116, 246, 260, - 261, 116, 260, 116, 252, 116, 116, 249, 254, 259, - 116, 251, 250, 253, 255, 256, 263, 257, 240, 241, - 116, 240, 258, 239, 116, 271, 273, 116, 116, 116, - 272, 116, 276, 116, 116, 274, 116, 275, 171, 116, - 116, 280, 282, 116, 278, 281, 260, 261, 116, 260, - 116, 284, 260, 261, 283, 260, 279, 260, 261, 292, - 260, 116, 116, 116, 285, 295, 293, 116, 294, 263, - 116, 116, 116, 116, 116, 296, 297, 116, 116, 116, - - 116, 116, 299, 314, 298, 302, 116, 172, 116, 309, - 116, 116, 116, 310, 301, 308, 312, 324, 328, 300, - 313, 328, 320, 334, 321, 322, 329, 311, 325, 323, - 319, 325, 332, 332, 332, 332, 116, 334, 116, 338, - 318, 331, 331, 331, 331, 333, 338, 317, 316, 332, - 332, 332, 332, 336, 338, 331, 331, 331, 331, 333, - 315, 338, 116, 332, 332, 332, 332, 340, 340, 340, - 340, 342, 116, 340, 340, 340, 340, 343, 343, 343, - 343, 344, 345, 116, 344, 344, 345, 116, 344, 116, - 307, 306, 305, 304, 343, 343, 343, 343, 20, 20, - - 20, 20, 20, 20, 20, 29, 29, 29, 29, 29, - 29, 29, 34, 34, 34, 34, 34, 34, 34, 45, - 45, 45, 45, 45, 45, 45, 76, 76, 76, 76, - 76, 76, 76, 81, 81, 81, 81, 81, 81, 81, - 86, 86, 86, 86, 86, 86, 86, 107, 107, 303, - 107, 107, 107, 107, 111, 111, 168, 111, 111, 111, - 111, 114, 114, 115, 115, 115, 115, 164, 164, 164, - 164, 164, 164, 164, 176, 176, 116, 176, 176, 176, - 176, 183, 183, 183, 183, 183, 183, 183, 186, 186, - 186, 186, 186, 186, 186, 188, 188, 188, 188, 190, - - 190, 190, 190, 197, 197, 197, 197, 197, 197, 197, - 200, 116, 200, 221, 221, 116, 116, 221, 221, 236, - 236, 236, 236, 262, 262, 262, 262, 262, 262, 290, - 290, 291, 290, 290, 290, 290, 337, 337, 289, 337, - 337, 337, 337, 288, 287, 286, 116, 116, 116, 116, - 116, 116, 189, 270, 269, 268, 267, 266, 264, 116, - 198, 116, 189, 189, 187, 235, 184, 234, 233, 232, - 231, 230, 229, 228, 227, 226, 225, 224, 223, 165, - 222, 201, 198, 196, 194, 116, 116, 189, 187, 185, - 184, 182, 181, 177, 175, 98, 166, 165, 162, 162, - - 154, 148, 116, 110, 100, 99, 98, 91, 346, 19, - 346, 346, 346, 346, 346, 346, 346, 346, 346, 346, - 346, 346, 346, 346, 346, 346, 346, 346, 346, 346, - 346, 346, 346, 346, 346, 346, 346, 346, 346, 346, - 346, 346, 346, 346, 346, 346, 346, 346, 346, 346, - 346, 346, 346, 346, 346, 346, 346, 346, 346, 346, - 346, 346, 346 + 354, 21, 22, 23, 21, 26, 22, 23, 26, 30, + 31, 27, 89, 24, 90, 30, 31, 24, 32, 35, + 36, 105, 37, 106, 32, 38, 46, 47, 108, 48, + 39, 108, 25, 22, 77, 116, 25, 33, 46, 47, + 116, 48, 78, 92, 116, 40, 92, 192, 116, 28, + 22, 82, 49, 79, 22, 77, 79, 22, 87, 83, + 204, 117, 101, 80, 49, 109, 88, 116, 135, 41, + 42, 35, 36, 116, 37, 43, 44, 38, 84, 22, + 82, 84, 39, 22, 87, 102, 94, 93, 85, 112, + 116, 113, 88, 95, 118, 116, 136, 40, 120, 96, + + 121, 121, 121, 121, 122, 174, 123, 116, 97, 103, + 104, 137, 174, 124, 119, 128, 128, 128, 128, 205, + 175, 41, 42, 20, 21, 22, 23, 21, 20, 20, + 20, 20, 20, 20, 20, 20, 50, 20, 20, 20, + 20, 51, 20, 20, 52, 52, 52, 52, 52, 52, + 20, 20, 20, 52, 52, 53, 52, 52, 54, 52, + 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, + 55, 52, 52, 52, 52, 56, 20, 57, 58, 59, + 60, 60, 60, 124, 116, 125, 125, 125, 126, 116, + 116, 116, 61, 116, 349, 62, 116, 63, 64, 65, + + 66, 116, 203, 67, 68, 116, 215, 69, 70, 116, + 132, 71, 133, 72, 73, 134, 131, 74, 75, 138, + 116, 140, 127, 129, 129, 129, 129, 116, 141, 139, + 163, 142, 146, 150, 152, 153, 150, 154, 130, 143, + 144, 164, 156, 151, 171, 156, 149, 147, 179, 145, + 116, 148, 157, 158, 159, 92, 160, 172, 92, 168, + 116, 108, 173, 161, 108, 162, 347, 169, 196, 196, + 196, 196, 170, 343, 193, 200, 200, 200, 200, 124, + 194, 125, 125, 125, 126, 124, 116, 126, 126, 126, + 126, 129, 129, 129, 129, 180, 181, 116, 109, 93, + + 124, 116, 128, 128, 128, 128, 130, 116, 116, 206, + 116, 116, 116, 116, 116, 116, 116, 152, 153, 116, + 154, 116, 332, 116, 116, 332, 116, 207, 212, 248, + 116, 208, 209, 211, 213, 216, 210, 217, 214, 262, + 218, 219, 221, 222, 150, 152, 153, 150, 152, 220, + 152, 153, 156, 152, 151, 156, 158, 159, 239, 160, + 158, 159, 157, 158, 158, 159, 161, 158, 224, 116, + 116, 196, 196, 196, 196, 242, 243, 116, 242, 200, + 200, 200, 200, 116, 129, 129, 129, 129, 116, 116, + 116, 240, 116, 116, 116, 116, 116, 116, 241, 130, + + 116, 116, 116, 116, 250, 116, 116, 244, 268, 116, + 245, 251, 249, 170, 116, 116, 246, 247, 255, 263, + 264, 252, 263, 260, 257, 254, 253, 256, 116, 259, + 242, 243, 258, 242, 116, 261, 266, 241, 116, 116, + 116, 116, 275, 116, 276, 116, 116, 116, 116, 116, + 274, 116, 280, 263, 264, 277, 263, 281, 284, 116, + 116, 286, 285, 282, 116, 116, 279, 278, 116, 288, + 116, 287, 263, 264, 283, 263, 296, 263, 264, 289, + 263, 298, 116, 116, 299, 116, 116, 116, 116, 266, + 116, 297, 116, 306, 116, 116, 301, 300, 116, 302, + + 307, 304, 116, 116, 303, 320, 116, 116, 116, 315, + 173, 316, 314, 313, 116, 116, 305, 116, 318, 333, + 334, 334, 326, 329, 319, 335, 116, 317, 335, 332, + 327, 328, 332, 336, 342, 325, 340, 340, 340, 340, + 346, 337, 339, 339, 339, 339, 341, 346, 342, 116, + 340, 340, 340, 340, 344, 346, 339, 339, 339, 339, + 341, 338, 346, 172, 340, 340, 340, 340, 348, 348, + 348, 348, 350, 116, 348, 348, 348, 348, 351, 351, + 351, 351, 352, 353, 116, 352, 352, 353, 116, 352, + 331, 330, 116, 116, 324, 351, 351, 351, 351, 20, + + 20, 20, 20, 20, 20, 20, 29, 29, 29, 29, + 29, 29, 29, 34, 34, 34, 34, 34, 34, 34, + 45, 45, 45, 45, 45, 45, 45, 76, 76, 76, + 76, 76, 76, 76, 81, 81, 81, 81, 81, 81, + 81, 86, 86, 86, 86, 86, 86, 86, 107, 107, + 323, 107, 107, 107, 107, 111, 111, 322, 111, 111, + 111, 111, 114, 114, 115, 115, 115, 115, 165, 165, + 165, 165, 165, 165, 165, 177, 177, 321, 177, 177, + 177, 177, 184, 184, 184, 184, 184, 184, 184, 187, + 187, 187, 187, 187, 187, 187, 189, 189, 189, 189, + + 191, 191, 191, 191, 198, 198, 198, 198, 198, 198, + 198, 201, 116, 201, 223, 223, 116, 116, 223, 223, + 238, 238, 238, 238, 265, 265, 265, 265, 265, 265, + 294, 294, 116, 294, 294, 294, 294, 345, 345, 116, + 345, 345, 345, 345, 312, 311, 310, 309, 308, 169, + 116, 116, 116, 116, 295, 293, 292, 291, 290, 116, + 116, 116, 116, 116, 116, 190, 273, 272, 271, 270, + 269, 267, 116, 199, 116, 190, 190, 188, 237, 185, + 236, 235, 234, 233, 232, 231, 230, 229, 228, 227, + 226, 225, 166, 224, 202, 199, 197, 195, 116, 116, + + 190, 188, 186, 185, 183, 182, 178, 176, 98, 167, + 166, 163, 163, 155, 149, 116, 110, 100, 99, 98, + 91, 354, 19, 354, 354, 354, 354, 354, 354, 354, + 354, 354, 354, 354, 354, 354, 354, 354, 354, 354, + 354, 354, 354, 354, 354, 354, 354, 354, 354, 354, + 354, 354, 354, 354, 354, 354, 354, 354, 354, 354, + 354, 354, 354, 354, 354, 354, 354, 354, 354, 354, + 354, 354, 354, 354, 354, 354, 354 } ; -static yyconst short int yy_chk[864] = +static yyconst short int yy_chk[878] = { 0, - 0, 1, 1, 1, 1, 3, 3, 4, 4, 316, - 13, 13, 316, 1, 3, 0, 4, 7, 7, 13, - 7, 8, 8, 24, 8, 24, 39, 26, 39, 4, - 26, 0, 1, 2, 2, 2, 2, 15, 15, 2, - 38, 0, 50, 7, 50, 2, 15, 8, 14, 14, - 14, 14, 16, 16, 16, 16, 17, 17, 14, 18, - 18, 53, 16, 38, 2, 17, 43, 27, 18, 43, - 54, 26, 55, 58, 27, 58, 341, 2, 5, 5, - 27, 5, 53, 65, 5, 339, 38, 38, 27, 5, - 57, 55, 57, 57, 57, 57, 60, 54, 60, 60, - - 60, 60, 66, 43, 5, 59, 65, 59, 59, 59, - 59, 61, 61, 61, 61, 62, 67, 63, 69, 117, - 64, 68, 118, 66, 70, 72, 61, 5, 5, 6, - 6, 117, 6, 6, 6, 6, 63, 71, 63, 67, - 6, 63, 62, 59, 64, 68, 118, 73, 72, 69, - 79, 70, 88, 79, 70, 6, 71, 71, 80, 80, - 79, 80, 84, 88, 141, 84, 71, 73, 96, 224, - 80, 73, 84, 224, 335, 330, 96, 141, 6, 6, - 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, + 0, 1, 1, 1, 1, 2, 2, 2, 2, 3, + 3, 2, 24, 1, 24, 4, 4, 2, 3, 5, + 5, 39, 5, 39, 4, 5, 7, 7, 43, 7, + 5, 43, 1, 13, 13, 117, 2, 4, 8, 8, + 53, 8, 13, 26, 64, 5, 26, 117, 132, 2, + 15, 15, 7, 14, 14, 14, 14, 17, 17, 15, + 132, 53, 38, 14, 8, 43, 17, 54, 64, 5, + 5, 6, 6, 65, 6, 6, 6, 6, 16, 16, + 16, 16, 6, 18, 18, 38, 27, 26, 16, 50, + 66, 50, 18, 27, 54, 55, 65, 6, 57, 27, + + 57, 57, 57, 57, 58, 349, 58, 133, 27, 38, + 38, 66, 96, 60, 55, 60, 60, 60, 60, 133, + 96, 6, 6, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, - 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, - 9, 9, 9, 11, 11, 11, 11, 11, 11, 92, - 85, 85, 92, 85, 102, 95, 119, 329, 11, 94, - 85, 11, 85, 11, 11, 11, 11, 94, 95, 11, - 11, 94, 95, 11, 11, 108, 119, 11, 108, 11, - 11, 131, 11, 11, 121, 121, 121, 121, 124, 124, - 124, 124, 125, 92, 125, 125, 125, 125, 132, 131, - 102, 102, 126, 133, 126, 126, 126, 126, 134, 135, - - 132, 128, 108, 128, 128, 128, 128, 129, 129, 129, - 129, 136, 137, 138, 139, 142, 133, 144, 140, 143, - 145, 149, 129, 146, 149, 147, 324, 251, 134, 135, - 139, 149, 317, 317, 317, 136, 138, 143, 140, 142, - 145, 137, 140, 251, 144, 147, 150, 150, 145, 150, - 146, 151, 151, 191, 151, 153, 153, 155, 153, 193, - 155, 156, 156, 192, 156, 157, 157, 155, 157, 159, - 159, 156, 159, 156, 195, 195, 195, 195, 202, 196, - 196, 191, 196, 203, 204, 192, 205, 193, 199, 199, - 199, 199, 201, 201, 201, 201, 206, 207, 209, 205, - - 210, 211, 212, 213, 216, 215, 214, 201, 202, 207, - 203, 217, 204, 219, 220, 237, 209, 218, 206, 221, - 221, 244, 221, 242, 213, 245, 247, 210, 215, 220, - 249, 212, 211, 214, 216, 217, 221, 218, 240, 240, - 250, 240, 219, 237, 252, 242, 245, 253, 255, 254, - 244, 256, 250, 257, 258, 247, 276, 249, 323, 322, - 320, 254, 255, 271, 252, 254, 260, 260, 275, 260, - 273, 257, 262, 262, 256, 262, 253, 263, 263, 271, - 263, 277, 278, 280, 258, 276, 273, 281, 275, 262, - 282, 284, 292, 285, 294, 277, 278, 295, 296, 302, - - 301, 308, 281, 303, 280, 285, 309, 303, 311, 294, - 312, 321, 319, 295, 284, 292, 301, 315, 318, 282, - 302, 318, 309, 328, 311, 312, 321, 296, 325, 314, - 308, 325, 326, 326, 326, 326, 313, 328, 310, 334, - 307, 325, 325, 325, 325, 327, 337, 306, 305, 327, - 327, 327, 327, 331, 334, 331, 331, 331, 331, 332, - 304, 337, 300, 332, 332, 332, 332, 336, 336, 336, - 336, 340, 299, 340, 340, 340, 340, 342, 342, 342, - 342, 343, 343, 298, 343, 344, 344, 297, 344, 293, - 291, 290, 289, 288, 343, 343, 343, 343, 347, 347, - - 347, 347, 347, 347, 347, 348, 348, 348, 348, 348, - 348, 348, 349, 349, 349, 349, 349, 349, 349, 350, - 350, 350, 350, 350, 350, 350, 351, 351, 351, 351, - 351, 351, 351, 352, 352, 352, 352, 352, 352, 352, - 353, 353, 353, 353, 353, 353, 353, 354, 354, 287, - 354, 354, 354, 354, 355, 355, 286, 355, 355, 355, - 355, 356, 356, 357, 357, 357, 357, 358, 358, 358, - 358, 358, 358, 358, 359, 359, 283, 359, 359, 359, - 359, 360, 360, 360, 360, 360, 360, 360, 361, 361, - 361, 361, 361, 361, 361, 362, 362, 362, 362, 363, - - 363, 363, 363, 364, 364, 364, 364, 364, 364, 364, - 365, 279, 365, 366, 366, 274, 272, 366, 366, 367, - 367, 367, 367, 368, 368, 368, 368, 368, 368, 369, - 369, 270, 369, 369, 369, 369, 370, 370, 268, 370, - 370, 370, 370, 267, 266, 265, 259, 248, 246, 243, - 239, 238, 236, 235, 231, 230, 229, 226, 223, 208, - 197, 190, 189, 188, 186, 185, 183, 180, 179, 178, - 176, 175, 174, 173, 171, 170, 168, 167, 166, 164, - 160, 130, 123, 122, 120, 116, 115, 114, 113, 109, - 106, 104, 103, 101, 98, 93, 91, 90, 87, 86, - - 83, 78, 52, 44, 33, 32, 28, 25, 19, 346, - 346, 346, 346, 346, 346, 346, 346, 346, 346, 346, - 346, 346, 346, 346, 346, 346, 346, 346, 346, 346, - 346, 346, 346, 346, 346, 346, 346, 346, 346, 346, - 346, 346, 346, 346, 346, 346, 346, 346, 346, 346, - 346, 346, 346, 346, 346, 346, 346, 346, 346, 346, - 346, 346, 346 + 9, 9, 9, 9, 9, 9, 9, 11, 11, 11, + 11, 11, 11, 59, 131, 59, 59, 59, 59, 62, + 69, 63, 11, 142, 347, 11, 67, 11, 11, 11, + + 11, 70, 131, 11, 11, 68, 142, 11, 11, 72, + 63, 11, 63, 11, 11, 63, 62, 11, 11, 67, + 71, 69, 59, 61, 61, 61, 61, 73, 70, 68, + 88, 70, 72, 79, 80, 80, 79, 80, 61, 71, + 71, 88, 84, 79, 95, 84, 80, 73, 102, 71, + 118, 73, 84, 85, 85, 92, 85, 95, 92, 94, + 119, 108, 95, 85, 108, 85, 343, 94, 121, 121, + 121, 121, 94, 338, 118, 124, 124, 124, 124, 125, + 119, 125, 125, 125, 125, 126, 134, 126, 126, 126, + 126, 129, 129, 129, 129, 102, 102, 135, 108, 92, + + 128, 136, 128, 128, 128, 128, 129, 138, 137, 134, + 139, 143, 140, 145, 141, 147, 207, 151, 151, 144, + 151, 146, 322, 148, 222, 322, 337, 135, 140, 207, + 192, 136, 137, 139, 141, 143, 138, 144, 141, 222, + 145, 146, 147, 148, 150, 152, 152, 150, 152, 146, + 154, 154, 156, 154, 150, 156, 157, 157, 192, 157, + 158, 158, 156, 158, 160, 160, 157, 160, 157, 193, + 194, 196, 196, 196, 196, 197, 197, 203, 197, 200, + 200, 200, 200, 204, 202, 202, 202, 202, 205, 206, + 208, 193, 209, 211, 212, 213, 214, 215, 194, 202, + + 216, 217, 218, 220, 209, 219, 221, 203, 226, 239, + 204, 211, 208, 226, 246, 247, 205, 206, 215, 223, + 223, 212, 223, 220, 217, 214, 213, 216, 244, 219, + 242, 242, 218, 242, 248, 221, 223, 239, 250, 252, + 253, 254, 246, 255, 247, 256, 257, 258, 259, 261, + 244, 260, 253, 263, 263, 248, 263, 254, 257, 275, + 274, 258, 257, 255, 279, 277, 252, 250, 280, 260, + 288, 259, 265, 265, 256, 265, 274, 266, 266, 261, + 266, 277, 281, 284, 279, 282, 285, 286, 289, 265, + 296, 275, 297, 288, 299, 300, 281, 280, 301, 282, + + 289, 285, 306, 307, 284, 308, 313, 314, 318, 299, + 308, 300, 297, 296, 315, 317, 286, 326, 306, 323, + 323, 323, 314, 318, 307, 324, 328, 301, 324, 332, + 315, 317, 332, 326, 335, 313, 333, 333, 333, 333, + 342, 328, 332, 332, 332, 332, 334, 345, 335, 336, + 334, 334, 334, 334, 339, 342, 339, 339, 339, 339, + 340, 331, 345, 330, 340, 340, 340, 340, 344, 344, + 344, 344, 348, 329, 348, 348, 348, 348, 350, 350, + 350, 350, 351, 351, 327, 351, 352, 352, 325, 352, + 321, 320, 319, 316, 312, 351, 351, 351, 351, 355, + + 355, 355, 355, 355, 355, 355, 356, 356, 356, 356, + 356, 356, 356, 357, 357, 357, 357, 357, 357, 357, + 358, 358, 358, 358, 358, 358, 358, 359, 359, 359, + 359, 359, 359, 359, 360, 360, 360, 360, 360, 360, + 360, 361, 361, 361, 361, 361, 361, 361, 362, 362, + 311, 362, 362, 362, 362, 363, 363, 310, 363, 363, + 363, 363, 364, 364, 365, 365, 365, 365, 366, 366, + 366, 366, 366, 366, 366, 367, 367, 309, 367, 367, + 367, 367, 368, 368, 368, 368, 368, 368, 368, 369, + 369, 369, 369, 369, 369, 369, 370, 370, 370, 370, + + 371, 371, 371, 371, 372, 372, 372, 372, 372, 372, + 372, 373, 305, 373, 374, 374, 304, 303, 374, 374, + 375, 375, 375, 375, 376, 376, 376, 376, 376, 376, + 377, 377, 302, 377, 377, 377, 377, 378, 378, 298, + 378, 378, 378, 378, 295, 294, 293, 292, 291, 290, + 287, 283, 278, 276, 273, 271, 270, 269, 268, 262, + 251, 249, 245, 241, 240, 238, 237, 233, 232, 231, + 228, 225, 210, 198, 191, 190, 189, 187, 186, 184, + 181, 180, 179, 177, 176, 175, 174, 172, 171, 169, + 168, 167, 165, 161, 130, 123, 122, 120, 116, 115, + + 114, 113, 109, 106, 104, 103, 101, 98, 93, 91, + 90, 87, 86, 83, 78, 52, 44, 33, 32, 28, + 25, 19, 354, 354, 354, 354, 354, 354, 354, 354, + 354, 354, 354, 354, 354, 354, 354, 354, 354, 354, + 354, 354, 354, 354, 354, 354, 354, 354, 354, 354, + 354, 354, 354, 354, 354, 354, 354, 354, 354, 354, + 354, 354, 354, 354, 354, 354, 354, 354, 354, 354, + 354, 354, 354, 354, 354, 354, 354 } ; static yy_state_type yy_state_buf[YY_BUF_SIZE + 2], *yy_state_ptr; @@ -818,7 +825,7 @@ add_gtk_doc_func(void) #define GTK_DOC_LINE 8 -#line 822 "lex.yy.c" +#line 829 "lex.yy.c" /* Macros after this point can all be overridden by user definitions in * section 1. @@ -975,7 +982,7 @@ YY_DECL #line 98 "lexer.l" -#line 979 "lex.yy.c" +#line 986 "lex.yy.c" if ( yy_init ) { @@ -1024,14 +1031,14 @@ yy_match: while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) { yy_current_state = (int) yy_def[yy_current_state]; - if ( yy_current_state >= 347 ) + if ( yy_current_state >= 355 ) yy_c = yy_meta[(unsigned int) yy_c]; } yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; *yy_state_ptr++ = yy_current_state; ++yy_cp; } - while ( yy_base[yy_current_state] != 810 ); + while ( yy_base[yy_current_state] != 823 ); yy_find_action: yy_current_state = *--yy_state_ptr; @@ -1561,7 +1568,7 @@ YY_RULE_SETUP char *s; s = g_strdup_printf("'%s' keyword should not " "be used when generating " - "C++ code",yytext); + "C++ code", yytext); print_error(TRUE, s, line_no); g_free(s); } @@ -1661,76 +1668,81 @@ YY_RULE_SETUP case 72: YY_RULE_SETUP #line 398 "lexer.l" -{yylval.line = line_no; return ARGUMENT;} +{yylval.line = line_no; return CLASSWIDE;} YY_BREAK case 73: YY_RULE_SETUP #line 399 "lexer.l" -{yylval.line = line_no; return VIRTUAL;} +{yylval.line = line_no; return ARGUMENT;} YY_BREAK case 74: YY_RULE_SETUP #line 400 "lexer.l" -{yylval.line = line_no; return SIGNAL;} +{yylval.line = line_no; return VIRTUAL;} YY_BREAK case 75: YY_RULE_SETUP #line 401 "lexer.l" -{yylval.line = line_no; return OVERRIDE;} +{yylval.line = line_no; return SIGNAL;} YY_BREAK case 76: YY_RULE_SETUP #line 402 "lexer.l" +{yylval.line = line_no; return OVERRIDE;} + YY_BREAK +case 77: +YY_RULE_SETUP +#line 403 "lexer.l" { yylval.id = g_strdup(yytext); return NUMBER; } YY_BREAK -case 77: +case 78: YY_RULE_SETUP -#line 406 "lexer.l" +#line 407 "lexer.l" { /* this one is for a classname with a namespace */ yylval.id = g_strdup(yytext); return TYPETOKEN; } YY_BREAK -case 78: +case 79: YY_RULE_SETUP -#line 411 "lexer.l" +#line 412 "lexer.l" { /* this is for a classname with an empty namespace */ yylval.id = g_strdup(yytext); return TYPETOKEN; } YY_BREAK -case 79: +case 80: YY_RULE_SETUP -#line 416 "lexer.l" +#line 417 "lexer.l" { yylval.id = g_strdup(yytext); return TOKEN; } YY_BREAK -case 80: +case 81: YY_RULE_SETUP -#line 421 "lexer.l" +#line 422 "lexer.l" { yylval.id = g_strdup(yytext); return ARRAY_DIM; } YY_BREAK -case 81: +case 82: YY_RULE_SETUP -#line 426 "lexer.l" +#line 427 "lexer.l" { BEGIN(CLASS_CODE_I); return '{'; } YY_BREAK -case 82: +case 83: YY_RULE_SETUP -#line 430 "lexer.l" +#line 431 "lexer.l" { BEGIN(C_CODE); parenth_depth=1; @@ -1741,38 +1753,38 @@ YY_RULE_SETUP return '{'; } YY_BREAK -case 83: +case 84: YY_RULE_SETUP -#line 439 "lexer.l" +#line 440 "lexer.l" { BEGIN(INITIAL); return '}'; } YY_BREAK -case 84: +case 85: YY_RULE_SETUP -#line 444 "lexer.l" +#line 445 "lexer.l" ; /*ignore*/ YY_BREAK -case 85: +case 86: YY_RULE_SETUP -#line 446 "lexer.l" +#line 447 "lexer.l" { yylval.line = line_no; return yytext[0]; } YY_BREAK -case 86: +case 87: YY_RULE_SETUP -#line 451 "lexer.l" +#line 452 "lexer.l" ; /*ignore*/ YY_BREAK -case 87: +case 88: YY_RULE_SETUP -#line 452 "lexer.l" +#line 453 "lexer.l" ECHO; YY_BREAK -#line 1776 "lex.yy.c" +#line 1788 "lex.yy.c" case YY_STATE_EOF(INITIAL): case YY_STATE_EOF(COMMENT): case YY_STATE_EOF(C_CODE): @@ -2070,7 +2082,7 @@ static yy_state_type yy_get_previous_state() while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) { yy_current_state = (int) yy_def[yy_current_state]; - if ( yy_current_state >= 347 ) + if ( yy_current_state >= 355 ) yy_c = yy_meta[(unsigned int) yy_c]; } yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; @@ -2100,11 +2112,11 @@ yy_state_type yy_current_state; while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) { yy_current_state = (int) yy_def[yy_current_state]; - if ( yy_current_state >= 347 ) + if ( yy_current_state >= 355 ) yy_c = yy_meta[(unsigned int) yy_c]; } yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; - yy_is_jam = (yy_current_state == 346); + yy_is_jam = (yy_current_state == 354); if ( ! yy_is_jam ) *yy_state_ptr++ = yy_current_state; @@ -2662,4 +2674,4 @@ int main() return 0; } #endif -#line 452 "lexer.l" +#line 453 "lexer.l" diff --git a/src/lexer.l b/src/lexer.l index 941a460..1e7de53 100644 --- a/src/lexer.l +++ b/src/lexer.l @@ -367,7 +367,7 @@ class { char *s; s = g_strdup_printf("'%s' keyword should not " "be used when generating " - "C++ code",yytext); + "C++ code", yytext); print_error(TRUE, s, line_no); g_free(s); } @@ -395,6 +395,7 @@ class { public {yylval.line = line_no; return PUBLIC;} private {yylval.line = line_no; return PRIVATE;} protected {yylval.line = line_no; return PROTECTED;} +classwide {yylval.line = line_no; return CLASSWIDE;} argument {yylval.line = line_no; return ARGUMENT;} virtual {yylval.line = line_no; return VIRTUAL;} signal {yylval.line = line_no; return SIGNAL;} diff --git a/src/main.c b/src/main.c index 09f59c2..cdbfa42 100644 --- a/src/main.c +++ b/src/main.c @@ -85,8 +85,7 @@ gboolean no_gnu = FALSE; gboolean exit_on_warn = FALSE; gboolean exit_on_error = TRUE; gboolean got_error = FALSE; -gboolean always_private_header = FALSE; -gboolean no_private_header = FALSE; +gint private_header = PRIVATE_HEADER_ALWAYS; gboolean no_extern_c = FALSE; gboolean no_write = FALSE; gboolean no_lines = FALSE; @@ -309,7 +308,7 @@ add_bad_hack_to_avoid_unused_warnings(Class *c) return; if(!no_gnu) - out_printf(out,"\n\n#ifndef __GNUC__\n"); + out_printf(out, "\n\n#ifndef __GNUC__\n"); out_printf(out, "/*REALLY BAD HACK\n" " This is to avoid unused warnings if you don't call\n" @@ -318,7 +317,7 @@ add_bad_hack_to_avoid_unused_warnings(Class *c) " extentions to make saner, faster code */\n" "static void\n" "___%s_really_bad_hack_to_avoid_warnings(void)\n" - "{\n",funcbase); + "{\n", funcbase); for(li=c->nodes;li;li=g_list_next(li)) { Node *node = li->data; if(node->type == METHOD_NODE) { @@ -330,31 +329,31 @@ add_bad_hack_to_avoid_unused_warnings(Class *c) continue; /* in C++ mode we don't alias new */ - if(for_cpp && strcmp(m->id,"new")==0) + if(for_cpp && strcmp(m->id, "new")==0) continue; - out_printf(out,"\t((void (*)(void))%s)();\n",m->id); + out_printf(out, "\t((void (*)(void))%s)();\n", m->id); } } out_printf(out, "\t___%s_really_bad_hack_to_avoid_warnings();\n", funcbase); if(!no_gnu) - out_printf(out,"}\n#endif /* __GNUC__ */\n\n"); + out_printf(out, "}\n#endif /* __GNUC__ */\n\n"); else - out_printf(out,"}\n\n"); + out_printf(out, "}\n\n"); } static void put_variable(Variable *v, FILE *fp) { - out_printf(fp,"\t"); - print_type(fp,v->vtype,FALSE); - out_printf(fp,"%s%s;",v->id, + out_printf(fp, "\t"); + print_type(fp, v->vtype, FALSE); + out_printf(fp, "%s%s;", v->id, v->vtype->postfix? v->vtype->postfix:""); if(v->scope == PROTECTED_SCOPE) - out_printf(fp," /* protected */"); - out_printf(fp,"\n"); + out_printf(fp, " /* protected */"); + out_printf(fp, "\n"); } static void @@ -367,10 +366,10 @@ put_vs_method(Method *m) /* if a signal mark it as such */ if(m->method != VIRTUAL_METHOD) - print_method(outh,"\t/*signal*/","(* ","",") ",";\n",m, - FALSE,TRUE); + print_method(outh, "\t/*signal*/", "(* ", "", ") ", ";\n", m, + FALSE, TRUE); else - print_method(outh,"\t","(* ","",") ",";\n",m,FALSE,TRUE); + print_method(outh, "\t", "(* ", "", ") ", ";\n", m, FALSE, TRUE); } static void @@ -379,7 +378,7 @@ put_pub_method(Method *m) if(m->scope != PUBLIC_SCOPE) return; - print_method(outh,"","\t","","\t",";\n",m,TRUE,FALSE); + print_method(outh, "", "\t", "", "\t", ";\n", m, TRUE, FALSE); } /* I'm starting not to like this idea */ @@ -427,9 +426,9 @@ put_prot_method(Method *m) return; if(outph) - print_method(outph,"","\t","","\t",";\n",m,FALSE,FALSE); + print_method(outph, "", "\t", "", "\t", ";\n", m, FALSE, FALSE); else - print_method(out,"","\t","","\t",";\n",m,FALSE,FALSE); + print_method(out, "", "\t", "", "\t", ";\n", m, FALSE, FALSE); } static void @@ -462,12 +461,12 @@ make_func_arg(char *typename, int is_class, char *name) char *tn; if(is_class) - tn = g_strconcat(typename,":Class",NULL); + tn = g_strconcat(typename, ":Class", NULL); else tn = g_strdup(typename); - type = new_type(1,tn,NULL); - node = new_funcarg((Type *)type,name,NULL); + type = new_type(1, tn, NULL); + node = new_funcarg((Type *)type, name, NULL); return g_list_prepend(NULL, node); } @@ -484,30 +483,30 @@ make_inits(Class *cl) Method *m = (Method *)n; if(m->method == INIT_METHOD) { if(got_init) - print_error(FALSE,"init defined more then once",m->line_no); + print_error(FALSE, "init defined more then once", m->line_no); got_init = TRUE; } else if(m->method == CLASS_INIT_METHOD) { if(got_class_init) - print_error(FALSE,"class_init defined more then once",m->line_no); + print_error(FALSE, "class_init defined more then once", m->line_no); got_class_init = TRUE; } } } if(!got_class_init) { node = new_method(NO_SCOPE, CLASS_INIT_METHOD, - (Type *)new_type(0, g_strdup("void"),NULL), + (Type *)new_type(0, g_strdup("void"), NULL), NULL, NULL, NULL, g_strdup("class_init"), make_func_arg(cl->otype, TRUE, g_strdup("c")), NULL, NULL, NULL, 0, 0, FALSE); - cl->nodes = g_list_prepend(cl->nodes,node); + cl->nodes = g_list_prepend(cl->nodes, node); } if(!got_init) { node = new_method(NO_SCOPE, INIT_METHOD, - (Type *)new_type(0, g_strdup("void"),NULL), + (Type *)new_type(0, g_strdup("void"), NULL), NULL, NULL, NULL, g_strdup("init"), make_func_arg(cl->otype, FALSE, g_strdup("o")), NULL, NULL, NULL, 0, 0, FALSE); - cl->nodes = g_list_prepend(cl->nodes,node); + cl->nodes = g_list_prepend(cl->nodes, node); } } @@ -527,7 +526,7 @@ make_finalize(Class *cl) got_finalize = TRUE; break; } - print_error(FALSE,"finalize method override " + print_error(FALSE, "finalize method override " "of class other then Gtk:Object", m->line_no); } @@ -535,14 +534,14 @@ make_finalize(Class *cl) } if(!got_finalize) { node = new_method(NO_SCOPE, OVERRIDE_METHOD, - (Type *)new_type(0,g_strdup("void"),NULL), + (Type *)new_type(0, g_strdup("void"), NULL), g_strdup("Gtk:Object"), NULL, NULL, g_strdup("finalize"), - make_func_arg("Gtk:Object",FALSE,g_strdup("o")), + make_func_arg("Gtk:Object", FALSE, g_strdup("o")), NULL, NULL, g_strdup("PARENT_HANDLER (o);\n"), - 0,0,FALSE); - cl->nodes = g_list_append(cl->nodes,node); + 0, 0, FALSE); + cl->nodes = g_list_append(cl->nodes, node); overrides++; } } @@ -561,7 +560,7 @@ static gboolean is_list_equal(GList *a, GList *b) { for(;a && b; a=a->next, b=b->next) { - if(strcmp(a->data,b->data)!=0) { + if(strcmp(a->data, b->data)!=0) { return FALSE; } } @@ -577,7 +576,7 @@ find_same_type_signal(Method *m) GList *li; for(li=eq_signal_methods;li;li=li->next) { Method *mm = li->data; - if(is_list_equal(mm->gtktypes,m->gtktypes)) + if(is_list_equal(mm->gtktypes, m->gtktypes)) return mm; } return NULL; @@ -589,16 +588,16 @@ print_signal_marsal_args(Method *m) if(strcmp(m->gtktypes->next->data, "NONE")!=0) { GList *li; int i; - for(i=0,li=m->gtktypes->next;li; - i++,li=g_list_next(li)) { + for(i=0, li=m->gtktypes->next;li; + i++, li=g_list_next(li)) { if(!for_cpp) out_printf(out, ",\n\t\tGTK_VALUE_%s(args[%d])", - (char *)li->data,i); + (char *)li->data, i); else { out_printf(out, ",\n\t\t(%s)" "GTK_VALUE_%s(args[%d])", get_cast(li->data, FALSE), - (char *)li->data,i); + (char *)li->data, i); } } } @@ -619,7 +618,7 @@ add_signal_prots(Method *m) return; if(!marsh) - marsh = g_hash_table_new(NULL,NULL); + marsh = g_hash_table_new(NULL, NULL); if(strcmp(m->gtktypes->data, "NONE")==0 && strcmp(m->gtktypes->next->data, "NONE")==0) @@ -628,12 +627,12 @@ add_signal_prots(Method *m) /* if we already did a signal prototype just use that */ mm = find_same_type_signal(m); if(mm) { - s = g_hash_table_lookup(marsh,mm); - g_hash_table_insert(marsh,m,s); + s = g_hash_table_lookup(marsh, mm); + g_hash_table_insert(marsh, m, s); return; } - s = g_strdup_printf("Sig%d",sig++); + s = g_strdup_printf("Sig%d", sig++); g_hash_table_insert(marsh, m, s); eq_signal_methods = g_list_prepend(eq_signal_methods, m); @@ -648,12 +647,12 @@ add_signal_prots(Method *m) } out_printf(out, "gpointer);\n"); - out_printf(out,"\nstatic void\n" + out_printf(out, "\nstatic void\n" "___marshal_%s (GtkObject * object,\n" "\tGtkSignalFunc func,\n" "\tgpointer func_data,\n" "\tGtkArg * args)\n" - "{\n",s); + "{\n", s); if(strcmp(m->gtktypes->data, "NONE")==0) { out_printf(out, "\t___%s rfunc;\n\n" @@ -678,9 +677,9 @@ static void add_enums(Class *c) { GList *li; - out_printf(out,"\n"); + out_printf(out, "\n"); if(signals>0) { - out_printf(out,"enum {\n"); + out_printf(out, "enum {\n"); for(li=c->nodes;li;li=g_list_next(li)) { Node *n = li->data; if(n->type == METHOD_NODE) { @@ -689,22 +688,22 @@ add_enums(Class *c) m->method == SIGNAL_FIRST_METHOD) { char *s = g_strdup(m->id); g_strup(s); - out_printf(out,"\t%s_SIGNAL,\n",s); + out_printf(out, "\t%s_SIGNAL,\n", s); g_free(s); } } } - out_printf(out,"\tLAST_SIGNAL\n};\n\n"); + out_printf(out, "\tLAST_SIGNAL\n};\n\n"); } if(arguments>0) { - out_printf(out,"enum {\n\tARG_0"); + out_printf(out, "enum {\n\tARG_0"); for(li=c->nodes;li;li=g_list_next(li)) { Node *n = li->data; if(n->type == ARGUMENT_NODE) { Argument *a = (Argument *)n; char *s = g_strdup(a->name); g_strup(s); - out_printf(out,",\n\tARG_%s",s); + out_printf(out, ",\n\tARG_%s", s); g_free(s); } } @@ -716,7 +715,7 @@ add_enums(Class *c) "static guint object_signals[LAST_SIGNAL] = {0};\n\n"); out_printf(out, "/* pointer to the class of our parent */\n"); - out_printf(out, "static %sClass *parent_class = NULL;\n\n",ptypebase); + out_printf(out, "static %sClass *parent_class = NULL;\n\n", ptypebase); } static void @@ -741,8 +740,8 @@ add_get_type(void) "\t}\n\n" "\treturn type;\n" "}\n\n", - funcbase,typebase,typebase,typebase, - funcbase,funcbase,pfuncbase); + funcbase, typebase, typebase, typebase, + funcbase, funcbase, pfuncbase); } static void @@ -767,21 +766,21 @@ add_overrides(Class *c, char *oname, gboolean did_gtk_obj) s = remove_sep(m->otype); - if(g_hash_table_lookup(done,s)) { + if(g_hash_table_lookup(done, s)) { g_free(s); continue; } - g_hash_table_insert(done,s,s); + g_hash_table_insert(done, s, s); - f = replace_sep(m->otype,'_'); + f = replace_sep(m->otype, '_'); g_strdown(f); - out_printf(out,"\t%sClass *%s_class = (%sClass *)%s;\n", - s,f,s,oname); + out_printf(out, "\t%sClass *%s_class = (%sClass *)%s;\n", + s, f, s, oname); g_free(f); } - g_hash_table_foreach(done,(GHFunc)g_free,NULL); + g_hash_table_foreach(done, (GHFunc)g_free, NULL); g_hash_table_destroy(done); } @@ -814,7 +813,7 @@ make_run_signal_flags(Method *m, gboolean last) char *flag = li->data; int i; for(i=0;flags[i];i++) { - if(strcmp(flags[i],flag)==0) + if(strcmp(flags[i], flag)==0) break; } /* if we haven't found it in our list */ @@ -826,7 +825,7 @@ make_run_signal_flags(Method *m, gboolean last) print_error(TRUE, s, m->line_no); g_free(s); } - g_string_sprintfa(gs, " | GTK_RUN_%s",flag); + g_string_sprintfa(gs, " | GTK_RUN_%s", flag); } { @@ -842,7 +841,7 @@ add_signals(Class *c) { GList *li; - out_printf(out,"\n"); + out_printf(out, "\n"); for(li=c->nodes;li;li=g_list_next(li)) { Node *n = li->data; char *mar, *sig, *flags; @@ -861,7 +860,7 @@ add_signals(Class *c) if(g_hash_table_lookup(marsh, m)) mar = g_strconcat("___marshal_", - (char *)g_hash_table_lookup(marsh,m), + (char *)g_hash_table_lookup(marsh, m), NULL); else mar = g_strdup("gtk_signal_default_marshaller"); @@ -871,16 +870,16 @@ add_signals(Class *c) sig = g_strdup(m->id); g_strup(sig); flags = make_run_signal_flags(m, last); - out_printf(out,"\tobject_signals[%s_SIGNAL] =\n" + 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_SIGNAL_OFFSET (%sClass, %s),\n" "\t\t\t%s,\n" "\t\t\tGTK_TYPE_%s, %d", - sig,m->id, + sig, m->id, flags, - typebase,m->id,mar,(char *)m->gtktypes->data, + typebase, m->id, mar, (char *)m->gtktypes->data, is_none?0:g_list_length(m->gtktypes->next)); g_free(mar); g_free(sig); @@ -889,13 +888,13 @@ add_signals(Class *c) if(!is_none) { GList *l; for(l=m->gtktypes->next;l;l=g_list_next(l)) - out_printf(out,",\n\t\t\tGTK_TYPE_%s", + out_printf(out, ",\n\t\t\tGTK_TYPE_%s", (char *)l->data); } - out_printf(out,");\n"); + out_printf(out, ");\n"); } - out_printf(out,"\tgtk_object_class_add_signals (gtk_object_class,\n" + out_printf(out, "\tgtk_object_class_add_signals (gtk_object_class,\n" "\t\tobject_signals, LAST_SIGNAL);\n\n"); } @@ -905,7 +904,7 @@ set_def_handlers(Class *c, char *oname) GList *li; gboolean set_line = FALSE; - out_printf(out,"\n"); + out_printf(out, "\n"); for(li=c->nodes;li;li=g_list_next(li)) { Node *n = li->data; Method *m = (Method *)n; @@ -929,17 +928,17 @@ set_def_handlers(Class *c, char *oname) s = replace_sep(m->otype, '_'); g_strdown(s); if(m->cbuf) - out_printf(out,"\t%s_class->%s = %s_%s;\n", + out_printf(out, "\t%s_class->%s = %s_%s;\n", s, m->id, funcbase, m->id); else - out_printf(out,"\t%s_class->%s = NULL;\n", + out_printf(out, "\t%s_class->%s = NULL;\n", s, m->id); } else { if(m->cbuf) - out_printf(out,"\t%s->%s = ___real_%s_%s;\n", + out_printf(out, "\t%s->%s = ___real_%s_%s;\n", oname, m->id, funcbase, m->id); else - out_printf(out,"\t%s->%s = NULL;\n", + out_printf(out, "\t%s->%s = NULL;\n", oname, m->id); } } @@ -959,7 +958,7 @@ make_arguments(Class *c) NULL }; - out_printf(out,"\n"); + out_printf(out, "\n"); for(li=c->nodes;li;li=g_list_next(li)) { Node *n = li->data; Argument *a; @@ -981,16 +980,16 @@ make_arguments(Class *c) for(l=a->flags;l;l=g_list_next(l)) { char *flag = l->data; int i; - if(strcmp(flag,"READWRITE")==0 || - strcmp(flag,"READABLE")==0 || - strcmp(flag,"WRITABLE")==0) { - print_error(TRUE,"READWRITE, READABLE and " + if(strcmp(flag, "READWRITE")==0 || + strcmp(flag, "READABLE")==0 || + strcmp(flag, "WRITABLE")==0) { + print_error(TRUE, "READWRITE, READABLE and " "WRITABLE argument flags are " - "set automatically",a->line_no); + "set automatically", a->line_no); continue; } for(i=0;argflags[i];i++) { - if(strcmp(argflags[i],flag)==0) + if(strcmp(argflags[i], flag)==0) break; } /* if we haven't found it in our list */ @@ -999,15 +998,15 @@ make_arguments(Class *c) s = g_strdup_printf("Unknown flag '%s' used, " "perhaps it was misspelled", flag); - print_error(TRUE,s,a->line_no); + print_error(TRUE, s, a->line_no); g_free(s); } - g_string_sprintfa(flags, " | GTK_ARG_%s",flag); + g_string_sprintfa(flags, " | GTK_ARG_%s", flag); } s = g_strdup(a->name); g_strup(s); - out_printf(out,"\tgtk_object_add_arg_type(\"%s::%s\",\n" + out_printf(out, "\tgtk_object_add_arg_type(\"%s::%s\",\n" "\t\tGTK_TYPE_%s,\n" "\t\t%s,\n" "\t\tARG_%s);\n", @@ -1059,14 +1058,14 @@ add_inits(Class *c) m = (Method *)n; if(m->method == INIT_METHOD) { if(m->line_no > 0) - out_addline_infile(out,m->line_no); + out_addline_infile(out, m->line_no); print_method(out, "static ", "\n", "", " ", "\n", m, FALSE, FALSE); if(m->line_no > 0) out_addline_outfile(out); - out_printf(out,"{\n"); + out_printf(out, "{\n"); if(privates > 0) { - out_printf(out,"\t%s->_priv = " + out_printf(out, "\t%s->_priv = " "g_new0 (%sPrivate, 1);\n", ((FuncArg *)m->args->data)->name, typebase); @@ -1077,9 +1076,11 @@ add_inits(Class *c) li != NULL; li = li->next) { Node *n = li->data; - if(n->type != VARIABLE_NODE) + Variable *v = (Variable *)n; + if(n->type != VARIABLE_NODE || + v->scope == CLASS_SCOPE) continue; - print_initializer(m, (Variable *)n); + print_initializer(m, v); } } } else if(m->method == CLASS_INIT_METHOD) { @@ -1089,7 +1090,7 @@ add_inits(Class *c) m, FALSE, FALSE); if(m->line_no > 0) out_addline_outfile(out); - out_printf(out,"{\n"); + out_printf(out, "{\n"); if(signals>0 || arguments>0) out_printf(out, @@ -1102,11 +1103,25 @@ add_inits(Class *c) add_overrides(c, ((FuncArg *)m->args->data)->name, (signals>0 || arguments>0)); + + if(initializers > 0) { + GList *li; + for(li = ((Class *)class)->nodes; + li != NULL; + li = li->next) { + Node *n = li->data; + Variable *v = (Variable *)n; + if(n->type != VARIABLE_NODE || + v->scope != CLASS_SCOPE) + continue; + print_initializer(m, v); + } + } - out_printf(out,"\n\tparent_class = "); + out_printf(out, "\n\tparent_class = "); if(for_cpp) - out_printf(out,"(%sClass *)",ptypebase); - out_printf(out,"gtk_type_class (%s_get_type ());\n", + out_printf(out, "(%sClass *)", ptypebase); + out_printf(out, "gtk_type_class (%s_get_type ());\n", pfuncbase); if(signals>0) @@ -1121,15 +1136,15 @@ add_inits(Class *c) continue; if(m->cbuf) { - out_printf(out," {\n"); - out_addline_infile(out,m->ccode_line); - out_printf(out,"%s\n",m->cbuf); + out_printf(out, " {\n"); + out_addline_infile(out, m->ccode_line); + out_printf(out, "%s\n", m->cbuf); out_addline_outfile(out); - out_printf(out," }\n"); + out_printf(out, " }\n"); } else { - out_printf(out,"return;\n"); + out_printf(out, "return;\n"); } - out_printf(out,"}\n"); + out_printf(out, "}\n"); } } @@ -1137,15 +1152,15 @@ static void add_getset_arg(Class *c, gboolean is_set) { GList *li; - out_printf(out,"\nstatic void\n" - "___object_%s_arg (GtkObject *object,\n" - "\tGtkArg *arg,\n" - "\tguint arg_id)\n" - "{\n" - "\t%s *self;\n\n" - "\tself = %s (object);\n\n" - "\tswitch (arg_id) {\n", - is_set?"set":"get",typebase,macrobase); + out_printf(out, "\nstatic void\n" + "___object_%s_arg (GtkObject *object,\n" + "\tGtkArg *arg,\n" + "\tguint arg_id)\n" + "{\n" + "\t%s *self;\n\n" + "\tself = %s (object);\n\n" + "\tswitch (arg_id) {\n", + is_set?"set":"get", typebase, macrobase); for(li=c->nodes;li;li=g_list_next(li)) { Node *n = li->data; @@ -1189,11 +1204,11 @@ add_getset_arg(Class *c, gboolean is_set) "foo; })\n", cast, a->gtktype); } - out_printf(out,"#else /* __GNUC__ */\n"); + out_printf(out, "#else /* __GNUC__ */\n"); out_printf(out, "#define ARG " "((%s)GTK_VALUE_%s(*arg))\n", cast, a->gtktype); - out_printf(out,"#endif /* __GNUC__ */\n\n"); + out_printf(out, "#endif /* __GNUC__ */\n\n"); } out_printf(out, "\t\t{\n"); g_free(cast); @@ -1210,13 +1225,13 @@ add_getset_arg(Class *c, gboolean is_set) g_free(s); if(line_no > 0) out_addline_infile(out, line_no); - out_printf(out,"%s\n",cbuf); + out_printf(out, "%s\n", cbuf); if(line_no > 0) out_addline_outfile(out); - out_printf(out,"\t\t}\n\t\tbreak;\n" + out_printf(out, "\t\t}\n\t\tbreak;\n" "#undef ARG\n"); } - out_printf(out,"\tdefault:\n\t\tbreak;\n\t}\n}\n"); + out_printf(out, "\tdefault:\n\t\tbreak;\n\t}\n}\n"); } static void @@ -1233,7 +1248,7 @@ print_checks(Method *m, FuncArg *fa) char *s; /* point to the method prot in .gob for failed checks */ if(m->line_no > 0) - out_addline_infile(out,m->line_no); + out_addline_infile(out, m->line_no); if(is_void) out_printf(out, "\tg_return_if_fail ("); else @@ -1254,22 +1269,22 @@ print_checks(Method *m, FuncArg *fa) g_free(s); break; case LT_CHECK: - out_printf(out,"%s < %s",fa->name,ch->number); + out_printf(out, "%s < %s", fa->name, ch->number); break; case GT_CHECK: - out_printf(out,"%s > %s",fa->name,ch->number); + out_printf(out, "%s > %s", fa->name, ch->number); break; case LE_CHECK: - out_printf(out,"%s <= %s",fa->name,ch->number); + out_printf(out, "%s <= %s", fa->name, ch->number); break; case GE_CHECK: - out_printf(out,"%s >= %s",fa->name,ch->number); + out_printf(out, "%s >= %s", fa->name, ch->number); break; case EQ_CHECK: - out_printf(out,"%s == %s",fa->name,ch->number); + out_printf(out, "%s == %s", fa->name, ch->number); break; case NE_CHECK: - out_printf(out,"%s != %s",fa->name,ch->number); + out_printf(out, "%s != %s", fa->name, ch->number); break; } if(is_void) @@ -1291,7 +1306,7 @@ print_preconditions(Method *m) for(li=m->args;li;li=g_list_next(li)) { FuncArg *fa = li->data; if(fa->checks) - print_checks(m,fa); + print_checks(m, fa); } if(m->line_no>0) out_addline_outfile(out); @@ -1344,7 +1359,7 @@ put_in_gen_code(Method *m) if(m->method == OVERRIDE_METHOD && strcmp(m->id, "finalize")==0) { if(privates > 0 || destructors > 0) { - out_printf(out,"\t%s *___self = %s (%s);\n", + out_printf(out, "\t%s *___self = %s (%s);\n", typebase, macrobase, ((FuncArg *)m->args->data)->name); } @@ -1354,13 +1369,14 @@ put_in_gen_code(Method *m) li != NULL; li = li->next) { Node *n = li->data; - if(n->type == VARIABLE_NODE) - print_destructor("___self", - (Variable *)n); + Variable *v = (Variable *)n; + if(n->type == VARIABLE_NODE && + v->scope != CLASS_SCOPE) + print_destructor("___self", v); } } if(privates > 0) { - out_printf(out,"\tg_free (___self->_priv);\n" + out_printf(out, "\tg_free (___self->_priv);\n" "\t___self->_priv = NULL;\n", macrobase, ((FuncArg *)m->args->data)->name, @@ -1373,7 +1389,7 @@ put_in_gen_code(Method *m) static void print_method_body(Method *m, int pre) { - out_printf(out,"{\n"); + out_printf(out, "{\n"); if(pre) print_preconditions(m); @@ -1402,7 +1418,7 @@ put_signal_args(Method *m) { GList *li; GList *ali; - for(ali = m->gtktypes->next,li=m->args->next; + for(ali = m->gtktypes->next, li=m->args->next; li && ali; li=li->next, ali=ali->next) { FuncArg *fa = li->data; @@ -1411,7 +1427,7 @@ put_signal_args(Method *m) the we know all the types */ g_assert(cast); - out_printf(out,",\n\t\t(%s)%s",cast, + out_printf(out, ",\n\t\t(%s)%s", cast, fa->name); } } @@ -1436,11 +1452,11 @@ get_arg_names_for_macro(Method *m) static void put_method(Method *m) { - char *s,*args,*doc; + char *s, *args, *doc; gboolean is_void; - is_void = (strcmp(m->mtype->name,"void")==0 && + is_void = (strcmp(m->mtype->name, "void")==0 && m->mtype->stars == 0); - out_printf(out,"\n"); + out_printf(out, "\n"); doc = get_gtk_doc(m->id); if(doc) { out_printf(out, "%s", doc); @@ -1449,10 +1465,10 @@ put_method(Method *m) switch(m->method) { case REGULAR_METHOD: if(m->line_no>0) - out_addline_infile(out,m->line_no); + out_addline_infile(out, m->line_no); if(m->scope == PRIVATE_SCOPE) - print_method(out,"static ","\n",""," ","\n", - m,FALSE,FALSE); + print_method(out, "static ", "\n", "", " ", "\n", + m, FALSE, FALSE); else /* PUBLIC, PROTECTED */ print_method(out, "", "\n", "", " ", "\n", m, FALSE, FALSE); @@ -1461,25 +1477,25 @@ put_method(Method *m) case SIGNAL_FIRST_METHOD: case SIGNAL_LAST_METHOD: if(m->line_no>0) - out_addline_infile(out,m->line_no); + out_addline_infile(out, m->line_no); if(m->scope == PRIVATE_SCOPE) - print_method(out,"static ","\n",""," ","\n", - m,FALSE,FALSE); + print_method(out, "static ", "\n", "", " ", "\n", + m, FALSE, FALSE); else /* PUBLIC, PROTECTED */ - print_method(out,"","\n",""," ","\n",m,FALSE,FALSE); + print_method(out, "", "\n", "", " ", "\n", m, FALSE, FALSE); out_addline_outfile(out); - out_printf(out,"{\n"); + out_printf(out, "{\n"); s = g_strdup(m->id); g_strup(s); - if(strcmp(m->mtype->name,"void")==0 && + if(strcmp(m->mtype->name, "void")==0 && m->mtype->stars==0) { print_preconditions(m); if(((FuncArg *)m->args->data)->name) - out_printf(out,"\tgtk_signal_emit (GTK_OBJECT (%s),\n" + out_printf(out, "\tgtk_signal_emit (GTK_OBJECT (%s),\n" "\t\tobject_signals[%s_SIGNAL]", - ((FuncArg *)m->args->data)->name,s); + ((FuncArg *)m->args->data)->name, s); put_signal_args(m); - out_printf(out,");\n}\n"); + out_printf(out, ");\n}\n"); } else { out_printf(out, "\t"); print_type(out, m->mtype, TRUE); @@ -1492,54 +1508,54 @@ put_method(Method *m) else out_printf(out, ")(0);\n"); print_preconditions(m); - out_printf(out,"\tgtk_signal_emit (GTK_OBJECT (%s),\n" + out_printf(out, "\tgtk_signal_emit (GTK_OBJECT (%s),\n" "\t\tobject_signals[%s_SIGNAL]", - ((FuncArg *)m->args->data)->name,s); + ((FuncArg *)m->args->data)->name, s); put_signal_args(m); - out_printf(out,",\n\t\t&return_val);\n" + out_printf(out, ",\n\t\t&return_val);\n" "\treturn return_val;\n}\n"); } if(!m->cbuf) break; if(m->line_no>0) - out_addline_infile(out,m->line_no); - print_method(out,"static ","\n___real_",""," ","\n", - m,FALSE,FALSE); - print_method_body(m,FALSE); + out_addline_infile(out, m->line_no); + print_method(out, "static ", "\n___real_", "", " ", "\n", + m, FALSE, FALSE); + print_method_body(m, FALSE); break; case VIRTUAL_METHOD: if(m->line_no>0) - out_addline_infile(out,m->line_no); + out_addline_infile(out, m->line_no); if(m->scope==PRIVATE_SCOPE) - print_method(out,"static ","\n",""," ","\n", - m,FALSE,FALSE); + print_method(out, "static ", "\n", "", " ", "\n", + m, FALSE, FALSE); else /* PUBLIC, PROTECTED */ - print_method(out,"","\n",""," ","\n",m,FALSE,FALSE); + print_method(out, "", "\n", "", " ", "\n", m, FALSE, FALSE); out_addline_outfile(out); - out_printf(out,"{\n" - "\t%sClass *klass;\n",typebase); + 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_CLASS(GTK_OBJECT(%s)->klass);\n\n" "\tif(klass->%s)\n", macrobase, ((FuncArg *)m->args->data)->name, m->id); - if(strcmp(m->mtype->name,"void")==0 && + if(strcmp(m->mtype->name, "void")==0 && m->mtype->stars==0) { GList *li; - out_printf(out,"\t\t(*klass->%s)(%s",m->id, + out_printf(out, "\t\t(*klass->%s)(%s", m->id, ((FuncArg *)m->args->data)->name); for(li=m->args->next;li;li=g_list_next(li)) { FuncArg *fa = li->data; - out_printf(out,",%s",fa->name); + out_printf(out, ",%s", fa->name); } - out_printf(out,");\n}\n"); + out_printf(out, ");\n}\n"); } else { GList *li; - out_printf(out, "\t\treturn (*klass->%s)(%s",m->id, + out_printf(out, "\t\treturn (*klass->%s)(%s", m->id, ((FuncArg *)m->args->data)->name); for(li=m->args->next;li;li=g_list_next(li)) { FuncArg *fa = li->data; - out_printf(out,",%s",fa->name); + out_printf(out, ",%s", fa->name); } out_printf(out, ");\n" "\telse\n" @@ -1556,41 +1572,41 @@ put_method(Method *m) if(!m->cbuf) break; if(m->line_no>0) - out_addline_infile(out,m->line_no); - print_method(out,"static ","\n___real_",""," ","\n", - m,FALSE,FALSE); - print_method_body(m,FALSE); + out_addline_infile(out, m->line_no); + print_method(out, "static ", "\n___real_", "", " ", "\n", + m, FALSE, FALSE); + print_method_body(m, FALSE); break; case OVERRIDE_METHOD: if(!m->cbuf) break; if(m->line_no>0) - out_addline_infile(out,m->line_no); - print_method(out,"static ","\n",""," ","\n", - m,FALSE,FALSE); - s = replace_sep(m->otype,'_'); + out_addline_infile(out, m->line_no); + print_method(out, "static ", "\n", "", " ", "\n", + m, FALSE, FALSE); + s = replace_sep(m->otype, '_'); g_strup(s); args = get_arg_names_for_macro(m); if(is_void) { - out_printf(out,"#define PARENT_HANDLER(%s) \\\n" + out_printf(out, "#define PARENT_HANDLER(%s) \\\n" "\t{ if(%s_CLASS(parent_class)->%s) \\\n" "\t\t(* %s_CLASS(parent_class)->%s)(%s); }\n", - args,s,m->id,s,m->id,args); + args, s, m->id, s, m->id, args); } else { - out_printf(out,"#define PARENT_HANDLER(%s) \\\n" + out_printf(out, "#define PARENT_HANDLER(%s) \\\n" "\t((%s_CLASS(parent_class)->%s)? \\\n" "\t\t(* %s_CLASS(parent_class)->%s)(%s): \\\n" "\t\t(", - args,s,m->id,s,m->id,args); - out_printf(out,"("); - print_type(out,m->mtype,TRUE); - out_printf(out,")%s))\n", + args, s, m->id, s, m->id, args); + out_printf(out, "("); + print_type(out, m->mtype, TRUE); + out_printf(out, ")%s))\n", m->onerror?m->onerror:"0"); } g_free(args); g_free(s); - print_method_body(m,TRUE); - out_printf(out,"#undef PARENT_HANDLER\n"); + print_method_body(m, TRUE); + out_printf(out, "#undef PARENT_HANDLER\n"); break; default: break; @@ -1600,19 +1616,20 @@ put_method(Method *m) static void open_files(void) { - char *outfile,*outfileh,*outfileph; + char *outfile, *outfileh, *outfileph; if(!for_cpp) - outfile = g_strconcat(filebase,".c",NULL); + outfile = g_strconcat(filebase, ".c", NULL); else - outfile = g_strconcat(filebase,".cc",NULL); + outfile = g_strconcat(filebase, ".cc", NULL); if(no_touch_headers) - outfileh = g_strconcat("#gob#",filebase,".h#gob#",NULL); + outfileh = g_strconcat("#gob#", filebase, ".h#gob#", NULL); else outfileh = g_strconcat(filebase, ".h", NULL); - if((privates > 0 || protecteds > 0 || always_private_header) && - !no_private_header) + if((privates > 0 || protecteds > 0 || + private_header == PRIVATE_HEADER_ALWAYS) && + !private_header != PRIVATE_HEADER_NEVER) outfileph = g_strconcat(filebase, "-private.h", NULL); else outfileph = NULL; @@ -1709,7 +1726,7 @@ put_argument_gnu_wrappers(Class *c) s = g_strdup(a->name); g_strup(s); if(a->atype) - cast = get_type(a->atype,TRUE); + cast = get_type(a->atype, TRUE); else cast = g_strdup(get_cast(a->gtktype, TRUE)); if(cast) { @@ -1767,7 +1784,7 @@ print_ccode_block(CCode *cc) default: case C_CCODE: fp = out; - out_printf(fp,"\n"); + out_printf(fp, "\n"); out_addline_infile(fp, cc->line_no); break; case PH_CCODE: @@ -1815,18 +1832,18 @@ print_class_block(Class *c) out_printf(outh, "\n/*\n" " * Type checking and casting macros\n" " */\n"); - out_printf(outh,"#define %s\t" + out_printf(outh, "#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" + 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" "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", - macrois,funcbase); + macrobase, funcbase, typebase); + out_printf(outh, "#define %s(obj)\t" + "GTK_CHECK_TYPE((obj),%s_get_type ())\n\n", + macrois, funcbase); out_printf(out, "/* self casting macros */\n"); out_printf(out, "#define SELF(x) %s(x)\n", macrobase); @@ -1835,22 +1852,22 @@ print_class_block(Class *c) if(privates>0) { out_printf(outh, "\n/* Private structure type */\n"); - out_printf(outh,"typedef struct _%sPrivate %sPrivate;\n", - typebase,typebase); + out_printf(outh, "typedef struct _%sPrivate %sPrivate;\n", + typebase, typebase); } out_printf(outh, "\n/*\n" " * Main object structure\n" " */\n"); - s = replace_sep(c->otype,'_'); + s = replace_sep(c->otype, '_'); g_strup(s); - out_printf(outh,"#ifndef __TYPEDEF_%s__\n" - "#define __TYPEDEF_%s__\n",s,s); + out_printf(outh, "#ifndef __TYPEDEF_%s__\n" + "#define __TYPEDEF_%s__\n", s, s); g_free(s); - out_printf(outh,"typedef struct _%s %s;\n" - "#endif\n",typebase,typebase); - out_printf(outh,"struct _%s {\n\t%s __parent__;\n", - typebase,ptypebase); + out_printf(outh, "typedef struct _%s %s;\n" + "#endif\n", typebase, typebase); + out_printf(outh, "struct _%s {\n\t%s __parent__;\n", + typebase, ptypebase); for(l=c->nodes;l;l=g_list_next(l)) { static gboolean printed_public = FALSE; Node *n = l->data; @@ -1858,10 +1875,10 @@ print_class_block(Class *c) if(n->type == VARIABLE_NODE && v->scope == PUBLIC_SCOPE) { if(!printed_public) { - out_printf(outh,"\t/*< public >*/\n"); + out_printf(outh, "\t/*< public >*/\n"); printed_public = TRUE; } - put_variable((Variable *)n,outh); + put_variable((Variable *)n, outh); } } /* put protecteds always AFTER publics */ @@ -1871,18 +1888,18 @@ print_class_block(Class *c) if(n->type == VARIABLE_NODE && v->scope == PROTECTED_SCOPE) { if(!printed_private) { - out_printf(outh,"\t/*< private >*/\n"); + out_printf(outh, "\t/*< private >*/\n"); printed_private = TRUE; } - put_variable((Variable *)n,outh); + put_variable((Variable *)n, outh); } } if(privates>0) { if(!printed_private) - out_printf(outh,"\t/*< private >*/\n"); - out_printf(outh,"\t%sPrivate *_priv;\n",typebase); + out_printf(outh, "\t/*< private >*/\n"); + out_printf(outh, "\t%sPrivate *_priv;\n", typebase); } - out_printf(outh,"};\n"); + out_printf(outh, "};\n"); if(privates>0) { FILE *outfp; @@ -1895,39 +1912,47 @@ print_class_block(Class *c) else outfp = out; - out_printf(outfp,"struct _%sPrivate {\n", + out_printf(outfp, "struct _%sPrivate {\n", typebase); for(l=c->nodes;l;l=l->next) { Node *n = l->data; Variable *v = (Variable *)n; if(n->type == VARIABLE_NODE && v->scope == PRIVATE_SCOPE) { - out_addline_infile(outfp,v->line_no); - put_variable(v,outfp); + out_addline_infile(outfp, v->line_no); + put_variable(v, outfp); } } out_addline_outfile(outfp); - out_printf(outfp,"};\n"); + out_printf(outfp, "};\n"); } out_printf(outh, "\n/*\n" " * Class definition\n" " */\n"); - out_printf(outh,"typedef struct _%sClass %sClass;\n", - typebase,typebase); + out_printf(outh, "typedef struct _%sClass %sClass;\n", + typebase, typebase); out_printf(outh, "struct _%sClass {\n\t%sClass __parent__;\n", - typebase,ptypebase); + typebase, ptypebase); for(l=c->nodes;l;l=g_list_next(l)) { Node *n = l->data; if(n->type == METHOD_NODE) put_vs_method((Method *)n); } - out_printf(outh,"};\n\n"); + /* put class scope variables */ + for(l=c->nodes;l;l=g_list_next(l)) { + Node *n = l->data; + Variable *v = (Variable *)n; + if(n->type == VARIABLE_NODE && + v->scope == CLASS_SCOPE) + put_variable((Variable *)n, outh); + } + out_printf(outh, "};\n\n"); - out_printf(out,"/* here are local prototypes */\n"); + out_printf(out, "/* here are local prototypes */\n"); if(arguments>0) { - out_printf(out,"static void ___object_set_arg " + out_printf(out, "static void ___object_set_arg " "(GtkObject *object, GtkArg *arg, " "guint arg_id);\n" "static void ___object_get_arg " @@ -1939,7 +1964,7 @@ print_class_block(Class *c) " * Public methods\n" " */\n"); - out_printf(outh,"guint\t%s_get_type\t(void);\n",funcbase); + out_printf(outh, "guint\t%s_get_type\t(void);\n", funcbase); for(l=c->nodes;l;l=g_list_next(l)) { Node *n = l->data; if(n->type == METHOD_NODE) { @@ -1972,11 +1997,11 @@ print_class_block(Class *c) out_printf(outh, "\n/*\n" " * Argument wrapping macros\n" " */\n"); - out_printf(outh,"#ifdef __GNUC__\n"); + out_printf(outh, "#ifdef __GNUC__\n"); put_argument_gnu_wrappers(c); - out_printf(outh,"#else /* __GNUC__ */\n"); + out_printf(outh, "#else /* __GNUC__ */\n"); put_argument_nongnu_wrappers(c); - out_printf(outh,"#endif /* __GNUC__ */\n\n"); + out_printf(outh, "#endif /* __GNUC__ */\n\n"); } else if(arguments>0 && no_gnu) { out_printf(outh, "\n/*\n" " * Argument wrapping macros\n" @@ -2000,15 +2025,15 @@ print_class_block(Class *c) if(no_gnu) make_method_nongnu_aliases(c); else { - out_printf(out,"\n#ifdef __GNUC__\n"); + out_printf(out, "\n#ifdef __GNUC__\n"); make_method_gnu_aliases(c); - out_printf(out,"#else /* __GNUC__ */\n"); + out_printf(out, "#else /* __GNUC__ */\n"); make_method_nongnu_aliases(c); - out_printf(out,"#endif /* __GNUC__ */\n\n"); + out_printf(out, "#endif /* __GNUC__ */\n\n"); } } - out_printf(out,"/* a macro for creating a new object of our type */\n"); + out_printf(out, "/* a macro for creating a new object of our type */\n"); out_printf(out, "#define GET_NEW ((%s *)gtk_type_new(%s_get_type()))\n\n", typebase, funcbase); @@ -2073,7 +2098,7 @@ print_includes(void) if(outph) { p = g_strconcat(filebase, "-private.h", NULL); if(!g_list_find_custom(include_files, p, (GCompareFunc)strcmp)) { - out_printf(out,"#include \"%s-private.h\"\n\n", + out_printf(out, "#include \"%s-private.h\"\n\n", filebase); if(found_header) print_error(TRUE, @@ -2154,7 +2179,7 @@ print_header_top(void) GList *li; /* mandatory include */ - out_printf(outh,"#include \n\n"); + out_printf(outh, "#include \n\n"); /* print the HT_CCODE blocks */ for(li=nodes;li;li=g_list_next(li)) { @@ -2202,8 +2227,8 @@ generate_outfiles(void) static void print_help(void) { - fprintf(stderr,"Gob version %s\n\n",VERSION); - fprintf(stderr,"Options:\n" + fprintf(stderr, "Gob version %s\n\n", VERSION); + fprintf(stderr, "Options:\n" "\t--help,-h,-? Display this help\n" "\t--version Display version\n" "\t--exit-on-warn,-w Exit with an error on warnings\n" @@ -2216,7 +2241,10 @@ print_help(void) "really changed\n" "\t--always-private-header Always create a private header " "file,\n" - "\t even if it would be empty\n" + "\t even if it would be empty " + "[default]\n" + "\t--ondemand-private-header Create private header only when " + "needed\n" "\t--no-private-header Don't create a private header, " "put private\n" "\t structure and protected " @@ -2245,10 +2273,10 @@ parse_options(int argc, char *argv[]) } filename = argv[i]; got_file = TRUE; - } else if(strcmp(argv[i],"--help")==0) { + } else if(strcmp(argv[i], "--help")==0) { print_help(); exit(0); - } else if(strcmp(argv[i],"--version")==0) { + } else if(strcmp(argv[i], "--version")==0) { fprintf(stderr, "Gob version %s\n", VERSION); exit(0); } else if(strcmp(argv[i], "--exit-on-warn")==0) { @@ -2259,12 +2287,12 @@ parse_options(int argc, char *argv[]) for_cpp = TRUE; } else if(strcmp(argv[i], "--no-touch-headers")==0) { no_touch_headers = TRUE; + } else if(strcmp(argv[i], "--ondemand-private-header")==0) { + private_header == PRIVATE_HEADER_ONDEMAND; } else if(strcmp(argv[i], "--always-private-header")==0) { - no_private_header = FALSE; - always_private_header = TRUE; + private_header == PRIVATE_HEADER_ALWAYS; } else if(strcmp(argv[i], "--no-private-header")==0) { - always_private_header = FALSE; - no_private_header = TRUE; + private_header == PRIVATE_HEADER_NEVER; } else if(strcmp(argv[i], "--no-gnu")==0) { no_gnu = TRUE; } else if(strcmp(argv[i], "--no-extern-c")==0) { @@ -2276,7 +2304,7 @@ parse_options(int argc, char *argv[]) } else if(strcmp(argv[i], "--")==0) { /*further arguments are files*/ no_opts = TRUE; - } else if(strncmp(argv[i], "--",2)==0) { + } else if(strncmp(argv[i], "--", 2)==0) { /*unknown long option*/ fprintf(stderr, "Unknown option '%s'!\n", argv[i]); print_help(); @@ -2315,7 +2343,7 @@ compare_and_move_header(void) char *hfnew = g_strconcat("#gob#", filebase, ".h#gob#", NULL); char *hf = g_strconcat(filebase, ".h", NULL); struct stat s; - if(stat(hf,&s)==0) { + if(stat(hf, &s)==0) { char *s; s = g_strdup_printf("cmp '%s' '%s' > /dev/null", hf, hfnew); if(system(s)==0) { @@ -2331,7 +2359,7 @@ compare_and_move_header(void) if(unlink(hf)!=0) print_error(FALSE, "Can't remove old header file", 0); } - if(rename(hfnew,hf)!=0) + if(rename(hfnew, hf)!=0) print_error(FALSE, "Can't rename new header file", 0); g_free(hfnew); g_free(hf); diff --git a/src/main.h b/src/main.h index 05d20b3..764e678 100644 --- a/src/main.h +++ b/src/main.h @@ -1,14 +1,19 @@ #ifndef _MAIN_H_ #define _MAIN_H_ +enum { + PRIVATE_HEADER_ALWAYS, + PRIVATE_HEADER_ONDEMAND, + PRIVATE_HEADER_NEVER +}; + extern gboolean no_touch_headers; extern gboolean for_cpp; extern gboolean no_gnu; extern gboolean exit_on_warn; extern gboolean exit_on_error; extern gboolean got_error; -extern gboolean always_private_header; -extern gboolean no_private_header; +extern gint private_header; extern gboolean no_extern_c; extern gboolean no_write; extern gboolean no_lines; diff --git a/src/parse.c b/src/parse.c index 7b6e9eb..9b63335 100644 --- a/src/parse.c +++ b/src/parse.c @@ -33,10 +33,11 @@ #define PUBLIC 283 #define PRIVATE 284 #define PROTECTED 285 -#define ARGUMENT 286 -#define VIRTUAL 287 -#define SIGNAL 288 -#define OVERRIDE 289 +#define CLASSWIDE 286 +#define ARGUMENT 287 +#define VIRTUAL 288 +#define SIGNAL 289 +#define OVERRIDE 290 #line 21 "parse.y" @@ -144,6 +145,8 @@ push_function(int scope, int method, char *oid, char *id, Node *node; Type *type; char *c_cbuf; + + g_assert(scope != CLASS_SCOPE); if(method!=INIT_METHOD && method!=CLASS_INIT_METHOD) { type = pop_type(); @@ -305,7 +308,7 @@ set_return_value(char *type, char *val) } -#line 288 "parse.y" +#line 290 "parse.y" typedef union { char *id; GString *cbuf; @@ -327,26 +330,26 @@ typedef union { -#define YYFINAL 242 +#define YYFINAL 243 #define YYFLAG -32768 -#define YYNTBASE 49 +#define YYNTBASE 50 -#define YYTRANSLATE(x) ((unsigned)(x) <= 289 ? yytranslate[x] : 86) +#define YYTRANSLATE(x) ((unsigned)(x) <= 290 ? yytranslate[x] : 87) static const char yytranslate[] = { 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 47, 2, 2, 2, 2, 2, 2, 40, - 41, 43, 2, 44, 48, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 38, 46, - 39, 45, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 48, 2, 2, 2, 2, 2, 2, 41, + 42, 44, 2, 45, 49, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 39, 47, + 40, 46, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 36, 42, 37, 2, 2, 2, 2, 2, + 2, 2, 37, 43, 38, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, @@ -362,86 +365,86 @@ static const char yytranslate[] = { 0, 2, 2, 2, 2, 2, 1, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, - 27, 28, 29, 30, 31, 32, 33, 34, 35 + 27, 28, 29, 30, 31, 32, 33, 34, 35, 36 }; #if YYDEBUG != 0 static const short yyprhs[] = { 0, 0, 4, 7, 10, 12, 14, 16, 18, 20, 22, 24, 27, 29, 34, 38, 43, 46, 48, 50, 52, - 54, 56, 58, 60, 62, 65, 69, 72, 76, 79, - 82, 84, 86, 87, 93, 100, 112, 121, 127, 133, - 135, 139, 140, 144, 146, 148, 151, 153, 156, 159, - 162, 164, 167, 170, 172, 174, 176, 178, 181, 183, - 185, 188, 190, 193, 195, 197, 199, 201, 203, 206, - 208, 211, 213, 217, 221, 224, 226, 231, 235, 237, - 240, 242, 253, 265, 275, 285, 294, 306, 315, 321, - 324, 329, 330, 332, 335, 337, 339, 343, 345, 349, - 351, 355, 357, 360, 364, 371, 379, 382, 384, 386, - 389, 392, 396, 400, 404, 408, 410, 413 + 54, 56, 58, 60, 62, 64, 67, 71, 74, 78, + 81, 84, 86, 88, 89, 95, 102, 114, 123, 129, + 135, 137, 141, 142, 146, 148, 150, 153, 155, 158, + 161, 164, 166, 169, 172, 174, 176, 178, 180, 183, + 185, 187, 190, 192, 195, 197, 199, 201, 203, 205, + 208, 210, 213, 215, 219, 223, 226, 228, 233, 237, + 239, 242, 244, 255, 267, 277, 287, 296, 308, 317, + 323, 326, 331, 332, 334, 337, 339, 341, 345, 347, + 351, 353, 357, 359, 362, 366, 373, 381, 384, 386, + 388, 391, 394, 398, 402, 406, 410, 412, 415 }; -static const short yyrhs[] = { 51, - 52, 51, 0, 52, 51, 0, 51, 52, 0, 52, +static const short yyrhs[] = { 52, + 53, 52, 0, 53, 52, 0, 52, 53, 0, 53, 0, 23, 0, 26, 0, 24, 0, 25, 0, 27, - 0, 28, 0, 51, 50, 0, 50, 0, 53, 36, - 54, 37, 0, 53, 36, 37, 0, 3, 21, 4, - 21, 0, 54, 55, 0, 55, 0, 76, 0, 60, - 0, 61, 0, 38, 0, 29, 0, 30, 0, 31, - 0, 19, 19, 0, 19, 36, 23, 0, 39, 85, - 0, 39, 36, 23, 0, 57, 58, 0, 58, 57, - 0, 58, 0, 57, 0, 0, 56, 65, 19, 59, - 38, 0, 56, 65, 19, 22, 59, 38, 0, 32, - 63, 62, 19, 19, 36, 23, 19, 36, 23, 38, - 0, 32, 63, 62, 19, 19, 36, 23, 38, 0, - 32, 63, 62, 19, 19, 0, 19, 40, 19, 65, - 41, 0, 19, 0, 40, 64, 41, 0, 0, 19, - 42, 64, 0, 19, 0, 66, 0, 5, 66, 0, - 67, 0, 67, 70, 0, 12, 68, 0, 11, 68, - 0, 68, 0, 12, 18, 0, 11, 18, 0, 18, - 0, 17, 0, 16, 0, 19, 0, 69, 19, 0, - 21, 0, 6, 0, 13, 15, 0, 13, 0, 14, - 15, 0, 14, 0, 15, 0, 9, 0, 8, 0, - 7, 0, 43, 70, 0, 43, 0, 19, 73, 0, - 73, 0, 56, 19, 73, 0, 19, 56, 73, 0, - 56, 73, 0, 71, 0, 19, 40, 74, 41, 0, - 74, 44, 19, 0, 19, 0, 36, 23, 0, 38, - 0, 34, 63, 72, 65, 19, 40, 79, 41, 77, - 75, 0, 56, 34, 63, 71, 65, 19, 40, 79, - 41, 77, 75, 0, 33, 56, 65, 19, 40, 79, - 41, 77, 75, 0, 56, 33, 65, 19, 40, 79, - 41, 77, 75, 0, 33, 65, 19, 40, 79, 41, - 77, 75, 0, 35, 40, 21, 41, 65, 19, 40, - 79, 41, 77, 75, 0, 56, 65, 19, 40, 79, - 41, 77, 75, 0, 19, 40, 19, 41, 75, 0, - 19, 78, 0, 19, 78, 19, 78, 0, 0, 85, - 0, 36, 23, 0, 6, 0, 19, 0, 19, 44, - 80, 0, 80, 0, 81, 44, 10, 0, 81, 0, - 81, 44, 82, 0, 82, 0, 65, 19, 0, 65, - 19, 22, 0, 65, 19, 40, 19, 83, 41, 0, - 65, 19, 22, 40, 19, 83, 41, 0, 83, 84, - 0, 84, 0, 19, 0, 45, 85, 0, 46, 85, - 0, 45, 39, 85, 0, 46, 39, 85, 0, 39, - 39, 85, 0, 47, 39, 85, 0, 20, 0, 48, - 20, 0, 19, 0 + 0, 28, 0, 52, 51, 0, 51, 0, 54, 37, + 55, 38, 0, 54, 37, 38, 0, 3, 21, 4, + 21, 0, 55, 56, 0, 56, 0, 77, 0, 61, + 0, 62, 0, 39, 0, 29, 0, 30, 0, 31, + 0, 32, 0, 19, 19, 0, 19, 37, 23, 0, + 40, 86, 0, 40, 37, 23, 0, 58, 59, 0, + 59, 58, 0, 59, 0, 58, 0, 0, 57, 66, + 19, 60, 39, 0, 57, 66, 19, 22, 60, 39, + 0, 33, 64, 63, 19, 19, 37, 23, 19, 37, + 23, 39, 0, 33, 64, 63, 19, 19, 37, 23, + 39, 0, 33, 64, 63, 19, 19, 0, 19, 41, + 19, 66, 42, 0, 19, 0, 41, 65, 42, 0, + 0, 19, 43, 65, 0, 19, 0, 67, 0, 5, + 67, 0, 68, 0, 68, 71, 0, 12, 69, 0, + 11, 69, 0, 69, 0, 12, 18, 0, 11, 18, + 0, 18, 0, 17, 0, 16, 0, 19, 0, 70, + 19, 0, 21, 0, 6, 0, 13, 15, 0, 13, + 0, 14, 15, 0, 14, 0, 15, 0, 9, 0, + 8, 0, 7, 0, 44, 71, 0, 44, 0, 19, + 74, 0, 74, 0, 57, 19, 74, 0, 19, 57, + 74, 0, 57, 74, 0, 72, 0, 19, 41, 75, + 42, 0, 75, 45, 19, 0, 19, 0, 37, 23, + 0, 39, 0, 35, 64, 73, 66, 19, 41, 80, + 42, 78, 76, 0, 57, 35, 64, 72, 66, 19, + 41, 80, 42, 78, 76, 0, 34, 57, 66, 19, + 41, 80, 42, 78, 76, 0, 57, 34, 66, 19, + 41, 80, 42, 78, 76, 0, 34, 66, 19, 41, + 80, 42, 78, 76, 0, 36, 41, 21, 42, 66, + 19, 41, 80, 42, 78, 76, 0, 57, 66, 19, + 41, 80, 42, 78, 76, 0, 19, 41, 19, 42, + 76, 0, 19, 79, 0, 19, 79, 19, 79, 0, + 0, 86, 0, 37, 23, 0, 6, 0, 19, 0, + 19, 45, 81, 0, 81, 0, 82, 45, 10, 0, + 82, 0, 82, 45, 83, 0, 83, 0, 66, 19, + 0, 66, 19, 22, 0, 66, 19, 41, 19, 84, + 42, 0, 66, 19, 22, 41, 19, 84, 42, 0, + 84, 85, 0, 85, 0, 19, 0, 46, 86, 0, + 47, 86, 0, 46, 40, 86, 0, 47, 40, 86, + 0, 40, 40, 86, 0, 48, 40, 86, 0, 20, + 0, 49, 20, 0, 19, 0 }; #endif #if YYDEBUG != 0 static const short yyrline[] = { 0, - 306, 307, 308, 309, 312, 318, 324, 330, 336, 342, - 350, 351, 354, 359, 366, 371, 372, 375, 376, 377, - 378, 381, 382, 383, 386, 399, 415, 419, 427, 428, - 429, 430, 431, 437, 440, 444, 479, 507, 572, 581, - 587, 588, 591, 594, 600, 601, 609, 613, 620, 623, - 626, 629, 632, 635, 638, 641, 644, 647, 651, 654, - 659, 662, 665, 668, 671, 676, 679, 682, 687, 688, - 692, 704, 710, 722, 734, 737, 743, 748, 751, 756, - 757, 761, 772, 783, 794, 805, 816, 822, 827, 848, - 859, 878, 884, 885, 891, 892, 903, 913, 916, 917, - 920, 921, 924, 927, 930, 938, 948, 949, 952, 965, - 969, 973, 977, 981, 985, 991, 992, 996 + 308, 309, 310, 311, 314, 320, 326, 332, 338, 344, + 352, 353, 356, 361, 368, 373, 374, 377, 378, 379, + 380, 383, 384, 385, 386, 389, 402, 418, 422, 430, + 431, 432, 433, 434, 440, 443, 447, 482, 510, 580, + 589, 595, 596, 599, 602, 608, 609, 617, 621, 628, + 631, 634, 637, 640, 643, 646, 649, 652, 655, 659, + 662, 667, 670, 673, 676, 679, 684, 687, 690, 695, + 696, 700, 712, 718, 730, 742, 745, 751, 756, 759, + 764, 765, 769, 785, 801, 817, 833, 844, 850, 860, + 881, 892, 911, 917, 918, 924, 925, 936, 946, 949, + 950, 953, 954, 957, 960, 963, 971, 981, 982, 985, + 998, 1002, 1006, 1010, 1014, 1018, 1024, 1025, 1029 }; #endif @@ -452,194 +455,194 @@ static const char * const yytname[] = { "$","error","$undefined.","CLASS", "FROM","CONST","VOID","STRUCT","UNION","ENUM","THREEDOTS","SIGNED","UNSIGNED", "LONG","SHORT","INT","FLOAT","DOUBLE","CHAR","TOKEN","NUMBER","TYPETOKEN","ARRAY_DIM", "CCODE","HTCODE","PHCODE","HCODE","ACODE","ATCODE","PUBLIC","PRIVATE","PROTECTED", -"ARGUMENT","VIRTUAL","SIGNAL","OVERRIDE","'{'","'}'","';'","'='","'('","')'", -"'|'","'*'","','","'>'","'<'","'!'","'-'","prog","ccode","ccodes","class","classdec", -"classcode","thing","scope","destructor","initializer","varoptions","variable", -"argument","argtype","flags","flaglist","type","type1","type2","integer","tspecifier", -"stars","simplesigtype","fullsigtype","sigtype","tokenlist","codenocode","method", -"returnvals","retcode","funcargs","arglist","arglist1","arg","checklist","check", -"numtok", NULL +"CLASSWIDE","ARGUMENT","VIRTUAL","SIGNAL","OVERRIDE","'{'","'}'","';'","'='", +"'('","')'","'|'","'*'","','","'>'","'<'","'!'","'-'","prog","ccode","ccodes", +"class","classdec","classcode","thing","scope","destructor","initializer","varoptions", +"variable","argument","argtype","flags","flaglist","type","type1","type2","integer", +"tspecifier","stars","simplesigtype","fullsigtype","sigtype","tokenlist","codenocode", +"method","returnvals","retcode","funcargs","arglist","arglist1","arg","checklist", +"check","numtok", NULL }; #endif static const short yyr1[] = { 0, - 49, 49, 49, 49, 50, 50, 50, 50, 50, 50, - 51, 51, 52, 52, 53, 54, 54, 55, 55, 55, - 55, 56, 56, 56, 57, 57, 58, 58, 59, 59, - 59, 59, 59, 60, 60, 61, 61, 61, 62, 62, - 63, 63, 64, 64, 65, 65, 66, 66, 67, 67, - 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, - 68, 68, 68, 68, 68, 69, 69, 69, 70, 70, - 71, 71, 72, 72, 72, 72, 73, 74, 74, 75, - 75, 76, 76, 76, 76, 76, 76, 76, 76, 77, - 77, 77, 78, 78, 79, 79, 79, 79, 80, 80, - 81, 81, 82, 82, 82, 82, 83, 83, 84, 84, - 84, 84, 84, 84, 84, 85, 85, 85 + 50, 50, 50, 50, 51, 51, 51, 51, 51, 51, + 52, 52, 53, 53, 54, 55, 55, 56, 56, 56, + 56, 57, 57, 57, 57, 58, 58, 59, 59, 60, + 60, 60, 60, 60, 61, 61, 62, 62, 62, 63, + 63, 64, 64, 65, 65, 66, 66, 67, 67, 68, + 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, + 68, 69, 69, 69, 69, 69, 70, 70, 70, 71, + 71, 72, 72, 73, 73, 73, 73, 74, 75, 75, + 76, 76, 77, 77, 77, 77, 77, 77, 77, 77, + 78, 78, 78, 79, 79, 80, 80, 80, 80, 81, + 81, 82, 82, 83, 83, 83, 83, 84, 84, 85, + 85, 85, 85, 85, 85, 85, 86, 86, 86 }; static const short yyr2[] = { 0, 3, 2, 2, 1, 1, 1, 1, 1, 1, 1, 2, 1, 4, 3, 4, 2, 1, 1, 1, 1, - 1, 1, 1, 1, 2, 3, 2, 3, 2, 2, - 1, 1, 0, 5, 6, 11, 8, 5, 5, 1, - 3, 0, 3, 1, 1, 2, 1, 2, 2, 2, - 1, 2, 2, 1, 1, 1, 1, 2, 1, 1, - 2, 1, 2, 1, 1, 1, 1, 1, 2, 1, - 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 + 1, 1, 1, 1, 1, 2, 3, 2, 3, 2, + 2, 1, 1, 0, 5, 6, 11, 8, 5, 5, + 1, 3, 0, 3, 1, 1, 2, 1, 2, 2, + 2, 1, 2, 2, 1, 1, 1, 1, 2, 1, + 1, 2, 1, 2, 1, 1, 1, 1, 1, 2, + 1, 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 }; static const short yydefact[] = { 0, 0, 5, 7, 8, 6, 9, 10, 12, 0, 4, 0, 0, 11, 3, 2, 0, 0, 1, 0, 22, - 23, 24, 42, 0, 42, 0, 14, 21, 0, 17, - 0, 19, 20, 18, 15, 0, 0, 0, 0, 60, - 68, 67, 66, 0, 0, 62, 64, 65, 56, 55, - 54, 57, 59, 0, 0, 45, 47, 51, 0, 0, - 0, 13, 16, 0, 42, 0, 0, 44, 0, 40, - 0, 46, 53, 50, 52, 49, 61, 63, 0, 0, - 70, 48, 58, 0, 0, 76, 0, 72, 0, 0, - 0, 33, 0, 0, 41, 0, 0, 0, 0, 69, - 0, 0, 0, 71, 0, 75, 0, 0, 0, 0, - 0, 0, 33, 0, 0, 32, 31, 0, 0, 81, - 89, 43, 0, 38, 0, 60, 57, 0, 0, 98, - 100, 102, 79, 0, 74, 73, 0, 0, 0, 0, - 25, 0, 0, 118, 116, 0, 0, 27, 0, 29, - 30, 34, 80, 0, 0, 0, 0, 103, 92, 0, - 77, 0, 0, 0, 0, 0, 26, 35, 28, 117, - 92, 39, 0, 92, 97, 104, 0, 0, 0, 99, - 101, 78, 0, 0, 92, 0, 0, 0, 37, 0, - 0, 0, 0, 90, 93, 86, 92, 0, 0, 0, - 88, 0, 84, 0, 109, 0, 0, 0, 0, 0, - 108, 94, 0, 0, 92, 85, 92, 0, 0, 0, - 0, 110, 0, 111, 0, 105, 107, 91, 82, 0, - 0, 36, 106, 114, 112, 113, 115, 87, 83, 0, - 0, 0 + 23, 24, 25, 43, 0, 43, 0, 14, 21, 0, + 17, 0, 19, 20, 18, 15, 0, 0, 0, 0, + 61, 69, 68, 67, 0, 0, 63, 65, 66, 57, + 56, 55, 58, 60, 0, 0, 46, 48, 52, 0, + 0, 0, 13, 16, 0, 43, 0, 0, 45, 0, + 41, 0, 47, 54, 51, 53, 50, 62, 64, 0, + 0, 71, 49, 59, 0, 0, 77, 0, 73, 0, + 0, 0, 34, 0, 0, 42, 0, 0, 0, 0, + 70, 0, 0, 0, 72, 0, 76, 0, 0, 0, + 0, 0, 0, 34, 0, 0, 33, 32, 0, 0, + 82, 90, 44, 0, 39, 0, 61, 58, 0, 0, + 99, 101, 103, 80, 0, 75, 74, 0, 0, 0, + 0, 26, 0, 0, 119, 117, 0, 0, 28, 0, + 30, 31, 35, 81, 0, 0, 0, 0, 104, 93, + 0, 78, 0, 0, 0, 0, 0, 27, 36, 29, + 118, 93, 40, 0, 93, 98, 105, 0, 0, 0, + 100, 102, 79, 0, 0, 93, 0, 0, 0, 38, + 0, 0, 0, 0, 91, 94, 87, 93, 0, 0, + 0, 89, 0, 85, 0, 110, 0, 0, 0, 0, + 0, 109, 95, 0, 0, 93, 86, 93, 0, 0, + 0, 0, 111, 0, 112, 0, 106, 108, 92, 83, + 0, 0, 37, 107, 115, 113, 114, 116, 88, 84, + 0, 0, 0 }; -static const short yydefgoto[] = { 240, - 8, 9, 10, 11, 29, 30, 31, 116, 117, 118, - 32, 33, 71, 38, 69, 128, 56, 57, 58, 59, - 82, 86, 87, 88, 134, 121, 34, 179, 194, 129, - 130, 131, 132, 210, 211, 195 +static const short yydefgoto[] = { 241, + 8, 9, 10, 11, 30, 31, 32, 117, 118, 119, + 33, 34, 72, 39, 70, 129, 57, 58, 59, 60, + 83, 87, 88, 89, 135, 122, 35, 180, 195, 130, + 131, 132, 133, 211, 212, 196 }; -static const short yypact[] = { 136, - -17,-32768,-32768,-32768,-32768,-32768,-32768,-32768, 136, 167, - -16, 13,-32768, 167, 167, 150, 15, 167, 19,-32768, --32768,-32768, 27, 137, 27, 37,-32768,-32768, 170,-32768, - 107,-32768,-32768,-32768,-32768, 25, 61, 98, 254,-32768, --32768,-32768,-32768, 263, 269, 114, 118,-32768,-32768,-32768, --32768,-32768,-32768, 221, 116,-32768, 104,-32768, 138, 73, - 151,-32768,-32768, 221, 27, 154, 133, 155, 157, 156, - 159,-32768,-32768,-32768,-32768,-32768,-32768,-32768, 187, 184, - 104,-32768,-32768, 146, 212,-32768, 221,-32768, 200, 229, - 239, 43, 96, 61,-32768, 245, 255, 240, 238,-32768, - 246, 260, 266,-32768, -8,-32768, 270, 221, 248, -8, - 221, 36, 3, -1, 238, 251, 272, 256, 273,-32768, --32768,-32768, 221, 257, 238, 258, 57, 276, 259,-32768, - 253,-32768,-32768, 64,-32768,-32768, 252, 279, 238, 282, --32768, 280, 264,-32768,-32768, 281, 285,-32768, 265,-32768, --32768,-32768,-32768, 267, 284, 268, 221, 5, 291, 204, --32768, 292, 238, 274, 271, 275,-32768,-32768,-32768,-32768, - 291,-32768, -10, 291,-32768, 277, 294, 18, 96,-32768, --32768,-32768, 278, 238, 291, 238, 96, 286,-32768, 96, - 297, 91, 295, 301,-32768,-32768, 291, 283, 96, 287, --32768, 298,-32768, 91,-32768, 288, -5, 10, 290, 29, --32768,-32768, 18, 96, 291,-32768, 291, 293, 50, 4, - 4,-32768, 4,-32768, 4,-32768,-32768,-32768,-32768, 96, - 96,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768, 323, - 325,-32768 +static const short yypact[] = { 158, + 13,-32768,-32768,-32768,-32768,-32768,-32768,-32768, 158, 185, + -26, 44,-32768, 185, 185, 168, 51, 185, 33,-32768, +-32768,-32768,-32768, 43, 138, 43, 46,-32768,-32768, 186, +-32768, 107,-32768,-32768,-32768,-32768, 67, 71, 82, 271, +-32768,-32768,-32768,-32768, 176, 280, 95, 102,-32768,-32768, +-32768,-32768,-32768,-32768, 238, 108,-32768, 86,-32768, 112, + 73, 111,-32768,-32768, 238, 43, 114, 92, 105, 96, + 121, 144,-32768,-32768,-32768,-32768,-32768,-32768,-32768, 145, + 131, 86,-32768,-32768, 147, 154,-32768, 238,-32768, 133, + 161, 177, 152, 41, 71,-32768, 195, 204, 200, 255, +-32768, 207, 239, 246,-32768, 1,-32768, 256, 238, 240, + 1, 238, 8, -10, -5, 255, 155, 272, 257, 274, +-32768,-32768,-32768, 238, 262, 255, 258, 20, 282, 260, +-32768, 259,-32768,-32768, 34,-32768,-32768, 264, 284, 255, + 287,-32768, 285, 268,-32768,-32768, 286, 290,-32768, 269, +-32768,-32768,-32768,-32768, 270, 291, 273, 238, -3, 294, + 221,-32768, 297, 255, 276, 277, 279,-32768,-32768,-32768, +-32768, 294,-32768, -15, 294,-32768, 281, 299, -2, 41, +-32768,-32768,-32768, 283, 255, 294, 255, 41, 289,-32768, + 41, 302, 89, 300, 305,-32768,-32768, 294, 288, 41, + 292,-32768, 304,-32768, 89,-32768, 293, 3, 9, 295, + 35,-32768,-32768, -2, 41, 294,-32768, 294, 298, 49, + 17, 17,-32768, 17,-32768, 17,-32768,-32768,-32768,-32768, + 41, 41,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768, + 328, 329,-32768 }; static const short yypgoto[] = {-32768, - 69, 117, 317,-32768,-32768, 303, -21, 213, 217, 222, --32768,-32768,-32768, -19, 242, -23, 299,-32768, 126,-32768, - 261, 243,-32768, -24,-32768, -174,-32768, -164, 124, -113, - 182,-32768, 180, 139, -120, -114 + 52, 45, 322,-32768,-32768, 306, -22, 214, 222, 224, +-32768,-32768,-32768, -20, 245, -24, 301,-32768, 53,-32768, + 261, 250,-32768, 54,-32768, -175,-32768, -165, 130, -114, + 187,-32768, 188, 141, -151, -115 }; -#define YYLAST 343 - - -static const short yytable[] = { 148, - 55, 149, 54, 12, 196, 60, 187, 66, 188, 190, - 101, 156, 201, 144, 145, 203, 17, 144, 145, 16, - 199, 112, 144, 145, 216, 165, 176, 189, 144, 145, - 79, 102, 214, 221, 146, 35, 144, 145, 85, 229, - 90, 114, 147, 67, 177, 91, 147, 205, 223, 183, - 230, 147, 231, 193, 141, 238, 239, 147, 36, 104, - 106, 112, 103, 107, 113, 147, 37, 206, 205, 226, - 198, 142, 200, 207, 208, 209, 61, 13, 135, 68, - 136, 114, 115, 13, 138, 104, 13, 140, 206, 227, - 233, 84, 222, 224, 207, 208, 209, -96, 227, 154, - 157, 20, 21, 22, 161, 234, 235, 162, 236, 205, - 237, 39, 40, 41, 42, 43, 70, 44, 45, 46, - 47, 48, 49, 50, 51, 52, 15, 53, 77, 206, - 18, 119, 78, 120, 80, 207, 208, 209, 1, 64, - 65, 39, 40, 41, 42, 43, 81, 44, 45, 46, - 47, 48, 49, 50, 51, 52, 83, 53, 2, 3, - 4, 5, 6, 7, 101, 20, 21, 22, 19, 74, - 76, 89, 92, 93, 20, 21, 22, 97, 20, 21, - 22, 23, 24, 25, 26, 102, 27, 28, 19, 2, - 3, 4, 5, 6, 7, 96, 94, 95, 20, 21, - 22, 23, 24, 25, 26, 98, 62, 28, 39, 40, - 41, 42, 43, 180, 44, 45, 46, 47, 48, 49, - 50, 51, 52, 99, 53, 39, 40, 41, 42, 43, - 105, 44, 45, 46, 47, 48, 49, 50, 51, 52, - 108, 53, 39, 126, 41, 42, 43, 109, 44, 45, - 46, 47, 48, 49, 50, 51, 127, 110, 53, 40, - 41, 42, 43, 123, 44, 45, 46, 47, 48, 49, - 50, 51, 52, 124, 53, 46, 47, 48, 133, 125, - 73, 46, 47, 48, 101, 102, 75, 139, 137, 114, - 112, 163, 155, 152, 158, 153, 160, 164, -95, 159, - 166, 168, 167, 169, 170, 171, 173, 172, 174, 178, - 182, 185, 192, 184, 186, 204, 191, 212, 197, 213, - 218, 202, 241, 215, 242, 14, 220, 217, 225, 151, - 232, 63, 150, 111, 143, 122, 228, 72, 175, 181, - 0, 100, 219 +#define YYLAST 349 + + +static const short yytable[] = { 149, + 56, 150, 55, 189, 197, 61, 188, 67, 113, 191, + 16, 157, 202, 145, 146, 204, 145, 146, 177, 102, + 200, 145, 146, 190, 217, 166, 142, 145, 146, 115, + 80, 147, 215, 12, 194, 145, 146, 178, 86, 230, + 91, 103, 222, 148, 143, 92, 148, 17, 224, 184, + 231, 148, 232, 206, 15, 239, 240, 148, 18, 228, + 13, -97, 104, 108, 158, 148, 13, 206, 228, 13, + 199, 36, 201, 37, 207, 162, 227, 120, 163, 121, + 208, 209, 210, 38, 139, 68, 62, 141, 207, 69, + 234, 85, 223, 225, 208, 209, 210, 75, 77, 155, + 71, 20, 21, 22, 23, 235, 236, 206, 237, 78, + 238, 40, 41, 42, 43, 44, 79, 45, 46, 47, + 48, 49, 50, 51, 52, 53, 81, 54, 207, 82, + 84, 90, 93, 94, 208, 209, 210, 96, 105, 107, + 65, 66, 40, 41, 42, 43, 44, 95, 45, 46, + 47, 48, 49, 50, 51, 52, 53, 136, 54, 137, + 1, 97, 98, 99, 105, 102, 20, 21, 22, 23, + 113, 100, 106, 114, 109, 20, 21, 22, 23, 110, + 2, 3, 4, 5, 6, 7, 19, 103, 47, 48, + 49, 115, 116, 74, 115, 111, 20, 21, 22, 23, + 24, 25, 26, 27, 19, 28, 29, 2, 3, 4, + 5, 6, 7, 124, 20, 21, 22, 23, 24, 25, + 26, 27, 125, 63, 29, 40, 41, 42, 43, 44, + 181, 45, 46, 47, 48, 49, 50, 51, 52, 53, + 126, 54, 40, 41, 42, 43, 44, 103, 45, 46, + 47, 48, 49, 50, 51, 52, 53, 134, 54, 40, + 127, 42, 43, 44, 102, 45, 46, 47, 48, 49, + 50, 51, 52, 128, 138, 54, 41, 42, 43, 44, + 140, 45, 46, 47, 48, 49, 50, 51, 52, 53, + 113, 54, 47, 48, 49, 153, 154, 76, 156, -96, + 159, 160, 165, 161, 164, 167, 169, 168, 170, 171, + 172, 173, 179, 174, 175, 183, 185, 193, 186, 187, + 205, 192, 213, 214, 198, 203, 219, 242, 243, 216, + 14, 152, 221, 218, 226, 64, 233, 144, 151, 123, + 73, 112, 101, 229, 176, 220, 0, 0, 182 }; -static const short yycheck[] = { 114, - 24, 115, 24, 21, 179, 25, 171, 31, 19, 174, - 19, 125, 187, 19, 20, 190, 4, 19, 20, 36, - 185, 19, 19, 20, 199, 139, 22, 38, 19, 20, - 54, 40, 197, 39, 36, 21, 19, 20, 60, 214, - 64, 39, 48, 19, 40, 65, 48, 19, 39, 163, - 215, 48, 217, 36, 19, 230, 231, 48, 40, 84, - 85, 19, 84, 87, 22, 48, 40, 39, 19, 41, - 184, 36, 186, 45, 46, 47, 40, 9, 103, 19, - 105, 39, 40, 15, 108, 110, 18, 111, 39, 210, - 41, 19, 207, 208, 45, 46, 47, 41, 219, 123, - 44, 29, 30, 31, 41, 220, 221, 44, 223, 19, - 225, 5, 6, 7, 8, 9, 19, 11, 12, 13, - 14, 15, 16, 17, 18, 19, 10, 21, 15, 39, - 14, 36, 15, 38, 19, 45, 46, 47, 3, 33, - 34, 5, 6, 7, 8, 9, 43, 11, 12, 13, - 14, 15, 16, 17, 18, 19, 19, 21, 23, 24, - 25, 26, 27, 28, 19, 29, 30, 31, 19, 44, - 45, 21, 19, 41, 29, 30, 31, 19, 29, 30, - 31, 32, 33, 34, 35, 40, 37, 38, 19, 23, - 24, 25, 26, 27, 28, 40, 42, 41, 29, 30, - 31, 32, 33, 34, 35, 19, 37, 38, 5, 6, - 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, - 17, 18, 19, 40, 21, 5, 6, 7, 8, 9, - 19, 11, 12, 13, 14, 15, 16, 17, 18, 19, - 41, 21, 5, 6, 7, 8, 9, 19, 11, 12, - 13, 14, 15, 16, 17, 18, 19, 19, 21, 6, - 7, 8, 9, 19, 11, 12, 13, 14, 15, 16, - 17, 18, 19, 19, 21, 13, 14, 15, 19, 40, - 18, 13, 14, 15, 19, 40, 18, 40, 19, 39, - 19, 40, 36, 38, 19, 23, 44, 19, 41, 41, - 19, 38, 23, 23, 20, 41, 23, 41, 41, 19, - 19, 41, 19, 40, 40, 19, 40, 23, 41, 19, - 23, 36, 0, 41, 0, 9, 39, 41, 39, 117, - 38, 29, 116, 91, 113, 94, 213, 39, 157, 160, - -1, 81, 204 +static const short yycheck[] = { 115, + 25, 116, 25, 19, 180, 26, 172, 32, 19, 175, + 37, 126, 188, 19, 20, 191, 19, 20, 22, 19, + 186, 19, 20, 39, 200, 140, 19, 19, 20, 40, + 55, 37, 198, 21, 37, 19, 20, 41, 61, 215, + 65, 41, 40, 49, 37, 66, 49, 4, 40, 164, + 216, 49, 218, 19, 10, 231, 232, 49, 14, 211, + 9, 42, 85, 88, 45, 49, 15, 19, 220, 18, + 185, 21, 187, 41, 40, 42, 42, 37, 45, 39, + 46, 47, 48, 41, 109, 19, 41, 112, 40, 19, + 42, 19, 208, 209, 46, 47, 48, 45, 46, 124, + 19, 29, 30, 31, 32, 221, 222, 19, 224, 15, + 226, 5, 6, 7, 8, 9, 15, 11, 12, 13, + 14, 15, 16, 17, 18, 19, 19, 21, 40, 44, + 19, 21, 19, 42, 46, 47, 48, 42, 85, 86, + 34, 35, 5, 6, 7, 8, 9, 43, 11, 12, + 13, 14, 15, 16, 17, 18, 19, 104, 21, 106, + 3, 41, 19, 19, 111, 19, 29, 30, 31, 32, + 19, 41, 19, 22, 42, 29, 30, 31, 32, 19, + 23, 24, 25, 26, 27, 28, 19, 41, 13, 14, + 15, 40, 41, 18, 40, 19, 29, 30, 31, 32, + 33, 34, 35, 36, 19, 38, 39, 23, 24, 25, + 26, 27, 28, 19, 29, 30, 31, 32, 33, 34, + 35, 36, 19, 38, 39, 5, 6, 7, 8, 9, + 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, + 41, 21, 5, 6, 7, 8, 9, 41, 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, 6, 7, 8, 9, + 41, 11, 12, 13, 14, 15, 16, 17, 18, 19, + 19, 21, 13, 14, 15, 39, 23, 18, 37, 42, + 19, 42, 19, 45, 41, 19, 39, 23, 23, 20, + 42, 42, 19, 23, 42, 19, 41, 19, 42, 41, + 19, 41, 23, 19, 42, 37, 23, 0, 0, 42, + 9, 118, 40, 42, 40, 30, 39, 114, 117, 95, + 40, 92, 82, 214, 158, 205, -1, -1, 161 }; /* -*-C-*- Note some compilers choke on comments on `#line' lines. */ #line 3 "/usr/lib/bison.simple" @@ -1185,23 +1188,23 @@ yyreduce: switch (yyn) { case 1: -#line 306 "parse.y" +#line 308 "parse.y" { ; ; break;} case 2: -#line 307 "parse.y" +#line 309 "parse.y" { ; ; break;} case 3: -#line 308 "parse.y" +#line 310 "parse.y" { ; ; break;} case 4: -#line 309 "parse.y" +#line 311 "parse.y" { ; ; break;} case 5: -#line 312 "parse.y" +#line 314 "parse.y" { Node *node = new_ccode(C_CCODE,(yyvsp[0].cbuf)->str, ccode_line); @@ -1210,7 +1213,7 @@ case 5: ; break;} case 6: -#line 318 "parse.y" +#line 320 "parse.y" { Node *node = new_ccode(H_CCODE,(yyvsp[0].cbuf)->str, ccode_line); @@ -1219,7 +1222,7 @@ case 6: ; break;} case 7: -#line 324 "parse.y" +#line 326 "parse.y" { Node *node = new_ccode(HT_CCODE,(yyvsp[0].cbuf)->str, ccode_line); @@ -1228,7 +1231,7 @@ case 7: ; break;} case 8: -#line 330 "parse.y" +#line 332 "parse.y" { Node *node = new_ccode(PH_CCODE,(yyvsp[0].cbuf)->str, ccode_line); @@ -1237,7 +1240,7 @@ case 8: ; break;} case 9: -#line 336 "parse.y" +#line 338 "parse.y" { Node *node = new_ccode(A_CCODE,(yyvsp[0].cbuf)->str, ccode_line); @@ -1246,7 +1249,7 @@ case 9: ; break;} case 10: -#line 342 "parse.y" +#line 344 "parse.y" { Node *node = new_ccode(AT_CCODE,(yyvsp[0].cbuf)->str, ccode_line); @@ -1255,15 +1258,15 @@ case 10: ; break;} case 11: -#line 350 "parse.y" +#line 352 "parse.y" { ; ; break;} case 12: -#line 351 "parse.y" +#line 353 "parse.y" { ; ; break;} case 13: -#line 354 "parse.y" +#line 356 "parse.y" { ((Class *)class)->nodes = class_nodes; class_nodes = NULL; @@ -1271,7 +1274,7 @@ case 13: ; break;} case 14: -#line 359 "parse.y" +#line 361 "parse.y" { ((Class *)class)->nodes = NULL; class_nodes = NULL; @@ -1279,49 +1282,53 @@ case 14: ; break;} case 15: -#line 366 "parse.y" +#line 368 "parse.y" { class = new_class(yyvsp[-2].id,yyvsp[0].id,NULL); ; break;} case 16: -#line 371 "parse.y" +#line 373 "parse.y" { ; ; break;} case 17: -#line 372 "parse.y" +#line 374 "parse.y" { ; ; break;} case 18: -#line 375 "parse.y" +#line 377 "parse.y" { ; ; break;} case 19: -#line 376 "parse.y" +#line 378 "parse.y" { ; ; break;} case 20: -#line 377 "parse.y" +#line 379 "parse.y" { ; ; break;} case 21: -#line 378 "parse.y" +#line 380 "parse.y" { ; ; break;} case 22: -#line 381 "parse.y" +#line 383 "parse.y" { the_scope = PUBLIC_SCOPE; ; break;} case 23: -#line 382 "parse.y" +#line 384 "parse.y" { the_scope = PRIVATE_SCOPE; ; break;} case 24: -#line 383 "parse.y" +#line 385 "parse.y" { the_scope = PROTECTED_SCOPE; ; break;} case 25: #line 386 "parse.y" +{ the_scope = CLASS_SCOPE; ; + break;} +case 26: +#line 389 "parse.y" { if(strcmp(yyvsp[-1].id, "destroywith")==0) { g_free(yyvsp[-1].id); @@ -1336,8 +1343,8 @@ case 25: } ; break;} -case 26: -#line 399 "parse.y" +case 27: +#line 402 "parse.y" { if(strcmp(yyvsp[-2].id, "destroy")==0) { g_free(yyvsp[-2].id); @@ -1353,58 +1360,58 @@ case 26: } ; break;} -case 27: -#line 415 "parse.y" +case 28: +#line 418 "parse.y" { initializer = yyvsp[0].id; initializer_line = ccode_line; ; break;} -case 28: -#line 419 "parse.y" +case 29: +#line 422 "parse.y" { initializer = (yyvsp[0].cbuf)->str; initializer_line = ccode_line; g_string_free(yyvsp[0].cbuf, FALSE); ; break;} -case 29: -#line 427 "parse.y" -{ ; ; - break;} case 30: -#line 428 "parse.y" +#line 430 "parse.y" { ; ; break;} case 31: -#line 429 "parse.y" -{ destructor = NULL; ; +#line 431 "parse.y" +{ ; ; break;} case 32: -#line 430 "parse.y" -{ initializer = NULL; ; +#line 432 "parse.y" +{ destructor = NULL; ; break;} case 33: -#line 431 "parse.y" +#line 433 "parse.y" +{ initializer = NULL; ; + break;} +case 34: +#line 434 "parse.y" { destructor = NULL; initializer = NULL; ; break;} -case 34: -#line 437 "parse.y" +case 35: +#line 440 "parse.y" { push_variable(yyvsp[-2].id, the_scope,yyvsp[-4].line, NULL); ; break;} -case 35: -#line 440 "parse.y" +case 36: +#line 443 "parse.y" { push_variable(yyvsp[-3].id, the_scope, yyvsp[-5].line, yyvsp[-2].id); ; break;} -case 36: -#line 444 "parse.y" +case 37: +#line 447 "parse.y" { if(strcmp(yyvsp[-6].id,"get")==0 && strcmp(yyvsp[-3].id,"set")==0) { @@ -1441,8 +1448,8 @@ case 36: } ; break;} -case 37: -#line 479 "parse.y" +case 38: +#line 482 "parse.y" { if(strcmp(yyvsp[-3].id,"get")==0) { Node *node; @@ -1472,8 +1479,8 @@ case 37: } ; break;} -case 38: -#line 507 "parse.y" +case 39: +#line 510 "parse.y" { Node *node; char *get, *set = NULL; @@ -1481,9 +1488,9 @@ case 38: Type *type; char *root; - if(strcmp(yyvsp[0].id,"link")!=0 && - strcmp(yyvsp[0].id,"stringlink")!=0 && - strcmp(yyvsp[0].id,"objectlink")!=0) { + if(strcmp(yyvsp[0].id, "link")!=0 && + strcmp(yyvsp[0].id, "stringlink")!=0 && + strcmp(yyvsp[0].id, "objectlink")!=0) { 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); @@ -1496,24 +1503,29 @@ case 38: 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 root = "self"; - if(strcmp(yyvsp[0].id,"link")==0) { + if(strcmp(yyvsp[0].id, "link")==0) { set = g_strdup_printf("%s->%s = ARG;", root, yyvsp[-1].id); - } else if(strcmp(yyvsp[0].id,"stringlink")==0) { + } else if(strcmp(yyvsp[0].id, "stringlink")==0) { set = g_strdup_printf("g_free(%s->%s); " "%s->%s = g_strdup(ARG);", root, yyvsp[-1].id, root, yyvsp[-1].id); - } else if(strcmp(yyvsp[0].id,"objectlink")==0) { + } else if(strcmp(yyvsp[0].id, "objectlink")==0) { set = g_strdup_printf( "if(%s->%s) " "gtk_object_unref(GTK_OBJECT(%s->%s)); " "%s->%s = ARG; " "if(%s->%s) " - "gtk_object_ref(GTK_OBJECT(%s->%s)); ", + "gtk_object_ref(GTK_OBJECT(%s->%s));", + root, yyvsp[-1].id, + root, yyvsp[-1].id, + root, yyvsp[-1].id, root, yyvsp[-1].id, root, yyvsp[-1].id, root, yyvsp[-1].id, @@ -1538,8 +1550,8 @@ case 38: class_nodes = g_list_append(class_nodes,node); ; break;} -case 39: -#line 572 "parse.y" +case 40: +#line 580 "parse.y" { if(strcmp(yyvsp[-2].id,"type")!=0) { g_free(yyvsp[-4].id); @@ -1550,39 +1562,39 @@ case 39: yyval.id = yyvsp[-4].id; ; break;} -case 40: -#line 581 "parse.y" +case 41: +#line 589 "parse.y" { yyval.id = yyvsp[0].id; typestack = g_list_prepend(typestack,NULL); ; break;} -case 41: -#line 587 "parse.y" +case 42: +#line 595 "parse.y" { yyval.list = yyvsp[-1].list; ; break;} -case 42: -#line 588 "parse.y" +case 43: +#line 596 "parse.y" { yyval.list = NULL; ; break;} -case 43: -#line 591 "parse.y" +case 44: +#line 599 "parse.y" { yyval.list = g_list_append(yyvsp[0].list,yyvsp[-2].id); ; break;} -case 44: -#line 594 "parse.y" +case 45: +#line 602 "parse.y" { yyval.list = g_list_append(NULL,yyvsp[0].id); ; break;} -case 45: -#line 600 "parse.y" +case 46: +#line 608 "parse.y" { ; ; break;} -case 46: -#line 601 "parse.y" +case 47: +#line 609 "parse.y" { Type *type = typestack->data; char *oldname = type->name; @@ -1590,152 +1602,152 @@ case 46: g_free(oldname); ; break;} -case 47: -#line 609 "parse.y" +case 48: +#line 617 "parse.y" { Node *node = new_type(0,yyvsp[0].id,NULL); typestack = g_list_prepend(typestack,node); ; break;} -case 48: -#line 613 "parse.y" +case 49: +#line 621 "parse.y" { Node *node = new_type(stars,yyvsp[-1].id,NULL); stars = 0; typestack = g_list_prepend(typestack,node); ; break;} -case 49: -#line 620 "parse.y" +case 50: +#line 628 "parse.y" { yyval.id = g_strconcat("unsigned ",yyvsp[0].id,NULL); ; break;} -case 50: -#line 623 "parse.y" +case 51: +#line 631 "parse.y" { yyval.id = g_strconcat("signed ",yyvsp[0].id,NULL); ; break;} -case 51: -#line 626 "parse.y" +case 52: +#line 634 "parse.y" { yyval.id = g_strdup(yyvsp[0].id); ; break;} -case 52: -#line 629 "parse.y" +case 53: +#line 637 "parse.y" { yyval.id = g_strdup("unsigned char"); ; break;} -case 53: -#line 632 "parse.y" +case 54: +#line 640 "parse.y" { yyval.id = g_strdup("signed char"); ; break;} -case 54: -#line 635 "parse.y" +case 55: +#line 643 "parse.y" { yyval.id = g_strdup("char"); ; break;} -case 55: -#line 638 "parse.y" +case 56: +#line 646 "parse.y" { yyval.id = g_strdup("double"); ; break;} -case 56: -#line 641 "parse.y" +case 57: +#line 649 "parse.y" { yyval.id = g_strdup("float"); ; break;} -case 57: -#line 644 "parse.y" +case 58: +#line 652 "parse.y" { yyval.id = yyvsp[0].id; ; break;} -case 58: -#line 647 "parse.y" +case 59: +#line 655 "parse.y" { yyval.id = g_strconcat(yyvsp[-1].id,yyvsp[0].id,NULL); g_free(yyvsp[0].id); ; break;} -case 59: -#line 651 "parse.y" +case 60: +#line 659 "parse.y" { yyval.id = yyvsp[0].id; ; break;} -case 60: -#line 654 "parse.y" +case 61: +#line 662 "parse.y" { yyval.id = g_strdup("void"); ; break;} -case 61: -#line 659 "parse.y" +case 62: +#line 667 "parse.y" { yyval.id = "long int"; ; break;} -case 62: -#line 662 "parse.y" +case 63: +#line 670 "parse.y" { yyval.id = "long"; ; break;} -case 63: -#line 665 "parse.y" +case 64: +#line 673 "parse.y" { yyval.id = "short int"; ; break;} -case 64: -#line 668 "parse.y" +case 65: +#line 676 "parse.y" { yyval.id = "short"; ; break;} -case 65: -#line 671 "parse.y" +case 66: +#line 679 "parse.y" { yyval.id = "int"; ; break;} -case 66: -#line 676 "parse.y" +case 67: +#line 684 "parse.y" { yyval.id = "enum "; ; break;} -case 67: -#line 679 "parse.y" +case 68: +#line 687 "parse.y" { yyval.id = "union "; ; break;} -case 68: -#line 682 "parse.y" +case 69: +#line 690 "parse.y" { yyval.id = "struct "; ; break;} -case 69: -#line 687 "parse.y" -{ stars++; ; - break;} case 70: -#line 688 "parse.y" +#line 695 "parse.y" { stars++; ; break;} case 71: -#line 692 "parse.y" +#line 696 "parse.y" +{ stars++; ; + break;} +case 72: +#line 700 "parse.y" { if(strcmp(yyvsp[-1].id, "first")==0) yyval.sigtype = SIGNAL_FIRST_METHOD; @@ -1749,14 +1761,14 @@ case 71: g_free(yyvsp[-1].id); ; break;} -case 72: -#line 704 "parse.y" +case 73: +#line 712 "parse.y" { yyval.sigtype = SIGNAL_LAST_METHOD; ; break;} -case 73: -#line 710 "parse.y" +case 74: +#line 718 "parse.y" { if(strcmp(yyvsp[-1].id,"first")==0) yyval.sigtype = SIGNAL_FIRST_METHOD; @@ -1770,8 +1782,8 @@ case 73: g_free(yyvsp[-1].id); ; break;} -case 74: -#line 722 "parse.y" +case 75: +#line 730 "parse.y" { if(strcmp(yyvsp[-2].id,"first")==0) yyval.sigtype = SIGNAL_FIRST_METHOD; @@ -1785,47 +1797,47 @@ case 74: g_free(yyvsp[-2].id); ; break;} -case 75: -#line 734 "parse.y" +case 76: +#line 742 "parse.y" { yyval.sigtype = SIGNAL_LAST_METHOD; ; break;} -case 76: -#line 737 "parse.y" +case 77: +#line 745 "parse.y" { /* the_scope was default thus public */ the_scope = PUBLIC_SCOPE; ; break;} -case 77: -#line 743 "parse.y" +case 78: +#line 751 "parse.y" { gtktypes = g_list_prepend(gtktypes, yyvsp[-3].id); ; break;} -case 78: -#line 748 "parse.y" +case 79: +#line 756 "parse.y" { gtktypes = g_list_append(gtktypes, yyvsp[0].id); ; break;} -case 79: -#line 751 "parse.y" +case 80: +#line 759 "parse.y" { gtktypes = g_list_append(gtktypes, yyvsp[0].id); ; break;} -case 80: -#line 756 "parse.y" +case 81: +#line 764 "parse.y" { yyval.cbuf = yyvsp[0].cbuf; ; break;} -case 81: -#line 757 "parse.y" +case 82: +#line 765 "parse.y" { yyval.cbuf = NULL; ; break;} -case 82: -#line 761 "parse.y" +case 83: +#line 769 "parse.y" { if(!has_self) { yyerror(_("signal without 'self' as " @@ -1833,13 +1845,18 @@ case 82: free_all_global_state(); YYERROR; } + if(the_scope == CLASS_SCOPE) { + yyerror(_("a method cannot be of class scope")); + free_all_global_state(); + YYERROR; + } push_function(the_scope, yyvsp[-7].sigtype,NULL, yyvsp[-5].id, yyvsp[0].cbuf,yyvsp[-9].line, ccode_line, vararg, yyvsp[-8].list); ; break;} -case 83: -#line 772 "parse.y" +case 84: +#line 785 "parse.y" { if(!has_self) { yyerror(_("signal without 'self' as " @@ -1847,13 +1864,18 @@ case 83: free_all_global_state(); YYERROR; } + if(the_scope == CLASS_SCOPE) { + yyerror(_("a method cannot be of class scope")); + free_all_global_state(); + YYERROR; + } push_function(the_scope, yyvsp[-7].sigtype, NULL, yyvsp[-5].id, yyvsp[0].cbuf, yyvsp[-9].line, ccode_line, vararg, yyvsp[-8].list); ; break;} -case 84: -#line 783 "parse.y" +case 85: +#line 801 "parse.y" { if(!has_self) { yyerror(_("virtual method without 'self' as " @@ -1861,13 +1883,18 @@ case 84: free_all_global_state(); YYERROR; } + if(the_scope == CLASS_SCOPE) { + yyerror(_("a method cannot be of class scope")); + free_all_global_state(); + YYERROR; + } push_function(the_scope, VIRTUAL_METHOD, NULL, yyvsp[-5].id, yyvsp[0].cbuf, yyvsp[-8].line, ccode_line, vararg, NULL); ; break;} -case 85: -#line 794 "parse.y" +case 86: +#line 817 "parse.y" { if(!has_self) { yyerror(_("virtual method without 'self' as " @@ -1875,13 +1902,18 @@ case 85: free_all_global_state(); YYERROR; } + if(the_scope == CLASS_SCOPE) { + yyerror(_("a method cannot be of class scope")); + free_all_global_state(); + YYERROR; + } push_function(the_scope, VIRTUAL_METHOD, NULL, yyvsp[-5].id, yyvsp[0].cbuf, yyvsp[-7].line, ccode_line, vararg, NULL); ; break;} -case 86: -#line 805 "parse.y" +case 87: +#line 833 "parse.y" { if(!has_self) { yyerror(_("virtual method without 'self' as " @@ -1894,8 +1926,8 @@ case 86: ccode_line, vararg, NULL); ; break;} -case 87: -#line 816 "parse.y" +case 88: +#line 844 "parse.y" { push_function(NO_SCOPE, OVERRIDE_METHOD, yyvsp[-8].id, yyvsp[-5].id, yyvsp[0].cbuf, @@ -1903,16 +1935,21 @@ case 87: vararg, NULL); ; break;} -case 88: -#line 822 "parse.y" +case 89: +#line 850 "parse.y" { + if(the_scope == CLASS_SCOPE) { + yyerror(_("a method cannot be of class scope")); + free_all_global_state(); + YYERROR; + } push_function(the_scope, REGULAR_METHOD, NULL, yyvsp[-5].id, yyvsp[0].cbuf, yyvsp[-7].line, ccode_line, vararg, NULL); ; break;} -case 89: -#line 827 "parse.y" +case 90: +#line 860 "parse.y" { if(strcmp(yyvsp[-4].id, "init")==0) { push_init_arg(yyvsp[-2].id,FALSE); @@ -1933,8 +1970,8 @@ case 89: } ; break;} -case 90: -#line 848 "parse.y" +case 91: +#line 881 "parse.y" { g_free(onerror); onerror = NULL; g_free(defreturn); defreturn = NULL; @@ -1947,8 +1984,8 @@ case 90: g_free(yyvsp[-1].id); ; break;} -case 91: -#line 859 "parse.y" +case 92: +#line 892 "parse.y" { g_free(onerror); onerror = NULL; g_free(defreturn); defreturn = NULL; @@ -1969,30 +2006,30 @@ case 91: g_free(yyvsp[-1].id); ; break;} -case 92: -#line 878 "parse.y" +case 93: +#line 911 "parse.y" { g_free(onerror); onerror = NULL; g_free(defreturn); defreturn = NULL; ; break;} -case 93: -#line 884 "parse.y" +case 94: +#line 917 "parse.y" { yyval.id = yyvsp[0].id; ; break;} -case 94: -#line 885 "parse.y" +case 95: +#line 918 "parse.y" { yyval.id = (yyvsp[1].cbuf)->str; g_string_free(yyvsp[1].cbuf, FALSE); ; break;} -case 95: -#line 891 "parse.y" +case 96: +#line 924 "parse.y" { vararg = FALSE; has_self = FALSE; ; break;} -case 96: -#line 892 "parse.y" +case 97: +#line 925 "parse.y" { vararg = FALSE; has_self = TRUE; @@ -2005,8 +2042,8 @@ case 96: } ; break;} -case 97: -#line 903 "parse.y" +case 98: +#line 936 "parse.y" { has_self = TRUE; if(strcmp(yyvsp[-2].id,"self")==0) @@ -2018,40 +2055,40 @@ case 97: } ; break;} -case 98: -#line 913 "parse.y" -{ has_self = FALSE; ; - break;} case 99: -#line 916 "parse.y" -{ vararg = TRUE; ; +#line 946 "parse.y" +{ has_self = FALSE; ; break;} case 100: -#line 917 "parse.y" -{ vararg = FALSE; ; +#line 949 "parse.y" +{ vararg = TRUE; ; break;} case 101: -#line 920 "parse.y" -{ ; ; +#line 950 "parse.y" +{ vararg = FALSE; ; break;} case 102: -#line 921 "parse.y" +#line 953 "parse.y" { ; ; break;} case 103: -#line 924 "parse.y" +#line 954 "parse.y" +{ ; ; + break;} +case 104: +#line 957 "parse.y" { push_funcarg(yyvsp[0].id,NULL); ; break;} -case 104: -#line 927 "parse.y" +case 105: +#line 960 "parse.y" { push_funcarg(yyvsp[-1].id,yyvsp[0].id); ; break;} -case 105: -#line 930 "parse.y" +case 106: +#line 963 "parse.y" { if(strcmp(yyvsp[-2].id,"check")!=0) { yyerror(_("parse error")); @@ -2061,8 +2098,8 @@ case 105: push_funcarg(yyvsp[-4].id,NULL); ; break;} -case 106: -#line 938 "parse.y" +case 107: +#line 971 "parse.y" { if(strcmp(yyvsp[-2].id,"check")!=0) { yyerror(_("parse error")); @@ -2072,16 +2109,16 @@ case 106: push_funcarg(yyvsp[-5].id,yyvsp[-4].id); ; break;} -case 107: -#line 948 "parse.y" -{ ; ; - break;} case 108: -#line 949 "parse.y" +#line 981 "parse.y" { ; ; break;} case 109: -#line 952 "parse.y" +#line 982 "parse.y" +{ ; ; + break;} +case 110: +#line 985 "parse.y" { if(strcmp(yyvsp[0].id,"type")==0) { Node *node = new_check(TYPE_CHECK,NULL); @@ -2096,61 +2133,61 @@ case 109: g_free(yyvsp[0].id); ; break;} -case 110: -#line 965 "parse.y" +case 111: +#line 998 "parse.y" { Node *node = new_check(GT_CHECK,yyvsp[0].id); checks = g_list_append(checks,node); ; break;} -case 111: -#line 969 "parse.y" +case 112: +#line 1002 "parse.y" { Node *node = new_check(LT_CHECK,yyvsp[0].id); checks = g_list_append(checks,node); ; break;} -case 112: -#line 973 "parse.y" +case 113: +#line 1006 "parse.y" { Node *node = new_check(GE_CHECK,yyvsp[0].id); checks = g_list_append(checks,node); ; break;} -case 113: -#line 977 "parse.y" +case 114: +#line 1010 "parse.y" { Node *node = new_check(LE_CHECK,yyvsp[0].id); checks = g_list_append(checks,node); ; break;} -case 114: -#line 981 "parse.y" +case 115: +#line 1014 "parse.y" { Node *node = new_check(EQ_CHECK,yyvsp[0].id); checks = g_list_append(checks,node); ; break;} -case 115: -#line 985 "parse.y" +case 116: +#line 1018 "parse.y" { Node *node = new_check(NE_CHECK,yyvsp[0].id); checks = g_list_append(checks,node); ; break;} -case 116: -#line 991 "parse.y" +case 117: +#line 1024 "parse.y" { yyval.id = yyvsp[0].id; ; break;} -case 117: -#line 992 "parse.y" +case 118: +#line 1025 "parse.y" { yyval.id = g_strconcat("-",yyvsp[0].id,NULL); g_free(yyvsp[0].id); ; break;} -case 118: -#line 996 "parse.y" +case 119: +#line 1029 "parse.y" { yyval.id = yyvsp[0].id; ; break;} } @@ -2375,5 +2412,5 @@ yyerrhandle: } return 1; } -#line 999 "parse.y" +#line 1032 "parse.y" diff --git a/src/parse.y b/src/parse.y index 0161aea..17ab264 100644 --- a/src/parse.y +++ b/src/parse.y @@ -123,6 +123,8 @@ push_function(int scope, int method, char *oid, char *id, Node *node; Type *type; char *c_cbuf; + + g_assert(scope != CLASS_SCOPE); if(method!=INIT_METHOD && method!=CLASS_INIT_METHOD) { type = pop_type(); @@ -299,7 +301,7 @@ set_return_value(char *type, char *val) %token TOKEN NUMBER TYPETOKEN ARRAY_DIM %token CCODE HTCODE PHCODE HCODE ACODE ATCODE -%token PUBLIC PRIVATE PROTECTED ARGUMENT VIRTUAL SIGNAL OVERRIDE +%token PUBLIC PRIVATE PROTECTED CLASSWIDE ARGUMENT VIRTUAL SIGNAL OVERRIDE %% @@ -381,6 +383,7 @@ thing: method { ; } scope: PUBLIC { the_scope = PUBLIC_SCOPE; } | PRIVATE { the_scope = PRIVATE_SCOPE; } | PROTECTED { the_scope = PROTECTED_SCOPE; } + | CLASSWIDE { the_scope = CLASS_SCOPE; } ; destructor: TOKEN TOKEN { @@ -511,9 +514,9 @@ argument: ARGUMENT flags argtype TOKEN TOKEN '{' CCODE TOKEN '{' CCODE ';' { Type *type; char *root; - if(strcmp($5,"link")!=0 && - strcmp($5,"stringlink")!=0 && - strcmp($5,"objectlink")!=0) { + if(strcmp($5, "link")!=0 && + strcmp($5, "stringlink")!=0 && + strcmp($5, "objectlink")!=0) { g_free($5); g_free($3); g_free($4); g_list_foreach($2,(GFunc)g_free,NULL); @@ -526,24 +529,29 @@ 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 root = "self"; - if(strcmp($5,"link")==0) { + if(strcmp($5, "link")==0) { set = g_strdup_printf("%s->%s = ARG;", root, $4); - } else if(strcmp($5,"stringlink")==0) { + } else if(strcmp($5, "stringlink")==0) { set = g_strdup_printf("g_free(%s->%s); " "%s->%s = g_strdup(ARG);", root, $4, root, $4); - } else if(strcmp($5,"objectlink")==0) { + } else if(strcmp($5, "objectlink")==0) { set = g_strdup_printf( "if(%s->%s) " "gtk_object_unref(GTK_OBJECT(%s->%s)); " "%s->%s = ARG; " "if(%s->%s) " - "gtk_object_ref(GTK_OBJECT(%s->%s)); ", + "gtk_object_ref(GTK_OBJECT(%s->%s));", + root, $4, + root, $4, + root, $4, root, $4, root, $4, root, $4, @@ -765,6 +773,11 @@ method: SIGNAL flags fullsigtype type TOKEN '(' funcargs ')' returnvals codenoc free_all_global_state(); YYERROR; } + if(the_scope == CLASS_SCOPE) { + yyerror(_("a method cannot be of class scope")); + free_all_global_state(); + YYERROR; + } push_function(the_scope, $3,NULL, $5, $10,$1, ccode_line, vararg, $2); @@ -776,6 +789,11 @@ method: SIGNAL flags fullsigtype type TOKEN '(' funcargs ')' returnvals codenoc free_all_global_state(); YYERROR; } + if(the_scope == CLASS_SCOPE) { + yyerror(_("a method cannot be of class scope")); + free_all_global_state(); + YYERROR; + } push_function(the_scope, $4, NULL, $6, $11, $2, ccode_line, vararg, $3); @@ -787,6 +805,11 @@ method: SIGNAL flags fullsigtype type TOKEN '(' funcargs ')' returnvals codenoc free_all_global_state(); YYERROR; } + if(the_scope == CLASS_SCOPE) { + yyerror(_("a method cannot be of class scope")); + free_all_global_state(); + YYERROR; + } push_function(the_scope, VIRTUAL_METHOD, NULL, $4, $9, $1, ccode_line, vararg, NULL); @@ -798,6 +821,11 @@ method: SIGNAL flags fullsigtype type TOKEN '(' funcargs ')' returnvals codenoc free_all_global_state(); YYERROR; } + if(the_scope == CLASS_SCOPE) { + yyerror(_("a method cannot be of class scope")); + free_all_global_state(); + YYERROR; + } push_function(the_scope, VIRTUAL_METHOD, NULL, $4, $9, $2, ccode_line, vararg, NULL); @@ -820,6 +848,11 @@ method: SIGNAL flags fullsigtype type TOKEN '(' funcargs ')' returnvals codenoc vararg, NULL); } | scope type TOKEN '(' funcargs ')' returnvals codenocode { + if(the_scope == CLASS_SCOPE) { + yyerror(_("a method cannot be of class scope")); + free_all_global_state(); + YYERROR; + } push_function(the_scope, REGULAR_METHOD, NULL, $3, $8, $1, ccode_line, vararg, NULL); diff --git a/src/test.gob b/src/test.gob index 98d8614..8447a93 100644 --- a/src/test.gob +++ b/src/test.gob @@ -58,6 +58,9 @@ class Gtk:Weird:Button from Gtk:Button { destroywith gtk_object_unref; argument POINTER testingobj objectlink; + classwide int foo = 20; + argument INT foo link; + public Gtk:Object * testingobj2 destroy { if(VAR) diff --git a/src/treefuncs.def b/src/treefuncs.def index 537bf2b..e393f7e 100644 --- a/src/treefuncs.def +++ b/src/treefuncs.def @@ -26,7 +26,8 @@ enum { NO_SCOPE, PUBLIC_SCOPE, PRIVATE_SCOPE, - PROTECTED_SCOPE + PROTECTED_SCOPE, + CLASS_SCOPE }; /* method type */ diff --git a/src/treefuncs.h b/src/treefuncs.h index d2e9430..e7c12d5 100644 --- a/src/treefuncs.h +++ b/src/treefuncs.h @@ -33,7 +33,8 @@ enum { NO_SCOPE, PUBLIC_SCOPE, PRIVATE_SCOPE, - PROTECTED_SCOPE + PROTECTED_SCOPE, + CLASS_SCOPE }; /* method type */ -- 2.43.0