r14984 - gnucash/branches/swig-redo/src/gnc-module - Convert gnc-module from gwrap to swig. All at once:

Chris Shoemaker chris at cvs.gnucash.org
Mon Oct 9 20:13:33 EDT 2006


Author: chris
Date: 2006-10-09 20:13:32 -0400 (Mon, 09 Oct 2006)
New Revision: 14984
Trac: http://svn.gnucash.org/trac/changeset/14984

Added:
   gnucash/branches/swig-redo/src/gnc-module/gnc-module.i
Modified:
   gnucash/branches/swig-redo/src/gnc-module/Makefile.am
   gnucash/branches/swig-redo/src/gnc-module/gnc-module.c
   gnucash/branches/swig-redo/src/gnc-module/gnc-module.scm
Log:
Convert gnc-module from gwrap to swig.  All at once:
  Add the interface definition.
  Build and load (from guile) the swig module.



Modified: gnucash/branches/swig-redo/src/gnc-module/Makefile.am
===================================================================
--- gnucash/branches/swig-redo/src/gnc-module/Makefile.am	2006-10-10 00:12:40 UTC (rev 14983)
+++ gnucash/branches/swig-redo/src/gnc-module/Makefile.am	2006-10-10 00:13:32 UTC (rev 14984)
@@ -4,34 +4,21 @@
    -I${top_srcdir}/lib/libc \
    -I${top_srcdir}/src \
    -I${top_srcdir}/src/core-utils \
-   ${GLIB_CFLAGS} ${G_WRAP_COMPILE_ARGS} ${GUILE_INCS}
+   ${GLIB_CFLAGS} ${GUILE_INCS}
 
 lib_LTLIBRARIES = libgncmodule.la 
-pkglib_LTLIBRARIES = libgw-gnc-module.la
 
-libgncmodule_la_SOURCES = gnc-module.c
+libgncmodule_la_SOURCES = gnc-module.c swig-gnc-module.c
 
 libgncmodule_la_LIBADD = \
   ../core-utils/libcore-utils.la \
-  ${G_WRAP_LINK_ARGS} \
  ${top_builddir}/lib/libc/libc-missing.la \
   ${GLIB_LIBS} \
   -lltdl
 
-nodist_libgw_gnc_module_la_SOURCES = gw-gnc-module.c
-
-libgw_gnc_module_la_LIBADD = libgncmodule.la \
-  ${G_WRAP_LINK_ARGS} \
-  ${GUILE_LIBS} \
-  ${GLIB_LIBS}
-
 gncmoddir = ${GNC_SHAREDIR}/guile-modules/gnucash
 gncmod_DATA = gnc-module.scm
 
-gwmoddir = ${GNC_GWRAP_LIBDIR}
-gwmod_DATA = gw-gnc-module-spec.scm 
-nodist_gwmod_DATA = gw-gnc-module.scm
-
 gncincludedir = ${GNC_INCLUDE_DIR}
 gncinclude_HEADERS = \
   gnc-module-api.h \
@@ -39,21 +26,20 @@
 
 noinst_DATA = .scm-links
 
+swig-gnc-module.c: gnc-module.i
+	swig -guile $(SWIG_ARGS) -Linkage module -o $@ $<
+
 EXTRA_DIST = \
-  ${gncmod_DATA} \
-  ${gwmod_DATA}
+  ${gncmod_DATA}
 
 if GNUCASH_SEPARATE_BUILDDIR
-#For compiling
-SCM_FILE_LINKS = gw-gnc-module-spec.scm
 #For executing test cases
-SCM_FILE_LINKS += ${gncmod_DATA}
+SCM_FILE_LINKS = ${gncmod_DATA}
 endif
 
 .scm-links: 
-	rm -f gnucash g-wrapped
+	rm -f gnucash
 	$(LN_S) -f . gnucash
-	$(LN_S) -f . g-wrapped
 if GNUCASH_SEPARATE_BUILDDIR
 	for X in ${SCM_FILE_LINKS} ; do \
 	  $(LN_S) -f ${srcdir}/$$X . ; \
@@ -61,13 +47,6 @@
 endif
 	touch .scm-links
 
