diff --git a/src/lumiera/Makefile.am b/src/lumiera/Makefile.am index 18371ff2f..b196c3ca1 100644 --- a/src/lumiera/Makefile.am +++ b/src/lumiera/Makefile.am @@ -16,18 +16,13 @@ # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. lumiera_srcdir = $(top_srcdir)/src/lumiera -bin_PROGRAMS += lumiera -lumiera_CPPFLAGS = $(AM_CPPFLAGS) -DLUMIERA_PLUGIN_PATH="\"$(pkglibdir)\"" -lumiera_CFLAGS = $(AM_CFLAGS) -std=gnu99 -Wextra -Wall -Werror -lumiera_LDADD = liblumiera.a $(LUMIERA_PLUGIN_LIBS) $(NOBUGMT_LUMIERA_LIBS) -lumiera_SOURCES = \ - $(lumiera_srcdir)/lumiera.c \ - $(lumiera_srcdir)/interface.c \ - $(lumiera_srcdir)/interfaceregistry.c \ - $(lumiera_srcdir)/plugin.c \ - $(lumiera_srcdir)/plugin_dynlib.c \ +noinst_LIBRARIES += liblumieraconfig.a +liblumieraconfig_a_CPPFLAGS = $(AM_CPPFLAGS) +liblumieraconfig_a_CFLAGS = $(AM_CFLAGS) -std=gnu99 -Wextra -Wall -Werror + +liblumieraconfig_a_SOURCES = \ $(lumiera_srcdir)/config.c \ $(lumiera_srcdir)/config_typed.c \ $(lumiera_srcdir)/config_wordlist.c \ @@ -36,6 +31,36 @@ lumiera_SOURCES = \ $(lumiera_srcdir)/config_lookup.c + +noinst_LIBRARIES += liblumieraplugin.a +liblumieraplugin_a_CPPFLAGS = $(AM_CPPFLAGS) -DLUMIERA_PLUGIN_PATH="\"$(pkglibdir)\"" +liblumieraplugin_a_CFLAGS = $(AM_CFLAGS) -std=gnu99 -Wextra -Wall -Werror + +liblumieraplugin_a_SOURCES = \ + $(lumiera_srcdir)/interface.c \ + $(lumiera_srcdir)/interfaceregistry.c \ + $(lumiera_srcdir)/plugin.c \ + $(lumiera_srcdir)/plugin_dynlib.c + + + +noinst_LIBRARIES += liblumierainit.a +liblumierainit_a_CPPFLAGS = $(AM_CPPFLAGS) +liblumierainit_a_CFLAGS = $(AM_CFLAGS) -std=gnu99 -Wextra -Wall -Werror + +liblumierainit_a_SOURCES = \ + $(lumiera_srcdir)/lumiera_init.c + + +bin_PROGRAMS += lumiera +lumiera_CPPFLAGS = $(AM_CPPFLAGS) +lumiera_CFLAGS = $(AM_CFLAGS) -std=gnu99 -Wextra -Wall -Werror +lumiera_LDADD = liblumierainit.a liblumieraconfig.a liblumieraplugin.a liblumiera.a $(LUMIERA_PLUGIN_LIBS) $(NOBUGMT_LUMIERA_LIBS) + +lumiera_SOURCES = \ + $(lumiera_srcdir)/lumiera.c + + noinst_HEADERS += \ $(lumiera_srcdir)/interface.h \ $(lumiera_srcdir)/interfaceregistry.h \ diff --git a/src/lumiera/interfacedescriptor.h b/src/lumiera/interfacedescriptor.h index 29894c686..de9179658 100644 --- a/src/lumiera/interfacedescriptor.h +++ b/src/lumiera/interfacedescriptor.h @@ -21,7 +21,7 @@ #ifndef LUMIERA_INTERFACEDESCRIPTOR_H #define LUMIERA_INTERFACEDESCRIPTOR_H -#include "backend/interface.h" +#include "lumiera/interface.h" /** diff --git a/src/lumiera/lumiera.c b/src/lumiera/lumiera.c index b154c100c..64bf9de89 100644 --- a/src/lumiera/lumiera.c +++ b/src/lumiera/lumiera.c @@ -36,25 +36,8 @@ * */ -NOBUG_DEFINE_FLAG (all); -NOBUG_DEFINE_FLAG_PARENT (lumiera_all, all); -NOBUG_DEFINE_FLAG_PARENT (lumiera, lumiera_all); - //code goes here// - -static void -lumiera_init (void) -{ - NOBUG_INIT; - NOBUG_INIT_FLAG (all); - NOBUG_INIT_FLAG (lumiera_all); - NOBUG_INIT_FLAG (lumiera); - -} - - - int main (int argc, char** argv) { diff --git a/src/lumiera/lumiera.h b/src/lumiera/lumiera.h index 54e55ed71..cf29bf65f 100644 --- a/src/lumiera/lumiera.h +++ b/src/lumiera/lumiera.h @@ -45,6 +45,8 @@ NOBUG_DECLARE_FLAG (lumiera); */ //TODO: declarations go here// +void +lumiera_init (void); #endif diff --git a/src/lumiera/lumiera_init.c b/src/lumiera/lumiera_init.c new file mode 100644 index 000000000..7107363ef --- /dev/null +++ b/src/lumiera/lumiera_init.c @@ -0,0 +1,63 @@ +/* + lumiera_init.c - Lumiera initialization and shutdowen and global state + + Copyright (C) Lumiera.org + 2008, Christian Thaeter + + 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, write to the Free Software + Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +*/ + +//TODO: Support library includes// + + +//TODO: Lumiera header includes// +#include "lumiera/lumiera.h" + +//TODO: internal/static forward declarations// + + +//TODO: System includes// + +/** + * @file + * + */ + +NOBUG_DEFINE_FLAG (all); +NOBUG_DEFINE_FLAG_PARENT (lumiera_all, all); +NOBUG_DEFINE_FLAG_PARENT (lumiera, lumiera_all); + + +//code goes here// + +void +lumiera_init (void) +{ + NOBUG_INIT; + NOBUG_INIT_FLAG (all); + NOBUG_INIT_FLAG (lumiera_all); + NOBUG_INIT_FLAG (lumiera); + +} + + + +/* +// Local Variables: +// mode: C +// c-file-style: "gnu" +// indent-tabs-mode: nil +// End: +*/ diff --git a/tests/Makefile.am b/tests/Makefile.am index a2bda93d7..6ab82f8b1 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -58,21 +58,24 @@ test_filehandles_SOURCES = $(tests_srcdir)/backend/test-filehandles.c test_filehandles_CPPFLAGS = $(AM_CPPFLAGS) -std=gnu99 -Wall -Werror test_filehandles_LDADD = liblumibackend.a liblumiera.a $(NOBUGMT_LUMIERA_LIBS) + + + check_PROGRAMS += test-config -test_config_SOURCES = $(tests_srcdir)/backend/test-config.c +test_config_SOURCES = $(tests_srcdir)/lumiera/test-config.c test_config_CPPFLAGS = $(AM_CPPFLAGS) -std=gnu99 -Wall -Werror -I$(top_srcdir)/src/ -test_config_LDADD = liblumibackend.a liblumiera.a $(NOBUGMT_LUMIERA_LIBS) +test_config_LDADD = liblumieraconfig.a liblumierainit.a liblumiera.a $(NOBUGMT_LUMIERA_LIBS) check_LTLIBRARIES += examplepluginc.la -examplepluginc_la_SOURCES = $(tests_srcdir)/backend/example_plugin.c +examplepluginc_la_SOURCES = $(tests_srcdir)/lumiera/example_plugin.c examplepluginc_la_CPPFLAGS = $(AM_CPPFLAGS) -std=gnu99 -Wall -Werror -DLUMIERA_PLUGIN -I$(top_srcdir)/src/ examplepluginc_la_LDFLAGS = -module -avoid-version -no-undefined -rpath /dev/null check_PROGRAMS += test-interfaces -test_interfaces_SOURCES = $(tests_srcdir)/backend/test-interfaces.c +test_interfaces_SOURCES = $(tests_srcdir)/lumiera/test-interfaces.c test_interfaces_CPPFLAGS = $(AM_CPPFLAGS) -std=gnu99 -Wall -Werror -test_interfaces_LDADD = liblumibackend.a liblumiera.a $(LUMIERA_PLUGIN_LIBS) $(NOBUGMT_LUMIERA_LIBS) -test_interfaces_DEPENDENCIES = examplepluginc.la liblumibackend.a liblumiera.a +test_interfaces_LDADD = liblumieraplugin.a liblumieraconfig.a liblumierainit.a liblumiera.a $(LUMIERA_PLUGIN_LIBS) $(NOBUGMT_LUMIERA_LIBS) +test_interfaces_DEPENDENCIES = examplepluginc.la liblumierainit.a liblumieraconfig.a liblumieraplugin.a liblumiera.a check_PROGRAMS += test-filemmap test_filemmap_SOURCES = $(tests_srcdir)/backend/test-filemmap.c diff --git a/tests/backend/plugin_main.c b/tests/backend/plugin_main.c deleted file mode 100644 index 4b95ea60c..000000000 --- a/tests/backend/plugin_main.c +++ /dev/null @@ -1,70 +0,0 @@ -#include - -#include "lib/plugin.h" -#include "hello_interface.h" - -LUMIERA_ERROR_DEFINE(FAILURE, "test failure"); - -int -main(int argc, char** argv) -{ - NOBUG_INIT; - - if (argc < 2) - return -1; - - lumiera_init_plugin (); - /* - we have a plugin 'hello_1' which provides us 2 hello interfaces, one for english and one for german output, - open both try them, close them. - */ - - TODO("macros, doing casting and typing"); - - if( !strcmp(argv[1],"C")) - { - LUMIERA_INTERFACE_TYPE(hello, 1)* hello_de = - (LUMIERA_INTERFACE_TYPE(hello, 1)*) lumiera_interface_open ("example_plugin", "german_1", sizeof(LUMIERA_INTERFACE_TYPE(hello, 1))); - - if (!hello_de) LUMIERA_DIE (FAILURE); - - hello_de->hello(); - hello_de->goodbye(argv[1]); - - LUMIERA_INTERFACE_TYPE(hello, 1)* hello_en = - (LUMIERA_INTERFACE_TYPE(hello, 1)*) lumiera_interface_open ("example_plugin", "english_1", sizeof(LUMIERA_INTERFACE_TYPE(hello, 1))); - - if (!hello_en) LUMIERA_DIE (FAILURE); - - hello_en->hello(); - hello_en->goodbye(argv[1]); - - lumiera_interface_close (hello_en); - lumiera_interface_close (hello_de); - } - - if( !strcmp(argv[1],"C++")) - { - /* same again for a plugin written in C++ */ - LUMIERA_INTERFACE_TYPE(hello, 1)* hello_de = - (LUMIERA_INTERFACE_TYPE(hello, 1)*) lumiera_interface_open ("example_plugin_cpp", "german_1", sizeof(LUMIERA_INTERFACE_TYPE(hello, 1))); - - if (!hello_de) LUMIERA_DIE (FAILURE); - - hello_de->hello(); - hello_de->goodbye(argv[1]); - - LUMIERA_INTERFACE_TYPE(hello, 1)* hello_en = - (LUMIERA_INTERFACE_TYPE(hello, 1)*) lumiera_interface_open ("example_plugin_cpp", "english_1", sizeof(LUMIERA_INTERFACE_TYPE(hello, 1))); - - if (!hello_en) LUMIERA_DIE (FAILURE); - - hello_en->hello(); - hello_en->goodbye(argv[1]); - - lumiera_interface_close (hello_en); - lumiera_interface_close (hello_de); - } - - return 0; -} diff --git a/tests/lumiera/DIR_INFO b/tests/lumiera/DIR_INFO new file mode 100644 index 000000000..5dbe3e850 --- /dev/null +++ b/tests/lumiera/DIR_INFO @@ -0,0 +1 @@ +tests for the main lumiera loader diff --git a/tests/backend/example_plugin.c b/tests/lumiera/example_plugin.c similarity index 99% rename from tests/backend/example_plugin.c rename to tests/lumiera/example_plugin.c index 66a93c838..14af12b71 100644 --- a/tests/backend/example_plugin.c +++ b/tests/lumiera/example_plugin.c @@ -1,7 +1,7 @@ #include #include "hello_interface.h" -#include "backend/interfacedescriptor.h" +#include "lumiera/interfacedescriptor.h" int myopen(void) { diff --git a/tests/backend/example_plugin.cpp b/tests/lumiera/example_plugin.cpp similarity index 100% rename from tests/backend/example_plugin.cpp rename to tests/lumiera/example_plugin.cpp diff --git a/tests/backend/hello_interface.h b/tests/lumiera/hello_interface.h similarity index 87% rename from tests/backend/hello_interface.h rename to tests/lumiera/hello_interface.h index 097861c01..4ccf02b88 100644 --- a/tests/backend/hello_interface.h +++ b/tests/lumiera/hello_interface.h @@ -1,4 +1,4 @@ -#include "backend/interface.h" +#include "lumiera/interface.h" LUMIERA_INTERFACE_DECLARE (lumieraorg_testhello, 0, LUMIERA_INTERFACE_SLOT (void, hello, (void)), diff --git a/tests/backend/test-config.c b/tests/lumiera/test-config.c similarity index 99% rename from tests/backend/test-config.c rename to tests/lumiera/test-config.c index 120fc57d7..cf215b7f2 100644 --- a/tests/backend/test-config.c +++ b/tests/lumiera/test-config.c @@ -21,8 +21,8 @@ */ #include "lib/safeclib.h" -#include "backend/config.h" -#include "backend/configitem.h" +#include "lumiera/config.h" +#include "lumiera/configitem.h" #include "tests/test.h" diff --git a/tests/backend/test-interfaces.c b/tests/lumiera/test-interfaces.c similarity index 99% rename from tests/backend/test-interfaces.c rename to tests/lumiera/test-interfaces.c index a087da735..488fe5ea4 100644 --- a/tests/backend/test-interfaces.c +++ b/tests/lumiera/test-interfaces.c @@ -19,13 +19,13 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ -#include "backend/interface.h" -#include "backend/interfaceregistry.h" -#include "backend/interfacedescriptor.h" -#include "backend/config.h" +#include "lumiera/interface.h" +#include "lumiera/interfaceregistry.h" +#include "lumiera/interfacedescriptor.h" +#include "lumiera/config.h" #include "tests/test.h" -#include "tests/backend/hello_interface.h" +#include "tests/lumiera/hello_interface.h" /* define 2 example interfaces