]> git.draconx.ca Git - gob-dx.git/commitdiff
Release 0.0.3 v0.0.3
authorGeorge Lebl <jirka@5z.com>
Thu, 19 Aug 1999 05:21:00 +0000 (21:21 -0800)
committerNick Bowler <nbowler@draconx.ca>
Tue, 19 Feb 2019 17:17:11 +0000 (12:17 -0500)
23 files changed:
ChangeLog
Makefile.am
Makefile.in
NEWS
README
configure
configure.in
doc/Makefile.in
doc/gob.1
doc/gob.1.in [new file with mode: 0644]
gob.spec [new file with mode: 0644]
gob.spec.in [new file with mode: 0644]
src/Makefile.am
src/Makefile.in
src/lexer.c
src/lexer.l
src/main.c
src/out.c [new file with mode: 0644]
src/out.h [new file with mode: 0644]
src/parse.c
src/parse.y
src/tree.c
src/tree.h

index fdaf29acd7db533a78906b87dec3773162c57d07..aa20937f4000a6a4db9b84e5fcd5ce94d8292706 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,25 @@
+Wed Aug 18 12:54:17 1999  George Lebl  <jirka@5z.com>
+
+       * Released 0.0.3
+
+Tue Aug 17 22:24:47 1999  George Lebl  <jirka@5z.com>
+
+       * src/lexer.l,src/parse.y: don't use reserved words for check type
+         last first and null
+
+       * src/{lexer.l,parse.y,tree.[ch],main.c}: add #line's to output
+         files
+
+       * src/out.[ch]: new functions for output so that we can easily add
+         #line's to files
+
+       * src/main.c: fix get/set arguments
+
+       * doc/gob.1.in: updated for newer version and spellchecked, also
+         gob.1 is generated by configure now to get versions correct
+
+       * gob.spec.in: added a spec file
+
 Fri Jul 30 02:19:05 1999  George Lebl  <jirka@5z.com>
 
        * src/parse.y: accept simple char types
index 39207806dc88bc22e0e4a35b1e04b8b3107daa02..a5e1570e1ab069d9053ce5cee65dc3f99fde5328 100644 (file)
@@ -1 +1,6 @@
 SUBDIRS = src doc
+
+EXTRA_DIST = gob.spec.in
+
+dist-hook:
+       cp gob.spec $(distdir)
index e43b1ddac812480a1cb3d54dad9601e07b0c9c89..e9e3a40f0e54432a508eb5c11a4d468401611579 100644 (file)
@@ -77,13 +77,15 @@ VERSION = @VERSION@
 YACC = @YACC@
 
 SUBDIRS = src doc
+
+EXTRA_DIST = gob.spec.in
 ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
 mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
 CONFIG_HEADER = config.h
-CONFIG_CLEAN_FILES = 
+CONFIG_CLEAN_FILES =  gob.spec
 DIST_COMMON =  README ./stamp-h.in AUTHORS COPYING ChangeLog INSTALL \
 Makefile.am Makefile.in NEWS aclocal.m4 config.h.in configure \
-configure.in install-sh missing mkinstalldirs
+configure.in gob.spec.in install-sh missing mkinstalldirs
 
 
 DISTFILES = $(DIST_COMMON) $(SOURCES) $(HEADERS) $(TEXINFOS) $(EXTRA_DIST)
@@ -133,6 +135,8 @@ distclean-hdr:
        -rm -f config.h
 
 maintainer-clean-hdr:
+gob.spec: $(top_builddir)/config.status gob.spec.in
+       cd $(top_builddir) && CONFIG_FILES=$@ 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.
@@ -281,6 +285,7 @@ distdir: $(DISTFILES)
              || exit 1; \
          fi; \
        done
+       $(MAKE) $(AM_MAKEFLAGS) top_distdir="$(top_distdir)" distdir="$(distdir)" dist-hook
 info-am:
 info: info-recursive
 dvi-am:
@@ -355,6 +360,9 @@ installdirs mostlyclean-generic distclean-generic clean-generic \
 maintainer-clean-generic clean mostlyclean distclean maintainer-clean
 
 
+dist-hook:
+       cp gob.spec $(distdir)
+
 # 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/NEWS b/NEWS
index 001f39baa68fe0cc30b7372d96373bc88ea69066..c93f17174213cf57778aa921b0f0e56dffe38d81 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -1,3 +1,11 @@
+0.0.3
+       * "type", "check", "first", "last" and "null" no longer reserved
+         words in method prototypes
+       * GET_NEW defined for the entire file
+       * added #line's to the .c files so that errors get reported on the
+         .gob file, there are no #line's in .h file however!
+       * bug fixes
+
 0.0.2
        * bug fixes
        * autoconf/automake setup
diff --git a/README b/README
index 7ab5067d19449c669a724754c463503fe4a8b5f7..b0637d89d0542d1eee0d4136aefd7ae30110edcf 100644 (file)
--- a/README
+++ b/README
@@ -1,9 +1,8 @@
 GTK+ Object Builder (GOB)
 
-Very early prototype. An extremely poor attempt at making a lex or yacc like
-preprocessor for making GTK+ objects, while keeping he language in a sort of
-java like style, and keeping the implementation extremely simple and without
-having to parse any real C code.
+Very simple preprocessor for making GTK+ objects with inline C code so that
+generatedfiles are not editted.  Syntax is inspired by java and yacc or lex.
+The implementation is intentionaly kept simple, and no C code parsing is done.
 
 Reasons:
        - C is a perfect (well mostly) language, no need for another language
@@ -13,11 +12,11 @@ Reasons:
          definition.
 
 To build:
-       run make
+       (the usual drill :)
+       run "./configure;make"
 
 To install:
-       edit the makefile to edit the destination directory and run
-       "make install" as root (or just put src/gob somewhere nice)
+       run "make install" as root
 
 To use:
        run gob with the .gob file on the command line
@@ -35,7 +34,6 @@ TODO:
        - clean up code
        - make it behave nice
        - add warnings all over the place
-       - add autoconf/automake setup
        - get a life
 
 George <jirka@5z.com>
index fd7e99fe4493c814e07e512b6c3235de11800f31..098d407a9ca66a364919f940228e74ffee1aa64e 100755 (executable)
--- a/configure
+++ b/configure
@@ -704,7 +704,7 @@ fi
 
 PACKAGE=gob
 
-VERSION=0.0.2
+VERSION=0.0.3
 
 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; }
@@ -2100,9 +2100,11 @@ ac_given_srcdir=$srcdir
 ac_given_INSTALL="$INSTALL"
 
 trap 'rm -fr `echo "
+gob.spec
 Makefile
 src/Makefile
-doc/Makefile config.h" | sed "s/:[^ ]*//g"` conftest*; exit 1' 1 2 15
+doc/Makefile
+doc/gob.1 config.h" | sed "s/:[^ ]*//g"` conftest*; exit 1' 1 2 15
 EOF
 cat >> $CONFIG_STATUS <<EOF
 
@@ -2201,9 +2203,11 @@ EOF
 
 cat >> $CONFIG_STATUS <<EOF
 
-CONFIG_FILES=\${CONFIG_FILES-"Makefile
+CONFIG_FILES=\${CONFIG_FILES-"gob.spec
+Makefile
 src/Makefile
-doc/Makefile"}
+doc/Makefile
+doc/gob.1"}
 EOF
 cat >> $CONFIG_STATUS <<\EOF
 for ac_file in .. $CONFIG_FILES; do if test "x$ac_file" != x..; then
index 77ca8672fedd680b8b418e2545738bd9b088c85f..1ed04d11f7c7d9fbf258a6740d5f0c004d46e3e3 100644 (file)
@@ -2,7 +2,7 @@ dnl Process this file with autoconf to produce a configure script.
 AC_PREREQ(2.2)
 AC_INIT(src/tree.h)
 AM_CONFIG_HEADER(config.h)
-AM_INIT_AUTOMAKE(gob,0.0.2)
+AM_INIT_AUTOMAKE(gob,0.0.3)
 
 dnl Checks for programs.
 AC_PROG_CC
@@ -28,6 +28,8 @@ AC_SUBST(CPPFLAGS)
 AC_SUBST(LDFLAGS)
 
 AC_OUTPUT([
+gob.spec
 Makefile
 src/Makefile
-doc/Makefile])
+doc/Makefile
+doc/gob.1])
index de5526bce39b85af00249c2392e16b73a08241c4..28dc9643f6451eb5561423d7f28a30225fac8762 100644 (file)
@@ -81,12 +81,12 @@ man_MANS = gob.1
 EXTRA_DIST = $(man_MANS)
 mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
 CONFIG_HEADER = ../config.h
-CONFIG_CLEAN_FILES = 
+CONFIG_CLEAN_FILES =  gob.1
 man1dir = $(mandir)/man1
 MANS = $(man_MANS)
 
 NROFF = nroff
-DIST_COMMON =  Makefile.am Makefile.in
+DIST_COMMON =  Makefile.am Makefile.in gob.1.in
 
 
 DISTFILES = $(DIST_COMMON) $(SOURCES) $(HEADERS) $(TEXINFOS) $(EXTRA_DIST)
@@ -101,6 +101,8 @@ Makefile: $(srcdir)/Makefile.in  $(top_builddir)/config.status
        cd $(top_builddir) \
          && CONFIG_FILES=$(subdir)/$@ CONFIG_HEADERS= $(SHELL) ./config.status
 
+gob.1: $(top_builddir)/config.status gob.1.in
+       cd $(top_builddir) && CONFIG_FILES=$(subdir)/$@ CONFIG_HEADERS= $(SHELL) ./config.status
 
 install-man1:
        $(mkinstalldirs) $(DESTDIR)$(man1dir)
index 3257c8fb64ef17ab994ff125c177b17a11207734..f7502e343a46ee2f3e29f3934fa892e035124c96 100644 (file)
--- a/doc/gob.1
+++ b/doc/gob.1
@@ -5,7 +5,7 @@
 .\" This manual page is covered by the terms of the GNU General
 .\" Public License.  
 .\"
-.TH GOB 1 "GOB 0.0.2
+.TH GOB 1 "GOB 0.0.3
 .SH NAME
 GOB \- The GTK+ Object Builder
 .SH SYNOPSIS
@@ -15,7 +15,8 @@ GOB \- The GTK+ Object Builder
 .PP
 GTK+ Object Builder is a simple preprocessor for easily creating
 GTK+ objects.  It does not parse any C code and ignores any C errors.  It
-is in spirit similiar to things like lex or yacc.
+is in spirit similar to things like lex or yacc.
+
 .SH TYPENAMES
 .PP
 Because we need to parse out different parts of the typename, 
@@ -51,6 +52,7 @@ For example:
   %}
 
 .fi
+
 .SH MAKING A NEW CLASS
 .PP
 The class header:
@@ -90,7 +92,7 @@ be somehow solved in some future version.
 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
 and a set handler.  They are fragments of C code that will be used to 
-get the value orset the value of the argument.  Inside them you can use the
+get the value or set the value of the argument.  Inside them you can use the
 define ARG to which you assign the data or get the data.  You can also use
 the identifier "this" as pointer to the object instance.  The type is
 defined as one of the gtk type enums, but without the GTK_TYPE_ prefix.
@@ -127,8 +129,8 @@ Argument lists:
 .PP
 For all but the init and init_class methods, you use the
 following syntax for arguments.  The first argument can be just "this",
-which gob will translateinto a pointer to the object instance.  The rest
-of the arguments are very similiar to normal C arguments.  If the
+which gob will translate into a pointer to the object instance.  The rest
+of the arguments are very similar to normal C arguments.  If the
 typename is an object pointer you should use the syntax defined above
 with the words separated by ':'
 .nf
@@ -140,7 +142,7 @@ or
 The checks are glib type preconditions, and can be the following:
 "null", which tests pointers for being NULL, "type" which checks GTK+
 object pointers for being the right type, "<test> <number>" which tests
-numberic arguments for being a certain value.  The test can be a <,>,<=,>=
+numeric arguments for being a certain value.  The test can be a <,>,<=,>=
 != or ==.  Example:
 .nf
   
@@ -178,7 +180,7 @@ so that one can override the method in derived methods.  They can be empty
 (if you put ';' instead of the C code).  A wrapper will also be defined
 which makes calling the methods he same as public methods.  This type of
 method is just a little bit "slower" then normal functions, but not as
-slow as signals.  You define them by using "virutal" keywrod before the
+slow as signals.  You define them by using "virtual" keyword before the
 prototype.
 .PP
 Signals:
@@ -197,7 +199,7 @@ of arguments>)".  If the return type is void, the type should be "NONE",
 the same should be for the argument list.  The rest of the prototype is
 the same as for other method types.  The body can also be empty, and
 also there is a public method wrapper which you can use for calling the
-signal jus tlike a public method.  Example:
+signal juslike a public method.  Example:
 .nf
 
   signal first INT(POINTER,INT)
@@ -247,12 +249,31 @@ have to type the class name before each call.  Example:
   {
          return foo(this) + i;
   }
+
+.fi
+.PP
+Making new objects:
+.PP
+You should define a new method which should be a normal public method.  Inside
+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 *
+  new(void) {
+         GtkObject *ret;
+         ret = GTK_OBJECT (GET_NEW);
+         return ret;
+  }
+
 .fi
+
 .SH BUGS
 .PP
 The generated header file is included as the first file in the .c file, no
-matter what. ths means that you willhave to putthings that need to be included
+matter what. This means that you will have to put things that need to be included
 before that, into an %h{ } section.
+
 .SH AUTHOR
 .PP
 George Lebl <jirka@5z.com>
