]> git.draconx.ca Git - gob-dx.git/commitdiff
Release 1.0.6 v1.0.6
authorGeorge Lebl <jirka@5z.com>
Mon, 12 Feb 2001 06:41:00 +0000 (22:41 -0800)
committerNick Bowler <nbowler@draconx.ca>
Tue, 19 Feb 2019 17:20:24 +0000 (12:20 -0500)
ChangeLog
NEWS
TODO
configure
configure.in
doc/gob.1.in
gob.spec
src/Makefile.am
src/Makefile.in
src/main.c
src/test.gob

index ff9feb6a7e69978ab9ac4ca5c59110296dd843c9..944435acf84f245d0f14a3568310eea269d05807 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,36 @@
+Sun Feb 11 16:33:07 2001  George Lebl <jirka@5z.com>
+
+       * Release 1.0.6
+
+Sat Feb 10 18:42:59 2001  George Lebl <jirka@5z.com>
+
+       * src/Makefile.am: fix the build
+
+2001-02-08  Maciej Stachowiak  <mjs@eazel.com>
+
+       * src/Makefile.am: Remove BUILT_SOURCES stuff; Automake knows how
+       to handle .l and .y files directly, and including the .c files as
+       well was making it fail to link as it would try to link in lexer.o
+       and parse.o twice.
+
+Thu Feb 08 02:43:22 2001  George Lebl <jirka@5z.com>
+
+       * src/main.c:  add signal connection typesafety macros
+
+       * src/test.gob, doc/gob.1.in: new stuff foo
+
+       * configure.in: raise version
+
+Thu Feb 08 01:42:52 2001  George Lebl <jirka@5z.com>
+
+       * src/Makefile.am: rule for parse.h includes parse.c, and
+         SOURCES include BUILT_SOURCES
+
+Tue Dec 26 11:03:44 2000  George Lebl <jirka@5z.com>
+
+       * src/main.c: Remove ## from the varargs macro stuff, as it's not
+         needed and causes trouble for newer gcc's (like in rh7)
+
 Sun Sep 10 18:04:07 2000  George Lebl <jirka@5z.com>
 
        * Release 1.0.5
diff --git a/NEWS b/NEWS
index 53e39fd1713605d0f6cb969645663f7e769e0829..f851976a96d43c799a2fb61148696073eea2bdf4 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -1,3 +1,7 @@
+1.0.6
+       * works with new gcc better
+       * signal connection typesafety macros
+
 1.0.5
        * gob.m4 defaults to WARN (Eskil)
        * fix argumentless methods
diff --git a/TODO b/TODO
index f576e1df8b2e6805f28a0cdf2bb2e89de235d09f..99f0ab3e01609bc9eece0dda96890eca3104daaf 100644 (file)
--- a/TODO
+++ b/TODO
@@ -1,5 +1,6 @@
 .defs file generation
 
-PROBABLY NOT! I'm not sure I like this any more:
-a connect_full function for each signal with typesafe function pointer
-argument and macros for the other (simpler) connect types.
+Allow math expressions in array definition
+
+test out the possibility of doing the static typesafe downcasts, at least
+for gob objects.
index d450c908e98ede9956dc937788d5e66953529fd5..84cca28f8fcad9677df34d66b2726bfb955e70ce 100755 (executable)
--- a/configure
+++ b/configure
@@ -703,7 +703,7 @@ fi
 
 PACKAGE=gob
 
-VERSION=1.0.5
+VERSION=1.0.6
 
 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 cc30ff1638ccb807e9e1087c34375b973219ecfa..7f075ca67af133fb9579efa04b57c6baff0e0ad0 100644 (file)
@@ -2,8 +2,13 @@ dnl Process this file with autoconf to produce a configure script.
 AC_PREREQ(2.2)
 AC_INIT(src/treefuncs.h)
 AM_CONFIG_HEADER(config.h)
-AM_INIT_AUTOMAKE(gob,1.0.5)
+AM_INIT_AUTOMAKE(gob,1.0.6)
 
+dnl
+dnl  An utter hack to allow embedding of gob inside other packages.
+dnl  if a file is found in the parent directory named NOINST_GOB, then
+dnl  gob is not installed
+dnl
 if test -f ../NOINST_GOB ; then
   DOINSTGOB=
   NOINSTGOB=gob
