patch for bonobo-idl



Hi,

the test code that bonobo-idl was generating wasn't compiling,
here is a patch that should make it compile.

In bonobo-idl/main.c, in write_epv_assignment(), we need to use
name_gtk_interface_base() instead of name_corba_interface_prefix(),
or else the generated test-bskel.c contains this code:

static void
init_my_prefix_corba_class (void)
{
	MyPrefix_vepv.Bonobo_Unknown_epv = bonobo_object_get_epv ();
	MyPrefix_vepv.Test_Duck_epv = My_Prefix_get_epv ();
			 	      ^^^^^^^^^^^^^^^^^
				  this should be my_prefix_get_epv ()
}


Also, in bonobo-idl/test.bcd, my_prefix_new() needs to return MyPrefix*
instead of MyPrefix.

This patch also fixes several warnings, and it adds a bonobo-idl/test-main.c
file, which has a client to the generated bonobo server. 

Matt


diff -uNr --exclude-from=/tmp/list bonobo.orig/ChangeLog bonobo/ChangeLog
--- bonobo.orig/ChangeLog	Sun Jul 30 01:53:48 2000
+++ bonobo/ChangeLog	Sun Jul 30 03:45:39 2000
@@ -1,3 +1,23 @@
+2000-07-30  Matt Bissiri  <bissiri@eecs.umich.edu>
+
+	* bonobo-idl/.cvsignore: Ignore more generated files.
+	* bonobo-idl/Makefile.am: Add bonobo cflags and libs for test-idl.
+	(test_idl_SOURCES): Add test-main.c.
+	* bonobo-idl/ctx.c (prefix_compute_names): Removed unused variable.
+	* bonobo-idl/main.c (write_epv_assignement): Rename to
+	(write_epv_assignment).  Use name_gtk_interface_base() instead of
+	name_corba_interface_prefix().
+	(parse_bcd): Change "%prefix" to "%prefix:"
+	* bonobo-idl/test.bcd: Change my_prefix_new() to return MyPrefix*
+	instead of MyPrefix
+	* bonobo-idl/test.c (impl_My_Prefix_get_message): Return a value, so
+	that this will compile.
+	(my_prefix_class_init): Call init_my_prefix_corba_class().
+	(my_prefix_new): New function.
+	* bonobo-idl/util.c: #include <string.h> to get rid of strcat warning.
+	* bonobo-idl/test-main.c: New file.  This is a client of the
+	"MyPrefix" bonobo server.
+
 2000-07-29  Michael Meeks  <michael@helixcode.com>
 
 	* configure.in: bump version to 0.16
diff -uN --exclude-from=/tmp/list bonobo.orig/bonobo-idl/.cvsignore bonobo/bonobo-idl/.cvsignore
--- bonobo.orig/bonobo-idl/.cvsignore	Sat Jul  8 13:29:59 2000
+++ bonobo/bonobo-idl/.cvsignore	Sun Jul 30 03:45:31 2000
@@ -1,2 +1,12 @@
 Makefile
 Makefile.in
+.deps
+.libs
+Test-common.c
+Test-skels.c
+Test-stubs.c
+Test.h
+test-bskel.c
+test.h
+bonobo-idl
+test-idl
diff -uN --exclude-from=/tmp/list bonobo.orig/bonobo-idl/Makefile.am bonobo/bonobo-idl/Makefile.am
--- bonobo.orig/bonobo-idl/Makefile.am	Mon Jul 24 20:23:01 2000
+++ bonobo/bonobo-idl/Makefile.am	Sun Jul 30 03:45:31 2000
@@ -22,18 +22,28 @@
 	Test-stubs.c	\
 	Test-common.c
 
+INCLUDES = `gnome-config --cflags bonobo`
+
 test_idl_SOURCES =		\
 	$(test_corba_generated)	\
 	test.bcd		\
-	test-bskel.c		\
 	test.c			\
-	test.h
+	test.h			\
+	test-main.c
+
+test_idl_LDFLAGS = `gnome-config --libs bonobo`
 
 EXTRA_DIST = Test.idl
 
 $(test_corba_generated): Test.idl
 	orbit-idl -I`$(GNOME_CONFIG) --datadir`/idl -I$(srcdir) -I$(top_srcdir) $<
 
