[Cruft Reduction] Remove unused functions from src/engine

Nothing in gnc-session-scm.c was being used, so deleted it and its corresponding header.

git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@21579 57a11ea4-9604-0410-9ed3-97b8803252fd
This commit is contained in:
John Ralls 2011-11-18 21:04:01 +00:00
parent e1ce730560
commit eeaa897be1
59 changed files with 153 additions and 1547 deletions

View File

@ -175,7 +175,6 @@ src/engine/gncOrder.c
src/engine/gncOwner.c
src/engine/gnc-pricedb.c
src/engine/gnc-session.c
src/engine/gnc-session-scm.c
src/engine/gncTaxTable.c
src/engine/gncVendor.c
src/engine/kvp-scm.c

View File

@ -83,12 +83,6 @@ gnc_get_gconf_path (void)
return gconf_path;
}
gint
gnc_get_svn_version (void)
{
return strtol(GNUCASH_SVN_REV, NULL, 10);
}
guint
gnc_get_long_version()
{

View File

@ -1504,14 +1504,14 @@ xaccAccountEqual(const Account *aa, const Account *ab, gboolean check_guids)
/********************************************************************\
\********************************************************************/
/*
gboolean
gnc_account_get_sort_dirty (Account *acc)
{
g_return_val_if_fail(GNC_IS_ACCOUNT(acc), FALSE);
return GET_PRIVATE(acc)->sort_dirty;
}
*/
void
gnc_account_set_sort_dirty (Account *acc)
{
@ -1525,14 +1525,14 @@ gnc_account_set_sort_dirty (Account *acc)
priv = GET_PRIVATE(acc);
priv->sort_dirty = TRUE;
}
/*
gboolean
gnc_account_get_balance_dirty (Account *acc)
{
g_return_val_if_fail(GNC_IS_ACCOUNT(acc), FALSE);
return GET_PRIVATE(acc)->balance_dirty;
}
*/
void
gnc_account_set_balance_dirty (Account *acc)
{
@ -1549,7 +1549,7 @@ gnc_account_set_balance_dirty (Account *acc)
/********************************************************************\
\********************************************************************/
/*
gboolean
gnc_account_find_split (Account *acc, Split *s)
{
@ -1563,7 +1563,7 @@ gnc_account_find_split (Account *acc, Split *s)
node = g_list_find(priv->splits, s);
return node ? TRUE : FALSE;
}
*/
gboolean
gnc_account_insert_split (Account *acc, Split *s)
{
@ -1682,7 +1682,7 @@ xaccAccountLookup (const GncGUID *guid, QofBook *book)
/********************************************************************\
\********************************************************************/
/*
short
xaccAccountGetMark (const Account *acc)
{
@ -1690,7 +1690,7 @@ xaccAccountGetMark (const Account *acc)
return GET_PRIVATE(acc)->mark;
}
*/
void
xaccAccountSetMark (Account *acc, short m)
{
@ -2812,7 +2812,7 @@ gnc_account_foreach_child (const Account *acc,
thunk (node->data, user_data);
}
}
/*
gpointer
gnc_account_foreach_child_until (const Account *acc,
AccountCb2 thunk,
@ -2835,7 +2835,7 @@ gnc_account_foreach_child_until (const Account *acc,
return NULL;
}
*/
void
gnc_account_foreach_descendant (const Account *acc,
AccountCb thunk,
@ -3036,7 +3036,7 @@ xaccAccountGetCommodity (const Account *acc)
/********************************************************************\
\********************************************************************/
/*
gnc_numeric
gnc_account_get_start_balance (Account *acc)
{
@ -3044,7 +3044,7 @@ gnc_account_get_start_balance (Account *acc)
return GET_PRIVATE(acc)->starting_balance;
}
*/
void
gnc_account_set_start_balance (Account *acc, const gnc_numeric start_baln)
{
@ -3056,7 +3056,7 @@ gnc_account_set_start_balance (Account *acc, const gnc_numeric start_baln)
priv->starting_balance = start_baln;
priv->balance_dirty = TRUE;
}
/*
gnc_numeric
gnc_account_get_start_cleared_balance (Account *acc)
{
@ -3064,7 +3064,7 @@ gnc_account_get_start_cleared_balance (Account *acc)
return GET_PRIVATE(acc)->starting_cleared_balance;
}
*/
void
gnc_account_set_start_cleared_balance (Account *acc,
const gnc_numeric start_baln)
@ -3077,7 +3077,7 @@ gnc_account_set_start_cleared_balance (Account *acc,
priv->starting_cleared_balance = start_baln;
priv->balance_dirty = TRUE;
}
/*
gnc_numeric
gnc_account_get_start_reconciled_balance (Account *acc)
{
@ -3085,7 +3085,7 @@ gnc_account_get_start_reconciled_balance (Account *acc)
return GET_PRIVATE(acc)->starting_reconciled_balance;
}
*/
void
gnc_account_set_start_reconciled_balance (Account *acc,
const gnc_numeric start_baln)
@ -3520,7 +3520,6 @@ xaccAccountGetClearedBalanceInCurrency (const Account *acc,
include_children);
}
gnc_numeric
xaccAccountGetReconciledBalanceInCurrency (const Account *acc,
const gnc_commodity *report_commodity,
@ -3994,7 +3993,7 @@ xaccAccountGetTypeStr(GNCAccountType type)
if (type < 0 || NUM_ACCOUNT_TYPES <= type ) return "";
return _(account_type_name [type]);
}
/*
GNCAccountType
xaccAccountGetTypeFromStr (const gchar *str)
{
@ -4011,7 +4010,7 @@ xaccAccountGetTypeFromStr (const gchar *str)
return ACCT_TYPE_INVALID;
}
*/
/********************************************************************\
\********************************************************************/
@ -4634,7 +4633,7 @@ xaccTransactionTraverse (Transaction *trans, int stage)
return FALSE;
}
/*
gboolean
xaccSplitTransactionTraverse (Split *split, int stage)
{
@ -4642,7 +4641,7 @@ xaccSplitTransactionTraverse (Split *split, int stage)
return xaccTransactionTraverse (split->parent, stage);
}
*/
static void do_one_split (Split *s, gpointer data)
{
Transaction *trans = s->parent;

View File

@ -357,9 +357,9 @@ void gnc_account_set_sort_dirty (Account *acc);
* @param s The split to be found.
*
* @result TRUE is the split is found in the accounts list of splits.
* FALSE otherwise. */
* FALSE otherwise.
gboolean gnc_account_find_split (Account *acc, Split *s);
*/
/** Insert the given split from an account.
*
* @param acc The account to which the split should be added.
@ -400,35 +400,35 @@ const char * xaccAccountGetNotes (const Account *account);
const char * xaccAccountGetLastNum (const Account *account);
/** Get the account's lot order policy */
GNCPolicy *gnc_account_get_policy (Account *account);
/** Retrieve the starting commodity balance for this account. */
/** Retrieve the starting commodity balance for this account.
gnc_numeric gnc_account_get_start_balance (Account *acc);
*/
/** Retrieve the starting cleared commodity balance for this
* account. */
* account.
gnc_numeric gnc_account_get_start_cleared_balance (Account *acc);
*/
/** Retrieve the starting reconciled commodity balance for this
* account. */
* account.
gnc_numeric gnc_account_get_start_reconciled_balance (Account *acc);
*/
/** Get an indication of whether the account believes that the running
* balances may be incorrect and need to be recomputed.
*
* @param acc Retrieve the flag on this account.
*
* @return TRUE if the running account balances need to be recomputed.
* FALSE if they are correct. */
* FALSE if they are correct.
gboolean gnc_account_get_balance_dirty (Account *acc);
*/
/** Get an indication of whether the account believes that the splits
* may be incorrectly sorted and need to be resorted.
*
* @param acc Retrieve the flag on this account.
*
* @return TRUE if the splits in the account need to be resorted.
* FALSE if the sort order is correct. */
* FALSE if the sort order is correct.
gboolean gnc_account_get_sort_dirty (Account *acc);
*/
/** The following recompute the partial balances (stored with the
* transaction) and the total balance, for this account
*/
@ -836,10 +836,10 @@ void gnc_account_foreach_child (const Account *account,
* @param func A function taking two arguments, an Account and a
* gpointer.
*
* @param user_data This data will be passed to each call of func. */
* @param user_data This data will be passed to each call of func.
gpointer gnc_account_foreach_child_until (const Account *account,
AccountCb2 func, /*@ null @*/ gpointer user_data);
AccountCb2 func, gpointer user_data);
*/
/** This method will traverse all children of this accounts and their
* descendants, calling 'func' on each account. This function
@ -975,9 +975,9 @@ GNCAccountType xaccAccountStringToEnum (const char* str);
const char * xaccAccountGetTypeStr (GNCAccountType type);
/** The xaccAccountGetTypeStr() routine returns a string suitable for
* use in the GUI/Interface. These strings should be translated
* to the local language. */
* to the local language.
GNCAccountType xaccAccountGetTypeFromStr (const gchar *str);
*/
/** Return the bitmask of parent account types compatible with a given type. */
guint32 xaccParentAccountTypesCompatibleWith (GNCAccountType type);
@ -1248,9 +1248,9 @@ void xaccAccountSetTaxUSCopyNumber (Account *account, gint64 copy_number);
*/
void xaccAccountSetMark (Account *account, short mark);
/** Get the mark set by xaccAccountSetMark */
/** Get the mark set by xaccAccountSetMark
short xaccAccountGetMark (const Account *account);
*/
/** The xaccClearMark will find the root account, and clear the mark in
* the entire account tree. */
void xaccClearMark (Account *account, short val);
@ -1327,9 +1327,9 @@ gboolean xaccTransactionTraverse(Transaction *trans, int stage);
/** xaccSplitTransactionTraverse() behaves as above using the parent of
* the given split.
*/
*
gboolean xaccSplitTransactionTraverse(Split *split, int stage);
*/
/** xaccAccountStagedTransactionTraversal() calls @a thunk on each
* transaction in account @a a whose current marker is less than the
* given @a stage and updates each transaction's marker to be @a stage.

View File

@ -41,7 +41,6 @@ SET (libgncmod_engine_HEADERS
gnc-event.h
gnc-hooks.h
gnc-pricedb.h
gnc-session-scm.h
gnc-session.h
kvp-scm.h
policy.h
@ -122,7 +121,6 @@ SET (libgncmod_engine_SOURCES
gnc-hooks.c
gnc-lot.c
gnc-pricedb.c
gnc-session-scm.c
gnc-session.c
gncmod-engine.c
kvp-scm.c

View File

@ -36,7 +36,6 @@ libgncmod_engine_la_SOURCES = \
gnc-lot.c \
gnc-pricedb.c \
gnc-session.c \
gnc-session-scm.c \
gncmod-engine.c \
swig-engine.c \
kvp-scm.c \
@ -89,7 +88,6 @@ gncinclude_HEADERS = \
gnc-hooks.h \
gnc-pricedb.h \
gnc-session.h \
gnc-session-scm.h \
kvp-scm.h \
policy.h \
gncAddress.h \

View File

@ -69,14 +69,18 @@ const char *gnc_ttsplitinfo_get_memo(TTSplitInfo *split_i);
void gnc_ttsplitinfo_set_credit_formula(TTSplitInfo *split_i,
const char *credit_formula);
void gnc_ttsplitinfo_set_credit_formula_numeric(TTSplitInfo *split_i,
gnc_numeric credit_formula);
const char *gnc_ttsplitinfo_get_credit_formula(TTSplitInfo *split_i);
void gnc_ttsplitinfo_set_debit_formula(TTSplitInfo *split_i,
const char *debit_formula);
void gnc_ttsplitinfo_set_debit_formula_numeric(TTSplitInfo *split_i,
gnc_numeric debit_formula);
const char *gnc_ttsplitinfo_get_debit_formula(TTSplitInfo *split_i);
void gnc_ttsplitinfo_set_account(TTSplitInfo *split_i, Account *acc);

View File

@ -768,28 +768,6 @@ gint gnc_sx_get_num_occur_daterange(const SchedXaction *sx, const GDate* start_d
return result;
}
KvpValue *
xaccSchedXactionGetSlot( const SchedXaction *sx, const char *slot )
{
if (!sx) return NULL;
return kvp_frame_get_slot(sx->inst.kvp_data, slot);
}
void
xaccSchedXactionSetSlot( SchedXaction *sx,
const char *slot,
const KvpValue *value )
{
if (!sx) return;
gnc_sx_begin_edit(sx);
kvp_frame_set_slot( sx->inst.kvp_data, slot, value );
qof_instance_set_dirty(&sx->inst);
gnc_sx_commit_edit(sx);
}
gboolean
xaccSchedXactionGetEnabled( const SchedXaction *sx )
{
@ -1167,18 +1145,6 @@ gnc_sx_incr_temporal_state(const SchedXaction *sx, SXTmpStateData *stateData )
tsd->num_inst += 1;
}
void
gnc_sx_revert_to_temporal_state( SchedXaction *sx, SXTmpStateData *stateData )
{
SXTmpStateData *tsd = (SXTmpStateData*)stateData;
gnc_sx_begin_edit(sx);
sx->last_date = tsd->last_date;
sx->num_occurances_remain = tsd->num_occur_rem;
sx->instance_num = tsd->num_inst;
qof_instance_set_dirty(&sx->inst);
gnc_sx_commit_edit(sx);
}
void
gnc_sx_destroy_temporal_state( SXTmpStateData *stateData )
{

View File

@ -246,13 +246,6 @@ SXTmpStateData *gnc_sx_create_temporal_state(const SchedXaction *sx );
* occurence in the remporalStateDate. The SX is unchanged. */
void gnc_sx_incr_temporal_state(const SchedXaction *sx, SXTmpStateData *stateData );
/** Sets the state of the given SX to the state of the given
* SXTmpStateData. In that sense, this function does not "revert"
* but instead it copies the state from the SXTmpStateData to the
* real SX.. */
void gnc_sx_revert_to_temporal_state( SchedXaction *sx,
SXTmpStateData *stateData );
/** Frees the given stateDate object. */
void gnc_sx_destroy_temporal_state( SXTmpStateData *stateData );
@ -337,15 +330,6 @@ gboolean SXRegister (void);
/** \deprecated */
#define xaccSchedXactionGetSlots(X) qof_instance_get_slots(QOF_INSTANCE(X))
/** \deprecated to be replaced with 'dirty' kvp's */
KvpValue *xaccSchedXactionGetSlot( const SchedXaction *sx,
const char *slot );
/** \deprecated to be replaced with 'dirty' kvp's */
void xaccSchedXactionSetSlot( SchedXaction *sx,
const char *slot,
const KvpValue *value );
#endif /* XACC_SCHEDXACTION_H */
/** @} */

View File

@ -239,73 +239,6 @@ is_subsplit (Split *split)
/* ================================================================= */
void
xaccScrubSubSplitPrice (Split *split, int maxmult, int maxamtscu)
{
gnc_numeric src_amt, src_val;
SplitList *node;
if (FALSE == is_subsplit (split)) return;
ENTER (" ");
/* Get 'price' of the indicated split */
src_amt = xaccSplitGetAmount (split);
src_val = xaccSplitGetValue (split);
/* Loop over splits, adjust each so that it has the same
* ratio (i.e. price). Change the value to get things
* right; do not change the amount */
for (node = split->parent->splits; node; node = node->next)
{
Split *s = node->data;
Transaction *txn = s->parent;
gnc_numeric dst_amt, dst_val, target_val;
gnc_numeric frac, delta;
int scu;
/* Skip the reference split */
if (s == split) continue;
scu = gnc_commodity_get_fraction (txn->common_currency);
dst_amt = xaccSplitGetAmount (s);
dst_val = xaccSplitGetValue (s);
frac = gnc_numeric_div (dst_amt, src_amt,
GNC_DENOM_AUTO, GNC_HOW_DENOM_REDUCE);
target_val = gnc_numeric_mul (frac, src_val,
scu, GNC_HOW_DENOM_EXACT | GNC_HOW_RND_ROUND_HALF_UP);
if (gnc_numeric_check (target_val))
{
PERR ("Numeric overflow of value\n"
"\tAcct=%s txn=%s\n"
"\tdst_amt=%s src_val=%s src_amt=%s\n",
xaccAccountGetName (s->acc),
xaccTransGetDescription(txn),
gnc_num_dbg_to_string(dst_amt),
gnc_num_dbg_to_string(src_val),
gnc_num_dbg_to_string(src_amt));
continue;
}
/* If the required price changes are 'small', do nothing.
* That is a case that the user will have to deal with
* manually. This routine is really intended only for
* a gross level of synchronization.
*/
delta = gnc_numeric_sub_fixed (target_val, dst_val);
delta = gnc_numeric_abs (delta);
if (maxmult * delta.num < delta.denom) continue;
/* If the amount is small, pass on that too */
if ((-maxamtscu < dst_amt.num) && (dst_amt.num < maxamtscu)) continue;
/* Make the actual adjustment */
xaccTransBeginEdit (txn);
xaccSplitSetValue (s, target_val);
xaccTransCommitEdit (txn);
}
LEAVE (" ");
}
/* ================================================================= */
@ -440,28 +373,6 @@ restart:
return rc;
}
gboolean
xaccScrubMergeTransSubSplits (Transaction *txn)
{
gboolean rc = FALSE;
SplitList *node;
if (!txn) return FALSE;
ENTER (" ");
restart:
for (node = txn->splits; node; node = node->next)
{
Split *s = node->data;
if (!xaccScrubMergeSubSplits(s)) continue;
rc = TRUE;
goto restart;
}
LEAVE (" splits merged=%d", rc);
return rc;
}
gboolean
xaccScrubMergeLotSubSplits (GNCLot *lot)
{

View File

@ -80,28 +80,6 @@ void xaccLotFill (GNCLot *lot);
*/
void xaccLotScrubDoubleBalance (GNCLot *lot);
/** If a split has been pulled apart to make it fit into two (or more)
* lots, then it becomes theoretically possible for each subsplit to
* have a distinct price. But this would be wrong: each subsplit should
* have the same price, within rounding errors. This routine will
* examine the indicated split for sub-splits, and adjust the value
* of each so that they all have the same price.
*
* There is a bit of a problem with the interpretation of 'rounding
* errors' because there are pathological corner cases of small
* amounts. So this routine is loose, hopefully loose enough so
* that the user can manually fine tune without having this routine
* clobber thier work.
*
* This routine ignores price differences smaller than 1/maxmult.
* This routine ignores price differences when the split with a crazy
* price involes only a small amount: specifically, an amount that
* is less than maxamtscu/amount.denom.
*
* Reasonable/recommended values might be maxmult=3, maxamtscu = 2.
*/
void xaccScrubSubSplitPrice (Split *split, int maxmult, int maxamtscu);
/** The xaccScrubMergeSubSplits() routine will merge together
* all of the splits that were at one time split off from this
* split, but are no longer needed to be kept separate. Splits
@ -120,7 +98,6 @@ void xaccScrubSubSplitPrice (Split *split, int maxmult, int maxamtscu);
* that it does it for all of the splits in the lot.
*/
gboolean xaccScrubMergeSubSplits (Split *split);
gboolean xaccScrubMergeTransSubSplits (Transaction *txn);
gboolean xaccScrubMergeLotSubSplits (GNCLot *lot);
#endif /* XACC_SCRUB2_H */

View File

@ -665,23 +665,6 @@ add_keys_to_list(gpointer key, gpointer val, gpointer list)
*(GList **)list = g_list_prepend(*(GList **)list, key);
}
GList *
xaccSplitListGetUniqueTransactions(const GList *splits)
{
const GList *node;
GList *transList = NULL;
GHashTable *transHash = g_hash_table_new(g_direct_hash, g_direct_equal);
for (node = splits; node; node = node->next)
{
Transaction *trans = xaccSplitGetParent((Split *)(node->data));
g_hash_table_insert(transHash, trans, trans);
}
g_hash_table_foreach(transHash, add_keys_to_list, &transList);
g_hash_table_destroy(transHash);
return transList;
}
/********************************************************************
* Account funcs
********************************************************************/
@ -920,7 +903,7 @@ xaccSplitGetSlots (const Split * s)
{
return qof_instance_get_slots(QOF_INSTANCE(s));
}
/* Used for testing only: _get_random_split in test-engine-stuff.c */
void
xaccSplitSetSlots_nc(Split *s, KvpFrame *frm)
{
@ -934,25 +917,6 @@ xaccSplitSetSlots_nc(Split *s, KvpFrame *frm)
/********************************************************************\
\********************************************************************/
void
DxaccSplitSetSharePriceAndAmount (Split *s, double price, double amt)
{
if (!s) return;
ENTER (" ");
xaccTransBeginEdit (s->parent);
s->amount = double_to_gnc_numeric(amt, get_commodity_denom(s),
GNC_HOW_RND_ROUND_HALF_UP);
s->value = double_to_gnc_numeric(price * amt, get_currency_denom(s),
GNC_HOW_RND_ROUND_HALF_UP);
SET_GAINS_A_VDIRTY(s);
mark_split (s);
qof_instance_set_dirty(QOF_INSTANCE(s));
xaccTransCommitEdit(s->parent);
LEAVE("");
}
void
xaccSplitSetSharePriceAndAmount (Split *s, gnc_numeric price, gnc_numeric amt)
{
@ -999,41 +963,6 @@ xaccSplitSetSharePrice (Split *s, gnc_numeric price)
LEAVE ("");
}
void
DxaccSplitSetShareAmount (Split *s, double damt)
{
gnc_numeric old_price, old_amt;
int commodity_denom = get_commodity_denom(s);
gnc_numeric amt = double_to_gnc_numeric(damt, commodity_denom,
GNC_HOW_RND_ROUND_HALF_UP);
if (!s) return;
ENTER (" ");
xaccTransBeginEdit (s->parent);
old_amt = xaccSplitGetAmount (s);
if (!gnc_numeric_zero_p(old_amt))
{
old_price = gnc_numeric_div(xaccSplitGetValue (s),
old_amt, GNC_DENOM_AUTO,
GNC_HOW_DENOM_REDUCE);
}
else
{
old_price = gnc_numeric_create(1, 1);
}
s->amount = gnc_numeric_convert(amt, commodity_denom,
GNC_HOW_RND_NEVER);
s->value = gnc_numeric_mul(s->amount, old_price,
get_currency_denom(s), GNC_HOW_RND_ROUND_HALF_UP);
SET_GAINS_A_VDIRTY(s);
mark_split (s);
qof_instance_set_dirty(QOF_INSTANCE(s));
xaccTransCommitEdit(s->parent);
LEAVE ("");
}
static void
qofSplitSetAmount (Split *split, gnc_numeric amt)
{
@ -1206,68 +1135,68 @@ xaccSplitGetBaseValue (const Split *s, const gnc_commodity * base_currency)
/********************************************************************\
\********************************************************************/
gnc_numeric
xaccSplitsComputeValue (GList *splits, const Split * skip_me,
const gnc_commodity * base_currency)
{
GList *node;
gnc_numeric value = gnc_numeric_zero();
/* gnc_numeric */
/* xaccSplitsComputeValue (GList *splits, const Split * skip_me, */
/* const gnc_commodity * base_currency) */
/* { */
/* GList *node; */
/* gnc_numeric value = gnc_numeric_zero(); */
g_return_val_if_fail (base_currency, value);
/* g_return_val_if_fail (base_currency, value); */
ENTER (" currency=%s", gnc_commodity_get_mnemonic (base_currency));
/* ENTER (" currency=%s", gnc_commodity_get_mnemonic (base_currency)); */
for (node = splits; node; node = node->next)
{
const Split *s = node->data;
const gnc_commodity *currency;
const gnc_commodity *commodity;
/* for (node = splits; node; node = node->next) */
/* { */
/* const Split *s = node->data; */
/* const gnc_commodity *currency; */
/* const gnc_commodity *commodity; */
if (s == skip_me) continue;
/* if (s == skip_me) continue; */
/* value = gnc_numeric_add(value, xaccSplitGetBaseValue(s, base_currency),
GNC_DENOM_AUTO, GNC_HOW_DENOM_LCD); */
/* /\* value = gnc_numeric_add(value, xaccSplitGetBaseValue(s, base_currency), */
/* GNC_DENOM_AUTO, GNC_HOW_DENOM_LCD); *\/ */
/* The split-editor often sends us 'temp' splits whose account
* hasn't yet been set. Be lenient, and assume an implied base
* currency. If there's a problem later, the scrub routines will
* pick it up.
*/
commodity = s->acc ? xaccAccountGetCommodity (s->acc) : base_currency;
currency = xaccTransGetCurrency (s->parent);
/* /\* The split-editor often sends us 'temp' splits whose account */
/* * hasn't yet been set. Be lenient, and assume an implied base */
/* * currency. If there's a problem later, the scrub routines will */
/* * pick it up. */
/* *\/ */
/* commodity = s->acc ? xaccAccountGetCommodity (s->acc) : base_currency; */
/* currency = xaccTransGetCurrency (s->parent); */
if (gnc_commodity_equiv(currency, base_currency))
{
value = gnc_numeric_add(value, xaccSplitGetValue(s),
GNC_DENOM_AUTO, GNC_HOW_DENOM_LCD);
}
else if (gnc_commodity_equiv(commodity, base_currency))
{
value = gnc_numeric_add(value, xaccSplitGetAmount(s),
GNC_DENOM_AUTO, GNC_HOW_DENOM_LCD);
}
else
{
PERR ("inconsistent currencies\n"
"\tbase = '%s', curr='%s', sec='%s'\n",
gnc_commodity_get_printname(base_currency),
gnc_commodity_get_printname(currency),
gnc_commodity_get_printname(commodity));
g_return_val_if_fail (FALSE, value);
}
}
/* if (gnc_commodity_equiv(currency, base_currency)) */
/* { */
/* value = gnc_numeric_add(value, xaccSplitGetValue(s), */
/* GNC_DENOM_AUTO, GNC_HOW_DENOM_LCD); */
/* } */
/* else if (gnc_commodity_equiv(commodity, base_currency)) */
/* { */
/* value = gnc_numeric_add(value, xaccSplitGetAmount(s), */
/* GNC_DENOM_AUTO, GNC_HOW_DENOM_LCD); */
/* } */
/* else */
/* { */
/* PERR ("inconsistent currencies\n" */
/* "\tbase = '%s', curr='%s', sec='%s'\n", */
/* gnc_commodity_get_printname(base_currency), */
/* gnc_commodity_get_printname(currency), */
/* gnc_commodity_get_printname(commodity)); */
/* g_return_val_if_fail (FALSE, value); */
/* } */
/* } */
/* Note that just because the currencies are equivalent
* doesn't mean the denominators are the same! */
value = gnc_numeric_convert(value,
gnc_commodity_get_fraction (base_currency),
GNC_HOW_RND_ROUND_HALF_UP);
/* /\* Note that just because the currencies are equivalent */
/* * doesn't mean the denominators are the same! *\/ */
/* value = gnc_numeric_convert(value, */
/* gnc_commodity_get_fraction (base_currency), */
/* GNC_HOW_RND_ROUND_HALF_UP); */
LEAVE (" total=%" G_GINT64_FORMAT "/%" G_GINT64_FORMAT,
value.num, value.denom);
return value;
}
/* LEAVE (" total=%" G_GINT64_FORMAT "/%" G_GINT64_FORMAT, */
/* value.num, value.denom); */
/* return value; */
/* } */
gnc_numeric
xaccSplitConvertAmount (const Split *split, const Account * account)
@ -1444,7 +1373,6 @@ xaccSplitOrderDateOnly (const Split *sa, const Split *sb)
return -1;
}
static gboolean
get_corr_account_split(const Split *sa, const Split **retval)
{
@ -1487,22 +1415,6 @@ get_corr_account_split(const Split *sa, const Split **retval)
}
/* TODO: these static consts can be shared. */
const char *
xaccSplitGetCorrAccountName(const Split *sa)
{
static const char *split_const = NULL;
const Split *other_split;
if (!get_corr_account_split(sa, &other_split))
{
if (!split_const)
split_const = _("-- Split Transaction --");
return split_const;
}
return xaccAccountGetName(other_split->acc);
}
char *
xaccSplitGetCorrAccountFullName(const Split *sa)
@ -1974,12 +1886,6 @@ xaccSplitGetOtherSplit (const Split *split)
/********************************************************************\
\********************************************************************/
gboolean
xaccIsPeerSplit (const Split *sa, const Split *sb)
{
return (sa && sb && (sa->parent == sb->parent));
}
gnc_numeric
xaccSplitVoidFormerAmount(const Split *split)
{

View File

@ -143,9 +143,9 @@ void xaccSplitSetLot(Split* split, GNCLot* lot);
KvpFrame *xaccSplitGetSlots(const Split *split);
/** Set the KvpFrame slots of this split to the given frm by directly
* using the frm pointer (i.e. non-copying). */
* using the frm pointer (i.e. non-copying).
void xaccSplitSetSlots_nc(Split *s, KvpFrame *frm);
*/
/** The memo is an arbitrary string associated with a split. It is
* intended to hold a short (zero to forty character) string that is
@ -314,9 +314,6 @@ gnc_numeric xaccSplitGetReconciledBalance (const Split *split);
@{
*/
/* Get a GList of unique transactions containing the given list of Splits. */
GList *xaccSplitListGetUniqueTransactions(const GList *splits);
/** Equality.
*
* @param sa First split to compare
@ -356,9 +353,9 @@ Split * xaccSplitGetOtherSplit (const Split *split);
/** The xaccIsPeerSplit() is a convenience routine that returns TRUE
* (a non-zero value) if the two splits share a common parent
* transaction, else it returns FALSE (zero).
*/
*
gboolean xaccIsPeerSplit (const Split *split_1, const Split *split_2);
*/
/** Returns the split type, which is either the string "normal", or
* "stock-split" for a split from a stock split (pun intended? :-). */
const char *xaccSplitGetType(const Split *s);
@ -420,8 +417,6 @@ int xaccSplitCompareOtherAccountCodes(const Split *sa, const Split *sb);
char * xaccSplitGetCorrAccountFullName(const Split *sa);
/** document me */
const char * xaccSplitGetCorrAccountName(const Split *sa);
/** document me */
const char * xaccSplitGetCorrAccountCode(const Split *sa);
#ifdef DUMP_FUNCTIONS

View File

@ -295,136 +295,5 @@ xaccTransWriteLog (Transaction *trans, char flag)
fflush (trans_log);
}
/********************************************************************\
\********************************************************************/
#if 0
/* open_memstream seems to give various distros fits
* this has resulted in warfare on the mailing list.
* I think the truce called required changing this to asprintf
* this code is not currently used ... so its ifdef out
*/
char *
xaccSplitAsString(Split *split, const char prefix[])
{
char *result = NULL;
size_t result_size;
FILE *stream = open_memstream(&result, &result_size);
const char *split_memo = xaccSplitGetMemo(split);
const double split_value = gnc_numeric_to_double(xaccSplitGetValue(split));
Account *split_dest = xaccSplitGetAccount(split);
const char *dest_name =
split_dest ? xaccAccountGetName(split_dest) : NULL;
g_return_val_if_fail (stream, NULL);
fputc('\n', stream);
fputs(prefix, stream);
fprintf(stream, " %10.2f | %15s | %s",
split_value,
dest_name ? dest_name : "<no-account-name>",
split_memo ? split_memo : "<no-split-memo>");
fclose(stream);
return(result);
}
static char *
xaccTransGetDateStr (Transaction *trans)
{
char buf [MAX_DATE_LENGTH];
struct tm *date;
time_t secs;
secs = xaccTransGetDate (trans);
date = localtime (&secs);
qof_print_date_buff(buf, date->tm_mday, date->tm_mon + 1, date->tm_year + 1900);
return g_strdup (buf);
}
char *
xaccTransAsString(Transaction *txn, const char prefix[])
{
char *result = NULL;
size_t result_size;
FILE *stream = open_memstream(&result, &result_size);
time_t date = xaccTransGetDate(txn);
const char *num = xaccTransGetNum(txn);
const char *desc = xaccTransGetDescription(txn);
const char *memo = xaccSplitGetMemo(xaccTransGetSplit(txn, 0));
const double total = gnc_numeric_to_double(xaccSplitGetValue(xaccTransGetSplit(txn, 0)));
g_return_val_if_fail (stream, NULL);
fputs(prefix, stream);
if (date)
{
char *datestr = xaccTransGetDateStr(txn);
fprintf(stream, "%s", datestr);
free(datestr);
}
else
{
fprintf(stream, "<no-date>");
}
fputc(' ', stream);
if (num)
{
fputs(num, stream);
}
else
{
fprintf(stream, "<no-num>");
}
fputc('\n', stream);
fputs(prefix, stream);
if (desc)
{
fputs(" ", stream);
fputs(desc, stream);
}
else
{
fprintf(stream, "<no-description>");
}
fputc('\n', stream);
fputs(prefix, stream);
if (memo)
{
fputs(" ", stream);
fputs(memo, stream);
}
else
{
fprintf(stream, "<no-transaction-memo>");
}
{
int split_count = xaccTransCountSplits(txn);
int i;
for (i = 1; i < split_count; i++)
{
Split *split = xaccTransGetSplit(txn, i);
char *split_text = xaccSplitAsString(split, prefix);
fputs(split_text, stream);
free(split_text);
}
}
fputc('\n', stream);
fputs(prefix, stream);
fprintf(stream, " %10.2f -- Transaction total\n", total);
fclose(stream);
return(result);
}
#endif
/************************ END OF ************************************\
\************************* FILE *************************************/

View File

@ -449,38 +449,6 @@ xaccMallocTransaction (QofBook *book)
return trans;
}
#ifdef DUMP_FUNCTIONS
void
xaccTransDump (const Transaction *trans, const char *tag)
{
GList *node;
printf("%s Trans %p", tag, trans);
printf(" Entered: %s\n", gnc_print_date(trans->date_entered));
printf(" Posted: %s\n", gnc_print_date(trans->date_posted));
printf(" Num: %s\n", trans->num ? trans->num : "(null)");
printf(" Description: %s\n",
trans->description ? trans->description : "(null)");
printf(" Currency: %s\n",
gnc_commodity_get_printname(trans->common_currency));
printf(" version: %x\n", qof_instance_get_version(trans));
printf(" version_chk: %x\n", qof_instance_get_version_check(trans));
printf(" editlevel: %x\n", qof_instance_get_editlevel(trans));
printf(" orig: %p\n", trans->orig);
printf(" idata: %x\n", qof_instance_get_idata(trans));
printf(" splits: ");
for (node = trans->splits; node; node = node->next)
{
printf("%p ", node->data);
}
printf("\n");
for (node = trans->splits; node; node = node->next)
{
xaccSplitDump(node->data, tag);
}
printf("\n");
}
#endif
void
xaccTransSortSplits (Transaction *trans)

View File

@ -613,10 +613,6 @@ Timespec xaccTransGetVoidTime(const Transaction *tr);
#define TRANS_SPLITLIST "split-list" /* for guid_match_all */
/**@}*/
#ifdef DUMP_FUNCTIONS
void xaccTransDump (const Transaction *trans, const char *tag);
#endif
#define RECONCILED_MATCH_TYPE "reconciled-match"
/** \deprecated */

View File

@ -70,18 +70,6 @@ gnc_split_get_date_reconciled(const Split *s)
return(result);
}
void
gnc_transaction_set_date_posted(Transaction *t, const Timespec d)
{
xaccTransSetDatePostedTS(t, &d);
}
void
gnc_transaction_set_date_entered(Transaction *t, const Timespec d)
{
xaccTransSetDateEnteredTS(t, &d);
}
void
gnc_transaction_set_date(Transaction *t, Timespec ts)
{
@ -2433,9 +2421,3 @@ gnc_book_to_scm (const QofBook *book)
{
return gnc_generic_to_scm(book, "_p_QofBook");
}
SCM
qof_session_to_scm (const QofSession *session)
{
return gnc_generic_to_scm(session, "_p_QofSession");
}

View File

@ -38,9 +38,6 @@ Timespec gnc_transaction_get_date_entered(const Transaction *t);
Timespec gnc_split_get_date_reconciled(const Split *s);
void gnc_transaction_set_date_posted(Transaction *t, const Timespec d);
void gnc_transaction_set_date_entered(Transaction *t, const Timespec d);
void gnc_transaction_set_date(Transaction *t, Timespec ts);
/* Helpers for various types */
@ -73,6 +70,5 @@ int gnc_numeric_p(SCM arg);
gnc_commodity * gnc_scm_to_commodity(SCM scm);
SCM gnc_commodity_to_scm (const gnc_commodity *commodity);
SCM gnc_book_to_scm (const QofBook *book);
SCM qof_session_to_scm (const QofSession *session);
#endif

View File

@ -12,7 +12,6 @@
#include "gnc-filepath-utils.h"
#include "gnc-pricedb.h"
#include "gnc-lot.h"
#include "gnc-session-scm.h"
#include "gnc-hooks-scm.h"
#include "engine-helpers.h"
#include "SX-book.h"
@ -156,7 +155,6 @@ void gnc_quote_source_set_fq_installed (GList *sources_list);
%ignore gnc_quote_source_set_fq_installed;
%include <gnc-commodity.h>
%include <gnc-session-scm.h>
void gnc_hook_add_scm_dangler (const gchar *name, SCM proc);
void gnc_hook_run (const gchar *name, gpointer data);
%include <gnc-hooks.h>

View File

@ -243,31 +243,6 @@ gnc_tracking_associate_income_accounts(Account *stock_account,
* *
* Returns : void *
\*********************************************************************/
void
gnc_tracking_asssociate_expense_account(Account *stock_account,
GNCTrackingExpenseCategory category,
GList *account_list)
{
KvpFrame *account_frame, *expense_acc_frame;
KvpValue *kvpd_on_account_list;
g_return_if_fail(stock_account);
g_return_if_fail(xaccAccountIsPriced(stock_account));
account_frame = xaccAccountGetSlots(stock_account);
g_return_if_fail(account_frame);
g_return_if_fail(category >= 0);
g_return_if_fail(category < GNC_TR_EXP_N_CATEGORIES);
expense_acc_frame = get_assoc_acc_frame(account_frame);
kvpd_on_account_list = make_kvpd_on_list(account_list);
back_associate_expense_accounts(stock_account, account_list, category);
kvp_frame_set_slot_nc(expense_acc_frame,
expense_to_key[category],
kvpd_on_account_list);
}
/*********************************************************************\
* gnc_tracking_find_expense_accounts *
* find out which accounts are associated with a particular *

View File

@ -58,11 +58,6 @@ void gnc_tracking_associate_income_accounts(Account *stock_account,
GNCTrackingIncomeCategory category,
AccountList *account_list);
void gnc_tracking_asssociate_expense_account(Account *stock_account,
GNCTrackingExpenseCategory category,
AccountList *account_list);
/*
* returns a list of account *'s,
* returns null if no association specified

View File

@ -526,34 +526,6 @@ gnc_budget_set_account_period_value(GncBudget *budget, const Account *account,
/* We don't need these here, but maybe they're useful somewhere else?
Maybe this should move to Account.h */
#if 0
static gpointer
is_same_commodity(Account *a, gpointer data)
{
gnc_commodity *acct_comm;
gnc_commodity *comm;
g_return_val_if_fail(data, NULL);
// What? No type-checking macro?
comm = (gnc_commodity *) data;
acct_comm = xaccAccountGetCommodity(a);
return gnc_commodity_equal(comm, acct_comm) ? NULL : data;
}
static gboolean
xaccAccountChildrenHaveSameCommodity(Account *account)
{
gpointer different;
gnc_commodity *comm;
comm = xaccAccountGetCommodity(account);
different =
gnc_account_foreach_descendant_until(account, is_same_commodity, comm);
return (different == NULL);
}
#endif
gboolean
gnc_budget_is_account_period_value_set(const GncBudget *budget, const Account *account,
@ -623,13 +595,6 @@ gnc_budget_get_account_period_actual_value(
acc, period_num);
}
QofBook*
gnc_budget_get_book(const GncBudget* budget)
{
g_return_val_if_fail(GNC_IS_BUDGET(budget), NULL);
return qof_instance_get_book(&budget->inst);
}
GncBudget*
gnc_budget_lookup (const GncGUID *guid, const QofBook *book)
{

View File

@ -150,9 +150,6 @@ gnc_numeric gnc_budget_get_account_period_value(
gnc_numeric gnc_budget_get_account_period_actual_value(
const GncBudget *budget, Account *account, guint period_num);
/** Get the book that this budget is associated with. */
QofBook* gnc_budget_get_book(const GncBudget* budget);
/* Returns some budget in the book, or NULL. */
GncBudget* gnc_budget_get_default(QofBook *book);

View File

@ -479,19 +479,6 @@ gnc_quote_source_get_user_name (const gnc_quote_source *source)
return source->user_name;
}
const char *
gnc_quote_source_get_old_internal_name (const gnc_quote_source *source)
{
ENTER("%p", source);
if (!source)
{
LEAVE("bad source");
return NULL;
}
LEAVE("old internal name %s", source->old_internal_name);
return source->old_internal_name;
}
const char *
gnc_quote_source_get_internal_name (const gnc_quote_source *source)
{
@ -1625,14 +1612,6 @@ gnc_commodity_obtain_twin (const gnc_commodity *from, QofBook *book)
* get the size of the commodity table
********************************************************************/
guint
gnc_commodity_table_get_number_of_namespaces(const gnc_commodity_table* tbl)
{
g_return_val_if_fail(tbl, 0);
g_return_val_if_fail(tbl->ns_table, 0);
return g_hash_table_size(tbl->ns_table);
}
static void
count_coms(gpointer key, gpointer value, gpointer user_data)
{
@ -2157,17 +2136,6 @@ gnc_commodity_find_commodity_by_guid(const GncGUID *guid, QofBook *book)
return (gnc_commodity *) qof_collection_lookup_entity (col, guid);
}
gnc_commodity_namespace *
gnc_commodity_find_namespace_by_guid(const GncGUID *guid, QofBook *book)
{
QofCollection *col;
if (!guid || !book) return NULL;
col = qof_book_get_collection (book, GNC_ID_COMMODITY_NAMESPACE);
return (gnc_commodity_namespace *) qof_collection_lookup_entity (col, guid);
}
/********************************************************************
* gnc_commodity_table_delete_namespace
* delete a namespace
@ -2291,68 +2259,6 @@ gnc_commodity_table_destroy(gnc_commodity_table * t)
/* =========================================================== */
static gboolean
table_equal_helper (gnc_commodity *cm_1, gpointer user_data)
{
gnc_commodity_table *t_2 = user_data;
gnc_commodity *cm_2;
cm_2 = gnc_commodity_table_lookup (t_2,
gnc_commodity_get_namespace (cm_1),
gnc_commodity_get_mnemonic (cm_1));
if (!cm_2)
{
PWARN ("one has commodity %s, the other does not",
gnc_commodity_get_unique_name (cm_1));
return FALSE;
}
return gnc_commodity_equal (cm_1, cm_2);
}
gboolean
gnc_commodity_table_equal(gnc_commodity_table *t_1,
gnc_commodity_table *t_2)
{
gboolean ok;
if (t_1 == t_2) return TRUE;
if (!t_1 || !t_2) return FALSE;
ok = gnc_commodity_table_foreach_commodity (t_1, table_equal_helper, t_2);
if (!ok)
return FALSE;
return gnc_commodity_table_foreach_commodity (t_2, table_equal_helper, t_1);
}
/* =========================================================== */
typedef struct
{
gnc_commodity_table *dest;
QofBook *dest_book;
} table_copy_helper_data;
static gboolean
table_copy_helper (gnc_commodity *src_cm, gpointer user_data)
{
table_copy_helper_data *data = user_data;
gnc_commodity_table_insert (data->dest,
gnc_commodity_clone (src_cm, data->dest_book));
return TRUE;
}
void
gnc_commodity_table_copy(gnc_commodity_table *dest,
gnc_commodity_table *src,
QofBook *dest_book)
{
table_copy_helper_data data = {dest, dest_book};
gnc_commodity_table_foreach_commodity (src, table_copy_helper, &data);
}
/********************************************************************
* gnc_commodity_table_add_default_data
********************************************************************/

View File

@ -245,19 +245,6 @@ const char *gnc_quote_source_get_user_name (const gnc_quote_source *source);
/*@ dependent @*/
const char *gnc_quote_source_get_internal_name (const gnc_quote_source *source);
/** Given a gnc_quote_source data structure, return the internal name
* of this quote source. This is the name used by both gnucash and
* by Finance::Quote. E.G. "yahoo_australia" or "australia"
*
* @note This routine should only be used for backward compatability
* with the existing XML files. The rest of the code should use the
* gnc_quote_source_lookup_by_internal() routine.
*
* @param source The quote source in question.
*
* @return The internal name.
*/
const char *gnc_quote_source_get_old_internal_name (const gnc_quote_source *source);
/** @} */
@ -696,14 +683,6 @@ gboolean gnc_commodity_is_currency(const gnc_commodity *cm);
/*@ dependent @*/
gnc_commodity_table * gnc_commodity_table_get_table(QofBook *book);
/** compare two tables for equality */
gboolean gnc_commodity_table_equal(gnc_commodity_table *t_1,
gnc_commodity_table *t_2);
/** copy all commodities from src table to dest table */
void gnc_commodity_table_copy(gnc_commodity_table *dest,
gnc_commodity_table *src,
QofBook *dest_book);
/** @} */
/* ---------------------------------------------------------- */
/** @name Commodity Table Lookup functions
@ -720,8 +699,8 @@ gnc_commodity * gnc_commodity_table_find_full(const gnc_commodity_table * t,
const char * fullname);
/*@ dependent @*/
gnc_commodity * gnc_commodity_find_commodity_by_guid(const GncGUID *guid, QofBook *book);
gnc_commodity_namespace * gnc_commodity_find_namespace_by_guid(const GncGUID *guid, QofBook *book);
gnc_commodity * gnc_commodity_find_commodity_by_guid(const GncGUID *guid,
QofBook *book);
/** @} */
/* ---------------------------------------------------------- */
@ -791,13 +770,6 @@ const char * gnc_commodity_namespace_get_name (const gnc_commodity_namespace *ns
GList * gnc_commodity_namespace_get_commodity_list(const gnc_commodity_namespace * ns);
/** Return a count of the number of namespaces in the commodity table.
* This count includes both system and user defined namespaces.
*
* @return The number of namespaces. Zero if an invalid argument was
* supplied or there was an error. */
guint gnc_commodity_table_get_number_of_namespaces(const gnc_commodity_table* tbl);
/** Test to see if the indicated namespace exits in the commodity table.
*
* @param table A pointer to the commodity table

View File

@ -124,14 +124,6 @@ gnc_engine_init(int argc, char ** argv)
gnc_engine_init_part3(argc, argv);
}
void
gnc_engine_init_static(int argc, char ** argv)
{
gnc_engine_init_part1();
gnc_engine_init_part3(argc, argv);
}
/********************************************************************
* gnc_engine_shutdown
* shutdown backend, destroy any global data, etc.

View File

@ -225,13 +225,6 @@ typedef void (* gnc_engine_init_hook_t)(int, char **);
* method that does not require Guile. */
void gnc_engine_init(int argc, char ** argv);
/** This is the statically linked-in version of gnc_engine_init. It is
* identically to that function except that it doesn't load the
* loadable shared module, which means this function will not load the
* "(gnucash engine)" scheme module.
*/
void gnc_engine_init_static(int argc, char ** argv);
/** Called to shutdown the engine, see also ::qof_close
* for use without Guile. */
void gnc_engine_shutdown (void);

View File

@ -106,23 +106,6 @@ gnc_hook_lookup (const gchar *name)
return(hook);
}
gchar *
gnc_hook_get_description(const gchar *name)
{
GncHook *hook;
ENTER("name %s", name);
hook = gnc_hook_lookup(name);
if (!hook)
{
LEAVE("No hook found");
return "";
}
LEAVE("desc: %s", hook->desc);
return (gchar*) hook->desc;
}
void
gnc_hook_add_dangler (const gchar *name, GFunc callback, gpointer cb_arg)
{
@ -237,34 +220,6 @@ hook_remove_scm_runner (GHook *hook, gpointer data)
return(scm_is_true(res));
}
void
gnc_hook_del_scm_dangler (const gchar *name, SCM proc)
{
GncHook *gnc_hook;
GHook *hook;
GncScmDangler scm;
ENTER("name %s, proc ???", name);
scm.proc = proc;
gnc_hook = gnc_hook_lookup(name);
if (gnc_hook == NULL)
{
LEAVE("Unknown hook list %s", name);
return;
}
hook = g_hook_find(gnc_hook->scm_danglers, TRUE, hook_remove_scm_runner, &scm);
if (hook == NULL)
{
LEAVE("Hook dangler not found");
return;
}
g_hook_destroy_link(gnc_hook->scm_danglers, hook);
LEAVE("Removed dangler from %s", name);
}
static void
call_c_hook (GHook *hook, gpointer data)
{

View File

@ -32,12 +32,6 @@
*/
gchar * gnc_hook_create(const gchar *name, gint num_args, const gchar *desc);
/**
* lookup the description of a hook. returned description belongs to
* the hook and not the caller
*/
gchar * gnc_hook_get_description(const gchar *name);
/**
* add and remove C-style dangers from a hook. The callback is called
* function(hook_run_data, cb_data)

View File

@ -322,26 +322,6 @@ gnc_lot_set_account(GNCLot* lot, Account* account)
}
}
unsigned char
gnc_lot_get_marker(const GNCLot* lot)
{
LotPrivate* priv;
if (lot == NULL) return 0;
priv = GET_PRIVATE(lot);
return priv->marker;
}
void
gnc_lot_set_marker(GNCLot* lot, unsigned char m)
{
LotPrivate* priv;
if (lot != NULL)
{
priv = GET_PRIVATE(lot);
priv->marker = m;
}
}
void
gnc_lot_set_closed_unknown(GNCLot* lot)
{

View File

@ -164,8 +164,6 @@ const char * gnc_lot_get_title (const GNCLot *);
const char * gnc_lot_get_notes (const GNCLot *);
void gnc_lot_set_title (GNCLot *, const char *);
void gnc_lot_set_notes (GNCLot *, const char *);
unsigned char gnc_lot_get_marker(const GNCLot*);
void gnc_lot_set_marker(GNCLot*, unsigned char);
/** Every lot has a place to hang kvp data. This routine returns that
* place.

View File

@ -1604,58 +1604,6 @@ lookup_day(gpointer key, gpointer val, gpointer user_data)
}
}
PriceList *
gnc_pricedb_lookup_day_any_currency(GNCPriceDB *db,
const gnc_commodity *c,
Timespec t)
{
GList *result = NULL;
GHashTable *currency_hash;
GNCPriceLookupHelper lookup_helper;
QofBook *book;
QofBackend *be;
if (!db || !c) return NULL;
ENTER ("db=%p commodity=%p", db, c);
book = qof_instance_get_book(&db->inst);
be = qof_book_get_backend(book);
/* Convert to noon local time. */
t = timespecCanonicalDayTime(t);
#ifdef GNUCASH_MAJOR_VERSION
if (be && be->price_lookup)
{
GNCPriceLookup pl;
pl.type = LOOKUP_AT_TIME;
pl.prdb = db;
pl.commodity = c;
pl.currency = NULL; /* can the backend handle this??? */
pl.date = t;
(be->price_lookup) (be, &pl);
}
#endif
currency_hash = g_hash_table_lookup(db->commodity_hash, c);
if (!currency_hash)
{
LEAVE ("no currency hash");
return NULL;
}
lookup_helper.return_list = &result;
lookup_helper.time = t;
g_hash_table_foreach(currency_hash, lookup_day, &lookup_helper);
if (!result)
{
LEAVE (" ");
return NULL;
}
result = g_list_sort(result, compare_prices_by_date);
LEAVE (" ");
return result;
}
PriceList *
gnc_pricedb_lookup_at_time(GNCPriceDB *db,
@ -1739,57 +1687,6 @@ lookup_time(gpointer key, gpointer val, gpointer user_data)
}
}
PriceList *
gnc_pricedb_lookup_at_time_any_currency(GNCPriceDB *db,
const gnc_commodity *c,
Timespec t)
{
GList *result = NULL;
GHashTable *currency_hash;
GNCPriceLookupHelper lookup_helper;
QofBook *book;
QofBackend *be;
if (!db || !c) return NULL;
ENTER ("db=%p commodity=%p", db, c);
book = qof_instance_get_book(&db->inst);
be = qof_book_get_backend(book);
#ifdef GNUCASH_MAJOR_VERSION
if (be && be->price_lookup)
{
GNCPriceLookup pl;
pl.type = LOOKUP_AT_TIME;
pl.prdb = db;
pl.commodity = c;
pl.currency = NULL; /* can the backend handle this??? */
pl.date = t;
(be->price_lookup) (be, &pl);
}
#endif
currency_hash = g_hash_table_lookup(db->commodity_hash, c);
if (!currency_hash)
{
LEAVE (" no currency hash");
return NULL;
}
lookup_helper.return_list = &result;
lookup_helper.time = t;
g_hash_table_foreach(currency_hash, lookup_time, &lookup_helper);
if (!result)
{
LEAVE (" ");
return NULL;
}
result = g_list_sort(result, compare_prices_by_date);
LEAVE (" ");
return result;
}
GNCPrice *
gnc_pricedb_lookup_nearest_in_time(GNCPriceDB *db,
const gnc_commodity *c,
@ -2344,106 +2241,6 @@ gnc_pricedb_convert_balance_nearest_price(GNCPriceDB *pdb,
}
gnc_numeric
gnc_pricedb_convert_balance_latest_before(GNCPriceDB *pdb,
gnc_numeric balance,
gnc_commodity *balance_currency,
gnc_commodity *new_currency,
Timespec t)
{
GNCPrice *price, *currency_price;
GList *price_list, *list_helper;
gnc_numeric currency_price_value;
gnc_commodity *intermediate_currency;
if (gnc_numeric_zero_p (balance) ||
gnc_commodity_equiv (balance_currency, new_currency))
return balance;
/* Look for a direct price. */
price = gnc_pricedb_lookup_latest_before (pdb, balance_currency, new_currency, t);
if (price)
{
balance = gnc_numeric_mul (balance, gnc_price_get_value (price),
gnc_commodity_get_fraction (new_currency),
GNC_HOW_RND_ROUND_HALF_UP);
gnc_price_unref (price);
return balance;
}
/* Look for a price of the new currency in the balance currency and use
* the reciprocal if we find it.
*/
price = gnc_pricedb_lookup_latest_before (pdb, new_currency, balance_currency, t);
if (price)
{
balance = gnc_numeric_div (balance, gnc_price_get_value (price),
gnc_commodity_get_fraction (new_currency),
GNC_HOW_RND_ROUND_HALF_UP);
gnc_price_unref (price);
return balance;
}
/*
* no direct price found, try if we find a price in another currency
* and convert in two stages
*/
price_list = gnc_pricedb_lookup_latest_before_any_currency(pdb, balance_currency, t);
if (!price_list)
{
balance = gnc_numeric_zero ();
return balance;
}
list_helper = price_list;
currency_price_value = gnc_numeric_zero();
do
{
price = (GNCPrice *)(list_helper->data);
intermediate_currency = gnc_price_get_currency(price);
currency_price = gnc_pricedb_lookup_latest_before(pdb, intermediate_currency,
new_currency, t);
if (currency_price)
{
currency_price_value = gnc_price_get_value(currency_price);
gnc_price_unref(currency_price);
}
else
{
currency_price = gnc_pricedb_lookup_nearest_in_time(pdb, new_currency,
intermediate_currency, t);
if (currency_price)
{
/* here we need the reciprocal */
currency_price_value = gnc_numeric_div(gnc_numeric_create(1, 1),
gnc_price_get_value(currency_price),
gnc_commodity_get_fraction (new_currency),
GNC_HOW_RND_ROUND_HALF_UP);
gnc_price_unref(currency_price);
}
}
list_helper = list_helper->next;
}
while ((list_helper != NULL) &&
(gnc_numeric_zero_p(currency_price_value)));
balance = gnc_numeric_mul (balance, currency_price_value,
gnc_commodity_get_fraction (new_currency),
GNC_HOW_RND_ROUND_HALF_UP);
balance = gnc_numeric_mul (balance, gnc_price_get_value (price),
gnc_commodity_get_fraction (new_currency),
GNC_HOW_RND_ROUND_HALF_UP);
gnc_price_list_destroy(price_list);
return balance;
}
/* ==================================================================== */
/* gnc_pricedb_foreach_price infrastructure
*/

View File

@ -346,13 +346,6 @@ PriceList * gnc_pricedb_lookup_at_time(GNCPriceDB *db,
const gnc_commodity *currency,
Timespec t);
/** gnc_pricedb_lookup_at_time_any_currency - return all prices that match the
given commodity and timespec in any available currency. Prices will be
returned as a GNCPrice list (see above). */
PriceList * gnc_pricedb_lookup_at_time_any_currency(GNCPriceDB *db,
const gnc_commodity *c,
Timespec t);
/** gnc_pricedb_lookup_day - return all prices that match the given
commodity, currency, and timespec. Prices will be returned as a
GNCPrice list (see above). */
@ -361,12 +354,6 @@ PriceList * gnc_pricedb_lookup_day(GNCPriceDB *db,
const gnc_commodity *currency,
Timespec t);
/** gnc_pricedb_lookup_day_any_currency - return all prices that match the
given commodity and timespec in any available currency. Prices will be
returned as a GNCPrice list (see above). */
PriceList * gnc_pricedb_lookup_day_any_currency(GNCPriceDB *db,
const gnc_commodity *c,
Timespec t);
/** gnc_pricedb_lookup_nearest_in_time - return the price for the given
commodity in the given currency nearest to the given time t. */
@ -413,16 +400,6 @@ gnc_pricedb_convert_balance_nearest_price(GNCPriceDB *pdb,
const gnc_commodity *new_currency,
Timespec t);
/** gnc_pricedb_convert_balance_latest_before - Convert a balance from one currency
to another using the lastest price prior to Timespec t. */
gnc_numeric
gnc_pricedb_convert_balance_latest_before(GNCPriceDB *pdb,
gnc_numeric balance,
gnc_commodity *balance_currency,
gnc_commodity *new_currency,
Timespec t);
/** gnc_pricedb_foreach_price - call f once for each price in db, until
and unless f returns FALSE. If stable_order is not FALSE, make
sure the ordering of the traversal is stable (i.e. the same order
@ -434,10 +411,11 @@ gboolean gnc_pricedb_foreach_price(GNCPriceDB *db,
gpointer user_data,
gboolean stable_order);
/* The following two convenience functions are used to test the xml backend */
/** gnc_pricedb_get_num_prices - return the number of prices
in the database. */
guint gnc_pricedb_get_num_prices(GNCPriceDB *db);
/** gnc_pricedb_equal - test equality of two pricedbs */
gboolean gnc_pricedb_equal (GNCPriceDB *db1, GNCPriceDB *db2);
/** @name Internal/Debugging

View File

@ -1,87 +0,0 @@
/********************************************************************\
* gnc-sesssion.c -- session access (connection to backend) *
* Scheme specific code. *
* *
* This program is free software; you can redistribute it and/or *
* modify it under the terms of the GNU General Public License as *
* published by the Free Software Foundation; either version 2 of *
* the License, or (at your option) any later version. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License*
* along with this program; if not, contact: *
* *
* Free Software Foundation Voice: +1-617-542-5942 *
* 51 Franklin Street, Fifth Floor Fax: +1-617-542-2652 *
* Boston, MA 02110-1301, USA gnu@gnu.org *
\********************************************************************/
/*
* FILE:
* gnc-session-scm.c
*
* FUNCTION:
* Encapsulate a connection to a GnuCash backend.
*
* HISTORY:
* Created by David Hampton, September 2002
* Copyright (c) 2002 Linas Vepstas <linas@linas.org>
*/
#include "config.h"
#include <stdlib.h>
#include <string.h>
#include <glib.h>
#include "gnc-engine.h"
#include "qofsession.h"
#include "gnc-session-scm.h"
//static short module = MOD_IO;
static SCM gnc_session_scm_gui_cb = SCM_BOOL_F;
static void
gnc_session_scm_gui_cb_helper (const char *message, double percent)
{
if (gnc_session_scm_gui_cb != SCM_BOOL_F)
{
SCM string = scm_makfrom0str(message);
SCM scm_percent = scm_make_real(percent);
scm_call_2 (gnc_session_scm_gui_cb, string, scm_percent);
}
}
void
gnc_session_scm_load (QofSession *session)
{
qof_session_load (session, gnc_session_scm_gui_cb_helper);
}
void
gnc_session_scm_save (QofSession *session)
{
qof_session_save (session, gnc_session_scm_gui_cb_helper);
}
/*
* Set the callback that will be used for any calls to the session
* load/save functions from the scheme side of the code.
*/
void
gnc_session_scm_set_callback (SCM percentage_cb)
{
if (gnc_session_scm_gui_cb != SCM_BOOL_F)
scm_gc_unprotect_object(gnc_session_scm_gui_cb);
gnc_session_scm_gui_cb = percentage_cb;
if (gnc_session_scm_gui_cb != SCM_BOOL_F)
scm_gc_protect_object(gnc_session_scm_gui_cb);
}

View File

@ -1,49 +0,0 @@
/********************************************************************\
* gnc-session-scm.h -- session access (connection to backend) *
* Scheme specific code. *
* *
* This program is free software; you can redistribute it and/or *
* modify it under the terms of the GNU General Public License as *
* published by the Free Software Foundation; either version 2 of *
* the License, or (at your option) any later version. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License*
* along with this program; if not, contact: *
* *
* Free Software Foundation Voice: +1-617-542-5942 *
* 51 Franklin Street, Fifth Floor Fax: +1-617-542-2652 *
* Boston, MA 02110-1301, USA gnu@gnu.org *
* *
\********************************************************************/
/*
* FILE:
* gnc-session-scm.h
*
* FUNCTION:
* Encapsulates a connection to a GnuCash backend. That is, it
* manages the connection to a persistant data store; whereas
* the backend is the thing that performs the actual datastore
* access.
*
* HISTORY:
* Created by David Hampton, September 2002
* Copyright (c) 2002 Linas Vepstas <linas@linas.org>
*/
#ifndef GNC_SESSION_SCM_H
#define GNC_SESSION_SCM_H
#include <libguile.h>
#include "gnc-engine.h"
void gnc_session_scm_load (QofSession *session);
void gnc_session_scm_save (QofSession *session);
void gnc_session_scm_set_callback (SCM percentage_cb);
#endif /* GNC_SESSION_SCM_H */

View File

@ -815,16 +815,6 @@ gncBillTermComputeDueDate (const GncBillTerm *term, Timespec post_date)
return compute_time (term, post_date, term->due_days);
}
Timespec
gncBillTermComputeDiscountDate (const GncBillTerm *term, Timespec post_date)
{
Timespec res = post_date;
if (!term) return res;
return compute_time (term, post_date, term->disc_days);
}
/* Package-Private functions */
static void _gncBillTermCreate (QofBook *book)

View File

@ -165,7 +165,6 @@ gboolean gncBillTermIsFamily (const GncBillTerm *a, const GncBillTerm *b);
/* Compute the due date and discount dates from the post date */
Timespec gncBillTermComputeDueDate (const GncBillTerm *term, Timespec post_date);
Timespec gncBillTermComputeDiscountDate (const GncBillTerm *term, Timespec post_date);
/* deprecated */
#define gncBillTermGetGUID(x) qof_instance_get_guid (QOF_INSTANCE(x))

View File

@ -40,15 +40,6 @@ get_acct_type ()
return account_type;
}
int gnc_account_value_pointer_p (SCM arg)
{
swig_type_info * account_type = get_acct_type();
return (scm_is_pair (arg) &&
SWIG_IsPointerOfType(SCM_CAR (arg), account_type) &&
gnc_numeric_p (SCM_CDR (arg)));
}
GncAccountValue * gnc_scm_to_account_value_ptr (SCM valuearg)
{
GncAccountValue *res;

View File

@ -27,7 +27,6 @@
#include <gncTaxTable.h> /* for GncAccountValue */
#include <libguile.h>
int gnc_account_value_pointer_p (SCM arg);
GncAccountValue * gnc_scm_to_account_value_ptr (SCM valuearg);
SCM gnc_account_value_ptr_to_scm (GncAccountValue *);

View File

@ -135,12 +135,9 @@ gnc_commodity * gncCustomerGetCurrency (const GncCustomer *customer);
gboolean gncCustomerGetTaxTableOverride (const GncCustomer *customer);
GncTaxTable* gncCustomerGetTaxTable (const GncCustomer *customer);
GList * gncCustomerGetJoblist (const GncCustomer *customer, gboolean show_all);
/** @} */
gboolean gncCustomerIsDirty (GncCustomer *customer);
int gncCustomerCompare (const GncCustomer *a, const GncCustomer *b);
gboolean gncCustomerEqual(const GncCustomer *a, const GncCustomer *b);
#define CUSTOMER_ID "id"
#define CUSTOMER_NAME "name"
@ -161,6 +158,12 @@ gboolean gncCustomerEqual(const GncCustomer *a, const GncCustomer *b);
#define gncCustomerGetBook(x) qof_instance_get_book(QOF_INSTANCE(x))
#define gncCustomerLookupDirect(g,b) gncCustomerLookup((b), &(g))
/** Test support function, used in gets-dbi-business-stuff.c */
gboolean gncCustomerEqual(const GncCustomer *a, const GncCustomer *b);
GList * gncCustomerGetJoblist (const GncCustomer *customer, gboolean show_all);
gboolean gncCustomerIsDirty (GncCustomer *customer);
#endif /* GNC_CUSTOMER_H_ */
/** @} */
/** @} */

View File

@ -147,6 +147,7 @@ gnc_employee_set_property (GObject *object,
}
/** Get displayable name */
/*
static gchar*
impl_get_display_name(const QofInstance* inst)
{
@ -158,7 +159,7 @@ impl_get_display_name(const QofInstance* inst)
emp = GNC_EMPLOYEE(inst);
return g_strdup_printf("Employee %s", emp->username);
}
*/
/** Does this object refer to a specific object */
static gboolean
impl_refers_to_object(const QofInstance* inst, const QofInstance* ref)

View File

@ -104,8 +104,6 @@ static inline GncEmployee * gncEmployeeLookup (const QofBook *book, const GncGUI
QOF_BOOK_RETURN_ENTITY(book, guid, GNC_ID_EMPLOYEE, GncEmployee);
}
gboolean gncEmployeeIsDirty (const GncEmployee *employee);
gboolean gncEmployeeEqual(const GncEmployee* e1, const GncEmployee* e2);
#define EMPLOYEE_ID "id"
#define EMPLOYEE_USERNAME "username"
@ -122,6 +120,10 @@ gboolean gncEmployeeEqual(const GncEmployee* e1, const GncEmployee* e2);
#define gncEmployeeRetGUID(E) (E ? *(qof_entity_get_guid(QOF_INSTANCE(E))) : *(guid_null()))
#define gncEmployeeLookupDirect(G,B) gncEmployeeLookup((B),&(G))
/** Test support function, used by test-dbi-business-stuff.c */
gboolean gncEmployeeEqual(const GncEmployee* e1, const GncEmployee* e2);
gboolean gncEmployeeIsDirty (const GncEmployee *employee);
#endif /* GNC_EMPLOYEE_H_ */
/** @} */
/** @} */

View File

@ -1443,87 +1443,6 @@ int gncEntryCompare (const GncEntry *a, const GncEntry *b)
return FALSE; \
}
gboolean gncEntryEqual(const GncEntry *a, const GncEntry *b)
{
if (a == NULL && b == NULL) return TRUE;
if (a == NULL || b == NULL) return FALSE;
g_return_val_if_fail(GNC_IS_ENTRY(a), FALSE);
g_return_val_if_fail(GNC_IS_ENTRY(b), FALSE);
CHECK_STRING(a, b, desc);
CHECK_STRING(a, b, action);
CHECK_STRING(a, b, notes);
CHECK_NUMERIC(a, b, quantity);
if (a->invoice != NULL)
{
CHECK_ACCOUNT(a, b, i_account);
CHECK_NUMERIC(a, b, i_price);
CHECK_VALUE(a, b, i_taxable);
CHECK_VALUE(a, b, i_taxincluded);
if (!gncTaxTableEqual(a->i_tax_table, b->i_tax_table))
{
PWARN("i_tax_table differ");
return FALSE;
}
CHECK_NUMERIC(a, b, i_discount);
CHECK_VALUE(a, b, i_disc_type);
CHECK_VALUE(a, b, i_disc_how);
CHECK_NUMERIC(a, b, i_value);
CHECK_NUMERIC(a, b, i_value_rounded);
CHECK_NUMERIC(a, b, i_tax_value);
CHECK_NUMERIC(a, b, i_tax_value_rounded);
CHECK_NUMERIC(a, b, i_disc_value);
CHECK_NUMERIC(a, b, i_disc_value_rounded);
#if 0
Timespec date;
Timespec date_entered;
/* employee bill data */
GncEntryPaymentType b_payment;
/* customer invoice */
GList * i_tax_values;
Timespec i_taxtable_modtime;
#endif
}
if (a->bill != NULL)
{
CHECK_ACCOUNT(a, b, b_account);
CHECK_NUMERIC(a, b, b_price);
CHECK_NUMERIC(a, b, b_value);
CHECK_NUMERIC(a, b, b_value_rounded);
CHECK_NUMERIC(a, b, b_tax_value);
CHECK_NUMERIC(a, b, b_tax_value_rounded);
#if 0
Timespec date;
Timespec date_entered;
/* vendor bill data */
gboolean b_taxable;
gboolean b_taxincluded;
GncTaxTable * b_tax_table;
gboolean billable;
GncOwner billto;
/* employee bill data */
GncEntryPaymentType b_payment;
/* vendor bill */
GList * b_tax_values;
Timespec b_taxtable_modtime;
#endif
}
/* FIXME: Need real tests */
return TRUE;
}
/* ============================================================= */
/* Object declaration */

View File

@ -241,7 +241,6 @@ gboolean gncEntryIsOpen (const GncEntry *entry);
void gncEntryBeginEdit (GncEntry *entry);
void gncEntryCommitEdit (GncEntry *entry);
int gncEntryCompare (const GncEntry *a, const GncEntry *b);
gboolean gncEntryEqual(const GncEntry *a, const GncEntry *b);
#define ENTRY_DATE "date"
#define ENTRY_DATE_ENTERED "date-entered"

View File

@ -629,14 +629,6 @@ void gncInvoiceAddPrice (GncInvoice *invoice, GNCPrice *price)
mark_invoice (invoice);
}
void gncInvoiceRemovePrice (GncInvoice *invoice, GNCPrice *price)
{
if (!invoice || !price) return;
invoice->prices = g_list_remove (invoice->prices, price);
mark_invoice (invoice);
}
void gncBillAddEntry (GncInvoice *bill, GncEntry *entry)
{
GncInvoice *old;
@ -664,23 +656,6 @@ void gncBillRemoveEntry (GncInvoice *bill, GncEntry *entry)
mark_invoice (bill);
}
void gncBillAddPrice (GncInvoice *bill, GNCPrice *price)
{
if (!bill || !price) return;
bill->prices = g_list_prepend(bill->prices, price);
mark_invoice (bill);
}
void gncBillRemovePrice (GncInvoice *bill, GNCPrice *price)
{
if (!bill || !price) return;
bill->prices = g_list_remove (bill->prices, price);
mark_invoice (bill);
}
void gncInvoiceSortEntries (GncInvoice *invoice)
{
if (!invoice) return;
@ -985,12 +960,6 @@ EntryList * gncInvoiceGetEntries (GncInvoice *invoice)
return invoice->entries;
}
GList * gncInvoiceGetPrices(GncInvoice *invoice)
{
if (!invoice) return NULL;
return invoice->prices;
}
GNCPrice * gncInvoiceGetPrice(GncInvoice *invoice, gnc_commodity *commodity)
{
GList *node = g_list_first(invoice->prices);

View File

@ -114,13 +114,10 @@ void gncInvoiceSetToChargeAmount (GncInvoice *invoice, gnc_numeric amount);
void gncInvoiceAddEntry (GncInvoice *invoice, GncEntry *entry);
void gncInvoiceRemoveEntry (GncInvoice *invoice, GncEntry *entry);
void gncInvoiceAddPrice (GncInvoice *invoice, GNCPrice *price);
void gncInvoiceRemovePrice (GncInvoice *invoice, GNCPrice *price);
/** Call this function when adding an entry to a bill instead of an invoice */
void gncBillAddEntry (GncInvoice *bill, GncEntry *entry);
void gncBillRemoveEntry (GncInvoice *bill, GncEntry *entry);
void gncBillAddPrice (GncInvoice *bill, GNCPrice *price);
void gncBillRemovePrice (GncInvoice *bill, GNCPrice *price);
/** Call this function when an Entry is changed and you want to
re-sort the list of entries
@ -160,7 +157,6 @@ gnc_numeric gncInvoiceGetTotalTax (GncInvoice *invoice);
typedef GList EntryList;
EntryList * gncInvoiceGetEntries (GncInvoice *invoice);
GList * gncInvoiceGetPrices(GncInvoice *invoice);
GNCPrice * gncInvoiceGetPrice(GncInvoice *invoice, gnc_commodity* commodity);
/** Depending on the invoice type, invoices have a different effect
@ -217,7 +213,6 @@ static inline GncInvoice * gncInvoiceLookup (const QofBook *book, const GncGUID
void gncInvoiceBeginEdit (GncInvoice *invoice);
void gncInvoiceCommitEdit (GncInvoice *invoice);
int gncInvoiceCompare (const GncInvoice *a, const GncInvoice *b);
gboolean gncInvoiceEqual(const GncInvoice *a, const GncInvoice *b);
gboolean gncInvoiceIsPosted (const GncInvoice *invoice);
gboolean gncInvoiceIsPaid (const GncInvoice *invoice);
@ -251,6 +246,9 @@ QofBook *gncInvoiceGetBook(GncInvoice *x);
#define gncInvoiceRetGUID(x) (x ? *(qof_instance_get_guid(QOF_INSTANCE(x))) : *(guid_null()))
#define gncInvoiceLookupDirect(G,B) gncInvoiceLookup((B),&(G))
/** Test support function used by test-dbi-business-stuff.c */
gboolean gncInvoiceEqual(const GncInvoice *a, const GncInvoice *b);
#endif /* GNC_INVOICE_H_ */
/** @} */
/** @} */

View File

@ -487,6 +487,7 @@ destroy_job_on_book_close(QofInstance *ent, gpointer data)
*
* @param book Book being closed
*/
/*
static void
gnc_job_book_end(QofBook* book)
{
@ -495,7 +496,7 @@ gnc_job_book_end(QofBook* book)
col = qof_book_get_collection(book, GNC_ID_JOB);
qof_collection_foreach(col, destroy_job_on_book_close, NULL);
}
*/
static QofObject gncJobDesc =
{
DI(.interface_version = ) QOF_OBJECT_VERSION,

View File

@ -445,54 +445,6 @@ int gncOrderCompare (const GncOrder *a, const GncOrder *b)
return qof_instance_guid_compare(a, b);
}
gboolean gncOrderEqual(const GncOrder * a, const GncOrder *b)
{
if (a == NULL && b == NULL) return TRUE;
if (a == NULL || b == NULL) return FALSE;
g_return_val_if_fail(GNC_IS_ORDER(a), FALSE);
g_return_val_if_fail(GNC_IS_ORDER(b), FALSE);
if (safe_strcmp(a->id, b->id) != 0)
{
PWARN("IDs differ: %s vs %s", a->id, b->id);
return FALSE;
}
if (safe_strcmp(a->notes, b->notes) != 0)
{
PWARN("Notes differ: %s vs %s", a->notes, b->notes);
return FALSE;
}
if (a->active != b->active)
{
PWARN("Active flags differ");
return FALSE;
}
if (safe_strcmp(a->reference, b->reference) != 0)
{
PWARN("References differ: %s vs %s", a->reference, b->reference);
return FALSE;
}
if (safe_strcmp(a->printname, b->printname) != 0)
{
PWARN("printnames differ: %s vs %s", a->printname, b->printname);
return FALSE;
}
/* FIXME: Need real tests */
#if 0
GncOwner owner;
GList * entries;
Timespec opened;
Timespec closed;
#endif
return TRUE;
}
/* =========================================================== */
/* Package-Private functions */

View File

@ -92,7 +92,6 @@ GList * gncOrderGetEntries (GncOrder *order);
void gncOrderBeginEdit (GncOrder *order);
void gncOrderCommitEdit (GncOrder *order);
int gncOrderCompare (const GncOrder *a, const GncOrder *b);
gboolean gncOrderEqual(const GncOrder *a, const GncOrder *b);
gboolean gncOrderIsClosed (const GncOrder *order);

View File

@ -99,38 +99,6 @@ void gncOwnerBeginEdit (GncOwner *owner)
}
void gncOwnerCommitEdit (GncOwner *owner)
{
if (!owner) return;
switch (owner->type)
{
case GNC_OWNER_NONE :
case GNC_OWNER_UNDEFINED :
break;
case GNC_OWNER_CUSTOMER :
{
gncCustomerCommitEdit(owner->owner.customer);
break;
}
case GNC_OWNER_JOB :
{
gncJobCommitEdit(owner->owner.job);
break;
}
case GNC_OWNER_VENDOR :
{
gncVendorCommitEdit(owner->owner.vendor);
break;
}
case GNC_OWNER_EMPLOYEE :
{
gncEmployeeCommitEdit(owner->owner.employee);
break;
}
}
}
void gncOwnerDestroy (GncOwner *owner)
{
if (!owner) return;
@ -513,31 +481,6 @@ const GncGUID * gncOwnerGetGUID (const GncOwner *owner)
}
}
void
gncOwnerSetName (const GncOwner *owner, const gchar *name)
{
if (!owner) return;
switch (owner->type)
{
case GNC_OWNER_CUSTOMER:
gncCustomerSetName (owner->owner.customer, name);
break;
case GNC_OWNER_VENDOR:
gncVendorSetName (owner->owner.vendor, name);
break;
case GNC_OWNER_EMPLOYEE:
gncAddressSetName (gncEmployeeGetAddr (owner->owner.employee), name);
break;
case GNC_OWNER_JOB:
gncJobSetName (owner->owner.job, name);
break;
case GNC_OWNER_NONE:
case GNC_OWNER_UNDEFINED:
default:
break;
}
}
void
gncOwnerSetActive (const GncOwner *owner, gboolean active)
{

View File

@ -146,7 +146,6 @@ gnc_commodity * gncOwnerGetCurrency (const GncOwner *owner);
/** \name Set routines.
@{
*/
void gncOwnerSetName (const GncOwner *owner, const gchar *new_name);
void gncOwnerSetActive (const GncOwner *owner, gboolean active);
/** @} */
@ -270,7 +269,6 @@ void gncOwnerFree (GncOwner *owner);
* without knowing its type.
*/
void gncOwnerBeginEdit (GncOwner *owner);
void gncOwnerCommitEdit (GncOwner *owner);
void gncOwnerDestroy (GncOwner *owner);
#endif /* GNC_OWNER_H_ */

View File

@ -736,6 +736,8 @@ gnc_numeric gncTaxTableEntryGetAmount (const GncTaxTableEntry *entry)
return entry->amount;
}
/* This is a semi-private function (meaning that it's not declared in
* the header) used for SQL Backend testing. */
GncTaxTable* gncTaxTableEntryGetTable( const GncTaxTableEntry* entry )
{
if (!entry) return NULL;

View File

@ -153,6 +153,7 @@ gnc_vendor_set_property (GObject *object,
}
/** Return displayable name */
/*
static gchar*
impl_get_display_name(const QofInstance* inst)
{
@ -164,7 +165,7 @@ impl_get_display_name(const QofInstance* inst)
v = GNC_VENDOR(inst);
return g_strdup_printf("Vendor %s", v->name);
}
*/
/** Does this object refer to a specific object */
static gboolean
impl_refers_to_object(const QofInstance* inst, const QofInstance* ref)
@ -654,28 +655,8 @@ gboolean gncVendorEqual(const GncVendor *a, const GncVendor *b)
return TRUE;
}
GList * gncVendorGetJoblist (const GncVendor *vendor, gboolean show_all)
{
if (!vendor) return NULL;
if (show_all)
{
return (g_list_copy (vendor->jobs));
}
else
{
GList *list = NULL, *iterator;
for (iterator = vendor->jobs; iterator; iterator = iterator->next)
{
GncJob *j = iterator->data;
if (gncJobGetActive (j))
list = g_list_append (list, j);
}
return list;
}
}
gboolean gncVendorIsDirty (const GncVendor *vendor)
gboolean
gncVendorIsDirty (const GncVendor *vendor)
{
if (!vendor) return FALSE;
return (qof_instance_get_dirty_flag(vendor)

View File

@ -102,10 +102,8 @@ GncTaxTable* gncVendorGetTaxTable (const GncVendor *vendor);
/** XXX should be renamed to RetJobList to be consistent with
* other usage, since caller must free the copied list
*/
GList * gncVendorGetJoblist (const GncVendor *vendor, gboolean show_all);
gboolean gncVendorIsDirty (const GncVendor *vendor);
int gncVendorCompare (const GncVendor *a, const GncVendor *b);
gboolean gncVendorEqual(const GncVendor *a, const GncVendor *b);
/** Return a pointer to the instance gncVendor that is identified
* by the guid, and is residing in the book. Returns NULL if the
@ -133,7 +131,9 @@ static inline GncVendor * gncVendorLookup (const QofBook *book, const GncGUID *g
#define gncVendorGetGUID(X) qof_instance_get_guid (QOF_INSTANCE(X))
#define gncVendorRetGUID(X) (X ? *(qof_instance_get_guid (QOF_INSTANCE(X))) : *(guid_null()))
#define gncVendorLookupDirect(G,B) gncVendorLookup((B),&(G))
/** Test support function, used by test-dbi-business-stuff.c */
gboolean gncVendorEqual(const GncVendor *a, const GncVendor *b);
gboolean gncVendorIsDirty (const GncVendor *vendor);
#endif /* GNC_VENDOR_H_ */
/** @} */
/** @} */

View File

@ -8,18 +8,13 @@
#include "guile-mappings.h"
#include "swig-runtime.h"
int
gnc_kvp_value_ptr_p(SCM arg)
{
return TRUE;
}
/* NOTE: There are some problems with this approach. Currently,
* guids are stored simply as strings in scheme, so some
* strings could be mistaken for guids, although that is
* unlikely. The general problem is distinguishing kvp
* types based only on the scheme type.
*/
KvpValue *
gnc_scm_to_kvp_value_ptr(SCM val)
{

View File

@ -4,7 +4,6 @@
#include "qof.h"
#include <libguile.h>
int gnc_kvp_value_ptr_p(SCM arg);
KvpValue* gnc_scm_to_kvp_value_ptr(SCM kvpval);
SCM gnc_kvp_value_ptr_to_scm(KvpValue* val);
void gnc_kvp_frame_delete_at_path(KvpFrame *frame, GSList *key_path);

View File

@ -233,26 +233,4 @@ LIFOPolicyIsOpeningSplit (GNCPolicy *pcy, GNCLot *lot, Split *split)
return (split == opening_split);
}
/* ============================================================== */
/* Define a single, static policy, since we have no per-object data.
* I suppose this could change, but we don't need any better at the
* moment ... */
GNCPolicy *
xaccGetLIFOPolicy (void)
{
static GNCPolicy *pcy = NULL;
if (!pcy)
{
pcy = g_new (GNCPolicy, 1);
pcy->PolicyGetLot = LIFOPolicyGetLot;
pcy->PolicyGetSplit = LIFOPolicyGetSplit;
pcy->PolicyGetLotOpening = LIFOPolicyGetLotOpening;
pcy->PolicyIsOpeningSplit = LIFOPolicyIsOpeningSplit;
}
return pcy;
}
/* =========================== END OF FILE ======================= */

View File

@ -51,15 +51,6 @@ typedef struct gncpolicy_s GNCPolicy;
*/
GNCPolicy *xaccGetFIFOPolicy (void);
/** Last-in, First-out Policy
* This policy will create LIFO Lots. LIFO Lots have the following
* properties:
* -- XXX I think the implementation is broken right now.
* -- All splits in the lot share the same transaction currency as
* the split that opened the lot.
*/
GNCPolicy *xaccGetLIFOPolicy (void);
#endif /* XACC_POLICY_H */
/** @} */
/** @} */

View File

@ -491,7 +491,7 @@ gnc_account_init (Account* acc)// 1
* gnc_account_set_start_cleared_balance ()
* gnc_account_set_start_reconciled_balance ()
* gnc_account_set_policy ()
* xaccAccountSetMark ()
* xaccAccountSetMark () *** Not Used ***
* xaccAccountSetTaxRelated ()
* xaccAccountSetTaxUSCode ()
* xaccAccountSetTaxUSPayerNameSource ()
@ -968,16 +968,12 @@ test_xaccAccountEqual (Fixture *fixture, gconstpointer pData)
}*/
/*
The following are getters and setters, unworthy of testing:
gnc_account_get_sort_dirty
gnc_account_get_sort_dirty *** Test Only ***
gnc_account_set_sort_dirty
gnc_account_get_balance_dirty
gnc_account_get_balance_dirty *** Test Only ***
gnc_account_set_balance_dirty
*/
/* gnc_account_find_split
gboolean
gnc_account_find_split (Account *acc, Split *s)// C: 4 in 2
Simple pass-through, no test
*/
/* gnc_account_find_split *** Test Only ***
/* gnc_account_insert_split
gboolean
gnc_account_insert_split (Account *acc, Split *s)// C: 5 in 3
@ -1091,9 +1087,9 @@ xaccAccountLookup (const GncGUID *guid, QofBook *book)// C: 37 in 28 SCM: 2 in 1
Passthrough, no test.
*/
/* More getters/setters:
xaccAccountGetMark
xaccAccountSetMark
xaccClearMark
xaccAccountGetMark *** Test Only ***
xaccAccountSetMark *** Not Used ***
xaccClearMark *** Not Used ***
xaccClearMarkDown
gnc_account_get_policy
gnc_account_set_policy
@ -1657,10 +1653,10 @@ test_gnc_account_foreach_child (Fixture *fixture, gconstpointer pData)
gnc_account_foreach_child (begin, thunk, &counter);
g_assert_cmpint (counter, ==, 2);
}
/* gnc_account_foreach_child_until
/* gnc_account_foreach_child_until *** Not Used ***
gpointer
gnc_account_foreach_child_until (const Account *acc,// C: 4 in 2 */
static void
/*static void
test_gnc_account_foreach_child_until (Fixture *fixture, gconstpointer pData)
{
Account *root = gnc_account_get_root (fixture->acct);
@ -1676,7 +1672,7 @@ test_gnc_account_foreach_child_until (Fixture *fixture, gconstpointer pData)
result = gnc_account_foreach_child_until (second, thunk2, &counter);
g_assert (result == expected);
g_assert_cmpint (counter, ==, 3);
}
}*/
/* gnc_account_foreach_descendant
void
gnc_account_foreach_descendant (const Account *acc,// C: 23 in 14 */
@ -1719,14 +1715,14 @@ test_gnc_account_foreach_descendant_until (Fixture *fixture, gconstpointer pData
* xaccAccountGetColor
* xaccAccountGetNotes
* xaccAccountGetCommodity
* gnc_account_get_start_balance
* gnc_account_get_start_balance *** Test Only ***
* gnc_account_set_start_balance
* gnc_account_get_start_cleared_balance
* gnc_account_get_start_cleared_balance *** Test Only ***
* gnc_account_set_start_cleared_balance
* gnc_account_get_start_reconciled_balance
* gnc_account_get_start_reconciled_balance *** Test Only ***
* gnc_account_set_start_reconciled_balance
* xaccAccountGetBalance
* xaccAccountGetClearedBalanc
* xaccAccountGetClearedBalance C: 1
* xaccAccountGetReconciledBalance
*/
/* gnc_account_get_full_name
@ -1981,8 +1977,8 @@ test_xaccAccountHasAncestor (Fixture *fixture, gconstpointer pData)
/* xaccAccountTypeEnumAsString
* xaccAccountStringToType
* xaccAccountStringToEnum
* xaccAccountGetTypeStr
* xaccAccountGetTypeFromStr
* xaccAccountGetTypeStr *** Not Used ***
* xaccAccountGetTypeFromStr *** Test Only ***
* xaccAccountIsPriced
const char *
xaccAccountTypeEnumAsString (GNCAccountType type)// C: 5 in 3 */
@ -2034,7 +2030,7 @@ test_xaccAccountType_Stuff (void)
}
else
g_assert_cmpstr (typestr_uc, ==, typename);
g_assert_cmpint (xaccAccountGetTypeFromStr (typestr), ==, type);
// g_assert_cmpint (xaccAccountGetTypeFromStr (typestr), ==, type);
g_free (typestr_uc);
g_object_set (acc, "type", type, NULL);
@ -2167,7 +2163,7 @@ test_xaccAccountType_Compatibility (void)
*/
/* finder_help_function
static void
finder_help_function (const Account *acc, const char *description,// 3
finder_help_function (const Account *acc, const char *descrption,// 3
Helper function, fully exercised by the following two public functions
*/
/* xaccAccountFindSplitByDesc
@ -2408,7 +2404,7 @@ test_suite_account (void)
GNC_TEST_ADD (suitename, "gnc account lookup by full name helper", Fixture, &complex, setup, test_gnc_account_lookup_by_full_name_helper, teardown );
GNC_TEST_ADD (suitename, "gnc account lookup by full name", Fixture, &complex, setup, test_gnc_account_lookup_by_full_name, teardown );
GNC_TEST_ADD (suitename, "gnc account foreach child", Fixture, &complex, setup, test_gnc_account_foreach_child, teardown );
GNC_TEST_ADD (suitename, "gnc account foreach child until", Fixture, &complex, setup, test_gnc_account_foreach_child_until, teardown );
// GNC_TEST_ADD (suitename, "gnc account foreach child until", Fixture, &complex, setup, test_gnc_account_foreach_child_until, teardown );
GNC_TEST_ADD (suitename, "gnc account foreach descendant", Fixture, &complex, setup, test_gnc_account_foreach_descendant, teardown );
GNC_TEST_ADD (suitename, "gnc account foreach descendant until", Fixture, &complex, setup, test_gnc_account_foreach_descendant_until, teardown );
GNC_TEST_ADD (suitename, "gnc account get full name", Fixture, &good_data, setup, test_gnc_account_get_full_name, teardown );