gnucash master: Multiple changes pushed

John Ralls jralls at code.gnucash.org
Sun Jul 17 13:08:07 EDT 2022


Updated	 via  https://github.com/Gnucash/gnucash/commit/d87972e4 (commit)
	 via  https://github.com/Gnucash/gnucash/commit/f4c27d44 (commit)
	 via  https://github.com/Gnucash/gnucash/commit/3e2f7bc6 (commit)
	from  https://github.com/Gnucash/gnucash/commit/47904a85 (commit)



commit d87972e4306bd803361d1212ae7d2df36ee9f6ad
Author: John Ralls <jralls at ceridwen.us>
Date:   Tue Jul 12 13:14:12 2022 -0700

    Git-ignore .LCK files

diff --git a/.gitignore b/.gitignore
index d477d7e4c..588496ecf 100644
--- a/.gitignore
+++ b/.gitignore
@@ -199,3 +199,4 @@ xcuserdata/
 messages.mo
 /.settings/
 /build/
+*.LCK

commit f4c27d4494e16055cae5fd9896b35c5c33bea6d0
Author: John Ralls <jralls at ceridwen.us>
Date:   Tue Jul 12 13:13:41 2022 -0700

    Move gnc_ui_account_get_tax_info_string to gnc-locale-tax.c
    
    To prevent a circular dependency between libgnc-app-utils and
    libgnucash-guile.

diff --git a/bindings/CMakeLists.txt b/bindings/CMakeLists.txt
index 651037956..13ae396d0 100644
--- a/bindings/CMakeLists.txt
+++ b/bindings/CMakeLists.txt
@@ -3,6 +3,7 @@ add_subdirectory(python)
 
 set_local_dist(bindings_DIST_local
     CMakeLists.txt
+    app-utils.i
     business-core.i
     core-utils.i
     engine.i
diff --git a/libgnucash/app-utils/app-utils.i b/bindings/app-utils.i
similarity index 99%
rename from libgnucash/app-utils/app-utils.i
rename to bindings/app-utils.i
index 6e1430bc6..b97690fe1 100644
--- a/libgnucash/app-utils/app-utils.i
+++ b/bindings/app-utils.i
@@ -30,11 +30,13 @@ extern "C"
 #include <gnc-euro.h>
 #include <gnc-ui-util.h>
 #include <gnc-prefs-utils.h>
+#if defined(SWIGGUILE)
 #include <gnc-helpers.h>
+#include "gnc-engine-guile.h"
+#endif
 #include <gnc-accounting-period.h>
 #include <gnc-session.h>
 
-#include "gnc-engine-guile.h"
 #ifdef __cplusplus
 }
 #endif
diff --git a/libgnucash/app-utils/expressions.i b/bindings/expressions.i
similarity index 76%
copy from libgnucash/app-utils/expressions.i
copy to bindings/expressions.i
index 18aafbf6a..ff629d93f 100644
--- a/libgnucash/app-utils/expressions.i
+++ b/bindings/expressions.i
@@ -47,28 +47,26 @@ static SCM
 gnc_numeric_to_scm(gnc_numeric arg)
 {
     return gnc_numeric_check (arg) ? SCM_BOOL_F :
-           scm_divide (scm_from_int64 (arg.num), scm_from_int64 (arg.denom));
+        scm_divide (scm_from_int64 (arg.num), scm_from_int64 (arg.denom));
 }
 %}
-#include <gnc-sx-instance-model.h>
-%import "base-typemaps.i"
 
 %typemap(out) GHashTable * {
-SCM table = scm_c_make_hash_table (g_hash_table_size($1) + 17);
-GHashTableIter iter;
-gpointer key, value;
+  SCM table = scm_c_make_hash_table (g_hash_table_size($1) + 17);
+  GHashTableIter iter;
+  gpointer key, value;
 
-g_hash_table_iter_init (&iter, $1);
-while (g_hash_table_iter_next (&iter, &key, &value)) {
-const GncGUID* c_guid = (const GncGUID*) key;
-const gnc_numeric* c_numeric = (const gnc_numeric*) value;
-SCM scm_guid = gnc_guid2scm(*c_guid);
-SCM scm_numeric = gnc_numeric_to_scm(*c_numeric);
+  g_hash_table_iter_init (&iter, $1);
+  while (g_hash_table_iter_next (&iter, &key, &value)) {
+    const GncGUID* c_guid = (const GncGUID*) key;
+    const gnc_numeric* c_numeric = (const gnc_numeric*) value;
+    SCM scm_guid = gnc_guid2scm(*c_guid);
+    SCM scm_numeric = gnc_numeric_to_scm(*c_numeric);
 
-scm_hash_set_x(table, scm_guid, scm_numeric);
-}
-g_hash_table_destroy($1);
-$result = table;
+    scm_hash_set_x(table, scm_guid, scm_numeric);
+  }
+  g_hash_table_destroy($1);
+  $result = table;
 }
 GHashTable* gnc_sx_all_instantiate_cashflow_all(GDate range_start, GDate range_end);
 %clear GHashTable *;
diff --git a/bindings/guile/CMakeLists.txt b/bindings/guile/CMakeLists.txt
index 004a24be9..321145809 100644
--- a/bindings/guile/CMakeLists.txt
+++ b/bindings/guile/CMakeLists.txt
@@ -1,6 +1,6 @@
 add_subdirectory(test)
 