index 7d0c285f5053538208a5c90ccc699af8e811083d..d5d817bccfa295ea146339d1b09f5462f308d244 100644 (file)
@@ -382,18 +382,18 @@ value part of the argument.  So for setting an argument of height, one would
 use (for object type My:Object):
 .nf
 
-  gtk_object_set(GTK_OBJECT(object),
-                 MY_OBJECT_ARG_HEIGHT(7),
-                 NULL);
+  gtk_object_set (GTK_OBJECT (object),
+                  MY_OBJECT_ARG_HEIGHT (7),
+                  NULL);
 
 .fi
 And for getting, you would use:
 .nf
 
   int height;
-  gtk_object_set(GTK_OBJECT(object),
-                 MY_OBJECT_GET_ARG_HEIGHT(&height),
-                 NULL);
+  gtk_object_set (GTK_OBJECT (object),
+                  MY_OBJECT_GET_ARG_HEIGHT (&height),
+                  NULL);
 
 .fi
 Note however that the type safety only works completely on GNU C compilers.
@@ -654,6 +654,21 @@ flags, although this is probably very rare.  These are the GTK_RUN_* flags,
 and you can add them without the GTK_RUN_ prefix into a parenthesis, just
 after the "signal" keyword.  By default all public signals are GTK_RUN_ACTION.
 .PP
