diff --git a/src/engine/Account.c b/src/engine/Account.c index f62c02b8fb..c35e923bf7 100644 --- a/src/engine/Account.c +++ b/src/engine/Account.c @@ -1068,4 +1068,15 @@ xaccAccountGetNumSplits (Account *acc) return (acc->numSplits); } +/********************************************************************\ +\********************************************************************/ + +Account * +IthAccount (Account **list, int i) +{ + if (!list || 0 > i) return NULL; + return list[i]; +} + + /*************************** END OF FILE **************************** */ diff --git a/src/engine/Account.h b/src/engine/Account.h index 99ea84273e..686fba699a 100644 --- a/src/engine/Account.h +++ b/src/engine/Account.h @@ -23,8 +23,8 @@ * Huntington Beach, CA 92648-4632 * \********************************************************************/ -#ifndef __ACCOUNT_H__ -#define __ACCOUNT_H__ +#ifndef __XACC_ACCOUNT_H__ +#define __XACC_ACCOUNT_H__ #include "config.h" #include "AccInfo.h" @@ -148,9 +148,10 @@ Split * xaccAccountGetSplit (Account *acc, int i); Split ** xaccAccountGetSplitList (Account *acc); int xaccAccountGetNumSplits (Account *acc); +/* The IthAccount() routine merely dereferences: the returned + * value is just list[i]. This routine is needed for the perl + * swig wrappers, which cannot dereference a list. + */ -/** GLOBALS *********************************************************/ - -extern int next_free_unique_account_id; - -#endif +Account * IthAccount (Account **list, int i); +#endif /* __XACC_ACCOUNT_H__ */ diff --git a/src/engine/AccountP.h b/src/engine/AccountP.h index 8406516ad9..4d302c94df 100644 --- a/src/engine/AccountP.h +++ b/src/engine/AccountP.h @@ -160,4 +160,8 @@ void xaccAccountRemoveSplit (Account *, Split *); void xaccAccountRecomputeBalance (Account *); void xaccAccountRecomputeBalances (Account **); +/** GLOBALS *********************************************************/ + +extern int next_free_unique_account_id; + #endif /* __XACC_ACCOUNT_P_H__ */ diff --git a/src/engine/Transaction.c b/src/engine/Transaction.c index 7b9da77e38..ca77bb04b0 100644 --- a/src/engine/Transaction.c +++ b/src/engine/Transaction.c @@ -1945,5 +1945,22 @@ xaccIsPeerSplit (Split *sa, Split *sb) return 0; } +/********************************************************************\ +\********************************************************************/ + +Split * +IthSplit (Split **list, int i) +{ + if (!list || 0 > i) return NULL; + return list[i]; +} + +Transaction * +IthTransaction (Transaction **list, int i) +{ + if (!list || 0 > i) return NULL; + return list[i]; +} + /************************ END OF ************************************\ \************************* FILE *************************************/ diff --git a/src/engine/Transaction.h b/src/engine/Transaction.h index dad252614e..f9cd3df7e8 100644 --- a/src/engine/Transaction.h +++ b/src/engine/Transaction.h @@ -445,4 +445,12 @@ Split * xaccGetOtherSplit (Split *); */ int xaccIsPeerSplit (Split *, Split *); +/* The IthSplit() and IthTransaction() routines merely dereference + * the lists supplied as arguments; i.e. they return list[i]. + * These routines are needed by the perl swig wrappers, which + * are unable to dereference on thier own. + */ +Transaction * IthTransaction (Transaction **tarray, int i); +Split * IthSplit (Split **sarray, int i); + #endif /* __XACC_TRANSACTION_H__ */