2008-12-07 08:46:44 +01:00
|
|
|
|
/*
|
2017-02-22 01:58:49 +01:00
|
|
|
|
ExamplePlugin - example plugin for testing the interface/plugin system
|
2010-12-17 23:28:49 +01:00
|
|
|
|
|
Copyright: clarify and simplify the file headers
* Lumiera source code always was copyrighted by individual contributors
* there is no entity "Lumiera.org" which holds any copyrights
* Lumiera source code is provided under the GPL Version 2+
== Explanations ==
Lumiera as a whole is distributed under Copyleft, GNU General Public License Version 2 or above.
For this to become legally effective, the ''File COPYING in the root directory is sufficient.''
The licensing header in each file is not strictly necessary, yet considered good practice;
attaching a licence notice increases the likeliness that this information is retained
in case someone extracts individual code files. However, it is not by the presence of some
text, that legally binding licensing terms become effective; rather the fact matters that a
given piece of code was provably copyrighted and published under a license. Even reformatting
the code, renaming some variables or deleting parts of the code will not alter this legal
situation, but rather creates a derivative work, which is likewise covered by the GPL!
The most relevant information in the file header is the notice regarding the
time of the first individual copyright claim. By virtue of this initial copyright,
the first author is entitled to choose the terms of licensing. All further
modifications are permitted and covered by the License. The specific wording
or format of the copyright header is not legally relevant, as long as the
intention to publish under the GPL remains clear. The extended wording was
based on a recommendation by the FSF. It can be shortened, because the full terms
of the license are provided alongside the distribution, in the file COPYING.
2024-11-17 23:42:55 +01:00
|
|
|
|
Copyright (C)
|
|
|
|
|
|
2008, Christian Thaeter <ct@pipapo.org>
|
2010-12-17 23:28:49 +01:00
|
|
|
|
|
Copyright: clarify and simplify the file headers
* Lumiera source code always was copyrighted by individual contributors
* there is no entity "Lumiera.org" which holds any copyrights
* Lumiera source code is provided under the GPL Version 2+
== Explanations ==
Lumiera as a whole is distributed under Copyleft, GNU General Public License Version 2 or above.
For this to become legally effective, the ''File COPYING in the root directory is sufficient.''
The licensing header in each file is not strictly necessary, yet considered good practice;
attaching a licence notice increases the likeliness that this information is retained
in case someone extracts individual code files. However, it is not by the presence of some
text, that legally binding licensing terms become effective; rather the fact matters that a
given piece of code was provably copyrighted and published under a license. Even reformatting
the code, renaming some variables or deleting parts of the code will not alter this legal
situation, but rather creates a derivative work, which is likewise covered by the GPL!
The most relevant information in the file header is the notice regarding the
time of the first individual copyright claim. By virtue of this initial copyright,
the first author is entitled to choose the terms of licensing. All further
modifications are permitted and covered by the License. The specific wording
or format of the copyright header is not legally relevant, as long as the
intention to publish under the GPL remains clear. The extended wording was
based on a recommendation by the FSF. It can be shortened, because the full terms
of the license are provided alongside the distribution, in the file COPYING.
2024-11-17 23:42:55 +01:00
|
|
|
|
**Lumiera** 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. See the file COPYING for further details.
|
2010-12-17 23:28:49 +01:00
|
|
|
|
|
Copyright: clarify and simplify the file headers
* Lumiera source code always was copyrighted by individual contributors
* there is no entity "Lumiera.org" which holds any copyrights
* Lumiera source code is provided under the GPL Version 2+
== Explanations ==
Lumiera as a whole is distributed under Copyleft, GNU General Public License Version 2 or above.
For this to become legally effective, the ''File COPYING in the root directory is sufficient.''
The licensing header in each file is not strictly necessary, yet considered good practice;
attaching a licence notice increases the likeliness that this information is retained
in case someone extracts individual code files. However, it is not by the presence of some
text, that legally binding licensing terms become effective; rather the fact matters that a
given piece of code was provably copyrighted and published under a license. Even reformatting
the code, renaming some variables or deleting parts of the code will not alter this legal
situation, but rather creates a derivative work, which is likewise covered by the GPL!
The most relevant information in the file header is the notice regarding the
time of the first individual copyright claim. By virtue of this initial copyright,
the first author is entitled to choose the terms of licensing. All further
modifications are permitted and covered by the License. The specific wording
or format of the copyright header is not legally relevant, as long as the
intention to publish under the GPL remains clear. The extended wording was
based on a recommendation by the FSF. It can be shortened, because the full terms
of the license are provided alongside the distribution, in the file COPYING.
2024-11-17 23:42:55 +01:00
|
|
|
|
* *****************************************************************/
|
2008-12-07 08:46:44 +01:00
|
|
|
|
|
2017-02-22 01:58:49 +01:00
|
|
|
|
/** @file example-plugin.c
|
|
|
|
|
|
** Dummy C plug-in to cover the plugin loader for unit test
|
|
|
|
|
|
** This file defines a Lumiera plug-in written in plain C,
|
|
|
|
|
|
** implementing the `lumieraorg_testhello` interface
|
|
|
|
|
|
** @see test-interfaces.c
|
2016-11-03 18:26:43 +01:00
|
|
|
|
*/
|
|
|
|
|
|
|
2008-12-07 08:46:44 +01:00
|
|
|
|
|
2007-07-18 00:10:02 +02:00
|
|
|
|
#include <stdio.h>
|
|
|
|
|
|
|
2014-10-15 19:45:12 +02:00
|
|
|
|
#include "common/interface-descriptor.h"
|
|
|
|
|
|
#include "common/config-interface.h"
|
2007-07-18 00:10:02 +02:00
|
|
|
|
|
2017-02-22 01:58:49 +01:00
|
|
|
|
#include "interface/say-hello.h"
|
2008-11-26 05:19:59 +01:00
|
|
|
|
|
|
|
|
|
|
|
2008-11-07 03:59:43 +01:00
|
|
|
|
LUMIERA_PLUGIN_INTERFACEHANDLE;
|
|
|
|
|
|
|
|
|
|
|
|
LumieraInterface
|
|
|
|
|
|
myopen (LumieraInterface self, LumieraInterface interfaces)
|
2007-07-18 00:10:02 +02:00
|
|
|
|
{
|
2008-11-07 03:59:43 +01:00
|
|
|
|
LUMIERA_PLUGIN_STORE_INTERFACEHANDLE (interfaces);
|
|
|
|
|
|
|
|
|
|
|
|
fprintf (stderr, "opened %p global interfaces %p\n", self, interfaces);
|
|
|
|
|
|
return self;
|
2007-07-18 00:10:02 +02:00
|
|
|
|
}
|
|
|
|
|
|
|
2008-11-07 03:59:43 +01:00
|
|
|
|
void
|
|
|
|
|
|
myclose (LumieraInterface self)
|
2007-07-18 00:10:02 +02:00
|
|
|
|
{
|
2008-11-07 03:59:43 +01:00
|
|
|
|
fprintf (stderr, "closed %p\n", self);
|
2007-07-18 00:10:02 +02:00
|
|
|
|
}
|
|
|
|
|
|
|
2008-11-07 03:59:43 +01:00
|
|
|
|
void hallo (void)
|
2007-07-18 00:10:02 +02:00
|
|
|
|
{
|
2008-11-07 03:59:43 +01:00
|
|
|
|
printf ("Hallo Welt!\n");
|
2007-07-18 00:10:02 +02:00
|
|
|
|
}
|
|
|
|
|
|
|
2008-11-07 03:59:43 +01:00
|
|
|
|
void tschuess (const char* m)
|
2007-07-18 00:10:02 +02:00
|
|
|
|
{
|
2008-11-07 03:59:43 +01:00
|
|
|
|
printf ("Tschuess %s\n", m);
|
2007-07-18 00:10:02 +02:00
|
|
|
|
}
|
|
|
|
|
|
|
2008-11-07 03:59:43 +01:00
|
|
|
|
void hello (void)
|
2007-07-18 00:10:02 +02:00
|
|
|
|
{
|
2008-11-07 03:59:43 +01:00
|
|
|
|
printf ("Hello World!\n");
|
2007-07-18 00:10:02 +02:00
|
|
|
|
}
|
|
|
|
|
|
|
2008-11-07 03:59:43 +01:00
|
|
|
|
void bye (const char* m)
|
2007-07-18 00:10:02 +02:00
|
|
|
|
{
|
2008-11-07 03:59:43 +01:00
|
|
|
|
printf ("Bye %s\n", m);
|
2007-07-18 00:10:02 +02:00
|
|
|
|
}
|
|
|
|
|
|
|
2008-04-09 00:27:21 +02:00
|
|
|
|
|
2008-11-07 03:59:43 +01:00
|
|
|
|
void yeahbabe (void)
|
|
|
|
|
|
{
|
|
|
|
|
|
LUMIERA_INTERFACE_HANDLE (lumieraorg_testhello, 0) german =
|
|
|
|
|
|
LUMIERA_INTERFACE_OPEN (lumieraorg_testhello, 0, 0, lumieraorg_hello_german);
|
|
|
|
|
|
|
|
|
|
|
|
LUMIERA_INTERFACE_HANDLE (lumieraorg_testhello, 0) english =
|
|
|
|
|
|
LUMIERA_INTERFACE_OPEN (lumieraorg_testhello, 0, 0, lumieraorg_hello_english);
|
|
|
|
|
|
|
2008-11-07 08:51:05 +01:00
|
|
|
|
LUMIERA_INTERFACE_HANDLE (lumieraorg_configuration, 0) config =
|
|
|
|
|
|
LUMIERA_INTERFACE_OPEN (lumieraorg_configuration, 0, 0, lumieraorg_configuration);
|
|
|
|
|
|
|
|
|
|
|
|
const char* path;
|
|
|
|
|
|
if (config->wordlist_get ("config.path", &path))
|
|
|
|
|
|
printf ("config path is: %s\n", path);
|
|
|
|
|
|
if (config->wordlist_get ("plugin.path", &path))
|
|
|
|
|
|
printf ("plugin path is: %s\n", path);
|
|
|
|
|
|
|
|
|
|
|
|
LUMIERA_INTERFACE_CLOSE (config);
|
|
|
|
|
|
|
2008-11-07 03:59:43 +01:00
|
|
|
|
german->hello ();
|
|
|
|
|
|
english->hello ();
|
|
|
|
|
|
english->goodbye ("World!");
|
|
|
|
|
|
german->goodbye ("Welt!");
|
|
|
|
|
|
|
|
|
|
|
|
LUMIERA_INTERFACE_CLOSE (german);
|
|
|
|
|
|
LUMIERA_INTERFACE_CLOSE (english);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2008-10-26 22:04:58 +01:00
|
|
|
|
LUMIERA_INTERFACE_INSTANCE (lumieraorg_interfacedescriptor, 0,
|
|
|
|
|
|
lumieraorg_exampleplugin_descriptor,
|
|
|
|
|
|
NULL, NULL, NULL,
|
2014-03-16 02:21:07 +01:00
|
|
|
|
LUMIERA_INTERFACE_INLINE (name,
|
2008-10-26 22:04:58 +01:00
|
|
|
|
const char*, (LumieraInterface iface),
|
2017-04-01 23:59:37 +02:00
|
|
|
|
{(void)iface; return "LumieraTest";}
|
2008-10-26 22:04:58 +01:00
|
|
|
|
),
|
2014-03-16 02:21:07 +01:00
|
|
|
|
LUMIERA_INTERFACE_INLINE (brief,
|
2008-10-26 22:04:58 +01:00
|
|
|
|
const char*, (LumieraInterface iface),
|
2017-04-01 23:59:37 +02:00
|
|
|
|
{(void)iface; return "Lumiera Test suite examples";}
|
2008-10-26 22:04:58 +01:00
|
|
|
|
),
|
2014-03-16 02:21:07 +01:00
|
|
|
|
LUMIERA_INTERFACE_INLINE (homepage,
|
2008-10-26 22:04:58 +01:00
|
|
|
|
const char*, (LumieraInterface iface),
|
2017-04-01 23:59:37 +02:00
|
|
|
|
{(void)iface; return "http://www.lumiera.org/develompent.html";}
|
2008-10-26 22:04:58 +01:00
|
|
|
|
),
|
2014-03-16 02:21:07 +01:00
|
|
|
|
LUMIERA_INTERFACE_INLINE (version,
|
2008-10-26 22:04:58 +01:00
|
|
|
|
const char*, (LumieraInterface iface),
|
2017-04-01 23:59:37 +02:00
|
|
|
|
{(void)iface; return "No Version";}
|
2008-10-26 22:04:58 +01:00
|
|
|
|
),
|
2014-03-16 02:21:07 +01:00
|
|
|
|
LUMIERA_INTERFACE_INLINE (author,
|
2008-10-26 22:04:58 +01:00
|
|
|
|
const char*, (LumieraInterface iface),
|
2017-04-01 23:59:37 +02:00
|
|
|
|
{(void)iface; return "Christian Thaeter";}
|
2008-10-26 22:04:58 +01:00
|
|
|
|
),
|
2014-03-16 02:21:07 +01:00
|
|
|
|
LUMIERA_INTERFACE_INLINE (email,
|
2008-10-26 22:04:58 +01:00
|
|
|
|
const char*, (LumieraInterface iface),
|
2017-04-01 23:59:37 +02:00
|
|
|
|
{(void)iface; return "ct@pipapo.org";}
|
2008-10-26 22:04:58 +01:00
|
|
|
|
),
|
2014-03-16 02:21:07 +01:00
|
|
|
|
LUMIERA_INTERFACE_INLINE (copyright,
|
2008-10-26 22:04:58 +01:00
|
|
|
|
const char*, (LumieraInterface iface),
|
|
|
|
|
|
{
|
2017-04-01 23:59:37 +02:00
|
|
|
|
(void)iface;
|
2008-10-26 22:04:58 +01:00
|
|
|
|
return
|
Copyright: clarify and simplify the file headers
* Lumiera source code always was copyrighted by individual contributors
* there is no entity "Lumiera.org" which holds any copyrights
* Lumiera source code is provided under the GPL Version 2+
== Explanations ==
Lumiera as a whole is distributed under Copyleft, GNU General Public License Version 2 or above.
For this to become legally effective, the ''File COPYING in the root directory is sufficient.''
The licensing header in each file is not strictly necessary, yet considered good practice;
attaching a licence notice increases the likeliness that this information is retained
in case someone extracts individual code files. However, it is not by the presence of some
text, that legally binding licensing terms become effective; rather the fact matters that a
given piece of code was provably copyrighted and published under a license. Even reformatting
the code, renaming some variables or deleting parts of the code will not alter this legal
situation, but rather creates a derivative work, which is likewise covered by the GPL!
The most relevant information in the file header is the notice regarding the
time of the first individual copyright claim. By virtue of this initial copyright,
the first author is entitled to choose the terms of licensing. All further
modifications are permitted and covered by the License. The specific wording
or format of the copyright header is not legally relevant, as long as the
intention to publish under the GPL remains clear. The extended wording was
based on a recommendation by the FSF. It can be shortened, because the full terms
of the license are provided alongside the distribution, in the file COPYING.
2024-11-17 23:42:55 +01:00
|
|
|
|
"Copyright (C)\n"
|
|
|
|
|
|
" 2008, Christian Thaeter <ct@pipapo.org>";
|
2008-10-26 22:04:58 +01:00
|
|
|
|
}
|
|
|
|
|
|
),
|
2014-03-16 02:21:07 +01:00
|
|
|
|
LUMIERA_INTERFACE_INLINE (license,
|
2008-10-26 22:04:58 +01:00
|
|
|
|
const char*, (LumieraInterface iface),
|
|
|
|
|
|
{
|
2025-06-07 23:59:57 +02:00
|
|
|
|
(void)iface;
|
2008-10-26 22:04:58 +01:00
|
|
|
|
return
|
Copyright: clarify and simplify the file headers
* Lumiera source code always was copyrighted by individual contributors
* there is no entity "Lumiera.org" which holds any copyrights
* Lumiera source code is provided under the GPL Version 2+
== Explanations ==
Lumiera as a whole is distributed under Copyleft, GNU General Public License Version 2 or above.
For this to become legally effective, the ''File COPYING in the root directory is sufficient.''
The licensing header in each file is not strictly necessary, yet considered good practice;
attaching a licence notice increases the likeliness that this information is retained
in case someone extracts individual code files. However, it is not by the presence of some
text, that legally binding licensing terms become effective; rather the fact matters that a
given piece of code was provably copyrighted and published under a license. Even reformatting
the code, renaming some variables or deleting parts of the code will not alter this legal
situation, but rather creates a derivative work, which is likewise covered by the GPL!
The most relevant information in the file header is the notice regarding the
time of the first individual copyright claim. By virtue of this initial copyright,
the first author is entitled to choose the terms of licensing. All further
modifications are permitted and covered by the License. The specific wording
or format of the copyright header is not legally relevant, as long as the
intention to publish under the GPL remains clear. The extended wording was
based on a recommendation by the FSF. It can be shortened, because the full terms
of the license are provided alongside the distribution, in the file COPYING.
2024-11-17 23:42:55 +01:00
|
|
|
|
"**Lumiera** is free software; you can redistribute it and/or modify it\n"
|
|
|
|
|
|
"under the terms of the GNU General Public License as published by the\n"
|
|
|
|
|
|
"Free Software Foundation; either version 2 of the License, or (at your\n"
|
|
|
|
|
|
"option) any later version. See the file COPYING for further details."
|
|
|
|
|
|
;
|
2008-10-26 22:04:58 +01:00
|
|
|
|
}
|
|
|
|
|
|
),
|
|
|
|
|
|
|
2014-03-16 02:21:07 +01:00
|
|
|
|
LUMIERA_INTERFACE_INLINE (state,
|
2008-10-26 22:04:58 +01:00
|
|
|
|
int, (LumieraInterface iface),
|
2017-04-01 23:59:37 +02:00
|
|
|
|
{(void)iface; return LUMIERA_INTERFACE_EXPERIMENTAL;}
|
2008-10-26 22:04:58 +01:00
|
|
|
|
),
|
|
|
|
|
|
|
2014-03-16 02:21:07 +01:00
|
|
|
|
LUMIERA_INTERFACE_INLINE (versioncmp,
|
2008-10-26 22:04:58 +01:00
|
|
|
|
int, (const char* a, const char* b),
|
2017-04-01 23:59:37 +02:00
|
|
|
|
{(void)a;(void)b; return 0;}
|
2008-10-26 22:04:58 +01:00
|
|
|
|
)
|
2008-04-09 00:27:21 +02:00
|
|
|
|
);
|
2008-10-26 22:04:58 +01:00
|
|
|
|
|
|
|
|
|
|
|
2008-11-06 05:23:47 +01:00
|
|
|
|
LUMIERA_EXPORT(
|
|
|
|
|
|
LUMIERA_INTERFACE_DEFINE (lumieraorg_testhello, 0,
|
|
|
|
|
|
lumieraorg_hello_german,
|
|
|
|
|
|
LUMIERA_INTERFACE_REF (lumieraorg_interfacedescriptor, 0, lumieraorg_exampleplugin_descriptor),
|
2008-11-07 03:59:43 +01:00
|
|
|
|
myopen,
|
|
|
|
|
|
myclose,
|
2014-03-16 02:21:07 +01:00
|
|
|
|
LUMIERA_INTERFACE_MAP (hello,
|
2008-11-06 05:23:47 +01:00
|
|
|
|
hallo),
|
2014-03-16 02:21:07 +01:00
|
|
|
|
LUMIERA_INTERFACE_MAP (goodbye,
|
2008-11-06 05:23:47 +01:00
|
|
|
|
tschuess)
|
|
|
|
|
|
),
|
|
|
|
|
|
LUMIERA_INTERFACE_DEFINE (lumieraorg_testhello, 0,
|
|
|
|
|
|
lumieraorg_hello_english,
|
|
|
|
|
|
LUMIERA_INTERFACE_REF (lumieraorg_interfacedescriptor, 0, lumieraorg_exampleplugin_descriptor),
|
2008-11-07 03:59:43 +01:00
|
|
|
|
myopen,
|
|
|
|
|
|
myclose,
|
2014-03-16 02:21:07 +01:00
|
|
|
|
LUMIERA_INTERFACE_MAP (hello,
|
2008-11-06 05:23:47 +01:00
|
|
|
|
hello),
|
2014-03-16 02:21:07 +01:00
|
|
|
|
LUMIERA_INTERFACE_MAP (goodbye,
|
2008-11-06 05:23:47 +01:00
|
|
|
|
bye)
|
2008-11-07 03:59:43 +01:00
|
|
|
|
),
|
|
|
|
|
|
LUMIERA_INTERFACE_DEFINE (lumieraorg_testtest, 0,
|
|
|
|
|
|
lumieraorg_test_both,
|
|
|
|
|
|
LUMIERA_INTERFACE_REF (lumieraorg_interfacedescriptor, 0, lumieraorg_exampleplugin_descriptor),
|
|
|
|
|
|
myopen,
|
|
|
|
|
|
myclose,
|
2014-03-16 02:21:07 +01:00
|
|
|
|
LUMIERA_INTERFACE_MAP (testit,
|
2008-11-07 03:59:43 +01:00
|
|
|
|
yeahbabe)
|
2008-11-06 05:23:47 +01:00
|
|
|
|
)
|
|
|
|
|
|
)
|