35 LUMIERA_INTERFACE_SLOT (
void, foo1, (
const char*)),
36 LUMIERA_INTERFACE_SLOT (
void, bar1, (
const char*)),
40 LUMIERA_INTERFACE_SLOT (
void, foo2, (
const char*)),
41 LUMIERA_INTERFACE_SLOT (
void, bar2, (
const char*)),
53 testfunc (
const char* message)
55 ECHO (
"Called as '%s'", message);
61 testacquire (LumieraInterface
self, LumieraInterface interface)
64 ECHO (
"Acquire %s_%d_%s", self->interface, self->version, self->name);
70 testrelease (LumieraInterface
self)
72 ECHO (
"Release %s_%d_%s", self->interface, self->version, self->name);
80 lumieraorg_tests_descriptor,
85 LUMIERA_INTERFACE_INLINE (
name,
86 const char*, (LumieraInterface iface),
87 {(void)iface;
return "LumieraTest";}
89 LUMIERA_INTERFACE_INLINE (brief,
90 const char*, (LumieraInterface iface),
91 {(void)iface;
return "Lumiera Test suite examples";}
93 LUMIERA_INTERFACE_INLINE (homepage,
94 const char*, (LumieraInterface iface),
95 {(void)iface;
return "http://www.lumiera.org/develompent.html";}
97 LUMIERA_INTERFACE_INLINE (version,
98 const char*, (LumieraInterface iface),
99 {(void)iface;
return "No Version";}
101 LUMIERA_INTERFACE_INLINE (author,
102 const char*, (LumieraInterface iface),
103 {(void)iface;
return "Christian Thaeter";}
105 LUMIERA_INTERFACE_INLINE (email,
106 const char*, (LumieraInterface iface),
107 {(void)iface;
return "ct@pipapo.org";}
109 LUMIERA_INTERFACE_INLINE (copyright,
110 const char*, (LumieraInterface iface),
115 " 2008, Christian Thaeter <ct@pipapo.org>";
118 LUMIERA_INTERFACE_INLINE (license,
119 const char*, (LumieraInterface iface),
123 "**Lumiera** is free software; you can redistribute it and/or modify it\n" 124 "under the terms of the GNU General Public License as published by the\n" 125 "Free Software Foundation; either version 2 of the License, or (at your\n" 126 "option) any later version. See the file COPYING for further details." 131 LUMIERA_INTERFACE_INLINE (state,
132 int, (LumieraInterface iface),
136 LUMIERA_INTERFACE_INLINE (versioncmp,
137 int, (
const char* a,
const char* b),
138 {(void)a;(void)b;
return 0;}
163 testacquire_one (LumieraInterface self, LumieraInterface interface)
166 ECHO (
"Acquire one %s_%d_%s", self->interface, self->version, self->name);
167 one_keeps_two = LUMIERA_INTERFACE_OPEN (lumieraorg_testexample_void, 0, 0, lumieraorg_dependencytest_two);
168 one_keeps_three = LUMIERA_INTERFACE_OPEN (lumieraorg_testexample_void, 0, 0, lumieraorg_dependencytest_three);
173 testrelease_one (LumieraInterface
self)
175 ECHO (
"Release one %s_%d_%s", self->interface, self->version, self->name);
184 testacquire_two (LumieraInterface self, LumieraInterface interface)
187 ECHO (
"Acquire two %s_%d_%s", self->interface, self->version, self->name);
188 two_keeps_one = LUMIERA_INTERFACE_OPEN (lumieraorg_testexample_void, 0, 0, lumieraorg_dependencytest_one);
189 two_keeps_four = LUMIERA_INTERFACE_OPEN (lumieraorg_testexample_void, 0, 0, lumieraorg_dependencytest_four);
194 testrelease_two (LumieraInterface
self)
196 ECHO (
"Release two %s_%d_%s", self->interface, self->version, self->name);
205 testacquire_three (LumieraInterface self, LumieraInterface interface)
208 ECHO (
"Acquire three %s_%d_%s", self->interface, self->version, self->name);
209 three_keeps_two = LUMIERA_INTERFACE_OPEN (lumieraorg_testexample_void, 0, 0, lumieraorg_dependencytest_two);
210 three_keeps_four = LUMIERA_INTERFACE_OPEN (lumieraorg_testexample_void, 0, 0, lumieraorg_dependencytest_four);
215 testrelease_three (LumieraInterface
self)
217 ECHO (
"Release three %s_%d_%s", self->interface, self->version, self->name);
227 testacquire_four (LumieraInterface self, LumieraInterface interface)
230 ECHO (
"Acquire four %s_%d_%s", self->interface, self->version, self->name);
231 four_keeps_one = LUMIERA_INTERFACE_OPEN (lumieraorg_testexample_void, 0, 0, lumieraorg_dependencytest_one);
232 four_keeps_two = LUMIERA_INTERFACE_OPEN (lumieraorg_testexample_void, 0, 0, lumieraorg_dependencytest_two);
233 four_keeps_three = LUMIERA_INTERFACE_OPEN (lumieraorg_testexample_void, 0, 0, lumieraorg_dependencytest_three);
238 testrelease_four (LumieraInterface
self)
240 ECHO (
"Release four %s_%d_%s", self->interface, self->version, self->name);
248 LUMIERA_INTERFACE_DEFINE (lumieraorg_testexample_one, 0,
249 lumieraorg_first_test,
253 LUMIERA_INTERFACE_MAP (foo1,
255 LUMIERA_INTERFACE_MAP (bar1,
258 LUMIERA_INTERFACE_DEFINE (lumieraorg_testexample_two, 0,
259 lumieraorg_second_test,
263 LUMIERA_INTERFACE_MAP (foo2,
265 LUMIERA_INTERFACE_MAP (bar2,
268 LUMIERA_INTERFACE_DEFINE (lumieraorg_testexample_void, 0,
269 lumieraorg_dependencytest_one,
274 LUMIERA_INTERFACE_DEFINE (lumieraorg_testexample_void, 0,
275 lumieraorg_dependencytest_two,
280 LUMIERA_INTERFACE_DEFINE (lumieraorg_testexample_void, 0,
281 lumieraorg_dependencytest_three,
286 LUMIERA_INTERFACE_DEFINE (lumieraorg_testexample_void, 0,
287 lumieraorg_dependencytest_four,
301 lumiera_interfaceregistry_bulkregister_interfaces (lumiera_plugin_interfaces(), NULL);
306 LumieraInterface handle1 =
307 lumiera_interfaceregistry_interface_find (
"lumieraorg_testexample_one", 0,
"lumieraorg_first_test");
313 lumiera_interfaceregistry_interface_find ("lumieraorg_testexample_two", 0, "lumieraorg_second_test");
315 handle2->foo2 ("this is foo2");
318 lumiera_interfaceregistry_destroy ();
324 lumiera_interfaceregistry_bulkregister_interfaces (lumiera_plugin_interfaces(), NULL);
327 LUMIERA_INTERFACE_OPEN (lumieraorg_testexample_one, 0, 0, lumieraorg_first_test);
330 handle->bar1 ("this is bar1");
335 lumiera_interfaceregistry_destroy ();
338 TEST (dependencies_one)
344 LUMIERA_INTERFACE_OPEN (lumieraorg_testexample_void, 0, 0, lumieraorg_dependencytest_one);
347 ECHO ("Sucessfully opened");
352 lumiera_interfaceregistry_destroy ();
356 TEST (dependencies_two)
362 LUMIERA_INTERFACE_OPEN (lumieraorg_testexample_void, 0, 0, lumieraorg_dependencytest_two);
365 ECHO ("Sucessfully opened");
370 lumiera_interfaceregistry_destroy ();
373 TEST (dependencies_three)
379 LUMIERA_INTERFACE_OPEN (lumieraorg_testexample_void, 0, 0, lumieraorg_dependencytest_three);
382 ECHO ("Sucessfully opened");
387 lumiera_interfaceregistry_destroy ();
391 TEST (dependencies_four)
397 LUMIERA_INTERFACE_OPEN (lumieraorg_testexample_void, 0, 0, lumieraorg_dependencytest_four);
400 ECHO ("Sucessfully opened");
405 lumiera_interfaceregistry_destroy ();
410 TEST (dependencies_all)
417 LUMIERA_INTERFACE_OPEN (lumieraorg_testexample_void, 0, 0, lumieraorg_dependencytest_one);
422 LUMIERA_INTERFACE_OPEN (lumieraorg_testexample_void, 0, 0, lumieraorg_dependencytest_three);
423 CHECK (handle_three);
427 LUMIERA_INTERFACE_OPEN (lumieraorg_testexample_void, 0, 0, lumieraorg_dependencytest_two);
432 LUMIERA_INTERFACE_OPEN (lumieraorg_testexample_void, 0, 0, lumieraorg_dependencytest_four);
435 ECHO ("Sucessfully OPENED");
443 ECHO ("CLOSE three");
451 lumiera_interfaceregistry_destroy ();
455 TEST (plugin_discover)
470 lumiera_interfaceregistry_destroy ();
480 printf (
"plugin discovered before unload: %p\n", p);
481 CHECK (p,
"prerequisite: need to load test-c-plugin.lum");
485 printf (
"plugin discovered after unload: %p\n", p);
486 CHECK (!p,
"failed to unload plugin.");
488 lumiera_interfaceregistry_destroy ();
492 TEST (plugin_exampleplugin)
497 TODO (
"macro to derive minminor version from a slot");
500 LUMIERA_INTERFACE_OPEN (lumieraorg_testhello, 0, 0, lumieraorg_hello_german);
503 LUMIERA_INTERFACE_OPEN (lumieraorg_testhello, 0, 0, lumieraorg_hello_english);
506 german->goodbye ("Welt!");
509 english->goodbye ("World!");
511 LUMIERA_INTERFACE_CLOSE (german);
512 LUMIERA_INTERFACE_CLOSE (english);
514 lumiera_interfaceregistry_destroy ();
517 TEST (plugin_exampleplugin_nested)
521 lumiera_config_interface_init ();
524 LUMIERA_INTERFACE_OPEN (lumieraorg_testtest, 0, 0, lumieraorg_test_both);
528 LUMIERA_INTERFACE_CLOSE (
test);
530 lumiera_config_interface_destroy ();
531 lumiera_interfaceregistry_destroy ();
535 TEST (plugin_exampleplugin_cpp)
542 LUMIERA_INTERFACE_OPEN (lumieraorg_testhello, 0, 0, lumieraorg_hello_german_cpp);
545 LUMIERA_INTERFACE_OPEN (lumieraorg_testhello, 0, 0, lumieraorg_hello_english_cpp);
548 german->goodbye ("schnöde Welt!");
551 english->goodbye ("Vale of Tears!");
553 LUMIERA_INTERFACE_CLOSE (german);
554 LUMIERA_INTERFACE_CLOSE (english);
556 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)