]> git.draconx.ca Git - gob-dx.git/commitdiff
Release 1.0.7 v1.0.7
authorGeorge Lebl <jirka@5z.com>
Mon, 26 Feb 2001 08:10:00 +0000 (00:10 -0800)
committerNick Bowler <nbowler@draconx.ca>
Tue, 19 Feb 2019 17:20:30 +0000 (12:20 -0500)
ChangeLog
NEWS
TODO
configure
configure.in
doc/gob.1.in
gob.spec
src/checks.c
src/checks.h
src/main.c
src/test.gob

index 944435acf84f245d0f14a3568310eea269d05807..b4190e26c4d9c3dc62aaa5a1e1043ac873d78cbe 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,14 @@
+Sun Feb 25 17:17:46 2001  George Lebl <jirka@5z.com>
+
+       * Release 1.0.7
+
+Sun Feb 25 16:57:45 2001  George Lebl <jirka@5z.com>
+
+       * src/main.c, src/checks.c: to make doing BonoboXObjects possible
+         allow overriding the _get_type function.
+
+       * doc/gob.1.in: document the above
+
 Sun Feb 11 16:33:07 2001  George Lebl <jirka@5z.com>
 
        * Release 1.0.6
diff --git a/NEWS b/NEWS
index f851976a96d43c799a2fb61148696073eea2bdf4..045c60fcbe336ce399ce484ef109c178d6a15fc8 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -1,3 +1,6 @@
+1.0.7
+       * allow overriding of get_type (allows BonoboXObject)
+
 1.0.6
        * works with new gcc better
        * signal connection typesafety macros
diff --git a/TODO b/TODO
index 99f0ab3e01609bc9eece0dda96890eca3104daaf..24bf3e0a8312a2ec981d33aafd06f06996e10e94 100644 (file)
--- a/TODO
+++ b/TODO
@@ -4,3 +4,7 @@ Allow math expressions in array definition
 
 test out the possibility of doing the static typesafe downcasts, at least
 for gob objects.
+
+override geT_type
+
+Support BonoboXObject directly
index 84cca28f8fcad9677df34d66b2726bfb955e70ce..d013f62f6286b27259f6b58ebd9b599d7a8ed6d7 100755 (executable)
--- a/configure
+++ b/configure
@@ -703,7 +703,7 @@ fi
 
 PACKAGE=gob
 
-VERSION=1.0.6
+VERSION=1.0.7
 
 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 7f075ca67af133fb9579efa04b57c6baff0e0ad0..91e1277ee2dfd65eb3e139d0b40679be26697053 100644 (file)
@@ -2,7 +2,7 @@ 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.6)
+AM_INIT_AUTOMAKE(gob,1.0.7)
 
 dnl
 dnl  An utter hack to allow embedding of gob inside other packages.
index d5d817bccfa295ea146339d1b09f5462f308d244..81aa107e361bd31c5f0dca22d48b033e18649850 100644 (file)
@@ -824,6 +824,24 @@ use the full name of the method inside your code.  Also note that gob does
 not use any C++ features, this option will just make the generated code
 compile with a C++ compiler.
 
+.SH OVERRIDING THE GET_TYPE METHOD
+.PP
+The get_type is not really a method, but a function which initializes your
+object.  Recently objects appeared which require you to make a custom
+get_type function (BonoboXObject currently).  So in 1.0.7 it is now possible
+to override this function.  To do so, just define a new public method called
+get_type, with no arguments.  Example:
+.nf
+
+  public GtkType
+  get_type (void)
+  {
+       /* code goes here */
+       return some_type;
+  }
+
+.fi
+
 .SH IDENTIFIER CONFLICTS
 .PP
 Gob will need to define some local variables and functions in the generated
index 53019090531c0a4b997b5b7b32021a8617e03888..06064dbc3fe4bbc0e350c6146c9953bd0208bdd6 100644 (file)
--- a/gob.spec
+++ b/gob.spec
@@ -1,4 +1,4 @@
-%define  ver     1.0.6
+%define  ver     1.0.7
 %define  rel     1
 %define  prefix  /usr
 
index 2bb3b69043b209cd28c6cebdce032c0c7c8c35fa..062d6357c2e11521ed3cbe1cbdb4dcc5967ea2fb 100644 (file)
@@ -582,3 +582,27 @@ count_initializers(Class *c)
        }
        return num;
 }
