* src/engine/engine-helpers.c: removed various glist processing

helpers -- now handled by g-wrap.  However g-wrap doesn't ATM
publish the glist->list and list->glist functions on the scheme
side.  If we need that, it can be added.


git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@6559 57a11ea4-9604-0410-9ed3-97b8803252fd
This commit is contained in:
Rob Browning 2002-01-09 21:39:49 +00:00
parent a61c6084e0
commit 7aaea61bca

View File

@ -24,7 +24,7 @@
#include "config.h"
#include <g-wrap-runtime-guile.h>
#include <g-wrap-wct.h>
#include <libguile.h>
#include <string.h>
@ -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("<gnc:Account*>");
/* 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("<gnc:Transaction*>");
/* 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("<gnc:Split*>");
/* 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("<gnc:commodity*>");
/* 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("<gnc:Price*>");
/* 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);
}