diff --git a/src/engine/engine-helpers.c b/src/engine/engine-helpers.c index f0f0156e44..171c06a7d8 100644 --- a/src/engine/engine-helpers.c +++ b/src/engine/engine-helpers.c @@ -24,7 +24,7 @@ #include "config.h" -#include +#include #include #include @@ -1738,170 +1738,6 @@ gnc_numeric_p(SCM arg) } } -static SCM -gnc_glist_account_ptr_to_scm_internal (GList *account_list, gboolean free_list) -{ - static SCM acct_type = SCM_UNDEFINED; - SCM result; - - if (acct_type == SCM_UNDEFINED) - { - acct_type = gh_eval_str(""); - /* don't really need this - types are bound globally anyway. */ - if(acct_type != SCM_UNDEFINED) scm_protect_object(acct_type); - } - - result = gnc_glist_to_scm_list(account_list, acct_type); - - if (free_list) - g_list_free (account_list); - - return result; -} - -/********************************************************************\ - * gnc_account_list_to_scm * - * Turn a list of accounts into an SCM. * - * The list is freed. * - * * - * Args: account_list - list of accounts to SCMify * - * Return: SCM list of accounts * -\********************************************************************/ -SCM -gnc_glist_account_ptr_to_scm (GList *account_list) -{ - return gnc_glist_account_ptr_to_scm_internal (account_list, TRUE); -} - -/********************************************************************\ - * gnc_account_list_to_scm_no_free * - * Turn a list of accounts into an SCM. * - * The list is not freed. * - * * - * Args: account_list - list of accounts to SCMify * - * Return: SCM list of accounts * -\********************************************************************/ -SCM -gnc_glist_account_ptr_to_scm_no_free (GList *account_list) -{ - return gnc_glist_account_ptr_to_scm_internal (account_list, FALSE); -} - -/********************************************************************\ - * gnc_scm_to_account_list * - * Turn an SCM into a g_malloc's account list * - * * - * Args: scm_list - SCM list of accounts * - * Return: GList of accounts * -\********************************************************************/ -GList * -gnc_scm_to_glist_account_ptr(SCM scm_list) -{ - return gnc_scm_list_to_glist(scm_list); -} - -/******************************************************************** - * gnc_glist_account_ptr_p - ********************************************************************/ - -int -gnc_glist_account_ptr_p(SCM list) -{ - return gh_list_p(list); -} - -static SCM -gnc_glist_transaction_ptr_to_scm_internal (GList *trans_list, - gboolean free_list) -{ - static SCM trans_type = SCM_UNDEFINED; - SCM result; - - if (trans_type == SCM_UNDEFINED) - { - trans_type = gh_eval_str(""); - /* don't really need this - types are bound globally anyway. */ - if(trans_type != SCM_UNDEFINED) scm_protect_object(trans_type); - } - - result = gnc_glist_to_scm_list(trans_list, trans_type); - - if (free_list) - g_list_free (trans_list); - - return result; -} - -SCM -gnc_glist_transaction_ptr_to_scm (GList *transaction_list) -{ - return gnc_glist_transaction_ptr_to_scm_internal (transaction_list, TRUE); -} - -SCM -gnc_glist_transaction_ptr_to_scm_no_free (GList *transaction_list) -{ - return gnc_glist_transaction_ptr_to_scm_internal (transaction_list, FALSE); -} - -GList * -gnc_scm_to_glist_transaction_ptr (SCM scm_list) -{ - return gnc_scm_list_to_glist (scm_list); -} - -int -gnc_glist_transaction_ptr_p (SCM list) -{ - return gh_list_p (list); -} - -static SCM -gnc_glist_split_ptr_to_scm_internal (GList *trans_list, - gboolean free_list) -{ - static SCM trans_type = SCM_UNDEFINED; - SCM result; - - if (trans_type == SCM_UNDEFINED) - { - trans_type = gh_eval_str(""); - /* don't really need this - types are bound globally anyway. */ - if(trans_type != SCM_UNDEFINED) scm_protect_object(trans_type); - } - - result = gnc_glist_to_scm_list(trans_list, trans_type); - - if (free_list) - g_list_free (trans_list); - - return result; -} - -SCM -gnc_glist_split_ptr_to_scm (GList *split_list) -{ - return gnc_glist_split_ptr_to_scm_internal (split_list, TRUE); -} - -SCM -gnc_glist_split_ptr_to_scm_no_free (GList *split_list) -{ - return gnc_glist_split_ptr_to_scm_internal (split_list, FALSE); -} - -GList * -gnc_scm_to_glist_split_ptr (SCM scm_list) -{ - return gnc_scm_list_to_glist (scm_list); -} - -int -gnc_glist_split_ptr_p (SCM list) -{ - return gh_list_p (list); -} - /******************************************************************** * gnc_scm_to_commodity ********************************************************************/ @@ -1989,80 +1825,3 @@ gnc_session_to_scm (GNCSession *session) return gw_wcp_assimilate_ptr ((void *) session, session_type); } -/******************************************************************** - * gnc_glist_commodity_ptr_to_scm - ********************************************************************/ -SCM -gnc_glist_commodity_ptr_to_scm(GList * l) -{ - static SCM commodity_type = SCM_UNDEFINED; - SCM result_list; - - if(commodity_type == SCM_UNDEFINED) { - commodity_type = gh_eval_str(""); - /* don't really need this - types are bound globally anyway. */ - if(commodity_type != SCM_UNDEFINED) scm_protect_object(commodity_type); - } - result_list = gnc_glist_to_scm_list(l, commodity_type); - g_list_free(l); - return result_list; -} - -/******************************************************************** - * gnc_scm_to_glist_commodity_ptr - ********************************************************************/ - -GList * -gnc_scm_to_glist_commodity_ptr(SCM scm_list) -{ - return gnc_scm_list_to_glist(scm_list); -} - -/******************************************************************** - * gnc_glist_commodity_ptr_p - ********************************************************************/ - -int -gnc_glist_commodity_ptr_p(SCM list) -{ - return gh_list_p(list); -} - -/******************************************************************** - * gnc_glist_price_ptr_to_scm - ********************************************************************/ -SCM -gnc_glist_price_ptr_to_scm(GList * l) -{ - static SCM price_type = SCM_UNDEFINED; - SCM result_list; - - if(price_type == SCM_UNDEFINED) { - price_type = gh_eval_str(""); - /* don't really need this - types are bound globally anyway. */ - if(price_type != SCM_UNDEFINED) scm_protect_object(price_type); - } - result_list = gnc_glist_to_scm_list(l, price_type); - g_list_free(l); - return result_list; -} - -/******************************************************************** - * gnc_scm_to_glist_price_ptr - ********************************************************************/ - -GList * -gnc_scm_to_glist_price_ptr(SCM scm_list) -{ - return gnc_scm_list_to_glist(scm_list); -} - -/******************************************************************** - * gnc_glist_price_ptr_p - ********************************************************************/ - -int -gnc_glist_price_ptr_p(SCM list) -{ - return gh_list_p(list); -}