mirror of https://github.com/Gnucash/gnucash
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
<libdir>/gnucash to <libdir>. 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.
pull/611/head
parent
90aa539908
commit
d52aa0a0dd
@ -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).
|
||||
@ -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 <config.h>
|
||||
#include <gmodule.h>
|
||||
#include <libguile.h>
|
||||
|
||||
#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;
|
||||
}
|
||||
@ -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 <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/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;
|
||||
}
|
||||
@ -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)
|
||||
|
||||
Loading…
Reference in new issue