Initial port from the deprecated (in 1.6) guile gh_xxx interface to

the supported scm_xxx interface.


git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@8013 57a11ea4-9604-0410-9ed3-97b8803252fd
This commit is contained in:
David Hampton 2003-02-22 08:15:53 +00:00
parent 5644fe4325
commit d154e92e71
160 changed files with 1797 additions and 1617 deletions

View File

@ -1,3 +1,8 @@
2003-02-22 David Hampton <hampton@employees.org>
* various: Initial port from the deprecated (in 1.6) guile gh_xxx
interface to the supported scm_xxx interface.
2003-02-22 Christian Stimming <stimming@tuhh.de>
* src/import-export/hbci/dialog-hbcitrans.c: Quick fix to avoid

View File

@ -9,7 +9,7 @@ how I did it, but there are a few bits you have to be careful about.
One of the main sources of useful information is "info guile-ref".
This contains the documentation for all the guile C-side functions
like gh_car(), gh_append(), etc. that manipulate opaque SCM objects
like SCM_CAR(), scm_append(), etc. that manipulate opaque SCM objects
from the guile side.
Given that and a reasonable understanding of GTK/GNOME, you should be

View File

@ -22,7 +22,7 @@
#include "config.h"
#include <glib.h>
#include <guile/gh.h>
#include <libguile.h>
#include <string.h>
#include <g-wrap-wct.h>
@ -249,11 +249,11 @@ static void
gnc_book_opened (void)
{
GNCSession *session = gnc_get_current_session();
gh_call2 (gh_eval_str("gnc:hook-run-danglers"),
gh_eval_str("gnc:*book-opened-hook*"),
(session ?
gw_wcp_assimilate_ptr (session, gh_eval_str("<gnc:Session*>")) :
SCM_BOOL_F));
scm_call_2 (scm_c_eval_string("gnc:hook-run-danglers"),
scm_c_eval_string("gnc:*book-opened-hook*"),
(session ?
gw_wcp_assimilate_ptr (session, scm_c_eval_string("<gnc:Session*>")) :
SCM_BOOL_F));
}
void
@ -272,11 +272,11 @@ gnc_file_new (void)
* disable events so we don't get spammed by redraws. */
gnc_engine_suspend_events ();
gh_call2(gh_eval_str("gnc:hook-run-danglers"),
gh_eval_str("gnc:*book-closed-hook*"),
(session ?
gw_wcp_assimilate_ptr (session, gh_eval_str("<gnc:Session*>")) :
SCM_BOOL_F));
scm_call_2(scm_c_eval_string("gnc:hook-run-danglers"),
scm_c_eval_string("gnc:*book-closed-hook*"),
(session ?
gw_wcp_assimilate_ptr (session, scm_c_eval_string("<gnc:Session*>")) :
SCM_BOOL_F));
gnc_close_gui_component_by_session (session);
gnc_session_destroy (session);
@ -284,8 +284,8 @@ gnc_file_new (void)
/* start a new book */
gnc_get_current_session ();
gh_call1(gh_eval_str("gnc:hook-run-danglers"),
gh_eval_str("gnc:*new-book-hook*"));
scm_call_1(scm_c_eval_string("gnc:hook-run-danglers"),
scm_c_eval_string("gnc:*new-book-hook*"));
gnc_book_opened ();
@ -359,12 +359,12 @@ gnc_post_file_open (const char * filename)
/* -------------- BEGIN CORE SESSION CODE ------------- */
/* -- this code is almost identical in FileOpen and FileSaveAs -- */
current_session = gnc_get_current_session();
gh_call2(gh_eval_str("gnc:hook-run-danglers"),
gh_eval_str("gnc:*book-closed-hook*"),
(current_session ?
gw_wcp_assimilate_ptr (current_session,
gh_eval_str("<gnc:Session*>")) :
SCM_BOOL_F));
scm_call_2(scm_c_eval_string("gnc:hook-run-danglers"),
scm_c_eval_string("gnc:*book-closed-hook*"),
(current_session ?
gw_wcp_assimilate_ptr (current_session,
scm_c_eval_string("<gnc:Session*>")) :
SCM_BOOL_F));
gnc_session_destroy (current_session);
/* load the accounts from the users datafile */
@ -691,10 +691,10 @@ gnc_file_save (void)
gnc_book_mark_saved (gnc_session_get_book (session));
/* save the main window state */
gh_call1 (gh_eval_str("gnc:main-window-save-state"),
(session ?
gw_wcp_assimilate_ptr (session, gh_eval_str("<gnc:Session*>")) :
SCM_BOOL_F));
scm_call_1 (scm_c_eval_string("gnc:main-window-save-state"),
(session ?
gw_wcp_assimilate_ptr (session, scm_c_eval_string("<gnc:Session*>")) :
SCM_BOOL_F));
LEAVE (" ");
}
@ -832,11 +832,11 @@ gnc_file_quit (void)
* transactions during shutdown would cause massive redraws */
gnc_engine_suspend_events ();
gh_call2(gh_eval_str("gnc:hook-run-danglers"),
gh_eval_str("gnc:*book-closed-hook*"),
(session ?
gw_wcp_assimilate_ptr (session, gh_eval_str("<gnc:Session*>")) :
SCM_BOOL_F));
scm_call_2(scm_c_eval_string("gnc:hook-run-danglers"),
scm_c_eval_string("gnc:*book-closed-hook*"),
(session ?
gw_wcp_assimilate_ptr (session, scm_c_eval_string("<gnc:Session*>")) :
SCM_BOOL_F));
gnc_session_destroy (session);

View File

@ -6,10 +6,9 @@
*********************************************************************/
#include <stdio.h>
#include <guile/gh.h>
#include <glib.h>
#include <libguile/strports.h>
#include <libguile/modules.h>
#include <libguile.h>
#include "guile-mappings.h"
#include "gnc-file-p.h"
#include "gnc-file-history.h"
@ -49,7 +48,7 @@ static void
lmod(char * mn)
{
char * form = g_strdup_printf("(use-modules %s)\n", mn);
gh_eval_str(form);
scm_c_eval_string(form);
g_free(form);
}

View File

@ -3,6 +3,7 @@ SUBDIRS = . test
pkglib_LTLIBRARIES = libgncmod-app-utils.la libgw-app-utils.la
AM_CFLAGS = \
-I${top_srcdir}/src \
-I${top_srcdir}/src/gnc-module \
-I${top_srcdir}/src/calculation \
-I${top_srcdir}/src/engine \

View File

@ -34,7 +34,8 @@
#include <unistd.h>
#include <glib.h>
#include <guile/gh.h>
#include <libguile.h>
#include "guile-mappings.h"
#include "file-utils.h"
#include "messages.h"
@ -58,12 +59,11 @@ gncFindFile (const char * filename)
if (!filename || *filename == '\0')
return NULL;
/* This should be gh_lookup, but that appears to be broken */
find_doc_file = gh_eval_str("gnc:find-doc-file");
scm_filename = gh_str02scm ((char *) filename);
scm_result = gh_call1(find_doc_file, scm_filename);
find_doc_file = scm_c_eval_string("gnc:find-doc-file");
scm_filename = scm_makfrom0str ((char *) filename);
scm_result = scm_call_1(find_doc_file, scm_filename);
if (gh_string_p(scm_result))
if (SCM_STRINGP(scm_result))
full_filename = gh_scm2newstr(scm_result, NULL);
g_filename = g_strdup (full_filename);

View File

@ -9,6 +9,7 @@
#include <assert.h>
#include <string.h>
#include "config.h"
#include "gfec.h"
@ -26,11 +27,11 @@ gfec_catcher(void *data, SCM tag, SCM throw_args)
SCM result;
char *msg = NULL;
func = gh_eval_str("gnc:error->string");
if (gh_procedure_p(func))
func = scm_c_eval_string("gnc:error->string");
if (SCM_PROCEDUREP(func))
{
result = gh_call2(func, tag, throw_args);
if (gh_string_p(result))
result = scm_call_2(func, tag, throw_args);
if (SCM_STRINGP(result))
msg = gh_scm2newstr(result, NULL);
}
@ -93,7 +94,7 @@ gfec_string_helper(void *data)
{
char *string = data;
return gh_eval_str(string);
return scm_c_eval_string(string);
}
SCM
@ -132,7 +133,7 @@ gfec_apply_helper(void *data)
{
struct gfec_apply_rec *apply_rec = (struct gfec_apply_rec *)data;
return gh_apply(apply_rec->proc, apply_rec->arglist);
return scm_apply(apply_rec->proc, apply_rec->arglist, SCM_EOL);
}
SCM

View File

@ -9,7 +9,8 @@
#ifndef GFEC_H
#define GFEC_H
#include <guile/gh.h>
#include <libguile.h>
#include "guile-mappings.h"
typedef void (*gfec_error_handler)(const char *error_message);

View File

@ -44,11 +44,11 @@ static GNCOptionDB *global_options = NULL;
void
gnc_options_init(void)
{
SCM func = gh_eval_str("gnc:send-global-options");
SCM func = scm_c_eval_string("gnc:send-global-options");
SCM options;
if (gh_procedure_p(func))
options = gh_call0(func);
if (SCM_PROCEDUREP(func))
options = scm_call_0(func);
else
{
PERR("gnc_options_init: no guile options!");

View File

@ -744,7 +744,7 @@ gnc_gui_refresh_internal (gboolean force)
continue;
if (!ci->refresh_handler &&
!gh_procedure_p (ci->refresh_handler_scm))
!SCM_PROCEDUREP (ci->refresh_handler_scm))
continue;
if (force)
@ -752,14 +752,14 @@ gnc_gui_refresh_internal (gboolean force)
if (ci->refresh_handler)
ci->refresh_handler (NULL, ci->user_data);
else
gh_call0 (ci->refresh_handler_scm);
scm_call_0 (ci->refresh_handler_scm);
}
else if (changes_match (&ci->watch_info, &changes_backup))
{
if (ci->refresh_handler)
ci->refresh_handler (changes_backup.entity_events, ci->user_data);
else
gh_call0 (ci->refresh_handler_scm);
scm_call_0 (ci->refresh_handler_scm);
}
}
@ -802,13 +802,13 @@ gnc_close_gui_component (gint component_id)
}
if (!ci->close_handler &&
!gh_procedure_p (ci->close_handler_scm))
!SCM_PROCEDUREP (ci->close_handler_scm))
return;
if (ci->close_handler)
ci->close_handler (ci->user_data);
else
gh_call0 (ci->close_handler_scm);
scm_call_0 (ci->close_handler_scm);
}
void

View File

@ -21,7 +21,8 @@
#define GNC_COMPONENT_MANAGER_H
#include <glib.h>
#include <guile/gh.h>
#include <libguile.h>
#include "guile-mappings.h"
#include "GNCId.h"
#include "gnc-event.h"

View File