-gw-gnc-module.scm gw-gnc-module.c gw-gnc-module.h: \
-  .scm-links gw-gnc-module-spec.scm ${top_builddir}/config.status
-	FLAVOR=gnome $(GUILE) -c \
-	  "(set! %load-path (cons \"${G_WRAP_MODULE_DIR}\" %load-path)) \
-	  (primitive-load \"./gw-gnc-module-spec.scm\") \
-	  (gw:generate-wrapset \"gw-gnc-module\")"
-
-BUILT_SOURCES = gw-gnc-module.scm gw-gnc-module.h gw-gnc-module.c
-CLEANFILES = $(BUILT_SOURCES) .scm-links g-wrapped gnucash \
-	${SCM_FILE_LINKS} gw-gnc-module.html
+BUILT_SOURCES = swig-gnc-module.c
+CLEANFILES = $(BUILT_SOURCES) .scm-links gnucash \
+	${SCM_FILE_LINKS}

Modified: gnucash/branches/swig-redo/src/gnc-module/gnc-module.c
===================================================================
--- gnucash/branches/swig-redo/src/gnc-module/gnc-module.c	2006-10-10 00:12:40 UTC (rev 14983)
+++ gnucash/branches/swig-redo/src/gnc-module/gnc-module.c	2006-10-10 00:13:32 UTC (rev 14984)
@@ -15,7 +15,6 @@
 #include <dirent.h>
 
 #include "gnc-module.h"
-#include "gw-gnc-module.h"
 
 #ifndef lt_ptr
 # define lt_ptr lt_ptr_t

Added: gnucash/branches/swig-redo/src/gnc-module/gnc-module.i
===================================================================
--- gnucash/branches/swig-redo/src/gnc-module/gnc-module.i	2006-10-10 00:12:40 UTC (rev 14983)
+++ gnucash/branches/swig-redo/src/gnc-module/gnc-module.i	2006-10-10 00:13:32 UTC (rev 14984)
@@ -0,0 +1,13 @@
+%module sw_gnc_module
+%{
+#include <gnc-module.h>
+%}
+
+typedef char gchar;
+typedef int gint;
+
+void            gnc_module_system_init(void);
+void            gnc_module_system_refresh(void);
+GNCModule       gnc_module_load(gchar * module_name, gint interface);
+GNCModule       gnc_module_load_optional(gchar * module_name, gint interface);
+int             gnc_module_unload(GNCModule mod);

Modified: gnucash/branches/swig-redo/src/gnc-module/gnc-module.scm
===================================================================
--- gnucash/branches/swig-redo/src/gnc-module/gnc-module.scm	2006-10-10 00:12:40 UTC (rev 14983)
+++ gnucash/branches/swig-redo/src/gnc-module/gnc-module.scm	2006-10-10 00:13:32 UTC (rev 14984)
@@ -7,27 +7,17 @@
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 
 (define-module (gnucash gnc-module))
-(use-modules (g-wrapped gw-gnc-module))
+(load-extension "libgncmodule" "scm_init_sw_gnc_module_module")
+(use-modules (sw_gnc_module))
 
-(export gnc:module-system-init)
+(define gnc:module-system-init gnc-module-system-init)
+(define gnc:module-system-refresh gnc-module-system-refresh)
+(define gnc:module-load gnc-module-load)
+(define gnc:module-load-optional gnc-module-load-optional)
+(define gnc:module-unload gnc-module-unload)
 
-(if (not (defined? 're-export))
-    (begin
-      (defmacro re-export names
-	`(eval export names))
-      (export re-export)))
-
-;; symbols from gw-gnc-module
-(re-export gnc:module-system-refresh)
-(re-export gnc:module-load)
-(re-export gnc:module-load-optional)
-(re-export gnc:module-unload)
-
-(define (gnc:module-system-init)
-  (let ((lib (if (or (string=? (version) "1.3")
-                     (string=? (version) "1.3.4"))
-                 (dynamic-link "libgncmodule.so")
-                 (dynamic-link "libgncmodule"))))
-    (if lib
-        (dynamic-call "gnc_module_system_init" lib)
-        (throw 'gnc:module-system-init-failed))))
+(export gnc:module-system-init)
+(export gnc:module-system-refresh)
+(export gnc:module-load)
+(export gnc:module-load-optional)
+(export gnc:module-unload)



More information about the gnucash-changes mailing list