r14985 - gnucash/branches/swig-redo/src - Convert the core-utils "module" (more like "directory") from gwrap to swig.
Chris Shoemaker
chris at cvs.gnucash.org
Mon Oct 9 20:14:12 EDT 2006
Author: chris
Date: 2006-10-09 20:14:12 -0400 (Mon, 09 Oct 2006)
New Revision: 14985
Trac: http://svn.gnucash.org/trac/changeset/14985
Added:
gnucash/branches/swig-redo/src/core-utils/core-utils.i
gnucash/branches/swig-redo/src/core-utils/core-utils.scm
Modified:
gnucash/branches/swig-redo/src/app-utils/prefs.scm
gnucash/branches/swig-redo/src/bin/gnucash-bin.c
gnucash/branches/swig-redo/src/core-utils/Makefile.am
gnucash/branches/swig-redo/src/core-utils/gnc-main.c
gnucash/branches/swig-redo/src/core-utils/gnc-main.h
gnucash/branches/swig-redo/src/import-export/qif-import/qif-file.scm
gnucash/branches/swig-redo/src/report/report-gnome/report-gnome.scm
gnucash/branches/swig-redo/src/scm/main.scm
gnucash/branches/swig-redo/src/scm/price-quotes.scm
Log:
Convert the core-utils "module" (more like "directory") from gwrap to swig.
All at once:
Add the interface definition.
Add a new guile module to replace the gw-core-utils.
Build and load the swig module (from the new guile module).
Use more glib in gnc-main.[ch]
Incidentally, enable guile backtraces unconditionally.
Modified: gnucash/branches/swig-redo/src/app-utils/prefs.scm
===================================================================
--- gnucash/branches/swig-redo/src/app-utils/prefs.scm 2006-10-10 00:13:32 UTC (rev 14984)
+++ gnucash/branches/swig-redo/src/app-utils/prefs.scm 2006-10-10 00:14:12 UTC (rev 14985)
@@ -19,7 +19,6 @@
(require 'sort)
(require 'hash-table)
-(use-modules (g-wrapped gw-core-utils))
;; (define gnc:*double-entry-restriction*
;; (gnc:make-config-var
Modified: gnucash/branches/swig-redo/src/bin/gnucash-bin.c
===================================================================
--- gnucash/branches/swig-redo/src/bin/gnucash-bin.c 2006-10-10 00:13:32 UTC (rev 14984)
+++ gnucash/branches/swig-redo/src/bin/gnucash-bin.c 2006-10-10 00:14:12 UTC (rev 14985)
@@ -51,7 +51,7 @@
#include "dialog-new-user.h"
#include "gnc-session.h"
#include "engine-helpers.h"
-#include <g-wrap-wct.h>
+#include "swig-runtime.h"
/* GNUCASH_SVN is defined whenever we're building from an SVN tree */
#ifdef GNUCASH_SVN
Modified: gnucash/branches/swig-redo/src/core-utils/Makefile.am
===================================================================
--- gnucash/branches/swig-redo/src/core-utils/Makefile.am 2006-10-10 00:13:32 UTC (rev 14984)
+++ gnucash/branches/swig-redo/src/core-utils/Makefile.am 2006-10-10 00:14:12 UTC (rev 14985)
@@ -1,4 +1,4 @@
-lib_LTLIBRARIES = libcore-utils.la libgw-core-utils.la
+lib_LTLIBRARIES = libcore-utils.la
libcore_utils_la_SOURCES = \
gnc-main.c \
@@ -7,6 +7,7 @@
gnc-gkeyfile-utils.c \
gnc-glib-utils.c \
gnc-gobject-utils.c \
+ swig-core-utils.c \
gnc-gtk-utils.c
libcore_utils_la_LIBADD = \
@@ -14,15 +15,6 @@
${GCONF_LIBS} \
${GTK_LIBS}
-nodist_libgw_core_utils_la_SOURCES = \
- gw-core-utils.c
-
-libgw_core_utils_la_LDFLAGS = ${G_WRAP_LINK_ARGS}
-libgw_core_utils_la_LIBADD = \
- libcore-utils.la \
- ${GLIB_LIBS} \
- ${GUILE_LIBS}
-
noinst_HEADERS = \
gnc-main.h \
gnc-gconf-utils.h \
@@ -32,42 +24,23 @@
gnc-gobject-utils.h \
gnc-gtk-utils.h
-EXTRA_DIST = ${gwmod_DATA}
+swig-core-utils.c: core-utils.i
+ swig -guile $(SWIG_ARGS) -Linkage module -o $@ $<
AM_CFLAGS = \
- ${G_WRAP_COMPILE_ARGS} \
${GUILE_INCS} \
${GLIB_CFLAGS} \
${GCONF_CFLAGS} \
${GTK_CFLAGS}
-gwmoddir = ${GNC_GWRAP_LIBDIR}
-gwmod_DATA = gw-core-utils-spec.scm
-nodist_gwmod_DATA = gw-core-utils.scm
-
-if GNUCASH_SEPARATE_BUILDDIR
-#Only needed when srcdir and builddir are different
-SCM_FILE_LINKS = gw-core-utils-spec.scm
-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 . ; \
- done
-endif
touch .scm-links
-gw-core-utils.scm gw-core-utils.h gw-core-utils.c gw-core-utils.html: \
- gw-core-utils-spec.scm .scm-links ${top_builddir}/config.status
- FLAVOR=gnome $(GUILE) -c \
- "(set! %load-path (cons \"${G_WRAP_MODULE_DIR}\" %load-path)) \
- (primitive-load \"./gw-core-utils-spec.scm\") \
- (gw:generate-wrapset \"gw-core-utils\")"
+gncmoddir = ${GNC_SHAREDIR}/guile-modules/gnucash
+gncmod_DATA = core-utils.scm
-BUILT_SOURCES = gw-core-utils.scm gw-core-utils.h gw-core-utils.c
-CLEANFILES = $(BUILT_SOURCES) g-wrapped gnucash .scm-links \
- ${SCM_FILE_LINKS} gw-core-utils.html
+EXTRA_DIST = $(gncmod_DATA)
+BUILT_SOURCES = swig-core-utils.c
+CLEANFILES = $(BUILT_SOURCES) gnucash .scm-links
Added: gnucash/branches/swig-redo/src/core-utils/core-utils.i
===================================================================
--- gnucash/branches/swig-redo/src/core-utils/core-utils.i 2006-10-10 00:13:32 UTC (rev 14984)
+++ gnucash/branches/swig-redo/src/core-utils/core-utils.i 2006-10-10 00:14:12 UTC (rev 14985)
@@ -0,0 +1,25 @@
+%module sw_core_utils
+%{
+//#include <gnc-gconf-utils.h>
+#include <gnc-glib-utils.h>
+#include <gnc-main.h>
+#include <glib.h>
+%}
+
+typedef char gchar;
+%typemap(newfree) gchar * "g_free($1);"
+%typemap(in) gboolean " $1 = SCM_NFALSEP($input) ? TRUE : FALSE; "
+%typemap(out) gboolean " $result = $1 ? SCM_BOOL_T : SCM_BOOL_F; "
+
+
+
+%newobject g_find_program_in_path;
+gchar * g_find_program_in_path(const gchar *);
+
+gboolean gnc_is_debugging(void);
+
+/* Special treatment because the string changes in place. */
+%typemap(in) gchar * " $1 = SCM_STRING_CHARS($input); "
+%typemap(freearg) gchar * ""
+void gnc_utf8_strip_invalid (gchar *str);
+
Added: gnucash/branches/swig-redo/src/core-utils/core-utils.scm
===================================================================
--- gnucash/branches/swig-redo/src/core-utils/core-utils.scm 2006-10-10 00:13:32 UTC (rev 14984)
+++ gnucash/branches/swig-redo/src/core-utils/core-utils.scm 2006-10-10 00:14:12 UTC (rev 14985)
@@ -0,0 +1,14 @@
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+;;; core-utils.scm
+;;; Guile module for core-utils
+;;;
+;;; Copyright 2006 Chris Shoemaker <c.shoemaker at cox.net>
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+
+(define-module (gnucash core-utils))
+(load-extension "libcore-utils" "scm_init_sw_core_utils_module")
+(use-modules (sw_core_utils))
+
+(export gnc-is-debugging)
+(export g-find-program-in-path)
+(export gnc-utf8-strip-invalid)
Modified: gnucash/branches/swig-redo/src/core-utils/gnc-main.c
===================================================================
--- gnucash/branches/swig-redo/src/core-utils/gnc-main.c 2006-10-10 00:13:32 UTC (rev 14984)
+++ gnucash/branches/swig-redo/src/core-utils/gnc-main.c 2006-10-10 00:14:12 UTC (rev 14985)
@@ -24,11 +24,11 @@
#include "config.h"
#include "gnc-main.h"
-static char *namespace_regexp = NULL;
-static int is_debugging;
+static gchar *namespace_regexp = NULL;
+static gboolean is_debugging;
void
-gnc_main_set_namespace_regexp(const char *str)
+gnc_main_set_namespace_regexp(const gchar *str)
{
if (namespace_regexp)
g_free(namespace_regexp);
@@ -37,20 +37,20 @@
namespace_regexp = g_strdup(str);
}
-const char *
+const gchar *
gnc_main_get_namespace_regexp(void)
{
return namespace_regexp;
}
-int
+gboolean
gnc_is_debugging(void)
{
return is_debugging;
}
void
-gnc_set_debugging(int d)
+gnc_set_debugging(gboolean d)
{
is_debugging = d;
}
Modified: gnucash/branches/swig-redo/src/core-utils/gnc-main.h
===================================================================
--- gnucash/branches/swig-redo/src/core-utils/gnc-main.h 2006-10-10 00:13:32 UTC (rev 14984)
+++ gnucash/branches/swig-redo/src/core-utils/gnc-main.h 2006-10-10 00:14:12 UTC (rev 14985)
@@ -26,10 +26,10 @@
#include <glib.h>
-void gnc_main_set_namespace_regexp(const char *str);
-const char *gnc_main_get_namespace_regexp(void);
+void gnc_main_set_namespace_regexp(const gchar *str);
+const gchar *gnc_main_get_namespace_regexp(void);
-int gnc_is_debugging(void);
-void gnc_set_debugging(int d);
+gboolean gnc_is_debugging(void);
+void gnc_set_debugging(gboolean d);
#endif /* GNC_MAIN_H */
Modified: gnucash/branches/swig-redo/src/import-export/qif-import/qif-file.scm
===================================================================
--- gnucash/branches/swig-redo/src/import-export/qif-import/qif-file.scm 2006-10-10 00:13:32 UTC (rev 14984)
+++ gnucash/branches/swig-redo/src/import-export/qif-import/qif-file.scm 2006-10-10 00:14:12 UTC (rev 14985)
@@ -11,7 +11,7 @@
;; just store the fields "raw".
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
-(use-modules (g-wrapped gw-core-utils))
+(use-modules (gnucash core-utils))
(cond
((or (string=? "1.3.4" (version))
@@ -74,7 +74,7 @@
;; pick the 1-char tag off from the remainder of the line
(set! tag (string-ref line 0))
(set! value (substring line 1))
- (gnc:utf8-strip-invalid value)
+ (gnc-utf8-strip-invalid value) ;; changes value in-place
;; now do something with the line
(if
Modified: gnucash/branches/swig-redo/src/report/report-gnome/report-gnome.scm
===================================================================
--- gnucash/branches/swig-redo/src/report/report-gnome/report-gnome.scm 2006-10-10 00:13:32 UTC (rev 14984)
+++ gnucash/branches/swig-redo/src/report/report-gnome/report-gnome.scm 2006-10-10 00:14:12 UTC (rev 14985)
@@ -13,7 +13,6 @@
(use-modules (ice-9 slib))
(require 'printf)
-(use-modules (g-wrapped gw-core-utils))
(use-modules (sw_report_gnome))
(gnc:module-load "gnucash/gnome-utils" 0)
Modified: gnucash/branches/swig-redo/src/scm/main.scm
===================================================================
--- gnucash/branches/swig-redo/src/scm/main.scm 2006-10-10 00:13:32 UTC (rev 14984)
+++ gnucash/branches/swig-redo/src/scm/main.scm 2006-10-10 00:14:12 UTC (rev 14985)
@@ -23,8 +23,7 @@
(default-duplicate-binding-handler 'last))
(use-modules (ice-9 slib))
-(use-modules (g-wrap gw-wct))
-(use-modules (g-wrapped gw-core-utils))
+(use-modules (gnucash core-utils))
;; Load the srfis (eventually, we should see where these are needed
;; and only have the use-modules statements in those files).
@@ -79,6 +78,7 @@
;; executable code until the end of the file if you can help it.
;; These are needed for a guile 1.3.4 bug
(debug-enable 'debug)
+(debug-enable 'backtrace)
(read-enable 'positions)
(debug-set! maxdepth 100000)
@@ -86,9 +86,6 @@
;;(use-modules (ice-9 statprof))
-(define (gnc:setup-debugging)
- (if (gnc:debugging?)
- (debug-enable 'backtrace)))
;; various utilities
@@ -182,7 +179,7 @@
(newline))
(define (gnc:debug . items)
- (if (gnc:debugging?)
+ (if (gnc-is-debugging)
(begin
(display "gnucash: [D] ")
(for-each (lambda (i) (write i)) items)
@@ -228,7 +225,6 @@
;; Now the fun begins.
(gnc:debug "starting up (1).")
- (gnc:setup-debugging)
;; Now we can load a bunch of files.
(load-from-path "command-line.scm") ;; depends on app-utils (N_, etc.)...
Modified: gnucash/branches/swig-redo/src/scm/price-quotes.scm
===================================================================
--- gnucash/branches/swig-redo/src/scm/price-quotes.scm 2006-10-10 00:13:32 UTC (rev 14984)
+++ gnucash/branches/swig-redo/src/scm/price-quotes.scm 2006-10-10 00:14:12 UTC (rev 14985)
@@ -31,7 +31,7 @@
(use-modules (srfi srfi-1))
(use-modules (gnucash main)) ;; FIXME: delete after we finish modularizing.
(use-modules (gnucash gnc-module))
-(use-modules (g-wrapped gw-core-utils))
+(use-modules (gnucash core-utils))
(gnc:module-load "gnucash/app-utils" 0)
@@ -242,7 +242,7 @@
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(define gnc:*finance-quote-check*
- (g:find-program-in-path "gnc-fq-check"))
+ (g-find-program-in-path "gnc-fq-check"))
(define (gnc:fq-check-sources)
(let ((program #f))
@@ -290,7 +290,7 @@
;; src/engine/gnc-pricedb.h
(define gnc:*finance-quote-helper*
- (g:find-program-in-path "gnc-fq-helper"))
+ (g-find-program-in-path "gnc-fq-helper"))
(define (gnc:fq-get-quotes requests)
;; requests should be a list where each item is of the form
More information about the gnucash-changes
mailing list