@ -33,6 +33,7 @@
#include "gnc-exp-parser.h"
#include "messages.h"
#include "gnc-ui-util.h"
#include "guile-mappings.h"
/** Data Types *****************************************************/
@ -74,7 +75,7 @@ gnc_exp_parser_real_init ( gboolean addPredefined )
if ( addPredefined ) {
alist = gnc_lookup_option ("__exp_parser", "defined_variables", SCM_EOL);
while (gh_list_p(alist) && !gh_null_p(alist))
while (SCM_LISTP(alist) && !SCM_NULLP(alist))
{
char *name;
SCM assoc;
@ -82,29 +83,29 @@ gnc_exp_parser_real_init ( gboolean addPredefined )
gnc_numeric value;
gboolean good;
assoc = gh_car (alist);
alist = gh_cdr (alist);
assoc = SCM_CAR (alist);
alist = SCM_CDR (alist);
if (!gh_pair_p (assoc))
if (!SCM_CONSP (assoc))
continue;
name = gh_scm2newstr (gh_car (assoc), NULL);
name = gh_scm2newstr (SCM_CAR (assoc), NULL);
if (name == NULL)
continue;
val_scm = gh_cdr (assoc);
val_scm = SCM_CDR (assoc);
good = TRUE;
if (gh_number_p (val_scm))
if (SCM_NUMBERP (val_scm))
{
double dvalue;
dvalue = gh_scm2double (val_scm);
dvalue = scm_num2dbl (val_scm, __FUNCTION__);
value = double_to_gnc_numeric (dvalue, GNC_DENOM_AUTO,
GNC_DENOM_SIGFIGS(6)
| GNC_RND_ROUND);
}
else if (gh_string_p (val_scm))
else if (SCM_STRINGP (val_scm))
{
char *s;
const char *err;
@ -147,10 +148,10 @@ binding_cons (gpointer key, gpointer value, gpointer data)
SCM assoc;
num_str = gnc_numeric_to_string (gnc_numeric_reduce (pnum->value));
assoc = gh_cons (gh_str02scm (name), gh_str02scm (num_str));
assoc = scm_cons (scm_makfrom0str (name), scm_makfrom0str (num_str));
g_free (num_str);
*alist_p = gh_cons (assoc, *alist_p);
*alist_p = scm_cons (assoc, *alist_p);
}
void
@ -361,23 +362,23 @@ func_op( const char *fname,
g_string_sprintf( realFnName, "gnc:%s", fname );
scmFn = gh_eval_str_with_standard_handler( realFnName->str );
g_string_free( realFnName, TRUE );
if ( ! gh_procedure_p( scmFn ) ) {
if ( ! SCM_PROCEDUREP( scmFn ) ) {
/* FIXME: handle errors correctly. */
printf( "gnc:\"%s\" is not a scm procedure\n", fname );
return NULL;
}
scmArgs = gh_list( SCM_UNDEFINED );
scmArgs = scm_listify( SCM_UNDEFINED );
for ( i=0; i<argc; i++ ) {
/* cons together back-to-front. */
vs = (var_store*)argv[argc - i - 1];
switch ( vs->type ) {
case VST_NUMERIC:
n = *(gnc_numeric*)(vs->value);
scmTmp = gh_double2scm( gnc_numeric_to_double( n ) );
scmTmp = scm_make_real( gnc_numeric_to_double( n ) );
break;
case VST_STRING:
str = (char*)(vs->value);
scmTmp = gh_str2scm( str, strlen(str) );
scmTmp = scm_mem2string( str, strlen(str) );
break;
default:
/* FIXME: error */
@ -386,15 +387,15 @@ func_op( const char *fname,
return NULL;
break; /* notreached */
}
scmArgs = gh_cons( scmTmp, scmArgs );
scmArgs = scm_cons( scmTmp, scmArgs );
}
scmTmp = gh_apply( scmFn, scmArgs );
scmTmp = scm_apply( scmFn, scmArgs , SCM_EOL);
result = g_new0( gnc_numeric, 1 );
*result = double_to_gnc_numeric( gh_scm2double(scmTmp),
*result = double_to_gnc_numeric( scm_num2dbl(scmTmp, __FUNCTION__),
GNC_DENOM_AUTO,
GNC_DENOM_SIGFIGS(6) | GNC_RND_ROUND );
/* FIXME: cleanup scmArgs = gh_list, cons'ed cells? */
/* FIXME: cleanup scmArgs = scm_list, cons'ed cells? */
return (void*)result;
}

View File

@ -23,7 +23,8 @@
#include "config.h"
#include <guile/gh.h>
#include <libguile.h>
#include "guile-mappings.h"
#include <string.h>
#include "gnc-engine-util.h"
@ -40,19 +41,19 @@ gnc_printinfo2scm(GNCPrintAmountInfo info)
{
SCM info_scm = SCM_EOL;
info_scm = gh_cons (gh_bool2scm (info.round), info_scm);
info_scm = gh_cons (gh_bool2scm (info.force_fit), info_scm);
info_scm = gh_cons (gh_bool2scm (info.monetary), info_scm);
info_scm = gh_cons (gh_bool2scm (info.use_locale), info_scm);
info_scm = gh_cons (gh_bool2scm (info.use_symbol), info_scm);
info_scm = gh_cons (gh_bool2scm (info.use_separators), info_scm);
info_scm = scm_cons (SCM_BOOL (info.round), info_scm);
info_scm = scm_cons (SCM_BOOL (info.force_fit), info_scm);
info_scm = scm_cons (SCM_BOOL (info.monetary), info_scm);
info_scm = scm_cons (SCM_BOOL (info.use_locale), info_scm);
info_scm = scm_cons (SCM_BOOL (info.use_symbol), info_scm);
info_scm = scm_cons (SCM_BOOL (info.use_separators), info_scm);
info_scm = gh_cons (gh_int2scm (info.min_decimal_places), info_scm);
info_scm = gh_cons (gh_int2scm (info.max_decimal_places), info_scm);
info_scm = scm_cons (scm_int2num (info.min_decimal_places), info_scm);
info_scm = scm_cons (scm_int2num (info.max_decimal_places), info_scm);
info_scm = gh_cons (gnc_commodity_to_scm (info.commodity), info_scm);
info_scm = scm_cons (gnc_commodity_to_scm (info.commodity), info_scm);
info_scm = gh_cons (gh_symbol2scm ("print-info"), info_scm);
info_scm = scm_cons (scm_str2symbol ("print-info"), info_scm);
return info_scm;
}
@ -63,32 +64,32 @@ gnc_scm2printinfo(SCM info_scm)
GNCPrintAmountInfo info;
/* skip type */
info_scm = gh_cdr (info_scm);
info.commodity = gnc_scm_to_commodity (gh_car (info_scm));
info_scm = SCM_CDR (info_scm);
info.commodity = gnc_scm_to_commodity (SCM_CAR (info_scm));
info_scm = gh_cdr (info_scm);
info.max_decimal_places = gh_scm2int (gh_car (info_scm));
info_scm = SCM_CDR (info_scm);
info.max_decimal_places = scm_num2int (SCM_CAR (info_scm), SCM_ARG1, __FUNCTION__);
info_scm = gh_cdr (info_scm);
info.min_decimal_places = gh_scm2int (gh_car (info_scm));
info_scm = SCM_CDR (info_scm);
info.min_decimal_places = scm_num2int (SCM_CAR (info_scm), SCM_ARG1, __FUNCTION__);
info_scm = gh_cdr (info_scm);
info.use_separators = gh_scm2bool (gh_car (info_scm));
info_scm = SCM_CDR (info_scm);
info.use_separators = SCM_NFALSEP (SCM_CAR (info_scm));
info_scm = gh_cdr (info_scm);
info.use_symbol = gh_scm2bool (gh_car (info_scm));
info_scm = SCM_CDR (info_scm);
info.use_symbol = SCM_NFALSEP (SCM_CAR (info_scm));
info_scm = gh_cdr (info_scm);
info.use_locale = gh_scm2bool (gh_car (info_scm));
info_scm = SCM_CDR (info_scm);
info.use_locale = SCM_NFALSEP (SCM_CAR (info_scm));
info_scm = gh_cdr (info_scm);
info.monetary = gh_scm2bool (gh_car (info_scm));
info_scm = SCM_CDR (info_scm);
info.monetary = SCM_NFALSEP (SCM_CAR (info_scm));
info_scm = gh_cdr (info_scm);
info.force_fit = gh_scm2bool (gh_car (info_scm));
info_scm = SCM_CDR (info_scm);
info.force_fit = SCM_NFALSEP (SCM_CAR (info_scm));
info_scm = gh_cdr (info_scm);
info.round = gh_scm2bool (gh_car (info_scm));
info_scm = SCM_CDR (info_scm);
info.round = SCM_NFALSEP (SCM_CAR (info_scm));
return info;
}
@ -99,11 +100,11 @@ gnc_printinfo_p(SCM info_scm)
char *symbol;
int retval;
if (!gh_list_p(info_scm) || gh_null_p(info_scm))
if (!SCM_LISTP(info_scm) || SCM_NULLP(info_scm))
return 0;
info_scm = gh_car (info_scm);
if (!gh_symbol_p (info_scm))
info_scm = SCM_CAR (info_scm);
if (!SCM_SYMBOLP (info_scm))
return 0;
symbol = gh_symbol2newstr (info_scm, NULL);

View File

@ -24,7 +24,7 @@
#ifndef GNC_HELPERS
#define GNC_HELPERS
#include <guile/gh.h>
#include <libguile.h>
#include "gnc-ui-util.h"

View File

@ -48,6 +48,7 @@
#include "Group.h"
#include "messages.h"
#include "Transaction.h"
#include "guile-mappings.h"
static short module = MOD_GUI;
@ -516,12 +517,12 @@ gnc_ui_account_get_tax_info_string (Account *account)
g_return_val_if_fail (module, NULL);
get_form = gh_eval_str ("(false-if-exception gnc:txf-get-form)");
get_desc = gh_eval_str ("(false-if-exception gnc:txf-get-description)");
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 (gh_procedure_p (get_form), NULL);
g_return_val_if_fail (gh_procedure_p (get_desc), NULL);
g_return_val_if_fail (SCM_PROCEDUREP (get_form), NULL);
g_return_val_if_fail (SCM_PROCEDUREP (get_desc), NULL);
if (!account)
return NULL;
@ -537,23 +538,22 @@ gnc_ui_account_get_tax_info_string (Account *account)
if (!code)
return NULL;
category = gh_eval_str (atype == INCOME ?
"txf-income-categories" :
"txf-expense-categories");
category = scm_c_eval_string (atype == INCOME ?
"txf-income-categories" :
"txf-expense-categories");
/* FIXME: when we drop support older guiles, drop the (char *) coercion. */
code_scm = gh_symbol2scm ((char *) code);
code_scm = scm_str2symbol (code);
scm = gh_call2 (get_form, category, code_scm);
if (!gh_string_p (scm))
scm = scm_call_2 (get_form, category, code_scm);
if (!SCM_STRINGP (scm))
return NULL;
form = gh_scm2newstr (scm, NULL);
if (!form)
return NULL;
scm = gh_call2 (get_desc, category, code_scm);
if (!gh_string_p (scm))
scm = scm_call_2 (get_desc, category, code_scm);
if (!SCM_STRINGP (scm))
{
free (form);
return NULL;

View File

@ -5,11 +5,11 @@
* Copyright (c) 2001 Linux Developers Group, Inc.
*********************************************************************/
#include "config.h"
#include <stdio.h>
#include <guile/gh.h>
#include <glib.h>
#include <libguile/strports.h>
#include <libguile/modules.h>
#include <libguile.h>
#include "guile-mappings.h"
#include "gnc-module.h"
#include "gnc-module-api.h"
@ -45,7 +45,7 @@ static void
lmod(char * mn)
{
char * form = g_strdup_printf("(use-modules %s)\n", mn);
gh_eval_str(form);
scm_c_eval_string(form);
g_free(form);
}

View File

@ -30,7 +30,8 @@
#include "messages.h"
#include <g-wrap-wct.h>
#include <libguile/version.h>
#include <libguile.h>
#include "guile-mappings.h"
/* This static indicates the debugging module this .o belongs to. */
static short module = MOD_GUILE;
@ -83,39 +84,39 @@ initialize_scm_functions()
return;
setters.split_scm_account_guid =
gh_eval_str("gnc:split-scm-set-account-guid");
setters.split_scm_memo = gh_eval_str("gnc:split-scm-set-memo");
setters.split_scm_action = gh_eval_str("gnc:split-scm-set-action");
scm_c_eval_string("gnc:split-scm-set-account-guid");
setters.split_scm_memo = scm_c_eval_string("gnc:split-scm-set-memo");
setters.split_scm_action = scm_c_eval_string("gnc:split-scm-set-action");
setters.split_scm_reconcile_state =
gh_eval_str("gnc:split-scm-set-reconcile-state");
setters.split_scm_amount = gh_eval_str("gnc:split-scm-set-amount");
setters.split_scm_value = gh_eval_str("gnc:split-scm-set-value");
scm_c_eval_string("gnc:split-scm-set-reconcile-state");
setters.split_scm_amount = scm_c_eval_string("gnc:split-scm-set-amount");
setters.split_scm_value = scm_c_eval_string("gnc:split-scm-set-value");
setters.trans_scm_date = gh_eval_str("gnc:transaction-scm-set-date-posted");
setters.trans_scm_num = gh_eval_str("gnc:transaction-scm-set-num");
setters.trans_scm_date = scm_c_eval_string("gnc:transaction-scm-set-date-posted");
setters.trans_scm_num = scm_c_eval_string("gnc:transaction-scm-set-num");
setters.trans_scm_description =
gh_eval_str("gnc:transaction-scm-set-description");
setters.trans_scm_notes = gh_eval_str("gnc:transaction-scm-set-notes");
scm_c_eval_string("gnc:transaction-scm-set-description");
setters.trans_scm_notes = scm_c_eval_string("gnc:transaction-scm-set-notes");
setters.trans_scm_append_split_scm =
gh_eval_str("gnc:transaction-scm-append-split-scm");
scm_c_eval_string("gnc:transaction-scm-append-split-scm");
getters.split_scm_memo = gh_eval_str("gnc:split-scm-get-memo");
getters.split_scm_action = gh_eval_str("gnc:split-scm-get-action");
getters.split_scm_amount = gh_eval_str("gnc:split-scm-get-amount");
getters.split_scm_value = gh_eval_str("gnc:split-scm-get-value");
getters.split_scm_memo = scm_c_eval_string("gnc:split-scm-get-memo");
getters.split_scm_action = scm_c_eval_string("gnc:split-scm-get-action");
getters.split_scm_amount = scm_c_eval_string("gnc:split-scm-get-amount");
getters.split_scm_value = scm_c_eval_string("gnc:split-scm-get-value");
getters.trans_scm_split_scms =
gh_eval_str("gnc:transaction-scm-get-split-scms");
scm_c_eval_string("gnc:transaction-scm-get-split-scms");
getters.trans_scm_split_scm =
gh_eval_str("gnc:transaction-scm-get-split-scm");
scm_c_eval_string("gnc:transaction-scm-get-split-scm");
getters.trans_scm_other_split_scm =
gh_eval_str("gnc:transaction-scm-get-other-split-scm");
scm_c_eval_string("gnc:transaction-scm-get-other-split-scm");
getters.debit_string = gh_eval_str("gnc:get-debit-string");
getters.credit_string = gh_eval_str("gnc:get-credit-string");
getters.debit_string = scm_c_eval_string("gnc:get-debit-string");
getters.credit_string = scm_c_eval_string("gnc:get-credit-string");
predicates.is_split_scm = gh_eval_str("gnc:split-scm?");
predicates.is_trans_scm = gh_eval_str("gnc:transaction-scm?");
predicates.is_split_scm = scm_c_eval_string("gnc:split-scm?");
predicates.is_trans_scm = scm_c_eval_string("gnc:transaction-scm?");
scm_funcs_inited = TRUE;
}
@ -135,11 +136,11 @@ gnc_guile_call1_to_string(SCM func, SCM arg)
{
SCM value;
if (gh_procedure_p(func))
if (SCM_PROCEDUREP(func))
{
value = gh_call1(func, arg);
value = scm_call_1(func, arg);
if (gh_string_p(value))
if (SCM_STRINGP(value))
return gh_scm2newstr(value, NULL);
else
{
@ -170,11 +171,11 @@ gnc_guile_call1_symbol_to_string(SCM func, SCM arg)
{
SCM value;
if (gh_procedure_p(func))
if (SCM_PROCEDUREP(func))
{
value = gh_call1(func, arg);
value = scm_call_1(func, arg);
if (gh_symbol_p(value))
if (SCM_SYMBOLP(value))
return gh_symbol2newstr(value, NULL);
else
{
@ -204,11 +205,11 @@ gnc_guile_call1_to_procedure(SCM func, SCM arg)
{
SCM value;
if (gh_procedure_p(func))
if (SCM_PROCEDUREP(func))
{
value = gh_call1(func, arg);
value = scm_call_1(func, arg);
if (gh_procedure_p(value))
if (SCM_PROCEDUREP(value))
return value;
else
{
@ -238,11 +239,11 @@ gnc_guile_call1_to_list(SCM func, SCM arg)
{
SCM value;
if (gh_procedure_p(func))
if (SCM_PROCEDUREP(func))
{
value = gh_call1(func, arg);
value = scm_call_1(func, arg);
if (gh_list_p(value))
if (SCM_LISTP(value))
return value;
else
{
@ -272,11 +273,11 @@ gnc_guile_call1_to_vector(SCM func, SCM arg)
{
SCM value;
if (gh_procedure_p(func))
if (SCM_PROCEDUREP(func))
{
value = gh_call1(func, arg);
value = scm_call_1(func, arg);
if (gh_vector_p(value))
if (SCM_VECTORP(value))
return value;
else
{
@ -338,9 +339,9 @@ gnc_scm_lookup(const char *module, const char *symbol)
thunk_str = g_strdup_printf("(lambda () (eval '%s))", symbol);
in_guard = gh_eval_str(in_guard_str);
thunk = gh_eval_str(thunk_str);
out_guard = gh_eval_str("(let ((cm (current-module)))"
in_guard = scm_c_eval_string(in_guard_str);
thunk = scm_c_eval_string(thunk_str);
out_guard = scm_c_eval_string("(let ((cm (current-module)))"
" (lambda () (set-current-module cm)))");
result = scm_dynamic_wind(in_guard, thunk, out_guard);
@ -373,19 +374,19 @@ gnc_copy_split(Split *split, gboolean use_cut_semantics)
if (split == NULL)
return SCM_UNDEFINED;
func = gh_eval_str("gnc:split->split-scm");
if (!gh_procedure_p(func))
func = scm_c_eval_string("gnc:split->split-scm");
if (!SCM_PROCEDUREP(func))
return SCM_UNDEFINED;
if(split_type == SCM_UNDEFINED) {
split_type = gh_eval_str("<gnc:Split*>");
split_type = scm_c_eval_string("<gnc:Split*>");
/* don't really need this - types are bound globally anyway. */
if(split_type != SCM_UNDEFINED) scm_protect_object(split_type);
}
arg = gw_wcp_assimilate_ptr(split, split_type);
return gh_call2(func, arg, gh_bool2scm(use_cut_semantics));
return scm_call_2(func, arg, SCM_BOOL(use_cut_semantics));
}
@ -414,27 +415,27 @@ gnc_copy_split_scm_onto_split(SCM split_scm, Split *split,
g_return_if_fail (book);
func = gh_eval_str("gnc:split-scm?");
if (!gh_procedure_p(func))
func = scm_c_eval_string("gnc:split-scm?");
if (!SCM_PROCEDUREP(func))
return;
result = gh_call1(func, split_scm);
if (!gh_scm2bool(result))
result = scm_call_1(func, split_scm);
if (!SCM_NFALSEP(result))
return;
func = gh_eval_str("gnc:split-scm-onto-split");
if (!gh_procedure_p(func))
func = scm_c_eval_string("gnc:split-scm-onto-split");
if (!SCM_PROCEDUREP(func))
return;
if(split_type == SCM_UNDEFINED) {
split_type = gh_eval_str("<gnc:Split*>");
split_type = scm_c_eval_string("<gnc:Split*>");
/* don't really need this - types are bound globally anyway. */
if(split_type != SCM_UNDEFINED) scm_protect_object(split_type);
}
arg = gw_wcp_assimilate_ptr(split, split_type);
gh_call3(func, split_scm, arg, gnc_book_to_scm (book));
scm_call_3(func, split_scm, arg, gnc_book_to_scm (book));
}
@ -450,7 +451,7 @@ gnc_is_split_scm(SCM scm)
{
initialize_scm_functions();
return gh_scm2bool(gh_call1(predicates.is_split_scm, scm));
return SCM_NFALSEP(scm_call_1(predicates.is_split_scm, scm));
}
@ -466,7 +467,7 @@ gnc_is_trans_scm(SCM scm)
{
initialize_scm_functions();
return gh_scm2bool(gh_call1(predicates.is_trans_scm, scm));
return SCM_NFALSEP(scm_call_1(predicates.is_trans_scm, scm));
}
@ -495,9 +496,9 @@ gnc_split_scm_set_account(SCM split_scm, Account *account)
if (guid_string == NULL)
return;
arg = gh_str02scm(guid_string);
arg = scm_makfrom0str(guid_string);
gh_call2(setters.split_scm_account_guid, split_scm, arg);
scm_call_2(setters.split_scm_account_guid, split_scm, arg);
g_free(guid_string);
}
@ -523,10 +524,9 @@ gnc_split_scm_set_memo(SCM split_scm, const char *memo)
if (memo == NULL)
return;
/* FIXME: when we drop support older guiles, drop the (char *) coercion. */
arg = gh_str02scm((char *) memo);
arg = scm_makfrom0str(memo);
gh_call2(setters.split_scm_memo, split_scm, arg);
scm_call_2(setters.split_scm_memo, split_scm, arg);
}
@ -550,10 +550,9 @@ gnc_split_scm_set_action(SCM split_scm, const char *action)
if (action == NULL)
return;
/* FIXME: when we drop support older guiles, drop the (char *) coercion. */
arg = gh_str02scm((char *) action);
arg = scm_makfrom0str(action);
gh_call2(setters.split_scm_action, split_scm, arg);
scm_call_2(setters.split_scm_action, split_scm, arg);
}
@ -575,9 +574,9 @@ gnc_split_scm_set_reconcile_state(SCM split_scm, char reconcile_state)
if (!gnc_is_split_scm(split_scm))
return;
arg = gh_char2scm(reconcile_state);
arg = SCM_MAKE_CHAR(reconcile_state);
gh_call2(setters.split_scm_reconcile_state, split_scm, arg);
scm_call_2(setters.split_scm_reconcile_state, split_scm, arg);
}
@ -600,7 +599,7 @@ gnc_split_scm_set_amount(SCM split_scm, gnc_numeric amount)
return;
arg = gnc_numeric_to_scm(amount);
gh_call2(setters.split_scm_amount, split_scm, arg);
scm_call_2(setters.split_scm_amount, split_scm, arg);
}
@ -623,7 +622,7 @@ gnc_split_scm_set_value(SCM split_scm, gnc_numeric value)
return;
arg = gnc_numeric_to_scm(value);
gh_call2(setters.split_scm_value, split_scm, arg);
scm_call_2(setters.split_scm_value, split_scm, arg);
}
@ -644,8 +643,8 @@ gnc_split_scm_get_memo(SCM split_scm)
if (!gnc_is_split_scm(split_scm))
return NULL;
result = gh_call1(getters.split_scm_memo, split_scm);
if (!gh_string_p(result))
result = scm_call_1(getters.split_scm_memo, split_scm);
if (!SCM_STRINGP(result))
return NULL;
return gh_scm2newstr(result, NULL);
@ -669,8 +668,8 @@ gnc_split_scm_get_action(SCM split_scm)
if (!gnc_is_split_scm(split_scm))
return NULL;
result = gh_call1(getters.split_scm_action, split_scm);
if (!gh_string_p(result))
result = scm_call_1(getters.split_scm_action, split_scm);
if (!SCM_STRINGP(result))
return NULL;
return gh_scm2newstr(result, NULL);
@ -694,7 +693,7 @@ gnc_split_scm_get_amount(SCM split_scm)
if (!gnc_is_split_scm(split_scm))
return gnc_numeric_zero ();
result = gh_call1(getters.split_scm_amount, split_scm);
result = scm_call_1(getters.split_scm_amount, split_scm);
if (!gnc_numeric_p(result))
return gnc_numeric_zero ();
@ -719,7 +718,7 @@ gnc_split_scm_get_value(SCM split_scm)
if (!gnc_is_split_scm(split_scm))
return gnc_numeric_zero ();
result = gh_call1(getters.split_scm_value, split_scm);
result = scm_call_1(getters.split_scm_value, split_scm);
if (!gnc_numeric_p(result))
return gnc_numeric_zero ();
@ -746,19 +745,19 @@ gnc_copy_trans(Transaction *trans, gboolean use_cut_semantics)
if (trans == NULL)
return SCM_UNDEFINED;
func = gh_eval_str("gnc:transaction->transaction-scm");
if (!gh_procedure_p(func))
func = scm_c_eval_string("gnc:transaction->transaction-scm");
if (!SCM_PROCEDUREP(func))
return SCM_UNDEFINED;
if(trans_type == SCM_UNDEFINED) {
trans_type = gh_eval_str("<gnc:Transaction*>");
trans_type = scm_c_eval_string("<gnc:Transaction*>");
/* don't really need this - types are bound globally anyway. */
if(trans_type != SCM_UNDEFINED) scm_protect_object(trans_type);
}
arg = gw_wcp_assimilate_ptr(trans, trans_type);
return gh_call2(func, arg, gh_bool2scm(use_cut_semantics));
return scm_call_2(func, arg, SCM_BOOL(use_cut_semantics));
}
@ -814,20 +813,20 @@ gnc_copy_trans_scm_onto_trans_swap_accounts(SCM trans_scm,
g_return_if_fail (book);
func = gh_eval_str("gnc:transaction-scm?");
if (!gh_procedure_p(func))
func = scm_c_eval_string("gnc:transaction-scm?");
if (!SCM_PROCEDUREP(func))
return;
result = gh_call1(func, trans_scm);
if (!gh_scm2bool(result))
result = scm_call_1(func, trans_scm);
if (!SCM_NFALSEP(result))
return;
func = gh_eval_str("gnc:transaction-scm-onto-transaction");
if (!gh_procedure_p(func))
func = scm_c_eval_string("gnc:transaction-scm-onto-transaction");
if (!SCM_PROCEDUREP(func))
return;
if(trans_type == SCM_UNDEFINED) {
trans_type = gh_eval_str("<gnc:Transaction*>");
trans_type = scm_c_eval_string("<gnc:Transaction*>");
/* don't really need this - types are bound globally anyway. */
if(trans_type != SCM_UNDEFINED) scm_protect_object(trans_type);
}
@ -839,15 +838,15 @@ gnc_copy_trans_scm_onto_trans_swap_accounts(SCM trans_scm,
SCM args = SCM_EOL;
SCM commit;
commit = gh_bool2scm(do_commit);
commit = SCM_BOOL(do_commit);
args = gh_cons(gnc_book_to_scm (book), args);
args = gh_cons(commit, args);
args = gh_cons(SCM_EOL, args);
args = gh_cons(arg, args);
args = gh_cons(trans_scm, args);
args = scm_cons(gnc_book_to_scm (book), args);
args = scm_cons(commit, args);
args = scm_cons(SCM_EOL, args);
args = scm_cons(arg, args);
args = scm_cons(trans_scm, args);
gh_apply(func, args);
scm_apply(func, args, SCM_EOL);
}
else
{
@ -857,28 +856,28 @@ gnc_copy_trans_scm_onto_trans_swap_accounts(SCM trans_scm,
SCM commit;
char *guid_str;
args = gh_cons(gnc_book_to_scm (book), args);
args = scm_cons(gnc_book_to_scm (book), args);
commit = gh_bool2scm(do_commit);
commit = SCM_BOOL(do_commit);
args = gh_cons(commit, args);
args = scm_cons(commit, args);
guid_str = guid_to_string(guid_1);
from = gh_str02scm(guid_str);
from = scm_makfrom0str(guid_str);
g_free (guid_str);
guid_str = guid_to_string(guid_2);
to = gh_str02scm(guid_str);
to = scm_makfrom0str(guid_str);
g_free (guid_str);
map = gh_cons(gh_cons(from, to), map);
map = gh_cons(gh_cons(to, from), map);
map = scm_cons(scm_cons(from, to), map);
map = scm_cons(scm_cons(to, from), map);
args = gh_cons(map, args);
args = gh_cons(arg, args);
args = gh_cons(trans_scm, args);
args = scm_cons(map, args);
args = scm_cons(arg, args);
args = scm_cons(trans_scm, args);
gh_apply(func, args);
scm_apply(func, args, SCM_EOL);
}
}
@ -904,7 +903,7 @@ gnc_trans_scm_set_date(SCM trans_scm, Timespec *ts)
arg = gnc_timespec2timepair(*ts);
gh_call2(setters.trans_scm_date, trans_scm, arg);
scm_call_2(setters.trans_scm_date, trans_scm, arg);
}
@ -928,10 +927,9 @@ gnc_trans_scm_set_num(SCM trans_scm, const char *num)
if (num == NULL)
return;
/* FIXME: when we drop support older guiles, drop the (char *) coercion. */
arg = gh_str02scm((char *) num);
arg = scm_makfrom0str(num);
gh_call2(setters.trans_scm_num, trans_scm, arg);
scm_call_2(setters.trans_scm_num, trans_scm, arg);
}
@ -955,10 +953,9 @@ gnc_trans_scm_set_description(SCM trans_scm, const char *description)
if (description == NULL)
return;
/* FIXME: when we drop support older guiles, drop the (char *) coercion. */
arg = gh_str02scm((char *) description);
arg = scm_makfrom0str(description);
gh_call2(setters.trans_scm_description, trans_scm, arg);
scm_call_2(setters.trans_scm_description, trans_scm, arg);
}
@ -982,10 +979,9 @@ gnc_trans_scm_set_notes(SCM trans_scm, const char *notes)
if (notes == NULL)
return;
/* FIXME: when we drop support older guiles, drop the (char *) coercion. */
arg = gh_str02scm((char *) notes);
arg = scm_makfrom0str(notes);
gh_call2(setters.trans_scm_notes, trans_scm, arg);
scm_call_2(setters.trans_scm_notes, trans_scm, arg);
}
@ -1007,7 +1003,7 @@ gnc_trans_scm_append_split_scm(SCM trans_scm, SCM split_scm)
if (!gnc_is_split_scm(split_scm))
return;
gh_call2(setters.trans_scm_append_split_scm, trans_scm, split_scm);
scm_call_2(setters.trans_scm_append_split_scm, trans_scm, split_scm);
}
@ -1029,9 +1025,9 @@ gnc_trans_scm_get_split_scm(SCM trans_scm, int index)
if (!gnc_is_trans_scm(trans_scm))
return SCM_UNDEFINED;
arg = gh_int2scm(index);
arg = scm_int2num(index);
return gh_call2(getters.trans_scm_split_scm, trans_scm, arg);
return scm_call_2(getters.trans_scm_split_scm, trans_scm, arg);
}
@ -1055,7 +1051,7 @@ gnc_trans_scm_get_other_split_scm(SCM trans_scm, SCM split_scm)
if (!gnc_is_split_scm(split_scm))
return SCM_UNDEFINED;
result = gh_call2(getters.trans_scm_other_split_scm, trans_scm, split_scm);
result = scm_call_2(getters.trans_scm_other_split_scm, trans_scm, split_scm);
if (!gnc_is_split_scm(result))
return SCM_UNDEFINED;
@ -1081,12 +1077,12 @@ gnc_trans_scm_get_num_splits(SCM trans_scm)
if (!gnc_is_trans_scm(trans_scm))
return 0;
result = gh_call1(getters.trans_scm_split_scms, trans_scm);
result = scm_call_1(getters.trans_scm_split_scms, trans_scm);
if (!gh_list_p(result))
if (!SCM_LISTP(result))
return 0;
return gh_length(result);
return SCM_LENGTH(result);
}
@ -1116,11 +1112,10 @@ gnc_get_debit_string(GNCAccountType account_type)
type_string = xaccAccountTypeEnumAsString(account_type);
/* FIXME: when we drop support older guiles, drop the (char *) coercion. */
arg = gh_symbol2scm((char *) type_string);
arg = scm_str2symbol(type_string);
result = gh_call1(getters.debit_string, arg);
if (!gh_string_p(result))
result = scm_call_1(getters.debit_string, arg);
if (!SCM_STRINGP(result))
return NULL;
string = gh_scm2newstr(result, NULL);
@ -1162,10 +1157,10 @@ gnc_get_credit_string(GNCAccountType account_type)
type_string = xaccAccountTypeEnumAsString(account_type);
arg = gh_symbol2scm(type_string);
arg = scm_str2symbol(type_string);
result = gh_call1(getters.credit_string, arg);
if (!gh_string_p(result))
result = scm_call_1(getters.credit_string, arg);
if (!SCM_STRINGP(result))
return NULL;
string = gh_scm2newstr(result, NULL);

View File

@ -25,7 +25,7 @@
#define GUILE_UTIL_H
#include <glib.h>
#include <guile/gh.h>
#include <libguile.h>
#include "date.h"
#include "gnc-book.h"

View File

@ -32,6 +32,7 @@
#include "glib-helpers.h"
#include "guile-util.h"
#include "gnc-engine-util.h"
#include "guile-mappings.h"
#include <g-wrap-wct.h>
@ -185,9 +186,9 @@ gnc_option_set_selectable (GNCOption *option, gboolean selectable)
static void
gnc_option_db_init(GNCOptionDB *odb)
{
SCM func = gh_eval_str("gnc:send-options");
SCM func = scm_c_eval_string("gnc:send-options");
gh_call2(func, gh_int2scm(odb->handle), odb->guile_options);
scm_call_2(func, scm_int2num(odb->handle), odb->guile_options);
}
@ -267,15 +268,15 @@ gnc_option_db_new_for_type(SCM id_type)
if (!id_type) return NULL;
if (make_option_proc == SCM_UNDEFINED) {
make_option_proc = gh_eval_str("gnc:make-kvp-options");
if (!gh_procedure_p (make_option_proc)) {
make_option_proc = scm_c_eval_string("gnc:make-kvp-options");
if (!SCM_PROCEDUREP (make_option_proc)) {
PERR ("not a procedure\n");
make_option_proc = SCM_UNDEFINED;
return NULL;
}
}
options = gh_call1 (make_option_proc, id_type);
options = scm_call_1 (make_option_proc, id_type);
return gnc_option_db_new (options);
}
@ -289,8 +290,8 @@ gnc_option_db_load_from_kvp(GNCOptionDB* odb, kvp_frame *slots)
if (!odb || !slots) return;
if (kvp_to_scm == SCM_UNDEFINED) {
kvp_to_scm = gh_eval_str("gnc:options-kvp->scm");
if (!gh_procedure_p (kvp_to_scm)) {
kvp_to_scm = scm_c_eval_string("gnc:options-kvp->scm");
if (!SCM_PROCEDUREP (kvp_to_scm)) {
PERR ("not a procedure\n");
kvp_to_scm = SCM_UNDEFINED;
return;
@ -298,16 +299,16 @@ gnc_option_db_load_from_kvp(GNCOptionDB* odb, kvp_frame *slots)
}
if (kvp_option_path == SCM_UNDEFINED) {
kvp_option_path = gh_eval_str("gnc:*kvp-option-path*");
kvp_option_path = scm_c_eval_string("gnc:*kvp-option-path*");
if (kvp_option_path == SCM_UNDEFINED) {
PERR ("can't find the option path");
return;
}
}
scm_slots = gw_wcp_assimilate_ptr (slots, gh_eval_str("<gnc:kvp-frame*>"));
scm_slots = gw_wcp_assimilate_ptr (slots, scm_c_eval_string("<gnc:kvp-frame*>"));
gh_call3 (kvp_to_scm, odb->guile_options, scm_slots, kvp_option_path);
scm_call_3 (kvp_to_scm, odb->guile_options, scm_slots, kvp_option_path);
}
void
@ -320,8 +321,8 @@ gnc_option_db_save_to_kvp(GNCOptionDB* odb, kvp_frame *slots)
if (!odb || !slots) return;
if (scm_to_kvp == SCM_UNDEFINED) {
scm_to_kvp = gh_eval_str("gnc:options-scm->kvp");
if (!gh_procedure_p (scm_to_kvp)) {
scm_to_kvp = scm_c_eval_string("gnc:options-scm->kvp");
if (!SCM_PROCEDUREP (scm_to_kvp)) {
PERR ("not a procedure\n");
scm_to_kvp = SCM_UNDEFINED;
return;
@ -329,16 +330,16 @@ gnc_option_db_save_to_kvp(GNCOptionDB* odb, kvp_frame *slots)
}
if (kvp_option_path == SCM_UNDEFINED) {
kvp_option_path = gh_eval_str("gnc:*kvp-option-path*");
kvp_option_path = scm_c_eval_string("gnc:*kvp-option-path*");
if (kvp_option_path == SCM_UNDEFINED) {
PERR ("can't find the option path");
return;
}
}
scm_slots = gw_wcp_assimilate_ptr (slots, gh_eval_str("<gnc:kvp-frame*>"));
scm_slots = gw_wcp_assimilate_ptr (slots, scm_c_eval_string("<gnc:kvp-frame*>"));
gh_call3 (scm_to_kvp, odb->guile_options, scm_slots, kvp_option_path);
scm_call_3 (scm_to_kvp, odb->guile_options, scm_slots, kvp_option_path);
}
/********************************************************************\
@ -446,20 +447,20 @@ gnc_option_db_register_change_callback(GNCOptionDB *odb,
return SCM_UNDEFINED;
/* Get the register procedure */
register_proc = gh_eval_str("gnc:options-register-c-callback");
if (!gh_procedure_p(register_proc))
register_proc = scm_c_eval_string("gnc:options-register-c-callback");
if (!SCM_PROCEDUREP(register_proc))
{
PERR("not a procedure\n");
return SCM_UNDEFINED;
}
if(void_type == SCM_UNDEFINED) {
void_type = gh_eval_str("<gw:void*>");
void_type = scm_c_eval_string("<gw:void*>");
/* don't really need this - types are bound globally anyway. */
if(void_type != SCM_UNDEFINED) scm_protect_object(void_type);
}
if(callback_type == SCM_UNDEFINED) {
callback_type = gh_eval_str("<gnc:OptionChangeCallback>");
callback_type = scm_c_eval_string("<gnc:OptionChangeCallback>");
/* don't really need this - types are bound globally anyway. */
if(callback_type != SCM_UNDEFINED)
scm_protect_object(callback_type);
@ -469,15 +470,15 @@ gnc_option_db_register_change_callback(GNCOptionDB *odb,
args = SCM_EOL;
/* first the guile options database */
args = gh_cons(odb->guile_options, args);
args = scm_cons(odb->guile_options, args);
/* next the data */
arg = gw_wcp_assimilate_ptr(data, void_type);
args = gh_cons(arg, args);
args = scm_cons(arg, args);
/* next the callback */
arg = gw_wcp_assimilate_ptr(callback, callback_type);
args = gh_cons(arg, args);
args = scm_cons(arg, args);
/* next the name */
if (name == NULL)
@ -486,10 +487,9 @@ gnc_option_db_register_change_callback(GNCOptionDB *odb,
}
else
{
/* FIXME: when we drop support older guiles, drop the (char *) coercion. */
arg = gh_str02scm((char *) name);
arg = scm_makfrom0str(name);
}
args = gh_cons(arg, args);
args = scm_cons(arg, args);
/* next the section */
if (section == NULL)
@ -498,13 +498,12 @@ gnc_option_db_register_change_callback(GNCOptionDB *odb,
}
else
{
/* FIXME: when we drop support older guiles, drop the (char *) coercion. */
arg = gh_str02scm((char *) section);
arg = scm_makfrom0str(section);
}
args = gh_cons(arg, args);
args = scm_cons(arg, args);
/* now apply the procedure */
return gh_apply(register_proc, args);
return scm_apply(register_proc, args, SCM_EOL);
}
@ -524,14 +523,14 @@ gnc_option_db_unregister_change_callback_id(GNCOptionDB *odb, SCM callback_id)
if (callback_id == SCM_UNDEFINED)
return;
proc = gh_eval_str("gnc:options-unregister-callback-id");
if (!gh_procedure_p(proc))
proc = scm_c_eval_string("gnc:options-unregister-callback-id");
if (!SCM_PROCEDUREP(proc))
{
PERR("not a procedure\n");
return;
}
gh_call2(proc, callback_id, odb->guile_options);
scm_call_2(proc, callback_id, odb->guile_options);
}
void
@ -545,14 +544,14 @@ gnc_call_option_change_callbacks(GNCOptionDB *odb)
{
SCM proc;
proc = gh_eval_str("gnc:options-run-callbacks");
if (!gh_procedure_p(proc))
proc = scm_c_eval_string("gnc:options-run-callbacks");
if (!SCM_PROCEDUREP(proc))
{
PERR("not a procedure\n");
return;
}
gh_call1(proc, odb->guile_options);
scm_call_1(proc, odb->guile_options);
}
@ -564,34 +563,34 @@ initialize_getters(void)
if (getters_initialized)
return;
getters.section = gh_eval_str("gnc:option-section");
getters.name = gh_eval_str("gnc:option-name");
getters.type = gh_eval_str("gnc:option-type");
getters.sort_tag = gh_eval_str("gnc:option-sort-tag");
getters.section = scm_c_eval_string("gnc:option-section");
getters.name = scm_c_eval_string("gnc:option-name");
getters.type = scm_c_eval_string("gnc:option-type");
getters.sort_tag = scm_c_eval_string("gnc:option-sort-tag");
getters.documentation =
gh_eval_str("gnc:option-documentation");
getters.getter = gh_eval_str("gnc:option-getter");
getters.setter = gh_eval_str("gnc:option-setter");
scm_c_eval_string("gnc:option-documentation");
getters.getter = scm_c_eval_string("gnc:option-getter");
getters.setter = scm_c_eval_string("gnc:option-setter");
getters.default_getter =
gh_eval_str("gnc:option-default-getter");
scm_c_eval_string("gnc:option-default-getter");
getters.value_validator =
gh_eval_str("gnc:option-value-validator");
getters.option_data = gh_eval_str("gnc:option-data");
getters.index_to_name = gh_eval_str("gnc:option-index-get-name");
scm_c_eval_string("gnc:option-value-validator");
getters.option_data = scm_c_eval_string("gnc:option-data");
getters.index_to_name = scm_c_eval_string("gnc:option-index-get-name");
getters.index_to_description =
gh_eval_str("gnc:option-index-get-description");
getters.number_of_indices = gh_eval_str("gnc:option-number-of-indices");
getters.index_to_value = gh_eval_str("gnc:option-index-get-value");
getters.value_to_index = gh_eval_str("gnc:option-value-get-index");
scm_c_eval_string("gnc:option-index-get-description");
getters.number_of_indices = scm_c_eval_string("gnc:option-number-of-indices");
getters.index_to_value = scm_c_eval_string("gnc:option-index-get-value");
getters.value_to_index = scm_c_eval_string("gnc:option-value-get-index");
getters.option_widget_changed_cb =
gh_eval_str("gnc:option-widget-changed-proc");
getters.date_option_subtype = gh_eval_str("gnc:date-option-get-subtype");
getters.date_option_show_time = gh_eval_str("gnc:date-option-show-time?");
getters.date_option_value_type = gh_eval_str ("gnc:date-option-value-type");
scm_c_eval_string("gnc:option-widget-changed-proc");
getters.date_option_subtype = scm_c_eval_string("gnc:date-option-get-subtype");
getters.date_option_show_time = scm_c_eval_string("gnc:date-option-show-time?");
getters.date_option_value_type = scm_c_eval_string ("gnc:date-option-value-type");
getters.date_option_value_absolute =
gh_eval_str("gnc:date-option-absolute-time");
scm_c_eval_string("gnc:date-option-absolute-time");
getters.date_option_value_relative =
gh_eval_str("gnc:date-option-relative-time");
scm_c_eval_string("gnc:date-option-relative-time");
getters_initialized = TRUE;
}
@ -687,7 +686,7 @@ gnc_option_documentation(GNCOption *option)
/********************************************************************\
* gnc_option_getter *
* returns the SCM handle for the option getter function. *
* This value should be tested with gh_procedure_p before use. *
* This value should be tested with scm_procedure_p before use. *
* *
* Args: option - the GNCOption *
* Returns: SCM handle to function *
@ -705,7 +704,7 @@ gnc_option_getter(GNCOption *option)
/********************************************************************\
* gnc_option_setter *
* returns the SCM handle for the option setter function. *
* This value should be tested with gh_procedure_p before use. *
* This value should be tested with scm_procedure_p before use. *
* *
* Args: option - the GNCOption *
* Returns: SCM handle to function *
@ -723,7 +722,7 @@ gnc_option_setter(GNCOption *option)
/********************************************************************\
* gnc_option_default_getter *
* returns the SCM handle for the option default_getter function. *
* This value should be tested with gh_procedure_p before use. *
* This value should be tested with scm_procedure_p before use. *
* *
* Args: option - the GNCOption *
* Returns: SCM handle to function *
@ -741,7 +740,7 @@ gnc_option_default_getter(GNCOption *option)
/********************************************************************\
* gnc_option_value_validator *
* returns the SCM handle for the option value validator function.*
* This value should be tested with gh_procedure_p before use. *
* This value should be tested with scm_procedure_p before use. *
* *
* Args: option - the GNCOption *
* Returns: SCM handle to function *
@ -760,7 +759,7 @@ gnc_option_value_validator(GNCOption *option)
* gnc_option_widget_changed_proc_getter *
* returns the SCM handle for the function to be called if the *
* GUI widget representing the option is changed. *
* This value should be tested with gh_procedure_p before use. *
* This value should be tested with scm_procedure_p before use. *
* If no such function exists, returns SCM_UNDEFINED. *
* *
* Args: option - the GNCOption *
@ -774,12 +773,12 @@ gnc_option_widget_changed_proc_getter(GNCOption *option)
initialize_getters();
if( gh_procedure_p( getters.option_widget_changed_cb ) )
if( SCM_PROCEDUREP( getters.option_widget_changed_cb ) )
{
/* call the callback function getter to get the actual callback function */
cb = gh_call1(getters.option_widget_changed_cb, option->guile_option);
cb = scm_call_1(getters.option_widget_changed_cb, option->guile_option);
if( gh_procedure_p( cb ) ) /* a callback exists */
if( SCM_PROCEDUREP( cb ) ) /* a callback exists */
{
return( cb );
}
@ -816,7 +815,7 @@ gnc_option_call_option_widget_changed_proc(GNCOption *option)
if( value != SCM_UNDEFINED )
{
gh_call1(cb, value);
scm_call_1(cb, value);
}
}
}
@ -837,11 +836,11 @@ gnc_option_num_permissible_values(GNCOption *option)
initialize_getters();
value = gh_call1(getters.number_of_indices, option->guile_option);
value = scm_call_1(getters.number_of_indices, option->guile_option);
if(gh_exact_p(value))
if(SCM_EXACTP(value))
{
return gh_scm2int(value);
return scm_num2int(value, SCM_ARG1, __FUNCTION__);
}
else
{
@ -863,14 +862,14 @@ int
gnc_option_permissible_value_index(GNCOption *option, SCM search_value)
{
SCM value;
value = gh_call2(getters.value_to_index, option->guile_option, search_value);
value = scm_call_2(getters.value_to_index, option->guile_option, search_value);
if (value == SCM_BOOL_F)
{
return -1;
}
else
{
return gh_scm2int(value);
return scm_num2int(value, SCM_ARG1, __FUNCTION__);
}
}
@ -895,8 +894,8 @@ gnc_option_permissible_value(GNCOption *option, int index)
initialize_getters();
value = gh_call2(getters.index_to_value, option->guile_option,
gh_int2scm(index));
value = scm_call_2(getters.index_to_value, option->guile_option,
scm_int2num(index));
return value;
}
@ -922,8 +921,8 @@ gnc_option_permissible_value_name(GNCOption *option, int index)
initialize_getters();
name = gh_call2(getters.index_to_name, option->guile_option,
gh_int2scm(index));
name = scm_call_2(getters.index_to_name, option->guile_option,
scm_int2num(index));
if (name == SCM_UNDEFINED)
return NULL;
@ -951,8 +950,8 @@ gnc_option_permissible_value_description(GNCOption *option, int index)
initialize_getters();
help = gh_call2(getters.index_to_description, option->guile_option,
gh_int2scm(index));
help = scm_call_2(getters.index_to_description, option->guile_option,
scm_int2num(index));
if (help == SCM_UNDEFINED)
return NULL;
@ -975,9 +974,9 @@ gnc_option_show_time(GNCOption *option)
initialize_getters();
value = gh_call1(getters.date_option_show_time, option->guile_option);
value = scm_call_1(getters.date_option_show_time, option->guile_option);
return gh_scm2bool(value);
return SCM_NFALSEP(value);
}
/********************************************************************\
@ -992,7 +991,7 @@ gnc_option_get_option_data(GNCOption *option)
{
initialize_getters();
return gh_call1(getters.option_data, option->guile_option);
return scm_call_1(getters.option_data, option->guile_option);
}
@ -1011,9 +1010,9 @@ gnc_option_multiple_selection(GNCOption *option)
initialize_getters();
pair = gh_call1(getters.option_data, option->guile_option);
pair = scm_call_1(getters.option_data, option->guile_option);
return !gh_scm2bool(gh_not(gh_car(pair)));
return !SCM_NFALSEP(scm_not(SCM_CAR(pair)));
}
/********************************************************************\
@ -1035,29 +1034,29 @@ gnc_option_get_account_type_list(GNCOption *option)
initialize_getters();
pair = gh_call1(getters.option_data, option->guile_option);
lst = gh_cdr(pair);
pair = scm_call_1(getters.option_data, option->guile_option);
lst = SCM_CDR(pair);
conv_func = gh_eval_str ("gw:enum-<gnc:AccountType>-val->int");
if (!gh_procedure_p (conv_func)) {
conv_func = scm_c_eval_string ("gw:enum-<gnc:AccountType>-val->int");
if (!SCM_PROCEDUREP (conv_func)) {
PERR ("Cannot obtain conv_func");
return NULL;
}
while (!gh_null_p (lst)) {
while (!SCM_NULLP (lst)) {
GNCAccountType type;
SCM item;
/* Compute this item and the rest of the list */
item = gh_car (lst);
lst = gh_cdr (lst);
item = SCM_CAR (lst);
lst = SCM_CDR (lst);
item = gh_call1(conv_func, item);
item = scm_call_1(conv_func, item);
if (SCM_FALSEP (scm_integer_p (item))) {
PERR ("Invalid type");
} else {
type = gh_scm2long (item);
type = scm_num2long (item, SCM_ARG1, __FUNCTION__);
type_list = g_list_prepend (type_list, GINT_TO_POINTER (type));
}
}
@ -1086,64 +1085,59 @@ gboolean gnc_option_get_range_info(GNCOption *option,
initialize_getters();
list = gh_call1(getters.option_data, option->guile_option);
list = scm_call_1(getters.option_data, option->guile_option);
if (!gh_list_p(list) || gh_null_p(list))
if (!SCM_LISTP(list) || SCM_NULLP(list))
return FALSE;
/* lower bound */
value = gh_car(list);
list = gh_cdr(list);
value = SCM_CAR(list);
list = SCM_CDR(list);
if (!gh_number_p(value))
if (!SCM_NUMBERP(value))
return FALSE;
if (lower_bound != NULL)
*lower_bound = gh_scm2double(value);
*lower_bound = scm_num2dbl(value, __FUNCTION__);
if (!gh_list_p(list) || gh_null_p(list))
if (!SCM_LISTP(list) || SCM_NULLP(list))
return FALSE;
/* upper bound */
value = gh_car(list);
list = gh_cdr(list);
value = SCM_CAR(list);
list = SCM_CDR(list);
if (!gh_number_p(value))
if (!SCM_NUMBERP(value))
return FALSE;
if (upper_bound != NULL)
*upper_bound = gh_scm2double(value);
*upper_bound = scm_num2dbl(value, __FUNCTION__);
if (!gh_list_p(list) || gh_null_p(list))
if (!SCM_LISTP(list) || SCM_NULLP(list))
return FALSE;
/* number of decimals */
value = gh_car(list);
list = gh_cdr(list);
value = SCM_CAR(list);
list = SCM_CDR(list);
if (!gh_number_p(value))
if (!SCM_NUMBERP(value))
return FALSE;
/* Guile-1.6 returns this as a double, so let's use that in all cases.
* This is still safe for earlier guiles, too -- tested with 1.3.4.
*/
if (num_decimals != NULL) {
double decimals = gh_scm2double(value);
*num_decimals = (int)decimals;
}
if (num_decimals != NULL)
*num_decimals = scm_num2int(value, SCM_ARG1, __FUNCTION__);
if (!gh_list_p(list) || gh_null_p(list))
if (!SCM_LISTP(list) || SCM_NULLP(list))
return FALSE;
/* step size */
value = gh_car(list);
list = gh_cdr(list);
value = SCM_CAR(list);
list = SCM_CDR(list);
if (!gh_number_p(value))
if (!SCM_NUMBERP(value))
return FALSE;
if (step_size != NULL)
*step_size = gh_scm2double(value);
*step_size = scm_num2dbl(value, __FUNCTION__);
return TRUE;
}
@ -1165,15 +1159,15 @@ gnc_option_color_range(GNCOption *option)
initialize_getters();
list = gh_call1(getters.option_data, option->guile_option);
if (!gh_list_p(list) || gh_null_p(list))
list = scm_call_1(getters.option_data, option->guile_option);
if (!SCM_LISTP(list) || SCM_NULLP(list))
return 0.0;
value = gh_car(list);
if (!gh_number_p(value))
value = SCM_CAR(list);
if (!SCM_NUMBERP(value))
return 0.0;
return gh_scm2double(value);
return scm_num2dbl(value, __FUNCTION__);
}
@ -1193,19 +1187,19 @@ gnc_option_use_alpha(GNCOption *option)
initialize_getters();
list = gh_call1(getters.option_data, option->guile_option);
if (!gh_list_p(list) || gh_null_p(list))
list = scm_call_1(getters.option_data, option->guile_option);
if (!SCM_LISTP(list) || SCM_NULLP(list))
return FALSE;
list = gh_cdr(list);
if (!gh_list_p(list) || gh_null_p(list))
list = SCM_CDR(list);
if (!SCM_LISTP(list) || SCM_NULLP(list))
return FALSE;
value = gh_car(list);
if (!gh_boolean_p(value))
value = SCM_CAR(list);
if (!SCM_BOOLP(value))
return FALSE;
return gh_scm2bool(value);
return SCM_NFALSEP(value);
}
@ -1276,8 +1270,8 @@ gnc_option_get_color_info(GNCOption *option,
if (getter == SCM_UNDEFINED)
return FALSE;
value = gh_call0(getter);
if (!gh_list_p(value) || gh_null_p(value) || !gh_number_p(gh_car(value)))
value = scm_call_0(getter);
if (!SCM_LISTP(value) || SCM_NULLP(value) || !SCM_NUMBERP(SCM_CAR(value)))
return FALSE;
scale = gnc_option_color_range(option);
@ -1286,31 +1280,31 @@ gnc_option_get_color_info(GNCOption *option,
scale = 1.0 / scale;
rgba = gh_scm2double(gh_car(value));
rgba = scm_num2dbl(SCM_CAR(value), __FUNCTION__);
if (red != NULL)
*red = MIN(1.0, rgba * scale);
value = gh_cdr(value);
if (!gh_list_p(value) || gh_null_p(value) || !gh_number_p(gh_car(value)))
value = SCM_CDR(value);
if (!SCM_LISTP(value) || SCM_NULLP(value) || !SCM_NUMBERP(SCM_CAR(value)))
return FALSE;
rgba = gh_scm2double(gh_car(value));
rgba = scm_num2dbl(SCM_CAR(value), __FUNCTION__);
if (green != NULL)
*green = MIN(1.0, rgba * scale);
value = gh_cdr(value);
if (!gh_list_p(value) || gh_null_p(value) || !gh_number_p(gh_car(value)))
value = SCM_CDR(value);
if (!SCM_LISTP(value) || SCM_NULLP(value) || !SCM_NUMBERP(SCM_CAR(value)))
return FALSE;
rgba = gh_scm2double(gh_car(value));
rgba = scm_num2dbl(SCM_CAR(value), __FUNCTION__);
if (blue != NULL)
*blue = MIN(1.0, rgba * scale);
value = gh_cdr(value);
if (!gh_list_p(value) || gh_null_p(value) || !gh_number_p(gh_car(value)))
value = SCM_CDR(value);
if (!SCM_LISTP(value) || SCM_NULLP(value) || !SCM_NUMBERP(SCM_CAR(value)))
return FALSE;
rgba = gh_scm2double(gh_car(value));
rgba = scm_num2dbl(SCM_CAR(value), __FUNCTION__);
if (alpha != NULL)
*alpha = MIN(1.0, rgba * scale);
@ -1339,13 +1333,13 @@ gnc_option_set_default(GNCOption *option)
if (default_getter == SCM_UNDEFINED)
return;
value = gh_call0(default_getter);
value = scm_call_0(default_getter);
setter = gnc_option_setter(option);
if (setter == SCM_UNDEFINED)
return;
gh_call1(setter, value);
scm_call_1(setter, value);
}
@ -1658,22 +1652,22 @@ gnc_option_valid_value(GNCOption *option, SCM value)
validator = gnc_option_value_validator(option);
result = gh_call1(validator, value);
if (!gh_list_p(result) || gh_null_p(result))
result = scm_call_1(validator, value);
if (!SCM_LISTP(result) || SCM_NULLP(result))
return SCM_UNDEFINED;
ok = gh_car(result);
if (!gh_boolean_p(ok))
ok = SCM_CAR(result);
if (!SCM_BOOLP(ok))
return SCM_UNDEFINED;
if (!gh_scm2bool(ok))
if (!SCM_NFALSEP(ok))
return SCM_UNDEFINED;
result = gh_cdr(result);
if (!gh_list_p(result) || gh_null_p(result))
result = SCM_CDR(result);
if (!SCM_LISTP(result) || SCM_NULLP(result))
return SCM_UNDEFINED;
return gh_car(result);
return SCM_CAR(result);
}
@ -1690,28 +1684,28 @@ gnc_commit_option(GNCOption *option)
validator = gnc_option_value_validator(option);
result = gh_call1(validator, value);
if (!gh_list_p(result) || gh_null_p(result))
result = scm_call_1(validator, value);
if (!SCM_LISTP(result) || SCM_NULLP(result))
{
PERR("bad validation result\n");
return;
}
/* First element determines validity */
ok = gh_car(result);
if (!gh_boolean_p(ok))
ok = SCM_CAR(result);
if (!SCM_BOOLP(ok))
{
PERR("bad validation result\n");
return;
}
if (gh_scm2bool(ok))
if (SCM_NFALSEP(ok))
{
/* Second element is value to use */
value = gh_cadr(result);
value = SCM_CADR(result);
setter = gnc_option_setter(option);
gh_call1(setter, value);
scm_call_1(setter, value);
gnc_option_set_ui_value (option, FALSE);
}
@ -1721,8 +1715,8 @@ gnc_commit_option(GNCOption *option)
char *section, *name, *message;
/* Second element is error message */
oops = gh_cadr(result);
if (!gh_string_p(oops))
oops = SCM_CADR(result);
if (!SCM_STRINGP(oops))
{
PERR("bad validation result\n");
return;
@ -1907,12 +1901,12 @@ gnc_option_db_get_default_section(GNCOptionDB *odb)
if (odb == NULL)
return NULL;
getter = gh_eval_str("gnc:options-get-default-section");
if (!gh_procedure_p(getter))
getter = scm_c_eval_string("gnc:options-get-default-section");
if (!SCM_PROCEDUREP(getter))
return NULL;
value = gh_call1(getter, odb->guile_options);
if (!gh_string_p(value))
value = scm_call_1(getter, odb->guile_options);
if (!SCM_STRINGP(value))
return NULL;
return gh_scm2newstr(value, NULL);
@ -1948,7 +1942,7 @@ gnc_option_db_lookup_option(GNCOptionDB *odb,
if (getter == SCM_UNDEFINED)
return default_value;
return gh_call0(getter);
return scm_call_0(getter);
}
/********************************************************************\
@ -1981,10 +1975,10 @@ gnc_option_db_lookup_boolean_option(GNCOptionDB *odb,
if (getter == SCM_UNDEFINED)
return default_value;
value = gh_call0(getter);
value = scm_call_0(getter);
if (gh_boolean_p(value))
return gh_scm2bool(value);
if (SCM_BOOLP(value))
return SCM_NFALSEP(value);
else
return default_value;
}
@ -2019,8 +2013,8 @@ gnc_option_db_lookup_string_option(GNCOptionDB *odb,
getter = gnc_option_getter(option);
if (getter != SCM_UNDEFINED)
{
value = gh_call0(getter);
if (gh_string_p(value))
value = scm_call_0(getter);
if (SCM_STRINGP(value))
return gh_scm2newstr(value, NULL);
}
}
@ -2084,8 +2078,8 @@ gnc_option_db_lookup_multichoice_option(GNCOptionDB *odb,
getter = gnc_option_getter(option);
if (getter != SCM_UNDEFINED)
{
value = gh_call0(getter);
if (gh_symbol_p(value))
value = scm_call_0(getter);
if (SCM_SYMBOLP(value))
return gh_symbol2newstr(value, NULL);
}
}
@ -2157,9 +2151,9 @@ gnc_option_db_lookup_date_option(GNCOptionDB *odb,
getter = gnc_option_getter(option);
if (getter != SCM_UNDEFINED)
{
value = gh_call0(getter);
value = scm_call_0(getter);
if (gh_pair_p(value))
if (SCM_CONSP(value))
{
Timespec absolute;
@ -2228,9 +2222,9 @@ gnc_option_db_lookup_number_option(GNCOptionDB *odb,
getter = gnc_option_getter(option);
if (getter != SCM_UNDEFINED)
{
value = gh_call0(getter);
if (gh_number_p(value))
return gh_scm2double(value);
value = scm_call_0(getter);
if (SCM_NUMBERP(value))
return scm_num2dbl(value, __FUNCTION__);
}
}
@ -2325,13 +2319,13 @@ gnc_option_db_lookup_list_option(GNCOptionDB *odb,
if (getter == SCM_UNDEFINED)
return default_value;
value = gh_call0(getter);
while (gh_list_p(value) && !gh_null_p(value))
value = scm_call_0(getter);
while (SCM_LISTP(value) && !SCM_NULLP(value))
{
item = gh_car(value);
value = gh_cdr(value);
item = SCM_CAR(value);
value = SCM_CDR(value);
if (!gh_symbol_p(item))
if (!SCM_SYMBOLP(item))
{
gnc_free_list_option_value(list);
@ -2341,7 +2335,7 @@ gnc_option_db_lookup_list_option(GNCOptionDB *odb,
list = g_slist_prepend(list, gh_symbol2newstr(item, NULL));
}
if (!gh_list_p(value) || !gh_null_p(value))
if (!SCM_LISTP(value) || !SCM_NULLP(value))
{
gnc_free_list_option_value(list);
@ -2381,7 +2375,7 @@ gnc_option_db_lookup_currency_option(GNCOptionDB *odb,
if (getter == SCM_UNDEFINED)
return default_value;
value = gh_call0(getter);
value = scm_call_0(getter);
return gnc_scm_to_commodity (value);
}
@ -2454,7 +2448,7 @@ gnc_option_db_set_option(GNCOptionDB *odb,
if (setter == SCM_UNDEFINED)
return FALSE;
gh_call1(setter, value);
scm_call_1(setter, value);
return TRUE;
}
@ -2485,7 +2479,7 @@ gnc_option_db_set_number_option(GNCOptionDB *odb,
if (option == NULL)
return FALSE;
scm_value = gh_double2scm(value);
scm_value = scm_make_real(value);
scm_value = gnc_option_valid_value(option, scm_value);
if (scm_value == SCM_UNDEFINED)
@ -2495,7 +2489,7 @@ gnc_option_db_set_number_option(GNCOptionDB *odb,
if (setter == SCM_UNDEFINED)
return FALSE;
gh_call1(setter, scm_value);
scm_call_1(setter, scm_value);
return TRUE;
}
@ -2525,7 +2519,7 @@ gnc_option_db_set_boolean_option(GNCOptionDB *odb,
if (option == NULL)
return FALSE;
scm_value = gh_bool2scm(value);
scm_value = SCM_BOOL(value);
scm_value = gnc_option_valid_value(option, scm_value);
if (scm_value == SCM_UNDEFINED)
@ -2535,7 +2529,7 @@ gnc_option_db_set_boolean_option(GNCOptionDB *odb,
if (setter == SCM_UNDEFINED)
return FALSE;
gh_call1(setter, scm_value);
scm_call_1(setter, scm_value);
return TRUE;
}
@ -2566,7 +2560,7 @@ gnc_option_db_set_string_option(GNCOptionDB *odb,
return FALSE;
if (value)
scm_value = gh_str2scm((char*)value, strlen(value));
scm_value = scm_mem2string(value, strlen(value));
else
scm_value = SCM_BOOL_F;
@ -2578,7 +2572,7 @@ gnc_option_db_set_string_option(GNCOptionDB *odb,
if (setter == SCM_UNDEFINED)
return FALSE;
gh_call1(setter, scm_value);
scm_call_1(setter, scm_value);
return TRUE;
}
@ -2597,9 +2591,9 @@ gnc_option_date_option_get_subtype(GNCOption *option)
initialize_getters();
value = gh_call1(getters.date_option_subtype, option->guile_option);
value = scm_call_1(getters.date_option_subtype, option->guile_option);
if (gh_symbol_p(value))
if (SCM_SYMBOLP(value))
return gh_symbol2newstr(value, NULL);
else
return NULL;
@ -2619,8 +2613,8 @@ gnc_date_option_value_get_type (SCM option_value)
initialize_getters();
value = gh_call1 (getters.date_option_value_type, option_value);
if (!gh_symbol_p (value))
value = scm_call_1 (getters.date_option_value_type, option_value);
if (!SCM_SYMBOLP (value))
return NULL;
return gh_symbol2newstr (value, NULL);
@ -2640,7 +2634,7 @@ gnc_date_option_value_get_absolute (SCM option_value)
initialize_getters();
value = gh_call1 (getters.date_option_value_absolute, option_value);
value = scm_call_1 (getters.date_option_value_absolute, option_value);
return gnc_timepair2timespec (value);
}
@ -2657,7 +2651,7 @@ gnc_date_option_value_get_relative (SCM option_value)
{
initialize_getters();
return gh_call1 (getters.date_option_value_relative, option_value);
return scm_call_1 (getters.date_option_value_relative, option_value);
}
/*******************************************************************\

View File

@ -24,8 +24,9 @@
#ifndef OPTION_UTIL_H
#define OPTION_UTIL_H
#include <guile/gh.h>
#include <glib.h>
#include <libguile.h>
#include "guile-mappings.h"
#include "gnc-commodity.h"
#include "kvp_frame.h"

View File

@ -1,15 +1,15 @@
#include "config.h"
#include <glib.h>
#include <stdlib.h>
#include <stdio.h>
#include "guile/gh.h"
#include <libguile.h>
#include "guile-mappings.h"
#include "gnc-exp-parser.h"
#include "gnc-numeric.h"
#include "test-stuff.h"
void real_main (int argc, char **argv);
static GList *tests = NULL;
typedef struct
@ -151,7 +151,7 @@ test_parser (void)
"- 42.72 + 13.32 + 15.48 + 23.4 + 115.4",
gnc_numeric_create(35897, 100) );
gh_eval_str( "(define (gnc:plus a b) (+ a b))" );
scm_c_eval_string( "(define (gnc:plus a b) (+ a b))" );
add_pass_test( "plus( 1 : 2 ) + 3", NULL, gnc_numeric_create( 6, 1 ) );
add_pass_test( "plus( 1 : 2 ) * 3", NULL, gnc_numeric_create( 9, 1 ) );
add_pass_test( "plus( 1 + 2 : 3 ) * 5", NULL, gnc_numeric_create( 30, 1 ) );
@ -160,7 +160,7 @@ test_parser (void)
add_pass_test( "plus( plus( 1 : 2 ) : 3 )", NULL, gnc_numeric_create( 6, 1 ) );
add_pass_test( "plus( 4 : plus( plus( 1 : 2 ) : 3))", NULL, gnc_numeric_create( 10, 1 ) );
gh_eval_str( "(define (gnc:sub a b) (- a b))" );
scm_c_eval_string( "(define (gnc:sub a b) (- a b))" );
add_pass_test( "sub( 1 : 2 ) + 4", NULL, gnc_numeric_create( 3, 1 ) );
add_pass_test( "sub( (1 + 2 * 3) : 4 ) + 5",
@ -170,18 +170,18 @@ test_parser (void)
add_pass_test( "sub( a = 42 : sub( plus( 1 : 2 ) : 6 * 7 )) + a",
NULL, gnc_numeric_create( 123, 1 ) );
gh_eval_str( "(define (gnc:test_str str b)"
" (+ b (cond ((equal? str \"one\") 1)"
" ((equal? str \"two\") 2)"
" ((equal? str \"three\") 3)"
" (0))))" );
scm_c_eval_string( "(define (gnc:test_str str b)"
" (+ b (cond ((equal? str \"one\") 1)"
" ((equal? str \"two\") 2)"
" ((equal? str \"three\") 3)"
" (0))))" );
add_pass_test( "test_str( \"one\" : 1 )", NULL, gnc_numeric_create( 2, 1 ) );
add_pass_test( "test_str( \"two\" : 2 )", NULL, gnc_numeric_create( 4, 1 ) );
add_fail_test( "test_str( 3 : \"three\" )", NULL, 0 );
add_pass_test( "test_str( \"asdf\" : 1 )", NULL, gnc_numeric_create( 1, 1 ) );
add_fail_test( "\"asdf\" + 0", NULL, 0 );
gh_eval_str( "(define (gnc:blindreturn val) val)" );
scm_c_eval_string( "(define (gnc:blindreturn val) val)" );
add_pass_test( "blindreturn( 123.1 )", NULL, gnc_numeric_create( 1231, 10 ) );
add_pass_test( "blindreturn( 123.01 )", NULL, gnc_numeric_create( 12301, 100 ) );
add_pass_test( "blindreturn( 123.001 )", NULL, gnc_numeric_create( 123001, 1000 ) );
@ -192,8 +192,8 @@ test_parser (void)
success ("shutdown expression parser");
}
void
real_main (int argc, char **argv)
static void
real_main (void *closure, int argc, char **argv)
{
/* set_should_print_success (TRUE); */
test_parser();
@ -201,9 +201,9 @@ real_main (int argc, char **argv)
exit(get_rv());
}
int main( int argc, char **argv )
int main ( int argc, char **argv )
{
/* do things this way so we can test scheme function calls from expressions */
gh_enter( argc, argv, real_main );
scm_boot_guile( argc, argv, real_main, NULL );
return 0;
}

View File

@ -1,6 +1,7 @@
#include <glib.h>
#include <guile/gh.h>
#include <libguile.h>
#include "guile-mappings.h"
#include "engine-helpers.h"
#include "gnc-module.h"
@ -18,10 +19,10 @@ test_query (Query *q, SCM val2str)
SCM args = SCM_EOL;
scm_q = gnc_query2scm (q);
args = gh_cons (scm_q, SCM_EOL);
str_q = gh_apply (val2str, args);
args = scm_cons (scm_q, SCM_EOL);
str_q = scm_apply (val2str, args, SCM_EOL);
args = gh_cons (gh_str02scm ("'"), gh_cons (str_q, SCM_EOL));
args = scm_cons (scm_makfrom0str ("'"), scm_cons (str_q, SCM_EOL));
str_q = scm_string_append (args);
gh_display (str_q); gh_newline (); gh_newline ();
@ -34,8 +35,8 @@ run_tests (int count)
SCM val2str;
int i;
val2str = gh_eval_str ("gnc:value->string");
g_return_if_fail (gh_procedure_p (val2str));
val2str = scm_c_eval_string ("gnc:value->string");
g_return_if_fail (SCM_PROCEDUREP (val2str));
for (i = 0; i < count; i++) {
q = get_random_query ();
@ -46,7 +47,7 @@ run_tests (int count)
}
static void
main_helper (int argc, char **argv)
main_helper (void *closure, int argc, char **argv)
{
int count = 50;
@ -74,6 +75,6 @@ main_helper (int argc, char **argv)
int
main (int argc, char **argv)
{
gh_enter (argc, argv, main_helper);
scm_boot_guile (argc, argv, main_helper, NULL);
return 0;
}

View File

@ -1,6 +1,7 @@
#include <glib.h>
#include <guile/gh.h>
#include <libguile.h>
#include "guile-mappings.h"
#include "engine-helpers.h"
#include "gnc-module.h"
@ -21,16 +22,16 @@ test_query (Query *q, SCM val2str)
char * str;
scm_q = gnc_query2scm (q);
args = gh_cons (scm_q, SCM_EOL);
str_q = gh_apply (val2str, args);
args = scm_cons (scm_q, SCM_EOL);
str_q = scm_apply (val2str, args, SCM_EOL);
args = gh_cons (gh_str02scm ("'"), gh_cons (str_q, SCM_EOL));
args = scm_cons (scm_makfrom0str ("'"), scm_cons (str_q, SCM_EOL));
str_q = scm_string_append (args);
str = gh_scm2newstr (str_q, NULL);
if (str) {
res_q = gh_eval_str (str);
res_q = scm_c_eval_string (str);
} else {
res_q = SCM_BOOL_F;
}
@ -60,8 +61,8 @@ run_tests (void)
SCM val2str;
int i;
val2str = gh_eval_str ("gnc:value->string");
g_return_if_fail (gh_procedure_p (val2str));
val2str = scm_c_eval_string ("gnc:value->string");
g_return_if_fail (SCM_PROCEDUREP (val2str));
for (i = 0; i < 100; i++) {
q = get_random_query ();
@ -72,7 +73,7 @@ run_tests (void)
}
static void
main_helper (int argc, char **argv)
main_helper (void *closure, int argc, char **argv)
{
gnc_module_load("gnucash/engine", 0);
gnc_module_load("gnucash/app-utils", 0);
@ -95,6 +96,6 @@ main_helper (int argc, char **argv)
int
main (int argc, char **argv)
{
gh_enter (argc, argv, main_helper);
scm_boot_guile (argc, argv, main_helper, NULL);
return 0;
}

View File

@ -206,8 +206,8 @@ double_to_string(double value)
{
gchar *numstr;
#ifdef USE_GUILE_FOR_DOUBLE_CONVERSION
numstr = gh_scm2newstr(gh_call1(gh_eval_str("number->string"),
gh_double2scm(value)),
numstr = gh_scm2newstr(scm_call_1(scm_c_eval_string("number->string"),
scm_make_real(value)),
NULL);
#else /* don't USE_GUILE_FOR_DOUBLE_CONVERSION */

View File

@ -175,17 +175,17 @@ string_to_double(const char *str, double *result)
SCM conversion_result;
if(!ready) {
string_to_number = gh_eval_str("string->number");
string_to_number = scm_c_eval_string("string->number");
scm_protect_object(string_to_number);
ready = TRUE;
}
conversion_result = gh_call1(string_to_number, gh_str02scm(str));
conversion_result = scm_call_1(string_to_number, scm_makfrom0str(str));
if(!conversion_result == SCM_BOOL_F) {
return(FALSE);
}
*result = gh_scm2double(conversion_result);
*result = scm_num2dbl(conversion_result, __FUNCTION__);
}
#else /* don't USE_GUILE_FOR_DOUBLE_CONVERSION */

View File

@ -60,6 +60,7 @@ LDADD = ${top_builddir}/src/test-core/libgncmod-test.la \
./libgnc-test-file-stuff.la
AM_CFLAGS = \
-I${top_srcdir}/src \
-I${top_srcdir}/src/core-utils \
-I${top_srcdir}/src/gnc-module \
-I${top_srcdir}/src/test-core \

View File

@ -1,5 +1,5 @@
#include <glib.h>
#include <guile/gh.h>
#include <libguile.h>
#include <string.h>
#include <stdlib.h>
#include <stdio.h>
@ -42,7 +42,7 @@ test_load_file(GNCBook *book, const char *filename)
}
static void
guile_main(int argc, char **argv)
guile_main (void *closure, int argc, char **argv)
{
const char *location = getenv("GNC_ACCOUNT_PATH");
GSList *list = NULL;
@ -105,8 +105,8 @@ guile_main(int argc, char **argv)
}
int
main(int argc, char ** argv)
main (int argc, char ** argv)
{
gh_enter (argc, argv, guile_main);
scm_boot_guile (argc, argv, guile_main, NULL);
return 0;
}

View File

@ -1,5 +1,5 @@
#include <glib.h>
#include <guile/gh.h>
#include <libguile.h>
#include <stdlib.h>
#include <stdio.h>
#include <sys/types.h>
@ -73,7 +73,7 @@ test_load_file(const char *filename)
}
static void
guile_main(int argc, char **argv)
guile_main (void *closure, int argc, char **argv)
{
const char *location = getenv("GNC_TEST_FILES");
DIR *xml2_dir;
@ -126,11 +126,11 @@ guile_main(int argc, char **argv)
}
int
main(int argc, char ** argv)
main (int argc, char ** argv)
{
/* getchar (); */
gh_enter(argc, argv, guile_main);
scm_boot_guile(argc, argv, guile_main, NULL);
return 0;
}

View File

@ -1,7 +1,7 @@
#include "config.h"
#include <glib.h>
#include <guile/gh.h>
#include <libguile.h>
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
@ -356,7 +356,7 @@ test_real_account(const char *tag, gpointer global_data, gpointer data)
}
static void
guile_main(int argc, char **argv)
guile_main (void *closure, int argc, char **argv)
{
gnc_module_system_init();
gnc_module_load("gnucash/engine", 0);
@ -379,8 +379,8 @@ guile_main(int argc, char **argv)
}
int
main(int argc, char ** argv)
main (int argc, char ** argv)
{
gh_enter (argc, argv, guile_main);
scm_boot_guile (argc, argv, guile_main, NULL);
return 0;
}

View File

@ -1,7 +1,7 @@
#include "config.h"
#include <glib.h>
#include <guile/gh.h>
#include <libguile.h>
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
@ -223,7 +223,7 @@ test_real_commodity(const char *tag, gpointer globaldata, gpointer data)
}
static void
guile_main(int argc, char **argv)
guile_main (void *closure, int argc, char **argv)
{
gnc_module_system_init();
gnc_module_load("gnucash/engine", 0);
@ -246,8 +246,8 @@ guile_main(int argc, char **argv)
}
int
main(int argc, char ** argv)
main (int argc, char ** argv)
{
gh_enter (argc, argv, guile_main);
scm_boot_guile (argc, argv, guile_main, NULL);
return 0;
}

