From 486240dc4c5d57b0afaddba60d87fe375112bed5 Mon Sep 17 00:00:00 2001 From: George Lebl Date: Fri, 30 Jun 2000 22:51:00 -0800 Subject: [PATCH] Release 1.0.2 --- ChangeLog | 40 ++ NEWS | 12 + configure | 2 +- configure.in | 2 +- doc/gob.1.in | 31 +- gob.spec | 2 +- src/ChangeLog | 25 + src/Makefile.am | 2 + src/Makefile.in | 5 +- src/checks.c | 85 ++- src/checks.h | 1 + src/generate_treefuncs.pl | 8 +- src/lexer.c | 888 +++++++++++++++--------------- src/lexer.l | 19 +- src/main.c | 114 ++-- src/main.h | 1 + src/parse.c | 1079 ++++++++++++++++++++----------------- src/parse.y | 217 ++++---- src/test.gob | 45 +- src/treefuncs.c | 48 +- src/treefuncs.def | 5 +- src/treefuncs.h | 7 +- src/util.c | 36 +- src/util.h | 6 +- 24 files changed, 1549 insertions(+), 1131 deletions(-) create mode 100644 src/ChangeLog diff --git a/ChangeLog b/ChangeLog index 4b931f1..df70dda 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,43 @@ +Fri Jun 30 13:11:05 2000 George Lebl + + * doc/gob.1.in: add doc for --always-private-struct + + * src/main.c: fix output of --help. Also print __GOB_FUNCTION__ + for inits and for get/set_arg. And print the get_real_id to + avoid the underscore. + +Mon Jun 26 00:06:45 2000 George Lebl + + * src/parse.y: for stringlink, dup the string on argument + getting + + * doc/gob.1.in: update documentation to the above change + +Sun Jun 25 03:34:02 2000 George Lebl + + * src/treefuncs.def, src/main.c, src/utils.[ch], src/parse.y: sane + parsing of const. Get rid of "stars" integer and just use a + "pointer" string. Also the types in general are more sanely parsed, + thus recognizing hopefully all legal (and some illegal) C types. + + * src/checks.[ch], src/main.c: checks the argument type to be one we can + truly check. + + * src/treefuncs.def, src/main.c, src/parse.y, src/lexer.l: Apply + patch from Bas van der Linden that adds the + possibility to use chunks to allocate objects. + + * src/main.c: Apply patch from Bas van der Linden + to add a __GOB_FUNCTION__ define to each function + + * src/Makefile.am, src/main.c, src/lexer.l, src/generate_treefuncs.pl: + avoid and fix warnings, and compile with all warnings + + * src/main.[ch]: add an --always-private-struct option to always put + in the private pointer, even if there are no private members. + + * src/test.gob: add some more tests for new stuff + Wed Jun 07 15:03:18 2000 George Lebl * Release 1.0.1 diff --git a/NEWS b/NEWS index 77cf571..f63100d 100644 --- a/NEWS +++ b/NEWS @@ -1,3 +1,15 @@ +1.0.2 + * Fix "const" handeling + * Allow use of chunks for new object allocation (Bas van der Linden) + * Add __GOB_FUNCTION__ define for each function (Bas van der Linden) + * Add --always-private-struct option + * stringlink strdups on get + * Minor fixes + + NOTE: if you are using stringlink, you might notice a memory leak + since from 1.0.2 stringlink strdups the string instead of just + returning it + 1.0.1 * documentation fixes * fix the behaviour of the private header switches diff --git a/configure b/configure index 3dc86a2..2c41e7c 100755 --- a/configure +++ b/configure @@ -703,7 +703,7 @@ fi PACKAGE=gob -VERSION=1.0.1 +VERSION=1.0.2 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 9c8435c..cc28b67 100644 --- a/configure.in +++ b/configure.in @@ -2,7 +2,7 @@ dnl Process this file with autoconf to produce a configure script. AC_PREREQ(2.2) AC_INIT(src/treefuncs.h) AM_CONFIG_HEADER(config.h) -AM_INIT_AUTOMAKE(gob,1.0.1) +AM_INIT_AUTOMAKE(gob,1.0.2) if test -f ../NOINST_GOB ; then DOINSTGOB= diff --git a/doc/gob.1.in b/doc/gob.1.in index 9e1ce35..01d66cd 100644 --- a/doc/gob.1.in +++ b/doc/gob.1.in @@ -77,6 +77,11 @@ and SELF_CLASS macros. .TP .B --no-kill-underscores Do not remove the initial underscore from method names. +.TP +.B --always-private-struct +Always include the private pointer in the public header file. This is useful for +files which are part of a library and you want to reserve the right to add some +private data members without breaking binary compatibility. .SH TYPENAMES .PP @@ -439,7 +444,7 @@ is just like private char * foo; argument POINTER (type char *) foo get { - ARG = self->_priv->foo; + ARG = g_strdup(self->_priv->foo); } set { g_free(self->_priv->foo); self->_priv->foo = g_strdup(ARG); @@ -472,10 +477,9 @@ is just like .PP As you see it will handle NULLs correctly (for the string, g_free and g_strdup handle NULLs). And it will also handle private, protected and public members. -Also you should notice that when the get is used, only a pointer is always -returned for both objectlink and strinklink. So you should treat the returned -value with care and never free it (and notice that it will only be around -until you set the argument to something else or destroy the object). +For objectlink, just a pointer is returned on get, if you wish to keep it around, +you should call gtk_object_ref on it. For stringlink, get makes a copy of +the string which you should free after use. This is the behaviour since 1.0.2. .PP Methods: .PP @@ -931,6 +935,23 @@ include the generated .c and .h files into BUILT_SOURCES variable. You have to include both the .gob and the .c and .h files in the SOURCES for your program. +.SH DEBUGGING +.PP +GOB does several things to make debugging the code easier. First it adds +preprocessor commands into the output c file that point to the correct places +in your .gob input file. However sometimes there might be some bigger +confusion and this is just not helpful. In this case you will probably want +to have gcc point you directly at the generated files. For this use +the --no-lines command line option. You should also note that these commands +are not generated for the public header file at all. If there is an error which +points you to the public header file, make sure you fix this error in the .gob +file, otherwise your changes will not have any effect after gob recompiles the +sources again. +.PP +Sometimes you might want to know which method you are in for some debugging +output. GOB will define __GOB_FUNCTION__ macro, which is just a string constant +with a pretty name of the method. + .SH BUGS .PP The lexer does not actually parse the C code, so I'm sure that some corner diff --git a/gob.spec b/gob.spec index ac4d7ab..af07c4d 100644 --- a/gob.spec +++ b/gob.spec @@ -1,4 +1,4 @@ -%define ver 1.0.1 +%define ver 1.0.2 %define rel 1 %define prefix /usr diff --git a/src/ChangeLog b/src/ChangeLog new file mode 100644 index 0000000..9110b93 --- /dev/null +++ b/src/ChangeLog @@ -0,0 +1,25 @@ +Sun Jun 25 03:34:02 2000 George Lebl + + * treefuncs.def, main.c, utils.[ch], parse.y: sane parsing of const. + Get rid of "stars" integer and just use a "pointer" string. Also + the types in general are more sanely parsed, thus recognizing + hopefully all legal (and some illegal) C types. + + * checks.[ch], main.c: checks the argument type to be one we can + truly check. + + * treefuncs.def, main.c, parse.y, lexer.l: Apply patch from + Bas van der Linden that adds the possibility to + use chunks to allocate objects. + + * main.c: Apply patch from Bas van der Linden + to add a __GOB_FUNCTION__ define to each function + + * Makefile.am, main.c, lexer.l, generate_treefuncs.pl: avoid and fix + warnings, and compile with all warnings + + * main.[ch]: add an --always-private-struct option to always put in the + private pointer, even if there are no private members. + + * test.gob: add some more tests for new stuff + diff --git a/src/Makefile.am b/src/Makefile.am index 28872fe..1c846fd 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -2,6 +2,8 @@ YFLAGS += -d -t SUBDIRS = +CFLAGS += -Wall -Wpointer-arith -Wmissing-prototypes -Wmissing-declarations + INCLUDES = @GLIB_CFLAGS@ -I$(includedir) bin_PROGRAMS = @DOINSTGOB@ diff --git a/src/Makefile.in b/src/Makefile.in index ced6ae4..3c0acd1 100644 --- a/src/Makefile.in +++ b/src/Makefile.in @@ -60,7 +60,6 @@ NORMAL_UNINSTALL = : PRE_UNINSTALL = : POST_UNINSTALL = : CC = @CC@ -CFLAGS = @CFLAGS@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ DOINSTGOB = @DOINSTGOB@ @@ -82,6 +81,8 @@ YACC = @YACC@ YFLAGS = -d -t SUBDIRS = +CFLAGS = @CFLAGS@ -Wall -Wpointer-arith -Wmissing-prototypes -Wmissing-declarations + INCLUDES = @GLIB_CFLAGS@ -I$(includedir) bin_PROGRAMS = @DOINSTGOB@ @@ -118,7 +119,7 @@ LEXLIB = @LEXLIB@ COMPILE = $(CC) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) CCLD = $(CC) LINK = $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(LDFLAGS) -o $@ -DIST_COMMON = Makefile.am Makefile.in lexer.c parse.c +DIST_COMMON = ChangeLog Makefile.am Makefile.in lexer.c parse.c DISTFILES = $(DIST_COMMON) $(SOURCES) $(HEADERS) $(TEXINFOS) $(EXTRA_DIST) diff --git a/src/checks.c b/src/checks.c index 7ce3bea..7c675ee 100644 --- a/src/checks.c +++ b/src/checks.c @@ -317,7 +317,7 @@ check_nonvoidempty(Class *c) if(m->method != REGULAR_METHOD) continue; if(!(strcmp(m->mtype->name, "void")==0 && - m->mtype->stars == 0) && + m->mtype->pointer == NULL) && !m->cbuf) { print_error(TRUE, "non-void empty method found, " @@ -385,6 +385,89 @@ check_argument_types(Class *c) } } +static void +check_func_arg_check_func_arg(Method *m, FuncArg *fa) +{ + GList *li; + char *s; + + if( ! fa->checks) + return; + + if(strcmp(fa->atype->name, "void") == 0 && + fa->atype->pointer == NULL) { + print_error(FALSE, "Running checks on a void function " + "argument", m->line_no); + return; + } + + for(li = fa->checks; li; li = g_list_next(li)) { + Check *ch = li->data; + if(ch->chtype == TYPE_CHECK) { + char *p; + gboolean got_type = FALSE; + s = g_strdup(fa->atype->name); + p = strtok(s, " "); + if( ! p) { + g_free(s); + goto type_check_error; + } + while(p) { + if(strcmp(p, "const") != 0) { + if(got_type) { + g_free(s); + goto type_check_error; + } + got_type = TRUE; + } + p = strtok(NULL, " "); + } + g_free(s); + if( ! got_type) + goto type_check_error; + + if(fa->atype->pointer == NULL || + (strcmp(fa->atype->pointer, "*") != 0 && + strcmp(fa->atype->pointer, "* const") != 0)) + goto type_check_error; + } + } + return; + +type_check_error: + if(fa->atype->pointer) + s = g_strdup_printf("Cannot check the type of '%s %s'", + fa->atype->name, fa->atype->pointer); + else + s = g_strdup_printf("Cannot check the type of '%s'", + fa->atype->name); + print_error(FALSE, s, m->line_no); + g_free(s); +} + +static void +check_func_arg_check_method(Method *m) +{ + GList *li; + for(li = m->args; li; li = g_list_next(li)) { + FuncArg *fa = li->data; + check_func_arg_check_func_arg(m, fa); + } +} + +void +check_func_arg_checks(Class *c) +{ + GList *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; + check_func_arg_check_method(m); + } + } +} + int count_signals(Class *c) { diff --git a/src/checks.h b/src/checks.h index 8d20300..a2a5674 100644 --- a/src/checks.h +++ b/src/checks.h @@ -33,6 +33,7 @@ void check_firstarg(Class *c); void check_nonvoidempty(Class *c); void check_signal_args(Class *c); void check_argument_types(Class *c); +void check_func_arg_checks(Class *c); int count_signals(Class *c); int count_arguments(Class *c); diff --git a/src/generate_treefuncs.pl b/src/generate_treefuncs.pl index 12890fc..de6c4b6 100755 --- a/src/generate_treefuncs.pl +++ b/src/generate_treefuncs.pl @@ -97,8 +97,8 @@ while() { "\tself->type = $uct"."_NODE;\n"; $copyfunc{$typename} = "{\n" . "\t$typename * new;\n" . - "\tg_return_if_fail(self != NULL);\n" . - "\tg_return_if_fail(self->type == $uct"."_NODE);\n" . + "\tg_return_val_if_fail(self != NULL, NULL);\n" . + "\tg_return_val_if_fail(self->type == $uct"."_NODE, NULL);\n" . "\tnew = g_new0($typename, 1);\n" . "\tnew->type = $uct"."_NODE;\n"; $freefunc{$typename} = "{\n\tg_return_if_fail(self != NULL);\n" . @@ -258,8 +258,8 @@ foreach $t (sort keys %freefunc_prot) { print OUTC "Node * copy_node(Node *node)\n" . "{\n" . - "\tg_return_if_fail(node != NULL);\n" . - "\tg_return_if_fail(node->type >= 0 && node->type < LAST_NODE_TYPE);\n" . + "\tg_return_val_if_fail(node != NULL, NULL);\n" . + "\tg_return_val_if_fail(node->type >= 0 && node->type < LAST_NODE_TYPE, NULL);\n" . "\tswitch(node->type) {\n"; foreach $t (sort keys %typestruct) { print OUTC "\tcase " . uc($t) . "_NODE: return (Node *)copy_" . lc($t) . " (($t *)node);\n"; diff --git a/src/lexer.c b/src/lexer.c index bbab92d..f1ce73c 100644 --- a/src/lexer.c +++ b/src/lexer.c @@ -286,7 +286,7 @@ static void yy_fatal_error YY_PROTO(( yyconst char msg[] )); #define YY_NUM_RULES 88 #define YY_END_OF_BUFFER 89 -static yyconst short int yy_acclist[399] = +static yyconst short int yy_acclist[401] = { 0, 89, 86, 88, 85, 86, 88, 1, 87, 88, 86, 87, 88, 86, 88, 86, 88, 85, 86, 88, 86, @@ -299,82 +299,82 @@ static yyconst short int yy_acclist[399] = 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, + 77, 86, 88, 77, 86, 88, 86, 88, 80, 86, + 88, 80, 86, 88, 80, 86, 88, 80, 86, 88, + 82, 86, 88, 86, 88, 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, 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, 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, + 77, 23, 77, 77, 79, 80, 78, 80, 80, 80, + 24, 81, 80, 80, 80, 80, 80, 80, 80, 80, 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 + 8, 6, 13, 10, 12, 11, 13, 16, 15, 3, + 28, 32, 39, 35, 37, 18, 77, 19, 77, 77, + 79, 79, 78, 80, 80, 80, 68, 20, 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[358] = +static yyconst short int yy_accept[359] = { 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 4, 7, 10, 13, 15, 17, 20, 22, 24, 27, 31, 35, 38, 41, 44, 48, 52, 56, 59, 62, 65, 69, 73, 76, 79, 82, 86, 90, 94, 97, - 99, 101, 104, 107, 110, 113, 116, 118, 120, 123, - 126, 128, 131, 134, 137, 140, 143, 146, 149, 152, - 155, 158, 161, 164, 167, 170, 173, 177, 180, 183, - 186, 189, 193, 196, 199, 202, 205, 209, 212, 213, - 213, 213, 213, 213, 213, 213, 213, 214, 214, 215, - - 215, 215, 215, 215, 215, 216, 216, 217, 217, 217, - 218, 219, 220, 220, 221, 222, 223, 224, 225, 226, - 226, 227, 228, 228, 228, 229, 229, 229, 230, 230, - 230, 231, 232, 233, 234, 235, 236, 237, 238, 239, - 240, 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, 277, 278, 279, 280, 281, 282, - 283, 284, 286, 287, 288, 289, 290, 291, 292, 293, - 294, 295, 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 + 99, 101, 104, 107, 109, 112, 115, 118, 121, 124, + 126, 128, 130, 133, 136, 139, 142, 145, 148, 151, + 154, 157, 160, 163, 166, 169, 172, 175, 179, 182, + 185, 188, 191, 195, 198, 201, 204, 207, 211, 214, + 215, 215, 215, 215, 215, 215, 215, 215, 216, 216, + + 217, 217, 217, 217, 217, 217, 218, 218, 219, 219, + 219, 220, 221, 222, 223, 223, 223, 224, 224, 224, + 225, 226, 227, 228, 229, 230, 231, 231, 232, 232, + 232, 232, 233, 234, 235, 236, 237, 238, 239, 240, + 241, 242, 243, 244, 245, 246, 247, 248, 249, 250, + 251, 252, 252, 252, 252, 253, 253, 254, 254, 254, + 254, 255, 256, 256, 258, 259, 260, 260, 261, 261, + 261, 261, 262, 262, 262, 263, 263, 263, 263, 263, + 264, 264, 264, 264, 265, 266, 266, 267, 267, 268, + 268, 269, 270, 271, 272, 273, 274, 275, 276, 277, + + 278, 278, 278, 279, 279, 279, 280, 281, 282, 283, + 284, 285, 286, 288, 289, 290, 291, 292, 293, 294, + 295, 296, 297, 298, 299, 300, 300, 301, 301, 301, + 302, 302, 303, 304, 304, 304, 304, 305, 306, 307, + 307, 308, 309, 311, 313, 313, 314, 315, 317, 318, + 319, 320, 322, 323, 325, 326, 327, 328, 329, 330, + 331, 332, 333, 334, 335, 337, 337, 338, 338, 338, + 339, 339, 339, 339, 339, 339, 339, 340, 342, 344, + 345, 347, 348, 349, 350, 351, 353, 354, 355, 356, + 358, 359, 360, 360, 360, 360, 360, 360, 360, 361, + + 362, 364, 365, 366, 367, 369, 371, 373, 375, 376, + 377, 377, 377, 377, 377, 377, 378, 379, 380, 382, + 383, 384, 386, 386, 386, 386, 386, 386, 388, 389, + 391, 392, 394, 394, 394, 394, 394, 394, 394, 396, + 398, 398, 398, 398, 399, 399, 399, 399, 399, 400, + 400, 400, 400, 400, 400, 400, 401, 401 } ; static yyconst int yy_ec[256] = @@ -419,200 +419,200 @@ static yyconst int yy_meta[55] = 7, 7, 1, 1 } ; -static yyconst short int yy_base[383] = +static yyconst short int yy_base[384] = { 0, 0, 4, 7, 13, 17, 69, 24, 36, 123, 0, 165, 0, 31, 52, 48, 77, 55, 81, 848, 849, 849, 849, 849, 1, 807, 42, 56, 811, 849, 849, 849, 831, 817, 849, 849, 849, 849, 57, 10, 0, - 849, 849, 27, 789, 849, 849, 849, 849, 0, 78, - 0, 823, 22, 49, 77, 849, 86, 93, 171, 101, - 209, 171, 173, 26, 55, 72, 178, 187, 172, 183, - 202, 191, 209, 849, 849, 849, 849, 827, 232, 233, - 849, 849, 826, 241, 252, 836, 835, 228, 849, 834, - 805, 254, 800, 220, 210, 75, 849, 789, 849, 0, - - 824, 243, 823, 822, 849, 827, 849, 260, 787, 849, - 849, 849, 825, 808, 807, 806, 17, 232, 242, 811, - 254, 811, 819, 261, 267, 273, 0, 288, 277, 791, - 792, 166, 30, 89, 268, 279, 283, 290, 289, 292, - 294, 296, 175, 293, 301, 295, 303, 297, 305, 849, - 343, 316, 344, 849, 349, 849, 351, 355, 359, 849, - 363, 805, 849, 849, 849, 815, 849, 770, 776, 762, - 849, 783, 760, 849, 759, 772, 761, 783, 849, 799, - 798, 797, 849, 849, 802, 849, 771, 800, 849, 783, - 782, 781, 312, 351, 352, 849, 357, 374, 796, 849, - - 365, 0, 768, 370, 359, 365, 370, 371, 298, 372, - 374, 778, 375, 376, 377, 378, 379, 382, 383, 384, - 387, 385, 388, 306, 418, 849, 749, 361, 849, 761, - 849, 849, 744, 754, 767, 849, 849, 849, 751, 771, - 391, 770, 769, 429, 849, 410, 768, 396, 397, 416, - 767, 420, 766, 421, 422, 423, 425, 427, 428, 429, - 430, 433, 431, 765, 452, 849, 471, 476, 849, 740, - 747, 750, 734, 0, 730, 442, 441, 759, 447, 758, - 446, 450, 464, 467, 757, 465, 468, 469, 756, 452, - 470, 730, 727, 724, 736, 742, 723, 472, 474, 723, - - 476, 477, 480, 722, 716, 713, 674, 484, 485, 458, - 644, 619, 648, 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, 849, 535, 233, 554, 542, 849, 160, 560, - 60, 564, 581, 585, 849, 849, 599, 607, 615, 623, - 631, 639, 647, 655, 663, 666, 670, 674, 682, 690, - 698, 706, 711, 715, 722, 727, 730, 737, 741, 747, - 754, 762 + 849, 849, 27, 789, 849, 849, 849, 849, 0, 86, + 78, 168, 99, 0, 823, 22, 49, 80, 849, 174, + 93, 206, 50, 187, 78, 161, 176, 169, 183, 163, + 188, 209, 175, 210, 849, 849, 849, 849, 827, 230, + 236, 849, 849, 826, 249, 253, 836, 835, 105, 849, + 834, 805, 238, 800, 220, 211, 206, 849, 789, 849, + + 0, 824, 225, 823, 822, 849, 827, 849, 261, 787, + 849, 849, 254, 849, 825, 259, 270, 276, 0, 286, + 808, 807, 806, 17, 262, 243, 811, 811, 819, 280, + 791, 792, 271, 30, 214, 287, 288, 290, 292, 26, + 294, 293, 295, 178, 297, 296, 298, 302, 299, 303, + 849, 318, 322, 345, 849, 349, 849, 341, 353, 357, + 849, 361, 805, 849, 849, 849, 815, 849, 770, 776, + 762, 849, 783, 760, 849, 759, 772, 761, 783, 849, + 799, 798, 797, 849, 849, 802, 849, 771, 353, 800, + 849, 357, 0, 783, 782, 781, 338, 72, 342, 849, + + 374, 796, 849, 768, 365, 359, 365, 367, 368, 300, + 369, 371, 778, 372, 373, 374, 375, 377, 379, 378, + 380, 384, 382, 385, 388, 429, 849, 749, 278, 849, + 761, 849, 849, 744, 754, 767, 849, 849, 849, 751, + 771, 381, 770, 769, 433, 849, 399, 768, 394, 397, + 386, 767, 411, 766, 393, 418, 423, 424, 425, 431, + 87, 427, 428, 432, 765, 450, 849, 465, 469, 849, + 740, 747, 750, 734, 0, 730, 441, 435, 759, 442, + 758, 456, 437, 445, 460, 757, 461, 463, 464, 756, + 468, 469, 725, 715, 698, 710, 716, 686, 471, 470, + + 678, 472, 473, 475, 664, 651, 643, 580, 479, 477, + 451, 563, 550, 586, 560, 483, 484, 486, 575, 492, + 488, 574, 549, 553, 514, 508, 527, 570, 501, 559, + 496, 549, 522, 519, 532, 523, 540, 522, 534, 516, + 502, 546, 554, 849, 539, 423, 558, 546, 849, 371, + 564, 234, 568, 585, 541, 849, 849, 603, 611, 619, + 627, 635, 643, 651, 659, 667, 670, 674, 678, 686, + 694, 702, 710, 715, 718, 722, 729, 734, 741, 745, + 751, 758, 766 } ; -static yyconst short int yy_def[383] = +static yyconst short int yy_def[384] = { 0, - 357, 357, 358, 358, 359, 359, 360, 360, 356, 9, - 9, 11, 361, 361, 362, 362, 363, 363, 356, 356, - 356, 356, 356, 356, 356, 356, 356, 356, 356, 356, - 356, 356, 356, 356, 356, 356, 356, 356, 356, 364, - 356, 356, 356, 356, 356, 356, 356, 356, 365, 356, - 366, 367, 367, 367, 367, 356, 356, 356, 356, 356, - 368, 367, 367, 367, 367, 367, 367, 367, 367, 367, - 367, 367, 367, 356, 356, 356, 356, 356, 356, 356, - 356, 356, 356, 356, 356, 356, 356, 356, 356, 369, - 356, 356, 356, 356, 356, 356, 356, 356, 356, 370, - - 356, 356, 356, 356, 356, 371, 356, 356, 356, 356, - 356, 356, 372, 373, 367, 374, 367, 367, 367, 356, - 356, 356, 375, 356, 356, 356, 376, 356, 356, 377, - 356, 367, 367, 367, 367, 367, 367, 367, 367, 367, - 367, 367, 367, 367, 367, 367, 367, 367, 367, 356, - 356, 356, 356, 356, 378, 356, 356, 356, 356, 356, - 356, 356, 356, 356, 356, 369, 356, 356, 356, 356, - 356, 356, 356, 356, 356, 356, 356, 356, 356, 356, - 356, 356, 356, 356, 371, 356, 356, 372, 356, 373, - 379, 374, 367, 367, 367, 356, 356, 356, 375, 356, - - 356, 376, 377, 368, 367, 367, 367, 367, 367, 367, - 367, 367, 367, 367, 367, 367, 367, 367, 367, 367, - 367, 367, 367, 367, 380, 356, 356, 356, 356, 356, - 356, 356, 356, 356, 356, 356, 356, 356, 356, 379, - 367, 367, 367, 356, 356, 367, 367, 367, 367, 367, - 367, 367, 367, 367, 367, 367, 367, 367, 367, 367, - 367, 367, 367, 367, 356, 356, 380, 356, 356, 356, - 356, 356, 356, 381, 356, 367, 367, 367, 367, 367, - 367, 367, 367, 367, 367, 367, 367, 367, 367, 367, - 367, 356, 356, 356, 356, 356, 356, 367, 367, 367, - - 367, 367, 367, 367, 367, 367, 367, 367, 367, 356, - 356, 356, 356, 356, 367, 367, 367, 367, 367, 367, - 367, 356, 356, 356, 356, 356, 367, 367, 367, 367, - 367, 356, 356, 356, 356, 356, 356, 367, 367, 356, - 356, 356, 356, 382, 356, 356, 382, 356, 356, 356, - 356, 356, 356, 356, 356, 0, 356, 356, 356, 356, - 356, 356, 356, 356, 356, 356, 356, 356, 356, 356, - 356, 356, 356, 356, 356, 356, 356, 356, 356, 356, - 356, 356 + 358, 358, 359, 359, 360, 360, 361, 361, 357, 9, + 9, 11, 362, 362, 363, 363, 364, 364, 357, 357, + 357, 357, 357, 357, 357, 357, 357, 357, 357, 357, + 357, 357, 357, 357, 357, 357, 357, 357, 357, 365, + 357, 357, 357, 357, 357, 357, 357, 357, 366, 357, + 357, 357, 357, 367, 368, 368, 368, 368, 357, 357, + 357, 369, 368, 368, 368, 368, 368, 368, 368, 368, + 368, 368, 368, 368, 357, 357, 357, 357, 357, 357, + 357, 357, 357, 357, 357, 357, 357, 357, 357, 357, + 370, 357, 357, 357, 357, 357, 357, 357, 357, 357, + + 371, 357, 357, 357, 357, 357, 372, 357, 357, 357, + 357, 357, 357, 357, 373, 357, 357, 357, 374, 357, + 375, 368, 376, 368, 368, 368, 357, 357, 377, 357, + 378, 357, 368, 368, 368, 368, 368, 368, 368, 368, + 368, 368, 368, 368, 368, 368, 368, 368, 368, 368, + 357, 357, 357, 357, 357, 379, 357, 357, 357, 357, + 357, 357, 357, 357, 357, 357, 370, 357, 357, 357, + 357, 357, 357, 357, 357, 357, 357, 357, 357, 357, + 357, 357, 357, 357, 357, 372, 357, 357, 357, 373, + 357, 357, 374, 375, 380, 376, 368, 368, 368, 357, + + 357, 377, 357, 378, 369, 368, 368, 368, 368, 368, + 368, 368, 368, 368, 368, 368, 368, 368, 368, 368, + 368, 368, 368, 368, 368, 381, 357, 357, 357, 357, + 357, 357, 357, 357, 357, 357, 357, 357, 357, 357, + 380, 368, 368, 368, 357, 357, 368, 368, 368, 368, + 368, 368, 368, 368, 368, 368, 368, 368, 368, 368, + 368, 368, 368, 368, 368, 357, 357, 381, 357, 357, + 357, 357, 357, 357, 382, 357, 368, 368, 368, 368, + 368, 368, 368, 368, 368, 368, 368, 368, 368, 368, + 368, 368, 357, 357, 357, 357, 357, 357, 368, 368, + + 368, 368, 368, 368, 368, 368, 368, 368, 368, 368, + 357, 357, 357, 357, 357, 368, 368, 368, 368, 368, + 368, 368, 357, 357, 357, 357, 357, 368, 368, 368, + 368, 368, 357, 357, 357, 357, 357, 357, 368, 368, + 357, 357, 357, 357, 383, 357, 357, 383, 357, 357, + 357, 357, 357, 357, 357, 357, 0, 357, 357, 357, + 357, 357, 357, 357, 357, 357, 357, 357, 357, 357, + 357, 357, 357, 357, 357, 357, 357, 357, 357, 357, + 357, 357, 357 } ; static yyconst short int yy_nxt[904] = { 0, - 356, 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, 193, 116, 28, - 22, 82, 49, 79, 22, 77, 79, 22, 87, 83, - 206, 117, 101, 80, 49, 109, 88, 116, 136, 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, 137, 40, 120, 96, - - 121, 121, 121, 121, 122, 175, 123, 116, 97, 103, - 104, 138, 175, 124, 119, 128, 128, 128, 128, 207, - 176, 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, 351, 62, 116, 63, 64, 65, - - 66, 116, 205, 67, 68, 116, 217, 69, 70, 116, - 133, 71, 134, 72, 73, 135, 132, 74, 75, 139, - 116, 141, 127, 129, 129, 129, 129, 116, 142, 140, - 164, 143, 147, 151, 153, 154, 151, 155, 131, 144, - 145, 165, 157, 152, 172, 157, 150, 148, 180, 146, - 116, 149, 158, 159, 160, 92, 161, 173, 92, 169, - 116, 108, 174, 162, 108, 163, 349, 170, 197, 197, - 197, 197, 171, 345, 194, 201, 201, 201, 201, 124, - 195, 125, 125, 125, 126, 124, 116, 126, 126, 126, - 126, 129, 129, 129, 129, 181, 182, 116, 109, 93, - - 124, 116, 128, 128, 128, 128, 131, 116, 116, 208, - 116, 116, 116, 116, 116, 116, 116, 153, 154, 116, - 155, 116, 334, 116, 116, 334, 116, 209, 214, 250, - 116, 210, 211, 213, 215, 218, 212, 219, 216, 264, - 220, 221, 223, 224, 151, 153, 154, 151, 153, 222, - 153, 154, 157, 153, 152, 157, 159, 160, 241, 161, - 159, 160, 158, 159, 159, 160, 162, 159, 226, 116, - 116, 197, 197, 197, 197, 244, 245, 116, 244, 201, - 201, 201, 201, 116, 129, 129, 129, 129, 116, 116, - 116, 242, 116, 116, 116, 116, 116, 116, 243, 131, - - 116, 116, 116, 116, 252, 116, 116, 246, 270, 116, - 247, 253, 251, 171, 116, 116, 248, 249, 257, 265, - 266, 254, 265, 262, 259, 256, 255, 258, 116, 261, - 244, 245, 260, 244, 116, 263, 268, 243, 116, 116, - 116, 116, 277, 116, 278, 116, 116, 116, 116, 116, - 276, 116, 282, 265, 266, 279, 265, 283, 286, 116, - 116, 288, 287, 284, 116, 116, 281, 280, 116, 290, - 116, 289, 265, 266, 285, 265, 298, 265, 266, 291, - 265, 300, 116, 116, 301, 116, 116, 116, 116, 268, - 116, 299, 116, 308, 116, 116, 303, 302, 116, 304, - - 309, 306, 116, 116, 305, 322, 116, 116, 116, 317, - 174, 318, 316, 315, 116, 116, 307, 116, 320, 335, - 336, 336, 328, 331, 321, 337, 116, 319, 337, 334, - 329, 330, 334, 338, 344, 327, 342, 342, 342, 342, - 348, 339, 341, 341, 341, 341, 343, 348, 344, 116, - 342, 342, 342, 342, 346, 348, 341, 341, 341, 341, - 343, 340, 348, 173, 342, 342, 342, 342, 350, 350, - 350, 350, 352, 116, 350, 350, 350, 350, 353, 353, - 353, 353, 354, 355, 116, 354, 354, 355, 116, 354, - 333, 332, 116, 116, 326, 353, 353, 353, 353, 20, - - 20, 20, 20, 20, 20, 20, 20, 29, 29, 29, - 29, 29, 29, 29, 29, 34, 34, 34, 34, 34, - 34, 34, 34, 45, 45, 45, 45, 45, 45, 45, - 45, 76, 76, 76, 76, 76, 76, 76, 76, 81, - 81, 81, 81, 81, 81, 81, 81, 86, 86, 86, - 86, 86, 86, 86, 86, 107, 107, 325, 107, 107, - 107, 107, 107, 111, 111, 324, 111, 111, 111, 111, - 111, 114, 114, 115, 115, 115, 115, 130, 323, 130, - 130, 130, 166, 166, 166, 166, 166, 166, 166, 166, - 178, 178, 116, 178, 178, 178, 178, 178, 185, 185, - - 185, 185, 185, 185, 185, 185, 188, 188, 188, 188, - 188, 188, 188, 188, 190, 190, 190, 190, 192, 192, - 192, 192, 199, 199, 199, 199, 199, 199, 199, 199, - 202, 116, 202, 203, 116, 203, 203, 203, 225, 225, - 116, 116, 225, 225, 240, 240, 240, 240, 267, 267, - 267, 267, 267, 267, 296, 296, 314, 296, 296, 296, - 296, 296, 347, 347, 313, 347, 347, 347, 347, 347, - 312, 311, 310, 170, 116, 116, 116, 116, 297, 295, - 294, 293, 292, 116, 116, 116, 116, 116, 116, 191, - 275, 274, 273, 272, 271, 269, 116, 131, 200, 116, - - 191, 191, 189, 239, 186, 238, 237, 236, 235, 234, - 233, 232, 231, 230, 229, 228, 227, 167, 226, 204, - 131, 200, 198, 196, 116, 116, 191, 189, 187, 186, - 184, 183, 179, 177, 98, 168, 167, 164, 164, 156, - 150, 116, 110, 100, 99, 98, 91, 356, 19, 356, - 356, 356, 356, 356, 356, 356, 356, 356, 356, 356, - 356, 356, 356, 356, 356, 356, 356, 356, 356, 356, - 356, 356, 356, 356, 356, 356, 356, 356, 356, 356, - 356, 356, 356, 356, 356, 356, 356, 356, 356, 356, - 356, 356, 356, 356, 356, 356, 356, 356, 356, 356, - - 356, 356, 356 + 357, 21, 22, 23, 21, 26, 22, 23, 26, 30, + 31, 27, 90, 24, 91, 30, 31, 24, 32, 35, + 36, 106, 37, 107, 32, 38, 46, 47, 109, 48, + 39, 109, 25, 22, 78, 123, 25, 33, 46, 47, + 123, 48, 79, 93, 123, 40, 93, 197, 123, 28, + 22, 83, 49, 80, 22, 78, 80, 22, 88, 84, + 207, 124, 102, 81, 49, 110, 89, 123, 123, 41, + 42, 35, 36, 213, 37, 43, 44, 38, 85, 22, + 83, 85, 39, 22, 88, 103, 95, 94, 86, 114, + 123, 115, 89, 96, 125, 133, 123, 40, 123, 97, + + 113, 113, 113, 113, 128, 123, 129, 165, 98, 104, + 105, 116, 243, 120, 120, 120, 120, 126, 166, 289, + 137, 41, 42, 20, 21, 22, 23, 21, 20, 20, + 20, 20, 20, 20, 20, 50, 51, 52, 53, 53, + 53, 54, 20, 20, 55, 55, 55, 55, 55, 55, + 20, 20, 20, 55, 55, 56, 55, 55, 57, 55, + 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, + 58, 55, 55, 55, 55, 59, 20, 60, 61, 123, + 116, 123, 117, 117, 117, 118, 127, 123, 113, 113, + 113, 113, 62, 123, 123, 63, 123, 64, 65, 66, + + 67, 123, 138, 68, 69, 123, 123, 70, 71, 218, + 140, 72, 142, 73, 74, 139, 148, 75, 76, 119, + 130, 130, 130, 130, 134, 141, 135, 123, 123, 136, + 181, 152, 123, 143, 152, 132, 144, 154, 155, 93, + 156, 153, 93, 176, 208, 173, 145, 146, 149, 151, + 158, 177, 150, 158, 160, 161, 147, 162, 174, 170, + 159, 123, 109, 175, 163, 109, 164, 171, 189, 189, + 189, 189, 172, 192, 192, 192, 192, 182, 183, 176, + 123, 199, 116, 94, 117, 117, 117, 118, 116, 123, + 118, 118, 118, 118, 130, 130, 130, 130, 116, 110, + + 120, 120, 120, 120, 198, 123, 123, 206, 123, 132, + 123, 123, 123, 123, 123, 123, 123, 123, 123, 152, + 123, 123, 152, 154, 155, 271, 156, 215, 209, 153, + 172, 251, 220, 216, 212, 214, 210, 217, 211, 219, + 222, 225, 158, 221, 224, 158, 154, 155, 223, 154, + 154, 155, 159, 154, 160, 161, 123, 162, 160, 161, + 123, 160, 160, 161, 163, 160, 227, 189, 189, 189, + 189, 192, 192, 192, 192, 245, 246, 123, 245, 130, + 130, 130, 130, 123, 242, 123, 123, 123, 244, 123, + 123, 123, 123, 123, 132, 123, 123, 123, 123, 123, + + 123, 253, 123, 123, 123, 352, 123, 247, 254, 252, + 248, 123, 123, 249, 250, 123, 258, 123, 255, 260, + 263, 265, 257, 256, 259, 280, 262, 244, 261, 123, + 266, 267, 264, 266, 245, 246, 123, 245, 282, 277, + 278, 123, 123, 123, 279, 123, 123, 269, 283, 123, + 123, 266, 267, 123, 266, 123, 350, 284, 281, 123, + 123, 287, 285, 123, 291, 288, 266, 267, 290, 266, + 266, 267, 286, 266, 123, 299, 301, 304, 123, 123, + 292, 123, 123, 269, 303, 300, 123, 123, 123, 123, + 123, 123, 305, 123, 302, 123, 307, 123, 323, 310, + + 306, 123, 123, 175, 123, 318, 123, 319, 317, 309, + 123, 308, 316, 321, 123, 335, 322, 329, 335, 123, + 330, 332, 320, 336, 337, 337, 331, 345, 338, 340, + 328, 338, 346, 335, 123, 339, 335, 343, 343, 343, + 343, 345, 355, 356, 349, 355, 342, 342, 342, 342, + 344, 349, 123, 341, 343, 343, 343, 343, 347, 349, + 342, 342, 342, 342, 344, 174, 349, 123, 343, 343, + 343, 343, 351, 351, 351, 351, 353, 123, 351, 351, + 351, 351, 354, 354, 354, 354, 355, 356, 123, 355, + 334, 333, 123, 123, 327, 326, 325, 324, 123, 354, + + 354, 354, 354, 20, 20, 20, 20, 20, 20, 20, + 20, 29, 29, 29, 29, 29, 29, 29, 29, 34, + 34, 34, 34, 34, 34, 34, 34, 45, 45, 45, + 45, 45, 45, 45, 45, 77, 77, 77, 77, 77, + 77, 77, 77, 82, 82, 82, 82, 82, 82, 82, + 82, 87, 87, 87, 87, 87, 87, 87, 87, 108, + 108, 123, 108, 108, 108, 108, 108, 112, 112, 123, + 112, 112, 112, 112, 112, 121, 121, 122, 122, 122, + 122, 131, 123, 131, 131, 131, 167, 167, 167, 167, + 167, 167, 167, 167, 179, 179, 123, 179, 179, 179, + + 179, 179, 186, 186, 186, 186, 186, 186, 186, 186, + 190, 190, 190, 190, 190, 190, 190, 190, 193, 315, + 193, 194, 194, 194, 194, 196, 196, 196, 196, 202, + 202, 202, 202, 202, 202, 202, 202, 204, 314, 204, + 204, 204, 226, 226, 313, 312, 226, 226, 241, 241, + 241, 241, 268, 268, 268, 268, 268, 268, 297, 297, + 311, 297, 297, 297, 297, 297, 348, 348, 171, 348, + 348, 348, 348, 348, 123, 123, 123, 123, 298, 296, + 295, 294, 293, 123, 123, 123, 123, 123, 123, 195, + 276, 275, 274, 273, 272, 270, 123, 132, 203, 123, + + 195, 195, 191, 240, 187, 239, 238, 237, 236, 235, + 234, 233, 232, 231, 230, 229, 228, 168, 227, 205, + 132, 203, 201, 200, 123, 123, 195, 191, 188, 187, + 185, 184, 180, 178, 99, 169, 168, 165, 165, 157, + 151, 123, 111, 101, 100, 99, 92, 357, 19, 357, + 357, 357, 357, 357, 357, 357, 357, 357, 357, 357, + 357, 357, 357, 357, 357, 357, 357, 357, 357, 357, + 357, 357, 357, 357, 357, 357, 357, 357, 357, 357, + 357, 357, 357, 357, 357, 357, 357, 357, 357, 357, + 357, 357, 357, 357, 357, 357, 357, 357, 357, 357, + + 357, 357, 357 } ; static yyconst short int yy_chk[904] = @@ -620,103 +620,103 @@ static yyconst short int yy_chk[904] = 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, 133, 2, + 5, 43, 1, 13, 13, 124, 2, 4, 8, 8, + 56, 8, 13, 26, 140, 5, 26, 124, 134, 2, 15, 15, 7, 14, 14, 14, 14, 17, 17, 15, - 133, 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, 351, 58, 134, 27, 38, - 38, 66, 96, 60, 55, 60, 60, 60, 60, 134, - 96, 6, 6, 9, 9, 9, 9, 9, 9, 9, + 134, 56, 38, 14, 8, 43, 17, 57, 63, 5, + 5, 6, 6, 140, 6, 6, 6, 6, 16, 16, + 16, 16, 6, 18, 18, 38, 27, 26, 16, 51, + 198, 51, 18, 27, 57, 63, 65, 6, 58, 27, + + 50, 50, 50, 50, 61, 261, 61, 89, 27, 38, + 38, 53, 198, 53, 53, 53, 53, 58, 89, 261, + 65, 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, 9, 9, 9, 9, 11, 11, 11, - 11, 11, 11, 59, 132, 59, 59, 59, 59, 62, - 69, 63, 11, 143, 349, 11, 67, 11, 11, 11, - - 11, 70, 132, 11, 11, 68, 143, 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, 345, 94, 121, 121, - 121, 121, 94, 340, 118, 124, 124, 124, 124, 125, - 119, 125, 125, 125, 125, 126, 135, 126, 126, 126, - 126, 129, 129, 129, 129, 102, 102, 136, 108, 92, - - 128, 137, 128, 128, 128, 128, 129, 139, 138, 135, - 140, 144, 141, 146, 142, 148, 209, 152, 152, 145, - 152, 147, 324, 149, 224, 324, 339, 136, 141, 209, - 193, 137, 138, 140, 142, 144, 139, 145, 142, 224, - 146, 147, 148, 149, 151, 153, 153, 151, 153, 147, - 155, 155, 157, 155, 151, 157, 158, 158, 193, 158, - 159, 159, 157, 159, 161, 161, 158, 161, 158, 194, - 195, 197, 197, 197, 197, 198, 198, 205, 198, 201, - 201, 201, 201, 206, 204, 204, 204, 204, 207, 208, - 210, 194, 211, 213, 214, 215, 216, 217, 195, 204, - - 218, 219, 220, 222, 211, 221, 223, 205, 228, 241, - 206, 213, 210, 228, 248, 249, 207, 208, 217, 225, - 225, 214, 225, 222, 219, 216, 215, 218, 246, 221, - 244, 244, 220, 244, 250, 223, 225, 241, 252, 254, - 255, 256, 248, 257, 249, 258, 259, 260, 261, 263, - 246, 262, 255, 265, 265, 250, 265, 256, 259, 277, - 276, 260, 259, 257, 281, 279, 254, 252, 282, 262, - 290, 261, 267, 267, 258, 267, 276, 268, 268, 263, - 268, 279, 283, 286, 281, 284, 287, 288, 291, 267, - 298, 277, 299, 290, 301, 302, 283, 282, 303, 284, - - 291, 287, 308, 309, 286, 310, 315, 316, 320, 301, - 310, 302, 299, 298, 317, 319, 288, 328, 308, 325, - 325, 325, 316, 320, 309, 326, 330, 303, 326, 334, - 317, 319, 334, 328, 337, 315, 335, 335, 335, 335, - 344, 330, 334, 334, 334, 334, 336, 347, 337, 338, - 336, 336, 336, 336, 341, 344, 341, 341, 341, 341, - 342, 333, 347, 332, 342, 342, 342, 342, 346, 346, - 346, 346, 350, 331, 350, 350, 350, 350, 352, 352, - 352, 352, 353, 353, 329, 353, 354, 354, 327, 354, - 323, 322, 321, 318, 314, 353, 353, 353, 353, 357, - - 357, 357, 357, 357, 357, 357, 357, 358, 358, 358, - 358, 358, 358, 358, 358, 359, 359, 359, 359, 359, - 359, 359, 359, 360, 360, 360, 360, 360, 360, 360, - 360, 361, 361, 361, 361, 361, 361, 361, 361, 362, - 362, 362, 362, 362, 362, 362, 362, 363, 363, 363, - 363, 363, 363, 363, 363, 364, 364, 313, 364, 364, - 364, 364, 364, 365, 365, 312, 365, 365, 365, 365, - 365, 366, 366, 367, 367, 367, 367, 368, 311, 368, - 368, 368, 369, 369, 369, 369, 369, 369, 369, 369, - 370, 370, 307, 370, 370, 370, 370, 370, 371, 371, - - 371, 371, 371, 371, 371, 371, 372, 372, 372, 372, - 372, 372, 372, 372, 373, 373, 373, 373, 374, 374, - 374, 374, 375, 375, 375, 375, 375, 375, 375, 375, - 376, 306, 376, 377, 305, 377, 377, 377, 378, 378, - 304, 300, 378, 378, 379, 379, 379, 379, 380, 380, - 380, 380, 380, 380, 381, 381, 297, 381, 381, 381, - 381, 381, 382, 382, 296, 382, 382, 382, 382, 382, - 295, 294, 293, 292, 289, 285, 280, 278, 275, 273, - 272, 271, 270, 264, 253, 251, 247, 243, 242, 240, - 239, 235, 234, 233, 230, 227, 212, 203, 199, 192, - - 191, 190, 188, 187, 185, 182, 181, 180, 178, 177, - 176, 175, 173, 172, 170, 169, 168, 166, 162, 131, - 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, 356, 356, - 356, 356, 356, 356, 356, 356, 356, 356, 356, 356, - 356, 356, 356, 356, 356, 356, 356, 356, 356, 356, - 356, 356, 356, 356, 356, 356, 356, 356, 356, 356, - 356, 356, 356, 356, 356, 356, 356, 356, 356, 356, - 356, 356, 356, 356, 356, 356, 356, 356, 356, 356, - - 356, 356, 356 + 9, 9, 9, 9, 9, 9, 9, 11, 11, 66, + 52, 70, 52, 52, 52, 52, 60, 68, 60, 60, + 60, 60, 11, 73, 67, 11, 144, 11, 11, 11, + + 11, 69, 66, 11, 11, 64, 71, 11, 11, 144, + 68, 11, 70, 11, 11, 67, 73, 11, 11, 52, + 62, 62, 62, 62, 64, 69, 64, 72, 74, 64, + 103, 80, 135, 71, 80, 62, 71, 81, 81, 93, + 81, 80, 93, 97, 135, 96, 72, 72, 74, 81, + 85, 97, 74, 85, 86, 86, 72, 86, 96, 95, + 85, 126, 109, 96, 86, 109, 86, 95, 113, 113, + 113, 113, 95, 116, 116, 116, 116, 103, 103, 352, + 125, 126, 117, 93, 117, 117, 117, 117, 118, 133, + 118, 118, 118, 118, 130, 130, 130, 130, 120, 109, + + 120, 120, 120, 120, 125, 136, 137, 133, 138, 130, + 139, 142, 141, 143, 146, 145, 147, 149, 210, 152, + 148, 150, 152, 153, 153, 229, 153, 142, 136, 152, + 229, 210, 146, 143, 139, 141, 137, 143, 138, 145, + 148, 150, 158, 147, 149, 158, 154, 154, 148, 154, + 156, 156, 158, 156, 159, 159, 197, 159, 160, 160, + 199, 160, 162, 162, 159, 162, 159, 189, 189, 189, + 189, 192, 192, 192, 192, 201, 201, 206, 201, 205, + 205, 205, 205, 207, 197, 208, 209, 211, 199, 212, + 214, 215, 216, 217, 205, 218, 220, 219, 221, 242, + + 223, 212, 222, 224, 251, 350, 225, 206, 214, 211, + 207, 255, 249, 208, 209, 250, 218, 247, 215, 220, + 223, 225, 217, 216, 219, 251, 222, 242, 221, 253, + 226, 226, 224, 226, 245, 245, 256, 245, 255, 247, + 249, 257, 258, 259, 250, 262, 263, 226, 256, 260, + 264, 266, 266, 278, 266, 283, 346, 257, 253, 277, + 280, 260, 258, 284, 263, 260, 268, 268, 262, 268, + 269, 269, 259, 269, 282, 277, 280, 284, 285, 287, + 264, 288, 289, 268, 283, 278, 291, 292, 300, 299, + 302, 303, 285, 304, 282, 310, 288, 309, 311, 292, + + 287, 316, 317, 311, 318, 302, 321, 303, 300, 291, + 320, 289, 299, 309, 331, 325, 310, 317, 325, 329, + 318, 321, 304, 326, 326, 326, 320, 338, 327, 331, + 316, 327, 341, 335, 340, 329, 335, 336, 336, 336, + 336, 338, 355, 355, 345, 355, 335, 335, 335, 335, + 337, 348, 339, 334, 337, 337, 337, 337, 342, 345, + 342, 342, 342, 342, 343, 333, 348, 332, 343, 343, + 343, 343, 347, 347, 347, 347, 351, 330, 351, 351, + 351, 351, 353, 353, 353, 353, 354, 354, 328, 354, + 324, 323, 322, 319, 315, 314, 313, 312, 308, 354, + + 354, 354, 354, 358, 358, 358, 358, 358, 358, 358, + 358, 359, 359, 359, 359, 359, 359, 359, 359, 360, + 360, 360, 360, 360, 360, 360, 360, 361, 361, 361, + 361, 361, 361, 361, 361, 362, 362, 362, 362, 362, + 362, 362, 362, 363, 363, 363, 363, 363, 363, 363, + 363, 364, 364, 364, 364, 364, 364, 364, 364, 365, + 365, 307, 365, 365, 365, 365, 365, 366, 366, 306, + 366, 366, 366, 366, 366, 367, 367, 368, 368, 368, + 368, 369, 305, 369, 369, 369, 370, 370, 370, 370, + 370, 370, 370, 370, 371, 371, 301, 371, 371, 371, + + 371, 371, 372, 372, 372, 372, 372, 372, 372, 372, + 373, 373, 373, 373, 373, 373, 373, 373, 374, 298, + 374, 375, 375, 375, 375, 376, 376, 376, 376, 377, + 377, 377, 377, 377, 377, 377, 377, 378, 297, 378, + 378, 378, 379, 379, 296, 295, 379, 379, 380, 380, + 380, 380, 381, 381, 381, 381, 381, 381, 382, 382, + 294, 382, 382, 382, 382, 382, 383, 383, 293, 383, + 383, 383, 383, 383, 290, 286, 281, 279, 276, 274, + 273, 272, 271, 265, 254, 252, 248, 244, 243, 241, + 240, 236, 235, 234, 231, 228, 213, 204, 202, 196, + + 195, 194, 190, 188, 186, 183, 182, 181, 179, 178, + 177, 176, 174, 173, 171, 170, 169, 167, 163, 132, + 131, 129, 128, 127, 123, 122, 121, 115, 110, 107, + 105, 104, 102, 99, 94, 92, 91, 88, 87, 84, + 79, 55, 44, 33, 32, 28, 25, 19, 357, 357, + 357, 357, 357, 357, 357, 357, 357, 357, 357, 357, + 357, 357, 357, 357, 357, 357, 357, 357, 357, 357, + 357, 357, 357, 357, 357, 357, 357, 357, 357, 357, + 357, 357, 357, 357, 357, 357, 357, 357, 357, 357, + 357, 357, 357, 357, 357, 357, 357, 357, 357, 357, + + 357, 357, 357 } ; static yy_state_type yy_state_buf[YY_BUF_SIZE + 2], *yy_state_ptr; @@ -818,6 +818,10 @@ add_gtk_doc_func(void) gtk_doc_func = NULL; } +/* Ugly warning avoiding */ +#ifdef FLEX_SCANNER +int yylex(void); +#endif #define COMMENT 1 @@ -835,7 +839,7 @@ add_gtk_doc_func(void) #define GTK_DOC_LINE 8 -#line 839 "lex.yy.c" +#line 843 "lex.yy.c" /* Macros after this point can all be overridden by user definitions in * section 1. @@ -989,10 +993,10 @@ YY_DECL register char *yy_cp = NULL, *yy_bp = NULL; register int yy_act; -#line 98 "lexer.l" +#line 102 "lexer.l" -#line 996 "lex.yy.c" +#line 1000 "lex.yy.c" if ( yy_init ) { @@ -1041,7 +1045,7 @@ 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 >= 357 ) + if ( yy_current_state >= 358 ) yy_c = yy_meta[(unsigned int) yy_c]; } yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; @@ -1079,7 +1083,7 @@ do_action: /* This label is used only to access EOF actions. */ { /* beginning of action switch */ case 1: YY_RULE_SETUP -#line 100 "lexer.l" +#line 104 "lexer.l" { line_no++; REJECT; } YY_BREAK case 2: @@ -1087,7 +1091,7 @@ case 2: yy_c_buf_p = yy_cp -= 1; YY_DO_BEFORE_ACTION; /* set up yytext again */ YY_RULE_SETUP -#line 102 "lexer.l" +#line 106 "lexer.l" { /* Thy evil easter egg */ #define QQ(x) long x @@ -1115,12 +1119,12 @@ case 3: yy_c_buf_p = yy_cp -= 1; YY_DO_BEFORE_ACTION; /* set up yytext again */ YY_RULE_SETUP -#line 124 "lexer.l" +#line 128 "lexer.l" { ; /*comment, ignore*/ } YY_BREAK case 4: YY_RULE_SETUP -#line 125 "lexer.l" +#line 129 "lexer.l" { if(look_for_includes==1) { char *p; @@ -1143,7 +1147,7 @@ case 5: yy_c_buf_p = yy_cp -= 1; YY_DO_BEFORE_ACTION; /* set up yytext again */ YY_RULE_SETUP -#line 142 "lexer.l" +#line 146 "lexer.l" { /* eat out gtk doc stuff */ BEGIN(GTK_DOC_BEFORE_NAME); @@ -1155,7 +1159,7 @@ case 6: yy_c_buf_p = yy_cp -= 1; YY_DO_BEFORE_ACTION; /* set up yytext again */ YY_RULE_SETUP -#line 147 "lexer.l" +#line 151 "lexer.l" { /* empty doc lines */ ; @@ -1166,7 +1170,7 @@ case 7: yy_c_buf_p = yy_cp -= 1; YY_DO_BEFORE_ACTION; /* set up yytext again */ YY_RULE_SETUP -#line 151 "lexer.l" +#line 155 "lexer.l" { char *p; BEGIN(GTK_DOC); @@ -1180,14 +1184,14 @@ YY_RULE_SETUP YY_BREAK case 8: YY_RULE_SETUP -#line 161 "lexer.l" +#line 165 "lexer.l" { BEGIN(CLASS_CODE_I); } YY_BREAK case 9: YY_RULE_SETUP -#line 164 "lexer.l" +#line 168 "lexer.l" { BEGIN(COMMENT); before_comment = CLASS_CODE_I; @@ -1198,7 +1202,7 @@ case 10: yy_c_buf_p = yy_cp -= 1; YY_DO_BEFORE_ACTION; /* set up yytext again */ YY_RULE_SETUP -#line 168 "lexer.l" +#line 172 "lexer.l" { /* empty doc lines */ add_to_cbuf(" *\n"); @@ -1206,7 +1210,7 @@ YY_RULE_SETUP YY_BREAK case 11: YY_RULE_SETUP -#line 172 "lexer.l" +#line 176 "lexer.l" { BEGIN(CLASS_CODE_I); add_gtk_doc_func(); @@ -1214,7 +1218,7 @@ YY_RULE_SETUP YY_BREAK case 12: YY_RULE_SETUP -#line 176 "lexer.l" +#line 180 "lexer.l" { fflush(stdout); add_to_cbuf(" * "); @@ -1223,14 +1227,14 @@ YY_RULE_SETUP YY_BREAK case 13: YY_RULE_SETUP -#line 181 "lexer.l" +#line 185 "lexer.l" { BEGIN(CLASS_CODE_I); } YY_BREAK case 14: YY_RULE_SETUP -#line 184 "lexer.l" +#line 188 "lexer.l" { BEGIN(COMMENT); before_comment = CLASS_CODE_I; @@ -1238,7 +1242,7 @@ YY_RULE_SETUP YY_BREAK case 15: YY_RULE_SETUP -#line 188 "lexer.l" +#line 192 "lexer.l" { BEGIN(CLASS_CODE_I); add_to_cbuf("\n"); @@ -1250,7 +1254,7 @@ case 16: yy_c_buf_p = yy_cp -= 1; YY_DO_BEFORE_ACTION; /* set up yytext again */ YY_RULE_SETUP -#line 193 "lexer.l" +#line 197 "lexer.l" { BEGIN(GTK_DOC); add_to_cbuf(yytext); @@ -1259,7 +1263,7 @@ YY_RULE_SETUP YY_BREAK case 17: YY_RULE_SETUP -#line 198 "lexer.l" +#line 202 "lexer.l" { fflush(stdout); add_to_cbuf(yytext); @@ -1270,7 +1274,7 @@ case 18: yy_c_buf_p = yy_cp -= 1; YY_DO_BEFORE_ACTION; /* set up yytext again */ YY_RULE_SETUP -#line 203 "lexer.l" +#line 207 "lexer.l" { add_to_cbuf(yytext); /*comment, ignore*/ } YY_BREAK case 19: @@ -1278,7 +1282,7 @@ case 19: yy_c_buf_p = yy_cp -= 1; YY_DO_BEFORE_ACTION; /* set up yytext again */ YY_RULE_SETUP -#line 204 "lexer.l" +#line 208 "lexer.l" { ; /*comment, ignore*/ } YY_BREAK case 20: @@ -1286,17 +1290,17 @@ case 20: yy_c_buf_p = yy_cp -= 1; YY_DO_BEFORE_ACTION; /* set up yytext again */ YY_RULE_SETUP -#line 205 "lexer.l" +#line 209 "lexer.l" { ; /*comment, ignore*/ } YY_BREAK case 21: YY_RULE_SETUP -#line 206 "lexer.l" +#line 210 "lexer.l" {BEGIN(COMMENT); before_comment = INITIAL; } YY_BREAK case 22: YY_RULE_SETUP -#line 207 "lexer.l" +#line 211 "lexer.l" { add_to_cbuf(yytext); BEGIN(COMMENT); @@ -1305,17 +1309,17 @@ YY_RULE_SETUP YY_BREAK case 23: YY_RULE_SETUP -#line 212 "lexer.l" +#line 216 "lexer.l" {BEGIN(COMMENT); before_comment = CLASS_CODE; } YY_BREAK case 24: YY_RULE_SETUP -#line 213 "lexer.l" +#line 217 "lexer.l" {BEGIN(COMMENT); before_comment = CLASS_CODE_I; } YY_BREAK case 25: YY_RULE_SETUP -#line 214 "lexer.l" +#line 218 "lexer.l" { if(before_comment == C_CODE) add_to_cbuf(yytext); BEGIN(before_comment); @@ -1323,7 +1327,7 @@ YY_RULE_SETUP YY_BREAK case 26: YY_RULE_SETUP -#line 218 "lexer.l" +#line 222 "lexer.l" { /* comment, ignore */ if(before_comment == C_CODE) add_to_cbuf(yytext); @@ -1331,7 +1335,7 @@ YY_RULE_SETUP YY_BREAK case 27: YY_RULE_SETUP -#line 222 "lexer.l" +#line 226 "lexer.l" { /* comment, ignore */ if(before_comment == C_CODE) add_to_cbuf(yytext); @@ -1339,7 +1343,7 @@ YY_RULE_SETUP YY_BREAK case 28: YY_RULE_SETUP -#line 227 "lexer.l" +#line 231 "lexer.l" { BEGIN(C_CODE); parenth_depth = 1; @@ -1351,7 +1355,7 @@ YY_RULE_SETUP YY_BREAK case 29: YY_RULE_SETUP -#line 235 "lexer.l" +#line 239 "lexer.l" { BEGIN(C_CODE); parenth_depth = 1; @@ -1363,7 +1367,7 @@ YY_RULE_SETUP YY_BREAK case 30: YY_RULE_SETUP -#line 244 "lexer.l" +#line 248 "lexer.l" { BEGIN(C_CODE); parenth_depth = 1; @@ -1375,7 +1379,7 @@ YY_RULE_SETUP YY_BREAK case 31: YY_RULE_SETUP -#line 252 "lexer.l" +#line 256 "lexer.l" { BEGIN(C_CODE); parenth_depth = 1; @@ -1387,7 +1391,7 @@ YY_RULE_SETUP YY_BREAK case 32: YY_RULE_SETUP -#line 260 "lexer.l" +#line 264 "lexer.l" { BEGIN(C_CODE); parenth_depth = 1; @@ -1399,7 +1403,7 @@ YY_RULE_SETUP YY_BREAK case 33: YY_RULE_SETUP -#line 268 "lexer.l" +#line 272 "lexer.l" { BEGIN(C_CODE); parenth_depth = 1; @@ -1413,7 +1417,7 @@ YY_RULE_SETUP YY_BREAK case 34: YY_RULE_SETUP -#line 278 "lexer.l" +#line 282 "lexer.l" { BEGIN(INITIAL); yylval.cbuf = cbuf; @@ -1425,42 +1429,42 @@ YY_RULE_SETUP YY_BREAK case 35: YY_RULE_SETUP -#line 287 "lexer.l" +#line 291 "lexer.l" { add_to_cbuf(yytext); } YY_BREAK case 36: YY_RULE_SETUP -#line 288 "lexer.l" +#line 292 "lexer.l" { add_to_cbuf(yytext); } YY_BREAK case 37: YY_RULE_SETUP -#line 289 "lexer.l" +#line 293 "lexer.l" { add_to_cbuf(yytext); } YY_BREAK case 38: YY_RULE_SETUP -#line 290 "lexer.l" +#line 294 "lexer.l" { add_to_cbuf(yytext); } YY_BREAK case 39: YY_RULE_SETUP -#line 291 "lexer.l" +#line 295 "lexer.l" { add_to_cbuf(yytext); } YY_BREAK case 40: YY_RULE_SETUP -#line 292 "lexer.l" +#line 296 "lexer.l" { add_to_cbuf(yytext); } YY_BREAK case 41: YY_RULE_SETUP -#line 294 "lexer.l" +#line 298 "lexer.l" { add_to_cbuf(yytext); } YY_BREAK case 42: YY_RULE_SETUP -#line 295 "lexer.l" +#line 299 "lexer.l" { BEGIN(C_CODE_STRING); add_to_cbuf(yytext); @@ -1468,12 +1472,12 @@ YY_RULE_SETUP YY_BREAK case 43: YY_RULE_SETUP -#line 299 "lexer.l" +#line 303 "lexer.l" { add_to_cbuf(yytext); } YY_BREAK case 44: YY_RULE_SETUP -#line 300 "lexer.l" +#line 304 "lexer.l" { BEGIN(C_CODE); add_to_cbuf(yytext); @@ -1481,17 +1485,17 @@ YY_RULE_SETUP YY_BREAK case 45: YY_RULE_SETUP -#line 304 "lexer.l" +#line 308 "lexer.l" { add_to_cbuf(yytext); } YY_BREAK case 46: YY_RULE_SETUP -#line 305 "lexer.l" +#line 309 "lexer.l" { add_to_cbuf(yytext); } YY_BREAK case 47: YY_RULE_SETUP -#line 307 "lexer.l" +#line 311 "lexer.l" { parenth_depth++; add_to_cbuf(yytext); @@ -1499,7 +1503,7 @@ YY_RULE_SETUP YY_BREAK case 48: YY_RULE_SETUP -#line 311 "lexer.l" +#line 315 "lexer.l" { parenth_depth--; if(parenth_depth<0) { @@ -1515,17 +1519,17 @@ YY_RULE_SETUP YY_BREAK case 49: YY_RULE_SETUP -#line 324 "lexer.l" +#line 328 "lexer.l" { add_to_cbuf(yytext); } YY_BREAK case 50: YY_RULE_SETUP -#line 325 "lexer.l" +#line 329 "lexer.l" { add_to_cbuf(yytext); } YY_BREAK case 51: YY_RULE_SETUP -#line 327 "lexer.l" +#line 331 "lexer.l" { static int found_classes = 0; look_for_includes = 2; @@ -1545,7 +1549,7 @@ case 52: yy_c_buf_p = yy_cp -= 1; YY_DO_BEFORE_ACTION; /* set up yytext again */ YY_RULE_SETUP -#line 341 "lexer.l" +#line 345 "lexer.l" { int maj = 0,min = 0,pl = 0; int rmaj = 0,rmin = 0,rpl = 0; @@ -1572,7 +1576,7 @@ YY_RULE_SETUP YY_BREAK case 53: YY_RULE_SETUP -#line 365 "lexer.l" +#line 369 "lexer.l" { if(for_cpp) { char *s; @@ -1587,122 +1591,122 @@ YY_RULE_SETUP YY_BREAK case 54: YY_RULE_SETUP -#line 377 "lexer.l" +#line 381 "lexer.l" {return FROM;} YY_BREAK case 55: YY_RULE_SETUP -#line 379 "lexer.l" +#line 383 "lexer.l" {return VOID;} YY_BREAK case 56: YY_RULE_SETUP -#line 380 "lexer.l" +#line 384 "lexer.l" {return STRUCT;} YY_BREAK case 57: YY_RULE_SETUP -#line 381 "lexer.l" +#line 385 "lexer.l" {return UNION;} YY_BREAK case 58: YY_RULE_SETUP -#line 382 "lexer.l" +#line 386 "lexer.l" {return ENUM;} YY_BREAK case 59: YY_RULE_SETUP -#line 383 "lexer.l" +#line 387 "lexer.l" {return SIGNED;} YY_BREAK case 60: YY_RULE_SETUP -#line 384 "lexer.l" +#line 388 "lexer.l" {return UNSIGNED;} YY_BREAK case 61: YY_RULE_SETUP -#line 385 "lexer.l" +#line 389 "lexer.l" {return LONG;} YY_BREAK case 62: YY_RULE_SETUP -#line 386 "lexer.l" +#line 390 "lexer.l" {return SHORT;} YY_BREAK case 63: YY_RULE_SETUP -#line 387 "lexer.l" +#line 391 "lexer.l" {return INT;} YY_BREAK case 64: YY_RULE_SETUP -#line 388 "lexer.l" +#line 392 "lexer.l" {return FLOAT;} YY_BREAK case 65: YY_RULE_SETUP -#line 389 "lexer.l" +#line 393 "lexer.l" {return DOUBLE;} YY_BREAK case 66: YY_RULE_SETUP -#line 390 "lexer.l" +#line 394 "lexer.l" {return CHAR;} YY_BREAK case 67: YY_RULE_SETUP -#line 391 "lexer.l" +#line 395 "lexer.l" {return CONST;} YY_BREAK case 68: YY_RULE_SETUP -#line 393 "lexer.l" +#line 397 "lexer.l" {return THREEDOTS;} YY_BREAK case 69: YY_RULE_SETUP -#line 395 "lexer.l" +#line 399 "lexer.l" {yylval.line = line_no; return PUBLIC;} YY_BREAK case 70: YY_RULE_SETUP -#line 396 "lexer.l" +#line 400 "lexer.l" {yylval.line = line_no; return PRIVATE;} YY_BREAK case 71: YY_RULE_SETUP -#line 397 "lexer.l" +#line 401 "lexer.l" {yylval.line = line_no; return PROTECTED;} YY_BREAK case 72: YY_RULE_SETUP -#line 398 "lexer.l" +#line 402 "lexer.l" {yylval.line = line_no; return CLASSWIDE;} YY_BREAK case 73: YY_RULE_SETUP -#line 399 "lexer.l" +#line 403 "lexer.l" {yylval.line = line_no; return ARGUMENT;} YY_BREAK case 74: YY_RULE_SETUP -#line 400 "lexer.l" +#line 404 "lexer.l" {yylval.line = line_no; return VIRTUAL;} YY_BREAK case 75: YY_RULE_SETUP -#line 401 "lexer.l" +#line 405 "lexer.l" {yylval.line = line_no; return SIGNAL;} YY_BREAK case 76: YY_RULE_SETUP -#line 402 "lexer.l" +#line 406 "lexer.l" {yylval.line = line_no; return OVERRIDE;} YY_BREAK case 77: YY_RULE_SETUP -#line 403 "lexer.l" +#line 407 "lexer.l" { yylval.id = g_strdup(yytext); return NUMBER; @@ -1710,7 +1714,7 @@ YY_RULE_SETUP YY_BREAK case 78: YY_RULE_SETUP -#line 407 "lexer.l" +#line 411 "lexer.l" { /* this one is for a classname with a namespace */ yylval.id = g_strdup(yytext); @@ -1719,7 +1723,7 @@ YY_RULE_SETUP YY_BREAK case 79: YY_RULE_SETUP -#line 412 "lexer.l" +#line 416 "lexer.l" { /* this is for a classname with an empty namespace */ yylval.id = g_strdup(yytext); @@ -1728,7 +1732,7 @@ YY_RULE_SETUP YY_BREAK case 80: YY_RULE_SETUP -#line 417 "lexer.l" +#line 421 "lexer.l" { yylval.id = g_strdup(yytext); return TOKEN; @@ -1736,7 +1740,7 @@ YY_RULE_SETUP YY_BREAK case 81: YY_RULE_SETUP -#line 422 "lexer.l" +#line 426 "lexer.l" { yylval.id = g_strdup(yytext); return ARRAY_DIM; @@ -1744,7 +1748,7 @@ YY_RULE_SETUP YY_BREAK case 82: YY_RULE_SETUP -#line 427 "lexer.l" +#line 431 "lexer.l" { BEGIN(CLASS_CODE_I); return '{'; @@ -1752,7 +1756,7 @@ YY_RULE_SETUP YY_BREAK case 83: YY_RULE_SETUP -#line 431 "lexer.l" +#line 435 "lexer.l" { BEGIN(C_CODE); parenth_depth=1; @@ -1765,7 +1769,7 @@ YY_RULE_SETUP YY_BREAK case 84: YY_RULE_SETUP -#line 440 "lexer.l" +#line 444 "lexer.l" { BEGIN(INITIAL); return '}'; @@ -1773,12 +1777,12 @@ YY_RULE_SETUP YY_BREAK case 85: YY_RULE_SETUP -#line 445 "lexer.l" +#line 449 "lexer.l" ; /*ignore*/ YY_BREAK case 86: YY_RULE_SETUP -#line 447 "lexer.l" +#line 451 "lexer.l" { yylval.line = line_no; return yytext[0]; @@ -1786,15 +1790,15 @@ YY_RULE_SETUP YY_BREAK case 87: YY_RULE_SETUP -#line 452 "lexer.l" +#line 456 "lexer.l" ; /*ignore*/ YY_BREAK case 88: YY_RULE_SETUP -#line 453 "lexer.l" +#line 458 "lexer.l" ECHO; YY_BREAK -#line 1798 "lex.yy.c" +#line 1802 "lex.yy.c" case YY_STATE_EOF(INITIAL): case YY_STATE_EOF(COMMENT): case YY_STATE_EOF(C_CODE): @@ -2092,7 +2096,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 >= 357 ) + if ( yy_current_state >= 358 ) yy_c = yy_meta[(unsigned int) yy_c]; } yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; @@ -2122,11 +2126,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 >= 357 ) + if ( yy_current_state >= 358 ) 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 == 356); + yy_is_jam = (yy_current_state == 357); if ( ! yy_is_jam ) *yy_state_ptr++ = yy_current_state; @@ -2684,4 +2688,16 @@ int main() return 0; } #endif -#line 453 "lexer.l" +#line 458 "lexer.l" + + +/* Ugly warning avoiding */ +#ifdef FLEX_SCANNER +static void warning_avoider(void) G_GNUC_UNUSED; +static void warning_avoider(void) { + yy_flex_realloc(NULL, 0); + yyunput(0, NULL); + warning_avoider(); +} +#endif + diff --git a/src/lexer.l b/src/lexer.l index f3a0f2e..a33eed0 100644 --- a/src/lexer.l +++ b/src/lexer.l @@ -81,6 +81,10 @@ add_gtk_doc_func(void) gtk_doc_func = NULL; } +/* Ugly warning avoiding */ +#ifdef FLEX_SCANNER +int yylex(void); +#endif %} @@ -400,7 +404,7 @@ class { virtual {yylval.line = line_no; return VIRTUAL;} signal {yylval.line = line_no; return SIGNAL;} override {yylval.line = line_no; return OVERRIDE;} -0|[1-9][0-9]*|0x[0-9a-fA-F]+|0[0-7]+|[0-9]*\.[0-9]+|\.[0-9][0-9]* { +0|[1-9][0-9]*|0x[0-9a-fA-F]+|0[0-7]+|[0-9]*\.[0-9]+|\.[0-9][0-9]* { yylval.id = g_strdup(yytext); return NUMBER; } @@ -450,3 +454,16 @@ class { } <*>[\n\r] ; /*ignore*/ + +%% + +/* Ugly warning avoiding */ +#ifdef FLEX_SCANNER +static void warning_avoider(void) G_GNUC_UNUSED; +static void warning_avoider(void) { + yy_flex_realloc(NULL, 0); + yyunput(0, NULL); + warning_avoider(); +} +#endif + diff --git a/src/main.c b/src/main.c index 31cd849..691d5df 100644 --- a/src/main.c +++ b/src/main.c @@ -98,6 +98,7 @@ gboolean no_write = FALSE; gboolean no_lines = FALSE; gboolean no_self_alias = FALSE; gboolean no_kill_underscores = FALSE; +gboolean always_private_struct = FALSE; int method_unique_id = 1; @@ -147,10 +148,14 @@ get_type(Type *t, gboolean postfix_to_stars) if(*p == '[') extra++; } g_string_append_c(gs, ' '); - - for(i=0; i<(t->stars+extra); i++) - g_string_append_c(gs, '*'); + if(t->pointer) { + g_string_append(gs, t->pointer); + for(i=0; i < extra; i++) + g_string_append_c(gs, '*'); + g_string_append_c(gs, ' '); + } + s = gs->str; g_string_free(gs, FALSE); return s; @@ -497,7 +502,7 @@ make_func_arg(char *typename, int is_class, char *name) else tn = g_strdup(typename); - type = new_type(1, tn, NULL); + type = new_type(tn, g_strdup("*"), NULL); node = new_funcarg((Type *)type, name, NULL); return g_list_prepend(NULL, node); } @@ -526,7 +531,8 @@ make_inits(Class *cl) } if(!got_class_init) { node = new_method(NO_SCOPE, CLASS_INIT_METHOD, - (Type *)new_type(0, g_strdup("void"), NULL), + (Type *)new_type(g_strdup("void"), + NULL, NULL), NULL, NULL, NULL, g_strdup("class_init"), make_func_arg(cl->otype, TRUE, g_strdup("c")), NULL, NULL, NULL, 0, 0, FALSE, @@ -535,7 +541,8 @@ make_inits(Class *cl) } if(!got_init) { node = new_method(NO_SCOPE, INIT_METHOD, - (Type *)new_type(0, g_strdup("void"), NULL), + (Type *)new_type(g_strdup("void"), + NULL, NULL), NULL, NULL, NULL, g_strdup("init"), make_func_arg(cl->otype, FALSE, g_strdup("o")), NULL, NULL, NULL, 0, 0, FALSE, @@ -548,7 +555,6 @@ static void find_destroy(Class *cl) { GList *li; - Node *node; destroy_handler = NULL; for(li=cl->nodes;li;li=g_list_next(li)) { @@ -582,7 +588,6 @@ static void find_finalize(Class *cl) { GList *li; - Node *node; finalize_handler = NULL; for(li=cl->nodes;li;li=g_list_next(li)) { @@ -787,6 +792,8 @@ add_enums(Class *c) static void add_get_type(void) { + char *chunk_size = ((Class*)class)->chunk_size; + out_printf(out, "guint\n" "%s_get_type (void)\n" "{\n" @@ -802,12 +809,18 @@ add_get_type(void) "\t\t\t/* reserved_2 */ NULL,\n" "\t\t\t(GtkClassInitFunc) NULL,\n" "\t\t};\n\n" - "\t\ttype = gtk_type_unique (%s_get_type(), &info);\n" - "\t}\n\n" - "\treturn type;\n" - "}\n\n", + "\t\ttype = gtk_type_unique (%s_get_type(), &info);\n", funcbase, typebase, typebase, typebase, funcbase, funcbase, pfuncbase); + if(chunk_size) { + out_printf(out, "#if %s > 0\n" + "\t\tgtk_type_set_chunk_alloc(type,%s);\n" + "#endif\n", + chunk_size, chunk_size); + } + out_printf(out,"\t}\n\n" + "\treturn type;\n" + "}\n\n"); } static void @@ -975,7 +988,6 @@ set_def_handlers(Class *c, char *oname) for(li = c->nodes; li; li = g_list_next(li)) { Node *n = li->data; Method *m = (Method *)n; - char *id; if(n->type != METHOD_NODE || (m->method != SIGNAL_FIRST_METHOD && @@ -1255,12 +1267,17 @@ add_inits(Class *c) m, FALSE, FALSE, TRUE); if(m->line_no > 0) out_addline_outfile(out); - out_printf(out, "{\n"); + out_printf(out, "{\n" + "#define __GOB_FUNCTION__ \"%s::init\"\n", + c->otype); if(privates > 0) { out_printf(out, "\t%s->_priv = " "g_new0 (%sPrivate, 1);\n", ((FuncArg *)m->args->data)->name, typebase); + } else if(always_private_struct) { + out_printf(out, "\t%s->_priv = NULL;\n", + ((FuncArg *)m->args->data)->name); } if(initializers > 0) { GList *li; @@ -1284,7 +1301,9 @@ add_inits(Class *c) m, FALSE, FALSE, TRUE); if(m->line_no > 0) out_addline_outfile(out); - out_printf(out, "{\n"); + out_printf(out, "{\n" + "#define __GOB_FUNCTION__ \"%s::class_init\"\n", + c->otype); if(signals > 0 || arguments > 0 || need_destroy || @@ -1351,7 +1370,8 @@ add_inits(Class *c) } else { out_printf(out, "return;\n"); } - out_printf(out, "}\n"); + out_printf(out, "}\n" + "#undef __GOB_FUNCTION__\n"); } } @@ -1363,11 +1383,14 @@ add_getset_arg(Class *c, gboolean is_set) "___object_%s_arg (GtkObject *object,\n" "\tGtkArg *arg,\n" "\tguint arg_id)\n" + "#define __GOB_FUNCTION__ \"%s::%s_arg\"\n" "{\n" "\t%s *self;\n\n" "\tself = %s (object);\n\n" "\tswitch (arg_id) {\n", - is_set?"set":"get", typebase, macrobase); + is_set ? "set" : "get", + c->otype, is_set ? "set" : "get", + typebase, macrobase); for(li=c->nodes;li;li=g_list_next(li)) { Node *n = li->data; @@ -1438,7 +1461,8 @@ add_getset_arg(Class *c, gboolean is_set) 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" + "#undef __GOB_FUNCTION__\n"); } static void @@ -1448,9 +1472,9 @@ print_checks(Method *m, FuncArg *fa) gboolean is_void; gboolean checked_null = FALSE; is_void = (strcmp(m->mtype->name, "void")==0 && - m->mtype->stars == 0); + m->mtype->pointer == NULL); - for(li=fa->checks;li;li=g_list_next(li)) { + for(li = fa->checks; li; li = g_list_next(li)) { Check *ch = li->data; char *s; /* point to the method prot in .gob for failed checks */ @@ -1522,7 +1546,10 @@ print_preconditions(Method *m) static void print_method_body(Method *m, int pre) { - out_printf(out, "{\n"); + out_printf(out, "{\n" + "#define __GOB_FUNCTION__ \"%s::%s\"\n", + ((Class *)class)->otype, + get_real_id(m->id)); if(pre) print_preconditions(m); @@ -1538,10 +1565,14 @@ print_method_body(Method *m, int pre) out_printf(out, "\t%s}", m->cbuf); } + /* Note, there is no \n between the last } and this } so that + * errors/warnings reported on the end of the body get pointed to the + * right line in the .gob source */ out_printf(out, "}\n"); if(m->cbuf) out_addline_outfile(out); + out_printf(out, "#undef __GOB_FUNCTION__\n"); } static void @@ -1586,7 +1617,7 @@ put_method(Method *m) char *s, *args, *doc; gboolean is_void; is_void = (strcmp(m->mtype->name, "void")==0 && - m->mtype->stars == 0); + m->mtype->pointer == NULL); out_printf(out, "\n"); if(m->method != OVERRIDE_METHOD) { doc = get_gtk_doc(m->id); @@ -1622,8 +1653,8 @@ put_method(Method *m) out_printf(out, "{\n"); s = g_strdup(get_real_id(m->id)); g_strup(s); - if(strcmp(m->mtype->name, "void")==0 && - m->mtype->stars==0) { + if(strcmp(m->mtype->name, "void") == 0 && + m->mtype->pointer == NULL) { print_preconditions(m); if(((FuncArg *)m->args->data)->name) out_printf(out, "\tgtk_signal_emit (GTK_OBJECT (%s),\n" @@ -1677,8 +1708,8 @@ put_method(Method *m) "\tif(klass->%s)\n", macrobase, ((FuncArg *)m->args->data)->name, get_real_id(m->id)); - if(strcmp(m->mtype->name, "void")==0 && - m->mtype->stars==0) { + if(strcmp(m->mtype->name, "void") == 0 && + m->mtype->pointer == NULL) { GList *li; out_printf(out, "\t\t(*klass->%s)(%s", get_real_id(m->id), @@ -1990,7 +2021,7 @@ print_class_block(Class *c) "GTK_CHECK_TYPE((obj),%s_get_type ())\n\n", macrois, funcbase); - if(!no_self_alias) { + if( ! no_self_alias) { out_printf(out, "/* self casting macros */\n"); out_printf(out, "#define SELF(x) %s(x)\n", macrobase); out_printf(out, "#define IS_SELF(x) %s(x)\n", macrois); @@ -2002,10 +2033,13 @@ print_class_block(Class *c) out_printf(out, "typedef %sClass SelfClass;\n\n", typebase); } - if(privates > 0) { + if(privates > 0 || always_private_struct) { out_printf(outh, "\n/* Private structure type */\n"); out_printf(outh, "typedef struct _%sPrivate %sPrivate;\n", typebase, typebase); + if(privates == 0) + out_printf(outh, "/* There are no privates, this " + "structure is thus never defined */\n"); } out_printf(outh, "\n/*\n" @@ -2020,13 +2054,13 @@ print_class_block(Class *c) "#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)) { + for(l=c->nodes; l; l=g_list_next(l)) { static gboolean printed_public = FALSE; Node *n = l->data; Variable *v = (Variable *)n; if(n->type == VARIABLE_NODE && v->scope == PUBLIC_SCOPE) { - if(!printed_public) { + if( ! printed_public) { out_printf(outh, "\t/*< public >*/\n"); printed_public = TRUE; } @@ -2034,20 +2068,20 @@ print_class_block(Class *c) } } /* put protecteds always AFTER publics */ - for(l=c->nodes;l;l=g_list_next(l)) { + 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 == PROTECTED_SCOPE) { - if(!printed_private) { + if( ! printed_private) { out_printf(outh, "\t/*< private >*/\n"); printed_private = TRUE; } put_variable((Variable *)n, outh); } } - if(privates>0) { - if(!printed_private) + if(privates > 0 || always_private_struct) { + if( ! printed_private) out_printf(outh, "\t/*< private >*/\n"); out_printf(outh, "\t%sPrivate *_priv;\n", typebase); } @@ -2066,7 +2100,7 @@ print_class_block(Class *c) out_printf(outfp, "struct _%sPrivate {\n", typebase); - for(l=c->nodes;l;l=l->next) { + for(l=c->nodes; l; l=l->next) { Node *n = l->data; Variable *v = (Variable *)n; if(n->type == VARIABLE_NODE && @@ -2390,6 +2424,7 @@ static void print_help(void) { fprintf(stderr, "Gob version %s\n\n", VERSION); + fprintf(stderr, "gob [options] file.gob\n\n"); fprintf(stderr, "Options:\n" "\t--help,-h,-? Display this help\n" "\t--version Display version\n" @@ -2411,13 +2446,17 @@ print_help(void) "put private\n" "\t structure and protected " "prototypes inside c file\n" + "\t--always-private-struct Always create a private pointer " + "in\n" + "\t the object structure\n" "\t--no-write,-n Don't write output files, just " "check syntax\n" "\t--no-lines Don't print '#line' to output\n" "\t--no-self-alias Don't create self type and macro " "aliases\n" "\t--no-kill-underscores Don't remove the leading underscore " - "from short id names"); + "from\n" + "\t short id names\n"); } static void @@ -2471,6 +2510,8 @@ parse_options(int argc, char *argv[]) no_self_alias = TRUE; } else if(strcmp(argv[i], "--no-kill-underscores")==0) { no_kill_underscores = TRUE; + } else if(strcmp(argv[i], "--always-private-struct")==0) { + always_private_struct = TRUE; } else if(strcmp(argv[i], "--")==0) { /*further arguments are files*/ no_opts = TRUE; @@ -2587,6 +2628,7 @@ main(int argc, char *argv[]) check_nonvoidempty((Class *)class); check_signal_args((Class *)class); check_argument_types((Class *)class); + check_func_arg_checks((Class *)class); exit_on_error = TRUE; diff --git a/src/main.h b/src/main.h index e5ac102..abc6049 100644 --- a/src/main.h +++ b/src/main.h @@ -41,6 +41,7 @@ extern gboolean no_write; extern gboolean no_lines; extern gboolean no_self_alias; extern gboolean no_kill_underscores; +extern gboolean always_private_struct; extern char *filename; extern char *filebase; diff --git a/src/parse.c b/src/parse.c index a3b796c..8cc0914 100644 --- a/src/parse.c +++ b/src/parse.c @@ -45,6 +45,7 @@ #include "config.h" #include #include +#include #include #include "treefuncs.h" @@ -57,9 +58,9 @@ GList *nodes = NULL; static GList *class_nodes = NULL; Node *class = NULL; +char *chunk_size = NULL; static GList *typestack = NULL; -static int stars = 0; static GList *funcargs = NULL; static GList *checks = NULL; static int has_self = FALSE; @@ -148,10 +149,10 @@ push_function(int scope, int method, char *oid, char *id, g_assert(scope != CLASS_SCOPE); - if(method!=INIT_METHOD && method!=CLASS_INIT_METHOD) { - type = pop_type(); + if(method == INIT_METHOD || method == CLASS_INIT_METHOD) { + type = (Type *)new_type(g_strdup("void"), NULL, NULL); } else { - type = (Type *)new_type(0,g_strdup("void"),NULL); + type = pop_type(); } /* a complicated and ugly test to figure out if we have @@ -213,6 +214,9 @@ free_all_global_state(void) g_free(defreturn); defreturn = NULL; + g_free(chunk_size); + chunk_size = NULL; + g_list_foreach(gtktypes, (GFunc)g_free, NULL); g_list_free(gtktypes); gtktypes = NULL; @@ -247,7 +251,7 @@ push_init_arg(char *name, int is_class) else tn = g_strdup(((Class *)class)->otype); - type = new_type(1,tn,NULL); + type = new_type(tn, g_strdup("*"), NULL); node = new_funcarg((Type *)type,name,NULL); funcargs = g_list_prepend(funcargs, node); } @@ -258,7 +262,7 @@ push_self(char *id) Node *node; Node *type; GList *ch = NULL; - type = new_type(1,g_strdup(((Class *)class)->otype),NULL); + type = new_type(g_strdup(((Class *)class)->otype), g_strdup("*"), NULL); ch = g_list_append(ch,new_check(NULL_CHECK,NULL)); ch = g_list_append(ch,new_check(TYPE_CHECK,NULL)); node = new_funcarg((Type *)type,id,ch); @@ -308,7 +312,7 @@ set_return_value(char *type, char *val) } -#line 290 "parse.y" +#line 294 "parse.y" typedef union { char *id; GString *cbuf; @@ -330,20 +334,20 @@ typedef union { -#define YYFINAL 243 +#define YYFINAL 256 #define YYFLAG -32768 #define YYNTBASE 50 -#define YYTRANSLATE(x) ((unsigned)(x) <= 290 ? yytranslate[x] : 87) +#define YYTRANSLATE(x) ((unsigned)(x) <= 290 ? yytranslate[x] : 88) 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, 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, 48, 2, 2, 2, 2, 2, 2, 39, + 40, 44, 2, 45, 49, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 41, 47, + 42, 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, @@ -371,80 +375,85 @@ static const char yytranslate[] = { 0, #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, 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 + 24, 27, 29, 34, 38, 44, 45, 50, 55, 58, + 60, 62, 64, 66, 68, 70, 72, 74, 76, 79, + 83, 86, 90, 93, 96, 98, 100, 101, 107, 114, + 126, 135, 141, 147, 149, 153, 154, 158, 160, 163, + 165, 167, 169, 172, 175, 178, 182, 186, 189, 192, + 195, 197, 200, 202, 205, 207, 209, 211, 213, 215, + 217, 219, 221, 223, 225, 227, 229, 231, 234, 237, + 241, 244, 246, 250, 254, 257, 259, 264, 268, 270, + 273, 275, 286, 298, 308, 318, 327, 339, 348, 354, + 357, 362, 363, 365, 368, 370, 372, 376, 378, 382, + 384, 388, 390, 393, 397, 404, 412, 415, 417, 419, + 422, 425, 429, 433, 437, 441, 443, 446 }; 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, 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 + 56, 38, 0, 54, 37, 38, 0, 3, 21, 4, + 21, 55, 0, 0, 39, 19, 19, 40, 0, 39, + 19, 20, 40, 0, 56, 57, 0, 57, 0, 78, + 0, 62, 0, 63, 0, 41, 0, 29, 0, 30, + 0, 31, 0, 32, 0, 19, 19, 0, 19, 37, + 23, 0, 42, 87, 0, 42, 37, 23, 0, 59, + 60, 0, 60, 59, 0, 60, 0, 59, 0, 0, + 58, 67, 19, 61, 41, 0, 58, 67, 19, 22, + 61, 41, 0, 33, 65, 64, 19, 19, 37, 23, + 19, 37, 23, 41, 0, 33, 65, 64, 19, 19, + 37, 23, 41, 0, 33, 65, 64, 19, 19, 0, + 19, 39, 19, 67, 40, 0, 19, 0, 39, 66, + 40, 0, 0, 19, 43, 66, 0, 19, 0, 68, + 72, 0, 68, 0, 69, 0, 19, 0, 5, 19, + 0, 19, 5, 0, 71, 19, 0, 5, 71, 19, + 0, 71, 19, 5, 0, 70, 69, 0, 21, 69, + 0, 5, 69, 0, 21, 0, 21, 5, 0, 70, + 0, 70, 5, 0, 6, 0, 18, 0, 14, 0, + 15, 0, 13, 0, 16, 0, 17, 0, 11, 0, + 12, 0, 7, 0, 8, 0, 9, 0, 44, 0, + 44, 5, 0, 44, 72, 0, 44, 5, 72, 0, + 19, 75, 0, 75, 0, 58, 19, 75, 0, 19, + 58, 75, 0, 58, 75, 0, 73, 0, 19, 39, + 76, 40, 0, 76, 45, 19, 0, 19, 0, 37, + 23, 0, 41, 0, 35, 65, 74, 67, 19, 39, + 81, 40, 79, 77, 0, 58, 35, 65, 73, 67, + 19, 39, 81, 40, 79, 77, 0, 34, 58, 67, + 19, 39, 81, 40, 79, 77, 0, 58, 34, 67, + 19, 39, 81, 40, 79, 77, 0, 34, 67, 19, + 39, 81, 40, 79, 77, 0, 36, 39, 21, 40, + 67, 19, 39, 81, 40, 79, 77, 0, 58, 67, + 19, 39, 81, 40, 79, 77, 0, 19, 39, 19, + 40, 77, 0, 19, 80, 0, 19, 80, 19, 80, + 0, 0, 87, 0, 37, 23, 0, 6, 0, 19, + 0, 19, 45, 82, 0, 82, 0, 83, 45, 10, + 0, 83, 0, 83, 45, 84, 0, 84, 0, 67, + 19, 0, 67, 19, 22, 0, 67, 19, 39, 19, + 85, 40, 0, 67, 19, 22, 39, 19, 85, 40, + 0, 85, 86, 0, 86, 0, 19, 0, 46, 87, + 0, 47, 87, 0, 46, 42, 87, 0, 47, 42, + 87, 0, 42, 42, 87, 0, 48, 42, 87, 0, + 20, 0, 49, 20, 0, 19, 0 }; #endif #if YYDEBUG != 0 static const short yyrline[] = { 0, - 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, - 883, 894, 913, 919, 920, 926, 927, 938, 948, 951, - 952, 955, 956, 959, 962, 965, 973, 983, 984, 987, - 1000, 1004, 1008, 1012, 1016, 1020, 1026, 1027, 1031 + 312, 313, 314, 315, 318, 324, 330, 336, 342, 348, + 356, 357, 360, 365, 372, 377, 378, 386, 397, 398, + 401, 402, 403, 404, 407, 408, 409, 410, 413, 426, + 442, 446, 454, 455, 456, 457, 458, 464, 467, 471, + 506, 534, 604, 613, 619, 620, 623, 626, 632, 636, + 643, 646, 649, 653, 657, 661, 666, 674, 678, 683, + 687, 690, 694, 697, 702, 703, 704, 705, 706, 707, + 708, 709, 710, 713, 714, 715, 718, 719, 720, 724, + 731, 743, 749, 761, 773, 776, 782, 787, 790, 795, + 796, 800, 816, 832, 848, 864, 875, 881, 891, 914, + 925, 944, 950, 951, 957, 958, 969, 979, 982, 983, + 986, 987, 990, 993, 996, 1004, 1014, 1015, 1018, 1031, + 1035, 1039, 1043, 1047, 1051, 1057, 1058, 1062 }; #endif @@ -455,194 +464,206 @@ 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", -"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 +"CLASSWIDE","ARGUMENT","VIRTUAL","SIGNAL","OVERRIDE","'{'","'}'","'('","')'", +"';'","'='","'|'","'*'","','","'>'","'<'","'!'","'-'","prog","ccode","ccodes", +"class","classdec","chunk","classcode","thing","scope","destructor","initializer", +"varoptions","variable","argument","argtype","flags","flaglist","type","specifier_list", +"spec_list","specifier","strunionenum","pointer","simplesigtype","fullsigtype", +"sigtype","tokenlist","codenocode","method","returnvals","retcode","funcargs", +"arglist","arglist1","arg","checklist","check","numtok", NULL }; #endif static const short yyr1[] = { 0, 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 + 52, 52, 53, 53, 54, 55, 55, 55, 56, 56, + 57, 57, 57, 57, 58, 58, 58, 58, 59, 59, + 60, 60, 61, 61, 61, 61, 61, 62, 62, 63, + 63, 63, 64, 64, 65, 65, 66, 66, 67, 67, + 68, 68, 68, 68, 68, 68, 68, 69, 69, 69, + 69, 69, 69, 69, 70, 70, 70, 70, 70, 70, + 70, 70, 70, 71, 71, 71, 72, 72, 72, 72, + 73, 73, 74, 74, 74, 74, 75, 76, 76, 77, + 77, 78, 78, 78, 78, 78, 78, 78, 78, 79, + 79, 79, 80, 80, 81, 81, 81, 81, 82, 82, + 83, 83, 84, 84, 84, 84, 85, 85, 86, 86, + 86, 86, 86, 86, 86, 87, 87, 87 }; 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, 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 + 2, 1, 4, 3, 5, 0, 4, 4, 2, 1, + 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, 2, 1, + 1, 1, 2, 2, 2, 3, 3, 2, 2, 2, + 1, 2, 1, 2, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 2, 2, 3, + 2, 1, 3, 3, 2, 1, 4, 3, 1, 2, + 1, 10, 11, 9, 9, 8, 11, 8, 5, 2, + 4, 0, 1, 2, 1, 1, 3, 1, 3, 1, + 3, 1, 2, 3, 6, 7, 2, 1, 1, 2, + 2, 3, 3, 3, 3, 1, 2, 1 }; 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, 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 + 0, 0, 11, 3, 2, 0, 0, 1, 0, 25, + 26, 27, 28, 46, 0, 46, 0, 14, 24, 0, + 20, 0, 22, 23, 21, 16, 0, 0, 0, 0, + 65, 74, 75, 76, 72, 73, 69, 67, 68, 70, + 71, 66, 52, 61, 0, 0, 50, 51, 63, 0, + 0, 0, 13, 19, 0, 46, 0, 0, 15, 0, + 48, 0, 44, 0, 0, 53, 60, 0, 54, 62, + 59, 0, 0, 77, 49, 64, 58, 55, 0, 0, + 86, 0, 82, 0, 0, 0, 37, 0, 0, 0, + 45, 0, 0, 56, 0, 0, 78, 79, 57, 0, + 0, 0, 81, 0, 85, 0, 0, 0, 0, 0, + 0, 37, 0, 0, 36, 35, 0, 0, 0, 0, + 91, 99, 47, 0, 42, 0, 65, 52, 0, 0, + 108, 110, 112, 80, 89, 0, 84, 83, 0, 0, + 0, 0, 29, 0, 0, 0, 128, 126, 0, 0, + 31, 33, 34, 38, 17, 18, 90, 0, 0, 0, + 0, 113, 102, 0, 87, 0, 0, 0, 0, 0, + 30, 39, 102, 32, 127, 43, 0, 102, 107, 114, + 0, 0, 0, 109, 111, 88, 0, 0, 102, 0, + 0, 0, 41, 0, 0, 0, 0, 100, 103, 96, + 102, 0, 0, 0, 98, 0, 94, 0, 119, 0, + 0, 0, 0, 0, 118, 104, 0, 0, 102, 95, + 102, 0, 0, 0, 0, 120, 0, 121, 0, 115, + 117, 101, 92, 0, 0, 40, 116, 124, 122, 123, + 125, 97, 93, 0, 0, 0 }; -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 yydefgoto[] = { 254, + 8, 9, 10, 11, 69, 30, 31, 32, 125, 126, + 127, 33, 34, 74, 39, 72, 139, 57, 58, 59, + 60, 85, 91, 92, 93, 146, 132, 35, 193, 208, + 140, 141, 142, 143, 224, 225, 209 }; -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 yypact[] = { 174, + -1,-32768,-32768,-32768,-32768,-32768,-32768,-32768, 174, 221, + -14, 38,-32768, 221, 221, 175, 23, 221, 29,-32768, +-32768,-32768,-32768, 39, 157, 39, 41,-32768,-32768, 193, +-32768, 112,-32768,-32768,-32768, 57, 72, 81, 84, 263, +-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768, +-32768,-32768, 99, 314, 280, 89, 90,-32768, 328, 117, + 161, 116,-32768,-32768, 280, 39, 119, 123,-32768, 104, + 105, 114, 118, 133, 342,-32768,-32768, 137,-32768, 342, +-32768, 139, 128, 5,-32768, 342,-32768, 176, 211, 160, +-32768, 280,-32768, 142, 164, 165, 67, 6, 17, 81, +-32768, 166, 177,-32768, 156, 297, 90,-32768,-32768, 178, + 184, 195,-32768, 31,-32768, 196, 280, 179, 31, 280, + -2, -15, 297, 44, 190, 200, 180, 197, 198, 210, +-32768,-32768,-32768, 280, 183, 297, 199, 3, 216, 226, +-32768, 191,-32768,-32768,-32768, 42,-32768,-32768, 234, 264, + 297, 271,-32768, 277, 266, 281,-32768,-32768, 294, 302, +-32768,-32768,-32768,-32768,-32768,-32768,-32768, 283, 301, 296, + 280, 51, 318, 246,-32768, 319, 297, 311, 312, 322, +-32768,-32768, 318,-32768,-32768,-32768, -3, 318,-32768, 323, + 332, 46, 17,-32768,-32768,-32768, 324, 297, 318, 297, + 17, 329,-32768, 17, 346, 93, 344, 349,-32768,-32768, + 318, 330, 17, 331,-32768, 350,-32768, 93,-32768, 327, + 52, 65, 333, 103,-32768,-32768, 46, 17, 318,-32768, + 318, 335, 113, 56, 56,-32768, 56,-32768, 56,-32768, +-32768,-32768,-32768, 17, 17,-32768,-32768,-32768,-32768,-32768, +-32768,-32768,-32768, 372, 374,-32768 }; static const short yypgoto[] = {-32768, - 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 + 13, 78, 368,-32768,-32768,-32768, 348, -22, 253, 255, + 259,-32768,-32768,-32768, -20, 282, -18,-32768, -35,-32768, + 343, -73, 288,-32768, -57,-32768, -192,-32768, -170, 158, + -121, 215,-32768, 213, 170, -164, -124 }; -#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 +#define YYLAST 388 + + +static const short yytable[] = { 161, + 210, 156, 55, 121, 77, 61, 56, 79, 215, 107, + 108, 217, 201, 67, 170, 202, 153, 204, 81, 12, + 230, 13, 16, 87, 128, 129, 124, 13, 213, 179, + 13, 113, 115, 144, 154, 243, 82, 203, 90, 77, + 228, 17, -106, 36, 77, 96, 95, 171, 84, 110, + 77, 252, 253, 130, 147, 197, 148, 131, 244, 241, + 245, 113, 157, 158, 157, 158, 112, 37, 241, 111, + 157, 158, 190, 116, 157, 158, 212, 38, 214, 62, + 159, 175, 207, 157, 158, 121, 176, 15, 122, 191, + 70, 18, 160, 235, 160, 68, 236, 238, 150, 71, + 160, 152, 73, 79, 160, 123, 237, 83, 124, 248, + 249, 219, 250, 160, 251, 168, 40, 41, 42, 43, + 44, 219, 45, 46, 47, 48, 49, 50, 51, 52, + 53, 219, 54, 84, 220, 88, 94, 97, 221, 222, + 223, 98, 240, 99, 220, 65, 66, 100, 221, 222, + 223, 103, 247, 101, 220, 104, 102, 105, 221, 222, + 223, 40, 41, 42, 43, 44, 106, 45, 46, 47, + 48, 49, 50, 51, 52, 53, 1, 54, 114, 89, + 109, 117, 118, 119, 134, 20, 21, 22, 23, 20, + 21, 22, 23, 19, 136, 135, 2, 3, 4, 5, + 6, 7, 145, 20, 21, 22, 23, 24, 25, 26, + 27, 19, 28, 110, 149, 29, 111, 151, 121, 169, + 164, 20, 21, 22, 23, 24, 25, 26, 27, 110, + 63, 124, 167, 29, 172, 174, 165, 166, -105, 20, + 21, 22, 23, 2, 3, 4, 5, 6, 7, 111, + 40, 41, 42, 43, 44, 194, 45, 46, 47, 48, + 49, 50, 51, 52, 53, 173, 54, 75, 41, 42, + 43, 44, 177, 45, 46, 47, 48, 49, 50, 51, + 52, 76, 178, 54, 40, 41, 42, 43, 44, 180, + 45, 46, 47, 48, 49, 50, 51, 52, 53, 181, + 54, 40, 137, 42, 43, 44, 182, 45, 46, 47, + 48, 49, 50, 51, 52, 138, 184, 54, 80, 41, + 183, 185, 186, 187, 45, 46, 47, 48, 49, 50, + 51, 52, 86, 41, 54, 188, 192, 196, 45, 46, + 47, 48, 49, 50, 51, 52, 75, 41, 54, 198, + 206, 199, 45, 46, 47, 48, 49, 50, 51, 52, + 200, 205, 54, 211, 218, 216, 226, 227, 234, 229, + 231, 255, 232, 256, 239, 246, 14, 64, 163, 162, + 155, 133, 78, 120, 242, 189, 195, 233 }; -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 +static const short yycheck[] = { 124, + 193, 123, 25, 19, 40, 26, 25, 5, 201, 5, + 84, 204, 183, 32, 136, 19, 19, 188, 54, 21, + 213, 9, 37, 59, 19, 20, 42, 15, 199, 151, + 18, 89, 90, 107, 37, 228, 55, 41, 61, 75, + 211, 4, 40, 21, 80, 66, 65, 45, 44, 19, + 86, 244, 245, 37, 112, 177, 114, 41, 229, 224, + 231, 119, 19, 20, 19, 20, 89, 39, 233, 39, + 19, 20, 22, 92, 19, 20, 198, 39, 200, 39, + 37, 40, 37, 19, 20, 19, 45, 10, 22, 39, + 19, 14, 49, 42, 49, 39, 221, 222, 117, 19, + 49, 120, 19, 5, 49, 39, 42, 19, 42, 234, + 235, 19, 237, 49, 239, 134, 5, 6, 7, 8, + 9, 19, 11, 12, 13, 14, 15, 16, 17, 18, + 19, 19, 21, 44, 42, 19, 21, 19, 46, 47, + 48, 19, 40, 40, 42, 34, 35, 43, 46, 47, + 48, 19, 40, 40, 42, 19, 39, 19, 46, 47, + 48, 5, 6, 7, 8, 9, 39, 11, 12, 13, + 14, 15, 16, 17, 18, 19, 3, 21, 19, 19, + 5, 40, 19, 19, 19, 29, 30, 31, 32, 29, + 30, 31, 32, 19, 39, 19, 23, 24, 25, 26, + 27, 28, 19, 29, 30, 31, 32, 33, 34, 35, + 36, 19, 38, 19, 19, 41, 39, 39, 19, 37, + 41, 29, 30, 31, 32, 33, 34, 35, 36, 19, + 38, 42, 23, 41, 19, 45, 40, 40, 40, 29, + 30, 31, 32, 23, 24, 25, 26, 27, 28, 39, + 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, + 15, 16, 17, 18, 19, 40, 21, 5, 6, 7, + 8, 9, 39, 11, 12, 13, 14, 15, 16, 17, + 18, 19, 19, 21, 5, 6, 7, 8, 9, 19, + 11, 12, 13, 14, 15, 16, 17, 18, 19, 23, + 21, 5, 6, 7, 8, 9, 41, 11, 12, 13, + 14, 15, 16, 17, 18, 19, 23, 21, 5, 6, + 40, 20, 40, 23, 11, 12, 13, 14, 15, 16, + 17, 18, 5, 6, 21, 40, 19, 19, 11, 12, + 13, 14, 15, 16, 17, 18, 5, 6, 21, 39, + 19, 40, 11, 12, 13, 14, 15, 16, 17, 18, + 39, 39, 21, 40, 19, 37, 23, 19, 42, 40, + 40, 0, 23, 0, 42, 41, 9, 30, 126, 125, + 122, 100, 40, 96, 227, 171, 174, 218 }; /* -*-C-*- Note some compilers choke on comments on `#line' lines. */ #line 3 "/usr/lib/bison.simple" @@ -1188,23 +1209,23 @@ yyreduce: switch (yyn) { case 1: -#line 308 "parse.y" +#line 312 "parse.y" { ; ; break;} case 2: -#line 309 "parse.y" +#line 313 "parse.y" { ; ; break;} case 3: -#line 310 "parse.y" +#line 314 "parse.y" { ; ; break;} case 4: -#line 311 "parse.y" +#line 315 "parse.y" { ; ; break;} case 5: -#line 314 "parse.y" +#line 318 "parse.y" { Node *node = new_ccode(C_CCODE,(yyvsp[0].cbuf)->str, ccode_line); @@ -1213,7 +1234,7 @@ case 5: ; break;} case 6: -#line 320 "parse.y" +#line 324 "parse.y" { Node *node = new_ccode(H_CCODE,(yyvsp[0].cbuf)->str, ccode_line); @@ -1222,7 +1243,7 @@ case 6: ; break;} case 7: -#line 326 "parse.y" +#line 330 "parse.y" { Node *node = new_ccode(HT_CCODE,(yyvsp[0].cbuf)->str, ccode_line); @@ -1231,7 +1252,7 @@ case 7: ; break;} case 8: -#line 332 "parse.y" +#line 336 "parse.y" { Node *node = new_ccode(PH_CCODE,(yyvsp[0].cbuf)->str, ccode_line); @@ -1240,7 +1261,7 @@ case 8: ; break;} case 9: -#line 338 "parse.y" +#line 342 "parse.y" { Node *node = new_ccode(A_CCODE,(yyvsp[0].cbuf)->str, ccode_line); @@ -1249,7 +1270,7 @@ case 9: ; break;} case 10: -#line 344 "parse.y" +#line 348 "parse.y" { Node *node = new_ccode(AT_CCODE,(yyvsp[0].cbuf)->str, ccode_line); @@ -1258,15 +1279,15 @@ case 10: ; break;} case 11: -#line 352 "parse.y" +#line 356 "parse.y" { ; ; break;} case 12: -#line 353 "parse.y" +#line 357 "parse.y" { ; ; break;} case 13: -#line 356 "parse.y" +#line 360 "parse.y" { ((Class *)class)->nodes = class_nodes; class_nodes = NULL; @@ -1274,7 +1295,7 @@ case 13: ; break;} case 14: -#line 361 "parse.y" +#line 365 "parse.y" { ((Class *)class)->nodes = NULL; class_nodes = NULL; @@ -1282,53 +1303,76 @@ case 14: ; break;} case 15: -#line 368 "parse.y" +#line 372 "parse.y" { - class = new_class(yyvsp[-2].id,yyvsp[0].id,NULL); + class = new_class(yyvsp[-3].id,yyvsp[-1].id,chunk_size,NULL); ; break;} -case 16: -#line 373 "parse.y" -{ ; ; - break;} case 17: -#line 374 "parse.y" -{ ; ; +#line 378 "parse.y" +{ + if(strcmp(yyvsp[-2].id,"chunks") == 0) { + chunk_size = g_strdup(yyvsp[0].id); + } else { + yyerror(_("parse error")); + YYERROR; + } + ; break;} case 18: -#line 377 "parse.y" -{ ; ; +#line 386 "parse.y" +{ + if(strcmp(yyvsp[-2].id,"chunks") == 0) { + if(atoi(yyvsp[0].id) != 0) + chunk_size = g_strdup(yyvsp[0].id); + } else { + yyerror(_("parse error")); + YYERROR; + } + ; break;} case 19: -#line 378 "parse.y" +#line 397 "parse.y" { ; ; break;} case 20: -#line 379 "parse.y" +#line 398 "parse.y" { ; ; break;} case 21: -#line 380 "parse.y" +#line 401 "parse.y" { ; ; break;} case 22: -#line 383 "parse.y" -{ the_scope = PUBLIC_SCOPE; ; +#line 402 "parse.y" +{ ; ; break;} case 23: -#line 384 "parse.y" -{ the_scope = PRIVATE_SCOPE; ; +#line 403 "parse.y" +{ ; ; break;} case 24: -#line 385 "parse.y" -{ the_scope = PROTECTED_SCOPE; ; +#line 404 "parse.y" +{ ; ; break;} case 25: -#line 386 "parse.y" -{ the_scope = CLASS_SCOPE; ; +#line 407 "parse.y" +{ the_scope = PUBLIC_SCOPE; ; break;} case 26: -#line 389 "parse.y" +#line 408 "parse.y" +{ the_scope = PRIVATE_SCOPE; ; + break;} +case 27: +#line 409 "parse.y" +{ the_scope = PROTECTED_SCOPE; ; + break;} +case 28: +#line 410 "parse.y" +{ the_scope = CLASS_SCOPE; ; + break;} +case 29: +#line 413 "parse.y" { if(strcmp(yyvsp[-1].id, "destroywith")==0) { g_free(yyvsp[-1].id); @@ -1343,8 +1387,8 @@ case 26: } ; break;} -case 27: -#line 402 "parse.y" +case 30: +#line 426 "parse.y" { if(strcmp(yyvsp[-2].id, "destroy")==0) { g_free(yyvsp[-2].id); @@ -1360,58 +1404,58 @@ case 27: } ; break;} -case 28: -#line 418 "parse.y" +case 31: +#line 442 "parse.y" { initializer = yyvsp[0].id; initializer_line = ccode_line; ; break;} -case 29: -#line 422 "parse.y" +case 32: +#line 446 "parse.y" { initializer = (yyvsp[0].cbuf)->str; initializer_line = ccode_line; g_string_free(yyvsp[0].cbuf, FALSE); ; break;} -case 30: -#line 430 "parse.y" +case 33: +#line 454 "parse.y" { ; ; break;} -case 31: -#line 431 "parse.y" +case 34: +#line 455 "parse.y" { ; ; break;} -case 32: -#line 432 "parse.y" +case 35: +#line 456 "parse.y" { destructor = NULL; ; break;} -case 33: -#line 433 "parse.y" +case 36: +#line 457 "parse.y" { initializer = NULL; ; break;} -case 34: -#line 434 "parse.y" +case 37: +#line 458 "parse.y" { destructor = NULL; initializer = NULL; ; break;} -case 35: -#line 440 "parse.y" +case 38: +#line 464 "parse.y" { push_variable(yyvsp[-2].id, the_scope,yyvsp[-4].line, NULL); ; break;} -case 36: -#line 443 "parse.y" +case 39: +#line 467 "parse.y" { push_variable(yyvsp[-3].id, the_scope, yyvsp[-5].line, yyvsp[-2].id); ; break;} -case 37: -#line 447 "parse.y" +case 40: +#line 471 "parse.y" { if(strcmp(yyvsp[-6].id,"get")==0 && strcmp(yyvsp[-3].id,"set")==0) { @@ -1448,8 +1492,8 @@ case 37: } ; break;} -case 38: -#line 482 "parse.y" +case 41: +#line 506 "parse.y" { if(strcmp(yyvsp[-3].id,"get")==0) { Node *node; @@ -1479,8 +1523,8 @@ case 38: } ; break;} -case 39: -#line 510 "parse.y" +case 42: +#line 534 "parse.y" { Node *node; char *get, *set = NULL; @@ -1527,16 +1571,16 @@ case 39: root, yyvsp[-1].id, root, yyvsp[-1].id, root, yyvsp[-1].id, - root, yyvsp[-1].id, - root, yyvsp[-1].id, - root, yyvsp[-1].id, root, yyvsp[-1].id); } else { g_assert_not_reached(); } - /* get is the same for everything */ - get = g_strdup_printf("ARG = %s->%s;", root, yyvsp[-1].id); + if(strcmp(yyvsp[0].id, "stringlink")==0) { + get = g_strdup_printf("ARG = g_strdup(%s->%s);", root, yyvsp[-1].id); + } else + /* For everything else, get is just straight assignment */ + get = g_strdup_printf("ARG = %s->%s;", root, yyvsp[-1].id); g_free(yyvsp[0].id); @@ -1550,8 +1594,8 @@ case 39: class_nodes = g_list_append(class_nodes,node); ; break;} -case 40: -#line 580 "parse.y" +case 43: +#line 604 "parse.y" { if(strcmp(yyvsp[-2].id,"type")!=0) { g_free(yyvsp[-4].id); @@ -1562,192 +1606,215 @@ case 40: yyval.id = yyvsp[-4].id; ; break;} -case 41: -#line 589 "parse.y" +case 44: +#line 613 "parse.y" { yyval.id = yyvsp[0].id; typestack = g_list_prepend(typestack,NULL); ; break;} -case 42: -#line 595 "parse.y" -{ yyval.list = yyvsp[-1].list; ; - break;} -case 43: -#line 596 "parse.y" -{ yyval.list = NULL; ; - break;} -case 44: -#line 599 "parse.y" -{ - yyval.list = g_list_append(yyvsp[0].list,yyvsp[-2].id); - ; - break;} case 45: -#line 602 "parse.y" -{ - yyval.list = g_list_append(NULL,yyvsp[0].id); - ; +#line 619 "parse.y" +{ yyval.list = yyvsp[-1].list; ; break;} case 46: -#line 608 "parse.y" -{ ; ; +#line 620 "parse.y" +{ yyval.list = NULL; ; break;} case 47: -#line 609 "parse.y" +#line 623 "parse.y" { - Type *type = typestack->data; - char *oldname = type->name; - type->name = g_strconcat("const ",oldname,NULL); - g_free(oldname); + yyval.list = g_list_append(yyvsp[0].list,yyvsp[-2].id); ; break;} case 48: -#line 617 "parse.y" +#line 626 "parse.y" { - Node *node = new_type(0,yyvsp[0].id,NULL); - typestack = g_list_prepend(typestack,node); + yyval.list = g_list_append(NULL,yyvsp[0].id); ; break;} case 49: -#line 621 "parse.y" +#line 632 "parse.y" { - Node *node = new_type(stars,yyvsp[-1].id,NULL); - stars = 0; + Node *node = new_type(yyvsp[-1].id, yyvsp[0].id, NULL); typestack = g_list_prepend(typestack,node); - ; + ; break;} case 50: -#line 628 "parse.y" +#line 636 "parse.y" { - yyval.id = g_strconcat("unsigned ",yyvsp[0].id,NULL); - ; + Node *node = new_type(yyvsp[0].id, NULL, NULL); + typestack = g_list_prepend(typestack,node); + ; break;} case 51: -#line 631 "parse.y" +#line 643 "parse.y" { - yyval.id = g_strconcat("signed ",yyvsp[0].id,NULL); - ; + yyval.id = yyvsp[0].id; + ; break;} case 52: -#line 634 "parse.y" +#line 646 "parse.y" { - yyval.id = g_strdup(yyvsp[0].id); - ; + yyval.id = yyvsp[0].id; + ; break;} case 53: -#line 637 "parse.y" +#line 649 "parse.y" { - yyval.id = g_strdup("unsigned char"); - ; + yyval.id = g_strconcat("const ", yyvsp[0].id, NULL); + g_free(yyvsp[0].id); + ; break;} case 54: -#line 640 "parse.y" +#line 653 "parse.y" { - yyval.id = g_strdup("signed char"); - ; + yyval.id = g_strconcat(yyvsp[-1].id, " const", NULL); + g_free(yyvsp[-1].id); + ; break;} case 55: -#line 643 "parse.y" +#line 657 "parse.y" { - yyval.id = g_strdup("char"); - ; + yyval.id = g_strconcat(yyvsp[-1].id, " ", yyvsp[0].id, NULL); + g_free(yyvsp[0].id); + ; break;} case 56: -#line 646 "parse.y" +#line 661 "parse.y" { - yyval.id = g_strdup("double"); - ; + yyval.id = g_strconcat("const ", yyvsp[-1].id, " ", + yyvsp[0].id, NULL); + g_free(yyvsp[0].id); + ; break;} case 57: -#line 649 "parse.y" +#line 666 "parse.y" { - yyval.id = g_strdup("float"); - ; + yyval.id = g_strconcat(yyvsp[-2].id, " ", + yyvsp[-1].id, " const", NULL); + g_free(yyvsp[-1].id); + ; break;} case 58: -#line 652 "parse.y" +#line 674 "parse.y" { - yyval.id = yyvsp[0].id; - ; + yyval.id = g_strconcat(yyvsp[-1].id, " ", yyvsp[0].id, NULL); + g_free(yyvsp[0].id); + ; break;} case 59: -#line 655 "parse.y" +#line 678 "parse.y" { - yyval.id = g_strconcat(yyvsp[-1].id,yyvsp[0].id,NULL); + yyval.id = g_strconcat(yyvsp[-1].id, " ", yyvsp[0].id, NULL); + g_free(yyvsp[-1].id); g_free(yyvsp[0].id); - ; + ; break;} case 60: -#line 659 "parse.y" +#line 683 "parse.y" { - yyval.id = yyvsp[0].id; - ; + yyval.id = g_strconcat("const ", yyvsp[0].id, NULL); + g_free(yyvsp[0].id); + ; break;} case 61: -#line 662 "parse.y" +#line 687 "parse.y" { - yyval.id = g_strdup("void"); - ; + yyval.id = yyvsp[0].id; + ; break;} case 62: -#line 667 "parse.y" +#line 690 "parse.y" { - yyval.id = "long int"; - ; + yyval.id = g_strconcat(yyvsp[-1].id, " const", NULL); + g_free(yyvsp[-1].id); + ; break;} case 63: -#line 670 "parse.y" +#line 694 "parse.y" { - yyval.id = "long"; - ; + yyval.id = g_strdup(yyvsp[0].id); + ; break;} case 64: -#line 673 "parse.y" +#line 697 "parse.y" { - yyval.id = "short int"; - ; + yyval.id = g_strconcat(yyvsp[-1].id, " const", NULL); + ; break;} case 65: -#line 676 "parse.y" -{ - yyval.id = "short"; - ; +#line 702 "parse.y" +{ yyval.id = "void"; ; break;} case 66: -#line 679 "parse.y" -{ - yyval.id = "int"; - ; +#line 703 "parse.y" +{ yyval.id = "char"; ; break;} case 67: -#line 684 "parse.y" -{ - yyval.id = "enum "; - ; +#line 704 "parse.y" +{ yyval.id = "short"; ; break;} case 68: -#line 687 "parse.y" -{ - yyval.id = "union "; - ; +#line 705 "parse.y" +{ yyval.id = "int"; ; break;} case 69: -#line 690 "parse.y" -{ - yyval.id = "struct "; - ; +#line 706 "parse.y" +{ yyval.id = "long"; ; break;} case 70: -#line 695 "parse.y" -{ stars++; ; +#line 707 "parse.y" +{ yyval.id = "float"; ; break;} case 71: -#line 696 "parse.y" -{ stars++; ; +#line 708 "parse.y" +{ yyval.id = "double"; ; break;} case 72: -#line 700 "parse.y" +#line 709 "parse.y" +{ yyval.id = "signed"; ; + break;} +case 73: +#line 710 "parse.y" +{ yyval.id = "unsigned"; ; + break;} +case 74: +#line 713 "parse.y" +{ yyval.id = "struct"; ; + break;} +case 75: +#line 714 "parse.y" +{ yyval.id = "union"; ; + break;} +case 76: +#line 715 "parse.y" +{ yyval.id = "enum"; ; + break;} +case 77: +#line 718 "parse.y" +{ yyval.id = g_strdup("*"); ; + break;} +case 78: +#line 719 "parse.y" +{ yyval.id = g_strdup("* const"); ; + break;} +case 79: +#line 720 "parse.y" +{ + yyval.id = g_strconcat("*", yyvsp[0].id, NULL); + g_free(yyvsp[0].id); + ; + break;} +case 80: +#line 724 "parse.y" +{ + yyval.id = g_strconcat("* const", yyvsp[0].id, NULL); + g_free(yyvsp[0].id); + ; + break;} +case 81: +#line 731 "parse.y" { if(strcmp(yyvsp[-1].id, "first")==0) yyval.sigtype = SIGNAL_FIRST_METHOD; @@ -1761,14 +1828,14 @@ case 72: g_free(yyvsp[-1].id); ; break;} -case 73: -#line 712 "parse.y" +case 82: +#line 743 "parse.y" { yyval.sigtype = SIGNAL_LAST_METHOD; ; break;} -case 74: -#line 718 "parse.y" +case 83: +#line 749 "parse.y" { if(strcmp(yyvsp[-1].id,"first")==0) yyval.sigtype = SIGNAL_FIRST_METHOD; @@ -1782,8 +1849,8 @@ case 74: g_free(yyvsp[-1].id); ; break;} -case 75: -#line 730 "parse.y" +case 84: +#line 761 "parse.y" { if(strcmp(yyvsp[-2].id,"first")==0) yyval.sigtype = SIGNAL_FIRST_METHOD; @@ -1797,47 +1864,47 @@ case 75: g_free(yyvsp[-2].id); ; break;} -case 76: -#line 742 "parse.y" +case 85: +#line 773 "parse.y" { yyval.sigtype = SIGNAL_LAST_METHOD; ; break;} -case 77: -#line 745 "parse.y" +case 86: +#line 776 "parse.y" { /* the_scope was default thus public */ the_scope = PUBLIC_SCOPE; ; break;} -case 78: -#line 751 "parse.y" +case 87: +#line 782 "parse.y" { gtktypes = g_list_prepend(gtktypes, yyvsp[-3].id); ; break;} -case 79: -#line 756 "parse.y" +case 88: +#line 787 "parse.y" { gtktypes = g_list_append(gtktypes, yyvsp[0].id); ; break;} -case 80: -#line 759 "parse.y" +case 89: +#line 790 "parse.y" { gtktypes = g_list_append(gtktypes, yyvsp[0].id); ; break;} -case 81: -#line 764 "parse.y" +case 90: +#line 795 "parse.y" { yyval.cbuf = yyvsp[0].cbuf; ; break;} -case 82: -#line 765 "parse.y" +case 91: +#line 796 "parse.y" { yyval.cbuf = NULL; ; break;} -case 83: -#line 769 "parse.y" +case 92: +#line 800 "parse.y" { if(!has_self) { yyerror(_("signal without 'self' as " @@ -1855,8 +1922,8 @@ case 83: ccode_line, vararg, yyvsp[-8].list); ; break;} -case 84: -#line 785 "parse.y" +case 93: +#line 816 "parse.y" { if(!has_self) { yyerror(_("signal without 'self' as " @@ -1874,8 +1941,8 @@ case 84: ccode_line, vararg, yyvsp[-8].list); ; break;} -case 85: -#line 801 "parse.y" +case 94: +#line 832 "parse.y" { if(!has_self) { yyerror(_("virtual method without 'self' as " @@ -1893,8 +1960,8 @@ case 85: ccode_line, vararg, NULL); ; break;} -case 86: -#line 817 "parse.y" +case 95: +#line 848 "parse.y" { if(!has_self) { yyerror(_("virtual method without 'self' as " @@ -1912,8 +1979,8 @@ case 86: ccode_line, vararg, NULL); ; break;} -case 87: -#line 833 "parse.y" +case 96: +#line 864 "parse.y" { if(!has_self) { yyerror(_("virtual method without 'self' as " @@ -1926,8 +1993,8 @@ case 87: ccode_line, vararg, NULL); ; break;} -case 88: -#line 844 "parse.y" +case 97: +#line 875 "parse.y" { push_function(NO_SCOPE, OVERRIDE_METHOD, yyvsp[-8].id, yyvsp[-5].id, yyvsp[0].cbuf, @@ -1935,8 +2002,8 @@ case 88: vararg, NULL); ; break;} -case 89: -#line 850 "parse.y" +case 98: +#line 881 "parse.y" { if(the_scope == CLASS_SCOPE) { yyerror(_("a method cannot be of class scope")); @@ -1948,8 +2015,8 @@ case 89: vararg, NULL); ; break;} -case 90: -#line 860 "parse.y" +case 99: +#line 891 "parse.y" { if(strcmp(yyvsp[-4].id, "init")==0) { push_init_arg(yyvsp[-2].id,FALSE); @@ -1972,8 +2039,8 @@ case 90: } ; break;} -case 91: -#line 883 "parse.y" +case 100: +#line 914 "parse.y" { g_free(onerror); onerror = NULL; g_free(defreturn); defreturn = NULL; @@ -1986,8 +2053,8 @@ case 91: g_free(yyvsp[-1].id); ; break;} -case 92: -#line 894 "parse.y" +case 101: +#line 925 "parse.y" { g_free(onerror); onerror = NULL; g_free(defreturn); defreturn = NULL; @@ -2008,30 +2075,30 @@ case 92: g_free(yyvsp[-1].id); ; break;} -case 93: -#line 913 "parse.y" +case 102: +#line 944 "parse.y" { g_free(onerror); onerror = NULL; g_free(defreturn); defreturn = NULL; ; break;} -case 94: -#line 919 "parse.y" +case 103: +#line 950 "parse.y" { yyval.id = yyvsp[0].id; ; break;} -case 95: -#line 920 "parse.y" +case 104: +#line 951 "parse.y" { yyval.id = (yyvsp[1].cbuf)->str; g_string_free(yyvsp[1].cbuf, FALSE); ; break;} -case 96: -#line 926 "parse.y" +case 105: +#line 957 "parse.y" { vararg = FALSE; has_self = FALSE; ; break;} -case 97: -#line 927 "parse.y" +case 106: +#line 958 "parse.y" { vararg = FALSE; has_self = TRUE; @@ -2044,8 +2111,8 @@ case 97: } ; break;} -case 98: -#line 938 "parse.y" +case 107: +#line 969 "parse.y" { has_self = TRUE; if(strcmp(yyvsp[-2].id,"self")==0) @@ -2057,40 +2124,40 @@ case 98: } ; break;} -case 99: -#line 948 "parse.y" +case 108: +#line 979 "parse.y" { has_self = FALSE; ; break;} -case 100: -#line 951 "parse.y" +case 109: +#line 982 "parse.y" { vararg = TRUE; ; break;} -case 101: -#line 952 "parse.y" +case 110: +#line 983 "parse.y" { vararg = FALSE; ; break;} -case 102: -#line 955 "parse.y" +case 111: +#line 986 "parse.y" { ; ; break;} -case 103: -#line 956 "parse.y" +case 112: +#line 987 "parse.y" { ; ; break;} -case 104: -#line 959 "parse.y" +case 113: +#line 990 "parse.y" { push_funcarg(yyvsp[0].id,NULL); ; break;} -case 105: -#line 962 "parse.y" +case 114: +#line 993 "parse.y" { push_funcarg(yyvsp[-1].id,yyvsp[0].id); ; break;} -case 106: -#line 965 "parse.y" +case 115: +#line 996 "parse.y" { if(strcmp(yyvsp[-2].id,"check")!=0) { yyerror(_("parse error")); @@ -2100,8 +2167,8 @@ case 106: push_funcarg(yyvsp[-4].id,NULL); ; break;} -case 107: -#line 973 "parse.y" +case 116: +#line 1004 "parse.y" { if(strcmp(yyvsp[-2].id,"check")!=0) { yyerror(_("parse error")); @@ -2111,16 +2178,16 @@ case 107: push_funcarg(yyvsp[-5].id,yyvsp[-4].id); ; break;} -case 108: -#line 983 "parse.y" +case 117: +#line 1014 "parse.y" { ; ; break;} -case 109: -#line 984 "parse.y" +case 118: +#line 1015 "parse.y" { ; ; break;} -case 110: -#line 987 "parse.y" +case 119: +#line 1018 "parse.y" { if(strcmp(yyvsp[0].id,"type")==0) { Node *node = new_check(TYPE_CHECK,NULL); @@ -2135,61 +2202,61 @@ case 110: g_free(yyvsp[0].id); ; break;} -case 111: -#line 1000 "parse.y" +case 120: +#line 1031 "parse.y" { Node *node = new_check(GT_CHECK,yyvsp[0].id); checks = g_list_append(checks,node); ; break;} -case 112: -#line 1004 "parse.y" +case 121: +#line 1035 "parse.y" { Node *node = new_check(LT_CHECK,yyvsp[0].id); checks = g_list_append(checks,node); ; break;} -case 113: -#line 1008 "parse.y" +case 122: +#line 1039 "parse.y" { Node *node = new_check(GE_CHECK,yyvsp[0].id); checks = g_list_append(checks,node); ; break;} -case 114: -#line 1012 "parse.y" +case 123: +#line 1043 "parse.y" { Node *node = new_check(LE_CHECK,yyvsp[0].id); checks = g_list_append(checks,node); ; break;} -case 115: -#line 1016 "parse.y" +case 124: +#line 1047 "parse.y" { Node *node = new_check(EQ_CHECK,yyvsp[0].id); checks = g_list_append(checks,node); ; break;} -case 116: -#line 1020 "parse.y" +case 125: +#line 1051 "parse.y" { Node *node = new_check(NE_CHECK,yyvsp[0].id); checks = g_list_append(checks,node); ; break;} -case 117: -#line 1026 "parse.y" +case 126: +#line 1057 "parse.y" { yyval.id = yyvsp[0].id; ; break;} -case 118: -#line 1027 "parse.y" +case 127: +#line 1058 "parse.y" { yyval.id = g_strconcat("-",yyvsp[0].id,NULL); g_free(yyvsp[0].id); ; break;} -case 119: -#line 1031 "parse.y" +case 128: +#line 1062 "parse.y" { yyval.id = yyvsp[0].id; ; break;} } @@ -2414,5 +2481,5 @@ yyerrhandle: } return 1; } -#line 1034 "parse.y" +#line 1065 "parse.y" diff --git a/src/parse.y b/src/parse.y index f052991..9764b67 100644 --- a/src/parse.y +++ b/src/parse.y @@ -23,6 +23,7 @@ #include "config.h" #include #include +#include #include #include "treefuncs.h" @@ -35,9 +36,9 @@ GList *nodes = NULL; static GList *class_nodes = NULL; Node *class = NULL; +char *chunk_size = NULL; static GList *typestack = NULL; -static int stars = 0; static GList *funcargs = NULL; static GList *checks = NULL; static int has_self = FALSE; @@ -126,10 +127,10 @@ push_function(int scope, int method, char *oid, char *id, g_assert(scope != CLASS_SCOPE); - if(method!=INIT_METHOD && method!=CLASS_INIT_METHOD) { - type = pop_type(); + if(method == INIT_METHOD || method == CLASS_INIT_METHOD) { + type = (Type *)new_type(g_strdup("void"), NULL, NULL); } else { - type = (Type *)new_type(0,g_strdup("void"),NULL); + type = pop_type(); } /* a complicated and ugly test to figure out if we have @@ -191,6 +192,9 @@ free_all_global_state(void) g_free(defreturn); defreturn = NULL; + g_free(chunk_size); + chunk_size = NULL; + g_list_foreach(gtktypes, (GFunc)g_free, NULL); g_list_free(gtktypes); gtktypes = NULL; @@ -225,7 +229,7 @@ push_init_arg(char *name, int is_class) else tn = g_strdup(((Class *)class)->otype); - type = new_type(1,tn,NULL); + type = new_type(tn, g_strdup("*"), NULL); node = new_funcarg((Type *)type,name,NULL); funcargs = g_list_prepend(funcargs, node); } @@ -236,7 +240,7 @@ push_self(char *id) Node *node; Node *type; GList *ch = NULL; - type = new_type(1,g_strdup(((Class *)class)->otype),NULL); + type = new_type(g_strdup(((Class *)class)->otype), g_strdup("*"), NULL); ch = g_list_append(ch,new_check(NULL_CHECK,NULL)); ch = g_list_append(ch,new_check(TYPE_CHECK,NULL)); node = new_funcarg((Type *)type,id,ch); @@ -365,11 +369,31 @@ class: classdec '{' classcode '}' { } ; -classdec: CLASS TYPETOKEN FROM TYPETOKEN { - class = new_class($2,$4,NULL); +classdec: CLASS TYPETOKEN FROM TYPETOKEN chunk { + class = new_class($2,$4,chunk_size,NULL); } ; - + +chunk: + | '(' TOKEN TOKEN ')' { + if(strcmp($2,"chunks") == 0) { + chunk_size = g_strdup($4); + } else { + yyerror(_("parse error")); + YYERROR; + } + } + | '(' TOKEN NUMBER ')' { + if(strcmp($2,"chunks") == 0) { + if(atoi($4) != 0) + chunk_size = g_strdup($4); + } else { + yyerror(_("parse error")); + YYERROR; + } + } + ; + classcode: classcode thing { ; } | thing { ; } ; @@ -553,16 +577,16 @@ argument: ARGUMENT flags argtype TOKEN TOKEN '{' CCODE TOKEN '{' CCODE ';' { root, $4, root, $4, root, $4, - root, $4, - root, $4, - root, $4, root, $4); } else { g_assert_not_reached(); } - /* get is the same for everything */ - get = g_strdup_printf("ARG = %s->%s;", root, $4); + if(strcmp($5, "stringlink")==0) { + get = g_strdup_printf("ARG = g_strdup(%s->%s);", root, $4); + } else + /* For everything else, get is just straight assignment */ + get = g_strdup_printf("ARG = %s->%s;", root, $4); g_free($5); @@ -605,95 +629,102 @@ flaglist: TOKEN '|' flaglist { ; -type: type1 { ; } - | CONST type1 { - Type *type = typestack->data; - char *oldname = type->name; - type->name = g_strconcat("const ",oldname,NULL); - g_free(oldname); - } - ; - -type1: type2 { - Node *node = new_type(0,$1,NULL); +type: specifier_list pointer { + Node *node = new_type($1, $2, NULL); typestack = g_list_prepend(typestack,node); - } - | type2 stars { - Node *node = new_type(stars,$1,NULL); - stars = 0; + } + | specifier_list { + Node *node = new_type($1, NULL, NULL); typestack = g_list_prepend(typestack,node); - } + } ; -type2: UNSIGNED integer { - $$ = g_strconcat("unsigned ",$2,NULL); - } - | SIGNED integer { - $$ = g_strconcat("signed ",$2,NULL); - } - | integer { - $$ = g_strdup($1); - } - | UNSIGNED CHAR { - $$ = g_strdup("unsigned char"); - } - | SIGNED CHAR { - $$ = g_strdup("signed char"); - } - | CHAR { - $$ = g_strdup("char"); - } - | DOUBLE { - $$ = g_strdup("double"); - } - | FLOAT { - $$ = g_strdup("float"); - } - | TOKEN { +/* The special cases are neccessary to avoid conflicts */ +specifier_list: spec_list { $$ = $1; - } - | tspecifier TOKEN { - $$ = g_strconcat($1,$2,NULL); - g_free($2); - } - | TYPETOKEN { + } + | TOKEN { $$ = $1; - } - | VOID { - $$ = g_strdup("void"); - } + } + | CONST TOKEN { + $$ = g_strconcat("const ", $2, NULL); + g_free($2); + } + | TOKEN CONST { + $$ = g_strconcat($1, " const", NULL); + g_free($1); + } + | strunionenum TOKEN { + $$ = g_strconcat($1, " ", $2, NULL); + g_free($2); + } + | CONST strunionenum TOKEN { + $$ = g_strconcat("const ", $2, " ", + $3, NULL); + g_free($3); + } + | strunionenum TOKEN CONST { + $$ = g_strconcat($1, " ", + $2, " const", NULL); + g_free($2); + } ; -integer: LONG INT { - $$ = "long int"; - } - | LONG { - $$ = "long"; - } - | SHORT INT { - $$ = "short int"; - } - | SHORT { - $$ = "short"; - } - | INT { - $$ = "int"; - } +/* The special const cases take care of conflicts ! */ +spec_list: specifier spec_list { + $$ = g_strconcat($1, " ", $2, NULL); + g_free($2); + } + | TYPETOKEN spec_list { + $$ = g_strconcat($1, " ", $2, NULL); + g_free($1); + g_free($2); + } + | CONST spec_list { + $$ = g_strconcat("const ", $2, NULL); + g_free($2); + } + | TYPETOKEN { + $$ = $1; + } + | TYPETOKEN CONST { + $$ = g_strconcat($1, " const", NULL); + g_free($1); + } + | specifier { + $$ = g_strdup($1); + } + | specifier CONST { + $$ = g_strconcat($1, " const", NULL); + } ; - -tspecifier: ENUM { - $$ = "enum "; - } - | UNION { - $$ = "union "; - } - | STRUCT { - $$ = "struct "; - } + +specifier: VOID { $$ = "void"; } + | CHAR { $$ = "char"; } + | SHORT { $$ = "short"; } + | INT { $$ = "int"; } + | LONG { $$ = "long"; } + | FLOAT { $$ = "float"; } + | DOUBLE { $$ = "double"; } + | SIGNED { $$ = "signed"; } + | UNSIGNED { $$ = "unsigned"; } + ; + +strunionenum: STRUCT { $$ = "struct"; } + | UNION { $$ = "union"; } + | ENUM { $$ = "enum"; } ; - -stars: '*' stars { stars++; } - | '*' { stars++; } + +pointer: '*' { $$ = g_strdup("*"); } + | '*' CONST { $$ = g_strdup("* const"); } + | '*' pointer { + $$ = g_strconcat("*", $2, NULL); + g_free($2); + } + | '*' CONST pointer { + $$ = g_strconcat("* const", $3, NULL); + g_free($3); + } ; /* this never sets the_scope */ diff --git a/src/test.gob b/src/test.gob index e31319b..be3f543 100644 --- a/src/test.gob +++ b/src/test.gob @@ -7,6 +7,7 @@ requires 0.93.0 %headertop{ /* this should go on the very top of the header */ + %} %ht{ /* this should go on the very top of the header as well */ @@ -37,6 +38,16 @@ static void jjjj(void); %} %h{ +enum _gob__enum_t { + BUDLIKY, BUDLIKY2 +}; + +struct _gob__struct_t { + int i, x, y, z; +}; +union _gob__union_t { + int i, x, y, z; +}; void bubu(void); %} %header{ @@ -141,7 +152,7 @@ class Gtk:Weird:Button from Gtk:Button { * * Returns: new object */ signal last INT (POINTER, INT) - int bleh2(self, Gtk:Widget * wid (check null type), + int bleh2(self, const Gtk:Widget * wid (check null type), int h (check > 0)) { /* testing multiple marshaller support */ return 0; @@ -185,6 +196,14 @@ class Gtk:Weird:Button from Gtk:Button { { return 25; } + public int consttest2(self, gchar const *text, ...) + { + return 25; + } + public int consttest3(self, Gtk:Widget const *wid (check null type)) + { + return 25; + } signal private first NONE (NONE) void googlegoogle(self) { @@ -216,12 +235,12 @@ class Gtk:Weird:Button from Gtk:Button { googlegoogle(self); } private virtual - void testprivvirtual2(self, int some_array[5][8][9]) + void testprivvirtual2(self, const int some_array[5][8][9]) { /* nothing here */ } public virtual - void testpublicvirtual(self, int some_array[5][8][9]) + void testpublicvirtual(self, int const some_array[5][8][9]) { /* nothing here */ } @@ -299,6 +318,26 @@ class Gtk:Weird:Button from Gtk:Button { { return FALSE; } + + /* testing types */ + public int t1; + public long int t2; + public int long t3; + public int long const t4; + public const int long t5; + public const char * const t6; + public char const * const t7; + public enum _gob__enum_t const * const t8; + public union _gob__union_t t9; + public union _gob__union_t * const * const * t10; + public struct _gob__struct_t * const * const * t11; + public const struct _gob__struct_t * const * const * t13; + public const enum _gob__enum_t * const * const * t14; + public enum _gob__enum_t t15; + public gchar const t16; + public const gchar * const t17; + public const gchar t18; + /* testing empty statements */ ; ; diff --git a/src/treefuncs.c b/src/treefuncs.c index 7ed3501..e424df3 100644 --- a/src/treefuncs.c +++ b/src/treefuncs.c @@ -41,12 +41,13 @@ Node * new_check (int chtype, char * number) return (Node *)self; } -Node * new_class (char * otype, char * ptype, GList * nodes) +Node * new_class (char * otype, char * ptype, char * chunk_size, GList * nodes) { Class * self = g_new0(Class, 1); self->type = CLASS_NODE; self->otype = otype; self->ptype = ptype; + self->chunk_size = chunk_size; self->nodes = nodes; return (Node *)self; } @@ -83,12 +84,12 @@ Node * new_method (int scope, int method, Type * mtype, char * otype, GList * gt return (Node *)self; } -Node * new_type (int stars, char * name, char * postfix) +Node * new_type (char * name, char * pointer, char * postfix) { Type * self = g_new0(Type, 1); self->type = TYPE_NODE; - self->stars = stars; self->name = name; + self->pointer = pointer; self->postfix = postfix; return (Node *)self; } @@ -112,8 +113,8 @@ Node * new_variable (int scope, Type * vtype, char * id, int line_no, char * des Argument * copy_argument (Argument * self) { Argument * new; - g_return_if_fail(self != NULL); - g_return_if_fail(self->type == ARGUMENT_NODE); + g_return_val_if_fail(self != NULL, NULL); + g_return_val_if_fail(self->type == ARGUMENT_NODE, NULL); new = g_new0(Argument, 1); new->type = ARGUMENT_NODE; new->gtktype = g_strdup(self->gtktype); @@ -131,8 +132,8 @@ Argument * copy_argument (Argument * self) CCode * copy_ccode (CCode * self) { CCode * new; - g_return_if_fail(self != NULL); - g_return_if_fail(self->type == CCODE_NODE); + g_return_val_if_fail(self != NULL, NULL); + g_return_val_if_fail(self->type == CCODE_NODE, NULL); new = g_new0(CCode, 1); new->type = CCODE_NODE; new->cctype = self->cctype; @@ -144,8 +145,8 @@ CCode * copy_ccode (CCode * self) Check * copy_check (Check * self) { Check * new; - g_return_if_fail(self != NULL); - g_return_if_fail(self->type == CHECK_NODE); + g_return_val_if_fail(self != NULL, NULL); + g_return_val_if_fail(self->type == CHECK_NODE, NULL); new = g_new0(Check, 1); new->type = CHECK_NODE; new->chtype = self->chtype; @@ -156,12 +157,13 @@ Check * copy_check (Check * self) Class * copy_class (Class * self) { Class * new; - g_return_if_fail(self != NULL); - g_return_if_fail(self->type == CLASS_NODE); + g_return_val_if_fail(self != NULL, NULL); + g_return_val_if_fail(self->type == CLASS_NODE, NULL); new = g_new0(Class, 1); new->type = CLASS_NODE; new->otype = g_strdup(self->otype); new->ptype = g_strdup(self->ptype); + new->chunk_size = g_strdup(self->chunk_size); new->nodes = copy_node_list(self->nodes); return new; } @@ -169,8 +171,8 @@ Class * copy_class (Class * self) FuncArg * copy_funcarg (FuncArg * self) { FuncArg * new; - g_return_if_fail(self != NULL); - g_return_if_fail(self->type == FUNCARG_NODE); + g_return_val_if_fail(self != NULL, NULL); + g_return_val_if_fail(self->type == FUNCARG_NODE, NULL); new = g_new0(FuncArg, 1); new->type = FUNCARG_NODE; new->atype = copy_type(self->atype); @@ -182,8 +184,8 @@ FuncArg * copy_funcarg (FuncArg * self) Method * copy_method (Method * self) { Method * new; - g_return_if_fail(self != NULL); - g_return_if_fail(self->type == METHOD_NODE); + g_return_val_if_fail(self != NULL, NULL); + g_return_val_if_fail(self->type == METHOD_NODE, NULL); new = g_new0(Method, 1); new->type = METHOD_NODE; new->scope = self->scope; @@ -207,12 +209,12 @@ Method * copy_method (Method * self) Type * copy_type (Type * self) { Type * new; - g_return_if_fail(self != NULL); - g_return_if_fail(self->type == TYPE_NODE); + g_return_val_if_fail(self != NULL, NULL); + g_return_val_if_fail(self->type == TYPE_NODE, NULL); new = g_new0(Type, 1); new->type = TYPE_NODE; - new->stars = self->stars; new->name = g_strdup(self->name); + new->pointer = g_strdup(self->pointer); new->postfix = g_strdup(self->postfix); return new; } @@ -220,8 +222,8 @@ Type * copy_type (Type * self) Variable * copy_variable (Variable * self) { Variable * new; - g_return_if_fail(self != NULL); - g_return_if_fail(self->type == VARIABLE_NODE); + g_return_val_if_fail(self != NULL, NULL); + g_return_val_if_fail(self->type == VARIABLE_NODE, NULL); new = g_new0(Variable, 1); new->type = VARIABLE_NODE; new->scope = self->scope; @@ -271,6 +273,7 @@ void free_class (Class * self) g_return_if_fail(self->type == CLASS_NODE); g_free(self->otype); g_free(self->ptype); + g_free(self->chunk_size); free_node_list(self->nodes); g_free(self); } @@ -306,6 +309,7 @@ void free_type (Type * self) g_return_if_fail(self != NULL); g_return_if_fail(self->type == TYPE_NODE); g_free(self->name); + g_free(self->pointer); g_free(self->postfix); g_free(self); } @@ -323,8 +327,8 @@ void free_variable (Variable * self) Node * copy_node(Node *node) { - g_return_if_fail(node != NULL); - g_return_if_fail(node->type >= 0 && node->type < LAST_NODE_TYPE); + g_return_val_if_fail(node != NULL, NULL); + g_return_val_if_fail(node->type >= 0 && node->type < LAST_NODE_TYPE, NULL); switch(node->type) { case ARGUMENT_NODE: return (Node *)copy_argument ((Argument *)node); case CCODE_NODE: return (Node *)copy_ccode ((CCode *)node); diff --git a/src/treefuncs.def b/src/treefuncs.def index dc72008..e7a16b0 100644 --- a/src/treefuncs.def +++ b/src/treefuncs.def @@ -45,12 +45,13 @@ ENDHEADER CLASS Class STRING otype # this object class type STRING ptype # parent class type + STRING chunk_size # if the object should be allocated with mem_chunks NODELIST nodes ENDCLASS CLASS Type - INT stars - STRING name + STRING name # the specifier part + STRING pointer # the pointer part STRING postfix ENDCLASS diff --git a/src/treefuncs.h b/src/treefuncs.h index 974540a..4d60558 100644 --- a/src/treefuncs.h +++ b/src/treefuncs.h @@ -102,6 +102,7 @@ struct _Class { int type; char * otype; char * ptype; + char * chunk_size; GList * nodes; }; @@ -133,8 +134,8 @@ struct _Method { struct _Type { int type; - int stars; char * name; + char * pointer; char * postfix; }; @@ -167,10 +168,10 @@ union _Node { Node * new_argument (char * gtktype, Type * atype, GList * flags, char * name, char * get, int get_line, char * set, int set_line, int line_no); Node * new_ccode (int cctype, char * cbuf, int line_no); Node * new_check (int chtype, char * number); -Node * new_class (char * otype, char * ptype, GList * nodes); +Node * new_class (char * otype, char * ptype, char * chunk_size, GList * nodes); Node * new_funcarg (Type * atype, char * name, GList * checks); Node * new_method (int scope, int method, Type * mtype, char * otype, GList * gtktypes, GList * flags, char * id, GList * args, char * onerror, char * defreturn, char * cbuf, int line_no, int ccode_line, gboolean vararg, int unique_id); -Node * new_type (int stars, char * name, char * postfix); +Node * new_type (char * name, char * pointer, char * postfix); Node * new_variable (int scope, Type * vtype, char * id, int line_no, char * destructor, int destructor_line, gboolean destructor_simple, char * initializer, int initializer_line); /* General copy/free functions */ diff --git a/src/util.c b/src/util.c index e47be5e..ae16914 100644 --- a/src/util.c +++ b/src/util.c @@ -53,13 +53,13 @@ remove_sep(char *base) { char *p; char *s = g_strdup(base); - while((p=strchr(s,':'))) + while((p = strchr(s, ':'))) strcpy(p,p+1); return s; } char * -replace_sep(char *base, char r) +replace_sep(const char *base, char r) { char *p; char *s = g_strdup(base); @@ -76,7 +76,7 @@ replace_sep(char *base, char r) /*separate the namespace part and then replace rest of separators with r*/ void -separns_replace_sep(char *base, char **ns, char **name, char r) +separns_replace_sep(const char *base, char **ns, char **name, char r) { char *p; char *s = g_strdup(base); @@ -100,21 +100,35 @@ separns_replace_sep(char *base, char **ns, char **name, char r) /* make a macro with some prefix before the name but after namespace */ char * -make_pre_macro(char *base, char *pre) +make_pre_macro(const char *base, const char *pre) { - char *s1,*s2; + char *ns, *name; char *s; + char **v = NULL; + + if(strchr(base, ' ')) { + int i; + v = g_strsplit(base, " ", 0); + for(i = 0; v[i] != NULL; i++) { + if(*v[i] && strcmp(v[i], "const") != 0) { + base = v[i]; + break; + } + } + } - separns_replace_sep(base,&s1,&s2,'_'); - if(s1) - s = g_strconcat(s1,"_",pre,"_",s2,NULL); + separns_replace_sep(base, &ns, &name, '_'); + if(ns) + s = g_strconcat(ns, "_", pre, "_", name,NULL); else - s = g_strconcat(pre,"_",s2,NULL); + s = g_strconcat(pre, "_", name, NULL); g_strup(s); - g_free(s1); - g_free(s2); + g_free(ns); + g_free(name); + + g_strfreev(v); return s; } diff --git a/src/util.h b/src/util.h index 72121ca..ba7f1b5 100644 --- a/src/util.h +++ b/src/util.h @@ -29,15 +29,15 @@ void print_error(gboolean is_warn, char *error, int line); /* remove the : separator from a typename */ char * remove_sep(char *base); /* replace the : separator from a typename with a different character*/ -char * replace_sep(char *base, char r); +char * replace_sep(const char *base, char r); /*separate the namespace part and then replace rest of separators with r*/ -void separns_replace_sep(char *base, char **ns, char **name, char r); +void separns_replace_sep(const char *base, char **ns, char **name, char r); /* make a macro with some prefix before the name but after namespace */ -char * make_pre_macro(char *base, char *pre); +char * make_pre_macro(const char *base,const char *pre); /* get a name usable for a cast from a GTK+ type (without GTK_TYPE_)*/ const char * get_cast(char *type, gboolean simple_only); -- 2.43.0