diff --git a/doc/gob.1.in b/doc/gob.1.in
new file mode 100644 (file)
index 0000000..51f8a12
--- /dev/null
@@ -0,0 +1,279 @@
+.\"
+.\" gob manual page
+.\" (C) 1999 George Lebl <jirka@5z.com>
+.\" 
+.\" This manual page is covered by the terms of the GNU General
+.\" Public License.  
+.\"
+.TH GOB 1 "GOB @VERSION@" 
+.SH NAME
+GOB \- The GTK+ Object Builder
+.SH SYNOPSIS
+.PP
+.B gob
+.SH DESCRIPTION
+.PP
+GTK+ Object Builder is a simple preprocessor for easily creating
+GTK+ objects.  It does not parse any C code and ignores any C errors.  It
+is in spirit similar to things like lex or yacc.
+
+.SH TYPENAMES
+.PP
+Because we need to parse out different parts of the typename, 
+sometimes you need to specify the typename with some special syntax.
+Types are specified in capitalized form and words are separated by ':'.
+The first word of the type (which can be empty) is the "namespace".  This
+fact is for example used for the type checking macro.  For "Gtk:New:Button",
+the macro will be GTK_IS_NEW_BUTTON.  This format of typenames is used in
+the class declaration header and for method argument types.
+
+.SH OUTPUT FILE NAMES
+.PP
+The filenames are created from the typename.  The words are
+separated by '-' and all in lower case.  For example for an object named
+"Gtk:New:Button", the files are gtk-new-button.c and gtk-new-button.h.
+
+.SH INCLUDING NORMAL C CODE IN THE OUTPUT FILES
+.PP
+To include some code directly in the output C file begin with
+'%{' on an empty line and end the code with a '%{' on an empty line.  To
+put the code in the output header file, start the code with a '%h{'.
+For example:
+.nf
+
+  %h{
+  void somefunc(int i);
+  %}
+  %{
+  void somefunc(int i)
+  {
+         /* some code */
+  }
+  %}
+
+.fi
+
+.SH MAKING A NEW CLASS
+.PP
+The class header:
+.PP
+There can be only one class per input file.  Defining a class
+is sort of like in Java, you define the class and write inline code
+directly into the class definition.  To define a class you need to specify
+the new object name and the name of the object from which it is derived
+from, such as this "class <new type> from <parent type> { <class code> }".
+For example:
+.nf
+
+  class Gtk:New:Button from Gtk:Button {
+         <class code>
+  }
+
+.fi
+.PP
+Data members:
+.PP
+There are three types of data members.  Two of them are normal
+data numbers, and one is a virtual one, usually linked to a normal public
+data member.  The two normal data members are public or private. They are
+basically just copied into the object directly.  There is only one
+identifier allowed per typename unlike in normal C.  Example:
+.nf
+
+  public int i;
+  private GtkWidget *h;
+
+.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.
+.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
+and a set handler.  They are fragments of C code that will be used to 
+get the value or set the value of the argument.  Inside them you can use the
+define ARG to which you assign the data or get the data.  You can also use
+the identifier "this" as pointer to the object instance.  The type is
+defined as one of the gtk type enums, but without the GTK_TYPE_ prefix.
+For example:
+.nf
+
+  public int height;
+  argument INT height set { this->height = ARG; } get { ARG = this->height; };
+
+.fi
+.PP
+If you don't define a set or a get handler it will be a readonly
+or a writeonly argument.  If you want to add extra argument flags, add
+them into parenthesis after the argument keyword, separated by '|' and
+without the GTK_ARG_ prefix.  For example:
+.nf
+
+  public int height;
+  argument (CONSTRUCT) INT height get { ARG = this->height; };
+
+.fi
+.PP
+Methods:
+.PP
+There is a whole array of possible methods.  The two normal,
+"familiar" method types are private and public.  Public are defined as
+normal functions with a prototype in the header file.  Private methods
+are defined as static functions with prototypes at the top of the .c
+file.  Then there are signal, virtual and override methods.  You can also
+define init and init_class methods with a special definition if you want
+to add code to the constructors or you can just leave them out.
+.PP
+Argument lists:
+.PP
+For all but the init and init_class methods, you use the
+following syntax for arguments.  The first argument can be just "this",
+which gob will translate into a pointer to the object instance.  The rest
+of the arguments are very similar to normal C arguments.  If the
+typename is an object pointer you should use the syntax defined above
+with the words separated by ':'
+.nf
+<type> <argument id>
+or
+<type> <argument id> (check <list of checks>)
+.fi
+.PP
+The checks are glib type preconditions, and can be the following:
+"null", which tests pointers for being NULL, "type" which checks GTK+
+object pointers for being the right type, "<test> <number>" which tests
+numeric arguments for being a certain value.  The test can be a <,>,<=,>=
+!= or ==.  Example:
+.nf
+  
+  public int foo(this, int h (check > 0 < 11), Gtk:Widget *w (check null type))
+
+.fi
+.PP
+This will be the prototype of a function which has a this pointer
+as the first argument, an integer argument which will be checked and has
+to be more then 0 and less then 11, and a pointer to a GtkWidget object
+instance and it is checked for being null and the type will also be
+checked.
+.PP
+Error return:
+.PP
+Methods which have a return value, there also has to be something
+returned if there is an error, such as if a precondition is not met.  The
+default is 0, casted to the type of the method.  If you need to return
+something else then you can specify an "onerror" keyword after the
+prototype and after that a number, a token (an identifier) or a bit of C
+code enclosed in braces {}.  The braces will not be printed into the
+output, they just delimit the string.  For example
+.nf
+
+  public void * get_something(this, int i (check >= 0)) onerror NULL {
+         ...
+  }
+
+.fi
+.PP
+Virtual methods:
+.PP
+Virtual methods are basically pointers in the class structure,
+so that one can override the method in derived methods.  They can be empty
+(if you put ';' instead of the C code).  A wrapper will also be defined
+which makes calling the methods he same as public methods.  This type of
+method is just a little bit "slower" then normal functions, but not as
+slow as signals.  You define them by using "virtual" keyword before the
+prototype.
+.PP
+Signals:
+.PP
+Signals are methods to which the user can bind other handlers
+and override the default handler.  The default handler is basically the
+method body.  This is the most versatile and flexible type of a method
+and also the slowest.  You need to specify a whole bunch of things when
+you define a signal.  One thing is when the default handler will be run,
+first or last.  You specify that by "first" or "last" right after the
+"signal" keyword.  Then you need to define the gtk enum types (again
+without the GTK_TYPE_ prefix).  For that you define the return types
+and the types of arguments after the "this" pointer (not including the
+"this" pointer).  You put it in the following syntax "<return type> (<list
+of arguments>)".  If the return type is void, the type should be "NONE",
+the same should be for the argument list.  The rest of the prototype is
+the same as for other method types.  The body can also be empty, and
+also there is a public method wrapper which you can use for calling the
+signal just like a public method.  Example:
+.nf
+
+  signal first INT(POINTER,INT)
+  int do_something(this, Gtk:Widget *w (check null type), int length)
+  {
+         ...
+  }
+  
+or
+
+  signal last NONE(NONE) void foo(this);
+
+.fi
+.PP
+Override methods:
+.PP
+If you need to override some method (a signal or a virtual method
+of some class in the parent tree of the new object), you can define and
+override method.  After the "override" keyword, you should put the
+typename of the class you are overriding a method from.  Other then that
+it is the same as for other methods.  The "this" pointer in this case
+should be the type of the method you are overriding so that you don't
+get warnings during compilation.  Example:
+.nf
+
+  override (Gtk:Container) void
+  add (Gtk:Container *this (check null type), Gtk:Widget *wid (check null type))
+  {
+         ...
+  }
+.fi
+.PP
+Calling methods:
+.PP
+Inside the code, defines are set for the methods, so that you don't
+have to type the class name before each call.  Example:
+.nf
+
+  private int
+  foo(this)
+  {
+         return this->len;
+  }
+  
+  private int
+  bar(this,int i)
+  {
+         return foo(this) + i;
+  }
+
+.fi
+.PP
+Making new objects:
+.PP
+You should define a new method which should be a normal public method.  Inside
+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 *
+  new(void) {
+         GtkObject *ret;
+         ret = GTK_OBJECT (GET_NEW);
+         return ret;
+  }
+
+.fi
+
+.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.
+
+.SH AUTHOR
+.PP
+George Lebl <jirka@5z.com>
diff --git a/gob.spec b/gob.spec
new file mode 100644 (file)
index 0000000..24552b3
--- /dev/null
+++ b/gob.spec
@@ -0,0 +1,52 @@
+%define  ver     0.0.3
+%define  rel     1
+%define  prefix  /usr
+
+Summary: GOB, The GTK+ Object Builder
+Name: gob
+Version: %ver
+Release: %rel
+Copyright: GPL
+Group: Development/Tools
+Source: gob-%{ver}.tar.gz
+Url: http://www.5z.com/jirka/linux.html#gob
+BuildRoot: /var/tmp/gob-%{ver}-root
+Prefix: %prefix
+
+%description
+GOB is a simple preprocessor for making GTK+ objects.  It makes objects
+from a single file which has inline C code so that you don't have to edit
+the generated files.  Syntax is somewhat inspired by java and yacc.
+
+%changelog
+* Mon Aug 16 1999  George Lebl <jirka@5z.com>
+- added gob.spec.in file
+
+%prep
+%setup
+
+%build
+./configure --prefix=%prefix
+
+if [ "$SMP" != "" ]; then
+  (make "MAKE=make -k -j $SMP"; exit 0)
+  make
+else
+  make
+fi
+
+%install
+rm -rf $RPM_BUILD_ROOT
+
+make prefix=$RPM_BUILD_ROOT%{prefix} install
+
+%clean
+rm -rf $RPM_BUILD_ROOT
+
+%files
+%defattr(-, root, root)
+
+%doc README AUTHORS COPYING NEWS TODO ChangeLog
+
+%{prefix}/bin/*
+%{prefix}/man/man1/*
diff --git a/gob.spec.in b/gob.spec.in
new file mode 100644 (file)
index 0000000..3719afc
--- /dev/null
@@ -0,0 +1,52 @@
+%define  ver     @VERSION@
+%define  rel     SNAP
+%define  prefix  /usr
+
+Summary: GOB, The GTK+ Object Builder
+Name: gob
+Version: %ver
+Release: %rel
+Copyright: GPL
+Group: Development/Tools
+Source: gob-%{ver}.tar.gz
+Url: http://www.5z.com/jirka/linux.html#gob
+BuildRoot: /var/tmp/gob-%{ver}-root
+Prefix: %prefix
+
+%description
+GOB is a simple preprocessor for making GTK+ objects.  It makes objects
+from a single file which has inline C code so that you don't have to edit
+the generated files.  Syntax is somewhat inspired by java and yacc.
+
+%changelog
+* Mon Aug 16 1999  George Lebl <jirka@5z.com>
+- added gob.spec.in file
+
+%prep
+%setup
+
+%build
+./configure --prefix=%prefix
+
+if [ "$SMP" != "" ]; then
+  (make "MAKE=make -k -j $SMP"; exit 0)
+  make
+else
+  make
+fi
+
+%install
+rm -rf $RPM_BUILD_ROOT
+
+make prefix=$RPM_BUILD_ROOT%{prefix} install
+
+%clean
+rm -rf $RPM_BUILD_ROOT
+
+%files
+%defattr(-, root, root)
+
+%doc README AUTHORS COPYING NEWS TODO ChangeLog
+
+%{prefix}/bin/*
+%{prefix}/man/man1/*
index f97395d2fc82ff783d6ab2d79b9431c0c69e4a81..e2f80b28c68363219ee945dc4a182f7c32317ae0 100644 (file)
@@ -9,6 +9,8 @@ gob_SOURCES =   \
        main.c          \
        tree.c          \
        tree.h          \
+       out.c           \
+       out.h           \
        parse.y         \
        lexer.l
 
index 8c6d993a28d049455b308c3b0606bb8860f233fd..dd27c6b2a9ab8229e131ebd3b4e860e2b6912f11 100644 (file)
@@ -84,7 +84,7 @@ INCLUDES = @GLIB_CFLAGS@ -I$(includedir)
 
 bin_PROGRAMS = gob
 
-gob_SOURCES =          main.c                  tree.c                  tree.h                  parse.y                 lexer.l
+gob_SOURCES =          main.c                  tree.c                  tree.h                  out.c                   out.h                   parse.y                 lexer.l
 
 
 gob_LDADD =    -lm     -lpopt  $(GLIB_LIBS)    @LEXLIB@
@@ -103,7 +103,7 @@ PROGRAMS =  $(bin_PROGRAMS)
 
 DEFS = @DEFS@ -I. -I$(srcdir) -I..
 LIBS = @LIBS@
-gob_OBJECTS =  main.o tree.o parse.o lexer.o
+gob_OBJECTS =  main.o tree.o out.o parse.o lexer.o
 gob_DEPENDENCIES = 
 gob_LDFLAGS = 
 LEX_OUTPUT_ROOT = @LEX_OUTPUT_ROOT@
@@ -233,7 +233,8 @@ distdir: $(DISTFILES)
          fi; \
        done
 lexer.o: lexer.c ../config.h parse.h
-main.o: main.c ../config.h tree.h parse.h
+main.o: main.c ../config.h tree.h parse.h out.h
+out.o: out.c out.h
 parse.o: parse.c ../config.h tree.h
 tree.o: tree.c ../config.h tree.h
 
index 2663aeee3c51f464fbd0ec10c0f9d0273742e7a7..1e4dccb5da20c2404b0b73032ffaec7f4a6bcd9b 100644 (file)
@@ -284,71 +284,65 @@ static void yy_fatal_error YY_PROTO(( yyconst char msg[] ));
        *yy_cp = '\0'; \
        yy_c_buf_p = yy_cp;
 
-#define YY_NUM_RULES 62
-#define YY_END_OF_BUFFER 63
-static yyconst short int yy_acclist[293] =
+#define YY_NUM_RULES 58
+#define YY_END_OF_BUFFER 59
+static yyconst short int yy_acclist[269] =
     {   0,
-       63,   61,   62,   60,   61,   62,    1,   60,   62,   61,
-       62,   61,   62,   61,   62,   11,   61,   62,    1,   62,
-       11,   61,   62,   26,   61,   62,    1,   27,   62,   20,
-       26,   61,   62,   26,   61,   62,   26,   61,   62,   26,
-       61,   62,   24,   26,   61,   62,   25,   26,   61,   62,
-       26,   61,   62,   23,   61,   62,   22,   23,   61,   62,
-       23,   61,   62,   61,   62,   61,   62,   56,   61,   62,
-       56,   61,   62,   57,   61,   62,   61,   62,   61,   62,
-       54,   61,   62,   54,   61,   62,   56,   61,   62,   56,
-       61,   62,   56,   61,   62,   56,   61,   62,   56,   61,
-
-       62,   56,   61,   62,   56,   61,   62,   56,   61,   62,
-       56,   61,   62,   56,   61,   62,   56,   61,   62,   56,
-       61,   62,   56,   61,   62,   56,   61,   62,   58,   61,
-       62,   59,   61,   62,    6,   13,   10,    7,   19,   14,
-       21,    8,   56,   55,   56,   54,    9,   54,   54,   56,
-       56,   56,   56,   56,   56,   56,   56,   56,   56,   56,
-       56,   56,   56,   56,   56,   56,   56,   56,   56,   56,
-        2,   12,   15,   17,    3,    4,   55,   56,   54,    5,
-       54,   54,   56,   56,   56,   56,   56,   56,   56,   38,
-       56,   56,   56,   56,   56,   56,   56,   56,   56,   56,
-
-       56,   56,   56,   56,   56,   56,   16,   18,   29,   56,
-       56,   41,   56,   56,   56,   33,   56,   56,   56,   47,
-       56,   36,   56,   51,   56,   56,   56,   56,   56,   56,
-       56,   56,   52,   56,   56,   56,   56,   30,   56,   28,
-       56,   50,   56,   56,   48,   56,   39,   56,   56,   56,
-       56,   56,   37,   56,   56,   56,   56,   32,   56,   56,
-       56,   56,   40,   56,   56,   56,   56,   42,   56,   46,
-       56,   34,   56,   31,   56,   56,   56,   56,   53,   56,
-       56,   43,   56,   56,   45,   56,   44,   56,   49,   56,
-       35,   56
-
+       59,   57,   58,   56,   57,   58,    1,   56,   58,   57,
+       58,   57,   58,   57,   58,   11,   57,   58,    1,   12,
+       58,   11,   57,   58,   27,   57,   58,    1,   28,   58,
+       21,   27,   57,   58,   27,   57,   58,   27,   57,   58,
+       27,   57,   58,   25,   27,   57,   58,   26,   27,   57,
+       58,   27,   57,   58,   24,   57,   58,    1,   58,   23,
+       24,   57,   58,   24,   57,   58,   57,   58,   57,   58,
+       52,   57,   58,   52,   57,   58,   53,   57,   58,   57,
+       58,   57,   58,   50,   57,   58,   50,   57,   58,   52,
+       57,   58,   52,   57,   58,   52,   57,   58,   52,   57,
+
+       58,   52,   57,   58,   52,   57,   58,   52,   57,   58,
+       52,   57,   58,   52,   57,   58,   52,   57,   58,   52,
+       57,   58,   52,   57,   58,   54,   57,   58,   55,   57,
+       58,    6,   14,   10,    7,   20,   15,   22,    8,   52,
+       51,   52,   50,    9,   50,   50,   52,   52,   52,   52,
+       52,   52,   52,   52,   52,   52,   52,   52,   52,   52,
+       52,   52,   52,    2,   13,   16,   18,    3,    4,   51,
+       52,   50,    5,   50,   50,   52,   52,   52,   52,   52,
+       39,   52,   52,   52,   52,   52,   52,   52,   52,   52,
+       52,   52,   52,   52,   17,   19,   30,   52,   52,   42,
+
+       52,   52,   34,   52,   52,   37,   52,   52,   52,   52,
+       52,   52,   52,   52,   52,   52,   52,   31,   52,   29,
+       52,   52,   40,   52,   52,   52,   52,   52,   38,   52,
+       52,   52,   52,   33,   52,   52,   52,   52,   41,   52,
+       52,   52,   52,   43,   52,   47,   52,   35,   52,   32,
+       52,   52,   52,   52,   49,   52,   52,   44,   52,   52,
+       46,   52,   45,   52,   48,   52,   36,   52
     } ;
 
-static yyconst short int yy_accept[217] =
+static yyconst short int yy_accept[200] =
     {   0,
         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
         1,    1,    1,    2,    4,    7,   10,   12,   14,   16,
-       19,   21,   24,   27,   30,   34,   37,   40,   43,   47,
-       51,   54,   57,   61,   64,   66,   68,   71,   74,   77,
-       79,   81,   84,   87,   90,   93,   96,   99,  102,  105,
-      108,  111,  114,  117,  120,  123,  126,  129,  132,  135,
-      136,  136,  136,  136,  137,  138,  138,  138,  138,  139,
-      139,  140,  141,  142,  143,  143,  143,  144,  145,  146,
-      147,  148,  148,  148,  149,  149,  149,  150,  151,  152,
-      153,  154,  155,  156,  157,  158,  159,  160,  161,  162,
-
-      163,  164,  165,  166,  167,  168,  169,  170,  171,  171,
-      172,  172,  173,  173,  173,  174,  175,  175,  176,  176,
-      177,  177,  178,  179,  180,  180,  181,  182,  183,  184,
-      185,  186,  187,  188,  189,  190,  192,  193,  194,  195,
-      196,  197,  198,  199,  200,  201,  202,  203,  204,  205,
-      206,  207,  207,  208,  209,  211,  212,  214,  215,  216,
-      218,  219,  220,  222,  224,  226,  227,  228,  229,  230,
-      231,  232,  233,  235,  236,  237,  238,  240,  241,  242,
-      244,  245,  247,  249,  250,  251,  252,  253,  255,  256,
-      257,  258,  260,  261,  262,  263,  265,  266,  267,  268,
-
-      270,  272,  274,  276,  277,  278,  279,  281,  282,  284,
-      285,  287,  289,  291,  293,  293
+       19,   22,   25,   28,   31,   35,   38,   41,   44,   48,
+       52,   55,   58,   60,   64,   67,   69,   71,   74,   77,
+       80,   82,   84,   87,   90,   93,   96,   99,  102,  105,
+      108,  111,  114,  117,  120,  123,  126,  129,  132,  133,
+      133,  133,  133,  134,  135,  135,  135,  135,  136,  136,
+      137,  138,  139,  140,  140,  140,  141,  142,  143,  144,
+      145,  145,  145,  146,  146,  146,  147,  148,  149,  150,
+      151,  152,  153,  154,  155,  156,  157,  158,  159,  160,
+
+      161,  162,  163,  164,  164,  165,  165,  166,  166,  166,
+      167,  168,  168,  169,  169,  170,  170,  171,  172,  173,
+      173,  174,  175,  176,  177,  178,  179,  180,  181,  183,
+      184,  185,  186,  187,  188,  189,  190,  191,  192,  193,
+      194,  195,  195,  196,  197,  199,  200,  202,  203,  205,
+      206,  208,  209,  210,  211,  212,  213,  214,  215,  216,
+      217,  218,  220,  221,  222,  223,  225,  226,  227,  228,
+      229,  231,  232,  233,  234,  236,  237,  238,  239,  241,
+      242,  243,  244,  246,  248,  250,  252,  253,  254,  255,
+      257,  258,  260,  261,  263,  265,  267,  269,  269
+
     } ;
 
 static yyconst int yy_ec[256] =
@@ -364,9 +358,9 @@ static yyconst int yy_ec[256] =
        15,   15,   15,   15,   15,   15,   15,   15,   15,   15,
         1,   16,    1,    1,   15,    1,   17,   18,   19,   20,
 
-       21,   22,   23,   24,   25,   15,   26,   27,   28,   29,
-       30,   31,   15,   32,   33,   34,   35,   36,   15,   37,
-       38,   15,   39,    1,   40,    1,    1,    1,    1,    1,
+       21,   22,   23,   24,   25,   15,   15,   26,   27,   28,
+       29,   30,   15,   31,   32,   33,   34,   35,   15,   36,
+       15,   15,   37,    1,   38,    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,
@@ -383,196 +377,180 @@ static yyconst int yy_ec[256] =
         1,    1,    1,    1,    1
     } ;
 
-static yyconst int yy_meta[41] =
+static yyconst int yy_meta[39] =
     {   0,
         1,    1,    2,    1,    1,    1,    1,    1,    1,    3,
         3,    3,    4,    5,    6,    1,    5,    5,    5,    5,
         5,    5,    6,    6,    6,    6,    6,    6,    6,    6,
-        6,    6,    6,    6,    6,    6,    6,    6,    1,    1
+        6,    6,    6,    6,    6,    6,    1,    1
     } ;
 
-static yyconst short int yy_base[231] =
+static yyconst short int yy_base[214] =
     {   0,
-        0,    2,    3,    5,   19,   57,   10,   13,   97,    0,
-      137,    0,  491,  492,  492,  492,   11,  463,    0,  492,
-      492,  480,  492,  492,  492,   11,   23,    0,  492,  492,
-      448,  492,  492,    0,   24,    0,  474,    2,  492,   26,
-       33,   33,   44,   33,   40,   44,   54,   55,   56,   58,
-       59,  165,  167,  166,  168,   63,   65,  492,  492,  492,
-      483,  468,  445,  492,  492,    8,  477,  476,  492,  478,
-      492,  492,  492,  492,  477,  466,  465,  464,  173,  172,
-      492,  473,  177,  185,  197,    0,  202,   64,  198,  185,
-      191,  203,  204,  205,  208,  209,   66,   68,  210,  211,
-
-       73,  212,  214,  215,  217,  219,  227,  220,  472,  492,
-      441,  492,  467,  466,  492,  492,  468,  492,  467,  492,
-      456,  455,  230,  239,  464,  492,  243,    0,  233,  243,
-      244,  247,  248,  249,  253,  453,  251,  254,  256,  258,
-      259,  260,  261,  265,  266,  267,  268,  271,  273,  274,
-      172,  432,  492,  492,  451,  279,  450,  280,  286,  449,
-      281,  287,  448,  447,  446,  290,  291,  292,  299,  297,
-      312,  298,  445,  301,  303,  305,  444,  492,  306,  443,
-      307,  442,  441,  319,  321,  322,  323,  439,  324,  325,
-      326,  395,  328,  330,  335,  389,  331,  339,  337,  362,
-
-      361,  360,  358,  340,  341,  342,  356,  349,  354,  352,
-      353,  216,   71,   36,  492,  376,  382,  388,  394,  400,
-      406,  408,  412,  418,  424,  430,  434,  438,  444,  448
+        0,    2,    3,    5,   19,   55,   10,   13,   93,    0,
+      124,    0,  434,  435,  435,  435,   11,  407,    0,  435,
+      435,  423,  435,  435,  435,   11,   23,    0,  435,  435,
+      393,  435,  435,  435,    0,   24,    0,  417,   21,  435,
+       28,   34,   34,   43,   34,   49,   37,   50,   54,   55,
+       56,  129,  134,  127,   59,   61,  435,  435,  435,  426,
+      411,  390,  435,  435,   38,  420,  419,  435,  421,  435,
+      435,  435,  435,  420,  409,  408,  407,  126,  159,  435,
+      416,  162,  167,  172,    0,  177,   66,   64,    2,  163,
+      173,  168,  135,  177,  178,  179,  182,  180,  183,  181,
+
+      190,  192,  194,  415,  435,  385,  435,  410,  409,  435,
+      435,  411,  435,  410,  435,  399,  398,  197,  206,  407,
+      435,  215,    0,  195,  200,  215,  207,   71,  395,  198,
+      201,  217,  222,  223,  224,  225,  226,  227,  229,  228,
+      230,  332,  435,  435,  345,  231,  318,  233,  317,  232,
+      316,  238,  239,  249,  250,  234,  251,  258,  260,  261,
+      263,  315,  435,  265,  266,  314,  267,  268,  269,  270,
+      313,  272,  279,  277,  312,  278,  287,  281,  311,  282,
+      288,  290,  308,  307,  306,  304,  294,  292,  299,  154,
+      301,  153,  303,  125,  124,   78,   69,  435,  332,  338,
+
+      344,  350,  356,  362,  364,  368,  374,  380,  386,  390,
+      394,  400,  404
     } ;
 
-static yyconst short int yy_def[231] =
+static yyconst short int yy_def[214] =
     {   0,
-      216,  216,  217,  217,  218,  218,  219,  219,  215,    9,
-      215,   11,  215,  215,  215,  215,  215,  215,  215,  215,
-      215,  215,  215,  215,  215,  215,  215,  220,  215,  215,
-      215,  215,  215,  221,  215,  222,  223,  223,  215,  215,
-      215,  215,  215,  223,  223,  223,  223,  223,  223,  223,
-      223,  223,  223,  223,  223,  223,  223,  215,  215,  215,
-      224,  215,  215,  215,  215,  215,  215,  215,  215,  225,
-      215,  215,  215,  215,  226,  227,  223,  228,  223,  215,
-      215,  229,  215,  215,  215,  230,  215,  223,  223,  223,
-      223,  223,  223,  223,  223,  223,  223,  223,  223,  223,
-
-      223,  223,  223,  223,  223,  223,  223,  223,  224,  215,
-      215,  215,  215,  215,  215,  215,  225,  215,  226,  215,
-      227,  228,  223,  215,  229,  215,  215,  230,  223,  223,
-      223,  223,  223,  223,  223,  223,  223,  223,  223,  223,
-      223,  223,  223,  223,  223,  223,  223,  223,  223,  223,
-      223,  215,  215,  215,  223,  223,  223,  223,  223,  223,
-      223,  223,  223,  223,  223,  223,  223,  223,  223,  223,
-      223,  223,  223,  223,  223,  223,  223,  215,  223,  223,
-      223,  223,  223,  223,  223,  223,  223,  223,  223,  223,
-      223,  223,  223,  223,  223,  223,  223,  223,  223,  223,
-
-      223,  223,  223,  223,  223,  223,  223,  223,  223,  223,
-      223,  223,  223,  223,    0,  215,  215,  215,  215,  215,
-      215,  215,  215,  215,  215,  215,  215,  215,  215,  215
+      199,  199,  200,  200,  201,  201,  202,  202,  198,    9,
+        9,   11,  198,  198,  198,  198,  198,  198,  198,  198,
+      198,  198,  198,  198,  198,  198,  198,  203,  198,  198,
+      198,  198,  198,  198,  204,  198,  205,  206,  206,  198,
+      198,  198,  198,  198,  206,  206,  206,  206,  206,  206,
+      206,  206,  206,  206,  206,  206,  198,  198,  198,  207,
+      198,  198,  198,  198,  198,  198,  198,  198,  208,  198,
+      198,  198,  198,  209,  210,  206,  211,  206,  198,  198,
+      212,  198,  198,  198,  213,  198,  206,  206,  206,  206,
+      206,  206,  206,  206,  206,  206,  206,  206,  206,  206,
+
+      206,  206,  206,  207,  198,  198,  198,  198,  198,  198,
+      198,  208,  198,  209,  198,  210,  211,  206,  198,  212,
+      198,  198,  213,  206,  206,  206,  206,  206,  206,  206,
+      206,  206,  206,  206,  206,  206,  206,  206,  206,  206,
+      206,  198,  198,  198,  206,  206,  206,  206,  206,  206,
+      206,  206,  206,  206,  206,  206,  206,  206,  206,  206,
+      206,  206,  198,  206,  206,  206,  206,  206,  206,  206,
+      206,  206,  206,  206,  206,  206,  206,  206,  206,  206,
+      206,  206,  206,  206,  206,  206,  206,  206,  206,  206,
+      206,  206,  206,  206,  206,  206,  206,    0,  198,  198,
+
+      198,  198,  198,  198,  198,  198,  198,  198,  198,  198,
+      198,  198,  198
     } ;
 
-static yyconst short int yy_nxt[533] =
+static yyconst short int yy_nxt[474] =
     {   0,
-      215,   15,   16,   15,   16,   21,   19,   21,   17,   22,
-       17,   22,   21,   33,   78,   21,   33,   60,   18,   61,
-       18,   24,   25,   63,   26,   34,   66,   27,   34,   69,
-       74,   70,   75,   79,   28,   80,   80,   80,   64,   81,
-       83,   82,   84,   84,   85,   78,  113,  114,   78,   67,
-       68,   83,   78,   87,   87,   87,   78,   29,   30,   24,
-       25,   31,   26,   89,   88,   27,   78,   78,   78,   86,
-       78,   78,   28,   90,   95,   78,   78,   78,   78,   92,
-       78,   93,   91,   78,   94,   78,  129,   96,  140,  107,
-      143,  106,  139,   97,  108,   29,   30,   14,   15,   16,
-
-       14,   14,   14,   14,   14,   35,   14,   14,   14,   36,
-       37,   37,   14,   37,   37,   37,   37,   37,   38,   37,
-       37,   37,   37,   37,   37,   37,   37,   37,   37,   37,
-       37,   37,   37,   37,   37,   39,   14,   14,   15,   16,
-       14,   14,   14,   14,   40,   41,   42,   43,   43,   36,
-       37,   37,   14,   44,   37,   45,   46,   47,   48,   37,
-       37,   49,   37,   50,   37,   51,   52,   53,   37,   54,
-       55,   56,   57,   37,   37,   58,   59,   78,   78,   78,
-       78,  124,  124,  124,   78,   78,  127,  127,  127,  102,
-      103,  177,   83,   98,   84,   84,   85,   78,  100,  104,
-
-       99,  101,  123,   78,   83,  105,   85,   85,   85,   83,
-       78,   87,   87,   87,  130,   78,   78,   78,  131,  132,
-       78,   78,   78,   78,   78,  133,   78,   78,   78,   78,
-      141,   78,   78,  135,  134,  142,  145,  138,  136,   78,
-      137,  144,   78,  148,  151,   78,  146,  147,  124,  124,
-      124,  149,  127,  127,  127,   78,   78,  155,  150,   78,
-       78,   78,  158,   78,  159,   78,   78,  156,   78,  162,
-       78,   78,   78,   78,  157,  160,  164,   78,   78,   78,
-       78,  161,  165,   78,  163,   78,   78,  169,  173,  166,
-      167,   78,   78,   78,  171,  168,  170,  175,   78,   78,
-
-      174,  172,   78,   78,   78,  180,  179,  176,  186,   78,
-       78,   78,  181,   78,  182,   78,  191,   78,   78,   78,
-      183,  184,  185,  187,   78,  193,  195,  196,  189,  192,
-      188,   78,  190,   78,   78,   78,   78,   78,   78,  194,
-       78,  200,   78,   78,  202,  198,  205,   78,  197,   78,
-      201,   78,   78,   78,   78,  199,  204,  209,  208,  203,
-      210,   78,  207,  206,   78,   78,   78,  211,   78,  213,
-       78,  214,   78,   78,   78,  212,   14,   14,   14,   14,
-       14,   14,   20,   20,   20,   20,   20,   20,   23,   23,
-       23,   23,   23,   23,   32,   32,   32,   32,   32,   32,
-
-       71,   78,   71,   71,   71,   71,   73,   78,   73,   73,
-       73,   73,   76,   76,   77,   77,   77,   77,  109,  109,
-      109,  109,  109,  109,  117,  117,  117,  117,  117,  117,
-      119,  119,  119,  119,  119,  119,  121,  121,  121,  121,
-      122,  122,  122,  122,  125,  125,  125,  125,  125,  125,
-      128,   78,  128,   78,   78,   78,   78,   78,   78,   78,
-       78,   78,   78,   78,  178,   78,  126,   78,   78,  120,
-      118,  154,  153,  152,  110,  126,   78,   78,   78,  120,
-      118,  116,  115,  112,  111,  110,   78,   72,   65,   62,
-      215,   13,  215,  215,  215,  215,  215,  215,  215,  215,
-
-      215,  215,  215,  215,  215,  215,  215,  215,  215,  215,
-      215,  215,  215,  215,  215,  215,  215,  215,  215,  215,
-      215,  215,  215,  215,  215,  215,  215,  215,  215,  215,
-      215,  215
+      198,   15,   16,   15,   16,   21,   19,   21,   17,   22,
+       17,   22,   33,   34,   77,   33,   34,   59,   18,   60,
+       18,   24,   25,   62,   26,   35,   65,   27,   35,   68,
+       73,   69,   74,   77,   28,  126,   63,   79,   79,   79,
+       80,   82,   81,   83,   83,   84,   77,   66,   67,   77,
+       82,   78,   86,   86,   86,   29,   30,   24,   25,   31,
+       26,   77,   77,   27,   87,   89,   77,   77,   77,   85,
+       28,   77,   88,   77,  108,  109,   77,   90,   77,   91,
+      125,   77,   92,   77,   93,  102,  101,  150,  124,  103,
+       77,   29,   30,   14,   15,   16,   14,   14,   14,   14,
+
+       14,   36,   14,   14,   14,   37,   38,   38,   14,   38,
+       38,   38,   38,   38,   39,   38,   38,   38,   38,   38,
+       38,   38,   38,   38,   38,   38,   38,   38,   38,   40,
+       14,   41,   42,   43,   44,   44,   77,   77,   77,   77,
+       45,   77,   46,   47,   48,   49,   77,   77,   50,   51,
+       98,   99,   52,   53,  118,   54,   94,   55,   56,  100,
+       57,   58,  130,   95,   96,   77,   77,   97,  119,  119,
+      119,  122,  122,  122,   82,   77,   83,   83,   84,   82,
+       77,   84,   84,   84,   82,   77,   86,   86,   86,   77,
+       77,   77,   77,   77,   77,   77,  127,  131,  132,  134,
+
+      129,  128,   77,  133,   77,  136,   77,   77,  135,   77,
+       77,  137,   77,   77,  138,  119,  119,  119,  141,   77,
+      151,  139,  140,  145,  122,  122,  122,   77,  146,   77,
+      147,  152,  148,  149,   77,   77,   77,   77,   77,   77,
+       77,   77,   77,   77,   77,   77,   77,  153,  155,  162,
+       77,   77,  157,  160,  156,  159,  154,  164,  165,  158,
+      161,   77,   77,   77,  166,  169,  171,  172,  167,  168,
+       77,  173,   77,   77,  170,   77,  174,   77,   77,   77,
+       77,   77,   77,  176,   77,  178,  179,  175,  183,   77,
+       77,   77,  181,   77,   77,  180,  177,  184,  185,   77,
+
+       77,  182,   77,  188,   77,  187,   77,  191,  189,  186,
+      192,   77,  190,   77,  193,   77,   77,  194,   77,   77,
+       77,  196,  197,   77,   77,   77,   77,   77,   77,   77,
+       77,  195,   14,   14,   14,   14,   14,   14,   20,   20,
+       20,   20,   20,   20,   23,   23,   23,   23,   23,   23,
+       32,   32,   32,   32,   32,   32,   70,   77,   70,   70,
+       70,   70,   72,  163,   72,   72,   72,   72,   75,   75,
+       76,   76,   76,   76,  104,  104,  104,  104,  104,  104,
+      112,  112,  112,  112,  112,  112,  114,  114,  114,  114,
+      114,  114,  116,  116,  116,  116,  117,  117,  117,  117,
+
+      120,  120,  120,  120,  120,  120,  123,   77,  123,  121,
+       77,   77,  115,  113,  144,  143,  142,  105,  121,   77,
+       77,   77,  115,  113,  111,  110,  107,  106,  105,   77,
+       71,   64,   61,  198,   13,  198,  198,  198,  198,  198,
+      198,  198,  198,  198,  198,  198,  198,  198,  198,  198,
+      198,  198,  198,  198,  198,  198,  198,  198,  198,  198,
+      198,  198,  198,  198,  198,  198,  198,  198,  198,  198,
+      198,  198,  198
     } ;
 
-static yyconst short int yy_chk[533] =
+static yyconst short int yy_chk[474] =
     {   0,
         0,    1,    1,    2,    2,    3,    2,    4,    1,    3,
-        2,    4,    7,    7,   38,    8,    8,   17,    1,   17,
+        2,    4,    7,    7,   89,    8,    8,   17,    1,   17,
         2,    5,    5,   19,    5,    7,   26,    5,    8,   27,
-       35,   27,   35,   38,    5,   40,   40,   40,   19,   41,
-       42,   41,   42,   42,   42,   44,   66,   66,  214,   26,
-       26,   43,   45,   43,   43,   43,   46,    5,    5,    6,
-        6,    6,    6,   45,   44,    6,   47,   48,   49,   42,
-       50,   51,    6,   46,   50,   56,   88,   57,   97,   48,
-       98,   48,   47,  213,   49,  101,   88,   50,   98,   57,
-      101,   56,   97,   51,   57,    6,    6,    9,    9,    9,
+       36,   27,   36,   39,    5,   89,   19,   41,   41,   41,
+       42,   43,   42,   43,   43,   43,   45,   26,   26,   47,
+       44,   39,   44,   44,   44,    5,    5,    6,    6,    6,
+        6,   46,   48,    6,   45,   47,   49,   50,   51,   43,
+        6,   55,   46,   56,   65,   65,   88,   48,   87,   49,
+       88,  197,   50,  128,   51,   56,   55,  128,   87,   56,
+      196,    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,   11,   11,   11,
-       11,   11,   11,   11,   11,   11,   11,   11,   11,   11,
-       11,   11,   11,   11,   11,   11,   11,   11,   11,   11,
-       11,   11,   11,   11,   11,   11,   11,   11,   11,   11,
-       11,   11,   11,   11,   11,   11,   11,   52,   54,   53,
-       55,   80,   80,   80,  151,   79,   83,   83,   83,   54,
-       54,  151,   84,   52,   84,   84,   84,   90,   53,   54,
-
-       52,   53,   79,   91,   85,   55,   85,   85,   85,   87,
-       89,   87,   87,   87,   89,   92,   93,   94,   89,   90,
-       95,   96,   99,  100,  102,   91,  103,  104,  212,  105,
-       99,  106,  108,   93,   92,  100,  103,   96,   94,  107,
-       95,  102,  123,  106,  108,  129,  104,  105,  124,  124,
-      124,  106,  127,  127,  127,  130,  131,  123,  107,  132,
-      133,  134,  131,  137,  132,  135,  138,  129,  139,  135,
-      140,  141,  142,  143,  130,  133,  138,  144,  145,  146,
-      147,  134,  139,  148,  137,  149,  150,  143,  147,  140,
-      141,  156,  158,  161,  145,  142,  144,  149,  159,  162,
-
-      148,  146,  166,  167,  168,  158,  156,  150,  168,  170,
-      172,  169,  159,  174,  161,  175,  172,  176,  179,  181,
-      162,  166,  167,  169,  171,  175,  179,  181,  171,  174,
-      170,  184,  171,  185,  186,  187,  189,  190,  191,  176,
-      193,  187,  194,  197,  190,  185,  194,  195,  184,  199,
-      189,  198,  204,  205,  206,  186,  193,  199,  198,  191,
-      204,  208,  197,  195,  210,  211,  209,  205,  207,  208,
-      203,  210,  202,  201,  200,  206,  216,  216,  216,  216,
-      216,  216,  217,  217,  217,  217,  217,  217,  218,  218,
-      218,  218,  218,  218,  219,  219,  219,  219,  219,  219,
-
-      220,  196,  220,  220,  220,  220,  221,  192,  221,  221,
-      221,  221,  222,  222,  223,  223,  223,  223,  224,  224,
-      224,  224,  224,  224,  225,  225,  225,  225,  225,  225,
-      226,  226,  226,  226,  226,  226,  227,  227,  227,  227,
-      228,  228,  228,  228,  229,  229,  229,  229,  229,  229,
-      230,  188,  230,  183,  182,  180,  177,  173,  165,  164,
-      163,  160,  157,  155,  152,  136,  125,  122,  121,  119,
-      117,  114,  113,  111,  109,   82,   78,   77,   76,   75,
-       70,   68,   67,   63,   62,   61,   37,   31,   22,   18,
-       13,  215,  215,  215,  215,  215,  215,  215,  215,  215,
-
-      215,  215,  215,  215,  215,  215,  215,  215,  215,  215,
-      215,  215,  215,  215,  215,  215,  215,  215,  215,  215,
-      215,  215,  215,  215,  215,  215,  215,  215,  215,  215,
-      215,  215
+        9,   11,   11,   11,   11,   11,  195,  194,   78,   54,
+       11,   52,   11,   11,   11,   11,   53,   93,   11,   11,
+       54,   54,   11,   11,   78,   11,   52,   11,   11,   54,
+       11,   11,   93,   52,   53,  192,  190,   53,   79,   79,
+       79,   82,   82,   82,   83,   90,   83,   83,   83,   84,
+       92,   84,   84,   84,   86,   91,   86,   86,   86,   94,
+       95,   96,   98,  100,   97,   99,   90,   94,   95,   97,
+
+       92,   91,  101,   96,  102,   99,  103,  124,   98,  118,
+      130,  100,  125,  131,  101,  119,  119,  119,  103,  127,
+      130,  101,  102,  118,  122,  122,  122,  126,  124,  132,
+      125,  131,  126,  127,  133,  134,  135,  136,  137,  138,
+      140,  139,  141,  146,  150,  148,  156,  132,  134,  141,
+      152,  153,  136,  139,  135,  138,  133,  146,  148,  137,
+      140,  154,  155,  157,  150,  154,  156,  157,  152,  153,
+      158,  157,  159,  160,  155,  161,  158,  164,  165,  167,
+      168,  169,  170,  160,  172,  164,  165,  159,  170,  174,
+      176,  173,  168,  178,  180,  167,  161,  172,  173,  177,
+
+      181,  169,  182,  177,  188,  176,  187,  181,  178,  174,
+      182,  189,  180,  191,  187,  193,  186,  188,  185,  184,
+      183,  191,  193,  179,  175,  171,  166,  162,  151,  149,
+      147,  189,  199,  199,  199,  199,  199,  199,  200,  200,
+      200,  200,  200,  200,  201,  201,  201,  201,  201,  201,
+      202,  202,  202,  202,  202,  202,  203,  145,  203,  203,
+      203,  203,  204,  142,  204,  204,  204,  204,  205,  205,
+      206,  206,  206,  206,  207,  207,  207,  207,  207,  207,
+      208,  208,  208,  208,  208,  208,  209,  209,  209,  209,
+      209,  209,  210,  210,  210,  210,  211,  211,  211,  211,
+
+      212,  212,  212,  212,  212,  212,  213,  129,  213,  120,
+      117,  116,  114,  112,  109,  108,  106,  104,   81,   77,
+       76,   75,   74,   69,   67,   66,   62,   61,   60,   38,
+       31,   22,   18,   13,  198,  198,  198,  198,  198,  198,
+      198,  198,  198,  198,  198,  198,  198,  198,  198,  198,
+      198,  198,  198,  198,  198,  198,  198,  198,  198,  198,
+      198,  198,  198,  198,  198,  198,  198,  198,  198,  198,
+      198,  198,  198
     } ;
 
 static yy_state_type yy_state_buf[YY_BUF_SIZE + 2], *yy_state_ptr;
@@ -624,6 +602,7 @@ static int class_after_c = FALSE;
 static int header_c = FALSE;
 
 static GString *cbuf = NULL;
+int ccode_line = 1;
 
 int line_no = 1;
 
@@ -657,7 +636,7 @@ add_to_cbuf(char *s)
 
 #define CLASS_CODE_I 5
 
-#line 661 "lex.yy.c"
+#line 640 "lex.yy.c"
 
 /* Macros after this point can all be overridden by user definitions in
  * section 1.
@@ -811,10 +790,10 @@ YY_DECL
        register char *yy_cp, *yy_bp;
        register int yy_act;
 
-#line 65 "lexer.l"
+#line 66 "lexer.l"
 
 
-#line 818 "lex.yy.c"
+#line 797 "lex.yy.c"
 
        if ( yy_init )
                {
@@ -863,14 +842,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 >= 216 )
+                               if ( yy_current_state >= 199 )
                                        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] != 492 );
+               while ( yy_base[yy_current_state] != 435 );
 
 yy_find_action:
                yy_current_state = *--yy_state_ptr;
@@ -901,7 +880,7 @@ do_action:  /* This label is used only to access EOF actions. */
        { /* beginning of action switch */
 case 1:
 YY_RULE_SETUP
-#line 67 "lexer.l"
+#line 68 "lexer.l"
 { line_no++; REJECT; }
        YY_BREAK
 case 2:
@@ -909,7 +888,7 @@ case 2:
 yy_c_buf_p = yy_cp -= 1;
 YY_DO_BEFORE_ACTION; /* set up yytext again */
 YY_RULE_SETUP
-#line 69 "lexer.l"
+#line 70 "lexer.l"
 { ; /*comment, ignore*/ }
        YY_BREAK
 case 3:
@@ -917,7 +896,7 @@ case 3:
 yy_c_buf_p = yy_cp -= 1;
 YY_DO_BEFORE_ACTION; /* set up yytext again */
 YY_RULE_SETUP
-#line 70 "lexer.l"
+#line 71 "lexer.l"
 { ; /*comment, ignore*/ }
        YY_BREAK
 case 4:
@@ -925,7 +904,7 @@ case 4:
 yy_c_buf_p = yy_cp -= 1;
 YY_DO_BEFORE_ACTION; /* set up yytext again */
 YY_RULE_SETUP
-#line 71 "lexer.l"
+#line 72 "lexer.l"
 { ; /*comment, ignore*/ }
        YY_BREAK
 case 5:
@@ -933,64 +912,71 @@ case 5:
 yy_c_buf_p = yy_cp -= 1;
 YY_DO_BEFORE_ACTION; /* set up yytext again */
 YY_RULE_SETUP
-#line 72 "lexer.l"
+#line 73 "lexer.l"
 { ; /*comment, ignore*/ }
        YY_BREAK
 case 6:
 YY_RULE_SETUP
-#line 73 "lexer.l"
+#line 74 "lexer.l"
 {BEGIN(COMMENT); before_comment = INITIAL; }
        YY_BREAK
 case 7:
 YY_RULE_SETUP
-#line 74 "lexer.l"
+#line 75 "lexer.l"
 {BEGIN(COMMENT); before_comment = C_CODE; }
        YY_BREAK
 case 8:
 YY_RULE_SETUP
-#line 75 "lexer.l"
+#line 76 "lexer.l"
 {BEGIN(COMMENT); before_comment = CLASS_CODE; }
        YY_BREAK
 case 9:
 YY_RULE_SETUP
-#line 76 "lexer.l"
+#line 77 "lexer.l"
 {BEGIN(COMMENT); before_comment = CLASS_CODE_I; }
        YY_BREAK
 case 10:
 YY_RULE_SETUP
-#line 77 "lexer.l"
+#line 78 "lexer.l"
 {BEGIN(before_comment);}
        YY_BREAK
 case 11:
 YY_RULE_SETUP
-#line 78 "lexer.l"
+#line 79 "lexer.l"
 { ; /* comment, ignore */ }
        YY_BREAK
 case 12:
 YY_RULE_SETUP
 #line 80 "lexer.l"
+{ ; /* comment, ignore */ }
+       YY_BREAK
+case 13:
+YY_RULE_SETUP
+#line 82 "lexer.l"
 {
                        BEGIN(C_CODE);
                        parenth_depth = 1;
                        class_after_c = FALSE;
                        header_c = TRUE;
                        clear_cbuf();
+                       ccode_line = line_no;
                }
        YY_BREAK
-case 13:
+case 14:
 YY_RULE_SETUP
-#line 87 "lexer.l"
+#line 90 "lexer.l"
 {
                        BEGIN(C_CODE);
                        parenth_depth = 1;
                        class_after_c = FALSE;
                        header_c = FALSE;
                        clear_cbuf();
+                       ccode_line = line_no;
                }
        YY_BREAK
-case 14:
+case 15:
 YY_RULE_SETUP
-#line 94 "lexer.l"
+#line 98 "lexer.l"
 {
                        BEGIN(INITIAL);
                        yylval.cbuf = cbuf;
@@ -1001,51 +987,43 @@ YY_RULE_SETUP
                                return CCODE;
                }
        YY_BREAK
-case 15:
-YY_RULE_SETUP
-#line 104 "lexer.l"
-{ add_to_cbuf(yytext); }
-       YY_BREAK
 case 16:
 YY_RULE_SETUP
-#line 105 "lexer.l"
+#line 108 "lexer.l"
 { add_to_cbuf(yytext); }
        YY_BREAK
 case 17:
 YY_RULE_SETUP
-#line 106 "lexer.l"
+#line 109 "lexer.l"
 { add_to_cbuf(yytext); }
        YY_BREAK
 case 18:
 YY_RULE_SETUP
-#line 107 "lexer.l"
+#line 110 "lexer.l"
 { add_to_cbuf(yytext); }
        YY_BREAK
 case 19:
 YY_RULE_SETUP
-#line 109 "lexer.l"
+#line 111 "lexer.l"
 { add_to_cbuf(yytext); }
        YY_BREAK
 case 20:
 YY_RULE_SETUP
-#line 110 "lexer.l"
-{
-                       BEGIN(C_CODE_STRING);
-                       add_to_cbuf(yytext);
-               }
+#line 113 "lexer.l"
+{ add_to_cbuf(yytext); }
        YY_BREAK
 case 21:
 YY_RULE_SETUP
 #line 114 "lexer.l"
 {
-                               add_to_cbuf(yytext);
-                       }
+                       BEGIN(C_CODE_STRING);
+                       add_to_cbuf(yytext);
+               }
        YY_BREAK
 case 22:
 YY_RULE_SETUP