View File

@ -1,7 +1,7 @@
#include "config.h"
#include <glib.h>
#include <guile/gh.h>
#include <libguile.h>
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
@ -121,7 +121,7 @@ test_generation (void)
}
static void
guile_main(int argc, char **argv)
guile_main (void *closure, int argc, char **argv)
{
gnc_module_system_init();
gnc_module_load("gnucash/engine", 0);
@ -135,8 +135,8 @@ guile_main(int argc, char **argv)
}
int
main(int argc, char ** argv)
main (int argc, char ** argv)
{
gh_enter (argc, argv, guile_main);
scm_boot_guile (argc, argv, guile_main, NULL);
return 0;
}

View File

@ -1,7 +1,7 @@
#include "config.h"
#include <glib.h>
#include <guile/gh.h>
#include <libguile.h>
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
@ -459,7 +459,7 @@ test_real_transaction(const char *tag, gpointer global_data, gpointer data)
}
static void
guile_main(int argc, char **argv)
guile_main (void *closure, int argc, char **argv)
{
gnc_module_system_init();
gnc_module_load("gnucash/engine", 0);
@ -486,8 +486,8 @@ guile_main(int argc, char **argv)
}
int
main(int argc, char ** argv)
main (int argc, char ** argv)
{
gh_enter (argc, argv, guile_main);
scm_boot_guile (argc, argv, guile_main, NULL);
return 0;
}

