mirror of
https://github.com/Gnucash/gnucash.git
synced 2025-02-25 18:55:30 -06:00
Convert gncmod-report into an ordinary library
An init function has been added to be called once before using the library.
This commit is contained in:
parent
8e40f400ad
commit
03d7ae8fd0
@ -52,9 +52,9 @@ endif()
|
||||
|
||||
target_link_libraries (gnucash
|
||||
gnc-ledger-core gnc-gnome gnc-gnome-utils gnc-app-utils
|
||||
gnc-engine gnc-module gnc-core-utils gncmod-report gnucash-guile
|
||||
gnc-engine gnc-module gnc-core-utils gnucash-guile
|
||||
gnc-qif-import gnc-csv-import gnc-csv-export gnc-log-replay
|
||||
gnc-bi-import gnc-customer-import
|
||||
gnc-bi-import gnc-customer-import gnc-report
|
||||
PkgConfig::GTK3 ${GUILE_LDFLAGS} ${GLIB2_LDFLAGS} ${GTK_MAC_LDFLAGS}
|
||||
)
|
||||
|
||||
|
@ -139,7 +139,7 @@ add_library (gnc-gnome ${gnc_gnome_SOURCES} ${gnc_gnome_noinst_HEADERS} ${SWIG_G
|
||||
target_link_libraries(gnc-gnome
|
||||
gnc-gnome-search
|
||||
gnc-ledger-core
|
||||
gncmod-report
|
||||
gnc-report
|
||||
gnc-register-gnome
|
||||
gnc-register-core
|
||||
gnc-gnome-utils
|
||||
|
@ -508,7 +508,6 @@ load_gnucash_modules()
|
||||
{
|
||||
{ "gnucash/import-export/ofx", 0, TRUE },
|
||||
{ "gnucash/import-export/aqbanking", 0, TRUE },
|
||||
{ "gnucash/report", 0, FALSE },
|
||||
{ "gnucash/python", 0, TRUE },
|
||||
};
|
||||
|
||||
@ -623,6 +622,7 @@ inner_main (void *closure, int argc, char **argv)
|
||||
gnc_search_core_initialize ();
|
||||
gnc_hook_add_dangler(HOOK_UI_SHUTDOWN, (GFunc)gnc_search_core_finalize, NULL, NULL);
|
||||
gnucash_register_add_cell_types ();
|
||||
gnc_report_init ();
|
||||
|
||||
load_gnucash_plugins();
|
||||
load_gnucash_modules();
|
||||
|
@ -14,35 +14,34 @@ gnc_add_swig_guile_command (swig-report-c
|
||||
)
|
||||
|
||||
set (report_SOURCES
|
||||
gncmod-report.c
|
||||
gnc-report.c
|
||||
)
|
||||
|
||||
add_library (gncmod-report
|
||||
add_library (gnc-report
|
||||
${report_SOURCES}
|
||||
${report_HEADERS}
|
||||
${SWIG_REPORT_C}
|
||||
)
|
||||
|
||||
target_compile_definitions(gncmod-report PRIVATE -DG_LOG_DOMAIN=\"gnc.report.core\")
|
||||
target_compile_definitions(gnc-report PRIVATE -DG_LOG_DOMAIN=\"gnc.report.core\")
|
||||
|
||||
target_link_libraries(gncmod-report
|
||||
target_link_libraries(gnc-report
|
||||
gnc-module
|
||||
gnc-app-utils
|
||||
gnucash-guile
|
||||
PkgConfig::GTK3
|
||||
${GUILE_LDFLAGS})
|
||||
|
||||
target_include_directories (gncmod-report
|
||||
target_include_directories (gnc-report
|
||||
PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}
|
||||
)
|
||||
|
||||
|
||||
if (APPLE)
|
||||
set_target_properties (gncmod-report PROPERTIES INSTALL_NAME_DIR "${CMAKE_INSTALL_FULL_LIBDIR}/gnucash")
|
||||
set_target_properties (gnc-report PROPERTIES INSTALL_NAME_DIR "${CMAKE_INSTALL_FULL_LIBDIR}/gnucash")
|
||||
endif()
|
||||
|
||||
install(TARGETS gncmod-report
|
||||
install(TARGETS gnc-report
|
||||
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}/gnucash
|
||||
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}/gnucash
|
||||
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})
|
||||
@ -90,7 +89,7 @@ set (report_eguile_SCHEME
|
||||
set(GUILE_DEPENDS
|
||||
scm-gnc-html
|
||||
scm-gnome-utils
|
||||
gncmod-report
|
||||
gnc-report
|
||||
scm-app-utils
|
||||
scm-engine
|
||||
scm-gnc-module
|
||||
|
@ -42,12 +42,23 @@
|
||||
#include "gnc-report.h"
|
||||
#include "gnc-engine.h"
|
||||
|
||||
extern SCM scm_init_sw_report_module(void);
|
||||
|
||||
static QofLogModule log_module = GNC_MOD_GUI;
|
||||
|
||||
/* Fow now, this is global, like it was in guile. It _should_ be per-book. */
|
||||
static GHashTable *reports = NULL;
|
||||
static gint report_next_serial_id = 0;
|
||||
|
||||
void
|
||||
gnc_report_init (void)
|
||||
{
|
||||
scm_init_sw_report_module();
|
||||
scm_c_use_module ("gnucash report");
|
||||
scm_c_eval_string("(report-module-loader (list '(gnucash report stylesheets)))");
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
gnc_report_init_table(void)
|
||||
{
|
||||
|
@ -31,6 +31,13 @@
|
||||
#define SAVED_REPORTS_FILE "saved-reports-2.8"
|
||||
#define SAVED_REPORTS_FILE_OLD_REV "saved-reports-2.4"
|
||||
|
||||
/** Initialize report library.
|
||||
*
|
||||
* Should be called once before using any of its features.
|
||||
*/
|
||||
void gnc_report_init (void);
|
||||
|
||||
|
||||
gboolean gnc_run_report (gint report_id, char ** data);
|
||||
gboolean gnc_run_report_id_string (const char * id_string, char **data);
|
||||
|
||||
|
@ -1,81 +0,0 @@
|
||||
/*********************************************************************
|
||||
* gncmod-report.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 <config.h>
|
||||
#include <gmodule.h>
|
||||
#include <libguile.h>
|
||||
|
||||
#include "gnc-module.h"
|
||||
#include "gnc-module-api.h"
|
||||
|
||||
GNC_MODULE_API_DECL(libgncmod_report)
|
||||
|
||||
/* version of the gnc module system interface we require */
|
||||
int libgncmod_report_gnc_module_system_interface = 0;
|
||||
|
||||
/* module versioning uses libtool semantics. */
|
||||
int libgncmod_report_gnc_module_current = 0;
|
||||
int libgncmod_report_gnc_module_revision = 0;
|
||||
int libgncmod_report_gnc_module_age = 0;
|
||||
|
||||
|
||||
char *
|
||||
libgncmod_report_gnc_module_path(void)
|
||||
{
|
||||
return g_strdup("gnucash/report");
|
||||
}
|
||||
|
||||
char *
|
||||
libgncmod_report_gnc_module_description(void)
|
||||
{
|
||||
return g_strdup("Core components of GnuCash report generation system");
|
||||
}
|
||||
|
||||
extern SCM scm_init_sw_report_module(void);
|
||||
|
||||
int
|
||||
libgncmod_report_gnc_module_init(int refcount)
|
||||
{
|
||||
scm_init_sw_report_module();
|
||||
|
||||
scm_c_use_module ("gnucash report");
|
||||
|
||||
/* if this is the first time the module's being loaded, initialize
|
||||
* the relative date system */
|
||||
if (refcount == 0)
|
||||
{
|
||||
scm_c_eval_string("(report-module-loader (list '(gnucash report stylesheets)))");
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
int
|
||||
libgncmod_report_gnc_module_end(int refcount)
|
||||
{
|
||||
return TRUE;
|
||||
}
|
@ -25,7 +25,7 @@
|
||||
(use-modules (gnucash app-utils))
|
||||
(use-modules (gnucash core-utils))
|
||||
(eval-when (compile load eval expand)
|
||||
(load-extension "libgncmod-report" "scm_init_sw_report_module"))
|
||||
(load-extension "libgnc-report" "scm_init_sw_report_module"))
|
||||
(use-modules (sw_report))
|
||||
|
||||
(use-modules (ice-9 match))
|
||||
|
@ -1,14 +1,4 @@
|
||||
|
||||
set(REPORT_TEST_INCLUDE_DIRS
|
||||
${CMAKE_SOURCE_DIR}/libgnucash/gnc-module
|
||||
${GUILE_INCLUDE_DIRS}
|
||||
)
|
||||
set(REPORT_TEST_LIBS gnc-module)
|
||||
|
||||
gnc_add_test_with_guile(test-link-module-report test-link-module.c
|
||||
REPORT_TEST_INCLUDE_DIRS REPORT_TEST_LIBS
|
||||
)
|
||||
|
||||
set(scm_test_report_SOURCES
|
||||
test-load-report-module.scm
|
||||
test-test-extras.scm
|
||||
@ -57,12 +47,12 @@ gnc_add_scheme_test_targets(scm-test-report-2
|
||||
DEPENDS "scm-test-report")
|
||||
|
||||
add_dependencies(check scm-test-report)
|
||||
|
||||
set_dist_list(test_report_DIST
|
||||
CMakeLists.txt
|
||||
${scm_test_report_with_srfi64_SOURCES}
|
||||
${scm_test_report_SOURCES}
|
||||
test-report-extras.scm
|
||||
test-link-module.c
|
||||
)
|
||||
|
||||
# Module interfaces deprecated in 4.x, will be removed for 5.x
|
||||
|
@ -1,42 +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 <stdlib.h>
|
||||
#include <libguile.h>
|
||||
#include <gnc-module.h>
|
||||
|
||||
static void
|
||||
guile_main(void *closure, int argc, char ** argv)
|
||||
{
|
||||
GNCModule mod;
|
||||
gnc_module_system_init();
|
||||
mod = gnc_module_load("gnucash/report", 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;
|
||||
}
|
||||
|
@ -400,7 +400,6 @@ gnucash/report/commodity-utilities.scm
|
||||
gnucash/report/eguile-html-utilities.scm
|
||||
gnucash/report/eguile.scm
|
||||
gnucash/report/eguile-utilities.scm
|
||||
gnucash/report/gncmod-report.c
|
||||
gnucash/report/gnc-report.c
|
||||
gnucash/report/html-acct-table.scm
|
||||
gnucash/report/html-anytag.scm
|
||||
|
Loading…
Reference in New Issue
Block a user