]> git.draconx.ca Git - gob-dx.git/commitdiff
Release 0.90.0 v0.90.0
authorGeorge Lebl <jirka@5z.com>
Mon, 30 Aug 1999 06:51:00 +0000 (22:51 -0800)
committerNick Bowler <nbowler@draconx.ca>
Tue, 19 Feb 2019 17:17:50 +0000 (12:17 -0500)
16 files changed:
ChangeLog
NEWS
configure
configure.in
doc/gob.1
doc/gob.1.in
gob.spec
src/Makefile.am
src/Makefile.in
src/main.c
src/main.h [new file with mode: 0644]
src/parse.c
src/parse.y
src/test.gob
src/tree.c
src/tree.h

index d3e47130e63660bbf5098dd67039580f77bfa6e6..88451c1e7267d0feefe9514a0541f57c36f96346 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,29 @@
+Sun Aug 29 13:46:33 1999  George Lebl  <jirka@5z.com>
+
+       * Release 0.90.0
+
+Sat Aug 28 23:36:48 1999  George Lebl  <jirka@5z.com>
+
+       * src/main.[ch],parse.y: make error/warning reporting public
+         and use it to report depreciated use of 'this'
+
+Sat Aug 28 22:41:52 1999  George Lebl  <jirka@5z.com>
+
+       * src/tree.[ch],parse.y,main.c: check for duplicate variables and
+         signals and arguments as well.
+
+Sat Aug 28 22:00:19 1999  George Lebl  <jirka@5z.com>
+
+       * src/parse.y,src/main.c: change "this" to "self", but accept "this"
+         as well
+
+       * src/main.c: check for duplicate methods, and warn on non-public
+         "new" method
+
+       * configure.in: change to version 0.90.0
+
+       * doc/gob.1.in: change this to self
+
 Tue Aug 24 20:37:26 1999  George Lebl  <jirka@5z.com>
 
        * Release 0.0.4
diff --git a/NEWS b/NEWS
index c93f17174213cf57778aa921b0f0e56dffe38d81..8453dbd74b6e1abb3c667d038e96f76198e54535 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -1,3 +1,12 @@
+0.90.0
+       * changed "this" to "self" but recognize "this" as well
+       * warn if "new" is not public
+       * check symbols/arguments/signals for duplicates
+
+0.0.4
+       * you can have tokens inside check statements
+       * avoid warnings when no overrides, signals and arguments
+
 0.0.3
        * "type", "check", "first", "last" and "null" no longer reserved
          words in method prototypes
index 9deca695a5e0696ecdc6ffab5b77670198a6c3cd..0deb73018484644f79917ac5407f4aeb1c025888 100755 (executable)
--- a/configure
+++ b/configure
@@ -703,7 +703,7 @@ fi
 
 PACKAGE=gob
 
-VERSION=0.0.4
+VERSION=0.90.0
 
 if test "`cd $srcdir && pwd`" != "`pwd`" && test -f $srcdir/config.status; then
   { echo "configure: error: source directory already configured; run "make distclean" there first" 1>&2; exit 1; }
index 8a65fd8e11655958f2a5124c34ff9c3a295c56a1..cda5ea7e48c5dfec658cd3caa3b5a276f2edfcbb 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.4)
+AM_INIT_AUTOMAKE(gob,0.90.0)
 
 dnl Checks for programs.
 AC_PROG_CC
index 2e1b157506ccc51fd2a70c7886ba55696aae5738..089cdd39a448e466dd7791b0c4d9a177d8736aff 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.4
+.TH GOB 1 "GOB 0.90.0
 .SH NAME
 GOB \- The GTK+ Object Builder
 .SH SYNOPSIS
@@ -94,13 +94,13 @@ 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
+the identifier "self" 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; };
+  argument INT height set { self->height = ARG; } get { ARG = self->height; };
 
 .fi
 .PP
@@ -111,7 +111,7 @@ without the GTK_ARG_ prefix.  For example:
 .nf
 
   public int height;
-  argument (CONSTRUCT) INT height get { ARG = this->height; };
+  argument (CONSTRUCT) INT height get { ARG = self->height; };
 
 .fi
 .PP
@@ -128,7 +128,7 @@ to add code to the constructors or you can just leave them out.
 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",
+following syntax for arguments.  The first argument can be just "self",
 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
@@ -146,11 +146,11 @@ 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))
+  public int foo(self, 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
+This will be the prototype of a function which has a self 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
@@ -167,7 +167,7 @@ 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 {
+  public void * get_something(self, int i (check >= 0)) onerror NULL {
          ...
   }
 
@@ -193,8 +193,8 @@ 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
+and the types of arguments after the "self" pointer (not including the
+"self" 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
@@ -203,14 +203,14 @@ 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)
+  int do_something(self, Gtk:Widget *w (check null type), int length)
   {
          ...
   }
   
 or
 
-  signal last NONE(NONE) void foo(this);
+  signal last NONE(NONE) void foo(self);
 
 .fi
 .PP
@@ -220,13 +220,13 @@ 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
+it is the same as for other methods.  The "self" 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))
+  add (Gtk:Container *self (check null type), Gtk:Widget *wid (check null type))
   {
          ...
   }
@@ -239,15 +239,15 @@ have to type the class name before each call.  Example:
 .nf
 
   private int
-  foo(this)
+  foo(self)
   {
-         return this->len;
+         return self->len;
   }
   
   private int
-  bar(this,int i)
+  bar(self,int i)
   {
-         return foo(this) + i;
+         return foo(self) + i;
   }
 
 .fi
index 51f8a12c5ff6b5a728980378dcf3df094662d012..ee42dd9d513f411bd20f384786ef6313aa803d0e 100644 (file)
@@ -94,13 +94,13 @@ 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
+the identifier "self" 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; };
+  argument INT height set { self->height = ARG; } get { ARG = self->height; };
 
 .fi
 .PP
@@ -111,7 +111,7 @@ without the GTK_ARG_ prefix.  For example:
 .nf
 
   public int height;
-  argument (CONSTRUCT) INT height get { ARG = this->height; };
+  argument (CONSTRUCT) INT height get { ARG = self->height; };
 
 .fi
 .PP
@@ -128,7 +128,7 @@ to add code to the constructors or you can just leave them out.
 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",
+following syntax for arguments.  The first argument can be just "self",
 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
@@ -146,11 +146,11 @@ 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))
+  public int foo(self, 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
+This will be the prototype of a function which has a self 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
@@ -167,7 +167,7 @@ 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 {
+  public void * get_something(self, int i (check >= 0)) onerror NULL {
          ...
   }
 
@@ -193,8 +193,8 @@ 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
+and the types of arguments after the "self" pointer (not including the
+"self" 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
@@ -203,14 +203,14 @@ 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)
+  int do_something(self, Gtk:Widget *w (check null type), int length)
   {
          ...
   }
   
 or
 
-  signal last NONE(NONE) void foo(this);
+  signal last NONE(NONE) void foo(self);
 
 .fi
 .PP
@@ -220,13 +220,13 @@ 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
+it is the same as for other methods.  The "self" 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))
+  add (Gtk:Container *self (check null type), Gtk:Widget *wid (check null type))
   {
          ...
   }
@@ -239,15 +239,15 @@ have to type the class name before each call.  Example:
 .nf
 
   private int
-  foo(this)
+  foo(self)
   {
-         return this->len;
+         return self->len;
   }
   
   private int
-  bar(this,int i)
+  bar(self,int i)
   {
-         return foo(this) + i;
+         return foo(self) + i;
   }
 
 .fi
index 38eefc95e6ea12553d00ce25ddb9e27fdbb0223f..7c9cfa9770d88e888e02ebb54eacc50584cad636 100644 (file)
--- a/gob.spec
+++ b/gob.spec
@@ -1,4 +1,4 @@
-%define  ver     0.0.4
+%define  ver     0.90.0
 %define  rel     1
 %define  prefix  /usr
 
index e2f80b28c68363219ee945dc4a182f7c32317ae0..b8a6baff73a5d0e22b08015c93d2763cd89e04cd 100644 (file)
@@ -7,6 +7,7 @@ bin_PROGRAMS = gob
 
 gob_SOURCES =  \
        main.c          \
+       main.h          \
        tree.c          \
        tree.h          \
        out.c           \
@@ -22,7 +23,7 @@ gob_LDADD = \
 
 BUILT_SOURCES = parse.h parse.c lexer.c
 
-CLEANFILES += $(BUILT_SOURCES)
+CLEANFILES += $(BUILT_SOURCES) gtk-weird-button.*
 
 EXTRA_DIST = test.gob
 
@@ -32,5 +33,7 @@ parse.h: parse.y
        test -f y.tab.h && mv -f y.tab.h parse.h
 
 test: gtk-weird-button.c gtk-weird-button.h
+       $(CC) -g -Wall `gtk-config --cflags` -c gtk-weird-button.c
+
 gtk-weird-button.c gtk-weird-button.h: test.gob gob
        ./gob test.gob
index 09de471e5e6fbc495e615e00b8229b31902254d7..3252f31ff6e8af1c4118469b83416a9a4e397985 100644 (file)
@@ -83,7 +83,7 @@ INCLUDES = @GLIB_CFLAGS@ -I$(includedir)
 
 bin_PROGRAMS = gob
 
-gob_SOURCES =          main.c                  tree.c                  tree.h                  out.c                   out.h                   parse.y                 lexer.l
+gob_SOURCES =          main.c                  main.h                  tree.c                  tree.h                  out.c                   out.h                   parse.y                 lexer.l
 
 
 gob_LDADD =    -lm     -lpopt  $(GLIB_LIBS)    @LEXLIB@