-#line 117 "lexer.l"
+#line 118 "lexer.l"
 {
-                               BEGIN(C_CODE);
                                add_to_cbuf(yytext);
                        }
        YY_BREAK
@@ -1053,20 +1031,28 @@ case 23:
 YY_RULE_SETUP
 #line 121 "lexer.l"
 {
+                               BEGIN(C_CODE);
                                add_to_cbuf(yytext);
                        }
        YY_BREAK
 case 24:
 YY_RULE_SETUP
 #line 125 "lexer.l"
+{
+                               add_to_cbuf(yytext);
+                       }
+       YY_BREAK
+case 25:
+YY_RULE_SETUP
+#line 129 "lexer.l"
 {
                        parenth_depth++;
                        add_to_cbuf(yytext);
                }
        YY_BREAK
-case 25:
+case 26:
 YY_RULE_SETUP
-#line 129 "lexer.l"
+#line 133 "lexer.l"
 {
                        parenth_depth--;
                        if(parenth_depth<0) {
@@ -1080,218 +1066,195 @@ YY_RULE_SETUP
                        add_to_cbuf(yytext);
                }
        YY_BREAK
-case 26:
+case 27:
 YY_RULE_SETUP
-#line 142 "lexer.l"
+#line 146 "lexer.l"
 { add_to_cbuf(yytext); }
        YY_BREAK
-case 27:
+case 28:
 YY_RULE_SETUP
-#line 143 "lexer.l"
+#line 147 "lexer.l"
 { add_to_cbuf(yytext); }
        YY_BREAK
-case 28:
+case 29:
 YY_RULE_SETUP
-#line 145 "lexer.l"
+#line 149 "lexer.l"
 {
                        BEGIN(CLASS_CODE);
                        return CLASS;
                }
        YY_BREAK
-case 29:
-YY_RULE_SETUP
-#line 150 "lexer.l"
-{return FROM;}
-       YY_BREAK
 case 30:
 YY_RULE_SETUP
-#line 152 "lexer.l"
-{return VOID;}
+#line 154 "lexer.l"
+{return FROM;}
        YY_BREAK
 case 31:
 YY_RULE_SETUP
-#line 153 "lexer.l"
-{return STRUCT;}
+#line 156 "lexer.l"
+{return VOID;}
        YY_BREAK
 case 32:
 YY_RULE_SETUP
-#line 154 "lexer.l"
-{return UNION;}
+#line 157 "lexer.l"
+{return STRUCT;}
        YY_BREAK
 case 33:
 YY_RULE_SETUP
-#line 155 "lexer.l"
-{return ENUM;}
+#line 158 "lexer.l"
+{return UNION;}
        YY_BREAK
 case 34:
 YY_RULE_SETUP
-#line 156 "lexer.l"
-{return SIGNED;}
+#line 159 "lexer.l"
+{return ENUM;}
        YY_BREAK
 case 35:
 YY_RULE_SETUP
-#line 157 "lexer.l"
-{return UNSIGNED;}
+#line 160 "lexer.l"
+{return SIGNED;}
        YY_BREAK
 case 36:
 YY_RULE_SETUP
-#line 158 "lexer.l"
-{return LONG;}
+#line 161 "lexer.l"
+{return UNSIGNED;}
        YY_BREAK
 case 37:
 YY_RULE_SETUP
-#line 159 "lexer.l"
-{return SHORT;}
+#line 162 "lexer.l"
+{return LONG;}
        YY_BREAK
 case 38:
 YY_RULE_SETUP
-#line 160 "lexer.l"
-{return INT;}
+#line 163 "lexer.l"
+{return SHORT;}
        YY_BREAK
 case 39:
 YY_RULE_SETUP
-#line 161 "lexer.l"
-{return FLOAT;}
+#line 164 "lexer.l"
+{return INT;}
        YY_BREAK
 case 40:
 YY_RULE_SETUP
-#line 162 "lexer.l"
-{return DOUBLE;}
-       YY_BREAK
-case 41:
-YY_RULE_SETUP
-#line 163 "lexer.l"
-{return CHAR;}
-       YY_BREAK
-case 42:
-YY_RULE_SETUP
 #line 165 "lexer.l"
-{yylval.line = line_no; return PUBLIC;}
+{return FLOAT;}
        YY_BREAK
-case 43:
+case 41:
 YY_RULE_SETUP
 #line 166 "lexer.l"
-{yylval.line = line_no; return PRIVATE;}
+{return DOUBLE;}
        YY_BREAK
-case 44:
+case 42:
 YY_RULE_SETUP
 #line 167 "lexer.l"
-{yylval.line = line_no; return ARGUMENT;}
-       YY_BREAK
-case 45:
-YY_RULE_SETUP
-#line 168 "lexer.l"
-{yylval.line = line_no; return VIRTUAL;}
+{return CHAR;}
        YY_BREAK
-case 46:
+case 43:
 YY_RULE_SETUP
 #line 169 "lexer.l"
-{yylval.line = line_no; return SIGNAL;}
+{yylval.line = line_no; return PUBLIC;}
        YY_BREAK
-case 47:
+case 44:
 YY_RULE_SETUP
 #line 170 "lexer.l"
-{return LAST;}
+{yylval.line = line_no; return PRIVATE;}
        YY_BREAK
-case 48:
+case 45:
 YY_RULE_SETUP
 #line 171 "lexer.l"
-{return FIRST;}
+{yylval.line = line_no; return ARGUMENT;}
        YY_BREAK
-case 49:
+case 46:
 YY_RULE_SETUP
 #line 172 "lexer.l"
-{yylval.line = line_no; return OVERRIDE;}
+{yylval.line = line_no; return VIRTUAL;}
        YY_BREAK
-case 50:
+case 47:
 YY_RULE_SETUP
 #line 173 "lexer.l"
-{return CHECK;}
+{yylval.line = line_no; return SIGNAL;}
        YY_BREAK
-case 51:
+case 48:
 YY_RULE_SETUP
 #line 174 "lexer.l"
-{return CNULL;}
+{yylval.line = line_no; return OVERRIDE;}
        YY_BREAK
-case 52:
+case 49:
 YY_RULE_SETUP
 #line 175 "lexer.l"
-{return TYPE;}
-       YY_BREAK
-case 53:
-YY_RULE_SETUP
-#line 176 "lexer.l"
 {return ONERROR;}
        YY_BREAK
-case 54:
+case 50:
 YY_RULE_SETUP
-#line 177 "lexer.l"
+#line 176 "lexer.l"
 {
                        yylval.id = g_strdup(yytext);
                        return NUMBER;
                }
        YY_BREAK
-case 55:
+case 51:
 YY_RULE_SETUP
-#line 181 "lexer.l"
+#line 180 "lexer.l"
 {
                        yylval.id = g_strdup(yytext);
                        return TYPETOKEN;
                }
        YY_BREAK
-case 56:
+case 52:
 YY_RULE_SETUP
-#line 185 "lexer.l"
+#line 184 "lexer.l"
 {
                        yylval.id = g_strdup(yytext);
                        return TOKEN;
                }
        YY_BREAK
-case 57:
+case 53:
 YY_RULE_SETUP
-#line 190 "lexer.l"
+#line 189 "lexer.l"
 {
                        BEGIN(CLASS_CODE_I);
                        return '{';
                }
        YY_BREAK
-case 58:
+case 54:
 YY_RULE_SETUP
-#line 194 "lexer.l"
+#line 193 "lexer.l"
 {
                        BEGIN(C_CODE);
                        parenth_depth=1;
                        class_after_c = TRUE;
+                       ccode_line = line_no;
+                       yylval.line = line_no;
                        return '{';
                }
        YY_BREAK
-case 59:
+case 55:
 YY_RULE_SETUP
-#line 200 "lexer.l"
+#line 201 "lexer.l"
 {
                                BEGIN(INITIAL);
                                return '}';
                        }
        YY_BREAK
-case 60:
+case 56:
 YY_RULE_SETUP
-#line 205 "lexer.l"
+#line 206 "lexer.l"
 ;  /*ignore*/
        YY_BREAK
-case 61:
+case 57:
 YY_RULE_SETUP
-#line 207 "lexer.l"
+#line 208 "lexer.l"
 {
                        yylval.line = line_no;
                        return yytext[0];
                }
        YY_BREAK
-case 62:
+case 58:
 YY_RULE_SETUP
-#line 211 "lexer.l"
+#line 212 "lexer.l"
 ECHO;
        YY_BREAK
-#line 1295 "lex.yy.c"
+#line 1258 "lex.yy.c"
                        case YY_STATE_EOF(INITIAL):
                        case YY_STATE_EOF(COMMENT):
                        case YY_STATE_EOF(C_CODE):
@@ -1586,7 +1549,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 >= 216 )
+                       if ( yy_current_state >= 199 )
                                yy_c = yy_meta[(unsigned int) yy_c];
                        }
                yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
