diff --git a/ChangeLog b/ChangeLog index b8c3d5f180..b05fa35eca 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,54 @@ +2001-08-08 Dave Peticolas + + * src/engine/engine-helpers.[ch]: remove cruft + + * src/guile/gnc-helpers.c: fix warnings + + * src/import-export/qif-import/gncmod-qif-import.c: include api + header + + * src/register/register-gnome/gncmod-register-gnome.c: include api + header + + * src/register/register-core/gncmod-register-core.c: include api + header + + * src/register/ledger-core/gncmod-ledger-core.c: include api header + + * src/backend/postgres/gncmod-backend-postgres.c: include api header + + * src/backend/rpc/gncmod-backend-rpc.c: include api header + + * src/backend/file/gnc-pricedb-xml-v1.c: fix warning + + * src/backend/file/Makefile.am (SUBDIRS): fix includes + + * src/backend/file/gncmod-backend-file.c: include api header + + * src/engine/gncmod-engine.c: include api header + + * src/gnc-module/test/test-dynload.c: fix warning + + * src/gnc-module/test/misc-mods/agedver.c: include api header + + * src/gnc-module/test/misc-mods/incompatdep.c: include api header + + * src/gnc-module/test/misc-mods/futuremodsys.c: include api header + + * src/gnc-module/test/mod-baz/gnc-mod-baz.c: include api header + + * src/gnc-module/test/mod-bar/gnc-mod-bar.c: include api header + + * src/gnc-module/test/mod-bar/Makefile.am: fix includes + + * src/gnc-module/test/mod-foo/gnc-mod-foo.c: include api header + + * src/gnc-module/test/mod-foo/Makefile.am: fix includes + + * src/gnc-module/gnc-module-api.h: new file. public module api + + * src/gnc-module/Makefile.am: add headers + 2001-08-06 Bill Gribble * Added module/plugin system (src/gnc-module/*) diff --git a/src/backend/Makefile.am b/src/backend/Makefile.am index 0ce1affb26..d05affc512 100644 --- a/src/backend/Makefile.am +++ b/src/backend/Makefile.am @@ -2,3 +2,4 @@ SUBDIRS=file ${SQL_DIR} ${RPC_DIR} DIST_SUBDIRS=file postgres rpc +noinst_HEADERS = gnc-backend-api.h diff --git a/src/backend/file/Makefile.am b/src/backend/file/Makefile.am index 5de74613a5..c973c75665 100644 --- a/src/backend/file/Makefile.am +++ b/src/backend/file/Makefile.am @@ -2,7 +2,7 @@ SUBDIRS=. test lib_LTLIBRARIES=libgncmod-backend-file.la -INCLUDES= -I../../engine -I../../gnc-module ${GLIB_CFLAGS} -I../.. +INCLUDES= -I.. -I../../engine -I../../gnc-module ${GLIB_CFLAGS} -I../.. libgncmod_backend_file_la_SOURCES= gncmod-backend-file.c \ gnc-account-xml-v2.c gnc-backend-file.c gnc-commodity-xml-v2.c \ diff --git a/src/backend/file/gnc-backend-file.c b/src/backend/file/gnc-backend-file.c index febd9d005a..86a5621176 100644 --- a/src/backend/file/gnc-backend-file.c +++ b/src/backend/file/gnc-backend-file.c @@ -23,6 +23,7 @@ #include "io-gncbin.h" #include "io-gncxml-v2.h" +#include "gnc-backend-api.h" #include "gnc-book.h" #include "gnc-book-p.h" #include "gnc-engine.h" @@ -39,8 +40,6 @@ struct FileBackend_struct char *linkfile; int lockfd; - const char *id; - GNCBook *book; }; @@ -171,9 +170,6 @@ file_book_end(Backend *be_start) if (be->lockfile) unlink (be->lockfile); -/* g_free (be->id); */ -/* be->id = NULL; */ - g_free (be->fullpath); be->fullpath = NULL; @@ -197,7 +193,7 @@ file_all_sync(Backend* be, AccountGroup *ag, GNCPriceDB *pricedb) } Backend * -gnc_backend_new(const char *book_id, void *data) +gnc_backend_new(void) { FileBackend *fbe; Backend *be; @@ -232,8 +228,6 @@ gnc_backend_new(const char *book_id, void *data) fbe->linkfile = NULL; fbe->lockfd = -1; - fbe->id = book_id; - fbe->book = NULL; return be; @@ -353,7 +347,7 @@ is_gzipped_file(const gchar *name) return FALSE; } -GNCBookFileType +static GNCBookFileType gnc_file_be_determine_file_type(const char *path) { if(gnc_is_xml_data_file_v2(path)) { diff --git a/src/backend/file/gnc-pricedb-xml-v1.c b/src/backend/file/gnc-pricedb-xml-v1.c index 1adf950e61..ace017200d 100644 --- a/src/backend/file/gnc-pricedb-xml-v1.c +++ b/src/backend/file/gnc-pricedb-xml-v1.c @@ -302,6 +302,8 @@ pricedb_v2_end_handler( return TRUE; } +sixtp* gnc_pricedb_parser_new(void); + sixtp* gnc_pricedb_parser_new(void) { diff --git a/src/backend/file/gncmod-backend-file.c b/src/backend/file/gncmod-backend-file.c index 72e9515512..c725c823ad 100644 --- a/src/backend/file/gncmod-backend-file.c +++ b/src/backend/file/gncmod-backend-file.c @@ -9,6 +9,7 @@ #include #include "gnc-module.h" +#include "gnc-module-api.h" /* version of the gnc module system interface we require */ int gnc_module_system_interface = 0; diff --git a/src/backend/gnc-backend-api.h b/src/backend/gnc-backend-api.h new file mode 100644 index 0000000000..114423b8ed --- /dev/null +++ b/src/backend/gnc-backend-api.h @@ -0,0 +1,31 @@ +/********************************************************************\ + * gnc-backend-api.h -- public functions needed by gnucash backends * + * Copyright (C) 2001 Linux Developers Group, Inc. * + * * + * This program is free software; you can redistribute it and/or * + * modify it under the terms of the GNU General Public License as * + * published by the Free Software Foundation; either version 2 of * + * the License, or (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License* + * along with this program; if not, contact: * + * * + * Free Software Foundation Voice: +1-617-542-5942 * + * 59 Temple Place - Suite 330 Fax: +1-617-542-2652 * + * Boston, MA 02111-1307, USA gnu@gnu.org * + * * +\********************************************************************/ + +#ifndef GNC_BACKEND_API_H +#define GNC_BACKEND_API_H + +#include "Backend.h" + +Backend * gnc_backend_new (void); + +#endif diff --git a/src/backend/postgres/Makefile.am b/src/backend/postgres/Makefile.am index 5516c70c95..43883ee55d 100644 --- a/src/backend/postgres/Makefile.am +++ b/src/backend/postgres/Makefile.am @@ -47,7 +47,7 @@ EXTRA_DIST = \ table-drop.sql \ demo.c -INCLUDES = -I../.. -I../../engine -I../../gnc-module +INCLUDES = -I.. -I../.. -I../../engine -I../../gnc-module CFLAGS = @CFLAGS@ ${GLIB_CFLAGS} # Some of the required C files are built with the m4 pre-processor diff --git a/src/backend/postgres/gncmod-backend-postgres.c b/src/backend/postgres/gncmod-backend-postgres.c index 754c4a70f7..cca4cfba84 100644 --- a/src/backend/postgres/gncmod-backend-postgres.c +++ b/src/backend/postgres/gncmod-backend-postgres.c @@ -11,7 +11,9 @@ #include "Backend.h" #include "PostgresBackend.h" +#include "gnc-backend-api.h" #include "gnc-module.h" +#include "gnc-module-api.h" /* version of the gnc module system interface we require */ int gnc_module_system_interface = 0; diff --git a/src/backend/rpc/Makefile.am b/src/backend/rpc/Makefile.am index c27a0b5bf6..f67614adfa 100644 --- a/src/backend/rpc/Makefile.am +++ b/src/backend/rpc/Makefile.am @@ -42,7 +42,7 @@ EXTRA_DIST = \ README \ $(RPCGEN_SRCS) -INCLUDES = -I../../engine -I../../gnc-module +INCLUDES = -I.. -I../../engine -I../../gnc-module LDADD = -lpthread CFLAGS = @CFLAGS@ ${GLIB_CFLAGS} -DGNCACCT_COMMODITY diff --git a/src/backend/rpc/gncmod-backend-rpc.c b/src/backend/rpc/gncmod-backend-rpc.c index 2ac46e0435..966643b1a3 100644 --- a/src/backend/rpc/gncmod-backend-rpc.c +++ b/src/backend/rpc/gncmod-backend-rpc.c @@ -11,7 +11,9 @@ #include "Backend.h" #include "RpcBackend.h" +#include "gnc-backend-api.h" #include "gnc-module.h" +#include "gnc-module-api.h" /* version of the gnc module system interface we require */ int gnc_module_system_interface = 0; diff --git a/src/engine/engine-helpers.c b/src/engine/engine-helpers.c index e63c203c8c..11d970a317 100644 --- a/src/engine/engine-helpers.c +++ b/src/engine/engine-helpers.c @@ -39,42 +39,6 @@ #include -int -gnc_guid_type(GUID guid) -{ - return xaccGUIDType(&guid); -} - -GUID -gnc_account_get_guid(Account *account) { - return *xaccAccountGetGUID(account); -} - -Account * -gnc_account_lookup(GUID guid) { - return xaccAccountLookup(&guid); -} - -GUID -gnc_trans_get_guid(Transaction *trans) { - return *xaccTransGetGUID(trans); -} - -Transaction * -gnc_trans_lookup(GUID guid) { - return xaccTransLookup(&guid); -} - -GUID -gnc_split_get_guid(Split *split) { - return *xaccSplitGetGUID(split); -} - -Split * -gnc_split_lookup(GUID guid) { - return xaccSplitLookup(&guid); -} - Timespec gnc_transaction_get_date_posted(Transaction *t) { Timespec result; diff --git a/src/engine/engine-helpers.h b/src/engine/engine-helpers.h index 0431cff37b..a5e5222633 100644 --- a/src/engine/engine-helpers.h +++ b/src/engine/engine-helpers.h @@ -34,16 +34,6 @@ #include #include -int gnc_guid_type(GUID guid); -GUID gnc_account_get_guid(Account *account); -Account * gnc_account_lookup(GUID guid); - -GUID gnc_trans_get_guid(Transaction *trans); -Transaction * gnc_trans_lookup(GUID guid); - -GUID gnc_split_get_guid(Split *split); -Split * gnc_split_lookup(GUID guid); - Timespec gnc_transaction_get_date_posted(Transaction *t); Timespec gnc_transaction_get_date_entered(Transaction *t); diff --git a/src/engine/gncmod-engine.c b/src/engine/gncmod-engine.c index c5db3c909c..8b4b974b8b 100644 --- a/src/engine/gncmod-engine.c +++ b/src/engine/gncmod-engine.c @@ -8,8 +8,9 @@ #include #include #include -#include "gnc-engine.h" +#include "gnc-engine.h" +#include "gnc-module-api.h" #include "gw-engine.h" /* version of the gnc module system interface we require */ diff --git a/src/gnc-module/Makefile.am b/src/gnc-module/Makefile.am index 6af0356ed7..7a6296c518 100644 --- a/src/gnc-module/Makefile.am +++ b/src/gnc-module/Makefile.am @@ -19,6 +19,10 @@ gwmoddir=${GNC_SHAREDIR}/guile-modules/g-wrapped gwmod_LTLIBRARIES=libgw-gnc-module.la gwmod_DATA=gw-gnc-module-spec.scm +noinst_HEADERS = \ + gnc-module-api.h \ + gnc-module.h + noinst_DATA=.scm-links .scm-links: diff --git a/src/gnc-module/gnc-module-api.h b/src/gnc-module/gnc-module-api.h new file mode 100644 index 0000000000..9a49b36bbe --- /dev/null +++ b/src/gnc-module/gnc-module-api.h @@ -0,0 +1,32 @@ +/********************************************************************\ + * gnc-module-api.h -- public functions needed by gnucash modules * + * Copyright (C) 2001 Linux Developers Group, Inc. * + * * + * This program is free software; you can redistribute it and/or * + * modify it under the terms of the GNU General Public License as * + * published by the Free Software Foundation; either version 2 of * + * the License, or (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License* + * along with this program; if not, contact: * + * * + * Free Software Foundation Voice: +1-617-542-5942 * + * 59 Temple Place - Suite 330 Fax: +1-617-542-2652 * + * Boston, MA 02111-1307, USA gnu@gnu.org * + * * +\********************************************************************/ + +#ifndef GNC_MODULE_API_H +#define GNC_MODULE_API_H + +char * gnc_module_path (void); +char * gnc_module_description (void); +int gnc_module_init (int refcount); +int gnc_module_end(int refcount); + +#endif diff --git a/src/gnc-module/gnc-module.h b/src/gnc-module/gnc-module.h index a98c7d3b6d..690dd046c0 100644 --- a/src/gnc-module/gnc-module.h +++ b/src/gnc-module/gnc-module.h @@ -3,6 +3,9 @@ * Copyright 2001 Linux Developers Group, Inc. *************************************************************/ +#ifndef GNC_MODULE_H +#define GNC_MODULE_H + #include #include @@ -40,3 +43,4 @@ int gnc_module_use_scm_module(gchar * module_path); * 'mod'. 'mod' must be previously loaded. */ void * gnc_module_lookup(GNCModule mod, gchar * symbol); +#endif diff --git a/src/gnc-module/test/misc-mods/agedver.c b/src/gnc-module/test/misc-mods/agedver.c index 8c616dbb54..9e6112519a 100644 --- a/src/gnc-module/test/misc-mods/agedver.c +++ b/src/gnc-module/test/misc-mods/agedver.c @@ -1,9 +1,10 @@ -/* incompatdep.c : a gnucash module that depends on an incompatible - * version of another module. the initialization should fail. */ +/* agedver.c : testing module age? */ #include #include + #include "gnc-module.h" +#include "gnc-module-api.h" int gnc_module_system_interface = 0; @@ -22,7 +23,7 @@ gnc_module_description(void) { } int -gnc_module_init(void) { +gnc_module_init(int refcount) { return TRUE; } diff --git a/src/gnc-module/test/misc-mods/futuremodsys.c b/src/gnc-module/test/misc-mods/futuremodsys.c index 56af303e2b..cdaff95738 100644 --- a/src/gnc-module/test/misc-mods/futuremodsys.c +++ b/src/gnc-module/test/misc-mods/futuremodsys.c @@ -1,11 +1,13 @@ /* futuremodsys.c : a gnucash module compiled with a future version of * the module system. gnucash should not be able to load it. but if - * it doesn't motice that, the actual interface is compatible with + * it doesn't notice that, the actual interface is compatible with * version 0 so it will load all the way before failing. */ #include #include +#include "gnc-module-api.h" + int gnc_module_system_interface = 123456; int gnc_module_current = 0; diff --git a/src/gnc-module/test/misc-mods/incompatdep.c b/src/gnc-module/test/misc-mods/incompatdep.c index 2a62c30ffd..1f7977b122 100644 --- a/src/gnc-module/test/misc-mods/incompatdep.c +++ b/src/gnc-module/test/misc-mods/incompatdep.c @@ -3,7 +3,9 @@ #include #include + #include "gnc-module.h" +#include "gnc-module-api.h" int gnc_module_system_interface = 0; diff --git a/src/gnc-module/test/mod-bar/Makefile.am b/src/gnc-module/test/mod-bar/Makefile.am index e659786116..a100fd3154 100644 --- a/src/gnc-module/test/mod-bar/Makefile.am +++ b/src/gnc-module/test/mod-bar/Makefile.am @@ -1,5 +1,7 @@ CFLAGS=@CFLAGS@ ${GLIB_CFLAGS} ${G_WRAP_COMPILE_ARGS} +INCLUDES=-I${top_srcdir}/src/gnc-module + checklibdir=${PWD} checklib_LTLIBRARIES = libbar.la libgncmodbar.la diff --git a/src/gnc-module/test/mod-bar/gnc-mod-bar.c b/src/gnc-module/test/mod-bar/gnc-mod-bar.c index dcd434eaf8..f218d1e53b 100644 --- a/src/gnc-module/test/mod-bar/gnc-mod-bar.c +++ b/src/gnc-module/test/mod-bar/gnc-mod-bar.c @@ -4,7 +4,9 @@ #include #include #include + #include "bar-gwrap.h" +#include "gnc-module-api.h" int gnc_module_system_interface = 0; diff --git a/src/gnc-module/test/mod-baz/gnc-mod-baz.c b/src/gnc-module/test/mod-baz/gnc-mod-baz.c index ee7a321657..3e85d033ce 100644 --- a/src/gnc-module/test/mod-baz/gnc-mod-baz.c +++ b/src/gnc-module/test/mod-baz/gnc-mod-baz.c @@ -3,7 +3,9 @@ #include #include + #include "gnc-module.h" +#include "gnc-module-api.h" #include "baz-gwrap.h" int gnc_module_system_interface = 0; diff --git a/src/gnc-module/test/mod-foo/Makefile.am b/src/gnc-module/test/mod-foo/Makefile.am index 56308d5fad..cd0db278bd 100644 --- a/src/gnc-module/test/mod-foo/Makefile.am +++ b/src/gnc-module/test/mod-foo/Makefile.am @@ -1,5 +1,7 @@ CFLAGS=@CFLAGS@ ${GLIB_CFLAGS} ${G_WRAP_COMPILE_ARGS} +INCLUDES=-I${top_srcdir}/src/gnc-module + checklibdir=${PWD} checklib_LTLIBRARIES=libfoo.la libgncmodfoo.la diff --git a/src/gnc-module/test/mod-foo/gnc-mod-foo.c b/src/gnc-module/test/mod-foo/gnc-mod-foo.c index b709ba294f..c11985bc39 100644 --- a/src/gnc-module/test/mod-foo/gnc-mod-foo.c +++ b/src/gnc-module/test/mod-foo/gnc-mod-foo.c @@ -4,7 +4,9 @@ #include #include #include + #include "foo-gwrap.h" +#include "gnc-module-api.h" int gnc_module_system_interface = 0; diff --git a/src/gnc-module/test/test-dynload.c b/src/gnc-module/test/test-dynload.c index 42d4eda648..972cbc4b58 100644 --- a/src/gnc-module/test/test-dynload.c +++ b/src/gnc-module/test/test-dynload.c @@ -10,7 +10,7 @@ #include "gnc-module.h" -void +static void guile_main(int argc, char ** argv) { lt_dlhandle handle; diff --git a/src/import-export/qif-import/gncmod-qif-import.c b/src/import-export/qif-import/gncmod-qif-import.c index dcc0ded968..e200008977 100644 --- a/src/import-export/qif-import/gncmod-qif-import.c +++ b/src/import-export/qif-import/gncmod-qif-import.c @@ -7,7 +7,9 @@ #include #include + #include "gnc-module.h" +#include "gnc-module-api.h" /* version of the gnc module system interface we require */ int gnc_module_system_interface = 0; diff --git a/src/register/ledger-core/gncmod-ledger-core.c b/src/register/ledger-core/gncmod-ledger-core.c index 80b84ef0e3..3f0ff6ae49 100644 --- a/src/register/ledger-core/gncmod-ledger-core.c +++ b/src/register/ledger-core/gncmod-ledger-core.c @@ -6,7 +6,9 @@ *********************************************************************/ #include + #include "gnc-module.h" +#include "gnc-module-api.h" /* version of the gnc module system interface we require */ int gnc_module_system_interface = 0; diff --git a/src/register/register-core/gncmod-register-core.c b/src/register/register-core/gncmod-register-core.c index eac73399cd..8a19ad3fa7 100644 --- a/src/register/register-core/gncmod-register-core.c +++ b/src/register/register-core/gncmod-register-core.c @@ -6,7 +6,9 @@ *********************************************************************/ #include + #include "gnc-module.h" +#include "gnc-module-api.h" /* version of the gnc module system interface we require */ int gnc_module_system_interface = 0; diff --git a/src/register/register-gnome/gncmod-register-gnome.c b/src/register/register-gnome/gncmod-register-gnome.c index 3d74ddb315..5990e442d7 100644 --- a/src/register/register-gnome/gncmod-register-gnome.c +++ b/src/register/register-gnome/gncmod-register-gnome.c @@ -6,7 +6,9 @@ *********************************************************************/ #include + #include "gnc-module.h" +#include "gnc-module-api.h" /* version of the gnc module system interface we require */ int gnc_module_system_interface = 0;