View File

@ -1,5 +1,5 @@
#include <glib.h>
#include <guile/gh.h>
#include <libguile.h>
#include <libpq-fe.h>
#include <stdlib.h>
#include <stdio.h>
@ -1075,7 +1075,7 @@ test_performance(DbInfo *dbinfo)
#endif
static void
guile_main(int argc, char **argv)
guile_main (void *closure, int argc, char **argv)
{
DbInfo *dbinfo;
@ -1130,8 +1130,8 @@ guile_main(int argc, char **argv)
}
int
main(int argc, char **argv)
main (int argc, char **argv)
{
gh_enter(argc, argv, guile_main);
gh_enter(argc, argv, guile_main, NULL);
return 0;
}

View File

@ -5,9 +5,10 @@
* Copyright (c) 2001 Derek Atkins <warlord@MIT.EDU>
*********************************************************************/
#include "config.h"
#include <stdio.h>
#include <guile/gh.h>
#include <glib.h>
#include <libguile.h>
#include "gnc-module.h"
#include "gnc-module-api.h"
@ -75,8 +76,8 @@ libgncmod_business_core_LTX_gnc_module_init(int refcount)
gncVendorRegister ();
}
gh_eval_str("(use-modules (g-wrapped gw-business-core))");
gh_eval_str("(use-modules (gnucash business-core))");
scm_c_eval_string("(use-modules (g-wrapped gw-business-core))");
scm_c_eval_string("(use-modules (gnucash business-core))");
return TRUE;
}

