diff --git a/src/engine/Account.c b/src/engine/Account.c index b863eb3257..5f14b71ce2 100644 --- a/src/engine/Account.c +++ b/src/engine/Account.c @@ -228,7 +228,7 @@ xaccCloneAccount (const Account *from, QofBook *book) Account * xaccAccountLookupTwin (Account *acc, QofBook *book) { - kvp_value *v_ncopies; + KvpValue *v_ncopies; int i, ncopies = 0; if (!acc || !book) return NULL; @@ -240,7 +240,7 @@ xaccAccountLookupTwin (Account *acc, QofBook *book) for (i=0; ikvp_data, "gemini", buff, "acct_guid", NULL); @@ -795,7 +795,7 @@ xaccAccountBringUpToDate(Account *acc) * xaccAccountGetSlots ********************************************************************/ -kvp_frame * +KvpFrame * xaccAccountGetSlots(Account * account) { if (!account) return NULL; @@ -803,7 +803,7 @@ xaccAccountGetSlots(Account * account) } void -xaccAccountSetSlots_nc(Account *account, kvp_frame *frame) +xaccAccountSetSlots_nc(Account *account, KvpFrame *frame) { if (!account) return; @@ -1642,7 +1642,7 @@ DxaccAccountSetCurrencySCU (Account * acc, int scu) int DxaccAccountGetCurrencySCU (Account * acc) { - kvp_value *v; + KvpValue *v; if (!acc) return 0; @@ -1787,7 +1787,7 @@ xaccAccountGetDescription (Account *acc) const char * xaccAccountGetNotes (Account *acc) { - kvp_value *v; + KvpValue *v; if (!acc) return NULL; v = kvp_frame_get_slot(acc->kvp_data, "notes"); @@ -1798,7 +1798,7 @@ xaccAccountGetNotes (Account *acc) gnc_commodity * DxaccAccountGetCurrency (Account *acc) { - kvp_value *v; + KvpValue *v; const char *s; gnc_commodity_table *table; @@ -1826,7 +1826,7 @@ xaccAccountGetCommodity (Account *acc) gnc_commodity * DxaccAccountGetSecurity (Account *acc) { - kvp_value *v; + KvpValue *v; const char *s; gnc_commodity_table *table; @@ -2222,7 +2222,7 @@ xaccAccountForEachLot(Account *acc, gboolean xaccAccountGetTaxRelated (Account *account) { - kvp_value *kvp; + KvpValue *kvp; if (!account) return FALSE; @@ -2237,7 +2237,7 @@ xaccAccountGetTaxRelated (Account *account) void xaccAccountSetTaxRelated (Account *account, gboolean tax_related) { - kvp_value *new_value; + KvpValue *new_value; if (!account) return; @@ -2258,7 +2258,7 @@ xaccAccountSetTaxRelated (Account *account, gboolean tax_related) const char * xaccAccountGetTaxUSCode (Account *account) { - kvp_value *value; + KvpValue *value; if (!account) return FALSE; @@ -2273,7 +2273,7 @@ xaccAccountGetTaxUSCode (Account *account) void xaccAccountSetTaxUSCode (Account *account, const char *code) { - kvp_frame *frame; + KvpFrame *frame; if (!account) return; @@ -2293,7 +2293,7 @@ xaccAccountSetTaxUSCode (Account *account, const char *code) const char * xaccAccountGetTaxUSPayerNameSource (Account *account) { - kvp_value *value; + KvpValue *value; if (!account) return FALSE; @@ -2309,7 +2309,7 @@ xaccAccountGetTaxUSPayerNameSource (Account *account) void xaccAccountSetTaxUSPayerNameSource (Account *account, const char *source) { - kvp_frame *frame; + KvpFrame *frame; if (!account) return; @@ -2332,7 +2332,7 @@ xaccAccountSetTaxUSPayerNameSource (Account *account, const char *source) gboolean xaccAccountGetPlaceholder (Account *account) { - kvp_value *kvp; + KvpValue *kvp; char *setting; if ( ( account ) && @@ -2595,7 +2595,7 @@ xaccAccountTypesCompatible (GNCAccountType parent_type, gboolean xaccAccountGetReconcileLastDate (Account *account, time_t *last_date) { - kvp_value *value; + KvpValue *value; if (!account) return FALSE; @@ -2622,7 +2622,7 @@ xaccAccountGetReconcileLastDate (Account *account, time_t *last_date) void xaccAccountSetReconcileLastDate (Account *account, time_t last_date) { - kvp_frame *frame; + KvpFrame *frame; if (!account) return; @@ -2642,7 +2642,7 @@ xaccAccountSetReconcileLastDate (Account *account, time_t last_date) gboolean xaccAccountGetReconcileLastInterval (Account *account, int *months, int *days) { - kvp_value *value1, *value2; + KvpValue *value1, *value2; if (!account) return FALSE; @@ -2668,7 +2668,7 @@ xaccAccountGetReconcileLastInterval (Account *account, int *months, int *days) void xaccAccountSetReconcileLastInterval (Account *account, int months, int days) { - kvp_frame *frame; + KvpFrame *frame; if (!account) return; @@ -2692,7 +2692,7 @@ gboolean xaccAccountGetReconcilePostponeDate (Account *account, time_t *postpone_date) { - kvp_value *value; + KvpValue *value; if (!account) return FALSE; @@ -2720,7 +2720,7 @@ void xaccAccountSetReconcilePostponeDate (Account *account, time_t postpone_date) { - kvp_frame *frame; + KvpFrame *frame; if (!account) return; @@ -2743,7 +2743,7 @@ gboolean xaccAccountGetReconcilePostponeBalance (Account *account, gnc_numeric *balance) { - kvp_value *value; + KvpValue *value; if (!account) return FALSE; @@ -2772,7 +2772,7 @@ void xaccAccountSetReconcilePostponeBalance (Account *account, gnc_numeric balance) { - kvp_frame *frame; + KvpFrame *frame; if (!account) return; @@ -2819,7 +2819,7 @@ xaccAccountClearReconcilePostpone (Account *account) gboolean xaccAccountGetAutoInterestXfer (Account *account, gboolean default_value) { - kvp_value *value = NULL; + KvpValue *value = NULL; char *setting = NULL; gboolean result = default_value; @@ -2846,7 +2846,7 @@ xaccAccountGetAutoInterestXfer (Account *account, gboolean default_value) void xaccAccountSetAutoInterestXfer (Account *account, gboolean option) { - kvp_frame *frame; + KvpFrame *frame; if (!account) return; @@ -2870,7 +2870,7 @@ xaccAccountSetAutoInterestXfer (Account *account, gboolean option) const char * xaccAccountGetLastNum (Account *account) { - kvp_value *value; + KvpValue *value; if (!account) return FALSE; @@ -2934,7 +2934,7 @@ dxaccAccountGetPriceSrc(Account *acc) t = acc->type; if((t == STOCK) || (t == MUTUAL) || (t == CURRENCY)) { - kvp_value *value = kvp_frame_get_slot(acc->kvp_data, "old-price-source"); + KvpValue *value = kvp_frame_get_slot(acc->kvp_data, "old-price-source"); if(value) return (kvp_value_get_string(value)); } return NULL; @@ -2975,7 +2975,7 @@ dxaccAccountGetQuoteTZ(Account *acc) t = acc->type; if((t == STOCK) || (t == MUTUAL) || (t == CURRENCY)) { - kvp_value *value = kvp_frame_get_slot(acc->kvp_data, "old-quote-tz"); + KvpValue *value = kvp_frame_get_slot(acc->kvp_data, "old-quote-tz"); if(value) return (kvp_value_get_string(value)); } return NULL; @@ -2987,7 +2987,7 @@ dxaccAccountGetQuoteTZ(Account *acc) void xaccAccountSetReconcileChildrenStatus(Account *account, gboolean status) { - kvp_frame *frame; + KvpFrame *frame; if (!account) return; @@ -3008,7 +3008,7 @@ xaccAccountSetReconcileChildrenStatus(Account *account, gboolean status) gboolean xaccAccountGetReconcileChildrenStatus(Account *account) { - kvp_value *status; + KvpValue *status; if (!account) return FALSE; /* access the account's kvp-data for status and return that, if no value diff --git a/src/engine/Account.h b/src/engine/Account.h index 1969e87b8f..62149ae054 100644 --- a/src/engine/Account.h +++ b/src/engine/Account.h @@ -402,10 +402,10 @@ gboolean xaccAccountHasAncestor (Account *account, Account *ancestor); /* ------------------ */ -/** @name Account kvp_frame getters/setters */ +/** @name Account KvpFrame getters/setters */ /** @{ */ -kvp_frame * xaccAccountGetSlots (Account *account); -void xaccAccountSetSlots_nc(Account *account, kvp_frame *frame); +KvpFrame * xaccAccountGetSlots (Account *account); +void xaccAccountSetSlots_nc(Account *account, KvpFrame *frame); /** Delete any old data in the account's kvp data. * This includes the old currency and security fields. */ diff --git a/src/engine/AccountP.h b/src/engine/AccountP.h index a249d88b4f..6165a504df 100644 --- a/src/engine/AccountP.h +++ b/src/engine/AccountP.h @@ -90,7 +90,7 @@ struct account_s * information in splits, transactions, and accounts. it's NULL * until accessed. See src/engine/kvp_doc.txt for a list and * description of the important keys. */ - kvp_frame * kvp_data; + KvpFrame * kvp_data; /* The type field is the account type, picked from the enumerated * list that includes BANK, STOCK, CREDIT, INCOME, etc. Its diff --git a/src/engine/Period.c b/src/engine/Period.c index dd3e82dc7d..8e3ea94c9b 100644 --- a/src/engine/Period.c +++ b/src/engine/Period.c @@ -312,8 +312,8 @@ add_closing_balances (AccountGroup *closed_grp, acc_list = xaccGroupGetAccountList (closed_grp); for (node=acc_list; node; node=node->next) { - kvp_frame *cwd; - kvp_value *vvv; + KvpFrame *cwd; + KvpValue *vvv; Account *twin; AccountGroup *childs; Account * candidate = (Account *) node->data; @@ -446,8 +446,8 @@ gnc_book_close_period (QofBook *existing_book, Timespec calve_date, { Query *query; QofBook *closing_book; - kvp_frame *exist_cwd, *partn_cwd; - kvp_value *vvv; + KvpFrame *exist_cwd, *partn_cwd; + KvpValue *vvv; Timespec ts; if (!existing_book) return NULL; diff --git a/src/engine/Query.c b/src/engine/Query.c index 31a367e21b..487b2b688b 100644 --- a/src/engine/Query.c +++ b/src/engine/Query.c @@ -511,7 +511,7 @@ xaccQueryAddGUIDMatchGL (QofQuery *q, GList *param_list, } void -xaccQueryAddKVPMatch(QofQuery *q, GSList *path, const kvp_value *value, +xaccQueryAddKVPMatch(QofQuery *q, GSList *path, const KvpValue *value, QofQueryCompare how, QofIdType id_type, QofQueryOp op) { diff --git a/src/engine/Query.h b/src/engine/Query.h index 227a1d3e5c..70321b96eb 100644 --- a/src/engine/Query.h +++ b/src/engine/Query.h @@ -206,7 +206,7 @@ void xaccQueryAddGUIDMatchGL (QofQuery *q, GList *param_list, GUID guid, QofQueryOp op); /* given kvp value is on right side of comparison */ -void xaccQueryAddKVPMatch(Query *q, GSList *path, const kvp_value *value, +void xaccQueryAddKVPMatch(Query *q, GSList *path, const KvpValue *value, QofQueryCompare how, QofIdType id_type, QofQueryOp op); diff --git a/src/engine/QueryP.h b/src/engine/QueryP.h index 9982200b78..ef1abd5778 100644 --- a/src/engine/QueryP.h +++ b/src/engine/QueryP.h @@ -100,7 +100,7 @@ typedef struct { kvp_match_t how; kvp_match_where_t where; GSList *path; - kvp_value *value; + KvpValue *value; } KVPPredicateData; typedef struct { diff --git a/src/engine/SX-ttinfo.c b/src/engine/SX-ttinfo.c index 95312a79ef..e8ca8ddb7b 100644 --- a/src/engine/SX-ttinfo.c +++ b/src/engine/SX-ttinfo.c @@ -27,7 +27,7 @@ #include "SX-ttinfo.h" -/* kvp_frame policy? */ +/* KvpFrame policy? */ struct TTInfo_s { /* FIXME add notes field */ @@ -41,7 +41,7 @@ struct TTInfo_s struct TTSplitInfo_s { char *action; /* owned by us */ - /* FIXME: What about the split's kvp_frame */ + /* FIXME: What about the split's KvpFrame */ char *memo; /* owned by us */ char *credit_formula, *debit_formula; /* owned by us */ Account *acc; diff --git a/src/engine/SchedXaction.c b/src/engine/SchedXaction.c index a30301a3f1..94c064b1a7 100644 --- a/src/engine/SchedXaction.c +++ b/src/engine/SchedXaction.c @@ -327,7 +327,7 @@ xaccSchedXactionSetRemOccur( SchedXaction *sx, } -kvp_value * +KvpValue * xaccSchedXactionGetSlot( SchedXaction *sx, const char *slot ) { if (!sx) @@ -341,7 +341,7 @@ xaccSchedXactionGetSlot( SchedXaction *sx, const char *slot ) void xaccSchedXactionSetSlot( SchedXaction *sx, const char *slot, - const kvp_value *value ) + const KvpValue *value ) { if (!sx) { @@ -353,14 +353,14 @@ xaccSchedXactionSetSlot( SchedXaction *sx, return; } -kvp_frame* +KvpFrame* xaccSchedXactionGetSlots( SchedXaction *sx ) { return sx->kvp_data; } void -xaccSchedXactionSetSlots( SchedXaction *sx, kvp_frame *frm ) +xaccSchedXactionSetSlots( SchedXaction *sx, KvpFrame *frm ) { sx->kvp_data = frm; sx->dirty = TRUE; @@ -587,8 +587,8 @@ pack_split_info (TTSplitInfo *s_info, Account *parent_acct, Transaction *parent_trans, QofBook *book) { Split *split; - kvp_frame *split_frame; - kvp_value *tmp_value; + KvpFrame *split_frame; + KvpValue *tmp_value; const GUID *acc_guid; split = xaccMallocSplit(book); diff --git a/src/engine/SchedXaction.h b/src/engine/SchedXaction.h index 855ff0e633..1ac7a3ec73 100644 --- a/src/engine/SchedXaction.h +++ b/src/engine/SchedXaction.h @@ -40,7 +40,7 @@ #include "qofbook.h" /* - * #defines for kvp_frame strings + * #defines for KvpFrame strings * FIXME: Is this the right spot for them ? * FIXME: No, they should be private data and there should * be an api for getting/setting the values @@ -158,22 +158,22 @@ void xaccSchedXactionSetAdvanceReminder( SchedXaction *sx, gint reminderDays ); /* * The following function is slightly risky. If you change - * the retrieved kvp_frame you must mark the SchedXaction + * the retrieved KvpFrame you must mark the SchedXaction * dirty with xaccSchedXactionSetDirtyness */ -kvp_frame *xaccSchedXactionGetSlots( SchedXaction *sx ); +KvpFrame *xaccSchedXactionGetSlots( SchedXaction *sx ); /** * Sets the SX kvp data to the given kvp_frame. * NOTE: This is not copied, but set directly. **/ void xaccSchedXactionSetSlots( SchedXaction *sx, - kvp_frame *frm ); + KvpFrame *frm ); /** * Use the following two functions in preference to * the above two . . . */ -kvp_value *xaccSchedXactionGetSlot( SchedXaction *sx, +KvpValue *xaccSchedXactionGetSlot( SchedXaction *sx, const char *slot ); /* @@ -182,7 +182,7 @@ kvp_value *xaccSchedXactionGetSlot( SchedXaction *sx, void xaccSchedXactionSetSlot( SchedXaction *sx, const char *slot, - const kvp_value *value ); + const KvpValue *value ); const GUID *xaccSchedXactionGetGUID( SchedXaction *sx ); void xaccSchedXactionSetGUID( SchedXaction *sx, GUID g ); diff --git a/src/engine/SchedXactionP.h b/src/engine/SchedXactionP.h index 20e7fafcb1..d5d6882410 100644 --- a/src/engine/SchedXactionP.h +++ b/src/engine/SchedXactionP.h @@ -84,7 +84,7 @@ struct gncp_SchedXaction /* Changed since last save? */ gboolean dirty; - kvp_frame *kvp_data; + KvpFrame *kvp_data; }; /** Just the variable temporal bits from the SX structure. */ diff --git a/src/engine/Scrub2.c b/src/engine/Scrub2.c index 565d850abf..2c52d12e3a 100644 --- a/src/engine/Scrub2.c +++ b/src/engine/Scrub2.c @@ -313,8 +313,8 @@ GetOrMakeLotOrphanAccount (AccountGroup *root, gnc_commodity * currency) void xaccAccountSetDefaultGainAccount (Account *acc, Account *gain_acct) { - kvp_frame *cwd; - kvp_value *vvv; + KvpFrame *cwd; + KvpValue *vvv; const char * cur_name; if (!acc || !gain_acct) return; @@ -338,8 +338,8 @@ Account * xaccAccountGetDefaultGainAccount (Account *acc, gnc_commodity * currency) { Account *gain_acct = NULL; - kvp_frame *cwd; - kvp_value *vvv; + KvpFrame *cwd; + KvpValue *vvv; GUID * gain_acct_guid; const char * cur_name; @@ -367,8 +367,8 @@ static Account * GetOrMakeGainAcct (Account *acc, gnc_commodity * currency) { Account *gain_acct = NULL; - kvp_frame *cwd; - kvp_value *vvv; + KvpFrame *cwd; + KvpValue *vvv; GUID * gain_acct_guid; const char * cur_name; diff --git a/src/engine/Transaction.c b/src/engine/Transaction.c index 65479f70e2..9e40d88412 100644 --- a/src/engine/Transaction.c +++ b/src/engine/Transaction.c @@ -607,7 +607,7 @@ get_commodity_denom(const Split * s) * xaccSplitGetSlots ********************************************************************/ -kvp_frame * +KvpFrame * xaccSplitGetSlots (const Split * s) { if(!s) return NULL; @@ -615,7 +615,7 @@ xaccSplitGetSlots (const Split * s) } void -xaccSplitSetSlots_nc(Split *s, kvp_frame *frm) +xaccSplitSetSlots_nc(Split *s, KvpFrame *frm) { g_return_if_fail(s); g_return_if_fail(frm); @@ -1238,7 +1238,7 @@ xaccTransEqual(const Transaction *ta, const Transaction *tb, * xaccTransGetSlots ********************************************************************/ -kvp_frame * +KvpFrame * xaccTransGetSlots (const Transaction *t) { if(!t) return NULL; @@ -1246,7 +1246,7 @@ xaccTransGetSlots (const Transaction *t) } void -xaccTransSetSlots_nc (Transaction *t, kvp_frame *frm) +xaccTransSetSlots_nc (Transaction *t, KvpFrame *frm) { g_return_if_fail(t); g_return_if_fail(frm); @@ -2685,7 +2685,7 @@ xaccTransSetDate (Transaction *trans, int day, int mon, int year) void xaccTransSetDateDueTS (Transaction *trans, const Timespec *ts) { - kvp_value *value; + KvpValue *value; if (!trans || !ts) return; @@ -2697,7 +2697,7 @@ xaccTransSetDateDueTS (Transaction *trans, const Timespec *ts) void xaccTransSetTxnType (Transaction *trans, char type) { - kvp_value *value; + KvpValue *value; char s[2]; if (!trans) return; @@ -2803,7 +2803,7 @@ xaccTransGetDescription (const Transaction *trans) const char * xaccTransGetNotes (const Transaction *trans) { - kvp_value *v; + KvpValue *v; if (!trans) return NULL; @@ -2856,7 +2856,7 @@ xaccTransRetDateEnteredTS (const Transaction *trans) void xaccTransGetDateDueTS (const Transaction *trans, Timespec *ts) { - kvp_value *value; + KvpValue *value; if (!trans || !ts) return; @@ -2880,7 +2880,7 @@ xaccTransRetDateDueTS (const Transaction *trans) char xaccTransGetTxnType (const Transaction *trans) { - kvp_value *value; + KvpValue *value; const char *s; if (!trans) return TXN_TYPE_NONE; @@ -2896,7 +2896,7 @@ xaccTransGetTxnType (const Transaction *trans) const char * xaccTransGetReadOnly (const Transaction *trans) { - kvp_value *v; + KvpValue *v; if (!trans) return NULL; @@ -3171,8 +3171,8 @@ xaccSplitGetBook (const Split *split) const char * xaccSplitGetType(const Split *s) { - kvp_frame *frame; - kvp_value *split_type; + KvpFrame *frame; + KvpValue *split_type; if(!s) return NULL; frame = s->kvp_data; @@ -3318,8 +3318,8 @@ void xaccTransVoid(Transaction *transaction, const char *reason) { - kvp_frame *frame; - kvp_value *val; + KvpFrame *frame; + KvpValue *val; gnc_numeric amt, zero; GList *split_list; Split *split; @@ -3381,7 +3381,7 @@ xaccTransGetVoidStatus(const Transaction *trans) char * xaccTransGetVoidReason(const Transaction *trans) { - kvp_value *val; + KvpValue *val; char *reason; g_return_val_if_fail(trans, NULL); @@ -3399,7 +3399,7 @@ xaccTransGetVoidReason(const Transaction *trans) gnc_numeric xaccSplitVoidFormerAmount(const Split *split) { - kvp_value *val; + KvpValue *val; gnc_numeric amt = gnc_numeric_zero(); g_return_val_if_fail(split, amt); @@ -3416,7 +3416,7 @@ xaccSplitVoidFormerAmount(const Split *split) gnc_numeric xaccSplitVoidFormerValue(const Split *split) { - kvp_value *val; + KvpValue *val; gnc_numeric amt = gnc_numeric_zero(); g_return_val_if_fail(split, amt); @@ -3434,7 +3434,7 @@ xaccSplitVoidFormerValue(const Split *split) Timespec xaccTransGetVoidTime(const Transaction *tr) { - kvp_value *val; + KvpValue *val; Timespec void_time = {0,0}; g_return_val_if_fail(tr, void_time); @@ -3452,8 +3452,8 @@ xaccTransGetVoidTime(const Transaction *tr) void xaccTransUnvoid (Transaction *transaction) { - kvp_frame *frame; - kvp_value *val; + KvpFrame *frame; + KvpValue *val; gnc_numeric amt; GList *split_list; Split *split; diff --git a/src/engine/Transaction.h b/src/engine/Transaction.h index f33fa383ca..d2b02cdec4 100644 --- a/src/engine/Transaction.h +++ b/src/engine/Transaction.h @@ -212,15 +212,15 @@ void xaccTransSortSplits (Transaction *trans); */ void xaccTransDump (Transaction *trans, const char *tag); -/** Returns the transaction's kvp_frame slots. +/** Returns the transaction's KvpFrame slots. * Transaction slots are used to store arbitrary strings, numbers, and structures which aren't members of the transaction struct. */ -kvp_frame *xaccTransGetSlots(const Transaction *trans); +KvpFrame *xaccTransGetSlots(const Transaction *trans); -/** Set the kvp_frame slots of this transaction to the given frm by +/** Set the KvpFrame slots of this transaction to the given frm by * directly using the frm pointer (i.e. non-copying). */ -void xaccTransSetSlots_nc(Transaction *t, kvp_frame *frm); +void xaccTransSetSlots_nc(Transaction *t, KvpFrame *frm); /** Set the Transaction Type @@ -465,17 +465,17 @@ Transaction * xaccSplitGetParent (const Split *split); GNCLot * xaccSplitGetLot (const Split *split); -/** Returns the kvp_frame slots of this split for direct editing. +/** Returns the KvpFrame slots of this split for direct editing. * * Split slots are used to store arbitrary strings, numbers, and * structures which aren't members of the transaction struct. See * kvp_doc.txt for reserved slot names. */ -kvp_frame *xaccSplitGetSlots(const Split *split); +KvpFrame *xaccSplitGetSlots(const Split *split); -/** Set the kvp_frame slots of this split to the given frm by directly +/** Set the KvpFrame slots of this split to the given frm by directly * using the frm pointer (i.e. non-copying). */ -void xaccSplitSetSlots_nc(Split *s, kvp_frame *frm); +void xaccSplitSetSlots_nc(Split *s, KvpFrame *frm); /** The xaccSplitGetGUID() subroutine will return the diff --git a/src/engine/TransactionP.h b/src/engine/TransactionP.h index 34b5fd26eb..b95b4264b7 100644 --- a/src/engine/TransactionP.h +++ b/src/engine/TransactionP.h @@ -106,7 +106,7 @@ struct split_s /* kvp_data is a key-value pair database for storing simple * "extra" information in splits, transactions, and accounts. * it's NULL until accessed. */ - kvp_frame * kvp_data; + KvpFrame * kvp_data; char reconciled; /* The reconciled field */ Timespec date_reconciled; /* date split was reconciled */ @@ -160,7 +160,7 @@ struct transaction_s /* kvp_data is a key-value pair database for storing simple * "extra" information in splits, transactions, and accounts. * it's NULL until accessed. */ - kvp_frame * kvp_data; + KvpFrame * kvp_data; /* The common_currency field is the balancing common currency for diff --git a/src/engine/engine-helpers.c b/src/engine/engine-helpers.c index dec58929c5..e7bf7ade7c 100644 --- a/src/engine/engine-helpers.c +++ b/src/engine/engine-helpers.c @@ -594,31 +594,31 @@ gnc_query_path_free (GSList *path) } static SCM -gnc_kvp_value_type2scm (kvp_value_t how) +gnc_KvpValueTypeype2scm (KvpValueType how) { return gnc_gw_enum_val2scm ("", how); } -static kvp_value_t -gnc_scm2kvp_value_type (SCM value_type_scm) +static KvpValueType +gnc_scm2KvpValueTypeype (SCM value_type_scm) { return gnc_gw_enum_scm2val ("", value_type_scm); } -static SCM gnc_kvp_frame2scm (kvp_frame *frame); +static SCM gnc_kvp_frame2scm (KvpFrame *frame); static SCM -gnc_kvp_value2scm (kvp_value *value) +gnc_kvp_value2scm (KvpValue *value) { SCM value_scm = SCM_EOL; - kvp_value_t value_t; + KvpValueType value_t; SCM scm; if (!value) return SCM_BOOL_F; value_t = kvp_value_get_type (value); - value_scm = scm_cons (gnc_kvp_value_type2scm (value_t), value_scm); + value_scm = scm_cons (gnc_KvpValueTypeype2scm (value_t), value_scm); switch (value_t) { @@ -682,7 +682,7 @@ typedef struct } KVPSCMData; static void -kvp_frame_slot2scm (const char *key, kvp_value *value, gpointer data) +kvp_frame_slot2scm (const char *key, KvpValue *value, gpointer data) { KVPSCMData *ksd = data; SCM value_scm; @@ -697,7 +697,7 @@ kvp_frame_slot2scm (const char *key, kvp_value *value, gpointer data) } static SCM -gnc_kvp_frame2scm (kvp_frame *frame) +gnc_kvp_frame2scm (KvpFrame *frame) { KVPSCMData ksd; @@ -710,13 +710,13 @@ gnc_kvp_frame2scm (kvp_frame *frame) return ksd.scm; } -static kvp_frame * gnc_scm2kvp_frame (SCM frame_scm); +static KvpFrame * gnc_scm2KvpFrame (SCM frame_scm); -static kvp_value * -gnc_scm2kvp_value (SCM value_scm) +static KvpValue * +gnc_scm2KvpValue (SCM value_scm) { - kvp_value_t value_t; - kvp_value *value; + KvpValueType value_t; + KvpValue *value; SCM type_scm; SCM val_scm; @@ -724,7 +724,7 @@ gnc_scm2kvp_value (SCM value_scm) return NULL; type_scm = SCM_CAR (value_scm); - value_t = gnc_scm2kvp_value_type (type_scm); + value_t = gnc_scm2KvpValueTypeype (type_scm); value_scm = SCM_CDR (value_scm); if (!SCM_LISTP (value_scm) || SCM_NULLP (value_scm)) @@ -786,7 +786,7 @@ gnc_scm2kvp_value (SCM value_scm) { SCM scm = SCM_CAR (val_scm); - list = g_list_prepend (list, gnc_scm2kvp_value (scm)); + list = g_list_prepend (list, gnc_scm2KvpValue (scm)); } list = g_list_reverse (list); @@ -800,9 +800,9 @@ gnc_scm2kvp_value (SCM value_scm) } case KVP_TYPE_FRAME: { - kvp_frame *frame; + KvpFrame *frame; - frame = gnc_scm2kvp_frame (val_scm); + frame = gnc_scm2KvpFrame (val_scm); value = kvp_value_new_frame (frame); kvp_frame_delete (frame); break; @@ -816,10 +816,10 @@ gnc_scm2kvp_value (SCM value_scm) return value; } -static kvp_frame * -gnc_scm2kvp_frame (SCM frame_scm) +static KvpFrame * +gnc_scm2KvpFrame (SCM frame_scm) { - kvp_frame * frame; + KvpFrame * frame; if (!SCM_LISTP (frame_scm)) return NULL; @@ -829,7 +829,7 @@ gnc_scm2kvp_frame (SCM frame_scm) frame_scm = SCM_CDR (frame_scm)) { SCM pair = SCM_CAR (frame_scm); - kvp_value *value; + KvpValue *value; SCM key_scm; SCM val_scm; char *key; @@ -847,7 +847,7 @@ gnc_scm2kvp_frame (SCM frame_scm) if (!key) continue; - value = gnc_scm2kvp_value (val_scm); + value = gnc_scm2KvpValue (val_scm); if (!value) { free (key); @@ -1118,7 +1118,7 @@ gnc_scm2query_term_query_v2 (SCM qt_scm) } else if (!safe_strcmp (type, QOF_QUERYCORE_KVP)) { GSList *kvp_path; - kvp_value *value; + KvpValue *value; scm = SCM_CAR (qt_scm); qt_scm = SCM_CDR (qt_scm); @@ -1132,7 +1132,7 @@ gnc_scm2query_term_query_v2 (SCM qt_scm) gnc_query_path_free (kvp_path); break; } - value = gnc_scm2kvp_value (scm); + value = gnc_scm2KvpValue (scm); pd = qof_query_kvp_predicate (compare_how, kvp_path, value); gnc_query_path_free (kvp_path); @@ -1432,7 +1432,7 @@ gnc_scm2query_term_query_v1 (SCM query_term_scm) } else if (!safe_strcmp (pd_type, "pd-kvp")) { GSList *path; - kvp_value *value; + KvpValue *value; QofQueryCompare how; QofIdType where; @@ -1462,7 +1462,7 @@ gnc_scm2query_term_query_v1 (SCM query_term_scm) break; scm = SCM_CAR (query_term_scm); query_term_scm = SCM_CDR (query_term_scm); - value = gnc_scm2kvp_value (scm); + value = gnc_scm2KvpValue (scm); xaccQueryAddKVPMatch (q, path, value, how, where, QOF_QUERY_OR); diff --git a/src/engine/gnc-associate-account.c b/src/engine/gnc-associate-account.c index ada5254a48..a5115bc86c 100644 --- a/src/engine/gnc-associate-account.c +++ b/src/engine/gnc-associate-account.c @@ -52,11 +52,11 @@ static char * income_to_key[] = {"income-miscellaneous", static char * expense_to_key[] = {"expense-miscellaneous", "expense-commission"}; -static kvp_frame * -get_assoc_acc_frame(kvp_frame *account_frame) +static KvpFrame * +get_assoc_acc_frame(KvpFrame *account_frame) { - kvp_frame *assoc_acc_frame; - kvp_value *assoc_acc_frame_kvpvalue = + KvpFrame *assoc_acc_frame; + KvpValue *assoc_acc_frame_kvpvalue = kvp_frame_get_slot(account_frame, "associated-accounts"); assoc_acc_frame = kvp_value_get_frame(assoc_acc_frame_kvpvalue); @@ -76,8 +76,8 @@ back_associate_expense_accounts(Account *stock_account, GList *accounts, GNCTrackingExpenseCategory category) { - kvp_frame *acc_frame; - kvp_value *val, *stock_acc_guid_kvpval, *stock_acc_category_kvpval; + KvpFrame *acc_frame; + KvpValue *val, *stock_acc_guid_kvpval, *stock_acc_category_kvpval; const GUID *stock_acc_guid; const GUID *existing_acc_guid; @@ -111,8 +111,8 @@ back_associate_income_accounts(Account *stock_account, GList *accounts, GNCTrackingIncomeCategory category) { - kvp_frame *acc_frame; - kvp_value *val, *stock_acc_guid_kvpval, *stock_acc_category_kvpval; + KvpFrame *acc_frame; + KvpValue *val, *stock_acc_guid_kvpval, *stock_acc_category_kvpval; const GUID *stock_acc_guid; const GUID *existing_acc_guid; @@ -141,12 +141,12 @@ back_associate_income_accounts(Account *stock_account, return; } -static kvp_value * +static KvpValue * make_kvpd_on_list(GList *account_list) { GList *iter; - kvp_value *retval; - kvp_value *guid_kvp; + KvpValue *retval; + KvpValue *guid_kvp; GList *kvp_acc_list = NULL; const GUID *acc_id; @@ -171,7 +171,7 @@ make_kvpd_on_list(GList *account_list) } static GList * -de_kvp_account_list(kvp_value *kvpd_list, QofBook *book) +de_kvp_account_list(KvpValue *kvpd_list, QofBook *book) { GList *guid_account_list = kvp_value_get_glist(kvpd_list); if (guid_account_list) @@ -213,8 +213,8 @@ gnc_tracking_associate_income_accounts(Account *stock_account, GNCTrackingIncomeCategory category, GList *account_list) { - kvp_frame *account_frame, *inc_account_frame; - kvp_value *kvpd_on_account_list; + KvpFrame *account_frame, *inc_account_frame; + KvpValue *kvpd_on_account_list; GNCAccountType type; g_return_if_fail(stock_account); @@ -255,8 +255,8 @@ gnc_tracking_asssociate_expense_account(Account *stock_account, GNCTrackingExpenseCategory category, GList *account_list) { - kvp_frame *account_frame, *expense_acc_frame; - kvp_value *kvpd_on_account_list; + KvpFrame *account_frame, *expense_acc_frame; + KvpValue *kvpd_on_account_list; GNCAccountType type; g_return_if_fail(stock_account); @@ -295,8 +295,8 @@ gnc_tracking_find_expense_accounts(Account *stock_account, { GNCAccountType type; - kvp_frame *account_frame, *expense_acc_frame; - kvp_value *kvpd_on_account_list; + KvpFrame *account_frame, *expense_acc_frame; + KvpValue *kvpd_on_account_list; type = xaccAccountGetType(stock_account); g_return_val_if_fail(category >= 0 && category < GNC_TR_EXP_N_CATEGORIES, @@ -329,8 +329,8 @@ gnc_tracking_find_income_accounts(Account *stock_account, GNCTrackingIncomeCategory category) { GNCAccountType type; - kvp_frame *account_frame, *income_acc_frame; - kvp_value *kvpd_on_account_list; + KvpFrame *account_frame, *income_acc_frame; + KvpValue *kvpd_on_account_list; type = xaccAccountGetType(stock_account); g_return_val_if_fail(category >= 0 && category < GNC_TR_INC_N_CATEGORIES, @@ -429,9 +429,9 @@ void gnc_tracking_dissociate_account(Account *inc_or_expense_account) { GNCAccountType type; - kvp_frame *stock_account_kvpframe, *assoc_acc_kvpframe; - kvp_frame *current_account_kvpframe; - kvp_value *stock_account_kvpval, *acc_list_kvpval, *category_kvpval; + KvpFrame *stock_account_kvpframe, *assoc_acc_kvpframe; + KvpFrame *current_account_kvpframe; + KvpValue *stock_account_kvpval, *acc_list_kvpval, *category_kvpval; const GUID *stock_account_guid, *inc_or_expense_account_guid, *current_guid; Account *stock_account; char *category_name; diff --git a/src/engine/gnc-lot-p.h b/src/engine/gnc-lot-p.h index c1e90d46bc..4652cfe28b 100644 --- a/src/engine/gnc-lot-p.h +++ b/src/engine/gnc-lot-p.h @@ -51,7 +51,7 @@ struct gnc_lot_struct QofBook *book; /* Anchor for generic lot-specific data. */ - kvp_frame *kvp_data; + KvpFrame *kvp_data; /* Account to which this lot applies. All splits in the lot must * belong to this account. diff --git a/src/engine/gnc-lot.c b/src/engine/gnc-lot.c index e482756b1a..45f44a2c53 100644 --- a/src/engine/gnc-lot.c +++ b/src/engine/gnc-lot.c @@ -158,7 +158,7 @@ gnc_lot_get_account (GNCLot *lot) return lot->account; } -kvp_frame * +KvpFrame * gnc_lot_get_slots (GNCLot *lot) { if (!lot) return NULL; diff --git a/src/engine/gnc-lot.h b/src/engine/gnc-lot.h index e7d6a44cba..78c64d147d 100644 --- a/src/engine/gnc-lot.h +++ b/src/engine/gnc-lot.h @@ -94,7 +94,7 @@ Split * gnc_lot_get_latest_split (GNCLot *lot); /** Every lot has a place to hang kvp data. This routine returns that * place. * */ -kvp_frame * gnc_lot_get_slots (GNCLot *); +KvpFrame * gnc_lot_get_slots (GNCLot *); #define LOT_IS_CLOSED "is-closed?" #define LOT_BALANCE "balance" diff --git a/src/engine/gw-engine-spec.scm b/src/engine/gw-engine-spec.scm index 63d926be7e..c08c9475ad 100644 --- a/src/engine/gw-engine-spec.scm +++ b/src/engine/gw-engine-spec.scm @@ -178,7 +178,7 @@ (gw:enum-add-value! wt "QUERY_TXN_MATCH_ANY" 'query-txn-match-any) #t) -(let ((wt (gw:wrap-enumeration ws ' "kvp_value_t"))) +(let ((wt (gw:wrap-enumeration ws ' "KvpValueType"))) (gw:enum-add-value! wt "KVP_TYPE_GINT64" 'kvp-type-gint64) (gw:enum-add-value! wt "KVP_TYPE_DOUBLE" 'kvp-type-double) (gw:enum-add-value! wt "KVP_TYPE_NUMERIC" 'kvp-type-numeric) diff --git a/src/engine/gw-kvp-spec.scm b/src/engine/gw-kvp-spec.scm index 431c668d1d..57367c6878 100644 --- a/src/engine/gw-kvp-spec.scm +++ b/src/engine/gw-kvp-spec.scm @@ -31,11 +31,11 @@ "#include \n" "#include \n"))) - (gw:wrap-as-wct ws ' "kvp_frame*" "const kvp_frame*") + (gw:wrap-as-wct ws ' "KvpFrame*" "const KvpFrame*") (gw:wrap-simple-type ws - ' "kvp_value*" + ' "KvpValue*" '("gnc_kvp_value_ptr_p(" scm-var ")") '(c-var " = gnc_scm_to_kvp_value_ptr(" scm-var ");\n") '(scm-var " = gnc_kvp_value_ptr_to_scm(" c-var ");\n")) @@ -47,7 +47,7 @@ "gnc_kvp_frame_delete_at_path" '(( f) ((gw:gslist-of ( caller-owned const) caller-owned) key-path)) - "Deletes the kvp_frame at the key-path in frame f") + "Deletes the KvpFrame at the key-path in frame f") (gw:wrap-function ws diff --git a/src/engine/kvp-scm.c b/src/engine/kvp-scm.c index bca9999a0f..ce2ce9aa64 100644 --- a/src/engine/kvp-scm.c +++ b/src/engine/kvp-scm.c @@ -18,8 +18,9 @@ gnc_kvp_value_ptr_p(SCM arg) * 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. */ -kvp_value* + * types based only on the scheme type. + */ +KvpValue * gnc_scm_to_kvp_value_ptr(SCM val) { if(SCM_EXACTP (val) && gnc_gh_gint64_p(val)) @@ -47,7 +48,7 @@ gnc_scm_to_kvp_value_ptr(SCM val) else if(SCM_STRINGP(val)) { char *newstr; - kvp_value *ret; + KvpValue *ret; newstr = gh_scm2newstr(val, NULL); ret = kvp_value_new_string(newstr); free(newstr); @@ -56,7 +57,7 @@ gnc_scm_to_kvp_value_ptr(SCM val) else if(gw_wcp_p(val) && gw_wcp_is_of_type_p(scm_c_eval_string(""), val)) { - kvp_frame *frame = gw_wcp_get_ptr(val); + KvpFrame *frame = gw_wcp_get_ptr(val); return kvp_value_new_frame (frame); } /* FIXME: add binary handler here when it's figured out */ @@ -65,7 +66,7 @@ gnc_scm_to_kvp_value_ptr(SCM val) } SCM -gnc_kvp_value_ptr_to_scm(kvp_value* val) +gnc_kvp_value_ptr_to_scm(KvpValue* val) { switch(kvp_value_get_type(val)) { @@ -93,7 +94,7 @@ gnc_kvp_value_ptr_to_scm(kvp_value* val) case KVP_TYPE_FRAME: { - kvp_frame *frame = kvp_value_get_frame(val); + KvpFrame *frame = kvp_value_get_frame(val); if (frame) return gw_wcp_assimilate_ptr (frame, scm_c_eval_string("")); @@ -110,7 +111,7 @@ gnc_kvp_value_ptr_to_scm(kvp_value* val) } void -gnc_kvp_frame_delete_at_path (kvp_frame *frame, GSList *key_path) +gnc_kvp_frame_delete_at_path (KvpFrame *frame, GSList *key_path) { kvp_frame_set_slot_path_gslist (frame, NULL, key_path); } diff --git a/src/engine/kvp-scm.h b/src/engine/kvp-scm.h index 2aa8b21058..6acbf71ad2 100644 --- a/src/engine/kvp-scm.h +++ b/src/engine/kvp-scm.h @@ -5,9 +5,9 @@ #include int gnc_kvp_value_ptr_p(SCM arg); -kvp_value* gnc_scm_to_kvp_value_ptr(SCM kvpval); -SCM gnc_kvp_value_ptr_to_scm(kvp_value* val); -void gnc_kvp_frame_delete_at_path(kvp_frame *frame, GSList *key_path); +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); #endif /* KVP_SCM_H */ diff --git a/src/engine/kvp-util-p.h b/src/engine/kvp-util-p.h index 9b03ca5c5d..fb5f9ee5d2 100644 --- a/src/engine/kvp-util-p.h +++ b/src/engine/kvp-util-p.h @@ -41,6 +41,6 @@ * /gemini//date, where = ncopies-1. */ -void gnc_kvp_gemini (kvp_frame *, const GUID *, const GUID *, time_t); +void gnc_kvp_gemini (KvpFrame *, const GUID *, const GUID *, time_t); #endif /* XACC_KVP_UTIL_P_H */ diff --git a/src/engine/kvp-util.c b/src/engine/kvp-util.c index ecd29b20d0..896dda6ef9 100644 --- a/src/engine/kvp-util.c +++ b/src/engine/kvp-util.c @@ -38,12 +38,12 @@ */ void -gnc_kvp_gemini (kvp_frame *kvp_root, const GUID *acct_guid, +gnc_kvp_gemini (KvpFrame *kvp_root, const GUID *acct_guid, const GUID *book_guid, time_t secs) { char buff[80]; - kvp_frame *cwd, *pwd; - kvp_value *v_ncopies, *vvv; + KvpFrame *cwd, *pwd; + KvpValue *v_ncopies, *vvv; gint64 ncopies = 0; Timespec ts; diff --git a/src/engine/kvp_frame.c b/src/engine/kvp_frame.c index 0be2c51574..5fa595f453 100644 --- a/src/engine/kvp_frame.c +++ b/src/engine/kvp_frame.c @@ -1,7 +1,7 @@ /******************************************************************** * kvp_frame.c -- a key-value frame system for gnucash. * * Copyright (C) 2000 Bill Gribble * - * Copyright (C) 2001 Linas Vepstas * + * Copyright (C) 2001,2003Linas Vepstas * * * * This program is free software; you can redistribute it and/or * * modify it under the terms of the GNU General Public License as * @@ -39,20 +39,24 @@ /* Note that we keep the keys for this hash table in a GCache - * (gnc_string_cache), as it is likely we will see the same keys - * over and over again */ -struct _kvp_frame { + * (gnc_string_cache), as it is very likely we will see the + * same keys over and over again */ + +struct _KvpFrame +{ GHashTable * hash; }; -typedef struct { +typedef struct +{ void *data; int datasize; -} kvp_value_binary_data; +} KvpValueBinaryData; -struct _kvp_value { - kvp_value_t type; +struct _KvpValue +{ + KvpValueType type; union { gint64 int64; double dbl; @@ -60,9 +64,9 @@ struct _kvp_value { gchar *str; GUID *guid; Timespec timespec; - kvp_value_binary_data binary; + KvpValueBinaryData binary; GList *list; - kvp_frame *frame; + KvpFrame *frame; } value; }; @@ -70,7 +74,7 @@ struct _kvp_value { static short module = MOD_ENGINE; /******************************************************************** - * kvp_frame functions + * KvpFrame functions ********************************************************************/ static guint @@ -86,7 +90,7 @@ kvp_comp_func(gconstpointer v, gconstpointer v2) } static gboolean -init_frame_body_if_needed(kvp_frame *f) +init_frame_body_if_needed(KvpFrame *f) { if(!f->hash) { @@ -96,10 +100,10 @@ init_frame_body_if_needed(kvp_frame *f) return(f->hash != NULL); } -kvp_frame * +KvpFrame * kvp_frame_new(void) { - kvp_frame * retval = g_new0(kvp_frame, 1); + KvpFrame * retval = g_new0(KvpFrame, 1); /* save space until we have data */ retval->hash = NULL; return retval; @@ -109,11 +113,11 @@ static void kvp_frame_delete_worker(gpointer key, gpointer value, gpointer user_data) { g_cache_remove(gnc_engine_get_string_cache(), key); - kvp_value_delete((kvp_value *)value); + kvp_value_delete((KvpValue *)value); } void -kvp_frame_delete(kvp_frame * frame) +kvp_frame_delete(KvpFrame * frame) { if (!frame) return; @@ -131,7 +135,7 @@ kvp_frame_delete(kvp_frame * frame) } gboolean -kvp_frame_is_empty(kvp_frame * frame) +kvp_frame_is_empty(KvpFrame * frame) { if (!frame) return TRUE; if (!frame->hash) return TRUE; @@ -141,7 +145,7 @@ kvp_frame_is_empty(kvp_frame * frame) static void kvp_frame_copy_worker(gpointer key, gpointer value, gpointer user_data) { - kvp_frame * dest = (kvp_frame *)user_data; + KvpFrame * dest = (KvpFrame *)user_data; g_hash_table_freeze(dest->hash); g_hash_table_insert(dest->hash, (gpointer)g_cache_insert(gnc_engine_get_string_cache(), key), @@ -149,10 +153,10 @@ kvp_frame_copy_worker(gpointer key, gpointer value, gpointer user_data) g_hash_table_thaw(dest->hash); } -kvp_frame * -kvp_frame_copy(const kvp_frame * frame) +KvpFrame * +kvp_frame_copy(const KvpFrame * frame) { - kvp_frame * retval = kvp_frame_new(); + KvpFrame * retval = kvp_frame_new(); if (!frame) return retval; @@ -167,8 +171,8 @@ kvp_frame_copy(const kvp_frame * frame) } static void -kvp_frame_set_slot_destructively(kvp_frame * frame, const char * slot, - kvp_value * new_value) { +kvp_frame_set_slot_destructively(KvpFrame * frame, const char * slot, + KvpValue * new_value) { /* FIXME: no way to indicate errors... */ gpointer orig_key; @@ -201,10 +205,10 @@ kvp_frame_set_slot_destructively(kvp_frame * frame, const char * slot, } void -kvp_frame_set_slot(kvp_frame * frame, const char * slot, - const kvp_value * value) +kvp_frame_set_slot(KvpFrame * frame, const char * slot, + const KvpValue * value) { - kvp_value *new_value = NULL; + KvpValue *new_value = NULL; if (!frame) return; @@ -215,8 +219,8 @@ kvp_frame_set_slot(kvp_frame * frame, const char * slot, } void -kvp_frame_set_slot_nc(kvp_frame * frame, const char * slot, - kvp_value * value) +kvp_frame_set_slot_nc(KvpFrame * frame, const char * slot, + KvpValue * value) { if (!frame) return; @@ -225,19 +229,19 @@ kvp_frame_set_slot_nc(kvp_frame * frame, const char * slot, kvp_frame_set_slot_destructively(frame, slot, value); } -kvp_value * -kvp_frame_get_slot(kvp_frame * frame, const char * slot) +KvpValue * +kvp_frame_get_slot(KvpFrame * frame, const char * slot) { if (!frame) return NULL; if(!frame->hash) return(NULL); - return (kvp_value *)g_hash_table_lookup(frame->hash, slot); + return (KvpValue *)g_hash_table_lookup(frame->hash, slot); } /* ============================================================ */ void -kvp_frame_set_slot_path (kvp_frame *frame, - const kvp_value *new_value, +kvp_frame_set_slot_path (KvpFrame *frame, + const KvpValue *new_value, const char *first_key, ...) { va_list ap; @@ -253,7 +257,7 @@ kvp_frame_set_slot_path (kvp_frame *frame, while (TRUE) { - kvp_value *value; + KvpValue *value; const char *next_key; next_key = va_arg (ap, const char *); @@ -267,8 +271,8 @@ kvp_frame_set_slot_path (kvp_frame *frame, value = kvp_frame_get_slot (frame, key); if (!value) { - kvp_frame *new_frame = kvp_frame_new (); - kvp_value *frame_value = kvp_value_new_frame (new_frame); + KvpFrame *new_frame = kvp_frame_new (); + KvpValue *frame_value = kvp_value_new_frame (new_frame); kvp_frame_set_slot_nc (frame, key, frame_value); @@ -286,8 +290,8 @@ kvp_frame_set_slot_path (kvp_frame *frame, } void -kvp_frame_set_slot_path_gslist (kvp_frame *frame, - const kvp_value *new_value, +kvp_frame_set_slot_path_gslist (KvpFrame *frame, + const KvpValue *new_value, GSList *key_path) { if (!frame || !key_path) return; @@ -295,7 +299,7 @@ kvp_frame_set_slot_path_gslist (kvp_frame *frame, while (TRUE) { const char *key = key_path->data; - kvp_value *value; + KvpValue *value; if (!key) return; @@ -312,8 +316,8 @@ kvp_frame_set_slot_path_gslist (kvp_frame *frame, value = kvp_frame_get_slot (frame, key); if (!value) { - kvp_frame *new_frame = kvp_frame_new (); - kvp_value *frame_value = kvp_value_new_frame (new_frame); + KvpFrame *new_frame = kvp_frame_new (); + KvpValue *frame_value = kvp_value_new_frame (new_frame); kvp_frame_set_slot_nc (frame, key, frame_value); @@ -328,6 +332,80 @@ kvp_frame_set_slot_path_gslist (kvp_frame *frame, } } +/* ============================================================ */ +/* decode url-encoded string, do it in place + * + == space + * %xx == asci char where xx is hexadecimal ascii value + */ + +static void +decode (char *enc) +{ + char * p, *w; + + /* Loop, convert +'s to blanks */ + p = strchr (enc, '+'); + while (p) + { + *p = ' '; + p = strchr (p, '+'); + } + + p = strchr (enc, '%'); + w = p; + + while (p) + { + int ch,cl; + p++; + ch = *p - 0x30; /* ascii 0 = 0x30 */ + if (9 < ch) ch -= 0x11 + 10; /* uppercase A = 0x41 */ + if (16 < ch) ch -= 0x20; /* lowercase a = 0x61 */ + + p++; + cl = *p - 0x30; /* ascii 0 = 0x30 */ + if (9 < cl) cl -= 0x11 + 10; /* uppercase A = 0x41 */ + if (16 < cl) cl -= 0x20; /* lowercase a = 0x61 */ + + *w = (char) (ch<<4 | cl); + + w++; + *w = 0x0; /* null-terminate in case loop terminates */ + p = strchr (p, '%'); + } +} + +void +kvp_frame_add_url_encoding (KvpFrame *frame, const char *enc) +{ + char *buff, *p; + if (!frame || !enc) return; + + /* Loop over all key-value pairs in the encoded string */ + buff = g_strdup (enc); + p = buff; + while (*p) + { + char *n, *v; + n = strchr (p, '&'); /* n = next key-value */ + if (n) *n = 0x0; + + v = strchr (p, '='); /* v = pointer to value */ + if (!v) break; + *v = 0x0; + v ++; + + decode (p); + decode (v); + kvp_frame_set_slot_nc (frame, p, kvp_value_new_string(v)); + + if (!n) break; /* no next key, we are done */ + p = n++; + } + + g_free(buff); +} + /* ============================================================ */ /* * NOTE: This patch undoes a previous (brain-damaged) patch. @@ -345,11 +423,11 @@ kvp_frame_set_slot_path_gslist (kvp_frame *frame, * gcc -O3 should inline it. It performs no error checks, * the caller is responsible of passing good keys and frames. */ -static inline kvp_frame * -get_or_make (kvp_frame *fr, const char * key) +static inline KvpFrame * +get_or_make (KvpFrame *fr, const char * key) { - kvp_frame *next_frame; - kvp_value *value; + KvpFrame *next_frame; + KvpValue *value; value = kvp_frame_get_slot (fr, key); if (value) @@ -365,8 +443,8 @@ get_or_make (kvp_frame *fr, const char * key) return next_frame; } -kvp_frame * -kvp_frame_get_frame_gslist (kvp_frame *frame, GSList *key_path) +KvpFrame * +kvp_frame_get_frame_gslist (KvpFrame *frame, GSList *key_path) { if (!frame) return frame; @@ -385,8 +463,8 @@ kvp_frame_get_frame_gslist (kvp_frame *frame, GSList *key_path) } -kvp_frame * -kvp_frame_get_frame (kvp_frame *frame, const char *key, ...) +KvpFrame * +kvp_frame_get_frame (KvpFrame *frame, const char *key, ...) { va_list ap; if (!frame || !key) return frame; @@ -405,8 +483,8 @@ kvp_frame_get_frame (kvp_frame *frame, const char *key, ...) } -kvp_frame * -kvp_frame_get_frame_slash (kvp_frame *frame, const char *key_path) +KvpFrame * +kvp_frame_get_frame_slash (KvpFrame *frame, const char *key_path) { char *root, *key, *next; if (!frame || !key_path) return frame; @@ -434,12 +512,12 @@ kvp_frame_get_frame_slash (kvp_frame *frame, const char *key_path) /* ============================================================ */ -kvp_value * -kvp_frame_get_slot_path (kvp_frame *frame, +KvpValue * +kvp_frame_get_slot_path (KvpFrame *frame, const char *first_key, ...) { va_list ap; - kvp_value *value; + KvpValue *value; const char *key; if (!frame || !first_key) return NULL; @@ -470,8 +548,8 @@ kvp_frame_get_slot_path (kvp_frame *frame, return value; } -kvp_value * -kvp_frame_get_slot_path_gslist (kvp_frame *frame, +KvpValue * +kvp_frame_get_slot_path_gslist (KvpFrame *frame, GSList *key_path) { if (!frame || !key_path) return NULL; @@ -479,7 +557,7 @@ kvp_frame_get_slot_path_gslist (kvp_frame *frame, while (TRUE) { const char *key = key_path->data; - kvp_value *value; + KvpValue *value; if (!key) return NULL; @@ -501,7 +579,7 @@ kvp_frame_get_slot_path_gslist (kvp_frame *frame, static void kvp_glist_delete_worker(gpointer datum, gpointer user_data) { - kvp_value * val = (kvp_value *)datum; + KvpValue * val = (KvpValue *)datum; kvp_value_delete(val); } @@ -553,8 +631,8 @@ kvp_glist_compare(const GList * list1, const GList * list2) lp2 = list2; while(lp1 && lp2) { - kvp_value *v1 = (kvp_value *) lp1->data; - kvp_value *v2 = (kvp_value *) lp2->data; + KvpValue *v1 = (KvpValue *) lp1->data; + KvpValue *v2 = (KvpValue *) lp2->data; gint vcmp = kvp_value_compare(v1, v2); if(vcmp != 0) return vcmp; lp1 = lp1->next; @@ -566,61 +644,61 @@ kvp_glist_compare(const GList * list1, const GList * list2) } /******************************************************************** - * kvp_value functions + * KvpValue functions ********************************************************************/ -kvp_value * +KvpValue * kvp_value_new_gint64(gint64 value) { - kvp_value * retval = g_new0(kvp_value, 1); + KvpValue * retval = g_new0(KvpValue, 1); retval->type = KVP_TYPE_GINT64; retval->value.int64 = value; return retval; } -kvp_value * +KvpValue * kvp_value_new_double(double value) { - kvp_value * retval = g_new0(kvp_value, 1); + KvpValue * retval = g_new0(KvpValue, 1); retval->type = KVP_TYPE_DOUBLE; retval->value.dbl = value; return retval; } -kvp_value * +KvpValue * kvp_value_new_gnc_numeric(gnc_numeric value) { - kvp_value * retval = g_new0(kvp_value, 1); + KvpValue * retval = g_new0(KvpValue, 1); retval->type = KVP_TYPE_NUMERIC; retval->value.numeric = value; return retval; } -kvp_value * +KvpValue * kvp_value_new_string(const char * value) { - kvp_value * retval = g_new0(kvp_value, 1); + KvpValue * retval = g_new0(KvpValue, 1); retval->type = KVP_TYPE_STRING; retval->value.str = g_strdup(value); return retval; } -kvp_value * +KvpValue * kvp_value_new_guid(const GUID * value) { - kvp_value * retval = g_new0(kvp_value, 1); + KvpValue * retval = g_new0(KvpValue, 1); retval->type = KVP_TYPE_GUID; retval->value.guid = g_new0(GUID, 1); memcpy(retval->value.guid, value, sizeof(GUID)); return retval; } -kvp_value * +KvpValue * kvp_value_new_timespec(Timespec value) { - kvp_value * retval = g_new0(kvp_value, 1); + KvpValue * retval = g_new0(KvpValue, 1); retval->type = KVP_TYPE_TIMESPEC; retval->value.timespec = value; return retval; } -kvp_value * +KvpValue * kvp_value_new_binary(const void * value, guint64 datasize) { - kvp_value * retval = g_new0(kvp_value, 1); + KvpValue * retval = g_new0(KvpValue, 1); retval->type = KVP_TYPE_BINARY; retval->value.binary.data = g_new0(char, datasize); retval->value.binary.datasize = datasize; @@ -628,49 +706,49 @@ kvp_value_new_binary(const void * value, guint64 datasize) { return retval; } -kvp_value * +KvpValue * kvp_value_new_binary_nc(void * value, guint64 datasize) { - kvp_value * retval = g_new0(kvp_value, 1); + KvpValue * retval = g_new0(KvpValue, 1); retval->type = KVP_TYPE_BINARY; retval->value.binary.data = value; retval->value.binary.datasize = datasize; return retval; } -kvp_value * +KvpValue * kvp_value_new_glist(const GList * value) { - kvp_value * retval = g_new0(kvp_value, 1); + KvpValue * retval = g_new0(KvpValue, 1); retval->type = KVP_TYPE_GLIST; retval->value.list = kvp_glist_copy(value); return retval; } -kvp_value * +KvpValue * kvp_value_new_glist_nc(GList * value) { - kvp_value * retval = g_new0(kvp_value, 1); + KvpValue * retval = g_new0(KvpValue, 1); retval->type = KVP_TYPE_GLIST; retval->value.list = value; return retval; } -kvp_value * -kvp_value_new_frame(const kvp_frame * value) { - kvp_value * retval = g_new0(kvp_value, 1); +KvpValue * +kvp_value_new_frame(const KvpFrame * value) { + KvpValue * retval = g_new0(KvpValue, 1); retval->type = KVP_TYPE_FRAME; retval->value.frame = kvp_frame_copy(value); return retval; } -kvp_value * -kvp_value_new_frame_nc(kvp_frame * value) { - kvp_value * retval = g_new0(kvp_value, 1); +KvpValue * +kvp_value_new_frame_nc(KvpFrame * value) { + KvpValue * retval = g_new0(KvpValue, 1); retval->type = KVP_TYPE_FRAME; retval->value.frame = value; return retval; } void -kvp_value_delete(kvp_value * value) { +kvp_value_delete(KvpValue * value) { if(!value) return; switch(value->type) { @@ -699,14 +777,14 @@ kvp_value_delete(kvp_value * value) { g_free(value); } -kvp_value_t -kvp_value_get_type(const kvp_value * value) { +KvpValueType +kvp_value_get_type(const KvpValue * value) { if (!value) return -1; return value->type; } gint64 -kvp_value_get_gint64(const kvp_value * value) { +kvp_value_get_gint64(const KvpValue * value) { if (!value) return 0; if(value->type == KVP_TYPE_GINT64) { return value->value.int64; @@ -717,7 +795,7 @@ kvp_value_get_gint64(const kvp_value * value) { } double -kvp_value_get_double(const kvp_value * value) { +kvp_value_get_double(const KvpValue * value) { if (!value) return 0.0; if(value->type == KVP_TYPE_DOUBLE) { return value->value.dbl; @@ -728,7 +806,7 @@ kvp_value_get_double(const kvp_value * value) { } gnc_numeric -kvp_value_get_numeric(const kvp_value * value) { +kvp_value_get_numeric(const KvpValue * value) { if (!value) return gnc_numeric_zero (); if(value->type == KVP_TYPE_NUMERIC) { return value->value.numeric; @@ -739,7 +817,7 @@ kvp_value_get_numeric(const kvp_value * value) { } char * -kvp_value_get_string(const kvp_value * value) { +kvp_value_get_string(const KvpValue * value) { if (!value) return NULL; if(value->type == KVP_TYPE_STRING) { return value->value.str; @@ -750,7 +828,7 @@ kvp_value_get_string(const kvp_value * value) { } GUID * -kvp_value_get_guid(const kvp_value * value) { +kvp_value_get_guid(const KvpValue * value) { if (!value) return NULL; if(value->type == KVP_TYPE_GUID) { return value->value.guid; @@ -761,7 +839,7 @@ kvp_value_get_guid(const kvp_value * value) { } Timespec -kvp_value_get_timespec(const kvp_value * value) { +kvp_value_get_timespec(const KvpValue * value) { Timespec ts; ts.tv_sec = 0; ts.tv_nsec = 0; if (!value) return ts; if (value->type == KVP_TYPE_TIMESPEC) @@ -771,7 +849,7 @@ kvp_value_get_timespec(const kvp_value * value) { } void * -kvp_value_get_binary(const kvp_value * value, guint64 * size_return) { +kvp_value_get_binary(const KvpValue * value, guint64 * size_return) { if (!value) { if (size_return) @@ -792,7 +870,7 @@ kvp_value_get_binary(const kvp_value * value, guint64 * size_return) { } GList * -kvp_value_get_glist(const kvp_value * value) { +kvp_value_get_glist(const KvpValue * value) { if (!value) return NULL; if(value->type == KVP_TYPE_GLIST) { return value->value.list; @@ -802,8 +880,8 @@ kvp_value_get_glist(const kvp_value * value) { } } -kvp_frame * -kvp_value_get_frame(const kvp_value * value) { +KvpFrame * +kvp_value_get_frame(const KvpValue * value) { if (!value) return NULL; if(value->type == KVP_TYPE_FRAME) { return value->value.frame; @@ -815,8 +893,8 @@ kvp_value_get_frame(const kvp_value * value) { /* manipulators */ -kvp_value * -kvp_value_copy(const kvp_value * value) { +KvpValue * +kvp_value_copy(const KvpValue * value) { if(!value) return NULL; @@ -854,9 +932,9 @@ kvp_value_copy(const kvp_value * value) { } void -kvp_frame_for_each_slot(kvp_frame *f, +kvp_frame_for_each_slot(KvpFrame *f, void (*proc)(const char *key, - kvp_value *value, + KvpValue *value, gpointer data), gpointer data) { @@ -877,7 +955,7 @@ double_compare(double d1, double d2) } gint -kvp_value_compare(const kvp_value * kva, const kvp_value * kvb) { +kvp_value_compare(const KvpValue * kva, const KvpValue * kvb) { if(kva == kvb) return 0; /* nothing is always less than something */ if(!kva && kvb) return -1; @@ -929,15 +1007,16 @@ kvp_value_compare(const kvp_value * kva, const kvp_value * kvb) { typedef struct { gint compare; - kvp_frame *other_frame; + KvpFrame *other_frame; } kvp_frame_cmp_status; static void -kvp_frame_compare_helper(const char *key, kvp_value* val, gpointer data) { +kvp_frame_compare_helper(const char *key, KvpValue * val, gpointer data) +{ kvp_frame_cmp_status *status = (kvp_frame_cmp_status *) data; if(status->compare == 0) { - kvp_frame *other_frame = status->other_frame; - kvp_value *other_val = kvp_frame_get_slot(other_frame, key); + KvpFrame *other_frame = status->other_frame; + KvpValue *other_val = kvp_frame_get_slot(other_frame, key); if(other_val) { status->compare = kvp_value_compare(val, other_val); @@ -948,7 +1027,8 @@ kvp_frame_compare_helper(const char *key, kvp_value* val, gpointer data) { } gint -kvp_frame_compare(const kvp_frame *fa, const kvp_frame *fb) { +kvp_frame_compare(const KvpFrame *fa, const KvpFrame *fb) +{ kvp_frame_cmp_status status; if(fa == fb) return 0; @@ -961,16 +1041,16 @@ kvp_frame_compare(const kvp_frame *fa, const kvp_frame *fb) { if(fa->hash && !fb->hash) return 1; status.compare = 0; - status.other_frame = (kvp_frame *) fb; + status.other_frame = (KvpFrame *) fb; - kvp_frame_for_each_slot((kvp_frame *) fa, kvp_frame_compare_helper, &status); + kvp_frame_for_each_slot((KvpFrame *) fa, kvp_frame_compare_helper, &status); if (status.compare != 0) return status.compare; - status.other_frame = (kvp_frame *) fa; + status.other_frame = (KvpFrame *) fa; - kvp_frame_for_each_slot((kvp_frame *) fb, kvp_frame_compare_helper, &status); + kvp_frame_for_each_slot((KvpFrame *) fb, kvp_frame_compare_helper, &status); return(-status.compare); } @@ -1005,7 +1085,7 @@ kvp_value_glist_to_string(const GList *list) { gchar *tmp3; - tmp3 = kvp_value_to_string((kvp_value*)cursor->data); + tmp3 = kvp_value_to_string((KvpValue *)cursor->data); tmp2 = g_strdup_printf("%s %s,", tmp1, tmp3 ? tmp3 : ""); g_free(tmp1); g_free(tmp3); @@ -1019,7 +1099,7 @@ kvp_value_glist_to_string(const GList *list) } gchar* -kvp_value_to_string(const kvp_value *val) +kvp_value_to_string(const KvpValue *val) { gchar *tmp1; gchar *tmp2; @@ -1059,11 +1139,11 @@ kvp_value_to_string(const kvp_value *val) case KVP_TYPE_TIMESPEC: tmp1 = g_new0 (char, 40); - gnc_timespec_to_iso8601_buff (kvp_value_get_timespec (val), tmp1); - tmp2 = g_strdup_printf("KVP_VALUE_TIMESPEC(%s)", tmp1); - g_free(tmp1); - return tmp2; - break; + gnc_timespec_to_iso8601_buff (kvp_value_get_timespec (val), tmp1); + tmp2 = g_strdup_printf("KVP_VALUE_TIMESPEC(%s)", tmp1); + g_free(tmp1); + return tmp2; + break; case KVP_TYPE_BINARY: { @@ -1102,7 +1182,7 @@ kvp_frame_to_string_helper(gpointer key, gpointer value, gpointer data) gchar **str = (gchar**)data; gchar *old_data = *str; - tmp_val = kvp_value_to_string((kvp_value*)value); + tmp_val = kvp_value_to_string((KvpValue *)value); *str = g_strdup_printf("%s %s => %s,\n", *str ? *str : "", @@ -1114,7 +1194,7 @@ kvp_frame_to_string_helper(gpointer key, gpointer value, gpointer data) } gchar* -kvp_frame_to_string(const kvp_frame *frame) +kvp_frame_to_string(const KvpFrame *frame) { gchar *tmp1; @@ -1136,9 +1216,10 @@ kvp_frame_to_string(const kvp_frame *frame) } GHashTable* -kvp_frame_get_hash(const kvp_frame *frame) +kvp_frame_get_hash(const KvpFrame *frame) { g_return_val_if_fail (frame != NULL, NULL); return frame->hash; } + /* ========================== END OF FILE ======================= */ diff --git a/src/engine/kvp_frame.h b/src/engine/kvp_frame.h index 356201dabf..0190e6470b 100644 --- a/src/engine/kvp_frame.h +++ b/src/engine/kvp_frame.h @@ -22,6 +22,7 @@ /** @file kvp_frame.h @brief A key-value frame system for gnucash @author Copyright (C) 2000 Bill Gribble + @author Copyright (C) 2003 Linas Vepstas */ #ifndef KVP_FRAME_H @@ -33,24 +34,40 @@ #include "gnc-numeric.h" #include "guid.h" -/** a kvp_frame is a set of associations between character strings - * (keys) and kvp_value structures. A kvp_value is a union with - * possible types enumerated in the kvp_value_t enum. +/** a KvpFrame is a set of associations between character strings + * (keys) and KvpValue structures. A KvpValue is a union with + * possible types enumerated in the KvpValueType enum, and includes, + * among other things, ints, doubles, strings, guid's, lists, time + * and numeric values. KvpValues may also be other frames, so + * KVP is inherently heirarchical. * + * Values are stored in a 'slot' associated with a key. * Pointers passed as arguments into set_slot and get_slot are the * responsibility of the caller. Pointers returned by get_slot are * owned by the kvp_frame. Make copies as needed. * - * kvp_frame_delete and kvp_value_delete are deep (recursive) deletes. - * kvp_frame_copy and kvp_value_copy are deep value copies. + * A 'path' is a sequence of keys that can be followed to a value. + * Paths may be specified as varargs (variable number of arguments + * to a subrutine, NULL-terminated), as a GSList, or as a standard + * URL-like path name. The later is parsed and treated in the same + * way as file paths would be: / separates keys, /./ is treated as / + * and /../ means backup one level. Repeated slashes are treated + * as one slash. + * + * Note that although, in principle, keys may contain the / and . and + * .. characters, doing so may lead to confusion, and will make + * path-string parsing routines fail. In other words, don't use + * a key such as 'some/key' or 'some/./other/../key' because you + * may get unexpected results. + * */ -typedef struct _kvp_frame kvp_frame; +typedef struct _KvpFrame KvpFrame; -/** A kvp_value is a union with possible types enumerated in the - * kvp_value_t enum. */ -typedef struct _kvp_value kvp_value; +/** A KvpValue is a union with possible types enumerated in the + * KvpValueType enum. */ +typedef struct _KvpValue KvpValue; -/** Enum to enumerate possible types in the union kvp_value */ +/** Enum to enumerate possible types in the union KvpValue */ typedef enum { KVP_TYPE_GINT64, KVP_TYPE_DOUBLE, @@ -61,120 +78,147 @@ typedef enum { KVP_TYPE_BINARY, KVP_TYPE_GLIST, KVP_TYPE_FRAME -} kvp_value_t; +} KvpValueType; -/** @name kvp_frame Constructors */ +/* Deprecated backwards compat tokens; do not use these in new code. */ +#define kvp_frame KvpFrame +#define kvp_value KvpValue +#define kvp_value_t KvpValueType + + +/** @name KvpFrame Constructors */ /*@{*/ -/** kvp_frame functions */ -kvp_frame * kvp_frame_new(void); -/** This is a deep (recursive) delete. */ -void kvp_frame_delete(kvp_frame * frame); -/** This is a deep value copy. */ -kvp_frame * kvp_frame_copy(const kvp_frame * frame); -gboolean kvp_frame_is_empty(kvp_frame * frame); + +/** Return a new empty instance of KvpFrame */ +KvpFrame * kvp_frame_new(void); + +/** Perform a deep (recursive) delete of the frame and any subframes. */ +/* + * kvp_frame_delete and kvp_value_delete are deep (recursive) deletes. + * kvp_frame_copy and kvp_value_copy are deep value copies. + */ +void kvp_frame_delete(KvpFrame * frame); + +/** Perform a deep (recursive) value copy, copying the fraame, + * subframes, and the values as well. */ +KvpFrame * kvp_frame_copy(const KvpFrame * frame); + +/** Return TRUE if the KvpFrame is empty */ +gboolean kvp_frame_is_empty(KvpFrame * frame); + /*@}*/ -/** Internal helper */ -gchar* kvp_frame_to_string(const kvp_frame *frame); -/** Internal helper */ +/** Internal helper rouotines, you probably shouldn't be using these. */ +gchar* kvp_frame_to_string(const KvpFrame *frame); gchar* binary_to_string(const void *data, guint32 size); -/** Internal helper */ gchar* kvp_value_glist_to_string(const GList *list); - -GHashTable* kvp_frame_get_hash(const kvp_frame *frame); +GHashTable* kvp_frame_get_hash(const KvpFrame *frame); -/** @name kvp_frame Value Storing */ +/** @name KvpFrame Value Storing */ /*@{*/ /** The kvp_frame_set_slot() routine copies the value into the frame, - * associating it with 'key'. - * - * Pointers passed as arguments into set_slot are the responsibility - * of the caller. + * associating it with a copy of 'key'. Pointers passed as arguments + * into kvp_frame_set_slot are the responsibility of the caller; + * the pointers are *not* taken over or managed. */ -void kvp_frame_set_slot(kvp_frame * frame, - const char * key, const kvp_value * value); +void kvp_frame_set_slot(KvpFrame * frame, + const char * key, const KvpValue * value); /** * The kvp_frame_set_slot_nc() routine puts the value (without copying - * it) into the frame, associating it with 'key'. This routine is - * handy for avoiding excess memory allocations & frees. + * it) into the frame, associating it with a copy of 'key'. This + * routine is handy for avoiding excess memory allocations & frees. + * Note that because the KvpValue was grabbed, you can't just delete + * unless you remove the key as well (or unless you replace the value). */ -void kvp_frame_set_slot_nc(kvp_frame * frame, - const char * key, kvp_value * value); +void kvp_frame_set_slot_nc(KvpFrame * frame, + const char * key, KvpValue * value); -/** The kvp_frame_set_slot_path() routines walk the hierarchy, +/** The kvp_frame_set_slot_path() routine walks the hierarchy, * using the key values to pick each branch. When the terminal node * is reached, the value is copied into it. */ -void kvp_frame_set_slot_path (kvp_frame *frame, - const kvp_value *value, +void kvp_frame_set_slot_path (KvpFrame *frame, + const KvpValue *value, const char *first_key, ...); -/** The kvp_frame_set_slot_path() routines walk the hierarchy, - * using the key values to pick each branch. When the terminal node - * is reached, the value is copied into it. +/** The kvp_frame_set_slot_path_gslist() routine walks the hierarchy, + * using the key values to pick each branch. When the terminal node + * is reached, the value is copied into it. */ -void kvp_frame_set_slot_path_gslist (kvp_frame *frame, - const kvp_value *value, +void kvp_frame_set_slot_path_gslist (KvpFrame *frame, + const KvpValue *value, GSList *key_path); + +/** The kvp_frame_add_url_encoding()routine will parse the + * value string, assuming it to be URL-encoded in the standard way, + * turning it into a set of key-value pairs, and adding those to the + * indicated frame. URL-encoded strings are the things that are + * returned by web browsers when a form is filled out. For example, + * 'start-date=June&end-date=November' consists of two keys, + * 'start-date' and 'end-date', which have the values 'June' and + * 'November', respectively. This routine also handles % encoding. + * + * This routine treats all values as strings; it does *not* attempt + * to perform any type-conversion. + * */ +void kvp_frame_add_url_encoding (KvpFrame *frame, const char *enc); /*@}*/ -/** @name kvp_frame Value Retrieval */ +/** @name KvpFrame Value Retrieval */ /*@{*/ -/** Returns the kvp_value in the given kvp_frame 'frame' that is associated with 'key'. +/** Returns the KvpValue in the given KvpFrame 'frame' that is + * associated with 'key'. * - * Pointers passed as arguments into get_slot are the responsibility - * of the caller. Pointers returned by get_slot are owned by the - * kvp_frame. Make copies as needed. + * Pointers passed as arguments into get_slot are the responsibility + * of the caller. Pointers returned by get_slot are owned by the + * kvp_frame. Make copies as needed. */ -kvp_value * kvp_frame_get_slot(kvp_frame * frame, - const char * key); +KvpValue * kvp_frame_get_slot(KvpFrame * frame, const char * key); + +/** This routine returns the last frame of the path. + * If the frame path doesn't exist, it is created. + */ +KvpFrame * kvp_frame_get_frame (KvpFrame *frame, const char *,...); /** This routine return the last frame of the path. - * If the frame path doesn't exist, it is created. + * If the frame path doesn't exist, it is created. */ -kvp_frame * kvp_frame_get_frame (kvp_frame *frame, const char *,...); - -/** This routine return the last frame of the path. - * If the frame path doesn't exist, it is created. - */ -kvp_frame * kvp_frame_get_frame_gslist (kvp_frame *frame, +KvpFrame * kvp_frame_get_frame_gslist (KvpFrame *frame, GSList *key_path); /** This routine return the last frame of the path. - * If the frame path doesn't exist, it is created. + * If the frame path doesn't exist, it is created. * * The kvp_frame_get_frame_slash() routine takes a single string * where the keys are separated by slashes; thus, for example: * /this/is/a/valid/path and///so//is////this/ * Multiple slashes are compresed. Leading slash is optional. - * The pointers . and .. are *not* followed/obeyed. (This is - * arguably a bug that needs fixing). - * - * + * The pointers . and .. are *not* currently followed/obeyed. + * (This is a bug that needs fixing). */ -kvp_frame * kvp_frame_get_frame_slash (kvp_frame *frame, +KvpFrame * kvp_frame_get_frame_slash (KvpFrame *frame, const char *path); /** This routine return the value at the end of the * path, or NULL if any portion of the path doesn't exist. */ -kvp_value * kvp_frame_get_slot_path (kvp_frame *frame, +KvpValue * kvp_frame_get_slot_path (KvpFrame *frame, const char *first_key, ...); /** This routine return the value at the end of the * path, or NULL if any portion of the path doesn't exist. */ -kvp_value * kvp_frame_get_slot_path_gslist (kvp_frame *frame, +KvpValue * kvp_frame_get_slot_path_gslist (KvpFrame *frame, GSList *key_path); /** * Similar returns as strcmp. **/ -gint kvp_frame_compare(const kvp_frame *fa, const kvp_frame *fb); +gint kvp_frame_compare(const KvpFrame *fa, const KvpFrame *fb); /*@}*/ @@ -198,92 +242,102 @@ GList * kvp_glist_copy(const GList * list); void kvp_glist_delete(GList * list); -/** @name kvp_value Constructors */ +/** @name KvpValue Constructors */ /*@{*/ /** The following routines are constructors for kvp_value. * Those with pointer arguments copy in the value. * The *_nc() versions do *not* copy in thier values, * but use them directly. */ -kvp_value * kvp_value_new_gint64(gint64 value); -kvp_value * kvp_value_new_double(double value); -kvp_value * kvp_value_new_gnc_numeric(gnc_numeric value); -kvp_value * kvp_value_new_string(const char * value); -kvp_value * kvp_value_new_guid(const GUID * guid); -kvp_value * kvp_value_new_timespec(Timespec timespec); -kvp_value * kvp_value_new_binary(const void * data, guint64 datasize); -/** Creates a kvp_value from a GList of kvp_value's! (Not to be - * confused with GList's of something else!) */ -kvp_value * kvp_value_new_glist(const GList * value); -kvp_value * kvp_value_new_frame(const kvp_frame * value); +KvpValue * kvp_value_new_gint64(gint64 value); +KvpValue * kvp_value_new_double(double value); +KvpValue * kvp_value_new_gnc_numeric(gnc_numeric value); +KvpValue * kvp_value_new_string(const char * value); +KvpValue * kvp_value_new_guid(const GUID * guid); +KvpValue * kvp_value_new_timespec(Timespec timespec); +KvpValue * kvp_value_new_binary(const void * data, guint64 datasize); -/** value constructors (non-copying - kvp_value takes pointer ownership) +/** Creates a KvpValue from a GList of kvp_value's! (Not to be + * confused with GList's of something else!) */ +KvpValue * kvp_value_new_glist(const GList * value); +KvpValue * kvp_value_new_frame(const KvpFrame * value); + +/** value constructors (non-copying - KvpValue takes pointer ownership) values *must* have been allocated via glib allocators! (gnew, etc.) */ -kvp_value * kvp_value_new_binary_nc(void * data, guint64 datasize); -/** Creates a kvp_value from a GList of kvp_value's! (Not to be +KvpValue * kvp_value_new_binary_nc(void * data, guint64 datasize); + +/** Creates a KvpValue from a GList of kvp_value's! (Not to be * confused with GList's of something else!) * - * This value constructor is non-copying (kvp_value takes pointer + * This value constructor is non-copying (KvpValue takes pointer * ownership). The values *must* have been allocated via glib * allocators! (gnew, etc.) */ -kvp_value * kvp_value_new_glist_nc(GList *lst); -/** value constructors (non-copying - kvp_value takes pointer ownership) +KvpValue * kvp_value_new_glist_nc(GList *lst); + +/** value constructors (non-copying - KvpValue takes pointer ownership) values *must* have been allocated via glib allocators! (gnew, etc.) */ -kvp_value * kvp_value_new_frame_nc(kvp_frame * value); +KvpValue * kvp_value_new_frame_nc(KvpFrame * value); /** This is a deep (recursive) delete. */ -void kvp_value_delete(kvp_value * value); +void kvp_value_delete(KvpValue * value); + /** This is a deep value copy. */ -kvp_value * kvp_value_copy(const kvp_value * value); +KvpValue * kvp_value_copy(const KvpValue * value); /*@}*/ -/** @name kvp_value Value access */ +/** @name KvpValue Value access */ /*@{*/ -/** Value accessors. Those for GUID, binary, GList, kvp_frame and +/** Value accessors. Those for GUID, binary, GList, KvpFrame and string are non-copying -- the caller can modify the value directly. Note that the above non-copying list did not include the get_string() function. But in fact that function has always been a non-copying one -- therefore don't free the result unless you want - to delete the whole kvp_frame by yourself. */ -kvp_value_t kvp_value_get_type(const kvp_value * value); + to delete the whole KvpFrame by yourself. */ +KvpValueType kvp_value_get_type(const KvpValue * value); + +gint64 kvp_value_get_gint64(const KvpValue * value); +double kvp_value_get_double(const KvpValue * value); +gnc_numeric kvp_value_get_numeric(const KvpValue * value); -gint64 kvp_value_get_gint64(const kvp_value * value); -double kvp_value_get_double(const kvp_value * value); -gnc_numeric kvp_value_get_numeric(const kvp_value * value); /** Value accessor. This one is non-copying -- the caller can modify * the value directly. */ -char * kvp_value_get_string(const kvp_value * value); +char * kvp_value_get_string(const KvpValue * value); + /** Value accessor. This one is non-copying -- the caller can modify * the value directly. */ -GUID * kvp_value_get_guid(const kvp_value * value); +GUID * kvp_value_get_guid(const KvpValue * value); + /** Value accessor. This one is non-copying -- the caller can modify * the value directly. */ -void * kvp_value_get_binary(const kvp_value * value, +void * kvp_value_get_binary(const KvpValue * value, guint64 * size_return); + /** Returns the GList of kvp_frame's (not to be confused with GList's * of something else!) from the given kvp_frame. This one is * non-copying -- the caller can modify the value directly. */ -GList * kvp_value_get_glist(const kvp_value * value); +GList * kvp_value_get_glist(const KvpValue * value); + /** Value accessor. This one is non-copying -- the caller can modify * the value directly. */ -kvp_frame * kvp_value_get_frame(const kvp_value * value); -Timespec kvp_value_get_timespec(const kvp_value * value); +KvpFrame * kvp_value_get_frame(const KvpValue * value); +Timespec kvp_value_get_timespec(const KvpValue * value); /** * Similar returns as strcmp. **/ -gint kvp_value_compare(const kvp_value *va, const kvp_value *vb); +gint kvp_value_compare(const KvpValue *va, const KvpValue *vb); + /*@}*/ -gchar* kvp_value_to_string(const kvp_value *val); +gchar* kvp_value_to_string(const KvpValue *val); /** Manipulator: * - * copying - but more efficient than creating a new kvp_value manually. */ -gboolean kvp_value_binary_append(kvp_value *v, void *data, guint64 size); + * copying - but more efficient than creating a new KvpValue manually. */ +gboolean kvp_value_binary_append(KvpValue *v, void *data, guint64 size); /** @name Iterators */ /*@{*/ @@ -291,11 +345,12 @@ gboolean kvp_value_binary_append(kvp_value *v, void *data, guint64 size); does not descend recursively to traverse any kvp_frames stored as slot values. You must handle that in proc, with a suitable recursive call if desired. */ -void kvp_frame_for_each_slot(kvp_frame *f, +void kvp_frame_for_each_slot(KvpFrame *f, void (*proc)(const char *key, - kvp_value *value, + KvpValue *value, gpointer data), gpointer data); + /*@}*/ #endif diff --git a/src/engine/qofbook-p.h b/src/engine/qofbook-p.h index c1df50da43..8187b30cf8 100644 --- a/src/engine/qofbook-p.h +++ b/src/engine/qofbook-p.h @@ -40,9 +40,9 @@ struct _QofBook /* Unique guid for this book. */ GUID guid; - /* The kvp_frame provides a place for top-level data associated + /* The KvpFrame provides a place for top-level data associated * with this book. */ - kvp_frame *kvp_data; + KvpFrame *kvp_data; /* The entity table associates the GUIDs of all the objects * belonging to this book, with their pointers to the respective diff --git a/src/engine/qofbook.c b/src/engine/qofbook.c index b6679f3ff0..76dc1ec44f 100644 --- a/src/engine/qofbook.c +++ b/src/engine/qofbook.c @@ -150,7 +150,7 @@ qof_book_get_guid (QofBook *book) return &book->guid; } -kvp_frame * +KvpFrame * qof_book_get_slots (QofBook *book) { if (!book) return NULL; @@ -232,8 +232,8 @@ gint64 qof_book_get_counter (QofBook *book, const char *counter_name) { QofBackend *be; - kvp_frame *kvp; - kvp_value *value; + KvpFrame *kvp; + KvpValue *value; gint64 counter; if (!book) { diff --git a/src/engine/qofbook.h b/src/engine/qofbook.h index 0092c7ce93..a7b91ef490 100644 --- a/src/engine/qofbook.h +++ b/src/engine/qofbook.h @@ -63,7 +63,7 @@ QofEntityTable * qof_book_get_entity_table (QofBook *book); const GUID * qof_book_get_guid (QofBook *book); /** \return The kvp data for the book */ -kvp_frame * qof_book_get_slots (QofBook *book); +KvpFrame * qof_book_get_slots (QofBook *book); /** The qof_book_set_data() allows * arbitrary pointers to structs to be stored in QofBook. diff --git a/src/engine/qofquerycore-p.h b/src/engine/qofquerycore-p.h index b18a587992..0dd6380eb5 100644 --- a/src/engine/qofquerycore-p.h +++ b/src/engine/qofquerycore-p.h @@ -126,7 +126,7 @@ typedef struct { typedef struct { QofQueryPredData pd; GSList * path; - kvp_value * value; + KvpValue * value; } query_kvp_def, *query_kvp_t; #endif /* QOF_QUERYCOREP_H */ diff --git a/src/engine/qofquerycore.c b/src/engine/qofquerycore.c index 650fbc8272..9977e6dcf3 100644 --- a/src/engine/qofquerycore.c +++ b/src/engine/qofquerycore.c @@ -100,7 +100,7 @@ static const char * query_boolean_type = QOF_QUERYCORE_BOOLEAN; typedef char (*query_char_getter) (gpointer); static const char * query_char_type = QOF_QUERYCORE_CHAR; -typedef kvp_frame * (*query_kvp_getter) (gpointer); +typedef KvpFrame * (*query_kvp_getter) (gpointer); static const char * query_kvp_type = QOF_QUERYCORE_KVP; /* Tables for predicate storage and lookup */ @@ -1087,8 +1087,8 @@ static int kvp_match_predicate (gpointer object, QofAccessFunc get_fcn, QofQueryPredData *pd) { int compare; - kvp_frame *kvp; - kvp_value *value; + KvpFrame *kvp; + KvpValue *value; query_kvp_t pdata = (query_kvp_t)pd; VERIFY_PREDICATE (query_kvp_type); @@ -1171,7 +1171,7 @@ kvp_predicate_equal (QofQueryPredData *p1, QofQueryPredData *p2) QofQueryPredData * qof_query_kvp_predicate (QofQueryCompare how, - GSList *path, const kvp_value *value) + GSList *path, const KvpValue *value) { query_kvp_t pdata; GSList *node; diff --git a/src/engine/qofquerycore.h b/src/engine/qofquerycore.h index 43c19c72b5..c5cf266023 100644 --- a/src/engine/qofquerycore.h +++ b/src/engine/qofquerycore.h @@ -136,7 +136,7 @@ QofQueryPredData *qof_query_boolean_predicate (QofQueryCompare how, gboolean val QofQueryPredData *qof_query_char_predicate (QofCharMatch options, const char *chars); QofQueryPredData *qof_query_kvp_predicate (QofQueryCompare how, - GSList *path, const kvp_value *value); + GSList *path, const KvpValue *value); /** Copy a predicate. */ QofQueryPredData *qof_query_core_predicate_copy (QofQueryPredData *pdata); diff --git a/src/engine/test-core/test-engine-stuff.c b/src/engine/test-core/test-engine-stuff.c index 4a2a6ec13d..90a5d6151e 100644 --- a/src/engine/test-core/test-engine-stuff.c +++ b/src/engine/test-core/test-engine-stuff.c @@ -61,7 +61,7 @@ set_max_kvp_frame_elements (gint max_kvp_frame_elements) } void -kvp_exclude_type (kvp_value_t kvp_type) +kvp_exclude_type (KvpValueType kvp_type) { gint *key; @@ -75,7 +75,7 @@ kvp_exclude_type (kvp_value_t kvp_type) } static gboolean -kvp_type_excluded (kvp_value_t kvp_type) +kvp_type_excluded (KvpValueType kvp_type) { gint key = kvp_type; @@ -314,7 +314,7 @@ get_random_glist_depth (gint depth) for (i = 0; i < count; i++) { - kvp_value_t kvpt; + KvpValueType kvpt; kvp_value *value; kvpt = glist_strings_only ? KVP_TYPE_STRING : -2; diff --git a/src/engine/test-core/test-engine-stuff.h b/src/engine/test-core/test-engine-stuff.h index 9d167f9a77..c46406c18d 100644 --- a/src/engine/test-core/test-engine-stuff.h +++ b/src/engine/test-core/test-engine-stuff.h @@ -35,7 +35,7 @@ GUID* get_random_guid(void); GList* get_random_glist(void); void random_glist_strings_only (gboolean strings_only); -void kvp_exclude_type (kvp_value_t kvp_type); +void kvp_exclude_type (KvpValueType kvp_type); void set_max_kvp_depth (gint max_kvp_depth); void set_max_kvp_frame_elements (gint max_kvp_frame_elements); void set_max_group_depth (gint max_group_depth); diff --git a/src/engine/xlate.pl b/src/engine/xlate.pl index a1828021ea..c07c39db9f 100755 --- a/src/engine/xlate.pl +++ b/src/engine/xlate.pl @@ -20,205 +20,213 @@ foreach (@files) while () { - s/GNCBook/QofBook/g; - s/gnc_book_not_saved/qof_book_not_saved/g; + # s/GNCBook/QofBook/g; + # s/gnc_book_not_saved/qof_book_not_saved/g; - s/GncObject_t/QofObject/g; - s/gncObjectLookup/qof_object_lookup/g; - s/gncObjectRegister/qof_object_register/g; - s/gncObjectGetTypeLabel/qof_object_get_type_label/g; - s/gncObjectRegisterBackend/qof_object_register_backend/g; - s/gncObjectLookupBackend/qof_object_lookup_backend/g; - s/gncObjectForeachBackend/qof_object_foreach_backend/g; - s/gncObjectInitialize/qof_object_initialize/g; + # s/GncObject_t/QofObject/g; + # s/gncObjectLookup/qof_object_lookup/g; + # s/gncObjectRegister/qof_object_register/g; + # s/gncObjectGetTypeLabel/qof_object_get_type_label/g; + # s/gncObjectRegisterBackend/qof_object_register_backend/g; + # s/gncObjectLookupBackend/qof_object_lookup_backend/g; + # s/gncObjectForeachBackend/qof_object_foreach_backend/g; + # s/gncObjectInitialize/qof_object_initialize/g; - s/gncObjectShutdown/qof_object_shutdown/g; - s/gncObjectBookBegin/qof_object_book_begin/g; - s/gncObjectBookEnd/qof_object_book_end/g; - s/gncObjectIsDirty/qof_object_is_dirty/g; - s/gncObjectMarkClean/qof_object_mark_clean/g; + # s/gncObjectShutdown/qof_object_shutdown/g; + # s/gncObjectBookBegin/qof_object_book_begin/g; + # s/gncObjectBookEnd/qof_object_book_end/g; + # s/gncObjectIsDirty/qof_object_is_dirty/g; + # s/gncObjectMarkClean/qof_object_mark_clean/g; - s/gncObjectForeachType/qof_object_foreach_type/g; - s/gncObjectForeach/qof_object_foreach/g; - s/gncObjectPrintable/qof_object_printable/g; + # s/gncObjectForeachType/qof_object_foreach_type/g; + # s/gncObjectForeach/qof_object_foreach/g; + # s/gncObjectPrintable/qof_object_printable/g; - s/foreachTypeCB/QofForeachTypeCB/g; - s/foreachBackendTypeCB/QofForeachBackendTypeCB/g; + # s/foreachTypeCB/QofForeachTypeCB/g; + # s/foreachBackendTypeCB/QofForeachBackendTypeCB/g; - s/gncQueryStringPredicate/qof_query_string_predicate/g; - s/gncQueryDatePredicate/qof_query_date_predicate/g; - s/gncQueryNumericPredicate/qof_query_numeric_predicate/g; - s/gncQueryGUIDPredicate/qof_query_guid_predicate/g; - s/gncQueryInt32Predicate/qof_query_int32_predicate/g; - s/gncQueryInt64Predicate/qof_query_int64_predicate/g; - s/gncQueryDoublePredicate/qof_query_double_predicate/g; - s/gncQueryBooleanPredicate/qof_query_boolean_predicate/g; - s/gncQueryCharPredicate/qof_query_char_predicate/g; - s/gncQueryKVPPredicate/qof_query_kvp_predicate/g; - s/gncQueryCorePredicateFree/qof_query_core_predicate_free/g; + # s/gncQueryStringPredicate/qof_query_string_predicate/g; + # s/gncQueryDatePredicate/qof_query_date_predicate/g; + # s/gncQueryNumericPredicate/qof_query_numeric_predicate/g; + # s/gncQueryGUIDPredicate/qof_query_guid_predicate/g; + # s/gncQueryInt32Predicate/qof_query_int32_predicate/g; + # s/gncQueryInt64Predicate/qof_query_int64_predicate/g; + # s/gncQueryDoublePredicate/qof_query_double_predicate/g; + # s/gncQueryBooleanPredicate/qof_query_boolean_predicate/g; + # s/gncQueryCharPredicate/qof_query_char_predicate/g; + # s/gncQueryKVPPredicate/qof_query_kvp_predicate/g; + # s/gncQueryCorePredicateFree/qof_query_core_predicate_free/g; - s/COMPARE_LT/QOF_COMPARE_LT/g; - s/COMPARE_LTE/QOF_COMPARE_LTE/g; - s/COMPARE_EQUAL/QOF_COMPARE_EQUAL/g; - s/COMPARE_GT/QOF_COMPARE_GT/g; - s/COMPARE_GTE/QOF_COMPARE_GTE/g; - s/COMPARE_NEQ/QOF_COMPARE_NEQ/g; + # s/COMPARE_LT/QOF_COMPARE_LT/g; + # s/COMPARE_LTE/QOF_COMPARE_LTE/g; + # s/COMPARE_EQUAL/QOF_COMPARE_EQUAL/g; + # s/COMPARE_GT/QOF_COMPARE_GT/g; + # s/COMPARE_GTE/QOF_COMPARE_GTE/g; + # s/COMPARE_NEQ/QOF_COMPARE_NEQ/g; - s/STRING_MATCH_NORMAL/QOF_STRING_MATCH_NORMAL/g; - s/STRING_MATCH_CASEINSENSITIVE/QOF_STRING_MATCH_CASEINSENSITIVE/g; + # s/STRING_MATCH_NORMAL/QOF_STRING_MATCH_NORMAL/g; + # s/STRING_MATCH_CASEINSENSITIVE/QOF_STRING_MATCH_CASEINSENSITIVE/g; - s/DATE_MATCH_NORMAL/QOF_DATE_MATCH_NORMAL/g; - s/DATE_MATCH_ROUNDED/QOF_DATE_MATCH_ROUNDED/g; + # s/DATE_MATCH_NORMAL/QOF_DATE_MATCH_NORMAL/g; + # s/DATE_MATCH_ROUNDED/QOF_DATE_MATCH_ROUNDED/g; - s/NUMERIC_MATCH_ANY/QOF_NUMERIC_MATCH_ANY/g; - s/NUMERIC_MATCH_CREDIT/QOF_NUMERIC_MATCH_CREDIT/g; - s/NUMERIC_MATCH_DEBIT/QOF_NUMERIC_MATCH_DEBIT/g; + # s/NUMERIC_MATCH_ANY/QOF_NUMERIC_MATCH_ANY/g; + # s/NUMERIC_MATCH_CREDIT/QOF_NUMERIC_MATCH_CREDIT/g; + # s/NUMERIC_MATCH_DEBIT/QOF_NUMERIC_MATCH_DEBIT/g; - s/GUID_MATCH_ANY/QOF_GUID_MATCH_ANY/g; - s/GUID_MATCH_NONE/QOF_GUID_MATCH_NONE/g; - s/GUID_MATCH_NULL/QOF_GUID_MATCH_NULL/g; - s/GUID_MATCH_ALL/QOF_GUID_MATCH_ALL/g; - s/GUID_MATCH_LIST_ANY/QOF_GUID_MATCH_LIST_ANY/g; + # s/GUID_MATCH_ANY/QOF_GUID_MATCH_ANY/g; + # s/GUID_MATCH_NONE/QOF_GUID_MATCH_NONE/g; + # s/GUID_MATCH_NULL/QOF_GUID_MATCH_NULL/g; + # s/GUID_MATCH_ALL/QOF_GUID_MATCH_ALL/g; + # s/GUID_MATCH_LIST_ANY/QOF_GUID_MATCH_LIST_ANY/g; - s/CHAR_MATCH_ANY/QOF_CHAR_MATCH_ANY/g; - s/CHAR_MATCH_NONE/QOF_CHAR_MATCH_NONE/g; + # s/CHAR_MATCH_ANY/QOF_CHAR_MATCH_ANY/g; + # s/CHAR_MATCH_NONE/QOF_CHAR_MATCH_NONE/g; - s/char_match_t/QofCharMatch/g; - s/guid_match_t/QofGuidMatch/g; - s/numeric_match_t/QofNumericMatch/g; - s/date_match_t/QofDateMatch/g; - s/string_match_t/QofStringMatch/g; - s/query_compare_t/QofQueryCompare/g; + # s/char_match_t/QofCharMatch/g; + # s/guid_match_t/QofGuidMatch/g; + # s/numeric_match_t/QofNumericMatch/g; + # s/date_match_t/QofDateMatch/g; + # s/string_match_t/QofStringMatch/g; + # s/query_compare_t/QofQueryCompare/g; - s/gncQueryCoreInit/qof_query_core_init/g; - s/gncQueryCoreShutdown/qof_query_core_shutdown/g; - s/gncQueryCoreGetPredicate/qof_query_core_get_predicate/g; - s/gncQueryCoreGetCompare/qof_query_core_get_compare/g; + # s/gncQueryCoreInit/qof_query_core_init/g; + # s/gncQueryCoreShutdown/qof_query_core_shutdown/g; + # s/gncQueryCoreGetPredicate/qof_query_core_get_predicate/g; + # s/gncQueryCoreGetCompare/qof_query_core_get_compare/g; - s/gncQueryCorePredicateEqual/qof_query_core_predicate_equal/g; + # s/gncQueryCorePredicateEqual/qof_query_core_predicate_equal/g; - s/QUERY_AND/QOF_QUERY_AND/g; - s/QUERY_OR/QOF_QUERY_OR/g; - s/QUERY_NAND/QOF_QUERY_NAND/g; - s/QUERY_NOR/QOF_QUERY_NOR/g; - s/QUERY_XOR/QOF_QUERY_XOR/g; - s/QUERY_PARAM_BOOK/QOF_QUERY_PARAM_BOOK/g; - s/QUERY_PARAM_GUID/QOF_QUERY_PARAM_GUID/g; - s/QUERY_PARAM_ACTIVE/QOF_QUERY_PARAM_ACTIVE/g; + # s/QUERY_AND/QOF_QUERY_AND/g; + # s/QUERY_OR/QOF_QUERY_OR/g; + # s/QUERY_NAND/QOF_QUERY_NAND/g; + # s/QUERY_NOR/QOF_QUERY_NOR/g; + # s/QUERY_XOR/QOF_QUERY_XOR/g; + # s/QUERY_PARAM_BOOK/QOF_QUERY_PARAM_BOOK/g; + # s/QUERY_PARAM_GUID/QOF_QUERY_PARAM_GUID/g; + # s/QUERY_PARAM_ACTIVE/QOF_QUERY_PARAM_ACTIVE/g; - s/QUERYCORE_INT64/QOF_QUERYCORE_INT64/g; - s/QUERYCORE_STRING/QOF_QUERYCORE_STRING/g; - s/QUERYCORE_GUID/QOF_QUERYCORE_GUID/g; - s/QUERYCORE_DATE/QOF_QUERYCORE_DATE/g; - s/QUERYCORE_BOOLEAN/QOF_QUERYCORE_BOOLEAN/g; - s/QUERYCORE_NUMERIC/QOF_QUERYCORE_NUMERIC/g; - s/QuerySort/QofSortFunc/g; + # s/QUERYCORE_INT64/QOF_QUERYCORE_INT64/g; + # s/QUERYCORE_STRING/QOF_QUERYCORE_STRING/g; + # s/QUERYCORE_GUID/QOF_QUERYCORE_GUID/g; + # s/QUERYCORE_DATE/QOF_QUERYCORE_DATE/g; + # s/QUERYCORE_BOOLEAN/QOF_QUERYCORE_BOOLEAN/g; + # s/QUERYCORE_NUMERIC/QOF_QUERYCORE_NUMERIC/g; + # s/QuerySort/QofSortFunc/g; - s/querynew_s/_QofQuery/g; - s/QueryNew/QofQuery/g; - s/QueryOp/QofQueryOp/g; - s/query_new_term/_QofQueryTerm/g; - s/query_new_sort/_QofQuerySort/g; + # s/querynew_s/_QofQuery/g; + # s/QueryNew/QofQuery/g; + # s/QueryOp/QofQueryOp/g; + # s/query_new_term/_QofQueryTerm/g; + # s/query_new_sort/_QofQuerySort/g; - s/gncQueryBuildParamList/qof_query_build_param_list/g; - s/gncQueryCreateFor/qof_query_create_for/g; - s/gncQueryCreate/qof_query_create/g; - s/gncQueryDestroy/qof_query_destroy/g; - s/gncQuerySearchFor/qof_query_search_for/g; - s/gncQuerySetBook/qof_query_set_book/g; - s/gncQueryAddTerm/qof_query_add_term/g; - s/gncQueryAddGUIDMatch/qof_query_add_guid_match/g; - s/gncQueryAddGUIDListMatch/qof_query_add_guid_list_match/g; - s/gncQueryAddBooleanMatch/qof_query_add_boolean_match/g; - s/gncQueryRun/qof_query_run/g; - s/gncQueryLastRun/qof_query_last_run/g; - s/gncQueryClear/qof_query_clear/g; - s/gncQueryPurgeTerms/qof_query_purge_terms/g; - s/gncQueryHasTerms/qof_query_has_terms/g; - s/gncQueryNumTerms/qof_query_num_terms/g; - s/gncQueryHasTermType/qof_query_has_term_type/g; - s/gncQueryCopy/qof_query_copy/g; - s/gncQueryInvert/qof_query_invert/g; - s/gncQueryMerge/qof_query_merge/g; - s/gncQueryMergeInPlace/qof_query_merges_ins_place/g; - s/gncQuerySetSortOrder/qof_query_set_sort_order/g; - s/gncQuerySetSortOptions/qof_query_set_sort_options/g; - s/gncQuerySetSortIncreasing/qof_query_set_sort_increasing/g; - s/gncQuerySetMaxResults/qof_query_set_max_results/g; - s/gncQueryEqual/qof_query_equal/g; - s/gncQueryPrint/qof_query_print/g; - s/gncQueryGetSearchFor/qof_query_get_search_for/g; - s/gncQueryGetBooks/qof_query_get_books/g; + # s/gncQueryBuildParamList/qof_query_build_param_list/g; + # s/gncQueryCreateFor/qof_query_create_for/g; + # s/gncQueryCreate/qof_query_create/g; + # s/gncQueryDestroy/qof_query_destroy/g; + # s/gncQuerySearchFor/qof_query_search_for/g; + # s/gncQuerySetBook/qof_query_set_book/g; + # s/gncQueryAddTerm/qof_query_add_term/g; + # s/gncQueryAddGUIDMatch/qof_query_add_guid_match/g; + # s/gncQueryAddGUIDListMatch/qof_query_add_guid_list_match/g; + # s/gncQueryAddBooleanMatch/qof_query_add_boolean_match/g; + # s/gncQueryRun/qof_query_run/g; + # s/gncQueryLastRun/qof_query_last_run/g; + # s/gncQueryClear/qof_query_clear/g; + # s/gncQueryPurgeTerms/qof_query_purge_terms/g; + # s/gncQueryHasTerms/qof_query_has_terms/g; + # s/gncQueryNumTerms/qof_query_num_terms/g; + # s/gncQueryHasTermType/qof_query_has_term_type/g; + # s/gncQueryCopy/qof_query_copy/g; + # s/gncQueryInvert/qof_query_invert/g; + # s/gncQueryMerge/qof_query_merge/g; + # s/gncQueryMergeInPlace/qof_query_merges_ins_place/g; + # s/gncQuerySetSortOrder/qof_query_set_sort_order/g; + # s/gncQuerySetSortOptions/qof_query_set_sort_options/g; + # s/gncQuerySetSortIncreasing/qof_query_set_sort_increasing/g; + # s/gncQuerySetMaxResults/qof_query_set_max_results/g; + # s/gncQueryEqual/qof_query_equal/g; + # s/gncQueryPrint/qof_query_print/g; + # s/gncQueryGetSearchFor/qof_query_get_search_for/g; + # s/gncQueryGetBooks/qof_query_get_books/g; - s/gncQueryNewInit/qof_query_new_init/g; - s/gncQueryNewShutdown/qof_query_new_shutdown/g; - s/gncQueryGetMaxResults/qof_query_get_max_results/g; - s/gncQueryGetTerms/qof_query_get_terms/g; - s/gncQueryTermGetParamPath/qof_query_term_get_param_path/g; - s/gncQueryTermGetPredData/qof_query_term_get_pred_data/g; - s/gncQueryTermIsInverted/qof_query_term_is_inverted/g; - s/gncQueryGetSorts/qof_query_get_sorts/g; - s/gncQuerySortGetParamPath/qof_query_sort_get_param_path/g; - s/gncQuerySortGetSortOptions/qof_query_sort_get_sort_options/g; - s/gncQuerySortGetIncreasing/qof_query_sort_get_increasing/g; + # s/gncQueryNewInit/qof_query_new_init/g; + # s/gncQueryNewShutdown/qof_query_new_shutdown/g; + # s/gncQueryGetMaxResults/qof_query_get_max_results/g; + # s/gncQueryGetTerms/qof_query_get_terms/g; + # s/gncQueryTermGetParamPath/qof_query_term_get_param_path/g; + # s/gncQueryTermGetPredData/qof_query_term_get_pred_data/g; + # s/gncQueryTermIsInverted/qof_query_term_is_inverted/g; + # s/gncQueryGetSorts/qof_query_get_sorts/g; + # s/gncQuerySortGetParamPath/qof_query_sort_get_param_path/g; + # s/gncQuerySortGetSortOptions/qof_query_sort_get_sort_options/g; + # s/gncQuerySortGetIncreasing/qof_query_sort_get_increasing/g; - s/query_object_def/_QofQueryObject/g; - s/QueryObjectDef/QofQueryObject/g; + # s/query_object_def/_QofQueryObject/g; + # s/QueryObjectDef/QofQueryObject/g; - s/QueryAccess/QofAccessFunc/g; + # s/QueryAccess/QofAccessFunc/g; - s/gncQueryObjectRegister/qof_query_object_register/g; - s/gncQueryObjectParameterType/qof_query_object_parameter_type/g; - s/gncQueryObjectGetParameterGetter/qof_query_object_get_parameter_getter/g; - s/gncQueryObjectGetParameter/qof_query_object_get_parameter/g; - s/gncQueryObjectInit/qof_query_object_init/g; - s/gncQueryObjectShutdown/qof_query_object_shutdown/g; - s/gncQueryObjectDefaultSort/qof_query_object_default_sort/g; + # s/gncQueryObjectRegister/qof_query_object_register/g; + # s/gncQueryObjectParameterType/qof_query_object_parameter_type/g; + # s/gncQueryObjectGetParameterGetter/qof_query_object_get_parameter_getter/g; + # s/gncQueryObjectGetParameter/qof_query_object_get_parameter/g; + # s/gncQueryObjectInit/qof_query_object_init/g; + # s/gncQueryObjectShutdown/qof_query_object_shutdown/g; + # s/gncQueryObjectDefaultSort/qof_query_object_default_sort/g; - s/xaccGUIDNULL/guid_null/g; - s/xaccGUIDMalloc/guid_malloc/g; - s/xaccGUIDFree/guid_free/g; + # s/xaccGUIDNULL/guid_null/g; + # s/xaccGUIDMalloc/guid_malloc/g; + # s/xaccGUIDFree/guid_free/g; - s/GNCIdTypeConst/QofIdTypeConst/g; - s/GNCIdType/QofIdType/g; - s/GNCEntityTable/QofEntityTable/g; - s/xaccGUIDTypeEntityTable/qof_guid_type/g; + # s/GNCIdTypeConst/QofIdTypeConst/g; + # s/GNCIdType/QofIdType/g; + # s/GNCEntityTable/QofEntityTable/g; + # s/xaccGUIDTypeEntityTable/qof_guid_type/g; - s/xaccEntityTableNew/qof_entity_new/g; - s/xaccEntityTableDestroy/qof_entity_destroy/g; - s/xaccGUIDNewEntityTable/qof_entity_guid_new/g; - s/xaccLookupEntity/qof_entity_lookup/g; - s/xaccStoreEntity/qof_entity_store/g; - s/xaccRemoveEntity/qof_entity_remove/g; - s/xaccForeachEntity/qof_entity_foreach/g; + # s/xaccEntityTableNew/qof_entity_new/g; + # s/xaccEntityTableDestroy/qof_entity_destroy/g; + # s/xaccGUIDNewEntityTable/qof_entity_guid_new/g; + # s/xaccLookupEntity/qof_entity_lookup/g; + # s/xaccStoreEntity/qof_entity_store/g; + # s/xaccRemoveEntity/qof_entity_remove/g; + # s/xaccForeachEntity/qof_entity_foreach/g; - s/foreachObjectCB/QofEntityForeachCB/g; - s/GNC_OBJECT_VERSION/QOF_OBJECT_VERSION/g; + # s/foreachObjectCB/QofEntityForeachCB/g; + # s/GNC_OBJECT_VERSION/QOF_OBJECT_VERSION/g; - s/GNCSession/QofSession/g; - s/gnc_session/qof_session/g; - s/GNCPercentageFunc/QofPercentageFunc/g; - s/gnc_get_current_session/qof_session_get_current_session/g; - s/gnc_set_current_session/qof_session_set_current_session/g; + # s/GNCSession/QofSession/g; + # s/gnc_session/qof_session/g; + # s/GNCPercentageFunc/QofPercentageFunc/g; + # s/gnc_get_current_session/qof_session_get_current_session/g; + # s/gnc_set_current_session/qof_session_set_current_session/g; - s/ Backend/ QofBackend/g; - s/\(Backend/\(QofBackend/g; - s/GNCBackendError/QofBackendError/g; - s/GNCBePercentageFunc/QofBePercentageFunc/g; - s/xaccBackendSetError/qof_backend_set_error/g; - s/xaccBackendGetError/qof_backend_get_error/g; - s/xaccBackendSetMessage/qof_backend_set_message/g; - s/xaccBackendGetMessage/qof_backend_get_message/g; - s/xaccInitBackend/qof_backend_init/g; + # s/ Backend/ QofBackend/g; + # s/\(Backend/\(QofBackend/g; + # s/GNCBackendError/QofBackendError/g; + # s/GNCBePercentageFunc/QofBePercentageFunc/g; + # s/xaccBackendSetError/qof_backend_set_error/g; + # s/xaccBackendGetError/qof_backend_get_error/g; + # s/xaccBackendSetMessage/qof_backend_set_message/g; + # s/xaccBackendGetMessage/qof_backend_get_message/g; + # s/xaccInitBackend/qof_backend_init/g; - s/GNCId\.h/qofid\.h/g; - s/gncObject\.h/qofobject\.h/g; - s/QueryCore\.h/qofquerycore\.h/g; - s/QofQuery\.h/qofquery\.h/g; - s/QueryObject\.h/qofqueryobject\.h/g; + # s/GNCId\.h/qofid\.h/g; + # s/gncObject\.h/qofobject\.h/g; + # s/QueryCore\.h/qofquerycore\.h/g; + # s/QofQuery\.h/qofquery\.h/g; + # s/QueryObject\.h/qofqueryobject\.h/g; - s/QofQof/Qof/g; - s/QOF_QOF/QOF/g; + # s/QofQof/Qof/g; + # s/QOF_QOF/QOF/g; + + + s/kvp_frame /KvpFrame /g; + s/kvp_frame* /KvpFrame* /g; + s/kvp_value /KvpValue /g; + s/kvp_value* /KvpValue* /g; + s/kvp_value_t/KvpValueType/g; + print OF $_; } close OF;