-test-bskel.c: test.bcd
+test_bonobo_idl_generated =	\
+	test-bskel.c		\
+	test.h
+
+test.c: $(test_bonobo_idl_generated)
+
+$(test_bonobo_idl_generated): test.bcd bonobo-idl
 	./bonobo-idl -I`$(GNOME_CONFIG) --datadir`/idl test.bcd
 
diff -uN --exclude-from=/tmp/list bonobo.orig/bonobo-idl/ctx.c bonobo/bonobo-idl/ctx.c
--- bonobo.orig/bonobo-idl/ctx.c	Thu Jul 13 00:56:23 2000
+++ bonobo/bonobo-idl/ctx.c	Sun Jul 30 03:45:31 2000
@@ -116,7 +116,6 @@
 static void
 prefix_compute_names (Ctx *ctx)
 {
-	int i;
 	char **names;
 	
 	names = tokenize (ctx->prefix);
diff -uN --exclude-from=/tmp/list bonobo.orig/bonobo-idl/main.c bonobo/bonobo-idl/main.c
--- bonobo.orig/bonobo-idl/main.c	Mon Jul 24 20:23:01 2000
+++ bonobo/bonobo-idl/main.c	Sun Jul 30 03:45:31 2000
@@ -178,14 +178,14 @@
 }
 
 static void
-write_epv_assignement (IDL_tree node, Ctx *ctx)
+write_epv_assignment (IDL_tree node, Ctx *ctx)
 {
 	char *method = IDL_ns_ident_to_qstring (IDL_IDENT_TO_NS (IDL_INTERFACE (node).ident), "_", 0);
 	char *x_method = lowercase (IDL_ns_ident_to_qstring (IDL_IDENT_TO_NS (IDL_INTERFACE (node).ident), "_", 0));
 	
 	if (strcmp (method, name_corba_interface (ctx)) == 0){
 		g_free (x_method);
-		x_method = g_strdup (name_corba_interface_prefix (ctx));
+		x_method = g_strdup (name_gtk_interface_base (ctx));
 	}
 
 	if (strcmp (x_method, "bonobo_unknown") == 0){
@@ -208,7 +208,7 @@
 		 "init_%s_corba_class (void)\n"
 		 "{\n", name_gtk_interface_base (ctx));
 
-	IDL_tree_traverse_parents (ctx->base, (GFunc) write_epv_assignement, ctx);
+	IDL_tree_traverse_parents (ctx->base, (GFunc) write_epv_assignment, ctx);
 
 	fprintf (ctx->output, "}\n\n");
 }
@@ -530,7 +530,7 @@
 			continue;
 		}
 