-# Command to generate the swig-core-utils-guile.c wrapper file
+# Generate the swig-core-utils-guile.c wrapper file
 gnc_swig_extract_header_files (gnc-core-utils CORE_UTILS_HEADERS)
 gnc_add_swig_guile_command (swig-core-utils-guile-c
     SWIG_CORE_UTILS_GUILE_C swig-core-utils-guile.c
@@ -9,7 +9,7 @@ gnc_add_swig_guile_command (swig-core-utils-guile-c
     ${CORE_UTILS_HEADERS}
 )
 
-# Command to generate the swig-engine.c wrapper file
+# Generate the swig-engine.c wrapper file
 gnc_swig_extract_header_files (gnc-engine ENGINE_HEADERS)
 gnc_add_swig_guile_command (swig-engine-c
     SWIG_ENGINE_C swig-engine.c
@@ -20,10 +20,28 @@ gnc_add_swig_guile_command (swig-engine-c
     ${CMAKE_SOURCE_DIR}/bindings/engine-common.i
 )
 
+# Generate the swig-app-utils-guile.cpp wrapper file
+set(SWIG_ARGS "-c++" "-procdoc" "sw-gnc-option-doc" "-procdocformat" "plain")
+gnc_add_swig_guile_command (swig-apputils-guile-cpp #target
+        SWIG_APP_UTILS_GUILE_CPP swig-app-utils-guile.cpp #outvar, output
+        ${CMAKE_CURRENT_SOURCE_DIR}/../app-utils.i #input
+        "${CMAKE_CURRENT_SOURCE_DIR};${CMAKE_SOURCE_DIR}/libgnucash/app-utils" #includes
+        ${CMAKE_CURRENT_SOURCE_DIR}/gnc-optiondb.i #additional dependencies
+        )
+unset(SWIG_ARGS)
+
+#Generate the swig-expressions-guile.c wrapper file
+gnc_add_swig_guile_command(swig-expressions-guile-c #target
+        SWIG_EXPRESSIONS_GUILE_C swig-expressions-guile.c #outvar, output
+        ${CMAKE_CURRENT_SOURCE_DIR}/expressions.i #input
+        "${CMAKE_CURRENT_SOURCE_DIR};${CMAKE_SOURCE_DIR}/libgnucash/app-utils;${CMAKE_SOURCE_DIR}/libgnucash/expressions" #includes
+        )
+
 set(guile_HEADERS
     glib-guile.h
     gnc-engine-guile.h
     gnc-guile-utils.h
+    gnc-helpers.h
     gnc-kvp-guile.h)
 
 set(guile_SOURCES
@@ -31,13 +49,15 @@ set(guile_SOURCES
     gnc-engine-guile.c
     gnc-guile-bindings.c
     gnc-guile-utils.c
+    gnc-helpers.c
     gnc-kvp-guile.cpp)
 
 add_library(gnucash-guile SHARED
     ${guile_SOURCES}
     ${guile_HEADERS}
     ${SWIG_CORE_UTILS_GUILE_C}
-    ${SWIG_ENGINE_C})
+    ${SWIG_ENGINE_C}
+    ${SWIG_APP_UTILS_GUILE_CPP})
 
 add_dependencies(gnucash-guile
     swig-runtime-h)
@@ -57,6 +77,7 @@ target_link_libraries(gnucash-guile
     PRIVATE
         gnc-core-utils
         gnc-engine
+        gnc-app-utils
         ${GLIB2_LDFLAGS})
 
 install(TARGETS gnucash-guile
@@ -65,6 +86,28 @@ install(TARGETS gnucash-guile
     RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
 )
 
+add_library(gnc-expressions-guile SHARED
+        ${SWIG_EXPRESSIONS_GUILE_C})
+
+target_include_directories(gnc-expressions-guile
+        PUBLIC
+        ${CMAKE_SOURCE_DIR}/libgnucash/expressions
+        ${GUILE_INCLUDE_DIRS}
+        ${GLIB2_INCLUDE_DIRS})
+
+target_link_libraries(gnc-expressions-guile
+        gnc-expressions
+        gnc-engine
+        gnc-app-utils
+        ${GUILE_LDFLAGS}
+        ${GLIB2_LDFLAGS})
+
+install(TARGETS gnc-expressions-guile
+        LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
+        ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
+        RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
+        )
+
 # Scheme
 
 set (core_utils_SCHEME core-utils.scm)
@@ -126,6 +169,57 @@ gnc_add_scheme_targets(scm-engine-2
 
 add_custom_target(scm-engine ALL DEPENDS scm-engine-2 scm-engine-1 scm-engine-0)
 
+set (app_utils_SCHEME_1
+        c-interface.scm
+        date-utilities.scm
+        )
+
+set (app_utils_SCHEME_1a
+        options.scm
+        )
+
+set (app_utils_SCHEME_2
+        app-utils.scm
+        )
+
+
+set(GUILE_DEPENDS
+        gnc-app-utils
+        scm-core-utils
+        scm-engine)
+
+gnc_add_scheme_targets(scm-app-utils-1
+        SOURCES "${app_utils_SCHEME_1}"
+        OUTPUT_DIR "gnucash/app-utils"
+        DEPENDS "${GUILE_DEPENDS}"
+        MAKE_LINKS)
+
+gnc_add_scheme_targets(scm-app-utils-1a
+        SOURCES "${app_utils_SCHEME_1a}"
+        OUTPUT_DIR "gnucash/app-utils"
+        DEPENDS "scm-app-utils-1"
+        MAKE_LINKS)
+
+gnc_add_scheme_targets(scm-app-utils-2
+        SOURCES "${app_utils_SCHEME_2}"
+        OUTPUT_DIR "gnucash"
+        DEPENDS "scm-app-utils-1a"
+        MAKE_LINKS)
+
+add_custom_target(scm-app-utils ALL DEPENDS scm-app-utils-2 scm-app-utils-1)
+
+set(expressions_SCHEME
+        fin.scm)
+
+set(GUILE_INTERNAL_DEPENDS
+        scm-app-utils-1)
+
+gnc_add_scheme_targets(scm-expressions
+        SOURCES "${expressions_SCHEME}"
+        OUTPUT_DIR "gnucash/app-utils"
+        DEPENDS "${GUILE_INTERNAL_DEPENDS}"
+        MAKE_LINKS)
+
 set_local_dist(guile_DIST_local
     CMakeLists.txt
     core-utils.scm
@@ -133,7 +227,14 @@ set_local_dist(guile_DIST_local
     ${guile_HEADERS}
     ${engine_SCHEME_0}
     ${engine_SCHEME_1}
-    ${engine_SCHEME_2})
+    ${engine_SCHEME_2}
+    ${app_utils_SCHEME_1}
+    ${app_utils_SCHEME_1a}
+    ${app_utils_SCHEME_1b}
+    ${app_utils_SCHEME_1c}
+    ${app_utils_SCHEME_2}
+    ${app_utils_SCHEME_3}
+    expressions.i)
 set(guile_DIST ${guile_DIST_local} ${test_guile_DIST} PARENT_SCOPE)
 
 
diff --git a/libgnucash/app-utils/app-utils.scm b/bindings/guile/app-utils.scm
similarity index 95%
rename from libgnucash/app-utils/app-utils.scm
rename to bindings/guile/app-utils.scm
index cb77eb7a6..aee1e8610 100644
--- a/libgnucash/app-utils/app-utils.scm
+++ b/bindings/guile/app-utils.scm
@@ -18,7 +18,7 @@
 (define-module (gnucash app-utils))
 
 (eval-when (compile load eval expand)
-  (load-extension "libgnc-app-utils" "scm_init_sw_app_utils_module"))
+  (load-extension "libgnucash-guile" "scm_init_sw_app_utils_module"))
 
 (use-modules (srfi srfi-1))
 (use-modules (gnucash utilities))
diff --git a/libgnucash/app-utils/c-interface.scm b/bindings/guile/c-interface.scm
similarity index 100%
rename from libgnucash/app-utils/c-interface.scm
rename to bindings/guile/c-interface.scm
diff --git a/libgnucash/app-utils/date-utilities.scm b/bindings/guile/date-utilities.scm
similarity index 99%
rename from libgnucash/app-utils/date-utilities.scm
rename to bindings/guile/date-utilities.scm
index 9395bac5f..f5a4e7766 100644
--- a/libgnucash/app-utils/date-utilities.scm
+++ b/bindings/guile/date-utilities.scm
@@ -24,7 +24,7 @@
 (define-module (gnucash app-utils date-utilities))
 
 (eval-when (compile load eval expand)
-  (load-extension "libgnc-app-utils" "scm_init_sw_app_utils_module"))
+  (load-extension "libgnucash-guile" "scm_init_sw_app_utils_module"))
 
 (use-modules (gnucash engine))
 (use-modules (gnucash core-utils))
diff --git a/libgnucash/app-utils/expressions.i b/bindings/guile/expressions.i
similarity index 100%
rename from libgnucash/app-utils/expressions.i
rename to bindings/guile/expressions.i
diff --git a/libgnucash/app-utils/fin.scm b/bindings/guile/fin.scm
similarity index 100%
rename from libgnucash/app-utils/fin.scm
rename to bindings/guile/fin.scm
diff --git a/libgnucash/app-utils/gnc-helpers.c b/bindings/guile/gnc-helpers.c
similarity index 100%
rename from libgnucash/app-utils/gnc-helpers.c
rename to bindings/guile/gnc-helpers.c
diff --git a/libgnucash/app-utils/gnc-helpers.h b/bindings/guile/gnc-helpers.h
similarity index 100%
rename from libgnucash/app-utils/gnc-helpers.h
rename to bindings/guile/gnc-helpers.h
diff --git a/libgnucash/app-utils/gnc-optiondb.i b/bindings/guile/gnc-optiondb.i
similarity index 100%
rename from libgnucash/app-utils/gnc-optiondb.i
rename to bindings/guile/gnc-optiondb.i
diff --git a/libgnucash/app-utils/options.scm b/bindings/guile/options.scm
similarity index 99%
rename from libgnucash/app-utils/options.scm
rename to bindings/guile/options.scm
index 390c52dad..d7a5e5d87 100644
--- a/libgnucash/app-utils/options.scm
+++ b/bindings/guile/options.scm
@@ -20,7 +20,7 @@
 (define-module (gnucash app-utils options))
 
 (eval-when (compile load eval expand)
-  (load-extension "libgnc-app-utils" "scm_init_sw_app_utils_module"))
+  (load-extension "libgnucash-guile" "scm_init_sw_app_utils_module"))
 
 (use-modules (gnucash core-utils))
 (use-modules (gnucash engine))
diff --git a/bindings/guile/test/CMakeLists.txt b/bindings/guile/test/CMakeLists.txt
index ebbb2f90a..bce963a28 100644
--- a/bindings/guile/test/CMakeLists.txt
+++ b/bindings/guile/test/CMakeLists.txt
@@ -6,15 +6,20 @@ set(ENGINE_TEST_INCLUDE_DIRS
     ${CMAKE_SOURCE_DIR}/libgnucash/engine/test-core
     ${CMAKE_BINARY_DIR}/common # for config.h
     ${CMAKE_SOURCE_DIR}/common/test-core  # for unittest-support.h
+    ${CMAKE_SOURCE_DIR}/libgnucash/app-utils
     ${CMAKE_SOURCE_DIR}/bindings/guile # for gnc-engine-guile.h
     ${GLIB2_INCLUDE_DIRS}
+    ${GUILE_INCLUDE_DIRS}
 )
 
 set(ENGINE_TEST_LIBS
     gnc-engine
+    gnc-app-utils
     gnc-test-engine
     test-core
     gnucash-guile
+    ${GIO_LDFLAGS}
+    ${GUILE_LDFLAGS}
     ${LIBXML2_LDFLAGS}
     -lm)
 
@@ -105,11 +110,57 @@ set(test_engine_SCHEME_DIST
     test-business-core.scm
 )
 
+set(test_app_utils_scheme_SOURCES
+        test-c-interface.scm
+        test-load-app-utils-module.scm
+        )
+
+set (test_app_utils_scheme_SRFI64_SOURCES
+        test-date-utilities.scm
+        test-options.scm
+        )
+
+gnc_add_scheme_test_targets(scm-test-load-app-utils-module
+        SOURCES "test-load-app-utils-module.scm"
+        OUTPUT_DIR "tests"
+        DEPENDS "${GUILE_DEPENDS}")
+
+gnc_add_scheme_test_targets(scm-test-c-interface
+        SOURCES "test-c-interface.scm"
+        OUTPUT_DIR "tests"
+        DEPENDS "${GUILE_DEPENDS}")
+
+gnc_add_scheme_tests("${test_app_utils_scheme_SOURCES}")
+
+if (HAVE_SRFI64)
+    gnc_add_scheme_test_targets(scm-test-app-utils-srfi64
+            SOURCES "${test_app_utils_scheme_SRFI64_SOURCES}"
+            OUTPUT_DIR "tests"
+            DEPENDS "${GUILE_DEPENDS};scm-srfi64-extras")
+
+    gnc_add_scheme_test_targets(scm-test-gnc-optiondb
+            SOURCES "test-gnc-optiondb.scm" "test-gnc-option-scheme-output.scm"
+            OUTPUT_DIR "tests"
+            DEPENDS "swig-apputils-guile-cpp;scm-srfi64-extras")
+    gnc_add_scheme_tests("test-gnc-optiondb.scm")
+    gnc_add_scheme_tests("test-gnc-option-scheme-output.scm")
+    gnc_add_scheme_tests("${test_app_utils_scheme_SRFI64_SOURCES}")
+endif()
+
+gnc_add_test_with_guile(test-print-queries test-print-queries.cpp ENGINE_TEST_INCLUDE_DIRS ENGINE_TEST_LIBS)
+gnc_add_test_with_guile(test-scm-query-string test-scm-query-string.cpp
+        ENGINE_TEST_INCLUDE_DIRS ENGINE_TEST_LIBS
+        )
+
 set_local_dist(test_guile_DIST_local
     CMakeLists.txt
+    test-print-queries.cpp
     test-scm-query.cpp
+    test-scm-query-string.cpp
     ${test_engine_SCHEME_DIST}
     ${test_scm_SCHEME}
+    ${test_app_utils_scheme_SOURCES}
+    ${test_app_utils_scheme_SRFI64_SOURCES}
 )
 set(test_guile_DIST
     ${test_guile_DIST_local}
diff --git a/libgnucash/app-utils/test/test-c-interface.scm b/bindings/guile/test/test-c-interface.scm
similarity index 100%
rename from libgnucash/app-utils/test/test-c-interface.scm
rename to bindings/guile/test/test-c-interface.scm
diff --git a/libgnucash/app-utils/test/test-date-utilities.scm b/bindings/guile/test/test-date-utilities.scm
similarity index 100%
rename from libgnucash/app-utils/test/test-date-utilities.scm
rename to bindings/guile/test/test-date-utilities.scm
diff --git a/libgnucash/app-utils/test/test-gnc-option-scheme-output.scm b/bindings/guile/test/test-gnc-option-scheme-output.scm
similarity index 100%
rename from libgnucash/app-utils/test/test-gnc-option-scheme-output.scm
rename to bindings/guile/test/test-gnc-option-scheme-output.scm
diff --git a/libgnucash/app-utils/test/test-gnc-optiondb.scm b/bindings/guile/test/test-gnc-optiondb.scm
similarity index 99%
rename from libgnucash/app-utils/test/test-gnc-optiondb.scm
rename to bindings/guile/test/test-gnc-optiondb.scm
index 7174a4f53..f19af1008 100644
--- a/libgnucash/app-utils/test/test-gnc-optiondb.scm
+++ b/bindings/guile/test/test-gnc-optiondb.scm
@@ -39,7 +39,7 @@
 ;; Load the C++ option implementation, avoiding the options.scm ones.
 (eval-when
  (compile load eval expand)
- (load-extension "libgnc-app-utils" "scm_init_sw_app_utils_module"))
+ (load-extension "libgnucash-guile" "scm_init_sw_app_utils_module"))
 
 (use-modules (gnucash engine))
 (use-modules (sw_app_utils))
@@ -246,4 +246,4 @@
            (gnc-register-report-placement-option option-db "foo" "bar")
            (gnc-set-option option-db "foo" "bar" rp)
            (test-equal report2 (car (cadr (gnc-option-value option-db "foo" "bar")))))
-  (test-end "test-gnc-report-placement-option"))
\ No newline at end of file
+  (test-end "test-gnc-report-placement-option"))
diff --git a/libgnucash/app-utils/test/test-load-app-utils-module.scm b/bindings/guile/test/test-load-app-utils-module.scm
similarity index 100%
rename from libgnucash/app-utils/test/test-load-app-utils-module.scm
rename to bindings/guile/test/test-load-app-utils-module.scm
diff --git a/libgnucash/app-utils/test/test-options.scm b/bindings/guile/test/test-options.scm
similarity index 94%
rename from libgnucash/app-utils/test/test-options.scm
rename to bindings/guile/test/test-options.scm
index 8e28da919..f243e195f 100644
--- a/libgnucash/app-utils/test/test-options.scm
+++ b/bindings/guile/test/test-options.scm
@@ -2,7 +2,7 @@
 ;; Load the C++ option implementation, avoiding the options.scm ones.
 (eval-when
  (compile load eval expand)
- (load-extension "libgnc-app-utils" "scm_init_sw_app_utils_module"))
+ (load-extension "libgnucash-guile" "scm_init_sw_app_utils_module"))
 (use-modules (sw_app_utils))
 (use-modules (srfi srfi-64))
 (use-modules (tests srfi64-extras))
