gnucash unstable: Multiple changes pushed
Geert Janssens
gjanssens at code.gnucash.org
Wed Dec 20 08:56:01 EST 2017
Updated via https://github.com/Gnucash/gnucash/commit/318f7ebc (commit)
via https://github.com/Gnucash/gnucash/commit/723b51a0 (commit)
via https://github.com/Gnucash/gnucash/commit/3d910ad2 (commit)
via https://github.com/Gnucash/gnucash/commit/a784dd57 (commit)
from https://github.com/Gnucash/gnucash/commit/76921b5e (commit)
commit 318f7ebc4fd97d727c8b49bc12758c6c7a9520f8
Author: Geert Janssens <geert at kobaltwit.be>
Date: Wed Dec 20 14:34:35 2017 +0100
Force build order on report system support files
Guile 2.2 is more picky about this than guile 2.0 was.
diff --git a/gnucash/report/report-system/CMakeLists.txt b/gnucash/report/report-system/CMakeLists.txt
index 72eeb83..d97f5be 100644
--- a/gnucash/report/report-system/CMakeLists.txt
+++ b/gnucash/report/report-system/CMakeLists.txt
@@ -52,9 +52,12 @@ SET (report_system_SCHEME
eguile-html-utilities.scm
)
-SET (report_system_SCHEME_2
+SET (report_system_SCHEME_2a
collectors.scm
list-extras.scm
+)
+
+SET (report_system_SCHEME_2b
report-collectors.scm
)
@@ -87,17 +90,24 @@ GNC_ADD_SCHEME_TARGETS(scm-report-system
FALSE
)
-GNC_ADD_SCHEME_TARGETS(scm-report-system-2
- "${report_system_SCHEME_2}"
+GNC_ADD_SCHEME_TARGETS(scm-report-system-2a
+ "${report_system_SCHEME_2a}"
"gnucash/report/report-system"
scm-report-system
FALSE
)
+GNC_ADD_SCHEME_TARGETS(scm-report-system-2b
+ "${report_system_SCHEME_2b}"
+ "gnucash/report/report-system"
+ scm-report-system-2a
+ FALSE
+)
+
GNC_ADD_SCHEME_TARGETS(scm-report-system-3
"${report_system_SCHEME_3}"
""
- scm-report-system-2
+ scm-report-system-2b
FALSE
)
commit 723b51a06d7e8028349d1a3f81badc32ea0befa3
Author: Geert Janssens <geert at kobaltwit.be>
Date: Tue Dec 19 23:28:47 2017 +0100
Add unit test for rewritten scheme error handlers
diff --git a/libgnucash/app-utils/test/CMakeLists.txt b/libgnucash/app-utils/test/CMakeLists.txt
index faa1e68..c455423 100644
--- a/libgnucash/app-utils/test/CMakeLists.txt
+++ b/libgnucash/app-utils/test/CMakeLists.txt
@@ -28,6 +28,7 @@ GNC_ADD_TEST_WITH_GUILE(test-scm-query-string test-scm-query-string.cpp
ADD_APP_UTILS_TEST(test-sx test-sx.cpp)
SET(GUILE_DEPENDS
+ scm-test-engine
scm-app-utils
gnc-core-utils
gnc-module
@@ -36,6 +37,11 @@ SET(GUILE_DEPENDS
gncmod-backend-xml
)
+set(test_app_utils_scheme_SOURCES
+ test-c-interface.scm
+ test-load-app-utils-module.scm
+)
+
GNC_ADD_SCHEME_TARGETS(scm-test-load-app-utils-module
"test-load-app-utils-module.scm"
"gnucash/reports"
@@ -43,7 +49,14 @@ GNC_ADD_SCHEME_TARGETS(scm-test-load-app-utils-module
FALSE
)
-GNC_ADD_SCHEME_TESTS("test-load-app-utils-module.scm")
+GNC_ADD_SCHEME_TARGETS(scm-test-c-interface
+ "test-c-interface.scm"
+ ""
+ "${GUILE_DEPENDS}"
+ FALSE
+)
+
+GNC_ADD_SCHEME_TESTS(${test_app_utils_scheme_SOURCES})
# Doesn't work yet:
GNC_ADD_TEST_WITH_GUILE(test-app-utils "${test_app_utils_SOURCES}" APP_UTILS_TEST_INCLUDE_DIRS APP_UTILS_TEST_LIBS)
@@ -56,6 +69,7 @@ SET_DIST_LIST(test_app_utils_DIST
test-print-queries.cpp
test-scm-query-string.cpp
test-sx.cpp
- test-load-app-utils-module.scm
+ test-c-interface.scm
+ ${test_app_utils_scheme_SOURCES}
${test_app_utils_SOURCES}
)
diff --git a/libgnucash/app-utils/test/Makefile.am b/libgnucash/app-utils/test/Makefile.am
index 5380cc3..3ebb930 100644
--- a/libgnucash/app-utils/test/Makefile.am
+++ b/libgnucash/app-utils/test/Makefile.am
@@ -16,11 +16,14 @@ test_scm_query_string_SOURCES = test-scm-query-string.cpp
test_sx_SOURCES = test-sx.cpp
test_print_parse_amount_SOURCES = test-print-parse-amount.cpp
-GNC_TEST_DEPS = --gnc-module-dir ${top_builddir}/libgnucash/engine \
+GNC_TEST_DEPS = \
+ --gnc-module-dir ${top_builddir}/libgnucash/engine \
+ --gnc-module-dir ${top_builddir}/libgnucash/engine/test \
--gnc-module-dir ${top_builddir}/libgnucash/app-utils \
--guile-load-dir ${top_builddir}/libgnucash/core-utils \
--guile-load-dir ${top_builddir}/libgnucash/gnc-module \
--guile-load-dir ${top_builddir}/libgnucash/engine \
+ --guile-load-dir ${top_builddir}/libgnucash/engine/test \
--guile-load-dir ${top_builddir}/libgnucash/scm \
--guile-load-dir ${top_builddir}/libgnucash/app-utils \
--library-dir ${top_builddir}/libgnucash/core-utils \
@@ -74,7 +77,7 @@ test_app_utils_CXXFLAGS = \
-DTESTPROG=test_app_utils \
${GLIB_CFLAGS}
-SCM_TESTS = test-load-app-utils-module
+SCM_TESTS = test-load-app-utils-module test-c-interface
SCM_TEST_SRCS = $(SCM_TESTS:%=%.scm)
$(SCM_TESTS): %: $(srcdir)/%.scm Makefile
diff --git a/libgnucash/app-utils/test/test-c-interface.scm b/libgnucash/app-utils/test/test-c-interface.scm
new file mode 100644
index 0000000..f12cb1c
--- /dev/null
+++ b/libgnucash/app-utils/test/test-c-interface.scm
@@ -0,0 +1,45 @@
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+;; 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 at gnu.org
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+
+(setenv "GNC_UNINSTALLED" "1")
+(debug-set! stack 50000)
+(load-from-path "c-interface")
+(use-modules (gnucash engine test test-extras))
+
+(define (test-func a b)
+ (list (/ a b) 6))
+
+(define (run-test)
+ (and (test test-call-with-error-handling)
+ (test test-eval-string-with-error-handling)
+ (test test-apply-with-error-handling)))
+
+(define (test-call-with-error-handling)
+ (and (eq? #f (cadr (gnc:call-with-error-handling test-func (list 4 5))))
+ (eq? #f (cadr (gnc:call-with-error-handling "(test-func 4 5)" '())))
+ (eq? #f (car (gnc:call-with-error-handling test-func (list 4 0))))
+ (eq? #f (car (gnc:call-with-error-handling "(test-func 4 0)" '())))))
+
+(define (test-eval-string-with-error-handling)
+ (and (eq? #f (cadr (gnc:eval-string-with-error-handling "(test-func 4 5)")))
+ (eq? #f (car (gnc:eval-string-with-error-handling "(test-func 4 0)")))))
+
+(define (test-apply-with-error-handling)
+ (and (eq? #f (cadr (gnc:apply-with-error-handling test-func (list 4 5))))
+ (eq? #f (car (gnc:apply-with-error-handling test-func (list 4 0))))))
commit 3d910ad2b1c6bde3948e9fe7e22265408c4a1c02
Author: Geert Janssens <geert at kobaltwit.be>
Date: Tue Dec 19 23:13:01 2017 +0100
Drop guile 1.8 support
And with it all quirks we still had in the code to support that version.
diff --git a/CMakeLists.txt b/CMakeLists.txt
index c679753..05aff73 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -269,7 +269,7 @@ IF(BUILDING_FROM_VCS)
ENDIF()
# Find Guile and determine which version we are using.
-# Look for guile versions in this order: 2.2 > 2.0 > 1.8
+# Look for guile versions in this order: 2.2 > 2.0
# guile library and include dir
GNC_PKG_CHECK_MODULES (GUILE22 guile-2.2 QUIET)
@@ -302,19 +302,7 @@ ELSE(GUILE22_FOUND)
MESSAGE(STATUS "Using guile-2.0.x")
FIND_PROGRAM (GUILE_EXECUTABLE NAMES guile2.0 guile)
ELSE(GUILE2_FOUND)
-
- # look for guile 1.8
- GNC_PKG_CHECK_MODULES (GUILE1 guile-1.8>=1.8.8 QUIET)
- IF (NOT GUILE1_FOUND)
- MESSAGE (FATAL_ERROR "Neither guile 1.8 nor guile 2.0 were found GnuCash can't run without one of them. Ensure that one is installed and can be found with pgk-config.")
- ENDIF(NOT GUILE1_FOUND)
-
- SET(HAVE_GUILE1 TRUE)
- SET(GUILE_EFFECTIVE_VERSION 1.8)
- SET(GUILE_INCLUDE_DIRS ${GUILE1_INCLUDE_DIRS})
- SET(GUILE_LDFLAGS ${GUILE1_LDFLAGS})
- MESSAGE(STATUS "Using guile-1.8.x")
- FIND_PROGRAM (GUILE_EXECUTABLE NAMES guile1.8 guile)
+ MESSAGE (FATAL_ERROR "Neither guile 2.2 nor guile 2.0 were found GnuCash can't run without one of them. Ensure that one is installed and can be found with pgk-config.")
ENDIF(GUILE2_FOUND)
ENDIF(GUILE22_FOUND)
diff --git a/Makefile.am b/Makefile.am
index fc2aa8b..2823a0a 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -57,7 +57,6 @@ dist_doc_DATA = \
# CVS dirs.
EXTRA_DIST = \
- $(SWIG_DIST_FAIL) \
CMakeLists.txt \
cmake/cmake_uninstall.cmake.in \
cmake/README_CMAKE.txt \
@@ -174,14 +173,6 @@ distuninstallcheck_listfiles = \
#dist-hook: po/POTFILES.in
-# Make "make dist" fail if we have the wrong version of swig
-if SWIG_DIST_FAIL
-SWIG_DIST_FAIL = swig-dist-fail
-swig-dist-fail:
- @echo "You cannot build the dist with your version of swig"
- @exit 1
-endif
-
distcheck-hook:
@e=''; \
for X in `grep -v \# ${distdir}/po/POTFILES.in | sed 's/\[type:.*\]//'` ; do \
diff --git a/README b/README
index 642365f..3f479df 100644
--- a/README
+++ b/README
@@ -237,9 +237,8 @@ you'll need for the systems we know about:
current:
libgnome-dev
libwebkit-dev
- guile1.8
+ guile
libguile9-dev
- libguile9-slib
SuSE:
diff --git a/README.dependencies b/README.dependencies
index 56753b1..e2699ce 100644
--- a/README.dependencies
+++ b/README.dependencies
@@ -64,7 +64,7 @@ Libraries/Deps
-------- _______
glib2 2.40.0
gtk+3 3.14.0
-guile 1.8.5 or 2.0.0
+guile 2.2.0 or 2.0.0
libxml2 2.5.10
libxslt
ICU International Compnents for
diff --git a/common/CMakeLists.txt b/common/CMakeLists.txt
index 84ca246..c63e54f 100644
--- a/common/CMakeLists.txt
+++ b/common/CMakeLists.txt
@@ -10,8 +10,7 @@ SET(common_EXTRA_DIST
config.h.cmake.in
gnc-test-env.pl
guile-mappings.h
- platform.h
- swig-utf8.patch)
+ platform.h)
IF (BUILDING_FROM_VCS)
SET (SWIG_RUNTIME_H ${CMAKE_CURRENT_BINARY_DIR}/swig-runtime.h PARENT_SCOPE)
diff --git a/common/Makefile.am b/common/Makefile.am
index 07c4e9e..29c5b8e 100644
--- a/common/Makefile.am
+++ b/common/Makefile.am
@@ -39,5 +39,4 @@ EXTRA_DIST = \
gnc-test-env.pl \
guile-mappings.h \
platform.h \
- swig-utf8.patch \
CMakeLists.txt
diff --git a/common/cmake_modules/GncAddSchemeTargets.cmake b/common/cmake_modules/GncAddSchemeTargets.cmake
index ec6fc6f..befc367 100644
--- a/common/cmake_modules/GncAddSchemeTargets.cmake
+++ b/common/cmake_modules/GncAddSchemeTargets.cmake
@@ -54,8 +54,8 @@ FUNCTION(GNC_ADD_SCHEME_TARGETS _TARGET _SOURCE_FILES _OUTPUT_DIR _GUILE_DEPENDS
MAKE_UNIX_PATH(CMAKE_SOURCE_DIR)
ENDIF(MINGW64)
- # For guile 1, we simple link (or copy, for Windows) each source file to the dest directory
- IF(HAVE_GUILE1 OR MAKE_LINKS)
+ # If links are requested, we simple link (or copy, for Windows) each source file to the dest directory
+ IF(MAKE_LINKS)
SET(_LINK_DIR ${DATADIR_BUILD}/gnucash/scm/${_OUTPUT_DIR})
FILE(MAKE_DIRECTORY ${_LINK_DIR})
SET(_SCHEME_LINKS "")
@@ -74,30 +74,25 @@ FUNCTION(GNC_ADD_SCHEME_TARGETS _TARGET _SOURCE_FILES _OUTPUT_DIR _GUILE_DEPENDS
)
ENDIF()
ENDFOREACH(scheme_file)
- IF(HAVE_GUILE1)
- ADD_CUSTOM_TARGET(${_TARGET} ALL DEPENDS ${_SCHEME_LINKS})
- ELSE()
- ADD_CUSTOM_TARGET(${_TARGET}-links ALL DEPENDS ${_SCHEME_LINKS})
- ENDIF()
- ENDIF(HAVE_GUILE1 OR MAKE_LINKS)
+ ADD_CUSTOM_TARGET(${_TARGET}-links ALL DEPENDS ${_SCHEME_LINKS})
+ ENDIF(MAKE_LINKS)
- IF(HAVE_GUILE2)
- # Construct the guile source and compiled load paths
+ # Construct the guile source and compiled load paths
- SET(_GUILE_LOAD_PATH "${current_srcdir}"
- "${current_bindir}" "${CMAKE_BINARY_DIR}/libgnucash/scm") # to pick up generated build-config.scm
- SET(_GUILE_LOAD_COMPILED_PATH "${current_bindir}")
+ SET(_GUILE_LOAD_PATH "${current_srcdir}"
+ "${current_bindir}" "${CMAKE_BINARY_DIR}/libgnucash/scm") # to pick up generated build-config.scm
+ SET(_GUILE_LOAD_COMPILED_PATH "${current_bindir}")
- SET(_GUILE_CACHE_DIR ${LIBDIR_BUILD}/gnucash/scm/ccache/${GUILE_EFFECTIVE_VERSION})
- SET(_GUILE_LOAD_PATH "${current_srcdir}")
- IF (MAKE_LINKS)
+ SET(_GUILE_CACHE_DIR ${LIBDIR_BUILD}/gnucash/scm/ccache/${GUILE_EFFECTIVE_VERSION})
+ SET(_GUILE_LOAD_PATH "${current_srcdir}")
+ IF (MAKE_LINKS)
LIST(APPEND _GUILE_LOAD_PATH "${build_datadir}/gnucash/scm")
- ENDIF()
- SET(_GUILE_LOAD_COMPILED_PATH ${build_libdir}/gnucash/scm/ccache/${GUILE_EFFECTIVE_VERSION})
+ ENDIF()
+ SET(_GUILE_LOAD_COMPILED_PATH ${build_libdir}/gnucash/scm/ccache/${GUILE_EFFECTIVE_VERSION})
- SET(_TARGET_FILES "")
+ SET(_TARGET_FILES "")
- FOREACH(source_file ${_SOURCE_FILES})
+ FOREACH(source_file ${_SOURCE_FILES})
SET(guile_depends ${_GUILE_DEPENDS})
GET_FILENAME_COMPONENT(basename ${source_file} NAME_WE)
@@ -121,11 +116,11 @@ FUNCTION(GNC_ADD_SCHEME_TARGETS _TARGET _SOURCE_FILES _OUTPUT_DIR _GUILE_DEPENDS
SET(CMAKE_COMMAND_TMP ${CMAKE_COMMAND} -E env)
ENDIF()
IF (MINGW64)
- set(fpath "")
- foreach(dir $ENV{PATH})
- MAKE_UNIX_PATH(dir)
- set(fpath "${fpath}${dir}:")
- endforeach(dir)
+ set(fpath "")
+ foreach(dir $ENV{PATH})
+ MAKE_UNIX_PATH(dir)
+ set(fpath "${fpath}${dir}:")
+ endforeach(dir)
SET(LIBRARY_PATH "PATH=\"${build_bindir}:${fpath}\"")
ELSE (MINGW64)
SET (LIBRARY_PATH "LD_LIBRARY_PATH=${LIBDIR_BUILD}:${LIBDIR_BUILD}/gnucash:${_GUILE_LD_LIBRARY_PATH}")
@@ -135,7 +130,7 @@ FUNCTION(GNC_ADD_SCHEME_TARGETS _TARGET _SOURCE_FILES _OUTPUT_DIR _GUILE_DEPENDS
ENDIF (APPLE)
SET(_GNC_MODULE_PATH "")
IF(MINGW64)
- SET(_GNC_MODULE_PATH "${build_bindir}")
+ SET(_GNC_MODULE_PATH "${build_bindir}")
ELSE(MINGW64)
SET(_GNC_MODULE_PATH "${LIBDIR_BUILD}" "${LIBDIR_BUILD}/gnucash" "${GNC_MODULE_PATH}")
ENDIF(MINGW64)
@@ -144,31 +139,30 @@ FUNCTION(GNC_ADD_SCHEME_TARGETS _TARGET _SOURCE_FILES _OUTPUT_DIR _GUILE_DEPENDS
MAKE_UNIX_PATH_LIST(_GUILE_LD_LIBRARY_PATH)
MAKE_UNIX_PATH_LIST(_GNC_MODULE_PATH)
IF (__DEBUG)
- MESSAGE(" ")
- MESSAGE(" LIBRARY_PATH: ${LIBRARY_PATH}")
- MESSAGE(" GUILE_LOAD_PATH: ${_GUILE_LOAD_PATH}")
- MESSAGE(" GUILE_LOAD_COMPILED_PATH: ${_GUILE_LOAD_COMPILED_PATH}")
- MESSAGE(" GNC_MODULE_PATH: ${_GNC_MODULE_PATH}")
+ MESSAGE(" ")
+ MESSAGE(" LIBRARY_PATH: ${LIBRARY_PATH}")
+ MESSAGE(" GUILE_LOAD_PATH: ${_GUILE_LOAD_PATH}")
+ MESSAGE(" GUILE_LOAD_COMPILED_PATH: ${_GUILE_LOAD_COMPILED_PATH}")
+ MESSAGE(" GNC_MODULE_PATH: ${_GNC_MODULE_PATH}")
ENDIF(__DEBUG)
ADD_CUSTOM_COMMAND(
OUTPUT ${output_file}
COMMAND ${CMAKE_COMMAND_TMP}
- ${LIBRARY_PATH}
- GNC_UNINSTALLED=YES
- GNC_BUILDDIR=${CMAKE_BINARY_DIR}
- GUILE_LOAD_PATH=${_GUILE_LOAD_PATH}
- GUILE_LOAD_COMPILED_PATH=${_GUILE_LOAD_COMPILED_PATH}
- GNC_MODULE_PATH=${_GNC_MODULE_PATH}
- ${GUILE_EXECUTABLE} -e '\(@@ \(guild\) main\)' -s ${GUILD_EXECUTABLE} compile -o ${output_file} ${source_file_abs_path}
+ ${LIBRARY_PATH}
+ GNC_UNINSTALLED=YES
+ GNC_BUILDDIR=${CMAKE_BINARY_DIR}
+ GUILE_LOAD_PATH=${_GUILE_LOAD_PATH}
+ GUILE_LOAD_COMPILED_PATH=${_GUILE_LOAD_COMPILED_PATH}
+ GNC_MODULE_PATH=${_GNC_MODULE_PATH}
+ ${GUILE_EXECUTABLE} -e '\(@@ \(guild\) main\)' -s ${GUILD_EXECUTABLE} compile -o ${output_file} ${source_file_abs_path}
DEPENDS ${guile_depends}
MAIN_DEPENDENCY ${source_file_abs_path}
)
- ENDFOREACH(source_file)
- IF (__DEBUG)
- MESSAGE("TARGET_FILES are ${_TARGET_FILES}")
- ENDIF(__DEBUG)
- ADD_CUSTOM_TARGET(${_TARGET} ALL DEPENDS ${_TARGET_FILES})
- INSTALL(FILES ${_TARGET_FILES} DESTINATION ${SCHEME_INSTALLED_CACHE_DIR}/${_OUTPUT_DIR})
- ENDIF(HAVE_GUILE2)
+ ENDFOREACH(source_file)
+ IF (__DEBUG)
+ MESSAGE("TARGET_FILES are ${_TARGET_FILES}")
+ ENDIF(__DEBUG)
+ ADD_CUSTOM_TARGET(${_TARGET} ALL DEPENDS ${_TARGET_FILES})
+ INSTALL(FILES ${_TARGET_FILES} DESTINATION ${SCHEME_INSTALLED_CACHE_DIR}/${_OUTPUT_DIR})
INSTALL(FILES ${_SOURCE_FILES} DESTINATION ${SCHEME_INSTALLED_SOURCE_DIR}/${_OUTPUT_DIR})
ENDFUNCTION(GNC_ADD_SCHEME_TARGETS)
diff --git a/common/guile-mappings.h b/common/guile-mappings.h
index 9ec30b9..386b24b 100644
--- a/common/guile-mappings.h
+++ b/common/guile-mappings.h
@@ -19,15 +19,6 @@
#include <libguile.h> /* for SCM_MAJOR_VERSION etc */
-/* Give Guile 1.8 a 2.0-like interface */
-#if (SCM_MAJOR_VERSION < 2)
-# define scm_c_string_length scm_i_string_length
-#endif
-#ifndef scm_from_utf8_string
-# define scm_from_utf8_string scm_from_locale_string
-# define scm_to_utf8_string scm_to_locale_string
-#endif
-
/* Convenience macros */
#define scm_is_equal(obj1,obj2) scm_is_true(scm_equal_p(obj1,obj2))
diff --git a/common/swig-utf8.patch b/common/swig-utf8.patch
deleted file mode 100644
index 86a222a..0000000
--- a/common/swig-utf8.patch
+++ /dev/null
@@ -1,60 +0,0 @@
---- guile_scm_run.swg
-+++ guile_scm_run.swg
-@@ -41,10 +41,14 @@ typedef struct swig_guile_clientdata {
- SCM goops_class;
- } swig_guile_clientdata;
-
-+#if SCM_MAJOR_VERSION <= 2
-+#define scm_to_utf8_string scm_to_locale_string
-+#define scm_from_utf8_string scm_from_locale_string
-+#endif
- #define SWIG_scm2str(s) \
- SWIG_Guile_scm2newstr(s, NULL)
- #define SWIG_str02scm(str) \
-- str ? scm_from_locale_string(str) : SCM_BOOL_F
-+ str ? scm_from_utf8_string(str) : SCM_BOOL_F
- # define SWIG_malloc(size) \
- scm_malloc(size)
- # define SWIG_free(mem) \
-@@ -84,21 +88,13 @@ SWIGINTERN char *
- SWIG_Guile_scm2newstr(SCM str, size_t *len) {
- #define FUNC_NAME "SWIG_Guile_scm2newstr"
- char *ret;
-- char *tmp;
-- size_t l;
-
- SCM_ASSERT (scm_is_string(str), str, 1, FUNC_NAME);
-- l = scm_c_string_length(str);
-
-- ret = (char *) SWIG_malloc( (l + 1) * sizeof(char));
-+ ret = scm_to_utf8_string(str);
- if (!ret) return NULL;
-
-- tmp = scm_to_locale_string(str);
-- memcpy(ret, tmp, l);
-- free(tmp);
--
-- ret[l] = '\0';
-- if (len) *len = l;
-+ if (len) *len = strlen(ret) - 1;
- return ret;
- #undef FUNC_NAME
- }
-@@ -473,7 +469,7 @@ SWIG_Guile_GetArgs (SCM *dest, SCM rest,
- int num_args_passed = 0;
- for (i = 0; i<reqargs; i++) {
- if (!SCM_CONSP(rest))
-- scm_wrong_num_args(scm_from_locale_string(procname ? (char *) procname : "unknown procedure"));
-+ scm_wrong_num_args(scm_from_utf8_string(procname ? (char *) procname : "unknown procedure"));
- *dest++ = SCM_CAR(rest);
- rest = SCM_CDR(rest);
- num_args_passed++;
-@@ -486,7 +482,7 @@ SWIG_Guile_GetArgs (SCM *dest, SCM rest,
- for (; i<optargs; i++)
- *dest++ = SCM_UNDEFINED;
- if (!SCM_NULLP(rest))
-- scm_wrong_num_args(scm_from_locale_string(procname ? (char *) procname : "unknown procedure"));
-+ scm_wrong_num_args(scm_from_utf8_string(procname ? (char *) procname : "unknown procedure"));
- return num_args_passed;
- }
-
diff --git a/common/test-core/Makefile.am b/common/test-core/Makefile.am
index 30d5a98..b30af7d 100644
--- a/common/test-core/Makefile.am
+++ b/common/test-core/Makefile.am
@@ -28,13 +28,6 @@ swig-unittest-support-guile.c: unittest-support.i $(top_srcdir)/common/base-type
$(SWIG) -guile -Linkage module \
-I${top_srcdir}/common \
${AM_CPPFLAGS} -o $@ $<
-if ! OS_WIN32
-if ! SWIG_DIST_FAIL
- if ! `grep "define scm_from_utf8_string" $@ > /dev/null 2>&1`; then \
- patch $@ $(top_srcdir)/common/swig-utf8.patch; \
- fi
-endif
-endif
swig-unittest-support-python.c: unittest-support.i $(top_srcdir)/common/base-typemaps.i
$(SWIG) -python -Wall -Werror \
@@ -110,7 +103,6 @@ if ! OS_WIN32
touch .scm-links
endif
-if GNC_HAVE_GUILE_2
GUILE_COMPILE_ENV = \
--library-dir ${top_builddir}/common/test-core \
--library-dir ${top_builddir}/libgnucash/engine \
@@ -125,7 +117,6 @@ GUILE_COMPILE_ENV = \
gncscmmodcachedir = ${pkglibdir}/scm/ccache/@GUILE_EFFECTIVE_VERSION@/gnucash
gncscmmodcache_DATA = $(gncscmmod_DATA:.scm=.go)
-endif
clean-local:
$(RM) -rf gnucash
diff --git a/common/test-core/unittest-support.scm b/common/test-core/unittest-support.scm
index 80c9a3c..0525471 100644
--- a/common/test-core/unittest-support.scm
+++ b/common/test-core/unittest-support.scm
@@ -18,13 +18,9 @@
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(define-module (gnucash unittest-support))
-(cond-expand
- (guile-2
- (eval-when
+(eval-when
(compile load eval expand)
- (load-extension "libtest-core-guile" "scm_init_unittest_support_module")))
- (else
- (load-extension "libtest-core-guile" "scm_init_unittest_support_module")))
+ (load-extension "libtest-core-guile" "scm_init_unittest_support_module"))
(use-modules (unittest_support))
(re-export TestErrorStruct-log-level-set)
diff --git a/configure.ac b/configure.ac
index cdc0a5d..b3f1884 100644
--- a/configure.ac
+++ b/configure.ac
@@ -504,40 +504,38 @@ GUILE_EFFECTIVE_VERSION=0
# - determine GUILE_CFLAGS and GUILE_LIBS
AC_ARG_WITH([guile],
- AS_HELP_STRING([--with-guile=1.8|2.0|auto],
+ AS_HELP_STRING([--with-guile=2.2|2.0|auto],
[which guile version to compile against @<:@default: auto@:>@]),
[],
[with_guile=auto]
)
-AS_IF([test "$with_guile" = "2.0"],
+AS_IF([test "$with_guile" = "2.2"],
+ [PKG_CHECK_MODULES(GUILE, [guile-2.2 >= 2.2.0],
+ [GUILE_EFFECTIVE_VERSION=2.2])],
+ [test "$with_guile" = "2.0"],
[PKG_CHECK_MODULES(GUILE, [guile-2.0 >= 2.0.0],
- [GUILE_EFFECTIVE_VERSION=2.0
- AC_PATH_PROG([GUILD], guild)])],
- [test "$with_guile" = "1.8"],
- [PKG_CHECK_MODULES(GUILE, [guile-1.8 >= 1.8.5],
- [GUILE_EFFECTIVE_VERSION=1.8])],
+ [GUILE_EFFECTIVE_VERSION=2.0])],
[test "$with_guile" = "auto"],
- [PKG_CHECK_MODULES(GUILE, [guile-2.0 >= 2.0.0],
- [GUILE_EFFECTIVE_VERSION=2.0
- AC_PATH_PROG([GUILD], guild)],
- [PKG_CHECK_MODULES(GUILE, [guile-1.8 >= 1.8.5],
- [GUILE_EFFECTIVE_VERSION=1.8],
+ [PKG_CHECK_MODULES(GUILE, [guile-2.2 >= 2.2.0],
+ [GUILE_EFFECTIVE_VERSION=2.2],
+ [PKG_CHECK_MODULES(GUILE, [guile-2.0 >= 2.0.0],
+ [GUILE_EFFECTIVE_VERSION=2.0],
[GUILE_EFFECTIVE_VERSION=0])
])],
# else
[AC_MSG_ERROR([invalid guile version specified])]
)
+AC_PATH_PROG([GUILD], guild)
AS_IF([test "$GUILE_EFFECTIVE_VERSION" = "0"],
[AC_MSG_ERROR([
guile does not appear to be installed correctly, or is not in the
correct version range. Perhaps you have not installed the guile
- development packages? Gnucash requires at least version 1.8.5 to build.
+ development packages? Gnucash requires at least version 2.0.0 to build.
])]
)
-AM_CONDITIONAL(GNC_HAVE_GUILE_2, [test "$GUILE_EFFECTIVE_VERSION" = "2.0"])
AC_SUBST(GUILE_EFFECTIVE_VERSION)
AC_SUBST(GUILE, [`pwd`/gnc-guile])
@@ -553,48 +551,13 @@ the libtool(-ltdl) development package?])])
# version 2.0.10 of SWIG, because that's the first version that supports
# guile 2.
#
-# For a guile 1.8 build we accept an older version, but won't allow you
-# to build the dist because we need to apply a patch to the swig
-# generated files that needs to go into the release tarball. At that
-# point we don't know yet which version of guile will be used together
-# with that tarball so we have to prepare the tarball for guile 2
-# compatibility.
-#
if test "${BUILDING_FROM_VCS}" = yes
then
- AX_PKG_SWIG(2.0.10, [gnc_have_swig_2_0_10=yes], [gnc_have_swig_2_0_10=no])
-
- if test "${GUILE_EFFECTIVE_VERSION}" = "2.0"
- then
- if test "${gnc_have_swig_2_0_10}" = no
- then
- AC_MSG_ERROR([
- You are building from ${VCS_TYPE} but swig was not found or too old.
- To build gnucash you need at least swig version 2.0.10.
- ])
- fi
- else # using guile 1.8
- if test "${gnc_have_swig_2_0_10}" = no
- then
- AX_PKG_SWIG(1.3.31, [],
+ AX_PKG_SWIG(2.0.10, ,
[AC_MSG_ERROR([
You are building from ${VCS_TYPE} but swig was not found or too old.
- To build gnucash with guile 1.8 you need at least swig version 1.3.31.
- ])])
- fi
- fi
-
- # If we get here then we have an okay version to build locally.
- # Check if we can build dist (which always requires swig 2.0.10)
- if test "${gnc_have_swig_2_0_10}" = no
- then
- AC_MSG_WARN([You don't have SWIG 2.0.10 so you will not be able to "make dist"])
- fi
- AM_CONDITIONAL([SWIG_DIST_FAIL], test "${gnc_have_swig_2_0_10}" != yes)
-else
- # When building from tarball, all the prerequisites to build dist are already
- # met so make sure it's allowed
- AM_CONDITIONAL([SWIG_DIST_FAIL], test yes != yes)
+ To build gnucash you need at least swig version 2.0.10.
+ ])])
fi
### --------------------------------------------------------------------------
diff --git a/gnucash/gnome-utils/Makefile.am b/gnucash/gnome-utils/Makefile.am
index 0692968..2ed2bc2 100644
--- a/gnucash/gnome-utils/Makefile.am
+++ b/gnucash/gnome-utils/Makefile.am
@@ -222,13 +222,6 @@ swig-gnome-utils.c: gnome-utils.i \
${top_srcdir}/common/base-typemaps.i
$(SWIG) -guile -Linkage module \
-I${top_srcdir}/common -o $@ $<
-if ! OS_WIN32
-if ! SWIG_DIST_FAIL
- if ! `grep "define scm_from_utf8_string" $@ > /dev/null 2>&1`; then \
- patch $@ $(top_srcdir)/common/swig-utf8.patch; \
- fi
-endif
-endif
endif
gncscmmoddir = ${GNC_SCM_INSTALL_DIR}/gnucash
@@ -267,7 +260,6 @@ if ! OS_WIN32
touch .scm-links
endif
-if GNC_HAVE_GUILE_2
GUILE_COMPILE_ENV = \
--guile-load-dir ${top_builddir}/libgnucash/core-utils \
--guile-load-dir ${top_builddir}/libgnucash/gnc-module \
@@ -290,7 +282,6 @@ gncscmmodcache_DATA = $(gncscmmod_DATA:.scm=.go)
gncscmcachedir = ${pkglibdir}/scm/ccache/@GUILE_EFFECTIVE_VERSION@
gncscmcache_DATA = $(gncscm_DATA:.scm=.go)
-endif
noinst_DATA = .scm-links
clean-local:
diff --git a/gnucash/gnome-utils/gnome-utils.scm b/gnucash/gnome-utils/gnome-utils.scm
index a5a8c73..e165efc 100644
--- a/gnucash/gnome-utils/gnome-utils.scm
+++ b/gnucash/gnome-utils/gnome-utils.scm
@@ -22,12 +22,9 @@
(use-modules (gnucash main)) ;; FIXME: delete after we finish modularizing.
(use-modules (gnucash gnc-module))
-(cond-expand
- (guile-2
- (eval-when
+(eval-when
(compile load eval expand)
- (load-extension "libgncmod-gnome-utils" "scm_init_sw_gnome_utils_module")))
- (else ))
+ (load-extension "libgncmod-gnome-utils" "scm_init_sw_gnome_utils_module"))
(use-modules (sw_gnome_utils))
(gnc:module-load "gnucash/app-utils" 0)
diff --git a/gnucash/gnome/Makefile.am b/gnucash/gnome/Makefile.am
index 8fe2b65..b57eb2a 100644
--- a/gnucash/gnome/Makefile.am
+++ b/gnucash/gnome/Makefile.am
@@ -152,13 +152,6 @@ if BUILDING_FROM_VCS
swig-gnome.c: gnome.i dialog-progress.h ${top_srcdir}/common/base-typemaps.i
$(SWIG) -guile -Linkage module \
-I${top_srcdir}/common -o $@ $<
-if ! OS_WIN32
-if ! SWIG_DIST_FAIL
- if ! `grep "define scm_from_utf8_string" $@ > /dev/null 2>&1`; then \
- patch $@ $(top_srcdir)/common/swig-utf8.patch; \
- fi
-endif
-endif
endif
EXTRA_DIST = \
diff --git a/gnucash/html/Makefile.am b/gnucash/html/Makefile.am
index db57fd7..3fa8f68 100644
--- a/gnucash/html/Makefile.am
+++ b/gnucash/html/Makefile.am
@@ -57,13 +57,6 @@ swig-gnc-html.c: gnc-html.i gnc-html.h \
${top_srcdir}/common/base-typemaps.i
$(SWIG) -guile -Linkage module \
-I${top_srcdir}/common -o $@ $<
-if ! OS_WIN32
-if ! SWIG_DIST_FAIL
- if ! `grep "define scm_from_utf8_string" $@ > /dev/null 2>&1`; then \
- patch $@ $(top_srcdir)/common/swig-utf8.patch; \
- fi
-endif
-endif
endif
EXTRA_DIST = \
diff --git a/gnucash/import-export/qif-imp/Makefile.am b/gnucash/import-export/qif-imp/Makefile.am
index 6226701..894dff4 100644
--- a/gnucash/import-export/qif-imp/Makefile.am
+++ b/gnucash/import-export/qif-imp/Makefile.am
@@ -98,7 +98,6 @@ if ! OS_WIN32
touch .scm-links
endif
-if GNC_HAVE_GUILE_2
GUILE_COMPILE_ENV = \
--gnc-module-dir ${top_builddir}/libgnucash/engine \
--guile-load-dir ${top_builddir}/libgnucash/app-utils \
@@ -134,7 +133,6 @@ gncscmmodcache_DATA = $(gncscmmod_DATA:.scm=.go)
gncscmcachedir = ${pkglibdir}/scm/ccache/@GUILE_EFFECTIVE_VERSION@/qif-import
gncscmcache_DATA = $(gncscm_DATA:.scm=.go)
-endif
clean-local:
$(RM) -rf gnucash qif-import
diff --git a/gnucash/import-export/qif-imp/qif-import.scm b/gnucash/import-export/qif-imp/qif-import.scm
index ae4cf71..62b31d0 100644
--- a/gnucash/import-export/qif-imp/qif-import.scm
+++ b/gnucash/import-export/qif-imp/qif-import.scm
@@ -30,13 +30,9 @@
;; 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
-(cond-expand
- (guile-2
- (eval-when
+(eval-when
(compile load eval expand)
- (load-extension "libgnc-gnome" "scm_init_sw_gnome_module")))
- (else
- (load-extension "libgnc-gnome" "scm_init_sw_gnome_module")))
+ (load-extension "libgnc-gnome" "scm_init_sw_gnome_module"))
(use-modules (sw_gnome))
diff --git a/gnucash/report/business-reports/Makefile.am b/gnucash/report/business-reports/Makefile.am
index 3c08cf2..07bc62b 100644
--- a/gnucash/report/business-reports/Makefile.am
+++ b/gnucash/report/business-reports/Makefile.am
@@ -46,7 +46,6 @@ if ! OS_WIN32
touch .scm-links
endif
-if GNC_HAVE_GUILE_2
GUILE_COMPILE_ENV = \
--gnc-module-dir ${top_builddir}/libgnucash/app-utils \
--gnc-module-dir ${top_builddir}/libgnucash/engine \
@@ -81,7 +80,6 @@ GUILE_COMPILE_ENV = \
gncscmmodcachedir = ${pkglibdir}/scm/ccache/@GUILE_EFFECTIVE_VERSION@/gnucash/report
gncscmmodcache_DATA = $(gncscmmod_DATA:.scm=.go)
-endif
clean-local:
$(RM) -rf gnucash
diff --git a/gnucash/report/business-reports/balsheet-eg.scm b/gnucash/report/business-reports/balsheet-eg.scm
index 0050fa3..5df41b6 100644
--- a/gnucash/report/business-reports/balsheet-eg.scm
+++ b/gnucash/report/business-reports/balsheet-eg.scm
@@ -39,10 +39,7 @@
(use-modules (gnucash report eguile-utilities))
(use-modules (ice-9 regex)) ; for regular expressions
-(cond-expand
- (guile-2
- (use-modules (ice-9 local-eval))) ; for the-environment
- (else ))
+(use-modules (ice-9 local-eval)) ; for the-environment
(use-modules (srfi srfi-13)) ; for extra string functions
(gnc:module-load "gnucash/report/report-system" 0)
diff --git a/gnucash/report/business-reports/receipt.scm b/gnucash/report/business-reports/receipt.scm
index 4e69995..890510b 100644
--- a/gnucash/report/business-reports/receipt.scm
+++ b/gnucash/report/business-reports/receipt.scm
@@ -16,10 +16,7 @@
(define-module (gnucash report receipt))
-(cond-expand
- (guile-2
- (use-modules (ice-9 local-eval))) ; for the-environment
- (else ))
+(use-modules (ice-9 local-eval)) ; for the-environment
(use-modules (gnucash main))
(use-modules (gnucash gnc-module))
(use-modules (gnucash gettext))
diff --git a/gnucash/report/business-reports/taxinvoice.scm b/gnucash/report/business-reports/taxinvoice.scm
index dc864db..2417c6b 100644
--- a/gnucash/report/business-reports/taxinvoice.scm
+++ b/gnucash/report/business-reports/taxinvoice.scm
@@ -24,10 +24,7 @@
; (see http://wiki.gnucash.org/wiki/Custom_Reports )
(define-module (gnucash report taxinvoice))
-(cond-expand
- (guile-2
- (use-modules (ice-9 local-eval))) ; for the-environment
- (else ))
+(use-modules (ice-9 local-eval)) ; for the-environment
(use-modules (gnucash main))
(use-modules (gnucash gnc-module))
(use-modules (gnucash gettext))
diff --git a/gnucash/report/locale-specific/us/Makefile.am b/gnucash/report/locale-specific/us/Makefile.am
index 474e662..bcf84f6 100644
--- a/gnucash/report/locale-specific/us/Makefile.am
+++ b/gnucash/report/locale-specific/us/Makefile.am
@@ -51,7 +51,6 @@ if ! OS_WIN32
touch .scm-links
endif
-if GNC_HAVE_GUILE_2
GUILE_COMPILE_ENV = \
--gnc-module-dir ${top_builddir}/libgnucash/app-utils \
--gnc-module-dir ${top_builddir}/libgnucash/engine \
@@ -91,7 +90,6 @@ gncscmmodcache_DATA = $(gncscmmod_DATA:.scm=.go)
gncscmrptcachedir = ${pkglibdir}/scm/ccache/@GUILE_EFFECTIVE_VERSION@/gnucash/report/locale-specific
gncscmrptcache_DATA = $(gncscmrpt_DATA:.scm=.go)
-endif
clean-local:
$(RM) -rf gnucash
diff --git a/gnucash/report/locale-specific/us/taxtxf.scm b/gnucash/report/locale-specific/us/taxtxf.scm
index e339f2c..fe17aa9 100644
--- a/gnucash/report/locale-specific/us/taxtxf.scm
+++ b/gnucash/report/locale-specific/us/taxtxf.scm
@@ -97,12 +97,9 @@
(use-modules (gnucash gnc-module))
(use-modules (gnucash gettext))
-(cond-expand
- (guile-2
- (eval-when
+(eval-when
(compile load eval expand)
- (load-extension "libgncmod-gnome-utils" "scm_init_sw_gnome_utils_module")))
- (else ))
+ (load-extension "libgncmod-gnome-utils" "scm_init_sw_gnome_utils_module"))
(use-modules (sw_gnome_utils)) ;; to get to gnc-error-dialog
(use-modules (gnucash printf))
diff --git a/gnucash/report/report-gnome/Makefile.am b/gnucash/report/report-gnome/Makefile.am
index 38c11d7..88b945f 100644
--- a/gnucash/report/report-gnome/Makefile.am
+++ b/gnucash/report/report-gnome/Makefile.am
@@ -51,13 +51,6 @@ if BUILDING_FROM_VCS
swig-report-gnome.c: report-gnome.i ${top_srcdir}/common/base-typemaps.i
$(SWIG) -guile -Linkage module \
-I${top_srcdir}/common -o $@ $<
-if ! OS_WIN32
-if ! SWIG_DIST_FAIL
- if ! `grep "define scm_from_utf8_string" $@ > /dev/null 2>&1`; then \
- patch $@ $(top_srcdir)/common/swig-utf8.patch; \
- fi
-endif
-endif
endif
gncscmmoddir = ${GNC_SCM_INSTALL_DIR}/gnucash/report
@@ -103,7 +96,6 @@ if ! OS_WIN32
touch .scm-links
endif
-if GNC_HAVE_GUILE_2
GUILE_COMPILE_ENV = \
--gnc-module-dir ${top_builddir}/libgnucash/app-utils \
--gnc-module-dir ${top_builddir}/libgnucash/engine \
@@ -136,7 +128,6 @@ GUILE_COMPILE_ENV = \
gncscmmodcachedir = ${pkglibdir}/scm/ccache/@GUILE_EFFECTIVE_VERSION@/gnucash/report
gncscmmodcache_DATA = $(gncscmmod_DATA:.scm=.go)
-endif
clean-local:
rm -rf gnucash
diff --git a/gnucash/report/report-gnome/report-gnome.scm b/gnucash/report/report-gnome/report-gnome.scm
index 5f07220..48ecf45 100644
--- a/gnucash/report/report-gnome/report-gnome.scm
+++ b/gnucash/report/report-gnome/report-gnome.scm
@@ -33,13 +33,10 @@
(use-modules (gnucash printf))
-(cond-expand
- (guile-2
- (eval-when
+(eval-when
(compile load eval expand)
(load-extension "libgncmod-gnome-utils" "scm_init_sw_gnome_utils_module")
- (load-extension "libgncmod-report-gnome" "scm_init_sw_report_gnome_module")))
- (else ))
+ (load-extension "libgncmod-report-gnome" "scm_init_sw_report_gnome_module"))
(use-modules (sw_report_gnome))
(gnc:module-load "gnucash/gnome-utils" 0)
diff --git a/gnucash/report/report-gnome/test/test-load-report-gnome-module.scm b/gnucash/report/report-gnome/test/test-load-report-gnome-module.scm
index 5273082..85f07cd 100755
--- a/gnucash/report/report-gnome/test/test-load-report-gnome-module.scm
+++ b/gnucash/report/report-gnome/test/test-load-report-gnome-module.scm
@@ -9,13 +9,7 @@ exec ${GUILE} -s "$0"
(debug-set! maxdepth 100000))
(display " testing report module load ... ")
-(cond-expand
- (guile-2 )
- (else
- ;; Syncase is deprecated and redundant in guile 2
- (use-modules (ice-9 syncase))))
(use-modules (gnucash gnc-module))
-
(gnc:module-system-init)
(setenv "GNC_UNINSTALLED" "1")
diff --git a/gnucash/report/report-system/Makefile.am b/gnucash/report/report-system/Makefile.am
index 0cdeeef..d92f372 100644
--- a/gnucash/report/report-system/Makefile.am
+++ b/gnucash/report/report-system/Makefile.am
@@ -27,13 +27,6 @@ if BUILDING_FROM_VCS
swig-report-system.c: report-system.i ${top_srcdir}/common/base-typemaps.i
$(SWIG) -guile -Linkage module \
-I${top_srcdir}/common -o $@ $<
-if ! OS_WIN32
-if ! SWIG_DIST_FAIL
- if ! `grep "define scm_from_utf8_string" $@ > /dev/null 2>&1`; then \
- patch $@ $(top_srcdir)/common/swig-utf8.patch; \
- fi
-endif
-endif
endif
AM_CPPFLAGS = \
@@ -105,7 +98,6 @@ if ! OS_WIN32
touch .scm-links
endif
-if GNC_HAVE_GUILE_2
GUILE_COMPILE_ENV = \
--gnc-module-dir ${top_builddir}/libgnucash/app-utils \
--gnc-module-dir ${top_builddir}/libgnucash/engine \
@@ -143,7 +135,6 @@ gncmodscmcache_DATA = $(gncmodscm_DATA:.scm=.go)
gncscmcachedir = ${pkglibdir}/scm/ccache/@GUILE_EFFECTIVE_VERSION@
gncscmcache_DATA = $(gncscm_DATA:.scm=.go)
-endif
noinst_DATA = .scm-links
diff --git a/gnucash/report/report-system/eguile-gnc.scm b/gnucash/report/report-system/eguile-gnc.scm
index 38ea3c0..1f8a614 100644
--- a/gnucash/report/report-system/eguile-gnc.scm
+++ b/gnucash/report/report-system/eguile-gnc.scm
@@ -85,10 +85,7 @@
(use-modules (ice-9 regex)) ; for regular expressions
(use-modules (ice-9 rdelim)) ; for read-line
-(cond-expand
- (guile-2
- (use-modules (ice-9 local-eval))) ; for the-environment
- (else ))
+(use-modules (ice-9 local-eval)) ; for the-environment
(use-modules (gnucash printf))
(use-modules (gnucash app-utils)) ; for _
diff --git a/gnucash/report/report-system/eguile-utilities.scm b/gnucash/report/report-system/eguile-utilities.scm
index 5eb12e1..becf77b 100644
--- a/gnucash/report/report-system/eguile-utilities.scm
+++ b/gnucash/report/report-system/eguile-utilities.scm
@@ -32,15 +32,8 @@
(use-modules (gnucash core-utils))
(gnc:module-load "gnucash/report/report-system" 0)
(gnc:module-load "gnucash/app-utils" 0)
-; Syncase is deprecated and redundant in guile 2
-(cond-expand
- (guile-2 )
- (else
- (use-modules (ice-9 syncase)))) ; for define-syntax
-;(use-modules (srfi srfi-13)) ; for extra string functions
-
(define-public (fmtnumber n)
;; Format a number (integer or real) into something printable
(number->string (if (integer? n)
diff --git a/gnucash/report/report-system/report.scm b/gnucash/report/report-system/report.scm
index 6ec25d5..81dc90f 100644
--- a/gnucash/report/report-system/report.scm
+++ b/gnucash/report/report-system/report.scm
@@ -24,12 +24,9 @@
(use-modules (gnucash app-utils))
(use-modules (gnucash printf))
(use-modules (gnucash gettext))
-(cond-expand
- (guile-2
- (eval-when
+(eval-when
(compile load eval expand)
- (load-extension "libgncmod-report-system" "scm_init_sw_report_system_module")))
- (else ))
+ (load-extension "libgncmod-report-system" "scm_init_sw_report_system_module"))
(use-modules (sw_report_system))
;; Terminology in this file:
diff --git a/gnucash/report/report-system/test/test-load-report-system-module.scm b/gnucash/report/report-system/test/test-load-report-system-module.scm
index 0695190..b2158de 100755
--- a/gnucash/report/report-system/test/test-load-report-system-module.scm
+++ b/gnucash/report/report-system/test/test-load-report-system-module.scm
@@ -6,11 +6,6 @@
(display " testing report module load ... ")
(setenv "GNC_UNINSTALLED" "1")
-(cond-expand
- (guile-2 )
- (else
- ;; Syncase is deprecated and redundant in guile 2
- (use-modules (ice-9 syncase))))
(use-modules (gnucash gnc-module))
(gnc:module-system-init)
diff --git a/gnucash/report/standard-reports/Makefile.am b/gnucash/report/standard-reports/Makefile.am
index 7040d88..da43206 100644
--- a/gnucash/report/standard-reports/Makefile.am
+++ b/gnucash/report/standard-reports/Makefile.am
@@ -58,7 +58,6 @@ if ! OS_WIN32
touch .scm-links
endif
-if GNC_HAVE_GUILE_2
GUILE_COMPILE_ENV = \
--gnc-module-dir ${top_builddir}/libgnucash/app-utils \
--gnc-module-dir ${top_builddir}/libgnucash/engine \
@@ -94,7 +93,6 @@ gncscmmodcache_DATA = $(gncscmmod_DATA:.scm=.go)
gncscmrptcachedir = ${pkglibdir}/scm/ccache/@GUILE_EFFECTIVE_VERSION@/gnucash/report/standard-reports
gncscmrptcache_DATA = $(gncscmrpt_DATA:.scm=.go)
-endif
clean-local:
$(RM) -rf gnucash
diff --git a/gnucash/report/standard-reports/test/test-standard-net-linechart.scm b/gnucash/report/standard-reports/test/test-standard-net-linechart.scm
index 549ef11..d74387b 100644
--- a/gnucash/report/standard-reports/test/test-standard-net-linechart.scm
+++ b/gnucash/report/standard-reports/test/test-standard-net-linechart.scm
@@ -26,12 +26,8 @@
;; otherwise the N_ syntax-rule won't be found at compile time
;; causing the test to fail
;; That's what the wrapper below is meant for:
-(cond-expand
- (guile-2
- (define-syntax-rule (begin-for-syntax form ...)
- (eval-when (load compile eval expand) (begin form ...))))
- (else
- (define begin-for-syntax begin)))
+(define-syntax-rule (begin-for-syntax form ...)
+ (eval-when (load compile eval expand) (begin form ...)))
(begin-for-syntax (gnc:module-load "gnucash/report/report-system" 0))
(use-modules (gnucash engine))
diff --git a/gnucash/report/stylesheets/Makefile.am b/gnucash/report/stylesheets/Makefile.am
index 1de87a7..a33bc4f 100644
--- a/gnucash/report/stylesheets/Makefile.am
+++ b/gnucash/report/stylesheets/Makefile.am
@@ -62,7 +62,6 @@ if ! OS_WIN32
touch .scm-links
endif
-if GNC_HAVE_GUILE_2
GUILE_COMPILE_ENV = \
--gnc-module-dir ${top_builddir}/libgnucash/app-utils \
--gnc-module-dir ${top_builddir}/libgnucash/engine \
@@ -97,7 +96,6 @@ GUILE_COMPILE_ENV = \
gncscmmodcachedir = ${pkglibdir}/scm/ccache/@GUILE_EFFECTIVE_VERSION@/gnucash/report
gncscmmodcache_DATA = $(gncscmmod_DATA:.scm=.go)
-endif
clean-local:
$(RM) -rf gnucash
diff --git a/gnucash/report/utility-reports/Makefile.am b/gnucash/report/utility-reports/Makefile.am
index 289ef72..f5df74d 100644
--- a/gnucash/report/utility-reports/Makefile.am
+++ b/gnucash/report/utility-reports/Makefile.am
@@ -28,7 +28,6 @@ if ! OS_WIN32
touch .scm-links
endif
-if GNC_HAVE_GUILE_2
GUILE_COMPILE_ENV = \
--gnc-module-dir ${top_builddir}/libgnucash/app-utils \
--gnc-module-dir ${top_builddir}/libgnucash/engine \
@@ -61,7 +60,6 @@ GUILE_COMPILE_ENV = \
gncscmmodcachedir = ${pkglibdir}/scm/ccache/@GUILE_EFFECTIVE_VERSION@/gnucash/report
gncscmmodcache_DATA = $(gncscmmod_DATA:.scm=.go)
-endif
clean-local:
$(RM) -rf gnucash
diff --git a/gnucash/report/utility-reports/view-column.scm b/gnucash/report/utility-reports/view-column.scm
index ba4be79..dd521a1 100644
--- a/gnucash/report/utility-reports/view-column.scm
+++ b/gnucash/report/utility-reports/view-column.scm
@@ -31,12 +31,9 @@
(use-modules (gnucash app-utils))
(use-modules (gnucash gnc-module))
(use-modules (gnucash gettext))
-(cond-expand
- (guile-2
- (eval-when
+(eval-when
(compile load eval expand)
- (load-extension "libgncmod-report-system" "scm_init_sw_report_system_module")))
- (else ))
+ (load-extension "libgncmod-report-system" "scm_init_sw_report_system_module"))
(use-modules (sw_report_system))
(use-modules (gnucash printf))
diff --git a/gnucash/report/utility-reports/welcome-to-gnucash.scm b/gnucash/report/utility-reports/welcome-to-gnucash.scm
index 9537a4e..7f689bb 100644
--- a/gnucash/report/utility-reports/welcome-to-gnucash.scm
+++ b/gnucash/report/utility-reports/welcome-to-gnucash.scm
@@ -27,12 +27,9 @@
(use-modules (gnucash core-utils)) ; for gnc:version
(use-modules (gnucash gettext))
(use-modules (gnucash gnc-module))
-(cond-expand
- (guile-2
- (eval-when
+(eval-when
(compile load eval expand)
- (load-extension "libgncmod-report-system" "scm_init_sw_report_system_module")))
- (else ))
+ (load-extension "libgncmod-report-system" "scm_init_sw_report_system_module"))
(use-modules (sw_report_system))
(gnc:module-load "gnucash/report/report-system" 0)
diff --git a/libgnucash/app-utils/Makefile.am b/libgnucash/app-utils/Makefile.am
index 84e7f8b..87cef70 100644
--- a/libgnucash/app-utils/Makefile.am
+++ b/libgnucash/app-utils/Makefile.am
@@ -105,13 +105,7 @@ if BUILDING_FROM_VCS
swig-app-utils-guile.c: app-utils.i ${top_srcdir}/common/base-typemaps.i
$(SWIG) -guile -Linkage module \
-I${top_srcdir}/common -o $@ $<
-if ! OS_WIN32
-if ! SWIG_DIST_FAIL
- if ! `grep "define scm_from_utf8_string" $@ > /dev/null 2>&1`; then \
- patch $@ $(top_srcdir)/common/swig-utf8.patch; \
- fi
-endif
-endif
+
swig-app-utils-python.c: app-utils.i ${top_srcdir}/common/base-typemaps.i
$(SWIG) -python -Wall -Werror \
-I${GLIB_CFLAGS} -I${top_srcdir}/common -o $@ $<
@@ -199,7 +193,6 @@ if ! OS_WIN32
touch .scm-links
endif
-if GNC_HAVE_GUILE_2
GUILE_COMPILE_ENV = \
--gnc-module-dir ${top_builddir}/libgnucash/engine \
--guile-load-dir ${top_builddir}/libgnucash/app-utils \
@@ -223,7 +216,6 @@ gncscmmodcache_DATA = $(gncscmmod_DATA:.scm=.go)
gncscmcachedir = ${pkglibdir}/scm/ccache/@GUILE_EFFECTIVE_VERSION@
gncscmcache_DATA = $(gncscm_DATA:.scm=.go)
-endif
clean-local:
rm -rf gnucash
diff --git a/libgnucash/app-utils/app-utils.scm b/libgnucash/app-utils/app-utils.scm
index fa3f5f0..cc21aa2 100644
--- a/libgnucash/app-utils/app-utils.scm
+++ b/libgnucash/app-utils/app-utils.scm
@@ -16,12 +16,9 @@
;; Boston, MA 02110-1301, USA gnu at gnu.org
(define-module (gnucash app-utils))
-(cond-expand
- (guile-2
- (eval-when
+(eval-when
(compile load eval expand)
- (load-extension "libgncmod-app-utils" "scm_init_sw_app_utils_module")))
- (else ))
+ (load-extension "libgncmod-app-utils" "scm_init_sw_app_utils_module"))
(use-modules (sw_app_utils))
(use-modules (srfi srfi-1))
(use-modules (gnucash main)) ;; FIXME: delete after we finish modularizing.
@@ -29,13 +26,9 @@
(use-modules (gnucash gettext))
;; Guile 2 needs to find the symbols from the c module at compile time already
-(cond-expand
- (guile-2
- (eval-when
+(eval-when
(compile load eval expand)
- (gnc:module-load "gnucash/engine" 0)))
- (else
- (gnc:module-load "gnucash/engine" 0)))
+ (gnc:module-load "gnucash/engine" 0))
;; gettext.scm
(re-export gnc:gettext)
diff --git a/libgnucash/app-utils/gettext.scm b/libgnucash/app-utils/gettext.scm
index eeacb81..bfef856 100644
--- a/libgnucash/app-utils/gettext.scm
+++ b/libgnucash/app-utils/gettext.scm
@@ -18,16 +18,11 @@
(define-module (gnucash gettext))
;; Load a few different modules depending on the version of guile
-(cond-expand
- (guile-2
- ;; Our app-utils gnc module must be evaluated at compile time
- ;; Without it sw_app_utils can't be evaluated below
- (eval-when
+;; Our app-utils gnc module must be evaluated at compile time
+;; Without it sw_app_utils can't be evaluated below
+(eval-when
(compile load eval expand)
- (load-extension "libgncmod-app-utils" "scm_init_sw_app_utils_module")))
- (else
- ;; Syncase is deprecated and redundant in guile 2
- (use-modules (ice-9 syncase))))
+ (load-extension "libgncmod-app-utils" "scm_init_sw_app_utils_module"))
(use-modules (sw_app_utils))
;; gettext functions
@@ -43,4 +38,4 @@
(export gnc:gettext)
(export _)
-(export N_)
\ No newline at end of file
+(export N_)
diff --git a/libgnucash/app-utils/make-prefs-migration-script.xsl b/libgnucash/app-utils/make-prefs-migration-script.xsl
index f9a3350..8fccf5c 100644
--- a/libgnucash/app-utils/make-prefs-migration-script.xsl
+++ b/libgnucash/app-utils/make-prefs-migration-script.xsl
@@ -25,13 +25,9 @@
(use-modules (gnucash core-utils))
;(use-modules (gnucash gnc-module))
;; Guile 2 needs to find the symbols from the c module at compile time already
-;(cond-expand
-; (guile-2
-; (eval-when
-; (compile load eval)
-; (load-extension "libgnc-core-utils" "scm_init_sw_core_utils_module")))
-; (else
-; (load-extension "libgnc-core-utils" "scm_init_sw_core_utils_module")))
+;(eval-when
+; (compile load eval)
+; (load-extension "libgnc-core-utils" "scm_init_sw_core_utils_module"))
;(use-modules (sw_core_utils))
(define (run-migration-internal)
@@ -217,4 +213,4 @@
<df:dateformat><df:name>locale</df:name><df:index>4</df:index></df:dateformat>
</df:dateformats>
-</xsl:stylesheet>
\ No newline at end of file
+</xsl:stylesheet>
diff --git a/libgnucash/app-utils/options.scm b/libgnucash/app-utils/options.scm
index a0ced62..b0e7b0e 100644
--- a/libgnucash/app-utils/options.scm
+++ b/libgnucash/app-utils/options.scm
@@ -199,13 +199,6 @@
(define (gnc:value->string value)
(let ((result (call-with-output-string
(lambda (port) (write value port)))))
- ;; Guile 1.8 has a bug that it serializes a space in a symbol to "\ "
- ;; but can't deserialize this back to a symbol afterwards. Stripping the
- ;; "\" appears to work around this (see gnucash bug 721654 which lead to this issue)
- (cond-expand
- (guile-2 )
- (else (set! result (regexp-substitute/global #f "\\\\ " result 'pre " " 'post))))
-
result))
(define (gnc:make-string-option
diff --git a/libgnucash/app-utils/test/test-load-app-utils-module.scm b/libgnucash/app-utils/test/test-load-app-utils-module.scm
index a3bd729..b9fac73 100755
--- a/libgnucash/app-utils/test/test-load-app-utils-module.scm
+++ b/libgnucash/app-utils/test/test-load-app-utils-module.scm
@@ -7,12 +7,8 @@
;; otherwise the N_ syntax-rule won't be found at compile time
;; causing the test to fail
;; That's what the wrapper below is meant for:
-(cond-expand
- (guile-2
- (define-syntax-rule (begin-for-syntax form ...)
- (eval-when (load compile eval) (begin form ...))))
- (else
- (define begin-for-syntax begin)))
+(define-syntax-rule (begin-for-syntax form ...)
+ (eval-when (load compile eval) (begin form ...)))
(begin-for-syntax (define loaded-module (gnc:module-load "gnucash/app-utils" 0)))
(if loaded-module
diff --git a/libgnucash/app-utils/test/test-scm-query-string.cpp b/libgnucash/app-utils/test/test-scm-query-string.cpp
index 8031a9a..b9f2a82 100644
--- a/libgnucash/app-utils/test/test-scm-query-string.cpp
+++ b/libgnucash/app-utils/test/test-scm-query-string.cpp
@@ -132,11 +132,6 @@ int
main (int argc, char **argv)
{
g_setenv ("GNC_UNINSTALLED", "1", TRUE);
-/* When built with clang, guile-1.8.8's scm_c_eval_string truncates all
- * integer values to int32, which causes this test to fail.
- */
-#if !(defined(__clang__)) || defined(HAVE_GUILE20) || defined(HAVE_GUILE22)
scm_boot_guile (argc, argv, main_helper, NULL);
-#endif
return 0;
}
diff --git a/libgnucash/core-utils/Makefile.am b/libgnucash/core-utils/Makefile.am
index da63a34..51f07fa 100644
--- a/libgnucash/core-utils/Makefile.am
+++ b/libgnucash/core-utils/Makefile.am
@@ -42,13 +42,7 @@ if BUILDING_FROM_VCS
swig-core-utils-guile.c: core-utils.i ${top_srcdir}/common/base-typemaps.i
$(SWIG) -guile -Linkage module \
-I${top_srcdir}/common -o $@ $<
-if ! OS_WIN32
-if ! SWIG_DIST_FAIL
- if ! `grep "define scm_from_utf8_string" $@ > /dev/null 2>&1`; then \
- patch $@ $(top_srcdir)/common/swig-utf8.patch; \
- fi
-endif
-endif
+
swig-core-utils-python.c: core-utils.i ${top_srcdir}/common/base-typemaps.i
$(SWIG) -python -Wall -Werror \
-I${GLIB_CFLAGS} -I${top_srcdir}/common -I${srcdir} -o $@ $<
@@ -107,7 +101,6 @@ if ! OS_WIN32
touch .scm-links
endif
-if GNC_HAVE_GUILE_2
GUILE_COMPILE_ENV = \
--library-dir ${top_builddir}/libgnucash/core-utils
@@ -119,7 +112,6 @@ GUILE_COMPILE_ENV = \
gncscmmodcachedir = ${pkglibdir}/scm/ccache/@GUILE_EFFECTIVE_VERSION@/gnucash
gncscmmodcache_DATA = $(gncscmmod_DATA:.scm=.go)
-endif
noinst_DATA = .scm-links
BUILT_SOURCES = gncla-dir.h gnc-version.h
diff --git a/libgnucash/core-utils/core-utils.scm b/libgnucash/core-utils/core-utils.scm
index 645228b..d02dce1 100644
--- a/libgnucash/core-utils/core-utils.scm
+++ b/libgnucash/core-utils/core-utils.scm
@@ -27,13 +27,9 @@
(define-module (gnucash core-utils))
;; Guile 2 needs to find the symbols from the extension at compile time already
-(cond-expand
- (guile-2
- (eval-when
+(eval-when
(compile load eval expand)
- (load-extension "libgnc-core-utils" "scm_init_sw_core_utils_module")))
- (else
- (load-extension "libgnc-core-utils" "scm_init_sw_core_utils_module")))
+ (load-extension "libgnc-core-utils" "scm_init_sw_core_utils_module"))
(use-modules (sw_core_utils))
diff --git a/libgnucash/core-utils/gnc-guile-utils.c b/libgnucash/core-utils/gnc-guile-utils.c
index 8b99fb4..e86fe9f 100644
--- a/libgnucash/core-utils/gnc-guile-utils.c
+++ b/libgnucash/core-utils/gnc-guile-utils.c
@@ -297,33 +297,12 @@ gchar *gnc_scm_strip_comments (SCM scm_text)
splits = g_strsplit(raw_text, "\n", -1);
for (i = j = 0; splits[i]; i++)
{
- gchar *haystack, *needle;
if ((splits[i][0] == ';') || (splits[i][0] == '\0'))
{
g_free(splits[i]);
continue;
}
-
- /* Work around a bug in guile 1.8 that escapes spaces
- * in a symbol printed on a string port. We don't
- * want this, because this string can't be properly
- * converted back into a symbol later on. */
-
- haystack = splits [i];
- needle = g_strstr_len (haystack, -1, "\\ ");
- while (needle)
- {
- gchar *new_haystack = NULL;
- gsize prefix_size = needle - haystack;
- gchar *prefix = g_strndup (haystack, prefix_size);
- needle++;
- new_haystack = g_strconcat (prefix, needle, NULL);
- g_free (prefix);
- g_free (haystack);
- haystack = new_haystack;
- needle = g_strstr_len (haystack, -1, "\\ ");
- }
- splits[j++] = haystack;
+ splits[j++] = splits [i];
}
splits[j] = NULL;
diff --git a/libgnucash/engine/Makefile.am b/libgnucash/engine/Makefile.am
index 5b8ae45..49c70cc 100644
--- a/libgnucash/engine/Makefile.am
+++ b/libgnucash/engine/Makefile.am
@@ -275,7 +275,6 @@ if ! OS_WIN32
touch .scm-links
endif
-if GNC_HAVE_GUILE_2
GUILE_COMPILE_ENV = \
--guile-load-dir ${top_builddir}/libgnucash/gnc-module \
--library-dir ${top_builddir}/libgnucash/engine \
@@ -293,7 +292,6 @@ gncscmmodcache_DATA = $(gncscmmod_DATA:.scm=.go)
gncscmcachedir = ${pkglibdir}/scm/ccache/@GUILE_EFFECTIVE_VERSION@
gncscmcache_DATA = $(gncscm_DATA:.scm=.go)
-endif
noinst_DATA = .scm-links
@@ -303,13 +301,6 @@ swig-engine.c: engine.i $(top_srcdir)/common/base-typemaps.i \
$(gncinclude_HEADERS) $(noinst_HEADERS)
$(SWIG) -guile -Linkage module \
-I${top_srcdir}/common -o $@ $<
-if ! OS_WIN32
-if ! SWIG_DIST_FAIL
- if ! `grep "define scm_from_utf8_string" $@ > /dev/null 2>&1`; then \
- patch $@ $(top_srcdir)/common/swig-utf8.patch; \
- fi
-endif
-endif
endif
diff --git a/libgnucash/engine/engine.scm b/libgnucash/engine/engine.scm
index 00bd61c..fdb0b40 100644
--- a/libgnucash/engine/engine.scm
+++ b/libgnucash/engine/engine.scm
@@ -19,12 +19,9 @@
(define-module (gnucash engine))
-(cond-expand
- (guile-2
- (eval-when
+(eval-when
(compile load eval expand)
- (load-extension "libgncmod-engine" "scm_init_sw_engine_module")))
- (else ))
+ (load-extension "libgncmod-engine" "scm_init_sw_engine_module"))
(use-modules (sw_engine))
(export GNC-RND-FLOOR)
diff --git a/libgnucash/gnc-module/Makefile.am b/libgnucash/gnc-module/Makefile.am
index 9246715..1d99001 100644
--- a/libgnucash/gnc-module/Makefile.am
+++ b/libgnucash/gnc-module/Makefile.am
@@ -33,13 +33,6 @@ if BUILDING_FROM_VCS
swig-gnc-module.c: gnc-module.i ${top_srcdir}/common/base-typemaps.i
$(SWIG) -guile -Linkage module \
-I${top_srcdir}/common -o $@ $<
-if ! OS_WIN32
-if ! SWIG_DIST_FAIL
- if ! `grep "define scm_from_utf8_string" $@ > /dev/null 2>&1`; then \
- patch $@ $(top_srcdir)/common/swig-utf8.patch; \
- fi
-endif
-endif
endif
EXAMPLE_EXTRA_DIST = \
@@ -79,7 +72,6 @@ if ! OS_WIN32
touch .scm-links
endif
-if GNC_HAVE_GUILE_2
GUILE_COMPILE_ENV = \
--library-dir ${top_builddir}/libgnucash/gnc-module \
--library-dir ${top_builddir}/libgnucash/core-utils
@@ -92,7 +84,6 @@ GUILE_COMPILE_ENV = \
gncscmmodcachedir = ${pkglibdir}/scm/ccache/@GUILE_EFFECTIVE_VERSION@/gnucash
gncscmmodcache_DATA = $(gncscmmod_DATA:.scm=.go)
-endif
clean-local:
rm -rf gnucash
diff --git a/libgnucash/gnc-module/gnc-module.scm b/libgnucash/gnc-module/gnc-module.scm
index 544f37c..236f02f 100644
--- a/libgnucash/gnc-module/gnc-module.scm
+++ b/libgnucash/gnc-module/gnc-module.scm
@@ -28,13 +28,9 @@
(define-module (gnucash gnc-module))
;; Guile 2 needs to find the symbols from the extension at compile time already
-(cond-expand
- (guile-2
- (eval-when
+(eval-when
(compile load eval expand)
- (load-extension "libgnc-module" "scm_init_sw_gnc_module_module")))
- (else
- (load-extension "libgnc-module" "scm_init_sw_gnc_module_module")))
+ (load-extension "libgnc-module" "scm_init_sw_gnc_module_module"))
(use-modules (sw_gnc_module))
@@ -52,9 +48,5 @@
(export gnc:module-begin-syntax)
;; Guile 2 needs to load external modules at compile time
-(cond-expand
- (guile-2
- (define-syntax-rule (gnc:module-begin-syntax form ...)
- (eval-when (load compile eval expand) (begin form ...))))
- (else
- (define gnc:module-begin-syntax begin)))
+(define-syntax-rule (gnc:module-begin-syntax form ...)
+ (eval-when (load compile eval expand) (begin form ...)))
diff --git a/libgnucash/gnc-module/test/mod-bar/Makefile.am b/libgnucash/gnc-module/test/mod-bar/Makefile.am
index 76b158c..008d543 100644
--- a/libgnucash/gnc-module/test/mod-bar/Makefile.am
+++ b/libgnucash/gnc-module/test/mod-bar/Makefile.am
@@ -25,13 +25,6 @@ libgncmodbar_la_LIBADD=libbar.la \
if BUILDING_FROM_VCS
swig-bar.c: bar.i
$(SWIG) -guile -Linkage module -o $@ $<
-if ! OS_WIN32
-if ! SWIG_DIST_FAIL
- if ! `grep "define scm_from_utf8_string" $@ > /dev/null 2>&1`; then \
- patch $@ $(top_srcdir)/common/swig-utf8.patch; \
- fi
-endif
-endif
endif
EXTRA_DIST = \
diff --git a/libgnucash/gnc-module/test/mod-baz/Makefile.am b/libgnucash/gnc-module/test/mod-baz/Makefile.am
index b5d1064..5873a5e 100644
--- a/libgnucash/gnc-module/test/mod-baz/Makefile.am
+++ b/libgnucash/gnc-module/test/mod-baz/Makefile.am
@@ -29,13 +29,6 @@ libgncmodbaz_la_LIBADD = \
if BUILDING_FROM_VCS
swig-baz.c: baz.i
$(SWIG) -guile -Linkage module -o $@ $<
-if ! OS_WIN32
-if ! SWIG_DIST_FAIL
- if ! `grep "define scm_from_utf8_string" $@ > /dev/null 2>&1`; then \
- patch $@ $(top_srcdir)/common/swig-utf8.patch; \
- fi
-endif
-endif
endif
EXTRA_DIST = \
diff --git a/libgnucash/gnc-module/test/mod-foo/Makefile.am b/libgnucash/gnc-module/test/mod-foo/Makefile.am
index a1536f4..2e63b54 100644
--- a/libgnucash/gnc-module/test/mod-foo/Makefile.am
+++ b/libgnucash/gnc-module/test/mod-foo/Makefile.am
@@ -31,13 +31,6 @@ EXTRA_DIST = \
if BUILDING_FROM_VCS
swig-foo.c: foo.i
$(SWIG) -guile -Linkage module -o $@ $<
-if ! OS_WIN32
-if ! SWIG_DIST_FAIL
- if ! `grep "define scm_from_utf8_string" $@ > /dev/null 2>&1`; then \
- patch $@ $(top_srcdir)/common/swig-utf8.patch; \
- fi
-endif
-endif
endif
BUILT_SOURCES = swig-foo.c
diff --git a/libgnucash/scm/CMakeLists.txt b/libgnucash/scm/CMakeLists.txt
index 22165f8..f11cc81 100644
--- a/libgnucash/scm/CMakeLists.txt
+++ b/libgnucash/scm/CMakeLists.txt
@@ -14,11 +14,7 @@ SET (scm_SCHEME_4
# FIXME: ${BUILD_CONFIG_SCM} needs a rule to cause it to be generated, I think.
-IF (HAVE_GUILE1)
- GNC_CONFIGURE(build-config.scm.in build-config.scm)
-ELSE()
- GNC_CONFIGURE2(build-config-scm build-config.scm.in build-config.scm)
-ENDIF()
+GNC_CONFIGURE2(build-config-scm build-config.scm.in build-config.scm)
# CONFIGURE_FILE(build-config.scm.in ${BUILD_CONFIG_SCM})
diff --git a/libgnucash/scm/Makefile.am b/libgnucash/scm/Makefile.am
index d6647c7..2d69f08 100644
--- a/libgnucash/scm/Makefile.am
+++ b/libgnucash/scm/Makefile.am
@@ -41,7 +41,6 @@ if ! OS_WIN32
touch .scm-links
endif
-if GNC_HAVE_GUILE_2
GUILE_COMPILE_ENV = \
--guile-load-dir ${top_builddir}/libgnucash/core-utils \
--guile-load-dir ${top_builddir}/libgnucash/gnc-module \
@@ -59,7 +58,6 @@ gncscmmodcache_DATA = $(gncscmmod_DATA:.scm=.go)
gncscmcachedir = ${pkglibdir}/scm/ccache/@GUILE_EFFECTIVE_VERSION@
gncscmcache_DATA = $(gncscm_DATA:.scm=.go)
-endif
clean-local:
$(RM) -rf gnucash
diff --git a/libgnucash/scm/gnumeric/Makefile.am b/libgnucash/scm/gnumeric/Makefile.am
index 2e12cf6..476557f 100644
--- a/libgnucash/scm/gnumeric/Makefile.am
+++ b/libgnucash/scm/gnumeric/Makefile.am
@@ -19,14 +19,12 @@ if ! OS_WIN32
touch .scm-links
endif
-if GNC_HAVE_GUILE_2
%.go : %.scm .scm-links
$(GUILD) compile \
-o $@ $<
gncscmcachedir = ${pkglibdir}/scm/ccache/@GUILE_EFFECTIVE_VERSION@/gnumeric
gncscmcache_DATA = $(gncscm_DATA:.scm=.go)
-endif
noinst_DATA = .scm-links
diff --git a/libgnucash/scm/main.scm b/libgnucash/scm/main.scm
index 107a109..178f33d 100644
--- a/libgnucash/scm/main.scm
+++ b/libgnucash/scm/main.scm
@@ -18,11 +18,6 @@
(define-module (gnucash main)
#:use-module (gnucash printf))
-;; This is to silence warnings with guile-1.8:
-(if (and (>= (string->number (major-version)) 1)
- (>= (string->number (minor-version)) 8))
- (default-duplicate-binding-handler 'last))
-
;; Turn off the scheme compiler's "possibly unbound variable" warnings.
;; In guile 2.0 we get nearly 7500 of them loading the scheme files.
;; This is the default value for auto-compilation-options without "unbound-variable".
diff --git a/libgnucash/tax/us/Makefile.am b/libgnucash/tax/us/Makefile.am
index ac7d2d5..136f760 100644
--- a/libgnucash/tax/us/Makefile.am
+++ b/libgnucash/tax/us/Makefile.am
@@ -44,7 +44,6 @@ if ! OS_WIN32
touch .scm-links
endif
-if GNC_HAVE_GUILE_2
GUILE_COMPILE_ENV = \
--gnc-module-dir ${top_builddir}/libgnucash/engine \
--guile-load-dir ${top_builddir}/libgnucash/app-utils \
@@ -68,7 +67,6 @@ gncscmmodcache_DATA = $(gncscmmod_DATA:.scm=.go)
gncscmcachedir = ${pkglibdir}/scm/ccache/@GUILE_EFFECTIVE_VERSION@
gncscmcache_DATA = $(gncscm_DATA:.scm=.go)
-endif
clean-local:
$(RM) -rf gnucash
diff --git a/libgnucash/tax/us/de_DE.scm b/libgnucash/tax/us/de_DE.scm
index 0ae5699..54bb9f7 100644
--- a/libgnucash/tax/us/de_DE.scm
+++ b/libgnucash/tax/us/de_DE.scm
@@ -20,13 +20,10 @@
(define-module (gnucash tax de_DE))
(use-modules (gnucash gnc-module))
-(cond-expand
- (guile-2
- (eval-when
+(eval-when
(compile load eval expand)
(load-extension "libgncmod-engine" "scm_init_sw_engine_module")
- (load-extension "libgncmod-app-utils" "scm_init_sw_app_utils_module")))
- (else ))
+ (load-extension "libgncmod-app-utils" "scm_init_sw_app_utils_module"))
(use-modules (sw_app_utils))
(use-modules (sw_engine))
(use-modules (gnucash app-utils))
commit a784dd57848e0d52ad17108f624722adfeeb2867
Author: Geert Janssens <geert at kobaltwit.be>
Date: Tue Dec 19 16:53:40 2017 +0100
Add support for guile 2.2
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 964bb9b..c679753 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -269,37 +269,54 @@ IF(BUILDING_FROM_VCS)
ENDIF()
# Find Guile and determine which version we are using.
-# First look for guile-2.0. If not found, try to locate guile-1.8
+# Look for guile versions in this order: 2.2 > 2.0 > 1.8
# guile library and include dir
-GNC_PKG_CHECK_MODULES (GUILE2 guile-2.0>=2.0.9 QUIET)
-IF (GUILE2_FOUND) # found guile-2.0
- ADD_DEFINITIONS (-DHAVE_GUILE20)
+GNC_PKG_CHECK_MODULES (GUILE22 guile-2.2 QUIET)
+IF (GUILE22_FOUND) # found guile-2.2
+ ADD_DEFINITIONS (-DHAVE_GUILE22)
SET(HAVE_GUILE2 TRUE)
- SET(GUILE_EFFECTIVE_VERSION 2.0)
- SET(GUILE_INCLUDE_DIRS ${GUILE2_INCLUDE_DIRS})
- SET(GUILE_LDFLAGS ${GUILE2_LDFLAGS})
+ SET(GUILE_EFFECTIVE_VERSION 2.2)
+ SET(GUILE_INCLUDE_DIRS ${GUILE22_INCLUDE_DIRS})
+ SET(GUILE_LDFLAGS ${GUILE22_LDFLAGS})
- FIND_PROGRAM (GUILD_EXECUTABLE NAMES guild2.0 guild)
+ FIND_PROGRAM (GUILD_EXECUTABLE NAMES guild2.2 guild)
IF (NOT GUILD_EXECUTABLE)
MESSAGE (SEND_ERROR "The guild executable was not found, but is required. Please set GUILD_EXECUTABLE.")
ENDIF (NOT GUILD_EXECUTABLE)
- MESSAGE(STATUS "Using guile-2.0.x")
- FIND_PROGRAM (GUILE_EXECUTABLE NAMES guile2.0 guile)
-ELSE()
- # look for guile 1.8
- GNC_PKG_CHECK_MODULES (GUILE1 guile-1.8>=1.8.8 QUIET)
- IF (NOT GUILE1_FOUND)
- MESSAGE (FATAL_ERROR "Neither guile 1.8 nor guile 2.0 were found GnuCash can't run without one of them. Ensure that one is installed and can be found with pgk-config.")
- ENDIF(NOT GUILE1_FOUND)
-
- SET(HAVE_GUILE1 TRUE)
- SET(GUILE_EFFECTIVE_VERSION 1.8)
- SET(GUILE_INCLUDE_DIRS ${GUILE1_INCLUDE_DIRS})
- SET(GUILE_LDFLAGS ${GUILE1_LDFLAGS})
- MESSAGE(STATUS "Using guile-1.8.x")
- FIND_PROGRAM (GUILE_EXECUTABLE NAMES guile1.8 guile)
-ENDIF()
+ MESSAGE(STATUS "Using guile-2.2.x")
+ FIND_PROGRAM (GUILE_EXECUTABLE NAMES guile2.2 guile)
+ELSE(GUILE22_FOUND)
+ GNC_PKG_CHECK_MODULES (GUILE2 guile-2.0>=2.0.9 QUIET)
+ IF (GUILE2_FOUND) # found guile-2.0
+ ADD_DEFINITIONS (-DHAVE_GUILE20)
+ SET(HAVE_GUILE2 TRUE)
+ SET(GUILE_EFFECTIVE_VERSION 2.0)
+ SET(GUILE_INCLUDE_DIRS ${GUILE2_INCLUDE_DIRS})
+ SET(GUILE_LDFLAGS ${GUILE2_LDFLAGS})
+
+ FIND_PROGRAM (GUILD_EXECUTABLE NAMES guild2.0 guild)
+ IF (NOT GUILD_EXECUTABLE)
+ MESSAGE (SEND_ERROR "The guild executable was not found, but is required. Please set GUILD_EXECUTABLE.")
+ ENDIF (NOT GUILD_EXECUTABLE)
+ MESSAGE(STATUS "Using guile-2.0.x")
+ FIND_PROGRAM (GUILE_EXECUTABLE NAMES guile2.0 guile)
+ ELSE(GUILE2_FOUND)
+
+ # look for guile 1.8
+ GNC_PKG_CHECK_MODULES (GUILE1 guile-1.8>=1.8.8 QUIET)
+ IF (NOT GUILE1_FOUND)
+ MESSAGE (FATAL_ERROR "Neither guile 1.8 nor guile 2.0 were found GnuCash can't run without one of them. Ensure that one is installed and can be found with pgk-config.")
+ ENDIF(NOT GUILE1_FOUND)
+
+ SET(HAVE_GUILE1 TRUE)
+ SET(GUILE_EFFECTIVE_VERSION 1.8)
+ SET(GUILE_INCLUDE_DIRS ${GUILE1_INCLUDE_DIRS})
+ SET(GUILE_LDFLAGS ${GUILE1_LDFLAGS})
+ MESSAGE(STATUS "Using guile-1.8.x")
+ FIND_PROGRAM (GUILE_EXECUTABLE NAMES guile1.8 guile)
+ ENDIF(GUILE2_FOUND)
+ENDIF(GUILE22_FOUND)
IF (NOT GUILE_EXECUTABLE)
MESSAGE (SEND_ERROR "The guile executable was not found, but is required. Please set GUILE_EXECUTABLE.")
diff --git a/common/cmake_modules/GncAddSchemeTargets.cmake b/common/cmake_modules/GncAddSchemeTargets.cmake
index ffe31f1..ec6fc6f 100644
--- a/common/cmake_modules/GncAddSchemeTargets.cmake
+++ b/common/cmake_modules/GncAddSchemeTargets.cmake
@@ -88,12 +88,12 @@ FUNCTION(GNC_ADD_SCHEME_TARGETS _TARGET _SOURCE_FILES _OUTPUT_DIR _GUILE_DEPENDS
"${current_bindir}" "${CMAKE_BINARY_DIR}/libgnucash/scm") # to pick up generated build-config.scm
SET(_GUILE_LOAD_COMPILED_PATH "${current_bindir}")
- SET(_GUILE_CACHE_DIR ${LIBDIR_BUILD}/gnucash/scm/ccache/2.0)
+ SET(_GUILE_CACHE_DIR ${LIBDIR_BUILD}/gnucash/scm/ccache/${GUILE_EFFECTIVE_VERSION})
SET(_GUILE_LOAD_PATH "${current_srcdir}")
IF (MAKE_LINKS)
LIST(APPEND _GUILE_LOAD_PATH "${build_datadir}/gnucash/scm")
ENDIF()
- SET(_GUILE_LOAD_COMPILED_PATH ${build_libdir}/gnucash/scm/ccache/2.0)
+ SET(_GUILE_LOAD_COMPILED_PATH ${build_libdir}/gnucash/scm/ccache/${GUILE_EFFECTIVE_VERSION})
SET(_TARGET_FILES "")
diff --git a/common/cmake_modules/GncAddTest.cmake b/common/cmake_modules/GncAddTest.cmake
index 0f11a63..6435f22 100644
--- a/common/cmake_modules/GncAddTest.cmake
+++ b/common/cmake_modules/GncAddTest.cmake
@@ -25,7 +25,7 @@ FUNCTION(GET_GUILE_ENV)
set(fpath "${fpath}${dir}:")
endforeach(dir)
LIST(APPEND env "PATH=${fpath}")
- set(compiled_path "${LIBDIR_BUILD}/gnucash/scm/ccache/2.0")
+ set(compiled_path "${LIBDIR_BUILD}/gnucash/scm/ccache/${GUILE_EFFECTIVE_VERSION}")
string(REGEX REPLACE "^([A-Za-z]):" "/\\1" compiled_path ${compiled_path})
LIST(APPEND env GUILE_LOAD_COMPILED_PATH=${compiled_path})
ENDIF(MINGW64)
@@ -33,7 +33,7 @@ FUNCTION(GET_GUILE_ENV)
LIST(APPEND env "GUILE=${GUILE_EXECUTABLE}")
IF (NOT WIN32)
- LIST(APPEND env "GUILE_LOAD_COMPILED_PATH=${LIBDIR_BUILD}/gnucash/scm/ccache/2.0")
+ LIST(APPEND env "GUILE_LOAD_COMPILED_PATH=${LIBDIR_BUILD}/gnucash/scm/ccache/${GUILE_EFFECTIVE_VERSION}")
ENDIF()
SET(guile_load_paths "")
LIST(APPEND guile_load_paths ${CMAKE_CURRENT_SOURCE_DIR}/mod-foo)
diff --git a/gnucash/environment.in b/gnucash/environment.in
index 0ef4568..eb582e2 100644
--- a/gnucash/environment.in
+++ b/gnucash/environment.in
@@ -1,7 +1,5 @@
@-NOTE If you make any changes here, you should probably -@
- at -NOTE also change the equivalent sections in: -@
- at -NOTE - src/bin/overrides/gnucash-env.in -@
- at -NOTE Check as well that modifications performed in -@
+ at -NOTE also verify that modifications performed in -@
@-NOTE - gnucash-on-windows.git:gnucash.iss don't conflict. -@
# environment
#
@@ -66,7 +64,7 @@ GUILE_LOAD_PATH={GNC_DATA}/scm;{GUILE_LIBS};{GUILE_LOAD_PATH}
# On Windows {GNC_LIB} points to {GNC_HOME}/bin because that's where the DLLs
# are. It's not where the compiled scheme files are so we use {SYS_LIB} here.
-GUILE_LOAD_COMPILED_PATH={SYS_LIB}/guile/2.0/ccache;{SYS_LIB}/gnucash/scm/ccache/@-GUILE_EFFECTIVE_VERSION-@;{GUILE_COMPILED_LIBS};{GUILE_LOAD_COMPILED_PATH}
+GUILE_LOAD_COMPILED_PATH={SYS_LIB}/guile/@-GUILE_EFFECTIVE_VERSION-@/ccache;{SYS_LIB}/gnucash/scm/ccache/@-GUILE_EFFECTIVE_VERSION-@;{GUILE_COMPILED_LIBS};{GUILE_LOAD_COMPILED_PATH}
# Tell Guile where to find GnuCash specific shared libraries
GNC_LIBRARY_PATH={SYS_LIB};{GNC_LIB}
diff --git a/gnucash/import-export/qif-imp/Makefile.am b/gnucash/import-export/qif-imp/Makefile.am
index e23cd32..6226701 100644
--- a/gnucash/import-export/qif-imp/Makefile.am
+++ b/gnucash/import-export/qif-imp/Makefile.am
@@ -100,7 +100,10 @@ endif
if GNC_HAVE_GUILE_2
GUILE_COMPILE_ENV = \
+ --gnc-module-dir ${top_builddir}/libgnucash/engine \
+ --guile-load-dir ${top_builddir}/libgnucash/app-utils \
--guile-load-dir ${top_builddir}/libgnucash/core-utils \
+ --guile-load-dir ${top_builddir}/libgnucash/engine \
--guile-load-dir ${top_builddir}/libgnucash/gnc-module \
--guile-load-dir ${top_builddir}/libgnucash/scm \
--library-dir ${top_builddir}/libgnucash/engine \
diff --git a/gnucash/import-export/qif-imp/qif-import.scm b/gnucash/import-export/qif-imp/qif-import.scm
index 54443fb..ae4cf71 100644
--- a/gnucash/import-export/qif-imp/qif-import.scm
+++ b/gnucash/import-export/qif-imp/qif-import.scm
@@ -26,6 +26,7 @@
(define-module (gnucash import-export qif-import))
(use-modules (gnucash main)) ;; FIXME: delete after we finish modularizing.
+(use-modules (gnucash app-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
@@ -43,7 +44,6 @@
(use-modules (ice-9 regex))
(use-modules (srfi srfi-1))
-(debug-enable 'debug)
(debug-enable 'backtrace)
(gnc:module-load "gnucash/engine" 0)
diff --git a/gnucash/report/report-gnome/dialog-report-column-view.c b/gnucash/report/report-gnome/dialog-report-column-view.c
index d351ca4..8c508f3 100644
--- a/gnucash/report/report-gnome/dialog-report-column-view.c
+++ b/gnucash/report/report-gnome/dialog-report-column-view.c
@@ -432,7 +432,7 @@ gnc_column_view_edit_add_cb(GtkButton * button, gpointer user_data)
oldlist = SCM_CDR(oldlist);
}
newlist = scm_append
- (scm_listify(scm_reverse(scm_cons(SCM_LIST4(new_report,
+ (scm_list_n (scm_reverse(scm_cons(SCM_LIST4(new_report,
scm_from_int (1),
scm_from_int (1),
SCM_BOOL_F),
@@ -443,7 +443,7 @@ gnc_column_view_edit_add_cb(GtkButton * button, gpointer user_data)
else
{
newlist = scm_append
- (scm_listify(oldlist,
+ (scm_list_n (oldlist,
SCM_LIST1(SCM_LIST4(new_report,
scm_from_int (1),
scm_from_int (1),
@@ -485,7 +485,7 @@ gnc_column_view_edit_remove_cb(GtkButton * button, gpointer user_data)
}
if (count <= oldlength)
{
- newlist = scm_append(scm_listify(scm_reverse(newlist), SCM_CDR(oldlist), SCM_UNDEFINED));
+ newlist = scm_append(scm_list_n (scm_reverse(newlist), SCM_CDR(oldlist), SCM_UNDEFINED));
}
}
@@ -528,7 +528,7 @@ gnc_edit_column_view_move_up_cb(GtkButton * button, gpointer user_data)
temp = SCM_CAR(oldlist);
oldlist = SCM_CDR(oldlist);
newlist = scm_cons(temp, scm_cons(SCM_CAR(oldlist), newlist));
- newlist = scm_append(scm_listify(scm_reverse(newlist), SCM_CDR(oldlist), SCM_UNDEFINED));
+ newlist = scm_append(scm_list_n (scm_reverse(newlist), SCM_CDR(oldlist), SCM_UNDEFINED));
scm_gc_unprotect_object(r->contents_list);
r->contents_list = newlist;
@@ -566,7 +566,7 @@ gnc_edit_column_view_move_down_cb(GtkButton * button, gpointer user_data)
temp = SCM_CAR(oldlist);
oldlist = SCM_CDR(oldlist);
newlist = scm_cons(temp, scm_cons(SCM_CAR(oldlist), newlist));
- newlist = scm_append(scm_listify(scm_reverse(newlist), SCM_CDR(oldlist), SCM_UNDEFINED));
+ newlist = scm_append(scm_list_n (scm_reverse(newlist), SCM_CDR(oldlist), SCM_UNDEFINED));
scm_gc_unprotect_object(r->contents_list);
r->contents_list = newlist;
diff --git a/gnucash/report/report-gnome/test/test-load-report-gnome-module.scm b/gnucash/report/report-gnome/test/test-load-report-gnome-module.scm
index 054ada4..5273082 100755
--- a/gnucash/report/report-gnome/test/test-load-report-gnome-module.scm
+++ b/gnucash/report/report-gnome/test/test-load-report-gnome-module.scm
@@ -2,7 +2,6 @@
exec ${GUILE} -s "$0"
!#
-(debug-enable 'debug)
(debug-enable 'backtrace)
(debug-set! stack 500000)
@@ -10,7 +9,11 @@ exec ${GUILE} -s "$0"
(debug-set! maxdepth 100000))
(display " testing report module load ... ")
-(use-modules (ice-9 syncase))
+(cond-expand
+ (guile-2 )
+ (else
+ ;; Syncase is deprecated and redundant in guile 2
+ (use-modules (ice-9 syncase))))
(use-modules (gnucash gnc-module))
(gnc:module-system-init)
diff --git a/gnucash/report/report-system/report.scm b/gnucash/report/report-system/report.scm
index ae8ae00..6ec25d5 100644
--- a/gnucash/report/report-system/report.scm
+++ b/gnucash/report/report-system/report.scm
@@ -21,6 +21,7 @@
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(use-modules (gnucash main))
+(use-modules (gnucash app-utils))
(use-modules (gnucash printf))
(use-modules (gnucash gettext))
(cond-expand
diff --git a/gnucash/report/report-system/test/test-load-report-system-module.scm b/gnucash/report/report-system/test/test-load-report-system-module.scm
index ea77251..0695190 100755
--- a/gnucash/report/report-system/test/test-load-report-system-module.scm
+++ b/gnucash/report/report-system/test/test-load-report-system-module.scm
@@ -1,4 +1,3 @@
-(debug-enable 'debug)
(debug-enable 'backtrace)
(debug-set! stack 500000)
@@ -7,7 +6,11 @@
(display " testing report module load ... ")
(setenv "GNC_UNINSTALLED" "1")
-(use-modules (ice-9 syncase))
+(cond-expand
+ (guile-2 )
+ (else
+ ;; Syncase is deprecated and redundant in guile 2
+ (use-modules (ice-9 syncase))))
(use-modules (gnucash gnc-module))
(gnc:module-system-init)
diff --git a/gnucash/report/utility-reports/hello-world.scm b/gnucash/report/utility-reports/hello-world.scm
index bbabfdd..5337aa9 100644
--- a/gnucash/report/utility-reports/hello-world.scm
+++ b/gnucash/report/utility-reports/hello-world.scm
@@ -28,11 +28,6 @@
(use-modules (gnucash gnc-module))
(use-modules (gnucash gettext))
-;; 'debug is deprecated and unused since guile 2
-(cond-expand
- (guile-2 )
- (else
- (debug-enable 'debug)))
(debug-enable 'backtrace)
(gnc:module-load "gnucash/report/report-system" 0)
diff --git a/gnucash/report/utility-reports/test-graphing.scm b/gnucash/report/utility-reports/test-graphing.scm
index c053e48..94437ef 100644
--- a/gnucash/report/utility-reports/test-graphing.scm
+++ b/gnucash/report/utility-reports/test-graphing.scm
@@ -27,7 +27,6 @@
(use-modules (gnucash main)) ;; FIXME: delete after we finish modularizing.
(use-modules (gnucash gnc-module))
-(debug-enable 'debug)
(debug-enable 'backtrace)
(gnc:module-load "gnucash/report/report-system" 0)
diff --git a/gnucash/report/utility-reports/view-column.scm b/gnucash/report/utility-reports/view-column.scm
index 780a521..ba4be79 100644
--- a/gnucash/report/utility-reports/view-column.scm
+++ b/gnucash/report/utility-reports/view-column.scm
@@ -28,6 +28,7 @@
(define-module (gnucash report view-column))
(use-modules (gnucash main)) ;; FIXME: delete after we finish modularizing.
+(use-modules (gnucash app-utils))
(use-modules (gnucash gnc-module))
(use-modules (gnucash gettext))
(cond-expand
diff --git a/libgnucash/app-utils/app-utils.scm b/libgnucash/app-utils/app-utils.scm
index 22008d2..fa3f5f0 100644
--- a/libgnucash/app-utils/app-utils.scm
+++ b/libgnucash/app-utils/app-utils.scm
@@ -43,7 +43,9 @@
(re-export N_)
;; c-interface.scm
-(export gnc:error->string)
+(export gnc:apply-with-error-handling)
+(export gnc:eval-string-with-error-handling)
+(export gnc:backtrace-if-exception)
(export gnc:make-string-database)
;; options.scm
diff --git a/libgnucash/app-utils/c-interface.scm b/libgnucash/app-utils/c-interface.scm
index e6243d7..559bc32 100644
--- a/libgnucash/app-utils/c-interface.scm
+++ b/libgnucash/app-utils/c-interface.scm
@@ -15,25 +15,67 @@
;; 51 Franklin Street, Fifth Floor Fax: +1-617-542-2652
;; Boston, MA 02110-1301, USA gnu at gnu.org
-(define (gnc:error->string tag args)
- (define (write-error port)
- (if (and (list? args) (not (null? args)))
- (let ((func (car args)))
- (if func
- (begin
- (display "Function: " port)
- (display func port)
- (display ", " port)
- (display tag port)
- (display "\n\n" port)))))
- (false-if-exception
- (apply display-error (fluid-ref the-last-stack) port args))
- (display-backtrace (fluid-ref the-last-stack) port)
- (force-output port))
-
- (false-if-exception
- (call-with-output-string write-error)))
+(define (gnc:call-with-error-handling cmd args)
+ (let ((captured-stack #f)
+ (captured-error #f)
+ (result #f))
+ (catch #t
+ (lambda ()
+ ;; Execute the code in which
+ ;; you want to catch errors here.
+ (if (procedure? cmd)
+ (set! result (apply cmd args)))
+ (if (string? cmd)
+ (set! result (eval-string cmd)))
+ )
+ (lambda (key . parameters)
+ ;; Put the code which you want
+ ;; to handle an error after the
+ ;; stack has been unwound here.
+ (let* ((str-port (open-output-string)))
+ (display-backtrace captured-stack str-port)
+ (display "\n" str-port)
+ (print-exception str-port #f key parameters)
+ (set! captured-error (get-output-string str-port))))
+ (lambda (key . parameters)
+ ;; Capture the stack here, cut the last 3 frames which are
+ ;; make-stack, this one, and the throw handler.
+ (set! captured-stack (make-stack #t 3))))
+ (list result captured-error)
+))
+
+;; gnc:eval-string-with-error-handling will evaluate the input string (cmd)
+;; an captures any exception that would be generated. It returns
+;; a list with 2 elements: the output of the evaluation and a backtrace.
+;; The first may be set if string evaluation did generate
+;; output, the latter is set when an exception was caught.
+;; We'll use this to wrap guile calls in C(++), allowing
+;; the C(++) code to decide how to handle the errors.
+(define (gnc:eval-string-with-error-handling cmd)
+ (gnc:call-with-error-handling cmd '()))
+
+;; gnc:apply-with-error-handling will call guile's apply to run func with args
+;; an captures any exception that would be generated. It returns
+;; a list with 2 elements: the output of the evaluation and a backtrace.
+;; The first may be set if the result of the apply did generate
+;; output, the latter is set when an exception was caught.
+;; We'll use this to wrap guile calls in C(++), allowing
+;; the C(++) code to decide how to handle the errors.
+(define (gnc:apply-with-error-handling func args)
+ (gnc:call-with-error-handling func args))
+
+
+(define (gnc:backtrace-if-exception proc . args)
+ (let* ((apply-result (gnc:apply-with-error-handling proc args))
+ (result (car apply-result))
+ (error (cadr apply-result)))
+ (if error
+ (begin
+ (display error (current-error-port))
+ (if (defined? 'gnc:warn)
+ (gnc:warn error)))
+ result)))
;; This database can be used to store and retrieve translatable
;; strings. Strings that are returned by the lookup function are
@@ -56,5 +98,5 @@
(if func
(apply func args)
(gnc:warn "string-database: bad message" message "\n"))))
-
+
dispatch)
diff --git a/libgnucash/app-utils/gfec.c b/libgnucash/app-utils/gfec.c
index b640e2d..8e5f70a 100644
--- a/libgnucash/app-utils/gfec.c
+++ b/libgnucash/app-utils/gfec.c
@@ -18,134 +18,31 @@
# define strdup _strdup
#endif
-typedef struct {
- char **msg;
- SCM *scm_string;
-} helper_data_t;
-
-static SCM helper_scm_to_string(void *ptr_void)
-{
- helper_data_t* ptr = ptr_void;
- g_assert(ptr);
- *(ptr->msg) = gnc_scm_to_utf8_string(*ptr->scm_string);
- return SCM_UNDEFINED;
-}
-
-
-static int gfec_catcher_recursion_level = 0;
-
-/* We assume that data is actually a char**. The way we return results
- * from this function is to malloc a fresh string, and store it in
- * this pointer. It is the caller's responsibility to do something
- * smart with this freshly allocated storage. the caller can determine
- * whether there was an error by initializing the char* passed in to
- * NULL. If there is an error, the char string will not be NULL on
- * return.
- *
- * This function might call itself recursively: The conversion of the error
- * object to a string might itself throw an exception, hence the scm_to_string
- * function must be wrapped into a stack_catch block as well. To avoid infinite
- * recursion, we check the recursion level by gfec_catcher_recursion_level.
- */
-static SCM
-gfec_catcher(void *data, SCM tag, SCM throw_args)
-{
- SCM func;
- SCM result;
- char *msg = NULL;
-
- // To much recursion? Better jump out of here quickly.
- if (gfec_catcher_recursion_level > 2)
- {
- *(char**)data = strdup("Guile error: Too many recursions in error catch handler.");
- return SCM_UNDEFINED;
- }
-
- gfec_catcher_recursion_level++;
-
- func = scm_c_eval_string("gnc:error->string");
- if (scm_is_procedure(func))
- {
- result = scm_call_2(func, tag, throw_args);
- if (scm_is_string(result))
- {
- char *internal_err_msg = NULL;
- helper_data_t helper_data;
-
- helper_data.msg = &msg;
- helper_data.scm_string = &result;
-
- // The conversion to string can itself throw as well
- scm_internal_stack_catch(SCM_BOOL_T,
- helper_scm_to_string,
- (void *) &helper_data,
- gfec_catcher,
- &internal_err_msg);
- // Previously: msg = gnc_scm_to_utf8_string (result);
-
- // Did we run into an exception? Then the output argument msg is
- // not set (due to the exception), but err_msg is set and contains
- // that error message. We thus pass the err_msg instead of msg to
- // our caller.
- if (internal_err_msg)
- {
- msg = internal_err_msg;
- }
- }
- }
-
- if (msg == NULL)
- {
- *(char**)data = strdup("Error running guile function.");
- }
- else
- {
- *(char**)data = strdup(msg);
- g_free(msg);
- }
-
- --gfec_catcher_recursion_level;
- return SCM_UNDEFINED;
-}
-
-
-/* The arguments to scm_internal_stack_catch:
- ------------------------------------------
- SCM tag : this should be SCM_BOOL_T to catch all errors.
- scm_catch_body_t body : the function to run.
- void *body_data : a pointer to pass to body
- scm_catch_handler_t handler : the hander function
- void *handler_data : a pointer to pass to the handler
-*/
-
-static SCM
-gfec_string_helper(void *data)
-{
- char *string = data;
-
- return scm_c_eval_string(string);
-}
SCM
gfec_eval_string(const char *str, gfec_error_handler error_handler)
{
- char *err_msg = NULL;
- SCM result;
-
- result = scm_internal_stack_catch(SCM_BOOL_T,
- gfec_string_helper,
- (void *) str,
- gfec_catcher,
- &err_msg);
-
- if (err_msg != NULL)
+ SCM result = SCM_UNDEFINED;
+ SCM func = scm_c_eval_string("gnc:eval-string-with-error-handling");
+ if (scm_is_procedure(func))
{
- if (error_handler)
- error_handler(err_msg);
+ char *err_msg = NULL;
+ SCM call_result, error = SCM_UNDEFINED;
+ call_result = scm_call_1 (func, scm_from_utf8_string (str));
- free(err_msg);
+ error = scm_list_ref (call_result, scm_from_uint (1));
+ if (scm_is_true (error))
+ err_msg = gnc_scm_to_utf8_string (error);
+ else
+ result = scm_list_ref (call_result, scm_from_uint (0));
- return SCM_UNDEFINED;
+ if (err_msg != NULL)
+ {
+ if (error_handler)
+ error_handler (err_msg);
+
+ free(err_msg);
+ }
}
return result;
@@ -175,44 +72,30 @@ gfec_eval_file(const char *file, gfec_error_handler error_handler)
return result;
}
-struct gfec_apply_rec
-{
- SCM proc;
- SCM arglist;
-};
-
-static SCM
-gfec_apply_helper(void *data)
-{
- struct gfec_apply_rec *apply_rec = (struct gfec_apply_rec *)data;
-
- return scm_apply(apply_rec->proc, apply_rec->arglist, SCM_EOL);
-}
-
SCM
gfec_apply(SCM proc, SCM arglist, gfec_error_handler error_handler)
{
- char *err_msg = NULL;
- struct gfec_apply_rec apply_rec;
- SCM result;
-
- apply_rec.proc = proc;
- apply_rec.arglist = arglist;
-
- result = scm_internal_stack_catch(SCM_BOOL_T,
- gfec_apply_helper,
- &apply_rec,
- gfec_catcher,
- &err_msg);
-
- if (err_msg != NULL)
+ SCM result = SCM_UNDEFINED;
+ SCM func = scm_c_eval_string("gnc:apply-with-error-handling");
+ if (scm_is_procedure(func))
{
- if (error_handler)
- error_handler(err_msg);
+ char *err_msg = NULL;
+ SCM call_result, error;
+ call_result = scm_call_2 (func, proc, arglist);
- free(err_msg);
+ error = scm_list_ref (call_result, scm_from_uint (1));
+ if (scm_is_true (error))
+ err_msg = gnc_scm_to_utf8_string (error);
+ else
+ result = scm_list_ref (call_result, scm_from_uint (0));
- return SCM_UNDEFINED;
+ if (err_msg != NULL)
+ {
+ if (error_handler)
+ error_handler (err_msg);
+
+ free(err_msg);
+ }
}
return result;
diff --git a/libgnucash/app-utils/gnc-exp-parser.c b/libgnucash/app-utils/gnc-exp-parser.c
index 0f90281..23b787c 100644
--- a/libgnucash/app-utils/gnc-exp-parser.c
+++ b/libgnucash/app-utils/gnc-exp-parser.c
@@ -302,7 +302,7 @@ func_op(const char *fname, int argc, void **argv)
printf( "gnc:\"%s\" is not a scm procedure\n", fname );
return NULL;
}
- scmArgs = scm_listify( SCM_UNDEFINED );
+ scmArgs = scm_list_n (SCM_UNDEFINED);
for ( i = 0; i < argc; i++ )
{
/* cons together back-to-front. */
diff --git a/libgnucash/app-utils/test/test-exp-parser.c b/libgnucash/app-utils/test/test-exp-parser.c
index 94be10a..6c46c7f 100644
--- a/libgnucash/app-utils/test/test-exp-parser.c
+++ b/libgnucash/app-utils/test/test-exp-parser.c
@@ -189,9 +189,9 @@ test_parser (void)
"- 42.72 + 13.32 + 15.48 + 23.4 + 115.4",
gnc_numeric_create(35897, 100) );
- /* This must be defined for the function-parsing to work. */
- scm_c_eval_string("(define (gnc:error->string tag args) (define (write-error port) (if (and (list? args) (not (null? args))) (let ((func (car args))) (if func (begin (display \"Function: \" port) (display func port) (display \", \" port) (display tag port) (display \"\n\n\" port))))) (false-if-exception (apply display-error (fluid-ref the-last-stack) port args)) (display-backtrace (fluid-ref the-last-stack) port) (force-output port)) (false-if-exception (call-with-output-string write-error)))");
-
+ /* gnc:apply-with-error-handling must be defined because it's used
+ * indirectly through gfec_apply by the expression parser */
+ scm_c_eval_string("(define (gnc:apply-with-error-handling cmd args) (let ((captured-stack #f) (captured-error #f) (result #f)) (catch #t (lambda () (if (procedure? cmd) (set! result (apply cmd args))) (if (string? cmd) (set! result (eval-string cmd)))) (lambda (key . parameters) (let* ((str-port (open-output-string))) (display-backtrace captured-stack str-port) (display \"\n\" str-port) (print-exception str-port #f key parameters) (set! captured-error (get-output-string str-port)))) (lambda (key . parameters) (set! captured-stack (make-stack #t 3)))) (list result captured-error)))");
scm_c_eval_string( "(define (gnc:plus a b) (+ a b))" );
add_pass_test("plus(2 : 1)", NULL, gnc_numeric_create(3, 1));
add_fail_test("plus(1:2) plus(3:4)", NULL, 15);
diff --git a/libgnucash/app-utils/test/test-load-app-utils-module.scm b/libgnucash/app-utils/test/test-load-app-utils-module.scm
index 6bf102f..a3bd729 100755
--- a/libgnucash/app-utils/test/test-load-app-utils-module.scm
+++ b/libgnucash/app-utils/test/test-load-app-utils-module.scm
@@ -21,10 +21,10 @@
(display "Failed - module gnucash/app-utils not loaded successfully\n")
(set! exit-code -1)))
-(if (procedure? gnc:error->string)
- (display "Procedure gnc:error->string found\n")
+(if (procedure? gnc:apply-with-error-handling)
+ (display "Procedure gnc:apply-with-error-handling found\n")
(begin
- (display "Failed - procedure gnc:error->string not found\n")
+ (display "Failed - procedure gnc:apply-with-error-handling not found\n")
(set! exit-code -1)))
(if (procedure? gnc-default-currency)
diff --git a/libgnucash/app-utils/test/test-scm-query-string.cpp b/libgnucash/app-utils/test/test-scm-query-string.cpp
index 2d08da3..8031a9a 100644
--- a/libgnucash/app-utils/test/test-scm-query-string.cpp
+++ b/libgnucash/app-utils/test/test-scm-query-string.cpp
@@ -135,7 +135,7 @@ main (int argc, char **argv)
/* When built with clang, guile-1.8.8's scm_c_eval_string truncates all
* integer values to int32, which causes this test to fail.
*/
-#if !(defined(__clang__)) || defined(HAVE_GUILE20)
+#if !(defined(__clang__)) || defined(HAVE_GUILE20) || defined(HAVE_GUILE22)
scm_boot_guile (argc, argv, main_helper, NULL);
#endif
return 0;
diff --git a/libgnucash/scm/main.scm b/libgnucash/scm/main.scm
index 040f289..107a109 100644
--- a/libgnucash/scm/main.scm
+++ b/libgnucash/scm/main.scm
@@ -53,7 +53,6 @@
(export gnc:error)
(export gnc:msg)
(export gnc:debug)
-(export gnc:backtrace-if-exception)
(export gnc:safe-strcmp) ;; only used by aging.scm atm...
;; Get the Makefile.am/configure.in generated variables.
@@ -64,15 +63,6 @@
;; These are needed for a guile 1.3.4 bug
(debug-enable 'backtrace)
(read-enable 'positions)
-
-;; These options should only be set for guile < 2.0
-;; 'debug (deprecated and unused since guile 2)
-;; maxdepth (removed since guile 2)
-(cond-expand
- (guile-2 )
- (else
- (debug-enable 'debug)
- (debug-set! maxdepth 100000)))
(debug-set! stack 200000)
;; Initalialize localization, otherwise reports may output
@@ -94,32 +84,6 @@
(b -1)
(else 0))))
-(define (gnc:backtrace-if-exception proc . args)
- (define (dumper key . args)
- (let ((stack (make-stack #t dumper)))
- ;; Send debugging output to the console.
- (display-backtrace stack (current-error-port))
- (apply display-error stack (current-error-port) args)
-
- ;; Send debugging output to the log.
- (if (defined? 'gnc:warn)
- (let ((string-port (open-output-string)))
- (display-backtrace stack string-port)
- (apply display-error stack string-port args)
- (gnc:warn (get-output-string string-port))
- (close-output-port string-port)))
-
- (throw 'ignore)))
-
- (catch
- 'ignore
- (lambda ()
- (lazy-catch #t
- (lambda () (apply proc args))
- dumper))
- (lambda (key . args)
- #f)))
-
;;;; Status output functions.
(define (strify items)
Summary of changes:
CMakeLists.txt | 53 +++---
Makefile.am | 9 -
README | 3 +-
README.dependencies | 2 +-
common/CMakeLists.txt | 3 +-
common/Makefile.am | 1 -
common/cmake_modules/GncAddSchemeTargets.cmake | 84 +++++----
common/cmake_modules/GncAddTest.cmake | 4 +-
common/guile-mappings.h | 9 -
common/swig-utf8.patch | 60 -------
common/test-core/Makefile.am | 9 -
common/test-core/unittest-support.scm | 8 +-
configure.ac | 67 ++------
gnucash/environment.in | 6 +-
gnucash/gnome-utils/Makefile.am | 9 -
gnucash/gnome-utils/gnome-utils.scm | 7 +-
gnucash/gnome/Makefile.am | 7 -
gnucash/html/Makefile.am | 7 -
gnucash/import-export/qif-imp/Makefile.am | 5 +-
gnucash/import-export/qif-imp/qif-import.scm | 10 +-
gnucash/report/business-reports/Makefile.am | 2 -
gnucash/report/business-reports/balsheet-eg.scm | 5 +-
gnucash/report/business-reports/receipt.scm | 5 +-
gnucash/report/business-reports/taxinvoice.scm | 5 +-
gnucash/report/locale-specific/us/Makefile.am | 2 -
gnucash/report/locale-specific/us/taxtxf.scm | 7 +-
gnucash/report/report-gnome/Makefile.am | 9 -
.../report-gnome/dialog-report-column-view.c | 10 +-
gnucash/report/report-gnome/report-gnome.scm | 7 +-
.../test/test-load-report-gnome-module.scm | 3 -
gnucash/report/report-system/CMakeLists.txt | 18 +-
gnucash/report/report-system/Makefile.am | 9 -
gnucash/report/report-system/eguile-gnc.scm | 5 +-
gnucash/report/report-system/eguile-utilities.scm | 7 -
gnucash/report/report-system/report.scm | 8 +-
.../test/test-load-report-system-module.scm | 2 -
gnucash/report/standard-reports/Makefile.am | 2 -
.../test/test-standard-net-linechart.scm | 8 +-
gnucash/report/stylesheets/Makefile.am | 2 -
gnucash/report/utility-reports/Makefile.am | 2 -
gnucash/report/utility-reports/hello-world.scm | 5 -
gnucash/report/utility-reports/test-graphing.scm | 1 -
gnucash/report/utility-reports/view-column.scm | 8 +-
.../report/utility-reports/welcome-to-gnucash.scm | 7 +-
libgnucash/app-utils/Makefile.am | 10 +-
libgnucash/app-utils/app-utils.scm | 19 +--
libgnucash/app-utils/c-interface.scm | 80 ++++++---
libgnucash/app-utils/gettext.scm | 15 +-
libgnucash/app-utils/gfec.c | 189 ++++-----------------
libgnucash/app-utils/gnc-exp-parser.c | 2 +-
.../app-utils/make-prefs-migration-script.xsl | 12 +-
libgnucash/app-utils/options.scm | 7 -
libgnucash/app-utils/test/CMakeLists.txt | 18 +-
libgnucash/app-utils/test/Makefile.am | 7 +-
.../test/test-c-interface.scm} | 41 +++--
libgnucash/app-utils/test/test-exp-parser.c | 6 +-
.../app-utils/test/test-load-app-utils-module.scm | 14 +-
.../app-utils/test/test-scm-query-string.cpp | 5 -
libgnucash/core-utils/Makefile.am | 10 +-
libgnucash/core-utils/core-utils.scm | 8 +-
libgnucash/core-utils/gnc-guile-utils.c | 23 +--
libgnucash/engine/Makefile.am | 9 -
libgnucash/engine/engine.scm | 7 +-
libgnucash/gnc-module/Makefile.am | 9 -
libgnucash/gnc-module/gnc-module.scm | 16 +-
libgnucash/gnc-module/test/mod-bar/Makefile.am | 7 -
libgnucash/gnc-module/test/mod-baz/Makefile.am | 7 -
libgnucash/gnc-module/test/mod-foo/Makefile.am | 7 -
libgnucash/scm/CMakeLists.txt | 6 +-
libgnucash/scm/Makefile.am | 2 -
libgnucash/scm/gnumeric/Makefile.am | 2 -
libgnucash/scm/main.scm | 41 -----
libgnucash/tax/us/Makefile.am | 2 -
libgnucash/tax/us/de_DE.scm | 7 +-
74 files changed, 313 insertions(+), 777 deletions(-)
delete mode 100644 common/swig-utf8.patch
copy libgnucash/{engine/test/test-test-extras.scm => app-utils/test/test-c-interface.scm} (50%)
More information about the gnucash-changes
mailing list