mirror of
https://github.com/Gnucash/gnucash.git
synced 2025-02-25 18:55:30 -06:00
bindings/guile - remove gnc-module wrapper
Emit appropriate deprecation warnings in case code tries to invoke the removed functions. Only for gnc:module-load a more elaborate compat function has been written which should allow code using this obsolete function to continue to function. The emitted deprecation warning will guide the user to update his/her code for future compatibility.
This commit is contained in:
parent
e8451ae1db
commit
88706e5657
@ -6,6 +6,5 @@ set_local_dist(bindings_DIST_local
|
|||||||
business-core.i
|
business-core.i
|
||||||
core-utils.i
|
core-utils.i
|
||||||
engine.i
|
engine.i
|
||||||
engine-common.i
|
engine-common.i)
|
||||||
gnc-module.i)
|
|
||||||
set(bindings_DIST ${bindings_DIST_local} ${guile_DIST} ${python_bindings_DIST} PARENT_SCOPE)
|
set(bindings_DIST ${bindings_DIST_local} ${guile_DIST} ${python_bindings_DIST} PARENT_SCOPE)
|
||||||
|
@ -1,39 +0,0 @@
|
|||||||
/********************************************************************\
|
|
||||||
* 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 *
|
|
||||||
* *
|
|
||||||
\********************************************************************/
|
|
||||||
|
|
||||||
%module sw_gnc_module
|
|
||||||
%{
|
|
||||||
#include <gnc-module.h>
|
|
||||||
%}
|
|
||||||
#if defined(SWIGGUILE)
|
|
||||||
%{
|
|
||||||
#include "guile-mappings.h"
|
|
||||||
|
|
||||||
SCM scm_init_sw_gnc_module_module (void);
|
|
||||||
%}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
%import "base-typemaps.i"
|
|
||||||
|
|
||||||
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);
|
|
@ -20,15 +20,6 @@ gnc_add_swig_guile_command (swig-engine-c
|
|||||||
${CMAKE_SOURCE_DIR}/bindings/engine-common.i
|
${CMAKE_SOURCE_DIR}/bindings/engine-common.i
|
||||||
)
|
)
|
||||||
|
|
||||||
# Command to generate the swig-gnc-module.c wrapper file
|
|
||||||
gnc_swig_extract_header_files (gnc-module GNC_MODULE_HEADERS)
|
|
||||||
gnc_add_swig_guile_command (swig-gnc-module-c
|
|
||||||
SWIG_GNC_MODULE_C swig-gnc-module.c
|
|
||||||
${CMAKE_SOURCE_DIR}/bindings/gnc-module.i
|
|
||||||
"${CMAKE_CURRENT_SOURCE_DIR};${CMAKE_SOURCE_DIR}/libgnucash/gnc-module"
|
|
||||||
${GNC_MODULE_HEADERS}
|
|
||||||
)
|
|
||||||
|
|
||||||
set(guile_HEADERS
|
set(guile_HEADERS
|
||||||
glib-guile.h
|
glib-guile.h
|
||||||
gnc-engine-guile.h
|
gnc-engine-guile.h
|
||||||
@ -46,8 +37,7 @@ add_library(gnucash-guile SHARED
|
|||||||
${guile_SOURCES}
|
${guile_SOURCES}
|
||||||
${guile_HEADERS}
|
${guile_HEADERS}
|
||||||
${SWIG_CORE_UTILS_GUILE_C}
|
${SWIG_CORE_UTILS_GUILE_C}
|
||||||
${SWIG_ENGINE_C}
|
${SWIG_ENGINE_C})
|
||||||
${SWIG_GNC_MODULE_C})
|
|
||||||
|
|
||||||
add_dependencies(gnucash-guile
|
add_dependencies(gnucash-guile
|
||||||
swig-runtime-h)
|
swig-runtime-h)
|
||||||
@ -67,7 +57,6 @@ target_link_libraries(gnucash-guile
|
|||||||
PRIVATE
|
PRIVATE
|
||||||
gnc-core-utils
|
gnc-core-utils
|
||||||
gnc-engine
|
gnc-engine
|
||||||
gnc-module
|
|
||||||
${GLIB2_LDFLAGS})
|
${GLIB2_LDFLAGS})
|
||||||
|
|
||||||
install(TARGETS gnucash-guile
|
install(TARGETS gnucash-guile
|
||||||
@ -139,7 +128,6 @@ gnc_add_scheme_targets(scm-engine-2
|
|||||||
add_custom_target(scm-engine ALL DEPENDS scm-engine-2 scm-engine-1 scm-engine-0)
|
add_custom_target(scm-engine ALL DEPENDS scm-engine-2 scm-engine-1 scm-engine-0)
|
||||||
|
|
||||||
set(scm_gnc_module_DEPENDS
|
set(scm_gnc_module_DEPENDS
|
||||||
gnc-module
|
|
||||||
gnucash-guile)
|
gnucash-guile)
|
||||||
|
|
||||||
gnc_add_scheme_targets(scm-gnc-module
|
gnc_add_scheme_targets(scm-gnc-module
|
||||||
|
@ -34,7 +34,6 @@ static int is_initialized = 0;
|
|||||||
|
|
||||||
extern SCM scm_init_sw_core_utils_module (void);
|
extern SCM scm_init_sw_core_utils_module (void);
|
||||||
extern SCM scm_init_sw_engine_module (void);
|
extern SCM scm_init_sw_engine_module (void);
|
||||||
extern SCM scm_init_sw_gnc_module_module (void);
|
|
||||||
|
|
||||||
void
|
void
|
||||||
gnc_guile_bindings_init(void)
|
gnc_guile_bindings_init(void)
|
||||||
@ -44,7 +43,6 @@ gnc_guile_bindings_init(void)
|
|||||||
/* Do what's necessary to initialize the bindings */
|
/* Do what's necessary to initialize the bindings */
|
||||||
scm_init_sw_core_utils_module();
|
scm_init_sw_core_utils_module();
|
||||||
scm_init_sw_engine_module();
|
scm_init_sw_engine_module();
|
||||||
scm_init_sw_gnc_module_module();
|
|
||||||
|
|
||||||
is_initialized = 1;
|
is_initialized = 1;
|
||||||
}
|
}
|
||||||
|
@ -27,23 +27,50 @@
|
|||||||
|
|
||||||
(define-module (gnucash gnc-module))
|
(define-module (gnucash gnc-module))
|
||||||
|
|
||||||
;; Guile 2 needs to find the symbols from the extension at compile time already
|
(define (no-op-deprecation-warning)
|
||||||
(eval-when
|
(issue-deprecation-warning "* WARNING * Guile wrappers for the gnc module system have been deprecated.")
|
||||||
(compile load eval expand)
|
(issue-deprecation-warning "This particular function call is now a no-op. Please use equivalent (use-modules ...) calls instead."))
|
||||||
(load-extension "libgnucash-guile" "gnc_guile_bindings_init"))
|
|
||||||
(use-modules (sw_gnc_module))
|
|
||||||
|
|
||||||
; Export the swig-wrapped symbols in the public interface of this module
|
(define-public (gnc:module-system-init)
|
||||||
(let ((i (module-public-interface (current-module))))
|
(no-op-deprecation-warning))
|
||||||
(module-use! i (resolve-interface '(sw_gnc_module))))
|
(define-public (gnc:module-system-refresh)
|
||||||
|
(no-op-deprecation-warning))
|
||||||
(define-public gnc:module-system-init gnc-module-system-init)
|
(define-public (gnc:module-load-optional)
|
||||||
(define-public gnc:module-system-refresh gnc-module-system-refresh)
|
(no-op-deprecation-warning))
|
||||||
(define-public gnc:module-load gnc-module-load)
|
(define-public (gnc:module-unload)
|
||||||
(define-public gnc:module-load-optional gnc-module-load-optional)
|
(no-op-deprecation-warning))
|
||||||
(define-public gnc:module-unload gnc-module-unload)
|
(define-public (gnc:module-load gnc-mod-name mod-sys-version)
|
||||||
|
(let* ((mod-name-split (string-split gnc-mod-name #\/))
|
||||||
;; Guile 2 needs to load external modules at compile time
|
(mod-name-str (string-join mod-name-split " "))
|
||||||
(define-syntax-rule (gnc:module-begin-syntax form ...)
|
(scm-mod-name (map string->symbol mod-name-split)))
|
||||||
(eval-when (load compile eval expand) (begin form ...)))
|
(cond
|
||||||
(export gnc:module-begin-syntax)
|
((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))))))
|
||||||
|
@ -1,9 +1,5 @@
|
|||||||
# C(++) tests requiring a proper guile environment set up
|
# C(++) tests requiring a proper guile environment set up
|
||||||
|
|
||||||
add_subdirectory(mod-foo)
|
|
||||||
add_subdirectory(mod-bar)
|
|
||||||
add_subdirectory(mod-baz)
|
|
||||||
|
|
||||||
set(ENGINE_TEST_INCLUDE_DIRS
|
set(ENGINE_TEST_INCLUDE_DIRS
|
||||||
${CMAKE_SOURCE_DIR}/libgnucash/backend/xml
|
${CMAKE_SOURCE_DIR}/libgnucash/backend/xml
|
||||||
${CMAKE_SOURCE_DIR}/libgnucash/engine
|
${CMAKE_SOURCE_DIR}/libgnucash/engine
|
||||||
@ -115,43 +111,6 @@ if (HAVE_SRFI64)
|
|||||||
|
|
||||||
endif (HAVE_SRFI64)
|
endif (HAVE_SRFI64)
|
||||||
|
|
||||||
|
|
||||||
set (test_gnc_module_SCHEME
|
|
||||||
test-gnc-module-scm-init.scm
|
|
||||||
test-gnc-module-load-scm.scm
|
|
||||||
test-gnc-module-swigged-c.scm
|
|
||||||
test-gnc-module-load-deps.scm
|
|
||||||
test-gnc-module-scm-dynload.scm
|
|
||||||
test-gnc-module-scm-module.scm
|
|
||||||
test-gnc-module-scm-multi.scm
|
|
||||||
)
|
|
||||||
|
|
||||||
set (test_gnc_module_DEPENDS
|
|
||||||
scm-gnc-module
|
|
||||||
scm-test-core
|
|
||||||
scm-mod-foo
|
|
||||||
gncmod-bar
|
|
||||||
scm-mod-baz
|
|
||||||
)
|
|
||||||
|
|
||||||
gnc_add_scheme_test_targets (test-gnc-modules-scm
|
|
||||||
"${test_gnc_module_SCHEME}"
|
|
||||||
"tests"
|
|
||||||
"${test_gnc_module_DEPENDS}"
|
|
||||||
TRUE
|
|
||||||
)
|
|
||||||
gnc_add_scheme_tests ("${test_gnc_module_SCHEME}")
|
|
||||||
if(NOT WIN32)
|
|
||||||
# This little dance is needed because gnc_module_init will assert if
|
|
||||||
# it finds libgncmod-futuremod.so outside of a test that expects it.
|
|
||||||
get_guile_env()
|
|
||||||
set(_GNC_MODULE_PATH "${LIBDIR_BUILD}:${LIBDIR_BUILD}/gnucash:${LIBDIR_BUILD}/gnucash/test")
|
|
||||||
foreach(test_file ${test_gnc_module_SCHEME})
|
|
||||||
get_filename_component(basename ${test_file} NAME_WE)
|
|
||||||
set_tests_properties(${basename} PROPERTIES ENVIRONMENT "${GUILE_ENV};GNC_MODULE_PATH=${_GNC_MODULE_PATH}")
|
|
||||||
endforeach()
|
|
||||||
endif()
|
|
||||||
|
|
||||||
set(test_engine_SCHEME_DIST
|
set(test_engine_SCHEME_DIST
|
||||||
srfi64-extras.scm
|
srfi64-extras.scm
|
||||||
${bindings_test_SCHEME}
|
${bindings_test_SCHEME}
|
||||||
@ -164,14 +123,10 @@ set_local_dist(test_guile_DIST_local
|
|||||||
CMakeLists.txt
|
CMakeLists.txt
|
||||||
test-scm-query.cpp
|
test-scm-query.cpp
|
||||||
${test_engine_SCHEME_DIST}
|
${test_engine_SCHEME_DIST}
|
||||||
${test_gnc_module_SCHEME}
|
|
||||||
${test_scm_SCHEME}
|
${test_scm_SCHEME}
|
||||||
)
|
)
|
||||||
set(test_guile_DIST
|
set(test_guile_DIST
|
||||||
${test_guile_DIST_local}
|
${test_guile_DIST_local}
|
||||||
${mod_bar_DIST}
|
|
||||||
${mod_baz_DIST}
|
|
||||||
${mod_foo_DIST}
|
|
||||||
PARENT_SCOPE
|
PARENT_SCOPE
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -1,35 +0,0 @@
|
|||||||
|
|
||||||
gnc_add_swig_guile_command (swig-bar-c
|
|
||||||
SWIG_BAR_C swig-bar.c
|
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}/bar.i "" bar.h
|
|
||||||
)
|
|
||||||
|
|
||||||
add_library(bar EXCLUDE_FROM_ALL bar.c bar.h)
|
|
||||||
add_library(gncmod-bar EXCLUDE_FROM_ALL gnc-mod-bar.c)
|
|
||||||
set_source_files_properties (gnc-mod-bar.c PROPERTY OBJECT_DEPENDS ${SWIG_BAR_C})
|
|
||||||
|
|
||||||
target_link_libraries(gncmod-bar bar gnc-module)
|
|
||||||
target_include_directories(gncmod-bar PRIVATE
|
|
||||||
${CMAKE_BINARY_DIR}/common
|
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}
|
|
||||||
${CMAKE_CURRENT_BINARY_DIR}
|
|
||||||
${CMAKE_SOURCE_DIR}/common
|
|
||||||
${CMAKE_SOURCE_DIR}/libgnucash/gnc-module
|
|
||||||
${GLIB2_INCLUDE_DIRS}
|
|
||||||
${GUILE_INCLUDE_DIRS}
|
|
||||||
)
|
|
||||||
|
|
||||||
gnc_add_scheme_test_targets(scm-mod-bar
|
|
||||||
gnucash/bar.scm
|
|
||||||
"tests/gnucash"
|
|
||||||
gncmod-bar
|
|
||||||
FALSE
|
|
||||||
)
|
|
||||||
|
|
||||||
set_target_properties(bar gncmod-bar PROPERTIES
|
|
||||||
LIBRARY_OUTPUT_DIRECTORY ${LIBDIR_BUILD}/gnucash/test
|
|
||||||
ARCHIVE_OUTPUT_DIRECTORY ${LIBDIR_BUILD}/gnucash/test
|
|
||||||
RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin/test
|
|
||||||
)
|
|
||||||
|
|
||||||
set_dist_list(mod_bar_DIST CMakeLists.txt bar.c gnucash/bar.scm bar.h bar.i gnc-mod-bar.c)
|
|
@ -1,33 +0,0 @@
|
|||||||
/* libfoo. this is a dependency-free client library, equivalent to
|
|
||||||
* the engine or some other core component that's ignorant of guile
|
|
||||||
* and the module system */
|
|
||||||
/********************************************************************\
|
|
||||||
* 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 *
|
|
||||||
* *
|
|
||||||
\********************************************************************/
|
|
||||||
|
|
||||||
|
|
||||||
#include <stdio.h>
|
|
||||||
|
|
||||||
#include "bar.h"
|
|
||||||
|
|
||||||
int
|
|
||||||
bar_hello(void)
|
|
||||||
{
|
|
||||||
return 1;
|
|
||||||
}
|
|
@ -1,28 +0,0 @@
|
|||||||
/* bar.h: header for a dependency-free, guile-free client lib */
|
|
||||||
/********************************************************************\
|
|
||||||
* 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 *
|
|
||||||
* *
|
|
||||||
\********************************************************************/
|
|
||||||
|
|
||||||
|
|
||||||
#ifndef BAR_H
|
|
||||||
#define BAR_H
|
|
||||||
|
|
||||||
int bar_hello(void);
|
|
||||||
|
|
||||||
#endif
|
|
@ -1,33 +0,0 @@
|
|||||||
/********************************************************************\
|
|
||||||
* 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 *
|
|
||||||
* *
|
|
||||||
\********************************************************************/
|
|
||||||
|
|
||||||
%module sw_bar
|
|
||||||
%{
|
|
||||||
#include <bar.h>
|
|
||||||
%}
|
|
||||||
#if defined(SWIGGUILE)
|
|
||||||
%{
|
|
||||||
#include "guile-mappings.h"
|
|
||||||
|
|
||||||
SCM scm_init_sw_bar_module (void);
|
|
||||||
%}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
int bar_hello(void);
|
|
@ -1,63 +0,0 @@
|
|||||||
/* gnc-mod-bar.c : the Gnucash plugin that wraps the library
|
|
||||||
* 'libbar.so'. it does this by being linked against libbar.so */
|
|
||||||
/********************************************************************\
|
|
||||||
* 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 *
|
|
||||||
* *
|
|
||||||
\********************************************************************/
|
|
||||||
|
|
||||||
|
|
||||||
#include <config.h>
|
|
||||||
#include <stdio.h>
|
|
||||||
#include <gmodule.h>
|
|
||||||
#include <libguile.h>
|
|
||||||
|
|
||||||
#include "gnc-module-api.h"
|
|
||||||
#include "swig-bar.c"
|
|
||||||
|
|
||||||
GNC_MODULE_API_DECL(libgncmod_bar)
|
|
||||||
|
|
||||||
int libgncmod_bar_gnc_module_system_interface = 0;
|
|
||||||
|
|
||||||
int libgncmod_bar_gnc_module_current = 0;
|
|
||||||
int libgncmod_bar_gnc_module_age = 0;
|
|
||||||
int libgncmod_bar_gnc_module_revision = 0;
|
|
||||||
|
|
||||||
char *
|
|
||||||
libgncmod_bar_gnc_module_path(void)
|
|
||||||
{
|
|
||||||
return g_strdup("gnucash/bar");
|
|
||||||
}
|
|
||||||
|
|
||||||
char *
|
|
||||||
libgncmod_bar_gnc_module_description(void)
|
|
||||||
{
|
|
||||||
return g_strdup("this is a bar module");
|
|
||||||
}
|
|
||||||
|
|
||||||
int
|
|
||||||
libgncmod_bar_gnc_module_init(int refcount)
|
|
||||||
{
|
|
||||||
/* publish the wrapped Scheme bindings for libbar */
|
|
||||||
scm_init_sw_bar_module();
|
|
||||||
scm_c_eval_string("(use-modules (sw_bar))");
|
|
||||||
|
|
||||||
/* use the Scheme "bar" module */
|
|
||||||
scm_c_eval_string("(use-modules (gnucash bar))");
|
|
||||||
|
|
||||||
return TRUE;
|
|
||||||
}
|
|
@ -1,31 +0,0 @@
|
|||||||
;; test of a Scheme module called gnc-mod-bar, which should get
|
|
||||||
;; loaded by the Gnucash module "bar"
|
|
||||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
|
||||||
;; 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 bar))
|
|
||||||
|
|
||||||
(export bar:scheme-hello)
|
|
||||||
|
|
||||||
(define (bar:scheme-hello)
|
|
||||||
#t)
|
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -1,40 +0,0 @@
|
|||||||
|
|
||||||
gnc_add_swig_guile_command (swig-baz-c
|
|
||||||
SWIG_BAZ_C swig-baz.c
|
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}/baz.i "" baz.h
|
|
||||||
)
|
|
||||||
|
|
||||||
add_library(baz EXCLUDE_FROM_ALL baz.c baz.h)
|
|
||||||
target_include_directories(baz PRIVATE
|
|
||||||
${CMAKE_SOURCE_DIR}/bindings/guile/test/mod-foo
|
|
||||||
)
|
|
||||||
target_link_libraries(baz foo)
|
|
||||||
|
|
||||||
|
|
||||||
add_library(gncmod-baz EXCLUDE_FROM_ALL gnc-mod-baz.c)
|
|
||||||
set_source_files_properties (gnc-mod-baz.c PROPERTY OBJECT_DEPENDS ${SWIG_BAZ_C})
|
|
||||||
|
|
||||||
target_link_libraries(gncmod-baz baz gnc-module)
|
|
||||||
target_include_directories(gncmod-baz PRIVATE
|
|
||||||
${CMAKE_BINARY_DIR}/common
|
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}
|
|
||||||
${CMAKE_CURRENT_BINARY_DIR}
|
|
||||||
${CMAKE_SOURCE_DIR}/common
|
|
||||||
${CMAKE_SOURCE_DIR}/libgnucash/gnc-module
|
|
||||||
${GLIB2_INCLUDE_DIRS}
|
|
||||||
${GUILE_INCLUDE_DIRS}
|
|
||||||
)
|
|
||||||
|
|
||||||
gnc_add_scheme_test_targets(scm-mod-baz
|
|
||||||
gnucash/baz.scm
|
|
||||||
"tests/gnucash"
|
|
||||||
gncmod-baz
|
|
||||||
FALSE
|
|
||||||
)
|
|
||||||
|
|
||||||
set_target_properties(baz gncmod-baz PROPERTIES
|
|
||||||
LIBRARY_OUTPUT_DIRECTORY ${LIBDIR_BUILD}/gnucash/test
|
|
||||||
ARCHIVE_OUTPUT_DIRECTORY ${LIBDIR_BUILD}/gnucash/test
|
|
||||||
RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin/test)
|
|
||||||
|
|
||||||
set_dist_list(mod_baz_DIST CMakeLists.txt baz.c gnucash/baz.scm baz.h baz.i gnc-mod-baz.c)
|
|
@ -1,34 +0,0 @@
|
|||||||
/* libbaz. this library depends on foo */
|
|
||||||
/********************************************************************\
|
|
||||||
* 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 *
|
|
||||||
* *
|
|
||||||
\********************************************************************/
|
|
||||||
|
|
||||||
|
|
||||||
#include <stdio.h>
|
|
||||||
|
|
||||||
#include "baz.h"
|
|
||||||
#include "foo.h"
|
|
||||||
|
|
||||||
int
|
|
||||||
baz_hello(void)
|
|
||||||
{
|
|
||||||
foo_hello();
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
|
|
@ -1,28 +0,0 @@
|
|||||||
/* baz.h: header for a dependency-free, guile-free client lib */
|
|
||||||
/********************************************************************\
|
|
||||||
* 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 *
|
|
||||||
* *
|
|
||||||
\********************************************************************/
|
|
||||||
|
|
||||||
|
|
||||||
#ifndef BAZ_H
|
|
||||||
#define BAZ_H
|
|
||||||
|
|
||||||
int baz_hello(void);
|
|
||||||
|
|
||||||
#endif
|
|
@ -1,33 +0,0 @@
|
|||||||
/********************************************************************\
|
|
||||||
* 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 *
|
|
||||||
* *
|
|
||||||
\********************************************************************/
|
|
||||||
|
|
||||||
%module sw_baz
|
|
||||||
%{
|
|
||||||
#include <baz.h>
|
|
||||||
%}
|
|
||||||
#if defined(SWIGGUILE)
|
|
||||||
%{
|
|
||||||
#include "guile-mappings.h"
|
|
||||||
|
|
||||||
SCM scm_init_sw_baz_module (void);
|
|
||||||
%}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
int baz_hello(void);
|
|
@ -1,72 +0,0 @@
|
|||||||
/* gnc-mod-baz.c : the Gnucash plugin that wraps the library
|
|
||||||
* 'libbaz.so'. it does this by being linked against libbaz.so */
|
|
||||||
/********************************************************************\
|
|
||||||
* 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 *
|
|
||||||
* *
|
|
||||||
\********************************************************************/
|
|
||||||
|
|
||||||
|
|
||||||
#include <config.h>
|
|
||||||
#include <stdio.h>
|
|
||||||
#include <gmodule.h>
|
|
||||||
#include <libguile.h>
|
|
||||||
|
|
||||||
#include "gnc-module.h"
|
|
||||||
#include "gnc-module-api.h"
|
|
||||||
#include "swig-baz.c"
|
|
||||||
|
|
||||||
GNC_MODULE_API_DECL(libgncmod_baz)
|
|
||||||
|
|
||||||
int libgncmod_baz_gnc_module_system_interface = 0;
|
|
||||||
|
|
||||||
int libgncmod_baz_gnc_module_current = 0;
|
|
||||||
int libgncmod_baz_gnc_module_age = 0;
|
|
||||||
int libgncmod_baz_gnc_module_revision = 0;
|
|
||||||
|
|
||||||
char *
|
|
||||||
libgncmod_baz_gnc_module_path(void)
|
|
||||||
{
|
|
||||||
return g_strdup("gnucash/baz");
|
|
||||||
}
|
|
||||||
|
|
||||||
char *
|
|
||||||
libgncmod_baz_gnc_module_description(void)
|
|
||||||
{
|
|
||||||
return g_strdup("this is the baz module");
|
|
||||||
}
|
|
||||||
|
|
||||||
int
|
|
||||||
libgncmod_baz_gnc_module_init(int refcount)
|
|
||||||
{
|
|
||||||
/* load libfoo */
|
|
||||||
if (gnc_module_load("gnucash/foo", 0))
|
|
||||||
{
|
|
||||||
/* publish the wrapped Scheme bindings for libbaz */
|
|
||||||
scm_init_sw_baz_module();
|
|
||||||
scm_c_eval_string("(use-modules (sw_baz))");
|
|
||||||
|
|
||||||
/* use the Scheme "baz" module */
|
|
||||||
scm_c_eval_string("(use-modules (gnucash baz))");
|
|
||||||
|
|
||||||
return TRUE;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
return FALSE;
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,31 +0,0 @@
|
|||||||
;; test of a Scheme module called gnc-mod-baz, which should get
|
|
||||||
;; loaded by the Gnucash module "baz"
|
|
||||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
|
||||||
;; 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 baz))
|
|
||||||
|
|
||||||
(export baz:scheme-hello)
|
|
||||||
|
|
||||||
(define (baz:scheme-hello)
|
|
||||||
#t)
|
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -1,34 +0,0 @@
|
|||||||
|
|
||||||
gnc_add_swig_guile_command (swig-foo-c
|
|
||||||
SWIG_FOO_C swig-foo.c
|
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}/foo.i "" foo.h
|
|
||||||
)
|
|
||||||
|
|
||||||
add_library(foo EXCLUDE_FROM_ALL foo.c foo.h)
|
|
||||||
add_library(gncmod-foo EXCLUDE_FROM_ALL gnc-mod-foo.c)
|
|
||||||
set_source_files_properties (gnc-mod-foo.c PROPERTY OBJECT_DEPENDS ${SWIG_FOO_C})
|
|
||||||
|
|
||||||
target_link_libraries(gncmod-foo foo gnc-module)
|
|
||||||
target_include_directories(gncmod-foo PRIVATE
|
|
||||||
${CMAKE_BINARY_DIR}/common
|
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}
|
|
||||||
${CMAKE_CURRENT_BINARY_DIR}
|
|
||||||
${CMAKE_SOURCE_DIR}/common
|
|
||||||
${CMAKE_SOURCE_DIR}/libgnucash/gnc-module
|
|
||||||
${GLIB2_INCLUDE_DIRS}
|
|
||||||
${GUILE_INCLUDE_DIRS}
|
|
||||||
)
|
|
||||||
|
|
||||||
gnc_add_scheme_test_targets(scm-mod-foo
|
|
||||||
gnucash/foo.scm
|
|
||||||
"tests/gnucash"
|
|
||||||
gncmod-foo
|
|
||||||
FALSE
|
|
||||||
)
|
|
||||||
|
|
||||||
set_target_properties(foo gncmod-foo PROPERTIES
|
|
||||||
LIBRARY_OUTPUT_DIRECTORY ${LIBDIR_BUILD}/gnucash/test
|
|
||||||
ARCHIVE_OUTPUT_DIRECTORY ${LIBDIR_BUILD}/gnucash/test
|
|
||||||
RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin/test)
|
|
||||||
|
|
||||||
set_dist_list(mod_foo_DIST CMakeLists.txt foo.i gnucash/foo.scm foo.c foo.h gnc-mod-foo.c)
|
|
@ -1,33 +0,0 @@
|
|||||||
/* libfoo. this is a dependency-free client library, equivalent to
|
|
||||||
* the engine or some other core component that's ignorant of guile
|
|
||||||
* and the module system */
|
|
||||||
/********************************************************************\
|
|
||||||
* 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 *
|
|
||||||
* *
|
|
||||||
\********************************************************************/
|
|
||||||
|
|
||||||
|
|
||||||
#include <stdio.h>
|
|
||||||
|
|
||||||
#include "foo.h"
|
|
||||||
|
|
||||||
int
|
|
||||||
foo_hello(void)
|
|
||||||
{
|
|
||||||
return 10;
|
|
||||||
}
|
|
@ -1,28 +0,0 @@
|
|||||||
/* foo.h: header for a dependency-free, guile-free client lib */
|
|
||||||
/********************************************************************\
|
|
||||||
* 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 *
|
|
||||||
* *
|
|
||||||
\********************************************************************/
|
|
||||||
|
|
||||||
|
|
||||||
#ifndef FOO_H
|
|
||||||
#define FOO_H
|
|
||||||
|
|
||||||
int foo_hello(void);
|
|
||||||
|
|
||||||
#endif
|
|
@ -1,33 +0,0 @@
|
|||||||
/********************************************************************\
|
|
||||||
* 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 *
|
|
||||||
* *
|
|
||||||
\********************************************************************/
|
|
||||||
|
|
||||||
%module sw_foo
|
|
||||||
%{
|
|
||||||
#include <foo.h>
|
|
||||||
%}
|
|
||||||
#if defined(SWIGGUILE)
|
|
||||||
%{
|
|
||||||
#include "guile-mappings.h"
|
|
||||||
|
|
||||||
SCM scm_init_sw_foo_module (void);
|
|
||||||
%}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
int foo_hello(void);
|
|
@ -1,63 +0,0 @@
|
|||||||
/* gnc-mod-foo.c : the Gnucash plugin that wraps the library
|
|
||||||
* 'libfoo.so'. it does this by being linked against libfoo.so */
|
|
||||||
/********************************************************************\
|
|
||||||
* 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 *
|
|
||||||
* *
|
|
||||||
\********************************************************************/
|
|
||||||
|
|
||||||
|
|
||||||
#include <config.h>
|
|
||||||
#include <stdio.h>
|
|
||||||
#include <gmodule.h>
|
|
||||||
#include <libguile.h>
|
|
||||||
|
|
||||||
#include "gnc-module-api.h"
|
|
||||||
#include "swig-foo.c"
|
|
||||||
|
|
||||||
GNC_MODULE_API_DECL(libgncmod_foo)
|
|
||||||
|
|
||||||
int libgncmod_foo_gnc_module_system_interface = 0;
|
|
||||||
|
|
||||||
int libgncmod_foo_gnc_module_current = 0;
|
|
||||||
int libgncmod_foo_gnc_module_age = 0;
|
|
||||||
int libgncmod_foo_gnc_module_revision = 0;
|
|
||||||
|
|
||||||
char *
|
|
||||||
libgncmod_foo_gnc_module_path(void)
|
|
||||||
{
|
|
||||||
return g_strdup("gnucash/foo");
|
|
||||||
}
|
|
||||||
|
|
||||||
char *
|
|
||||||
libgncmod_foo_gnc_module_description(void)
|
|
||||||
{
|
|
||||||
return g_strdup("this is a foo module");
|
|
||||||
}
|
|
||||||
|
|
||||||
int
|
|
||||||
libgncmod_foo_gnc_module_init(int refcount)
|
|
||||||
{
|
|
||||||
/* publish the wrapped Scheme bindings for libfoo */
|
|
||||||
scm_init_sw_foo_module();
|
|
||||||
scm_c_eval_string("(use-modules (sw_foo))");
|
|
||||||
|
|
||||||
/* use the Scheme "foo" module */
|
|
||||||
scm_c_eval_string("(use-modules (gnucash foo))");
|
|
||||||
|
|
||||||
return TRUE;
|
|
||||||
}
|
|
@ -1,31 +0,0 @@
|
|||||||
;; test of a Scheme module called gnc-mod-foo, which should get
|
|
||||||
;; loaded by the Gnucash module "foo"
|
|
||||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
|
||||||
;; 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 foo))
|
|
||||||
|
|
||||||
(export foo:scheme-hello)
|
|
||||||
|
|
||||||
(define (foo:scheme-hello)
|
|
||||||
#t)
|
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -20,12 +20,10 @@
|
|||||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||||
|
|
||||||
|
|
||||||
(use-modules (gnucash gnc-module))
|
|
||||||
(use-modules (gnucash engine))
|
(use-modules (gnucash engine))
|
||||||
|
|
||||||
(define (run-test)
|
(define (run-test)
|
||||||
(setenv "GNC_UNINSTALLED" "1")
|
(setenv "GNC_UNINSTALLED" "1")
|
||||||
(gnc:module-system-init)
|
|
||||||
|
|
||||||
(let* ((session (qof-session-new))
|
(let* ((session (qof-session-new))
|
||||||
(book (qof-session-get-book session))
|
(book (qof-session-get-book session))
|
||||||
|
@ -1,11 +0,0 @@
|
|||||||
(use-modules (gnucash gnc-module))
|
|
||||||
|
|
||||||
(gnc:module-system-init)
|
|
||||||
(gnc:module-load "gnucash/baz" 0)
|
|
||||||
|
|
||||||
(baz-hello)
|
|
||||||
(foo-hello)
|
|
||||||
(baz:scheme-hello)
|
|
||||||
(foo:scheme-hello)
|
|
||||||
|
|
||||||
(exit 0)
|
|
@ -1,6 +0,0 @@
|
|||||||
(use-modules (gnucash gnc-module))
|
|
||||||
|
|
||||||
(gnc:module-system-init)
|
|
||||||
(gnc:module-load "gnucash/foo" 0)
|
|
||||||
|
|
||||||
(exit 0)
|
|
@ -1,2 +0,0 @@
|
|||||||
(dynamic-link "libgnc-module")
|
|
||||||
(exit 0)
|
|
@ -1,5 +0,0 @@
|
|||||||
(use-modules (gnucash gnc-module))
|
|
||||||
|
|
||||||
(gnc:module-system-init)
|
|
||||||
|
|
||||||
(exit 0)
|
|
@ -1,6 +0,0 @@
|
|||||||
(use-modules (gnucash gnc-module))
|
|
||||||
|
|
||||||
(gnc:module-system-init)
|
|
||||||
(if (not (gnc:module-load "gnucash/foo" 0)) (exit -1))
|
|
||||||
|
|
||||||
(exit (foo:scheme-hello))
|
|
@ -1,14 +0,0 @@
|
|||||||
(use-modules (gnucash gnc-module))
|
|
||||||
|
|
||||||
(gnc:module-system-init)
|
|
||||||
(gnc:module-load "gnucash/foo" 0)
|
|
||||||
(foo-hello)
|
|
||||||
(foo:scheme-hello)
|
|
||||||
|
|
||||||
(gnc:module-load "gnucash/bar" 0)
|
|
||||||
(foo-hello)
|
|
||||||
(foo:scheme-hello)
|
|
||||||
(bar-hello)
|
|
||||||
(bar:scheme-hello)
|
|
||||||
|
|
||||||
(exit 0)
|
|
@ -1,5 +0,0 @@
|
|||||||
(use-modules (gnucash gnc-module))
|
|
||||||
|
|
||||||
(gnc:module-system-init)
|
|
||||||
(gnc:module-load "gnucash/foo" 0)
|
|
||||||
(exit (eq? 10 (foo-hello)))
|
|
@ -20,12 +20,10 @@
|
|||||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||||
|
|
||||||
|
|
||||||
(use-modules (gnucash gnc-module))
|
|
||||||
(use-modules (gnucash engine))
|
(use-modules (gnucash engine))
|
||||||
|
|
||||||
(define (run-test)
|
(define (run-test)
|
||||||
(setenv "GNC_UNINSTALLED" "1")
|
(setenv "GNC_UNINSTALLED" "1")
|
||||||
(gnc:module-system-init)
|
|
||||||
|
|
||||||
(display "\tTesting the Query Import interface... \n")
|
(display "\tTesting the Query Import interface... \n")
|
||||||
(display "\tYou may see \"Error: xaccQueryAddGUIDMatch: Invalid match type\".\n")
|
(display "\tYou may see \"Error: xaccQueryAddGUIDMatch: Invalid match type\".\n")
|
||||||
|
@ -32,9 +32,6 @@ function(get_guile_env)
|
|||||||
list(APPEND env "GUILE=${GUILE_EXECUTABLE}")
|
list(APPEND env "GUILE=${GUILE_EXECUTABLE}")
|
||||||
|
|
||||||
set(guile_load_paths "")
|
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}")
|
||||||
list(APPEND guile_load_paths "${CMAKE_BINARY_DIR}/${GUILE_REL_SITEDIR}/gnucash/deprecated") # Path to gnucash' deprecated modules
|
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}")
|
set(guile_load_path "${guile_load_paths}")
|
||||||
|
@ -1,14 +1,21 @@
|
|||||||
|
(define exit-code 0)
|
||||||
(setenv "GNC_UNINSTALLED" "1")
|
(setenv "GNC_UNINSTALLED" "1")
|
||||||
(use-modules (gnucash gnc-module))
|
|
||||||
(gnc:module-system-init)
|
|
||||||
|
|
||||||
(display " testing gnome-utils module load ... ")
|
(display " testing gnome-utils module load ... ")
|
||||||
(if (gnc:module-load "gnucash/gnome-utils" 0)
|
(use-modules (gnucash gnome-utils))
|
||||||
|
|
||||||
(begin
|
(cond
|
||||||
(display "ok\n")
|
((defined? 'gnc:make-menu)
|
||||||
(exit 0))
|
(display "Procedure gnc:make-menu found\n"))
|
||||||
(begin
|
(else
|
||||||
(display "failed\n")
|
(display "Failed - procedure gnc:make-menu not found\n")
|
||||||
(exit 1)))
|
(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)
|
||||||
|
@ -1,17 +1,21 @@
|
|||||||
(debug-enable 'backtrace)
|
(define exit-code 0)
|
||||||
|
(setenv "GNC_UNINSTALLED" "1")
|
||||||
(debug-set! stack 500000)
|
|
||||||
|
|
||||||
(display " testing report module load ... ")
|
(display " testing report module load ... ")
|
||||||
(setenv "GNC_UNINSTALLED" "1")
|
(use-modules (gnucash report))
|
||||||
(use-modules (gnucash gnc-module))
|
|
||||||
|
|
||||||
(gnc:module-system-init)
|
(cond
|
||||||
|
((defined? 'gnc:define-report)
|
||||||
|
(display "Procedure gnc:define-report found\n"))
|
||||||
|
(else
|
||||||
|
(display "Failed - procedure gnc:define-report not found\n")
|
||||||
|
(set! exit-code -1)))
|
||||||
|
|
||||||
(if (gnc:module-load "gnucash/report" 0)
|
(cond
|
||||||
(begin
|
((defined? 'gnc:make-html-chart)
|
||||||
(display "ok\n")
|
(display "Procedure gnc:make-html-chart found\n"))
|
||||||
(exit 0))
|
(else
|
||||||
(begin
|
(display "Failed - procedure gnc:make-html-chart not found\n")
|
||||||
(display "failed\n")
|
(set! exit-code -1)))
|
||||||
(exit -1)))
|
|
||||||
|
(exit exit-code)
|
||||||
|
Loading…
Reference in New Issue
Block a user