mirror of
https://github.com/Gnucash/gnucash.git
synced 2025-02-25 18:55:30 -06:00
Preserve timespec-using functions in Guile bindings.
There's an example of use in text-extras.scm, function gnc-pricedb-create. Unfortunately the deprecation messages issue no warnings.
This commit is contained in:
parent
e9098d08d2
commit
c08dee67ba
@ -10,6 +10,7 @@ set(engine_noinst_HEADERS
|
||||
SX-book.h
|
||||
SX-ttinfo.h
|
||||
TransactionP.h
|
||||
engine-deprecated.h
|
||||
gnc-backend-prov.hpp
|
||||
gnc-date-p.h
|
||||
gnc-hooks-scm.h
|
||||
@ -149,6 +150,7 @@ set (engine_SOURCES
|
||||
Transaction.c
|
||||
cap-gains.c
|
||||
cashobjects.c
|
||||
engine-deprecated.c
|
||||
gnc-aqbanking-templates.cpp
|
||||
gnc-budget.c
|
||||
gnc-commodity.c
|
||||
@ -304,6 +306,7 @@ set(engine_EXTRA_DIST
|
||||
design.txt
|
||||
engine.i
|
||||
engine-common.i
|
||||
engine-deprecated.i
|
||||
extensions.txt
|
||||
iso-4217-currencies.xml
|
||||
iso-currencies-to-c.xsl
|
||||
|
208
libgnucash/engine/engine-deprecated.c
Normal file
208
libgnucash/engine/engine-deprecated.c
Normal file
@ -0,0 +1,208 @@
|
||||
/********************************************************************\
|
||||
* engine-deprecated.i: Guile wrappers for deleted C functions. *
|
||||
* Copyright 2018 John Ralls <jralls@ceridwen.us> *
|
||||
* *
|
||||
* 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 *
|
||||
* *
|
||||
\********************************************************************/
|
||||
|
||||
/* The functions in this file have been removed from the C library and are
|
||||
* provided here for backward compatibility. They will be removed completely
|
||||
* from the next major release of GnuCash.
|
||||
*/
|
||||
|
||||
#include "engine-deprecated.h"
|
||||
|
||||
#include <libguile/deprecation.h>
|
||||
|
||||
void xaccSplitSetDateReconciledTS(Split* s, Timespec *ts)
|
||||
{
|
||||
scm_c_issue_deprecation_warning("xaccSplitSetDateReconciled is deprecated. Use xaccSplitSetDateReconciledSecs instead.");
|
||||
xaccSplitSetDateReconciledSecs (s, ts->tv_sec);
|
||||
}
|
||||
|
||||
void xaccSplitGetDateReconciledTS(Split* s, Timespec *ts)
|
||||
{
|
||||
scm_c_issue_deprecation_warning("xaccSplitGetDateReconciled is deprecated. Use xaccSplitGetDateReconciledSecs instead.");
|
||||
ts->tv_sec = xaccSplitGetDateReconciled (s);
|
||||
ts->tv_nsec = 0;
|
||||
}
|
||||
|
||||
Timespec xaccSplitRetDateReconciledTS(Split* s)
|
||||
{
|
||||
Timespec ts = {0, 0};
|
||||
scm_c_issue_deprecation_warning("xaccSplitSetDateReconciled is deprecated. Use xaccSplitSetDateReconciledSecs instead.");
|
||||
ts.tv_sec = xaccSplitGetDateReconciled (s);
|
||||
return ts;
|
||||
}
|
||||
|
||||
Timespec
|
||||
gnc_transaction_get_date_posted(const Transaction *t)
|
||||
{
|
||||
Timespec ts = {0, 0};
|
||||
scm_c_issue_deprecation_warning("gnc_transaction_get_date_posted is deprecated. Use xaccTransRetDatePosted instead.");
|
||||
ts.tv_sec = xaccTransRetDatePosted(t);
|
||||
return ts;
|
||||
}
|
||||
|
||||
Timespec
|
||||
gnc_transaction_get_date_entered(const Transaction *t)
|
||||
{
|
||||
Timespec ts = {0, 0};
|
||||
scm_c_issue_deprecation_warning("gnc_transaction_get_date_entered is deprecated. Use xaccTransGetDateEntered instead.");
|
||||
ts.tv_sec = xaccTransRetDateEntered(t);
|
||||
return ts;
|
||||
}
|
||||
|
||||
Timespec
|
||||
gnc_split_get_date_reconciled(const Split *s)
|
||||
{
|
||||
Timespec ts = {0, 0};
|
||||
scm_c_issue_deprecation_warning("gnc_split_get_date_reconciled is deprecated. Use xaccSplitGetDateReconciled instead.");
|
||||
ts.tv_sec = xaccSplitGetDateReconciled(s);
|
||||
return ts;
|
||||
}
|
||||
|
||||
void
|
||||
gnc_transaction_set_date(Transaction *t, Timespec ts)
|
||||
{
|
||||
scm_c_issue_deprecation_warning("gnc_transaction_set_date is deprecated. Use xaccTransSetDatePostedSecs instead.");
|
||||
xaccTransSetDatePostedSecs(t, ts.tv_sec);
|
||||
}
|
||||
|
||||
Timespec
|
||||
gncTaxTableLastModified (const GncTaxTable *table)
|
||||
{
|
||||
Timespec t = {0, 0};
|
||||
scm_c_issue_deprecation_warning("gncTaxTableLastModified is deprecated. Use gncTaxTableLastModifiedSecs instead.");
|
||||
t.tv_sec = gncTaxTableLastModifiedSecs (table);
|
||||
return t;
|
||||
}
|
||||
|
||||
void
|
||||
gncOwnerApplyPayment (const GncOwner *owner, Transaction **preset_txn,
|
||||
GList *lots, Account *posted_acc, Account *xfer_acc,
|
||||
gnc_numeric amount, gnc_numeric exch, Timespec date,
|
||||
const char *memo, const char *num,
|
||||
gboolean auto_pay)
|
||||
{
|
||||
scm_c_issue_deprecation_warning("gncOwnerApplyPayment is deprecated. Use gncOwnerApplyPaymentSecs instead.");
|
||||
gncOwnerApplyPaymentSecs (owner, preset_txn, lots, posted_acc,
|
||||
xfer_acc, amount, exch, date.tv_sec,
|
||||
memo, num, auto_pay);
|
||||
}
|
||||
|
||||
GNCLot*
|
||||
gncOwnerCreatePaymentLot (const GncOwner *owner,
|
||||
Transaction **preset_txn, Account *posted_acc,
|
||||
Account *xfer_acc, gnc_numeric amount,
|
||||
gnc_numeric exch, Timespec date,
|
||||
const char *memo, const char *num)
|
||||
{
|
||||
GNCLot* lot = NULL;
|
||||
scm_c_issue_deprecation_warning("gncOwnerCreatePaymentLot is deprecated. Use gncOwnerCreatePaymentLotSecs instead.");
|
||||
lot = gncOwnerCreatePaymentLotSecs (owner, preset_txn, posted_acc,
|
||||
xfer_acc, amount, exch, date.tv_sec,
|
||||
memo, num);
|
||||
return lot;
|
||||
}
|
||||
|
||||
void
|
||||
gnc_price_set_time (GNCPrice *p, Timespec t)
|
||||
{
|
||||
scm_c_issue_deprecation_warning("gnc_price_set_time is deprecated. Use gnc_price_set_time64 instead.");
|
||||
gnc_price_set_time64(p, t.tv_sec);
|
||||
}
|
||||
|
||||
Timespec
|
||||
gnc_price_get_time (GNCPrice *p)
|
||||
{
|
||||
Timespec t = {0, 0};
|
||||
scm_c_issue_deprecation_warning("gnc_price_get_time is deprecated. Use gnc_price_get_time64 instead.");
|
||||
t.tv_sec = gnc_price_get_time64(p);
|
||||
return t;
|
||||
}
|
||||
|
||||
GNCPrice*
|
||||
gnc_pricedb_lookup_at_time(GNCPriceDB *db,
|
||||
const gnc_commodity *commodity,
|
||||
const gnc_commodity *currency,
|
||||
Timespec t)
|
||||
{
|
||||
scm_c_issue_deprecation_warning("gnc_pricedb_lookup_at_time is deprecated. Use gnc_pricedb_lookup_at_time64 instead.");
|
||||
return gnc_pricedb_lookup_at_time64(db, commodity, currency, t.tv_sec);
|
||||
}
|
||||
|
||||
GNCPrice*
|
||||
gnc_pricedb_lookup_day(GNCPriceDB *db,
|
||||
const gnc_commodity *commodity,
|
||||
const gnc_commodity *currency,
|
||||
Timespec t)
|
||||
{
|
||||
scm_c_issue_deprecation_warning("gnc_pricedb_lookup_day is deprecated. Use gnc_pricedb_lookup_day_t64 instead.");
|
||||
return gnc_pricedb_lookup_day_t64(db, commodity, currency, t.tv_sec);
|
||||
}
|
||||
|
||||
GNCPrice*
|
||||
gnc_pricedb_lookup_nearest_in_time(GNCPriceDB *db,
|
||||
const gnc_commodity *c,
|
||||
const gnc_commodity *currency,
|
||||
Timespec t)
|
||||
{
|
||||
scm_c_issue_deprecation_warning("gnc_pricedb_lookup_nearest_in_time is deprecated. Use gnc_pricedb_lookup_nearest_in_time64 instead.");
|
||||
return gnc_pricedb_lookup_nearest_in_time64(db, c, currency, t.tv_sec);
|
||||
}
|
||||
|
||||
PriceList*
|
||||
gnc_pricedb_lookup_nearest_in_time_any_currency(GNCPriceDB *db,
|
||||
const gnc_commodity *c,
|
||||
Timespec t)
|
||||
{
|
||||
scm_c_issue_deprecation_warning("gnc_pricedb_lookup_nearest_in_time_any_currency is deprecated. Use gnc_pricedb_lookup_nearest_in_time_any_currency_t64 instead.");
|
||||
return gnc_pricedb_lookup_nearest_in_time_any_currency_t64(db, c, t.tv_sec);
|
||||
}
|
||||
|
||||
GNCPrice*
|
||||
gnc_pricedb_lookup_latest_before(GNCPriceDB *db,
|
||||
gnc_commodity *c,
|
||||
gnc_commodity *currency,
|
||||
Timespec t)
|
||||
{
|
||||
scm_c_issue_deprecation_warning("gnc_pricedb_lookup_latest_before is deprecated. Use gnc_pricedb_lookup_latest_before_t64 instead.");
|
||||
return gnc_pricedb_lookup_latest_before_t64(db, c, currency, t.tv_sec);
|
||||
}
|
||||
|
||||
PriceList*
|
||||
gnc_pricedb_lookup_latest_before_any_currency(GNCPriceDB *db,
|
||||
const gnc_commodity *c,
|
||||
Timespec t)
|
||||
{
|
||||
scm_c_issue_deprecation_warning("gnc_pricedb_lookup_latest_before_any_currency is deprecated. Use gnc_pricedb_lookup_latest_before_any_currency_t64 instead.");
|
||||
return gnc_pricedb_lookup_latest_before_any_currency_t64(db, c, t.tv_sec);
|
||||
}
|
||||
|
||||
gnc_numeric
|
||||
gnc_pricedb_convert_balance_nearest_price(GNCPriceDB *pdb,
|
||||
gnc_numeric balance,
|
||||
const gnc_commodity *balance_currency,
|
||||
const gnc_commodity *new_currency,
|
||||
Timespec t)
|
||||
{
|
||||
scm_c_issue_deprecation_warning("gnc_pricedb_convert_balance_nearest_price is deprecated. Use gnc_pricedb_convert_balance_nearest_price_t64 instead.");
|
||||
return gnc_pricedb_convert_balance_nearest_price_t64(pdb, balance, balance_currency, new_currency, t.tv_sec);
|
||||
}
|
90
libgnucash/engine/engine-deprecated.h
Normal file
90
libgnucash/engine/engine-deprecated.h
Normal file
@ -0,0 +1,90 @@
|
||||
/********************************************************************\
|
||||
* engine-deprecated.h: Guile wrappers for deleted C functions. *
|
||||
* Copyright 2018 John Ralls <jralls@ceridwen.us> *
|
||||
* *
|
||||
* 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 *
|
||||
* *
|
||||
\********************************************************************/
|
||||
|
||||
#include "config.h"
|
||||
#include "Split.h"
|
||||
#include "Transaction.h"
|
||||
#include "gncTaxTable.h"
|
||||
#include "gncOwner.h"
|
||||
|
||||
typedef struct
|
||||
{
|
||||
time64 tv_sec;
|
||||
time64 tv_nsec;
|
||||
} Timespec;
|
||||
|
||||
|
||||
void xaccSplitSetDateReconciledTS(Split* s, Timespec *ts);
|
||||
void xaccSplitGetDateReconciledTS(Split* s, Timespec *ts);
|
||||
Timespec xaccSplitRetDateReconciledTS(Split* s);
|
||||
|
||||
Timespec gnc_transaction_get_date_posted(const Transaction *t);
|
||||
Timespec gnc_transaction_get_date_entered(const Transaction *t);
|
||||
Timespec gnc_split_get_date_reconciled(const Split *s);
|
||||
void gnc_transaction_set_date(Transaction *t, Timespec ts);
|
||||
|
||||
Timespec gncTaxTableLastModified (const GncTaxTable *table);
|
||||
|
||||
void gncOwnerApplyPayment (const GncOwner *owner, Transaction **preset_txn,
|
||||
GList *lots, Account *posted_acc, Account *xfer_acc,
|
||||
gnc_numeric amount, gnc_numeric exch, Timespec date,
|
||||
const char *memo, const char *num,
|
||||
gboolean auto_pay);
|
||||
|
||||
GNCLot* gncOwnerCreatePaymentLot (const GncOwner *owner,
|
||||
Transaction **preset_txn, Account *posted_acc,
|
||||
Account *xfer_acc, gnc_numeric amount,
|
||||
gnc_numeric exch, Timespec date,
|
||||
const char *memo, const char *num);
|
||||
|
||||
void gnc_price_set_time (GNCPrice *p, Timespec t);
|
||||
Timespec gnc_price_get_time (GNCPrice *p);
|
||||
GNCPrice* gnc_pricedb_lookup_at_time(GNCPriceDB *db,
|
||||
const gnc_commodity *commodity,
|
||||
const gnc_commodity *currency,
|
||||
Timespec t);
|
||||
GNCPrice* gnc_pricedb_lookup_day(GNCPriceDB *db,
|
||||
const gnc_commodity *commodity,
|
||||
const gnc_commodity *currency,
|
||||
Timespec t);
|
||||
GNCPrice* gnc_pricedb_lookup_nearest_in_time(GNCPriceDB *db,
|
||||
const gnc_commodity *c,
|
||||
const gnc_commodity *currency,
|
||||
Timespec t);
|
||||
PriceList* gnc_pricedb_lookup_nearest_in_time_any_currency(GNCPriceDB *db,
|
||||
const gnc_commodity *c,
|
||||
Timespec t);
|
||||
GNCPrice* gnc_pricedb_lookup_latest_before(GNCPriceDB *db,
|
||||
gnc_commodity *c,
|
||||
gnc_commodity *currency,
|
||||
Timespec t);
|
||||
PriceList* gnc_pricedb_lookup_latest_before_any_currency(GNCPriceDB *db,
|
||||
const gnc_commodity *c,
|
||||
Timespec t);
|
||||
gnc_numeric
|
||||
gnc_pricedb_convert_balance_nearest_price(GNCPriceDB *pdb,
|
||||
gnc_numeric balance,
|
||||
const gnc_commodity *balance_currency,
|
||||
const gnc_commodity *new_currency,
|
||||
Timespec t);
|
||||
|
@ -33,6 +33,7 @@
|
||||
#include "gnc-lot.h"
|
||||
#include "gnc-session.h"
|
||||
#include "gnc-hooks-scm.h"
|
||||
#include "engine-deprecated.h"
|
||||
#include "engine-helpers.h"
|
||||
#include "engine-helpers-guile.h"
|
||||
#include "policy.h"
|
||||
@ -80,6 +81,7 @@ engine-common.i */
|
||||
%newobject gnc_account_get_full_name;
|
||||
|
||||
%include "engine-common.i"
|
||||
%include "engine-deprecated.h"
|
||||
|
||||
%inline %{
|
||||
static const GncGUID * gncPriceGetGUID(GNCPrice *x)
|
||||
|
@ -624,6 +624,7 @@ libgnucash/engine/business-core.scm
|
||||
libgnucash/engine/cap-gains.c
|
||||
libgnucash/engine/cashobjects.c
|
||||
libgnucash/engine/commodity-table.scm
|
||||
libgnucash/engine/engine-deprecated.c
|
||||
libgnucash/engine/engine-helpers.c
|
||||
libgnucash/engine/engine-interface.scm
|
||||
libgnucash/engine/engine.scm
|
||||
|
Loading…
Reference in New Issue
Block a user