@@ -1616,11 +1579,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 >= 216 )
+               if ( yy_current_state >= 199 )
                        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 == 215);
+       yy_is_jam = (yy_current_state == 198);
        if ( ! yy_is_jam )
                *yy_state_ptr++ = yy_current_state;
 
@@ -2178,4 +2141,4 @@ int main()
        return 0;
        }
 #endif
-#line 211 "lexer.l"
+#line 212 "lexer.l"
index ebfc1871ea9af15b784fb4f86a9de9fc451431c4..5f9f7423a211958a0cf35e100e055e0d7dda1d7a 100644 (file)
@@ -31,6 +31,7 @@ static int class_after_c = FALSE;
 static int header_c = FALSE;
 
 static GString *cbuf = NULL;
+int ccode_line = 1;
 
 int line_no = 1;
 
@@ -76,6 +77,7 @@ add_to_cbuf(char *s)
 <CLASS_CODE_I>\/\*     {BEGIN(COMMENT); before_comment = CLASS_CODE_I; }
 <COMMENT>\*\/  {BEGIN(before_comment);}
 <COMMENT>.     { ; /* comment, ignore */ }
+<COMMENT>\n    { ; /* comment, ignore */ }
 
 ^\%h\{         {
                        BEGIN(C_CODE);
@@ -83,6 +85,7 @@ add_to_cbuf(char *s)
                        class_after_c = FALSE;
                        header_c = TRUE;
                        clear_cbuf();
+                       ccode_line = line_no;
                }
 ^\%\{          {
                        BEGIN(C_CODE);
@@ -90,6 +93,7 @@ add_to_cbuf(char *s)
                        class_after_c = FALSE;
                        header_c = FALSE;
                        clear_cbuf();
+                       ccode_line = line_no;
                }
 <C_CODE>^\%\}  {
                        BEGIN(INITIAL);
@@ -167,12 +171,7 @@ class              {
 <CLASS_CODE_I>argument {yylval.line = line_no; return ARGUMENT;}
 <CLASS_CODE_I>virtual  {yylval.line = line_no; return VIRTUAL;}
 <CLASS_CODE_I>signal   {yylval.line = line_no; return SIGNAL;}
-<CLASS_CODE_I>last     {return LAST;}
-<CLASS_CODE_I>first    {return FIRST;}
 <CLASS_CODE_I>override {yylval.line = line_no; return OVERRIDE;}
-<CLASS_CODE_I>check    {return CHECK;}
-<CLASS_CODE_I>null     {return CNULL;}
-<CLASS_CODE_I>type     {return TYPE;}
 <CLASS_CODE_I>onerror  {return ONERROR;}
 <CLASS_CODE_I>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);
@@ -195,6 +194,8 @@ class               {
                        BEGIN(C_CODE);
                        parenth_depth=1;
                        class_after_c = TRUE;
+                       ccode_line = line_no;
+                       yylval.line = line_no;
                        return '{';
                }
 <CLASS_CODE_I>\}       {
index 02db339d0109ca0c53fdc775c8c119c358020a5d..be842c647cafe1e18729812dc07fb769b08585e5 100644 (file)
@@ -28,6 +28,7 @@
 
 #include "tree.h"
 #include "parse.h"
+#include "out.h"
 
 char *filename = "stdin";
 
@@ -38,7 +39,7 @@ extern FILE * yyin;
 extern Node *class;
 extern GList *nodes;
 
-static char *filebase;
+char *filebase;
 static char *funcbase;
 static char *pfuncbase;
 static char *macrobase;
@@ -46,8 +47,11 @@ static char *macrois;
 static char *typebase;
 static char *ptypebase;
 
-static FILE *out;
-static FILE *outh;
+static int signals = 0;
+static int arguments = 0;
+
+FILE *out;
+FILE *outh;
 
 int exit_on_warn = FALSE;
 
@@ -163,7 +167,7 @@ def_methods(Class *c)
 {
        GList *li;
        
-       fprintf(out,"\n");
+       out_printf(out,"\n");
        for(li=c->nodes;li;li=g_list_next(li)) {
                Node *node = li->data;
                if(node->type == METHOD_NODE) {
@@ -174,10 +178,10 @@ def_methods(Class *c)
                           m->scope == OVERRIDE_METHOD)
                                continue;
                        
-                       fprintf(out,"#define %s %s_%s\n",m->id,funcbase,m->id); 
+                       out_printf(out,"#define %s %s_%s\n",m->id,funcbase,m->id); 
                }
        }
-       fprintf(out,"\n");
+       out_printf(out,"\n");
 }
 
 static void
@@ -185,7 +189,7 @@ undef_methods(Class *c)
 {
        GList *li;
        
-       fprintf(out,"\n");
+       out_printf(out,"\n");
        for(li=c->nodes;li;li=g_list_next(li)) {
                Node *node = li->data;
                if(node->type == METHOD_NODE) {
@@ -196,10 +200,10 @@ undef_methods(Class *c)
                           m->scope == OVERRIDE_METHOD)
                                continue;
                        
-                       fprintf(out,"#undef %s\n",m->id); 
+                       out_printf(out,"#undef %s\n",m->id); 
                }
        }
-       fprintf(out,"\n");
+       out_printf(out,"\n");
 }
 
 static void
@@ -208,22 +212,22 @@ print_type(FILE *fp, Type *t)
        char *s;
        int i;
        s = remove_sep(t->name);
-       fprintf(fp,"%s ",s); 
+       out_printf(fp,"%s ",s); 
        g_free(s);
        
        for(i=0;i<t->stars;i++)
-               fprintf(fp,"*"); 
+               out_printf(fp,"*"); 
 }
 
 static void
 put_variable(Variable *v)
 {
-       fprintf(outh,"\t");
+       out_printf(outh,"\t");
        if(v->scope == PRIVATE_SCOPE)
-               fprintf(outh,"/* private */ "); 
+               out_printf(outh,"/* private */ "); 
        print_type(outh,v->vtype);
 
-       fprintf(outh,"%s;\n",v->id); 
+       out_printf(outh,"%s;\n",v->id); 
 }
 
 static void
@@ -232,21 +236,25 @@ print_method(FILE *fp, char *typeprefix, char *nameprefix,
 {
        GList *li;
 
-       fprintf(fp,"%s",typeprefix); 
+       out_printf(fp,"%s",typeprefix); 
        print_type(fp,m->mtype);
-       fprintf(fp,"%s%s_%s%s(",
+       out_printf(fp,"%s%s_%s%s(",
                nameprefix,funcbase,m->id,namepostfix); 
        
-       for(li=m->args;li;li=g_list_next(li)) {
-               FuncArg *arg = li->data;
-               print_type(fp,arg->atype);
-               if(li->next)
-                       fprintf(fp,"%s, ",arg->name); 
-               else
-                       fprintf(fp,"%s",arg->name); 
+       if(m->args) {
+               for(li=m->args;li;li=g_list_next(li)) {
+                       FuncArg *arg = li->data;
+                       print_type(fp,arg->atype);
+                       if(li->next)
+                               out_printf(fp,"%s, ",arg->name); 
+                       else
+                               out_printf(fp,"%s",arg->name); 
 
+               }
+       } else {
+               out_printf(fp,"void"); 
        }
-       fprintf(fp,")%s\n",postfix); 
+       out_printf(fp,")%s\n",postfix); 
 }
 
 static void
@@ -333,7 +341,7 @@ make_inits(Class *cl)
                                  (Type *)new_type(0,g_strdup("void")),
                                  NULL,NULL,g_strdup("class_init"),
                                  make_init_args(cl,g_strdup("c"),TRUE),
-                                 NULL, NULL,0);
+                                 NULL, NULL,0,0);
                cl->nodes = g_list_prepend(cl->nodes,node);
        }
        if(!got_init) {
@@ -341,7 +349,7 @@ make_inits(Class *cl)
                                  (Type *)new_type(0,g_strdup("void")),
                                  NULL,NULL,g_strdup("init"),
                                  make_init_args(cl,g_strdup("o"),FALSE),
-                                 NULL, NULL,0);
+                                 NULL, NULL,0,0);
                cl->nodes = g_list_prepend(cl->nodes,node);
        }
 }
@@ -370,19 +378,19 @@ add_signal_prots(Method *m)
        
        g_hash_table_insert(marsh,m,s);
        
-       fprintf(out,"\ntypedef ");
+       out_printf(out,"\ntypedef ");
        print_type(out,m->mtype);
        
-       fprintf(out,"(*%s) (",s);
+       out_printf(out,"(*%s) (",s);
        
        for(li=m->args;li;li=g_list_next(li)) {
                FuncArg *arg = li->data;
                print_type(out,arg->atype);
-               fprintf(out,", "); 
+               out_printf(out,", "); 
        }
-       fprintf(out,"gpointer);\n"); 
+       out_printf(out,"gpointer);\n"); 
        