View File

@ -3,6 +3,7 @@ SUBDIRS = .
pkglib_LTLIBRARIES = libgncmod-business-backend-file.la
AM_CFLAGS = \
-I${top_srcdir}/src \
-I${top_srcdir}/src/backend \
-I${top_srcdir}/src/backend/file \
-I${top_srcdir}/src/engine \

View File

@ -16,7 +16,7 @@ get_acct_type ()
static SCM account_type = SCM_UNDEFINED;
if(account_type == SCM_UNDEFINED) {
account_type = gh_eval_str("<gnc:Account*>");
account_type = scm_c_eval_string("<gnc:Account*>");
/* don't really need this - types are bound globally anyway. */
if(account_type != SCM_UNDEFINED) scm_protect_object(account_type);
}
@ -28,9 +28,9 @@ int gnc_account_value_pointer_p (SCM arg)
{
SCM account_type = get_acct_type();
return (gh_pair_p (arg) &&
gw_wcp_is_of_type_p(account_type, gh_car (arg)) &&
gnc_numeric_p (gh_cdr (arg)));
return (SCM_CONSP (arg) &&
gw_wcp_is_of_type_p(account_type, SCM_CAR (arg)) &&
gnc_numeric_p (SCM_CDR (arg)));
}
GncAccountValue * gnc_scm_to_account_value_ptr (SCM valuearg)
@ -42,14 +42,14 @@ GncAccountValue * gnc_scm_to_account_value_ptr (SCM valuearg)
SCM val;
/* Get the account */
val = gh_car (valuearg);
val = SCM_CAR (valuearg);
if (!gw_wcp_is_of_type_p (account_type, val))
return NULL;
acc = gw_wcp_get_ptr (val);
/* Get the value */
val = gh_cdr (valuearg);
val = SCM_CDR (valuearg);
value = gnc_scm_to_numeric (val);
/* Build and return the object */
@ -71,6 +71,6 @@ SCM gnc_account_value_ptr_to_scm (GncAccountValue *av)
val = gnc_numeric_convert (av->value, gnc_commodity_get_fraction (com),
GNC_RND_ROUND);
return gh_cons (gw_wcp_assimilate_ptr (av->account, account_type),
gnc_numeric_to_scm (val));
return scm_cons (gw_wcp_assimilate_ptr (av->account, account_type),
gnc_numeric_to_scm (val));
}

