diff --git a/src/engine/Account.c b/src/engine/Account.c index e77ac4994e..dfcd53085d 100644 --- a/src/engine/Account.c +++ b/src/engine/Account.c @@ -4674,19 +4674,25 @@ xaccAccountForEachTransaction(const Account *acc, TransactionCallback proc, /* ================================================================ */ /* QofObject function implementation and registration */ - +#ifdef _MSC_VER +/* MSVC compiler doesn't have C99 "designated initializers" + * so we wrap them in a macro that is empty on MSVC. */ +# define DI(x) /* */ +#else +# define DI(x) x +#endif static QofObject account_object_def = { - .interface_version = QOF_OBJECT_VERSION, - .e_type = GNC_ID_ACCOUNT, - .type_label = "Account", - .create = (gpointer)xaccMallocAccount, - .book_begin = NULL, - .book_end = NULL, - .is_dirty = qof_collection_is_dirty, - .mark_clean = qof_collection_mark_clean, - .foreach = qof_collection_foreach, - .printable = (const char* (*)(gpointer)) xaccAccountGetName, - .version_cmp = (int (*)(gpointer,gpointer)) qof_instance_version_cmp, + DI(.interface_version =) QOF_OBJECT_VERSION, + DI(.e_type =) GNC_ID_ACCOUNT, + DI(.type_label =) "Account", + DI(.create =) (gpointer)xaccMallocAccount, + DI(.book_begin =) NULL, + DI(.book_end =) NULL, + DI(.is_dirty =) qof_collection_is_dirty, + DI(.mark_clean =) qof_collection_mark_clean, + DI(.foreach =) qof_collection_foreach, + DI(.printable =) (const char* (*)(gpointer)) xaccAccountGetName, + DI(.version_cmp =) (int (*)(gpointer,gpointer)) qof_instance_version_cmp, }; gboolean xaccAccountRegister (void) diff --git a/src/engine/SX-book.c b/src/engine/SX-book.c index 9cf51afa25..c6e3ae9358 100644 --- a/src/engine/SX-book.c +++ b/src/engine/SX-book.c @@ -161,17 +161,24 @@ sxtg_mark_clean(QofCollection *col) g_list_free(descendants); } +#ifdef _MSC_VER +/* MSVC compiler doesn't have C99 "designated initializers" + * so we wrap them in a macro that is empty on MSVC. */ +# define DI(x) /* */ +#else +# define DI(x) x +#endif static QofObject sxtg_object_def = { - .interface_version = QOF_OBJECT_VERSION, - .e_type = GNC_ID_SXTG, - .type_label = "Scheduled Transaction Templates", - .book_begin = sxtg_book_begin, - .book_end = sxtg_book_end, - .is_dirty = sxtg_is_dirty, - .mark_clean = sxtg_mark_clean, - .foreach = NULL, - .printable = NULL, + DI(.interface_version =) QOF_OBJECT_VERSION, + DI(.e_type =) GNC_ID_SXTG, + DI(.type_label =) "Scheduled Transaction Templates", + DI(.book_begin =) sxtg_book_begin, + DI(.book_end =) sxtg_book_end, + DI(.is_dirty =) sxtg_is_dirty, + DI(.mark_clean =) sxtg_mark_clean, + DI(.foreach =) NULL, + DI(.printable =) NULL, }; /* ====================================================================== */ @@ -307,32 +314,32 @@ book_sxlist_notsaved(const QofCollection *col) static QofObject sxes_object_def = { - .interface_version = QOF_OBJECT_VERSION, - .e_type = GNC_ID_SXES, - .type_label = "Scheduled Transactions List", - .create = NULL, - .book_begin = book_sxes_setup, - .book_end = book_sxes_end, - .is_dirty = book_sxlist_notsaved, - .mark_clean = book_sxns_mark_saved, - .foreach = NULL, - .printable = NULL, - .version_cmp = NULL + DI(.interface_version =) QOF_OBJECT_VERSION, + DI(.e_type =) GNC_ID_SXES, + DI(.type_label =) "Scheduled Transactions List", + DI(.create =) NULL, + DI(.book_begin =) book_sxes_setup, + DI(.book_end =) book_sxes_end, + DI(.is_dirty =) book_sxlist_notsaved, + DI(.mark_clean =) book_sxns_mark_saved, + DI(.foreach =) NULL, + DI(.printable =) NULL, + DI(.version_cmp =) NULL }; static QofObject sxtt_object_def = { - .interface_version = QOF_OBJECT_VERSION, - .e_type = GNC_ID_SXTT, - .type_label = "Scheduled Transaction Templates", - .create = NULL, - .book_begin = NULL, - .book_end = NULL, - .is_dirty = NULL, - .mark_clean = NULL, - .foreach = NULL, - .printable = NULL, - .version_cmp = NULL, + DI(.interface_version =) QOF_OBJECT_VERSION, + DI(.e_type =) GNC_ID_SXTT, + DI(.type_label =) "Scheduled Transaction Templates", + DI(.create =) NULL, + DI(.book_begin =) NULL, + DI(.book_end =) NULL, + DI(.is_dirty =) NULL, + DI(.mark_clean =) NULL, + DI(.foreach =) NULL, + DI(.printable =) NULL, + DI(.version_cmp =) NULL, }; gboolean diff --git a/src/engine/SchedXaction.c b/src/engine/SchedXaction.c index 9905cb80c8..fbdd4dda26 100644 --- a/src/engine/SchedXaction.c +++ b/src/engine/SchedXaction.c @@ -859,19 +859,26 @@ gnc_sx_get_defer_instances( SchedXaction *sx ) return sx->deferredList; } +#ifdef _MSC_VER +/* MSVC compiler doesn't have C99 "designated initializers" + * so we wrap them in a macro that is empty on MSVC. */ +# define DI(x) /* */ +#else +# define DI(x) x +#endif static QofObject SXDesc = { - .interface_version = QOF_OBJECT_VERSION, - .e_type = GNC_SX_ID, - .type_label = "Scheduled Transaction", - .create = (gpointer)xaccSchedXactionMalloc, - .book_begin = NULL, - .book_end = NULL, - .is_dirty = qof_collection_is_dirty, - .mark_clean = qof_collection_mark_clean, - .foreach = qof_collection_foreach, - .printable = NULL, - .version_cmp = (int (*)(gpointer, gpointer)) qof_instance_version_cmp, + DI(.interface_version =) QOF_OBJECT_VERSION, + DI(.e_type =) GNC_SX_ID, + DI(.type_label =) "Scheduled Transaction", + DI(.create =) (gpointer)xaccSchedXactionMalloc, + DI(.book_begin =) NULL, + DI(.book_end =) NULL, + DI(.is_dirty =) qof_collection_is_dirty, + DI(.mark_clean =) qof_collection_mark_clean, + DI(.foreach =) qof_collection_foreach, + DI(.printable =) NULL, + DI(.version_cmp =) (int (*)(gpointer, gpointer)) qof_instance_version_cmp, }; gboolean diff --git a/src/engine/Split.c b/src/engine/Split.c index 6f20ebf2c9..5d72118d12 100644 --- a/src/engine/Split.c +++ b/src/engine/Split.c @@ -1780,18 +1780,25 @@ xaccSplitUnvoid(Split *split) /* Hook into the QofObject registry */ +#ifdef _MSC_VER +/* MSVC compiler doesn't have C99 "designated initializers" + * so we wrap them in a macro that is empty on MSVC. */ +# define DI(x) /* */ +#else +# define DI(x) x +#endif static QofObject split_object_def = { - .interface_version = QOF_OBJECT_VERSION, - .e_type = GNC_ID_SPLIT, - .type_label = "Split", - .create = (gpointer)xaccMallocSplit, - .book_begin = NULL, - .book_end = NULL, - .is_dirty = qof_collection_is_dirty, - .mark_clean = qof_collection_mark_clean, - .foreach = qof_collection_foreach, - .printable = (const char* (*)(gpointer)) xaccSplitGetMemo, - .version_cmp = (int (*)(gpointer, gpointer)) qof_instance_version_cmp, + DI(.interface_version =) QOF_OBJECT_VERSION, + DI(.e_type =) GNC_ID_SPLIT, + DI(.type_label =) "Split", + DI(.create =) (gpointer)xaccMallocSplit, + DI(.book_begin =) NULL, + DI(.book_end =) NULL, + DI(.is_dirty =) qof_collection_is_dirty, + DI(.mark_clean =) qof_collection_mark_clean, + DI(.foreach =) qof_collection_foreach, + DI(.printable =) (const char* (*)(gpointer)) xaccSplitGetMemo, + DI(.version_cmp =) (int (*)(gpointer, gpointer)) qof_instance_version_cmp, }; static gpointer diff --git a/src/engine/Transaction.c b/src/engine/Transaction.c index fdb7652367..3c37d4858f 100644 --- a/src/engine/Transaction.c +++ b/src/engine/Transaction.c @@ -2028,19 +2028,27 @@ xaccTransFindSplitByAccount(const Transaction *trans, const Account *acc) \********************************************************************/ /* QofObject function implementation */ +#ifdef _MSC_VER +/* MSVC compiler doesn't have C99 "designated initializers" + * so we wrap them in a macro that is empty on MSVC. */ +# define DI(x) /* */ +#else +# define DI(x) x +#endif + /* Hook into the QofObject registry */ static QofObject trans_object_def = { - .interface_version = QOF_OBJECT_VERSION, - .e_type = GNC_ID_TRANS, - .type_label = "Transaction", - .create = (gpointer)xaccMallocTransaction, - .book_begin = NULL, - .book_end = NULL, - .is_dirty = qof_collection_is_dirty, - .mark_clean = qof_collection_mark_clean, - .foreach = qof_collection_foreach, - .printable = (const char* (*)(gpointer)) xaccTransGetDescription, - .version_cmp = (int (*)(gpointer,gpointer)) qof_instance_version_cmp, + DI(.interface_version =) QOF_OBJECT_VERSION, + DI(.e_type =) GNC_ID_TRANS, + DI(.type_label =) "Transaction", + DI(.create =) (gpointer)xaccMallocTransaction, + DI(.book_begin =) NULL, + DI(.book_end =) NULL, + DI(.is_dirty =) qof_collection_is_dirty, + DI(.mark_clean =) qof_collection_mark_clean, + DI(.foreach =) qof_collection_foreach, + DI(.printable =) (const char* (*)(gpointer)) xaccTransGetDescription, + DI(.version_cmp =) (int (*)(gpointer,gpointer)) qof_instance_version_cmp, }; static gboolean diff --git a/src/engine/gnc-budget.c b/src/engine/gnc-budget.c index 2448c8853c..d2f225dee1 100644 --- a/src/engine/gnc-budget.c +++ b/src/engine/gnc-budget.c @@ -600,20 +600,28 @@ gnc_budget_get_default (QofBook *book) return bgt; } +#ifdef _MSC_VER +/* MSVC compiler doesn't have C99 "designated initializers" + * so we wrap them in a macro that is empty on MSVC. */ +# define DI(x) /* */ +#else +# define DI(x) x +#endif + /* Define the QofObject. */ static QofObject budget_object_def = { - .interface_version = QOF_OBJECT_VERSION, - .e_type = GNC_ID_BUDGET, - .type_label = "Budget", - .create = (gpointer)gnc_budget_new, - .book_begin = NULL, - .book_end = NULL, - .is_dirty = qof_collection_is_dirty, - .mark_clean = qof_collection_mark_clean, - .foreach = qof_collection_foreach, - .printable = (const char* (*)(gpointer)) gnc_budget_get_name, - .version_cmp = (int (*)(gpointer, gpointer)) qof_instance_version_cmp, + DI(.interface_version =) QOF_OBJECT_VERSION, + DI(.e_type =) GNC_ID_BUDGET, + DI(.type_label =) "Budget", + DI(.create =) (gpointer)gnc_budget_new, + DI(.book_begin =) NULL, + DI(.book_end =) NULL, + DI(.is_dirty =) qof_collection_is_dirty, + DI(.mark_clean =) qof_collection_mark_clean, + DI(.foreach =) qof_collection_foreach, + DI(.printable =) (const char* (*)(gpointer)) gnc_budget_get_name, + DI(.version_cmp =) (int (*)(gpointer, gpointer)) qof_instance_version_cmp, }; diff --git a/src/engine/gnc-commodity.c b/src/engine/gnc-commodity.c index 21ab43a6fa..d2e00ea6f4 100644 --- a/src/engine/gnc-commodity.c +++ b/src/engine/gnc-commodity.c @@ -2312,30 +2312,37 @@ gnc_commodity_table_add_default_data(gnc_commodity_table *table, QofBook *book) ********************************************************************/ /* QofObject function implementation and registration */ +#ifdef _MSC_VER +/* MSVC compiler doesn't have C99 "designated initializers" + * so we wrap them in a macro that is empty on MSVC. */ +# define DI(x) /* */ +#else +# define DI(x) x +#endif static QofObject commodity_object_def = { - .interface_version = QOF_OBJECT_VERSION, - .e_type = GNC_ID_COMMODITY, - .type_label = "Commodity", - .book_begin = NULL, - .book_end = NULL, - .is_dirty = qof_collection_is_dirty, - .mark_clean = qof_collection_mark_clean, - .foreach = qof_collection_foreach, - .printable = (const char* (*)(gpointer)) gnc_commodity_get_fullname, + DI(.interface_version =) QOF_OBJECT_VERSION, + DI(.e_type =) GNC_ID_COMMODITY, + DI(.type_label =) "Commodity", + DI(.book_begin =) NULL, + DI(.book_end =) NULL, + DI(.is_dirty =) qof_collection_is_dirty, + DI(.mark_clean =) qof_collection_mark_clean, + DI(.foreach =) qof_collection_foreach, + DI(.printable =) (const char* (*)(gpointer)) gnc_commodity_get_fullname, }; static QofObject namespace_object_def = { - .interface_version = QOF_OBJECT_VERSION, - .e_type = GNC_ID_COMMODITY_NAMESPACE, - .type_label = "Namespace", - .book_begin = NULL, - .book_end = NULL, - .is_dirty = NULL, - .mark_clean = NULL, - .foreach = NULL, - .printable = NULL, + DI(.interface_version =) QOF_OBJECT_VERSION, + DI(.e_type =) GNC_ID_COMMODITY_NAMESPACE, + DI(.type_label =) "Namespace", + DI(.book_begin =) NULL, + DI(.book_end =) NULL, + DI(.is_dirty =) NULL, + DI(.mark_clean =) NULL, + DI(.foreach =) NULL, + DI(.printable =) NULL, }; static void @@ -2370,17 +2377,17 @@ commodity_table_book_end (QofBook *book) static QofObject commodity_table_object_def = { - .interface_version = QOF_OBJECT_VERSION, - .e_type = GNC_ID_COMMODITY_TABLE, - .type_label = "CommodityTable", - .create = NULL, - .book_begin = commodity_table_book_begin, - .book_end = commodity_table_book_end, - .is_dirty = qof_collection_is_dirty, - .mark_clean = qof_collection_mark_clean, - .foreach = NULL, - .printable = NULL, - .version_cmp = NULL, + DI(.interface_version =) QOF_OBJECT_VERSION, + DI(.e_type =) GNC_ID_COMMODITY_TABLE, + DI(.type_label =) "CommodityTable", + DI(.create =) NULL, + DI(.book_begin =) commodity_table_book_begin, + DI(.book_end =) commodity_table_book_end, + DI(.is_dirty =) qof_collection_is_dirty, + DI(.mark_clean =) qof_collection_mark_clean, + DI(.foreach =) NULL, + DI(.printable =) NULL, + DI(.version_cmp =) NULL, }; gboolean diff --git a/src/engine/gnc-lot.c b/src/engine/gnc-lot.c index ff0ab3f353..1be29c9505 100644 --- a/src/engine/gnc-lot.c +++ b/src/engine/gnc-lot.c @@ -610,19 +610,26 @@ gnc_lot_get_latest_split (GNCLot *lot) /* ============================================================= */ +#ifdef _MSC_VER +/* MSVC compiler doesn't have C99 "designated initializers" + * so we wrap them in a macro that is empty on MSVC. */ +# define DI(x) /* */ +#else +# define DI(x) x +#endif static QofObject gncLotDesc = { - .interface_version = QOF_OBJECT_VERSION, - .e_type = GNC_ID_LOT, - .type_label = "Lot", - .create = (gpointer)gnc_lot_new, - .book_begin = NULL, - .book_end = NULL, - .is_dirty = qof_collection_is_dirty, - .mark_clean = qof_collection_mark_clean, - .foreach = qof_collection_foreach, - .printable = NULL, - .version_cmp = (int (*)(gpointer,gpointer))qof_instance_version_cmp, + DI(.interface_version =) QOF_OBJECT_VERSION, + DI(.e_type =) GNC_ID_LOT, + DI(.type_label =) "Lot", + DI(.create =) (gpointer)gnc_lot_new, + DI(.book_begin =) NULL, + DI(.book_end =) NULL, + DI(.is_dirty =) qof_collection_is_dirty, + DI(.mark_clean =) qof_collection_mark_clean, + DI(.foreach =) qof_collection_foreach, + DI(.printable =) NULL, + DI(.version_cmp =) (int (*)(gpointer,gpointer))qof_instance_version_cmp, }; diff --git a/src/engine/gnc-pricedb.c b/src/engine/gnc-pricedb.c index d45d13beec..ed13ff264f 100644 --- a/src/engine/gnc-pricedb.c +++ b/src/engine/gnc-pricedb.c @@ -2479,34 +2479,41 @@ price_printable(gpointer obj) return buff; } +#ifdef _MSC_VER +/* MSVC compiler doesn't have C99 "designated initializers" + * so we wrap them in a macro that is empty on MSVC. */ +# define DI(x) /* */ +#else +# define DI(x) x +#endif static QofObject price_object_def = { - .interface_version = QOF_OBJECT_VERSION, - .e_type = GNC_ID_PRICE, - .type_label = "Price", - .create = price_create, - .book_begin = NULL, - .book_end = NULL, - .is_dirty = qof_collection_is_dirty, - .mark_clean = qof_collection_mark_clean, - .foreach = price_foreach, - .printable = price_printable, - .version_cmp = NULL, + DI(.interface_version =) QOF_OBJECT_VERSION, + DI(.e_type =) GNC_ID_PRICE, + DI(.type_label =) "Price", + DI(.create =) price_create, + DI(.book_begin =) NULL, + DI(.book_end =) NULL, + DI(.is_dirty =) qof_collection_is_dirty, + DI(.mark_clean =) qof_collection_mark_clean, + DI(.foreach =) price_foreach, + DI(.printable =) price_printable, + DI(.version_cmp =) NULL, }; static QofObject pricedb_object_def = { - .interface_version = QOF_OBJECT_VERSION, - .e_type = GNC_ID_PRICEDB, - .type_label = "PriceDB", - .create = NULL, - .book_begin = pricedb_book_begin, - .book_end = pricedb_book_end, - .is_dirty = qof_collection_is_dirty, - .mark_clean = qof_collection_mark_clean, - .foreach = NULL, - .printable = NULL, - .version_cmp = NULL, + DI(.interface_version =) QOF_OBJECT_VERSION, + DI(.e_type =) GNC_ID_PRICEDB, + DI(.type_label =) "PriceDB", + DI(.create =) NULL, + DI(.book_begin =) pricedb_book_begin, + DI(.book_end =) pricedb_book_end, + DI(.is_dirty =) qof_collection_is_dirty, + DI(.mark_clean =) qof_collection_mark_clean, + DI(.foreach =) NULL, + DI(.printable =) NULL, + DI(.version_cmp =) NULL, }; gboolean