+
+gboolean
+find_get_type (Class *c)
+{
+       GList *l;
+       for(l = c->nodes; l != NULL; l = g_list_next(l)) {
+               Node *n = l->data;
+               Method *m = (Method *)n;
+               if(n->type == METHOD_NODE &&
+                  strcmp (m->id, "get_type") == 0) {
+                       if (m->method != REGULAR_METHOD ||
+                           m->scope != PUBLIC_SCOPE ||
+                           m->args != NULL) {
+                               error_printf (GOB_ERROR, m->line_no,
+                                             "get_type method must be a "
+                                             "regular public method with "
+                                             "no arguments");
+                       }
+                       return TRUE;
+               }
+       }
+
+       return FALSE;
+}
index ef71b475c2b7737a4d62bc015b00de6588f235fc..7966f17cebf6ce690b10932556fbe2b5e54651a9 100644 (file)
@@ -43,5 +43,6 @@ int count_privates(Class *c);
 int count_protecteds(Class *c);
 int count_destructors(Class *c);
 int count_initializers(Class *c);
+gboolean find_get_type (Class *c);
 
 #endif
index 6b233d780ecb1de7b818f640c89b0aabb2df71c9..d94361a885aad4d5aec038557876ebc79178573f 100644 (file)
@@ -67,6 +67,7 @@ static int privates = 0; /* number of private data members */
 static int protecteds = 0; /* number of protected methods */
 static int destructors = 0; /* number of variable destructors */
 static int initializers = 0; /* number of variable initializers */
+static gboolean overrode_get_type = FALSE; /* provided your won _get_type */
 
 static gboolean made_aliases = FALSE;  /* if we made any shorthand aliases
                                          and need the REALLY UGLY HACK to
@@ -818,8 +819,8 @@ add_get_type(void)
                   "GtkType\n"
                   "%s_get_type (void)\n"
                   "{\n"
-                  "\tstatic guint type = 0;\n\n"
-                  "\tif ( ! type) {\n"
+                  "\tstatic GtkType type = 0;\n\n"
+                  "\tif (type == 0) {\n"
                   "\t\tstatic const GtkTypeInfo info = {\n"
                   "\t\t\t\"%s\",\n"
                   "\t\t\tsizeof (%s),\n"
@@ -2358,7 +2359,8 @@ print_class_block(Class *c)
 
        add_enums(c);
 
-       add_get_type();
+       if ( ! overrode_get_type)
+               add_get_type();
 
        if(any_method_to_alias(c)) {
                if( ! no_gnu) {
@@ -2773,6 +2775,7 @@ main(int argc, char *argv[])
        protecteds = count_protecteds((Class *)class);
        destructors = count_destructors((Class *)class);
        initializers = count_initializers((Class *)class);
+       overrode_get_type = find_get_type((Class *)class);
 
        make_bases();
        make_inits((Class *)class);
index 432f4716c81d6a906794b33256834a93f0e2336d..9ea1d90167d82a68bb187bfda12f73bb032a694d 100644 (file)
@@ -60,6 +60,7 @@ void bubu(void);
 %}
 
 class Gtk:Weird:Button from Gtk:Button {
+
        public int test_array[TEST_ARRAY];
        public int i;
        argument INT i set { self->i = ARG; } get { ARG = self->i; } ;
@@ -406,6 +407,30 @@ class Gtk:Weird:Button from Gtk:Button {
                method_with_no_arguments ();
        }
 
+       /* this is to test custom get_type */
+       /*public GtkType
+       get_type (void)
+       {
+               static guint type = 0;
+
+               if ( ! type) {
+                       static const GtkTypeInfo info = {
+                               "GtkWeirdButton",
+                               sizeof (GtkWeirdButton),
+                               sizeof (GtkWeirdButtonClass),
+                               (GtkClassInitFunc) gtk_weird_button_class_init,
+                               (GtkObjectInitFunc) gtk_weird_button_init,
+                               NULL,
+                               NULL,
+                               (GtkClassInitFunc) NULL
+                       };
+
+                       type = gtk_type_unique (gtk_button_get_type(), &info);
+               }
+
+               return type;
+       }*/
+
 
        /* testing empty statements */
        ;