44 LUMIERA_INTERFACE_SLOT (
void, foo1, (
const char*)),
45 LUMIERA_INTERFACE_SLOT (
void, bar1, (
const char*)),
49 LUMIERA_INTERFACE_SLOT (
void, foo2, (
const char*)),
50 LUMIERA_INTERFACE_SLOT (
void, bar2, (
const char*)),
62 testfunc (
const char* message)
64 ECHO (
"Called as '%s'", message);
70 testacquire (LumieraInterface
self, LumieraInterface interface)
73 ECHO (
"Acquire %s_%d_%s", self->interface, self->version, self->name);
79 testrelease (LumieraInterface
self)
81 ECHO (
"Release %s_%d_%s", self->interface, self->version, self->name);
89 lumieraorg_tests_descriptor,
94 LUMIERA_INTERFACE_INLINE (
name,
95 const char*, (LumieraInterface iface),
96 {(void)iface;
return "LumieraTest";}
98 LUMIERA_INTERFACE_INLINE (brief,
99 const char*, (LumieraInterface iface),
100 {(void)iface;
return "Lumiera Test suite examples";}
102 LUMIERA_INTERFACE_INLINE (homepage,
103 const char*, (LumieraInterface iface),
104 {(void)iface;
return "http://www.lumiera.org/develompent.html";}
106 LUMIERA_INTERFACE_INLINE (version,
107 const char*, (LumieraInterface iface),
108 {(void)iface;
return "No Version";}
110 LUMIERA_INTERFACE_INLINE (author,
111 const char*, (LumieraInterface iface),
112 {(void)iface;
return "Christian Thaeter";}
114 LUMIERA_INTERFACE_INLINE (email,
115 const char*, (LumieraInterface iface),
116 {(void)iface;
return "ct@pipapo.org";}
118 LUMIERA_INTERFACE_INLINE (copyright,
119 const char*, (LumieraInterface iface),
123 "Copyright (C) Lumiera.org\n" 124 " 2008 Christian Thaeter <ct@pipapo.org>";
127 LUMIERA_INTERFACE_INLINE (license,
128 const char*, (LumieraInterface iface),
132 "This program is free software; you can redistribute it and/or modify\n" 133 "it under the terms of the GNU General Public License as published by\n" 134 "the Free Software Foundation; either version 2 of the License, or\n" 135 "(at your option) any later version.\n" 137 "This program is distributed in the hope that it will be useful,\n" 138 "but WITHOUT ANY WARRANTY; without even the implied warranty of\n" 139 "MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n" 140 "GNU General Public License for more details.\n" 142 "You should have received a copy of the GNU General Public License\n" 143 "along with this program; if not, write to the Free Software\n" 144 "Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA";
148 LUMIERA_INTERFACE_INLINE (state,
149 int, (LumieraInterface iface),
153 LUMIERA_INTERFACE_INLINE (versioncmp,
154 int, (
const char* a,
const char* b),
155 {(void)a;(void)b;
return 0;}
180 testacquire_one (LumieraInterface self, LumieraInterface interface)
183 ECHO (
"Acquire one %s_%d_%s", self->interface, self->version, self->name);
184 one_keeps_two = LUMIERA_INTERFACE_OPEN (lumieraorg_testexample_void, 0, 0, lumieraorg_dependencytest_two);
185 one_keeps_three = LUMIERA_INTERFACE_OPEN (lumieraorg_testexample_void, 0, 0, lumieraorg_dependencytest_three);
190 testrelease_one (LumieraInterface
self)
192 ECHO (
"Release one %s_%d_%s", self->interface, self->version, self->name);
201 testacquire_two (LumieraInterface self, LumieraInterface interface)
204 ECHO (
"Acquire two %s_%d_%s", self->interface, self->version, self->name);
205 two_keeps_one = LUMIERA_INTERFACE_OPEN (lumieraorg_testexample_void, 0, 0, lumieraorg_dependencytest_one);
206 two_keeps_four = LUMIERA_INTERFACE_OPEN (lumieraorg_testexample_void, 0, 0, lumieraorg_dependencytest_four);
211 testrelease_two (LumieraInterface
self)
213 ECHO (
"Release two %s_%d_%s", self->interface, self->version, self->name);
222 testacquire_three (LumieraInterface self, LumieraInterface interface)
225 ECHO (
"Acquire three %s_%d_%s", self->interface, self->version, self->name);
226 three_keeps_two = LUMIERA_INTERFACE_OPEN (lumieraorg_testexample_void, 0, 0, lumieraorg_dependencytest_two);
227 three_keeps_four = LUMIERA_INTERFACE_OPEN (lumieraorg_testexample_void, 0, 0, lumieraorg_dependencytest_four);
232 testrelease_three (LumieraInterface
self)
234 ECHO (
"Release three %s_%d_%s", self->interface, self->version, self->name);
244 testacquire_four (LumieraInterface self, LumieraInterface interface)
247 ECHO (
"Acquire four %s_%d_%s", self->interface, self->version, self->name);
248 four_keeps_one = LUMIERA_INTERFACE_OPEN (lumieraorg_testexample_void, 0, 0, lumieraorg_dependencytest_one);
249 four_keeps_two = LUMIERA_INTERFACE_OPEN (lumieraorg_testexample_void, 0, 0, lumieraorg_dependencytest_two);
250 four_keeps_three = LUMIERA_INTERFACE_OPEN (lumieraorg_testexample_void, 0, 0, lumieraorg_dependencytest_three);
255 testrelease_four (LumieraInterface
self)
257 ECHO (
"Release four %s_%d_%s", self->interface, self->version, self->name);
265 LUMIERA_INTERFACE_DEFINE (lumieraorg_testexample_one, 0,
266 lumieraorg_first_test,
270 LUMIERA_INTERFACE_MAP (foo1,
272 LUMIERA_INTERFACE_MAP (bar1,
275 LUMIERA_INTERFACE_DEFINE (lumieraorg_testexample_two, 0,
276 lumieraorg_second_test,
280 LUMIERA_INTERFACE_MAP (foo2,
282 LUMIERA_INTERFACE_MAP (bar2,
285 LUMIERA_INTERFACE_DEFINE (lumieraorg_testexample_void, 0,
286 lumieraorg_dependencytest_one,
291 LUMIERA_INTERFACE_DEFINE (lumieraorg_testexample_void, 0,
292 lumieraorg_dependencytest_two,
297 LUMIERA_INTERFACE_DEFINE (lumieraorg_testexample_void, 0,
298 lumieraorg_dependencytest_three,
303 LUMIERA_INTERFACE_DEFINE (lumieraorg_testexample_void, 0,
304 lumieraorg_dependencytest_four,
318 lumiera_interfaceregistry_bulkregister_interfaces (lumiera_plugin_interfaces(), NULL);
323 LumieraInterface handle1 =
324 lumiera_interfaceregistry_interface_find (
"lumieraorg_testexample_one", 0,
"lumieraorg_first_test");
330 lumiera_interfaceregistry_interface_find ("lumieraorg_testexample_two", 0, "lumieraorg_second_test");
332 handle2->foo2 ("this is foo2");
335 lumiera_interfaceregistry_destroy ();
341 lumiera_interfaceregistry_bulkregister_interfaces (lumiera_plugin_interfaces(), NULL);
344 LUMIERA_INTERFACE_OPEN (lumieraorg_testexample_one, 0, 0, lumieraorg_first_test);
347 handle->bar1 ("this is bar1");
352 lumiera_interfaceregistry_destroy ();
355 TEST (dependencies_one)
361 LUMIERA_INTERFACE_OPEN (lumieraorg_testexample_void, 0, 0, lumieraorg_dependencytest_one);
364 ECHO ("Sucessfully opened");
369 lumiera_interfaceregistry_destroy ();
373 TEST (dependencies_two)
379 LUMIERA_INTERFACE_OPEN (lumieraorg_testexample_void, 0, 0, lumieraorg_dependencytest_two);
382 ECHO ("Sucessfully opened");
387 lumiera_interfaceregistry_destroy ();
390 TEST (dependencies_three)
396 LUMIERA_INTERFACE_OPEN (lumieraorg_testexample_void, 0, 0, lumieraorg_dependencytest_three);
399 ECHO ("Sucessfully opened");
404 lumiera_interfaceregistry_destroy ();
408 TEST (dependencies_four)
414 LUMIERA_INTERFACE_OPEN (lumieraorg_testexample_void, 0, 0, lumieraorg_dependencytest_four);
417 ECHO ("Sucessfully opened");
422 lumiera_interfaceregistry_destroy ();
427 TEST (dependencies_all)
434 LUMIERA_INTERFACE_OPEN (lumieraorg_testexample_void, 0, 0, lumieraorg_dependencytest_one);
439 LUMIERA_INTERFACE_OPEN (lumieraorg_testexample_void, 0, 0, lumieraorg_dependencytest_three);
440 CHECK (handle_three);
444 LUMIERA_INTERFACE_OPEN (lumieraorg_testexample_void, 0, 0, lumieraorg_dependencytest_two);
449 LUMIERA_INTERFACE_OPEN (lumieraorg_testexample_void, 0, 0, lumieraorg_dependencytest_four);
452 ECHO ("Sucessfully OPENED");
460 ECHO ("CLOSE three");
468 lumiera_interfaceregistry_destroy ();
472 TEST (plugin_discover)
487 lumiera_interfaceregistry_destroy ();
497 printf (
"plugin discovered before unload: %p\n", p);
498 CHECK (p,
"prerequisite: need to load test-c-plugin.lum");
502 printf (
"plugin discovered after unload: %p\n", p);
503 CHECK (!p,
"failed to unload plugin.");
505 lumiera_interfaceregistry_destroy ();
509 TEST (plugin_exampleplugin)
514 TODO (
"macro to derive minminor version from a slot");
517 LUMIERA_INTERFACE_OPEN (lumieraorg_testhello, 0, 0, lumieraorg_hello_german);
520 LUMIERA_INTERFACE_OPEN (lumieraorg_testhello, 0, 0, lumieraorg_hello_english);
523 german->goodbye ("Welt!");
526 english->goodbye ("World!");
528 LUMIERA_INTERFACE_CLOSE (german);
529 LUMIERA_INTERFACE_CLOSE (english);
531 lumiera_interfaceregistry_destroy ();
534 TEST (plugin_exampleplugin_nested)
538 lumiera_config_interface_init ();
541 LUMIERA_INTERFACE_OPEN (lumieraorg_testtest, 0, 0, lumieraorg_test_both);
545 LUMIERA_INTERFACE_CLOSE (
test);
547 lumiera_config_interface_destroy ();
548 lumiera_interfaceregistry_destroy ();
552 TEST (plugin_exampleplugin_cpp)
559 LUMIERA_INTERFACE_OPEN (lumieraorg_testhello, 0, 0, lumieraorg_hello_german_cpp);
562 LUMIERA_INTERFACE_OPEN (lumieraorg_testhello, 0, 0, lumieraorg_hello_english_cpp);
565 german->goodbye ("schnöde Welt!");
568 english->goodbye ("Vale of Tears!");
570 LUMIERA_INTERFACE_CLOSE (german);
571 LUMIERA_INTERFACE_CLOSE (english);
573 lumiera_interfaceregistry_destroy ();
LumieraPlugin lumiera_plugin_lookup(const char *name)
Lookup a plugin handle in the pluginregistry.
const char * lumiera_plugin_name(LumieraPlugin self)
Query the plugin name The name is the path and filename under which it was loaded.
int lumiera_plugin_register(LumieraPlugin plugin)
Register a plugin and its interfaces.
LumieraPlugin lumiera_plugin_load(const char *plugin)
Tries to load a plugin Creates a new plugin structure and tries to load and initialise the plugin...
LUMIERA_EXPORT(LUMIERA_INTERFACE_DEFINE(lumieraorg_interface, 0, lumieraorg_interface, NULL, NULL, NULL, LUMIERA_INTERFACE_MAP(open, lumiera_interface_open), LUMIERA_INTERFACE_MAP(close, lumiera_interface_close), LUMIERA_INTERFACE_MAP(version, lumiera_interface_version),))
Definition of 'the mother of all interfaces' since this interface is singleton and required for any c...
Helpers and support macros for defining test executables in C.
Interface for a lumiera configuration system (draft).
#define LUMIERA_INTERFACE_DECLARE(name, version,...)
Declare an interface.
Not finished development code.
#define LUMIERA_INTERFACE_INSTANCE(iname, version, name, descriptor, acquire, release,...)
Define an interface instance.
#define LUMIERA_INTERFACE_REGISTEREXPORTED
Register all exported interfaces when not a plugin This is a no-op when LUMIERA_PLUGIN is defined...
Lumiera interface macros and structures.
unsigned lumiera_plugin_unload(LumieraPlugin self)
Tries to unload a plugin.
#define LUMIERA_INTERFACE_CAST(name, version)
Construct a cast to the target interface type Used to cast a generic LumieraInterface to the real typ...
A mock interface to support testing of the interface system.
void lumiera_interface_close(LumieraInterface self)
Close an interface after use.
#define LUMIERA_INTERFACE_REF(iname, version, dname)
Return a reference (pointer) to an interface implementation.
int lumiera_plugin_discover(LumieraPlugin(*callback_load)(const char *plugin), int(*callback_register)(LumieraPlugin))
discover new plugins traverses the configured plugin paths and calls the callback_load function for a...
lumiera_err lumiera_error(void)
Get and clear current error state.
#define LUMIERA_INTERFACE_TYPE(name, version)
Construct the type of the interface.
void lumiera_interfaceregistry_init(void)
Initialise the interface registry.
Global registry for interfaces (extension points).
#define LUMIERA_INTERFACE_UNREGISTEREXPORTED
Unregister all exported interfaces when not a plugin This is a no-op when LUMIERA_PLUGIN is defined...
ExampleStrategy::Qualifier two(string additionalArg)
definition of another qualifier two(arg), accepting an additional argument
A data record to describe interface, interface instances and plug-in instances.
External interface to the lumiera configuration system.
ExampleStrategy::Qualifier one()
definition of a qualifier one()
#define LUMIERA_INTERFACE_HANDLE(interface, version)
create a handle for a interface (WIP)