@@ -91,7 +91,7 @@ gob_LDADD =   -lm     -lpopt  $(GLIB_LIBS)    @LEXLIB@
 
 BUILT_SOURCES = parse.h parse.c lexer.c
 
-CLEANFILES =  $(BUILT_SOURCES)
+CLEANFILES =  $(BUILT_SOURCES) gtk-weird-button.*
 
 EXTRA_DIST = test.gob
 mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
@@ -232,9 +232,9 @@ distdir: $(DISTFILES)
          fi; \
        done
 lexer.o: lexer.c ../config.h parse.h
-main.o: main.c ../config.h tree.h parse.h out.h
+main.o: main.c ../config.h tree.h parse.h out.h main.h
 out.o: out.c out.h
-parse.o: parse.c ../config.h tree.h
+parse.o: parse.c ../config.h tree.h main.h
 tree.o: tree.c ../config.h tree.h
 
 info-am:
@@ -316,6 +316,8 @@ parse.h: parse.y
        test -f y.tab.h && mv -f y.tab.h parse.h
 
 test: gtk-weird-button.c gtk-weird-button.h
+       $(CC) -g -Wall `gtk-config --cflags` -c gtk-weird-button.c
+
 gtk-weird-button.c gtk-weird-button.h: test.gob gob
        ./gob test.gob
 
index e418b4e2814ea101a5a585fbc3a4574163da8d8b..54293fca1ee59b654fe545eb8ac4a8757f6f0659 100644 (file)
@@ -29,6 +29,7 @@
 #include "tree.h"
 #include "parse.h"
 #include "out.h"
+#include "main.h"
 
 char *filename = "stdin";
 
@@ -55,20 +56,24 @@ FILE *out;
 FILE *outh;
 
 int exit_on_warn = FALSE;
+int exit_on_error = TRUE;
+int got_error = FALSE;
 
-static void
+void
 print_error(int is_warn, char *error,int line)
 {
        char *w;
        if(is_warn)
                w = "Warning:";
-       else
+       else {
                w = "Error:";
+               got_error = TRUE;
+       }
        if(line>0)
                fprintf(stderr,"%s:%d: %s %s\n",filename,line,w,error);
        else
                fprintf(stderr,"%s: %s %s\n",filename,w,error);
-       if(!is_warn || exit_on_warn)
+       if((!is_warn || exit_on_warn) && exit_on_error)
                exit(1);
 }
 
@@ -750,8 +755,8 @@ add_getset_arg(Class *c, int is_set)
                "\tGtkArg *arg,\n"
                "\tguint arg_id)\n"
                "{\n"
-               "\t%s *this;\n\n"
-               "\tthis = %s (object);\n\n"
+               "\t%s *self, *this;\n\n"
+               "\tself = this = %s (object);\n\n"
                "\tswitch (arg_id) {\n",
                is_set?"set":"get",typebase,macrobase);
 