-       fprintf(out,"\nstatic void\n"
+       out_printf(out,"\nstatic void\n"
                "marshal_%s (GtkObject * object,\n"
                "\tGtkSignalFunc func,\n"
                "\tgpointer func_data,\n"
@@ -391,22 +399,22 @@ add_signal_prots(Method *m)
        
        if(strcmp(m->gtktypes->data,"NONE")==0) {
                int i;
-               fprintf(out, "\t%s rfunc;\n\n"
+               out_printf(out, "\t%s rfunc;\n\n"
                        "\trfunc = (%s)func;\n\n"
                        "\t(*rfunc)((%s *)object",s,s,typebase);
                if(strcmp(m->gtktypes->next->data,"NONE")!=0) {
                        for(i=0,li=m->gtktypes->next;li;
                            i++,li=g_list_next(li)) {
-                               fprintf(out, ",\n\t\tGTK_VALUE_%s(args[%d])",
+                               out_printf(out, ",\n\t\tGTK_VALUE_%s(args[%d])",
                                        (char *)li->data,i);
                        }
                }
-               fprintf(out, ",\n\t\tfunc_data);\n}\n\n");
+               out_printf(out, ",\n\t\tfunc_data);\n}\n\n");
        } else {
                int i;
-               fprintf(out, "\t%s rfunc;\n\t",s);
+               out_printf(out, "\t%s rfunc;\n\t",s);
                print_type(out,m->mtype);
-               fprintf(out, " *retval;\n\n"
+               out_printf(out, " *retval;\n\n"
                        "\trfunc = (%s)func;\n\n"
                        "\tretval = GTK_RETLOC_%s(args[%d]);\n\n"
                        "\t*retval = (*rfunc)((%s *)object",
@@ -415,11 +423,11 @@ add_signal_prots(Method *m)
                if(strcmp(m->gtktypes->next->data,"NONE")!=0) {
                        for(i=0,li=m->gtktypes->next;li;
                            i++,li=g_list_next(li)) {
-                               fprintf(out, ",\n\t\tGTK_VALUE_%s(args[%d])",
+                               out_printf(out, ",\n\t\tGTK_VALUE_%s(args[%d])",
                                        (char *)li->data,i);
                        }
                }
-               fprintf(out, ",\n\t\tfunc_data);\n}\n\n");
+               out_printf(out, ",\n\t\tfunc_data);\n}\n\n");
        }
 
 }
@@ -428,43 +436,50 @@ static void
 add_enums(Class *c)
 {
        GList *li;
-       fprintf(out,"\nenum {\n");
-       for(li=c->nodes;li;li=g_list_next(li)) {
-               Node *n = li->data;
-               if(n->type == METHOD_NODE) {
-                       Method *m = (Method *)n;
-                       if(m->scope == SIGNAL_LAST_METHOD ||
-                          m->scope == SIGNAL_FIRST_METHOD) {
-                               char *s = g_strdup(m->id);
-                               g_strup(s);
-                               fprintf(out,"\t%s_SIGNAL,\n",s);
-                               g_free(s);
+       out_printf(out,"\n");
+       if(signals>0) {
+               out_printf(out,"enum {\n");
+               for(li=c->nodes;li;li=g_list_next(li)) {
+                       Node *n = li->data;
+                       if(n->type == METHOD_NODE) {
+                               Method *m = (Method *)n;
+                               if(m->scope == SIGNAL_LAST_METHOD ||
+                                  m->scope == SIGNAL_FIRST_METHOD) {
+                                       char *s = g_strdup(m->id);
+                                       g_strup(s);
+                                       out_printf(out,"\t%s_SIGNAL,\n",s);
+                                       g_free(s);
+                               }
                        }
                }
+               out_printf(out,"\tLAST_SIGNAL\n};\n\n");
        }
-       fprintf(out,"\tLAST_SIGNAL\n"
-               "};\n\n"
-               "enum {\n"
-               "\tARG_0,\n");
-       for(li=c->nodes;li;li=g_list_next(li)) {
-               Node *n = li->data;
-               if(n->type == ARGUMENT_NODE) {
-                       Argument *a = (Argument *)n;
-                       char *s = g_strdup(a->name);
-                       g_strup(s);
-                       fprintf(out,"\tARG_%s,\n",s);
-                       g_free(s);
+       if(arguments>0) {
+               out_printf(out,"enum {\n\tARG_0,\n");
+               for(li=c->nodes;li;li=g_list_next(li)) {
+                       Node *n = li->data;
+                       if(n->type == ARGUMENT_NODE) {
+                               Argument *a = (Argument *)n;
+                               char *s = g_strdup(a->name);
+                               g_strup(s);
+                               out_printf(out,"\tARG_%s,\n",s);
+                               g_free(s);
+                       }
                }
+               out_printf(out, "};\n\n");
        }
-       fprintf(out, "};\n\n"
-               "static guint object_signals[LAST_SIGNAL] = {0};\n\n"
-               "static %sClass *parent_class = NULL;\n\n",ptypebase);
+
+       if(signals>0)
+               out_printf(out,
+                          "static guint object_signals[LAST_SIGNAL] = {0};\n\n");
+
+       out_printf(out, "static %sClass *parent_class = NULL;\n\n",ptypebase);
 }
 
 static void
 add_get_type(void)
 {
-       fprintf(out, "guint\n"
+       out_printf(out, "guint\n"
                "%s_get_type (void)\n"
                "{\n"
                "\tstatic guint type = 0;\n\n"
@@ -517,7 +532,7 @@ add_overrides(Class *c, char *oname)
                f = replace_sep(m->otype,'_');
                g_strdown(f);
 
-               fprintf(out,"\t%sClass *%s_class = (%sClass *)%s;\n",
+               out_printf(out,"\t%sClass *%s_class = (%sClass *)%s;\n",
                        s,f,s,oname);
                
                g_free(f);
@@ -531,7 +546,7 @@ add_signals(Class *c)
 {
        GList *li;
 
-       fprintf(out,"\n");
+       out_printf(out,"\n");
        for(li=c->nodes;li;li=g_list_next(li)) {
                Node *n = li->data;
                Method *m;
@@ -556,7 +571,7 @@ add_signals(Class *c)
                
                sig = g_strdup(m->id);
                g_strup(sig);
-               fprintf(out,"\tobject_signals[%s_SIGNAL] =\n"
+               out_printf(out,"\tobject_signals[%s_SIGNAL] =\n"
                        "\t\tgtk_signal_new (\"%s\",\n"
                        "\t\t\tGTK_RUN_%s,\n"
                        "\t\t\tgtk_object_class->type,\n"
@@ -573,13 +588,13 @@ add_signals(Class *c)
                if(!is_none) {
                        GList *l;
                        for(l=m->gtktypes->next;l;l=g_list_next(l))
-                               fprintf(out,",\n\t\t\tGTK_TYPE_%s",
+                               out_printf(out,",\n\t\t\tGTK_TYPE_%s",
                                        (char *)l->data);
                }
 
-               fprintf(out,");\n");
+               out_printf(out,");\n");
        }
-       fprintf(out,"\tgtk_object_class_add_signals (gtk_object_class,\n"
+       out_printf(out,"\tgtk_object_class_add_signals (gtk_object_class,\n"
                "\t\tobject_signals, LAST_SIGNAL);\n\n");
 }
 
@@ -588,7 +603,7 @@ set_def_handlers(Class *c, char *oname)
 {
        GList *li;
 
-       fprintf(out,"\n");
+       out_printf(out,"\n");
        for(li=c->nodes;li;li=g_list_next(li)) {
                Node *n = li->data;
                Method *m;
@@ -605,39 +620,25 @@ set_def_handlers(Class *c, char *oname)
                        char *s;
                        s = replace_sep(m->otype,'_');
                        g_strdown(s);
-                       fprintf(out,"\t%s_class->%s = %s_%s;\n",
+                       out_printf(out,"\t%s_class->%s = %s_%s;\n",
                                s,m->id,funcbase,m->id);
                } else {
                        if(m->cbuf)
-                               fprintf(out,"\t%s->%s = _real_%s_%s;\n",
+                               out_printf(out,"\t%s->%s = _real_%s_%s;\n",
                                        oname,m->id,funcbase,m->id);
                        else
-                               fprintf(out,"\t%s->%s = NULL;\n",
+                               out_printf(out,"\t%s->%s = NULL;\n",
                                        oname,m->id);
                }
        }
 }
 
-static int
-is_arguments(Class *c)
-{
-       GList *li;
-
-       for(li=c->nodes;li;li=g_list_next(li)) {
-               Node *n = li->data;
-               if(n->type == ARGUMENT_NODE)
-                       return TRUE;
-       }
-       return FALSE;
-}
-
-
 static void
 make_arguments(Class *c)
 {
        GList *li;
 
-       fprintf(out,"\n");
+       out_printf(out,"\n");
        for(li=c->nodes;li;li=g_list_next(li)) {
                Node *n = li->data;
                Argument *a;
@@ -661,7 +662,7 @@ make_arguments(Class *c)
 
                s = g_strdup(a->name);
                g_strup(s);
-               fprintf(out,"\tgtk_object_add_arg_type(\"%s::%s\",\n"
+               out_printf(out,"\tgtk_object_add_arg_type(\"%s::%s\",\n"
                        "\t\tGTK_TYPE_%s,\n"
                        "\t\t%s,\n"
                        "\t\tARG_%s);\n",
@@ -670,11 +671,9 @@ make_arguments(Class *c)
                g_string_free(flags,TRUE);
        }
        
-       if(is_arguments(c)) {
-               fprintf(out,
-                       "\n\tgtk_object_class->set_arg = __object_set_arg;\n"
-                       "\tgtk_object_class->get_arg = __object_get_arg;\n");
-       }
+       out_printf(out,
+                  "\n\tgtk_object_class->set_arg = __object_set_arg;\n"
+                  "\tgtk_object_class->get_arg = __object_get_arg;\n");
 }
 
 static void
@@ -688,34 +687,49 @@ add_inits(Class *c)
                        continue;
                m = (Method *)n;
                if(m->scope == INIT_METHOD) {
+                       if(m->line_no>0)
+                               out_addline_infile(out,m->line_no);
                        print_method(out,"static ","\n"," ","",m);
-                       if(m->cbuf)
-                               fprintf(out,"{\n%s\n}\n\n",m->cbuf->str);
-                       else
-                               fprintf(out,"{\n\treturn;\n}\n\n");
+                       if(m->line_no>0)
+                               out_addline_outfile(out);
+                       out_printf(out,"{\n");
                } else if(m->scope == CLASS_INIT_METHOD) {
+                       if(m->line_no>0)
+                               out_addline_infile(out,m->line_no);
                        print_method(out,"static ","\n"," ","",m);
-                       fprintf(out,"{\n"
+                       if(m->line_no>0)
+                               out_addline_outfile(out);
+                       out_printf(out,"{\n"
                                "\tGtkObjectClass *gtk_object_class = "
                                "(GtkObjectClass*) %s;\n",
                                ((FuncArg *)m->args->data)->name);
                        
                        add_overrides(c, ((FuncArg *)m->args->data)->name);
                        
-                       fprintf(out,"\n\tparent_class = "
+                       out_printf(out,"\n\tparent_class = "
                                "gtk_type_class (%s_get_type ());\n",
                                pfuncbase);
 
-                       add_signals(c);
+                       if(signals>0)
+                               add_signals(c);
 
                        set_def_handlers(c, ((FuncArg *)m->args->data)->name);
                        
-                       make_arguments(c);
-                       
-                       if(m->cbuf)
-                               fprintf(out," {\n%s\n }\n",m->cbuf->str);
-                       fprintf(out,"}\n");
+                       if(arguments>0)
+                               make_arguments(c);
+               } else
+                       continue;
+
+               if(m->cbuf) {
+                       out_printf(out," {\n");
+                       out_addline_infile(out,m->ccode_line);
+                       out_printf(out,"%s\n",m->cbuf->str);
+                       out_addline_outfile(out);
+                       out_printf(out," }\n",m->cbuf->str);
+               } else {
+                       out_printf(out,"return;\n");
                }
+               out_printf(out,"}\n");
        }
 }
 
@@ -723,7 +737,7 @@ static void
 add_getset_arg(Class *c, int is_set)
 {
        GList *li;
-       fprintf(out,"\nstatic void\n"
+       out_printf(out,"\nstatic void\n"
                "__object_%s_arg (GtkObject *object,\n"
                "\tGtkArg *arg,\n"
                "\tguint arg_id)\n"
@@ -737,22 +751,34 @@ add_getset_arg(Class *c, int is_set)
                Node *n = li->data;
                Argument *a;
                char *s;
+               GString *cbuf;
+               int line_no;
                if(n->type != ARGUMENT_NODE)
                        continue;
                a = (Argument *)n;
-               if((is_set && !a->set) ||
-                  (!is_set && !a->get))
+               if(is_set) {
+                       cbuf = a->set;
+                       line_no = a->set_line;
+               } else {
+                       cbuf = a->get;
+                       line_no = a->get_line;
+               }
+               if(!cbuf)
                        continue;
                s = g_strdup(a->name);
                g_strup(s);
-               fprintf(out,"\tcase ARG_%s:\n"
+               out_printf(out,"\tcase ARG_%s:\n"
                        "#define ARG (GTK_VALUE_%s(*arg))\n"
-                       "\t\t{\n%s\n\t\t}\n\t\tbreak;\n"
-                       "#undef ARG\n",
-                       s,a->gtktype,a->set->str);
+                       "\t\t{\n",
+                       s,a->gtktype);
                g_free(s);
+               out_addline_infile(out,line_no);
+               out_printf(out,"%s\n",cbuf->str);
+               out_addline_outfile(out);
+               out_printf(out,"\t\t}\n\t\tbreak;\n"
+                       "#undef ARG\n");
        }
-       fprintf(out,"\tdefault:\n\t\tbreak;\n\t}\n}\n");
+       out_printf(out,"\tdefault:\n\t\tbreak;\n\t}\n}\n");
 }
 
 static void
@@ -767,43 +793,43 @@ print_checks(Method *m, FuncArg *fa)
                Check *ch = li->data;
                char *s;
                if(is_void)
-                       fprintf(out,"\tg_return_if_fail (");
+                       out_printf(out,"\tg_return_if_fail (");
                else
-                       fprintf(out,"\tg_return_val_if_fail (");
+                       out_printf(out,"\tg_return_val_if_fail (");
                switch(ch->chtype) {
                case NULL_CHECK:
-                       fprintf(out,"%s != NULL",fa->name);
+                       out_printf(out,"%s != NULL",fa->name);
                        break;
                case TYPE_CHECK:
                        s = make_is_macro(fa->atype->name);
-                       fprintf(out,"%s (%s)",s,fa->name);
+                       out_printf(out,"%s (%s)",s,fa->name);
                        g_free(s);
                        break;
                case LT_CHECK:
-                       fprintf(out,"%s < %s",fa->name,ch->number);
+                       out_printf(out,"%s < %s",fa->name,ch->number);
                        break;
                case GT_CHECK:
-                       fprintf(out,"%s > %s",fa->name,ch->number);
+                       out_printf(out,"%s > %s",fa->name,ch->number);
                        break;
                case LE_CHECK:
-                       fprintf(out,"%s <= %s",fa->name,ch->number);
+                       out_printf(out,"%s <= %s",fa->name,ch->number);
                        break;
                case GE_CHECK:
-                       fprintf(out,"%s >= %s",fa->name,ch->number);
+                       out_printf(out,"%s >= %s",fa->name,ch->number);
                        break;
                case EQ_CHECK:
-                       fprintf(out,"%s == %s",fa->name,ch->number);
+                       out_printf(out,"%s == %s",fa->name,ch->number);
                        break;
                case NE_CHECK:
-                       fprintf(out,"%s != %s",fa->name,ch->number);
+                       out_printf(out,"%s != %s",fa->name,ch->number);
                        break;
                }
                if(is_void)
-                       fprintf(out,");\n");
+                       out_printf(out,");\n");
                else {
-                       fprintf(out,", (");
+                       out_printf(out,", (");
                        print_type(out,m->mtype);
-                       fprintf(out,")%s);\n",
+                       out_printf(out,")%s);\n",
                                m->onerror?m->onerror:"0");
                }
        }
@@ -824,123 +850,161 @@ print_preconditions(Method *m)
 static void
 print_method_body(Method *m, int pre)
 {
-       fprintf(out,"{\n");
+       out_printf(out,"{\n");
        if(pre) {
                print_preconditions(m);
-               fprintf(out,"\t{\n");
+               out_printf(out,"\t{\n");
        }
 
-       fprintf(out,"\t\t%s\n",m->cbuf->str);
+       out_addline_infile(out,m->ccode_line);
+       out_printf(out,"\t\t%s\n",m->cbuf->str);
+       out_addline_outfile(out);
 
        if(pre)
-               fprintf(out,"\t}\n");
-       fprintf(out,"}\n");
+               out_printf(out,"\t}\n");
+       out_printf(out,"}\n");
 }
 
 static void
 put_method(Method *m)
 {
        char *s;
-       fprintf(out,"\n");
-       if(strcmp(m->id,"new")==0) {
-               fprintf(out,"#define GET_NEW (gtk_type_new(%s_get_type()))\n",
-                       funcbase);
-       }
+       out_printf(out,"\n");
        switch(m->scope) {
        case PUBLIC_SCOPE:
+               out_addline_infile(out,m->line_no);
                print_method(out,"","\n"," ","",m);
                print_method_body(m,TRUE);
                break;
        case PRIVATE_SCOPE:
+               out_addline_infile(out,m->line_no);
                print_method(out,"static ","\n"," ","",m);
                print_method_body(m,TRUE);
                break;
        case SIGNAL_FIRST_METHOD:
        case SIGNAL_LAST_METHOD:
+               out_addline_infile(out,m->line_no);
                print_method(out,"","\n"," ","",m);
-               fprintf(out,"{\n");
+               out_addline_outfile(out);
+               out_printf(out,"{\n");
                s = g_strdup(m->id);
                g_strup(s);
                if(strcmp(m->mtype->name,"void")==0 &&
                   m->mtype->stars==0) {
                        GList *li;
                        print_preconditions(m);
-                       fprintf(out,"\tgtk_signal_emit (GTK_OBJECT (this),\n"
+                       out_printf(out,"\tgtk_signal_emit (GTK_OBJECT (this),\n"
                                "\t\tobject_signals[%s_SIGNAL]",s);
                        for(li=m->args->next;li;li=g_list_next(li)) {
                                FuncArg *fa = li->data;
-                               fprintf(out,",\n\t\t%s",fa->name);
+                               out_printf(out,",\n\t\t%s",fa->name);
                        }
-                       fprintf(out,");\n}\n");
+                       out_printf(out,");\n}\n");
                } else {
                        GList *li;
-                       fprintf(out,"\t");
+                       out_printf(out,"\t");
                        print_type(out,m->mtype);
-                       fprintf(out,"return_val;\n");
+                       out_printf(out,"return_val;\n");
                        print_preconditions(m);
-                       fprintf(out,"\tgtk_signal_emit (GTK_OBJECT (this),\n"
+                       out_printf(out,"\tgtk_signal_emit (GTK_OBJECT (this),\n"
                                "\t\tobject_signals[%s_SIGNAL]",s);
                        for(li=m->args->next;li;li=g_list_next(li)) {
                                FuncArg *fa = li->data;
-                               fprintf(out,",\n\t\t%s",fa->name);
+                               out_printf(out,",\n\t\t%s",fa->name);
                        }
-                       fprintf(out,",\n\t\t&return_val);\n"
+                       out_printf(out,",\n\t\t&return_val);\n"
                                "\treturn return_val;\n}\n");
                }
 
                if(!m->cbuf)
                        break;
+               out_addline_infile(out,m->line_no);
                print_method(out,"static ","\n_real_"," ","",m);
                print_method_body(m,FALSE);
                break;
        case VIRTUAL_METHOD:
+               out_addline_infile(out,m->line_no);
                print_method(out,"","\n"," ","",m);
-               fprintf(out,"{\n"
+               out_addline_outfile(out);
+               out_printf(out,"{\n"
                        "\t%sClass *class;\n",typebase);
                print_preconditions(m);
-               fprintf(out,"\tclass = %s_CLASS(GTK_OBJECT(this)->klass);\n\n"
+               out_printf(out,"\tclass = %s_CLASS(GTK_OBJECT(this)->klass);\n\n"
                        "\tif(class->%s)\n",
                        macrobase,m->id);
                if(strcmp(m->mtype->name,"void")==0 &&
                   m->mtype->stars==0) {
                        GList *li;
-                       fprintf(out,"\t\t(*class->%s)(this",m->id);
+                       out_printf(out,"\t\t(*class->%s)(this",m->id);
                        for(li=m->args->next;li;li=g_list_next(li)) {
                                FuncArg *fa = li->data;
-                               fprintf(out,",%s",fa->name);
+                               out_printf(out,",%s",fa->name);
                        }
-                       fprintf(out,");\n}\n");
+                       out_printf(out,");\n}\n");
                } else {
                        GList *li;
-                       fprintf(out,"\t\treturn (*class->%s)(this",m->id);
+                       out_printf(out,"\t\treturn (*class->%s)(this",m->id);
                        for(li=m->args->next;li;li=g_list_next(li)) {
                                FuncArg *fa = li->data;
-                               fprintf(out,",%s",fa->name);
+                               out_printf(out,",%s",fa->name);
                        }
-                       fprintf(out,");\n"
+                       out_printf(out,");\n"
                                "\telse\n"
                                "\t\treturn (");
                        print_type(out,m->mtype);
-                       fprintf(out,")(%s);\n}\n",
+                       out_printf(out,")(%s);\n}\n",
                                m->onerror?m->onerror:"0");
                }
 
                if(!m->cbuf)
                        break;
+               out_addline_infile(out,m->line_no);
                print_method(out,"static ","\n_real_"," ","",m);
                print_method_body(m,FALSE);
                break;
        case OVERRIDE_METHOD:
+               out_addline_infile(out,m->line_no);
                print_method(out,"static ","\n"," ","",m);
                print_method_body(m,TRUE);
                break;
        default:
                break;
        }
-       if(strcmp(m->id,"new")==0)
-               fprintf(out,"#undef GET_NEW\n");
 }
 
+static int
+count_signals(Class *c)
+{
+       int num = 0;
+       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)
+                               num++;
+               }
+       }
+       return num;
+}
+
+static int
+count_arguments(Class *c)
+{
+       int num = 0;
+       GList *li;
+
+       for(li=c->nodes;li;li=g_list_next(li)) {
+               Node *n = li->data;
+               if(n->type == ARGUMENT_NODE)
+                       num ++;
+       }
+       return num;
+}
+
+
+
 static void
 open_files(void)
 {
@@ -967,22 +1031,22 @@ generate_outfiles(void)
        time_t curtime;
 
        time(&curtime);
-       fprintf(outh,"/* Generated by GOB (v%s) on %s"
+       out_printf(outh,"/* Generated by GOB (v%s) on %s"
               "   (do not edit directly) */\n\n",VERSION,ctime(&curtime));
-       fprintf(out,"/* Generated by GOB (v%s) on %s"
+       out_printf(out,"/* Generated by GOB (v%s) on %s"
               "   (do not edit directly) */\n\n",VERSION,ctime(&curtime));
        
        p = replace_sep(((Class *)class)->otype,'_');
        g_strup(p);
-       fprintf(outh,"#ifndef __%s_H__\n#define __%s_H__\n\n"
+       out_printf(outh,"#ifndef __%s_H__\n#define __%s_H__\n\n"
                "#include <gtk/gtk.h>\n\n",p,p);
        g_free(p);
 
-       fprintf(outh,"#ifdef __cplusplus\n"
+       out_printf(outh,"#ifdef __cplusplus\n"
                "extern \"C\" {\n"
                "#endif /* __cplusplus */\n\n");
        
-       fprintf(out,"#include \"%s.h\"\n\n",filebase);
+       out_printf(out,"#include \"%s.h\"\n\n",filebase);
        
        for(li=nodes;li;li=g_list_next(li)) {
                Node *node = li->data;
@@ -991,39 +1055,46 @@ generate_outfiles(void)
                        FILE *fp;
                        if(cc->header)
                                fp = outh;
-                       else
+                       else {
                                fp = out;
-                       fprintf(fp,"\n%s\n",cc->cbuf->str);
+                               out_addline_infile(fp,cc->line_no);
+                       }
+                       out_printf(fp,"\n%s\n",cc->cbuf->str);
+                       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);
                        
-                       fprintf(outh,"\n#define %s(obj)\t"
+                       out_printf(outh,"\n#define %s(obj)\t"
                                "GTK_CHECK_CAST((obj),%s_get_type(),%s)\n",
                                macrobase,funcbase,typebase);
-                       fprintf(outh,"#define %s_CLASS(klass)\t"
+                       out_printf(outh,"#define %s_CLASS(klass)\t"
                                "GTK_CHECK_CLASS_CAST((klass),%s_get_type(),%sClass)\n",
                                macrobase,funcbase,typebase);
-                       fprintf(outh,"#define %s(obj)\t"
+                       out_printf(outh,"#define %s(obj)\t"
                                "GTK_CHECK_TYPE((obj), %s_get_type ())\n\n",
                                macrois,funcbase);
 
                        otype = remove_sep(c->otype);
                        ptype = remove_sep(c->ptype);
-                       fprintf(outh,"\ntypedef struct _%s %s;\n",otype,otype);
-                       fprintf(outh,"struct _%s {\n\t%s __parent__;\n",
-                               otype,ptype);
+                       out_printf(outh,"\ntypedef struct _%s %s;\n",otype,otype);
+                       out_printf(outh,"struct _%s {\n\t%s __parent__;\n",
+                                  otype,ptype);
                        for(l=c->nodes;l;l=g_list_next(l)) {
                                Node *n = l->data;
                                if(n->type == VARIABLE_NODE)
                                        put_variable((Variable *)n);
                        }
-                       fprintf(outh,"};\n");
+                       out_printf(outh,"};\n");
 
-                       fprintf(outh,"\ntypedef struct _%sClass %sClass;\n",
+                       out_printf(outh,"\ntypedef struct _%sClass %sClass;\n",
                                otype,otype);
-                       fprintf(outh,
+                       out_printf(outh,
                                "struct _%sClass {\n\t%sClass __parent__;\n",
                                otype,ptype);
                        for(l=c->nodes;l;l=g_list_next(l)) {
@@ -1031,17 +1102,17 @@ generate_outfiles(void)
                                if(n->type == METHOD_NODE)
                                        put_vs_method((Method *)n);
                        }
-                       fprintf(outh,"};\n\n");
+                       out_printf(outh,"};\n\n");
 
-                       fprintf(outh,"guint\t%s_get_type\t(void);\n",funcbase);
+                       out_printf(outh,"guint\t%s_get_type\t(void);\n",funcbase);
                        
-                       if(is_arguments(c)) {
-                               fprintf(out,"static void __object_set_arg "
-                                       "(GtkObject *object, GtkArg *arg, "
-                                       "guint arg_id);\n"
-                                       "static void __object_get_arg "
-                                       "(GtkObject *object, GtkArg *arg, "
-                                       "guint arg_id);\n");
+                       if(arguments>0) {
+                               out_printf(out,"static void __object_set_arg "
+                                          "(GtkObject *object, GtkArg *arg, "
+                                          "guint arg_id);\n"
+                                          "static void __object_get_arg "
+                                          "(GtkObject *object, GtkArg *arg, "
+                                          "guint arg_id);\n");
                        }
 
                        for(l=c->nodes;l;l=g_list_next(l)) {
@@ -1052,10 +1123,12 @@ generate_outfiles(void)
                                }
                        }
 
-                       for(l=c->nodes;l;l=g_list_next(l)) {
-                               Node *n = l->data;
-                               if(n->type == METHOD_NODE) {
-                                       add_signal_prots((Method *)n);
+                       if(signals>0) {
+                               for(l=c->nodes;l;l=g_list_next(l)) {
+                                       Node *n = l->data;
+                                       if(n->type == METHOD_NODE) {
+                                               add_signal_prots((Method *)n);
+                                       }
                                }
                        }
                        
@@ -1064,10 +1137,13 @@ generate_outfiles(void)
                        add_get_type();
 
                        def_methods(c);
+
+                       out_printf(out,"#define GET_NEW (gtk_type_new(%s_get_type()))\n",
+                               funcbase);
                        
                        add_inits(c);
 
-                       if(is_arguments(c)) {
+                       if(arguments>0) {
                                add_getset_arg(c, TRUE);
                                add_getset_arg(c, FALSE);
                        }
@@ -1079,6 +1155,8 @@ generate_outfiles(void)
                                }
                        }
 
+                       out_printf(out,"#undef GET_NEW\n");
+
                        undef_methods(c);
 
                        g_free(otype);
@@ -1087,7 +1165,7 @@ generate_outfiles(void)
                        g_assert_not_reached();
        }
 
-       fprintf(outh,"\n#ifdef __cplusplus\n"
+       out_printf(outh,"\n#ifdef __cplusplus\n"
                "}\n"
                "#endif /* __cplusplus */\n\n"
                "#endif");
diff --git a/src/out.c b/src/out.c
new file mode 100644 (file)
index 0000000..df0d7f5
--- /dev/null
+++ b/src/out.c
@@ -0,0 +1,73 @@
+#include <stdio.h>
+#include <stdarg.h>
+#include <glib.h>
+
+#include "out.h"
+
+extern FILE *out;
+extern FILE *outh;
+
+extern char *filename;
+extern char *filebase;
+
+int outline = 1;
+int outhline = 1;
+
+static int
+strchrcnt(char *s, char c)
+{
+       int cnt = 0;
+       for(;*s;s++)
+               if(*s == c)
+                       cnt++;
+       return cnt;
+}
+
+void
+out_printf(FILE *fp,char *format,...)
+{
+       va_list ap;
+       char *s;
+       va_start(ap,format);
+       
+       s = g_strdup_vprintf(format,ap);
+
+       if(fp == out)
+               outline += strchrcnt(s,'\n');
+       else if(fp == outh)
+               outhline += strchrcnt(s,'\n');
+       else
+               g_assert_not_reached();
+
+       fprintf(fp,"%s",s);
+       g_free(s);
+
+       va_end(ap);
+}
+
+void
+out_addline_infile(FILE *fp, int line)
+{
+       if(fp == out)
+               outline++;
+       else if(fp == outh)
+               outhline++;
+       else
+               g_assert_not_reached();
+
+       fprintf(fp,"#line %d \"%s\"\n",line,filename);
+}
+
+void
+out_addline_outfile(FILE *fp)
+{
+       if(fp == out) {
+               outline++;
+               fprintf(fp,"#line %d \"%s.c\"\n",outline,filebase);
+       } else if(fp == outh) {
+               outhline++;
+               fprintf(fp,"#line %d \"%s.h\"\n",outhline,filebase);
+       } else
+               g_assert_not_reached();
+
+}
diff --git a/src/out.h b/src/out.h
new file mode 100644 (file)
index 0000000..4e9b0f7
--- /dev/null
+++ b/src/out.h
@@ -0,0 +1,31 @@
+/* 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 _OUT_H_
+#define _OUT_H_
+
+#include <stdio.h>
+
+void out_printf(FILE *fp,char *format,...);
+void out_addline_infile(FILE *fp, int line);
+void out_addline_outfile(FILE *fp);
+
+#endif
index 7d3195dc34957339e351107d3979d7150e67d50a..708486f429eac2e0833c5a9c1d762a44838e60a9 100644 (file)
 #define        CHAR    270
 #define        FIRST   271
 #define        LAST    272
-#define        CHECK   273
-#define        CNULL   274
-#define        TYPE    275
-#define        ONERROR 276
-#define        TOKEN   277
-#define        NUMBER  278
-#define        TYPETOKEN       279
-#define        CCODE   280
-#define        HCODE   281
-#define        PUBLIC  282
-#define        PRIVATE 283
-#define        ARGUMENT        284
-#define        VIRTUAL 285
-#define        SIGNAL  286
-#define        OVERRIDE        287
+#define        ONERROR 273
+#define        TOKEN   274
+#define        NUMBER  275
+#define        TYPETOKEN       276
+#define        CCODE   277
+#define        HCODE   278
+#define        PUBLIC  279
+#define        PRIVATE 280
+#define        ARGUMENT        281
+#define        VIRTUAL 282
+#define        SIGNAL  283
+#define        OVERRIDE        284
 
 #line 21 "parse.y"
 
@@ -67,6 +64,7 @@ static GList *gtktypes = NULL;
 void free(void *ptr);
 int yylex(void);
 
+extern int ccode_line;
 extern int line_no;
 
 extern char *yytext;
@@ -109,7 +107,7 @@ push_variable(char *name, int scope)
 
 static void
 push_function(int scope, char *oid, char *id, char *onerror,
-             GString *cbuf,int line_no)
+             GString *cbuf,int line_no, int ccode_line)
 {
        Node *node;
        Type *type;
@@ -122,7 +120,7 @@ push_function(int scope, char *oid, char *id, char *onerror,
        }
        
        node = new_method(scope,type,oid,gtktypes,id,funcargs,
-                         onerror,cbuf,line_no);
+                         onerror,cbuf,line_no,ccode_line);
        gtktypes = NULL;
        funcargs = NULL;
 
@@ -173,7 +171,7 @@ push_this(char *this)
 }
 
 
-#line 157 "parse.y"
+#line 158 "parse.y"
 typedef union {
        char *id;
        GString *cbuf;
@@ -194,26 +192,26 @@ typedef union {
 
 
 
-#define        YYFINAL         202
+#define        YYFINAL         190
 #define        YYFLAG          -32768
-#define        YYNTBASE        48
+#define        YYNTBASE        45
 
-#define YYTRANSLATE(x) ((unsigned)(x) <= 287 ? yytranslate[x] : 72)
+#define YYTRANSLATE(x) ((unsigned)(x) <= 284 ? yytranslate[x] : 69)
 
 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,    46,     2,     2,     2,     2,     2,     2,    37,
-    38,    40,     2,    41,    47,     2,     2,     2,    43,     2,
-     2,     2,     2,     2,     2,     2,     2,     2,    36,    45,
-    42,    44,     2,     2,     2,     2,     2,     2,     2,     2,
+     2,     2,    43,     2,     2,     2,     2,     2,     2,    34,
+    35,    37,     2,    38,    44,     2,     2,     2,    40,     2,
+     2,     2,     2,     2,     2,     2,     2,     2,    33,    42,
+    39,    41,     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,    34,    39,    35,     2,     2,     2,     2,     2,
+     2,     2,    31,    36,    32,     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,
@@ -229,7 +227,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
+    27,    28,    29,    30
 };
 
 #if YYDEBUG != 0
@@ -239,65 +237,62 @@ static const short yyprhs[] = {     0,
     78,    82,    83,    87,    89,    91,    94,    97,   100,   102,
    105,   108,   110,   112,   114,   116,   119,   121,   123,   126,
    128,   131,   133,   135,   137,   139,   141,   144,   146,   151,
-   155,   157,   169,   180,   192,   203,   214,   224,   234,   243,
-   256,   266,   276,   282,   289,   292,   295,   299,   302,   303,
-   305,   307,   311,   313,   317,   319,   322,   329,   332,   334,
-   336,   338,   341,   344,   348,   352,   356,   360,   362
+   155,   157,   169,   180,   191,   201,   211,   220,   233,   243,
+   253,   259,   266,   269,   272,   276,   279,   280,   282,   284,
+   288,   290,   294,   296,   299,   306,   309,   311,   313,   316,
+   319,   323,   327,   331,   335,   337
 };
 
-static const short yyrhs[] = {    49,
-    50,    49,     0,    50,    49,     0,    49,    50,     0,    50,
-     0,    49,    26,     0,    49,    27,     0,    26,     0,    27,
-     0,    51,    34,    52,    35,     0,     3,    25,     4,    25,
-     0,    52,    64,     0,    52,    53,     0,    52,    54,     0,
-    64,     0,    53,     0,    54,     0,    28,    57,    23,    36,
-     0,    29,    57,    23,    36,     0,    30,    55,    23,    23,
-    23,    34,    26,    23,    34,    26,    36,     0,    30,    55,
-    23,    23,    23,    34,    26,    36,     0,    37,    56,    38,
-     0,     0,    23,    39,    56,     0,    23,     0,    58,     0,
-    58,    61,     0,    10,    59,     0,     9,    59,     0,    59,
+static const short yyrhs[] = {    46,
+    47,    46,     0,    47,    46,     0,    46,    47,     0,    47,
+     0,    46,    23,     0,    46,    24,     0,    23,     0,    24,
+     0,    48,    31,    49,    32,     0,     3,    22,     4,    22,
+     0,    49,    61,     0,    49,    50,     0,    49,    51,     0,
+    61,     0,    50,     0,    51,     0,    25,    54,    20,    33,
+     0,    26,    54,    20,    33,     0,    27,    52,    20,    20,
+    20,    31,    23,    20,    31,    23,    33,     0,    27,    52,
+    20,    20,    20,    31,    23,    33,     0,    34,    53,    35,
+     0,     0,    20,    36,    53,     0,    20,     0,    55,     0,
+    55,    58,     0,    10,    56,     0,     9,    56,     0,    56,
      0,    10,    16,     0,     9,    16,     0,    16,     0,    15,
-     0,    14,     0,    23,     0,    60,    23,     0,    25,     0,
+     0,    14,     0,    20,     0,    57,    20,     0,    22,     0,
      5,     0,    11,    13,     0,    11,     0,    12,    13,     0,
     12,     0,    13,     0,     8,     0,     7,     0,     6,     0,
-    40,    61,     0,    40,     0,    23,    37,    63,    38,     0,
-    63,    41,    23,     0,    23,     0,    32,    18,    62,    57,
-    23,    37,    66,    38,    65,    34,    26,     0,    32,    18,
-    62,    57,    23,    37,    66,    38,    65,    36,     0,    32,
-    17,    62,    57,    23,    37,    66,    38,    65,    34,    26,
-     0,    32,    17,    62,    57,    23,    37,    66,    38,    65,
-    36,     0,    32,    62,    57,    23,    37,    66,    38,    65,
-    34,    26,     0,    32,    62,    57,    23,    37,    66,    38,
-    65,    36,     0,    31,    57,    23,    37,    66,    38,    65,
-    34,    26,     0,    31,    57,    23,    37,    66,    38,    65,
-    36,     0,    33,    37,    25,    38,    57,    23,    37,    66,
-    38,    65,    34,    26,     0,    28,    57,    23,    37,    66,
-    38,    65,    34,    26,     0,    29,    57,    23,    37,    66,
-    38,    65,    34,    26,     0,    23,    37,    23,    38,    36,
-     0,    23,    37,    23,    38,    34,    26,     0,    22,    23,
-     0,    22,    71,     0,    22,    34,    26,     0,    42,    43,
-     0,     0,     5,     0,    23,     0,    23,    41,    67,     0,
-    67,     0,    67,    41,    68,     0,    68,     0,    57,    23,
-     0,    57,    23,    37,    19,    69,    38,     0,    69,    70,
-     0,    70,     0,    20,     0,    21,     0,    44,    71,     0,
-    45,    71,     0,    44,    42,    71,     0,    45,    42,    71,
-     0,    42,    42,    71,     0,    46,    42,    71,     0,    24,
-     0,    47,    24,     0
+    37,    58,     0,    37,     0,    20,    34,    60,    35,     0,
+    60,    38,    20,     0,    20,     0,    29,    20,    59,    54,
+    20,    34,    63,    35,    62,    31,    23,     0,    29,    20,
+    59,    54,    20,    34,    63,    35,    62,    33,     0,    29,
+    59,    54,    20,    34,    63,    35,    62,    31,    23,     0,
+    29,    59,    54,    20,    34,    63,    35,    62,    33,     0,
+    28,    54,    20,    34,    63,    35,    62,    31,    23,     0,
+    28,    54,    20,    34,    63,    35,    62,    33,     0,    30,
+    34,    22,    35,    54,    20,    34,    63,    35,    62,    31,
+    23,     0,    25,    54,    20,    34,    63,    35,    62,    31,
+    23,     0,    26,    54,    20,    34,    63,    35,    62,    31,
+    23,     0,    20,    34,    20,    35,    33,     0,    20,    34,
+    20,    35,    31,    23,     0,    19,    20,     0,    19,    68,
+     0,    19,    31,    23,     0,    39,    40,     0,     0,     5,
+     0,    20,     0,    20,    38,    64,     0,    64,     0,    64,
+    38,    65,     0,    65,     0,    54,    20,     0,    54,    20,
+    34,    20,    66,    35,     0,    66,    67,     0,    67,     0,
+    20,     0,    41,    68,     0,    42,    68,     0,    41,    39,
+    68,     0,    42,    39,    68,     0,    39,    39,    68,     0,
+    43,    39,    68,     0,    21,     0,    44,    21,     0
 };
 
 #endif
 
 #if YYDEBUG != 0
 static const short yyrline[] = { 0,
-   175,   176,   177,   178,   181,   185,   189,   193,   199,   206,
-   211,   212,   213,   214,   215,   216,   219,   222,   226,   251,
-   275,   276,   279,   282,   288,   292,   299,   302,   305,   308,
-   311,   314,   317,   320,   323,   326,   330,   333,   338,   341,
-   344,   347,   350,   355,   358,   361,   366,   367,   370,   375,
-   378,   384,   393,   402,   411,   420,   429,   438,   442,   446,
-   450,   454,   458,   474,   493,   494,   495,   499,   500,   505,
-   506,   516,   526,   529,   530,   533,   536,   541,   542,   545,
-   549,   553,   557,   561,   565,   569,   573,   579,   580
+   176,   177,   178,   179,   182,   186,   190,   194,   200,   207,
+   212,   213,   214,   215,   216,   217,   220,   223,   227,   254,
+   278,   279,   282,   285,   291,   295,   302,   305,   308,   311,
+   314,   317,   320,   323,   326,   329,   333,   336,   341,   344,
+   347,   350,   353,   358,   361,   364,   369,   370,   373,   378,
+   381,   387,   408,   428,   437,   446,   450,   454,   458,   462,
+   466,   482,   503,   504,   505,   509,   510,   515,   516,   526,
+   536,   539,   540,   543,   546,   556,   557,   560,   573,   577,
+   581,   585,   589,   593,   599,   600
 };
 #endif
 
@@ -306,26 +301,25 @@ static const short yyrline[] = { 0,
 
 static const char * const yytname[] = {   "$","error","$undefined.","CLASS",
 "FROM","VOID","STRUCT","UNION","ENUM","SIGNED","UNSIGNED","LONG","SHORT","INT",
-"FLOAT","DOUBLE","CHAR","FIRST","LAST","CHECK","CNULL","TYPE","ONERROR","TOKEN",
-"NUMBER","TYPETOKEN","CCODE","HCODE","PUBLIC","PRIVATE","ARGUMENT","VIRTUAL",
-"SIGNAL","OVERRIDE","'{'","'}'","';'","'('","')'","'|'","'*'","','","'='","'1'",
-"'>'","'<'","'!'","'-'","prog","ccodes","class","classdec","classcode","variable",
-"argument","argflags","flaglist","type","type1","integer","tspecifier","stars",
-"sigtype","tokenlist","method","onerror","funcargs","arglist","arg","checklist",
-"check","number", NULL
+"FLOAT","DOUBLE","CHAR","FIRST","LAST","ONERROR","TOKEN","NUMBER","TYPETOKEN",
+"CCODE","HCODE","PUBLIC","PRIVATE","ARGUMENT","VIRTUAL","SIGNAL","OVERRIDE",
+"'{'","'}'","';'","'('","')'","'|'","'*'","','","'='","'1'","'>'","'<'","'!'",
+"'-'","prog","ccodes","class","classdec","classcode","variable","argument","argflags",
+"flaglist","type","type1","integer","tspecifier","stars","sigtype","tokenlist",
+"method","onerror","funcargs","arglist","arg","checklist","check","number", NULL
 };
 #endif
 
 static const short yyr1[] = {     0,
-    48,    48,    48,    48,    49,    49,    49,    49,    50,    51,
-    52,    52,    52,    52,    52,    52,    53,    53,    54,    54,
-    55,    55,    56,    56,    57,    57,    58,    58,    58,    58,
-    58,    58,    58,    58,    58,    58,    58,    58,    59,    59,
-    59,    59,    59,    60,    60,    60,    61,    61,    62,    63,
-    63,    64,    64,    64,    64,    64,    64,    64,    64,    64,
-    64,    64,    64,    64,    65,    65,    65,    65,    65,    66,
-    66,    66,    66,    67,    67,    68,    68,    69,    69,    70,
-    70,    70,    70,    70,    70,    70,    70,    71,    71
+    45,    45,    45,    45,    46,    46,    46,    46,    47,    48,
+    49,    49,    49,    49,    49,    49,    50,    50,    51,    51,
+    52,    52,    53,    53,    54,    54,    55,    55,    55,    55,
+    55,    55,    55,    55,    55,    55,    55,    55,    56,    56,
+    56,    56,    56,    57,    57,    57,    58,    58,    59,    60,
+    60,    61,    61,    61,    61,    61,    61,    61,    61,    61,
+    61,    61,    62,    62,    62,    62,    62,    63,    63,    63,
+    63,    64,    64,    65,    65,    66,    66,    67,    67,    67,
+    67,    67,    67,    67,    68,    68
 };
 
 static const short yyr2[] = {     0,
@@ -334,10 +328,10 @@ static const short yyr2[] = {     0,
      3,     0,     3,     1,     1,     2,     2,     2,     1,     2,
      2,     1,     1,     1,     1,     2,     1,     1,     2,     1,
      2,     1,     1,     1,     1,     1,     2,     1,     4,     3,
-     1,    11,    10,    11,    10,    10,     9,     9,     8,    12,
-     9,     9,     5,     6,     2,     2,     3,     2,     0,     1,
-     1,     3,     1,     3,     1,     2,     6,     2,     1,     1,
-     1,     2,     2,     3,     3,     3,     3,     1,     2
+     1,    11,    10,    10,     9,     9,     8,    12,     9,     9,
+     5,     6,     2,     2,     3,     2,     0,     1,     1,     3,
+     1,     3,     1,     2,     6,     2,     1,     1,     2,     2,
+     3,     3,     3,     3,     1,     2
 };
 
 static const short yydefact[] = {     0,
@@ -346,114 +340,106 @@ static const short yydefact[] = {     0,
      0,     0,    15,    16,    14,    10,     0,    38,    46,    45,
     44,     0,     0,    40,    42,    43,    34,    33,    32,    35,
     37,     0,    25,    29,     0,     0,     0,     0,     0,     0,
-     0,     0,     0,     0,     9,    12,    13,    11,     0,    31,
-    28,    30,    27,    39,    41,     0,    48,    26,    36,     0,
-    24,     0,     0,     0,     0,     0,     0,     0,     0,     0,
-    17,     0,    47,    18,     0,     0,    21,     0,     0,     0,
-     0,    51,     0,     0,     0,     0,    63,    38,    35,     0,
-     0,    73,    75,     0,    23,     0,     0,     0,     0,    49,
-     0,     0,     0,    64,     0,    76,    69,     0,    69,     0,
-    69,     0,     0,    50,     0,     0,    72,     0,     0,     0,
-     0,    74,     0,     0,     0,     0,     0,    69,     0,     0,
-    65,    88,     0,     0,    66,    68,     0,     0,     0,    20,
-     0,    59,    69,    69,     0,     0,    80,    81,     0,     0,
-     0,     0,     0,    79,    67,    89,    61,    62,     0,    58,
-     0,     0,     0,    57,    69,     0,     0,    82,     0,    83,
-     0,    77,    78,     0,     0,    55,     0,    53,    56,     0,
-    86,    84,    85,    87,    19,    54,    52,     0,    60,     0,
-     0,     0
+     0,     0,     9,    12,    13,    11,     0,    31,    28,    30,
+    27,    39,    41,     0,    48,    26,    36,     0,    24,     0,
+     0,     0,     0,     0,     0,     0,     0,     0,    17,     0,
+    47,    18,     0,     0,    21,     0,     0,    51,     0,     0,
+     0,     0,     0,    61,    38,    35,     0,     0,    71,    73,
+     0,    23,     0,     0,    49,     0,     0,     0,     0,    62,
+     0,    74,    67,     0,    67,     0,    67,    50,     0,     0,
+     0,    70,     0,     0,     0,     0,    72,     0,     0,     0,
+     0,    67,     0,     0,    63,    85,     0,     0,    64,    66,
+     0,     0,     0,    20,     0,    57,    67,     0,     0,    78,
+     0,     0,     0,     0,     0,    77,    65,    86,    59,    60,
+     0,    56,     0,     0,    55,    67,     0,     0,    79,     0,
+    80,     0,    75,    76,     0,     0,    53,    54,     0,    83,
+    81,    82,    84,    19,    52,     0,    58,     0,     0,     0
 };
 
-static const short yydefgoto[] = {   200,
-     4,     5,     6,    22,    23,    24,    48,    72,   100,    43,
-    44,    45,    68,    53,    93,    25,   131,   101,   102,   103,
-   163,   164,   145
+static const short yydefgoto[] = {   188,
+     4,     5,     6,    22,    23,    24,    48,    70,    97,    43,
+    44,    45,    66,    51,    89,    25,   126,    98,    99,   100,
+   155,   156,   139
 };
 
-static const short yypact[] = {     3,
-   -23,-32768,-32768,    23,    69,   -25,    19,-32768,-32768,    69,
-   104,   105,     2,   104,    36,    75,    75,    40,    75,    -5,
-    62,    94,-32768,-32768,-32768,-32768,    34,-32768,-32768,-32768,
--32768,    81,   102,   126,   132,-32768,-32768,-32768,-32768,-32768,
--32768,    93,    80,-32768,   109,   133,   134,   135,   136,   137,
-   137,   118,    75,   138,-32768,-32768,-32768,-32768,   123,-32768,
--32768,-32768,-32768,-32768,-32768,   111,    80,-32768,-32768,   113,
-   125,   124,   142,   129,    75,    75,   144,   145,   131,    30,
--32768,    96,-32768,-32768,    96,   134,-32768,   147,    96,   148,
-   149,-32768,   -22,   139,    75,   151,-32768,   140,   -21,   150,
-   141,   143,-32768,   152,-32768,   146,   153,   155,   156,-32768,
-   158,    96,   159,-32768,    75,   157,    33,    75,    33,   160,
-    33,    96,    96,-32768,   161,   163,   143,   164,    -9,   154,
-   162,-32768,   167,    29,    42,   165,   166,    33,    96,     1,
--32768,-32768,   169,   174,-32768,-32768,   176,   179,   172,-32768,
-   181,-32768,    33,    33,   106,   170,-32768,-32768,   168,     9,
-    20,   171,   -10,-32768,-32768,-32768,-32768,-32768,   183,-32768,
-   107,   110,   185,-32768,    33,    24,    24,-32768,    24,-32768,
-    24,-32768,-32768,   178,   186,-32768,   189,-32768,-32768,   182,
--32768,-32768,-32768,-32768,-32768,-32768,-32768,   191,-32768,   175,
-   187,-32768
+static const short yypact[] = {    20,
+    34,-32768,-32768,    42,    37,    -9,    60,-32768,-32768,    37,
+    44,   100,    69,    44,    78,    73,    73,    88,    73,    74,
+    97,    89,-32768,-32768,-32768,-32768,   120,-32768,-32768,-32768,
+-32768,     0,    58,   128,   129,-32768,-32768,-32768,-32768,-32768,
+-32768,   123,   107,-32768,   125,   126,   127,   130,   131,    28,
+    73,   132,-32768,-32768,-32768,-32768,   113,-32768,-32768,-32768,
+-32768,-32768,-32768,    90,   107,-32768,-32768,   103,   116,   114,
+   133,   121,   122,   137,    73,   138,   124,    59,-32768,    91,
+-32768,-32768,    91,   127,-32768,   140,    91,-32768,    14,   141,
+   134,    73,   139,-32768,   135,    16,   143,   136,   142,-32768,
+   144,-32768,   145,   146,-32768,   147,   148,    91,   149,-32768,
+    73,   150,     7,    73,     7,   151,     7,-32768,    91,   152,
+   154,   142,   153,   -13,   155,   158,-32768,   159,    30,    77,
+   156,     7,    91,    -3,-32768,-32768,   160,   157,-32768,-32768,
+   162,   163,   161,-32768,   170,-32768,     7,   101,   164,-32768,
+   165,    -7,     3,   166,   -14,-32768,-32768,-32768,-32768,-32768,
+   171,-32768,   102,   173,-32768,     7,   -11,   -11,-32768,   -11,
+-32768,   -11,-32768,-32768,   167,   174,-32768,-32768,   172,-32768,
+-32768,-32768,-32768,-32768,-32768,   175,-32768,   177,   201,-32768
 };
 
 static const short yypgoto[] = {-32768,
-    58,   184,-32768,-32768,   196,   197,-32768,    88,   -16,-32768,
-   119,-32768,   122,   103,-32768,   198,  -114,   -81,    70,   108,
--32768,    59,  -107
+    10,   168,-32768,-32768,   180,   184,-32768,    80,   -16,-32768,
+   106,-32768,   110,   115,-32768,   185,  -113,   -78,    55,    94,
+-32768,    54,   -95
 };
 
 
-#define        YYLAST          226
+#define        YYLAST          209
 
 
 static const short yytable[] = {    42,
-    46,     7,    49,   104,   133,     1,   135,   107,    12,   157,
-   158,    50,    51,   141,   142,   110,   -71,    52,   111,   115,
-   157,   158,    13,   155,   143,     1,    26,   182,     2,     3,
-   125,   159,   142,   160,   161,   162,    78,   144,   171,   172,
-   136,   137,   159,   142,   160,   161,   162,   142,     8,     9,
-   177,   149,   178,   180,   129,   144,    59,   156,    90,    91,
-   190,   179,    11,    96,   150,    97,   144,    14,   191,   192,
-   144,   193,    27,   194,   130,   151,    47,   152,   113,    28,
-    29,    30,    31,    32,    33,    34,    35,    36,    37,    38,
-    39,    34,    35,    36,     2,     3,    60,    40,    54,    41,
-    98,    29,    30,    31,    32,    33,    34,    35,    36,    37,
-    38,    39,    34,    35,    36,    66,    15,    62,    99,    67,
-    41,    16,    17,    18,    19,    20,    21,    15,    55,     8,
-     9,    69,    16,    17,    18,    19,    20,    21,    64,   173,
-   185,   174,   186,   187,    65,   188,    81,    82,    84,    85,
-    61,    63,    75,    76,    77,    70,    71,    73,    74,    52,
-    80,    87,    79,    86,    88,    89,    92,    94,    95,   106,
-   108,   109,   116,   105,   201,   112,   114,   -70,   117,   120,
-   124,   126,   140,   118,   127,   134,   202,    10,    83,   119,
-   121,   122,   123,   128,   165,   147,   146,   166,   138,   139,
-   148,   167,   153,   154,   168,   169,   170,   175,   184,   176,
-   189,   196,   181,   195,   197,   198,   199,    56,    57,    58,
-     0,   183,     0,     0,     0,   132
+    46,   128,    49,   130,   101,   150,   135,   136,   104,   136,
+    34,    35,    36,   136,    11,    58,   150,   137,   148,    14,
+   173,    12,     1,   136,   151,   124,   152,   153,   154,   120,
+   138,   168,   138,   163,    76,   151,   138,   152,   153,   154,
+   131,   170,     2,     3,     1,   125,   138,    73,   105,   143,
+   -69,   106,   179,   111,   149,     7,   169,   171,    90,     2,
+     3,    74,   144,    13,     8,     9,     8,     9,    34,    35,
+    36,   180,   181,    60,   182,   109,   183,    28,    29,    30,
+    31,    32,    33,    34,    35,    36,    37,    38,    39,    93,
+    26,    94,    40,    50,    41,    95,    29,    30,    31,    32,
+    33,    34,    35,    36,    37,    38,    39,   145,    15,   146,
+    96,    27,    41,    16,    17,    18,    19,    20,    21,    15,
+    53,    47,    79,    80,    16,    17,    18,    19,    20,    21,
+    52,   164,   176,   165,   177,    82,    83,    59,    61,    57,
+    62,    63,    64,    65,    67,    68,    69,    78,    85,    71,
+    72,    84,    86,    77,    87,    74,    88,    91,    92,   103,
+   107,   110,   112,   102,    75,   122,   118,   108,   121,   -68,
+   113,    10,   134,   129,    81,   116,   189,   158,   115,   114,
+   117,   119,   157,   123,   159,   160,   132,   133,   141,   142,
+   147,   161,   162,   175,   140,   178,   185,   187,   166,   184,
+   190,    54,   186,   167,   172,    55,    56,   127,   174
 };
 
 static const short yycheck[] = {    16,
-    17,    25,    19,    85,   119,     3,   121,    89,    34,    20,
-    21,    17,    18,    23,    24,    38,    38,    23,    41,    41,
-    20,    21,     4,   138,    34,     3,    25,    38,    26,    27,
-   112,    42,    24,    44,    45,    46,    53,    47,   153,   154,
-   122,   123,    42,    24,    44,    45,    46,    24,    26,    27,
-    42,    23,   160,   161,    22,    47,    23,   139,    75,    76,
-   175,    42,     5,    34,    36,    36,    47,    10,   176,   177,
-    47,   179,    37,   181,    42,    34,    37,    36,    95,     5,
-     6,     7,     8,     9,    10,    11,    12,    13,    14,    15,
-    16,    11,    12,    13,    26,    27,    16,    23,    37,    25,
-     5,     6,     7,     8,     9,    10,    11,    12,    13,    14,
-    15,    16,    11,    12,    13,    23,    23,    16,    23,    40,
-    25,    28,    29,    30,    31,    32,    33,    23,    35,    26,
-    27,    23,    28,    29,    30,    31,    32,    33,    13,    34,
-    34,    36,    36,    34,    13,    36,    36,    37,    36,    37,
-    32,    33,    50,    51,    37,    23,    23,    23,    23,    23,
-    38,    38,    25,    39,    23,    37,    23,    23,    38,    23,
-    23,    23,    23,    86,     0,    37,    26,    38,    38,    34,
-    23,    23,    19,    41,   115,    26,     0,     4,    67,    38,
-    38,    37,    37,    37,    26,    34,    43,    24,    38,    37,
-    34,    26,    38,    38,    26,    34,    26,    38,    26,    42,
-    26,    26,    42,    36,    26,    34,    26,    22,    22,    22,
-    -1,   163,    -1,    -1,    -1,   118
+    17,   115,    19,   117,    83,    20,    20,    21,    87,    21,
+    11,    12,    13,    21,     5,    16,    20,    31,   132,    10,
+    35,    31,     3,    21,    39,    19,    41,    42,    43,   108,
+    44,    39,    44,   147,    51,    39,    44,    41,    42,    43,
+   119,    39,    23,    24,     3,    39,    44,    20,    35,    20,
+    35,    38,   166,    38,   133,    22,   152,   153,    75,    23,
+    24,    34,    33,     4,    23,    24,    23,    24,    11,    12,
+    13,   167,   168,    16,   170,    92,   172,     5,     6,     7,
+     8,     9,    10,    11,    12,    13,    14,    15,    16,    31,
+    22,    33,    20,    20,    22,     5,     6,     7,     8,     9,
+    10,    11,    12,    13,    14,    15,    16,    31,    20,    33,
+    20,    34,    22,    25,    26,    27,    28,    29,    30,    20,
+    32,    34,    33,    34,    25,    26,    27,    28,    29,    30,
+    34,    31,    31,    33,    33,    33,    34,    32,    33,    20,
+    13,    13,    20,    37,    20,    20,    20,    35,    35,    20,
+    20,    36,    20,    22,    34,    34,    20,    20,    35,    20,
+    20,    23,    20,    84,    50,   111,    20,    34,    20,    35,
+    35,     4,    20,    23,    65,    31,     0,    21,    35,    38,
+    35,    34,    23,    34,    23,    23,    35,    34,    31,    31,
+    35,    31,    23,    23,    40,    23,    23,    23,    35,    33,
+     0,    22,    31,    39,    39,    22,    22,   114,   155
 };
 /* -*-C-*-  Note some compilers choke on comments on `#line' lines.  */
 #line 3 "/usr/lib/bison.simple"
@@ -999,51 +985,51 @@ yyreduce:
   switch (yyn) {
 
 case 1:
-#line 175 "parse.y"
+#line 176 "parse.y"
 { ; ;
     break;}
 case 2:
-#line 176 "parse.y"
+#line 177 "parse.y"
 { ; ;
     break;}
 case 3:
-#line 177 "parse.y"
+#line 178 "parse.y"
 { ; ;
     break;}
 case 4:
-#line 178 "parse.y"
+#line 179 "parse.y"
 { ; ;
     break;}
 case 5:
-#line 181 "parse.y"
+#line 182 "parse.y"
 {
-                       Node *node = new_ccode(FALSE,yyvsp[0].cbuf);
+                       Node *node = new_ccode(FALSE,yyvsp[0].cbuf,ccode_line);
                        nodes = g_list_append(nodes,node);
                                        ;
     break;}
 case 6:
-#line 185 "parse.y"
+#line 186 "parse.y"
 {
-                       Node *node = new_ccode(TRUE,yyvsp[0].cbuf);
+                       Node *node = new_ccode(TRUE,yyvsp[0].cbuf,ccode_line);
                        nodes = g_list_append(nodes,node);
                                        ;
     break;}
 case 7:
-#line 189 "parse.y"
+#line 190 "parse.y"
 {
-                       Node *node = new_ccode(FALSE,yyvsp[0].cbuf);
+                       Node *node = new_ccode(FALSE,yyvsp[0].cbuf,ccode_line);
                        nodes = g_list_append(nodes,node);
                                        ;
     break;}
 case 8:
-#line 193 "parse.y"
+#line 194 "parse.y"
 {
-                       Node *node = new_ccode(TRUE,yyvsp[0].cbuf);
+                       Node *node = new_ccode(TRUE,yyvsp[0].cbuf,ccode_line);
                        nodes = g_list_append(nodes,node);
                                        ;
     break;}
 case 9:
-#line 199 "parse.y"
+#line 200 "parse.y"
 {
                        ((Class *)class)->nodes = class_nodes;
                        class_nodes = NULL;
@@ -1051,63 +1037,65 @@ case 9:
                                                ;
     break;}
 case 10:
-#line 206 "parse.y"
+#line 207 "parse.y"
 {
                        class = new_class(yyvsp[-2].id,yyvsp[0].id,NULL);
                                                ;
     break;}
 case 11:
-#line 211 "parse.y"
+#line 212 "parse.y"
 { ; ;
     break;}
 case 12:
-#line 212 "parse.y"
+#line 213 "parse.y"
 { ; ;
     break;}
 case 13:
-#line 213 "parse.y"
+#line 214 "parse.y"
 { ; ;
     break;}
 case 14:
-#line 214 "parse.y"
+#line 215 "parse.y"
 { ; ;
     break;}
 case 15:
-#line 215 "parse.y"
+#line 216 "parse.y"
 { ; ;
     break;}
 case 16:
-#line 216 "parse.y"
+#line 217 "parse.y"
 { ; ;
     break;}
 case 17:
-#line 219 "parse.y"
+#line 220 "parse.y"
 {
                        push_variable(yyvsp[-1].id,PUBLIC_SCOPE);
                                                ;
     break;}
 case 18:
-#line 222 "parse.y"
+#line 223 "parse.y"
 {
                        push_variable(yyvsp[-1].id,PRIVATE_SCOPE);
                                                ;
     break;}
 case 19:
-#line 226 "parse.y"
+#line 227 "parse.y"
 {
                        if(strcmp(yyvsp[-6].id,"get")==0 &&
                           strcmp(yyvsp[-3].id,"set")==0) {
                                Node *node;
                                g_free(yyvsp[-6].id); g_free(yyvsp[-3].id);
                                node = new_argument(yyvsp[-8].id,yyvsp[-9].list,yyvsp[-7].id,
-                                                   yyvsp[-4].cbuf,yyvsp[-1].cbuf);
+                                                   yyvsp[-4].cbuf,yyvsp[-5].line,
+                                                   yyvsp[-1].cbuf,yyvsp[-2].line);
                                class_nodes = g_list_append(class_nodes,node);
                        } else if(strcmp(yyvsp[-6].id,"set")==0 &&
                                strcmp(yyvsp[-3].id,"get")==0) {
                                Node *node;
                                g_free(yyvsp[-6].id); g_free(yyvsp[-3].id);
                                node = new_argument(yyvsp[-8].id,yyvsp[-9].list,yyvsp[-7].id,
-                                                   yyvsp[-1].cbuf,yyvsp[-4].cbuf);
+                                                   yyvsp[-1].cbuf,yyvsp[-2].line,
+                                                   yyvsp[-4].cbuf,yyvsp[-5].line);
                                class_nodes = g_list_append(class_nodes,node);
                        } else {
                                g_free(yyvsp[-8].id); g_free(yyvsp[-7].id);
@@ -1121,19 +1109,19 @@ case 19:
                                                ;
     break;}
 case 20:
-#line 251 "parse.y"
+#line 254 "parse.y"
 {
                        if(strcmp(yyvsp[-3].id,"get")==0) {
                                Node *node;
                                g_free(yyvsp[-3].id);
                                node = new_argument(yyvsp[-5].id,yyvsp[-6].list,yyvsp[-4].id,
-                                                   yyvsp[-1].cbuf,NULL);
+                                                   yyvsp[-1].cbuf,yyvsp[-2].line,NULL,0);
                                class_nodes = g_list_append(class_nodes,node);
                        } else if(strcmp(yyvsp[-3].id,"set")==0) {
                                Node *node;
                                g_free(yyvsp[-3].id);
                                node = new_argument(yyvsp[-5].id,yyvsp[-6].list,yyvsp[-4].id,
-                                                   NULL,yyvsp[-1].cbuf);
+                                                   NULL,0,yyvsp[-1].cbuf,yyvsp[-2].line);
                                class_nodes = g_list_append(class_nodes,node);
                        } else {
                                g_free(yyvsp[-3].id); g_free(yyvsp[-5].id);
@@ -1146,34 +1134,34 @@ case 20:
                                                ;
     break;}
 case 21:
-#line 275 "parse.y"
+#line 278 "parse.y"
 { yyval.list = yyvsp[-1].list; ;
     break;}
 case 22:
-#line 276 "parse.y"
+#line 279 "parse.y"
 { yyval.list = NULL; ;
     break;}
 case 23:
-#line 279 "parse.y"
+#line 282 "parse.y"
 {
                        yyval.list = g_list_append(yyvsp[0].list,yyvsp[-2].id);
                                                ;
     break;}
 case 24:
-#line 282 "parse.y"
+#line 285 "parse.y"
 {
                        yyval.list = g_list_append(NULL,yyvsp[0].id);
                                                ;
     break;}
 case 25:
-#line 288 "parse.y"
+#line 291 "parse.y"
 {
                        Node *node = new_type(0,yyvsp[0].id);
                        typestack = g_list_prepend(typestack,node);
                                                ;
     break;}
 case 26:
-#line 292 "parse.y"
+#line 295 "parse.y"
 {
                        Node *node = new_type(stars,yyvsp[-1].id);
                        stars = 0;
@@ -1181,202 +1169,201 @@ case 26:
                                                ;
     break;}
 case 27:
-#line 299 "parse.y"
+#line 302 "parse.y"
 {
                        yyval.id = g_strconcat("unsigned ",yyvsp[0].id,NULL);
                                                ;
     break;}
 case 28:
-#line 302 "parse.y"
+#line 305 "parse.y"
 {
                        yyval.id = g_strconcat("signed ",yyvsp[0].id,NULL);
                                                ;
     break;}
 case 29:
-#line 305 "parse.y"
+#line 308 "parse.y"
 {
                        yyval.id = g_strdup(yyvsp[0].id);
                                                ;
     break;}
 case 30:
-#line 308 "parse.y"
+#line 311 "parse.y"
 {
                        yyval.id = g_strdup("unsigned char");
                                                ;
     break;}
 case 31:
-#line 311 "parse.y"
+#line 314 "parse.y"
 {
                        yyval.id = g_strdup("signed char");
                                                ;
     break;}
 case 32:
-#line 314 "parse.y"
+#line 317 "parse.y"
 {
                        yyval.id = g_strdup("char");
                                                ;
     break;}
 case 33:
-#line 317 "parse.y"
+#line 320 "parse.y"
 {
                        yyval.id = g_strdup("double");
                                                ;
     break;}
 case 34:
-#line 320 "parse.y"
+#line 323 "parse.y"
 {
                        yyval.id = g_strdup("float");
                                                ;
     break;}
 case 35:
-#line 323 "parse.y"
+#line 326 "parse.y"
 {
                        yyval.id = yyvsp[0].id;
                                                ;
     break;}
 case 36:
-#line 326 "parse.y"
+#line 329 "parse.y"
 {
                        yyval.id = g_strconcat(yyvsp[-1].id,yyvsp[0].id,NULL);
                        g_free(yyvsp[0].id);
                                                ;
     break;}
 case 37:
-#line 330 "parse.y"
+#line 333 "parse.y"
 {
                        yyval.id = yyvsp[0].id;
                                                ;
     break;}
 case 38:
-#line 333 "parse.y"
+#line 336 "parse.y"
 {
                        yyval.id = g_strdup("void");
                                                ;
     break;}
 case 39:
-#line 338 "parse.y"
+#line 341 "parse.y"
 {
                        yyval.id = "long int";
                                                ;
     break;}
 case 40:
-#line 341 "parse.y"
+#line 344 "parse.y"
 {
                        yyval.id = "long";
                                                ;
     break;}
 case 41:
-#line 344 "parse.y"
+#line 347 "parse.y"
 {
                        yyval.id = "short int";
                                                ;
     break;}
 case 42:
-#line 347 "parse.y"
+#line 350 "parse.y"
 {
                        yyval.id = "short";
                                                ;
     break;}
 case 43:
-#line 350 "parse.y"
+#line 353 "parse.y"
 {
                        yyval.id = "int";
                                                ;
     break;}
 case 44:
-#line 355 "parse.y"
+#line 358 "parse.y"
 {
                        yyval.id = "enum ";
                                                ;
     break;}
 case 45:
-#line 358 "parse.y"
+#line 361 "parse.y"
 {
                        yyval.id = "union ";
                                                ;
     break;}
 case 46:
-#line 361 "parse.y"
+#line 364 "parse.y"
 {
                        yyval.id = "struct ";
                                                ;
     break;}
 case 47:
-#line 366 "parse.y"
+#line 369 "parse.y"
 { stars++; ;
     break;}
 case 48:
-#line 367 "parse.y"
+#line 370 "parse.y"
 { stars++; ;
     break;}
 case 49:
-#line 370 "parse.y"
+#line 373 "parse.y"
 {
                        gtktypes = g_list_prepend(gtktypes,yyvsp[-3].id);
                                                ;
     break;}
 case 50:
-#line 375 "parse.y"
+#line 378 "parse.y"
 {
                        gtktypes = g_list_append(gtktypes,yyvsp[0].id);
                                                ;
     break;}
 case 51:
-#line 378 "parse.y"
+#line 381 "parse.y"
 { 
                        gtktypes = g_list_append(gtktypes,yyvsp[0].id);
                                                        ;
     break;}
 case 52:
-#line 384 "parse.y"
+#line 387 "parse.y"
 {
-                       if(!has_this) {
-                               yyerror(_("signal without 'this' as "
-                                         "first parameter"));
+                       int sigtype = SIGNAL_LAST_METHOD;
+                       if(strcmp(yyvsp[-9].id,"first")==0)
+                               sigtype = SIGNAL_FIRST_METHOD;
+                       else if(strcmp(yyvsp[-9].id,"last")==0)
+                               sigtype = SIGNAL_LAST_METHOD;
+                       else {
+                               yyerror(_("signal must be 'first' or 'last'"));
+                               g_free(yyvsp[-9].id);
                                YYERROR;
                        }
-                       push_function(SIGNAL_LAST_METHOD,NULL,
-                                     yyvsp[-6].id, yyvsp[-2].id, yyvsp[0].cbuf,yyvsp[-10].line);
-                                                                       ;
-    break;}
-case 53:
-#line 393 "parse.y"
-{
+                       g_free(yyvsp[-9].id);
+
                        if(!has_this) {
                                yyerror(_("signal without 'this' as "
                                          "first parameter"));
                                YYERROR;
                        }
-                       push_function(SIGNAL_LAST_METHOD, NULL,
-                                     yyvsp[-5].id, yyvsp[-1].id, NULL,yyvsp[-9].line);
+                       push_function(sigtype,NULL,
+                                     yyvsp[-6].id, yyvsp[-2].id, yyvsp[0].cbuf,yyvsp[-10].line,yyvsp[-1].line);
                                                                        ;
     break;}
-case 54:
-#line 402 "parse.y"
+case 53:
+#line 408 "parse.y"
 {
-                       if(!has_this) {
-                               yyerror(_("signal without 'this' as "
-                                         "first parameter"));
+                       int sigtype = SIGNAL_LAST_METHOD;
+                       if(strcmp(yyvsp[-8].id,"first")==0)
+                               sigtype = SIGNAL_FIRST_METHOD;
+                       else if(strcmp(yyvsp[-8].id,"last")==0)
+                               sigtype = SIGNAL_LAST_METHOD;
+                       else {
+                               yyerror(_("signal must be 'first' or 'last'"));
+                               g_free(yyvsp[-8].id);
                                YYERROR;
                        }
-                       push_function(SIGNAL_FIRST_METHOD, NULL,
-                                     yyvsp[-6].id, yyvsp[-2].id, yyvsp[0].cbuf,yyvsp[-10].line);
-                                                                       ;
-    break;}
-case 55:
-#line 411 "parse.y"
-{
+                       g_free(yyvsp[-8].id);
                        if(!has_this) {
                                yyerror(_("signal without 'this' as "
                                          "first parameter"));
                                YYERROR;
                        }
-                       push_function(SIGNAL_FIRST_METHOD, NULL, yyvsp[-5].id,
-                                     yyvsp[-1].id, NULL,yyvsp[-9].line);
+                       push_function(sigtype, NULL,
+                                     yyvsp[-5].id, yyvsp[-1].id, NULL,yyvsp[-9].line,0);
                                                                        ;
     break;}
-case 56:
-#line 420 "parse.y"
+case 54:
+#line 428 "parse.y"
 {
                        if(!has_this) {
                                yyerror(_("signal without 'this' as "
@@ -1384,11 +1371,11 @@ case 56:
                                YYERROR;
                        }
                        push_function(SIGNAL_LAST_METHOD, NULL,
-                                     yyvsp[-6].id, yyvsp[-2].id, yyvsp[0].cbuf,yyvsp[-9].line);
+                                     yyvsp[-6].id, yyvsp[-2].id, yyvsp[0].cbuf,yyvsp[-9].line,yyvsp[-1].line);
                                                                        ;
     break;}
-case 57:
-#line 429 "parse.y"
+case 55:
+#line 437 "parse.y"
 {
                        if(!has_this) {
                                yyerror(_("signal without 'this' as "
@@ -1396,55 +1383,55 @@ case 57:
                                YYERROR;
                        }
                        push_function(SIGNAL_LAST_METHOD, NULL, yyvsp[-5].id,
-                                     yyvsp[-1].id, NULL,yyvsp[-8].line);
+                                     yyvsp[-1].id, NULL,yyvsp[-8].line,0);
                                                                        ;
     break;}
-case 58:
-#line 438 "parse.y"
+case 56:
+#line 446 "parse.y"
 {
                        push_function(VIRTUAL_METHOD, NULL, yyvsp[-6].id,
-                                     yyvsp[-2].id, yyvsp[0].cbuf,yyvsp[-8].line);
+                                     yyvsp[-2].id, yyvsp[0].cbuf,yyvsp[-8].line,yyvsp[-1].line);
                                                                        ;
     break;}
-case 59:
-#line 442 "parse.y"
+case 57:
+#line 450 "parse.y"
 {
                        push_function(VIRTUAL_METHOD, NULL, yyvsp[-5].id,
-                                     yyvsp[-1].id, NULL,yyvsp[-7].line);
+                                     yyvsp[-1].id, NULL,yyvsp[-7].line,0);
                                                                        ;
     break;}
-case 60:
-#line 446 "parse.y"
+case 58:
+#line 454 "parse.y"
 {
                        push_function(OVERRIDE_METHOD, yyvsp[-9].id,
-                                     yyvsp[-6].id, yyvsp[-2].id, yyvsp[0].cbuf,yyvsp[-11].line);
+                                     yyvsp[-6].id, yyvsp[-2].id, yyvsp[0].cbuf,yyvsp[-11].line,yyvsp[-1].line);
                                                                        ;
     break;}
-case 61:
-#line 450 "parse.y"
+case 59:
+#line 458 "parse.y"
 {
                        push_function(PUBLIC_SCOPE, NULL, yyvsp[-6].id,
-                                     yyvsp[-2].id, yyvsp[0].cbuf,yyvsp[-8].line);
+                                     yyvsp[-2].id, yyvsp[0].cbuf,yyvsp[-8].line,yyvsp[-1].line);
                                                                ;
     break;}
-case 62:
-#line 454 "parse.y"
+case 60:
+#line 462 "parse.y"
 {
                        push_function(PRIVATE_SCOPE, NULL, yyvsp[-6].id,
-                                     yyvsp[-2].id, yyvsp[0].cbuf,yyvsp[-8].line);
+                                     yyvsp[-2].id, yyvsp[0].cbuf,yyvsp[-8].line,yyvsp[-1].line);
                                                                ;
     break;}
-case 63:
-#line 458 "parse.y"
+case 61:
+#line 466 "parse.y"
 {
                        if(strcmp(yyvsp[-4].id,"init")==0) {
                                push_init_arg(yyvsp[-2].id,FALSE);
                                push_function(INIT_METHOD, NULL, yyvsp[-4].id, 
-                                             NULL, NULL,yyvsp[-3].line);
+                                             NULL, NULL,yyvsp[-3].line,0);
                        } else if(strcmp(yyvsp[-4].id,"class_init")==0) {
                                push_init_arg(yyvsp[-2].id,TRUE);
                                push_function(CLASS_INIT_METHOD, NULL,
-                                             yyvsp[-4].id, NULL, NULL,yyvsp[-3].line);
+                                             yyvsp[-4].id, NULL, NULL,yyvsp[-3].line,0);
                        } else {
                                g_free(yyvsp[-4].id);
                                g_free(yyvsp[-2].id);
@@ -1453,17 +1440,19 @@ case 63:
                        }
                                                ;
     break;}
-case 64:
-#line 474 "parse.y"
+case 62:
+#line 482 "parse.y"
 {
                        if(strcmp(yyvsp[-5].id,"init")==0) {
                                push_init_arg(yyvsp[-3].id,FALSE);
                                push_function(INIT_METHOD, NULL,
-                                             yyvsp[-5].id, NULL, yyvsp[0].cbuf,yyvsp[-4].line);
+                                             yyvsp[-5].id, NULL, yyvsp[0].cbuf,yyvsp[-4].line,
+                                             yyvsp[-1].line);
                        } else if(strcmp(yyvsp[-5].id,"class_init")==0) {
                                push_init_arg(yyvsp[-3].id,TRUE);
                                push_function(CLASS_INIT_METHOD, NULL, 
-                                             yyvsp[-5].id, NULL, yyvsp[0].cbuf,yyvsp[-4].line);
+                                             yyvsp[-5].id, NULL, yyvsp[0].cbuf,yyvsp[-4].line,
+                                             yyvsp[-1].line);
                        } else {
                                g_free(yyvsp[-5].id);
                                g_free(yyvsp[-3].id);
@@ -1473,35 +1462,35 @@ case 64:
                        }
                                                ;
     break;}
-case 65:
-#line 493 "parse.y"
+case 63:
+#line 503 "parse.y"
 { yyval.id = yyvsp[0].id; ;
     break;}
-case 66:
-#line 494 "parse.y"
+case 64:
+#line 504 "parse.y"
 { yyval.id = yyvsp[0].id; ;
     break;}
-case 67:
-#line 495 "parse.y"
+case 65:
+#line 505 "parse.y"
 {
                        yyval.id = (yyvsp[0].cbuf)->str;
                        g_string_free(yyvsp[0].cbuf,FALSE);
                                        ;
     break;}
-case 68:
-#line 499 "parse.y"
+case 66:
+#line 509 "parse.y"
 { ; ;
     break;}
-case 69:
-#line 500 "parse.y"
+case 67:
+#line 510 "parse.y"
 { yyval.id = NULL; ;
     break;}
-case 70:
-#line 505 "parse.y"
+case 68:
+#line 515 "parse.y"
 { has_this = FALSE; ;
     break;}
-case 71:
-#line 506 "parse.y"
+case 69:
+#line 516 "parse.y"
 {
                        has_this = TRUE;
                        if(strcmp(yyvsp[0].id,"this")==0)
@@ -1513,8 +1502,8 @@ case 71:
                        }
                                                ;
     break;}
-case 72:
-#line 516 "parse.y"
+case 70:
+#line 526 "parse.y"
 {
                        has_this = TRUE;
                        if(strcmp(yyvsp[-2].id,"this")==0)
@@ -1526,100 +1515,107 @@ case 72:
                        }
                                        ;
     break;}
-case 73:
-#line 526 "parse.y"
+case 71:
+#line 536 "parse.y"
 { has_this = FALSE; ;
     break;}
-case 74:
-#line 529 "parse.y"
+case 72:
+#line 539 "parse.y"
 { ; ;
     break;}
-case 75:
-#line 530 "parse.y"
+case 73:
+#line 540 "parse.y"
 { ; ;
     break;}
-case 76:
-#line 533 "parse.y"
+case 74:
+#line 543 "parse.y"
 {
                        push_funcarg(yyvsp[0].id);
                                                                ;
     break;}
-case 77:
-#line 536 "parse.y"
+case 75:
+#line 546 "parse.y"
 {
+                       if(strcmp(yyvsp[-2].id,"check")!=0) {
+                               yyerror(_("parse error"));
+                               YYERROR;
+                       }
+                       g_free(yyvsp[-2].id);
                        push_funcarg(yyvsp[-4].id);
                                                                ;
     break;}
-case 78:
-#line 541 "parse.y"
+case 76:
+#line 556 "parse.y"
 { ; ;
     break;}
-case 79:
-#line 542 "parse.y"
+case 77:
+#line 557 "parse.y"
 { ; ;
     break;}
-case 80:
-#line 545 "parse.y"
-{
-                       Node *node = new_check(NULL_CHECK,NULL);
-                       checks = g_list_append(checks,node);
-                                       ;
-    break;}
-case 81:
-#line 549 "parse.y"
-{
-                       Node *node = new_check(TYPE_CHECK,NULL);
-                       checks = g_list_append(checks,node);
+case 78:
+#line 560 "parse.y"
+{
+                       if(strcmp(yyvsp[0].id,"type")==0) {
+                               Node *node = new_check(TYPE_CHECK,NULL);
+                               checks = g_list_append(checks,node);
+                       } else if(strcmp(yyvsp[0].id,"null")==0) {
+                               Node *node = new_check(NULL_CHECK,NULL);
+                               checks = g_list_append(checks,node);
+                       } else {
+                               yyerror(_("parse error"));
+                               YYERROR;
+                       }
+                       g_free(yyvsp[0].id);
                                        ;
     break;}
-case 82:
-#line 553 "parse.y"
+case 79:
+#line 573 "parse.y"
 {
                        Node *node = new_check(GT_CHECK,yyvsp[0].id);
                        checks = g_list_append(checks,node);
                                        ;
     break;}
-case 83:
-#line 557 "parse.y"
+case 80:
+#line 577 "parse.y"
 {
                        Node *node = new_check(LT_CHECK,yyvsp[0].id);
                        checks = g_list_append(checks,node);
                                        ;
     break;}
-case 84:
-#line 561 "parse.y"
+case 81:
+#line 581 "parse.y"
 {
                        Node *node = new_check(GE_CHECK,yyvsp[0].id);
                        checks = g_list_append(checks,node);
                                        ;
     break;}
-case 85:
-#line 565 "parse.y"
+case 82:
+#line 585 "parse.y"
 {
                        Node *node = new_check(LE_CHECK,yyvsp[0].id);
                        checks = g_list_append(checks,node);
                                        ;
     break;}
-case 86:
-#line 569 "parse.y"
+case 83:
+#line 589 "parse.y"
 {
                        Node *node = new_check(EQ_CHECK,yyvsp[0].id);
                        checks = g_list_append(checks,node);
                                        ;
     break;}
-case 87:
-#line 573 "parse.y"
+case 84:
+#line 593 "parse.y"
 {
                        Node *node = new_check(NE_CHECK,yyvsp[0].id);
                        checks = g_list_append(checks,node);
                                        ;
     break;}
-case 88:
-#line 579 "parse.y"
+case 85:
+#line 599 "parse.y"
 { yyval.id = yyvsp[0].id; ;
     break;}
-case 89:
-#line 580 "parse.y"
+case 86:
+#line 600 "parse.y"
 {
                        yyval.id = g_strconcat("-",yyvsp[0].id,NULL);
                        g_free(yyvsp[0].id);
@@ -1847,5 +1843,5 @@ yyerrhandle:
     }
   return 1;
 }
-#line 586 "parse.y"
+#line 606 "parse.y"
 
index 5bb8bc37c453d992cb848e4f013763e24cc74ba0..b718cdc9d417650a2d4c1646fa3370773f29a277 100644 (file)
@@ -47,6 +47,7 @@ static GList *gtktypes = NULL;
 void free(void *ptr);
 int yylex(void);
 
+extern int ccode_line;
 extern int line_no;
 
 extern char *yytext;
@@ -89,7 +90,7 @@ push_variable(char *name, int scope)
 
 static void
 push_function(int scope, char *oid, char *id, char *onerror,
-             GString *cbuf,int line_no)
+             GString *cbuf,int line_no, int ccode_line)
 {
        Node *node;
        Type *type;
@@ -102,7 +103,7 @@ push_function(int scope, char *oid, char *id, char *onerror,
        }
        
        node = new_method(scope,type,oid,gtktypes,id,funcargs,
-                         onerror,cbuf,line_no);
+                         onerror,cbuf,line_no,ccode_line);
        gtktypes = NULL;
        funcargs = NULL;
 
@@ -164,7 +165,7 @@ push_this(char *this)
 %token CLASS FROM
 %token VOID STRUCT UNION ENUM SIGNED UNSIGNED LONG SHORT INT FLOAT DOUBLE CHAR
 %token FIRST LAST
-%token CHECK CNULL TYPE ONERROR
+%token ONERROR
 
 %token <id> TOKEN NUMBER TYPETOKEN
 %token <cbuf> CCODE HCODE
@@ -179,19 +180,19 @@ prog:             ccodes class ccodes     { ; }
        ;
 
 ccodes:                ccodes CCODE            {
-                       Node *node = new_ccode(FALSE,$<cbuf>2);
+                       Node *node = new_ccode(FALSE,$<cbuf>2,ccode_line);
                        nodes = g_list_append(nodes,node);
                                        }
        |       ccodes HCODE            {
-                       Node *node = new_ccode(TRUE,$<cbuf>2);
+                       Node *node = new_ccode(TRUE,$<cbuf>2,ccode_line);
                        nodes = g_list_append(nodes,node);
                                        }
        |       CCODE                   {
-                       Node *node = new_ccode(FALSE,$<cbuf>1);
+                       Node *node = new_ccode(FALSE,$<cbuf>1,ccode_line);
                        nodes = g_list_append(nodes,node);
                                        }
        |       HCODE                   {
-                       Node *node = new_ccode(TRUE,$<cbuf>1);
+                       Node *node = new_ccode(TRUE,$<cbuf>1,ccode_line);
                        nodes = g_list_append(nodes,node);
                                        }
        ;
@@ -229,14 +230,16 @@ argument: ARGUMENT argflags TOKEN TOKEN TOKEN '{' CCODE TOKEN '{' CCODE ';' {
                                Node *node;
                                g_free($<id>5); g_free($<id>8);
                                node = new_argument($<id>3,$<list>2,$<id>4,
-                                                   $<cbuf>7,$<cbuf>10);
+                                                   $<cbuf>7,$<line>6,
+                                                   $<cbuf>10,$<line>9);
                                class_nodes = g_list_append(class_nodes,node);
                        } else if(strcmp($<id>5,"set")==0 &&
                                strcmp($<id>8,"get")==0) {
                                Node *node;
                                g_free($<id>5); g_free($<id>8);
                                node = new_argument($<id>3,$<list>2,$<id>4,
-                                                   $<cbuf>10,$<cbuf>7);
+                                                   $<cbuf>10,$<line>9,
+                                                   $<cbuf>7,$<line>6);
                                class_nodes = g_list_append(class_nodes,node);
                        } else {
                                g_free($<id>3); g_free($<id>4);
@@ -253,13 +256,13 @@ argument: ARGUMENT argflags TOKEN TOKEN TOKEN '{' CCODE TOKEN '{' CCODE ';' {
                                Node *node;
                                g_free($<id>5);
                                node = new_argument($<id>3,$<list>2,$<id>4,
-                                                   $<cbuf>7,NULL);
+                                                   $<cbuf>7,$<line>6,NULL,0);
                                class_nodes = g_list_append(class_nodes,node);
                        } else if(strcmp($<id>5,"set")==0) {
                                Node *node;
                                g_free($<id>5);
                                node = new_argument($<id>3,$<list>2,$<id>4,
-                                                   NULL,$<cbuf>7);
+                                                   NULL,0,$<cbuf>7,$<line>6);
                                class_nodes = g_list_append(class_nodes,node);
                        } else {
                                g_free($<id>5); g_free($<id>3);
@@ -381,41 +384,46 @@ tokenlist:        tokenlist ',' TOKEN             {
        ;
 
 /*here CCODE will include the ending '}' */
-method:                SIGNAL LAST sigtype type TOKEN '(' funcargs ')' onerror '{' CCODE {
-                       if(!has_this) {
-                               yyerror(_("signal without 'this' as "
-                                         "first parameter"));
+method:                SIGNAL TOKEN sigtype type TOKEN '(' funcargs ')' onerror '{' CCODE {
+                       int sigtype = SIGNAL_LAST_METHOD;
+                       if(strcmp($<id>2,"first")==0)
+                               sigtype = SIGNAL_FIRST_METHOD;
+                       else if(strcmp($<id>2,"last")==0)
+                               sigtype = SIGNAL_LAST_METHOD;
+                       else {
+                               yyerror(_("signal must be 'first' or 'last'"));
+                               g_free($<id>2);
                                YYERROR;
                        }
-                       push_function(SIGNAL_LAST_METHOD,NULL,
-                                     $<id>5, $<id>9, $<cbuf>11,$<line>1);
-                                                                       }
-       |       SIGNAL LAST sigtype type TOKEN '(' funcargs ')' onerror ';'     {
+                       g_free($<id>2);
+
                        if(!has_this) {
                                yyerror(_("signal without 'this' as "
                                          "first parameter"));
                                YYERROR;
                        }
-                       push_function(SIGNAL_LAST_METHOD, NULL,
-                                     $<id>5, $<id>9, NULL,$<line>1);
+                       push_function(sigtype,NULL,
+                                     $<id>5, $<id>9, $<cbuf>11,$<line>1,$<line>10);
                                                                        }
-       |       SIGNAL FIRST sigtype type TOKEN '(' funcargs ')' onerror '{' CCODE {
-                       if(!has_this) {
-                               yyerror(_("signal without 'this' as "
-                                         "first parameter"));
+       |       SIGNAL TOKEN sigtype type TOKEN '(' funcargs ')' onerror ';'    {
+                       int sigtype = SIGNAL_LAST_METHOD;
+                       if(strcmp($<id>2,"first")==0)
+                               sigtype = SIGNAL_FIRST_METHOD;
+                       else if(strcmp($<id>2,"last")==0)
+                               sigtype = SIGNAL_LAST_METHOD;
+                       else {
+                               yyerror(_("signal must be 'first' or 'last'"));
+                               g_free($<id>2);
                                YYERROR;
                        }
-                       push_function(SIGNAL_FIRST_METHOD, NULL,
-                                     $<id>5, $<id>9, $<cbuf>11,$<line>1);
-                                                                       }
-       |       SIGNAL FIRST sigtype type TOKEN '(' funcargs ')' onerror ';'    {
+                       g_free($<id>2);
                        if(!has_this) {
                                yyerror(_("signal without 'this' as "
                                          "first parameter"));
                                YYERROR;
                        }
-                       push_function(SIGNAL_FIRST_METHOD, NULL, $<id>5,
-                                     $<id>9, NULL,$<line>1);
+                       push_function(sigtype, NULL,
+                                     $<id>5, $<id>9, NULL,$<line>1,0);
                                                                        }
        |       SIGNAL sigtype type TOKEN '(' funcargs ')' onerror '{' CCODE    {
                        if(!has_this) {
@@ -424,7 +432,7 @@ method:             SIGNAL LAST sigtype type TOKEN '(' funcargs ')' onerror '{' CCODE {
                                YYERROR;
                        }
                        push_function(SIGNAL_LAST_METHOD, NULL,
-                                     $<id>4, $<id>8, $<cbuf>10,$<line>1);
+                                     $<id>4, $<id>8, $<cbuf>10,$<line>1,$<line>9);
                                                                        }
        |       SIGNAL sigtype type TOKEN '(' funcargs ')' onerror ';'          {
                        if(!has_this) {
@@ -433,37 +441,37 @@ method:           SIGNAL LAST sigtype type TOKEN '(' funcargs ')' onerror '{' CCODE {
                                YYERROR;
                        }
                        push_function(SIGNAL_LAST_METHOD, NULL, $<id>4,
-                                     $<id>8, NULL,$<line>1);
+                                     $<id>8, NULL,$<line>1,0);
                                                                        }
        |       VIRTUAL type TOKEN '(' funcargs ')' onerror '{' CCODE   {
                        push_function(VIRTUAL_METHOD, NULL, $<id>3,
-                                     $<id>7, $<cbuf>9,$<line>1);
+                                     $<id>7, $<cbuf>9,$<line>1,$<line>8);
                                                                        }
        |       VIRTUAL type TOKEN '(' funcargs ')' onerror ';'         {
                        push_function(VIRTUAL_METHOD, NULL, $<id>3,
-                                     $<id>7, NULL,$<line>1);
+                                     $<id>7, NULL,$<line>1,0);
                                                                        }
        |       OVERRIDE '(' TYPETOKEN ')' type TOKEN '(' funcargs ')' onerror '{' CCODE        {
                        push_function(OVERRIDE_METHOD, $<id>3,
-                                     $<id>6, $<id>10, $<cbuf>12,$<line>1);
+                                     $<id>6, $<id>10, $<cbuf>12,$<line>1,$<line>11);
                                                                        }
        |       PUBLIC type TOKEN '(' funcargs ')' onerror '{' CCODE    {
                        push_function(PUBLIC_SCOPE, NULL, $<id>3,
-                                     $<id>7, $<cbuf>9,$<line>1);
+                                     $<id>7, $<cbuf>9,$<line>1,$<line>8);
                                                                }
        |       PRIVATE type TOKEN '(' funcargs ')' onerror '{' CCODE   {
                        push_function(PRIVATE_SCOPE, NULL, $<id>3,
-                                     $<id>7, $<cbuf>9,$<line>1);
+                                     $<id>7, $<cbuf>9,$<line>1,$<line>8);
                                                                }
        |       TOKEN '(' TOKEN ')' ';'         {
                        if(strcmp($<id>1,"init")==0) {
                                push_init_arg($<id>3,FALSE);
                                push_function(INIT_METHOD, NULL, $<id>1, 
-                                             NULL, NULL,$<line>2);
+                                             NULL, NULL,$<line>2,0);
                        } else if(strcmp($<id>1,"class_init")==0) {
                                push_init_arg($<id>3,TRUE);
                                push_function(CLASS_INIT_METHOD, NULL,
-                                             $<id>1, NULL, NULL,$<line>2);
+                                             $<id>1, NULL, NULL,$<line>2,0);
                        } else {
                                g_free($<id>1);
                                g_free($<id>3);
@@ -475,11 +483,13 @@ method:           SIGNAL LAST sigtype type TOKEN '(' funcargs ')' onerror '{' CCODE {
                        if(strcmp($<id>1,"init")==0) {
                                push_init_arg($<id>3,FALSE);
                                push_function(INIT_METHOD, NULL,
-                                             $<id>1, NULL, $<cbuf>6,$<line>2);
+                                             $<id>1, NULL, $<cbuf>6,$<line>2,
+                                             $<line>5);
                        } else if(strcmp($<id>1,"class_init")==0) {
                                push_init_arg($<id>3,TRUE);
                                push_function(CLASS_INIT_METHOD, NULL, 
-                                             $<id>1, NULL, $<cbuf>6,$<line>2);
+                                             $<id>1, NULL, $<cbuf>6,$<line>2,
+                                             $<line>5);
                        } else {
                                g_free($<id>1);
                                g_free($<id>3);
@@ -533,7 +543,12 @@ arglist:   arglist ',' arg         { ; }
 arg:           type TOKEN                                      {
                        push_funcarg($<id>2);
                                                                }
-       |       type TOKEN '(' CHECK checklist ')'              {
+       |       type TOKEN '(' TOKEN checklist ')'              {
+                       if(strcmp($<id>4,"check")!=0) {
+                               yyerror(_("parse error"));
+                               YYERROR;
+                       }
+                       g_free($<id>4);
                        push_funcarg($<id>2);
                                                                }
        ;
@@ -542,13 +557,18 @@ checklist:        checklist check         { ; }
        |       check                   { ; }
        ;
 
-check:         CNULL                   {
-                       Node *node = new_check(NULL_CHECK,NULL);
-                       checks = g_list_append(checks,node);
-                                       }
-       |       TYPE                    {
-                       Node *node = new_check(TYPE_CHECK,NULL);
-                       checks = g_list_append(checks,node);
+check:         TOKEN                   {
+                       if(strcmp($<id>1,"type")==0) {
+                               Node *node = new_check(TYPE_CHECK,NULL);
+                               checks = g_list_append(checks,node);
+                       } else if(strcmp($<id>1,"null")==0) {
+                               Node *node = new_check(NULL_CHECK,NULL);
+                               checks = g_list_append(checks,node);
+                       } else {
+                               yyerror(_("parse error"));
+                               YYERROR;
+                       }
+                       g_free($<id>1);
                                        }
        |       '>' number              {
                        Node *node = new_check(GT_CHECK,$<id>2);
index 530145b355c463543aaca312a8a6c72510967b4f..a68b97438957404bd5b949e5775fd87f7d544796 100644 (file)
 #include "tree.h"
 
 Node *
-new_ccode(int header, GString *cbuf)
+new_ccode(int header, GString *cbuf, int line_no)
 {
        CCode *node = (CCode *)g_new(Node,1);
        node->type = CCODE_NODE;
        node->header = header;
        node->cbuf = cbuf;
+       node->line_no = line_no;
        return (Node *)node;
 }
 
@@ -76,7 +77,7 @@ new_funcarg(Type *atype, char *name, GList *checks)
 }
 
 Node *
-new_method(int scope, Type *mtype, char *otype, GList *gtktypes, char *id, GList *args, char *onerror, GString *cbuf, int line_no)
+new_method(int scope, Type *mtype, char *otype, GList *gtktypes, char *id, GList *args, char *onerror, GString *cbuf, int line_no,int ccode_line)
 {
        Method *node = (Method *)g_new(Node,1);
        node->type = METHOD_NODE;
@@ -89,11 +90,12 @@ new_method(int scope, Type *mtype, char *otype, GList *gtktypes, char *id, GList
        node->onerror = onerror;
        node->cbuf = cbuf;
        node->line_no = line_no;
+       node->ccode_line = ccode_line;
        return (Node *)node;
 }
 
 Node *
-new_argument(char *gtktype, GList *flags, char *name, GString *get, GString *set)
+new_argument(char *gtktype, GList *flags, char *name, GString *get, int get_line, GString *set, int set_line)
 {
        Argument *node = (Argument *)g_new(Node,1);
        node->type = ARGUMENT_NODE;
@@ -101,7 +103,9 @@ new_argument(char *gtktype, GList *flags, char *name, GString *get, GString *set
        node->flags = flags;
        node->name = name;
        node->get = get;
+       node->get_line = get_line;
        node->set = set;
+       node->set_line = set_line;
        return (Node *)node;
 }
 
index d3617a9a9b61c1a728338f032b36948004084067..348cb8a77b1bd7ef9f3462058f951a30d5fa994e 100644 (file)
@@ -42,6 +42,7 @@ struct _CCode {
        int type;
        int header;
        GString *cbuf;
+       int line_no;
 };
 
 typedef struct _Class Class;
@@ -92,7 +93,9 @@ struct _Argument {
        GList *flags;
        char *name;
        GString *get;
+       int get_line;
        GString *set;
+       int set_line;
 };
        
 /*scope type*/
@@ -119,6 +122,7 @@ struct _Method {
        char *onerror;
        GString *cbuf;
        int line_no;
+       int ccode_line;
 };
 
 typedef struct _Variable Variable;
@@ -140,13 +144,13 @@ union _Node {
        Variable variable;
 };
 
-Node *new_ccode(int header, GString *cbuf);
+Node *new_ccode(int header, GString *cbuf, int line_no);
 Node *new_class(char *otype, char *ptype, GList *nodes);
 Node *new_type(int stars, char *name);
 Node *new_check(int chtype, char *number);
 Node *new_funcarg(Type *atype, char *name, GList *checks);
-Node *new_method(int scope, Type *mtype, char *otype, GList *gtktypes, char *id, GList *args, char *onerror, GString *cbuf,int line_no);
-Node *new_argument(char *gtktype, GList *flags, char *name, GString *get, GString *set);
+Node *new_method(int scope, Type *mtype, char *otype, GList *gtktypes, char *id, GList *args, char *onerror, GString *cbuf,int line_no,int ccode_line);
+Node *new_argument(char *gtktype, GList *flags, char *name, GString *get, int get_line, GString *set, int set_line);
 Node *new_variable(int scope, Type *vtype, char *id);
 
 #endif