From 3379dcdfd0872947d761053c61d773add94d38c2 Mon Sep 17 00:00:00 2001 From: George Lebl Date: Mon, 3 Apr 2000 03:12:00 -0800 Subject: [PATCH] Release 0.93.2 --- ChangeLog | 33 ++ NEWS | 4 + configure | 4 +- configure.in | 4 +- doc/gob.1.in | 16 + gob.spec | 2 +- src/Makefile.am | 6 +- src/Makefile.in | 18 +- src/checks.c | 2 +- src/generate_treefuncs.pl | 298 +++++++++++ src/lexer.c | 1000 ++++++++++++++++++------------------- src/lexer.l | 27 +- src/main.c | 35 +- src/parse.c | 873 +++++++++++++++++--------------- src/parse.y | 150 ++++-- src/test.gob | 4 +- src/tree.c | 153 ------ src/tree.h | 195 -------- src/treefuncs.c | 374 ++++++++++++++ src/treefuncs.def | 112 +++++ src/treefuncs.h | 201 ++++++++ src/util.c | 2 +- 22 files changed, 2202 insertions(+), 1311 deletions(-) create mode 100755 src/generate_treefuncs.pl delete mode 100644 src/tree.c delete mode 100644 src/tree.h create mode 100644 src/treefuncs.c create mode 100644 src/treefuncs.def create mode 100644 src/treefuncs.h diff --git a/ChangeLog b/ChangeLog index 6ca25a0..822145e 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,36 @@ +Sun Apr 02 17:38:12 2000 George Lebl + + * src/Makefile.am: ass the .pl and .def file to EXTRA_DIST + +Sun Apr 2 14:37:49 PDT 2000 Manish Singh + + * configure.in: check for treefuncs.h instead of tree.h, since + the latter has gone bye-bye + +Sat Apr 01 23:27:47 2000 George Lebl + + * doc/gob.1.in: add documentation for defreturn + +Sat Apr 01 18:03:31 2000 George Lebl + + * src/{treefuncs.(def|c|h),generate_treefuncs.pl}: What would gob + be without some automatically generated code. The tree.[ch] was + hard to keep up and didn't have free/copy so these do, otherwise + it is the same. Also added a defreturn field to methods + + * src/*.[cyl]: include treefuncs.h rather then tree.h + + * src/{parse.y,lexer.l,main.c}: use the defreturn as the default for + return values of signals and virtual methods. If this is not + defined use the onerror or failing that '0'. onerror is also not + a reserved keyword anymore + + * configure.in: raise version + +Mon Mar 27 13:08:01 2000 George Lebl + + * Release 0.93.1 + Mon Mar 27 12:04:22 2000 George Lebl * src/util.[ch], src/main.c: figure out if we really need the special diff --git a/NEWS b/NEWS index 51d740a..08f942e 100644 --- a/NEWS +++ b/NEWS @@ -1,3 +1,7 @@ +0.93.2 + * defreturn for default return values on signals/virtuals + * code reorganisation + 0.93.1 * accept 1 word types * gob.m4 improvements (Eskil) diff --git a/configure b/configure index 10b91e4..0038bea 100755 --- a/configure +++ b/configure @@ -460,7 +460,7 @@ echo > confdefs.h # A filename unique to this package, relative to the directory that # configure is in, which we can look for to find out if srcdir is correct. -ac_unique_file=src/tree.h +ac_unique_file=src/treefuncs.h # Find the source files, if location was not specified. if test -z "$srcdir"; then @@ -703,7 +703,7 @@ fi PACKAGE=gob -VERSION=0.93.1 +VERSION=0.93.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 5a5d851..53c48c8 100644 --- a/configure.in +++ b/configure.in @@ -1,8 +1,8 @@ dnl Process this file with autoconf to produce a configure script. AC_PREREQ(2.2) -AC_INIT(src/tree.h) +AC_INIT(src/treefuncs.h) AM_CONFIG_HEADER(config.h) -AM_INIT_AUTOMAKE(gob,0.93.1) +AM_INIT_AUTOMAKE(gob,0.93.2) if test -f ../NOINST_GOB ; then DOINSTGOB= diff --git a/doc/gob.1.in b/doc/gob.1.in index df1472b..a2724c6 100644 --- a/doc/gob.1.in +++ b/doc/gob.1.in @@ -508,6 +508,22 @@ The onerror value is also used in overrides that have a return value, in case there isn't a parent method, PARENT_HANDLER will return it. More about this later. .PP +Default return: +.PP +Some signal and virtual methods have a return type. But what happens if +there is no default handler and no one connects to a signal. GOB will +normally have the wrappers return whatever you specify with onerror or '0' +if you haven't specified anything. But since 0.93.2 you can specify a default +return value with the keyword 'defreturn'. It's use is identical to the +use of onerror, and you can in fact use both at the same time. Example +.nf + + virtual int get_some_int(self) onerror -1 defreturn 10 ; + +.fi +That is an empty virtual method (in C++ terms a pure virtual). If you never +specify any handler for it in the derived children it will just return 10. +.PP Constructor methods: .PP There are two methods that handle the construction of an object, init and diff --git a/gob.spec b/gob.spec index 5d339ca..59c7c88 100644 --- a/gob.spec +++ b/gob.spec @@ -1,4 +1,4 @@ -%define ver 0.93.1 +%define ver 0.93.2 %define rel 1 %define prefix /usr diff --git a/src/Makefile.am b/src/Makefile.am index 504fcf0..28872fe 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -11,8 +11,8 @@ EXTRA_PROGRAMS = gob gob_SOURCES = \ main.c \ main.h \ - tree.c \ - tree.h \ + treefuncs.c \ + treefuncs.h \ out.c \ out.h \ util.c \ @@ -34,7 +34,7 @@ BUILT_SOURCES = parse.h parse.c lexer.c CLEANFILES += $(BUILT_SOURCES) gtk-weird-button.* gtk-weird-button-private.h -EXTRA_DIST = test.gob +EXTRA_DIST = test.gob generate_treefuncs.pl treefuncs.def parse.h: parse.y $(YACC) $(YFLAGS) $< diff --git a/src/Makefile.in b/src/Makefile.in index 3b197de..ced6ae4 100644 --- a/src/Makefile.in +++ b/src/Makefile.in @@ -88,7 +88,7 @@ bin_PROGRAMS = @DOINSTGOB@ noinst_PROGRAMS = @NOINSTGOB@ EXTRA_PROGRAMS = gob -gob_SOURCES = main.c main.h tree.c tree.h out.c out.h util.c util.h checks.c checks.h parse.y lexer.l +gob_SOURCES = main.c main.h treefuncs.c treefuncs.h out.c out.h util.c util.h checks.c checks.h parse.y lexer.l gob_LDADD = -lm $(GLIB_LIBS) @LEXLIB@ @@ -101,7 +101,7 @@ BUILT_SOURCES = parse.h parse.c lexer.c CLEANFILES = $(BUILT_SOURCES) gtk-weird-button.* gtk-weird-button-private.h -EXTRA_DIST = test.gob +EXTRA_DIST = test.gob generate_treefuncs.pl treefuncs.def mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs CONFIG_HEADER = ../config.h CONFIG_CLEAN_FILES = @@ -110,7 +110,7 @@ PROGRAMS = $(bin_PROGRAMS) $(noinst_PROGRAMS) DEFS = @DEFS@ -I. -I$(srcdir) -I.. LIBS = @LIBS@ -gob_OBJECTS = main.o tree.o out.o util.o checks.o parse.o lexer.o +gob_OBJECTS = main.o treefuncs.o out.o util.o checks.o parse.o lexer.o gob_DEPENDENCIES = gob_LDFLAGS = LEX_OUTPUT_ROOT = @LEX_OUTPUT_ROOT@ @@ -318,13 +318,15 @@ distdir: $(DISTFILES) || exit 1; \ fi; \ done -checks.o: checks.c ../config.h tree.h main.h util.h checks.h -lexer.o: lexer.c ../config.h tree.h parse.h main.h util.h -main.o: main.c ../config.h tree.h parse.h out.h util.h checks.h main.h +checks.o: checks.c ../config.h treefuncs.h main.h util.h checks.h +lexer.o: lexer.c ../config.h treefuncs.h parse.h main.h util.h +main.o: main.c ../config.h treefuncs.h parse.h out.h util.h checks.h \ + main.h out.o: out.c main.h out.h -parse.o: parse.c ../config.h tree.h main.h util.h +parse.o: parse.c ../config.h treefuncs.h main.h util.h +treefuncs.o: treefuncs.c treefuncs.h tree.o: tree.c ../config.h tree.h -util.o: util.c ../config.h tree.h main.h util.h +util.o: util.c ../config.h treefuncs.h main.h util.h info-am: info: info-recursive diff --git a/src/checks.c b/src/checks.c index f2bb058..d287341 100644 --- a/src/checks.c +++ b/src/checks.c @@ -24,7 +24,7 @@ #include #include -#include "tree.h" +#include "treefuncs.h" #include "main.h" #include "util.h" diff --git a/src/generate_treefuncs.pl b/src/generate_treefuncs.pl new file mode 100755 index 0000000..12890fc --- /dev/null +++ b/src/generate_treefuncs.pl @@ -0,0 +1,298 @@ +#!/usr/bin/perl -w + +open(FILE, "treefuncs.def") || die("Can't open treefuncs.def"); +open(OUTC, ">treefuncs.c") || die("Can't open treefuncs.c"); +open(OUTH, ">treefuncs.h") || die("Can't open treefuncs.h"); + +print OUTC "/* Generated by generate_treefuncs.pl from treefuncs.def!\n"; +print OUTC " * Do not edit by hand! */\n\n"; +print OUTH "/* Generated by generate_treefuncs.pl from treefuncs.def!\n"; +print OUTH " * Do not edit by hand! */\n\n"; + +$typedefs = "typedef union _Node Node;\n"; +$typeenums = "enum {\n"; + +$typename = ""; +%typestruct = (); +%newfunc = (); +%newfunc_prot = (); +%freefunc = (); +%freefunc_prot = (); +%copyfunc = (); +%copyfunc_prot = (); + +$var = ""; +$type = ""; +$copy = ""; +$free = ""; + +$headercode = ""; + +$inheadercode = 0; + +$vars = 0; + +sub end_var { + $typestruct{$typename} .= "\t$type $var;\n"; + + if($vars == 0) { + $newfunc_prot{$typename} .= "$type $var"; + } else { + $newfunc_prot{$typename} .= ", $type $var"; + } + $vars++; + + $newfunc{$typename} .= "\tself->$var = $var;\n"; + + if($copy ne "") { + $tmp = $copy; + $tmp =~ s/__VAL__/self->$var/g; + $tmp =~ s/__LVAL__/new->$var/g; + $copyfunc{$typename} .= "\t$tmp\n"; + } else { + $copyfunc{$typename} .= "\tnew->$var = self->$var;\n"; + } + if($free ne "") { + $tmp = $free; + $tmp =~ s/__VAL__/self->$var/g; + $freefunc{$typename} .= "\t$tmp\n"; + } +} + +while() { + if($inheadercode) { + if(/^ENDHEADER$/) { + $inheadercode = 0; + next; + } + $headercode .= $_; + next; + } + + s/#.*$//; + + if(/^[ \t]*HEADER[ \t]*$/) { + $inheadercode = 1; + next; + } + + if(/^[ \t]*CLASS[ \t]+([_A-Za-z][A-Za-z_0-9]+)[ \t]*$/) { + $typename = $1; + $lct = lc $typename; + $uct = uc $typename; + + $vars = 0; + + $typeenums .= "\t$uct"."_NODE,\n"; + + $typedefs .= "typedef struct _$typename $typename;\n"; + + $typestruct{$typename} = "struct _$typename {\n\tint type;\n"; + $newfunc_prot{$typename} = "Node * new_$lct ("; + $copyfunc_prot{$typename} = "$typename * copy_$lct ($typename * self)"; + $freefunc_prot{$typename} = "void free_$lct ($typename * self)"; + + $newfunc{$typename} = "{\n" . + "\t$typename * self = g_new0($typename, 1);\n" . + "\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" . + "\tnew = g_new0($typename, 1);\n" . + "\tnew->type = $uct"."_NODE;\n"; + $freefunc{$typename} = "{\n\tg_return_if_fail(self != NULL);\n" . + "\tg_return_if_fail(self->type == $uct"."_NODE);\n"; + + next; + } + + #ignore everything until we get some typename + if($typename eq "") { + next; + } + + #some predefined VARIABLE types + if(/^[ \t]*INT[ \t]+([_A-Za-z][A-Za-z_0-9]+)[ \t]*$/) { + $var = $1; + $type = "int"; + $copy = "__LVAL__ = __VAL__;"; + $free = ""; + end_var; + next; + } elsif(/^[ \t]*BOOL[ \t]+([_A-Za-z][A-Za-z_0-9]+)[ \t]*$/) { + $var = $1; + $type = "gboolean"; + $copy = "__LVAL__ = __VAL__;"; + $free = ""; + end_var; + next; + } elsif(/^[ \t]*STRING[ \t]+([_A-Za-z][A-Za-z_0-9]+)[ \t]*$/) { + $var = $1; + $type = "char *"; + $copy = "__LVAL__ = g_strdup(__VAL__);"; + $free = "g_free(__VAL__);"; + end_var; + next; + } elsif(/^[ \t]*STRINGLIST[ \t]+([_A-Za-z][A-Za-z_0-9]+)[ \t]*$/) { + $var = $1; + $type = "GList *"; + $copy = "__LVAL__ = g_list_copy(__VAL__); COPY_LIST_VALS(__LVAL__, g_strdup);"; + $free = "g_list_foreach(__VAL__, (GFunc)g_free, NULL); g_list_free(__VAL__);"; + end_var; + next; + } elsif(/^[ \t]*NODELIST[ \t]+([_A-Za-z][A-Za-z_0-9]+)[ \t]*$/) { + $var = $1; + $type = "GList *"; + $copy = "__LVAL__ = copy_node_list(__VAL__);"; + $free = "free_node_list(__VAL__);"; + end_var; + next; + #We assume one of the classes we are creating is named Type + } elsif(/^[ \t]*TYPE[ \t]+([_A-Za-z][A-Za-z_0-9]+)[ \t]*$/) { + $var = $1; + $type = "Type *"; + $copy = "__LVAL__ = copy_type(__VAL__);"; + $free = "free_type(__VAL__);"; + end_var; + next; + #generic variable type + } elsif(/^[ \t]*VAR[ \t]+([_A-Za-z][A-Za-z_0-9]+)[ \t]*$/) { + $var = $1; + $type = "int"; + $copy = "__LVAL__ = __VAL__;"; + $free = ""; + next; + } elsif(/^[ \t]*CTYPE[ \t]+(.+)[ \t]*$/) { + $type = $1; + next; + } elsif(/^[ \t]*COPY[ \t]+(.+)$/) { + $copy = $1; + next; + } elsif(/^[ \t]*FREE[ \t]+(.+)$/) { + $free = $1; + next; + } elsif(/^[ \t]*ENDVAR[ \t]*$/) { + end_var; + next; + } elsif(/^[ \t]*ENDCLASS[ \t]*$/) { + $typestruct{$typename} .= "};"; + $newfunc_prot{$typename} .= ")"; + + $newfunc{$typename} .= "\treturn (Node *)self;\n}"; + $copyfunc{$typename} .= "\treturn new;\n}"; + $freefunc{$typename} .= "\tg_free(self);\n}"; + $typename = ""; + next; + } else { + next; + } +} + +$typeenums .= "\tLAST_NODE_TYPE\n};"; + +print OUTH "\n#ifndef _TREEFUNCS_H_\n"; +print OUTH "\n#define _TREEFUNCS_H_\n"; + +print OUTH "\n$headercode\n\n"; +print OUTH "$typeenums\n\n"; +print OUTH "$typedefs\n\n"; + +foreach $t (sort keys %typestruct) { + print OUTH "$typestruct{$t}\n\n"; +} + +print OUTH "union _Node {\n\tint type;\n"; + +foreach $t (sort keys %typestruct) { + $foo = lc $t; + if($foo eq "type") { + print OUTH "\t$t _type;\n"; + } else { + print OUTH "\t$t $foo;\n"; + } +} +print OUTH "};\n\n"; + + +print OUTH "/* New functions */\n"; + +foreach $t (sort keys %newfunc_prot) { + print OUTH "$newfunc_prot{$t};\n"; +} + +print OUTH "\n/* General copy/free functions */\n"; +print OUTH "Node * copy_node(Node *node);\n"; +print OUTH "void free_node(Node *node);\n\n"; +print OUTH "GList * copy_node_list(GList *nodes);\n"; +print OUTH "void free_node_list(GList *nodes);\n"; + +print OUTH "\n/* Copy functions */\n"; +foreach $t (sort keys %copyfunc_prot) { + print OUTH "$copyfunc_prot{$t};\n"; +} +print OUTH "\n/* Free functions */\n"; +foreach $t (sort keys %freefunc_prot) { + print OUTH "$freefunc_prot{$t};\n"; +} + +print OUTH "\n#endif /*_TREEFUNCS_H_*/\n"; + +close(OUTH); + +print OUTC "#include \n#include \"treefuncs.h\"\n\n"; +print OUTC "#define COPY_LIST_VALS(list,func) " . + "{ GList *li; for(li=(list);li;li=li->next) { li->data=func(li->data); } }\n\n"; + +foreach $t (sort keys %newfunc_prot) { + print OUTC "$newfunc_prot{$t}\n$newfunc{$t}\n\n"; +} + +foreach $t (sort keys %copyfunc_prot) { + print OUTC "$copyfunc_prot{$t}\n$copyfunc{$t}\n\n"; +} + +foreach $t (sort keys %freefunc_prot) { + print OUTC "$freefunc_prot{$t}\n$freefunc{$t}\n\n"; +} + +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" . + "\tswitch(node->type) {\n"; +foreach $t (sort keys %typestruct) { + print OUTC "\tcase " . uc($t) . "_NODE: return (Node *)copy_" . lc($t) . " (($t *)node);\n"; +} +print OUTC "\tdefault: return NULL;\n\t}\n}\n\n"; + +print OUTC "void free_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" . + "\tswitch(node->type) {\n"; +foreach $t (sort keys %typestruct) { + print OUTC "\tcase " . uc($t) . "_NODE: free_" . lc($t) . " (($t *)node); return;\n"; +} +print OUTC "\tdefault: return;\n\t}\n}\n\n"; + +print OUTC "GList * copy_node_list(GList *nodes)\n" . + "{\n" . + "\tGList *li;\n" . + "\tnodes = g_list_copy(nodes);\n" . + "\tfor(li = nodes; li != NULL; li = li->next) {\n" . + "\t\tli->data = copy_node(li->data);\n" . + "\t}\n" . + "\treturn nodes;\n" . + "}\n\n"; + +print OUTC "void free_node_list(GList *nodes)\n" . + "{\n" . + "\tGList *li;\n" . + "\tfor(li = nodes; li != NULL; li = li->next) {\n" . + "\t\tfree_node(li->data);\n" . + "\t}\n" . + "\tg_list_free(nodes);\n" . + "}\n\n"; + +close(OUTC); diff --git a/src/lexer.c b/src/lexer.c index 824d2e8..958dd4d 100644 --- a/src/lexer.c +++ b/src/lexer.c @@ -284,102 +284,94 @@ static void yy_fatal_error YY_PROTO(( yyconst char msg[] )); *yy_cp = '\0'; \ yy_c_buf_p = yy_cp; -#define YY_NUM_RULES 88 -#define YY_END_OF_BUFFER 89 -static yyconst short int yy_acclist[428] = +#define YY_NUM_RULES 87 +#define YY_END_OF_BUFFER 88 +static yyconst short int yy_acclist[389] = { 0, - 89, 86, 88, 85, 86, 88, 1, 87, 88, 86, - 87, 88, 86, 88, 86, 88, 86, 88, 85, 86, - 88, 86, 88, 86, 88, 26, 86, 88, 1, 27, - 87, 88, 26, 86, 87, 88, 26, 86, 88, 26, - 86, 88, 49, 86, 88, 1, 50, 87, 88, 49, - 86, 87, 88, 42, 49, 86, 88, 49, 86, 88, - 49, 86, 88, 49, 86, 88, 49, 86, 88, 47, - 49, 86, 88, 48, 49, 86, 88, 49, 86, 88, - 49, 86, 88, 45, 86, 88, 1, 46, 87, 88, - 45, 86, 87, 88, 44, 45, 86, 88, 45, 86, - - 88, 45, 86, 88, 86, 88, 86, 88, 80, 86, - 88, 80, 86, 88, 80, 86, 88, 80, 86, 88, - 80, 86, 88, 82, 86, 88, 86, 88, 86, 88, - 77, 86, 88, 77, 86, 88, 86, 88, 80, 86, - 88, 80, 86, 88, 80, 86, 88, 80, 86, 88, - 80, 86, 88, 80, 86, 88, 80, 86, 88, 80, - 86, 88, 80, 86, 88, 80, 86, 88, 80, 86, - 88, 80, 86, 88, 83, 86, 88, 84, 86, 88, - 9, 86, 88, 9, 86, 87, 88, 9, 86, 88, - 9, 86, 88, 9, 86, 88, 9, 86, 88, 14, - - 86, 88, 14, 86, 87, 88, 14, 86, 88, 14, - 86, 88, 14, 86, 88, 14, 86, 88, 17, 86, - 88, 17, 86, 87, 88, 17, 86, 88, 17, 86, - 88, 21, 33, 25, 22, 41, 34, 43, 23, 79, - 80, 78, 80, 80, 80, 80, 77, 24, 77, 77, - 81, 80, 80, 80, 80, 80, 80, 80, 80, 80, - 80, 80, 80, 80, 80, 80, 80, 80, 80, 8, - 6, 13, 10, 12, 11, 13, 16, 15, 3, 28, - 32, 39, 35, 37, 18, 19, 79, 79, 78, 80, - 80, 80, 80, 68, 77, 20, 77, 77, 80, 80, - - 80, 80, 80, 80, 63, 80, 80, 80, 80, 80, - 80, 80, 80, 80, 80, 80, 80, 80, 80, 11, - 29, 30, 31, 40, 36, 38, 79, 80, 80, 54, - 80, 53, 80, 5, 80, 66, 80, 80, 80, 58, - 80, 80, 61, 80, 80, 80, 80, 80, 80, 80, - 80, 80, 80, 80, 80, 55, 80, 7, 51, 80, - 80, 67, 80, 80, 64, 80, 80, 80, 80, 80, - 80, 62, 80, 80, 80, 80, 57, 80, 80, 80, - 80, 80, 65, 80, 80, 80, 80, 80, 69, 80, - 74, 80, 59, 80, 56, 80, 80, 80, 80, 80, - - 76, 80, 80, 70, 80, 80, 80, 73, 80, 80, - 72, 80, 75, 80, 80, 60, 80, 80, 71, 80, - 80, 4, 80, 2, 2, 80, 52 + 88, 85, 87, 84, 85, 87, 1, 86, 87, 85, + 86, 87, 85, 87, 85, 87, 84, 85, 87, 85, + 87, 85, 87, 26, 85, 87, 1, 27, 86, 87, + 26, 85, 86, 87, 26, 85, 87, 26, 85, 87, + 49, 85, 87, 1, 50, 86, 87, 49, 85, 86, + 87, 42, 49, 85, 87, 49, 85, 87, 49, 85, + 87, 49, 85, 87, 47, 49, 85, 87, 48, 49, + 85, 87, 49, 85, 87, 49, 85, 87, 45, 85, + 87, 1, 46, 86, 87, 45, 85, 86, 87, 44, + 45, 85, 87, 45, 85, 87, 85, 87, 85, 87, + + 79, 85, 87, 79, 85, 87, 79, 85, 87, 79, + 85, 87, 81, 85, 87, 85, 87, 85, 87, 76, + 85, 87, 76, 85, 87, 85, 87, 79, 85, 87, + 79, 85, 87, 79, 85, 87, 79, 85, 87, 79, + 85, 87, 79, 85, 87, 79, 85, 87, 79, 85, + 87, 79, 85, 87, 79, 85, 87, 79, 85, 87, + 79, 85, 87, 82, 85, 87, 83, 85, 87, 9, + 85, 87, 9, 85, 86, 87, 9, 85, 87, 9, + 85, 87, 9, 85, 87, 14, 85, 87, 14, 85, + 86, 87, 14, 85, 87, 14, 85, 87, 14, 85, + + 87, 17, 85, 87, 17, 85, 86, 87, 17, 85, + 87, 21, 33, 25, 22, 41, 34, 43, 23, 78, + 79, 77, 79, 79, 79, 76, 24, 76, 76, 80, + 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, + 79, 79, 79, 79, 79, 79, 79, 8, 6, 13, + 10, 12, 11, 13, 16, 15, 3, 28, 32, 39, + 35, 37, 18, 19, 78, 78, 77, 79, 79, 79, + 68, 76, 20, 76, 76, 79, 79, 79, 79, 79, + 79, 63, 79, 79, 79, 79, 79, 79, 79, 79, + 79, 79, 79, 79, 79, 11, 29, 30, 31, 40, + + 36, 38, 78, 79, 54, 79, 53, 79, 5, 79, + 66, 79, 79, 79, 58, 79, 79, 61, 79, 79, + 79, 79, 79, 79, 79, 79, 79, 79, 79, 55, + 79, 7, 51, 79, 67, 79, 79, 64, 79, 79, + 79, 79, 79, 62, 79, 79, 79, 79, 57, 79, + 79, 79, 79, 65, 79, 79, 79, 79, 69, 79, + 74, 79, 59, 79, 56, 79, 79, 79, 79, 79, + 70, 79, 79, 79, 73, 79, 72, 79, 75, 79, + 79, 60, 79, 71, 79, 2, 4, 52 } ; -static yyconst short int yy_accept[372] = +static yyconst short int yy_accept[348] = { 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, 19, 22, 24, 26, - 29, 33, 37, 40, 43, 46, 50, 54, 58, 61, - 64, 67, 70, 74, 78, 81, 84, 87, 91, 95, - 99, 102, 105, 107, 109, 112, 115, 118, 121, 124, - 127, 129, 131, 134, 137, 139, 142, 145, 148, 151, - 154, 157, 160, 163, 166, 169, 172, 175, 178, 181, - 184, 188, 191, 194, 197, 200, 203, 207, 210, 213, - 216, 219, 222, 226, 229, 232, 233, 233, 233, 233, - - 233, 233, 233, 233, 233, 234, 234, 235, 235, 235, - 235, 235, 236, 236, 237, 237, 237, 238, 239, 240, - 240, 241, 242, 243, 244, 245, 246, 247, 247, 248, - 249, 249, 249, 250, 250, 250, 251, 251, 252, 253, - 254, 255, 256, 257, 258, 259, 260, 261, 262, 263, - 264, 265, 266, 267, 268, 269, 270, 271, 271, 271, - 271, 272, 272, 273, 273, 273, 273, 274, 275, 275, - 277, 278, 279, 279, 280, 280, 280, 280, 280, 281, - 281, 281, 282, 282, 282, 282, 283, 283, 283, 283, - 284, 285, 285, 286, 286, 286, 287, 288, 289, 290, - - 291, 292, 293, 294, 295, 296, 296, 296, 297, 298, - 299, 299, 300, 301, 302, 303, 304, 305, 307, 308, - 309, 310, 311, 312, 313, 314, 315, 316, 317, 318, - 319, 320, 320, 321, 321, 321, 321, 322, 322, 323, - 324, 324, 324, 325, 326, 327, 327, 328, 329, 330, - 332, 334, 334, 335, 336, 338, 339, 340, 342, 343, - 345, 346, 347, 348, 349, 350, 351, 352, 353, 354, - 355, 356, 358, 358, 359, 359, 359, 359, 360, 360, - 360, 360, 360, 360, 361, 362, 364, 365, 367, 368, - 369, 370, 371, 372, 374, 375, 376, 377, 379, 380, - - 381, 381, 381, 381, 381, 381, 381, 382, 383, 385, - 386, 387, 388, 389, 391, 393, 395, 397, 398, 399, - 399, 399, 399, 399, 399, 400, 401, 403, 404, 406, - 407, 408, 410, 410, 410, 410, 410, 410, 411, 413, - 415, 416, 418, 418, 418, 418, 418, 418, 419, 421, - 421, 421, 421, 421, 422, 422, 422, 422, 422, 423, - 424, 425, 425, 425, 427, 427, 427, 427, 427, 428, - 428 + 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, + 231, 232, 233, 234, 235, 236, 237, 238, 239, 240, + 241, 242, 243, 244, 245, 246, 247, 248, 249, 249, + 249, 249, 250, 250, 251, 251, 251, 251, 252, 253, + 253, 255, 256, 257, 257, 258, 258, 258, 258, 259, + 259, 259, 260, 260, 260, 260, 260, 261, 261, 261, + 261, 262, 263, 263, 264, 264, 264, 265, 266, 267, + 268, 269, 270, 271, 272, 273, 273, 273, 274, 275, + + 276, 276, 277, 278, 279, 280, 281, 282, 284, 285, + 286, 287, 288, 289, 290, 291, 292, 293, 294, 295, + 296, 296, 297, 297, 297, 298, 298, 299, 300, 300, + 300, 300, 301, 302, 303, 303, 304, 305, 307, 309, + 309, 310, 311, 313, 314, 315, 317, 318, 320, 321, + 322, 323, 324, 325, 326, 327, 328, 329, 330, 332, + 332, 333, 333, 333, 334, 334, 334, 334, 334, 334, + 334, 335, 337, 338, 340, 341, 342, 343, 344, 346, + 347, 348, 349, 351, 352, 353, 353, 353, 353, 353, + 353, 353, 354, 356, 357, 358, 359, 361, 363, 365, + + 367, 368, 369, 369, 369, 369, 369, 369, 370, 371, + 373, 374, 375, 377, 377, 377, 377, 377, 377, 379, + 381, 382, 384, 384, 384, 384, 384, 384, 384, 386, + 386, 386, 386, 387, 387, 387, 387, 387, 388, 388, + 388, 388, 388, 388, 388, 389, 389 } ; static yyconst int yy_ec[256] = @@ -387,17 +379,17 @@ static yyconst int yy_ec[256] = 1, 1, 1, 1, 1, 1, 1, 1, 2, 3, 1, 1, 4, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 5, 1, 6, 7, 1, 8, 1, 9, 1, - 1, 10, 1, 1, 1, 11, 12, 13, 14, 14, - 14, 14, 14, 14, 14, 15, 15, 16, 1, 17, - 1, 18, 1, 1, 19, 19, 20, 19, 21, 22, - 23, 24, 23, 23, 25, 23, 26, 23, 27, 23, - 23, 28, 23, 29, 30, 23, 23, 23, 23, 23, - 31, 32, 33, 1, 23, 1, 34, 35, 36, 37, - - 38, 39, 40, 41, 42, 23, 23, 43, 44, 45, - 46, 47, 48, 49, 50, 51, 52, 53, 23, 54, - 23, 23, 55, 1, 56, 1, 1, 1, 1, 1, + 1, 5, 1, 6, 7, 1, 8, 1, 9, 10, + 11, 12, 1, 1, 1, 13, 14, 15, 16, 17, + 17, 17, 17, 17, 17, 18, 18, 19, 1, 20, + 1, 21, 1, 1, 22, 22, 22, 22, 23, 22, + 24, 24, 25, 24, 24, 24, 24, 24, 24, 24, + 24, 26, 27, 24, 24, 24, 24, 24, 24, 24, + 28, 29, 30, 1, 24, 1, 31, 32, 33, 34, + + 35, 36, 37, 38, 39, 24, 24, 40, 41, 42, + 43, 44, 45, 46, 47, 48, 49, 50, 24, 51, + 24, 24, 52, 1, 53, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, @@ -414,310 +406,300 @@ static yyconst int yy_ec[256] = 1, 1, 1, 1, 1 } ; -static yyconst int yy_meta[57] = +static yyconst int yy_meta[54] = { 0, 1, 2, 3, 1, 2, 1, 1, 1, 1, 1, - 1, 1, 4, 4, 4, 5, 1, 1, 6, 6, - 6, 6, 7, 7, 7, 7, 7, 7, 7, 7, - 1, 1, 1, 6, 6, 6, 6, 6, 6, 7, + 1, 1, 1, 1, 4, 4, 4, 4, 5, 1, + 1, 6, 6, 7, 7, 7, 7, 1, 1, 1, + 6, 6, 6, 6, 6, 6, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, - 7, 7, 7, 7, 1, 1 + 7, 1, 1 } ; -static yyconst short int yy_base[393] = +static yyconst short int yy_base[371] = { 0, - 0, 35, 3, 5, 82, 136, 16, 24, 192, 0, - 238, 0, 7, 49, 31, 63, 66, 77, 822, 823, - 823, 823, 823, 4, 794, 777, 44, 49, 781, 823, - 823, 823, 806, 790, 823, 823, 823, 823, 66, 11, - 789, 0, 823, 823, 53, 759, 823, 823, 823, 823, - 787, 0, 50, 0, 797, 47, 2, 28, 66, 823, - 86, 99, 102, 112, 116, 63, 112, 86, 89, 90, - 102, 104, 119, 108, 125, 120, 135, 823, 823, 823, - 823, 800, 784, 168, 177, 823, 823, 798, 782, 252, - 253, 805, 804, 107, 156, 823, 803, 776, 770, 259, - - 765, 120, 228, 105, 823, 754, 823, 792, 254, 791, - 790, 823, 795, 823, 265, 752, 823, 823, 823, 793, - 779, 778, 777, 145, 153, 243, 255, 781, 171, 781, - 787, 285, 290, 300, 0, 305, 308, 758, 252, 262, - 257, 136, 279, 266, 301, 290, 308, 309, 311, 310, - 312, 314, 313, 317, 316, 318, 823, 334, 335, 346, - 823, 361, 823, 366, 367, 378, 823, 382, 776, 823, - 823, 823, 784, 823, 762, 735, 741, 728, 823, 748, - 726, 823, 725, 737, 726, 823, 768, 767, 766, 823, - 823, 771, 823, 737, 769, 823, 755, 754, 753, 8, - - 339, 334, 340, 823, 360, 389, 765, 823, 382, 0, - 385, 370, 366, 377, 326, 372, 385, 751, 386, 387, - 388, 389, 390, 391, 394, 393, 392, 401, 397, 395, - 396, 446, 823, 745, 715, 369, 823, 727, 823, 823, - 710, 720, 823, 823, 823, 718, 744, 407, 405, 743, - 742, 427, 823, 409, 741, 415, 424, 740, 419, 739, - 429, 434, 438, 436, 440, 441, 442, 443, 444, 445, - 447, 738, 466, 823, 485, 491, 725, 823, 706, 713, - 716, 700, 696, 449, 448, 731, 457, 730, 459, 465, - 468, 475, 481, 729, 482, 484, 486, 728, 487, 488, - - 721, 695, 692, 689, 701, 701, 490, 493, 721, 492, - 494, 497, 498, 720, 719, 718, 717, 502, 499, 702, - 465, 693, 680, 691, 48, 507, 712, 508, 707, 510, - 513, 692, 687, 657, 614, 525, 531, 523, 632, 577, - 518, 576, 566, 542, 547, 549, 539, 528, 560, 551, - 494, 546, 559, 531, 386, 306, 553, 563, 823, 554, - 823, 249, 560, 270, 141, 565, 581, 585, 823, 823, - 596, 603, 610, 617, 624, 631, 638, 645, 652, 654, - 658, 665, 672, 679, 683, 687, 694, 698, 703, 707, - 713, 720 - + 0, 32, 3, 5, 76, 127, 15, 19, 180, 0, + 221, 0, 8, 47, 35, 51, 54, 57, 809, 810, + 810, 810, 810, 12, 768, 26, 37, 772, 810, 810, + 810, 792, 778, 810, 810, 810, 810, 35, 15, 0, + 810, 810, 65, 751, 810, 810, 810, 810, 0, 31, + 0, 784, 43, 52, 54, 810, 78, 62, 93, 84, + 97, 97, 99, 102, 65, 84, 98, 103, 100, 106, + 119, 107, 129, 810, 810, 810, 810, 788, 149, 157, + 810, 810, 787, 161, 239, 797, 796, 150, 810, 795, + 766, 238, 761, 210, 211, 131, 810, 750, 810, 0, + + 785, 239, 784, 783, 810, 788, 810, 264, 748, 810, + 810, 810, 786, 769, 768, 767, 101, 104, 228, 772, + 260, 772, 780, 264, 270, 280, 0, 289, 293, 754, + 253, 270, 275, 280, 281, 293, 294, 295, 296, 300, + 146, 297, 301, 299, 302, 305, 307, 810, 320, 345, + 350, 810, 354, 810, 356, 360, 364, 810, 368, 767, + 810, 810, 810, 777, 810, 732, 738, 725, 810, 745, + 723, 810, 722, 734, 723, 745, 810, 761, 760, 759, + 810, 810, 764, 810, 733, 762, 810, 745, 744, 743, + 335, 345, 341, 810, 360, 378, 758, 810, 374, 0, + + 378, 360, 365, 366, 368, 378, 379, 741, 380, 382, + 383, 384, 385, 388, 387, 386, 393, 399, 395, 396, + 418, 810, 712, 122, 810, 724, 810, 810, 707, 717, + 730, 810, 810, 810, 714, 734, 397, 733, 732, 437, + 810, 405, 731, 403, 407, 730, 408, 729, 412, 422, + 309, 426, 429, 431, 430, 433, 435, 436, 728, 465, + 810, 471, 476, 810, 703, 710, 713, 693, 0, 683, + 445, 698, 452, 697, 450, 438, 463, 464, 693, 465, + 469, 472, 658, 473, 475, 613, 604, 546, 558, 569, + 557, 474, 571, 476, 479, 480, 569, 565, 554, 544, + + 482, 481, 456, 526, 502, 538, 506, 483, 488, 520, + 490, 492, 518, 487, 480, 8, 317, 517, 494, 442, + 493, 441, 415, 292, 527, 518, 535, 518, 229, 145, + 541, 549, 810, 534, 141, 553, 541, 810, 51, 559, + 31, 563, 580, 584, 810, 810, 598, 605, 612, 619, + 626, 633, 640, 647, 654, 656, 660, 667, 674, 681, + 688, 692, 696, 703, 707, 712, 716, 722, 729, 736 } ; -static yyconst short int yy_def[393] = +static yyconst short int yy_def[371] = { 0, - 371, 371, 372, 372, 373, 373, 374, 374, 370, 9, - 9, 11, 375, 375, 376, 376, 377, 377, 370, 370, - 370, 370, 370, 370, 370, 370, 370, 370, 370, 370, - 370, 370, 370, 370, 370, 370, 370, 370, 370, 370, - 370, 378, 370, 370, 370, 370, 370, 370, 370, 370, - 370, 379, 370, 380, 381, 381, 381, 381, 381, 370, - 370, 370, 370, 370, 370, 381, 381, 381, 381, 381, - 381, 381, 381, 381, 381, 381, 381, 370, 370, 370, - 370, 370, 370, 370, 370, 370, 370, 370, 370, 370, - 370, 370, 370, 370, 370, 370, 382, 370, 370, 370, - - 370, 370, 370, 370, 370, 370, 370, 370, 370, 370, - 370, 370, 383, 370, 370, 370, 370, 370, 370, 384, - 385, 381, 386, 381, 381, 381, 381, 370, 370, 370, - 387, 370, 370, 370, 388, 370, 370, 370, 381, 381, - 381, 381, 381, 381, 381, 381, 381, 381, 381, 381, - 381, 381, 381, 381, 381, 381, 370, 370, 370, 370, - 370, 389, 370, 370, 370, 370, 370, 370, 370, 370, - 370, 370, 382, 370, 370, 370, 370, 370, 370, 370, - 370, 370, 370, 370, 370, 370, 370, 370, 370, 370, - 370, 383, 370, 370, 384, 370, 385, 390, 386, 381, - - 381, 381, 381, 370, 370, 370, 387, 370, 370, 388, - 370, 381, 381, 381, 381, 381, 381, 381, 381, 381, - 381, 381, 381, 381, 381, 381, 381, 381, 381, 381, - 381, 391, 370, 370, 370, 370, 370, 370, 370, 370, - 370, 370, 370, 370, 370, 370, 390, 381, 381, 381, - 381, 370, 370, 381, 381, 381, 381, 381, 381, 381, - 381, 381, 381, 381, 381, 381, 381, 381, 381, 381, - 381, 381, 370, 370, 391, 370, 370, 370, 370, 370, - 370, 370, 370, 381, 381, 381, 381, 381, 381, 381, - 381, 381, 381, 381, 381, 381, 381, 381, 381, 381, - - 370, 370, 370, 370, 370, 370, 381, 381, 381, 381, - 381, 381, 381, 381, 381, 381, 381, 381, 381, 370, - 370, 370, 370, 370, 381, 381, 381, 381, 381, 381, - 381, 381, 370, 370, 370, 370, 370, 381, 381, 381, - 381, 381, 370, 370, 370, 370, 370, 381, 381, 370, - 370, 370, 392, 381, 370, 370, 370, 392, 370, 381, - 370, 370, 370, 381, 370, 370, 370, 370, 370, 0, - 370, 370, 370, 370, 370, 370, 370, 370, 370, 370, - 370, 370, 370, 370, 370, 370, 370, 370, 370, 370, - 370, 370 - + 347, 347, 348, 348, 349, 349, 350, 350, 346, 9, + 9, 11, 351, 351, 352, 352, 353, 353, 346, 346, + 346, 346, 346, 346, 346, 346, 346, 346, 346, 346, + 346, 346, 346, 346, 346, 346, 346, 346, 346, 354, + 346, 346, 346, 346, 346, 346, 346, 346, 355, 346, + 356, 357, 357, 357, 357, 346, 346, 346, 346, 346, + 346, 357, 357, 357, 357, 357, 357, 357, 357, 357, + 357, 357, 357, 346, 346, 346, 346, 346, 346, 346, + 346, 346, 346, 346, 346, 346, 346, 346, 346, 358, + 346, 346, 346, 346, 346, 346, 346, 346, 346, 359, + + 346, 346, 346, 346, 346, 360, 346, 346, 346, 346, + 346, 346, 361, 362, 357, 363, 357, 357, 357, 346, + 346, 346, 364, 346, 346, 346, 365, 346, 346, 346, + 357, 357, 357, 357, 357, 357, 357, 357, 357, 357, + 357, 357, 357, 357, 357, 357, 357, 346, 346, 346, + 346, 346, 366, 346, 346, 346, 346, 346, 346, 346, + 346, 346, 346, 358, 346, 346, 346, 346, 346, 346, + 346, 346, 346, 346, 346, 346, 346, 346, 346, 346, + 346, 346, 360, 346, 346, 361, 346, 362, 367, 363, + 357, 357, 357, 346, 346, 346, 364, 346, 346, 365, + + 346, 357, 357, 357, 357, 357, 357, 357, 357, 357, + 357, 357, 357, 357, 357, 357, 357, 357, 357, 357, + 368, 346, 346, 346, 346, 346, 346, 346, 346, 346, + 346, 346, 346, 346, 346, 367, 357, 357, 357, 346, + 346, 357, 357, 357, 357, 357, 357, 357, 357, 357, + 357, 357, 357, 357, 357, 357, 357, 357, 357, 346, + 346, 368, 346, 346, 346, 346, 346, 346, 369, 346, + 357, 357, 357, 357, 357, 357, 357, 357, 357, 357, + 357, 357, 357, 357, 357, 346, 346, 346, 346, 346, + 346, 357, 357, 357, 357, 357, 357, 357, 357, 357, + + 357, 357, 346, 346, 346, 346, 346, 357, 357, 357, + 357, 357, 357, 346, 346, 346, 346, 346, 357, 357, + 357, 357, 346, 346, 346, 346, 346, 346, 357, 346, + 346, 346, 346, 370, 346, 346, 370, 346, 346, 346, + 346, 346, 346, 346, 346, 0, 346, 346, 346, 346, + 346, 346, 346, 346, 346, 346, 346, 346, 346, 346, + 346, 346, 346, 346, 346, 346, 346, 346, 346, 346 } ; -static yyconst short int yy_nxt[880] = +static yyconst short int yy_nxt[864] = { 0, - 370, 21, 22, 23, 21, 31, 32, 31, 32, 22, - 81, 24, 33, 96, 33, 97, 82, 123, 48, 49, - 112, 50, 113, 123, 370, 25, 48, 49, 34, 50, - 34, 248, 83, 22, 87, 26, 27, 22, 23, 27, - 88, 51, 28, 123, 125, 100, 24, 52, 100, 51, - 84, 22, 81, 84, 115, 52, 89, 115, 85, 119, - 25, 120, 123, 123, 90, 22, 87, 90, 22, 93, - 26, 108, 91, 124, 83, 94, 126, 338, 123, 22, - 93, 123, 102, 29, 36, 37, 94, 38, 89, 103, - 39, 95, 101, 40, 116, 104, 128, 109, 129, 129, - - 129, 123, 95, 105, 123, 123, 127, 41, 130, 171, - 131, 139, 132, 42, 133, 133, 134, 123, 172, 123, - 110, 111, 132, 123, 136, 136, 136, 123, 137, 137, - 137, 142, 144, 143, 123, 123, 43, 44, 36, 37, - 123, 38, 45, 46, 39, 183, 145, 40, 138, 146, - 123, 123, 140, 184, 125, 135, 149, 141, 171, 150, - 123, 41, 177, 147, 154, 151, 152, 42, 123, 158, - 178, 148, 158, 200, 179, 153, 155, 159, 160, 161, - 156, 162, 98, 205, 205, 205, 201, 215, 157, 183, - 43, 44, 20, 21, 22, 23, 21, 20, 20, 20, - - 20, 20, 20, 53, 20, 20, 20, 54, 20, 20, - 55, 55, 55, 55, 55, 55, 55, 56, 55, 55, - 55, 55, 20, 20, 20, 55, 55, 57, 55, 55, - 58, 55, 55, 55, 55, 55, 55, 55, 55, 55, - 55, 55, 59, 55, 55, 55, 60, 20, 61, 62, - 63, 64, 64, 164, 166, 167, 164, 168, 123, 187, - 100, 165, 169, 100, 170, 180, 115, 123, 65, 115, - 123, 66, 123, 67, 68, 69, 70, 123, 181, 71, - 72, 123, 182, 73, 74, 123, 365, 75, 202, 76, - 77, 212, 78, 79, 123, 213, 203, 209, 209, 209, - - 132, 214, 133, 133, 134, 123, 116, 101, 188, 189, - 132, 217, 134, 134, 134, 132, 123, 136, 136, 136, - 137, 137, 137, 123, 123, 123, 123, 123, 123, 123, - 216, 123, 123, 123, 219, 158, 160, 161, 158, 162, - 138, 123, 362, 159, 224, 220, 221, 160, 161, 123, - 160, 218, 222, 226, 123, 123, 223, 225, 228, 231, - 257, 227, 160, 161, 230, 160, 229, 164, 166, 167, - 164, 168, 205, 205, 205, 165, 169, 250, 233, 166, - 167, 123, 166, 166, 167, 123, 166, 123, 249, 251, - 252, 253, 123, 252, 209, 209, 209, 137, 137, 137, - - 123, 123, 123, 123, 123, 123, 123, 123, 123, 123, - 123, 123, 123, 361, 255, 258, 123, 138, 259, 279, - 123, 254, 123, 179, 123, 260, 256, 284, 252, 253, - 123, 252, 272, 265, 123, 261, 262, 267, 270, 123, - 264, 263, 266, 268, 123, 271, 269, 273, 274, 123, - 273, 123, 285, 123, 251, 123, 123, 123, 123, 123, - 123, 276, 123, 123, 123, 286, 287, 273, 274, 288, - 273, 291, 123, 292, 123, 295, 307, 289, 297, 296, - 123, 293, 290, 123, 299, 308, 273, 274, 298, 273, - 123, 294, 273, 274, 309, 273, 123, 123, 300, 123, - - 276, 123, 123, 123, 310, 123, 311, 123, 123, 123, - 313, 325, 123, 123, 123, 334, 314, 123, 312, 182, - 316, 319, 123, 123, 315, 123, 346, 356, 123, 346, - 328, 318, 347, 123, 329, 347, 317, 326, 123, 331, - 327, 332, 348, 123, 353, 340, 123, 341, 330, 342, - 346, 360, 354, 346, 349, 353, 357, 339, 352, 352, - 352, 352, 352, 352, 359, 363, 363, 363, 359, 123, - 366, 355, 363, 363, 363, 123, 359, 367, 367, 367, - 359, 364, 368, 369, 351, 368, 368, 369, 181, 368, - 350, 123, 123, 367, 367, 367, 20, 20, 20, 20, - - 20, 20, 20, 30, 30, 30, 30, 30, 30, 30, - 35, 35, 35, 35, 35, 35, 35, 47, 47, 47, - 47, 47, 47, 47, 80, 80, 80, 80, 80, 80, - 80, 86, 86, 86, 86, 86, 86, 86, 92, 92, - 92, 92, 92, 92, 92, 114, 114, 123, 114, 114, - 114, 114, 118, 118, 345, 118, 118, 118, 118, 121, - 121, 122, 122, 122, 122, 173, 173, 173, 173, 173, - 173, 173, 192, 192, 192, 192, 192, 192, 192, 195, - 195, 195, 195, 195, 195, 195, 197, 197, 197, 197, - 199, 199, 199, 199, 207, 207, 207, 207, 207, 207, - - 207, 210, 344, 210, 232, 232, 343, 123, 232, 232, - 247, 247, 247, 247, 275, 275, 275, 275, 275, 275, - 358, 358, 123, 358, 358, 358, 358, 123, 337, 336, - 335, 333, 123, 123, 123, 123, 123, 324, 323, 322, - 321, 178, 320, 123, 123, 123, 123, 306, 305, 304, - 303, 302, 301, 123, 123, 123, 123, 123, 123, 198, - 283, 282, 281, 280, 278, 277, 123, 208, 123, 198, - 198, 196, 246, 193, 245, 244, 243, 242, 241, 240, - 239, 238, 237, 236, 235, 234, 174, 233, 211, 208, - 206, 204, 123, 123, 198, 196, 194, 193, 191, 190, - - 186, 185, 106, 176, 175, 174, 171, 171, 98, 163, - 98, 157, 123, 98, 117, 98, 98, 107, 106, 99, - 98, 370, 19, 370, 370, 370, 370, 370, 370, 370, - 370, 370, 370, 370, 370, 370, 370, 370, 370, 370, - 370, 370, 370, 370, 370, 370, 370, 370, 370, 370, - 370, 370, 370, 370, 370, 370, 370, 370, 370, 370, - 370, 370, 370, 370, 370, 370, 370, 370, 370, 370, - 370, 370, 370, 370, 370, 370, 370, 370, 370 + 346, 21, 22, 23, 21, 30, 31, 30, 31, 325, + 22, 77, 325, 24, 32, 346, 32, 46, 47, 78, + 48, 46, 47, 89, 48, 90, 105, 92, 106, 33, + 92, 346, 25, 26, 22, 23, 26, 22, 82, 27, + 101, 346, 112, 49, 113, 24, 83, 49, 79, 22, + 77, 79, 84, 22, 82, 84, 22, 87, 80, 22, + 87, 116, 85, 102, 25, 88, 108, 94, 88, 108, + 116, 93, 116, 122, 95, 123, 173, 28, 35, 36, + 96, 37, 117, 116, 38, 341, 103, 104, 97, 39, + 120, 119, 121, 121, 121, 121, 124, 118, 128, 128, + + 128, 128, 116, 109, 40, 124, 135, 125, 125, 125, + 126, 129, 129, 129, 129, 116, 116, 116, 116, 116, + 116, 116, 116, 136, 116, 116, 130, 41, 42, 35, + 36, 191, 37, 43, 44, 38, 132, 116, 117, 137, + 39, 133, 131, 127, 134, 138, 192, 116, 145, 139, + 149, 140, 162, 149, 141, 40, 142, 143, 151, 152, + 150, 153, 155, 163, 116, 155, 144, 146, 173, 265, + 148, 147, 156, 169, 339, 335, 174, 213, 41, 42, + 20, 21, 22, 23, 21, 20, 20, 20, 20, 20, + 20, 20, 20, 50, 20, 20, 20, 20, 51, 20, + + 20, 52, 52, 52, 52, 52, 52, 20, 20, 20, + 52, 52, 53, 52, 52, 54, 52, 52, 52, 52, + 52, 52, 52, 52, 52, 52, 52, 55, 52, 52, + 52, 56, 20, 57, 58, 59, 60, 60, 60, 92, + 157, 158, 92, 159, 178, 170, 116, 116, 61, 167, + 160, 62, 161, 63, 64, 65, 66, 168, 171, 67, + 68, 169, 172, 69, 70, 108, 193, 71, 108, 72, + 73, 116, 74, 75, 195, 195, 195, 195, 199, 199, + 199, 199, 124, 93, 125, 125, 125, 126, 116, 202, + 179, 180, 124, 116, 126, 126, 126, 126, 116, 116, + + 203, 124, 109, 128, 128, 128, 128, 129, 129, 129, + 129, 116, 116, 116, 116, 116, 204, 116, 116, 116, + 116, 149, 130, 116, 149, 116, 330, 116, 205, 206, + 210, 150, 326, 327, 327, 207, 209, 215, 211, 214, + 217, 208, 212, 277, 216, 220, 151, 152, 218, 153, + 219, 151, 152, 116, 151, 151, 152, 155, 151, 116, + 155, 157, 158, 116, 159, 157, 158, 156, 157, 157, + 158, 160, 157, 222, 195, 195, 195, 195, 116, 240, + 241, 237, 240, 116, 116, 238, 116, 239, 199, 199, + 199, 199, 129, 129, 129, 129, 116, 116, 116, 245, + + 116, 116, 116, 116, 116, 116, 116, 130, 242, 247, + 243, 116, 244, 116, 116, 116, 248, 116, 246, 260, + 261, 116, 260, 116, 252, 116, 116, 249, 254, 259, + 116, 251, 250, 253, 255, 256, 263, 257, 240, 241, + 116, 240, 258, 239, 116, 271, 273, 116, 116, 116, + 272, 116, 276, 116, 116, 274, 116, 275, 171, 116, + 116, 280, 282, 116, 278, 281, 260, 261, 116, 260, + 116, 284, 260, 261, 283, 260, 279, 260, 261, 292, + 260, 116, 116, 116, 285, 295, 293, 116, 294, 263, + 116, 116, 116, 116, 116, 296, 297, 116, 116, 116, + + 116, 116, 299, 314, 298, 302, 116, 172, 116, 309, + 116, 116, 116, 310, 301, 308, 312, 324, 328, 300, + 313, 328, 320, 334, 321, 322, 329, 311, 325, 323, + 319, 325, 332, 332, 332, 332, 116, 334, 116, 338, + 318, 331, 331, 331, 331, 333, 338, 317, 316, 332, + 332, 332, 332, 336, 338, 331, 331, 331, 331, 333, + 315, 338, 116, 332, 332, 332, 332, 340, 340, 340, + 340, 342, 116, 340, 340, 340, 340, 343, 343, 343, + 343, 344, 345, 116, 344, 344, 345, 116, 344, 116, + 307, 306, 305, 304, 343, 343, 343, 343, 20, 20, + + 20, 20, 20, 20, 20, 29, 29, 29, 29, 29, + 29, 29, 34, 34, 34, 34, 34, 34, 34, 45, + 45, 45, 45, 45, 45, 45, 76, 76, 76, 76, + 76, 76, 76, 81, 81, 81, 81, 81, 81, 81, + 86, 86, 86, 86, 86, 86, 86, 107, 107, 303, + 107, 107, 107, 107, 111, 111, 168, 111, 111, 111, + 111, 114, 114, 115, 115, 115, 115, 164, 164, 164, + 164, 164, 164, 164, 176, 176, 116, 176, 176, 176, + 176, 183, 183, 183, 183, 183, 183, 183, 186, 186, + 186, 186, 186, 186, 186, 188, 188, 188, 188, 190, + + 190, 190, 190, 197, 197, 197, 197, 197, 197, 197, + 200, 116, 200, 221, 221, 116, 116, 221, 221, 236, + 236, 236, 236, 262, 262, 262, 262, 262, 262, 290, + 290, 291, 290, 290, 290, 290, 337, 337, 289, 337, + 337, 337, 337, 288, 287, 286, 116, 116, 116, 116, + 116, 116, 189, 270, 269, 268, 267, 266, 264, 116, + 198, 116, 189, 189, 187, 235, 184, 234, 233, 232, + 231, 230, 229, 228, 227, 226, 225, 224, 223, 165, + 222, 201, 198, 196, 194, 116, 116, 189, 187, 185, + 184, 182, 181, 177, 175, 98, 166, 165, 162, 162, + + 154, 148, 116, 110, 100, 99, 98, 91, 346, 19, + 346, 346, 346, 346, 346, 346, 346, 346, 346, 346, + 346, 346, 346, 346, 346, 346, 346, 346, 346, 346, + 346, 346, 346, 346, 346, 346, 346, 346, 346, 346, + 346, 346, 346, 346, 346, 346, 346, 346, 346, 346, + 346, 346, 346, 346, 346, 346, 346, 346, 346, 346, + 346, 346, 346 } ; -static yyconst short int yy_chk[880] = +static yyconst short int yy_chk[864] = { 0, - 0, 1, 1, 1, 1, 3, 3, 4, 4, 13, - 13, 1, 3, 24, 4, 24, 13, 57, 7, 7, - 40, 7, 40, 200, 0, 1, 8, 8, 3, 8, - 4, 200, 13, 15, 15, 1, 2, 2, 2, 2, - 15, 7, 2, 58, 57, 27, 2, 7, 27, 8, - 14, 14, 14, 14, 45, 8, 15, 45, 14, 53, - 2, 53, 56, 325, 16, 16, 16, 16, 17, 17, - 2, 39, 16, 56, 14, 17, 58, 325, 66, 18, - 18, 59, 28, 2, 5, 5, 18, 5, 16, 28, - 5, 17, 27, 5, 45, 28, 61, 39, 61, 61, - - 61, 68, 18, 28, 69, 70, 59, 5, 62, 94, - 62, 66, 63, 5, 63, 63, 63, 71, 94, 72, - 39, 39, 64, 74, 64, 64, 64, 67, 65, 65, - 65, 68, 70, 69, 73, 76, 5, 5, 6, 6, - 75, 6, 6, 6, 6, 104, 71, 6, 65, 72, - 77, 142, 67, 104, 67, 63, 74, 67, 95, 74, - 124, 6, 102, 73, 76, 75, 75, 6, 125, 84, - 102, 73, 84, 124, 102, 75, 77, 84, 85, 85, - 77, 85, 95, 129, 129, 129, 125, 142, 85, 365, - 6, 6, 9, 9, 9, 9, 9, 9, 9, 9, - + 0, 1, 1, 1, 1, 3, 3, 4, 4, 316, + 13, 13, 316, 1, 3, 0, 4, 7, 7, 13, + 7, 8, 8, 24, 8, 24, 39, 26, 39, 4, + 26, 0, 1, 2, 2, 2, 2, 15, 15, 2, + 38, 0, 50, 7, 50, 2, 15, 8, 14, 14, + 14, 14, 16, 16, 16, 16, 17, 17, 14, 18, + 18, 53, 16, 38, 2, 17, 43, 27, 18, 43, + 54, 26, 55, 58, 27, 58, 341, 2, 5, 5, + 27, 5, 53, 65, 5, 339, 38, 38, 27, 5, + 57, 55, 57, 57, 57, 57, 60, 54, 60, 60, + + 60, 60, 66, 43, 5, 59, 65, 59, 59, 59, + 59, 61, 61, 61, 61, 62, 67, 63, 69, 117, + 64, 68, 118, 66, 70, 72, 61, 5, 5, 6, + 6, 117, 6, 6, 6, 6, 63, 71, 63, 67, + 6, 63, 62, 59, 64, 68, 118, 73, 72, 69, + 79, 70, 88, 79, 70, 6, 71, 71, 80, 80, + 79, 80, 84, 88, 141, 84, 71, 73, 96, 224, + 80, 73, 84, 224, 335, 330, 96, 141, 6, 6, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, + 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, 90, 91, 91, 90, 91, 126, 109, - 100, 90, 91, 100, 91, 103, 115, 139, 11, 115, - 127, 11, 141, 11, 11, 11, 11, 140, 103, 11, - 11, 144, 103, 11, 11, 364, 362, 11, 126, 11, - 11, 139, 11, 11, 143, 140, 127, 132, 132, 132, - - 133, 141, 133, 133, 133, 146, 115, 100, 109, 109, - 134, 144, 134, 134, 134, 136, 145, 136, 136, 136, - 137, 137, 137, 147, 148, 150, 149, 151, 153, 152, - 143, 155, 154, 156, 146, 158, 159, 159, 158, 159, - 137, 215, 356, 158, 150, 147, 148, 160, 160, 202, - 160, 145, 149, 152, 201, 203, 149, 151, 154, 156, - 215, 153, 162, 162, 155, 162, 154, 164, 165, 165, - 164, 165, 205, 205, 205, 164, 165, 202, 165, 166, - 166, 213, 166, 168, 168, 212, 168, 216, 201, 203, - 206, 206, 214, 206, 209, 209, 209, 211, 211, 211, - - 217, 219, 220, 221, 222, 223, 224, 227, 226, 225, - 230, 231, 229, 355, 213, 216, 228, 211, 217, 236, - 249, 212, 248, 236, 254, 219, 214, 248, 252, 252, - 256, 252, 231, 224, 259, 220, 221, 226, 229, 257, - 223, 222, 225, 227, 261, 230, 228, 232, 232, 262, - 232, 264, 254, 263, 249, 265, 266, 267, 268, 269, - 270, 232, 271, 285, 284, 256, 257, 273, 273, 259, - 273, 263, 287, 264, 289, 267, 284, 261, 268, 267, - 290, 265, 262, 291, 270, 285, 275, 275, 269, 275, - 292, 266, 276, 276, 287, 276, 293, 295, 271, 296, - - 275, 297, 299, 300, 289, 307, 290, 310, 308, 311, - 292, 307, 312, 313, 319, 321, 293, 318, 291, 321, - 296, 300, 326, 328, 295, 330, 336, 351, 331, 336, - 311, 299, 337, 341, 312, 337, 297, 308, 338, 318, - 310, 319, 338, 348, 347, 328, 354, 330, 313, 331, - 346, 354, 348, 346, 341, 347, 352, 326, 352, 352, - 352, 346, 346, 346, 353, 357, 357, 357, 358, 360, - 363, 350, 363, 363, 363, 349, 353, 366, 366, 366, - 358, 360, 367, 367, 345, 367, 368, 368, 344, 368, - 343, 342, 340, 367, 367, 367, 371, 371, 371, 371, - - 371, 371, 371, 372, 372, 372, 372, 372, 372, 372, - 373, 373, 373, 373, 373, 373, 373, 374, 374, 374, - 374, 374, 374, 374, 375, 375, 375, 375, 375, 375, - 375, 376, 376, 376, 376, 376, 376, 376, 377, 377, - 377, 377, 377, 377, 377, 378, 378, 339, 378, 378, - 378, 378, 379, 379, 335, 379, 379, 379, 379, 380, - 380, 381, 381, 381, 381, 382, 382, 382, 382, 382, - 382, 382, 383, 383, 383, 383, 383, 383, 383, 384, - 384, 384, 384, 384, 384, 384, 385, 385, 385, 385, - 386, 386, 386, 386, 387, 387, 387, 387, 387, 387, - - 387, 388, 334, 388, 389, 389, 333, 332, 389, 389, - 390, 390, 390, 390, 391, 391, 391, 391, 391, 391, - 392, 392, 329, 392, 392, 392, 392, 327, 324, 323, - 322, 320, 317, 316, 315, 314, 309, 306, 305, 304, - 303, 302, 301, 298, 294, 288, 286, 283, 282, 281, - 280, 279, 277, 272, 260, 258, 255, 251, 250, 247, - 246, 242, 241, 238, 235, 234, 218, 207, 199, 198, - 197, 195, 194, 192, 189, 188, 187, 185, 184, 183, - 181, 180, 178, 177, 176, 175, 173, 169, 138, 131, - 130, 128, 123, 122, 121, 120, 116, 113, 111, 110, - - 108, 106, 101, 99, 98, 97, 93, 92, 89, 88, - 83, 82, 55, 51, 46, 41, 34, 33, 29, 26, - 25, 19, 370, 370, 370, 370, 370, 370, 370, 370, - 370, 370, 370, 370, 370, 370, 370, 370, 370, 370, - 370, 370, 370, 370, 370, 370, 370, 370, 370, 370, - 370, 370, 370, 370, 370, 370, 370, 370, 370, 370, - 370, 370, 370, 370, 370, 370, 370, 370, 370, 370, - 370, 370, 370, 370, 370, 370, 370, 370, 370 + 9, 9, 9, 11, 11, 11, 11, 11, 11, 92, + 85, 85, 92, 85, 102, 95, 119, 329, 11, 94, + 85, 11, 85, 11, 11, 11, 11, 94, 95, 11, + 11, 94, 95, 11, 11, 108, 119, 11, 108, 11, + 11, 131, 11, 11, 121, 121, 121, 121, 124, 124, + 124, 124, 125, 92, 125, 125, 125, 125, 132, 131, + 102, 102, 126, 133, 126, 126, 126, 126, 134, 135, + + 132, 128, 108, 128, 128, 128, 128, 129, 129, 129, + 129, 136, 137, 138, 139, 142, 133, 144, 140, 143, + 145, 149, 129, 146, 149, 147, 324, 251, 134, 135, + 139, 149, 317, 317, 317, 136, 138, 143, 140, 142, + 145, 137, 140, 251, 144, 147, 150, 150, 145, 150, + 146, 151, 151, 191, 151, 153, 153, 155, 153, 193, + 155, 156, 156, 192, 156, 157, 157, 155, 157, 159, + 159, 156, 159, 156, 195, 195, 195, 195, 202, 196, + 196, 191, 196, 203, 204, 192, 205, 193, 199, 199, + 199, 199, 201, 201, 201, 201, 206, 207, 209, 205, + + 210, 211, 212, 213, 216, 215, 214, 201, 202, 207, + 203, 217, 204, 219, 220, 237, 209, 218, 206, 221, + 221, 244, 221, 242, 213, 245, 247, 210, 215, 220, + 249, 212, 211, 214, 216, 217, 221, 218, 240, 240, + 250, 240, 219, 237, 252, 242, 245, 253, 255, 254, + 244, 256, 250, 257, 258, 247, 276, 249, 323, 322, + 320, 254, 255, 271, 252, 254, 260, 260, 275, 260, + 273, 257, 262, 262, 256, 262, 253, 263, 263, 271, + 263, 277, 278, 280, 258, 276, 273, 281, 275, 262, + 282, 284, 292, 285, 294, 277, 278, 295, 296, 302, + + 301, 308, 281, 303, 280, 285, 309, 303, 311, 294, + 312, 321, 319, 295, 284, 292, 301, 315, 318, 282, + 302, 318, 309, 328, 311, 312, 321, 296, 325, 314, + 308, 325, 326, 326, 326, 326, 313, 328, 310, 334, + 307, 325, 325, 325, 325, 327, 337, 306, 305, 327, + 327, 327, 327, 331, 334, 331, 331, 331, 331, 332, + 304, 337, 300, 332, 332, 332, 332, 336, 336, 336, + 336, 340, 299, 340, 340, 340, 340, 342, 342, 342, + 342, 343, 343, 298, 343, 344, 344, 297, 344, 293, + 291, 290, 289, 288, 343, 343, 343, 343, 347, 347, + + 347, 347, 347, 347, 347, 348, 348, 348, 348, 348, + 348, 348, 349, 349, 349, 349, 349, 349, 349, 350, + 350, 350, 350, 350, 350, 350, 351, 351, 351, 351, + 351, 351, 351, 352, 352, 352, 352, 352, 352, 352, + 353, 353, 353, 353, 353, 353, 353, 354, 354, 287, + 354, 354, 354, 354, 355, 355, 286, 355, 355, 355, + 355, 356, 356, 357, 357, 357, 357, 358, 358, 358, + 358, 358, 358, 358, 359, 359, 283, 359, 359, 359, + 359, 360, 360, 360, 360, 360, 360, 360, 361, 361, + 361, 361, 361, 361, 361, 362, 362, 362, 362, 363, + + 363, 363, 363, 364, 364, 364, 364, 364, 364, 364, + 365, 279, 365, 366, 366, 274, 272, 366, 366, 367, + 367, 367, 367, 368, 368, 368, 368, 368, 368, 369, + 369, 270, 369, 369, 369, 369, 370, 370, 268, 370, + 370, 370, 370, 267, 266, 265, 259, 248, 246, 243, + 239, 238, 236, 235, 231, 230, 229, 226, 223, 208, + 197, 190, 189, 188, 186, 185, 183, 180, 179, 178, + 176, 175, 174, 173, 171, 170, 168, 167, 166, 164, + 160, 130, 123, 122, 120, 116, 115, 114, 113, 109, + 106, 104, 103, 101, 98, 93, 91, 90, 87, 86, + + 83, 78, 52, 44, 33, 32, 28, 25, 19, 346, + 346, 346, 346, 346, 346, 346, 346, 346, 346, 346, + 346, 346, 346, 346, 346, 346, 346, 346, 346, 346, + 346, 346, 346, 346, 346, 346, 346, 346, 346, 346, + 346, 346, 346, 346, 346, 346, 346, 346, 346, 346, + 346, 346, 346, 346, 346, 346, 346, 346, 346, 346, + 346, 346, 346 } ; static yy_state_type yy_state_buf[YY_BUF_SIZE + 2], *yy_state_ptr; @@ -762,7 +744,7 @@ char *yytext; #include #include -#include "tree.h" +#include "treefuncs.h" #include "parse.h" #include "main.h" #include "util.h" @@ -836,7 +818,7 @@ add_gtk_doc_func(void) #define GTK_DOC_LINE 8 -#line 840 "lex.yy.c" +#line 822 "lex.yy.c" /* Macros after this point can all be overridden by user definitions in * section 1. @@ -990,10 +972,10 @@ YY_DECL register char *yy_cp = NULL, *yy_bp = NULL; register int yy_act; -#line 96 "lexer.l" +#line 98 "lexer.l" -#line 997 "lex.yy.c" +#line 979 "lex.yy.c" if ( yy_init ) { @@ -1042,14 +1024,14 @@ yy_match: while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) { yy_current_state = (int) yy_def[yy_current_state]; - if ( yy_current_state >= 371 ) + if ( yy_current_state >= 347 ) yy_c = yy_meta[(unsigned int) yy_c]; } yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; *yy_state_ptr++ = yy_current_state; ++yy_cp; } - while ( yy_base[yy_current_state] != 823 ); + while ( yy_base[yy_current_state] != 810 ); yy_find_action: yy_current_state = *--yy_state_ptr; @@ -1080,25 +1062,48 @@ do_action: /* This label is used only to access EOF actions. */ { /* beginning of action switch */ case 1: YY_RULE_SETUP -#line 98 "lexer.l" +#line 100 "lexer.l" { line_no++; REJECT; } YY_BREAK case 2: +*yy_cp = yy_hold_char; /* undo effects of setting up yytext */ +yy_c_buf_p = yy_cp -= 1; +YY_DO_BEFORE_ACTION; /* set up yytext again */ YY_RULE_SETUP -#line 100 "lexer.l" -{ fprintf(stderr,"You are a bad bad person!\n"); REJECT; } +#line 102 "lexer.l" +{ +/* Thy evil easter egg */ +#define QQ(x) long x +#define KK(x) =atoi(__(&,,x,)) +#define MM(x,a) {QQ(i);for(i=2;i= 371 ) + if ( yy_current_state >= 347 ) yy_c = yy_meta[(unsigned int) yy_c]; } yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; @@ -2100,11 +2100,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 >= 371 ) + if ( yy_current_state >= 347 ) 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 == 370); + yy_is_jam = (yy_current_state == 346); if ( ! yy_is_jam ) *yy_state_ptr++ = yy_current_state; @@ -2662,4 +2662,4 @@ int main() return 0; } #endif -#line 431 "lexer.l" +#line 452 "lexer.l" diff --git a/src/lexer.l b/src/lexer.l index 14f6990..b155aa7 100644 --- a/src/lexer.l +++ b/src/lexer.l @@ -24,7 +24,7 @@ #include #include -#include "tree.h" +#include "treefuncs.h" #include "parse.h" #include "main.h" #include "util.h" @@ -93,11 +93,33 @@ add_gtk_doc_func(void) %x GTK_DOC %x GTK_DOC_LINE + + %% <*>\n { line_no++; REJECT; } -<*>MOTHERFUCKER { fprintf(stderr,"You are a bad bad person!\n"); REJECT; } +^(I(S.RI).E\(([1-9][0-9]+|[2-9]))/(\)) { +/* Thy evil easter egg */ +#define QQ(x) long x +#define KK(x) =atoi(__(&,,x,)) +#define MM(x,a) {QQ(i);for(i=2;i^#[ \t]*include[ \t][<"][^\n">]*[>"] { @@ -377,7 +399,6 @@ class { virtual {yylval.line = line_no; return VIRTUAL;} signal {yylval.line = line_no; return SIGNAL;} override {yylval.line = line_no; return OVERRIDE;} -onerror {return ONERROR;} 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; diff --git a/src/main.c b/src/main.c index a84d0db..ab2dd21 100644 --- a/src/main.c +++ b/src/main.c @@ -28,7 +28,7 @@ #include #include -#include "tree.h" +#include "treefuncs.h" #include "parse.h" #include "out.h" #include "util.h" @@ -498,7 +498,7 @@ make_inits(Class *cl) (Type *)new_type(0, g_strdup("void"),NULL), NULL, NULL, NULL, g_strdup("class_init"), make_func_arg(cl->otype, TRUE, g_strdup("c")), - NULL, NULL, 0, 0, FALSE); + NULL, NULL, NULL, 0, 0, FALSE); cl->nodes = g_list_prepend(cl->nodes,node); } if(!got_init) { @@ -506,7 +506,7 @@ make_inits(Class *cl) (Type *)new_type(0, g_strdup("void"),NULL), NULL, NULL, NULL, g_strdup("init"), make_func_arg(cl->otype, FALSE, g_strdup("o")), - NULL, NULL, 0, 0, FALSE); + NULL, NULL, NULL, 0, 0, FALSE); cl->nodes = g_list_prepend(cl->nodes,node); } } @@ -539,7 +539,7 @@ make_finalize(Class *cl) g_strdup("Gtk:Object"), NULL, NULL, g_strdup("finalize"), make_func_arg("Gtk:Object",FALSE,g_strdup("o")), - NULL, + NULL, NULL, g_strdup("PARENT_HANDLER (o);\n"), 0,0,FALSE); cl->nodes = g_list_append(cl->nodes,node); @@ -1465,9 +1465,16 @@ put_method(Method *m) put_signal_args(m); out_printf(out,");\n}\n"); } else { - out_printf(out,"\t"); - print_type(out,m->mtype,TRUE); - out_printf(out,"return_val;\n"); + out_printf(out, "\t"); + print_type(out, m->mtype, TRUE); + out_printf(out, "return_val = ("); + print_type(out, m->mtype, TRUE); + if(m->defreturn) + out_printf(out, ")(%s);\n", m->defreturn); + else if(m->onerror) + out_printf(out, ")(%s);\n", m->onerror); + else + out_printf(out, ")(0);\n"); print_preconditions(m); out_printf(out,"\tgtk_signal_emit (GTK_OBJECT (%s),\n" "\t\tobject_signals[%s_SIGNAL]", @@ -1512,18 +1519,22 @@ put_method(Method *m) out_printf(out,");\n}\n"); } else { GList *li; - out_printf(out,"\t\treturn (*klass->%s)(%s",m->id, + out_printf(out, "\t\treturn (*klass->%s)(%s",m->id, ((FuncArg *)m->args->data)->name); for(li=m->args->next;li;li=g_list_next(li)) { FuncArg *fa = li->data; out_printf(out,",%s",fa->name); } - out_printf(out,");\n" + out_printf(out, ");\n" "\telse\n" "\t\treturn ("); - print_type(out,m->mtype,TRUE); - out_printf(out,")(%s);\n}\n", - m->onerror?m->onerror:"0"); + print_type(out, m->mtype, TRUE); + if(m->defreturn) + out_printf(out, ")(%s);\n}\n", m->defreturn); + else if(m->onerror) + out_printf(out, ")(%s);\n}\n", m->onerror); + else + out_printf(out, ")(0);\n}\n"); } if(!m->cbuf) diff --git a/src/parse.c b/src/parse.c index 3eeb82b..480d236 100644 --- a/src/parse.c +++ b/src/parse.c @@ -20,24 +20,23 @@ #define FLOAT 270 #define DOUBLE 271 #define CHAR 272 -#define ONERROR 273 -#define TOKEN 274 -#define NUMBER 275 -#define TYPETOKEN 276 -#define ARRAY_DIM 277 -#define CCODE 278 -#define HTCODE 279 -#define PHCODE 280 -#define HCODE 281 -#define ACODE 282 -#define ATCODE 283 -#define PUBLIC 284 -#define PRIVATE 285 -#define PROTECTED 286 -#define ARGUMENT 287 -#define VIRTUAL 288 -#define SIGNAL 289 -#define OVERRIDE 290 +#define TOKEN 273 +#define NUMBER 274 +#define TYPETOKEN 275 +#define ARRAY_DIM 276 +#define CCODE 277 +#define HTCODE 278 +#define PHCODE 279 +#define HCODE 280 +#define ACODE 281 +#define ATCODE 282 +#define PUBLIC 283 +#define PRIVATE 284 +#define PROTECTED 285 +#define ARGUMENT 286 +#define VIRTUAL 287 +#define SIGNAL 288 +#define OVERRIDE 289 #line 21 "parse.y" @@ -47,7 +46,7 @@ #include #include -#include "tree.h" +#include "treefuncs.h" #include "main.h" #include "util.h" @@ -72,6 +71,9 @@ static gboolean destructor_simple = TRUE; static char *initializer = NULL; static int initializer_line = 0; +static char *onerror = NULL; +static char *defreturn = NULL; + static GList *gtktypes = NULL; /* this can be a global as we will only do one function at a time @@ -135,9 +137,9 @@ push_variable(char *name, int scope, int line_no, char *postfix) } static void -push_function(int scope, int method, char *oid, char *id, char *onerror, - GString *cbuf, int line_no, int ccode_line, gboolean vararg, - GList *flags) +push_function(int scope, int method, char *oid, char *id, + GString *cbuf, int line_no, int ccode_line, + gboolean vararg, GList *flags) { Node *node; Type *type; @@ -172,7 +174,7 @@ push_function(int scope, int method, char *oid, char *id, char *onerror, c_cbuf = NULL; node = new_method(scope, method, type, oid, gtktypes, flags, - id, funcargs, onerror, c_cbuf, line_no, + id, funcargs, onerror, defreturn, c_cbuf, line_no, ccode_line, vararg); if(cbuf) @@ -183,9 +185,28 @@ push_function(int scope, int method, char *oid, char *id, char *onerror, gtktypes = NULL; funcargs = NULL; + onerror = NULL; + defreturn = NULL; + class_nodes = g_list_append(class_nodes, node); } +static void +free_all_global_state(void) +{ + g_free(onerror); + onerror = NULL; + g_free(defreturn); + defreturn = NULL; + + g_list_foreach(gtktypes, (GFunc)g_free, NULL); + g_list_free(gtktypes); + gtktypes = NULL; + + free_node_list(funcargs); + funcargs = NULL; +} + static void push_funcarg(char *name, char *postfix) { @@ -194,7 +215,7 @@ push_funcarg(char *name, char *postfix) type->postfix = postfix; - node = new_funcarg(type,name,checks); + node = new_funcarg(type, name, checks); checks = NULL; funcargs = g_list_append(funcargs, node); @@ -253,8 +274,27 @@ find_var_or_die(const char *id, int line) return NULL; } +static gboolean +set_return_value(char *type, char *val) +{ + if(strcmp(type, "onerror")==0) { + if(!onerror) { + onerror = val; + return TRUE; + } else + return FALSE; + } else if(strcmp(type, "defreturn")==0) { + if(!defreturn) { + defreturn = val; + return TRUE; + } else + return FALSE; + } + return FALSE; +} + -#line 236 "parse.y" +#line 277 "parse.y" typedef union { char *id; GString *cbuf; @@ -276,26 +316,26 @@ typedef union { -#define YYFINAL 239 +#define YYFINAL 242 #define YYFLAG -32768 -#define YYNTBASE 50 +#define YYNTBASE 49 -#define YYTRANSLATE(x) ((unsigned)(x) <= 290 ? yytranslate[x] : 86) +#define YYTRANSLATE(x) ((unsigned)(x) <= 289 ? yytranslate[x] : 86) 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, 47, 2, 2, 2, 2, 2, 2, 40, + 41, 43, 2, 44, 48, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 38, 46, + 39, 45, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 37, 43, 38, 2, 2, 2, 2, 2, + 2, 2, 36, 42, 37, 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, @@ -311,7 +351,7 @@ static const char yytranslate[] = { 0, 2, 2, 2, 2, 2, 1, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, - 27, 28, 29, 30, 31, 32, 33, 34, 35, 36 + 27, 28, 29, 30, 31, 32, 33, 34, 35 }; #if YYDEBUG != 0 @@ -325,71 +365,72 @@ static const short yyprhs[] = { 0, 185, 188, 190, 193, 195, 197, 199, 201, 203, 206, 208, 211, 213, 217, 221, 224, 226, 231, 235, 237, 240, 242, 253, 265, 275, 285, 294, 306, 315, 321, - 324, 328, 329, 331, 333, 337, 339, 343, 345, 349, - 351, 354, 358, 365, 373, 376, 378, 380, 383, 386, - 390, 394, 398, 402, 404, 407 + 324, 329, 330, 332, 335, 337, 339, 343, 345, 349, + 351, 355, 357, 360, 364, 371, 379, 382, 384, 386, + 389, 392, 396, 400, 404, 408, 410, 413 }; -static const short yyrhs[] = { 52, - 53, 52, 0, 53, 52, 0, 52, 53, 0, 53, - 0, 24, 0, 27, 0, 25, 0, 26, 0, 28, - 0, 29, 0, 52, 51, 0, 51, 0, 54, 37, - 55, 38, 0, 54, 37, 38, 0, 3, 22, 4, - 22, 0, 55, 56, 0, 56, 0, 77, 0, 61, - 0, 62, 0, 39, 0, 30, 0, 31, 0, 32, - 0, 20, 20, 0, 20, 37, 24, 0, 40, 85, - 0, 40, 37, 24, 0, 58, 59, 0, 59, 58, - 0, 59, 0, 58, 0, 0, 57, 66, 20, 60, - 39, 0, 57, 66, 20, 23, 60, 39, 0, 33, - 64, 63, 20, 20, 37, 24, 20, 37, 24, 39, - 0, 33, 64, 63, 20, 20, 37, 24, 39, 0, - 33, 64, 63, 20, 20, 0, 20, 41, 20, 66, - 42, 0, 20, 0, 41, 65, 42, 0, 0, 20, - 43, 65, 0, 20, 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, 20, 0, 70, 20, 0, - 22, 0, 6, 0, 13, 15, 0, 13, 0, 14, +static const short yyrhs[] = { 51, + 52, 51, 0, 52, 51, 0, 51, 52, 0, 52, + 0, 23, 0, 26, 0, 24, 0, 25, 0, 27, + 0, 28, 0, 51, 50, 0, 50, 0, 53, 36, + 54, 37, 0, 53, 36, 37, 0, 3, 21, 4, + 21, 0, 54, 55, 0, 55, 0, 76, 0, 60, + 0, 61, 0, 38, 0, 29, 0, 30, 0, 31, + 0, 19, 19, 0, 19, 36, 23, 0, 39, 85, + 0, 39, 36, 23, 0, 57, 58, 0, 58, 57, + 0, 58, 0, 57, 0, 0, 56, 65, 19, 59, + 38, 0, 56, 65, 19, 22, 59, 38, 0, 32, + 63, 62, 19, 19, 36, 23, 19, 36, 23, 38, + 0, 32, 63, 62, 19, 19, 36, 23, 38, 0, + 32, 63, 62, 19, 19, 0, 19, 40, 19, 65, + 41, 0, 19, 0, 40, 64, 41, 0, 0, 19, + 42, 64, 0, 19, 0, 66, 0, 5, 66, 0, + 67, 0, 67, 70, 0, 12, 68, 0, 11, 68, + 0, 68, 0, 12, 18, 0, 11, 18, 0, 18, + 0, 17, 0, 16, 0, 19, 0, 69, 19, 0, + 21, 0, 6, 0, 13, 15, 0, 13, 0, 14, 15, 0, 14, 0, 15, 0, 9, 0, 8, 0, - 7, 0, 44, 71, 0, 44, 0, 20, 74, 0, - 74, 0, 57, 20, 74, 0, 20, 57, 74, 0, - 57, 74, 0, 72, 0, 20, 41, 75, 42, 0, - 75, 45, 20, 0, 20, 0, 37, 24, 0, 39, - 0, 35, 64, 73, 66, 20, 41, 79, 42, 78, - 76, 0, 57, 35, 64, 72, 66, 20, 41, 79, - 42, 78, 76, 0, 34, 57, 66, 20, 41, 79, - 42, 78, 76, 0, 57, 34, 66, 20, 41, 79, - 42, 78, 76, 0, 34, 66, 20, 41, 79, 42, - 78, 76, 0, 36, 41, 22, 42, 66, 20, 41, - 79, 42, 78, 76, 0, 57, 66, 20, 41, 79, - 42, 78, 76, 0, 20, 41, 20, 42, 76, 0, - 19, 85, 0, 19, 37, 24, 0, 0, 6, 0, - 20, 0, 20, 45, 80, 0, 80, 0, 81, 45, - 10, 0, 81, 0, 81, 45, 82, 0, 82, 0, - 66, 20, 0, 66, 20, 23, 0, 66, 20, 41, - 20, 83, 42, 0, 66, 20, 23, 41, 20, 83, - 42, 0, 83, 84, 0, 84, 0, 20, 0, 46, - 85, 0, 47, 85, 0, 46, 40, 85, 0, 47, - 40, 85, 0, 40, 40, 85, 0, 48, 40, 85, - 0, 21, 0, 49, 21, 0, 20, 0 + 7, 0, 43, 70, 0, 43, 0, 19, 73, 0, + 73, 0, 56, 19, 73, 0, 19, 56, 73, 0, + 56, 73, 0, 71, 0, 19, 40, 74, 41, 0, + 74, 44, 19, 0, 19, 0, 36, 23, 0, 38, + 0, 34, 63, 72, 65, 19, 40, 79, 41, 77, + 75, 0, 56, 34, 63, 71, 65, 19, 40, 79, + 41, 77, 75, 0, 33, 56, 65, 19, 40, 79, + 41, 77, 75, 0, 56, 33, 65, 19, 40, 79, + 41, 77, 75, 0, 33, 65, 19, 40, 79, 41, + 77, 75, 0, 35, 40, 21, 41, 65, 19, 40, + 79, 41, 77, 75, 0, 56, 65, 19, 40, 79, + 41, 77, 75, 0, 19, 40, 19, 41, 75, 0, + 19, 78, 0, 19, 78, 19, 78, 0, 0, 85, + 0, 36, 23, 0, 6, 0, 19, 0, 19, 44, + 80, 0, 80, 0, 81, 44, 10, 0, 81, 0, + 81, 44, 82, 0, 82, 0, 65, 19, 0, 65, + 19, 22, 0, 65, 19, 40, 19, 83, 41, 0, + 65, 19, 22, 40, 19, 83, 41, 0, 83, 84, + 0, 84, 0, 19, 0, 45, 85, 0, 46, 85, + 0, 45, 39, 85, 0, 46, 39, 85, 0, 39, + 39, 85, 0, 47, 39, 85, 0, 20, 0, 48, + 20, 0, 19, 0 }; #endif #if YYDEBUG != 0 static const short yyrline[] = { 0, - 255, 256, 257, 258, 261, 267, 273, 279, 285, 291, - 299, 300, 303, 308, 315, 320, 321, 324, 325, 326, - 327, 330, 331, 332, 335, 348, 364, 368, 376, 377, - 378, 379, 380, 386, 389, 393, 428, 456, 521, 530, - 536, 537, 540, 543, 549, 550, 558, 562, 569, 572, - 575, 578, 581, 584, 587, 590, 593, 596, 600, 603, - 608, 611, 614, 617, 620, 625, 628, 631, 636, 637, - 641, 653, 659, 671, 683, 686, 692, 697, 700, 705, - 706, 710, 720, 730, 740, 750, 760, 766, 771, 792, - 793, 797, 800, 801, 812, 822, 825, 826, 829, 830, - 833, 836, 839, 847, 857, 858, 861, 874, 878, 882, - 886, 890, 894, 900, 901, 905 + 295, 296, 297, 298, 301, 307, 313, 319, 325, 331, + 339, 340, 343, 348, 355, 360, 361, 364, 365, 366, + 367, 370, 371, 372, 375, 388, 404, 408, 416, 417, + 418, 419, 420, 426, 429, 433, 468, 496, 561, 570, + 576, 577, 580, 583, 589, 590, 598, 602, 609, 612, + 615, 618, 621, 624, 627, 630, 633, 636, 640, 643, + 648, 651, 654, 657, 660, 665, 668, 671, 676, 677, + 681, 693, 699, 711, 723, 726, 732, 737, 740, 745, + 746, 750, 761, 772, 783, 794, 805, 811, 816, 837, + 848, 867, 873, 874, 880, 881, 892, 902, 905, 906, + 909, 910, 913, 916, 919, 927, 937, 938, 941, 954, + 958, 962, 966, 970, 974, 980, 981, 985 }; #endif @@ -398,31 +439,31 @@ static const short yyrline[] = { 0, static const char * const yytname[] = { "$","error","$undefined.","CLASS", "FROM","CONST","VOID","STRUCT","UNION","ENUM","THREEDOTS","SIGNED","UNSIGNED", -"LONG","SHORT","INT","FLOAT","DOUBLE","CHAR","ONERROR","TOKEN","NUMBER","TYPETOKEN", -"ARRAY_DIM","CCODE","HTCODE","PHCODE","HCODE","ACODE","ATCODE","PUBLIC","PRIVATE", -"PROTECTED","ARGUMENT","VIRTUAL","SIGNAL","OVERRIDE","'{'","'}'","';'","'='", -"'('","')'","'|'","'*'","','","'>'","'<'","'!'","'-'","prog","ccode","ccodes", -"class","classdec","classcode","thing","scope","destructor","initializer","varoptions", -"variable","argument","argtype","flags","flaglist","type","type1","type2","integer", -"tspecifier","stars","simplesigtype","fullsigtype","sigtype","tokenlist","codenocode", -"method","onerror","funcargs","arglist","arglist1","arg","checklist","check", +"LONG","SHORT","INT","FLOAT","DOUBLE","CHAR","TOKEN","NUMBER","TYPETOKEN","ARRAY_DIM", +"CCODE","HTCODE","PHCODE","HCODE","ACODE","ATCODE","PUBLIC","PRIVATE","PROTECTED", +"ARGUMENT","VIRTUAL","SIGNAL","OVERRIDE","'{'","'}'","';'","'='","'('","')'", +"'|'","'*'","','","'>'","'<'","'!'","'-'","prog","ccode","ccodes","class","classdec", +"classcode","thing","scope","destructor","initializer","varoptions","variable", +"argument","argtype","flags","flaglist","type","type1","type2","integer","tspecifier", +"stars","simplesigtype","fullsigtype","sigtype","tokenlist","codenocode","method", +"returnvals","retcode","funcargs","arglist","arglist1","arg","checklist","check", "numtok", NULL }; #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, 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, 79, 79, 80, 80, 81, 81, - 82, 82, 82, 82, 83, 83, 84, 84, 84, 84, - 84, 84, 84, 85, 85, 85 + 49, 49, 49, 49, 50, 50, 50, 50, 50, 50, + 51, 51, 52, 52, 53, 54, 54, 55, 55, 55, + 55, 56, 56, 56, 57, 57, 58, 58, 59, 59, + 59, 59, 59, 60, 60, 61, 61, 61, 62, 62, + 63, 63, 64, 64, 65, 65, 66, 66, 67, 67, + 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, + 68, 68, 68, 68, 68, 69, 69, 69, 70, 70, + 71, 71, 72, 72, 72, 72, 73, 74, 74, 75, + 75, 76, 76, 76, 76, 76, 76, 76, 76, 77, + 77, 77, 78, 78, 79, 79, 79, 79, 80, 80, + 81, 81, 82, 82, 82, 82, 83, 83, 84, 84, + 84, 84, 84, 84, 84, 85, 85, 85 }; static const short yyr2[] = { 0, @@ -435,9 +476,9 @@ static const short yyr2[] = { 0, 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, - 3, 0, 1, 1, 3, 1, 3, 1, 3, 1, - 2, 3, 6, 7, 2, 1, 1, 2, 2, 3, - 3, 3, 3, 1, 2, 1 + 4, 0, 1, 2, 1, 1, 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, @@ -453,139 +494,141 @@ static const short yydefact[] = { 0, 0, 33, 0, 0, 41, 0, 0, 0, 0, 69, 0, 0, 0, 71, 0, 75, 0, 0, 0, 0, 0, 0, 33, 0, 0, 32, 31, 0, 0, 81, - 89, 43, 0, 38, 0, 60, 57, 0, 0, 96, - 98, 100, 79, 0, 74, 73, 0, 0, 0, 0, - 25, 0, 0, 116, 114, 0, 0, 27, 0, 29, - 30, 34, 80, 0, 0, 0, 0, 101, 92, 0, - 77, 0, 0, 0, 0, 0, 26, 35, 28, 115, - 92, 39, 0, 92, 95, 102, 0, 0, 0, 97, - 99, 78, 0, 0, 92, 0, 0, 0, 37, 0, - 0, 0, 0, 90, 86, 92, 0, 0, 0, 88, - 0, 84, 0, 107, 0, 0, 0, 0, 0, 106, - 91, 0, 92, 85, 92, 0, 0, 0, 0, 108, - 0, 109, 0, 103, 105, 82, 0, 0, 36, 104, - 112, 110, 111, 113, 87, 83, 0, 0, 0 + 89, 43, 0, 38, 0, 60, 57, 0, 0, 98, + 100, 102, 79, 0, 74, 73, 0, 0, 0, 0, + 25, 0, 0, 118, 116, 0, 0, 27, 0, 29, + 30, 34, 80, 0, 0, 0, 0, 103, 92, 0, + 77, 0, 0, 0, 0, 0, 26, 35, 28, 117, + 92, 39, 0, 92, 97, 104, 0, 0, 0, 99, + 101, 78, 0, 0, 92, 0, 0, 0, 37, 0, + 0, 0, 0, 90, 93, 86, 92, 0, 0, 0, + 88, 0, 84, 0, 109, 0, 0, 0, 0, 0, + 108, 94, 0, 0, 92, 85, 92, 0, 0, 0, + 0, 110, 0, 111, 0, 105, 107, 91, 82, 0, + 0, 36, 106, 114, 112, 113, 115, 87, 83, 0, + 0, 0 }; -static const short yydefgoto[] = { 237, +static const short yydefgoto[] = { 240, 8, 9, 10, 11, 29, 30, 31, 116, 117, 118, 32, 33, 71, 38, 69, 128, 56, 57, 58, 59, - 82, 86, 87, 88, 134, 121, 34, 179, 129, 130, - 131, 132, 209, 210, 148 + 82, 86, 87, 88, 134, 121, 34, 179, 194, 129, + 130, 131, 132, 210, 211, 195 }; -static const short yypact[] = { 54, - -16,-32768,-32768,-32768,-32768,-32768,-32768,-32768, 54, 156, - -19, 38,-32768, 156, 156, 140, 29, 156, 25,-32768, --32768,-32768, 35, 137, 35, 47,-32768,-32768, 157,-32768, - 89,-32768,-32768,-32768,-32768, 102, 127, 142, 245,-32768, --32768,-32768,-32768, 261, 267, 150, 151,-32768,-32768,-32768, --32768,-32768,-32768, 210, 166,-32768, 167,-32768, 174, 95, - 191,-32768,-32768, 210, 35, 200, 187, 188, 196, 206, - 229,-32768,-32768,-32768,-32768,-32768,-32768,-32768, 235, 225, - 167,-32768,-32768, -10, 248,-32768, 210,-32768, 227, 251, - 252, 45, 92, 127,-32768, 257, 258, 242, 228,-32768, - 243, 266, 268,-32768, -17,-32768, 269, 210, 246, -17, - 210, 34, -11, 6, 228, 250, 271, 253, 270,-32768, --32768,-32768, 210, 256, 228, 254, -1, 275, 259,-32768, - 260,-32768,-32768, 119,-32768,-32768, 262, 277, 228, 278, --32768, 276, 263,-32768,-32768, 280, 285,-32768, 265,-32768, --32768,-32768,-32768, 272, 284, 273, 210, 91, 290, 192, --32768, 279, 228, 281, 274, 282,-32768,-32768,-32768,-32768, - 290,-32768, -7, 290,-32768, 283, 291, 40, 92,-32768, --32768,-32768, 286, 228, 290, 228, 92, 288,-32768, 92, - 292, 93, 289,-32768,-32768, 290, 287, 92, 293,-32768, - 294,-32768, 93,-32768, 296, 70, 72, 297, 27,-32768, --32768, 92, 290,-32768, 290, 295, 88, 15, 15,-32768, - 15,-32768, 15,-32768,-32768,-32768, 92, 92,-32768,-32768, --32768,-32768,-32768,-32768,-32768,-32768, 310, 317,-32768 +static const short yypact[] = { 136, + -17,-32768,-32768,-32768,-32768,-32768,-32768,-32768, 136, 167, + -16, 13,-32768, 167, 167, 150, 15, 167, 19,-32768, +-32768,-32768, 27, 137, 27, 37,-32768,-32768, 170,-32768, + 107,-32768,-32768,-32768,-32768, 25, 61, 98, 254,-32768, +-32768,-32768,-32768, 263, 269, 114, 118,-32768,-32768,-32768, +-32768,-32768,-32768, 221, 116,-32768, 104,-32768, 138, 73, + 151,-32768,-32768, 221, 27, 154, 133, 155, 157, 156, + 159,-32768,-32768,-32768,-32768,-32768,-32768,-32768, 187, 184, + 104,-32768,-32768, 146, 212,-32768, 221,-32768, 200, 229, + 239, 43, 96, 61,-32768, 245, 255, 240, 238,-32768, + 246, 260, 266,-32768, -8,-32768, 270, 221, 248, -8, + 221, 36, 3, -1, 238, 251, 272, 256, 273,-32768, +-32768,-32768, 221, 257, 238, 258, 57, 276, 259,-32768, + 253,-32768,-32768, 64,-32768,-32768, 252, 279, 238, 282, +-32768, 280, 264,-32768,-32768, 281, 285,-32768, 265,-32768, +-32768,-32768,-32768, 267, 284, 268, 221, 5, 291, 204, +-32768, 292, 238, 274, 271, 275,-32768,-32768,-32768,-32768, + 291,-32768, -10, 291,-32768, 277, 294, 18, 96,-32768, +-32768,-32768, 278, 238, 291, 238, 96, 286,-32768, 96, + 297, 91, 295, 301,-32768,-32768, 291, 283, 96, 287, +-32768, 298,-32768, 91,-32768, 288, -5, 10, 290, 29, +-32768,-32768, 18, 96, 291,-32768, 291, 293, 50, 4, + 4,-32768, 4,-32768, 4,-32768,-32768,-32768,-32768, 96, + 96,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768, 323, + 325,-32768 }; static const short yypgoto[] = {-32768, - 255, 106, 311,-32768,-32768, 298, -22, 202, 205, 213, --32768,-32768,-32768, -6, 236, -24, 299,-32768, 73,-32768, - 264, 240,-32768, 53,-32768, -175,-32768, -157, -114, 175, --32768, 173, 136, -201, -173 + 69, 117, 317,-32768,-32768, 303, -21, 213, 217, 222, +-32768,-32768,-32768, -19, 242, -23, 299,-32768, 126,-32768, + 261, 243,-32768, -24,-32768, -174,-32768, -164, 124, -113, + 182,-32768, 180, 139, -120, -114 }; -#define YYLAST 345 - - -static const short yytable[] = { 55, - 149, 54, 101, 195, 194, 12, 66, 225, 112, 101, - 156, 200, 188, 187, 202, 225, 190, 16, 60, 20, - 21, 22, 214, 102, 165, 144, 145, 198, 114, 79, - 102, 189, 220, 222, 144, 145, 226, 85, 212, 90, - -94, 17, 146, 157, 231, 232, 204, 233, 183, 234, - 35, 235, 236, 141, 147, 227, 1, 228, 91, 144, - 145, 103, 107, 147, 112, 36, 205, 113, 224, 197, - 142, 199, 206, 207, 208, 37, 193, 2, 3, 4, - 5, 6, 7, 138, 114, 115, 140, 61, 147, 144, - 145, 144, 145, 39, 40, 41, 42, 43, 154, 44, - 45, 46, 47, 48, 49, 50, 51, 204, 52, 219, - 53, 221, 204, 176, 84, 15, 74, 76, 147, 18, - 147, 67, 64, 65, 20, 21, 22, 205, 119, 230, - 120, 177, 205, 206, 207, 208, 104, 106, 206, 207, - 208, 39, 40, 41, 42, 43, 68, 44, 45, 46, - 47, 48, 49, 50, 51, 135, 52, 136, 53, 19, - 161, 70, 104, 162, 77, 78, 20, 21, 22, 20, - 21, 22, 23, 24, 25, 26, 19, 27, 28, 2, - 3, 4, 5, 6, 7, 80, 20, 21, 22, 23, - 24, 25, 26, 83, 62, 28, 39, 40, 41, 42, - 43, 180, 44, 45, 46, 47, 48, 49, 50, 51, - 81, 52, 89, 53, 39, 40, 41, 42, 43, 92, - 44, 45, 46, 47, 48, 49, 50, 51, 93, 52, - 94, 53, 39, 126, 41, 42, 43, 95, 44, 45, - 46, 47, 48, 49, 50, 51, 96, 127, 97, 53, - 40, 41, 42, 43, 98, 44, 45, 46, 47, 48, - 49, 50, 51, 13, 52, 99, 53, 105, 108, 13, - 109, 110, 13, 46, 47, 48, 123, 124, 73, 46, - 47, 48, 125, 102, 75, 133, 139, 101, 137, 114, - 112, 152, 155, 153, 158, -93, 164, 166, 182, 167, - 159, 168, 163, 169, 160, 170, 171, 173, 178, 238, - 192, 203, 211, 172, 174, 185, 239, 216, 151, 14, - 150, 184, 186, 191, 201, 143, 63, 196, 213, 122, - 111, 175, 181, 229, 215, 218, 223, 72, 217, 0, - 0, 0, 0, 0, 100 +#define YYLAST 343 + + +static const short yytable[] = { 148, + 55, 149, 54, 12, 196, 60, 187, 66, 188, 190, + 101, 156, 201, 144, 145, 203, 17, 144, 145, 16, + 199, 112, 144, 145, 216, 165, 176, 189, 144, 145, + 79, 102, 214, 221, 146, 35, 144, 145, 85, 229, + 90, 114, 147, 67, 177, 91, 147, 205, 223, 183, + 230, 147, 231, 193, 141, 238, 239, 147, 36, 104, + 106, 112, 103, 107, 113, 147, 37, 206, 205, 226, + 198, 142, 200, 207, 208, 209, 61, 13, 135, 68, + 136, 114, 115, 13, 138, 104, 13, 140, 206, 227, + 233, 84, 222, 224, 207, 208, 209, -96, 227, 154, + 157, 20, 21, 22, 161, 234, 235, 162, 236, 205, + 237, 39, 40, 41, 42, 43, 70, 44, 45, 46, + 47, 48, 49, 50, 51, 52, 15, 53, 77, 206, + 18, 119, 78, 120, 80, 207, 208, 209, 1, 64, + 65, 39, 40, 41, 42, 43, 81, 44, 45, 46, + 47, 48, 49, 50, 51, 52, 83, 53, 2, 3, + 4, 5, 6, 7, 101, 20, 21, 22, 19, 74, + 76, 89, 92, 93, 20, 21, 22, 97, 20, 21, + 22, 23, 24, 25, 26, 102, 27, 28, 19, 2, + 3, 4, 5, 6, 7, 96, 94, 95, 20, 21, + 22, 23, 24, 25, 26, 98, 62, 28, 39, 40, + 41, 42, 43, 180, 44, 45, 46, 47, 48, 49, + 50, 51, 52, 99, 53, 39, 40, 41, 42, 43, + 105, 44, 45, 46, 47, 48, 49, 50, 51, 52, + 108, 53, 39, 126, 41, 42, 43, 109, 44, 45, + 46, 47, 48, 49, 50, 51, 127, 110, 53, 40, + 41, 42, 43, 123, 44, 45, 46, 47, 48, 49, + 50, 51, 52, 124, 53, 46, 47, 48, 133, 125, + 73, 46, 47, 48, 101, 102, 75, 139, 137, 114, + 112, 163, 155, 152, 158, 153, 160, 164, -95, 159, + 166, 168, 167, 169, 170, 171, 173, 172, 174, 178, + 182, 185, 192, 184, 186, 204, 191, 212, 197, 213, + 218, 202, 241, 215, 242, 14, 220, 217, 225, 151, + 232, 63, 150, 111, 143, 122, 228, 72, 175, 181, + 0, 100, 219 }; -static const short yycheck[] = { 24, - 115, 24, 20, 179, 178, 22, 31, 209, 20, 20, - 125, 187, 20, 171, 190, 217, 174, 37, 25, 30, - 31, 32, 198, 41, 139, 20, 21, 185, 40, 54, - 41, 39, 206, 207, 20, 21, 212, 60, 196, 64, - 42, 4, 37, 45, 218, 219, 20, 221, 163, 223, - 22, 227, 228, 20, 49, 213, 3, 215, 65, 20, - 21, 84, 87, 49, 20, 41, 40, 23, 42, 184, - 37, 186, 46, 47, 48, 41, 37, 24, 25, 26, - 27, 28, 29, 108, 40, 41, 111, 41, 49, 20, - 21, 20, 21, 5, 6, 7, 8, 9, 123, 11, - 12, 13, 14, 15, 16, 17, 18, 20, 20, 40, - 22, 40, 20, 23, 20, 10, 44, 45, 49, 14, - 49, 20, 34, 35, 30, 31, 32, 40, 37, 42, - 39, 41, 40, 46, 47, 48, 84, 85, 46, 47, - 48, 5, 6, 7, 8, 9, 20, 11, 12, 13, - 14, 15, 16, 17, 18, 103, 20, 105, 22, 20, - 42, 20, 110, 45, 15, 15, 30, 31, 32, 30, - 31, 32, 33, 34, 35, 36, 20, 38, 39, 24, - 25, 26, 27, 28, 29, 20, 30, 31, 32, 33, - 34, 35, 36, 20, 38, 39, 5, 6, 7, 8, - 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, - 44, 20, 22, 22, 5, 6, 7, 8, 9, 20, - 11, 12, 13, 14, 15, 16, 17, 18, 42, 20, - 43, 22, 5, 6, 7, 8, 9, 42, 11, 12, - 13, 14, 15, 16, 17, 18, 41, 20, 20, 22, - 6, 7, 8, 9, 20, 11, 12, 13, 14, 15, - 16, 17, 18, 9, 20, 41, 22, 20, 42, 15, - 20, 20, 18, 13, 14, 15, 20, 20, 18, 13, - 14, 15, 41, 41, 18, 20, 41, 20, 20, 40, - 20, 39, 37, 24, 20, 42, 20, 20, 20, 24, - 42, 39, 41, 24, 45, 21, 42, 24, 19, 0, - 20, 20, 24, 42, 42, 42, 0, 24, 117, 9, - 116, 41, 41, 41, 37, 113, 29, 42, 42, 94, - 91, 157, 160, 39, 42, 40, 40, 39, 203, -1, - -1, -1, -1, -1, 81 +static const short yycheck[] = { 114, + 24, 115, 24, 21, 179, 25, 171, 31, 19, 174, + 19, 125, 187, 19, 20, 190, 4, 19, 20, 36, + 185, 19, 19, 20, 199, 139, 22, 38, 19, 20, + 54, 40, 197, 39, 36, 21, 19, 20, 60, 214, + 64, 39, 48, 19, 40, 65, 48, 19, 39, 163, + 215, 48, 217, 36, 19, 230, 231, 48, 40, 84, + 85, 19, 84, 87, 22, 48, 40, 39, 19, 41, + 184, 36, 186, 45, 46, 47, 40, 9, 103, 19, + 105, 39, 40, 15, 108, 110, 18, 111, 39, 210, + 41, 19, 207, 208, 45, 46, 47, 41, 219, 123, + 44, 29, 30, 31, 41, 220, 221, 44, 223, 19, + 225, 5, 6, 7, 8, 9, 19, 11, 12, 13, + 14, 15, 16, 17, 18, 19, 10, 21, 15, 39, + 14, 36, 15, 38, 19, 45, 46, 47, 3, 33, + 34, 5, 6, 7, 8, 9, 43, 11, 12, 13, + 14, 15, 16, 17, 18, 19, 19, 21, 23, 24, + 25, 26, 27, 28, 19, 29, 30, 31, 19, 44, + 45, 21, 19, 41, 29, 30, 31, 19, 29, 30, + 31, 32, 33, 34, 35, 40, 37, 38, 19, 23, + 24, 25, 26, 27, 28, 40, 42, 41, 29, 30, + 31, 32, 33, 34, 35, 19, 37, 38, 5, 6, + 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, + 17, 18, 19, 40, 21, 5, 6, 7, 8, 9, + 19, 11, 12, 13, 14, 15, 16, 17, 18, 19, + 41, 21, 5, 6, 7, 8, 9, 19, 11, 12, + 13, 14, 15, 16, 17, 18, 19, 19, 21, 6, + 7, 8, 9, 19, 11, 12, 13, 14, 15, 16, + 17, 18, 19, 19, 21, 13, 14, 15, 19, 40, + 18, 13, 14, 15, 19, 40, 18, 40, 19, 39, + 19, 40, 36, 38, 19, 23, 44, 19, 41, 41, + 19, 38, 23, 23, 20, 41, 23, 41, 41, 19, + 19, 41, 19, 40, 40, 19, 40, 23, 41, 19, + 23, 36, 0, 41, 0, 9, 39, 41, 39, 117, + 38, 29, 116, 91, 113, 94, 213, 39, 157, 160, + -1, 81, 204 }; /* -*-C-*- Note some compilers choke on comments on `#line' lines. */ #line 3 "/usr/lib/bison.simple" @@ -1131,23 +1174,23 @@ yyreduce: switch (yyn) { case 1: -#line 255 "parse.y" +#line 295 "parse.y" { ; ; break;} case 2: -#line 256 "parse.y" +#line 296 "parse.y" { ; ; break;} case 3: -#line 257 "parse.y" +#line 297 "parse.y" { ; ; break;} case 4: -#line 258 "parse.y" +#line 298 "parse.y" { ; ; break;} case 5: -#line 261 "parse.y" +#line 301 "parse.y" { Node *node = new_ccode(C_CCODE,(yyvsp[0].cbuf)->str, ccode_line); @@ -1156,7 +1199,7 @@ case 5: ; break;} case 6: -#line 267 "parse.y" +#line 307 "parse.y" { Node *node = new_ccode(H_CCODE,(yyvsp[0].cbuf)->str, ccode_line); @@ -1165,7 +1208,7 @@ case 6: ; break;} case 7: -#line 273 "parse.y" +#line 313 "parse.y" { Node *node = new_ccode(HT_CCODE,(yyvsp[0].cbuf)->str, ccode_line); @@ -1174,7 +1217,7 @@ case 7: ; break;} case 8: -#line 279 "parse.y" +#line 319 "parse.y" { Node *node = new_ccode(PH_CCODE,(yyvsp[0].cbuf)->str, ccode_line); @@ -1183,7 +1226,7 @@ case 8: ; break;} case 9: -#line 285 "parse.y" +#line 325 "parse.y" { Node *node = new_ccode(A_CCODE,(yyvsp[0].cbuf)->str, ccode_line); @@ -1192,7 +1235,7 @@ case 9: ; break;} case 10: -#line 291 "parse.y" +#line 331 "parse.y" { Node *node = new_ccode(AT_CCODE,(yyvsp[0].cbuf)->str, ccode_line); @@ -1201,15 +1244,15 @@ case 10: ; break;} case 11: -#line 299 "parse.y" +#line 339 "parse.y" { ; ; break;} case 12: -#line 300 "parse.y" +#line 340 "parse.y" { ; ; break;} case 13: -#line 303 "parse.y" +#line 343 "parse.y" { ((Class *)class)->nodes = class_nodes; class_nodes = NULL; @@ -1217,7 +1260,7 @@ case 13: ; break;} case 14: -#line 308 "parse.y" +#line 348 "parse.y" { ((Class *)class)->nodes = NULL; class_nodes = NULL; @@ -1225,49 +1268,49 @@ case 14: ; break;} case 15: -#line 315 "parse.y" +#line 355 "parse.y" { class = new_class(yyvsp[-2].id,yyvsp[0].id,NULL); ; break;} case 16: -#line 320 "parse.y" +#line 360 "parse.y" { ; ; break;} case 17: -#line 321 "parse.y" +#line 361 "parse.y" { ; ; break;} case 18: -#line 324 "parse.y" +#line 364 "parse.y" { ; ; break;} case 19: -#line 325 "parse.y" +#line 365 "parse.y" { ; ; break;} case 20: -#line 326 "parse.y" +#line 366 "parse.y" { ; ; break;} case 21: -#line 327 "parse.y" +#line 367 "parse.y" { ; ; break;} case 22: -#line 330 "parse.y" +#line 370 "parse.y" { the_scope = PUBLIC_SCOPE; ; break;} case 23: -#line 331 "parse.y" +#line 371 "parse.y" { the_scope = PRIVATE_SCOPE; ; break;} case 24: -#line 332 "parse.y" +#line 372 "parse.y" { the_scope = PROTECTED_SCOPE; ; break;} case 25: -#line 335 "parse.y" +#line 375 "parse.y" { if(strcmp(yyvsp[-1].id, "destroywith")==0) { g_free(yyvsp[-1].id); @@ -1283,7 +1326,7 @@ case 25: ; break;} case 26: -#line 348 "parse.y" +#line 388 "parse.y" { if(strcmp(yyvsp[-2].id, "destroy")==0) { g_free(yyvsp[-2].id); @@ -1300,14 +1343,14 @@ case 26: ; break;} case 27: -#line 364 "parse.y" +#line 404 "parse.y" { initializer = yyvsp[0].id; initializer_line = ccode_line; ; break;} case 28: -#line 368 "parse.y" +#line 408 "parse.y" { initializer = (yyvsp[0].cbuf)->str; initializer_line = ccode_line; @@ -1315,42 +1358,42 @@ case 28: ; break;} case 29: -#line 376 "parse.y" +#line 416 "parse.y" { ; ; break;} case 30: -#line 377 "parse.y" +#line 417 "parse.y" { ; ; break;} case 31: -#line 378 "parse.y" +#line 418 "parse.y" { destructor = NULL; ; break;} case 32: -#line 379 "parse.y" +#line 419 "parse.y" { initializer = NULL; ; break;} case 33: -#line 380 "parse.y" +#line 420 "parse.y" { destructor = NULL; initializer = NULL; ; break;} case 34: -#line 386 "parse.y" +#line 426 "parse.y" { push_variable(yyvsp[-2].id, the_scope,yyvsp[-4].line, NULL); ; break;} case 35: -#line 389 "parse.y" +#line 429 "parse.y" { push_variable(yyvsp[-3].id, the_scope, yyvsp[-5].line, yyvsp[-2].id); ; break;} case 36: -#line 393 "parse.y" +#line 433 "parse.y" { if(strcmp(yyvsp[-6].id,"get")==0 && strcmp(yyvsp[-3].id,"set")==0) { @@ -1388,7 +1431,7 @@ case 36: ; break;} case 37: -#line 428 "parse.y" +#line 468 "parse.y" { if(strcmp(yyvsp[-3].id,"get")==0) { Node *node; @@ -1419,7 +1462,7 @@ case 37: ; break;} case 38: -#line 456 "parse.y" +#line 496 "parse.y" { Node *node; char *get, *set = NULL; @@ -1485,7 +1528,7 @@ case 38: ; break;} case 39: -#line 521 "parse.y" +#line 561 "parse.y" { if(strcmp(yyvsp[-2].id,"type")!=0) { g_free(yyvsp[-4].id); @@ -1497,38 +1540,38 @@ case 39: ; break;} case 40: -#line 530 "parse.y" +#line 570 "parse.y" { yyval.id = yyvsp[0].id; typestack = g_list_prepend(typestack,NULL); ; break;} case 41: -#line 536 "parse.y" +#line 576 "parse.y" { yyval.list = yyvsp[-1].list; ; break;} case 42: -#line 537 "parse.y" +#line 577 "parse.y" { yyval.list = NULL; ; break;} case 43: -#line 540 "parse.y" +#line 580 "parse.y" { yyval.list = g_list_append(yyvsp[0].list,yyvsp[-2].id); ; break;} case 44: -#line 543 "parse.y" +#line 583 "parse.y" { yyval.list = g_list_append(NULL,yyvsp[0].id); ; break;} case 45: -#line 549 "parse.y" +#line 589 "parse.y" { ; ; break;} case 46: -#line 550 "parse.y" +#line 590 "parse.y" { Type *type = typestack->data; char *oldname = type->name; @@ -1537,14 +1580,14 @@ case 46: ; break;} case 47: -#line 558 "parse.y" +#line 598 "parse.y" { Node *node = new_type(0,yyvsp[0].id,NULL); typestack = g_list_prepend(typestack,node); ; break;} case 48: -#line 562 "parse.y" +#line 602 "parse.y" { Node *node = new_type(stars,yyvsp[-1].id,NULL); stars = 0; @@ -1552,140 +1595,140 @@ case 48: ; break;} case 49: -#line 569 "parse.y" +#line 609 "parse.y" { yyval.id = g_strconcat("unsigned ",yyvsp[0].id,NULL); ; break;} case 50: -#line 572 "parse.y" +#line 612 "parse.y" { yyval.id = g_strconcat("signed ",yyvsp[0].id,NULL); ; break;} case 51: -#line 575 "parse.y" +#line 615 "parse.y" { yyval.id = g_strdup(yyvsp[0].id); ; break;} case 52: -#line 578 "parse.y" +#line 618 "parse.y" { yyval.id = g_strdup("unsigned char"); ; break;} case 53: -#line 581 "parse.y" +#line 621 "parse.y" { yyval.id = g_strdup("signed char"); ; break;} case 54: -#line 584 "parse.y" +#line 624 "parse.y" { yyval.id = g_strdup("char"); ; break;} case 55: -#line 587 "parse.y" +#line 627 "parse.y" { yyval.id = g_strdup("double"); ; break;} case 56: -#line 590 "parse.y" +#line 630 "parse.y" { yyval.id = g_strdup("float"); ; break;} case 57: -#line 593 "parse.y" +#line 633 "parse.y" { yyval.id = yyvsp[0].id; ; break;} case 58: -#line 596 "parse.y" +#line 636 "parse.y" { yyval.id = g_strconcat(yyvsp[-1].id,yyvsp[0].id,NULL); g_free(yyvsp[0].id); ; break;} case 59: -#line 600 "parse.y" +#line 640 "parse.y" { yyval.id = yyvsp[0].id; ; break;} case 60: -#line 603 "parse.y" +#line 643 "parse.y" { yyval.id = g_strdup("void"); ; break;} case 61: -#line 608 "parse.y" +#line 648 "parse.y" { yyval.id = "long int"; ; break;} case 62: -#line 611 "parse.y" +#line 651 "parse.y" { yyval.id = "long"; ; break;} case 63: -#line 614 "parse.y" +#line 654 "parse.y" { yyval.id = "short int"; ; break;} case 64: -#line 617 "parse.y" +#line 657 "parse.y" { yyval.id = "short"; ; break;} case 65: -#line 620 "parse.y" +#line 660 "parse.y" { yyval.id = "int"; ; break;} case 66: -#line 625 "parse.y" +#line 665 "parse.y" { yyval.id = "enum "; ; break;} case 67: -#line 628 "parse.y" +#line 668 "parse.y" { yyval.id = "union "; ; break;} case 68: -#line 631 "parse.y" +#line 671 "parse.y" { yyval.id = "struct "; ; break;} case 69: -#line 636 "parse.y" +#line 676 "parse.y" { stars++; ; break;} case 70: -#line 637 "parse.y" +#line 677 "parse.y" { stars++; ; break;} case 71: -#line 641 "parse.y" +#line 681 "parse.y" { - if(strcmp(yyvsp[-1].id,"first")==0) + if(strcmp(yyvsp[-1].id, "first")==0) yyval.sigtype = SIGNAL_FIRST_METHOD; - else if(strcmp(yyvsp[-1].id,"last")==0) + else if(strcmp(yyvsp[-1].id, "last")==0) yyval.sigtype = SIGNAL_LAST_METHOD; else { yyerror(_("signal must be 'first' or 'last'")); @@ -1696,13 +1739,13 @@ case 71: ; break;} case 72: -#line 653 "parse.y" +#line 693 "parse.y" { yyval.sigtype = SIGNAL_LAST_METHOD; ; break;} case 73: -#line 659 "parse.y" +#line 699 "parse.y" { if(strcmp(yyvsp[-1].id,"first")==0) yyval.sigtype = SIGNAL_FIRST_METHOD; @@ -1717,7 +1760,7 @@ case 73: ; break;} case 74: -#line 671 "parse.y" +#line 711 "parse.y" { if(strcmp(yyvsp[-2].id,"first")==0) yyval.sigtype = SIGNAL_FIRST_METHOD; @@ -1732,138 +1775,143 @@ case 74: ; break;} case 75: -#line 683 "parse.y" +#line 723 "parse.y" { yyval.sigtype = SIGNAL_LAST_METHOD; ; break;} case 76: -#line 686 "parse.y" +#line 726 "parse.y" { /* the_scope was default thus public */ the_scope = PUBLIC_SCOPE; ; break;} case 77: -#line 692 "parse.y" +#line 732 "parse.y" { - gtktypes = g_list_prepend(gtktypes,yyvsp[-3].id); + gtktypes = g_list_prepend(gtktypes, yyvsp[-3].id); ; break;} case 78: -#line 697 "parse.y" +#line 737 "parse.y" { - gtktypes = g_list_append(gtktypes,yyvsp[0].id); + gtktypes = g_list_append(gtktypes, yyvsp[0].id); ; break;} case 79: -#line 700 "parse.y" +#line 740 "parse.y" { - gtktypes = g_list_append(gtktypes,yyvsp[0].id); + gtktypes = g_list_append(gtktypes, yyvsp[0].id); ; break;} case 80: -#line 705 "parse.y" +#line 745 "parse.y" { yyval.cbuf = yyvsp[0].cbuf; ; break;} case 81: -#line 706 "parse.y" +#line 746 "parse.y" { yyval.cbuf = NULL; ; break;} case 82: -#line 710 "parse.y" +#line 750 "parse.y" { if(!has_self) { yyerror(_("signal without 'self' as " "first parameter")); + free_all_global_state(); YYERROR; } push_function(the_scope, yyvsp[-7].sigtype,NULL, - yyvsp[-5].id, yyvsp[-1].id, yyvsp[0].cbuf,yyvsp[-9].line, + yyvsp[-5].id, yyvsp[0].cbuf,yyvsp[-9].line, ccode_line, vararg, yyvsp[-8].list); ; break;} case 83: -#line 720 "parse.y" +#line 761 "parse.y" { if(!has_self) { yyerror(_("signal without 'self' as " "first parameter")); + free_all_global_state(); YYERROR; } push_function(the_scope, yyvsp[-7].sigtype, NULL, - yyvsp[-5].id, yyvsp[-1].id, yyvsp[0].cbuf, yyvsp[-9].line, + yyvsp[-5].id, yyvsp[0].cbuf, yyvsp[-9].line, ccode_line, vararg, yyvsp[-8].list); ; break;} case 84: -#line 730 "parse.y" +#line 772 "parse.y" { if(!has_self) { yyerror(_("virtual method without 'self' as " "first parameter")); + free_all_global_state(); YYERROR; } push_function(the_scope, VIRTUAL_METHOD, NULL, yyvsp[-5].id, - yyvsp[-1].id, yyvsp[0].cbuf, yyvsp[-8].line, + yyvsp[0].cbuf, yyvsp[-8].line, ccode_line, vararg, NULL); ; break;} case 85: -#line 740 "parse.y" +#line 783 "parse.y" { if(!has_self) { yyerror(_("virtual method without 'self' as " "first parameter")); + free_all_global_state(); YYERROR; } push_function(the_scope, VIRTUAL_METHOD, NULL, yyvsp[-5].id, - yyvsp[-1].id, yyvsp[0].cbuf, yyvsp[-7].line, + yyvsp[0].cbuf, yyvsp[-7].line, ccode_line, vararg, NULL); ; break;} case 86: -#line 750 "parse.y" +#line 794 "parse.y" { if(!has_self) { yyerror(_("virtual method without 'self' as " "first parameter")); + free_all_global_state(); YYERROR; } push_function(PUBLIC_SCOPE, VIRTUAL_METHOD, NULL, - yyvsp[-5].id, yyvsp[-1].id, yyvsp[0].cbuf, yyvsp[-7].line, + yyvsp[-5].id, yyvsp[0].cbuf, yyvsp[-7].line, ccode_line, vararg, NULL); ; break;} case 87: -#line 760 "parse.y" +#line 805 "parse.y" { push_function(NO_SCOPE, OVERRIDE_METHOD, yyvsp[-8].id, - yyvsp[-5].id, yyvsp[-1].id, yyvsp[0].cbuf, + yyvsp[-5].id, yyvsp[0].cbuf, yyvsp[-10].line, ccode_line, vararg, NULL); ; break;} case 88: -#line 766 "parse.y" +#line 811 "parse.y" { push_function(the_scope, REGULAR_METHOD, NULL, yyvsp[-5].id, - yyvsp[-1].id, yyvsp[0].cbuf, yyvsp[-7].line, ccode_line, + yyvsp[0].cbuf, yyvsp[-7].line, ccode_line, vararg, NULL); ; break;} case 89: -#line 771 "parse.y" +#line 816 "parse.y" { - if(strcmp(yyvsp[-4].id,"init")==0) { + if(strcmp(yyvsp[-4].id, "init")==0) { push_init_arg(yyvsp[-2].id,FALSE); push_function(NO_SCOPE, INIT_METHOD, NULL, - yyvsp[-4].id, NULL, yyvsp[0].cbuf, yyvsp[-3].line, + yyvsp[-4].id, yyvsp[0].cbuf, yyvsp[-3].line, ccode_line, FALSE, NULL); - } else if(strcmp(yyvsp[-4].id,"class_init")==0) { + } else if(strcmp(yyvsp[-4].id, "class_init")==0) { push_init_arg(yyvsp[-2].id,TRUE); push_function(NO_SCOPE, CLASS_INIT_METHOD, NULL, - yyvsp[-4].id, NULL, yyvsp[0].cbuf, yyvsp[-3].line, + yyvsp[-4].id, yyvsp[0].cbuf, yyvsp[-3].line, ccode_line, FALSE, NULL); } else { g_free(yyvsp[-4].id); @@ -1875,26 +1923,65 @@ case 89: ; break;} case 90: -#line 792 "parse.y" -{ yyval.id = yyvsp[0].id; ; +#line 837 "parse.y" +{ + g_free(onerror); onerror = NULL; + g_free(defreturn); defreturn = NULL; + if(!set_return_value(yyvsp[-1].id, yyvsp[0].id)) { + g_free(yyvsp[-1].id); + g_free(yyvsp[0].id); + yyerror(_("parse error")); + YYERROR; + } + g_free(yyvsp[-1].id); + ; break;} case 91: -#line 793 "parse.y" +#line 848 "parse.y" { - yyval.id = (yyvsp[0].cbuf)->str; - g_string_free(yyvsp[0].cbuf,FALSE); - ; + g_free(onerror); onerror = NULL; + g_free(defreturn); defreturn = NULL; + if(!set_return_value(yyvsp[-3].id, yyvsp[-2].id)) { + g_free(yyvsp[-3].id); g_free(yyvsp[-2].id); + g_free(yyvsp[-1].id); g_free(yyvsp[0].id); + yyerror(_("parse error")); + YYERROR; + } + if(!set_return_value(yyvsp[-1].id, yyvsp[0].id)) { + onerror = defreturn = NULL; + g_free(yyvsp[-3].id); g_free(yyvsp[-2].id); + g_free(yyvsp[-1].id); g_free(yyvsp[0].id); + yyerror(_("parse error")); + YYERROR; + } + g_free(yyvsp[-3].id); + g_free(yyvsp[-1].id); + ; break;} case 92: -#line 797 "parse.y" -{ yyval.id = NULL; ; +#line 867 "parse.y" +{ + g_free(onerror); onerror = NULL; + g_free(defreturn); defreturn = NULL; + ; break;} case 93: -#line 800 "parse.y" -{ vararg = FALSE; has_self = FALSE; ; +#line 873 "parse.y" +{ yyval.id = yyvsp[0].id; ; break;} case 94: -#line 801 "parse.y" +#line 874 "parse.y" +{ + yyval.id = (yyvsp[1].cbuf)->str; + g_string_free(yyvsp[1].cbuf, FALSE); + ; + break;} +case 95: +#line 880 "parse.y" +{ vararg = FALSE; has_self = FALSE; ; + break;} +case 96: +#line 881 "parse.y" { vararg = FALSE; has_self = TRUE; @@ -1907,8 +1994,8 @@ case 94: } ; break;} -case 95: -#line 812 "parse.y" +case 97: +#line 892 "parse.y" { has_self = TRUE; if(strcmp(yyvsp[-2].id,"self")==0) @@ -1920,40 +2007,40 @@ case 95: } ; break;} -case 96: -#line 822 "parse.y" +case 98: +#line 902 "parse.y" { has_self = FALSE; ; break;} -case 97: -#line 825 "parse.y" +case 99: +#line 905 "parse.y" { vararg = TRUE; ; break;} -case 98: -#line 826 "parse.y" +case 100: +#line 906 "parse.y" { vararg = FALSE; ; break;} -case 99: -#line 829 "parse.y" +case 101: +#line 909 "parse.y" { ; ; break;} -case 100: -#line 830 "parse.y" +case 102: +#line 910 "parse.y" { ; ; break;} -case 101: -#line 833 "parse.y" +case 103: +#line 913 "parse.y" { push_funcarg(yyvsp[0].id,NULL); ; break;} -case 102: -#line 836 "parse.y" +case 104: +#line 916 "parse.y" { push_funcarg(yyvsp[-1].id,yyvsp[0].id); ; break;} -case 103: -#line 839 "parse.y" +case 105: +#line 919 "parse.y" { if(strcmp(yyvsp[-2].id,"check")!=0) { yyerror(_("parse error")); @@ -1963,8 +2050,8 @@ case 103: push_funcarg(yyvsp[-4].id,NULL); ; break;} -case 104: -#line 847 "parse.y" +case 106: +#line 927 "parse.y" { if(strcmp(yyvsp[-2].id,"check")!=0) { yyerror(_("parse error")); @@ -1974,16 +2061,16 @@ case 104: push_funcarg(yyvsp[-5].id,yyvsp[-4].id); ; break;} -case 105: -#line 857 "parse.y" +case 107: +#line 937 "parse.y" { ; ; break;} -case 106: -#line 858 "parse.y" +case 108: +#line 938 "parse.y" { ; ; break;} -case 107: -#line 861 "parse.y" +case 109: +#line 941 "parse.y" { if(strcmp(yyvsp[0].id,"type")==0) { Node *node = new_check(TYPE_CHECK,NULL); @@ -1998,61 +2085,61 @@ case 107: g_free(yyvsp[0].id); ; break;} -case 108: -#line 874 "parse.y" +case 110: +#line 954 "parse.y" { Node *node = new_check(GT_CHECK,yyvsp[0].id); checks = g_list_append(checks,node); ; break;} -case 109: -#line 878 "parse.y" +case 111: +#line 958 "parse.y" { Node *node = new_check(LT_CHECK,yyvsp[0].id); checks = g_list_append(checks,node); ; break;} -case 110: -#line 882 "parse.y" +case 112: +#line 962 "parse.y" { Node *node = new_check(GE_CHECK,yyvsp[0].id); checks = g_list_append(checks,node); ; break;} -case 111: -#line 886 "parse.y" +case 113: +#line 966 "parse.y" { Node *node = new_check(LE_CHECK,yyvsp[0].id); checks = g_list_append(checks,node); ; break;} -case 112: -#line 890 "parse.y" +case 114: +#line 970 "parse.y" { Node *node = new_check(EQ_CHECK,yyvsp[0].id); checks = g_list_append(checks,node); ; break;} -case 113: -#line 894 "parse.y" +case 115: +#line 974 "parse.y" { Node *node = new_check(NE_CHECK,yyvsp[0].id); checks = g_list_append(checks,node); ; break;} -case 114: -#line 900 "parse.y" +case 116: +#line 980 "parse.y" { yyval.id = yyvsp[0].id; ; break;} -case 115: -#line 901 "parse.y" +case 117: +#line 981 "parse.y" { yyval.id = g_strconcat("-",yyvsp[0].id,NULL); g_free(yyvsp[0].id); ; break;} -case 116: -#line 905 "parse.y" +case 118: +#line 985 "parse.y" { yyval.id = yyvsp[0].id; ; break;} } @@ -2277,5 +2364,5 @@ yyerrhandle: } return 1; } -#line 908 "parse.y" +#line 988 "parse.y" diff --git a/src/parse.y b/src/parse.y index e204c62..192e4c4 100644 --- a/src/parse.y +++ b/src/parse.y @@ -25,7 +25,7 @@ #include #include -#include "tree.h" +#include "treefuncs.h" #include "main.h" #include "util.h" @@ -50,6 +50,9 @@ static gboolean destructor_simple = TRUE; static char *initializer = NULL; static int initializer_line = 0; +static char *onerror = NULL; +static char *defreturn = NULL; + static GList *gtktypes = NULL; /* this can be a global as we will only do one function at a time @@ -113,9 +116,9 @@ push_variable(char *name, int scope, int line_no, char *postfix) } static void -push_function(int scope, int method, char *oid, char *id, char *onerror, - GString *cbuf, int line_no, int ccode_line, gboolean vararg, - GList *flags) +push_function(int scope, int method, char *oid, char *id, + GString *cbuf, int line_no, int ccode_line, + gboolean vararg, GList *flags) { Node *node; Type *type; @@ -150,7 +153,7 @@ push_function(int scope, int method, char *oid, char *id, char *onerror, c_cbuf = NULL; node = new_method(scope, method, type, oid, gtktypes, flags, - id, funcargs, onerror, c_cbuf, line_no, + id, funcargs, onerror, defreturn, c_cbuf, line_no, ccode_line, vararg); if(cbuf) @@ -161,9 +164,28 @@ push_function(int scope, int method, char *oid, char *id, char *onerror, gtktypes = NULL; funcargs = NULL; + onerror = NULL; + defreturn = NULL; + class_nodes = g_list_append(class_nodes, node); } +static void +free_all_global_state(void) +{ + g_free(onerror); + onerror = NULL; + g_free(defreturn); + defreturn = NULL; + + g_list_foreach(gtktypes, (GFunc)g_free, NULL); + g_list_free(gtktypes); + gtktypes = NULL; + + free_node_list(funcargs); + funcargs = NULL; +} + static void push_funcarg(char *name, char *postfix) { @@ -172,7 +194,7 @@ push_funcarg(char *name, char *postfix) type->postfix = postfix; - node = new_funcarg(type,name,checks); + node = new_funcarg(type, name, checks); checks = NULL; funcargs = g_list_append(funcargs, node); @@ -231,6 +253,25 @@ find_var_or_die(const char *id, int line) return NULL; } +static gboolean +set_return_value(char *type, char *val) +{ + if(strcmp(type, "onerror")==0) { + if(!onerror) { + onerror = val; + return TRUE; + } else + return FALSE; + } else if(strcmp(type, "defreturn")==0) { + if(!defreturn) { + defreturn = val; + return TRUE; + } else + return FALSE; + } + return FALSE; +} + %} %union { @@ -244,7 +285,6 @@ find_var_or_die(const char *id, int line) %token CLASS FROM %token CONST VOID STRUCT UNION ENUM THREEDOTS %token SIGNED UNSIGNED LONG SHORT INT FLOAT DOUBLE CHAR -%token ONERROR %token TOKEN NUMBER TYPETOKEN ARRAY_DIM %token CCODE HTCODE PHCODE HCODE ACODE ATCODE @@ -639,9 +679,9 @@ stars: '*' stars { stars++; } /* this never sets the_scope */ simplesigtype: TOKEN sigtype { - if(strcmp($1,"first")==0) + if(strcmp($1, "first")==0) $$ = SIGNAL_FIRST_METHOD; - else if(strcmp($1,"last")==0) + else if(strcmp($1, "last")==0) $$ = SIGNAL_LAST_METHOD; else { yyerror(_("signal must be 'first' or 'last'")); @@ -690,15 +730,15 @@ fullsigtype: scope TOKEN sigtype { ; sigtype: TOKEN '(' tokenlist ')' { - gtktypes = g_list_prepend(gtktypes,$1); + gtktypes = g_list_prepend(gtktypes, $1); } ; tokenlist: tokenlist ',' TOKEN { - gtktypes = g_list_append(gtktypes,$3); + gtktypes = g_list_append(gtktypes, $3); } | TOKEN { - gtktypes = g_list_append(gtktypes,$1); + gtktypes = g_list_append(gtktypes, $1); } ; @@ -707,77 +747,82 @@ codenocode: '{' CCODE { $$ = $2; } ; /*here CCODE will include the ending '}' */ -method: SIGNAL flags fullsigtype type TOKEN '(' funcargs ')' onerror codenocode { +method: SIGNAL flags fullsigtype type TOKEN '(' funcargs ')' returnvals codenocode { if(!has_self) { yyerror(_("signal without 'self' as " "first parameter")); + free_all_global_state(); YYERROR; } push_function(the_scope, $3,NULL, - $5, $9, $10,$1, + $5, $10,$1, ccode_line, vararg, $2); } - | scope SIGNAL flags simplesigtype type TOKEN '(' funcargs ')' onerror codenocode { + | scope SIGNAL flags simplesigtype type TOKEN '(' funcargs ')' returnvals codenocode { if(!has_self) { yyerror(_("signal without 'self' as " "first parameter")); + free_all_global_state(); YYERROR; } push_function(the_scope, $4, NULL, - $6, $10, $11, $2, + $6, $11, $2, ccode_line, vararg, $3); } - | VIRTUAL scope type TOKEN '(' funcargs ')' onerror codenocode { + | VIRTUAL scope type TOKEN '(' funcargs ')' returnvals codenocode { if(!has_self) { yyerror(_("virtual method without 'self' as " "first parameter")); + free_all_global_state(); YYERROR; } push_function(the_scope, VIRTUAL_METHOD, NULL, $4, - $8, $9, $1, + $9, $1, ccode_line, vararg, NULL); } - | scope VIRTUAL type TOKEN '(' funcargs ')' onerror codenocode { + | scope VIRTUAL type TOKEN '(' funcargs ')' returnvals codenocode { if(!has_self) { yyerror(_("virtual method without 'self' as " "first parameter")); + free_all_global_state(); YYERROR; } push_function(the_scope, VIRTUAL_METHOD, NULL, $4, - $8, $9, $2, + $9, $2, ccode_line, vararg, NULL); } - | VIRTUAL type TOKEN '(' funcargs ')' onerror codenocode { + | VIRTUAL type TOKEN '(' funcargs ')' returnvals codenocode { if(!has_self) { yyerror(_("virtual method without 'self' as " "first parameter")); + free_all_global_state(); YYERROR; } push_function(PUBLIC_SCOPE, VIRTUAL_METHOD, NULL, - $3, $7, $8, $1, + $3, $8, $1, ccode_line, vararg, NULL); } - | OVERRIDE '(' TYPETOKEN ')' type TOKEN '(' funcargs ')' onerror codenocode { + | OVERRIDE '(' TYPETOKEN ')' type TOKEN '(' funcargs ')' returnvals codenocode { push_function(NO_SCOPE, OVERRIDE_METHOD, $3, - $6, $10, $11, + $6, $11, $1, ccode_line, vararg, NULL); } - | scope type TOKEN '(' funcargs ')' onerror codenocode { + | scope type TOKEN '(' funcargs ')' returnvals codenocode { push_function(the_scope, REGULAR_METHOD, NULL, $3, - $7, $8, $1, ccode_line, + $8, $1, ccode_line, vararg, NULL); } | TOKEN '(' TOKEN ')' codenocode { - if(strcmp($1,"init")==0) { + if(strcmp($1, "init")==0) { push_init_arg($3,FALSE); push_function(NO_SCOPE, INIT_METHOD, NULL, - $1, NULL, $5, $2, + $1, $5, $2, ccode_line, FALSE, NULL); - } else if(strcmp($1,"class_init")==0) { + } else if(strcmp($1, "class_init")==0) { push_init_arg($3,TRUE); push_function(NO_SCOPE, CLASS_INIT_METHOD, NULL, - $1, NULL, $5, $2, + $1, $5, $2, ccode_line, FALSE, NULL); } else { g_free($1); @@ -788,13 +833,48 @@ method: SIGNAL flags fullsigtype type TOKEN '(' funcargs ')' onerror codenocode } } ; - -onerror: ONERROR numtok { $$ = $2; } - | ONERROR '{' CCODE { + +returnvals: TOKEN retcode { + g_free(onerror); onerror = NULL; + g_free(defreturn); defreturn = NULL; + if(!set_return_value($1, $2)) { + g_free($1); + g_free($2); + yyerror(_("parse error")); + YYERROR; + } + g_free($1); + } + | TOKEN retcode TOKEN retcode { + g_free(onerror); onerror = NULL; + g_free(defreturn); defreturn = NULL; + if(!set_return_value($1, $2)) { + g_free($1); g_free($2); + g_free($3); g_free($4); + yyerror(_("parse error")); + YYERROR; + } + if(!set_return_value($3, $4)) { + onerror = defreturn = NULL; + g_free($1); g_free($2); + g_free($3); g_free($4); + yyerror(_("parse error")); + YYERROR; + } + g_free($1); + g_free($3); + } + | { + g_free(onerror); onerror = NULL; + g_free(defreturn); defreturn = NULL; + } + ; + +retcode: numtok { $$ = $1; } + | '{' CCODE { $$ = ($3)->str; - g_string_free($3,FALSE); + g_string_free($3, FALSE); } - | { $$ = NULL; } ; funcargs: VOID { vararg = FALSE; has_self = FALSE; } diff --git a/src/test.gob b/src/test.gob index 402f69c..edf2249 100644 --- a/src/test.gob +++ b/src/test.gob @@ -167,7 +167,7 @@ class Gtk:Weird:Button from Gtk:Button { *zblunk*******//**//**/ signal first NONE (NONE) void bloh(self); - virtual void * bah(self, int h (check > 0)) onerror NULL { + virtual void * bah(self, int h (check > 0)) onerror NULL defreturn 0 { beh(self,h); return NULL; } @@ -273,7 +273,7 @@ class Gtk:Weird:Button from Gtk:Button { } public signal (NO_HOOKS) last INT (INT) - int testflags(self, int w (check > 0)) { + int testflags(self, int w (check > 0)) defreturn -99 { /*foo*/ return w; } diff --git a/src/tree.c b/src/tree.c deleted file mode 100644 index 6382d05..0000000 --- a/src/tree.c +++ /dev/null @@ -1,153 +0,0 @@ -/* GOB C Preprocessor - * Copyright (C) 1999 the Free Software Foundation. - * - * Author: George Lebl - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, - * USA. - */ - -#include "config.h" -#include -#include "tree.h" - -Node * -new_ccode(int cctype, char *cbuf, int line_no) -{ - CCode *node = (CCode *)g_new(Node,1); - node->type = CCODE_NODE; - node->cctype = cctype; - node->cbuf = cbuf; - node->line_no = line_no; - return (Node *)node; -} - -Node * -new_class(char *otype, char *ptype, GList *nodes) -{ - Class *node = (Class *)g_new(Node,1); - node->type = CLASS_NODE; - node->otype = otype; - node->ptype = ptype; - node->nodes = nodes; - return (Node *)node; -} - -Node * -new_type(int stars, char *name, char *postfix) -{ - Type *node = (Type *)g_new(Node,1); - node->type = TYPE_NODE; - node->stars = stars; - node->name = name; - node->postfix = postfix; - return (Node *)node; -} - -Node * -new_check(int chtype, char *number) -{ - Check *node = (Check *)g_new(Node,1); - node->type = CHECK_NODE; - node->chtype = chtype; - node->number = number; - return (Node *)node; -} - -Node * -new_funcarg(Type *atype, char *name, GList *checks) -{ - FuncArg *node = (FuncArg *)g_new(Node,1); - node->type = FUNCARG_NODE; - node->atype = atype; - node->name = name; - node->checks = checks; - return (Node *)node; -} - -Node * -new_method(int scope, int method, Type *mtype, char *otype, - GList *gtktypes, GList *flags, char *id, GList *args, - char *onerror, char *cbuf, int line_no, int ccode_line, - gboolean vararg) -{ - Method *node = (Method *)g_new(Node,1); - node->type = METHOD_NODE; - node->scope = scope; - node->method = method; - node->mtype = mtype; - node->otype = otype; - node->gtktypes = gtktypes; - node->flags = flags; - node->id = id; - node->args = args; - node->onerror = onerror; - node->cbuf = cbuf; - node->line_no = line_no; - node->ccode_line = ccode_line; - node->vararg = vararg; - return (Node *)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) -{ - Argument *node = (Argument *)g_new(Node,1); - node->type = ARGUMENT_NODE; - node->gtktype = gtktype; - node->atype = atype; - node->flags = flags; - node->name = name; - node->get = get; - node->get_line = get_line; - node->set = set; - node->set_line = set_line; - node->line_no = line_no; - return (Node *)node; -} - -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) -{ - Variable *node = (Variable *)g_new(Node,1); - node->type = VARIABLE_NODE; - node->scope = scope; - node->vtype = vtype; - node->id = id; - node->line_no = line_no; - node->destructor = destructor; - node->destructor_line = destructor_line; - node->destructor_simple = destructor_simple; - node->initializer = initializer; - node->initializer_line = initializer_line; - return (Node *)node; -} - -Type * -copy_type(Type *type) -{ - Node *node; - - if(!type) return NULL; - - node = new_type(type->stars, - g_strdup(type->name), - g_strdup(type->postfix)); - - return (Type *)node; -} diff --git a/src/tree.h b/src/tree.h deleted file mode 100644 index 91fae23..0000000 --- a/src/tree.h +++ /dev/null @@ -1,195 +0,0 @@ -/* GOB C Preprocessor - * Copyright (C) 1999 the Free Software Foundation. - * - * Author: George Lebl - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, - * USA. - */ - -#ifndef _TREE_H_ -#define _TREE_H_ - -#include - -enum { - CCODE_NODE, - CLASS_NODE, - TYPE_NODE, - CHECK_NODE, - FUNCARG_NODE, - METHOD_NODE, - ARGUMENT_NODE, - VARIABLE_NODE -}; - -/* for ccode type */ -enum { - A_CCODE, - AT_CCODE, - C_CCODE, - H_CCODE, - HT_CCODE, - PH_CCODE -}; - -typedef union _Node Node; - -typedef struct _CCode CCode; -struct _CCode { - int type; - int cctype; - char *cbuf; - int line_no; -}; - -typedef struct _Class Class; -struct _Class { - int type; - char *otype; /*this object class type*/ - char *ptype; /*parent class type*/ - GList *nodes; -}; - -typedef struct _Type Type; -struct _Type { - int type; - int stars; - char *name; - char *postfix; -}; - -enum { - NULL_CHECK, - TYPE_CHECK, - LT_CHECK, - GT_CHECK, - LE_CHECK, - GE_CHECK, - EQ_CHECK, - NE_CHECK -}; - -typedef struct _Check Check; -struct _Check { - int type; - int chtype; - char *number; -}; - -typedef struct _FuncArg FuncArg; -struct _FuncArg { - int type; - Type *atype; - char *name; - GList *checks; -}; - -typedef struct _Argument Argument; -struct _Argument { - int type; - char *gtktype; - Type *atype; - GList *flags; - char *name; - char *get; - int get_line; - char *set; - int set_line; - int line_no; -}; - -/*scope type*/ -enum { - NO_SCOPE, - PUBLIC_SCOPE, - PRIVATE_SCOPE, - PROTECTED_SCOPE -}; - -/* method type */ -enum { - REGULAR_METHOD, - INIT_METHOD, - CLASS_INIT_METHOD, - VIRTUAL_METHOD, - SIGNAL_LAST_METHOD, - SIGNAL_FIRST_METHOD, - OVERRIDE_METHOD -}; - -typedef struct _Method Method; -struct _Method { - int type; - int scope; /* scope type */ - int method; /* method type */ - Type *mtype; - char *otype; /*for override methods*/ - GList *gtktypes; /*GTK types for a signal*/ - GList *flags; /* GTK_RUN_* flags for a signal */ - char *id; - GList *args; - char *onerror; - char *cbuf; - int line_no; - int ccode_line; - gboolean vararg; -}; - -typedef struct _Variable Variable; -struct _Variable { - int type; - int scope; - Type *vtype; - char *id; - int line_no; - char *destructor; - int destructor_line; - gboolean destructor_simple; - char *initializer; - int initializer_line; -}; - -union _Node { - int type; - CCode ccode; - Class class; - Type _type; - Check check; - Argument argument; - Method method; - Variable variable; -}; - -Node *new_ccode(int cctype, char *cbuf, int line_no); -Node *new_class(char *otype, char *ptype, GList *nodes); -Node *new_type(int stars, char *name, char *postfix); -Node *new_check(int chtype, char *number); -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 *cbuf, int line_no, int ccode_line, - gboolean vararg); -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_variable(int scope, Type *vtype, char *id, int line_no, - char *destructor, int destructor_line, - gboolean destructor_simple, - char *initializer, int initializer_line); - -Type *copy_type(Type *type); - -#endif diff --git a/src/treefuncs.c b/src/treefuncs.c new file mode 100644 index 0000000..e1b2be6 --- /dev/null +++ b/src/treefuncs.c @@ -0,0 +1,374 @@ +/* Generated by generate_treefuncs.pl from treefuncs.def! + * Do not edit by hand! */ + +#include +#include "treefuncs.h" + +#define COPY_LIST_VALS(list,func) { GList *li; for(li=(list);li;li=li->next) { li->data=func(li->data); } } + +Node * new_argument (char * gtktype, Type * atype, GList * flags, char * name, char * get, int get_line, char * set, int set_line, int line_no) +{ + Argument * self = g_new0(Argument, 1); + self->type = ARGUMENT_NODE; + self->gtktype = gtktype; + self->atype = atype; + self->flags = flags; + self->name = name; + self->get = get; + self->get_line = get_line; + self->set = set; + self->set_line = set_line; + self->line_no = line_no; + return (Node *)self; +} + +Node * new_ccode (int cctype, char * cbuf, int line_no) +{ + CCode * self = g_new0(CCode, 1); + self->type = CCODE_NODE; + self->cctype = cctype; + self->cbuf = cbuf; + self->line_no = line_no; + return (Node *)self; +} + +Node * new_check (int chtype, char * number) +{ + Check * self = g_new0(Check, 1); + self->type = CHECK_NODE; + self->chtype = chtype; + self->number = number; + return (Node *)self; +} + +Node * new_class (char * otype, char * ptype, GList * nodes) +{ + Class * self = g_new0(Class, 1); + self->type = CLASS_NODE; + self->otype = otype; + self->ptype = ptype; + self->nodes = nodes; + return (Node *)self; +} + +Node * new_funcarg (Type * atype, char * name, GList * checks) +{ + FuncArg * self = g_new0(FuncArg, 1); + self->type = FUNCARG_NODE; + self->atype = atype; + self->name = name; + self->checks = checks; + return (Node *)self; +} + +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) +{ + Method * self = g_new0(Method, 1); + self->type = METHOD_NODE; + self->scope = scope; + self->method = method; + self->mtype = mtype; + self->otype = otype; + self->gtktypes = gtktypes; + self->flags = flags; + self->id = id; + self->args = args; + self->onerror = onerror; + self->defreturn = defreturn; + self->cbuf = cbuf; + self->line_no = line_no; + self->ccode_line = ccode_line; + self->vararg = vararg; + return (Node *)self; +} + +Node * new_type (int stars, char * name, char * postfix) +{ + Type * self = g_new0(Type, 1); + self->type = TYPE_NODE; + self->stars = stars; + self->name = name; + self->postfix = postfix; + return (Node *)self; +} + +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) +{ + Variable * self = g_new0(Variable, 1); + self->type = VARIABLE_NODE; + self->scope = scope; + self->vtype = vtype; + self->id = id; + self->line_no = line_no; + self->destructor = destructor; + self->destructor_line = destructor_line; + self->destructor_simple = destructor_simple; + self->initializer = initializer; + self->initializer_line = initializer_line; + return (Node *)self; +} + +Argument * copy_argument (Argument * self) +{ + Argument * new; + g_return_if_fail(self != NULL); + g_return_if_fail(self->type == ARGUMENT_NODE); + new = g_new0(Argument, 1); + new->type = ARGUMENT_NODE; + new->gtktype = g_strdup(self->gtktype); + new->atype = copy_type(self->atype); + new->flags = g_list_copy(self->flags); COPY_LIST_VALS(new->flags, g_strdup); + new->name = g_strdup(self->name); + new->get = g_strdup(self->get); + new->get_line = self->get_line; + new->set = g_strdup(self->set); + new->set_line = self->set_line; + new->line_no = self->line_no; + return new; +} + +CCode * copy_ccode (CCode * self) +{ + CCode * new; + g_return_if_fail(self != NULL); + g_return_if_fail(self->type == CCODE_NODE); + new = g_new0(CCode, 1); + new->type = CCODE_NODE; + new->cctype = self->cctype; + new->cbuf = g_strdup(self->cbuf); + new->line_no = self->line_no; + return new; +} + +Check * copy_check (Check * self) +{ + Check * new; + g_return_if_fail(self != NULL); + g_return_if_fail(self->type == CHECK_NODE); + new = g_new0(Check, 1); + new->type = CHECK_NODE; + new->chtype = self->chtype; + new->number = g_strdup(self->number); + return new; +} + +Class * copy_class (Class * self) +{ + Class * new; + g_return_if_fail(self != NULL); + g_return_if_fail(self->type == CLASS_NODE); + new = g_new0(Class, 1); + new->type = CLASS_NODE; + new->otype = g_strdup(self->otype); + new->ptype = g_strdup(self->ptype); + new->nodes = copy_node_list(self->nodes); + return new; +} + +FuncArg * copy_funcarg (FuncArg * self) +{ + FuncArg * new; + g_return_if_fail(self != NULL); + g_return_if_fail(self->type == FUNCARG_NODE); + new = g_new0(FuncArg, 1); + new->type = FUNCARG_NODE; + new->atype = copy_type(self->atype); + new->name = g_strdup(self->name); + new->checks = copy_node_list(self->checks); + return new; +} + +Method * copy_method (Method * self) +{ + Method * new; + g_return_if_fail(self != NULL); + g_return_if_fail(self->type == METHOD_NODE); + new = g_new0(Method, 1); + new->type = METHOD_NODE; + new->scope = self->scope; + new->method = self->method; + new->mtype = copy_type(self->mtype); + new->otype = g_strdup(self->otype); + new->gtktypes = g_list_copy(self->gtktypes); COPY_LIST_VALS(new->gtktypes, g_strdup); + new->flags = g_list_copy(self->flags); COPY_LIST_VALS(new->flags, g_strdup); + new->id = g_strdup(self->id); + new->args = copy_node_list(self->args); + new->onerror = g_strdup(self->onerror); + new->defreturn = g_strdup(self->defreturn); + new->cbuf = g_strdup(self->cbuf); + new->line_no = self->line_no; + new->ccode_line = self->ccode_line; + new->vararg = self->vararg; + return new; +} + +Type * copy_type (Type * self) +{ + Type * new; + g_return_if_fail(self != NULL); + g_return_if_fail(self->type == TYPE_NODE); + new = g_new0(Type, 1); + new->type = TYPE_NODE; + new->stars = self->stars; + new->name = g_strdup(self->name); + new->postfix = g_strdup(self->postfix); + return new; +} + +Variable * copy_variable (Variable * self) +{ + Variable * new; + g_return_if_fail(self != NULL); + g_return_if_fail(self->type == VARIABLE_NODE); + new = g_new0(Variable, 1); + new->type = VARIABLE_NODE; + new->scope = self->scope; + new->vtype = copy_type(self->vtype); + new->id = g_strdup(self->id); + new->line_no = self->line_no; + new->destructor = g_strdup(self->destructor); + new->destructor_line = self->destructor_line; + new->destructor_simple = self->destructor_simple; + new->initializer = g_strdup(self->initializer); + new->initializer_line = self->initializer_line; + return new; +} + +void free_argument (Argument * self) +{ + g_return_if_fail(self != NULL); + g_return_if_fail(self->type == ARGUMENT_NODE); + g_free(self->gtktype); + free_type(self->atype); + g_list_foreach(self->flags, (GFunc)g_free, NULL); g_list_free(self->flags); + g_free(self->name); + g_free(self->get); + g_free(self->set); + g_free(self); +} + +void free_ccode (CCode * self) +{ + g_return_if_fail(self != NULL); + g_return_if_fail(self->type == CCODE_NODE); + g_free(self->cbuf); + g_free(self); +} + +void free_check (Check * self) +{ + g_return_if_fail(self != NULL); + g_return_if_fail(self->type == CHECK_NODE); + g_free(self->number); + g_free(self); +} + +void free_class (Class * self) +{ + g_return_if_fail(self != NULL); + g_return_if_fail(self->type == CLASS_NODE); + g_free(self->otype); + g_free(self->ptype); + free_node_list(self->nodes); + g_free(self); +} + +void free_funcarg (FuncArg * self) +{ + g_return_if_fail(self != NULL); + g_return_if_fail(self->type == FUNCARG_NODE); + free_type(self->atype); + g_free(self->name); + free_node_list(self->checks); + g_free(self); +} + +void free_method (Method * self) +{ + g_return_if_fail(self != NULL); + g_return_if_fail(self->type == METHOD_NODE); + free_type(self->mtype); + g_free(self->otype); + g_list_foreach(self->gtktypes, (GFunc)g_free, NULL); g_list_free(self->gtktypes); + g_list_foreach(self->flags, (GFunc)g_free, NULL); g_list_free(self->flags); + g_free(self->id); + free_node_list(self->args); + g_free(self->onerror); + g_free(self->defreturn); + g_free(self->cbuf); + g_free(self); +} + +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->postfix); + g_free(self); +} + +void free_variable (Variable * self) +{ + g_return_if_fail(self != NULL); + g_return_if_fail(self->type == VARIABLE_NODE); + free_type(self->vtype); + g_free(self->id); + g_free(self->destructor); + g_free(self->initializer); + g_free(self); +} + +Node * copy_node(Node *node) +{ + g_return_if_fail(node != NULL); + g_return_if_fail(node->type >= 0 && node->type < LAST_NODE_TYPE); + switch(node->type) { + case ARGUMENT_NODE: return (Node *)copy_argument ((Argument *)node); + case CCODE_NODE: return (Node *)copy_ccode ((CCode *)node); + case CHECK_NODE: return (Node *)copy_check ((Check *)node); + case CLASS_NODE: return (Node *)copy_class ((Class *)node); + case FUNCARG_NODE: return (Node *)copy_funcarg ((FuncArg *)node); + case METHOD_NODE: return (Node *)copy_method ((Method *)node); + case TYPE_NODE: return (Node *)copy_type ((Type *)node); + case VARIABLE_NODE: return (Node *)copy_variable ((Variable *)node); + default: return NULL; + } +} + +void free_node(Node *node) +{ + g_return_if_fail(node != NULL); + g_return_if_fail(node->type >= 0 && node->type < LAST_NODE_TYPE); + switch(node->type) { + case ARGUMENT_NODE: free_argument ((Argument *)node); return; + case CCODE_NODE: free_ccode ((CCode *)node); return; + case CHECK_NODE: free_check ((Check *)node); return; + case CLASS_NODE: free_class ((Class *)node); return; + case FUNCARG_NODE: free_funcarg ((FuncArg *)node); return; + case METHOD_NODE: free_method ((Method *)node); return; + case TYPE_NODE: free_type ((Type *)node); return; + case VARIABLE_NODE: free_variable ((Variable *)node); return; + default: return; + } +} + +GList * copy_node_list(GList *nodes) +{ + GList *li; + nodes = g_list_copy(nodes); + for(li = nodes; li != NULL; li = li->next) { + li->data = copy_node(li->data); + } + return nodes; +} + +void free_node_list(GList *nodes) +{ + GList *li; + for(li = nodes; li != NULL; li = li->next) { + free_node(li->data); + } + g_list_free(nodes); +} + diff --git a/src/treefuncs.def b/src/treefuncs.def new file mode 100644 index 0000000..537bf2b --- /dev/null +++ b/src/treefuncs.def @@ -0,0 +1,112 @@ +HEADER +/* for ccode type */ +enum { + A_CCODE, + AT_CCODE, + C_CCODE, + H_CCODE, + HT_CCODE, + PH_CCODE +}; + +/* check type */ +enum { + NULL_CHECK, + TYPE_CHECK, + LT_CHECK, + GT_CHECK, + LE_CHECK, + GE_CHECK, + EQ_CHECK, + NE_CHECK +}; + +/* scope type */ +enum { + NO_SCOPE, + PUBLIC_SCOPE, + PRIVATE_SCOPE, + PROTECTED_SCOPE +}; + +/* method type */ +enum { + REGULAR_METHOD, + INIT_METHOD, + CLASS_INIT_METHOD, + VIRTUAL_METHOD, + SIGNAL_LAST_METHOD, + SIGNAL_FIRST_METHOD, + OVERRIDE_METHOD +}; +ENDHEADER + +CLASS Class + STRING otype # this object class type + STRING ptype # parent class type + NODELIST nodes +ENDCLASS + +CLASS Type + INT stars + STRING name + STRING postfix +ENDCLASS + +CLASS CCode + INT cctype + STRING cbuf + INT line_no +ENDCLASS + +CLASS Check + INT chtype + STRING number +ENDCLASS + +CLASS FuncArg + TYPE atype + STRING name + NODELIST checks +ENDCLASS + +CLASS Argument + STRING gtktype + TYPE atype + STRINGLIST flags + STRING name + STRING get + INT get_line + STRING set + INT set_line + INT line_no +ENDCLASS + +CLASS Method + INT scope # scope type + INT method # method type + TYPE mtype + STRING otype # for override methods + STRINGLIST gtktypes # GTK types for a signal + STRINGLIST flags # GTK_RUN_* flags for a signal + STRING id + NODELIST args + STRING onerror + STRING defreturn + STRING cbuf + INT line_no + INT ccode_line + BOOL vararg +ENDCLASS + +CLASS Variable + INT scope + TYPE vtype + STRING id + INT line_no + STRING destructor + INT destructor_line + BOOL destructor_simple + STRING initializer + INT initializer_line +ENDCLASS diff --git a/src/treefuncs.h b/src/treefuncs.h new file mode 100644 index 0000000..d2e9430 --- /dev/null +++ b/src/treefuncs.h @@ -0,0 +1,201 @@ +/* Generated by generate_treefuncs.pl from treefuncs.def! + * Do not edit by hand! */ + + +#ifndef _TREEFUNCS_H_ + +#define _TREEFUNCS_H_ + +/* for ccode type */ +enum { + A_CCODE, + AT_CCODE, + C_CCODE, + H_CCODE, + HT_CCODE, + PH_CCODE +}; + +/* check type */ +enum { + NULL_CHECK, + TYPE_CHECK, + LT_CHECK, + GT_CHECK, + LE_CHECK, + GE_CHECK, + EQ_CHECK, + NE_CHECK +}; + +/* scope type */ +enum { + NO_SCOPE, + PUBLIC_SCOPE, + PRIVATE_SCOPE, + PROTECTED_SCOPE +}; + +/* method type */ +enum { + REGULAR_METHOD, + INIT_METHOD, + CLASS_INIT_METHOD, + VIRTUAL_METHOD, + SIGNAL_LAST_METHOD, + SIGNAL_FIRST_METHOD, + OVERRIDE_METHOD +}; + + +enum { + CLASS_NODE, + TYPE_NODE, + CCODE_NODE, + CHECK_NODE, + FUNCARG_NODE, + ARGUMENT_NODE, + METHOD_NODE, + VARIABLE_NODE, + LAST_NODE_TYPE +}; + +typedef union _Node Node; +typedef struct _Class Class; +typedef struct _Type Type; +typedef struct _CCode CCode; +typedef struct _Check Check; +typedef struct _FuncArg FuncArg; +typedef struct _Argument Argument; +typedef struct _Method Method; +typedef struct _Variable Variable; + + +struct _Argument { + int type; + char * gtktype; + Type * atype; + GList * flags; + char * name; + char * get; + int get_line; + char * set; + int set_line; + int line_no; +}; + +struct _CCode { + int type; + int cctype; + char * cbuf; + int line_no; +}; + +struct _Check { + int type; + int chtype; + char * number; +}; + +struct _Class { + int type; + char * otype; + char * ptype; + GList * nodes; +}; + +struct _FuncArg { + int type; + Type * atype; + char * name; + GList * checks; +}; + +struct _Method { + int type; + 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; +}; + +struct _Type { + int type; + int stars; + char * name; + char * postfix; +}; + +struct _Variable { + int type; + int scope; + Type * vtype; + char * id; + int line_no; + char * destructor; + int destructor_line; + gboolean destructor_simple; + char * initializer; + int initializer_line; +}; + +union _Node { + int type; + Argument argument; + CCode ccode; + Check check; + Class class; + FuncArg funcarg; + Method method; + Type _type; + Variable variable; +}; + +/* New functions */ +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_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); +Node * new_type (int stars, char * name, 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 */ +Node * copy_node(Node *node); +void free_node(Node *node); + +GList * copy_node_list(GList *nodes); +void free_node_list(GList *nodes); + +/* Copy functions */ +Argument * copy_argument (Argument * self); +CCode * copy_ccode (CCode * self); +Check * copy_check (Check * self); +Class * copy_class (Class * self); +FuncArg * copy_funcarg (FuncArg * self); +Method * copy_method (Method * self); +Type * copy_type (Type * self); +Variable * copy_variable (Variable * self); + +/* Free functions */ +void free_argument (Argument * self); +void free_ccode (CCode * self); +void free_check (Check * self); +void free_class (Class * self); +void free_funcarg (FuncArg * self); +void free_method (Method * self); +void free_type (Type * self); +void free_variable (Variable * self); + +#endif /*_TREEFUNCS_H_*/ diff --git a/src/util.c b/src/util.c index a6cff4e..03f1b71 100644 --- a/src/util.c +++ b/src/util.c @@ -24,7 +24,7 @@ #include #include -#include "tree.h" +#include "treefuncs.h" #include "main.h" #include "util.h" -- 2.43.0