@@ -901,8 +906,10 @@ put_method(Method *m)
                   m->mtype->stars==0) {
                        GList *li;
                        print_preconditions(m);
-                       out_printf(out,"\tgtk_signal_emit (GTK_OBJECT (this),\n"
-                               "\t\tobject_signals[%s_SIGNAL]",s);
+                       if(((FuncArg *)m->args->data)->name)
+                       out_printf(out,"\tgtk_signal_emit (GTK_OBJECT (%s),\n"
+                               "\t\tobject_signals[%s_SIGNAL]",
+                               ((FuncArg *)m->args->data)->name,s);
                        for(li=m->args->next;li;li=g_list_next(li)) {
                                FuncArg *fa = li->data;
                                out_printf(out,",\n\t\t%s",fa->name);
@@ -914,8 +921,9 @@ put_method(Method *m)
                        print_type(out,m->mtype);
                        out_printf(out,"return_val;\n");
                        print_preconditions(m);
-                       out_printf(out,"\tgtk_signal_emit (GTK_OBJECT (this),\n"
-                               "\t\tobject_signals[%s_SIGNAL]",s);
+                       out_printf(out,"\tgtk_signal_emit (GTK_OBJECT (%s),\n"
+                               "\t\tobject_signals[%s_SIGNAL]",
+                               ((FuncArg *)m->args->data)->name,s);
                        for(li=m->args->next;li;li=g_list_next(li)) {
                                FuncArg *fa = li->data;
                                out_printf(out,",\n\t\t%s",fa->name);
@@ -937,13 +945,14 @@ put_method(Method *m)
                out_printf(out,"{\n"
                        "\t%sClass *class;\n",typebase);
                print_preconditions(m);
-               out_printf(out,"\tclass = %s_CLASS(GTK_OBJECT(this)->klass);\n\n"
+               out_printf(out,"\tclass = %s_CLASS(GTK_OBJECT(%s)->klass);\n\n"
                        "\tif(class->%s)\n",
-                       macrobase,m->id);
+                       macrobase, ((FuncArg *)m->args->data)->name, m->id);
                if(strcmp(m->mtype->name,"void")==0 &&
                   m->mtype->stars==0) {
                        GList *li;
-                       out_printf(out,"\t\t(*class->%s)(this",m->id);
+                       out_printf(out,"\t\t(*class->%s)(%s",m->id,
+                                  ((FuncArg *)m->args->data)->name);
                        for(li=m->args->next;li;li=g_list_next(li)) {
                                FuncArg *fa = li->data;
                                out_printf(out,",%s",fa->name);
@@ -951,7 +960,8 @@ put_method(Method *m)
                        out_printf(out,");\n}\n");
                } else {
                        GList *li;
-                       out_printf(out,"\t\treturn (*class->%s)(this",m->id);
+                       out_printf(out,"\t\treturn (*class->%s)(%s",m->id,
+                                  ((FuncArg *)m->args->data)->name);
                        for(li=m->args->next;li;li=g_list_next(li)) {
                                FuncArg *fa = li->data;
                                out_printf(out,",%s",fa->name);
@@ -980,6 +990,121 @@ put_method(Method *m)
        }
 }
 
+static void
+check_duplicate(Class *c,Node *node,char *id, int line_no)
+{
+       GList *l;
+       for(l=c->nodes;l;l=g_list_next(l)) {
+               Node *n = l->data;
+               char *nid;
+               int nline_no;
+               char *s;
+               if(n->type == METHOD_NODE) {
+                       Method *m = (Method *)n;
+                       nid = m->id;
+                       nline_no = m->line_no;
+               } else if(n->type == VARIABLE_NODE) {
+                       Variable *v = (Variable *)n;
+                       nid = v->id;
+                       nline_no = v->line_no;
+               } else
+                       continue;
+               if(n==node ||
+                  line_no>=nline_no ||
+                  strcmp(nid,id)!=0)
+                       continue;
+               s = g_strdup_printf("symbol '%s' redefined, "
+                                   "first defined on line %d",
+                                   id,line_no);
+               print_error(FALSE,s,nline_no);
+       }
+}
+
+static void
+check_duplicate_symbols(Class *c)
+{
+       GList *l;
+       for(l=c->nodes;l;l=g_list_next(l)) {
+               Node *n = l->data;
+               if(n->type == METHOD_NODE) {
+                       Method *m = (Method *)n;
+                       check_duplicate(c,n,m->id,m->line_no);
+               } else if(n->type == VARIABLE_NODE) {
+                       Variable *v = (Variable *)n;
+                       check_duplicate(c,n,v->id,v->line_no);
+               }
+       }
+}
+
+static void
+check_duplicate_named(Class *c,Node *node,char *id, int line_no)
+{
+       GList *l;
+       for(l=c->nodes;l;l=g_list_next(l)) {
+               Node *n = l->data;
+               char *nid;
+               int nline_no;
+               char *s;
+               if(n->type == METHOD_NODE) {
+                       Method *m = (Method *)n;
+                       if(m->scope == SIGNAL_LAST_METHOD ||
+                          m->scope == SIGNAL_FIRST_METHOD) {
+                               nid = m->id;
+                               nline_no = m->line_no;
+                       } else
+                               continue;
+               } else if(n->type == ARGUMENT_NODE) {
+                       Argument *a = (Argument *)n;
+                       nid = a->name;
+                       nline_no = a->line_no;
+               } else
+                       continue;
+               if(n==node ||
+                  line_no>=nline_no ||
+                  strcmp(nid,id)!=0)
+                       continue;
+               s = g_strdup_printf("named symbol (argument or signal) '%s' "
+                                   "redefined, first defined on line %d",
+                                   id,line_no);
+               print_error(FALSE,s,nline_no);
+       }
+}
+
+static void
+check_duplicate_signals_args(Class *c)
+{
+       GList *l;
+       for(l=c->nodes;l;l=g_list_next(l)) {
+               Node *n = l->data;
+               if(n->type == METHOD_NODE) {
+                       Method *m = (Method *)n;
+                       if(m->scope == SIGNAL_LAST_METHOD ||
+                          m->scope == SIGNAL_FIRST_METHOD)
+                               check_duplicate_named(c,n,m->id,m->line_no);
+               } else if(n->type == ARGUMENT_NODE) {
+                       Argument *a = (Argument *)n;
+                       check_duplicate_named(c,n,a->name,a->line_no);
+               }
+       }
+}
+
+static void
+check_public_new(Class *c)
+{
+       GList *l;
+       for(l=c->nodes;l;l=g_list_next(l)) {
+               Node *n = l->data;
+               if(n->type == METHOD_NODE) {
+                       Method *m = (Method *)n;
+                       if(m->scope!=PUBLIC_SCOPE &&
+                          strcmp(m->id,"new")==0)
+                               print_error(TRUE,
+                                           "'new' should be a public method",
+                                           m->line_no);
+               }
+       }
+}
+
 static int
 count_signals(Class *c)
 {
@@ -1254,8 +1379,16 @@ main(int argc, char *argv[])
        
        make_bases();
        
+       exit_on_error = FALSE;
        make_inits((Class *)class);
+       check_duplicate_symbols((Class *)class);
+       check_duplicate_signals_args((Class *)class);
+       check_public_new((Class *)class);
+       exit_on_error = TRUE;
        
+       if(got_error)
+               exit(1);
+
        open_files();
        
        generate_outfiles();
diff --git a/src/main.h b/src/main.h
new file mode 100644 (file)
index 0000000..404e693
--- /dev/null
@@ -0,0 +1,10 @@
+#ifndef _MAIN_H_
+#define _MAIN_H_
+
+extern int exit_on_warn;
+extern int exit_on_error;
+extern int got_error;
+
+void print_error(int is_warn, char *error,int line);
+
+#endif
index eeafa039d17d49b35f46622e802fe4c287bb6164..e50c96bc61cf89017147b1a6810446907a1098f1 100644 (file)
@@ -43,6 +43,7 @@
 #include <string.h>
 
 #include "tree.h"
+#include "main.h"
 
 #define _(x) (x)
        
@@ -57,7 +58,7 @@ static GList *typestack = NULL;
 static int stars = 0;
 static GList *funcargs = NULL;
 static GList *checks = NULL;
-static int has_this = FALSE;
+static int has_self = FALSE;
 
 static GList *gtktypes = NULL;
 
@@ -95,13 +96,13 @@ yyerror(char *str)
 }
 
 static void
-push_variable(char *name, int scope)
+push_variable(char *name, int scope, int line_no)
 {
        Node *var;
        Type *type = typestack->data;
        typestack = g_list_remove(typestack,typestack->data);
        
-       var = new_variable(scope,type,name);
+       var = new_variable(scope,type,name,line_no);
        class_nodes = g_list_append(class_nodes, var);
 }
 
@@ -158,7 +159,7 @@ push_init_arg(char *name, int is_class)
 }
 
 static void
-push_this(char *this)
+push_self(char *id)
 {
        Node *node;
        Node *type;
@@ -166,12 +167,12 @@ push_this(char *this)
        type = new_type(1,g_strdup(((Class *)class)->otype));
        ch = g_list_append(ch,new_check(NULL_CHECK,NULL));
        ch = g_list_append(ch,new_check(TYPE_CHECK,NULL));
-       node = new_funcarg((Type *)type,this,ch);
+       node = new_funcarg((Type *)type,id,ch);
        funcargs = g_list_prepend(funcargs, node);
 }
 
 
-#line 158 "parse.y"
+#line 159 "parse.y"
 typedef union {
        char *id;
        GString *cbuf;
@@ -192,11 +193,11 @@ typedef union {
 
 
 
-#define        YYFINAL         190
+#define        YYFINAL         187
 #define        YYFLAG          -32768
 #define        YYNTBASE        45
 
-#define YYTRANSLATE(x) ((unsigned)(x) <= 285 ? yytranslate[x] : 69)
+#define YYTRANSLATE(x) ((unsigned)(x) <= 285 ? yytranslate[x] : 70)
 
 static const char yytranslate[] = {     0,
      2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
@@ -237,18 +238,18 @@ 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,   191,   201,   211,   220,   233,   243,
-   253,   259,   266,   269,   273,   276,   277,   279,   281,   285,
-   287,   291,   293,   296,   303,   306,   308,   310,   313,   316,
-   320,   324,   328,   332,   334,   337
+   155,   157,   160,   162,   173,   183,   192,   205,   215,   225,
+   231,   238,   241,   245,   248,   249,   251,   253,   257,   259,
+   263,   265,   268,   275,   278,   280,   282,   285,   288,   292,
+   296,   300,   304,   306,   309
 };
 
 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,    49,    62,     0,    49,    50,     0,    49,    51,     0,
+    62,     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,
@@ -259,40 +260,37 @@ static const short yyrhs[] = {    46,
      5,     0,    11,    13,     0,    11,     0,    12,    13,     0,
     12,     0,    13,     0,     8,     0,     7,     0,     6,     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,    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,    20,     0
+    60,    38,    20,     0,    20,     0,    31,    23,     0,    33,
+     0,    29,    20,    59,    54,    20,    34,    64,    35,    63,
+    61,     0,    29,    59,    54,    20,    34,    64,    35,    63,
+    61,     0,    28,    54,    20,    34,    64,    35,    63,    61,
+     0,    30,    34,    22,    35,    54,    20,    34,    64,    35,
+    63,    31,    23,     0,    25,    54,    20,    34,    64,    35,
+    63,    31,    23,     0,    26,    54,    20,    34,    64,    35,
+    63,    31,    23,     0,    20,    34,    20,    35,    33,     0,
+    20,    34,    20,    35,    31,    23,     0,    19,    69,     0,
+    19,    31,    23,     0,    39,    40,     0,     0,     5,     0,
+    20,     0,    20,    38,    65,     0,    65,     0,    65,    38,
+    66,     0,    66,     0,    54,    20,     0,    54,    20,    34,
+    20,    67,    35,     0,    67,    68,     0,    68,     0,    20,
+     0,    41,    69,     0,    42,    69,     0,    41,    39,    69,
+     0,    42,    39,    69,     0,    39,    39,    69,     0,    43,
+    39,    69,     0,    21,     0,    44,    21,     0,    20,     0
 };
 
 #endif
 
 #if YYDEBUG != 0
 static const short yyrline[] = { 0,
-   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,   508,   509,   514,   515,   525,   535,
-   538,   539,   542,   545,   555,   556,   559,   572,   576,   580,
-   584,   588,   592,   598,   599,   603
+   177,   178,   179,   180,   183,   187,   191,   195,   201,   208,
+   213,   214,   215,   216,   217,   218,   221,   224,   228,   257,
+   283,   284,   287,   290,   296,   300,   307,   310,   313,   316,
+   319,   322,   325,   328,   331,   334,   338,   341,   346,   349,
+   352,   355,   358,   363,   366,   369,   374,   375,   378,   383,
+   386,   391,   392,   396,   417,   426,   435,   439,   443,   447,
+   463,   484,   485,   489,   490,   495,   496,   511,   526,   529,
+   530,   533,   536,   546,   547,   550,   563,   567,   571,   575,
+   579,   583,   589,   590,   594
 };
 #endif
 
@@ -306,7 +304,8 @@ static const char * const yytname[] = {   "$","error","$undefined.","CLASS",
 "'{'","'}'","';'","'('","')'","'|'","'*'","','","'='","'1'","'>'","'<'","'!'",
 "'-'","prog","ccodes","class","classdec","classcode","variable","argument","argflags",
 "flaglist","type","type1","integer","tspecifier","stars","sigtype","tokenlist",
-"method","onerror","funcargs","arglist","arg","checklist","check","numtok", NULL
+"codenocode","method","onerror","funcargs","arglist","arg","checklist","check",
+"numtok", NULL
 };
 #endif
 
@@ -316,10 +315,10 @@ static const short yyr1[] = {     0,
     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,    63,    63,    63,    63,
-    64,    64,    65,    65,    66,    66,    67,    67,    67,    67,
-    67,    67,    67,    68,    68,    68
+    60,    61,    61,    62,    62,    62,    62,    62,    62,    62,
+    62,    63,    63,    63,    63,    64,    64,    64,    64,    65,
+    65,    66,    66,    67,    67,    68,    68,    68,    68,    68,
+    68,    68,    69,    69,    69
 };
 
 static const short yyr2[] = {     0,
@@ -328,10 +327,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,    10,     9,     9,     8,    12,     9,     9,
-     5,     6,     2,     3,     2,     0,     1,     1,     3,     1,
-     3,     1,     2,     6,     2,     1,     1,     2,     2,     3,
-     3,     3,     3,     1,     2,     1
+     1,     2,     1,    10,     9,     8,    12,     9,     9,     5,
+     6,     2,     3,     2,     0,     1,     1,     3,     1,     3,
+     1,     2,     6,     2,     1,     1,     2,     2,     3,     3,
+     3,     3,     1,     2,     1
 };
 
 static const short yydefact[] = {     0,
@@ -344,104 +343,108 @@ static const short yydefact[] = {     0,
     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,    70,    72,
-     0,    23,     0,     0,    49,     0,     0,     0,     0,    62,
-     0,    73,    66,     0,    66,     0,    66,    50,     0,     0,
-     0,    69,     0,     0,     0,     0,    71,     0,     0,     0,
-     0,    66,     0,     0,    86,    84,     0,     0,    63,    65,
-     0,     0,     0,    20,     0,    57,    66,     0,     0,    77,
-     0,     0,     0,     0,     0,    76,    64,    85,    59,    60,
-     0,    56,     0,     0,    55,    66,     0,     0,    78,     0,
-    79,     0,    74,    75,     0,     0,    53,    54,     0,    82,
-    80,    81,    83,    19,    52,     0,    58,     0,     0,     0
+     0,     0,     0,    60,    38,    35,     0,     0,    69,    71,
+     0,    23,     0,     0,    49,     0,     0,     0,     0,    61,
+     0,    72,    65,     0,    65,     0,    65,    50,     0,     0,
+     0,    68,     0,     0,     0,     0,    70,     0,     0,     0,
+     0,    65,     0,     0,    85,    83,     0,     0,    62,    64,
+     0,     0,     0,    20,     0,    53,    56,    65,     0,     0,
+    76,     0,     0,     0,     0,     0,    75,    63,    84,    58,
+    59,     0,    52,     0,    55,    65,     0,     0,    77,     0,
+    78,     0,    73,    74,     0,    54,     0,    81,    79,    80,
+    82,    19,     0,    57,     0,     0,     0
 };
 
-static const short yydefgoto[] = {   188,
+static const short yydefgoto[] = {   185,
      4,     5,     6,    22,    23,    24,    48,    70,    97,    43,
-    44,    45,    66,    51,    89,    25,   126,    98,    99,   100,
-   155,   156,   139
+    44,    45,    66,    51,    89,   147,    25,   126,    98,    99,
+   100,   156,   157,   139
 };
 
-static const short yypact[] = {    33,
-    11,-32768,-32768,    44,    51,   -19,    18,-32768,-32768,    51,
-    79,    52,    61,    79,     4,    85,    85,    70,    85,     9,
-    72,   101,-32768,-32768,-32768,-32768,    32,-32768,-32768,-32768,
--32768,   123,   129,   107,   109,-32768,-32768,-32768,-32768,-32768,
--32768,   112,    87,-32768,   128,   130,   131,   132,   133,   -10,
-    85,   127,-32768,-32768,-32768,-32768,   119,-32768,-32768,-32768,
--32768,-32768,-32768,   104,    87,-32768,-32768,   110,   120,   122,
-   135,   124,   125,   140,    85,   141,   134,    27,-32768,   103,
--32768,-32768,   103,   131,-32768,   142,   103,-32768,   -12,   143,
-   136,    85,   144,-32768,   137,    16,   145,   138,   126,-32768,
-   139,-32768,   146,   147,-32768,   148,   149,   103,   151,-32768,
-    85,   150,     6,    85,     6,   152,     6,-32768,   103,   153,
-   155,   126,   156,   -13,   154,   159,-32768,   160,    -5,    30,
-   157,     6,   103,    23,-32768,-32768,   158,   164,-32768,-32768,
-   163,   170,   165,-32768,   172,-32768,     6,    40,   162,-32768,
-   161,    -7,     0,   166,     7,-32768,-32768,-32768,-32768,-32768,
-   175,-32768,    55,   176,-32768,     6,    -4,    -4,-32768,    -4,
--32768,    -4,-32768,-32768,   168,   179,-32768,-32768,   173,-32768,
--32768,-32768,-32768,-32768,-32768,   180,-32768,   178,   187,-32768
+static const short yypact[] = {    26,
+   -14,-32768,-32768,    37,    51,    -6,    43,-32768,-32768,    51,
+    98,    99,     8,    98,    20,    72,    72,    24,    72,    52,
+    57,    88,-32768,-32768,-32768,-32768,    69,-32768,-32768,-32768,
+-32768,   119,   125,    94,    96,-32768,-32768,-32768,-32768,-32768,
+-32768,    91,    86,-32768,   120,   127,   128,   129,   130,    33,
+    72,   131,-32768,-32768,-32768,-32768,   116,-32768,-32768,-32768,
+-32768,-32768,-32768,   100,    86,-32768,-32768,   110,   118,   117,
+   135,   122,   123,   138,    72,   139,   126,    31,-32768,    90,
+-32768,-32768,    90,   128,-32768,   140,    90,-32768,    55,   142,
+   132,    72,   141,-32768,   133,   104,   143,   134,   136,-32768,
+   137,-32768,   144,   145,-32768,   147,   148,    90,   150,-32768,
+    72,   149,   -17,    72,   -17,   153,   -17,-32768,    90,   146,
+   151,   136,   157,   -11,   152,   155,-32768,   156,    36,    40,
+   154,   -17,    90,   -15,-32768,-32768,   161,   158,-32768,-32768,
+   165,   167,   160,-32768,   170,-32768,-32768,   -17,    40,   159,
+-32768,   162,    -8,    -5,   163,     3,-32768,-32768,-32768,-32768,
+-32768,   172,-32768,    40,-32768,   -17,    -3,    -3,-32768,    -3,
+-32768,    -3,-32768,-32768,   164,-32768,   168,-32768,-32768,-32768,
+-32768,-32768,   173,-32768,   171,   178,-32768
 };
 
 static const short yypgoto[] = {-32768,
-     1,   202,-32768,-32768,   185,   186,-32768,    82,   -16,-32768,
-   114,-32768,   115,   167,-32768,   188,  -113,   -78,    68,    95,
--32768,    56,   -83
+     9,   169,-32768,-32768,   176,   181,-32768,    81,   -16,-32768,
+   113,-32768,   166,   174,-32768,  -101,   182,  -111,   -76,    89,
+    92,-32768,    49,  -102
 };
 
 
-#define        YYLAST          217
+#define        YYLAST          231
 
 
 static const short yytable[] = {    42,
-    46,   128,    49,   130,   101,    11,   135,   136,   104,    73,
-    14,    12,   135,   136,   143,   135,   136,   137,   148,   135,
-   136,    13,   105,    74,   124,   106,   150,   144,    50,   120,
-   138,   168,     7,   163,    76,     1,   138,    27,   170,   138,
-   131,   173,   150,   138,   125,   151,     1,   152,   153,   154,
-   -68,    57,   179,   111,   149,     2,     3,    93,    90,    94,
-   145,   151,   146,   152,   153,   154,     8,     9,   169,   171,
-   164,    15,   165,     2,     3,   109,    16,    17,    18,    19,
-    20,    21,    26,   180,   181,   176,   182,   177,   183,    28,
-    29,    30,    31,    32,    33,    34,    35,    36,    37,    38,
-    39,     8,     9,    47,    40,    52,    41,    95,    29,    30,
-    31,    32,    33,    34,    35,    36,    37,    38,    39,    62,
-    15,    63,    96,    65,    41,    16,    17,    18,    19,    20,
-    21,    64,    53,    34,    35,    36,    79,    80,    58,    34,
-    35,    36,    82,    83,    60,    59,    61,    67,    77,    68,
-    69,    71,    72,    78,    86,    84,    85,    87,    74,    88,
-    91,   103,   107,   114,   112,   102,   110,   118,    92,   108,
-   121,   -67,   113,   115,   129,   134,   116,   189,   122,    81,
-   157,   117,   119,   123,   158,   159,   190,   132,   133,   141,
-   142,   147,   160,   140,   162,   161,   166,   175,   178,   167,
-   184,   185,   187,   186,   172,    10,    54,    55,   127,    56,
-   174,     0,     0,     0,     0,     0,    75
+    46,   124,    49,   128,   151,   130,   101,     7,   135,   136,
+   104,   135,   136,    11,   135,   136,   135,   136,    14,   137,
+   149,   125,   151,   152,    12,   153,   154,   155,     1,    26,
+   168,   120,   138,   170,    76,   138,   164,   173,   138,     1,
+   138,   152,   131,   153,   154,   155,    13,   165,     2,     3,
+   169,   171,    73,    27,   177,   143,   150,    47,    90,     8,
+     9,    93,   176,    94,   178,   179,    74,   180,   144,   181,
+   145,    50,   146,     2,     3,   109,    28,    29,    30,    31,
+    32,    33,    34,    35,    36,    37,    38,    39,    57,   105,
+    52,    40,   106,    41,    95,    29,    30,    31,    32,    33,
+    34,    35,    36,    37,    38,    39,    62,    15,    63,    96,
+    64,    41,    16,    17,    18,    19,    20,    21,    15,    53,
+     8,     9,    65,    16,    17,    18,    19,    20,    21,    34,
+    35,    36,    79,    80,    58,    34,    35,    36,   -67,    67,
+    60,   111,    82,    83,    59,    61,    68,    69,    71,    72,
+    78,    85,    77,    84,    86,    87,    74,    88,    91,   103,
+    92,   107,   112,   110,   102,   108,   118,   -66,   113,   121,
+   186,   115,    10,   114,   116,   129,   134,   187,   159,   117,
+   132,   119,   123,   158,   133,   141,   142,   160,   148,   161,
+   162,   140,   163,   166,   175,   184,   182,    54,   183,   122,
+   167,   172,    55,    56,   174,   127,     0,     0,     0,     0,
+     0,     0,     0,     0,     0,     0,     0,     0,     0,     0,
+     0,     0,     0,    75,     0,     0,     0,     0,     0,     0,
+    81
 };
 
 static const short yycheck[] = {    16,
-    17,   115,    19,   117,    83,     5,    20,    21,    87,    20,
-    10,    31,    20,    21,    20,    20,    21,    31,   132,    20,
-    21,     4,    35,    34,    19,    38,    20,    33,    20,   108,
-    44,    39,    22,   147,    51,     3,    44,    34,    39,    44,
-   119,    35,    20,    44,    39,    39,     3,    41,    42,    43,
-    35,    20,   166,    38,   133,    23,    24,    31,    75,    33,
-    31,    39,    33,    41,    42,    43,    23,    24,   152,   153,
-    31,    20,    33,    23,    24,    92,    25,    26,    27,    28,
-    29,    30,    22,   167,   168,    31,   170,    33,   172,     5,
-     6,     7,     8,     9,    10,    11,    12,    13,    14,    15,
-    16,    23,    24,    34,    20,    34,    22,     5,     6,     7,
-     8,     9,    10,    11,    12,    13,    14,    15,    16,    13,
-    20,    13,    20,    37,    22,    25,    26,    27,    28,    29,
-    30,    20,    32,    11,    12,    13,    33,    34,    16,    11,
-    12,    13,    33,    34,    16,    32,    33,    20,    22,    20,
-    20,    20,    20,    35,    20,    36,    35,    34,    34,    20,
-    20,    20,    20,    38,    20,    84,    23,    20,    35,    34,
-    20,    35,    35,    35,    23,    20,    31,     0,   111,    65,
-    23,    35,    34,    34,    21,    23,     0,    35,    34,    31,
-    31,    35,    23,    40,    23,    31,    35,    23,    23,    39,
-    33,    23,    23,    31,    39,     4,    22,    22,   114,    22,
-   155,    -1,    -1,    -1,    -1,    -1,    50
+    17,    19,    19,   115,    20,   117,    83,    22,    20,    21,
+    87,    20,    21,     5,    20,    21,    20,    21,    10,    31,
+   132,    39,    20,    39,    31,    41,    42,    43,     3,    22,
+    39,   108,    44,    39,    51,    44,   148,    35,    44,     3,
+    44,    39,   119,    41,    42,    43,     4,   149,    23,    24,
+   153,   154,    20,    34,   166,    20,   133,    34,    75,    23,
+    24,    31,   164,    33,   167,   168,    34,   170,    33,   172,
+    31,    20,    33,    23,    24,    92,     5,     6,     7,     8,
+     9,    10,    11,    12,    13,    14,    15,    16,    20,    35,
+    34,    20,    38,    22,     5,     6,     7,     8,     9,    10,
+    11,    12,    13,    14,    15,    16,    13,    20,    13,    20,
+    20,    22,    25,    26,    27,    28,    29,    30,    20,    32,
+    23,    24,    37,    25,    26,    27,    28,    29,    30,    11,
+    12,    13,    33,    34,    16,    11,    12,    13,    35,    20,
+    16,    38,    33,    34,    32,    33,    20,    20,    20,    20,
+    35,    35,    22,    36,    20,    34,    34,    20,    20,    20,
+    35,    20,    20,    23,    84,    34,    20,    35,    35,    20,
+     0,    35,     4,    38,    31,    23,    20,     0,    21,    35,
+    35,    34,    34,    23,    34,    31,    31,    23,    35,    23,
+    31,    40,    23,    35,    23,    23,    33,    22,    31,   111,
+    39,    39,    22,    22,   156,   114,    -1,    -1,    -1,    -1,
+    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
+    -1,    -1,    -1,    50,    -1,    -1,    -1,    -1,    -1,    -1,
+    65
 };
 /* -*-C-*-  Note some compilers choke on comments on `#line' lines.  */
 #line 3 "/usr/lib/bison.simple"
@@ -942,51 +945,51 @@ yyreduce:
   switch (yyn) {
 
 case 1:
-#line 176 "parse.y"
+#line 177 "parse.y"
 { ; ;
     break;}
 case 2:
-#line 177 "parse.y"
+#line 178 "parse.y"
 { ; ;
     break;}
 case 3:
-#line 178 "parse.y"
+#line 179 "parse.y"
 { ; ;
     break;}
 case 4:
-#line 179 "parse.y"
+#line 180 "parse.y"
 { ; ;
     break;}
 case 5:
-#line 182 "parse.y"
+#line 183 "parse.y"
 {
                        Node *node = new_ccode(FALSE,yyvsp[0].cbuf,ccode_line);
                        nodes = g_list_append(nodes,node);
                                        ;
     break;}
 case 6:
-#line 186 "parse.y"
+#line 187 "parse.y"
 {
                        Node *node = new_ccode(TRUE,yyvsp[0].cbuf,ccode_line);
                        nodes = g_list_append(nodes,node);
                                        ;
     break;}
 case 7:
-#line 190 "parse.y"
+#line 191 "parse.y"
 {
                        Node *node = new_ccode(FALSE,yyvsp[0].cbuf,ccode_line);
                        nodes = g_list_append(nodes,node);
                                        ;
     break;}
 case 8:
-#line 194 "parse.y"
+#line 195 "parse.y"
 {
                        Node *node = new_ccode(TRUE,yyvsp[0].cbuf,ccode_line);
                        nodes = g_list_append(nodes,node);
                                        ;
     break;}
 case 9:
-#line 200 "parse.y"
+#line 201 "parse.y"
 {
                        ((Class *)class)->nodes = class_nodes;
                        class_nodes = NULL;
@@ -994,49 +997,49 @@ case 9:
                                                ;
     break;}
 case 10:
-#line 207 "parse.y"
+#line 208 "parse.y"
 {
                        class = new_class(yyvsp[-2].id,yyvsp[0].id,NULL);
                                                ;
     break;}
 case 11:
-#line 212 "parse.y"
+#line 213 "parse.y"
 { ; ;
     break;}
 case 12:
-#line 213 "parse.y"
+#line 214 "parse.y"
 { ; ;
     break;}
 case 13:
-#line 214 "parse.y"
+#line 215 "parse.y"
 { ; ;
     break;}
 case 14:
-#line 215 "parse.y"
+#line 216 "parse.y"
 { ; ;
     break;}
 case 15:
-#line 216 "parse.y"
+#line 217 "parse.y"
 { ; ;
     break;}
 case 16:
-#line 217 "parse.y"
+#line 218 "parse.y"
 { ; ;
     break;}
 case 17:
-#line 220 "parse.y"
+#line 221 "parse.y"
 {
-                       push_variable(yyvsp[-1].id,PUBLIC_SCOPE);
+                       push_variable(yyvsp[-1].id,PUBLIC_SCOPE,yyvsp[-3].line);
                                                ;
     break;}
 case 18:
-#line 223 "parse.y"
+#line 224 "parse.y"
 {
-                       push_variable(yyvsp[-1].id,PRIVATE_SCOPE);
+                       push_variable(yyvsp[-1].id,PRIVATE_SCOPE,yyvsp[-3].line);
                                                ;
     break;}
 case 19:
-#line 227 "parse.y"
+#line 228 "parse.y"
 {
                        if(strcmp(yyvsp[-6].id,"get")==0 &&
                           strcmp(yyvsp[-3].id,"set")==0) {
@@ -1044,7 +1047,8 @@ case 19:
                                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[-5].line,
-                                                   yyvsp[-1].cbuf,yyvsp[-2].line);
+                                                   yyvsp[-1].cbuf,yyvsp[-2].line,
+                                                   yyvsp[-10].line);
                                class_nodes = g_list_append(class_nodes,node);
                        } else if(strcmp(yyvsp[-6].id,"set")==0 &&
                                strcmp(yyvsp[-3].id,"get")==0) {
@@ -1052,7 +1056,8 @@ case 19:
                                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[-2].line,
-                                                   yyvsp[-4].cbuf,yyvsp[-5].line);
+                                                   yyvsp[-4].cbuf,yyvsp[-5].line,
+                                                   yyvsp[-10].line);
                                class_nodes = g_list_append(class_nodes,node);
                        } else {
                                g_free(yyvsp[-8].id); g_free(yyvsp[-7].id);
@@ -1066,19 +1071,21 @@ case 19:
                                                ;
     break;}
 case 20:
-#line 254 "parse.y"
+#line 257 "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,yyvsp[-2].line,NULL,0);
+                                                   yyvsp[-1].cbuf,yyvsp[-2].line,NULL,0,
+                                                   yyvsp[-7].line);
                                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,0,yyvsp[-1].cbuf,yyvsp[-2].line);
+                                                   NULL,0,yyvsp[-1].cbuf,yyvsp[-2].line,
+                                                   yyvsp[-7].line);
                                class_nodes = g_list_append(class_nodes,node);
                        } else {
                                g_free(yyvsp[-3].id); g_free(yyvsp[-5].id);
@@ -1091,34 +1098,34 @@ case 20:
                                                ;
     break;}
 case 21:
-#line 278 "parse.y"
+#line 283 "parse.y"
 { yyval.list = yyvsp[-1].list; ;
     break;}
 case 22:
-#line 279 "parse.y"
+#line 284 "parse.y"
 { yyval.list = NULL; ;
     break;}
 case 23:
-#line 282 "parse.y"
+#line 287 "parse.y"
 {
                        yyval.list = g_list_append(yyvsp[0].list,yyvsp[-2].id);
                                                ;
     break;}
 case 24:
-#line 285 "parse.y"
+#line 290 "parse.y"
 {
                        yyval.list = g_list_append(NULL,yyvsp[0].id);
                                                ;
     break;}
 case 25:
-#line 291 "parse.y"
+#line 296 "parse.y"
 {
                        Node *node = new_type(0,yyvsp[0].id);
                        typestack = g_list_prepend(typestack,node);
                                                ;
     break;}
 case 26:
-#line 295 "parse.y"
+#line 300 "parse.y"
 {
                        Node *node = new_type(stars,yyvsp[-1].id);
                        stars = 0;
@@ -1126,178 +1133,162 @@ case 26:
                                                ;
     break;}
 case 27:
-#line 302 "parse.y"
+#line 307 "parse.y"
 {
                        yyval.id = g_strconcat("unsigned ",yyvsp[0].id,NULL);
                                                ;
     break;}
 case 28:
-#line 305 "parse.y"
+#line 310 "parse.y"
 {
                        yyval.id = g_strconcat("signed ",yyvsp[0].id,NULL);
                                                ;
     break;}
 case 29:
-#line 308 "parse.y"
+#line 313 "parse.y"
 {
                        yyval.id = g_strdup(yyvsp[0].id);
                                                ;
     break;}
 case 30:
-#line 311 "parse.y"
+#line 316 "parse.y"
 {
                        yyval.id = g_strdup("unsigned char");
                                                ;
     break;}
 case 31:
-#line 314 "parse.y"
+#line 319 "parse.y"
 {
                        yyval.id = g_strdup("signed char");
                                                ;
     break;}
 case 32:
-#line 317 "parse.y"
+#line 322 "parse.y"
 {
                        yyval.id = g_strdup("char");
                                                ;
     break;}
 case 33:
-#line 320 "parse.y"
+#line 325 "parse.y"
 {
                        yyval.id = g_strdup("double");
                                                ;
     break;}
 case 34:
-#line 323 "parse.y"
+#line 328 "parse.y"
 {
                        yyval.id = g_strdup("float");
                                                ;
     break;}
 case 35:
-#line 326 "parse.y"
+#line 331 "parse.y"
 {
                        yyval.id = yyvsp[0].id;
                                                ;
     break;}
 case 36:
-#line 329 "parse.y"
+#line 334 "parse.y"
 {
                        yyval.id = g_strconcat(yyvsp[-1].id,yyvsp[0].id,NULL);
                        g_free(yyvsp[0].id);
                                                ;
     break;}
 case 37:
-#line 333 "parse.y"
+#line 338 "parse.y"
 {
                        yyval.id = yyvsp[0].id;
                                                ;
     break;}
 case 38:
-#line 336 "parse.y"
+#line 341 "parse.y"
 {
                        yyval.id = g_strdup("void");
                                                ;
     break;}
 case 39:
-#line 341 "parse.y"
+#line 346 "parse.y"
 {
                        yyval.id = "long int";
                                                ;
     break;}
 case 40:
-#line 344 "parse.y"
+#line 349 "parse.y"
 {
                        yyval.id = "long";
                                                ;
     break;}
 case 41:
-#line 347 "parse.y"
+#line 352 "parse.y"
 {
                        yyval.id = "short int";
                                                ;
     break;}
 case 42:
-#line 350 "parse.y"
+#line 355 "parse.y"
 {
                        yyval.id = "short";
                                                ;
     break;}
 case 43:
-#line 353 "parse.y"
+#line 358 "parse.y"
 {
                        yyval.id = "int";
                                                ;
     break;}
 case 44:
-#line 358 "parse.y"
+#line 363 "parse.y"
 {
                        yyval.id = "enum ";
                                                ;
     break;}
 case 45:
-#line 361 "parse.y"
+#line 366 "parse.y"
 {
                        yyval.id = "union ";
                                                ;
     break;}
 case 46:
-#line 364 "parse.y"
+#line 369 "parse.y"
 {
                        yyval.id = "struct ";
                                                ;
     break;}
 case 47:
-#line 369 "parse.y"
+#line 374 "parse.y"
 { stars++; ;
     break;}
 case 48:
-#line 370 "parse.y"
+#line 375 "parse.y"
 { stars++; ;
     break;}
 case 49:
-#line 373 "parse.y"
+#line 378 "parse.y"
 {
                        gtktypes = g_list_prepend(gtktypes,yyvsp[-3].id);
                                                ;
     break;}
 case 50:
-#line 378 "parse.y"
+#line 383 "parse.y"
 {
                        gtktypes = g_list_append(gtktypes,yyvsp[0].id);
                                                ;
     break;}
 case 51:
-#line 381 "parse.y"
+#line 386 "parse.y"
 { 
                        gtktypes = g_list_append(gtktypes,yyvsp[0].id);
                                                        ;
     break;}
 case 52:
-#line 387 "parse.y"
-{
-                       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;
-                       }
-                       g_free(yyvsp[-9].id);
-
-                       if(!has_this) {
-                               yyerror(_("signal without 'this' as "
-                                         "first parameter"));
-                               YYERROR;
-                       }
-                       push_function(sigtype,NULL,
-                                     yyvsp[-6].id, yyvsp[-2].id, yyvsp[0].cbuf,yyvsp[-10].line,yyvsp[-1].line);
-                                                                       ;
+#line 391 "parse.y"
+{ yyval.cbuf=yyvsp[0].cbuf; ;
     break;}
 case 53:
-#line 408 "parse.y"
+#line 392 "parse.y"
+{ yyval.cbuf = NULL; ;
+    break;}
+case 54:
+#line 396 "parse.y"
 {
                        int sigtype = SIGNAL_LAST_METHOD;
                        if(strcmp(yyvsp[-8].id,"first")==0)
@@ -1310,76 +1301,63 @@ case 53:
                                YYERROR;
                        }
                        g_free(yyvsp[-8].id);
-                       if(!has_this) {
-                               yyerror(_("signal without 'this' as "
+
+                       if(!has_self) {
+                               yyerror(_("signal without 'self' as "
                                          "first parameter"));
                                YYERROR;
                        }
-                       push_function(sigtype, NULL,
-                                     yyvsp[-5].id, yyvsp[-1].id, NULL,yyvsp[-9].line,0);
+                       push_function(sigtype,NULL,
+                                     yyvsp[-5].id, yyvsp[-1].id, yyvsp[0].cbuf,yyvsp[-9].line,ccode_line);
                                                                        ;
     break;}
-case 54:
-#line 428 "parse.y"
+case 55:
+#line 417 "parse.y"
 {
-                       if(!has_this) {
-                               yyerror(_("signal without 'this' as "
+                       if(!has_self) {
+                               yyerror(_("signal without 'self' as "
                                          "first parameter"));
                                YYERROR;
                        }
                        push_function(SIGNAL_LAST_METHOD, NULL,
-                                     yyvsp[-6].id, yyvsp[-2].id, yyvsp[0].cbuf,yyvsp[-9].line,yyvsp[-1].line);
+                                     yyvsp[-5].id, yyvsp[-1].id, yyvsp[0].cbuf,yyvsp[-8].line,ccode_line);
                                                                        ;
     break;}
-case 55:
-#line 437 "parse.y"
+case 56:
+#line 426 "parse.y"
 {
-                       if(!has_this) {
-                               yyerror(_("signal without 'this' as "
+                       if(!has_self) {
+                               yyerror(_("virtual method without 'self' as "
                                          "first parameter"));
                                YYERROR;
                        }
-                       push_function(SIGNAL_LAST_METHOD, NULL, yyvsp[-5].id,
-                                     yyvsp[-1].id, NULL,yyvsp[-8].line,0);
-                                                                       ;
-    break;}
-case 56:
-#line 446 "parse.y"
-{
-                       push_function(VIRTUAL_METHOD, NULL, yyvsp[-6].id,
-                                     yyvsp[-2].id, yyvsp[0].cbuf,yyvsp[-8].line,yyvsp[-1].line);
-                                                                       ;
-    break;}
-case 57:
-#line 450 "parse.y"
-{
                        push_function(VIRTUAL_METHOD, NULL, yyvsp[-5].id,
-                                     yyvsp[-1].id, NULL,yyvsp[-7].line,0);
+                                     yyvsp[-1].id, yyvsp[0].cbuf,yyvsp[-7].line,ccode_line);
                                                                        ;
     break;}
-case 58:
-#line 454 "parse.y"
+case 57:
+#line 435 "parse.y"
 {
                        push_function(OVERRIDE_METHOD, yyvsp[-9].id,
                                      yyvsp[-6].id, yyvsp[-2].id, yyvsp[0].cbuf,yyvsp[-11].line,yyvsp[-1].line);
                                                                        ;
     break;}
-case 59:
-#line 458 "parse.y"
+case 58:
+#line 439 "parse.y"
 {
                        push_function(PUBLIC_SCOPE, NULL, yyvsp[-6].id,
                                      yyvsp[-2].id, yyvsp[0].cbuf,yyvsp[-8].line,yyvsp[-1].line);
                                                                ;
     break;}
-case 60:
-#line 462 "parse.y"
+case 59:
+#line 443 "parse.y"
 {
                        push_function(PRIVATE_SCOPE, NULL, yyvsp[-6].id,
                                      yyvsp[-2].id, yyvsp[0].cbuf,yyvsp[-8].line,yyvsp[-1].line);
                                                                ;
     break;}
-case 61:
-#line 466 "parse.y"
+case 60:
+#line 447 "parse.y"
 {
                        if(strcmp(yyvsp[-4].id,"init")==0) {
                                push_init_arg(yyvsp[-2].id,FALSE);
@@ -1397,8 +1375,8 @@ case 61:
                        }
                                                ;
     break;}
-case 62:
-#line 482 "parse.y"
+case 61:
+#line 463 "parse.y"
 {
                        if(strcmp(yyvsp[-5].id,"init")==0) {
                                push_init_arg(yyvsp[-3].id,FALSE);
@@ -1419,35 +1397,40 @@ case 62:
                        }
                                                ;
     break;}
-case 63:
-#line 503 "parse.y"
+case 62:
+#line 484 "parse.y"
 { yyval.id = yyvsp[0].id; ;
     break;}
-case 64:
-#line 504 "parse.y"
+case 63:
+#line 485 "parse.y"
 {
                        yyval.id = (yyvsp[0].cbuf)->str;
                        g_string_free(yyvsp[0].cbuf,FALSE);
                                        ;
     break;}
-case 65:
-#line 508 "parse.y"
+case 64:
+#line 489 "parse.y"
 { ; ;
     break;}
-case 66:
-#line 509 "parse.y"
+case 65:
+#line 490 "parse.y"
 { yyval.id = NULL; ;
     break;}
-case 67:
-#line 514 "parse.y"
-{ has_this = FALSE; ;
+case 66:
+#line 495 "parse.y"
+{ has_self = FALSE; ;
     break;}
-case 68:
-#line 515 "parse.y"
-{
-                       has_this = TRUE;
-                       if(strcmp(yyvsp[0].id,"this")==0)
-                               push_this(yyvsp[0].id);
+case 67:
+#line 496 "parse.y"
+{
+                       has_self = TRUE;
+                       if(strcmp(yyvsp[0].id,"this")==0) {
+                               push_self(yyvsp[0].id);
+                               print_error(TRUE,_("Use of 'this' is "
+                                                  "depreciated, use 'self' "
+                                                  "instead"),line_no);
+                       } else if(strcmp(yyvsp[0].id,"self")==0)
+                               push_self(yyvsp[0].id);
                        else {
                                g_free(yyvsp[0].id);
                                yyerror(_("parse error"));
@@ -1455,12 +1438,17 @@ case 68:
                        }
                                                ;
     break;}
-case 69:
-#line 525 "parse.y"
-{
-                       has_this = TRUE;
-                       if(strcmp(yyvsp[-2].id,"this")==0)
-                               push_this(yyvsp[-2].id);
+case 68:
+#line 511 "parse.y"
+{
+                       has_self = TRUE;
+                       if(strcmp(yyvsp[-2].id,"this")==0) {
+                               push_self(yyvsp[-2].id);
+                               print_error(TRUE,_("Use of 'this' is "
+                                                  "depreciated, use 'self' "
+                                                  "instead"),line_no);
+                       } else if(strcmp(yyvsp[-2].id,"self")==0)
+                               push_self(yyvsp[-2].id);
                        else {
                                g_free(yyvsp[-2].id);
                                yyerror(_("parse error"));
@@ -1468,26 +1456,26 @@ case 69:
                        }
                                        ;
     break;}
+case 69:
+#line 526 "parse.y"
+{ has_self = FALSE; ;
+    break;}
 case 70:
-#line 535 "parse.y"
-{ has_this = FALSE; ;
+#line 529 "parse.y"
+{ ; ;
     break;}
 case 71:
-#line 538 "parse.y"
+#line 530 "parse.y"
 { ; ;
     break;}
 case 72:
-#line 539 "parse.y"
-{ ; ;
-    break;}
-case 73:
-#line 542 "parse.y"
+#line 533 "parse.y"
 {
                        push_funcarg(yyvsp[0].id);
                                                                ;
     break;}
-case 74:
-#line 545 "parse.y"
+case 73:
+#line 536 "parse.y"
 {
                        if(strcmp(yyvsp[-2].id,"check")!=0) {
                                yyerror(_("parse error"));
@@ -1497,16 +1485,16 @@ case 74:
                        push_funcarg(yyvsp[-4].id);
                                                                ;
     break;}
-case 75:
-#line 555 "parse.y"
+case 74:
+#line 546 "parse.y"
 { ; ;
     break;}
-case 76:
-#line 556 "parse.y"
+case 75:
+#line 547 "parse.y"
 { ; ;
     break;}
-case 77:
-#line 559 "parse.y"
+case 76:
+#line 550 "parse.y"
 {
                        if(strcmp(yyvsp[0].id,"type")==0) {
                                Node *node = new_check(TYPE_CHECK,NULL);
@@ -1521,61 +1509,61 @@ case 77:
                        g_free(yyvsp[0].id);
                                        ;
     break;}
-case 78:
-#line 572 "parse.y"
+case 77:
+#line 563 "parse.y"
 {
                        Node *node = new_check(GT_CHECK,yyvsp[0].id);
                        checks = g_list_append(checks,node);
                                        ;
     break;}
-case 79:
-#line 576 "parse.y"
+case 78:
+#line 567 "parse.y"
 {
                        Node *node = new_check(LT_CHECK,yyvsp[0].id);
                        checks = g_list_append(checks,node);
                                        ;
     break;}
-case 80:
-#line 580 "parse.y"
+case 79:
+#line 571 "parse.y"
 {
                        Node *node = new_check(GE_CHECK,yyvsp[0].id);
                        checks = g_list_append(checks,node);
                                        ;
     break;}
-case 81:
-#line 584 "parse.y"
+case 80:
+#line 575 "parse.y"
 {
                        Node *node = new_check(LE_CHECK,yyvsp[0].id);
                        checks = g_list_append(checks,node);
                                        ;
     break;}
-case 82:
-#line 588 "parse.y"
+case 81:
+#line 579 "parse.y"
 {
                        Node *node = new_check(EQ_CHECK,yyvsp[0].id);
                        checks = g_list_append(checks,node);
                                        ;
     break;}
-case 83:
-#line 592 "parse.y"
+case 82:
+#line 583 "parse.y"
 {
                        Node *node = new_check(NE_CHECK,yyvsp[0].id);
                        checks = g_list_append(checks,node);
                                        ;
     break;}
-case 84:
-#line 598 "parse.y"
+case 83:
+#line 589 "parse.y"
 { yyval.id = yyvsp[0].id; ;
     break;}
-case 85:
-#line 599 "parse.y"
+case 84:
+#line 590 "parse.y"
 {
                        yyval.id = g_strconcat("-",yyvsp[0].id,NULL);
                        g_free(yyvsp[0].id);
                                        ;
     break;}
-case 86:
-#line 603 "parse.y"
+case 85:
+#line 594 "parse.y"
 { yyval.id = yyvsp[0].id; ;
     break;}
 }
@@ -1776,5 +1764,5 @@ yyerrhandle:
   yystate = yyn;
   goto yynewstate;
 }
-#line 606 "parse.y"
+#line 597 "parse.y"
 
index 77e5692bdf18dca67ba51c459f47429d47d05eb5..6e17c96eb0e859403d9d7df519a959e9a51e033a 100644 (file)
@@ -26,6 +26,7 @@
 #include <string.h>
 
 #include "tree.h"
+#include "main.h"
 
 #define _(x) (x)
        
@@ -40,7 +41,7 @@ static GList *typestack = NULL;
 static int stars = 0;
 static GList *funcargs = NULL;
 static GList *checks = NULL;
-static int has_this = FALSE;
+static int has_self = FALSE;
 
 static GList *gtktypes = NULL;
 
@@ -78,13 +79,13 @@ yyerror(char *str)
 }
 
 static void
-push_variable(char *name, int scope)
+push_variable(char *name, int scope, int line_no)
 {
        Node *var;
        Type *type = typestack->data;
        typestack = g_list_remove(typestack,typestack->data);
        
-       var = new_variable(scope,type,name);
+       var = new_variable(scope,type,name,line_no);
        class_nodes = g_list_append(class_nodes, var);
 }
 
@@ -141,7 +142,7 @@ push_init_arg(char *name, int is_class)
 }
 
 static void
-push_this(char *this)
+push_self(char *id)
 {
        Node *node;
        Node *type;
@@ -149,7 +150,7 @@ push_this(char *this)
        type = new_type(1,g_strdup(((Class *)class)->otype));
        ch = g_list_append(ch,new_check(NULL_CHECK,NULL));
        ch = g_list_append(ch,new_check(TYPE_CHECK,NULL));
-       node = new_funcarg((Type *)type,this,ch);
+       node = new_funcarg((Type *)type,id,ch);
        funcargs = g_list_prepend(funcargs, node);
 }
 
@@ -218,10 +219,10 @@ classcode:        classcode method                { ; }
        ;
 
 variable:      PUBLIC type TOKEN ';'           {
-                       push_variable($<id>3,PUBLIC_SCOPE);
+                       push_variable($<id>3,PUBLIC_SCOPE,$<line>1);
                                                }
        |       PRIVATE type TOKEN ';'  {
-                       push_variable($<id>3,PRIVATE_SCOPE);
+                       push_variable($<id>3,PRIVATE_SCOPE,$<line>1);
                                                }
        ;
 argument:      ARGUMENT argflags TOKEN TOKEN TOKEN '{' CCODE TOKEN '{' CCODE ';' {
@@ -231,7 +232,8 @@ argument:   ARGUMENT argflags TOKEN TOKEN TOKEN '{' CCODE TOKEN '{' CCODE ';' {
                                g_free($<id>5); g_free($<id>8);
                                node = new_argument($<id>3,$<list>2,$<id>4,
                                                    $<cbuf>7,$<line>6,
-                                                   $<cbuf>10,$<line>9);
+                                                   $<cbuf>10,$<line>9,
+                                                   $<line>1);
                                class_nodes = g_list_append(class_nodes,node);
                        } else if(strcmp($<id>5,"set")==0 &&
                                strcmp($<id>8,"get")==0) {
@@ -239,7 +241,8 @@ argument:   ARGUMENT argflags TOKEN TOKEN TOKEN '{' CCODE TOKEN '{' CCODE ';' {
                                g_free($<id>5); g_free($<id>8);
                                node = new_argument($<id>3,$<list>2,$<id>4,
                                                    $<cbuf>10,$<line>9,
-                                                   $<cbuf>7,$<line>6);
+                                                   $<cbuf>7,$<line>6,
+                                                   $<line>1);
                                class_nodes = g_list_append(class_nodes,node);
                        } else {
                                g_free($<id>3); g_free($<id>4);
@@ -256,13 +259,15 @@ 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,$<line>6,NULL,0);
+                                                   $<cbuf>7,$<line>6,NULL,0,
+                                                   $<line>1);
                                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,0,$<cbuf>7,$<line>6);
+                                                   NULL,0,$<cbuf>7,$<line>6,
+                                                   $<line>1);
                                class_nodes = g_list_append(class_nodes,node);
                        } else {
                                g_free($<id>5); g_free($<id>3);
@@ -383,8 +388,12 @@ tokenlist: tokenlist ',' TOKEN             {
                                                        }
        ;
 
+codenocode:    '{' CCODE                       { $<cbuf>$=$<cbuf>2; }
+       |       ';'                             { $<cbuf>$ = NULL; }
+       ;
+
 /*here CCODE will include the ending '}' */
-method:                SIGNAL TOKEN sigtype type TOKEN '(' funcargs ')' onerror '{' CCODE {
+method:                SIGNAL TOKEN sigtype type TOKEN '(' funcargs ')' onerror codenocode {
                        int sigtype = SIGNAL_LAST_METHOD;
                        if(strcmp($<id>2,"first")==0)
                                sigtype = SIGNAL_FIRST_METHOD;
@@ -397,59 +406,31 @@ method:           SIGNAL TOKEN sigtype type TOKEN '(' funcargs ')' onerror '{' CCODE {
                        }
                        g_free($<id>2);
 
-                       if(!has_this) {
-                               yyerror(_("signal without 'this' as "
+                       if(!has_self) {
+                               yyerror(_("signal without 'self' as "
                                          "first parameter"));
                                YYERROR;
                        }
                        push_function(sigtype,NULL,
-                                     $<id>5, $<id>9, $<cbuf>11,$<line>1,$<line>10);
+                                     $<id>5, $<id>9, $<cbuf>10,$<line>1,ccode_line);
                                                                        }
-       |       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;
-                       }
-                       g_free($<id>2);
-                       if(!has_this) {
-                               yyerror(_("signal without 'this' as "
-                                         "first parameter"));
-                               YYERROR;
-                       }
-                       push_function(sigtype, NULL,
-                                     $<id>5, $<id>9, NULL,$<line>1,0);
-                                                                       }
-       |       SIGNAL sigtype type TOKEN '(' funcargs ')' onerror '{' CCODE    {
-                       if(!has_this) {
-                               yyerror(_("signal without 'this' as "
+       |       SIGNAL sigtype type TOKEN '(' funcargs ')' onerror codenocode   {
+                       if(!has_self) {
+                               yyerror(_("signal without 'self' as "
                                          "first parameter"));
                                YYERROR;
                        }
                        push_function(SIGNAL_LAST_METHOD, NULL,
-                                     $<id>4, $<id>8, $<cbuf>10,$<line>1,$<line>9);
+                                     $<id>4, $<id>8, $<cbuf>9,$<line>1,ccode_line);
                                                                        }
-       |       SIGNAL sigtype type TOKEN '(' funcargs ')' onerror ';'          {
-                       if(!has_this) {
-                               yyerror(_("signal without 'this' as "
+       |       VIRTUAL type TOKEN '(' funcargs ')' onerror codenocode  {
+                       if(!has_self) {
+                               yyerror(_("virtual method without 'self' as "
                                          "first parameter"));
                                YYERROR;
                        }
-                       push_function(SIGNAL_LAST_METHOD, NULL, $<id>4,
-                                     $<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,$<line>8);
-                                                                       }
-       |       VIRTUAL type TOKEN '(' funcargs ')' onerror ';'         {
                        push_function(VIRTUAL_METHOD, NULL, $<id>3,
-                                     $<id>7, NULL,$<line>1,0);
+                                     $<id>7, $<cbuf>8,$<line>1,ccode_line);
                                                                        }
        |       OVERRIDE '(' TYPETOKEN ')' type TOKEN '(' funcargs ')' onerror '{' CCODE        {
                        push_function(OVERRIDE_METHOD, $<id>3,
@@ -511,11 +492,16 @@ onerror:  ONERROR numtok          { $<id>$ = $<id>2; }
        
        
 
-funcargs:      VOID                    { has_this = FALSE; }
+funcargs:      VOID                    { has_self = FALSE; }
        |       TOKEN                   {
-                       has_this = TRUE;
-                       if(strcmp($<id>1,"this")==0)
-                               push_this($<id>1);
+                       has_self = TRUE;
+                       if(strcmp($<id>1,"this")==0) {
+                               push_self($<id>1);
+                               print_error(TRUE,_("Use of 'this' is "
+                                                  "depreciated, use 'self' "
+                                                  "instead"),line_no);
+                       } else if(strcmp($<id>1,"self")==0)
+                               push_self($<id>1);
                        else {
                                g_free($<id>1);
                                yyerror(_("parse error"));
@@ -523,16 +509,21 @@ funcargs: VOID                    { has_this = FALSE; }
                        }
                                                }
        |       TOKEN ',' arglist       {
-                       has_this = TRUE;
-                       if(strcmp($<id>1,"this")==0)
-                               push_this($<id>1);
+                       has_self = TRUE;
+                       if(strcmp($<id>1,"this")==0) {
+                               push_self($<id>1);
+                               print_error(TRUE,_("Use of 'this' is "
+                                                  "depreciated, use 'self' "
+                                                  "instead"),line_no);
+                       } else if(strcmp($<id>1,"self")==0)
+                               push_self($<id>1);
                        else {
                                g_free($<id>1);
                                yyerror(_("parse error"));
                                YYERROR;
                        }
                                        }
-       |       arglist                 { has_this = FALSE; }
+       |       arglist                 { has_self = FALSE; }
        ;
        
 arglist:       arglist ',' arg         { ; }
index ae1ce1da13c07e4c09fc91609ecfb658670eb0fb..42adca4862b36709d5261e5202f138c7b54b1d47 100644 (file)
@@ -10,7 +10,7 @@ void bubu(void);
 
 class Gtk:Weird:Button from Gtk:Button {
        public int i;
-       argument INT i set { this->i = ARG; } get { ARG = this->i; } ;
+       argument INT i set { self->i = ARG; } get { ARG = self->i; } ;
        private int j;
        public GtkWidget * h;
 
@@ -27,27 +27,27 @@ class Gtk:Weird:Button from Gtk:Button {
 
                return ret;
        }
-       private int blah(this, Gtk:Widget * wid (check null type),
+       private int blah(self, Gtk:Widget * wid (check null type),
                         int h (check > 0)) onerror -1 {
-               gtk_container_add(GTK_CONTAINER(this),wid);
+               gtk_container_add(GTK_CONTAINER(self),wid);
                return h;
        }
        signal last INT (POINTER, INT)
-       int bleh(this, Gtk:Widget * wid (check null type),
+       int bleh(self, Gtk:Widget * wid (check null type),
                        int h (check > 0)) {
-               return blah(this,wid,h);
+               return blah(self,wid,h);
        }
        signal first NONE (NONE)
-       void bloh(this);
-       virtual void * bah(this, int h (check > 0)) onerror NULL {
-               beh(this,h);
+       void bloh(self);
+       virtual void * bah(self, int h (check > 0)) onerror NULL {
+               beh(self,h);
                return NULL;
        }
-       virtual int beh(this, int h (check > 0));
-       override(Gtk:Container) void add(Gtk:Container * this (check null type),
+       virtual int beh(self, int h (check > 0));
+       override(Gtk:Container) void add(Gtk:Container * self (check null type),
                                         Gtk:Widget * wid (check null type)) {
                if (GTK_CONTAINER_CLASS (parent_class)->add)
-                       (* GTK_CONTAINER_CLASS (parent_class)->add) (this,wid);
+                       (* GTK_CONTAINER_CLASS (parent_class)->add) (self,wid);
        }
 }
 
index a68b97438957404bd5b949e5775fd87f7d544796..279180a5dc30311b9aa95f038706b28118dd6afe 100644 (file)
@@ -95,7 +95,7 @@ new_method(int scope, Type *mtype, char *otype, GList *gtktypes, char *id, GList
 }
 
 Node *
-new_argument(char *gtktype, GList *flags, char *name, GString *get, int get_line, GString *set, int set_line)
+new_argument(char *gtktype, GList *flags, char *name, GString *get, int get_line, GString *set, int set_line, int line_no)
 {
        Argument *node = (Argument *)g_new(Node,1);
        node->type = ARGUMENT_NODE;
@@ -106,16 +106,18 @@ new_argument(char *gtktype, GList *flags, char *name, GString *get, int get_line
        node->get_line = get_line;
        node->set = set;
        node->set_line = set_line;
+       node->line_no = line_no;
        return (Node *)node;
 }
 
 Node *
-new_variable(int scope, Type *vtype, char *id)
+new_variable(int scope, Type *vtype, char *id, int line_no)
 {
        Variable *node = (Variable *)g_new(Node,1);
        node->type = VARIABLE_NODE;
        node->scope = scope;
        node->vtype = vtype;
        node->id = id;
+       node->line_no = line_no;
        return (Node *)node;
 }
index 348cb8a77b1bd7ef9f3462058f951a30d5fa994e..caef602d51eb10280b10ed2acd0448ec2ddf79e3 100644 (file)
@@ -96,6 +96,7 @@ struct _Argument {
        int get_line;
        GString *set;
        int set_line;
+       int line_no;
 };
        
 /*scope type*/
@@ -131,6 +132,7 @@ struct _Variable {
        int scope;
        Type *vtype;
        char *id;
+       int line_no;
 };
 
 union _Node {
@@ -150,7 +152,7 @@ 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,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);
+Node *new_argument(char *gtktype, GList *flags, char *name, GString *get, int get_line, GString *set, int set_line, int line_no);
+Node *new_variable(int scope, Type *vtype, char *id,int line_no);
 
 #endif