From d52aa0a0dd8de839d9889afbc2b3d4b8f6eb5d81 Mon Sep 17 00:00:00 2001 From: Geert Janssens Date: Tue, 26 Nov 2019 18:27:13 +0100 Subject: [PATCH] app-utils - remove gnc-module boilerplate app-utils now is an ordinery shared library A few bits worth mentioning: 1. it's not guile-free just yet, so instead of a gnc_module_load your code may have to call scm_c_use_module("gnucash app-utils"); to expose the scm side of the app-utils api. This call has been added to gnucash-bin.c for example 2. while lots of noise in this commit is to rename from gncmodule-app-utils to gnc-app-utils, I'll point out the library has also been moved from /gnucash to . This required changes in app-util's CMakeLists.txt file for the install side and in the top level CMakeLists.txt file for the build directory structure. 3. The C side link module test has been removed as linking an ordinary shared library should be considered well tested by the compiler devs. The scheme side module load test has been slightly tweaked to no longer try to use gnc:module-load, but instead now checks whether the app-utils api is properly exposed to scheme after loading it via use-modules. 4. Dropped a completely obsolete README file. --- CMakeLists.txt | 2 +- bindings/python/CMakeLists.txt | 4 +- gnucash/CMakeLists.txt | 2 +- gnucash/gnome-utils/CMakeLists.txt | 2 +- gnucash/gnome-utils/gncmod-gnome-utils.c | 10 --- gnucash/gnome-utils/test/CMakeLists.txt | 2 +- gnucash/gnucash-bin.c | 3 +- gnucash/html/gncmod-html.c | 5 -- gnucash/import-export/aqb/gncmod-aqbanking.c | 3 +- gnucash/import-export/aqb/test/CMakeLists.txt | 2 +- .../import-export/bi-import/CMakeLists.txt | 2 +- .../bi-import/gncmod-bi-import.c | 4 - gnucash/import-export/csv-exp/CMakeLists.txt | 2 +- .../import-export/csv-exp/gncmod-csv-export.c | 4 - gnucash/import-export/csv-imp/CMakeLists.txt | 2 +- .../import-export/csv-imp/gncmod-csv-import.c | 4 - .../customer-import/CMakeLists.txt | 2 +- .../customer-import/gncmod-customer-import.c | 4 - gnucash/import-export/gncmod-generic-import.c | 4 - .../import-export/log-replay/CMakeLists.txt | 2 +- .../log-replay/gncmod-log-replay.c | 4 - gnucash/import-export/ofx/CMakeLists.txt | 2 +- gnucash/import-export/ofx/gncmod-ofx-import.c | 4 - gnucash/import-export/qif-imp/CMakeLists.txt | 2 +- .../import-export/qif-imp/gncmod-qif-import.c | 5 -- gnucash/python/CMakeLists.txt | 2 +- .../register/ledger-core/gncmod-ledger-core.c | 5 -- gnucash/register/register-core/CMakeLists.txt | 2 +- gnucash/report/CMakeLists.txt | 2 +- gnucash/report/gncmod-report.c | 4 - libgnucash/app-utils/CMakeLists.txt | 25 +++--- libgnucash/app-utils/README | 10 --- libgnucash/app-utils/app-utils.scm | 2 +- libgnucash/app-utils/gncmod-app-utils.c | 88 ------------------- libgnucash/app-utils/test/CMakeLists.txt | 5 +- libgnucash/app-utils/test/test-app-utils.c | 5 +- libgnucash/app-utils/test/test-link-module.c | 41 --------- .../test/test-load-app-utils-module.scm | 31 +++---- .../app-utils/test/test-print-queries.cpp | 3 +- .../app-utils/test/test-scm-query-string.cpp | 4 +- libgnucash/tax/de_DE/tax.scm | 4 - .../{gncmod-locale-tax.c => gnc-locale-tax.c} | 0 po/POTFILES.in | 1 - 43 files changed, 50 insertions(+), 266 deletions(-) delete mode 100644 libgnucash/app-utils/README delete mode 100644 libgnucash/app-utils/gncmod-app-utils.c delete mode 100644 libgnucash/app-utils/test/test-link-module.c rename libgnucash/tax/{gncmod-locale-tax.c => gnc-locale-tax.c} (100%) diff --git a/CMakeLists.txt b/CMakeLists.txt index 5b3544bacd..169ecd43d6 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -868,7 +868,7 @@ configure_file( add_custom_target(uninstall COMMAND ${CMAKE_COMMAND} -P ${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake) -set(_MODULES gnc-core-utils gnc-engine gnc-module gnc-backend-xml-utils gnucash-guile) +set(_MODULES gnc-core-utils gnc-engine gnc-app-utils gnc-module gnc-backend-xml-utils gnucash-guile) if (WITH_SQL) list(APPEND _MODULES gnc-backend-sql) diff --git a/bindings/python/CMakeLists.txt b/bindings/python/CMakeLists.txt index 79775f28e2..b8619fafc2 100644 --- a/bindings/python/CMakeLists.txt +++ b/bindings/python/CMakeLists.txt @@ -76,7 +76,7 @@ if(WITH_PYTHON) add_library(gnucash_core_c MODULE ${SWIG_GNUCASH_CORE_C}) target_include_directories(gnucash_core_c PRIVATE ${gnucash_core_c_INCLUDE_DIRS}) - target_link_libraries(gnucash_core_c gncmod-app-utils gnc-engine gnc-module ${GLIB_LIBS} ${PYTHON_LIBRARIES}) + target_link_libraries(gnucash_core_c gnc-app-utils gnc-engine gnc-module ${GLIB_LIBS} ${PYTHON_LIBRARIES}) set_target_properties(gnucash_core_c PROPERTIES PREFIX "_") target_compile_options(gnucash_core_c PRIVATE -Wno-implicit -Wno-missing-prototypes -Wno-declaration-after-statement -Wno-missing-declarations) if (HAVE_STRINGOP_TRUNCATION) @@ -84,7 +84,7 @@ if(WITH_PYTHON) endif() add_executable(sqlite3test EXCLUDE_FROM_ALL sqlite3test.c ${SWIG_GNUCASH_CORE_C}) - target_link_libraries(sqlite3test gncmod-app-utils gnc-engine gnc-module ${GLIB_LIBS} ${PYTHON_LIBRARIES}) + target_link_libraries(sqlite3test gnc-app-utils gnc-engine gnc-module ${GLIB_LIBS} ${PYTHON_LIBRARIES}) target_include_directories(sqlite3test PRIVATE ${gnucash_core_c_INCLUDE_DIRS}) target_compile_options(sqlite3test PRIVATE -Wno-implicit -Wno-missing-prototypes -Wno-declaration-after-statement -Wno-missing-declarations) if (HAVE_STRINGOP_TRUNCATION) diff --git a/gnucash/CMakeLists.txt b/gnucash/CMakeLists.txt index 3d70de63de..a205f02e8b 100644 --- a/gnucash/CMakeLists.txt +++ b/gnucash/CMakeLists.txt @@ -51,7 +51,7 @@ if (BUILDING_FROM_VCS) endif (BUILDING_FROM_VCS) target_link_libraries (gnucash - gncmod-ledger-core gnc-gnome gncmod-gnome-utils gncmod-app-utils + gncmod-ledger-core gnc-gnome gncmod-gnome-utils gnc-app-utils gnc-engine gnc-module gnc-core-utils gncmod-report gnucash-guile PkgConfig::GTK3 ${GUILE_LDFLAGS} ${GLIB2_LDFLAGS} ${GTK_MAC_LDFLAGS} ) diff --git a/gnucash/gnome-utils/CMakeLists.txt b/gnucash/gnome-utils/CMakeLists.txt index 31846fc79f..7b5dfd48e7 100644 --- a/gnucash/gnome-utils/CMakeLists.txt +++ b/gnucash/gnome-utils/CMakeLists.txt @@ -207,7 +207,7 @@ add_library (gncmod-gnome-utils ) target_link_libraries(gncmod-gnome-utils - gncmod-app-utils + gnc-app-utils gnc-engine gnc-backend-xml-utils gnucash-guile diff --git a/gnucash/gnome-utils/gncmod-gnome-utils.c b/gnucash/gnome-utils/gncmod-gnome-utils.c index 0d901bd85d..97dde32e28 100644 --- a/gnucash/gnome-utils/gncmod-gnome-utils.c +++ b/gnucash/gnome-utils/gncmod-gnome-utils.c @@ -26,17 +26,12 @@ #include - -#include #include -#include "gnc-module.h" #include "gnc-module-api.h" #include "gnc-component-manager.h" #include "dialog-options.h" -#include "qof.h" -#include "gnc-gui-query.h" GNC_MODULE_API_DECL(libgncmod_gnome_utils) @@ -74,11 +69,6 @@ extern SCM scm_init_sw_gnome_utils_module(void); int libgncmod_gnome_utils_gnc_module_init(int refcount) { - if (!gnc_module_load("gnucash/app-utils", 0)) - { - return FALSE; - } - scm_init_sw_gnome_utils_module(); lmod("(sw_gnome_utils)"); lmod("(gnucash gnome-utils)"); diff --git a/gnucash/gnome-utils/test/CMakeLists.txt b/gnucash/gnome-utils/test/CMakeLists.txt index 509777b33e..03be6eb42c 100644 --- a/gnucash/gnome-utils/test/CMakeLists.txt +++ b/gnucash/gnome-utils/test/CMakeLists.txt @@ -31,7 +31,7 @@ set(GUILE_DEPENDS scm-gnome-utils test-core gncmod-test-engine - gncmod-app-utils + gnc-app-utils gnc-core-utils gnc-engine ) diff --git a/gnucash/gnucash-bin.c b/gnucash/gnucash-bin.c index b77bf35147..f946ffaddf 100644 --- a/gnucash/gnucash-bin.c +++ b/gnucash/gnucash-bin.c @@ -487,7 +487,6 @@ load_gnucash_modules() gboolean optional; } modules[] = { - { "gnucash/app-utils", 0, FALSE }, { "gnucash/gnome-utils", 0, FALSE }, { "gnucash/gnome-search", 0, FALSE }, { "gnucash/register/ledger-core", 0, FALSE }, @@ -602,10 +601,12 @@ inner_main (void *closure, int argc, char **argv) SCM main_mod; char* fn = NULL; + scm_c_eval_string("(debug-set! stack 200000)"); main_mod = scm_c_resolve_module("gnucash utilities"); scm_set_current_module(main_mod); + scm_c_use_module("gnucash app-utils"); /* Check whether the settings need a version update */ gnc_gsettings_version_upgrade (); diff --git a/gnucash/html/gncmod-html.c b/gnucash/html/gncmod-html.c index 8a4d08277e..b62cd80606 100644 --- a/gnucash/html/gncmod-html.c +++ b/gnucash/html/gncmod-html.c @@ -73,11 +73,6 @@ extern SCM scm_init_sw_gnc_html_module( void ); int libgncmod_html_gnc_module_init( int refcount ) { - if ( !gnc_module_load( "gnucash/app-utils", 0 ) ) - { - return FALSE; - } - scm_init_sw_gnc_html_module(); gnc_html_initialize(); lmod( "(sw_gnc_html)" ); diff --git a/gnucash/import-export/aqb/gncmod-aqbanking.c b/gnucash/import-export/aqb/gncmod-aqbanking.c index 4f678891f8..dc288500c2 100644 --- a/gnucash/import-export/aqb/gncmod-aqbanking.c +++ b/gnucash/import-export/aqb/gncmod-aqbanking.c @@ -62,8 +62,7 @@ gint libgncmod_aqbanking_gnc_module_init(gint refcount) { /* Load modules we depend on */ - if (!gnc_module_load("gnucash/app-utils", 0) - || !gnc_module_load("gnucash/gnome-utils", 0) + if (!gnc_module_load("gnucash/gnome-utils", 0) || !gnc_module_load("gnucash/import-export", 0)) { return FALSE; diff --git a/gnucash/import-export/aqb/test/CMakeLists.txt b/gnucash/import-export/aqb/test/CMakeLists.txt index 30ad13014a..8ce0b73dac 100644 --- a/gnucash/import-export/aqb/test/CMakeLists.txt +++ b/gnucash/import-export/aqb/test/CMakeLists.txt @@ -21,7 +21,7 @@ set(test_aqb_INCLUDE_DIRS set(test_aqb_LIBS gncmod-aqbanking gncmod-generic-import gnc-gnome gncmod-gnome-utils - gncmod-ledger-core gncmod-app-utils + gncmod-ledger-core gnc-app-utils gncmod-backend-xml-utils gnc-engine gnc-core-utils gnc-module ${GLIB2_LDFLAGS} ) diff --git a/gnucash/import-export/bi-import/CMakeLists.txt b/gnucash/import-export/bi-import/CMakeLists.txt index 1ec36809a6..90255fea2b 100644 --- a/gnucash/import-export/bi-import/CMakeLists.txt +++ b/gnucash/import-export/bi-import/CMakeLists.txt @@ -21,7 +21,7 @@ add_library(gncmod-bi-import ${bi_import_noinst_HEADERS} ${bi_import_SOURCES}) target_link_libraries(gncmod-bi-import gncmod-gnome-utils gncmod-gnome-search - gncmod-app-utils + gnc-app-utils gnc-engine gnc-core-utils gnc-module diff --git a/gnucash/import-export/bi-import/gncmod-bi-import.c b/gnucash/import-export/bi-import/gncmod-bi-import.c index 1aa7632076..b7091f4d5a 100644 --- a/gnucash/import-export/bi-import/gncmod-bi-import.c +++ b/gnucash/import-export/bi-import/gncmod-bi-import.c @@ -65,10 +65,6 @@ libgncmod_bi_import_gnc_module_description (void) int libgncmod_bi_import_gnc_module_init (int refcount) { - if (!gnc_module_load ("gnucash/app-utils", 0)) - { - return FALSE; - } if (!gnc_module_load ("gnucash/gnome-utils", 0)) { return FALSE; diff --git a/gnucash/import-export/csv-exp/CMakeLists.txt b/gnucash/import-export/csv-exp/CMakeLists.txt index 8351e7a240..44dd90a554 100644 --- a/gnucash/import-export/csv-exp/CMakeLists.txt +++ b/gnucash/import-export/csv-exp/CMakeLists.txt @@ -19,7 +19,7 @@ set(csv_export_noinst_HEADERS add_library(gncmod-csv-export ${csv_export_noinst_HEADERS} ${csv_export_SOURCES}) target_link_libraries(gncmod-csv-export gncmod-register-gnome gncmod-register-core gncmod-ledger-core gnc-engine - gnc-module gncmod-gnome-utils gnc-gnome gncmod-app-utils gnc-core-utils) + gnc-module gncmod-gnome-utils gnc-gnome gnc-app-utils gnc-core-utils) target_compile_definitions(gncmod-csv-export PRIVATE -DG_LOG_DOMAIN=\"gnc.export.csv\") diff --git a/gnucash/import-export/csv-exp/gncmod-csv-export.c b/gnucash/import-export/csv-exp/gncmod-csv-export.c index 7a2dca9805..1435bf9046 100644 --- a/gnucash/import-export/csv-exp/gncmod-csv-export.c +++ b/gnucash/import-export/csv-exp/gncmod-csv-export.c @@ -59,10 +59,6 @@ libgncmod_csv_export_gnc_module_description(void) int libgncmod_csv_export_gnc_module_init(int refcount) { - if (!gnc_module_load("gnucash/app-utils", 0)) - { - return FALSE; - } if (!gnc_module_load("gnucash/gnome-utils", 0)) { return FALSE; diff --git a/gnucash/import-export/csv-imp/CMakeLists.txt b/gnucash/import-export/csv-imp/CMakeLists.txt index e600912ed3..446c45e1d5 100644 --- a/gnucash/import-export/csv-imp/CMakeLists.txt +++ b/gnucash/import-export/csv-imp/CMakeLists.txt @@ -68,7 +68,7 @@ target_link_libraries( ${ICU4C_I18N_LDFLAGS} gncmod-generic-import gncmod-gnome-utils - gncmod-app-utils + gnc-app-utils gnc-engine gnc-core-utils gnc-module) diff --git a/gnucash/import-export/csv-imp/gncmod-csv-import.c b/gnucash/import-export/csv-imp/gncmod-csv-import.c index 52be6ea526..e92cc5696c 100644 --- a/gnucash/import-export/csv-imp/gncmod-csv-import.c +++ b/gnucash/import-export/csv-imp/gncmod-csv-import.c @@ -59,10 +59,6 @@ libgncmod_csv_import_gnc_module_description(void) int libgncmod_csv_import_gnc_module_init(int refcount) { - if (!gnc_module_load("gnucash/app-utils", 0)) - { - return FALSE; - } if (!gnc_module_load("gnucash/gnome-utils", 0)) { return FALSE; diff --git a/gnucash/import-export/customer-import/CMakeLists.txt b/gnucash/import-export/customer-import/CMakeLists.txt index 3380d4ddf4..a33e61225c 100644 --- a/gnucash/import-export/customer-import/CMakeLists.txt +++ b/gnucash/import-export/customer-import/CMakeLists.txt @@ -17,7 +17,7 @@ set(customer_import_noinst_HEADERS add_library(gncmod-customer-import ${customer_import_SOURCES} ${customer_import_noinst_HEADERS}) -target_link_libraries(gncmod-customer-import gnc-gnome gncmod-gnome-utils gncmod-app-utils +target_link_libraries(gncmod-customer-import gnc-gnome gncmod-gnome-utils gnc-app-utils gnc-engine gnc-core-utils gnc-module ${GLIB2_LDFLAGS}) target_include_directories(gncmod-customer-import diff --git a/gnucash/import-export/customer-import/gncmod-customer-import.c b/gnucash/import-export/customer-import/gncmod-customer-import.c index 945d8e08fb..93cb9e4339 100644 --- a/gnucash/import-export/customer-import/gncmod-customer-import.c +++ b/gnucash/import-export/customer-import/gncmod-customer-import.c @@ -65,10 +65,6 @@ libgncmod_customer_import_gnc_module_description (void) int libgncmod_customer_import_gnc_module_init (int refcount) { - if (!gnc_module_load ("gnucash/app-utils", 0)) - { - return FALSE; - } if (!gnc_module_load ("gnucash/gnome-utils", 0)) { return FALSE; diff --git a/gnucash/import-export/gncmod-generic-import.c b/gnucash/import-export/gncmod-generic-import.c index 7a68554adf..f1f1cd5ddb 100644 --- a/gnucash/import-export/gncmod-generic-import.c +++ b/gnucash/import-export/gncmod-generic-import.c @@ -58,10 +58,6 @@ libgncmod_generic_import_gnc_module_description(void) int libgncmod_generic_import_gnc_module_init(int refcount) { - if (!gnc_module_load("gnucash/app-utils", 0)) - { - return FALSE; - } if (!gnc_module_load("gnucash/gnome-utils", 0)) { return FALSE; diff --git a/gnucash/import-export/log-replay/CMakeLists.txt b/gnucash/import-export/log-replay/CMakeLists.txt index 8e6d71a1af..25573c1423 100644 --- a/gnucash/import-export/log-replay/CMakeLists.txt +++ b/gnucash/import-export/log-replay/CMakeLists.txt @@ -15,7 +15,7 @@ set(log_replay_noinst_HEADERS add_library(gncmod-log-replay ${log_replay_SOURCES} ${log_replay_noinst_HEADERS}) -target_link_libraries(gncmod-log-replay gncmod-gnome-utils gncmod-app-utils gnc-engine +target_link_libraries(gncmod-log-replay gncmod-gnome-utils gnc-app-utils gnc-engine gnc-core-utils gnc-module PkgConfig::GTK3) target_compile_definitions(gncmod-log-replay PRIVATE -DG_LOG_DOMAIN=\"gnc.import.log-replay\") diff --git a/gnucash/import-export/log-replay/gncmod-log-replay.c b/gnucash/import-export/log-replay/gncmod-log-replay.c index a27729d17e..777a41ecec 100644 --- a/gnucash/import-export/log-replay/gncmod-log-replay.c +++ b/gnucash/import-export/log-replay/gncmod-log-replay.c @@ -61,10 +61,6 @@ libgncmod_log_replay_gnc_module_description(void) int libgncmod_log_replay_gnc_module_init(int refcount) { - if (!gnc_module_load("gnucash/app-utils", 0)) - { - return FALSE; - } if (!gnc_module_load("gnucash/gnome-utils", 0)) { return FALSE; diff --git a/gnucash/import-export/ofx/CMakeLists.txt b/gnucash/import-export/ofx/CMakeLists.txt index c850b12936..8621909835 100644 --- a/gnucash/import-export/ofx/CMakeLists.txt +++ b/gnucash/import-export/ofx/CMakeLists.txt @@ -20,7 +20,7 @@ set(ofx_UI gnc-plugin-ofx-ui.xml) if (WITH_OFX) add_library(gncmod-ofx ${ofx_SOURCES} ${ofx_noinst_HEADERS}) - target_link_libraries(gncmod-ofx gncmod-generic-import gnc-engine gncmod-app-utils gnc-core-utils + target_link_libraries(gncmod-ofx gncmod-generic-import gnc-engine gnc-app-utils gnc-core-utils gncmod-gnome-utils ${LIBOFX_LDFLAGS}) target_compile_definitions(gncmod-ofx PRIVATE -DG_LOG_DOMAIN=\"gnc.import.ofx\") diff --git a/gnucash/import-export/ofx/gncmod-ofx-import.c b/gnucash/import-export/ofx/gncmod-ofx-import.c index 897b30bc6d..9796cd87cb 100644 --- a/gnucash/import-export/ofx/gncmod-ofx-import.c +++ b/gnucash/import-export/ofx/gncmod-ofx-import.c @@ -61,10 +61,6 @@ libgncmod_ofx_gnc_module_description(void) int libgncmod_ofx_gnc_module_init(int refcount) { - if (!gnc_module_load("gnucash/app-utils", 0)) - { - return FALSE; - } if (!gnc_module_load("gnucash/gnome-utils", 0)) { return FALSE; diff --git a/gnucash/import-export/qif-imp/CMakeLists.txt b/gnucash/import-export/qif-imp/CMakeLists.txt index 417369d591..e3bf7a078f 100644 --- a/gnucash/import-export/qif-imp/CMakeLists.txt +++ b/gnucash/import-export/qif-imp/CMakeLists.txt @@ -21,7 +21,7 @@ set (qif_import_noinst_HEADERS add_library (gncmod-qif-import ${qif_import_SOURCES} ${qif_import_noinst_HEADERS}) target_link_libraries(gncmod-qif-import - gncmod-app-utils + gnc-app-utils gncmod-gnome-utils gnc-gnome gnucash-guile) diff --git a/gnucash/import-export/qif-imp/gncmod-qif-import.c b/gnucash/import-export/qif-imp/gncmod-qif-import.c index 188a0ed97a..2bcb9e6062 100644 --- a/gnucash/import-export/qif-imp/gncmod-qif-import.c +++ b/gnucash/import-export/qif-imp/gncmod-qif-import.c @@ -62,11 +62,6 @@ libgncmod_qif_import_gnc_module_description(void) int libgncmod_qif_import_gnc_module_init(int refcount) { - if (!gnc_module_load("gnucash/app-utils", 0)) - { - return FALSE; - } - if (!gnc_module_load("gnucash/gnome-utils", 0)) { return FALSE; diff --git a/gnucash/python/CMakeLists.txt b/gnucash/python/CMakeLists.txt index a6690ddf8e..566f406397 100644 --- a/gnucash/python/CMakeLists.txt +++ b/gnucash/python/CMakeLists.txt @@ -13,7 +13,7 @@ set(pycons_DATA if (WITH_PYTHON) add_library(gncmod-python ${gncmod_python_SOURCES}) - # target_link_libraries(gncmod-python gnc-module gnc-core-utils-python gncmod-app-utils-python + # target_link_libraries(gncmod-python gnc-module gnc-core-utils-python gnc-app-utils-python target_link_libraries(gncmod-python gnc-module gnc-core-utils ${PYTHON_LIBRARIES} ${GLIB_LIBS}) # ${PYTHON_EXTRA_LIBS} target_include_directories(gncmod-python diff --git a/gnucash/register/ledger-core/gncmod-ledger-core.c b/gnucash/register/ledger-core/gncmod-ledger-core.c index c085759189..64bb9e8e92 100644 --- a/gnucash/register/ledger-core/gncmod-ledger-core.c +++ b/gnucash/register/ledger-core/gncmod-ledger-core.c @@ -61,10 +61,5 @@ libgncmod_ledger_core_gnc_module_init(int refcount) return FALSE; } - if (!gnc_module_load("gnucash/app-utils", 0)) - { - return FALSE; - } - return TRUE; } diff --git a/gnucash/register/register-core/CMakeLists.txt b/gnucash/register/register-core/CMakeLists.txt index 381e0de7c7..007de3849b 100644 --- a/gnucash/register/register-core/CMakeLists.txt +++ b/gnucash/register/register-core/CMakeLists.txt @@ -45,7 +45,7 @@ set_source_files_properties (${register_core_SOURCES} PROPERTIES OBJECT_DEPENDS add_library (gncmod-register-core ${register_core_SOURCES} ${register_core_HEADERS}) -target_link_libraries(gncmod-register-core gncmod-gnome-utils gncmod-app-utils ${GMODULE_LDFLAGS}) +target_link_libraries(gncmod-register-core gncmod-gnome-utils gnc-app-utils ${GMODULE_LDFLAGS}) target_compile_definitions (gncmod-register-core PRIVATE -DG_LOG_DOMAIN=\"gnc.register.core\") diff --git a/gnucash/report/CMakeLists.txt b/gnucash/report/CMakeLists.txt index 8eda96b253..aea5aa3edc 100644 --- a/gnucash/report/CMakeLists.txt +++ b/gnucash/report/CMakeLists.txt @@ -29,7 +29,7 @@ target_compile_definitions(gncmod-report PRIVATE -DG_LOG_DOMAIN=\"gnc.report.cor target_link_libraries(gncmod-report gnc-module - gncmod-app-utils + gnc-app-utils gnucash-guile PkgConfig::GTK3 ${GUILE_LDFLAGS}) diff --git a/gnucash/report/gncmod-report.c b/gnucash/report/gncmod-report.c index c6cf26f72a..8f2fe46565 100644 --- a/gnucash/report/gncmod-report.c +++ b/gnucash/report/gncmod-report.c @@ -60,10 +60,6 @@ extern SCM scm_init_sw_report_module(void); int libgncmod_report_gnc_module_init(int refcount) { - if (!gnc_module_load("gnucash/app-utils", 0)) - { - return FALSE; - } scm_init_sw_report_module(); scm_c_eval_string("(use-modules (gnucash report))"); diff --git a/libgnucash/app-utils/CMakeLists.txt b/libgnucash/app-utils/CMakeLists.txt index 438b6e92ac..81562e4f7b 100644 --- a/libgnucash/app-utils/CMakeLists.txt +++ b/libgnucash/app-utils/CMakeLists.txt @@ -65,7 +65,6 @@ set (app_utils_SOURCES gnc-state.c gnc-ui-util.c gnc-ui-balances.c - gncmod-app-utils.c option-util.c ) @@ -94,22 +93,22 @@ if (WIN32) endif() -add_library (gncmod-app-utils ${app_utils_ALL_SOURCES} ${SWIG_APP_UTILS_GUILE_C}) -target_link_libraries(gncmod-app-utils ${app_utils_ALL_LIBRARIES}) +add_library (gnc-app-utils ${app_utils_ALL_SOURCES} ${SWIG_APP_UTILS_GUILE_C}) +target_link_libraries(gnc-app-utils ${app_utils_ALL_LIBRARIES}) -target_include_directories (gncmod-app-utils +target_include_directories (gnc-app-utils PUBLIC ${CMAKE_CURRENT_SOURCE_DIR} PRIVATE ${app_utils_ALL_INCLUDES} ) -target_compile_definitions (gncmod-app-utils PRIVATE -DG_LOG_DOMAIN=\"gnc.app-utils\") +target_compile_definitions (gnc-app-utils PRIVATE -DG_LOG_DOMAIN=\"gnc.app-utils\") if (APPLE) - set_target_properties (gncmod-app-utils PROPERTIES INSTALL_NAME_DIR "${CMAKE_INSTALL_FULL_LIBDIR}/gnucash") + set_target_properties (gnc-app-utils PROPERTIES INSTALL_NAME_DIR "${CMAKE_INSTALL_FULL_LIBDIR}/gnucash") endif() -install(TARGETS gncmod-app-utils - LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}/gnucash - ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}/gnucash +install(TARGETS gnc-app-utils + LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} + ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} ) @@ -117,7 +116,7 @@ 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 gncmod-app-utils ${app_utils_ALL_LIBRARIES} ${PYTHON_LIBRARIES}) + 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) @@ -130,7 +129,7 @@ if (WITH_PYTHON) 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}/gnucash") + set_target_properties (sw_app_utils PROPERTIES INSTALL_NAME_DIR "${CMAKE_INSTALL_FULL_LIBDIR}") endif() install(TARGETS sw_app_utils @@ -168,7 +167,7 @@ set (app_utils_SCHEME_2 ) set(GUILE_DEPENDS - gncmod-app-utils + gnc-app-utils scm-core-utils scm-engine scm-gnc-module @@ -197,5 +196,5 @@ add_custom_target(scm-app-utils ALL DEPENDS scm-app-utils-2 scm-app-utils-1) set_local_dist(app_utils_DIST_local ${app_utils_ALL_SOURCES} ${app_utils_SCHEME_1} ${app_utils_SCHEME_2} ${app_utils_SCHEME_3} - app-utils.i CMakeLists.txt gnc-help-utils.c README) + app-utils.i CMakeLists.txt gnc-help-utils.c) set(app_utils_DIST ${app_utils_DIST_local} ${test_app_utils_DIST} PARENT_SCOPE) diff --git a/libgnucash/app-utils/README b/libgnucash/app-utils/README deleted file mode 100644 index c955f15e82..0000000000 --- a/libgnucash/app-utils/README +++ /dev/null @@ -1,10 +0,0 @@ - -After loading this module, you must also call - - (gnc:setup-gettext) - (setlocale LC_ALL "") - -at some point to finish initializing the app. This is not done -automatically from gncmod-app-utils.c via app-utils.scm because you -may need to handle setlocale yourself (or you may already have other -code that does). diff --git a/libgnucash/app-utils/app-utils.scm b/libgnucash/app-utils/app-utils.scm index 26aac63be2..b6d7f63f49 100644 --- a/libgnucash/app-utils/app-utils.scm +++ b/libgnucash/app-utils/app-utils.scm @@ -18,7 +18,7 @@ (define-module (gnucash app-utils)) (eval-when (compile load eval expand) - (load-extension "libgncmod-app-utils" "scm_init_sw_app_utils_module")) + (load-extension "libgnc-app-utils" "scm_init_sw_app_utils_module")) (use-modules (sw_app_utils)) ; Export the swig-wrapped symbols in the public interface of this module diff --git a/libgnucash/app-utils/gncmod-app-utils.c b/libgnucash/app-utils/gncmod-app-utils.c deleted file mode 100644 index 24ab94d93c..0000000000 --- a/libgnucash/app-utils/gncmod-app-utils.c +++ /dev/null @@ -1,88 +0,0 @@ -/********************************************************************* - * gncmod-app-utils.c - * module definition/initialization for the report infrastructure - * - * Copyright (c) 2001 Linux Developers Group, Inc. - *********************************************************************/ -/********************************************************************\ - * This program is free software; you can redistribute it and/or * - * modify it under the terms of the GNU General Public License as * - * published by the Free Software Foundation; either version 2 of * - * the License, or (at your option) any later version. * - * * - * This program is distributed in the hope that it will be useful, * - * but WITHOUT ANY WARRANTY; without even the implied warranty of * - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * - * GNU General Public License for more details. * - * * - * You should have received a copy of the GNU General Public License* - * along with this program; if not, contact: * - * * - * Free Software Foundation Voice: +1-617-542-5942 * - * 51 Franklin Street, Fifth Floor Fax: +1-617-542-2652 * - * Boston, MA 02110-1301, USA gnu@gnu.org * - * * -\********************************************************************/ - - -#include -#include -#include - -#include "gnc-module.h" -#include "gnc-module-api.h" - -#include "gnc-hooks.h" -#include "gnc-exp-parser.h" - -GNC_MODULE_API_DECL(libgncmod_app_utils) - -/* version of the gnc module system interface we require */ -int libgncmod_app_utils_gnc_module_system_interface = 0; - -/* module versioning uses libtool semantics. */ -int libgncmod_app_utils_gnc_module_current = 0; -int libgncmod_app_utils_gnc_module_revision = 0; -int libgncmod_app_utils_gnc_module_age = 0; - - -char * -libgncmod_app_utils_gnc_module_path(void) -{ - return g_strdup("gnucash/app-utils"); -} - -char * -libgncmod_app_utils_gnc_module_description(void) -{ - return g_strdup("Utilities for building gnc applications"); -} - -static void -lmod(char * mn) -{ - char * form = g_strdup_printf("(use-modules %s)\n", mn); - scm_c_eval_string(form); - g_free(form); -} - - -extern SCM scm_init_sw_app_utils_module(void); - -int -libgncmod_app_utils_gnc_module_init(int refcount) -{ - scm_init_sw_app_utils_module(); - /* publish swig bindings */ - /* load the scheme code */ - lmod("(sw_app_utils)"); - lmod("(gnucash app-utils)"); - - return TRUE; -} - -int -libgncmod_app_utils_gnc_module_end(int refcount) -{ - return TRUE; -} diff --git a/libgnucash/app-utils/test/CMakeLists.txt b/libgnucash/app-utils/test/CMakeLists.txt index dedc266de2..2316b9e106 100644 --- a/libgnucash/app-utils/test/CMakeLists.txt +++ b/libgnucash/app-utils/test/CMakeLists.txt @@ -9,7 +9,7 @@ set(APP_UTILS_TEST_INCLUDE_DIRS ${GUILE_INCLUDE_DIRS} ) -set(APP_UTILS_TEST_LIBS gncmod-app-utils gncmod-test-engine test-core ${GIO_LDFLAGS} ${GUILE_LDFLAGS}) +set(APP_UTILS_TEST_LIBS gnc-app-utils gncmod-test-engine test-core ${GIO_LDFLAGS} ${GUILE_LDFLAGS}) set(test_app_utils_SOURCES test-app-utils.c test-option-util.cpp test-gnc-ui-util.c) @@ -20,7 +20,6 @@ endmacro() gnc_add_test_with_guile(test-exp-parser test-exp-parser.c APP_UTILS_TEST_INCLUDE_DIRS APP_UTILS_TEST_LIBS ) -gnc_add_test_with_guile(test-link-module-app-utils test-link-module 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) @@ -33,7 +32,6 @@ set(GUILE_DEPENDS scm-test-engine scm-app-utils scm-core-utils - scm-gnc-module scm-engine scm-core-utils gncmod-backend-xml @@ -83,7 +81,6 @@ set_dist_list(test_app_utils_DIST CMakeLists.txt test-exp-parser.c - test-link-module.c test-print-parse-amount.cpp test-print-queries.cpp test-scm-query-string.cpp diff --git a/libgnucash/app-utils/test/test-app-utils.c b/libgnucash/app-utils/test/test-app-utils.c index 5daca604f3..17289e77fc 100644 --- a/libgnucash/app-utils/test/test-app-utils.c +++ b/libgnucash/app-utils/test/test-app-utils.c @@ -24,7 +24,6 @@ #include #include #include -#include extern void test_suite_option_util (void); extern void test_suite_gnc_ui_util (void); @@ -32,10 +31,8 @@ extern void test_suite_gnc_ui_util (void); static void guile_main (void *closure, int argc, char **argv) { - GNCModule mod; int retval; - gnc_module_system_init (); - mod = gnc_module_load ("gnucash/app-utils", 0); + scm_c_use_module("gnucash app-utils"); test_suite_option_util (); test_suite_gnc_ui_util (); diff --git a/libgnucash/app-utils/test/test-link-module.c b/libgnucash/app-utils/test/test-link-module.c deleted file mode 100644 index a51a18bcbc..0000000000 --- a/libgnucash/app-utils/test/test-link-module.c +++ /dev/null @@ -1,41 +0,0 @@ -/********************************************************************\ - * This program is free software; you can redistribute it and/or * - * modify it under the terms of the GNU General Public License as * - * published by the Free Software Foundation; either version 2 of * - * the License, or (at your option) any later version. * - * * - * This program is distributed in the hope that it will be useful, * - * but WITHOUT ANY WARRANTY; without even the implied warranty of * - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * - * GNU General Public License for more details. * - * * - * You should have received a copy of the GNU General Public License* - * along with this program; if not, contact: * - * * - * Free Software Foundation Voice: +1-617-542-5942 * - * 51 Franklin Street, Fifth Floor Fax: +1-617-542-2652 * - * Boston, MA 02110-1301, USA gnu@gnu.org * - * * -\********************************************************************/ - -#include -#include -#include - -static void -guile_main(void *closure, int argc, char ** argv) -{ - GNCModule mod; - gnc_module_system_init(); - mod = gnc_module_load("gnucash/app-utils", 0); - - exit(mod == NULL); -} - -int -main(int argc, char ** argv) -{ - g_setenv ("GNC_UNINSTALLED", "1", TRUE); - scm_boot_guile(argc, argv, guile_main, NULL); - return 0; -} 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 2524bbb80d..094d190059 100755 --- a/libgnucash/app-utils/test/test-load-app-utils-module.scm +++ b/libgnucash/app-utils/test/test-load-app-utils-module.scm @@ -1,25 +1,20 @@ (define exit-code 0) (setenv "GNC_UNINSTALLED" "1") -(use-modules (gnucash gnc-module)) -(gnc:module-system-init) -(gnc:module-begin-syntax (define loaded-module (gnc:module-load "gnucash/app-utils" 0))) -(if loaded-module - (display "Module gnucash/app-utils loaded successfully\n") - (begin - (display "Failed - module gnucash/app-utils not loaded successfully\n") - (set! exit-code -1))) +(use-modules (gnucash app-utils)) -(if (procedure? gnc:apply-with-error-handling) - (display "Procedure gnc:apply-with-error-handling found\n") - (begin - (display "Failed - procedure gnc:apply-with-error-handling not found\n") - (set! exit-code -1))) +(cond + ((defined? 'gnc:apply-with-error-handling) + (display "Procedure gnc:apply-with-error-handling found\n")) + (else + (display "Failed - procedure gnc:apply-with-error-handling not found\n") + (set! exit-code -1))) -(if (procedure? gnc-default-currency) - (display "Procedure gnc-default-currency found\n") - (begin - (display "Failed - procedure gnc-default-currency not found\n") - (set! exit-code -1))) +(cond + ((defined? 'gnc-default-currency) + (display "Procedure gnc-default-currency found\n")) + (else + (display "Failed - procedure gnc-default-currency not found\n") + (set! exit-code -1))) (exit exit-code) diff --git a/libgnucash/app-utils/test/test-print-queries.cpp b/libgnucash/app-utils/test/test-print-queries.cpp index 783a2a5401..9d6fa5a044 100644 --- a/libgnucash/app-utils/test/test-print-queries.cpp +++ b/libgnucash/app-utils/test/test-print-queries.cpp @@ -27,7 +27,6 @@ extern "C" #include "guile-mappings.h" #include "gnc-engine-guile.h" -#include "gnc-module.h" #include "test-engine-stuff.h" #include "test-stuff.h" #include "Query.h" @@ -77,7 +76,7 @@ main_helper (void *closure, int argc, char **argv) { int count = 50; - gnc_module_load("gnucash/app-utils", 0); + scm_c_use_module("gnucash app-utils"); if (argc > 1) count = atoi (argv[1]); diff --git a/libgnucash/app-utils/test/test-scm-query-string.cpp b/libgnucash/app-utils/test/test-scm-query-string.cpp index 9b685c8c72..13e9ad35e9 100644 --- a/libgnucash/app-utils/test/test-scm-query-string.cpp +++ b/libgnucash/app-utils/test/test-scm-query-string.cpp @@ -27,7 +27,6 @@ extern "C" #include "guile-mappings.h" #include "gnc-engine-guile.h" -#include "gnc-module.h" #include "gnc-guile-utils.h" #include "test-engine-stuff.h" #include "test-stuff.h" @@ -112,8 +111,7 @@ run_tests (void) static void main_helper (void *closure, int argc, char **argv) { - gnc_module_system_init (); - gnc_module_load("gnucash/app-utils", 0); + scm_c_use_module("gnucash app-utils"); xaccLogDisable (); diff --git a/libgnucash/tax/de_DE/tax.scm b/libgnucash/tax/de_DE/tax.scm index 8f2129b75d..77f6eede5e 100644 --- a/libgnucash/tax/de_DE/tax.scm +++ b/libgnucash/tax/de_DE/tax.scm @@ -19,11 +19,7 @@ (define-module (gnucash locale de_DE tax)) -(eval-when - (compile load eval expand) - (load-extension "libgncmod-app-utils" "scm_init_sw_app_utils_module")) (use-modules (gnucash engine)) -(use-modules (sw_app_utils)) (use-modules (gnucash app-utils)) (export gnc:txf-get-payer-name-source) diff --git a/libgnucash/tax/gncmod-locale-tax.c b/libgnucash/tax/gnc-locale-tax.c similarity index 100% rename from libgnucash/tax/gncmod-locale-tax.c rename to libgnucash/tax/gnc-locale-tax.c diff --git a/po/POTFILES.in b/po/POTFILES.in index 1c3e7c43a2..c54d4bbf63 100644 --- a/po/POTFILES.in +++ b/po/POTFILES.in @@ -535,7 +535,6 @@ libgnucash/app-utils/gnc-exp-parser.c libgnucash/app-utils/gnc-gsettings.c libgnucash/app-utils/gnc-helpers.c libgnucash/app-utils/gnc-help-utils.c -libgnucash/app-utils/gncmod-app-utils.c libgnucash/app-utils/gnc-prefs-utils.c libgnucash/app-utils/gnc-state.c libgnucash/app-utils/gnc-sx-instance-model.c