View File

@ -1,5 +1,6 @@
AM_CFLAGS = \
-I${top_srcdir}/src \
-I${top_srcdir}/src/gnc-module \
-I${top_srcdir}/src/test-core \
-I${top_srcdir}/src/engine \
@ -32,6 +33,7 @@ GNC_TEST_DEPS := \
--gnc-module-dir ${top_builddir}/src/business/business-core \
--gnc-module-dir ${top_srcdir}/src/gnc-module \
--gnc-module-dir ${top_srcdir}/src/engine \
--library-dir ${G_WRAP_LIB_DIR} \
--guile-load-dir ${G_WRAP_MODULE_DIR}
TESTS_ENVIRONMENT := \

View File

@ -1,5 +1,5 @@
#include <glib.h>
#include <guile/gh.h>
#include <libguile.h>
#include "guid.h"
#include "gnc-module.h"
@ -59,7 +59,7 @@ test_string_fcn (GncAddress *address, const char *message,
}
static void
main_helper (int argc, char **argv)
main_helper (void *closure, int argc, char **argv)
{
gnc_module_load("gnucash/business-core", 0);
test_address();
@ -70,6 +70,6 @@ main_helper (int argc, char **argv)
int
main (int argc, char **argv)
{
gh_enter (argc, argv, main_helper);
scm_boot_guile (argc, argv, main_helper, NULL);
return 0;
}

View File

@ -1,5 +1,5 @@
#include <glib.h>
#include <guile/gh.h>
#include <libguile.h>
#include "guid.h"
#include "gnc-module.h"
@ -96,7 +96,7 @@ test_printable (const char *name, gpointer obj)
}
static void
main_helper (int argc, char **argv)
main_helper (void *closure, int argc, char **argv)
{
gnc_module_load("gnucash/business-core", 0);
test_business();
@ -108,6 +108,6 @@ main_helper (int argc, char **argv)
int
main (int argc, char **argv)
{
// gh_enter (argc, argv, main_helper);
// scm_boot_guile (argc, argv, main_helper, NULL);
return 0;
}

View File

@ -1,5 +1,5 @@
#include <glib.h>
#include <guile/gh.h>
#include <libguile.h>
#include "guid.h"
#include "gnc-module.h"
@ -198,7 +198,7 @@ test_gint_fcn (GNCBook *book, const char *message,
#endif
static void
main_helper (int argc, char **argv)
main_helper (void *closure, int argc, char **argv)
{
gnc_module_load("gnucash/business-core", 0);
test_customer();
@ -209,6 +209,6 @@ main_helper (int argc, char **argv)
int
main (int argc, char **argv)
{
gh_enter (argc, argv, main_helper);
scm_boot_guile (argc, argv, main_helper, NULL);
return 0;
}

View File

@ -1,5 +1,5 @@
#include <glib.h>
#include <guile/gh.h>
#include <libguile.h>
#include "guid.h"
#include "gnc-module.h"
@ -183,7 +183,7 @@ test_gint_fcn (GNCBook *book, const char *message,
#endif
static void
main_helper (int argc, char **argv)
main_helper (void *closure, int argc, char **argv)
{
gnc_module_load("gnucash/business-core", 0);
test_employee();
@ -194,6 +194,6 @@ main_helper (int argc, char **argv)
int
main (int argc, char **argv)
{
gh_enter (argc, argv, main_helper);
scm_boot_guile (argc, argv, main_helper, NULL);
return 0;
}

View File

@ -1,5 +1,5 @@
#include <glib.h>
#include <guile/gh.h>
#include <libguile.h>
#include "guid.h"
#include "gnc-module.h"
@ -200,7 +200,7 @@ test_gint_fcn (GNCBook *book, const char *message,
#endif
static void
main_helper (int argc, char **argv)
main_helper (void *closure, int argc, char **argv)
{
gnc_module_load("gnucash/business-core", 0);
test_job();
@ -211,6 +211,6 @@ main_helper (int argc, char **argv)
int
main (int argc, char **argv)
{
gh_enter (argc, argv, main_helper);
scm_boot_guile (argc, argv, main_helper, NULL);
return 0;
}

View File

@ -1,11 +1,12 @@
#include <stdio.h>
#include <stdlib.h>
#include <guile/gh.h>
#include <libguile.h>
#include "gnc-module.h"
static void
guile_main(int argc, char ** argv) {
guile_main (void *closure, int argc, char ** argv)
{
GNCModule module;
printf(" test-load-module.c: loading/unloading business-core module ... ");
@ -28,7 +29,8 @@ guile_main(int argc, char ** argv) {
}
int
main(int argc, char ** argv) {
gh_enter(argc, argv, guile_main);
main (int argc, char ** argv)
{
scm_boot_guile(argc, argv, guile_main, NULL);
return 0;
}

View File

@ -1,5 +1,5 @@
#include <glib.h>
#include <guile/gh.h>
#include <libguile.h>
#include "guid.h"
#include "gnc-module.h"
@ -182,7 +182,7 @@ test_gint_fcn (GNCBook *book, const char *message,
#endif
static void
main_helper (int argc, char **argv)
main_helper (void *closure, int argc, char **argv)
{
gnc_module_load("gnucash/business-core", 0);
test_vendor();
@ -193,6 +193,6 @@ main_helper (int argc, char **argv)
int
main (int argc, char **argv)
{
gh_enter (argc, argv, main_helper);
scm_boot_guile (argc, argv, main_helper, NULL);
return 0;
}

View File

@ -20,6 +20,7 @@
#include "business-options-gnome.h"
#include "business-gnome-utils.h"
#include "dialog-invoice.h"
#include "guile-mappings.h"
static int
option_changed_cb (GtkWidget *widget, gpointer data)
@ -87,10 +88,10 @@ get_owner_type_from_option (GNCOption *option)
SCM odata = gnc_option_get_option_data (option);
SCM conv_func;
conv_func = gh_eval_str ("gw:enum-<gnc:GncOwnerType>-val->int");
odata = gh_call1 (conv_func, odata);
conv_func = scm_c_eval_string ("gw:enum-<gnc:GncOwnerType>-val->int");
odata = scm_call_1 (conv_func, odata);
return gh_scm2long (odata);
return scm_num2long (odata, SCM_ARG1, __FUNCTION__);
}
@ -155,7 +156,7 @@ owner_get_value (GNCOption *option, GtkWidget *widget)
owner.type = type;
gnc_owner_get_owner (widget, &owner);
return gw_wcp_assimilate_ptr (&owner, gh_eval_str("<gnc:GncOwner*>"));
return gw_wcp_assimilate_ptr (&owner, scm_c_eval_string("<gnc:GncOwner*>"));
}
@ -215,7 +216,7 @@ customer_get_value (GNCOption *option, GtkWidget *widget)
gnc_owner_get_owner (widget, &owner);
return gw_wcp_assimilate_ptr (owner.owner.undefined,
gh_eval_str("<gnc:GncCustomer*>"));
scm_c_eval_string("<gnc:GncCustomer*>"));
}
@ -275,7 +276,7 @@ vendor_get_value (GNCOption *option, GtkWidget *widget)
gnc_owner_get_owner (widget, &owner);
return gw_wcp_assimilate_ptr (owner.owner.undefined,
gh_eval_str("<gnc:GncVendor*>"));
scm_c_eval_string("<gnc:GncVendor*>"));
}
/********************************************************************/
@ -348,7 +349,7 @@ invoice_get_value (GNCOption *option, GtkWidget *widget)
GncInvoice *invoice;
invoice = gnc_general_search_get_selected (GNC_GENERAL_SEARCH (widget));
return gw_wcp_assimilate_ptr (invoice, gh_eval_str("<gnc:GncInvoice*>"));
return gw_wcp_assimilate_ptr (invoice, scm_c_eval_string("<gnc:GncInvoice*>"));
}
@ -423,7 +424,7 @@ taxtable_get_value (GNCOption *option, GtkWidget *widget)
GncTaxTable *taxtable;
taxtable = gnc_ui_optionmenu_get_value (widget);
return gw_wcp_assimilate_ptr (taxtable, gh_eval_str("<gnc:GncTaxTable*>"));
return gw_wcp_assimilate_ptr (taxtable, scm_c_eval_string("<gnc:GncTaxTable*>"));
}

View File

@ -10,7 +10,7 @@
#endif
#include <stdio.h>
#include <guile/gh.h>
#include <libguile.h>
#include <glib.h>
#include "gnc-module.h"
@ -74,9 +74,9 @@ libgncmod_business_gnome_LTX_gnc_module_init(int refcount)
// return FALSE;
// }
gh_eval_str("(use-modules (g-wrapped gw-business-gnome))");
gh_eval_str("(use-modules (gnucash business-gnome))");
gh_eval_str("(use-modules (gnucash report business-reports))");
scm_c_eval_string("(use-modules (g-wrapped gw-business-gnome))");
scm_c_eval_string("(use-modules (gnucash business-gnome))");
scm_c_eval_string("(use-modules (gnucash report business-reports))");
if (refcount == 0) {
/* Register the Owner search type */

View File

@ -40,6 +40,7 @@
#include "dialog-tax-table.h"
#include "dialog-billterms.h"
#include "AccWindow.h"
#include "guile-mappings.h"
#define DIALOG_NEW_INVOICE_CM_CLASS "dialog-new-invoice"
#define DIALOG_VIEW_INVOICE_CM_CLASS "dialog-view-invoice"
@ -495,17 +496,17 @@ gnc_invoice_window_printCB (GtkWidget *widget, gpointer data)
g_return_if_fail (invoice);
func = gh_eval_str ("gnc:invoice-report-create");
g_return_if_fail (gh_procedure_p (func));
func = scm_c_eval_string ("gnc:invoice-report-create");
g_return_if_fail (SCM_PROCEDUREP (func));
arg = gw_wcp_assimilate_ptr (invoice, gh_eval_str("<gnc:GncInvoice*>"));
args = gh_cons (arg, args);
arg = gw_wcp_assimilate_ptr (invoice, scm_c_eval_string("<gnc:GncInvoice*>"));
args = scm_cons (arg, args);
/* scm_protect_object(func); */
arg = gh_apply (func, args);
g_return_if_fail (gh_exact_p (arg));
report_id = gh_scm2int (arg);
arg = scm_apply (func, args, SCM_EOL);
g_return_if_fail (SCM_EXACTP (arg));
report_id = scm_num2int (arg, SCM_ARG1, __FUNCTION__);
/* scm_unprotect_object(func); */
if (report_id >= 0)
@ -662,31 +663,31 @@ void gnc_business_call_owner_report (GncOwner *owner, Account *acc)
args = SCM_EOL;
func = gh_eval_str ("gnc:owner-report-create");
g_return_if_fail (gh_procedure_p (func));
func = scm_c_eval_string ("gnc:owner-report-create");
g_return_if_fail (SCM_PROCEDUREP (func));
if (acc) {
qtype = gh_eval_str("<gnc:Account*>");
qtype = scm_c_eval_string("<gnc:Account*>");
g_return_if_fail (qtype != SCM_UNDEFINED);
arg = gw_wcp_assimilate_ptr (acc, qtype);
g_return_if_fail (arg != SCM_UNDEFINED);
args = gh_cons (arg, args);
args = scm_cons (arg, args);
} else {
args = gh_cons (SCM_BOOL_F, args);
args = scm_cons (SCM_BOOL_F, args);
}
qtype = gh_eval_str("<gnc:GncOwner*>");
qtype = scm_c_eval_string("<gnc:GncOwner*>");
g_return_if_fail (qtype != SCM_UNDEFINED);
arg = gw_wcp_assimilate_ptr (owner, qtype);
g_return_if_fail (arg != SCM_UNDEFINED);
args = gh_cons (arg, args);
args = scm_cons (arg, args);
/* Apply the function to the args */
arg = gh_apply (func, args);
g_return_if_fail (gh_exact_p (arg));
id = gh_scm2int (arg);
arg = scm_apply (func, args, SCM_EOL);
g_return_if_fail (SCM_EXACTP (arg));
id = scm_num2int (arg, SCM_ARG1, __FUNCTION__);
if (id >= 0)
reportWindow (id);

View File

@ -9,7 +9,7 @@
#include "config.h"
#include <glib.h>
#include <guile/gh.h>
#include <libguile.h>
#include "Account.h"
#include "gnc-ui-util.h"
@ -276,7 +276,7 @@ void gnc_entry_ledger_load (GncEntryLedger *ledger, GList *entry_list)
}
if (id_book == SCM_UNDEFINED)
id_book = gh_eval_str ("gnc:id-book");
id_book = scm_c_eval_string ("gnc:id-book");
/* Compute the proper taxtable */
odb = gnc_option_db_new_for_type (id_book);

View File

@ -26,7 +26,7 @@
if (getter == SCM_UNDEFINED) \
return default_value; \
\
value = gh_call0 (getter); \
value = scm_call_0 (getter); \
if (value == SCM_BOOL_F) \
return NULL; \
\

View File

@ -5,8 +5,9 @@
* Copyright (c) 2003 Derek Atkins <warlord@MIT.EDU>
*********************************************************************/
#include "config.h"
#include <stdio.h>
#include <guile/gh.h>
#include <libguile.h>
#include <glib.h>
#include "gnc-module.h"
@ -56,7 +57,7 @@ libgncmod_business_utils_LTX_gnc_module_init(int refcount)
/* initialize known types */
}
gh_eval_str("(use-modules (gnucash business-utils))");
scm_c_eval_string("(use-modules (gnucash business-utils))");
return TRUE;
}

View File

@ -5,8 +5,9 @@
* Copyright (c) 2002 Derek Atkins <warlord@MIT.EDU>
*********************************************************************/
#include "config.h"
#include <stdio.h>
#include <guile/gh.h>
#include <libguile.h>
#include <glib.h>
#include "gnc-module.h"
@ -55,8 +56,8 @@ libgncmod_dialog_tax_table_LTX_gnc_module_init(int refcount)
return FALSE;
}
gh_eval_str("(use-modules (g-wrapped gw-dialog-tax-table))");
// gh_eval_str("(use-modules (gnucash dialog-tax-table))");
scm_c_eval_string("(use-modules (g-wrapped gw-dialog-tax-table))");
// scm_c_eval_string("(use-modules (gnucash dialog-tax-table))");
return TRUE;
}

View File

@ -26,4 +26,7 @@ EXTRA_DIST = \
numeric_ops.c \
numeric_ops.h
AM_CFLAGS = -I${top_srcdir}/src/gnc-module ${GLIB_CFLAGS}
AM_CFLAGS = \
-I${top_srcdir}/src \
-I${top_srcdir}/src/gnc-module \
${GLIB_CFLAGS}

View File

@ -387,8 +387,6 @@
#include <glib.h>
#include <guile/gh.h>
#include "../engine/gnc-numeric.h"
#define EXPRESSION_PARSER_STATICS

View File

@ -4,6 +4,7 @@ pkglib_LTLIBRARIES = libgw-engine.la libgw-kvp.la libgncmod-engine.la
AM_CFLAGS = \
-I${top_srcdir}/lib/libc \
-I${top_srcdir}/src \
-I${top_srcdir}/src/gnc-module \
${GNUCASH_ENGINE_CFLAGS}

File diff suppressed because it is too large Load Diff

View File

@ -31,8 +31,9 @@
#include <Account.h>
#include <GNCId.h>
#include <Query.h>
#include <guile/gh.h>
#include <glib.h>
#include <libguile.h>
#include "guile-mappings.h"
Timespec gnc_transaction_get_date_posted(Transaction *t);
Timespec gnc_transaction_get_date_entered(Transaction *t);

View File