-		if (strncmp (buffer, "%prefix:", strlen ("%prefix")) == 0){
+		if (strncmp (buffer, "%prefix:", strlen ("%prefix:")) == 0){
 			ctx->prefix = trim_leading (buffer + strlen ("%prefix:"));
 			continue;
 		}
diff -uN --exclude-from=/tmp/list bonobo.orig/bonobo-idl/test-main.c bonobo/bonobo-idl/test-main.c
--- bonobo.orig/bonobo-idl/test-main.c	Wed Dec 31 19:00:00 1969
+++ bonobo/bonobo-idl/test-main.c	Sun Jul 30 03:45:31 2000
@@ -0,0 +1,72 @@
+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
+#include <config.h>
+#include <bonobo.h>
+#include <gnome.h>
+
+#include <test.h>
+
+static MyPrefix *my_prefix;
+
+
+static void
+my_prefix_do_stuff_cb (MyPrefix *my_prefix)
+{
+	g_print ("my_prefix_do_stuff_cb\n");
+}
+
+#ifdef USING_OAF
+
+#include <liboaf/liboaf.h>
+
+static void
+init_corba (int *argc, char **argv)
+{
+	gnome_init ("test-main", VERSION, *argc, argv);
+	oaf_init (*argc, argv);
+}
+
+#else
+
+#include <libgnorba/gnorba.h>
+
+static void
+init_corba (int *argc, char **argv)
+{
+	CORBA_Environment ev;
+
+	CORBA_exception_init (&ev);
+	gnome_CORBA_init ("test-main", VERSION, &argc, argv, 0, &ev);
+	if (ev._major != CORBA_NO_EXCEPTION) {
+		g_message ("main(): could not initialize the ORB");
+		CORBA_exception_free (&ev);
+		exit (1);
+	}
+	CORBA_exception_free (&ev);
+}
+
+#endif
+
+int
+main (int argc, char **argv)
+{
+	/*
+	bindtextdomain (PACKAGE, GNOMELOCALEDIR);
+	textdomain (PACKAGE);
+	*/
+	
+	init_corba (&argc, argv);
+
+	if (!bonobo_init (CORBA_OBJECT_NIL, CORBA_OBJECT_NIL, CORBA_OBJECT_NIL)) {
+		g_message ("main(): could not initialize Bonobo");
+		exit (1);
+	}
+
+	my_prefix = my_prefix_new ("/tmp/junk");
+	gtk_signal_connect (GTK_OBJECT (my_prefix), "do_stuff",
+			    my_prefix_do_stuff_cb,
+			    NULL);
+
+	bonobo_main ();
+
+	return 0;
+}
diff -uN --exclude-from=/tmp/list bonobo.orig/bonobo-idl/test.bcd bonobo/bonobo-idl/test.bcd
--- bonobo.orig/bonobo-idl/test.bcd	Thu Jul 13 19:05:11 2000
+++ bonobo/bonobo-idl/test.bcd	Sun Jul 30 03:45:31 2000
@@ -20,7 +20,7 @@
 %% bonobo-idl by default computes the name of the structures, and macros
 %% from the interface above.  If you want to override your C implementation
 %% you can use the following (for instance, there might be multiple implementations
-%% of the same interface
+%% of the same interface)
 %%
 %prefix: My Prefix
 
@@ -49,5 +49,5 @@
 %%
 %protos
 
-MyPrefix my_prefix_new (const char *file);
+MyPrefix *my_prefix_new (const char *file);
 
diff -uN --exclude-from=/tmp/list bonobo.orig/bonobo-idl/test.c bonobo/bonobo-idl/test.c
--- bonobo.orig/bonobo-idl/test.c	Thu Jul 13 19:05:11 2000
+++ bonobo/bonobo-idl/test.c	Sun Jul 30 03:45:31 2000
@@ -20,10 +20,10 @@
 {
 	MyPrefix *my_prefix = my_prefix_from_servant (servant);
 
-	if (my_prefix->message)
+	if (!my_prefix->message)
 		return CORBA_string_dup ("");
 	else
-		CORBA_string_dup (my_prefix->message);
+		return CORBA_string_dup (my_prefix->message);
 }
 
 static void
@@ -48,12 +48,28 @@
 	GTK_OBJECT_CLASS (my_prefix_parent_class)->destroy (object);
 }
 
+static void init_my_prefix_corba_class (void);
+
 static void
 my_prefix_class_init (GtkObjectClass *object_class)
 {
 	object_class->destroy = my_prefix_destroy;
 
 	my_prefix_parent_class = gtk_type_class (MY_PREFIX_PARENT_TYPE);
+
+	init_my_prefix_corba_class ();
+}
+
+MyPrefix *
+my_prefix_new (const char *file)
+{
+	MyPrefix *my_prefix;
+
+	my_prefix = gtk_type_new (MY_PREFIX_TYPE);
+
+	/* FIXME construct */
+	
+	return my_prefix;
 }
 
 #include "test-bskel.c"
diff -uN --exclude-from=/tmp/list bonobo.orig/bonobo-idl/util.c bonobo/bonobo-idl/util.c
--- bonobo.orig/bonobo-idl/util.c	Thu Jul 13 19:05:11 2000
+++ bonobo/bonobo-idl/util.c	Sun Jul 30 03:45:31 2000
@@ -8,6 +8,7 @@
  */
 #include "config.h"
 #include <ctype.h>
+#include <string.h>
 #include <libIDL/IDL.h>
 #include <glib.h>
 #include "util.h"





[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]