From: George Lebl Date: Mon, 13 Dec 1999 17:48:00 +0000 (-0800) Subject: Release 0.91.0 X-Git-Tag: v0.91.0 X-Git-Url: https://git.draconx.ca/gitweb/gob-dx.git/commitdiff_plain/40647d7b7b7fbeae828e0a032a3c3a5f204cdfa8 Release 0.91.0 --- diff --git a/ChangeLog b/ChangeLog index 70a1891..8fcd24a 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,32 @@ +Sun Dec 12 22:55:12 1999 George Lebl + + * doc/gob.1.in: added paragraph noting that private data members + cannot be accessed above the class definition in the .gob file + +Sun Dec 12 22:08:31 1999 George Lebl + + * src/main.c: implement real private data members as promised in + the documentation, this however breaks some compatiblity with + things that already used the 'private' keyword for data members + + * doc/gob.1.in: document private data member stuff + + * NEWS: update + + * src/main.c: a couple of sanity checks of the code to prevent weird + errors on some broken .gob code + + * configure.in: update version to 0.91.0 + +Sun Dec 05 14:20:26 1999 George Lebl + + * src/{lexer.l,main.c}: if we find the class header #include + statement in a %{ %} section above class definition, don't + include it ourselves. + + * doc/gob.1.in: remove the note about the include always first from + BUGS, and make a new section for the include file. + Thu Nov 25 13:09:08 1999 George Lebl * Release 0.90.5 diff --git a/Makefile.am b/Makefile.am index 997c25a..4a79694 100644 --- a/Makefile.am +++ b/Makefile.am @@ -1,5 +1,5 @@ SUBDIRS = @SUBDIRS@ -DIST_SUBDIRS = src doc +DIST_SUBDIRS = src doc examples EXTRA_DIST = gob.spec.in diff --git a/Makefile.in b/Makefile.in index 8f02198..3ae3ca7 100644 --- a/Makefile.in +++ b/Makefile.in @@ -78,7 +78,7 @@ VERSION = @VERSION@ YACC = @YACC@ SUBDIRS = @SUBDIRS@ -DIST_SUBDIRS = src doc +DIST_SUBDIRS = src doc examples EXTRA_DIST = gob.spec.in ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 diff --git a/NEWS b/NEWS index 3bd328b..7b870b1 100644 --- a/NEWS +++ b/NEWS @@ -1,5 +1,13 @@ +0.91.0 + * WARNING! change the way private data members are done, now you need + to access them through a private structure only available in the + C file, object->member becomes object->_priv->member + * add support for placing the object header anywhere in the C file + * bunch of further sanity checks added + * add some simple examples + 0.90.5 - * added PARENT_HANDLE macro for overrides + * added PARENT_HANDLER macro for overrides * added _TYPE_ macro for _get_type method * warn if signal parameter lists seem mismatched diff --git a/configure b/configure index 84c691a..8d5f67b 100755 --- a/configure +++ b/configure @@ -703,7 +703,7 @@ fi PACKAGE=gob -VERSION=0.90.5 +VERSION=0.91.0 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; } @@ -790,12 +790,12 @@ if test -f ../NOINST_GOB ; then DOINSTGOB= NOINSTGOB=gob echo "$ac_t""*** NOT Going to install GOB ***" 1>&6 - SUBDIRS="src" + SUBDIRS="src examples" else DOINSTGOB=gob NOINSTGOB= - SUBDIRS="src doc" + SUBDIRS="src examples doc" fi @@ -2076,6 +2076,7 @@ gob.spec Makefile src/Makefile doc/Makefile +examples/Makefile doc/gob.1 config.h" | sed "s/:[^ ]*//g"` conftest*; exit 1' 1 2 15 EOF cat >> $CONFIG_STATUS <> $CONFIG_STATUS <<\EOF diff --git a/configure.in b/configure.in index 8200f52..96bfb36 100644 --- a/configure.in +++ b/configure.in @@ -2,18 +2,18 @@ dnl Process this file with autoconf to produce a configure script. AC_PREREQ(2.2) AC_INIT(src/tree.h) AM_CONFIG_HEADER(config.h) -AM_INIT_AUTOMAKE(gob,0.90.5) +AM_INIT_AUTOMAKE(gob,0.91.0) if test -f ../NOINST_GOB ; then DOINSTGOB= NOINSTGOB=gob AC_MSG_RESULT([*** NOT Going to install GOB ***]) - SUBDIRS="src" + SUBDIRS="src examples" AC_SUBST(SUBDIRS) else DOINSTGOB=gob NOINSTGOB= - SUBDIRS="src doc" + SUBDIRS="src examples doc" AC_SUBST(SUBDIRS) fi AC_SUBST(DOINSTGOB) @@ -50,4 +50,5 @@ gob.spec Makefile src/Makefile doc/Makefile +examples/Makefile doc/gob.1]) diff --git a/doc/gob.1.in b/doc/gob.1.in index 4268580..f18490d 100644 --- a/doc/gob.1.in +++ b/doc/gob.1.in @@ -89,6 +89,14 @@ For example: .fi +.SH INCLUDE FILES +.PP +Gob will automatically include the class header file at the top of the .c +source file. If you wish to include it somewhere else, put the include +into some %{ %} section above the class definition, and gob will not include +it automatically. This way you can avoid circular includes and control +where in the file do you want to include the header. + .SH MAKING A NEW CLASS .PP The class header: @@ -121,9 +129,25 @@ identifier allowed per typename unlike in normal C. Example: .fi .PP -The private members are not currently protected from outside use, -they are just marked by a comment in the header file, this will most likely -be somehow solved in some future version. +Public datamembers are accessed normally as members of the object struct. +Example where 'i' is as above a public data member: +.nf + + object->i = 1; + +.fi +.PP +The private data members are defined in a structure which is only available +inside the .c file. You must access them using the structure _priv. Example +where 'h' is the private data member (as in the above example): +.nf + + object->_priv->h = NULL; + +.fi +Note that the _priv structure is only accessible to C code blocks below or +inside the class definition in the .gob file. If you use it above, you will +get a 'dereferencing incomplete pointer type' error from the C compiler. .PP The third type is an argument type. It is a named datamember which is one of the features of the GTK+ object system. You need to define a get @@ -276,6 +300,7 @@ class, you can use the PARENT_HANDLER macro with your arguments. Example: /* some code here */ PARENT_HANDLER(self, wid); } + .fi .PP Calling methods: @@ -306,7 +331,7 @@ this method, you can use the GET_NEW macro that is defined for you and that will fetch a new object, so a fairly standard new method would look like: .nf - public GtkWidget * + public GtkObject * new(void) { GtkObject *ret; ret = GTK_OBJECT (GET_NEW); @@ -328,10 +353,6 @@ compile with a C++ compiler. .SH BUGS .PP -The generated header file is included as the first file in the .c file, no -matter what. This means that you will have to put things that need to be -included before that, into an %h{ } section. -.PP Also the lexer does not actually parse the C code, so I'm sure that some corner cases or maybe even some not so corner cases of C syntax might confuse gob completely. If you find any, send me the source that makes it go gaga and I'll diff --git a/examples/Makefile.am b/examples/Makefile.am new file mode 100644 index 0000000..1cbbd04 --- /dev/null +++ b/examples/Makefile.am @@ -0,0 +1,5 @@ +EXTRA_DIST = \ + README \ + gtk-button-count.gob \ + my-person.gob +SUBDIRS = diff --git a/examples/Makefile.in b/examples/Makefile.in new file mode 100644 index 0000000..dd245f4 --- /dev/null +++ b/examples/Makefile.in @@ -0,0 +1,287 @@ +# Makefile.in generated automatically by automake 1.4 from Makefile.am + +# Copyright (C) 1994, 1995-8, 1999 Free Software Foundation, Inc. +# This Makefile.in is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + + +SHELL = @SHELL@ + +srcdir = @srcdir@ +top_srcdir = @top_srcdir@ +VPATH = @srcdir@ +prefix = @prefix@ +exec_prefix = @exec_prefix@ + +bindir = @bindir@ +sbindir = @sbindir@ +libexecdir = @libexecdir@ +datadir = @datadir@ +sysconfdir = @sysconfdir@ +sharedstatedir = @sharedstatedir@ +localstatedir = @localstatedir@ +libdir = @libdir@ +infodir = @infodir@ +mandir = @mandir@ +includedir = @includedir@ +oldincludedir = /usr/include + +DESTDIR = + +pkgdatadir = $(datadir)/@PACKAGE@ +pkglibdir = $(libdir)/@PACKAGE@ +pkgincludedir = $(includedir)/@PACKAGE@ + +top_builddir = .. + +ACLOCAL = @ACLOCAL@ +AUTOCONF = @AUTOCONF@ +AUTOMAKE = @AUTOMAKE@ +AUTOHEADER = @AUTOHEADER@ + +INSTALL = @INSTALL@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ $(AM_INSTALL_PROGRAM_FLAGS) +INSTALL_DATA = @INSTALL_DATA@ +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +transform = @program_transform_name@ + +NORMAL_INSTALL = : +PRE_INSTALL = : +POST_INSTALL = : +NORMAL_UNINSTALL = : +PRE_UNINSTALL = : +POST_UNINSTALL = : +CC = @CC@ +CFLAGS = @CFLAGS@ +CPP = @CPP@ +CPPFLAGS = @CPPFLAGS@ +DOINSTGOB = @DOINSTGOB@ +GLIB_CFLAGS = @GLIB_CFLAGS@ +GLIB_CONFIG = @GLIB_CONFIG@ +GLIB_LIBS = @GLIB_LIBS@ +LDFLAGS = @LDFLAGS@ +LEX = @LEX@ +MAINT = @MAINT@ +MAKEINFO = @MAKEINFO@ +MV = @MV@ +NOINSTGOB = @NOINSTGOB@ +PACKAGE = @PACKAGE@ +RM = @RM@ +TAR = @TAR@ +VERSION = @VERSION@ +YACC = @YACC@ + +EXTRA_DIST = README gtk-button-count.gob my-person.gob + +SUBDIRS = +mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs +CONFIG_HEADER = ../config.h +CONFIG_CLEAN_FILES = +DIST_COMMON = README Makefile.am Makefile.in + + +DISTFILES = $(DIST_COMMON) $(SOURCES) $(HEADERS) $(TEXINFOS) $(EXTRA_DIST) + +GZIP_ENV = --best +all: all-redirect +.SUFFIXES: +$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4) + cd $(top_srcdir) && $(AUTOMAKE) --gnu --include-deps examples/Makefile + +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + cd $(top_builddir) \ + && CONFIG_FILES=$(subdir)/$@ CONFIG_HEADERS= $(SHELL) ./config.status + + +# This directory's subdirectories are mostly independent; you can cd +# into them and run `make' without going through this Makefile. +# To change the values of `make' variables: instead of editing Makefiles, +# (1) if the variable is set in `config.status', edit `config.status' +# (which will cause the Makefiles to be regenerated when you run `make'); +# (2) otherwise, pass the desired values on the `make' command line. + +@SET_MAKE@ + +all-recursive install-data-recursive install-exec-recursive \ +installdirs-recursive install-recursive uninstall-recursive \ +check-recursive installcheck-recursive info-recursive dvi-recursive: + @set fnord $(MAKEFLAGS); amf=$$2; \ + dot_seen=no; \ + target=`echo $@ | sed s/-recursive//`; \ + list='$(SUBDIRS)'; for subdir in $$list; do \ + echo "Making $$target in $$subdir"; \ + if test "$$subdir" = "."; then \ + dot_seen=yes; \ + local_target="$$target-am"; \ + else \ + local_target="$$target"; \ + fi; \ + (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ + || case "$$amf" in *=*) exit 1;; *k*) fail=yes;; *) exit 1;; esac; \ + done; \ + if test "$$dot_seen" = "no"; then \ + $(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \ + fi; test -z "$$fail" + +mostlyclean-recursive clean-recursive distclean-recursive \ +maintainer-clean-recursive: + @set fnord $(MAKEFLAGS); amf=$$2; \ + dot_seen=no; \ + rev=''; list='$(SUBDIRS)'; for subdir in $$list; do \ + rev="$$subdir $$rev"; \ + test "$$subdir" = "." && dot_seen=yes; \ + done; \ + test "$$dot_seen" = "no" && rev=". $$rev"; \ + target=`echo $@ | sed s/-recursive//`; \ + for subdir in $$rev; do \ + echo "Making $$target in $$subdir"; \ + if test "$$subdir" = "."; then \ + local_target="$$target-am"; \ + else \ + local_target="$$target"; \ + fi; \ + (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ + || case "$$amf" in *=*) exit 1;; *k*) fail=yes;; *) exit 1;; esac; \ + done && test -z "$$fail" +tags-recursive: + list='$(SUBDIRS)'; for subdir in $$list; do \ + test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) tags); \ + done + +tags: TAGS + +ID: $(HEADERS) $(SOURCES) $(LISP) + list='$(SOURCES) $(HEADERS)'; \ + unique=`for i in $$list; do echo $$i; done | \ + awk ' { files[$$0] = 1; } \ + END { for (i in files) print i; }'`; \ + here=`pwd` && cd $(srcdir) \ + && mkid -f$$here/ID $$unique $(LISP) + +TAGS: tags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) $(LISP) + tags=; \ + here=`pwd`; \ + list='$(SUBDIRS)'; for subdir in $$list; do \ + if test "$$subdir" = .; then :; else \ + test -f $$subdir/TAGS && tags="$$tags -i $$here/$$subdir/TAGS"; \ + fi; \ + done; \ + list='$(SOURCES) $(HEADERS)'; \ + unique=`for i in $$list; do echo $$i; done | \ + awk ' { files[$$0] = 1; } \ + END { for (i in files) print i; }'`; \ + test -z "$(ETAGS_ARGS)$$unique$(LISP)$$tags" \ + || (cd $(srcdir) && etags $(ETAGS_ARGS) $$tags $$unique $(LISP) -o $$here/TAGS) + +mostlyclean-tags: + +clean-tags: + +distclean-tags: + -rm -f TAGS ID + +maintainer-clean-tags: + +distdir = $(top_builddir)/$(PACKAGE)-$(VERSION)/$(subdir) + +subdir = examples + +distdir: $(DISTFILES) + @for file in $(DISTFILES); do \ + d=$(srcdir); \ + if test -d $$d/$$file; then \ + cp -pr $$/$$file $(distdir)/$$file; \ + else \ + test -f $(distdir)/$$file \ + || ln $$d/$$file $(distdir)/$$file 2> /dev/null \ + || cp -p $$d/$$file $(distdir)/$$file || :; \ + fi; \ + done + for subdir in $(SUBDIRS); do \ + if test "$$subdir" = .; then :; else \ + test -d $(distdir)/$$subdir \ + || mkdir $(distdir)/$$subdir \ + || exit 1; \ + chmod 777 $(distdir)/$$subdir; \ + (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) top_distdir=../$(top_distdir) distdir=../$(distdir)/$$subdir distdir) \ + || exit 1; \ + fi; \ + done +info-am: +info: info-recursive +dvi-am: +dvi: dvi-recursive +check-am: all-am +check: check-recursive +installcheck-am: +installcheck: installcheck-recursive +install-exec-am: +install-exec: install-exec-recursive + +install-data-am: +install-data: install-data-recursive + +install-am: all-am + @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am +install: install-recursive +uninstall-am: +uninstall: uninstall-recursive +all-am: Makefile +all-redirect: all-recursive +install-strip: + $(MAKE) $(AM_MAKEFLAGS) AM_INSTALL_PROGRAM_FLAGS=-s install +installdirs: installdirs-recursive +installdirs-am: + + +mostlyclean-generic: + +clean-generic: + +distclean-generic: + -rm -f Makefile $(CONFIG_CLEAN_FILES) + -rm -f config.cache config.log stamp-h stamp-h[0-9]* + +maintainer-clean-generic: +mostlyclean-am: mostlyclean-tags mostlyclean-generic + +mostlyclean: mostlyclean-recursive + +clean-am: clean-tags clean-generic mostlyclean-am + +clean: clean-recursive + +distclean-am: distclean-tags distclean-generic clean-am + +distclean: distclean-recursive + +maintainer-clean-am: maintainer-clean-tags maintainer-clean-generic \ + distclean-am + @echo "This command is intended for maintainers to use;" + @echo "it deletes files that may require special tools to rebuild." + +maintainer-clean: maintainer-clean-recursive + +.PHONY: install-data-recursive uninstall-data-recursive \ +install-exec-recursive uninstall-exec-recursive installdirs-recursive \ +uninstalldirs-recursive all-recursive check-recursive \ +installcheck-recursive info-recursive dvi-recursive \ +mostlyclean-recursive distclean-recursive clean-recursive \ +maintainer-clean-recursive tags tags-recursive mostlyclean-tags \ +distclean-tags clean-tags maintainer-clean-tags distdir info-am info \ +dvi-am dvi check check-am installcheck-am installcheck install-exec-am \ +install-exec install-data-am install-data install-am install \ +uninstall-am uninstall all-redirect all-am all installdirs-am \ +installdirs mostlyclean-generic distclean-generic clean-generic \ +maintainer-clean-generic clean mostlyclean distclean maintainer-clean + + +# Tell versions [3.59,3.63) of GNU make to not export all variables. +# Otherwise a system limit (for SysV at least) may be exceeded. +.NOEXPORT: diff --git a/examples/README b/examples/README new file mode 100644 index 0000000..bcaf20c --- /dev/null +++ b/examples/README @@ -0,0 +1,12 @@ +These are some example .gob files + +gtk-button-count.gob An example showing how simple it is to derive + objects and override methods, this one implements + a "click counting" on a GtkButton. It defines + an argument for getting and setting the count + and it overrides the "clicked" default handler + to count clicks + +my-person.gob A simple file which can store some identity + information about a person, it shows arguments, + signals and others. diff --git a/examples/gtk-button-count.gob b/examples/gtk-button-count.gob new file mode 100644 index 0000000..0d039dc --- /dev/null +++ b/examples/gtk-button-count.gob @@ -0,0 +1,41 @@ +class Gtk:Button:Count from Gtk:Button { + public int count; + + argument INT count + get { + ARG = self->count; + } + set { + self->count = ARG; + }; + + init(button) + { + button->count = 0; + } + + public + GtkWidget * + new(void) + { + return GTK_WIDGET(GET_NEW); + } + + /* new button but with a label inside it already, the 'label' + argument must not be NULL or we will return NULL */ + public + GtkWidget * + new_with_label(char *label (check null)) onerror NULL + { + return GTK_WIDGET(GET_NEW); + } + + override (Gtk:Button) + void + clicked(Gtk:Button *self (check null type)) + { + GtkButtonCount *bc = GTK_BUTTON_COUNT(self); + bc->count++; + PARENT_HANDLER(self); + } +} diff --git a/examples/my-person.gob b/examples/my-person.gob new file mode 100644 index 0000000..516ee3e --- /dev/null +++ b/examples/my-person.gob @@ -0,0 +1,82 @@ +%{ +#include +#include "my-person.h" +%} + +class My:Person from Gtk:Object { + public char *name; + public long dob; /* date of birth as a time_t */ + public long dod; /* date of death as a time_t */ + + private int rounds_in_shotgun; /* number of rounds in our shotgun */ + + argument POINTER name + get { + if(self->name) + ARG = g_strdup(self->name); + else + ARG = NULL; + } + set { + g_free(self->name); + if(ARG) + self->name = g_strdup(ARG); + else + self->name = NULL; + }; + + argument LONG dob get { ARG = self->dob; } set { self->dob = ARG; }; + argument LONG dod get { ARG = self->dod; } set { self->dod = ARG; }; + + init(person) + { + person->name = g_strdup("Nobody"); + person->dob = 0; + person->dod = 0; + + /* initially we have no rounds in the shotgun */ + person->_priv->rounds_in_shotgun = 0; + } + + /* when the person gets born, sends out a signal, the caller + of the signal should provide the date of birth */ + signal last NONE (LONG) + void + birth(self, long dob) + { + self->dob = dob; + } + + /* when the person dies, sends out a signal, the caller + of the signal should provide the date of death */ + signal last NONE (LONG) + void + death(self, long dod) + { + self->dod = dod; + } + + public + void + load_shotgun(self) + { + /* add a round to our shotgun */ + self->_priv->rounds_in_shotgun++; + } + + public + void + shoot_oneself_in_the_head(self) + { + if(self->_priv->rounds_in_shotgun==0) { + g_warning("No rounds in the shotgun!"); + return; + } + + /* one round was fired */ + self->_priv->rounds_in_shotgun--; + + /* death is imminent if we shoot oneself in the head */ + death(self,(long)time(NULL)); + } +} diff --git a/gob.spec b/gob.spec index 32372a2..ad65ed9 100644 --- a/gob.spec +++ b/gob.spec @@ -1,4 +1,4 @@ -%define ver 0.90.5 +%define ver 0.91.0 %define rel 1 %define prefix /usr diff --git a/src/lexer.c b/src/lexer.c index 770320c..5dadf6f 100644 --- a/src/lexer.c +++ b/src/lexer.c @@ -284,78 +284,80 @@ static void yy_fatal_error YY_PROTO(( yyconst char msg[] )); *yy_cp = '\0'; \ yy_c_buf_p = yy_cp; -#define YY_NUM_RULES 66 -#define YY_END_OF_BUFFER 67 -static yyconst short int yy_acclist[336] = +#define YY_NUM_RULES 67 +#define YY_END_OF_BUFFER 68 +static yyconst short int yy_acclist[340] = { 0, - 67, 64, 66, 63, 64, 66, 1, 65, 66, 64, - 65, 66, 64, 66, 64, 66, 64, 66, 64, 66, - 12, 64, 66, 1, 13, 65, 66, 12, 64, 65, - 66, 12, 64, 66, 12, 64, 66, 31, 64, 66, - 1, 32, 65, 66, 31, 64, 65, 66, 24, 31, - 64, 66, 31, 64, 66, 31, 64, 66, 31, 64, - 66, 31, 64, 66, 29, 31, 64, 66, 30, 31, - 64, 66, 31, 64, 66, 27, 64, 66, 1, 28, - 65, 66, 27, 64, 65, 66, 26, 27, 64, 66, - 27, 64, 66, 27, 64, 66, 64, 66, 64, 66, - - 59, 64, 66, 59, 64, 66, 59, 64, 66, 59, - 64, 66, 59, 64, 66, 60, 64, 66, 64, 66, - 64, 66, 57, 64, 66, 57, 64, 66, 59, 64, - 66, 59, 64, 66, 59, 64, 66, 59, 64, 66, - 59, 64, 66, 59, 64, 66, 59, 64, 66, 59, - 64, 66, 59, 64, 66, 59, 64, 66, 59, 64, - 66, 59, 64, 66, 61, 64, 66, 62, 64, 66, - 7, 15, 11, 8, 23, 16, 25, 9, 59, 58, - 59, 59, 59, 59, 57, 10, 57, 57, 59, 59, - 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, - - 59, 59, 59, 59, 59, 59, 3, 14, 21, 17, - 19, 4, 5, 58, 59, 59, 59, 59, 49, 57, - 6, 57, 57, 59, 59, 59, 59, 59, 59, 44, - 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, - 59, 59, 59, 22, 18, 20, 59, 59, 35, 59, - 34, 59, 59, 47, 59, 59, 59, 39, 59, 59, - 42, 59, 59, 59, 59, 59, 59, 59, 59, 59, - 59, 59, 36, 59, 33, 59, 59, 48, 59, 59, - 45, 59, 59, 59, 59, 59, 43, 59, 59, 59, - 59, 38, 59, 59, 59, 59, 59, 46, 59, 59, - - 59, 59, 50, 59, 54, 59, 40, 59, 37, 59, - 59, 59, 59, 59, 56, 59, 59, 51, 59, 59, - 53, 59, 59, 52, 59, 55, 59, 41, 59, 59, - 59, 59, 2, 2, 59 + 68, 65, 67, 64, 65, 67, 1, 66, 67, 65, + 66, 67, 65, 67, 65, 67, 65, 67, 65, 67, + 13, 65, 67, 1, 14, 66, 67, 13, 65, 66, + 67, 13, 65, 67, 13, 65, 67, 32, 65, 67, + 1, 33, 66, 67, 32, 65, 66, 67, 25, 32, + 65, 67, 32, 65, 67, 32, 65, 67, 32, 65, + 67, 32, 65, 67, 30, 32, 65, 67, 31, 32, + 65, 67, 32, 65, 67, 32, 65, 67, 28, 65, + 67, 1, 29, 66, 67, 28, 65, 66, 67, 27, + 28, 65, 67, 28, 65, 67, 28, 65, 67, 65, + + 67, 65, 67, 60, 65, 67, 60, 65, 67, 60, + 65, 67, 60, 65, 67, 60, 65, 67, 61, 65, + 67, 65, 67, 65, 67, 58, 65, 67, 58, 65, + 67, 60, 65, 67, 60, 65, 67, 60, 65, 67, + 60, 65, 67, 60, 65, 67, 60, 65, 67, 60, + 65, 67, 60, 65, 67, 60, 65, 67, 60, 65, + 67, 60, 65, 67, 60, 65, 67, 62, 65, 67, + 63, 65, 67, 8, 16, 12, 9, 24, 17, 26, + 10, 60, 59, 60, 60, 60, 60, 58, 11, 58, + 58, 60, 60, 60, 60, 60, 60, 60, 60, 60, + + 60, 60, 60, 60, 60, 60, 60, 60, 60, 3, + 15, 22, 18, 20, 5, 6, 59, 60, 60, 60, + 60, 50, 58, 7, 58, 58, 60, 60, 60, 60, + 60, 60, 45, 60, 60, 60, 60, 60, 60, 60, + 60, 60, 60, 60, 60, 60, 23, 19, 21, 60, + 60, 36, 60, 35, 60, 60, 48, 60, 60, 60, + 40, 60, 60, 43, 60, 60, 60, 60, 60, 60, + 60, 60, 60, 60, 60, 37, 60, 34, 60, 60, + 49, 60, 60, 46, 60, 60, 60, 60, 60, 44, + 60, 60, 60, 60, 39, 60, 60, 60, 60, 60, + + 47, 60, 60, 60, 60, 51, 60, 55, 60, 41, + 60, 38, 60, 60, 60, 60, 60, 57, 60, 60, + 52, 60, 60, 54, 60, 60, 53, 60, 56, 60, + 42, 60, 60, 60, 4, 60, 2, 2, 60 } ; -static yyconst short int yy_accept[249] = +static yyconst short int yy_accept[262] = { 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 4, 7, 10, 13, 15, 17, 19, 21, 24, 28, 32, 35, 38, 41, 45, 49, - 53, 56, 59, 62, 65, 69, 73, 76, 79, 83, - 87, 91, 94, 97, 99, 101, 104, 107, 110, 113, - 116, 119, 121, 123, 126, 129, 132, 135, 138, 141, + 53, 56, 59, 62, 65, 69, 73, 76, 79, 82, + 86, 90, 94, 97, 100, 102, 104, 107, 110, 113, + 116, 119, 122, 124, 126, 129, 132, 135, 138, 141, 144, 147, 150, 153, 156, 159, 162, 165, 168, 171, - 172, 172, 172, 172, 172, 173, 174, 174, 174, 174, - 174, 175, 175, 176, 177, 178, 179, 179, 179, 180, - 181, 182, 183, 184, 185, 185, 186, 187, 187, 187, + 174, 175, 175, 175, 175, 175, 176, 177, 177, 177, + 177, 177, 178, 178, 179, 179, 179, 180, 181, 182, + 182, 182, 183, 184, 185, 186, 187, 188, 188, 189, - 188, 188, 188, 189, 190, 191, 192, 193, 194, 195, + 190, 190, 190, 191, 191, 191, 192, 193, 194, 195, 196, 197, 198, 199, 200, 201, 202, 203, 204, 205, - 206, 207, 207, 208, 208, 208, 209, 210, 210, 210, - 210, 211, 212, 212, 213, 213, 214, 214, 215, 216, - 217, 218, 219, 220, 221, 221, 222, 223, 224, 225, - 226, 227, 228, 229, 230, 232, 233, 234, 235, 236, - 237, 238, 239, 240, 241, 242, 243, 244, 244, 244, - 245, 246, 247, 248, 249, 251, 253, 254, 256, 257, - 258, 260, 261, 263, 264, 265, 266, 267, 268, 269, - 270, 271, 272, 273, 275, 275, 276, 277, 278, 280, - - 281, 283, 284, 285, 286, 287, 289, 290, 291, 292, - 294, 295, 296, 296, 297, 298, 300, 301, 302, 303, - 305, 307, 309, 311, 312, 313, 313, 314, 315, 317, - 318, 320, 321, 323, 323, 324, 326, 328, 330, 330, - 331, 331, 332, 332, 333, 334, 336, 336 + 206, 207, 208, 209, 210, 210, 211, 211, 211, 212, + 213, 213, 213, 213, 214, 215, 215, 216, 216, 216, + 217, 217, 218, 219, 220, 221, 222, 223, 224, 224, + 225, 226, 227, 228, 229, 230, 231, 232, 233, 235, + 236, 237, 238, 239, 240, 241, 242, 243, 244, 245, + 246, 247, 247, 247, 248, 249, 250, 250, 251, 252, + 254, 256, 257, 259, 260, 261, 263, 264, 266, 267, + 268, 269, 270, 271, 272, 273, 274, 275, 276, 278, + + 278, 279, 279, 280, 281, 283, 284, 286, 287, 288, + 289, 290, 292, 293, 294, 295, 297, 298, 299, 299, + 299, 300, 301, 303, 304, 305, 306, 308, 310, 312, + 314, 315, 316, 316, 316, 317, 318, 320, 321, 323, + 324, 326, 326, 326, 327, 329, 331, 333, 333, 333, + 334, 334, 334, 335, 335, 335, 336, 337, 338, 340, + 340 } ; static yyconst int yy_ec[256] = @@ -363,17 +365,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, 2, 1, 5, 1, 1, 6, 1, 7, 1, - 1, 8, 1, 1, 1, 9, 10, 11, 12, 12, - 12, 12, 12, 12, 12, 13, 13, 14, 1, 1, - 1, 1, 1, 1, 15, 15, 16, 15, 17, 18, - 19, 20, 19, 19, 21, 19, 22, 19, 23, 19, - 19, 24, 19, 25, 26, 19, 19, 19, 19, 19, - 1, 27, 1, 1, 19, 1, 28, 29, 30, 31, - - 32, 33, 34, 35, 36, 19, 19, 37, 38, 39, - 40, 41, 19, 42, 43, 44, 45, 46, 19, 47, - 19, 19, 48, 1, 49, 1, 1, 1, 1, 1, + 1, 2, 1, 5, 6, 1, 7, 1, 8, 1, + 1, 9, 1, 1, 1, 10, 11, 12, 13, 13, + 13, 13, 13, 13, 13, 14, 14, 15, 1, 16, + 1, 17, 1, 1, 18, 18, 19, 18, 20, 21, + 22, 23, 22, 22, 24, 22, 25, 22, 26, 22, + 22, 27, 22, 28, 29, 22, 22, 22, 22, 22, + 1, 30, 1, 1, 22, 1, 31, 32, 33, 34, + + 35, 36, 37, 38, 39, 22, 22, 40, 41, 42, + 43, 44, 22, 45, 46, 47, 48, 49, 22, 50, + 22, 22, 51, 1, 52, 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, @@ -390,213 +392,224 @@ static yyconst int yy_ec[256] = 1, 1, 1, 1, 1 } ; -static yyconst int yy_meta[50] = +static yyconst int yy_meta[53] = { 0, 1, 1, 2, 1, 1, 1, 1, 1, 1, 1, - 3, 3, 3, 4, 5, 5, 5, 5, 6, 6, - 6, 6, 6, 6, 6, 6, 1, 5, 5, 5, - 5, 5, 5, 6, 6, 6, 6, 6, 6, 6, - 6, 6, 6, 6, 6, 6, 6, 1, 1 + 1, 3, 3, 3, 4, 1, 1, 5, 5, 5, + 5, 6, 6, 6, 6, 6, 6, 6, 6, 1, + 5, 5, 5, 5, 5, 5, 6, 6, 6, 6, + 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, + 1, 1 } ; -static yyconst short int yy_base[263] = +static yyconst short int yy_base[277] = { 0, - 0, 3, 12, 15, 35, 82, 24, 44, 131, 0, - 172, 0, 530, 531, 531, 531, 531, 4, 506, 491, - 6, 531, 531, 531, 517, 503, 531, 531, 531, 531, - 16, 16, 502, 0, 531, 531, 475, 531, 531, 531, - 531, 500, 0, 42, 0, 508, 21, 18, 17, 39, - 531, 64, 48, 69, 82, 54, 65, 58, 22, 53, - 83, 85, 177, 180, 175, 87, 192, 531, 531, 531, - 518, 495, 491, 470, 531, 531, 510, 58, 509, 508, - 531, 511, 531, 531, 531, 531, 510, 498, 497, 496, - 89, 96, 174, 193, 500, 100, 531, 505, 106, 184, - - 222, 0, 227, 94, 101, 185, 212, 213, 216, 223, - 227, 228, 229, 232, 172, 230, 231, 233, 235, 234, - 236, 504, 531, 486, 462, 531, 531, 497, 496, 495, - 531, 531, 498, 531, 497, 531, 485, 484, 107, 237, - 239, 238, 531, 251, 494, 531, 271, 0, 240, 245, - 255, 259, 241, 272, 482, 260, 275, 276, 277, 278, - 279, 281, 282, 285, 283, 287, 291, 478, 451, 531, - 531, 531, 106, 289, 479, 478, 288, 477, 290, 292, - 476, 293, 475, 294, 296, 300, 297, 295, 316, 310, - 302, 321, 298, 474, 463, 531, 46, 328, 472, 331, - - 471, 332, 333, 335, 336, 470, 337, 339, 338, 469, - 342, 340, 464, 343, 344, 467, 345, 353, 348, 465, - 421, 415, 388, 357, 351, 375, 350, 359, 386, 361, - 385, 363, 384, 381, 176, 377, 376, 299, 177, 364, - 170, 378, 45, 372, 531, 3, 531, 403, 409, 415, - 421, 427, 433, 435, 439, 445, 451, 457, 461, 465, - 471, 475 + 0, 3, 9, 12, 35, 85, 19, 26, 137, 0, + 180, 0, 556, 557, 557, 557, 557, 8, 529, 514, + 3, 557, 557, 557, 542, 526, 557, 557, 557, 557, + 15, 39, 525, 0, 557, 557, 24, 498, 557, 557, + 557, 557, 523, 0, 44, 0, 533, 32, 12, 17, + 42, 557, 58, 50, 63, 69, 49, 59, 63, 27, + 69, 70, 80, 83, 85, 88, 86, 182, 557, 557, + 557, 544, 518, 514, 493, 557, 557, 535, 190, 534, + 533, 557, 537, 557, 194, 497, 557, 557, 557, 535, + 522, 521, 520, 89, 90, 184, 92, 524, 106, 557, + + 530, 188, 193, 224, 0, 233, 193, 93, 197, 202, + 203, 220, 207, 225, 99, 229, 233, 234, 237, 238, + 240, 242, 241, 243, 529, 557, 508, 484, 557, 557, + 521, 520, 519, 557, 557, 523, 557, 492, 521, 557, + 508, 507, 245, 244, 246, 247, 557, 257, 518, 557, + 264, 0, 250, 258, 259, 264, 268, 269, 505, 274, + 276, 277, 279, 280, 282, 284, 286, 287, 292, 289, + 291, 499, 472, 557, 557, 557, 477, 96, 293, 501, + 500, 297, 499, 295, 300, 498, 298, 497, 299, 301, + 302, 304, 303, 317, 308, 309, 320, 314, 496, 483, + + 557, 461, 183, 332, 493, 334, 492, 322, 338, 339, + 340, 491, 341, 344, 343, 490, 345, 348, 483, 469, + 349, 346, 487, 351, 357, 359, 486, 481, 478, 434, + 360, 353, 414, 380, 356, 361, 399, 365, 398, 367, + 397, 391, 407, 383, 392, 374, 369, 359, 387, 382, + 109, 394, 189, 95, 399, 557, 390, 557, 20, 557, + 417, 423, 429, 435, 441, 447, 449, 453, 459, 465, + 471, 475, 479, 485, 489, 494 } ; -static yyconst short int yy_def[263] = +static yyconst short int yy_def[277] = { 0, - 248, 248, 249, 249, 250, 250, 251, 251, 247, 9, - 9, 11, 247, 247, 247, 247, 247, 247, 247, 247, - 247, 247, 247, 247, 247, 247, 247, 247, 247, 247, - 247, 247, 247, 252, 247, 247, 247, 247, 247, 247, - 247, 247, 253, 247, 254, 255, 255, 255, 255, 255, - 247, 247, 247, 247, 247, 255, 255, 255, 255, 255, - 255, 255, 255, 255, 255, 255, 255, 247, 247, 247, - 256, 247, 247, 247, 247, 247, 247, 247, 247, 247, - 247, 257, 247, 247, 247, 247, 258, 259, 255, 260, - 255, 255, 255, 255, 247, 247, 247, 261, 247, 247, - - 247, 262, 247, 255, 255, 255, 255, 255, 255, 255, - 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, - 255, 256, 247, 247, 247, 247, 247, 247, 247, 247, - 247, 247, 257, 247, 258, 247, 259, 260, 255, 255, - 255, 255, 247, 247, 261, 247, 247, 262, 255, 255, - 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, - 255, 255, 255, 255, 255, 255, 255, 247, 247, 247, - 247, 247, 255, 255, 255, 255, 255, 255, 255, 255, - 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, - 255, 255, 255, 255, 247, 247, 255, 255, 255, 255, - - 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, - 255, 255, 247, 255, 255, 255, 255, 255, 255, 255, - 255, 255, 255, 255, 255, 247, 255, 255, 255, 255, - 255, 255, 255, 247, 255, 255, 255, 255, 247, 255, - 247, 255, 247, 255, 247, 255, 0, 247, 247, 247, - 247, 247, 247, 247, 247, 247, 247, 247, 247, 247, - 247, 247 + 261, 261, 262, 262, 263, 263, 264, 264, 260, 9, + 9, 11, 260, 260, 260, 260, 260, 260, 260, 260, + 260, 260, 260, 260, 260, 260, 260, 260, 260, 260, + 260, 260, 260, 265, 260, 260, 260, 260, 260, 260, + 260, 260, 260, 266, 260, 267, 268, 268, 268, 268, + 268, 260, 260, 260, 260, 260, 268, 268, 268, 268, + 268, 268, 268, 268, 268, 268, 268, 268, 260, 260, + 260, 269, 260, 260, 260, 260, 260, 260, 260, 260, + 260, 260, 270, 260, 260, 260, 260, 260, 260, 271, + 272, 268, 273, 268, 268, 268, 268, 260, 260, 260, + + 274, 260, 260, 260, 275, 260, 268, 268, 268, 268, + 268, 268, 268, 268, 268, 268, 268, 268, 268, 268, + 268, 268, 268, 268, 269, 260, 260, 260, 260, 260, + 260, 260, 260, 260, 260, 270, 260, 260, 271, 260, + 272, 273, 268, 268, 268, 268, 260, 260, 274, 260, + 260, 275, 268, 268, 268, 268, 268, 268, 268, 268, + 268, 268, 268, 268, 268, 268, 268, 268, 268, 268, + 268, 260, 260, 260, 260, 260, 260, 268, 268, 268, + 268, 268, 268, 268, 268, 268, 268, 268, 268, 268, + 268, 268, 268, 268, 268, 268, 268, 268, 268, 260, + + 260, 260, 268, 268, 268, 268, 268, 268, 268, 268, + 268, 268, 268, 268, 268, 268, 268, 268, 260, 260, + 268, 268, 268, 268, 268, 268, 268, 268, 268, 268, + 268, 268, 260, 260, 268, 268, 268, 268, 268, 268, + 268, 260, 260, 268, 268, 268, 268, 260, 260, 268, + 260, 276, 268, 260, 276, 260, 268, 260, 268, 0, + 260, 260, 260, 260, 260, 260, 260, 260, 260, 260, + 260, 260, 260, 260, 260, 260 } ; -static yyconst short int yy_nxt[581] = +static yyconst short int yy_nxt[610] = { 0, - 247, 15, 16, 17, 15, 16, 17, 247, 21, 18, - 247, 70, 18, 71, 23, 24, 90, 23, 24, 25, - 77, 19, 25, 81, 19, 82, 39, 40, 41, 20, - 90, 90, 20, 26, 90, 90, 26, 28, 29, 30, - 74, 31, 78, 91, 32, 42, 39, 40, 41, 86, - 43, 87, 90, 75, 92, 97, 33, 98, 93, 90, - 108, 34, 128, 79, 80, 42, 90, 90, 245, 214, - 43, 90, 95, 94, 96, 96, 96, 99, 90, 100, - 100, 101, 35, 36, 28, 29, 30, 37, 31, 109, - 99, 32, 103, 103, 103, 104, 90, 107, 90, 105, - - 90, 92, 90, 33, 106, 129, 130, 90, 34, 90, - 144, 144, 144, 139, 90, 102, 147, 147, 147, 90, - 90, 110, 197, 140, 111, 119, 173, 149, 150, 35, - 36, 14, 15, 16, 17, 14, 14, 14, 14, 14, - 44, 14, 14, 14, 45, 46, 46, 46, 46, 46, - 46, 46, 47, 46, 46, 46, 46, 14, 46, 46, - 48, 46, 46, 49, 46, 46, 46, 46, 46, 46, - 46, 46, 46, 46, 50, 46, 46, 46, 51, 14, - 52, 53, 54, 55, 55, 90, 243, 90, 90, 90, - 90, 240, 99, 90, 100, 100, 101, 241, 90, 56, - - 160, 57, 58, 59, 60, 90, 90, 61, 62, 116, - 117, 63, 64, 141, 65, 112, 66, 67, 118, 68, - 69, 114, 113, 151, 115, 90, 90, 120, 142, 90, - 99, 121, 101, 101, 101, 99, 90, 103, 103, 103, - 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, - 90, 90, 90, 90, 90, 154, 152, 153, 90, 157, - 158, 144, 144, 144, 162, 156, 155, 159, 90, 161, - 164, 167, 90, 90, 163, 166, 175, 165, 181, 174, - 176, 147, 147, 147, 177, 90, 178, 180, 90, 90, - 90, 90, 90, 183, 90, 90, 90, 179, 90, 182, - - 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, - 90, 90, 90, 90, 187, 90, 184, 185, 192, 189, - 188, 194, 186, 90, 191, 198, 190, 204, 200, 90, - 193, 176, 205, 199, 90, 202, 201, 203, 206, 209, - 210, 90, 212, 207, 90, 90, 90, 208, 90, 90, - 90, 90, 90, 90, 211, 90, 90, 90, 90, 215, - 227, 90, 216, 90, 90, 220, 90, 225, 218, 222, - 90, 217, 90, 221, 90, 235, 90, 90, 219, 231, - 224, 223, 228, 230, 242, 90, 229, 233, 232, 90, - 90, 90, 237, 238, 244, 246, 239, 90, 90, 90, - - 234, 90, 236, 14, 14, 14, 14, 14, 14, 22, - 22, 22, 22, 22, 22, 27, 27, 27, 27, 27, - 27, 38, 38, 38, 38, 38, 38, 83, 90, 83, - 83, 83, 83, 85, 90, 85, 85, 85, 85, 88, - 88, 89, 89, 89, 89, 122, 122, 122, 122, 122, - 122, 133, 133, 133, 133, 133, 133, 135, 135, 135, - 135, 135, 135, 137, 137, 137, 137, 138, 138, 138, - 138, 145, 145, 145, 145, 145, 145, 148, 90, 148, - 90, 226, 90, 90, 90, 90, 213, 90, 90, 90, - 90, 90, 90, 196, 195, 90, 146, 90, 90, 136, - - 134, 172, 171, 170, 169, 168, 123, 146, 143, 90, - 90, 90, 136, 134, 132, 131, 127, 126, 125, 124, - 123, 90, 72, 84, 72, 72, 76, 73, 72, 247, - 13, 247, 247, 247, 247, 247, 247, 247, 247, 247, - 247, 247, 247, 247, 247, 247, 247, 247, 247, 247, - 247, 247, 247, 247, 247, 247, 247, 247, 247, 247, - 247, 247, 247, 247, 247, 247, 247, 247, 247, 247, - 247, 247, 247, 247, 247, 247, 247, 247, 247, 247 + 260, 15, 16, 17, 15, 16, 17, 260, 260, 21, + 18, 23, 24, 18, 23, 24, 71, 25, 72, 78, + 25, 40, 41, 42, 19, 85, 93, 19, 40, 41, + 42, 93, 20, 26, 93, 20, 26, 28, 29, 30, + 75, 93, 31, 43, 79, 32, 93, 82, 44, 83, + 43, 95, 89, 76, 90, 44, 93, 94, 100, 33, + 101, 96, 86, 93, 34, 80, 81, 98, 111, 99, + 99, 99, 102, 93, 103, 103, 104, 93, 102, 97, + 106, 106, 106, 93, 93, 35, 36, 28, 29, 30, + 37, 38, 31, 107, 93, 32, 108, 93, 95, 93, + + 93, 109, 93, 93, 93, 110, 93, 93, 112, 33, + 93, 113, 105, 93, 34, 203, 143, 148, 148, 148, + 144, 258, 114, 154, 115, 119, 120, 122, 254, 117, + 146, 116, 118, 161, 121, 35, 36, 14, 15, 16, + 17, 14, 14, 14, 14, 14, 14, 45, 14, 14, + 14, 46, 14, 14, 47, 47, 47, 47, 47, 47, + 47, 48, 47, 47, 47, 47, 14, 47, 47, 49, + 47, 47, 50, 47, 47, 47, 47, 47, 47, 47, + 47, 47, 47, 51, 47, 47, 47, 52, 14, 53, + 54, 55, 56, 56, 131, 85, 93, 93, 93, 151, + + 151, 151, 102, 93, 103, 103, 104, 93, 257, 221, + 57, 93, 58, 59, 60, 61, 93, 93, 62, 63, + 123, 93, 64, 65, 124, 66, 145, 67, 68, 153, + 69, 70, 86, 102, 93, 104, 104, 104, 155, 93, + 132, 133, 102, 93, 106, 106, 106, 93, 93, 156, + 157, 93, 93, 159, 93, 93, 93, 93, 93, 93, + 93, 93, 158, 162, 93, 164, 160, 178, 148, 148, + 148, 163, 93, 93, 166, 151, 151, 151, 93, 165, + 168, 171, 93, 93, 167, 170, 180, 169, 93, 179, + 93, 93, 181, 93, 93, 185, 93, 182, 93, 187, + + 93, 93, 183, 93, 184, 93, 93, 93, 186, 93, + 188, 93, 93, 93, 93, 93, 93, 93, 93, 192, + 189, 190, 93, 93, 199, 194, 193, 191, 93, 196, + 197, 93, 210, 195, 93, 198, 93, 204, 181, 206, + 215, 205, 211, 208, 207, 209, 93, 213, 93, 212, + 216, 214, 93, 93, 93, 93, 217, 93, 93, 93, + 93, 218, 93, 93, 224, 93, 222, 93, 223, 235, + 93, 93, 227, 93, 93, 93, 225, 229, 232, 93, + 228, 93, 251, 93, 244, 226, 231, 236, 93, 230, + 238, 252, 241, 239, 240, 237, 93, 93, 256, 246, + + 247, 250, 252, 256, 93, 253, 93, 245, 249, 248, + 256, 93, 93, 93, 243, 256, 259, 14, 14, 14, + 14, 14, 14, 22, 22, 22, 22, 22, 22, 27, + 27, 27, 27, 27, 27, 39, 39, 39, 39, 39, + 39, 84, 242, 84, 84, 84, 84, 88, 93, 88, + 88, 88, 88, 91, 91, 92, 92, 92, 92, 125, + 125, 125, 125, 125, 125, 136, 136, 136, 136, 136, + 136, 139, 139, 139, 139, 139, 139, 141, 141, 141, + 141, 142, 142, 142, 142, 149, 149, 149, 149, 149, + 149, 152, 93, 152, 255, 93, 255, 255, 255, 255, + + 93, 93, 234, 233, 93, 93, 93, 93, 220, 219, + 93, 93, 93, 93, 93, 93, 202, 201, 200, 93, + 150, 93, 93, 140, 177, 137, 176, 175, 174, 173, + 172, 126, 150, 147, 93, 93, 93, 140, 138, 137, + 135, 134, 130, 129, 128, 127, 126, 93, 73, 87, + 73, 73, 77, 74, 73, 260, 13, 260, 260, 260, + 260, 260, 260, 260, 260, 260, 260, 260, 260, 260, + 260, 260, 260, 260, 260, 260, 260, 260, 260, 260, + 260, 260, 260, 260, 260, 260, 260, 260, 260, 260, + 260, 260, 260, 260, 260, 260, 260, 260, 260, 260, + + 260, 260, 260, 260, 260, 260, 260, 260, 260 } ; -static yyconst short int yy_chk[581] = +static yyconst short int yy_chk[610] = { 0, - 0, 1, 1, 1, 2, 2, 2, 0, 2, 1, - 0, 18, 2, 18, 3, 3, 246, 4, 4, 3, - 31, 1, 4, 32, 2, 32, 7, 7, 7, 1, - 49, 48, 2, 3, 47, 59, 4, 5, 5, 5, - 21, 5, 31, 47, 5, 7, 8, 8, 8, 44, - 7, 44, 50, 21, 48, 53, 5, 53, 49, 197, - 59, 5, 78, 31, 31, 8, 60, 56, 243, 197, - 8, 58, 52, 50, 52, 52, 52, 54, 57, 54, - 54, 54, 5, 5, 6, 6, 6, 6, 6, 60, - 55, 6, 55, 55, 55, 56, 61, 58, 62, 57, - - 66, 57, 91, 6, 57, 78, 78, 104, 6, 92, - 96, 96, 96, 91, 105, 54, 99, 99, 99, 173, - 139, 61, 173, 92, 62, 66, 139, 104, 105, 6, - 6, 9, 9, 9, 9, 9, 9, 9, 9, 9, + 0, 1, 1, 1, 2, 2, 2, 0, 0, 2, + 1, 3, 3, 2, 4, 4, 18, 3, 18, 31, + 4, 7, 7, 7, 1, 37, 49, 2, 8, 8, + 8, 50, 1, 3, 259, 2, 4, 5, 5, 5, + 21, 60, 5, 7, 31, 5, 48, 32, 7, 32, + 8, 49, 45, 21, 45, 8, 51, 48, 54, 5, + 54, 50, 37, 57, 5, 31, 31, 53, 60, 53, + 53, 53, 55, 58, 55, 55, 55, 59, 56, 51, + 56, 56, 56, 61, 62, 5, 5, 6, 6, 6, + 6, 6, 6, 57, 63, 6, 58, 64, 58, 65, + + 67, 58, 66, 94, 95, 59, 97, 108, 61, 6, + 178, 62, 55, 115, 6, 178, 94, 99, 99, 99, + 95, 254, 63, 108, 64, 66, 66, 67, 251, 65, + 97, 64, 65, 115, 66, 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, - 11, 11, 11, 11, 11, 115, 241, 93, 65, 235, - 63, 235, 100, 64, 100, 100, 100, 239, 106, 11, - - 115, 11, 11, 11, 11, 67, 94, 11, 11, 65, - 65, 11, 11, 93, 11, 63, 11, 11, 65, 11, - 11, 64, 63, 106, 64, 107, 108, 67, 94, 109, - 101, 67, 101, 101, 101, 103, 110, 103, 103, 103, - 111, 112, 113, 116, 117, 114, 118, 120, 119, 121, - 140, 142, 141, 149, 153, 109, 107, 108, 150, 112, - 113, 144, 144, 144, 117, 111, 110, 114, 151, 116, - 119, 121, 152, 156, 118, 120, 141, 119, 153, 140, - 142, 147, 147, 147, 149, 154, 150, 152, 157, 158, - 159, 160, 161, 156, 162, 163, 165, 151, 164, 154, - - 166, 177, 174, 179, 167, 180, 182, 184, 188, 185, - 187, 193, 238, 186, 160, 191, 157, 158, 165, 162, - 161, 167, 159, 190, 164, 177, 163, 186, 180, 189, - 166, 174, 187, 179, 192, 184, 182, 185, 188, 190, - 191, 198, 193, 189, 200, 202, 203, 189, 204, 205, - 207, 209, 208, 212, 192, 211, 214, 215, 217, 198, - 214, 219, 200, 227, 225, 205, 218, 212, 203, 208, - 224, 202, 228, 207, 230, 227, 232, 240, 204, 219, - 211, 209, 215, 218, 240, 244, 217, 225, 224, 237, - 236, 242, 230, 232, 242, 244, 234, 233, 231, 229, - - 226, 223, 228, 248, 248, 248, 248, 248, 248, 249, - 249, 249, 249, 249, 249, 250, 250, 250, 250, 250, - 250, 251, 251, 251, 251, 251, 251, 252, 222, 252, - 252, 252, 252, 253, 221, 253, 253, 253, 253, 254, - 254, 255, 255, 255, 255, 256, 256, 256, 256, 256, - 256, 257, 257, 257, 257, 257, 257, 258, 258, 258, - 258, 258, 258, 259, 259, 259, 259, 260, 260, 260, - 260, 261, 261, 261, 261, 261, 261, 262, 220, 262, - 216, 213, 210, 206, 201, 199, 195, 194, 183, 181, - 178, 176, 175, 169, 168, 155, 145, 138, 137, 135, - - 133, 130, 129, 128, 125, 124, 122, 98, 95, 90, - 89, 88, 87, 82, 80, 79, 77, 74, 73, 72, - 71, 46, 42, 37, 33, 26, 25, 20, 19, 13, - 247, 247, 247, 247, 247, 247, 247, 247, 247, 247, - 247, 247, 247, 247, 247, 247, 247, 247, 247, 247, - 247, 247, 247, 247, 247, 247, 247, 247, 247, 247, - 247, 247, 247, 247, 247, 247, 247, 247, 247, 247, - 247, 247, 247, 247, 247, 247, 247, 247, 247, 247 + 9, 9, 9, 9, 9, 9, 9, 9, 9, 11, + 11, 11, 11, 11, 79, 85, 68, 203, 96, 102, + + 102, 102, 103, 253, 103, 103, 103, 107, 253, 203, + 11, 109, 11, 11, 11, 11, 110, 111, 11, 11, + 68, 113, 11, 11, 68, 11, 96, 11, 11, 107, + 11, 11, 85, 104, 112, 104, 104, 104, 109, 114, + 79, 79, 106, 116, 106, 106, 106, 117, 118, 110, + 111, 119, 120, 113, 121, 123, 122, 124, 144, 143, + 145, 146, 112, 116, 153, 118, 114, 143, 148, 148, + 148, 117, 154, 155, 120, 151, 151, 151, 156, 119, + 122, 124, 157, 158, 121, 123, 145, 122, 160, 144, + 161, 162, 146, 163, 164, 156, 165, 153, 166, 158, + + 167, 168, 154, 170, 155, 171, 169, 179, 157, 184, + 160, 182, 187, 189, 185, 190, 191, 193, 192, 164, + 161, 162, 195, 196, 171, 166, 165, 163, 198, 168, + 169, 194, 191, 167, 197, 170, 208, 182, 179, 185, + 195, 184, 192, 189, 187, 190, 204, 194, 206, 193, + 196, 194, 209, 210, 211, 213, 197, 215, 214, 217, + 222, 198, 218, 221, 208, 224, 204, 232, 206, 221, + 235, 225, 211, 226, 231, 236, 209, 214, 218, 238, + 213, 240, 248, 247, 235, 210, 217, 222, 246, 215, + 225, 249, 232, 226, 231, 224, 250, 244, 252, 238, + + 240, 244, 249, 255, 257, 250, 245, 236, 243, 242, + 252, 241, 239, 237, 234, 255, 257, 261, 261, 261, + 261, 261, 261, 262, 262, 262, 262, 262, 262, 263, + 263, 263, 263, 263, 263, 264, 264, 264, 264, 264, + 264, 265, 233, 265, 265, 265, 265, 266, 230, 266, + 266, 266, 266, 267, 267, 268, 268, 268, 268, 269, + 269, 269, 269, 269, 269, 270, 270, 270, 270, 270, + 270, 271, 271, 271, 271, 271, 271, 272, 272, 272, + 272, 273, 273, 273, 273, 274, 274, 274, 274, 274, + 274, 275, 229, 275, 276, 228, 276, 276, 276, 276, + + 227, 223, 220, 219, 216, 212, 207, 205, 202, 200, + 199, 188, 186, 183, 181, 180, 177, 173, 172, 159, + 149, 142, 141, 139, 138, 136, 133, 132, 131, 128, + 127, 125, 101, 98, 93, 92, 91, 90, 86, 83, + 81, 80, 78, 75, 74, 73, 72, 47, 43, 38, + 33, 26, 25, 20, 19, 13, 260, 260, 260, 260, + 260, 260, 260, 260, 260, 260, 260, 260, 260, 260, + 260, 260, 260, 260, 260, 260, 260, 260, 260, 260, + 260, 260, 260, 260, 260, 260, 260, 260, 260, 260, + 260, 260, 260, 260, 260, 260, 260, 260, 260, 260, + + 260, 260, 260, 260, 260, 260, 260, 260, 260 } ; static yy_state_type yy_state_buf[YY_BUF_SIZE + 2], *yy_state_ptr; @@ -639,6 +652,7 @@ char *yytext; #include "config.h" #include +#include #include "parse.h" #include "main.h" @@ -653,6 +667,10 @@ static int header_c = FALSE; static GString *cbuf = NULL; int ccode_line = 1; +GList *include_files = NULL; +/* 0 no, 1 means yes, 2+ means don't even start looking anymore */ +static int look_for_includes = 0; + int line_no = 1; static void @@ -685,7 +703,7 @@ add_to_cbuf(char *s) #define CLASS_CODE_I 5 -#line 689 "lex.yy.c" +#line 707 "lex.yy.c" /* Macros after this point can all be overridden by user definitions in * section 1. @@ -839,10 +857,10 @@ YY_DECL register char *yy_cp = NULL, *yy_bp = NULL; register int yy_act; -#line 69 "lexer.l" +#line 74 "lexer.l" -#line 846 "lex.yy.c" +#line 864 "lex.yy.c" if ( yy_init ) { @@ -891,14 +909,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 >= 248 ) + if ( yy_current_state >= 261 ) 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] != 531 ); + while ( yy_base[yy_current_state] != 557 ); yy_find_action: yy_current_state = *--yy_state_ptr; @@ -929,12 +947,12 @@ do_action: /* This label is used only to access EOF actions. */ { /* beginning of action switch */ case 1: YY_RULE_SETUP -#line 71 "lexer.l" +#line 76 "lexer.l" { line_no++; REJECT; } YY_BREAK case 2: YY_RULE_SETUP -#line 73 "lexer.l" +#line 78 "lexer.l" { fprintf(stderr,"You are a bad bad person!\n"); REJECT; } YY_BREAK case 3: @@ -942,84 +960,104 @@ case 3: yy_c_buf_p = yy_cp -= 1; YY_DO_BEFORE_ACTION; /* set up yytext again */ YY_RULE_SETUP -#line 75 "lexer.l" +#line 80 "lexer.l" { ; /*comment, ignore*/ } YY_BREAK case 4: +YY_RULE_SETUP +#line 81 "lexer.l" +{ + if(look_for_includes==1) { + char *p; + char *file; + char *str = g_strdup(yytext); + file = strchr(str,'"'); + if(!file) file = strchr(str,'<'); + file++; + p = strchr(file,'"'); + if(!p) p = strchr(file,'>'); + *p = '\0'; + include_files = g_list_prepend(include_files,g_strdup(file)); + g_free(str); + } + REJECT; +} + YY_BREAK +case 5: *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 76 "lexer.l" +#line 98 "lexer.l" { add_to_cbuf(yytext); /*comment, ignore*/ } YY_BREAK -case 5: +case 6: *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 77 "lexer.l" +#line 99 "lexer.l" { ; /*comment, ignore*/ } YY_BREAK -case 6: +case 7: *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 78 "lexer.l" +#line 100 "lexer.l" { ; /*comment, ignore*/ } YY_BREAK -case 7: +case 8: YY_RULE_SETUP -#line 79 "lexer.l" +#line 101 "lexer.l" {BEGIN(COMMENT); before_comment = INITIAL; } YY_BREAK -case 8: +case 9: YY_RULE_SETUP -#line 80 "lexer.l" +#line 102 "lexer.l" { add_to_cbuf(yytext); BEGIN(COMMENT); before_comment = C_CODE; } YY_BREAK -case 9: +case 10: YY_RULE_SETUP -#line 85 "lexer.l" +#line 107 "lexer.l" {BEGIN(COMMENT); before_comment = CLASS_CODE; } YY_BREAK -case 10: +case 11: YY_RULE_SETUP -#line 86 "lexer.l" +#line 108 "lexer.l" {BEGIN(COMMENT); before_comment = CLASS_CODE_I; } YY_BREAK -case 11: +case 12: YY_RULE_SETUP -#line 87 "lexer.l" +#line 109 "lexer.l" { if(before_comment == C_CODE) add_to_cbuf(yytext); BEGIN(before_comment); } YY_BREAK -case 12: +case 13: YY_RULE_SETUP -#line 91 "lexer.l" +#line 113 "lexer.l" { /* comment, ignore */ if(before_comment == C_CODE) add_to_cbuf(yytext); } YY_BREAK -case 13: +case 14: YY_RULE_SETUP -#line 95 "lexer.l" +#line 117 "lexer.l" { /* comment, ignore */ if(before_comment == C_CODE) add_to_cbuf(yytext); } YY_BREAK -case 14: +case 15: YY_RULE_SETUP -#line 100 "lexer.l" +#line 122 "lexer.l" { BEGIN(C_CODE); parenth_depth = 1; @@ -1029,9 +1067,9 @@ YY_RULE_SETUP ccode_line = line_no; } YY_BREAK -case 15: +case 16: YY_RULE_SETUP -#line 108 "lexer.l" +#line 130 "lexer.l" { BEGIN(C_CODE); parenth_depth = 1; @@ -1039,98 +1077,102 @@ YY_RULE_SETUP header_c = FALSE; clear_cbuf(); ccode_line = line_no; + if(look_for_includes==0) + look_for_includes=1; } YY_BREAK -case 16: +case 17: YY_RULE_SETUP -#line 116 "lexer.l" +#line 140 "lexer.l" { BEGIN(INITIAL); yylval.cbuf = cbuf; cbuf = NULL; + if(look_for_includes==1) + look_for_includes=0; if(header_c) return HCODE; else return CCODE; } YY_BREAK -case 17: -YY_RULE_SETUP -#line 126 "lexer.l" -{ add_to_cbuf(yytext); } - YY_BREAK case 18: YY_RULE_SETUP -#line 127 "lexer.l" +#line 152 "lexer.l" { add_to_cbuf(yytext); } YY_BREAK case 19: YY_RULE_SETUP -#line 128 "lexer.l" +#line 153 "lexer.l" { add_to_cbuf(yytext); } YY_BREAK case 20: YY_RULE_SETUP -#line 129 "lexer.l" +#line 154 "lexer.l" { add_to_cbuf(yytext); } YY_BREAK case 21: YY_RULE_SETUP -#line 130 "lexer.l" +#line 155 "lexer.l" { add_to_cbuf(yytext); } YY_BREAK case 22: YY_RULE_SETUP -#line 131 "lexer.l" +#line 156 "lexer.l" { add_to_cbuf(yytext); } YY_BREAK case 23: YY_RULE_SETUP -#line 133 "lexer.l" +#line 157 "lexer.l" { add_to_cbuf(yytext); } YY_BREAK case 24: YY_RULE_SETUP -#line 134 "lexer.l" +#line 159 "lexer.l" +{ add_to_cbuf(yytext); } + YY_BREAK +case 25: +YY_RULE_SETUP +#line 160 "lexer.l" { BEGIN(C_CODE_STRING); add_to_cbuf(yytext); } YY_BREAK -case 25: +case 26: YY_RULE_SETUP -#line 138 "lexer.l" +#line 164 "lexer.l" { add_to_cbuf(yytext); } YY_BREAK -case 26: +case 27: YY_RULE_SETUP -#line 139 "lexer.l" +#line 165 "lexer.l" { BEGIN(C_CODE); add_to_cbuf(yytext); } YY_BREAK -case 27: +case 28: YY_RULE_SETUP -#line 143 "lexer.l" +#line 169 "lexer.l" { add_to_cbuf(yytext); } YY_BREAK -case 28: +case 29: YY_RULE_SETUP -#line 144 "lexer.l" +#line 170 "lexer.l" { add_to_cbuf(yytext); } YY_BREAK -case 29: +case 30: YY_RULE_SETUP -#line 146 "lexer.l" +#line 172 "lexer.l" { parenth_depth++; add_to_cbuf(yytext); } YY_BREAK -case 30: +case 31: YY_RULE_SETUP -#line 150 "lexer.l" +#line 176 "lexer.l" { parenth_depth--; if(parenth_depth<0) { @@ -1144,27 +1186,28 @@ YY_RULE_SETUP add_to_cbuf(yytext); } YY_BREAK -case 31: +case 32: YY_RULE_SETUP -#line 163 "lexer.l" +#line 189 "lexer.l" { add_to_cbuf(yytext); } YY_BREAK -case 32: +case 33: YY_RULE_SETUP -#line 164 "lexer.l" +#line 190 "lexer.l" { add_to_cbuf(yytext); } YY_BREAK -case 33: +case 34: YY_RULE_SETUP -#line 166 "lexer.l" +#line 192 "lexer.l" { + look_for_includes = 2; BEGIN(CLASS_CODE); return CLASS; } YY_BREAK -case 34: +case 35: YY_RULE_SETUP -#line 171 "lexer.l" +#line 198 "lexer.l" { if(for_cpp) { char *s; @@ -1177,151 +1220,151 @@ YY_RULE_SETUP REJECT; } YY_BREAK -case 35: +case 36: YY_RULE_SETUP -#line 183 "lexer.l" +#line 210 "lexer.l" {return FROM;} YY_BREAK -case 36: +case 37: YY_RULE_SETUP -#line 185 "lexer.l" +#line 212 "lexer.l" {return VOID;} YY_BREAK -case 37: +case 38: YY_RULE_SETUP -#line 186 "lexer.l" +#line 213 "lexer.l" {return STRUCT;} YY_BREAK -case 38: +case 39: YY_RULE_SETUP -#line 187 "lexer.l" +#line 214 "lexer.l" {return UNION;} YY_BREAK -case 39: +case 40: YY_RULE_SETUP -#line 188 "lexer.l" +#line 215 "lexer.l" {return ENUM;} YY_BREAK -case 40: +case 41: YY_RULE_SETUP -#line 189 "lexer.l" +#line 216 "lexer.l" {return SIGNED;} YY_BREAK -case 41: +case 42: YY_RULE_SETUP -#line 190 "lexer.l" +#line 217 "lexer.l" {return UNSIGNED;} YY_BREAK -case 42: +case 43: YY_RULE_SETUP -#line 191 "lexer.l" +#line 218 "lexer.l" {return LONG;} YY_BREAK -case 43: +case 44: YY_RULE_SETUP -#line 192 "lexer.l" +#line 219 "lexer.l" {return SHORT;} YY_BREAK -case 44: +case 45: YY_RULE_SETUP -#line 193 "lexer.l" +#line 220 "lexer.l" {return INT;} YY_BREAK -case 45: +case 46: YY_RULE_SETUP -#line 194 "lexer.l" +#line 221 "lexer.l" {return FLOAT;} YY_BREAK -case 46: +case 47: YY_RULE_SETUP -#line 195 "lexer.l" +#line 222 "lexer.l" {return DOUBLE;} YY_BREAK -case 47: +case 48: YY_RULE_SETUP -#line 196 "lexer.l" +#line 223 "lexer.l" {return CHAR;} YY_BREAK -case 48: +case 49: YY_RULE_SETUP -#line 197 "lexer.l" +#line 224 "lexer.l" {return CONST;} YY_BREAK -case 49: +case 50: YY_RULE_SETUP -#line 199 "lexer.l" +#line 226 "lexer.l" {return THREEDOTS;} YY_BREAK -case 50: +case 51: YY_RULE_SETUP -#line 201 "lexer.l" +#line 228 "lexer.l" {yylval.line = line_no; return PUBLIC;} YY_BREAK -case 51: +case 52: YY_RULE_SETUP -#line 202 "lexer.l" +#line 229 "lexer.l" {yylval.line = line_no; return PRIVATE;} YY_BREAK -case 52: +case 53: YY_RULE_SETUP -#line 203 "lexer.l" +#line 230 "lexer.l" {yylval.line = line_no; return ARGUMENT;} YY_BREAK -case 53: +case 54: YY_RULE_SETUP -#line 204 "lexer.l" +#line 231 "lexer.l" {yylval.line = line_no; return VIRTUAL;} YY_BREAK -case 54: +case 55: YY_RULE_SETUP -#line 205 "lexer.l" +#line 232 "lexer.l" {yylval.line = line_no; return SIGNAL;} YY_BREAK -case 55: +case 56: YY_RULE_SETUP -#line 206 "lexer.l" +#line 233 "lexer.l" {yylval.line = line_no; return OVERRIDE;} YY_BREAK -case 56: +case 57: YY_RULE_SETUP -#line 207 "lexer.l" +#line 234 "lexer.l" {return ONERROR;} YY_BREAK -case 57: +case 58: YY_RULE_SETUP -#line 208 "lexer.l" +#line 235 "lexer.l" { yylval.id = g_strdup(yytext); return NUMBER; } YY_BREAK -case 58: +case 59: YY_RULE_SETUP -#line 212 "lexer.l" +#line 239 "lexer.l" { yylval.id = g_strdup(yytext); return TYPETOKEN; } YY_BREAK -case 59: +case 60: YY_RULE_SETUP -#line 216 "lexer.l" +#line 243 "lexer.l" { yylval.id = g_strdup(yytext); return TOKEN; } YY_BREAK -case 60: +case 61: YY_RULE_SETUP -#line 221 "lexer.l" +#line 248 "lexer.l" { BEGIN(CLASS_CODE_I); return '{'; } YY_BREAK -case 61: +case 62: YY_RULE_SETUP -#line 225 "lexer.l" +#line 252 "lexer.l" { BEGIN(C_CODE); parenth_depth=1; @@ -1331,38 +1374,38 @@ YY_RULE_SETUP return '{'; } YY_BREAK -case 62: +case 63: YY_RULE_SETUP -#line 233 "lexer.l" +#line 260 "lexer.l" { BEGIN(INITIAL); return '}'; } YY_BREAK -case 63: +case 64: YY_RULE_SETUP -#line 238 "lexer.l" +#line 265 "lexer.l" ; /*ignore*/ YY_BREAK -case 64: +case 65: YY_RULE_SETUP -#line 240 "lexer.l" +#line 267 "lexer.l" { yylval.line = line_no; return yytext[0]; } YY_BREAK -case 65: +case 66: YY_RULE_SETUP -#line 245 "lexer.l" +#line 272 "lexer.l" ; /*ignore*/ YY_BREAK -case 66: +case 67: YY_RULE_SETUP -#line 246 "lexer.l" +#line 273 "lexer.l" ECHO; YY_BREAK -#line 1366 "lex.yy.c" +#line 1409 "lex.yy.c" case YY_STATE_EOF(INITIAL): case YY_STATE_EOF(COMMENT): case YY_STATE_EOF(C_CODE): @@ -1657,7 +1700,7 @@ static yy_state_type yy_get_previous_state() while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) { yy_current_state = (int) yy_def[yy_current_state]; - if ( yy_current_state >= 248 ) + if ( yy_current_state >= 261 ) yy_c = yy_meta[(unsigned int) yy_c]; } yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; @@ -1687,11 +1730,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 >= 248 ) + if ( yy_current_state >= 261 ) 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 == 247); + yy_is_jam = (yy_current_state == 260); if ( ! yy_is_jam ) *yy_state_ptr++ = yy_current_state; @@ -2249,4 +2292,4 @@ int main() return 0; } #endif -#line 246 "lexer.l" +#line 273 "lexer.l" diff --git a/src/lexer.l b/src/lexer.l index aabc7ad..320e25b 100644 --- a/src/lexer.l +++ b/src/lexer.l @@ -22,6 +22,7 @@ #include "config.h" #include +#include #include "parse.h" #include "main.h" @@ -36,6 +37,10 @@ static int header_c = FALSE; static GString *cbuf = NULL; int ccode_line = 1; +GList *include_files = NULL; +/* 0 no, 1 means yes, 2+ means don't even start looking anymore */ +static int look_for_includes = 0; + int line_no = 1; static void @@ -73,6 +78,23 @@ add_to_cbuf(char *s) <*>MOTHERFUCKER { fprintf(stderr,"You are a bad bad person!\n"); REJECT; } \/\/.*$ { ; /*comment, ignore*/ } +^#[ \t]*include[ \t][<"][^\n">]*[>"] { + if(look_for_includes==1) { + char *p; + char *file; + char *str = g_strdup(yytext); + file = strchr(str,'"'); + if(!file) file = strchr(str,'<'); + file++; + p = strchr(file,'"'); + if(!p) p = strchr(file,'>'); + *p = '\0'; + include_files = g_list_prepend(include_files,g_strdup(file)); + g_free(str); + } + REJECT; +} + \/\/.*$ { add_to_cbuf(yytext); /*comment, ignore*/ } \/\/.*$ { ; /*comment, ignore*/ } \/\/.*$ { ; /*comment, ignore*/ } @@ -112,11 +134,15 @@ add_to_cbuf(char *s) header_c = FALSE; clear_cbuf(); ccode_line = line_no; + if(look_for_includes==0) + look_for_includes=1; } ^\%\} { BEGIN(INITIAL); yylval.cbuf = cbuf; cbuf = NULL; + if(look_for_includes==1) + look_for_includes=0; if(header_c) return HCODE; else @@ -164,6 +190,7 @@ add_to_cbuf(char *s) \n { add_to_cbuf(yytext); } class { + look_for_includes = 2; BEGIN(CLASS_CODE); return CLASS; } diff --git a/src/main.c b/src/main.c index e556006..07158f5 100644 --- a/src/main.c +++ b/src/main.c @@ -44,6 +44,8 @@ extern FILE * yyin; extern Node *class; extern GList *nodes; +extern GList *include_files; + char *filebase; static char *funcbase; static char *pfuncbase; @@ -53,9 +55,10 @@ static char *macrotype; static char *typebase; static char *ptypebase; -static int signals = 0; -static int arguments = 0; -static int overrides = 0; +static int signals = 0; /* number of signals */ +static int arguments = 0; /* number of named arguments */ +static int overrides = 0; /* number of override functions */ +static int privates = 0; /* number of private data members */ FILE *out; FILE *outh; @@ -288,14 +291,17 @@ add_bad_hack_to_avoid_unused_warnings(Class *c) } static void -put_variable(Variable *v) +put_variable(Variable *v, FILE *fp, int priv) { - out_printf(outh,"\t"); - if(v->scope == PRIVATE_SCOPE) - out_printf(outh,"/* private */ "); - print_type(outh,v->vtype); + if(v->scope == PRIVATE_SCOPE) { + if(!priv) return; + } else { + if(priv) return; + } - out_printf(outh,"%s;\n",v->id); + out_printf(fp,"\t"); + print_type(fp,v->vtype); + out_printf(fp,"%s;\n",v->id); } static void @@ -351,16 +357,16 @@ put_priv_method_prot(Method *m) } static GList * -make_init_args(Class *cl, char *name, int is_class) +make_func_arg(char *typename, int is_class, char *name) { Node *node; Node *type; char *tn; if(is_class) - tn = g_strconcat(cl->otype,":Class",NULL); + tn = g_strconcat(typename,":Class",NULL); else - tn = g_strdup(cl->otype); + tn = g_strdup(typename); type = new_type(1,tn); node = new_funcarg((Type *)type,name,NULL); @@ -393,7 +399,7 @@ make_inits(Class *cl) node = new_method(CLASS_INIT_METHOD, (Type *)new_type(0,g_strdup("void")), NULL,NULL,g_strdup("class_init"), - make_init_args(cl,g_strdup("c"),TRUE), + make_func_arg(cl->otype,TRUE,g_strdup("c")), NULL, NULL,0,0,FALSE); cl->nodes = g_list_prepend(cl->nodes,node); } @@ -401,12 +407,50 @@ make_inits(Class *cl) node = new_method(INIT_METHOD, (Type *)new_type(0,g_strdup("void")), NULL,NULL,g_strdup("init"), - make_init_args(cl,g_strdup("o"),FALSE), + make_func_arg(cl->otype,FALSE,g_strdup("o")), NULL, NULL,0,0,FALSE); cl->nodes = g_list_prepend(cl->nodes,node); } } +static void +make_destroy(Class *cl) +{ + int got_destroy = FALSE; + GList *li; + Node *node; + for(li=cl->nodes;li;li=g_list_next(li)) { + Node *n = li->data; + if(n->type == METHOD_NODE) { + Method *m = (Method *)n; + if(m->scope == OVERRIDE_METHOD && + strcmp(m->id,"destroy")==0) { + if(strcmp(m->otype,"Gtk:Object")==0) { + got_destroy = TRUE; + break; + } else { + print_error(FALSE,"destroy method override " + "of class other then Gtk:Object", + m->line_no); + } + + } + } + } + if(!got_destroy) { + node = new_method(OVERRIDE_METHOD, + (Type *)new_type(0,g_strdup("void")), + g_strdup("Gtk:Object"), + NULL,g_strdup("destroy"), + make_func_arg("Gtk:Object",FALSE,g_strdup("o")), + NULL, + g_string_new("PARENT_HANDLER (o);\n"), + 0,0,FALSE); + cl->nodes = g_list_append(cl->nodes,node); + overrides++; + } +} + static GHashTable *marsh = NULL; static void @@ -786,6 +830,12 @@ add_inits(Class *c) if(m->line_no>0) out_addline_outfile(out); out_printf(out,"{\n"); + if(privates>0) { + out_printf(out,"\t%s->_priv = " + "g_new0 (%sPrivate,1);\n", + ((FuncArg *)m->args->data)->name, + typebase); + } } else if(m->scope == CLASS_INIT_METHOD) { if(m->line_no>0) out_addline_infile(out,m->line_no); @@ -950,21 +1000,39 @@ print_preconditions(Method *m) } } +/* put in code if it's needed */ +static void +put_in_gen_code(Method *m) +{ + /* now we only have the freeing of the private structure */ + if(privates>0 && + m->scope == OVERRIDE_METHOD && + strcmp(m->id,"destroy")==0) { + out_printf(out,"\tg_free (%s (%s)->_priv);\n" + "\t%s (%s)->_priv = NULL;\n", + macrobase, + ((FuncArg *)m->args->data)->name, + macrobase, + ((FuncArg *)m->args->data)->name); + + } +} + static void print_method_body(Method *m, int pre) { out_printf(out,"{\n"); - if(pre) { + if(pre) print_preconditions(m); - out_printf(out,"\t{\n"); - } + put_in_gen_code(m); + + out_printf(out,"\t{\n"); out_addline_infile(out,m->ccode_line); out_printf(out,"\t\t%s\n",m->cbuf->str); out_addline_outfile(out); - if(pre) - out_printf(out,"\t}\n"); + out_printf(out,"\t}\n"); out_printf(out,"}\n"); } @@ -1141,6 +1209,44 @@ check_duplicate_symbols(Class *c) } } +static void +check_bad_symbols(Class *c) +{ + GList *l; + for(l=c->nodes;l;l=g_list_next(l)) { + Node *n = l->data; + if(n->type == METHOD_NODE) { + Method *m = (Method *)n; + if((m->scope == SIGNAL_LAST_METHOD || + m->scope == SIGNAL_FIRST_METHOD || + m->scope == PRIVATE_SIGNAL_LAST_METHOD || + m->scope == PRIVATE_SIGNAL_FIRST_METHOD || + m->scope == VIRTUAL_METHOD || + m->scope == PRIVATE_VIRTUAL_METHOD) && + strcmp(m->id,"__parent__")==0) { + char *s; + s = g_strdup_printf("'%s' not allowed as an " + "identifier of signal " + "or virtual methods", + m->id); + print_error(FALSE,s,m->line_no); + g_free(s); + } + } else if(n->type == VARIABLE_NODE) { + Variable *v = (Variable *)n; + if(strcmp(v->id,"_priv")==0 || + strcmp(v->id,"__parent__")==0) { + char *s; + s = g_strdup_printf("'%s' not allowed as a data " + "member name",v->id); + print_error(FALSE,s,v->line_no); + g_free(s); + } + } + } +} + + static void check_duplicate_named(Class *c,Node *node,char *id, int line_no) { @@ -1241,6 +1347,32 @@ check_vararg(Class *c) } } +static void +check_firstarg(Class *c) +{ + GList *l; + for(l=c->nodes;l;l=g_list_next(l)) { + Node *n = l->data; + if(n->type == METHOD_NODE) { + Method *m = (Method *)n; + if(m->args) + continue; + if(m->scope == OVERRIDE_METHOD || + m->scope == SIGNAL_LAST_METHOD || + m->scope == SIGNAL_FIRST_METHOD || + m->scope == PRIVATE_SIGNAL_LAST_METHOD || + m->scope == PRIVATE_SIGNAL_FIRST_METHOD || + m->scope == VIRTUAL_METHOD || + m->scope == PRIVATE_VIRTUAL_METHOD) { + print_error(FALSE, + "signals, overrides and virtuals, " + "can't have no arguments", + m->line_no); + } + } + } +} + static int count_signals(Class *c) { @@ -1290,6 +1422,22 @@ count_overrides(Class *c) return num; } +static int +count_privates(Class *c) +{ + int num = 0; + GList *l; + for(l=c->nodes;l;l=g_list_next(l)) { + Node *n = l->data; + if(n->type == VARIABLE_NODE) { + Variable *v = (Variable *)n; + if(v->scope == PRIVATE_SCOPE) + num++; + } + } + return num; +} + static void open_files(void) @@ -1339,8 +1487,11 @@ generate_outfiles(void) "extern \"C\" {\n" "#endif /* __cplusplus */\n\n"); - out_printf(out,"#include \"%s.h\"\n\n",filebase); - + p = g_strconcat(filebase,".h",NULL); + if(!g_list_find_custom(include_files,p,(GCompareFunc)strcmp)) + out_printf(out,"#include \"%s.h\"\n\n",filebase); + g_free(p); + for(li=nodes;li;li=g_list_next(li)) { Node *node = li->data; if(node->type == CCODE_NODE) { @@ -1358,13 +1509,8 @@ generate_outfiles(void) if(!cc->header) out_addline_outfile(fp); } else if(node->type == CLASS_NODE) { - GList *l; Class *c = (Class *)class; - char *otype,*ptype; - - signals = count_signals(c); - arguments = count_arguments(c); - overrides = count_overrides(c); + GList *l; out_printf(outh,"\n#define %s\t" "(%s_get_type())\n", @@ -1379,23 +1525,41 @@ generate_outfiles(void) "GTK_CHECK_TYPE((obj), %s_get_type ())\n\n", macrois,funcbase); - otype = remove_sep(c->otype); - ptype = remove_sep(c->ptype); - out_printf(outh,"\ntypedef struct _%s %s;\n",otype,otype); + if(privates>0) + out_printf(outh,"\ntypedef struct _%sPrivate %sPrivate;\n",typebase,typebase); + + out_printf(outh,"\ntypedef struct _%s %s;\n",typebase,typebase); out_printf(outh,"struct _%s {\n\t%s __parent__;\n", - otype,ptype); + typebase,ptypebase); for(l=c->nodes;l;l=g_list_next(l)) { Node *n = l->data; if(n->type == VARIABLE_NODE) - put_variable((Variable *)n); + put_variable((Variable *)n,outh,FALSE); } + if(privates>0) + out_printf(outh,"\t%sPrivate *_priv;\n",typebase); out_printf(outh,"};\n"); + if(privates>0) { + out_printf(out,"struct _%sPrivate {\n", + typebase); + for(l=c->nodes;l;l=l->next) { + Node *n = l->data; + if(n->type == VARIABLE_NODE) { + Variable *v = (Variable *)n; + out_addline_infile(out,v->line_no); + put_variable(v,out,TRUE); + } + } + out_addline_outfile(out); + out_printf(out,"};\n"); + } + out_printf(outh,"\ntypedef struct _%sClass %sClass;\n", - otype,otype); + typebase,typebase); out_printf(outh, "struct _%sClass {\n\t%sClass __parent__;\n", - otype,ptype); + typebase,ptypebase); for(l=c->nodes;l;l=g_list_next(l)) { Node *n = l->data; if(n->type == METHOD_NODE) @@ -1457,9 +1621,6 @@ generate_outfiles(void) out_printf(out,"#undef GET_NEW\n"); add_bad_hack_to_avoid_unused_warnings(c); - - g_free(otype); - g_free(ptype); } else g_assert_not_reached(); } @@ -1635,14 +1796,25 @@ main(int argc, char *argv[]) if(!class) print_error(FALSE," no class defined",0); - make_bases(); - + exit_on_error = FALSE; + + signals = count_signals((Class *)class); + arguments = count_arguments((Class *)class); + overrides = count_overrides((Class *)class); + privates = count_privates((Class *)class); + + make_bases(); make_inits((Class *)class); + if(privates>0) + make_destroy((Class *)class); + check_bad_symbols((Class *)class); check_duplicate_symbols((Class *)class); check_duplicate_signals_args((Class *)class); check_public_new((Class *)class); check_vararg((Class *)class); + check_firstarg((Class *)class); + exit_on_error = TRUE; if(got_error) diff --git a/src/test.gob b/src/test.gob index f7fbf8d..b5b180e 100644 --- a/src/test.gob +++ b/src/test.gob @@ -1,5 +1,10 @@ %{ #include +/* the next line is not mandatory, but if gob finds an include in one of + the %{ %} sections above the class definitions, it will not put it in + the file itself. So you can this way select where the include file is + at */ +#include "gtk-weird-button.h" static void jjjj(void); %} @@ -24,7 +29,7 @@ class Gtk:Weird:Button from Gtk:Button { GtkWidget *ret; ret = GTK_WIDGET (GET_NEW); - GTK_WEIRD_BUTTON(ret)->j = j; + GTK_WEIRD_BUTTON(ret)->_priv->j = j; return ret; }