@ -23,9 +23,10 @@
#include "config.h"
#include <guile/gh.h>
#include <string.h>
#include <glib.h>
#include <libguile.h>
#include "guile-mappings.h"
#include <g-wrap-wct.h>
@ -41,9 +42,9 @@ glist_to_scm_list_helper(GList *glist, SCM wct)
GList *node;
for (node = glist; node; node = node->next)
list = gh_cons (gw_wcp_assimilate_ptr(node->data, wct), list);
list = scm_cons (gw_wcp_assimilate_ptr(node->data, wct), list);
return gh_reverse (list);
return scm_reverse (list);
}
SCM
@ -59,14 +60,14 @@ gnc_scm_list_to_glist(SCM rest)
GList *result = NULL;
SCM scm_item;
SCM_ASSERT(gh_list_p(rest), rest, SCM_ARG1, "gnc_scm_list_to_glist");
SCM_ASSERT(SCM_LISTP(rest), rest, SCM_ARG1, "gnc_scm_list_to_glist");
while(!gh_null_p(rest))
while(!SCM_NULLP(rest))
{
void *item;
scm_item = gh_car(rest);
rest = gh_cdr(rest);
scm_item = SCM_CAR(rest);
rest = SCM_CDR(rest);
/* fixes a bug in g-wrap */
if (scm_item == SCM_BOOL_F)
@ -94,17 +95,17 @@ glist_map_helper(GList *glist, SCM wct, SCM thunk)
GList *node;
for (node = glist; node; node = node->next)
list = gh_cons (gh_call1(thunk, gw_wcp_assimilate_ptr(node->data, wct)),
list);
list = scm_cons (scm_call_1(thunk, gw_wcp_assimilate_ptr(node->data, wct)),
list);
return gh_reverse (list);
return scm_reverse (list);
}
SCM
gnc_glist_scm_map(SCM wct, SCM thunk, GList* glist)
{
SCM_ASSERT(gw_wct_p(wct), wct, SCM_ARG1, "gnc_glist_map");
SCM_ASSERT(gh_procedure_p(thunk), thunk, SCM_ARG2, "gnc_glist_scm_map");
SCM_ASSERT(SCM_PROCEDUREP(thunk), thunk, SCM_ARG2, "gnc_glist_scm_map");
return(glist_map_helper(glist, wct, thunk));
}
@ -113,9 +114,9 @@ gnc_glist_scm_for_each(SCM wct, SCM thunk, GList *glist)
{
GList *lp;
SCM_ASSERT(gw_wct_p(wct), wct, SCM_ARG1, "gnc_glist_map");
SCM_ASSERT(gh_procedure_p(thunk), thunk, SCM_ARG2, "gnc_glist_scm_for_each");
SCM_ASSERT(SCM_PROCEDUREP(thunk), thunk, SCM_ARG2, "gnc_glist_scm_for_each");
for(lp = glist; lp; lp = lp->next) {
gh_call1(thunk, gw_wcp_assimilate_ptr(lp->data, wct));
scm_call_1(thunk, gw_wcp_assimilate_ptr(lp->data, wct));
}
}
@ -132,9 +133,9 @@ gnc_glist_string_to_scm(GList *glist)
GList *node;
for (node = glist; node; node = node->next)
list = gh_cons (gh_str02scm(node->data), list);
list = scm_cons (scm_makfrom0str(node->data), list);
return gh_reverse (list);
return scm_reverse (list);
}
@ -152,10 +153,10 @@ gnc_scm_to_glist_string(SCM list)
{
GList *glist = NULL;
while (!gh_null_p (list))
while (!SCM_NULLP (list))
{
glist = g_list_prepend (glist, gh_scm2newstr(gh_car(list), NULL));
list = gh_cdr (list);
glist = g_list_prepend (glist, gh_scm2newstr(SCM_CAR(list), NULL));
list = SCM_CDR (list);
}
return g_list_reverse (glist);
@ -167,5 +168,5 @@ gnc_scm_to_glist_string(SCM list)
int
gnc_glist_string_p(SCM list) {
return gh_list_p(list);
return SCM_LISTP(list);
}

View File

@ -24,8 +24,9 @@
#ifndef GLIB_HELPERS_H
#define GLIB_HELPERS_H
#include <guile/gh.h>
#include <glib.h>
#include <libguile.h>
#include "guile-mappings.h"
SCM gnc_glist_to_scm_list(GList *glist, SCM wct);
GList* gnc_scm_list_to_glist(SCM wcp_list);

View File

@ -62,9 +62,9 @@ static void
gnc_session_scm_gui_cb_helper (const char *message, double percent)
{
if (gnc_session_scm_gui_cb != SCM_BOOL_F) {
SCM string = gh_str02scm((char*)message);
SCM scm_percent = gh_double2scm(percent);
gh_call2 (gnc_session_scm_gui_cb, string, scm_percent);
SCM string = scm_makfrom0str(message);
SCM scm_percent = scm_make_real(percent);
scm_call_2 (gnc_session_scm_gui_cb, string, scm_percent);
}
}

View File

@ -39,7 +39,8 @@
#ifndef GNC_SESSION_SCM_H
#define GNC_SESSION_SCM_H
#include <guile/gh.h>
#include <libguile.h>
#include "guile-mappings.h"
void gnc_session_scm_load (GNCSession *session);
gboolean gnc_session_scm_export (GNCSession *tmp_session,

View File

@ -5,9 +5,11 @@
* Copyright (c) 2001 Linux Developers Group, Inc.
*********************************************************************/
#include "config.h"
#include <stdio.h>
#include <guile/gh.h>
#include <glib.h>
#include <libguile.h>
#include "guile-mappings.h"
#include "gnc-engine.h"
#include "gnc-module-api.h"
@ -49,12 +51,12 @@ libgncmod_engine_LTX_gnc_module_init(int refcount)
gnc_engine_init(0, NULL);
}
gh_eval_str("(use-modules (gnucash engine))");
scm_c_eval_string("(use-modules (gnucash engine))");
gh_eval_str("(use-modules (g-wrap gw-glib))");
scm_c_eval_string("(use-modules (g-wrap gw-glib))");
gh_eval_str("(use-modules (g-wrapped gw-kvp))");
gh_eval_str("(use-modules (g-wrapped gw-engine))");
scm_c_eval_string("(use-modules (g-wrapped gw-kvp))");
scm_c_eval_string("(use-modules (g-wrapped gw-engine))");
return TRUE;
}

View File

@ -6,6 +6,7 @@
#include <engine-helpers.h>
#include "kvp-scm.h"
#include "guile-mappings.h"
int
gnc_kvp_value_ptr_p(SCM arg)
@ -21,13 +22,13 @@ gnc_kvp_value_ptr_p(SCM arg)
kvp_value*
gnc_scm_to_kvp_value_ptr(SCM val)
{
if(gh_exact_p (val) && gnc_gh_gint64_p(val))
if(SCM_EXACTP (val) && gnc_gh_gint64_p(val))
{
return kvp_value_new_gint64(gnc_scm_to_gint64(val));
}
else if(gh_number_p(val))
else if(SCM_NUMBERP(val))
{
return kvp_value_new_double(gh_scm2double(val));
return kvp_value_new_double(scm_num2dbl(val, __FUNCTION__));
}
else if(gnc_numeric_p(val))
{
@ -43,7 +44,7 @@ gnc_scm_to_kvp_value_ptr(SCM val)
Timespec ts = gnc_timepair2timespec(val);
return kvp_value_new_timespec(ts);
}
else if(gh_string_p(val))
else if(SCM_STRINGP(val))
{
char *newstr;
kvp_value *ret;
@ -53,7 +54,7 @@ gnc_scm_to_kvp_value_ptr(SCM val)
return ret;
}
else if(gw_wcp_p(val) &&
gw_wcp_is_of_type_p(gh_eval_str("<gnc:kvp-frame*>"), val))
gw_wcp_is_of_type_p(scm_c_eval_string("<gnc:kvp-frame*>"), val))
{
kvp_frame *frame = gw_wcp_get_ptr(val);
return kvp_value_new_frame (frame);
@ -72,13 +73,13 @@ gnc_kvp_value_ptr_to_scm(kvp_value* val)
return gnc_gint64_to_scm(kvp_value_get_gint64(val));
break;
case KVP_TYPE_DOUBLE:
return gh_double2scm(kvp_value_get_double(val));
return scm_make_real(kvp_value_get_double(val));
break;
case KVP_TYPE_NUMERIC:
return gnc_numeric_to_scm(kvp_value_get_numeric(val));
break;
case KVP_TYPE_STRING:
return gh_str02scm(kvp_value_get_string(val));
return scm_makfrom0str(kvp_value_get_string(val));
break;
case KVP_TYPE_GUID:
{
@ -95,7 +96,7 @@ gnc_kvp_value_ptr_to_scm(kvp_value* val)
kvp_frame *frame = kvp_value_get_frame(val);
if (frame)
return gw_wcp_assimilate_ptr (frame,
gh_eval_str("<gnc:kvp-frame*>"));
scm_c_eval_string("<gnc:kvp-frame*>"));
}
break;

View File

@ -20,6 +20,7 @@ libgncmod_test_engine_la_LIBADD = \
noinst_HEADERS=test-engine-stuff.h
AM_CFLAGS = \
-I${top_srcdir}/src \
-I${top_srcdir}/src/gnc-module \
-I${top_srcdir}/src/test-core \
-I${top_srcdir}/src/engine \

View File

@ -1,5 +1,6 @@
AM_CFLAGS = \
-I${top_srcdir}/src \
-I${top_srcdir}/src/gnc-module \
-I${top_srcdir}/src/test-core \
-I${top_srcdir}/src/engine \

View File