diff --git a/libgnucash/app-utils/test/test-print-queries.cpp b/bindings/guile/test/test-print-queries.cpp
similarity index 100%
rename from libgnucash/app-utils/test/test-print-queries.cpp
rename to bindings/guile/test/test-print-queries.cpp
diff --git a/libgnucash/app-utils/test/test-scm-query-string.cpp b/bindings/guile/test/test-scm-query-string.cpp
similarity index 100%
rename from libgnucash/app-utils/test/test-scm-query-string.cpp
rename to bindings/guile/test/test-scm-query-string.cpp
diff --git a/bindings/python/CMakeLists.txt b/bindings/python/CMakeLists.txt
index 4e7480495..19c7ee043 100644
--- a/bindings/python/CMakeLists.txt
+++ b/bindings/python/CMakeLists.txt
@@ -55,6 +55,13 @@ gnc_add_swig_python_command (swig-core-utils-python
     ${CORE_UTILS_HEADERS}
 )
 
+# Command to generate the swig-app-utils-python.c wrapper file
+gnc_add_swig_python_command (swig-app-utils-python
+        SWIG_APP_UTILS_PYTHON_C SWIG_APP_UTILS_PYTHON_PY
+        swig-app-utils-python.c sw_app_utils.py
+        ${CMAKE_CURRENT_SOURCE_DIR}/../app-utils.i ""
+        )
+
 if(WITH_PYTHON)
 
   ### gnucash_core_c
@@ -146,6 +153,39 @@ if(WITH_PYTHON)
     COMMAND ${CMAKE_COMMAND} -E copy ${LIBDIR_BUILD}/gnucash/_sw_core_utils${CMAKE_SHARED_MODULE_SUFFIX} ${PYTHON_SYSCONFIG_BUILD}/gnucash
     DEPENDS sw_core_utils)
 