+Since 1.0.6, gob creates wrapper signal macros for signal connection
+typesafety, at least on gnu compilers.  These macros are named
+<type>_SIGNAL_<signal name>(func), where func is the function pointer.  This
+pointer must be of the correct type, or you will get an initialization from
+wrong pointer type warning.  This macro, much like the argument macros, wraps
+both the name and the function pointer parameters.  For example to connect a
+signal "changed" to a function "foo", you would do:
+.nf
+
+  gtk_signal_connect (GTK_OBJECT (object),
+                      MY_OBJECT_SIGNAL_CHANGED (foo),
+                      NULL);
+
+.fi
+.PP
 Override methods:
 .PP
 If you need to override some method (a signal or a virtual method
index 8657e1a2ad18474c9815db275484013cfbb116e2..53019090531c0a4b997b5b7b32021a8617e03888 100644 (file)
--- a/gob.spec
+++ b/gob.spec
@@ -1,4 +1,4 @@
-%define  ver     1.0.5
+%define  ver     1.0.6
 %define  rel     1
 %define  prefix  /usr
 
index 1c846fd21270509a1b50deb5e2035cb3fdf51d8e..ffe911378269005857be807b0df195847d567a77 100644 (file)
@@ -10,6 +10,8 @@ bin_PROGRAMS = @DOINSTGOB@
 noinst_PROGRAMS = @NOINSTGOB@
 EXTRA_PROGRAMS = gob
 
+BUILT_SOURCES = parse.h parse.c lexer.c
+
 gob_SOURCES =  \
        main.c          \
        main.h          \
@@ -32,13 +34,11 @@ gob_LDADD = \
 # we might want popt back in the future
 #      @POPT_LIB@
 
-BUILT_SOURCES = parse.h parse.c lexer.c
-
 CLEANFILES += $(BUILT_SOURCES) gtk-weird-button.* gtk-weird-button-private.h
 
 EXTRA_DIST = test.gob generate_treefuncs.pl treefuncs.def
 
-parse.h: parse.y
+parse.h parse.c: parse.y
        $(YACC) $(YFLAGS) $<
        test -f y.tab.c && mv -f y.tab.c parse.c
        test -f y.tab.h && mv -f y.tab.h parse.h
index 7646790c6f7a5ea511b380a67203165fa04f72a2..d4e16e4c4a5c66977669a6bb8057e621c28ad1bb 100644 (file)
@@ -89,6 +89,8 @@ bin_PROGRAMS = @DOINSTGOB@
 noinst_PROGRAMS = @NOINSTGOB@
 EXTRA_PROGRAMS = gob
 
+BUILT_SOURCES = parse.h parse.c lexer.c
+
 gob_SOURCES =          main.c                  main.h                  treefuncs.c             treefuncs.h             out.c                   out.h                   util.c                  util.h                  checks.c                checks.h                parse.y                 lexer.l
 
 
@@ -98,8 +100,6 @@ gob_LDADD =          -lm     $(GLIB_LIBS)    @LEXLIB@
 # we might want popt back in the future
 #      @POPT_LIB@
 
-BUILT_SOURCES = parse.h parse.c lexer.c
-
 CLEANFILES =  $(BUILT_SOURCES) gtk-weird-button.* gtk-weird-button-private.h
 
 EXTRA_DIST = test.gob generate_treefuncs.pl treefuncs.def
@@ -412,7 +412,7 @@ installdirs mostlyclean-generic distclean-generic clean-generic \
 maintainer-clean-generic clean mostlyclean distclean maintainer-clean
 
 
-parse.h: parse.y
+parse.h parse.c: parse.y
        $(YACC) $(YFLAGS) $<
        test -f y.tab.c && mv -f y.tab.c parse.c
        test -f y.tab.h && mv -f y.tab.h parse.h
index bf205ac9d2f16c7062b2742eb2041e94a234ea03..6b233d780ecb1de7b818f640c89b0aabb2df71c9 100644 (file)
@@ -193,12 +193,17 @@ print_type(FILE *fp, const Type *t, gboolean postfix_to_stars)
 
 
 static void
-print_method(FILE *fp, const char *typeprefix, const char *nameprefix,
-            const char *subnameprefix,
-            const char *namepostfix, const char *postfix, const Method *m,
-            gboolean one_arg_per_line,
-            gboolean no_funcbase,
-            gboolean kill_underscore)
+print_method (FILE *fp,
+             const char *typeprefix,
+             const char *nameprefix,
+             const char *subnameprefix,
+             const char *namepostfix,
+             const char *afterargs,
+             const char *postfix,
+             const Method *m,
+             gboolean one_arg_per_line,
+             gboolean no_funcbase,
+             gboolean kill_underscore)
 {
        GList *li;
        const char *id;
@@ -239,7 +244,7 @@ print_method(FILE *fp, const char *typeprefix, const char *nameprefix,
        } else {
                out_printf(fp, "void"); 
        }
-       out_printf(fp, ")%s", postfix); 
+       out_printf(fp, "%s)%s", afterargs, postfix); 
 }
 
 static gboolean
@@ -286,7 +291,7 @@ make_method_gnu_aliases(Class *c)
 
                        if(m->args != NULL)
                                out_printf(out, "#define %s(args...) "
-                                          "%s_%s(##args)\n", m->id,
+                                          "%s_%s(args)\n", m->id,
                                           funcbase, get_real_id(m->id));
                        else
                                out_printf(out, "#define %s() "
@@ -320,7 +325,8 @@ make_method_nongnu_aliases(Class *c)
                        if( ! local_made_aliases)
                                out_printf(out, "\n/* Short form pointers */\n");
 
-                       print_method(out, "static ", "(* const ", "", ") ", "",
+                       print_method(out, "static ", "(* const ", "", ") ",
+                                    "", "",
                                     m, FALSE, TRUE, FALSE);
                        out_printf(out, " = %s_%s;\n", funcbase,
                                   get_real_id(m->id));
@@ -402,10 +408,10 @@ put_vs_method(const Method *m)
 
        /* if a signal mark it as such */
        if(m->method != VIRTUAL_METHOD)
-               print_method(outh, "\t/*signal*/", "(* ", "", ") ", ";\n",
+               print_method(outh, "\t/*signal*/", "(* ", "", ") ", "", ";\n",
                             m, FALSE, TRUE, TRUE);
        else
-               print_method(outh, "\t", "(* ", "", ") ", ";\n",
+               print_method(outh, "\t", "(* ", "", ") ", "", ";\n",
                             m, FALSE, TRUE, TRUE);
 }
 
@@ -415,45 +421,51 @@ put_pub_method(const Method *m)
        if(m->scope != PUBLIC_SCOPE)
                return;
 
-       print_method(outh, "", "\t", "", "\t", ";\n", m, TRUE, FALSE, TRUE);
+       print_method(outh, "", "\t", "", "\t", "", ";\n", m, TRUE, FALSE, TRUE);
 }
 
-/* I'm starting not to like this idea */
-#if 0
 static void
-put_signal_connect(Method *m)
+put_signal_macro (const Method *m, gboolean gnu)
 {
+       char *id;
+
        if(m->method != SIGNAL_LAST_METHOD &&
           m->method != SIGNAL_FIRST_METHOD)
                return;
 
-       out_printf(outh, "guint \t%s_%s__connect_full\t(%s *object,\n"
-                  "\t\t\t\t\tconst char *name,\n"
-                  "\t\t\t\t\tGtkSignalFunc func,\n"
-                  "\t\t\t\t\tGtkCallbackMarshal marshal,\n"
-                  "\t\t\t\t\tgpointer data,\n"
-                  "\t\t\t\t\tGtkDestroyNotify destroy_func,\n"
-                  "\t\t\t\t\tgboolean object_signal,\n"
-                  "\t\t\t\t\tgboolean after);\n",
-                  funcbase, m->id, typebase);
-
-       out_printf(outh, "#define %s_%s__connect(object,name,func,data) "
-                  "%s_%s__connect_full((object),(name),(func),NULL,"
-                  "(data),NULL,FALSE,FALSE)\n",
-                  funcbase, m->id, funcbase, m->id);
-       out_printf(outh, "#define %s_%s__connect_after(object,name,func,data) "
-                  "%s__connect_%s_full((object),(name),(func),NULL,"
-                  "(data),NULL,FALSE,TRUE)\n",
-                  funcbase, m->id, funcbase, m->id);
-
-       out_printf(outh, "guint \t%s_%s__connect_while_alive\t(%s *object,\n"
-                  "\t\t\t\t\tconst char *name,\n"
-                  "\t\t\t\t\tGtkSignalFunc func,\n"
-                  "\t\t\t\t\tgpointer data,\n"
-                  "\t\t\t\t\tGtkObject *alive_object);\n\n",
-                  funcbase, m->id, typebase);
+       id = g_strdup (m->id);
+       g_strup (id);
+
+       if ( ! gnu) {
+               out_printf (outh, "#define %s_SIGNAL_%s(func)\t"
+                           "\"%s\",GTK_SIGNAL_FUNC(func)\n",
+                           macrobase, id, get_real_id (m->id));
+       } else {
+               out_printf (outh, "#define %s_SIGNAL_%s(func)\t"
+                           "\"%s\",GTK_SIGNAL_FUNC(({",
+                           macrobase, id, get_real_id (m->id));
+               print_method (outh, "", "(* ___", "", ") ", ", gpointer data ",
+                             " = func; ", m, FALSE, TRUE, TRUE);
+               out_printf (outh, "___%s; }))\n", get_real_id (m->id));
+
+       }
+       g_free (id);
+}
+
+static void
+put_signal_macros (const Class *c, gboolean gnu)
+{
+       const GList *li;
+
+       if (signals < 0)
+               return;
+
+       for (li = c->nodes; li != NULL; li = li->next) {
+               const Node *n = li->data;
+               if (n->type == METHOD_NODE)
+                       put_signal_macro ((Method *)n, gnu);
+       }
 }
-#endif
 
 
 static void
@@ -463,10 +475,10 @@ put_prot_method(const Method *m)
                return;
 
        if(outph)
-               print_method(outph, "", "\t", "", "\t", ";\n",
+               print_method(outph, "", "\t", "", "\t", "", ";\n",
                             m, FALSE, FALSE, TRUE);
        else
-               print_method(out, "", "\t", "", "\t", ";\n",
+               print_method(out, "", "\t", "", "\t", "", ";\n",
                             m, FALSE, FALSE, TRUE);
 }
 
@@ -478,7 +490,7 @@ put_priv_method_prot(Method *m)
           m->method == VIRTUAL_METHOD) {
                if(m->cbuf)
                        print_method(out,
-                                    "static ", "___real_", "", " ", ";\n",
+                                    "static ", "___real_", "", " ", "", ";\n",
                                     m, FALSE, FALSE, TRUE);
        }
        /* no else, here, it might still have a private prototype, it's not
@@ -488,14 +500,14 @@ put_priv_method_prot(Method *m)
            m->cbuf)) {
                /* add unique ID */
                char *s = g_strdup_printf("___%x_", (guint)m->unique_id);
-               print_method(out, "static ", s, "", " ",
+               print_method(out, "static ", s, "", " ", "",
                             no_gnu?";\n":" G_GNUC_UNUSED;\n",
                             m, FALSE, FALSE, FALSE);
                g_free(s);
        } else if(m->scope == PRIVATE_SCOPE ||
                  m->method == INIT_METHOD ||
                  m->method == CLASS_INIT_METHOD)
-               print_method(out, "static ", "", "", " ",
+               print_method(out, "static ", "", "", " ", "",
                             no_gnu?";\n":" G_GNUC_UNUSED;\n",
                             m, FALSE, FALSE, TRUE);
 }
@@ -1356,7 +1368,7 @@ add_inits(Class *c)
                if(m->method == INIT_METHOD) {
                        if(m->line_no > 0)
                                out_addline_infile(out, m->line_no);
-                       print_method(out, "static ", "\n", "", " ", "\n",
+                       print_method(out, "static ", "\n", "", " ", "", "\n",
                                     m, FALSE, FALSE, TRUE);
                        if(m->line_no > 0)
                                out_addline_outfile(out);
@@ -1390,7 +1402,7 @@ add_inits(Class *c)
 
                        if(m->line_no > 0)
                                out_addline_infile(out, m->line_no);
-                       print_method(out, "static ", "\n", "", " ", "\n",
+                       print_method(out, "static ", "\n", "", " ", "", "\n",
                                     m, FALSE, FALSE, TRUE);
                        if(m->line_no > 0)
                                out_addline_outfile(out);
@@ -1746,10 +1758,10 @@ put_method(Method *m)
                if(m->line_no > 0)
                        out_addline_infile(out, m->line_no);
                if(m->scope == PRIVATE_SCOPE)
-                       print_method(out, "static ", "\n", "", " ", "\n",
+                       print_method(out, "static ", "\n", "", " ", "", "\n",
                                     m, FALSE, FALSE, TRUE);
                else /* PUBLIC, PROTECTED */
-                       print_method(out, "", "\n", "", " ", "\n",
+                       print_method(out, "", "\n", "", " ", "", "\n",
                                     m, FALSE, FALSE, TRUE);
                print_method_body(m, TRUE);
                /* the outfile line was added above */
@@ -1759,10 +1771,10 @@ put_method(Method *m)
                if(m->line_no > 0)
                        out_addline_infile(out, m->line_no);
                if(m->scope == PRIVATE_SCOPE)
-                       print_method(out, "static ", "\n", "", " ", "\n",
+                       print_method(out, "static ", "\n", "", " ", "", "\n",
                                     m, FALSE, FALSE, TRUE);
                else /* PUBLIC, PROTECTED */
-                       print_method(out, "", "\n", "", " ", "\n",
+                       print_method(out, "", "\n", "", " ", "", "\n",
                                     m, FALSE, FALSE, TRUE);
                out_addline_outfile(out);
                out_printf(out, "{\n");
@@ -1801,7 +1813,7 @@ put_method(Method *m)
                        break;
                if(m->line_no > 0)
                        out_addline_infile(out, m->line_no);
-               print_method(out, "static ", "\n___real_", "", " ", "\n",
+               print_method(out, "static ", "\n___real_", "", " ", "", "\n",
                             m, FALSE, FALSE, TRUE);
                print_method_body(m, FALSE);
                /* the outfile line was added above */
@@ -1810,10 +1822,10 @@ put_method(Method *m)
                if(m->line_no > 0)
                        out_addline_infile(out, m->line_no);
                if(m->scope==PRIVATE_SCOPE)
-                       print_method(out, "static ", "\n", "", " ", "\n",
+                       print_method(out, "static ", "\n", "", " ", "", "\n",
                                     m, FALSE, FALSE, TRUE);
                else /* PUBLIC, PROTECTED */
-                       print_method(out, "", "\n", "", " ", "\n",
+                       print_method(out, "", "\n", "", " ", "", "\n",
                                     m, FALSE, FALSE, TRUE);
                out_addline_outfile(out);
                out_printf(out, "{\n"
@@ -1859,7 +1871,7 @@ put_method(Method *m)
                        break;
                if(m->line_no > 0)
                        out_addline_infile(out, m->line_no);
-               print_method(out, "static ", "\n___real_", "", " ", "\n",
+               print_method(out, "static ", "\n___real_", "", " ", "", "\n",
                             m, FALSE, FALSE, TRUE);
                print_method_body(m, FALSE);
                /* the outfile line was added above */
@@ -1870,7 +1882,7 @@ put_method(Method *m)
                if(m->line_no > 0)
                        out_addline_infile(out, m->line_no);
                s = g_strdup_printf("\n___%x_", (guint)m->unique_id);
-               print_method(out, "static ", s, "", " ", "\n",
+               print_method(out, "static ", s, "", " ", "", "\n",
                             m, FALSE, FALSE, FALSE);
                g_free(s);
                out_addline_outfile(out);
@@ -2304,39 +2316,34 @@ print_class_block(Class *c)
                }
        }
 
-/* this idea is less and less apealing to me */
-#if 0
-       if(!no_signal_connect) {
-               if(signals>0) {
-                       out_printf(outh, "\n/*\n"
-                                  " * Signal connection methods\n"
-                                  " */\n");
-               }
-
-               for(l=c->nodes;l;l=g_list_next(l)) {
-                       Node *n = l->data;
-                       if(n->type == METHOD_NODE)
-                               put_signal_connect((Method *)n);
+       /* this idea is less and less apealing to me */
+       if (signals > 0) {
+               out_printf (outh, "\n/*\n"
+                           " * Signal connection wrapper macros\n"
+                           " */\n");
+               if( ! no_gnu) {
+                       out_printf(outh, "#if defined(__GNUC__) && !defined(__STRICT_ANSI__)\n");
+                       put_signal_macros (c, TRUE);
+                       out_printf(outh, "#else /* __GNUC__ && !__STRICT_ANSI__ */\n");
+                       put_signal_macros (c, FALSE);
+                       out_printf(outh, "#endif /* __GNUC__ && !__STRICT_ANSI__ */\n\n");
+               } else {
+                       put_signal_macros (c, FALSE);
                }
        }
-#endif
-
 
        /* argument wrapping macros */
        if(get_arguments > 0 || set_arguments > 0) {
+               out_printf(outh, "\n/*\n"
+                          " * Argument wrapping macros\n"
+                          " */\n");
                if( ! no_gnu) {
-                       out_printf(outh, "\n/*\n"
-                                  " * Argument wrapping macros\n"
-                                  " */\n");
                        out_printf(outh, "#if defined(__GNUC__) && !defined(__STRICT_ANSI__)\n");
                        put_argument_gnu_wrappers(c);
                        out_printf(outh, "#else /* __GNUC__ && !__STRICT_ANSI__ */\n");
                        put_argument_nongnu_wrappers(c);
                        out_printf(outh, "#endif /* __GNUC__ && !__STRICT_ANSI__ */\n\n");
                } else {
-                       out_printf(outh, "\n/*\n"
-                                  " * Argument wrapping macros\n"
-                                  " */\n");
                        put_argument_nongnu_wrappers(c);
                }
        }
index 36fe62b1f94bc876903248163234dacee4244bc0..432f4716c81d6a906794b33256834a93f0e2336d 100644 (file)
@@ -146,6 +146,14 @@ class Gtk:Weird:Button from Gtk:Button {
                        int h (check > 0)) {
                return _blah(self,wid,h);
        }
+
+       private
+       int
+       test_handler (self, GtkWidget *w, int h, gpointer data)
+       {
+               return -1;
+       }
+
        /**
         * gtk_weird_button_bleh2:
         * @self: foo
@@ -158,6 +166,10 @@ class Gtk:Weird:Button from Gtk:Button {
        signal last INT (POINTER, INT)
        int bleh2(self, const Gtk:Widget * wid (check null type),
                        int h (check > 0)) {
+               gtk_signal_connect (GTK_OBJECT (self),
+                                   GTK_WEIRD_BUTTON_SIGNAL_BLEH (test_handler),
+                                   NULL);
+
                /* testing multiple marshaller support */
                return 0;
        }