@ -1,5 +1,5 @@
#include <glib.h>
#include <guile/gh.h>
#include <libguile.h>
#include "gnc-engine-util.h"
@ -152,7 +152,7 @@ test_commodity(void)
}
static void
main_helper (int argc, char **argv)
main_helper (void *closure, int argc, char **argv)
{
gnc_module_load("gnucash/engine", 0);
test_commodity();
@ -163,6 +163,6 @@ main_helper (int argc, char **argv)
int
main (int argc, char **argv)
{
gh_enter (argc, argv, main_helper);
scm_boot_guile (argc, argv, main_helper, NULL);
return 0;
}

View File

@ -1,6 +1,5 @@
#include <ctype.h>
#include <glib.h>
#include <guile/gh.h>
#include <time.h>
#include "TransLog.h"

View File

@ -9,7 +9,7 @@
#include <stdlib.h>
#include <glib.h>
#include <guile/gh.h>
#include <libguile.h>
#include "test-stuff.h"
#include "FreqSpec.h"
@ -524,7 +524,7 @@ test_composite (void)
}
static void
guile_main( int argc, char* argv[] )
guile_main ( void *closure, int argc, char* argv[] )
{
gnc_module_load("gnucash/engine", 0);
@ -558,6 +558,6 @@ guile_main( int argc, char* argv[] )
int
main (int argc, char **argv)
{
gh_enter (argc, argv, guile_main);
scm_boot_guile (argc, argv, guile_main, NULL);
return 0;
}

View File

@ -1,6 +1,6 @@
#include <glib.h>
#include <guile/gh.h>
#include <libguile.h>
#include "GroupP.h"
#include "GNCIdP.h"
@ -151,7 +151,7 @@ run_test (void)
}
static void
main_helper (int argc, char **argv)
main_helper (void *closure, int argc, char **argv)
{
int i;
@ -176,6 +176,6 @@ main_helper (int argc, char **argv)
int
main (int argc, char **argv)
{
gh_enter (argc, argv, main_helper);
scm_boot_guile (argc, argv, main_helper, NULL);
return 0;
}

View File

@ -1,11 +1,12 @@
#include <stdio.h>
#include <stdlib.h>
#include <guile/gh.h>
#include <libguile.h>
#include "gnc-module.h"
static void
guile_main(int argc, char ** argv) {
guile_main (void *closure, int argc, char ** argv)
{
GNCModule engine;
printf(" test-load-engine.c: loading/unloading engine module ... ");
@ -28,7 +29,8 @@ guile_main(int argc, char ** argv) {
}
int
main(int argc, char ** argv) {
gh_enter(argc, argv, guile_main);
main (int argc, char ** argv)
{
scm_boot_guile(argc, argv, guile_main, NULL);
return 0;
}

View File

@ -1,5 +1,5 @@
#include <glib.h>
#include <guile/gh.h>
#include <libguile.h>
#include "guid.h"
#include "gnc-module.h"
@ -118,7 +118,7 @@ test_printable (const char *name, gpointer obj)
}
static void
main_helper (int argc, char **argv)
main_helper (void *closure, int argc, char **argv)
{
gnc_module_load("gnucash/engine", 0);
test_object();
@ -129,6 +129,6 @@ main_helper (int argc, char **argv)
int
main (int argc, char **argv)
{
gh_enter (argc, argv, main_helper);
scm_boot_guile (argc, argv, main_helper, NULL);
return 0;
}

View File

@ -8,7 +8,7 @@
#include <ctype.h>
#include <glib.h>
#include <guile/gh.h>
#include <libguile.h>
#include <time.h>
#include "Account.h"

View File

@ -1,6 +1,6 @@
#include <glib.h>
#include <guile/gh.h>
#include <libguile.h>
#include "Group.h"
#include "Transaction.h"
@ -64,7 +64,7 @@ run_test (void)
}
static void
main_helper (int argc, char **argv)
main_helper (void *closure, int argc, char **argv)
{
gnc_module_load("gnucash/engine", 0);
@ -83,6 +83,6 @@ main_helper (int argc, char **argv)
int
main (int argc, char **argv)
{
gh_enter (argc, argv, main_helper);
scm_boot_guile (argc, argv, main_helper, NULL);
return 0;
}

View File

@ -1,5 +1,5 @@
#include <glib.h>
#include <guile/gh.h>
#include <libguile.h>
#include "guid.h"
#include "gnc-module.h"
@ -74,7 +74,7 @@ static void test_querynew (void)
}
static void
main_helper (int argc, char **argv)
main_helper (void *closure, int argc, char **argv)
{
gnc_module_load("gnucash/engine", 0);
test_query_core();
@ -87,6 +87,6 @@ main_helper (int argc, char **argv)
int
main (int argc, char **argv)
{
gh_enter (argc, argv, main_helper);
scm_boot_guile (argc, argv, main_helper, NULL);
return 0;
}

View File

@ -1,6 +1,6 @@
#include <glib.h>
#include <guile/gh.h>
#include <libguile.h>
#include "engine-helpers.h"
#include "gnc-module.h"
@ -57,7 +57,7 @@ run_tests (void)
}
static void
main_helper (int argc, char **argv)
main_helper (void *closure, int argc, char **argv)
{
gnc_module_load("gnucash/engine", 0);
@ -76,6 +76,6 @@ main_helper (int argc, char **argv)
int
main (int argc, char **argv)
{
gh_enter (argc, argv, main_helper);
scm_boot_guile (argc, argv, main_helper, NULL);
return 0;
}

View File

@ -1,6 +1,6 @@
#include <glib.h>
#include <guile/gh.h>
#include <libguile.h>
#include "GNCIdP.h"
@ -71,7 +71,7 @@ run_test (void)
}
static void
main_helper (int argc, char **argv)
main_helper (void *closure, int argc, char **argv)
{
gnc_module_load("gnucash/engine", 0);
@ -88,6 +88,6 @@ main_helper (int argc, char **argv)
int
main (int argc, char **argv)
{
gh_enter (argc, argv, main_helper);
scm_boot_guile (argc, argv, main_helper, NULL);
return 0;
}

View File

@ -1,5 +1,5 @@
#include <glib.h>
#include <guile/gh.h>
#include <libguile.h>
#include <string.h>
#include "GNCIdP.h"
@ -127,7 +127,7 @@ run_test (void)
}
static void
main_helper (int argc, char **argv)
main_helper (void *closure, int argc, char **argv)
{
gnc_module_load("gnucash/engine", 0);
@ -144,6 +144,6 @@ main_helper (int argc, char **argv)
int
main (int argc, char **argv)
{
gh_enter (argc, argv, main_helper);
scm_boot_guile (argc, argv, main_helper, NULL);
return 0;
}

View File

@ -1,6 +1,9 @@
SUBDIRS = . test
AM_CFLAGS = -I${top_srcdir}/src/core-utils ${GLIB_CFLAGS} ${G_WRAP_COMPILE_ARGS} ${GUILE_INCS}
AM_CFLAGS = \
-I${top_srcdir}/src \
-I${top_srcdir}/src/core-utils \
${GLIB_CFLAGS} ${G_WRAP_COMPILE_ARGS} ${GUILE_INCS}
lib_LTLIBRARIES = libgncmodule.la
pkglib_LTLIBRARIES = libgw-gnc-module.la

View File

@ -8,6 +8,8 @@
#include <glib.h>
#include <ltdl.h>
#include <libguile.h>
#include "guile-mappings.h"
#ifndef lt_ptr
#define lt_ptr lt_ptr_t

View File

@ -3,6 +3,7 @@ SUBDIRS = mod-foo mod-bar mod-baz misc-mods
LDADD = ../libgncmodule.la ${GLIB_LIBS} -lltdl
AM_CFLAGS = \
-I${top_srcdir}/src \
-I${top_srcdir}/src/gnc-module \
${GUILE_INCS} \
${GLIB_CFLAGS}

View File

@ -1,4 +1,5 @@
AM_CFLAGS = \
-I${top_srcdir}/src \
-I${top_srcdir}/src/gnc-module \
${GLIB_CFLAGS}

View File

@ -1,4 +1,5 @@
AM_CFLAGS = \
-I${top_srcdir}/src \
-I${top_srcdir}/src/gnc-module \
${G_WRAP_COMPILE_ARGS} \
${GUILE_INCS} \

View File

@ -1,9 +1,11 @@
/* gnc-mod-bar.c : the Gnucash plugin that wraps the library
* 'libbar.so'. it does this by being linked against libbar.so */
#include "config.h"
#include <stdio.h>
#include <guile/gh.h>
#include <glib.h>
#include <libguile.h>
#include "guile-mappings.h"
#include "bar-gwrap.h"
#include "gnc-module-api.h"
@ -35,7 +37,7 @@ libgncmodbar_LTX_gnc_module_init(int refcount) {
gw_init_wrapset_bar_gwrap();
/* use the (bar) module */
gh_eval_str("(use-modules (gnucash bar))");
scm_c_eval_string("(use-modules (gnucash bar))");
return TRUE;
}

View File

@ -1,4 +1,5 @@
AM_CFLAGS = \
-I${top_srcdir}/src \
-I${top_srcdir}/src/gnc-module \
-I${top_srcdir}/src/gnc-module/test/mod-foo \
${GLIB_CFLAGS} \

View File

@ -1,8 +1,10 @@
/* gnc-mod-baz.c : the Gnucash plugin that wraps the library
* 'libbaz.so'. it does this by being linked against libbaz.so */
#include "config.h"
#include <stdio.h>
#include <guile/gh.h>
#include <libguile.h>
#include "guile-mappings.h"
#include "gnc-module.h"
#include "gnc-module-api.h"
@ -37,7 +39,7 @@ libgncmodbaz_LTX_gnc_module_init(int refcount) {
gw_init_wrapset_baz_gwrap();
/* use the scheme module */
gh_eval_str("(use-modules (gnucash baz))");
scm_c_eval_string("(use-modules (gnucash baz))");
return TRUE;
}

View File

@ -1,4 +1,5 @@
AM_CFLAGS=\
-I${top_srcdir}/src \
-I${top_srcdir}/src/gnc-module \
${GUILE_INCS} \
${G_WRAP_COMPILE_ARGS} \

View File

@ -1,9 +1,11 @@
/* gnc-mod-foo.c : the Gnucash plugin that wraps the library
* 'libfoo.so'. it does this by being linked against libfoo.so */
#include "config.h"
#include <stdio.h>
#include <guile/gh.h>
#include <glib.h>
#include <libguile.h>
#include "guile-mappings.h"
#include "foo-gwrap.h"
#include "gnc-module-api.h"
@ -36,7 +38,7 @@ libgncmodfoo_LTX_gnc_module_init(int refcount) {
gw_init_wrapset_foo_gwrap();
/* use the Scheme "foo" module */
gh_eval_str("(use-modules (gnucash foo))");
scm_c_eval_string("(use-modules (gnucash foo))");
return TRUE;
}

View File

@ -1,11 +1,12 @@
#include <stdio.h>
#include <stdlib.h>
#include <guile/gh.h>
#include <libguile.h>
#include "gnc-module.h"
static void
guile_main(int argc, char ** argv) {
guile_main(void *closure, int argc, char ** argv)
{
GNCModule foo;
printf(" test-agedver.c: asking for an old but supported interface ...");
@ -25,7 +26,8 @@ guile_main(int argc, char ** argv) {
}
int
main(int argc, char ** argv) {
gh_enter(argc, argv, guile_main);
main(int argc, char ** argv)
{
scm_boot_guile(argc, argv, guile_main, NULL);
return 0;
}

View File

@ -6,12 +6,12 @@
#include <stdio.h>
#include <ltdl.h>
#include <guile/gh.h>
#include <libguile.h>
#include "gnc-module.h"
static void
guile_main(int argc, char ** argv)
guile_main(void *closure, int argc, char ** argv)
{
lt_dlhandle handle;
@ -40,8 +40,9 @@ guile_main(int argc, char ** argv)
}
int
main(int argc, char ** argv) {
gh_enter(argc, argv, guile_main);
main(int argc, char ** argv)
{
scm_boot_guile(argc, argv, guile_main, NULL);
return 0;
}

View File

@ -1,11 +1,12 @@
#include <stdio.h>
#include <stdlib.h>
#include <guile/gh.h>
#include <libguile.h>
#include "gnc-module.h"
static void
guile_main(int argc, char ** argv) {
guile_main(void *closure, int argc, char ** argv)
{
GNCModule foo;
printf(" test-incompatdep.c: loading a module with bad deps ...\n");
@ -25,7 +26,8 @@ guile_main(int argc, char ** argv) {
}
int
main(int argc, char ** argv) {
gh_enter(argc, argv, guile_main);
main(int argc, char ** argv)
{
scm_boot_guile(argc, argv, guile_main, NULL);
return 0;
}

View File

@ -1,12 +1,13 @@
#include <stdio.h>
#include <stdlib.h>
#include <guile/gh.h>
#include <libguile.h>
#include "gnc-module.h"
static void
guile_main(int argc, char ** argv) {
guile_main(void *closure, int argc, char ** argv)
{
int (*foo_hello)(void);
int helloval;
GNCModule foo;
@ -39,7 +40,8 @@ guile_main(int argc, char ** argv) {
}
int
main(int argc, char ** argv) {
gh_enter(argc, argv, guile_main);
main(int argc, char ** argv)
{
scm_boot_guile(argc, argv, guile_main, NULL);
return 0;
}

View File

@ -1,11 +1,12 @@
#include <stdio.h>
#include <stdlib.h>
#include <guile/gh.h>
#include <libguile.h>
#include "gnc-module.h"
static void
guile_main(int argc, char ** argv) {
guile_main(void *closure, int argc, char ** argv)
{
GNCModule foo;
printf(" test-modsysver.c: checking for a module we shouldn't find ...\n");
@ -25,7 +26,8 @@ guile_main(int argc, char ** argv) {
}
int
main(int argc, char ** argv) {
gh_enter(argc, argv, guile_main);
main(int argc, char ** argv)
{
scm_boot_guile(argc, argv, guile_main, NULL);
return 0;
}

View File

@ -10,8 +10,9 @@
#endif
#include <stdio.h>
#include <guile/gh.h>
#include <glib.h>
#include <libguile.h>
#include "guile-mappings.h"
#include "gnc-module.h"
#include "gnc-module-api.h"
@ -63,8 +64,8 @@ libgncmod_gnome_search_LTX_gnc_module_init(int refcount)
gnc_search_core_initialize ();
}
gh_eval_str("(use-modules (g-wrapped gw-gnome-search))");
gh_eval_str("(use-modules (gnucash gnome-search))");
scm_c_eval_string("(use-modules (g-wrapped gw-gnome-search))");
scm_c_eval_string("(use-modules (gnucash gnome-search))");
return TRUE;
}

View File

@ -23,8 +23,9 @@
#include "config.h"
#include <guile/gh.h>
#include <glib.h>
#include <libguile.h>
#include "guile-mappings.h"
#include "argv-list-converters.h"
@ -37,10 +38,10 @@ gnc_scheme_list_to_nulltermcharpp(int prelen, const char **prepend, SCM list)
int len = 0;
int loc;
if(gh_pair_p(list))
if(SCM_CONSP(list))
{
int i;
len = gh_length(list) + prelen;
len = scm_ilength(list) + prelen;
ret = g_new(char *, len + 1);
ret[len] = NULL;
for(i = 0; i < prelen; i++)
@ -54,11 +55,11 @@ gnc_scheme_list_to_nulltermcharpp(int prelen, const char **prepend, SCM list)
}
loc = prelen;
while(gh_pair_p(next))
while(SCM_CONSP(next))
{
SCM scm_string = gh_car(next);
next = gh_cdr(next);
if(gh_string_p(scm_string))
SCM scm_string = SCM_CAR(next);
next = SCM_CDR(next);
if(SCM_STRINGP(scm_string))
{
char *onestr = gh_scm2newstr(scm_string, 0);
ret[loc] = g_strdup (onestr);
@ -88,12 +89,10 @@ gnc_argvarr_to_scheme_list(int argc, const char** argv)
for(i = 0; i < argc; i++)
{
/* FIXME: when we drop support older guiles,
* drop the (char *) coercion. */
ret = gh_cons(gh_str02scm((char *) argv[i]), ret);
ret = scm_cons(scm_makfrom0str(argv[i]), ret);
}
return gh_reverse(ret);
return scm_reverse(ret);
}
void

View File

@ -26,7 +26,7 @@
#include <gnome.h>
#include <stdio.h>
#include <guile/gh.h>
#include <libguile.h>
#include "dialog-account-pick.h"
#include "dialog-utils.h"

View File

@ -43,6 +43,7 @@
#include "guile-util.h"
#include "messages.h"
#include "option-util.h"
#include "guile-mappings.h"
/* This static indicates the debugging module that this .o belongs to. */
@ -248,7 +249,7 @@ gnc_option_set_ui_value_internal (GNCOption *option, gboolean use_default)
else
getter = gnc_option_getter(option);
value = gh_call0(getter);
value = scm_call_0(getter);
option_def = gnc_options_ui_get_option (type);
if (option_def && option_def->set_value)
@ -2164,10 +2165,10 @@ static gboolean
gnc_option_set_ui_value_boolean (GNCOption *option, gboolean use_default,
GtkWidget *widget, SCM value)
{
if (gh_boolean_p(value))
if (SCM_BOOLP(value))
{
gtk_toggle_button_set_state(GTK_TOGGLE_BUTTON(widget),
gh_scm2bool(value));
SCM_NFALSEP(value));
return FALSE;
}
else
@ -2178,7 +2179,7 @@ static gboolean
gnc_option_set_ui_value_string (GNCOption *option, gboolean use_default,
GtkWidget *widget, SCM value)
{
if (gh_string_p(value))
if (SCM_STRINGP(value))
{
char *string = gh_scm2newstr(value, NULL);
gtk_entry_set_text(GTK_ENTRY(widget), string);
@ -2193,7 +2194,7 @@ static gboolean
gnc_option_set_ui_value_text (GNCOption *option, gboolean use_default,
GtkWidget *widget, SCM value)
{
if (gh_string_p(value))
if (SCM_STRINGP(value))
{
char *string = gh_scm2newstr(value, NULL);
gint pos = 0;
@ -2268,7 +2269,7 @@ gnc_option_set_ui_value_date (GNCOption *option, gboolean use_default,
date_option_type = gnc_option_date_option_get_subtype(option);
if (gh_pair_p(value))
if (SCM_CONSP(value))
{
symbol_str = gnc_date_option_value_get_type (value);
if (symbol_str)
@ -2397,12 +2398,12 @@ gnc_option_set_ui_value_list (GNCOption *option, gboolean use_default,
for (row = 0; row < num_rows; row++)
gtk_clist_set_row_data(GTK_CLIST(widget), row, GINT_TO_POINTER(FALSE));
while (gh_list_p(value) && !gh_null_p(value))
while (SCM_LISTP(value) && !SCM_NULLP(value))
{
SCM item;
item = gh_car(value);
value = gh_cdr(value);
item = SCM_CAR(value);
value = SCM_CDR(value);
row = gnc_option_permissible_value_index(option, item);
if (row < 0)
@ -2414,7 +2415,7 @@ gnc_option_set_ui_value_list (GNCOption *option, gboolean use_default,
gtk_clist_set_row_data(GTK_CLIST(widget), row, GINT_TO_POINTER(TRUE));
}
if (!gh_list_p(value) || !gh_null_p(value))
if (!SCM_LISTP(value) || !SCM_NULLP(value))
return TRUE;
return FALSE;
@ -2429,9 +2430,9 @@ gnc_option_set_ui_value_number_range (GNCOption *option, gboolean use_default,
spinner = GTK_SPIN_BUTTON(widget);
if (gh_number_p(value))
if (SCM_NUMBERP(value))
{
d_value = gh_scm2double(value);
d_value = scm_num2dbl(value, __FUNCTION__);
gtk_spin_button_set_value(spinner, d_value);
return FALSE;
}
@ -2463,7 +2464,7 @@ static gboolean
gnc_option_set_ui_value_font (GNCOption *option, gboolean use_default,
GtkWidget *widget, SCM value)
{
if (gh_string_p(value))
if (SCM_STRINGP(value))
{
char *string = gh_scm2newstr(value, NULL);
if ((string != NULL) && (*string != '\0'))
@ -2483,7 +2484,7 @@ static gboolean
gnc_option_set_ui_value_pixmap (GNCOption *option, gboolean use_default,
GtkWidget *widget, SCM value)
{
if (gh_string_p(value))
if (SCM_STRINGP(value))
{
char * string = gh_scm2newstr(value, NULL);
@ -2545,7 +2546,7 @@ gnc_option_get_ui_value_boolean (GNCOption *option, GtkWidget *widget)
gboolean active;
active = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widget));
return gh_bool2scm(active);
return SCM_BOOL(active);
}
static SCM
@ -2555,7 +2556,7 @@ gnc_option_get_ui_value_string (GNCOption *option, GtkWidget *widget)
SCM result;
string = gtk_editable_get_chars(GTK_EDITABLE(widget), 0, -1);
result = gh_str02scm(string);
result = scm_makfrom0str(string);
g_free(string);
return result;
}
@ -2567,7 +2568,7 @@ gnc_option_get_ui_value_text (GNCOption *option, GtkWidget *widget)
SCM result;
string = gtk_editable_get_chars(GTK_EDITABLE(widget), 0, -1);
result = gh_str02scm(string);
result = scm_makfrom0str(string);
g_free(string);
return result;
}
@ -2617,9 +2618,9 @@ gnc_option_get_ui_value_date (GNCOption *option, GtkWidget *widget)
{
index = GPOINTER_TO_INT(gtk_object_get_data(GTK_OBJECT(widget),
"gnc_multichoice_index"));
type = gh_symbol2scm("relative");
type = scm_str2symbol("relative");
val = gnc_option_permissible_value(option, index);
result = gh_cons(type, val);
result = scm_cons(type, val);
}
else if (safe_strcmp(subtype, "absolute") == 0)
{
@ -2628,7 +2629,7 @@ gnc_option_get_ui_value_date (GNCOption *option, GtkWidget *widget)
ts.tv_sec = gnc_date_edit_get_date(GNC_DATE_EDIT(widget));
ts.tv_nsec = 0;
result = gh_cons(gh_symbol2scm("absolute"), gnc_timespec2timepair(ts));
result = scm_cons(scm_str2symbol("absolute"), gnc_timespec2timepair(ts));
}
else if (safe_strcmp(subtype, "both") == 0)
{
@ -2648,14 +2649,14 @@ gnc_option_get_ui_value_date (GNCOption *option, GtkWidget *widget)
{
ts.tv_sec = gnc_date_edit_get_date(GNC_DATE_EDIT(ab_widget));
ts.tv_nsec = 0;
result = gh_cons(gh_symbol2scm("absolute"), gnc_timespec2timepair(ts));
result = scm_cons(scm_str2symbol("absolute"), gnc_timespec2timepair(ts));
}
else
{
index = GPOINTER_TO_INT(gtk_object_get_data(GTK_OBJECT(rel_widget),
"gnc_multichoice_index"));
val = gnc_option_permissible_value(option, index);
result = gh_cons(gh_symbol2scm("relative"), val);
result = scm_cons(scm_str2symbol("relative"), val);
}
}
g_free(subtype);
@ -2673,7 +2674,7 @@ gnc_option_get_ui_value_account_list (GNCOption *option, GtkWidget *widget)
list = gnc_account_tree_get_current_accounts(tree);
/* handover list */
result = gnc_glist_to_scm_list(list, gh_eval_str("<gnc:Account*>"));
result = gnc_glist_to_scm_list(list, scm_c_eval_string("<gnc:Account*>"));
g_list_free(list);
return result;
}
@ -2690,7 +2691,7 @@ gnc_option_get_ui_value_account_sel (GNCOption *option, GtkWidget *widget)
if (!acc)
return SCM_BOOL_F;
return gw_wcp_assimilate_ptr(acc, gh_eval_str("<gnc:Account*>"));
return gw_wcp_assimilate_ptr(acc, scm_c_eval_string("<gnc:Account*>"));
}
static SCM
@ -2704,16 +2705,16 @@ gnc_option_get_ui_value_list (GNCOption *option, GtkWidget *widget)
clist = GTK_CLIST(widget);
num_rows = gnc_option_num_permissible_values(option);
result = gh_eval_str("'()");
result = scm_c_eval_string("'()");
for (row = 0; row < num_rows; row++)
{
selected = GPOINTER_TO_INT(gtk_clist_get_row_data(clist, row));
if (selected)
result = gh_cons(gnc_option_permissible_value(option, row), result);
result = scm_cons(gnc_option_permissible_value(option, row), result);
}
return (gh_reverse(result));
return (scm_reverse(result));
}
static SCM
@ -2726,7 +2727,7 @@ gnc_option_get_ui_value_number_range (GNCOption *option, GtkWidget *widget)
value = gtk_spin_button_get_value_as_float(spinner);
return (gh_double2scm(value));
return (scm_make_real(value));
}
static SCM
@ -2744,10 +2745,10 @@ gnc_option_get_ui_value_color (GNCOption *option, GtkWidget *widget)
scale = gnc_option_color_range(option);
result = SCM_EOL;
result = gh_cons(gh_double2scm(alpha * scale), result);
result = gh_cons(gh_double2scm(blue * scale), result);
result = gh_cons(gh_double2scm(green * scale), result);
result = gh_cons(gh_double2scm(red * scale), result);
result = scm_cons(scm_make_real(alpha * scale), result);
result = scm_cons(scm_make_real(blue * scale), result);
result = scm_cons(scm_make_real(green * scale), result);
result = scm_cons(scm_make_real(red * scale), result);
return result;
}
@ -2758,7 +2759,7 @@ gnc_option_get_ui_value_font (GNCOption *option, GtkWidget *widget)
char * string;
string = gnome_font_picker_get_font_name(picker);
return (gh_str02scm(string));
return (scm_makfrom0str(string));
}
static SCM
@ -2767,7 +2768,7 @@ gnc_option_get_ui_value_pixmap (GNCOption *option, GtkWidget *widget)
GnomePixmapEntry * p = GNOME_PIXMAP_ENTRY(widget);
char * string = gnome_pixmap_entry_get_filename(p);
return (gh_str02scm(string ? string : ""));
return (scm_makfrom0str(string ? string : ""));
}
static SCM
@ -2865,7 +2866,7 @@ scm_apply_cb (GNCOptionWin *win, gpointer data)
if (gnc_option_db_get_changed (win->option_db)) {
gnc_option_db_commit (win->option_db);
if (cbdata->apply_cb != SCM_BOOL_F) {
gh_call0 (cbdata->apply_cb);
scm_call_0 (cbdata->apply_cb);
}
}
}
@ -2876,7 +2877,7 @@ scm_close_cb (GNCOptionWin *win, gpointer data)
struct scm_cb *cbdata = data;
if (cbdata->close_cb != SCM_BOOL_F) {
gh_call0 (cbdata->close_cb);
scm_call_0 (cbdata->close_cb);
scm_unprotect_object (cbdata->close_cb);
}

View File

@ -28,7 +28,7 @@
#endif
#include <gnome.h>
#include <guile/gh.h>
#include <libguile.h>
#include "option-util.h"

View File

@ -24,7 +24,7 @@
#include "config.h"
#include <gnome.h>
#include <guile/gh.h>
#include <libguile.h>
#ifdef GTKHTML_HAVE_GCONF
#include <gconf/gconf.h>

View File

@ -26,7 +26,7 @@
#include <gnome.h>
#include <glib.h>
#include <guile/gh.h>
#include <libguile.h>
#include <gtkhtml/gtkhtml.h>
#include <gtkhtml/gtkhtml-embedded.h>

View File

@ -40,7 +40,7 @@
#include <gnome.h>
#include <regex.h>
#include <glib.h>
#include <guile/gh.h>
#include <libguile.h>
#include "Account.h"
#include "Group.h"

View File

@ -25,7 +25,7 @@
#define GNC_MDI_UTILS_H
#include <gnome.h>
#include <guile/gh.h>
#include <libguile.h>
typedef struct gnc_mdi_child_info GNCMDIChildInfo;

Some files were not shown because too many files have changed in this diff Show More