Merge branch 'dropgml'

This commit is contained in:
Geert Janssens
2019-12-07 09:15:48 +01:00
308 changed files with 3971 additions and 5579 deletions

View File

@@ -868,7 +868,7 @@ configure_file(
add_custom_target(uninstall
COMMAND ${CMAKE_COMMAND} -P ${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake)
set(_MODULES gnc-core-utils gnc-module gnc-backend-xml-utils)
set(_MODULES gnc-core-utils gnc-engine gnc-app-utils gnc-module gnc-locale-tax gnc-backend-xml-utils gnucash-guile)
if (WITH_SQL)
list(APPEND _MODULES gnc-backend-sql)

View File

@@ -1,4 +1,10 @@
add_subdirectory(guile)
add_subdirectory(python)
set_local_dist(bindings_DIST_local CMakeLists.txt )
set(bindings_DIST ${bindings_DIST_local} ${python_bindings_DIST} PARENT_SCOPE)
set_local_dist(bindings_DIST_local
CMakeLists.txt
business-core.i
core-utils.i
engine.i
engine-common.i)
set(bindings_DIST ${bindings_DIST_local} ${guile_DIST} ${python_bindings_DIST} PARENT_SCOPE)

View File

@@ -126,7 +126,7 @@ GLIST_HELPER_INOUT(OwnerList, SWIGTYPE_p__gncOwner);
%include <gncTaxTable.h>
%include <gncVendor.h>
#if defined(SWIGGUILE)
%include <gncBusGuile.h>
%include <gnc-engine-guile.h>
#endif
/* Import query bindings for the below invoice query functions (but
* don't generate bindings for them). */

View File

@@ -33,14 +33,12 @@
#include "gnc-pricedb.h"
#include "gnc-lot.h"
#include "gnc-session.h"
#include "gnc-hooks-scm.h"
#include "engine-deprecated.h"
#include "engine-helpers.h"
#include "engine-helpers-guile.h"
#include "gnc-engine-guile.h"
#include "policy.h"
#include "SX-book.h"
#include "kvp-scm.h"
#include "glib-helpers.h"
#include "gnc-kvp-guile.h"
#include "glib-guile.h"
#include "gncAddress.h"
#include "gncBillTerm.h"
@@ -53,7 +51,6 @@
#include "gncOwner.h"
#include "gncTaxTable.h"
#include "gncVendor.h"
#include "gncBusGuile.h"
%}
#if defined(SWIGGUILE)
%{
@@ -82,7 +79,6 @@ engine-common.i */
%newobject gnc_account_get_full_name;
%include "engine-common.i"
%include "engine-deprecated.h"
#if defined(SWIGGUILE)
%ignore QofLogModule;
@@ -176,7 +172,7 @@ functions. */
}
%include <engine-helpers.h>
%include <engine-helpers-guile.h>
%include <gnc-engine-guile.h>
%typemap(in) Transaction *trans;
%typemap(in) Split *split;
%typemap(in) char * num;
@@ -288,6 +284,7 @@ void qof_book_set_string_option(QofBook* book, const char* opt_name, const char*
%init {
{
char tmp[100];
char * no_args[1] = { NULL };
#define SET_ENUM(e) snprintf(tmp, 100, "(set! %s (%s))", (e), (e)); \
scm_c_eval_string(tmp);
@@ -435,9 +432,35 @@ void qof_book_set_string_option(QofBook* book, const char* opt_name, const char*
#undef SET_ENUM
gnc_engine_init(0, no_args);
}
}
#endif
%include business-core.i
%typemap(in) GList * {
SCM path_scm = $input;
GList *path = NULL;
while (!scm_is_null (path_scm))
{
SCM key_scm = SCM_CAR (path_scm);
char *key;
gchar* gkey;
if (!scm_is_string (key_scm))
break;
key = scm_to_locale_string (key_scm);
gkey = g_strdup (key);
free (key);
path = g_list_prepend (path, gkey);
path_scm = SCM_CDR (path_scm);
}
$1 = g_list_reverse (path);
}
Process *gnc_spawn_process_async(GList *argl, const gboolean search_path);
%clear GList *;
gint gnc_process_get_fd(const Process *proc, const guint std_fd);
void gnc_detach_process(Process *proc, const gboolean kill_it);

View File

@@ -0,0 +1,151 @@
add_subdirectory(test)
# Command to generate the swig-core-utils-guile.c wrapper file
gnc_swig_extract_header_files (gnc-core-utils CORE_UTILS_HEADERS)
gnc_add_swig_guile_command (swig-core-utils-guile-c
SWIG_CORE_UTILS_GUILE_C swig-core-utils-guile.c
${CMAKE_SOURCE_DIR}/bindings/core-utils.i
${CMAKE_SOURCE_DIR}/libgnucash/core-utils
${CORE_UTILS_HEADERS}
)
# Command to generate the swig-engine.c wrapper file
gnc_swig_extract_header_files (gnc-engine ENGINE_HEADERS)
gnc_add_swig_guile_command (swig-engine-c
SWIG_ENGINE_C swig-engine.c
${CMAKE_SOURCE_DIR}/bindings/engine.i
"${CMAKE_CURRENT_SOURCE_DIR};${CMAKE_SOURCE_DIR}/libgnucash/engine"
${ENGINE_HEADERS}
${CMAKE_SOURCE_DIR}/bindings/business-core.i
${CMAKE_SOURCE_DIR}/bindings/engine-common.i
)
set(guile_HEADERS
glib-guile.h
gnc-engine-guile.h
gnc-guile-utils.h
gnc-kvp-guile.h)
set(guile_SOURCES
glib-guile.c
gnc-engine-guile.c
gnc-guile-bindings.c
gnc-guile-utils.c
gnc-kvp-guile.cpp)
add_library(gnucash-guile SHARED
${guile_SOURCES}
${guile_HEADERS}
${SWIG_CORE_UTILS_GUILE_C}
${SWIG_ENGINE_C})
add_dependencies(gnucash-guile
swig-runtime-h)
target_include_directories(gnucash-guile
PUBLIC
${CMAKE_CURRENT_SOURCE_DIR}
${GUILE_INCLUDE_DIRS}
${GLIB2_INCLUDE_DIRS}
PRIVATE
${CMAKE_SOURCE_DIR}/common
${CMAKE_BINARY_DIR}/common)
target_link_libraries(gnucash-guile
PUBLIC
${GUILE_LDFLAGS}
PRIVATE
gnc-core-utils
gnc-engine
${GLIB2_LDFLAGS})
install(TARGETS gnucash-guile
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
)
# Scheme
set (core_utils_SCHEME core-utils.scm)
set(GUILE_OUTPUT_DIR gnucash)
set(GUILE_DEPENDS gnc-core-utils gnucash-guile)
gnc_add_scheme_targets(scm-core-utils
"${core_utils_SCHEME}"
${GUILE_OUTPUT_DIR}
"${GUILE_DEPENDS}"
FALSE
)
set (engine_SCHEME_0
commodity-table.scm
gnc-numeric.scm
business-core.scm
)
set (engine_SCHEME_1
engine.scm
)
set (engine_SCHEME_2
utilities.scm
)
set(BACKEND_DEPENDS gncmod-backend-xml)
if (WITH_SQL)
list(APPEND BACKEND_DEPENDS gncmod-backend-dbi)
endif(WITH_SQL)
set(GUILE_DEPENDS
${BACKEND_DEPENDS}
gnc-engine
gnucash-guile)
gnc_add_scheme_targets(scm-engine-0
"${engine_SCHEME_0}"
"gnucash/engine"
"${GUILE_DEPENDS}"
TRUE
)
gnc_add_scheme_targets(scm-engine-1
"${engine_SCHEME_1}"
gnucash
"scm-engine-0;${GUILE_DEPENDS}"
FALSE
)
gnc_add_scheme_targets(scm-engine-2
"${engine_SCHEME_2}"
gnucash
"scm-engine-1;${GUILE_DEPENDS}"
FALSE
)
add_custom_target(scm-engine ALL DEPENDS scm-engine-2 scm-engine-1 scm-engine-0)
set(scm_gnc_module_DEPENDS
gnucash-guile)
gnc_add_scheme_targets(scm-gnc-module
gnc-module.scm
gnucash
"${scm_gnc_module_DEPENDS}"
FALSE
)
set_local_dist(guile_DIST_local
CMakeLists.txt
core-utils.scm
gnc-module.scm
${guile_SOURCES}
${guile_HEADERS}
${engine_SCHEME_0}
${engine_SCHEME_1}
${engine_SCHEME_2})
set(guile_DIST ${guile_DIST_local} ${test_guile_DIST} PARENT_SCOPE)

View File

@@ -17,10 +17,7 @@
;; Boston, MA 02110-1301, USA gnu@gnu.org
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(define-module (gnucash business-core))
(use-modules (gnucash gnc-module))
(use-modules (srfi srfi-1))
(gnc:module-load "gnucash/engine" 0)
(define (gnc:owner-get-address owner)
(let ((type (gncOwnerGetType owner)))
@@ -117,11 +114,3 @@
(cond (owner (gncOwnerCopy (gncOwnerGetEndOwner owner) result-owner)
result-owner)
(else '()))))
(export gnc:owner-get-address)
(export gnc:owner-get-name-dep)
(export gnc:owner-get-address-dep)
(export gnc:owner-get-name-and-address-dep)
(export gnc:owner-get-owner-id)
(export gnc:owner-from-split)

View File

@@ -1,9 +1,8 @@
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;; gnc-module.scm
;;; Guile module which allows initialization of the gnucash module
;;; system from Scheme
;;; core-utils.scm
;;; Guile module for core-utils
;;;
;;; Copyright 2001 Linux Developers Group
;;; Copyright 2006 Chris Shoemaker <c.shoemaker@cox.net>
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; This program is free software; you can redistribute it and/or
@@ -25,28 +24,22 @@
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(define-module (gnucash gnc-module))
(define-module (gnucash core-utils))
;; Guile 2 needs to find the symbols from the extension at compile time already
(eval-when
(compile load eval expand)
(load-extension "libgnc-module" "scm_init_sw_gnc_module_module"))
(load-extension "libgnucash-guile" "gnc_guile_bindings_init"))
(use-modules (sw_core_utils))
(use-modules (sw_gnc_module))
; Export the swig-wrapped symbols in the public interface of this module
(let ((i (module-public-interface (current-module))))
(module-use! i (resolve-interface '(sw_core_utils))))
(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)
(export gnc:module-system-init)
(export gnc:module-system-refresh)
(export gnc:module-load)
(export gnc:module-load-optional)
(export gnc:module-unload)
(export gnc:module-begin-syntax)
;; Guile 2 needs to load external modules at compile time
(define-syntax-rule (gnc:module-begin-syntax form ...)
(eval-when (load compile eval expand) (begin form ...)))
(define-public gnc:version (gnc-version))
;; gettext functions
(define-public _ gettext)
(define-syntax N_
(syntax-rules ()
((_ x) x)))
(export N_)

View File

@@ -19,11 +19,19 @@
(define-module (gnucash engine))
(use-modules (srfi srfi-1)
(srfi srfi-13))
(eval-when
(compile load eval expand)
(load-extension "libgncmod-engine" "scm_init_sw_engine_module"))
(load-extension "libgnucash-guile" "gnc_guile_bindings_init"))
(use-modules (sw_engine))
; Export the swig-wrapped symbols in the public interface of this module
(let ((i (module-public-interface (current-module))))
(module-use! i (resolve-interface '(sw_engine))))
;; gnc-numeric.scm
(export GNC-RND-FLOOR)
(export GNC-RND-CEIL)
(export GNC-RND-TRUNC)
@@ -50,6 +58,7 @@
(export gnc:gnc-monetary-amount)
(export gnc:monetary-neg)
;; commodity-table.scm
(export GNC_COMMODITY_NS_CURRENCY)
(export GNC_COMMODITY_NS_NASDAQ)
(export GNC_COMMODITY_NS_NYSE)
@@ -57,15 +66,41 @@
(export GNC_COMMODITY_NS_EUREX)
(export GNC_COMMODITY_NS_MUTUAL)
(export gnc:url->loaded-session)
;; engine-utilities.scm
(export gnc:account-map-descendants)
(export gnc:account-map-children)
(export account-full-name<?)
(export accounts-get-children-depth)
; business-core.scm
(export gnc:owner-get-address)
(export gnc:owner-get-name-dep)
(export gnc:owner-get-address-dep)
(export gnc:owner-get-name-and-address-dep)
(export gnc:owner-get-owner-id)
(export gnc:owner-from-split)
(load-from-path "gnucash/engine/gnc-numeric")
(load-from-path "gnucash/engine/commodity-table")
(load-from-path "gnucash/engine/engine-utilities")
(load-from-path "gnucash/engine/business-core")
;; A few account related utility functions which used to be in engine-utilities.scm
(define (gnc:account-map-descendants thunk account)
(let ((descendants (or (gnc-account-get-descendants-sorted account) '())))
(map thunk descendants)))
(define (gnc:account-map-children thunk account)
(let ((children (or (gnc-account-get-children-sorted account) '())))
(map thunk children)))
;; account related functions
;; helper for sorting of account list
(define (account-full-name<? a b)
(string<? (gnc-account-get-full-name a) (gnc-account-get-full-name b)))
;; return maximum depth over accounts and their children, if any
(define (accounts-get-children-depth accounts)
(apply max
(map (lambda (acct)
(let ((acct-depth (gnc-account-get-current-depth acct)))
(+ acct-depth (- (gnc-account-get-tree-depth acct) 1))))
accounts)))
(export gnc:account-map-descendants)
(export gnc:account-map-children)
(export account-full-name<?)
(export accounts-get-children-depth)

View File

@@ -1,5 +1,5 @@
/********************************************************************\
* gnc-helpers.c -- gnucash glib helper functions *
* glib-guile.c -- glib helper functions for guile *
* Copyright (C) 2000 Linas Vepstas *
* Copyright (C) 2006 Chris Shoemaker <c.shoemaker@cox.net> *
* *
@@ -24,14 +24,45 @@
#include <config.h>
#include <errno.h>
#include <string.h>
#include <glib.h>
#ifdef __MINGW32__
#define _GL_UNISTD_H //Deflect poisonous define of close in Guile's GnuLib
#endif
#include <libguile.h>
#ifdef HAVE_UNISTD_H
# ifdef close
# undef close
# endif
# include <unistd.h>
#else
# include <io.h>
# define close _close
#endif
#include <libguile.h>
#include "swig-runtime.h"
#include "guile-mappings.h"
#include "gnc-glib-utils.h"
#include "gnc-guile-utils.h"
#include "glib-helpers.h"
#include "glib-guile.h"
#include <platform.h>
#if PLATFORM(WINDOWS)
#include <winsock.h>
#include <windows.h>
#endif
#include "qof.h"
#include "gnc-engine-guile.h"
#define UNUSED_VAR __attribute__ ((unused))
/* This static indicates the debugging module this .o belongs to. */
static QofLogModule UNUSED_VAR log_module = GNC_MOD_GUILE;
static SCM
glist_to_scm_list_helper(GList *glist, swig_type_info *wct)
@@ -173,3 +204,139 @@ gnc_glist_string_p(SCM list)
{
return scm_is_list(list);
}
struct _Process
{
GPid pid;
gint fd_stdin;
gint fd_stdout;
gint fd_stderr;
gboolean dead;
gboolean detached;
};
static void
on_child_exit (GPid pid, gint status, gpointer data)
{
Process *proc = data;
g_return_if_fail (proc && proc->pid == pid);
g_spawn_close_pid (proc->pid);
/* free if the process is both dead and detached */
if (!proc->detached)
proc->dead = TRUE;
else
g_free (proc);
}
Process *
gnc_spawn_process_async (GList *argl, const gboolean search_path)
{
gboolean retval;
Process *proc;
GList *l_iter;
guint argc;
gchar **argv, **v_iter;
GSpawnFlags flags;
GError *error = NULL;
proc = g_new0 (Process, 1);
argc = g_list_length (argl);
argv = g_malloc ((argc + 1) * sizeof(gchar*));
for (l_iter = argl, v_iter = argv; l_iter; l_iter = l_iter->next, v_iter++)
{
*v_iter = (gchar*) l_iter->data;
}
*v_iter = NULL;
g_list_free (argl);
flags = G_SPAWN_DO_NOT_REAP_CHILD;
if (search_path)
flags |= G_SPAWN_SEARCH_PATH;
retval = g_spawn_async_with_pipes (
NULL, argv, NULL, flags, NULL, NULL, &proc->pid,
&proc->fd_stdin, &proc->fd_stdout, &proc->fd_stderr, &error);
if (retval)
{
g_child_watch_add (proc->pid, on_child_exit, proc);
}
else
{
g_warning ("Could not spawn %s: %s", *argv ? *argv : "(null)",
error->message ? error->message : "(null)");
g_free (proc);
proc = NULL;
}
g_strfreev (argv);
return proc;
}
gint
gnc_process_get_fd (const Process *proc, const gint std_fd)
{
const gint *retptr = NULL;
g_return_val_if_fail (proc, -1);
if (std_fd == 0)
retptr = &proc->fd_stdin;
else if (std_fd == 1)
retptr = &proc->fd_stdout;
else if (std_fd == 2)
retptr = &proc->fd_stderr;
else
g_return_val_if_reached (-1);
if (*retptr == -1)
g_warning ("Pipe to child's file descriptor %d is -1", std_fd);
return *retptr;
}
void
gnc_detach_process (Process *proc, const gboolean kill_it)
{
g_return_if_fail (proc && proc->pid);
errno = 0;
close (proc->fd_stdin);
if (errno)
{
g_message ("Close of child's stdin (%d) failed: %s", proc->fd_stdin,
g_strerror (errno));
errno = 0;
}
close (proc->fd_stdout);
if (errno)
{
g_message ("Close of child's stdout (%d) failed: %s", proc->fd_stdout,
g_strerror(errno));
errno = 0;
}
close (proc->fd_stderr);
if (errno)
{
g_message ("Close of child's stderr (%d) failed: %s", proc->fd_stderr,
g_strerror(errno));
errno = 0;
}
if (kill_it && !proc->dead)
{
/* give it a chance to die */
while (g_main_context_iteration (NULL, FALSE) && !proc->dead)
;
if (!proc->dead)
gnc_gpid_kill (proc->pid);
}
/* free if the process is both dead and detached */
if (!proc->dead)
proc->detached = TRUE;
else
g_free (proc);
}

View File

@@ -1,7 +1,7 @@
/********************************************************************\
* guile-util.h -- utility functions for using guile for GnuCash *
* Copyright (C) 1999 Linas Vepstas *
* Copyright (C) 2017 Aaron Laws *
* glib-guile.h -- glib helper functions for guile *
* Copyright (C) 2000 Linas Vepstas *
* Copyright (C) 2006 Chris Shoemaker <c.shoemaker@cox.net> *
* *
* This program is free software; you can redistribute it and/or *
* modify it under the terms of the GNU General Public License as *
@@ -22,22 +22,20 @@
* *
\********************************************************************/
#ifndef GUILE_UTIL_H
#define GUILE_UTIL_H
#ifndef GLIB_GUILE_H
#define GLIB_GUILE_H
#include <glib.h>
#include <libguile.h>
#include "qof.h"
#include "Account.h"
#include "gnc-guile-utils.h"
SCM gnc_glist_to_scm_list(GList *glist, gchar *wct);
GList* gnc_scm_list_to_glist(SCM wcp_list);
SCM gnc_glist_string_to_scm(GList * list);
GList * gnc_scm_to_glist_string(SCM list);
int gnc_glist_string_p(SCM list);
/* Two functions that return string synonyms for the terms 'debit' and
* 'credit' as appropriate for the given account type and user preferences.
* They should be g_freed when no longer needed. */
char * gnc_get_debit_string(GNCAccountType account_type);
char * gnc_get_credit_string(GNCAccountType account_type);
GSList * gnc_scm_to_gslist_string(SCM list);
/** An opaque process structure returned by gnc_spawn_process_async. */
typedef struct _Process Process;
@@ -75,14 +73,4 @@ gint gnc_process_get_fd(const Process *proc, const gint std_fd);
* @param kill_it If TRUE, kill the process. */
void gnc_detach_process(Process *proc, const gboolean kill_it);
/** Convert a time string to calendar time representation. Combine strptime and
* mktime into a single function to avoid the need to wrap struct tm *.
*
* @param s String representation of time.
*
* @param format Format specification.
*
* @return The time in seconds since unix epoch, or -1 on error */
time64 gnc_parse_time_to_time64 (const gchar *s, const gchar *format);
#endif

File diff suppressed because it is too large Load Diff

View File

@@ -1,5 +1,5 @@
/********************************************************************\
* engine-helpers.h -- gnucash engine helper functions *
* gnc-engine-guile.h -- engine helper functions for guile *
* Copyright (C) 2000 Linas Vepstas <linas@linas.org> *
* Copyright (C) 2001 Linux Developers Group, Inc. *
* *
@@ -22,13 +22,15 @@
* *
\********************************************************************/
#ifndef ENGINE_HELPERS_GUILE_H
#define ENGINE_HELPERS_GUILE_H
#ifndef GNC_ENGINE_GUILE_H
#define GNC_ENGINE_GUILE_H
#include <glib.h>
#include <libguile.h>
#include "gnc-engine.h"
#include <gncTaxTable.h> /* for GncAccountValue */
#include "gnc-hooks.h"
/* Helpers for various conversions to and from guile */
@@ -53,4 +55,22 @@ gnc_commodity * gnc_scm_to_commodity(SCM scm);
SCM gnc_commodity_to_scm (const gnc_commodity *commodity);
SCM gnc_book_to_scm (const QofBook *book);
/* Conversion routines used with tax tables */
GncAccountValue * gnc_scm_to_account_value_ptr (SCM valuearg);
SCM gnc_account_value_ptr_to_scm (GncAccountValue *);
/**
* add Scheme-style danglers from a hook
*/
void gnc_hook_add_scm_dangler(const gchar *name, SCM proc);
/** Convert a time string to calendar time representation. Combine strptime and
* mktime into a single function to avoid the need to wrap struct tm *.
*
* @param s String representation of time.
*
* @param format Format specification.
*
* @return The time in seconds since unix epoch, or -1 on error */
time64 gnc_parse_time_to_time64 (const gchar *s, const gchar *format);
#endif

View File

@@ -1,3 +1,9 @@
/*********************************************************************
* gnc-guile-bindings.c
* library to enable guile bindings for libgnucash
*
* Copyright (c) 2019 GnuCash Development Team
*********************************************************************/
/********************************************************************\
* This program is free software; you can redistribute it and/or *
* modify it under the terms of the GNU General Public License as *
@@ -18,24 +24,26 @@
* *
\********************************************************************/
#include <stdlib.h>
#include <config.h>
#include <libguile.h>
#include <gnc-module.h>
static void
guile_main(void *closure, int argc, char ** argv)
void gnc_guile_bindings_init(void);
static int is_initialized = 0;
extern SCM scm_init_sw_core_utils_module (void);
extern SCM scm_init_sw_engine_module (void);
void
gnc_guile_bindings_init(void)
{
GNCModule mod;
gnc_module_system_init();
mod = gnc_module_load("gnucash/app-utils", 0);
exit(mod == NULL);
}
int
main(int argc, char ** argv)
if (!is_initialized)
{
g_setenv ("GNC_UNINSTALLED", "1", TRUE);
scm_boot_guile(argc, argv, guile_main, NULL);
return 0;
/* Do what's necessary to initialize the bindings */
scm_init_sw_core_utils_module();
scm_init_sw_engine_module();
is_initialized = 1;
}
}

View File

@@ -9,9 +9,9 @@ extern "C"
#include <qof.h>
#include "swig-runtime.h"
#include "guile-mappings.h"
#include "engine-helpers-guile.h"
#include "gnc-engine-guile.h"
#include "gnc-guile-utils.h"
#include "kvp-scm.h"
#include "gnc-kvp-guile.h"
}
/* NOTE: There are some problems with this approach. Currently,

View File

@@ -0,0 +1,76 @@
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;; gnc-module.scm
;;; Guile module which allows initialization of the gnucash module
;;; system from Scheme
;;;
;;; Copyright 2001 Linux Developers Group
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; This program is free software; you can redistribute it and/or
;; modify it under the terms of the GNU General Public License as
;; published by the Free Software Foundation; either version 2 of
;; the License, or (at your option) any later version.
;;
;; This program is distributed in the hope that it will be useful,
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
;; GNU General Public License for more details.
;;
;; You should have received a copy of the GNU General Public License
;; along with this program; if not, contact:
;;
;; Free Software Foundation Voice: +1-617-542-5942
;; 51 Franklin Street, Fifth Floor Fax: +1-617-542-2652
;; Boston, MA 02110-1301, USA gnu@gnu.org
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(define-module (gnucash gnc-module))
(define (no-op-deprecation-warning)
(issue-deprecation-warning "* WARNING * Guile wrappers for the gnc module system have been deprecated.")
(issue-deprecation-warning "This particular function call is now a no-op. Please use equivalent (use-modules ...) calls instead."))
(define-public (gnc:module-system-init)
(no-op-deprecation-warning))
(define-public (gnc:module-system-refresh)
(no-op-deprecation-warning))
(define-public (gnc:module-load-optional)
(no-op-deprecation-warning))
(define-public (gnc:module-unload)
(no-op-deprecation-warning))
(define-public (gnc:module-load gnc-mod-name mod-sys-version)
(let* ((mod-name-split (string-split gnc-mod-name #\/))
(mod-name-str (string-join mod-name-split " "))
(scm-mod-name (map string->symbol mod-name-split)))
(cond
((string=? gnc-mod-name "gnucash/app-utils")
(issue-deprecation-warning "* WARNING * 'gnc:module-load (\"gnucash/app-utils\" 0)' has been deprecated and will be removed in gnucash 5.0.")
(issue-deprecation-warning "Use '(use-modules (gnucash engine)(gnucash app-utils))' instead.")
(issue-deprecation-warning "Use of the '(gnucash engine)' guile module is optional and depends on whether or not you use functions from this module in your code or not.")
(use-modules (gnucash engine)(gnucash app-utils)))
((or
(string=? gnc-mod-name "gnucash/tax/de_DE")
(string=? gnc-mod-name "gnucash/tax/us"))
(set! scm-mod-name (list 'gnucash 'locale (list-ref scm-mod-name 2) 'tax))
(set! mod-name-str (string-join (map symbol->string scm-mod-name) " "))
(issue-deprecation-warning (string-concatenate (list "* WARNING * '(gnc:module-load \"" gnc-mod-name "\" 0)' has been deprecated.")))
(issue-deprecation-warning (string-concatenate (list "Use '(use-modules (" mod-name-str "))' instead.")))
(module-use! (current-module) (resolve-interface scm-mod-name)))
((or
(string=? gnc-mod-name "gnucash/gnome-utils")
(string=? gnc-mod-name "gnucash/html")
(string=? gnc-mod-name "gnucash/report/report-system"))
(when (string=? gnc-mod-name"gnucash/report/report-system")
(set! mod-name-str "gnucash report"))
(set! scm-mod-name (list 'gnucash 'report))
(issue-deprecation-warning (string-concatenate (list "* WARNING * '(gnc:module-load \"" gnc-mod-name "\" 0)' has been deprecated.")))
(issue-deprecation-warning (string-concatenate (list "Use '(use-modules (gnucash engine)(gnucash app-utils)(" mod-name-str "))' instead.")))
(issue-deprecation-warning "Use of the '(gnucash engine)' or '(gnucash app-utils)' guile modules is optional and depends on whether or not you use functions from this module in your code or not.")
(use-modules (gnucash engine)(gnucash app-utils))
(module-use! (current-module) (resolve-interface scm-mod-name)))
(else
(issue-deprecation-warning (string-concatenate (list "* WARNING * '(gnc:module-load \"" gnc-mod-name "\" 0)' has been deprecated.")))
(issue-deprecation-warning (string-concatenate ( list "Use '(use-modules (" mod-name-str "))' instead.")))
(issue-deprecation-warning "Additional guile modules may have to be loaded depending on your specific code.")
(module-use! (current-module) (resolve-interface scm-mod-name))))))

View File

@@ -0,0 +1,135 @@
# C(++) tests requiring a proper guile environment set up
set(ENGINE_TEST_INCLUDE_DIRS
${CMAKE_SOURCE_DIR}/libgnucash/backend/xml
${CMAKE_SOURCE_DIR}/libgnucash/engine
${CMAKE_SOURCE_DIR}/libgnucash/engine/test-core
${CMAKE_BINARY_DIR}/common # for config.h
${CMAKE_SOURCE_DIR}/common/test-core # for unittest-support.h
${CMAKE_SOURCE_DIR}/bindings/guile # for gnc-engine-guile.h
${GLIB2_INCLUDE_DIRS}
)
set(ENGINE_TEST_LIBS
gnc-engine
gncmod-test-engine
test-core
gnucash-guile
${LIBXML2_LDFLAGS}
-lm)
gnc_add_test_with_guile(test-scm-query test-scm-query.cpp ENGINE_TEST_INCLUDE_DIRS ENGINE_TEST_LIBS)
# Scheme tests
set(bindings_test_SCHEME
test-core-utils.scm
test-create-account.scm
)
#list(APPEND engine_test_SCHEME test-scm-query-import.scm) Fails
set(GUILE_DEPENDS
scm-gnc-module
scm-app-utils
scm-core-utils
scm-engine)
gnc_add_scheme_test_targets(scm-test-engine-extras
"test-engine-extras.scm"
"tests"
"${GUILE_DEPENDS}"
FALSE
)
# Module interfaces deprecated in 4.x, will be removed for 5.x
gnc_add_scheme_deprecated_module ("gnucash engine test test-extras" "tests test-engine-extras" "scm-test-engine-extras" "")
gnc_add_scheme_test_targets(scm-test-engine
"${bindings_test_SCHEME}"
"tests"
"${GUILE_DEPENDS};scm-test-engine-extras"
FALSE
)
add_dependencies(check scm-test-engine)
gnc_add_scheme_tests("${engine_test_SCHEME}")
if (HAVE_SRFI64)
gnc_add_scheme_test_targets (scm-srfi64-extras
"srfi64-extras.scm"
"tests"
"${GUILE_DEPENDS};scm-test-engine-extras;scm-srfi64-extras"
FALSE
)
# Module interfaces deprecated in 4.x, will be removed for 5.x
gnc_add_scheme_deprecated_module ("gnucash engine test srfi64-extras" "tests srfi64-extras" "scm-srfi64-extras" "")
set (scm_tests_with_srfi64_SOURCES
test-business-core.scm
)
gnc_add_scheme_test_targets (scm-test-with-srfi64
"${scm_tests_with_srfi64_SOURCES}"
"tests"
"${GUILE_DEPENDS};scm-test-engine-extras;scm-srfi64-extras;gnc-engine"
FALSE
)
gnc_add_scheme_tests("${scm_tests_with_srfi64_SOURCES}")
add_dependencies(check scm-srfi64-extras)
endif (HAVE_SRFI64)
set(test_scm_SCHEME
test-scm-utilities.scm
test-module-deprecation.scm
)
set(GUILE_DEPENDS
scm-gnc-module
scm-app-utils
scm-engine
scm-srfi64-extras
scm-deprecated-gnucash-deprecated-module
scm-deprecated-gnucash-superseded-module
)
if (HAVE_SRFI64)
gnc_add_scheme_test_targets(scm-test-scm
"${test_scm_SCHEME}"
"tests"
"${GUILE_DEPENDS}"
FALSE
)
gnc_add_scheme_tests("${test_scm_SCHEME}")
endif (HAVE_SRFI64)
set(test_engine_SCHEME_DIST
srfi64-extras.scm
${bindings_test_SCHEME}
test-engine-extras.scm
test-scm-query-import.scm
test-business-core.scm
)
set_local_dist(test_guile_DIST_local
CMakeLists.txt
test-scm-query.cpp
${test_engine_SCHEME_DIST}
${test_scm_SCHEME}
)
set(test_guile_DIST
${test_guile_DIST_local}
PARENT_SCOPE
)
# Define two imaginary deprecated guile modules to test the compat file generation code
gnc_add_scheme_deprecated_module ("gnucash deprecated-module" "" "" "")
gnc_add_scheme_deprecated_module ("gnucash superseded-module" "gnucash utilities" "scm-engine" "")

View File

@@ -1,12 +1,10 @@
(use-modules (srfi srfi-1))
(use-modules (srfi srfi-64))
(use-modules (gnucash gnc-module))
(gnc:module-load "gnucash/engine" 0)
(gnc:module-load "gnucash/app-utils" 0)
(use-modules (gnucash app-utils))
(use-modules (tests srfi64-extras))
(use-modules (tests test-engine-extras))
(use-modules (gnucash utilities))
(use-modules (gnucash business-core))
(use-modules (gnucash engine))
(define (run-test)
(test-runner-factory gnc:test-runner)

View File

@@ -0,0 +1,17 @@
(define exit-code 0)
(setenv "GNC_UNINSTALLED" "1")
(use-modules (gnucash core-utils))
(if (macro? (module-ref (current-module) 'N_))
(display "Macro N_ defined\n")
(begin
(display "Failed - macro N_ not defined\n")
(set! exit-code -1)))
(if (string=? (N_ "foobar") "foobar")
(display "Macro N_ works properly\n")
(begin
(display "Failed - macro N_ doesn't work\n")
(set! exit-code -1)))
(exit exit-code)

View File

@@ -20,12 +20,10 @@
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(use-modules (gnucash gnc-module))
(use-modules (gnucash engine))
(define (run-test)
(setenv "GNC_UNINSTALLED" "1")
(gnc:module-system-init)
(gnc:module-load "gnucash/engine" 0)
(let* ((session (qof-session-new))
(book (qof-session-get-book session))

View File

@@ -20,12 +20,10 @@
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(use-modules (gnucash gnc-module))
(use-modules (gnucash engine))
(define (run-test)
(setenv "GNC_UNINSTALLED" "1")
(gnc:module-system-init)
(gnc:module-load "gnucash/engine" 0)
(display "\tTesting the Query Import interface... \n")
(display "\tYou may see \"Error: xaccQueryAddGUIDMatch: Invalid match type\".\n")

View File

@@ -25,7 +25,7 @@ extern "C"
#include <config.h>
#include <glib.h>
#include "engine-helpers-guile.h"
#include "gnc-engine-guile.h"
#include "gnc-module.h"
#include "test-engine-stuff.h"
#include "test-stuff.h"
@@ -84,8 +84,7 @@ run_tests (void)
static void
main_helper (void *closure, int argc, char **argv)
{
gnc_module_system_init ();
gnc_module_load("gnucash/engine", 0);
gnc_engine_init (0, NULL);
xaccLogDisable ();

View File

@@ -1,18 +1,18 @@
(use-modules (gnucash gnc-module))
(gnc:module-begin-syntax (gnc:module-load "gnucash/app-utils" 0))
(use-modules (gnucash app-utils))
(use-modules (gnucash engine))
(use-modules (gnucash utilities))
(use-modules (srfi srfi-64))
(use-modules (tests srfi64-extras))
(define (run-test)
(test-runner-factory gnc:test-runner)
(test-begin "test-libgnucash-scm-utilities.scm")
(test-begin "test-scm-utilities.scm")
(test-traverse-vec)
(test-substring-replace)
(test-sort-and-delete-duplicates)
(test-gnc:html-string-sanitize)
(test-gnc:list-flatten)
(test-begin "test-libgnucash-scm-utilities.scm"))
(test-begin "test-scm-utilities.scm"))
(define (test-traverse-vec)
(test-begin "traverse-vec")

View File

@@ -25,10 +25,7 @@
'(#:warnings (arity-mismatch format duplicate-case-datum bad-case-datum)))
(use-modules (gnucash core-utils))
(eval-when (compile load eval expand)
(load-extension "libgncmod-engine" "scm_init_sw_engine_module"))
(use-modules (sw_engine))
(use-modules (gnucash engine))
;; Load the srfis (eventually, we should see where these are needed
;; and only have the use-modules statements in those files).

View File

@@ -39,14 +39,27 @@ set(GNUCASH_CORE_C_INCLUDES
gnc_add_swig_python_command (swig-gnucash-core
SWIG_GNUCASH_CORE_C SWIG_GNUCASH_CORE_PY
gnucash_core.c gnucash_core_c.py
${SWIG_FILES}
${CMAKE_CURRENT_SOURCE_DIR}/gnucash_core.i
${CMAKE_SOURCE_DIR}/bindings
${CMAKE_CURRENT_SOURCE_DIR}/time64.i
${CMAKE_SOURCE_DIR}/common/base-typemaps.i
${CMAKE_SOURCE_DIR}/libgnucash/engine/engine-common.i
${CMAKE_SOURCE_DIR}/bindings/engine-common.i
${GNUCASH_CORE_C_INCLUDES}
)
# Command to generate the swig-core-utils-python.c wrapper file
gnc_swig_extract_header_files (gnc-core-utils CORE_UTILS_HEADERS)
gnc_add_swig_python_command (swig-core-utils-python
SWIG_CORE_UTILS_PYTHON_C SWIG_CORE_UTILS_PYTHON_PY
swig-core-utils-python.c sw_core_utils.py
${CMAKE_SOURCE_DIR}/bindings/core-utils.i ${CMAKE_SOURCE_DIR}/libgnucash/core-utils
${CORE_UTILS_HEADERS}
)
if(WITH_PYTHON)
### gnucash_core_c
set(gnucash_core_c_INCLUDE_DIRS
${CMAKE_SOURCE_DIR}/libgnucash
${CMAKE_SOURCE_DIR}/libgnucash/engine
@@ -63,7 +76,7 @@ if(WITH_PYTHON)
add_library(gnucash_core_c MODULE ${SWIG_GNUCASH_CORE_C})
target_include_directories(gnucash_core_c PRIVATE ${gnucash_core_c_INCLUDE_DIRS})
target_link_libraries(gnucash_core_c gncmod-app-utils gncmod-engine gnc-module ${GLIB_LIBS} ${PYTHON_LIBRARIES})
target_link_libraries(gnucash_core_c gnc-app-utils gnc-engine gnc-module ${GLIB_LIBS} ${PYTHON_LIBRARIES})
set_target_properties(gnucash_core_c PROPERTIES PREFIX "_")
target_compile_options(gnucash_core_c PRIVATE -Wno-implicit -Wno-missing-prototypes -Wno-declaration-after-statement -Wno-missing-declarations)
if (HAVE_STRINGOP_TRUNCATION)
@@ -71,7 +84,7 @@ if(WITH_PYTHON)
endif()
add_executable(sqlite3test EXCLUDE_FROM_ALL sqlite3test.c ${SWIG_GNUCASH_CORE_C})
target_link_libraries(sqlite3test gncmod-app-utils gncmod-engine gnc-module ${GLIB_LIBS} ${PYTHON_LIBRARIES})
target_link_libraries(sqlite3test gnc-app-utils gnc-engine gnc-module ${GLIB_LIBS} ${PYTHON_LIBRARIES})
target_include_directories(sqlite3test PRIVATE ${gnucash_core_c_INCLUDE_DIRS})
target_compile_options(sqlite3test PRIVATE -Wno-implicit -Wno-missing-prototypes -Wno-declaration-after-statement -Wno-missing-declarations)
if (HAVE_STRINGOP_TRUNCATION)
@@ -99,6 +112,41 @@ if(WITH_PYTHON)
COMMAND ${CMAKE_COMMAND} -E copy ${LIBDIR_BUILD}/gnucash/_gnucash_core_c${CMAKE_SHARED_MODULE_SUFFIX} ${PYTHON_SYSCONFIG_BUILD}/gnucash
DEPENDS gnucash_core_c)
### sw_core_utils
add_library (sw_core_utils MODULE ${SWIG_CORE_UTILS_PYTHON_C})
target_link_libraries(sw_core_utils gnc-core-utils ${PYTHON_LIBRARIES})
set_target_properties(sw_core_utils PROPERTIES PREFIX "_")
if (HAVE_STRINGOP_TRUNCATION)
target_compile_options(sw_core_utils PRIVATE -Wno-error=stringop-truncation)
endif()
target_include_directories (sw_core_utils
PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}
PRIVATE ${PYTHON_INCLUDE_DIRS}
)
target_compile_definitions (sw_core_utils PRIVATE -DG_LOG_DOMAIN=\"gnc.core-utils\")
if (APPLE)
set_target_properties (sw_core_utils PROPERTIES INSTALL_NAME_DIR "${CMAKE_INSTALL_FULL_LIBDIR}/gnucash")
endif()
install(TARGETS sw_core_utils
LIBRARY DESTINATION ${PYTHON_SYSCONFIG_OUTPUT}/gnucash
ARCHIVE DESTINATION ${PYTHON_SYSCONFIG_OUTPUT}/gnucash
)
add_custom_target(sw-core-utils-py ALL
COMMAND ${CMAKE_COMMAND} -E copy ${SWIG_CORE_UTILS_PYTHON_PY} ${PYTHON_SYSCONFIG_BUILD}/gnucash
DEPENDS ${SWIG_CORE_UTILS_PYTHON_C})
add_custom_target(sw-core-utils-build ALL
COMMAND ${CMAKE_COMMAND} -E copy ${LIBDIR_BUILD}/gnucash/_sw_core_utils${CMAKE_SHARED_MODULE_SUFFIX} ${PYTHON_SYSCONFIG_BUILD}/gnucash
DEPENDS sw_core_utils)
endif()
set(python_bindings_DATA ${PYEXEC_FILES}

View File

@@ -10,18 +10,35 @@
# - _out_var will be set to the full path to the generated wrapper file
# - _output is the name of the wrapper file to generate
# - _input is the swig interface file (*.i) to generate this wrapper from
# - _include_dirs is an optional list of include directories to pass to the swig command
# For guile two directories are always passed by default:
# ${CMAKE_SOURCE_DIR}/common and ${CMAKE_SOURCE_DIR}/libgnucash/engine
# Any additional parameters will be used as dependencies for this wrapper target
macro (gnc_add_swig_guile_command _target _out_var _output _input)
macro (gnc_add_swig_guile_command _target _out_var _output _input _include_dirs)
set(SW_CURR_BUILD_SOURCE_DIR ${CMAKE_CURRENT_BINARY_DIR})
set(SW_BUILD_SOURCE_DIR ${CMAKE_BINARY_DIR})
set(outfile ${SW_CURR_BUILD_SOURCE_DIR}/${_output})
set(${_out_var} ${outfile}) # This variable is set for convenience to use in the calling CMakeLists.txt
set (DEFAULT_SWIG_GUILE_FLAGS
-guile -Linkage module
${SWIG_ARGS}
)
set (DEFAULT_SWIG_GUILE_C_INCLUDES
${CMAKE_SOURCE_DIR}/common
${CMAKE_SOURCE_DIR}/libgnucash/engine
)
set (GUILE_SWIG_FLAGS ${DEFAULT_SWIG_GUILE_FLAGS})
foreach (dir ${DEFAULT_SWIG_GUILE_C_INCLUDES} ${_include_dirs})
list (APPEND GUILE_SWIG_FLAGS "-I${dir}")
endforeach (dir)
add_custom_command (
OUTPUT ${outfile}
DEPENDS ${_input} ${CMAKE_SOURCE_DIR}/common/base-typemaps.i ${ARGN}
COMMAND ${SWIG_EXECUTABLE} -guile ${SWIG_ARGS} -Linkage module -I${CMAKE_SOURCE_DIR}/libgnucash/engine -I${CMAKE_SOURCE_DIR}/common -o ${outfile} ${_input}
COMMAND ${SWIG_EXECUTABLE} ${GUILE_SWIG_FLAGS} -o ${outfile} ${_input}
)
add_custom_target(${_target} DEPENDS ${outfile})
endmacro (gnc_add_swig_guile_command)
@@ -36,8 +53,12 @@ endmacro (gnc_add_swig_guile_command)
# - _output is the name of the wrapper file to generate
# - _py_output is the name of the python module associated with this wrapper
# - _input is the swig interface file (*.i) to generate this wrapper from
# - _include_dirs is an optional list of include directories to pass to the swig command
# For python four directories are always passed by default:
# ${GLIB2_INCLUDE_DIRS}, ${CMAKE_SOURCE_DIR}/common,
# ${CMAKE_SOURCE_DIR}/libgnucash/app-utils and ${CMAKE_SOURCE_DIR}/libgnucash/engine
# Any additional parameters will be used as dependencies for this wrapper target
macro (gnc_add_swig_python_command _target _out_var _py_out_var _output _py_output _input)
macro (gnc_add_swig_python_command _target _out_var _py_out_var _output _py_output _input _include_dirs)
set(SW_CURR_BUILD_SOURCE_DIR ${CMAKE_CURRENT_BINARY_DIR})
set(SW_BUILD_SOURCE_DIR ${CMAKE_BINARY_DIR})
@@ -60,7 +81,7 @@ macro (gnc_add_swig_python_command _target _out_var _py_out_var _output _py_outp
)
set (PYTHON_SWIG_FLAGS ${DEFAULT_SWIG_PYTHON_FLAGS})
foreach (dir ${DEFAULT_SWIG_PYTHON_C_INCLUDES})
foreach (dir ${DEFAULT_SWIG_PYTHON_C_INCLUDES} ${_include_dirs})
list (APPEND PYTHON_SWIG_FLAGS "-I${dir}")
endforeach (dir)
add_custom_command(OUTPUT ${outfile} ${py_outfile}
@@ -69,3 +90,25 @@ macro (gnc_add_swig_python_command _target _out_var _py_out_var _output _py_outp
)
add_custom_target(${_target} ALL DEPENDS ${outfile} ${py_outfile} ${CMAKE_SOURCE_DIR}/common/base-typemaps.i ${_input} ${ARGN})
endmacro()
# The swig wrappers need to know the header files ("the interface")
# for the library they are wrapping.
# We can extract those from the target's SOURCES property
# Using a few ordinary cmake commands
macro (gnc_swig_extract_header_files _target _variable)
set(${_variable} "")
get_target_property(_headers ${_target} SOURCES)
if(_headers)
list(FILTER _headers INCLUDE REGEX ".*[.]h(pp)?$")
get_target_property(_srcdir ${_target} SOURCE_DIR)
foreach (_header ${_headers})
if(NOT IS_ABSOLUTE "${_header}")
set(_header_abs "${_srcdir}/${_header}")
else()
set(_header_abs "${_header}")
endif()
list (APPEND ${_variable} "${_header_abs}")
endforeach ()
endif()
endmacro()

View File

@@ -32,9 +32,6 @@ function(get_guile_env)
list(APPEND env "GUILE=${GUILE_EXECUTABLE}")
set(guile_load_paths "")
list(APPEND guile_load_paths "${CMAKE_CURRENT_SOURCE_DIR}/mod-foo")
list(APPEND guile_load_paths "${CMAKE_CURRENT_SOURCE_DIR}/mod-bar")
list(APPEND guile_load_paths "${CMAKE_CURRENT_SOURCE_DIR}/mod-baz")
#list(APPEND guile_load_paths "${CMAKE_BINARY_DIR}/${GUILE_REL_SITEDIR}")
list(APPEND guile_load_paths "${CMAKE_BINARY_DIR}/${GUILE_REL_SITEDIR}/gnucash/deprecated") # Path to gnucash' deprecated modules
set(guile_load_path "${guile_load_paths}")

View File

@@ -22,7 +22,7 @@ set_dist_list(test_core_DIST ${test_core_SOURCES} ${test_core_noinst_HEADERS} CM
unittest-support.i unittest-support.scm)
add_library(test-core STATIC ${test_core_SOURCES} ${test_core_noinst_HEADERS})
target_link_libraries(test-core gncmod-engine ${GLIB2_LDFLAGS})
target_link_libraries(test-core gnc-engine ${GLIB2_LDFLAGS})
if (UNIX)
target_compile_options(test-core PRIVATE -fPIC)
endif()
@@ -30,14 +30,14 @@ endif()
# Command to generate the swig-unittest-support-guile.c wrapper file
gnc_add_swig_guile_command (swig-unittest-support-guile-c
SWIG_UNITTEST_SUPPORT_GUILE_C swig-unittest-support-guile.c
${CMAKE_CURRENT_SOURCE_DIR}/unittest-support.i ${test_core_HEADERS}
${CMAKE_CURRENT_SOURCE_DIR}/unittest-support.i "" ${test_core_HEADERS}
)
# Command to generate the swig-unittest-support-python.c wrapper file
gnc_add_swig_python_command (swig-unittest-support-python
SWIG_UNITTEST_SUPPORT_PYTHON_C SWIG_UNITTEST_SUPPORT_PYTHON_PY
swig-unittest-support-python.c unittest_support.py
${CMAKE_CURRENT_SOURCE_DIR}/unittest-support.i
${CMAKE_CURRENT_SOURCE_DIR}/unittest-support.i ""
)
add_library(test-core-guile ${SWIG_UNITTEST_SUPPORT_GUILE_C})

View File

@@ -1,6 +1,4 @@
The Bill Invoice importer is an optional module and needs to enabled by editing the file $HOME/.gnucash/config.user, adding the line:
(gnc:module-load "gnucash/plugins/bi_import" 0)
Some notes on the bill and invoice importer:
The example csv file must have the 22 elements for it to work.

View File

@@ -51,8 +51,8 @@ if (BUILDING_FROM_VCS)
endif (BUILDING_FROM_VCS)
target_link_libraries (gnucash
gncmod-ledger-core gnc-gnome gncmod-gnome-utils gncmod-app-utils
gncmod-engine gnc-module gnc-core-utils gncmod-report
gncmod-ledger-core gnc-gnome gncmod-gnome-utils gnc-app-utils
gnc-engine gnc-module gnc-core-utils gncmod-report gnucash-guile
PkgConfig::GTK3 ${GUILE_LDFLAGS} ${GLIB2_LDFLAGS} ${GTK_MAC_LDFLAGS}
)
@@ -250,9 +250,16 @@ foreach(gres_file ${gresource_files})
list(APPEND gresource_files ${rel_file})
endforeach()
gnc_add_scheme_targets(price-quotes
price-quotes.scm
gnucash
"scm-engine;scm-app-utils;scm-gnome-utils"
FALSE)
set_local_dist(gnucash_DIST_local CMakeLists.txt environment.in generate-gnc-script
gnucash-bin.c gnucash.rc.in gnucash-valgrind.in gnucash-gresources.xml ${gresource_files}
${gnucash_EXTRA_DIST})
price-quotes.scm ${gnucash_EXTRA_DIST})
set (gnucash_DIST ${gnucash_DIST_local} ${gnome_DIST} ${gnome_search_DIST} ${gnome_utils_DIST}
${gschemas_DIST} ${gtkbuilder_DIST} ${html_DIST} ${import_export_DIST} ${python_DIST} ${register_DIST}

View File

@@ -60,12 +60,6 @@ libgncmod_gnome_search_gnc_module_description(void)
int
libgncmod_gnome_search_gnc_module_init(int refcount)
{
/* load the engine (we depend on it) */
if (!gnc_module_load("gnucash/engine", 0))
{
return FALSE;
}
if (!gnc_module_load("gnucash/gnome-utils", 0))
{
return FALSE;

View File

@@ -5,7 +5,7 @@ add_subdirectory(test)
# Command to generate the swig-gnome-utils.c wrapper file
gnc_add_swig_guile_command (swig-gnome-utils-c
SWIG_GNOME_UTILS_C swig-gnome-utils.c
${CMAKE_CURRENT_SOURCE_DIR}/gnome-utils.i
${CMAKE_CURRENT_SOURCE_DIR}/gnome-utils.i ""
)
set (WARNINGS_SCHEMA ${DATADIR_BUILD}/glib-2.0/schemas/org.gnucash.warnings.gschema.xml)
@@ -53,6 +53,7 @@ set (gnome_utils_SOURCES
gnc-cell-renderer-text-flag.c
gnc-combott.c
gnc-commodity-edit.c
gnc-component-manager.c
gnc-currency-edit.c
gnc-date-delta.c
gnc-date-edit.c
@@ -141,6 +142,7 @@ set (gnome_utils_HEADERS
gnc-cell-renderer-text-flag.h
gnc-combott.h
gnc-commodity-edit.h
gnc-component-manager.h
gnc-currency-edit.h
gnc-date-delta.h
gnc-date-edit.h
@@ -204,8 +206,14 @@ add_library (gncmod-gnome-utils
${gnome_utils_noinst_HEADERS}
)
target_link_libraries(gncmod-gnome-utils gncmod-app-utils gncmod-engine
gnc-backend-xml-utils PkgConfig::GTK3 ${CMAKE_DL_LIBS} ${LIBSECRET_LDFLAGS}
target_link_libraries(gncmod-gnome-utils
gnc-app-utils
gnc-engine
gnc-backend-xml-utils
gnucash-guile
PkgConfig::GTK3
${CMAKE_DL_LIBS}
${LIBSECRET_LDFLAGS}
${GTK_MAC_LDFLAGS})
target_compile_options(gncmod-gnome-utils PRIVATE -Wno-deprecated-declarations)
@@ -245,7 +253,7 @@ install(FILES ${gnome_utils_HEADERS} DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/gnu
# Scheme
set(GUILE_DEPENDS gncmod-gnome-utils scm-gnc-module scm-scm scm-app-utils)
set(GUILE_DEPENDS gncmod-gnome-utils scm-gnc-module scm-engine scm-app-utils)
gnc_add_scheme_targets(scm-gnome-utils-1
gnome-utils.scm

View File

@@ -34,8 +34,8 @@
#include "dialog-options.h"
#include "dialog-utils.h"
#include "engine-helpers-guile.h"
#include "glib-helpers.h"
#include "gnc-engine-guile.h"
#include "glib-guile.h"
#include "gnc-account-sel.h"
#include "gnc-tree-view-account.h"
#include "gnc-tree-model-account.h"
@@ -50,7 +50,6 @@
#include "gnc-gui-query.h"
#include "gnc-session.h"
#include "gnc-ui.h"
#include "guile-util.h"
#include "gnc-guile-utils.h"
#include "option-util.h"
#include "guile-mappings.h"

View File

@@ -47,7 +47,7 @@
#include "swig-runtime.h"
#include "guile-mappings.h"
#include "engine-helpers.h"
#include "engine-helpers-guile.h"
#include "gnc-engine-guile.h"
#include "QuickFill.h"
#include <gnc-commodity.h>

View File

@@ -43,7 +43,6 @@
#include "gnc-ui-util.h"
#include "gnc-prefs.h"
#include "gnc-combott.h"
#include "guile-util.h"
#include "gnc-main-window.h"
/* This static indicates the debugging module that this .o belongs to. */

View File

@@ -48,9 +48,11 @@
#include "dialog-reset-warnings.h"
#include "dialog-transfer.h"
#include "dialog-utils.h"
#include "engine-helpers.h"
#include "file-utils.h"
#include "gnc-component-manager.h"
#include "gnc-engine.h"
#include "gnc-features.h"
#include "gnc-file.h"
#include "gnc-filepath-utils.h"
#include "gnc-gkeyfile-utils.h"
@@ -2542,9 +2544,9 @@ gnc_main_window_class_init (GncMainWindowClass *klass)
NULL);
gnc_hook_add_dangler(HOOK_BOOK_SAVED,
(GFunc)gnc_main_window_update_all_titles, NULL);
(GFunc)gnc_main_window_update_all_titles, NULL, NULL);
gnc_hook_add_dangler(HOOK_BOOK_OPENED,
(GFunc)gnc_main_window_attach_to_book, NULL);
(GFunc)gnc_main_window_attach_to_book, NULL, NULL);
}
@@ -4111,6 +4113,44 @@ gnc_book_options_dialog_close_cb(GNCOptionWin * optionwin,
gnc_option_db_destroy(options);
}
/** Calls gnc_book_option_num_field_source_change to initiate registered
* callbacks when num_field_source book option changes so that
* registers/reports can update themselves; sets feature flag */
void
gnc_book_option_num_field_source_change_cb (gboolean num_action)
{
gnc_suspend_gui_refresh ();
if (num_action)
{
/* Set a feature flag in the book for use of the split action field as number.
* This will prevent older GnuCash versions that don't support this feature
* from opening this file. */
gnc_features_set_used (gnc_get_current_book(),
GNC_FEATURE_NUM_FIELD_SOURCE);
}
gnc_book_option_num_field_source_change (num_action);
gnc_resume_gui_refresh ();
}
/** Calls gnc_book_option_book_currency_selected to initiate registered
* callbacks when currency accounting book option changes to book-currency so
* that registers/reports can update themselves; sets feature flag */
void
gnc_book_option_book_currency_selected_cb (gboolean use_book_currency)
{
gnc_suspend_gui_refresh ();
if (use_book_currency)
{
/* Set a feature flag in the book for use of book currency. This will
* prevent older GnuCash versions that don't support this feature from
* opening this file. */
gnc_features_set_used (gnc_get_current_book(),
GNC_FEATURE_BOOK_CURRENCY);
}
gnc_book_option_book_currency_selected (use_book_currency);
gnc_resume_gui_refresh ();
}
static gboolean
show_handler (const char *class_name, gint component_id,
gpointer user_data, gpointer iter_data)

View File

@@ -26,7 +26,7 @@
#include <glib/gi18n.h>
#include <ctype.h>
#include "guile-util.h"
#include "gnc-guile-utils.h"
#include "gnc-engine.h"
#include "gnc-menu-extensions.h"
#include "gnc-ui.h"

View File

@@ -67,7 +67,7 @@ gnc_plugin_manager_get (void)
singleton = g_object_new (GNC_TYPE_PLUGIN_MANAGER,
NULL);
gnc_hook_add_dangler (HOOK_SHUTDOWN,
gnc_plugin_manager_shutdown, NULL);
gnc_plugin_manager_shutdown, NULL, NULL);
}
return singleton;

View File

@@ -40,7 +40,6 @@
#include "swig-runtime.h"
#include "guile-mappings.h"
#include "guile-util.h"
#include "gnc-engine.h"
#include "gnc-plugin-menu-additions.h"
#include "gnc-window.h"

View File

@@ -138,7 +138,7 @@ gnc_tree_view_account_class_init (GncTreeViewAccountClass *klass)
o_class->finalize = gnc_tree_view_account_finalize;
gnc_hook_add_dangler(HOOK_CURRENCY_CHANGED,
(GFunc)gtva_currency_changed_cb, NULL);
(GFunc)gtva_currency_changed_cb, NULL, NULL);
}
/********************************************************************\

View File

@@ -110,7 +110,7 @@ gnc_tree_view_owner_class_init (GncTreeViewOwnerClass *klass)
o_class->finalize = gnc_tree_view_owner_finalize;
gnc_hook_add_dangler(HOOK_CURRENCY_CHANGED,
(GFunc)gtvo_currency_changed_cb, NULL);
(GFunc)gtvo_currency_changed_cb, NULL, NULL);
}
/********************************************************************\

View File

@@ -26,16 +26,12 @@
#include <config.h>
#include <gmodule.h>
#include <libguile.h>
#include "gnc-module.h"
#include "gnc-module-api.h"
#include "gnc-component-manager.h"
#include "dialog-options.h"
#include "qof.h"
#include "gnc-gui-query.h"
GNC_MODULE_API_DECL(libgncmod_gnome_utils)
@@ -60,37 +56,19 @@ libgncmod_gnome_utils_gnc_module_description(void)
return g_strdup("Utilities for using Gnome/Gtk with GnuCash");
}
static void
lmod(char * mn)
{
char * form = g_strdup_printf("(use-modules %s)\n", mn);
scm_c_eval_string(form);
g_free(form);
}
extern SCM scm_init_sw_gnome_utils_module(void);
int
libgncmod_gnome_utils_gnc_module_init(int refcount)
{
/* load the engine (we depend on it) */
if (!gnc_module_load("gnucash/engine", 0))
{
return FALSE;
}
if (!gnc_module_load("gnucash/app-utils", 0))
{
return FALSE;
}
scm_init_sw_gnome_utils_module();
lmod("(sw_gnome_utils)");
lmod("(gnucash gnome-utils)");
scm_c_use_module ("sw_gnome_utils");
scm_c_use_module("gnucash gnome-utils");
/* Initialize the options-ui database */
if (refcount == 0)
{
gnc_component_manager_init ();
gnc_options_ui_initialize ();
}
@@ -100,5 +78,8 @@ libgncmod_gnome_utils_gnc_module_init(int refcount)
int
libgncmod_gnome_utils_gnc_module_end(int refcount)
{
if (refcount == 0)
gnc_component_manager_shutdown ();
return TRUE;
}

View File

@@ -19,14 +19,17 @@
(define-module (gnucash gnome-utils))
(use-modules (gnucash engine))
(use-modules (gnucash utilities))
(use-modules (gnucash gnc-module))
(use-modules (gnucash app-utils))
(eval-when (compile load eval expand)
(load-extension "libgncmod-gnome-utils" "scm_init_sw_gnome_utils_module"))
(use-modules (sw_gnome_utils))
(gnc:module-load "gnucash/app-utils" 0)
; Export the swig-wrapped symbols in the public interface of this module
(let ((i (module-public-interface (current-module))))
(module-use! i (resolve-interface '(sw_gnome_utils))))
;; from gnc-menu-extensions.scm
(export gnc:extension-type)

View File

@@ -31,9 +31,9 @@ set(GUILE_DEPENDS
scm-gnome-utils
test-core
gncmod-test-engine
gncmod-app-utils
gnc-app-utils
gnc-core-utils
gncmod-engine
gnc-engine
)
gnc_add_scheme_test_targets(scm-test-load-gnome-utils-module

View File

@@ -1,14 +1,21 @@
(define exit-code 0)
(setenv "GNC_UNINSTALLED" "1")
(use-modules (gnucash gnc-module))
(gnc:module-system-init)
(display " testing gnome-utils module load ... ")
(if (gnc:module-load "gnucash/gnome-utils" 0)
(use-modules (gnucash gnome-utils))
(begin
(display "ok\n")
(exit 0))
(begin
(display "failed\n")
(exit 1)))
(cond
((defined? 'gnc:make-menu)
(display "Procedure gnc:make-menu found\n"))
(else
(display "Failed - procedure gnc:make-menu not found\n")
(set! exit-code -1)))
(cond
((defined? 'gnc:set-ui-status)
(display "Procedure gnc:set-ui-status found\n"))
(else
(display "Failed - procedure gnc:set-ui-status not found\n")
(set! exit-code -1)))
(exit exit-code)

View File

@@ -64,7 +64,7 @@ set (gnc_gnome_noinst_HEADERS
# Command to generate the swig-gnome.c wrapper file
gnc_add_swig_guile_command (swig-gnome-c
SWIG_GNOME_C swig-gnome.c
${CMAKE_CURRENT_SOURCE_DIR}/gnome.i ${gnc_gnome_HEADERS}
${CMAKE_CURRENT_SOURCE_DIR}/gnome.i "" ${gnc_gnome_HEADERS}
)
set (gnc_gnome_SOURCES
@@ -136,9 +136,20 @@ set (gnc_gnome_SOURCES
set_source_files_properties (${gnc_gnome_SOURCES} PROPERTIES OBJECT_DEPENDS ${CONFIG_H})
add_library (gnc-gnome ${gnc_gnome_SOURCES} ${gnc_gnome_noinst_HEADERS} ${SWIG_GNOME_C})
target_link_libraries(gnc-gnome gncmod-gnome-search gncmod-ledger-core
gncmod-html gncmod-report gncmod-register-gnome gncmod-register-core
gncmod-gnome-utils gncmod-engine PkgConfig::GTK3 ${GTK_MAC_LDFLAGS})
target_link_libraries(gnc-gnome
gncmod-gnome-search
gncmod-ledger-core
gncmod-html
gncmod-report
gncmod-register-gnome
gncmod-register-core
gncmod-gnome-utils
gnc-engine
gnc-locale-tax
gnucash-guile
${Boost_LIBRARIES}
PkgConfig::GTK3
${GTK_MAC_LDFLAGS})
target_compile_definitions (gnc-gnome PRIVATE -DG_LOG_DOMAIN=\"gnc.gui\" ${GTK_MAC_CFLAGS_OTHER})
target_compile_options(gnc-gnome PRIVATE -Wno-deprecated-declarations)
@@ -219,10 +230,9 @@ set(GUILE_OUTPUT_DIR gnucash)
set(GUILE_DEPENDS
gncmod-gnome-utils
scm-engine
scm-gettext
scm-core-utils
scm-gnome-utils
scm-gnc-module
scm-scm
scm-report
scm-reports
)

View File

@@ -1366,5 +1366,5 @@ void
gnc_ui_hierarchy_assistant_initialize (void)
{
gnc_hook_add_dangler(HOOK_NEW_BOOK,
(GFunc)gnc_ui_hierarchy_assistant_hook, NULL);
(GFunc)gnc_ui_hierarchy_assistant_hook, NULL, NULL);
}

View File

@@ -48,8 +48,7 @@
#include "gnc-warnings.h"
#include "swig-runtime.h"
#include "guile-mappings.h"
#include "guile-util.h"
#include "engine-helpers-guile.h"
#include "gnc-engine-guile.h"
#define DIALOG_PRICE_DB_CM_CLASS "dialog-price-edit-db"

View File

@@ -45,7 +45,6 @@
#include "gnc-ui.h"
#include "gnc-ui-util.h"
#include "gnc-warnings.h"
#include "guile-util.h"
#include "engine-helpers.h"

View File

@@ -1822,7 +1822,7 @@ gnc_ui_sx_initialize (void)
_sx_engine_event_handler_id = qof_event_register_handler(_sx_engine_event_handler, NULL);
gnc_hook_add_dangler(HOOK_BOOK_OPENED,
(GFunc)gnc_sx_sxsincelast_book_opened, NULL);
(GFunc)gnc_sx_sxsincelast_book_opened, NULL, NULL);
/* Add page to preferences page for Scheduled Transactions */
/* The parameters are; glade file, items to add from glade file - last being the dialog, preference tab name */

View File

@@ -1771,7 +1771,7 @@ gnc_ui_sx_initialize2 (void) //FIXME need to remove the 2 when live
_sx_engine_event_handler_id = qof_event_register_handler (_sx_engine_event_handler, NULL);
gnc_hook_add_dangler (HOOK_BOOK_OPENED,
(GFunc)gnc_sx_sxsincelast_book_opened, NULL);
(GFunc)gnc_sx_sxsincelast_book_opened, NULL, NULL);
/* Add page to preferences page for Scheduled Transactions */
/* The parameters are; glade file, items to add from glade file - last being the dialog, preference tab name */

View File

@@ -30,13 +30,13 @@
#include <glib/gi18n.h>
#include <libguile.h>
#include "guile-mappings.h"
#include "guile-util.h"
#include "gnc-guile-utils.h"
#include "gnc-module.h"
#include "Account.h"
#include "gnc-ui-util.h"
#include "dialog-utils.h"
#include "gnc-locale-tax.h"
#include "gnc-prefs.h"
#include "gnc-tree-view-account.h"
#include "gnc-component-manager.h"
@@ -146,10 +146,8 @@ typedef struct
static void
initialize_getters (void)
{
if (!gnc_module_load("gnucash/locale/tax", 0))
{
return;
}
gnc_locale_tax_init();
getters.payer_name_source = scm_c_eval_string ("gnc:txf-get-payer-name-source");
getters.form = scm_c_eval_string ("gnc:txf-get-form");
getters.description = scm_c_eval_string ("gnc:txf-get-description");

View File

@@ -26,19 +26,16 @@
(define-module (gnucash report-menus))
(use-modules (gnucash core-utils))
(use-modules (gnucash engine))
(use-modules (gnucash utilities))
(use-modules (gnucash gnc-module))
(use-modules (gnucash gnome-utils))
(use-modules (gnucash gettext))
(use-modules (gnucash report))
(use-modules (gnucash reports standard dashboard))
(eval-when (compile load eval expand)
(load-extension "libgnc-gnome" "scm_init_sw_gnome_module"))
(use-modules (sw_gnome))
(gnc:module-load "gnucash/gnome-utils" 0)
(gnc:module-begin-syntax (gnc:module-load "gnucash/report" 0))
(export gnc:report-menu-setup)
(export gnc:add-report-template-menu-items)

View File

@@ -70,7 +70,6 @@
#include "gnucash-color.h"
#include "gnucash-sheet.h"
#include "gnucash-style.h"
#include "guile-util.h"
#include "search-core-type.h"
#include "search-owner.h"
#include "top-level.h"
@@ -411,15 +410,15 @@ gnc_main_gui_init (void)
gnc_hook_run(HOOK_UI_STARTUP, NULL);
gnc_hook_add_dangler(HOOK_BOOK_OPENED,
gnc_restore_all_state, NULL);
gnc_restore_all_state, NULL, NULL);
gnc_hook_add_dangler(HOOK_BOOK_CLOSED,
gnc_save_all_state, NULL);
gnc_save_all_state, NULL, NULL);
gnc_hook_add_dangler(HOOK_BOOK_CLOSED,
(GFunc)gnc_reports_flush_global, NULL);
(GFunc)gnc_reports_flush_global, NULL, NULL);
gnc_hook_add_dangler(HOOK_BOOK_OPENED,
(GFunc)gnc_invoice_remind_bills_due_cb, NULL);
(GFunc)gnc_invoice_remind_bills_due_cb, NULL, NULL);
gnc_hook_add_dangler(HOOK_BOOK_OPENED,
(GFunc)gnc_invoice_remind_invoices_due_cb, NULL);
(GFunc)gnc_invoice_remind_invoices_due_cb, NULL, NULL);
gnc_ui_sx_initialize();

View File

@@ -37,7 +37,6 @@
#include "gnc-main-window.h"
#include "gnc-plugin-page-register.h"
#include "gnc-ui.h"
#include "guile-util.h"
#include "window-autoclear.h"
#define WINDOW_AUTOCLEAR_CM_CLASS "window-autoclear"

View File

@@ -55,7 +55,6 @@
#include "gnc-ui.h"
#include "gnc-ui-balances.h"
#include "gnc-window.h"
#include "guile-util.h"
#include "reconcile-view.h"
#include "window-reconcile.h"
#ifdef MAC_INTEGRATION
@@ -1104,30 +1103,13 @@ gnc_reconcile_key_press_cb (GtkWidget *widget, GdkEventKey *event,
static void
gnc_reconcile_window_set_titles(RecnWindow *recnData)
{
gboolean formal;
gchar *title;
formal = gnc_prefs_get_bool(GNC_PREFS_GROUP_GENERAL, GNC_PREF_ACCOUNTING_LABELS);
if (formal)
title = _("Debits");
else
title = gnc_get_debit_string(ACCT_TYPE_NONE);
const gchar *title;
title = gnc_account_get_debit_string(ACCT_TYPE_NONE);
gtk_frame_set_label(GTK_FRAME(recnData->debit_frame), title);
if (!formal)
g_free(title);
if (formal)
title = _("Credits");
else
title = gnc_get_credit_string(ACCT_TYPE_NONE);
title = gnc_account_get_credit_string(ACCT_TYPE_NONE);
gtk_frame_set_label(GTK_FRAME(recnData->credit_frame), title);
if (!formal)
g_free(title);
}

View File

@@ -54,7 +54,6 @@
#include "gnc-ui.h"
#include "gnc-ui-balances.h"
#include "gnc-window.h"
#include "guile-util.h"
#include "reconcile-view.h"
#include "window-reconcile2.h"
@@ -1063,30 +1062,13 @@ gnc_reconcile_key_press_cb (GtkWidget *widget, GdkEventKey *event,
static void
gnc_reconcile_window_set_titles (RecnWindow2 *recnData)
{
gboolean formal;
gchar *title;
formal = gnc_prefs_get_bool(GNC_PREFS_GROUP_GENERAL, GNC_PREF_ACCOUNTING_LABELS);
if (formal)
title = _("Debits");
else
title = gnc_get_debit_string (ACCT_TYPE_NONE);
const gchar *title;
title = gnc_account_get_debit_string (ACCT_TYPE_NONE);
gtk_frame_set_label (GTK_FRAME (recnData->debit_frame), title);
if (!formal)
g_free(title);
if (formal)
title = _("Credits");
else
title = gnc_get_credit_string (ACCT_TYPE_NONE);
title = gnc_account_get_credit_string (ACCT_TYPE_NONE);
gtk_frame_set_label (GTK_FRAME (recnData->credit_frame), title);
if (!formal)
g_free(title);
}

View File

@@ -54,7 +54,7 @@
#include "gnc-plugin-report-system.h"
#include "dialog-new-user.h"
#include "gnc-session.h"
#include "engine-helpers-guile.h"
#include "gnc-engine-guile.h"
#include "swig-runtime.h"
#include "guile-mappings.h"
#include "window-report.h"
@@ -487,8 +487,6 @@ load_gnucash_modules()
gboolean optional;
} modules[] =
{
{ "gnucash/engine", 0, FALSE },
{ "gnucash/app-utils", 0, FALSE },
{ "gnucash/gnome-utils", 0, FALSE },
{ "gnucash/gnome-search", 0, FALSE },
{ "gnucash/register/ledger-core", 0, FALSE },
@@ -518,15 +516,6 @@ load_gnucash_modules()
gnc_module_load(modules[i].name, modules[i].version);
DEBUG("Loading module %s finished", modules[i].name);
}
if (!gnc_engine_is_initialized())
{
/* On Windows this check used to fail anyway, see
* https://lists.gnucash.org/pipermail/gnucash-devel/2006-September/018529.html
* but more recently it seems to work as expected
* again. 2006-12-20, cstim. */
g_warning("GnuCash engine failed to initialize. Exiting.\n");
exit(1);
}
}
static void
@@ -612,10 +601,12 @@ inner_main (void *closure, int argc, char **argv)
SCM main_mod;
char* fn = NULL;
scm_c_eval_string("(debug-set! stack 200000)");
main_mod = scm_c_resolve_module("gnucash utilities");
scm_set_current_module(main_mod);
scm_c_use_module("gnucash app-utils");
/* Check whether the settings need a version update */
gnc_gsettings_version_upgrade ();
@@ -636,7 +627,7 @@ inner_main (void *closure, int argc, char **argv)
before booting guile. */
gnc_main_gui_init();
gnc_hook_add_dangler(HOOK_UI_SHUTDOWN, (GFunc)gnc_file_quit, NULL);
gnc_hook_add_dangler(HOOK_UI_SHUTDOWN, (GFunc)gnc_file_quit, NULL, NULL);
/* Install Price Quote Sources */
gnc_update_splash_screen(_("Checking Finance::Quote..."), GNC_SPLASH_PERCENTAGE_UNKNOWN);
@@ -900,6 +891,7 @@ main(int argc, char ** argv)
g_print("\n\n%s\n", userdata_migration_msg);
gnc_log_init();
gnc_engine_init (0, NULL);
/* Write some locale details to the log to simplify debugging */
PINFO ("System locale returned %s", sys_locale ? sys_locale : "(null)");

View File

@@ -12,7 +12,7 @@ set (html_HEADERS
# Command to generate the swig-gnc-html.c wrapper file
gnc_add_swig_guile_command (swig-gnc-html-c
SWIG_GNC_HTML_C swig-gnc-html.c
${CMAKE_CURRENT_SOURCE_DIR}/gnc-html.i "${gncmod_html_HEADERS}"
${CMAKE_CURRENT_SOURCE_DIR}/gnc-html.i "" "${gncmod_html_HEADERS}"
)
set (html_SOURCES
@@ -32,7 +32,21 @@ else ()
set(html_EXTRA_DIST gnc-html-webkit1.h gnc-html-webkit1.c)
endif ()
set_dist_list(html_DIST CMakeLists.txt ${html_HEADERS} ${html_SOURCES} gnc-html.i ${html_EXTRA_DIST})
set (gnc_html_SCHEME html.scm)
set(GUILE_OUTPUT_DIR gnucash)
set(GUILE_DEPENDS gncmod-html gnucash-guile)
gnc_add_scheme_targets(scm-gnc-html
"${gnc_html_SCHEME}"
${GUILE_OUTPUT_DIR}
"${GUILE_DEPENDS}"
FALSE
)
set_dist_list(html_DIST CMakeLists.txt ${html_HEADERS} ${html_SOURCES} gnc-html.i ${html_EXTRA_DIST} html.scm)
add_library (gncmod-html
${html_SOURCES}
@@ -40,7 +54,7 @@ add_library (gncmod-html
${html_HEADERS}
)
target_link_libraries(gncmod-html gncmod-engine gnc-module gncmod-gnome-utils
target_link_libraries(gncmod-html gnc-engine gnc-module gncmod-gnome-utils
PkgConfig::GTK3 PkgConfig::WEBKIT ${GUILE_LDFLAGS})
target_compile_definitions(gncmod-html PRIVATE -DG_LOG_DOMAIN=\"gnc.html\")

View File

@@ -48,6 +48,7 @@ SCM scm_init_sw_gnc_html_module(void);
%include "gnc-html-extras.h"
void gnc_html_initialize(void);
%init {
{

View File

@@ -60,34 +60,14 @@ libgncmod_html_gnc_module_description( void )
return g_strdup( "Utilities for using HTML with GnuCash" );
}
static void
lmod( char* mn )
{
char* form = g_strdup_printf( "(use-modules %s)\n", mn );
scm_c_eval_string( form );
g_free( form );
}
extern SCM scm_init_sw_gnc_html_module( void );
int
libgncmod_html_gnc_module_init( int refcount )
{
/* load the engine (we depend on it) */
if ( !gnc_module_load( "gnucash/engine", 0 ) )
{
return FALSE;
}
if ( !gnc_module_load( "gnucash/app-utils", 0 ) )
{
return FALSE;
}
scm_init_sw_gnc_html_module();
gnc_html_initialize();
lmod( "(sw_gnc_html)" );
// lmod( "(gnucash gnc_html)" );
scm_c_use_module( "sw_gnc_html" );
return TRUE;
}

View File

@@ -1,5 +1,9 @@
;; test of a Scheme module called gnc-mod-foo, which should get
;; loaded by the Gnucash module "foo"
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;; gnc-html.scm
;;; Guile module for gnc-html
;;;
;;; Copyright 2019 Geert Janssens <geert@kobaltwit.be>
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; This program is free software; you can redistribute it and/or
;; modify it under the terms of the GNU General Public License as
@@ -20,12 +24,16 @@
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(define-module (gnucash foo))
(export foo:scheme-hello)
(define (foo:scheme-hello)
#t)
(define-module (gnucash html))
;; Guile 2 needs to find the symbols from the extension at compile time already
(eval-when
(compile load eval expand)
(load-extension "libgncmod-html" "scm_init_sw_gnc_html_module"))
(use-modules (sw_gnc_html))
; Export the swig-wrapped symbols in the public interface of this module
(let ((i (module-public-interface (current-module))))
(module-use! i (resolve-interface '(sw_gnc_html))))
(gnc-html-initialize)

View File

@@ -51,7 +51,7 @@ add_library (gncmod-generic-import
${generic_import_noinst_HEADERS}
)
target_link_libraries(gncmod-generic-import gncmod-gnome-utils gncmod-engine PkgConfig::GTK3 ${GLIB2_LDFLAGS})
target_link_libraries(gncmod-generic-import gncmod-gnome-utils gnc-engine PkgConfig::GTK3 ${GLIB2_LDFLAGS})
target_compile_definitions (gncmod-generic-import PRIVATE -DG_LOG_DOMAIN=\"gnc.import\")

View File

@@ -56,7 +56,7 @@ if(WITH_AQBANKING)
target_link_libraries(gncmod-aqbanking gnc-gnome gncmod-gnome-utils
gncmod-generic-import gncmod-register-core
gncmod-register-gnome gncmod-ledger-core gncmod-engine gwengui-gtk3
gncmod-register-gnome gncmod-ledger-core gnc-engine gwengui-gtk3
${AQB_EXPORT_SYMBOLS} ${AQBANKING_LDFLAGS}
${GWENHYWFAR_LDFLAGS}
${GNOME_LDFLAGS} ${AQB_LIBSTDCXX})

View File

@@ -62,9 +62,7 @@ gint
libgncmod_aqbanking_gnc_module_init(gint refcount)
{
/* Load modules we depend on */
if (!gnc_module_load("gnucash/engine", 0)
|| !gnc_module_load("gnucash/app-utils", 0)
|| !gnc_module_load("gnucash/gnome-utils", 0)
if (!gnc_module_load("gnucash/gnome-utils", 0)
|| !gnc_module_load("gnucash/import-export", 0))
{
return FALSE;

View File

@@ -21,8 +21,8 @@ set(test_aqb_INCLUDE_DIRS
set(test_aqb_LIBS
gncmod-aqbanking gncmod-generic-import gnc-gnome gncmod-gnome-utils
gncmod-ledger-core gncmod-app-utils
gncmod-backend-xml-utils gncmod-engine gnc-core-utils gnc-module
gncmod-ledger-core gnc-app-utils
gncmod-backend-xml-utils gnc-engine gnc-core-utils gnc-module
${GLIB2_LDFLAGS}
)

View File

@@ -21,8 +21,8 @@ add_library(gncmod-bi-import ${bi_import_noinst_HEADERS} ${bi_import_SOURCES})
target_link_libraries(gncmod-bi-import
gncmod-gnome-utils
gncmod-gnome-search
gncmod-app-utils
gncmod-engine
gnc-app-utils
gnc-engine
gnc-core-utils
gnc-module
gnc-gnome

View File

@@ -65,18 +65,10 @@ libgncmod_bi_import_gnc_module_description (void)
int
libgncmod_bi_import_gnc_module_init (int refcount)
{
if (!gnc_module_load ("gnucash/app-utils", 0))
{
return FALSE;
}
if (!gnc_module_load ("gnucash/gnome-utils", 0))
{
return FALSE;
}
if (!gnc_module_load ("gnucash/engine", 0))
{
return FALSE;
}
if (refcount == 0)
{

View File

@@ -18,8 +18,8 @@ set(csv_export_noinst_HEADERS
add_library(gncmod-csv-export ${csv_export_noinst_HEADERS} ${csv_export_SOURCES})
target_link_libraries(gncmod-csv-export gncmod-register-gnome gncmod-register-core gncmod-ledger-core gncmod-engine
gnc-module gncmod-gnome-utils gnc-gnome gncmod-app-utils gnc-core-utils)
target_link_libraries(gncmod-csv-export gncmod-register-gnome gncmod-register-core gncmod-ledger-core gnc-engine
gnc-module gncmod-gnome-utils gnc-gnome gnc-app-utils gnc-core-utils)
target_compile_definitions(gncmod-csv-export PRIVATE -DG_LOG_DOMAIN=\"gnc.export.csv\")

View File

@@ -59,14 +59,6 @@ libgncmod_csv_export_gnc_module_description(void)
int
libgncmod_csv_export_gnc_module_init(int refcount)
{
if (!gnc_module_load("gnucash/engine", 0))
{
return FALSE;
}
if (!gnc_module_load("gnucash/app-utils", 0))
{
return FALSE;
}
if (!gnc_module_load("gnucash/gnome-utils", 0))
{
return FALSE;

View File

@@ -68,8 +68,8 @@ target_link_libraries(
${ICU4C_I18N_LDFLAGS}
gncmod-generic-import
gncmod-gnome-utils
gncmod-app-utils
gncmod-engine
gnc-app-utils
gnc-engine
gnc-core-utils
gnc-module)

View File

@@ -59,14 +59,6 @@ libgncmod_csv_import_gnc_module_description(void)
int
libgncmod_csv_import_gnc_module_init(int refcount)
{
if (!gnc_module_load("gnucash/engine", 0))
{
return FALSE;
}
if (!gnc_module_load("gnucash/app-utils", 0))
{
return FALSE;
}
if (!gnc_module_load("gnucash/gnome-utils", 0))
{
return FALSE;

View File

@@ -7,7 +7,7 @@ set(CSV_IMP_TEST_INCLUDE_DIRS
${CMAKE_SOURCE_DIR}/lib
${GLIB2_INCLUDE_DIRS}
)
set(CSV_IMP_TEST_LIBS gncmod-csv-import gncmod-engine test-core)
set(CSV_IMP_TEST_LIBS gncmod-csv-import gnc-engine test-core)
# This test does not run in Win32
if (NOT WIN32)

View File

@@ -17,8 +17,8 @@ set(customer_import_noinst_HEADERS
add_library(gncmod-customer-import ${customer_import_SOURCES} ${customer_import_noinst_HEADERS})
target_link_libraries(gncmod-customer-import gnc-gnome gncmod-gnome-utils gncmod-app-utils
gncmod-engine gnc-core-utils gnc-module ${GLIB2_LDFLAGS})
target_link_libraries(gncmod-customer-import gnc-gnome gncmod-gnome-utils gnc-app-utils
gnc-engine gnc-core-utils gnc-module ${GLIB2_LDFLAGS})
target_include_directories(gncmod-customer-import
PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}

View File

@@ -65,21 +65,10 @@ libgncmod_customer_import_gnc_module_description (void)
int
libgncmod_customer_import_gnc_module_init (int refcount)
{
if (!gnc_module_load ("gnucash/app-utils", 0))
{
return FALSE;
}
if (!gnc_module_load ("gnucash/gnome-utils", 0))
{
return FALSE;
}
//if (!gnc_module_load ("gnucash/business-core", 0)) {
// return FALSE;
//}
if (!gnc_module_load ("gnucash/engine", 0))
{
return FALSE;
}
if (refcount == 0)
{

View File

@@ -58,14 +58,6 @@ libgncmod_generic_import_gnc_module_description(void)
int
libgncmod_generic_import_gnc_module_init(int refcount)
{
if (!gnc_module_load("gnucash/engine", 0))
{
return FALSE;
}
if (!gnc_module_load("gnucash/app-utils", 0))
{
return FALSE;
}
if (!gnc_module_load("gnucash/gnome-utils", 0))
{
return FALSE;

View File

@@ -15,7 +15,7 @@ set(log_replay_noinst_HEADERS
add_library(gncmod-log-replay ${log_replay_SOURCES} ${log_replay_noinst_HEADERS})
target_link_libraries(gncmod-log-replay gncmod-gnome-utils gncmod-app-utils gncmod-engine
target_link_libraries(gncmod-log-replay gncmod-gnome-utils gnc-app-utils gnc-engine
gnc-core-utils gnc-module PkgConfig::GTK3)
target_compile_definitions(gncmod-log-replay PRIVATE -DG_LOG_DOMAIN=\"gnc.import.log-replay\")

View File

@@ -61,14 +61,6 @@ libgncmod_log_replay_gnc_module_description(void)
int
libgncmod_log_replay_gnc_module_init(int refcount)
{
if (!gnc_module_load("gnucash/engine", 0))
{
return FALSE;
}
if (!gnc_module_load("gnucash/app-utils", 0))
{
return FALSE;
}
if (!gnc_module_load("gnucash/gnome-utils", 0))
{
return FALSE;

View File

@@ -20,7 +20,7 @@ set(ofx_UI gnc-plugin-ofx-ui.xml)
if (WITH_OFX)
add_library(gncmod-ofx ${ofx_SOURCES} ${ofx_noinst_HEADERS})
target_link_libraries(gncmod-ofx gncmod-generic-import gncmod-engine gncmod-app-utils gnc-core-utils
target_link_libraries(gncmod-ofx gncmod-generic-import gnc-engine gnc-app-utils gnc-core-utils
gncmod-gnome-utils ${LIBOFX_LDFLAGS})
target_compile_definitions(gncmod-ofx PRIVATE -DG_LOG_DOMAIN=\"gnc.import.ofx\")

View File

@@ -61,14 +61,6 @@ libgncmod_ofx_gnc_module_description(void)
int
libgncmod_ofx_gnc_module_init(int refcount)
{
if (!gnc_module_load("gnucash/engine", 0))
{
return FALSE;
}
if (!gnc_module_load("gnucash/app-utils", 0))
{
return FALSE;
}
if (!gnc_module_load("gnucash/gnome-utils", 0))
{
return FALSE;

View File

@@ -20,7 +20,11 @@ set (qif_import_noinst_HEADERS
add_library (gncmod-qif-import ${qif_import_SOURCES} ${qif_import_noinst_HEADERS})
target_link_libraries(gncmod-qif-import gncmod-app-utils gncmod-gnome-utils gnc-gnome)
target_link_libraries(gncmod-qif-import
gnc-app-utils
gncmod-gnome-utils
gnc-gnome
gnucash-guile)
target_compile_definitions(gncmod-qif-import PRIVATE -DG_LOG_DOMAIN=\"gnc.import.qif.import\")
@@ -62,7 +66,6 @@ set(GUILE_DEPENDS
gnc-gnome
scm-core-utils
scm-gnc-module
scm-scm
scm-app-utils
scm-engine
scm-gnome-utils

View File

@@ -62,16 +62,6 @@ libgncmod_qif_import_gnc_module_description(void)
int
libgncmod_qif_import_gnc_module_init(int refcount)
{
if (!gnc_module_load("gnucash/engine", 0))
{
return FALSE;
}
if (!gnc_module_load("gnucash/app-utils", 0))
{
return FALSE;
}
if (!gnc_module_load("gnucash/gnome-utils", 0))
{
return FALSE;
@@ -86,7 +76,7 @@ libgncmod_qif_import_gnc_module_init(int refcount)
((void (*)())gnc_file_qif_import);
}
scm_c_eval_string("(use-modules (gnucash qif-import))");
scm_c_use_module("gnucash qif-import");
gnc_plugin_qif_import_create_plugin();

View File

@@ -26,7 +26,9 @@
(define-module (gnucash qif-import))
(use-modules (gnucash utilities))
(use-modules (gnucash engine))
(use-modules (gnucash app-utils))
(use-modules (gnucash gnome-utils))
;; We do this initialization here because src/gnome isn't a real module.
;; Note: Guile 2 needs to find the symbols from the extension at compile time already
@@ -35,16 +37,11 @@
(use-modules (sw_gnome))
(use-modules (gnucash gnc-module))
(use-modules (ice-9 regex))
(use-modules (srfi srfi-1))
(debug-enable 'backtrace)
(gnc:module-load "gnucash/engine" 0)
(gnc:module-load "gnucash/app-utils" 0)
(gnc:module-load "gnucash/gnome-utils" 0)
(load-from-path "gnucash/qif-import/qif-objects") ;; class definitions
(load-from-path "gnucash/qif-import/qif-parse") ;; string-to-value
(load-from-path "gnucash/qif-import/qif-utils")

View File

@@ -14,8 +14,7 @@ set (GUILE_DEPENDS
scm-app-utils
scm-engine
scm-test-engine
scm-gettext
scm-scm
scm-core-utils
scm-qif-import
)
gnc_add_test(test-link-qif-imp test-link.c QIF_IMP_TEST_INCLUDE_DIRS QIF_IMP_TEST_LIBS)

View File

@@ -1,5 +1,4 @@
(use-modules (gnucash gnc-module))
(gnc:module-begin-syntax (gnc:module-load "gnucash/app-utils" 0))
(use-modules (gnucash app-utils))
(use-modules (srfi srfi-64))
(use-modules (tests srfi64-extras))
(use-modules (gnucash qif-import))

View File

@@ -1,5 +1,5 @@
(use-modules (gnucash gnc-module))
(gnc:module-begin-syntax (gnc:module-load "gnucash/app-utils" 0))
(use-modules (gnucash engine))
(use-modules (gnucash app-utils))
(use-modules (srfi srfi-64))
(use-modules (tests srfi64-extras))
(use-modules (gnucash qif-import))

View File

@@ -1,5 +1,4 @@
(use-modules (gnucash gnc-module))
(gnc:module-begin-syntax (gnc:module-load "gnucash/app-utils" 0))
(use-modules (gnucash app-utils))
(use-modules (srfi srfi-64))
(use-modules (tests srfi64-extras))
(use-modules (gnucash qif-import))

View File

@@ -25,15 +25,14 @@
(export gnc:book-add-quotes) ;; called from gnome/dialog-price-edit-db.c
(export gnc:price-quotes-install-sources)
(use-modules (gnucash engine))
(use-modules (gnucash utilities))
(use-modules (gnucash gnc-module))
(use-modules (gnucash core-utils))
(use-modules (gnucash app-utils))
(use-modules (gnucash gnome-utils))
(use-modules (srfi srfi-11)
(srfi srfi-1))
(gnc:module-load "gnucash/gnome-utils" 0) ;; for gnucash-ui-is-running
(gnc:module-load "gnucash/app-utils" 0)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(define gnc:*finance-quote-check*

View File

@@ -13,7 +13,7 @@ set(pycons_DATA
if (WITH_PYTHON)
add_library(gncmod-python ${gncmod_python_SOURCES})
# target_link_libraries(gncmod-python gnc-module gnc-core-utils-python gncmod-app-utils-python
# target_link_libraries(gncmod-python gnc-module gnc-core-utils-python gnc-app-utils-python
target_link_libraries(gncmod-python gnc-module gnc-core-utils
${PYTHON_LIBRARIES} ${GLIB_LIBS}) # ${PYTHON_EXTRA_LIBS}
target_include_directories(gncmod-python

Some files were not shown because too many files have changed in this diff Show More