+  ### App-utils
+  set(PYEXEC_FILES sw_app_utils.py)
+  add_library (sw_app_utils MODULE ${SWIG_APP_UTILS_PYTHON_C})
+
+  target_link_libraries(sw_app_utils gnc-app-utils ${app_utils_ALL_LIBRARIES} ${PYTHON_LIBRARIES})
+  set_target_properties(sw_app_utils PROPERTIES PREFIX "_")
+  if (HAVE_STRINGOP_TRUNCATION)
+    target_compile_options(sw_app_utils PRIVATE -Wno-error=stringop-truncation)
+  endif()
+
+  add_custom_target(sw-app-utils-py ALL
+          COMMAND ${CMAKE_COMMAND} -E copy ${SWIG_APP_UTILS_PYTHON_PY} ${PYTHON_SYSCONFIG_BUILD}/gnucash
+          DEPENDS ${SWIG_APP_UTILS_PYTHON_C})
+
+  target_include_directories (sw_app_utils
+          PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}
+          PRIVATE ${app_utils_ALL_INCLUDES} ${PYTHON_INCLUDE_DIRS}
+          )
+  target_compile_definitions (sw_app_utils PRIVATE -DG_LOG_DOMAIN=\"gnc.app-utils\")
+
+  if (APPLE)
+    set_target_properties (sw_app_utils PROPERTIES INSTALL_NAME_DIR "${CMAKE_INSTALL_FULL_LIBDIR}")
+  endif()
+
+  install(TARGETS sw_app_utils
+          LIBRARY DESTINATION ${PYTHON_SYSCONFIG_OUTPUT}/gnucash
+          ARCHIVE DESTINATION ${PYTHON_SYSCONFIG_OUTPUT}/gnucash
+          )
+
+  add_custom_target(sw-app-utils-build ALL
+          COMMAND ${CMAKE_COMMAND} -E copy ${LIBDIR_BUILD}/gnucash/_sw_app_utils${CMAKE_SHARED_MODULE_SUFFIX} ${PYTHON_SYSCONFIG_BUILD}/gnucash
+          DEPENDS sw_app_utils)
+
 endif()
 
 set(python_bindings_DATA ${PYEXEC_FILES}
diff --git a/gnucash/gnome-utils/CMakeLists.txt b/gnucash/gnome-utils/CMakeLists.txt
index a2bc8adb4..2ef9caf49 100644
--- a/gnucash/gnome-utils/CMakeLists.txt
+++ b/gnucash/gnome-utils/CMakeLists.txt
@@ -207,6 +207,7 @@ target_link_libraries(gnc-gnome-utils
     gnc-app-utils
     gnc-engine
     gnc-expressions
+    gnc-locale-tax
     gnc-backend-xml-utils
     gnucash-guile
     PkgConfig::GTK3
diff --git a/gnucash/gnome-utils/dialog-account.c b/gnucash/gnome-utils/dialog-account.c
index 4f79f08cf..63ab3808a 100644
--- a/gnucash/gnome-utils/dialog-account.c
+++ b/gnucash/gnome-utils/dialog-account.c
@@ -49,7 +49,7 @@
 #include "gnc-tree-view-account.h"
 #include "gnc-ui.h"
 #include "gnc-ui-util.h"
-
+#include <gnc-locale-tax.h>
 
 #define DIALOG_NEW_ACCOUNT_CM_CLASS "dialog-new-account"
 #define DIALOG_EDIT_ACCOUNT_CM_CLASS "dialog-edit-account"
diff --git a/gnucash/gnome-utils/gnc-tree-model-account.c b/gnucash/gnome-utils/gnc-tree-model-account.c
index e04eac9ad..c8345fef4 100644
--- a/gnucash/gnome-utils/gnc-tree-model-account.c
+++ b/gnucash/gnome-utils/gnc-tree-model-account.c
@@ -41,6 +41,7 @@
 #include "gnc-gobject-utils.h"
 #include "gnc-ui-balances.h"
 #include "gnc-ui-util.h"
+#include <gnc-locale-tax.h>
 
 #define TREE_MODEL_ACCOUNT_CM_CLASS "tree-model-account"
 
diff --git a/libgnucash/app-utils/CMakeLists.txt b/libgnucash/app-utils/CMakeLists.txt
index 338fd8362..987831737 100644
--- a/libgnucash/app-utils/CMakeLists.txt
+++ b/libgnucash/app-utils/CMakeLists.txt
@@ -17,7 +17,6 @@ set (app_utils_noinst_HEADERS
 set (app_utils_HEADERS
   QuickFill.h
   file-utils.h
-  gfec.h
   gnc-basic-gobject.h
   gnc-account-merge.h
   gnc-accounting-period.h
@@ -26,7 +25,6 @@ set (app_utils_HEADERS
   gnc-euro.h
   gnc-gsettings.h
   gnc-help-utils.h
-  gnc-helpers.h
   gnc-option.hpp
   gnc-optiondb.h
   gnc-optiondb.hpp
@@ -36,34 +34,15 @@ set (app_utils_HEADERS
   gnc-ui-balances.h
 )
 
-# Command to generate the swig-app-utils-guile.c wrapper file
-set(SWIG_ARGS "-c++" "-procdoc" "sw-gnc-option-doc" "-procdocformat" "plain")
-gnc_add_swig_guile_command (swig-apputils-guile-cpp #target
-    SWIG_APP_UTILS_GUILE_CPP swig-app-utils-guile.cpp #outvar, output
-    ${CMAKE_CURRENT_SOURCE_DIR}/app-utils.i #input
-    "${CMAKE_SOURCE_DIR}/bindings;${CMAKE_SOURCE_DIR}/bindings/guile" #includes
-    ${CMAKE_CURRENT_SOURCE_DIR}/gnc-optiondb.i #additional dependencies
-)
-unset(SWIG_ARGS)
-
-# Command to generate the swig-app-utils-python.c wrapper file
-gnc_add_swig_python_command (swig-app-utils-python
-    SWIG_APP_UTILS_PYTHON_C SWIG_APP_UTILS_PYTHON_PY
-    swig-app-utils-python.c sw_app_utils.py
-    ${CMAKE_CURRENT_SOURCE_DIR}/app-utils.i ""
-)
-
 set (app_utils_SOURCES
   QuickFill.c
   file-utils.c
-  gfec.c
   gnc-account-merge.c
   gnc-accounting-period.c
   gnc-addr-quickfill.c
   gnc-entry-quickfill.c
   gnc-euro.c
   gnc-gsettings.cpp
-  gnc-helpers.c
   gnc-option-date.cpp
   gnc-option.cpp
   gnc-option-impl.cpp
@@ -84,8 +63,6 @@ endif()
 set(app_utils_ALL_SOURCES ${app_utils_SOURCES} ${app_utils_HEADERS} ${app_utils_noinst_HEADERS})
 set(app_utils_ALL_LIBRARIES
     gnc-engine
-    gnc-locale-tax
-    gnucash-guile
     ${GLIB_LDFLAGS}
     ${GIO_LDFLAGS}
     ${LIBXML2_LDFLAGS}
@@ -130,44 +107,10 @@ install(TARGETS gnc-app-utils
   RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
 )
 
-if (WITH_PYTHON)
-  set(PYEXEC_FILES sw_app_utils.py)
-  add_library (sw_app_utils MODULE ${SWIG_APP_UTILS_PYTHON_C})
-
-  target_link_libraries(sw_app_utils gnc-app-utils ${app_utils_ALL_LIBRARIES} ${PYTHON_LIBRARIES})
-  set_target_properties(sw_app_utils PROPERTIES PREFIX "_")
-  if (HAVE_STRINGOP_TRUNCATION)
-    target_compile_options(sw_app_utils PRIVATE -Wno-error=stringop-truncation)
-  endif()
-
-  target_include_directories (sw_app_utils
-    PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}
-    PRIVATE ${app_utils_ALL_INCLUDES} ${PYTHON_INCLUDE_DIRS}
-  )
-  target_compile_definitions (sw_app_utils PRIVATE -DG_LOG_DOMAIN=\"gnc.app-utils\")
-
-  if (APPLE)
-    set_target_properties (sw_app_utils PROPERTIES INSTALL_NAME_DIR "${CMAKE_INSTALL_FULL_LIBDIR}")
-  endif()
-
-  install(TARGETS sw_app_utils
-    LIBRARY DESTINATION ${PYTHON_SYSCONFIG_OUTPUT}/gnucash
-    ARCHIVE DESTINATION ${PYTHON_SYSCONFIG_OUTPUT}/gnucash
-  )
-
-  add_custom_target(sw-app-utils-py ALL
-    COMMAND ${CMAKE_COMMAND} -E copy ${SWIG_APP_UTILS_PYTHON_PY} ${PYTHON_SYSCONFIG_BUILD}/gnucash
-    DEPENDS ${SWIG_APP_UTILS_PYTHON_C})
-
-  add_custom_target(sw-app-utils-build ALL
-    COMMAND ${CMAKE_COMMAND} -E copy ${LIBDIR_BUILD}/gnucash/_sw_app_utils${CMAKE_SHARED_MODULE_SUFFIX} ${PYTHON_SYSCONFIG_BUILD}/gnucash
-    DEPENDS sw_app_utils)
-
-endif()
-
 set(expressions_SOURCES
         calculation/expression_parser.c
         calculation/fin.c
+        gfec.c
         gnc-exp-parser.c
         gnc-sx-instance-model.c
         )
@@ -179,6 +122,7 @@ set(expressions_noinstall_HEADERS
         calculation/fin_static_proto.h
         )
 set(expressions_HEADERS
+        gfec.h
         gnc-exp-parser.h
         gnc-sx-instance-model.h
         )
@@ -206,8 +150,8 @@ target_include_directories(gnc-expressions
 target_link_libraries(gnc-expressions
         PUBLIC
         gnc-engine
-        gnucash-guile
         gnc-app-utils
+        gnucash-guile
         ${GUILE_LDFLAGS}
         ${GLIB2_LDFLAGS})
 
@@ -217,90 +161,9 @@ install(TARGETS gnc-expressions
         RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
         )
 
-#Generate the swig-expressions-guile.c wrapper file
-gnc_add_swig_guile_command(swig-expressions-guile-c #target
-        SWIG_EXPRESSIONS_GUILE_C swig-expressions-guile.c #outvar, output
-        ${CMAKE_CURRENT_SOURCE_DIR}/expressions.i #input
-        "${CMAKE_CURRENT_SOURCE_DIR};${CMAKE_SOURCE_DIR}/libgnucash/app-utils;${CMAKE_SOURCE_DIR}/libgnucash/expressions" #includes
-        )
-
-add_library(gnc-expressions-guile SHARED
-        ${SWIG_EXPRESSIONS_GUILE_C})
-
-target_include_directories(gnc-expressions-guile
-        PUBLIC
-        ${CMAKE_SOURCE_DIR}/libgnucash/expressions
-        ${GUILE_INCLUDE_DIRS}
-        ${GLIB2_INCLUDE_DIRS})
-
-target_link_libraries(gnc-expressions-guile
-        gnc-expressions
-        gnc-engine
-        gnc-app-utils
-        ${GUILE_LDFLAGS}
-        ${GLIB2_LDFLAGS})
-
-install(TARGETS gnc-expressions-guile
-        LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
-        ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
-        RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
-        )
 
 install(FILES ${app_utils_HEADERS} ${expressions_HEADERS}
         DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/gnucash)
-
-# And now handle scheme files
-
-set (app_utils_SCHEME_1
-    c-interface.scm
-    date-utilities.scm
-)
-
-set (app_utils_SCHEME_1a
-    options.scm
-)
-
-set (app_utils_SCHEME_2
-    app-utils.scm
-)
-
-set(GUILE_DEPENDS
-    gnc-app-utils
-    scm-core-utils
-    scm-engine)
-
-gnc_add_scheme_targets(scm-app-utils-1
-    SOURCES "${app_utils_SCHEME_1}"
-    OUTPUT_DIR "gnucash/app-utils"
-    DEPENDS "${GUILE_DEPENDS}"
-    MAKE_LINKS)
-
-gnc_add_scheme_targets(scm-app-utils-1a
-    SOURCES "${app_utils_SCHEME_1a}"
-    OUTPUT_DIR "gnucash/app-utils"
-    DEPENDS "scm-app-utils-1"
-    MAKE_LINKS)
-
-gnc_add_scheme_targets(scm-app-utils-2
-    SOURCES "${app_utils_SCHEME_2}"
-    OUTPUT_DIR "gnucash"
-    DEPENDS "scm-app-utils-1a"
-    MAKE_LINKS)
-
-add_custom_target(scm-app-utils ALL DEPENDS scm-app-utils-2 scm-app-utils-1)
-
-set(expressions_SCHEME
-        fin.scm)
-
-set(GUILE_INTERNAL_DEPENDS
-        scm-app-utils-1)
-
-gnc_add_scheme_targets(scm-expressions
-        SOURCES "${expressions_SCHEME}"
-        OUTPUT_DIR "gnucash/app-utils"
-        DEPENDS "${GUILE_INTERNAL_DEPENDS}"
-        MAKE_LINKS)
-
 set_local_dist(app_utils_DIST_local
     ${app_utils_ALL_SOURCES}
     ${app_utils_SCHEME_1}
@@ -313,6 +176,7 @@ set_local_dist(app_utils_DIST_local
     ${expressions_SCHEME}
     app-utils.i gnc-optiondb.i expressions.i CMakeLists.txt gnc-help-utils.c)
 
+
 set(app_utils_DIST
     ${app_utils_DIST_local}
     ${test_app_utils_DIST}
diff --git a/libgnucash/app-utils/gnc-option-impl.hpp b/libgnucash/app-utils/gnc-option-impl.hpp
index 75dd9d41f..9102f3e58 100644
--- a/libgnucash/app-utils/gnc-option-impl.hpp
+++ b/libgnucash/app-utils/gnc-option-impl.hpp
@@ -43,7 +43,6 @@ extern "C"
 #include <gnc-commodity.h>
 }
 #include <gnc-datetime.hpp>
-#include <libguile.h>
 #include <string>
 #include <utility>
 #include <vector>
diff --git a/libgnucash/app-utils/gnc-option.hpp b/libgnucash/app-utils/gnc-option.hpp
index 9cb97acff..138b3fbc6 100644
--- a/libgnucash/app-utils/gnc-option.hpp
+++ b/libgnucash/app-utils/gnc-option.hpp
@@ -34,7 +34,6 @@
 #define GNC_OPTION_HPP_
 
 #include <glib.h>
-#include <libguile.h>
 #include <string>
 #include <iostream>
 #include <iomanip>
diff --git a/libgnucash/app-utils/gnc-optiondb.cpp b/libgnucash/app-utils/gnc-optiondb.cpp
index dcec0e109..d94e1f650 100644
--- a/libgnucash/app-utils/gnc-optiondb.cpp
+++ b/libgnucash/app-utils/gnc-optiondb.cpp
@@ -21,7 +21,6 @@
  *                                                                  *
 \********************************************************************/
 
-#include <libguile.h>
 #include <functional>
 #include <string>
 #include <limits>
diff --git a/libgnucash/app-utils/gnc-optiondb.h b/libgnucash/app-utils/gnc-optiondb.h
index 88d12300d..4048e51aa 100644
--- a/libgnucash/app-utils/gnc-optiondb.h
+++ b/libgnucash/app-utils/gnc-optiondb.h
@@ -63,8 +63,6 @@ typedef struct GncOption GncOption;
 typedef struct GncOptionDB GncOptionDB;
 #endif
 
-#include <libguile.h>
-
 #ifdef __cplusplus
 extern "C"
 {
diff --git a/libgnucash/app-utils/gnc-optiondb.hpp b/libgnucash/app-utils/gnc-optiondb.hpp
index 25920f4c2..2fbb3237a 100644
--- a/libgnucash/app-utils/gnc-optiondb.hpp
+++ b/libgnucash/app-utils/gnc-optiondb.hpp
@@ -38,7 +38,6 @@
 #include <exception>
 #include <optional>
 #include <iostream>
-#include <libguile.h>
 extern "C"
 {
 #include <config.h>
diff --git a/libgnucash/app-utils/gnc-ui-util.c b/libgnucash/app-utils/gnc-ui-util.c
index c0279eebc..8b060d17e 100644
--- a/libgnucash/app-utils/gnc-ui-util.c
+++ b/libgnucash/app-utils/gnc-ui-util.c
@@ -29,7 +29,6 @@
 #include <glib.h>
 #include <glib/gi18n.h>
 #include <gio/gio.h>
-#include <libguile.h>
 #include <ctype.h>
 #include <errno.h>
 #include <limits.h>
@@ -45,18 +44,15 @@
 
 
 #include "qof.h"
-#include "guile-mappings.h"
 #include "gnc-prefs.h"
 #include "Account.h"
 #include "Transaction.h"
 #include "gnc-engine.h"
 #include "gnc-features.h"
 #include "gnc-hooks.h"
-#include "gnc-locale-tax.h"
 #include "gnc-session.h"
 #include "engine-helpers.h"
 #include "gnc-locale-utils.h"
-#include "gnc-guile-utils.h"
 
 #define GNC_PREF_CURRENCY_CHOICE_LOCALE "currency-choice-locale"
 #define GNC_PREF_CURRENCY_CHOICE_OTHER  "currency-choice-other"
@@ -467,263 +463,6 @@ gnc_account_lookup_for_register(const Account *base_account, const char *name)
         return gnc_account_lookup_by_full_name (base_account, name);
 }
 
-
-/* Caller is responsible for g_free'ing returned memory */
-char *
-gnc_ui_account_get_tax_info_string (const Account *account)
-{
-    static SCM get_form = SCM_UNDEFINED;
-    static SCM get_desc = SCM_UNDEFINED;
-
-    gboolean tax_related = FALSE;
-    const char *code;
-
-    if (!account)
-        return NULL;
-
-    tax_related = xaccAccountGetTaxRelated (account);
-    code = xaccAccountGetTaxUSCode (account);
-
-    if (!code)
-    {
-        if (!tax_related)
-            return NULL;
-        /* tax_related && !code */
-        else
-            /* Translators: This and the following strings appear on
-               the account tab if the Tax Info column is displayed,
-               i.e. if the user wants to record the tax form number
-               and location on that tax form which corresponds to this
-               gnucash account. For the US Income Tax support in
-               gnucash, each tax code that can be assigned to an
-               account generally corresponds to a specific line number
-               on a paper form and each form has a unique
-               identification (e.g., Form 1040, Schedule A). */
-            return g_strdup (_("Tax-related but has no tax code"));
-    }
-    else  /* with tax code */
-    {
-        const gchar *tax_type;
-        GNCAccountType atype;
-        SCM tax_entity_type;
-        SCM category;
-        gchar *num_code = NULL;
-        const gchar *prefix = "N";
-        gchar *return_string = NULL;
-
-        tax_type = gnc_get_current_book_tax_type ();
-        if (tax_type == NULL || (g_strcmp0 (tax_type, "") == 0))
-            return g_strdup (_("Tax entity type not specified"));
-
-        atype = xaccAccountGetType (account);
-        tax_entity_type = scm_from_utf8_string (tax_type);
-
-        if (get_form == SCM_UNDEFINED)
-        {
-            const gchar *tax_module;
-            /* load the tax info */
-            gnc_locale_tax_init ();
-
-            get_form = scm_c_eval_string
-                       ("(false-if-exception gnc:txf-get-form)");
-            get_desc = scm_c_eval_string
-                       ("(false-if-exception gnc:txf-get-description)");
-        }
-
-        g_return_val_if_fail (scm_is_procedure (get_form), NULL);
-        g_return_val_if_fail (scm_is_procedure (get_desc), NULL);
-
-        category = scm_c_eval_string (atype == ACCT_TYPE_INCOME ?
-                                      "txf-income-categories" :
-                                      (atype == ACCT_TYPE_EXPENSE ?
-                                       "txf-expense-categories" :
-                                       (((atype == ACCT_TYPE_BANK)      ||
-                                         (atype == ACCT_TYPE_CASH)      ||
-                                         (atype == ACCT_TYPE_ASSET)     ||
-                                         (atype == ACCT_TYPE_STOCK)     ||
-                                         (atype == ACCT_TYPE_MUTUAL)    ||
-                                         (atype == ACCT_TYPE_RECEIVABLE)) ?
-                                        "txf-asset-categories" :
-                                        (((atype == ACCT_TYPE_CREDIT)    ||
-                                          (atype == ACCT_TYPE_LIABILITY) ||
-                                          (atype == ACCT_TYPE_EQUITY)    ||
-                                          (atype == ACCT_TYPE_PAYABLE)) ?
-                                         "txf-liab-eq-categories" : ""))));
-
-        if (g_str_has_prefix (code, prefix))
-        {
-            const gchar *num_code_tmp;
-            num_code_tmp = g_strdup (code);
-            num_code_tmp++; /* to lose the leading N */
-            num_code = g_strdup (num_code_tmp);
-            num_code_tmp--;
-            g_free ((gpointer *) num_code_tmp);
-        }
-        else
-        {
-            num_code = g_strdup (code);
-        }
-
-        if (category == SCM_UNDEFINED)
-        {
-            if (tax_related)
-                return_string = g_strdup_printf
-                                (_("Tax type %s: invalid code %s for account type"),
-                                 tax_type, num_code);
-            else
-                return_string = g_strdup_printf
-                                (_("Not tax-related; tax type %s: invalid code %s for account type"),
-                                 tax_type, num_code);
-        }
-        else
-        {
-            SCM code_scm;
-            SCM form_scm;
-            code_scm = scm_from_locale_symbol (code);
-            form_scm = scm_call_3 (get_form, category, code_scm, tax_entity_type);
-            if (!scm_is_string (form_scm))
-            {
-                if (tax_related)
-                    return_string =  g_strdup_printf
-                                     (_("Invalid code %s for tax type %s"),
-                                      num_code, tax_type);
-                else
-                    return_string =  g_strdup_printf
-                                     (_("Not tax-related; invalid code %s for tax type %s"),
-                                      num_code, tax_type);
-            }
-            else
-            {
-                gchar *form = NULL;
-
-                /* Note: using scm_to_utf8_stringn directly here instead
-                   of our wrapper gnc_scm_to_utf8_string. 'form' should
-                   be freed with 'free' instead of 'g_free'. This will
-                   be taken care of automatically during scm_dynwind_end,
-                   because we inform guile of this memory allocation via
-                   scm_dynwind_free a little further. */
-                form = scm_to_utf8_stringn (form_scm, NULL);
-                if (!form)
-                {
-                    if (tax_related)
-                        return_string = g_strdup_printf
-                                        (_("No form: code %s, tax type %s"), num_code,
-                                         tax_type);
-                    else
-                        return_string = g_strdup_printf
-                                        (_("Not tax-related; no form: code %s, tax type %s"),
-                                         num_code, tax_type);
-                }
-                else
-                {
-                    SCM desc_scm;
-
-                    /* Create a dynwind context because we will be calling (scm) functions
-                       that potentially exit non-locally */
-                    scm_dynwind_begin (0);
-                    scm_dynwind_free (form);
-                    desc_scm = scm_call_3 (get_desc, category, code_scm,
-                                           tax_entity_type);
-                    if (!scm_is_string (desc_scm))
-                    {
-                        if (tax_related)
-                            return_string = g_strdup_printf
-                                            (_("No description: form %s, code %s, tax type %s"),
-                                             form, num_code, tax_type);
-                        else
-                            return_string = g_strdup_printf
-                                            (_("Not tax-related; no description: form %s, code %s, tax type %s"),
-                                             form, num_code, tax_type);
-                    }
-                    else
-                    {
-                        gchar *desc = NULL;
-                        desc = gnc_scm_to_utf8_string (desc_scm);
-                        if (!desc)
-                        {
-                            if (tax_related)
-                                return_string = g_strdup_printf
-                                                (_("No description: form %s, code %s, tax type %s"),
-                                                 form, num_code, tax_type);
-                            else
-                                return_string = g_strdup_printf
-                                                (_("Not tax-related; no description: form %s, code %s, tax type %s"),
-                                                 form, num_code, tax_type);
-                        }
-                        else
-                        {
-                            gint64 copy_number;
-                            gchar *copy_txt = NULL;
-                            copy_number = xaccAccountGetTaxUSCopyNumber (account);
-                            copy_txt = (copy_number == 1) ?
-                                       g_strdup ("") :
-                                       g_strdup_printf ("(%d)",
-                                                        (gint) copy_number);
-                            if (tax_related)
-                            {
-                                if (g_strcmp0 (form, "") == 0)
-                                    return_string = g_strdup_printf ("%s", desc);
-                                else
-                                    return_string = g_strdup_printf ("%s%s: %s",
-                                                                     form, copy_txt, desc);
-                            }
-                            else
-                            {
-                                return_string = g_strdup_printf
-                                                (_("Not tax-related; %s%s: %s (code %s, tax type %s)"),
-                                                 form, copy_txt, desc, num_code, tax_type);
-                            }
-                            g_free (copy_txt);
-                        }
-                        g_free (desc);
-                    }
-                    scm_dynwind_end ();
-                }
-            }
-        }
-        g_free (num_code);
-        return return_string;
-    }
-}
-
-/* Caller is responsible for g_free'ing returned memory */
-char *
-gnc_ui_account_get_tax_info_sub_acct_string (const Account *account)
-{
-    GList *descendant, *account_descendants;
-
-    if (!account)
-        return NULL;
-
-    account_descendants = gnc_account_get_descendants (account);
-    if (account_descendants)
-    {
-        gint sub_acct_tax_number = 0;
-        for (descendant = account_descendants; descendant;
-                descendant = g_list_next(descendant))
-        {
-            if (xaccAccountGetTaxRelated (descendant->data))
-                sub_acct_tax_number++;
-        }
-        g_list_free (account_descendants);
-        g_list_free (descendant);
-        /* Translators: This and the following strings appear on
-           the account tab if the Tax Info column is displayed,
-           i.e. if the user wants to record the tax form number
-           and location on that tax form which corresponds to this
-           gnucash account. For the US Income Tax support in
-           gnucash, each tax code that can be assigned to an
-           account generally corresponds to a specific line number
-           on a paper form and each form has a unique
-           identification (e.g., Form 1040, Schedule A). */
-        return (sub_acct_tax_number == 0) ? NULL :
-               g_strdup_printf (_("(Tax-related subaccounts: %d)"),
-                                sub_acct_tax_number);
-    }
-    else
-        return NULL;
-}
-
 /********************************************************************\
  * gnc_get_reconcile_str                                            *
  *   return the i18n'd string for the given reconciled flag         *
diff --git a/libgnucash/app-utils/gnc-ui-util.h b/libgnucash/app-utils/gnc-ui-util.h
index 768b0bad1..3c137371d 100644
--- a/libgnucash/app-utils/gnc-ui-util.h
+++ b/libgnucash/app-utils/gnc-ui-util.h
@@ -142,9 +142,6 @@ gchar *gnc_get_account_name_for_split_register(const Account *account,
  *                  of things like stock account values from share
  *                  values to an amount the requested currency.
  */
-char *gnc_ui_account_get_tax_info_string (const Account *account);
-
-char *gnc_ui_account_get_tax_info_sub_acct_string (const Account *account);
 
 const char * gnc_get_reconcile_str (char reconciled_flag);
 const char * gnc_get_reconcile_valid_flags (void);
diff --git a/libgnucash/app-utils/test/CMakeLists.txt b/libgnucash/app-utils/test/CMakeLists.txt
index 03ed9c2cd..9c5d89247 100644
--- a/libgnucash/app-utils/test/CMakeLists.txt
+++ b/libgnucash/app-utils/test/CMakeLists.txt
@@ -26,11 +26,6 @@ gnc_add_test_with_guile(test-exp-parser test-exp-parser.c
   APP_UTILS_TEST_INCLUDE_DIRS APP_UTILS_TEST_LIBS
  )
 add_app_utils_test(test-print-parse-amount test-print-parse-amount.cpp)
-# FIXME Why is this test not run ?
-#gnc_add_test_with_guile(test-print-queries test-print-queries.cpp APP_UTILS_TEST_INCLUDE_DIRS APP_UTILS_TEST_LIBS)
-gnc_add_test_with_guile(test-scm-query-string test-scm-query-string.cpp
-  APP_UTILS_TEST_INCLUDE_DIRS APP_UTILS_TEST_LIBS
-)
 add_app_utils_test(test-sx test-sx.cpp)
 
 set(gtest_gnc_option_SOURCES
@@ -62,49 +57,10 @@ set(GUILE_DEPENDS
   gncmod-backend-xml
 )
 
-set(test_app_utils_scheme_SOURCES
-  test-c-interface.scm
-  test-load-app-utils-module.scm
-)
-
-set (test_app_utils_scheme_SRFI64_SOURCES
-  test-date-utilities.scm
-  test-options.scm
-)
-
-gnc_add_scheme_test_targets(scm-test-load-app-utils-module
-    SOURCES "test-load-app-utils-module.scm"
-    OUTPUT_DIR "tests"
-    DEPENDS "${GUILE_DEPENDS}")
-
-gnc_add_scheme_test_targets(scm-test-c-interface
-    SOURCES "test-c-interface.scm"
-    OUTPUT_DIR "tests"
-    DEPENDS "${GUILE_DEPENDS}")
-
-gnc_add_scheme_tests("${test_app_utils_scheme_SOURCES}")
-
-if (HAVE_SRFI64)
-  gnc_add_scheme_test_targets(scm-test-app-utils-srfi64
-    SOURCES "${test_app_utils_scheme_SRFI64_SOURCES}"
-    OUTPUT_DIR "tests"
-    DEPENDS "${GUILE_DEPENDS};scm-srfi64-extras")
-
-  gnc_add_scheme_test_targets(scm-test-gnc-optiondb
-    SOURCES "test-gnc-optiondb.scm" "test-gnc-option-scheme-output.scm"
-    OUTPUT_DIR "tests"
-    DEPENDS "swig-apputils-guile-cpp;scm-srfi64-extras")
-  gnc_add_scheme_tests("test-gnc-optiondb.scm")
-  gnc_add_scheme_tests("test-gnc-option-scheme-output.scm")
-  gnc_add_scheme_tests("${test_app_utils_scheme_SRFI64_SOURCES}")
-endif()
-
 set_dist_list(test_app_utils_DIST
   CMakeLists.txt
   test-exp-parser.c
   test-print-parse-amount.cpp
-  test-print-queries.cpp
-  test-scm-query-string.cpp
   test-sx.cpp
   gtest-gnc-option.cpp
   gtest-gnc-optiondb.cpp
diff --git a/libgnucash/tax/CMakeLists.txt b/libgnucash/tax/CMakeLists.txt
index c1e33b39e..0e93ac568 100644
--- a/libgnucash/tax/CMakeLists.txt
+++ b/libgnucash/tax/CMakeLists.txt
@@ -7,6 +7,9 @@ set_source_files_properties (${locale_tax_SOURCES} PROPERTIES OBJECT_DEPENDS ${C
 
 add_library(gnc-locale-tax ${locale_tax_SOURCES})
 target_link_libraries(gnc-locale-tax
+    gnc-engine
+    gnc-app-utils
+    gnucash-guile
     ${GLIB2_LDFLAGS}
     ${GUILE_LDFLAGS})
 
diff --git a/libgnucash/tax/gnc-locale-tax.c b/libgnucash/tax/gnc-locale-tax.c
index f40e22318..ced2dfeba 100644
--- a/libgnucash/tax/gnc-locale-tax.c
+++ b/libgnucash/tax/gnc-locale-tax.c
@@ -30,7 +30,11 @@
 #include <locale.h>
 #include <libguile.h>
 #include <glib.h>
-
+#include <glib/gi18n.h>
+#include <Account.h>
+#include <gnc-ui-util.h>
+#include <guile-mappings.h>
+#include <gnc-guile-utils.h>
 #include "gnc-locale-tax.h"
 
 
@@ -54,3 +58,259 @@ gnc_locale_tax_init(void)
     else
         scm_c_use_module("gnucash locale us tax");
 }
+
+/* Caller is responsible for g_free'ing returned memory */
+char *
+gnc_ui_account_get_tax_info_string (const Account *account)
+{
+    static SCM get_form = SCM_UNDEFINED;
+    static SCM get_desc = SCM_UNDEFINED;
+
+    gboolean tax_related = FALSE;
+    const char *code;
+
+    if (!account)
+        return NULL;
+
+    tax_related = xaccAccountGetTaxRelated (account);
+    code = xaccAccountGetTaxUSCode (account);
+
+    if (!code)
+    {
+        if (!tax_related)
+            return NULL;
+        /* tax_related && !code */
+        else
+            /* Translators: This and the following strings appear on
+               the account tab if the Tax Info column is displayed,
+               i.e. if the user wants to record the tax form number
+               and location on that tax form which corresponds to this
+               gnucash account. For the US Income Tax support in
+               gnucash, each tax code that can be assigned to an
+               account generally corresponds to a specific line number
+               on a paper form and each form has a unique
+               identification (e.g., Form 1040, Schedule A). */
+            return g_strdup (_("Tax-related but has no tax code"));
+    }
+    else  /* with tax code */
+    {
+        const gchar *tax_type;
+        GNCAccountType atype;
+        SCM tax_entity_type;
+        SCM category;
+        gchar *num_code = NULL;
+        const gchar *prefix = "N";
+        gchar *return_string = NULL;
+
+        tax_type = gnc_get_current_book_tax_type ();
+        if (tax_type == NULL || (g_strcmp0 (tax_type, "") == 0))
+            return g_strdup (_("Tax entity type not specified"));
+
+        atype = xaccAccountGetType (account);
+        tax_entity_type = scm_from_utf8_string (tax_type);
+
+        if (get_form == SCM_UNDEFINED)
+        {
+            const gchar *tax_module;
+            /* load the tax info */
+            gnc_locale_tax_init ();
+
+            get_form = scm_c_eval_string
+                       ("(false-if-exception gnc:txf-get-form)");
+            get_desc = scm_c_eval_string
+                       ("(false-if-exception gnc:txf-get-description)");
+        }
+
+        g_return_val_if_fail (scm_is_procedure (get_form), NULL);
+        g_return_val_if_fail (scm_is_procedure (get_desc), NULL);
+
+        category = scm_c_eval_string (atype == ACCT_TYPE_INCOME ?
+                                      "txf-income-categories" :
+                                      (atype == ACCT_TYPE_EXPENSE ?
+                                       "txf-expense-categories" :
+                                       (((atype == ACCT_TYPE_BANK)      ||
+                                         (atype == ACCT_TYPE_CASH)      ||
+                                         (atype == ACCT_TYPE_ASSET)     ||
+                                         (atype == ACCT_TYPE_STOCK)     ||
+                                         (atype == ACCT_TYPE_MUTUAL)    ||
+                                         (atype == ACCT_TYPE_RECEIVABLE)) ?
+                                        "txf-asset-categories" :
+                                        (((atype == ACCT_TYPE_CREDIT)    ||
+                                          (atype == ACCT_TYPE_LIABILITY) ||
+                                          (atype == ACCT_TYPE_EQUITY)    ||
+                                          (atype == ACCT_TYPE_PAYABLE)) ?
+                                         "txf-liab-eq-categories" : ""))));
+
+        if (g_str_has_prefix (code, prefix))
+        {
+            const gchar *num_code_tmp;
+            num_code_tmp = g_strdup (code);
+            num_code_tmp++; /* to lose the leading N */
+            num_code = g_strdup (num_code_tmp);
+            num_code_tmp--;
+            g_free ((gpointer *) num_code_tmp);
+        }
+        else
+        {
+            num_code = g_strdup (code);
+        }
+
+        if (category == SCM_UNDEFINED)
+        {
+            if (tax_related)
+                return_string = g_strdup_printf
+                                (_("Tax type %s: invalid code %s for account type"),
+                                 tax_type, num_code);
+            else
+                return_string = g_strdup_printf
+                                (_("Not tax-related; tax type %s: invalid code %s for account type"),
+                                 tax_type, num_code);
+        }
+        else
+        {
+            SCM code_scm;
+            SCM form_scm;
+            code_scm = scm_from_locale_symbol (code);
+            form_scm = scm_call_3 (get_form, category, code_scm, tax_entity_type);
+            if (!scm_is_string (form_scm))
+            {
+                if (tax_related)
+                    return_string =  g_strdup_printf
+                                     (_("Invalid code %s for tax type %s"),
+                                      num_code, tax_type);
+                else
+                    return_string =  g_strdup_printf
+                                     (_("Not tax-related; invalid code %s for tax type %s"),
+                                      num_code, tax_type);
+            }
+            else
+            {
+                gchar *form = NULL;
+
+                /* Note: using scm_to_utf8_stringn directly here instead
+                   of our wrapper gnc_scm_to_utf8_string. 'form' should
+                   be freed with 'free' instead of 'g_free'. This will
+                   be taken care of automatically during scm_dynwind_end,
+                   because we inform guile of this memory allocation via
+                   scm_dynwind_free a little further. */
+                form = scm_to_utf8_stringn (form_scm, NULL);
+                if (!form)
+                {
+                    if (tax_related)
+                        return_string = g_strdup_printf
+                                        (_("No form: code %s, tax type %s"), num_code,
+                                         tax_type);
+                    else
+                        return_string = g_strdup_printf
+                                        (_("Not tax-related; no form: code %s, tax type %s"),
+                                         num_code, tax_type);
+                }
+                else
+                {
+                    SCM desc_scm;
+
+                    /* Create a dynwind context because we will be calling (scm) functions
+                       that potentially exit non-locally */
+                    scm_dynwind_begin (0);
+                    scm_dynwind_free (form);
+                    desc_scm = scm_call_3 (get_desc, category, code_scm,
+                                           tax_entity_type);
+                    if (!scm_is_string (desc_scm))
+                    {
+                        if (tax_related)
+                            return_string = g_strdup_printf
+                                            (_("No description: form %s, code %s, tax type %s"),
+                                             form, num_code, tax_type);
+                        else
+                            return_string = g_strdup_printf
+                                            (_("Not tax-related; no description: form %s, code %s, tax type %s"),
+                                             form, num_code, tax_type);
+                    }
+                    else
+                    {
+                        gchar *desc = NULL;
+                        desc = gnc_scm_to_utf8_string (desc_scm);
+                        if (!desc)
+                        {
+                            if (tax_related)
+                                return_string = g_strdup_printf
+                                                (_("No description: form %s, code %s, tax type %s"),
+                                                 form, num_code, tax_type);
+                            else
+                                return_string = g_strdup_printf
+                                                (_("Not tax-related; no description: form %s, code %s, tax type %s"),
+                                                 form, num_code, tax_type);
+                        }
+                        else
+                        {
+                            gint64 copy_number;
+                            gchar *copy_txt = NULL;
+                            copy_number = xaccAccountGetTaxUSCopyNumber (account);
+                            copy_txt = (copy_number == 1) ?
+                                       g_strdup ("") :
+                                       g_strdup_printf ("(%d)",
+                                                        (gint) copy_number);
+                            if (tax_related)
+                            {
+                                if (g_strcmp0 (form, "") == 0)
+                                    return_string = g_strdup_printf ("%s", desc);
+                                else
+                                    return_string = g_strdup_printf ("%s%s: %s",
+                                                                     form, copy_txt, desc);
+                            }
+                            else
+                            {
+                                return_string = g_strdup_printf
+                                                (_("Not tax-related; %s%s: %s (code %s, tax type %s)"),
+                                                 form, copy_txt, desc, num_code, tax_type);
+                            }
+                            g_free (copy_txt);
+                        }
+                        g_free (desc);
+                    }
+                    scm_dynwind_end ();
+                }
+            }
+        }
+        g_free (num_code);
+        return return_string;
+    }
+}
+
+/* Caller is responsible for g_free'ing returned memory */
+char *
+gnc_ui_account_get_tax_info_sub_acct_string (const Account *account)
+{
+    GList *descendant, *account_descendants;
+
+    if (!account)
+        return NULL;
+
+    account_descendants = gnc_account_get_descendants (account);
+    if (account_descendants)
+    {
+        gint sub_acct_tax_number = 0;
+        for (descendant = account_descendants; descendant;
+                descendant = g_list_next(descendant))
+        {
+            if (xaccAccountGetTaxRelated (descendant->data))
+                sub_acct_tax_number++;
+        }
+        g_list_free (account_descendants);
+        g_list_free (descendant);
+        /* Translators: This and the following strings appear on
+           the account tab if the Tax Info column is displayed,
+           i.e. if the user wants to record the tax form number
+           and location on that tax form which corresponds to this
+           gnucash account. For the US Income Tax support in
+           gnucash, each tax code that can be assigned to an
+           account generally corresponds to a specific line number
+           on a paper form and each form has a unique
+           identification (e.g., Form 1040, Schedule A). */
+        return (sub_acct_tax_number == 0) ? NULL :
+               g_strdup_printf (_("(Tax-related subaccounts: %d)"),
+                                sub_acct_tax_number);
+    }
+    else
+        return NULL;
+}
diff --git a/libgnucash/tax/gnc-locale-tax.h b/libgnucash/tax/gnc-locale-tax.h
index 0e6de189a..664e931e9 100644
--- a/libgnucash/tax/gnc-locale-tax.h
+++ b/libgnucash/tax/gnc-locale-tax.h
@@ -24,7 +24,11 @@
 
 #ifndef GNC_LOCALE_TAX_H_
 #define GNC_LOCALE_TAX_H_
+#include <config.h>
+#include <Account.h>
 
 void gnc_locale_tax_init (void);
+char *gnc_ui_account_get_tax_info_string (const Account *account);
+char *gnc_ui_account_get_tax_info_sub_acct_string (const Account *account);
 
 #endif
diff --git a/po/POTFILES.in b/po/POTFILES.in
index 0c92f8781..e49d54a69 100644
--- a/po/POTFILES.in
+++ b/po/POTFILES.in
@@ -1,14 +1,20 @@
 # This is a list of files which contain translatable strings.
 # This file was autogenerated by cmake.
+bindings/guile/app-utils.scm
 bindings/guile/business-core.scm
+bindings/guile/c-interface.scm
 bindings/guile/core-utils.scm
+bindings/guile/date-utilities.scm
 bindings/guile/engine.scm
+bindings/guile/fin.scm
 bindings/guile/glib-guile.c
 bindings/guile/gnc-engine-guile.c
 bindings/guile/gnc-guile-bindings.c
 bindings/guile/gnc-guile-utils.c
+bindings/guile/gnc-helpers.c
 bindings/guile/gnc-kvp-guile.cpp
 bindings/guile/gnc-numeric.scm
+bindings/guile/options.scm
 bindings/guile/utilities.scm
 bindings/python/app_utils.py
 bindings/python/deprecation.py
@@ -497,13 +503,9 @@ gnucash/report/stylesheets/footer.scm
 gnucash/report/stylesheets/head-or-tail.scm
 gnucash/report/stylesheets/plain.scm
 gnucash/report/trep-engine.scm
-libgnucash/app-utils/app-utils.scm
 libgnucash/app-utils/calculation/expression_parser.c
 libgnucash/app-utils/calculation/fin.c
-libgnucash/app-utils/c-interface.scm
-libgnucash/app-utils/date-utilities.scm
 libgnucash/app-utils/file-utils.c
-libgnucash/app-utils/fin.scm
 libgnucash/app-utils/gfec.c
 libgnucash/app-utils/gnc-accounting-period.c
 libgnucash/app-utils/gnc-account-merge.c
@@ -512,7 +514,6 @@ libgnucash/app-utils/gnc-entry-quickfill.c
 libgnucash/app-utils/gnc-euro.c
 libgnucash/app-utils/gnc-exp-parser.c
 libgnucash/app-utils/gnc-gsettings.cpp
-libgnucash/app-utils/gnc-helpers.c
 libgnucash/app-utils/gnc-help-utils.c
 libgnucash/app-utils/gnc-option.cpp
 libgnucash/app-utils/gnc-option-date.cpp
@@ -523,7 +524,6 @@ libgnucash/app-utils/gnc-state.c
 libgnucash/app-utils/gnc-sx-instance-model.c
 libgnucash/app-utils/gnc-ui-balances.c
 libgnucash/app-utils/gnc-ui-util.c
-libgnucash/app-utils/options.scm
 libgnucash/app-utils/QuickFill.c
 libgnucash/backend/dbi/gnc-backend-dbi.cpp
 libgnucash/backend/dbi/gnc-dbisqlconnection.cpp

commit 3e2f7bc66aa2a3fd2c9cb15c66455658b6bf62b5
Author: John Ralls <jralls at ceridwen.us>
Date:   Sun Jul 10 12:04:24 2022 -0700

    Create separate shared library for expression parser and SX instance model.
    
    These functions depend on both libgnc-app-utils and libgnucash-guile,
    creating a circular dependency when the app-utils bindings are added to
    libgnucash-guile.

diff --git a/gnucash/gnome-utils/CMakeLists.txt b/gnucash/gnome-utils/CMakeLists.txt
index ca95d104e..a2bc8adb4 100644
--- a/gnucash/gnome-utils/CMakeLists.txt
+++ b/gnucash/gnome-utils/CMakeLists.txt
@@ -206,6 +206,7 @@ add_library (gnc-gnome-utils
 target_link_libraries(gnc-gnome-utils
     gnc-app-utils
     gnc-engine
+    gnc-expressions
     gnc-backend-xml-utils
     gnucash-guile
     PkgConfig::GTK3
diff --git a/gnucash/gnome/CMakeLists.txt b/gnucash/gnome/CMakeLists.txt
index 2aafc0530..825f55827 100644
--- a/gnucash/gnome/CMakeLists.txt
+++ b/gnucash/gnome/CMakeLists.txt
@@ -134,6 +134,7 @@ target_link_libraries(gnc-gnome
     gnc-register-core
     gnc-gnome-utils
     gnc-engine
+    gnc-expressions
     gnc-html
     gnc-locale-tax
     gnucash-guile
diff --git a/gnucash/report/CMakeLists.txt b/gnucash/report/CMakeLists.txt
index afb1a40cc..5bf93fd35 100644
--- a/gnucash/report/CMakeLists.txt
+++ b/gnucash/report/CMakeLists.txt
@@ -28,6 +28,7 @@ target_compile_definitions(gnc-report PRIVATE -DG_LOG_DOMAIN=\"gnc.report.core\"
 target_link_libraries(gnc-report
     gnc-app-utils
     gnucash-guile
+    gnc-expressions-guile
     PkgConfig::GTK3
     ${GUILE_LDFLAGS})
 
diff --git a/gnucash/report/report-core.scm b/gnucash/report/report-core.scm
index 036ffe0d8..26573c0ca 100644
--- a/gnucash/report/report-core.scm
+++ b/gnucash/report/report-core.scm
@@ -22,7 +22,8 @@
 (define-module (gnucash report report-core))
 
 (eval-when (compile load eval expand)
-  (load-extension "libgnc-report" "scm_init_sw_report_module"))
+  (load-extension "libgnc-report" "scm_init_sw_report_module")
+  (load-extension "libgnc-expressions-guile" "scm_init_sw_expressions_module"))
 
 (use-modules (gnucash engine))
 (use-modules (gnucash utilities))
diff --git a/gnucash/report/reports/standard/account-summary.scm b/gnucash/report/reports/standard/account-summary.scm
index 3b966e864..14a9347ac 100644
--- a/gnucash/report/reports/standard/account-summary.scm
+++ b/gnucash/report/reports/standard/account-summary.scm
@@ -61,7 +61,7 @@
 (use-modules (gnucash core-utils))
 (use-modules (gnucash app-utils))
 (use-modules (gnucash report))
-
+(use-modules (sw_expressions))
 ;; account summary report prints a table of account information,
 ;; optionally with clickable links to open the corresponding register
 ;; window.
diff --git a/libgnucash/app-utils/CMakeLists.txt b/libgnucash/app-utils/CMakeLists.txt
index a9cf47e7c..338fd8362 100644
--- a/libgnucash/app-utils/CMakeLists.txt
+++ b/libgnucash/app-utils/CMakeLists.txt
@@ -7,10 +7,6 @@ include (GncFindLibm)
 # Build the library
 
 set (app_utils_noinst_HEADERS
-  calculation/finvar.h
-  calculation/finproto.h
-  calculation/fin_spl_protos.h
-  calculation/fin_static_proto.h
   gnc-option-date.hpp
   gnc-option-impl.hpp
   gnc-option-ui.hpp
@@ -28,7 +24,6 @@ set (app_utils_HEADERS
   gnc-addr-quickfill.h
   gnc-entry-quickfill.h
   gnc-euro.h
-  gnc-exp-parser.h
   gnc-gsettings.h
   gnc-help-utils.h
   gnc-helpers.h
@@ -37,7 +32,6 @@ set (app_utils_HEADERS
   gnc-optiondb.hpp
   gnc-prefs-utils.h
   gnc-state.h
-  gnc-sx-instance-model.h
   gnc-ui-util.h
   gnc-ui-balances.h
 )
@@ -60,8 +54,6 @@ gnc_add_swig_python_command (swig-app-utils-python
 )
 
 set (app_utils_SOURCES
-  calculation/expression_parser.c
-  calculation/fin.c
   QuickFill.c
   file-utils.c
   gfec.c
@@ -70,7 +62,6 @@ set (app_utils_SOURCES
   gnc-addr-quickfill.c
   gnc-entry-quickfill.c
   gnc-euro.c
-  gnc-exp-parser.c
   gnc-gsettings.cpp
   gnc-helpers.c
   gnc-option-date.cpp
@@ -78,7 +69,6 @@ set (app_utils_SOURCES
   gnc-option-impl.cpp
   gnc-optiondb.cpp
   gnc-prefs-utils.c
-  gnc-sx-instance-model.c
   gnc-state.c
   gnc-ui-util.c
   gnc-ui-balances.c
@@ -175,16 +165,95 @@ if (WITH_PYTHON)
 
 endif()
 
-
-
-install(FILES ${app_utils_HEADERS} DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/gnucash)
+set(expressions_SOURCES
+        calculation/expression_parser.c
+        calculation/fin.c
+        gnc-exp-parser.c
+        gnc-sx-instance-model.c
+        )
+
+set(expressions_noinstall_HEADERS
+        calculation/finvar.h
+        calculation/finproto.h
+        calculation/fin_spl_protos.h
+        calculation/fin_static_proto.h
+        )
+set(expressions_HEADERS
+        gnc-exp-parser.h
+        gnc-sx-instance-model.h
+        )
+
+set(expressions_all_sources ${expressions_SOURCES} ${expressions_noinstall_HEADERS} ${expressions_HEADERS})
+
+set_source_files_properties(${expressions_SOURCES} PROPERTIES OBJECT_DEPENDS ${CONFIG_H})
+add_library(gnc-expressions
+        ${expressions_HEADERS}
+        ${expressions_SOURCES}
+        )
+
+target_include_directories(gnc-expressions
+        PUBLIC
+        ${CMAKE_CURRENT_SOURCE_DIR}
+        ${CMAKE_CURRENT_SOURCE_DIR}/calculation
+        ${CMAKE_SOURCE_DIR}/bindings/guile
+        ${CMAKE_SOURCE_DIR}/libgnucash/app-utils
+        ${GUILE_INCLUDE_DIRS}
+        ${GLIB2_INCLUDE_DIRS}
+        PRIVATE
+        ${CMAKE_SOURCE_DIR}/common
+        ${CMAKE_BINARY_DIR}/common)
+
+target_link_libraries(gnc-expressions
+        PUBLIC
+        gnc-engine
+        gnucash-guile
+        gnc-app-utils
+        ${GUILE_LDFLAGS}
+        ${GLIB2_LDFLAGS})
+
+install(TARGETS gnc-expressions
+        LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
+        ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
+        RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
+        )
+
+#Generate the swig-expressions-guile.c wrapper file
+gnc_add_swig_guile_command(swig-expressions-guile-c #target
+        SWIG_EXPRESSIONS_GUILE_C swig-expressions-guile.c #outvar, output
+        ${CMAKE_CURRENT_SOURCE_DIR}/expressions.i #input
+        "${CMAKE_CURRENT_SOURCE_DIR};${CMAKE_SOURCE_DIR}/libgnucash/app-utils;${CMAKE_SOURCE_DIR}/libgnucash/expressions" #includes
+        )
+
+add_library(gnc-expressions-guile SHARED
+        ${SWIG_EXPRESSIONS_GUILE_C})
+
+target_include_directories(gnc-expressions-guile
+        PUBLIC
+        ${CMAKE_SOURCE_DIR}/libgnucash/expressions
+        ${GUILE_INCLUDE_DIRS}
+        ${GLIB2_INCLUDE_DIRS})
+
+target_link_libraries(gnc-expressions-guile
+        gnc-expressions
+        gnc-engine
+        gnc-app-utils
+        ${GUILE_LDFLAGS}
+        ${GLIB2_LDFLAGS})
+
+install(TARGETS gnc-expressions-guile
+        LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
+        ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
+        RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
+        )
+
+install(FILES ${app_utils_HEADERS} ${expressions_HEADERS}
+        DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/gnucash)
 
 # And now handle scheme files
 
 set (app_utils_SCHEME_1
     c-interface.scm
     date-utilities.scm
-    fin.scm
 )
 
 set (app_utils_SCHEME_1a
@@ -220,6 +289,18 @@ gnc_add_scheme_targets(scm-app-utils-2
 
 add_custom_target(scm-app-utils ALL DEPENDS scm-app-utils-2 scm-app-utils-1)
 
+set(expressions_SCHEME
+        fin.scm)
+
+set(GUILE_INTERNAL_DEPENDS
+        scm-app-utils-1)
+
+gnc_add_scheme_targets(scm-expressions
+        SOURCES "${expressions_SCHEME}"
+        OUTPUT_DIR "gnucash/app-utils"
+        DEPENDS "${GUILE_INTERNAL_DEPENDS}"
+        MAKE_LINKS)
+
 set_local_dist(app_utils_DIST_local
     ${app_utils_ALL_SOURCES}
     ${app_utils_SCHEME_1}
@@ -228,7 +309,9 @@ set_local_dist(app_utils_DIST_local
     ${app_utils_SCHEME_1c}
     ${app_utils_SCHEME_2}
     ${app_utils_SCHEME_3}
-    app-utils.i gnc-optiondb.i CMakeLists.txt gnc-help-utils.c)
+    ${expressions_all_sources}
+    ${expressions_SCHEME}
+    app-utils.i gnc-optiondb.i expressions.i CMakeLists.txt gnc-help-utils.c)
 
 set(app_utils_DIST
     ${app_utils_DIST_local}
diff --git a/libgnucash/app-utils/app-utils.i b/libgnucash/app-utils/app-utils.i
index 6b77ffa4f..6e1430bc6 100644
--- a/libgnucash/app-utils/app-utils.i
+++ b/libgnucash/app-utils/app-utils.i
@@ -28,13 +28,11 @@ extern "C"
 #endif
 #include <config.h>
 #include <gnc-euro.h>
-#include <gnc-exp-parser.h>
 #include <gnc-ui-util.h>
 #include <gnc-prefs-utils.h>
 #include <gnc-helpers.h>
 #include <gnc-accounting-period.h>
 #include <gnc-session.h>
-#include <gnc-sx-instance-model.h>
 
 #include "gnc-engine-guile.h"
 #ifdef __cplusplus
@@ -119,23 +117,4 @@ gnc_numeric gnc_convert_from_euro(const gnc_commodity * currency,
 time64 gnc_accounting_period_fiscal_start(void);
 time64 gnc_accounting_period_fiscal_end(void);
 
-%typemap(out) GHashTable * {
-  SCM table = scm_c_make_hash_table (g_hash_table_size($1) + 17);
-  GHashTableIter iter;
-  gpointer key, value;
-
-  g_hash_table_iter_init (&iter, $1);
-  while (g_hash_table_iter_next (&iter, &key, &value)) {
-    const GncGUID* c_guid = (const GncGUID*) key;
-    const gnc_numeric* c_numeric = (const gnc_numeric*) value;
-    SCM scm_guid = gnc_guid2scm(*c_guid);
-    SCM scm_numeric = gnc_numeric_to_scm(*c_numeric);
-
-    scm_hash_set_x(table, scm_guid, scm_numeric);
-  }
-  g_hash_table_destroy($1);
-  $result = table;
-}
-GHashTable* gnc_sx_all_instantiate_cashflow_all(GDate range_start, GDate range_end);
-%clear GHashTable *;
 #endif
diff --git a/libgnucash/app-utils/expressions.i b/libgnucash/app-utils/expressions.i
new file mode 100644
index 000000000..18aafbf6a
--- /dev/null
+++ b/libgnucash/app-utils/expressions.i
@@ -0,0 +1,74 @@
+/********************************************************************\
+ * 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                   *
+ *                                                                  *
+\********************************************************************/
+
+%module sw_expressions
+%{
+#include <gnc-sx-instance-model.h>
+
+SCM scm_init_sw_expressions_module (void);
+
+static GDate
+gnc_time64_to_GDate(SCM x)
+{
+    time64 time = scm_to_int64 (x);
+    return time64_to_gdate(time);
+}
+
+
+static SCM
+gnc_guid2scm(GncGUID guid)
+{
+    char string[GUID_ENCODING_LENGTH + 1];
+
+    if (!guid_to_string_buff(&guid, string))
+        return SCM_BOOL_F;
+
+    return scm_from_utf8_string(string);
+}
+
+static SCM
+gnc_numeric_to_scm(gnc_numeric arg)
+{
+    return gnc_numeric_check (arg) ? SCM_BOOL_F :
+           scm_divide (scm_from_int64 (arg.num), scm_from_int64 (arg.denom));
+}
+%}
+#include <gnc-sx-instance-model.h>
+%import "base-typemaps.i"
+
+%typemap(out) GHashTable * {
+SCM table = scm_c_make_hash_table (g_hash_table_size($1) + 17);
+GHashTableIter iter;
+gpointer key, value;
+
+g_hash_table_iter_init (&iter, $1);
+while (g_hash_table_iter_next (&iter, &key, &value)) {
+const GncGUID* c_guid = (const GncGUID*) key;
+const gnc_numeric* c_numeric = (const gnc_numeric*) value;
+SCM scm_guid = gnc_guid2scm(*c_guid);
+SCM scm_numeric = gnc_numeric_to_scm(*c_numeric);
+
+scm_hash_set_x(table, scm_guid, scm_numeric);
+}
+g_hash_table_destroy($1);
+$result = table;
+}
+GHashTable* gnc_sx_all_instantiate_cashflow_all(GDate range_start, GDate range_end);
+%clear GHashTable *;
diff --git a/libgnucash/app-utils/test/CMakeLists.txt b/libgnucash/app-utils/test/CMakeLists.txt
index b0028c299..03ed9c2cd 100644
--- a/libgnucash/app-utils/test/CMakeLists.txt
+++ b/libgnucash/app-utils/test/CMakeLists.txt
@@ -10,7 +10,13 @@ set(APP_UTILS_TEST_INCLUDE_DIRS
   ${GUILE_INCLUDE_DIRS}
 )
 
-set(APP_UTILS_TEST_LIBS gnc-app-utils gnc-test-engine test-core ${GIO_LDFLAGS} ${GUILE_LDFLAGS})
+set(APP_UTILS_TEST_LIBS
+        gnc-app-utils
+        gnc-expressions
+        gnc-test-engine
+        test-core
+        ${GIO_LDFLAGS}
+        ${GUILE_LDFLAGS})
 
 macro(add_app_utils_test _TARGET _SOURCE_FILES)
   gnc_add_test(${_TARGET} "${_SOURCE_FILES}" APP_UTILS_TEST_INCLUDE_DIRS APP_UTILS_TEST_LIBS)



Summary of changes:
 .gitignore                                         |   1 +
 bindings/CMakeLists.txt                            |   1 +
 {libgnucash/app-utils => bindings}/app-utils.i     |  25 +-
 .../misc-mods/agedver.c => bindings/expressions.i  |  65 +++--
 bindings/guile/CMakeLists.txt                      | 109 ++++++++-
 .../app-utils => bindings/guile}/app-utils.scm     |   2 +-
 .../app-utils => bindings/guile}/c-interface.scm   |   0
 .../guile}/date-utilities.scm                      |   2 +-
 .../gnc-html.i => bindings/guile/expressions.i     |  90 ++++---
 {libgnucash/app-utils => bindings/guile}/fin.scm   |   0
 .../app-utils => bindings/guile}/gnc-helpers.c     |   0
 .../app-utils => bindings/guile}/gnc-helpers.h     |   0
 .../app-utils => bindings/guile}/gnc-optiondb.i    |   0
 .../app-utils => bindings/guile}/options.scm       |   2 +-
 bindings/guile/test/CMakeLists.txt                 |  51 ++++
 .../guile}/test/test-c-interface.scm               |   0
 .../guile}/test/test-date-utilities.scm            |   0
 .../guile}/test/test-gnc-option-scheme-output.scm  |   0
 .../guile}/test/test-gnc-optiondb.scm              |   4 +-
 .../guile}/test/test-load-app-utils-module.scm     |   0
 .../guile}/test/test-options.scm                   |   2 +-
 .../guile}/test/test-print-queries.cpp             |   0
 .../guile}/test/test-scm-query-string.cpp          |   0
 bindings/python/CMakeLists.txt                     |  40 ++++
 gnucash/gnome-utils/CMakeLists.txt                 |   2 +
 gnucash/gnome-utils/dialog-account.c               |   2 +-
 gnucash/gnome-utils/gnc-tree-model-account.c       |   1 +
 gnucash/gnome/CMakeLists.txt                       |   1 +
 gnucash/report/CMakeLists.txt                      |   1 +
 gnucash/report/report-core.scm                     |   3 +-
 .../report/reports/standard/account-summary.scm    |   2 +-
 libgnucash/app-utils/CMakeLists.txt                | 175 +++++---------
 libgnucash/app-utils/gnc-option-impl.hpp           |   1 -
 libgnucash/app-utils/gnc-option.hpp                |   1 -
 libgnucash/app-utils/gnc-optiondb.cpp              |   1 -
 libgnucash/app-utils/gnc-optiondb.h                |   2 -
 libgnucash/app-utils/gnc-optiondb.hpp              |   1 -
 libgnucash/app-utils/gnc-ui-util.c                 | 261 --------------------
 libgnucash/app-utils/gnc-ui-util.h                 |   3 -
 libgnucash/app-utils/test/CMakeLists.txt           |  52 +---
 libgnucash/tax/CMakeLists.txt                      |   3 +
 libgnucash/tax/gnc-locale-tax.c                    | 262 ++++++++++++++++++++-
 libgnucash/tax/gnc-locale-tax.h                    |   4 +
 po/POTFILES.in                                     |  12 +-
 44 files changed, 639 insertions(+), 545 deletions(-)
 rename {libgnucash/app-utils => bindings}/app-utils.i (84%)
 copy libgnucash/gnc-module/test/misc-mods/agedver.c => bindings/expressions.i (52%)
 rename {libgnucash/app-utils => bindings/guile}/app-utils.scm (95%)
 rename {libgnucash/app-utils => bindings/guile}/c-interface.scm (100%)
 rename {libgnucash/app-utils => bindings/guile}/date-utilities.scm (99%)
 copy gnucash/html/gnc-html.i => bindings/guile/expressions.i (52%)
 rename {libgnucash/app-utils => bindings/guile}/fin.scm (100%)
 rename {libgnucash/app-utils => bindings/guile}/gnc-helpers.c (100%)
 rename {libgnucash/app-utils => bindings/guile}/gnc-helpers.h (100%)
 rename {libgnucash/app-utils => bindings/guile}/gnc-optiondb.i (100%)
 rename {libgnucash/app-utils => bindings/guile}/options.scm (99%)
 rename {libgnucash/app-utils => bindings/guile}/test/test-c-interface.scm (100%)
 rename {libgnucash/app-utils => bindings/guile}/test/test-date-utilities.scm (100%)
 rename {libgnucash/app-utils => bindings/guile}/test/test-gnc-option-scheme-output.scm (100%)
 rename {libgnucash/app-utils => bindings/guile}/test/test-gnc-optiondb.scm (99%)
 rename {libgnucash/app-utils => bindings/guile}/test/test-load-app-utils-module.scm (100%)
 rename {libgnucash/app-utils => bindings/guile}/test/test-options.scm (94%)
 rename {libgnucash/app-utils => bindings/guile}/test/test-print-queries.cpp (100%)
 rename {libgnucash/app-utils => bindings/guile}/test/test-scm-query-string.cpp (100%)



More information about the gnucash-changes mailing list