Lumiera 0.pre.04~rc.1
»edit your freedom«
Loading...
Searching...
No Matches
example-plugin.c
Go to the documentation of this file.
1/*
2 ExamplePlugin - example plugin for testing the interface/plugin system
3
4 Copyright (C)
5 2008, Christian Thaeter <ct@pipapo.org>
6
7  **Lumiera** is free software; you can redistribute it and/or modify it
8  under the terms of the GNU General Public License as published by the
9  Free Software Foundation; either version 2 of the License, or (at your
10  option) any later version. See the file COPYING for further details.
11
12* *****************************************************************/
13
22#include <stdio.h>
23
26
27#include "interface/say-hello.h"
28
29
31
34{
36
37 fprintf (stderr, "opened %p global interfaces %p\n", self, interfaces);
38 return self;
39}
40
41void
43{
44 fprintf (stderr, "closed %p\n", self);
45}
46
47void hallo (void)
48{
49 printf ("Hallo Welt!\n");
50}
51
52void tschuess (const char* m)
53{
54 printf ("Tschuess %s\n", m);
55}
56
57void hello (void)
58{
59 printf ("Hello World!\n");
60}
61
62void bye (const char* m)
63{
64 printf ("Bye %s\n", m);
65}
66
67
68void yeahbabe (void)
69{
70 LUMIERA_INTERFACE_HANDLE (lumieraorg_testhello, 0) german =
71 LUMIERA_INTERFACE_OPEN (lumieraorg_testhello, 0, 0, lumieraorg_hello_german);
72
73 LUMIERA_INTERFACE_HANDLE (lumieraorg_testhello, 0) english =
74 LUMIERA_INTERFACE_OPEN (lumieraorg_testhello, 0, 0, lumieraorg_hello_english);
75
76 LUMIERA_INTERFACE_HANDLE (lumieraorg_configuration, 0) config =
77 LUMIERA_INTERFACE_OPEN (lumieraorg_configuration, 0, 0, lumieraorg_configuration);
78
79 const char* path;
80 if (config->wordlist_get ("config.path", &path))
81 printf ("config path is: %s\n", path);
82 if (config->wordlist_get ("plugin.path", &path))
83 printf ("plugin path is: %s\n", path);
84
86
87 german->hello ();
88 english->hello ();
89 english->goodbye ("World!");
90 german->goodbye ("Welt!");
91
94}
95
96
97
98LUMIERA_INTERFACE_INSTANCE (lumieraorg_interfacedescriptor, 0,
99 lumieraorg_exampleplugin_descriptor,
100 NULL, NULL, NULL,
101 LUMIERA_INTERFACE_INLINE (name,
102 const char*, (LumieraInterface iface),
103 {(void)iface; return "LumieraTest";}
104 ),
105 LUMIERA_INTERFACE_INLINE (brief,
106 const char*, (LumieraInterface iface),
107 {(void)iface; return "Lumiera Test suite examples";}
108 ),
109 LUMIERA_INTERFACE_INLINE (homepage,
110 const char*, (LumieraInterface iface),
111 {(void)iface; return "http://www.lumiera.org/develompent.html";}
112 ),
113 LUMIERA_INTERFACE_INLINE (version,
114 const char*, (LumieraInterface iface),
115 {(void)iface; return "No Version";}
116 ),
117 LUMIERA_INTERFACE_INLINE (author,
118 const char*, (LumieraInterface iface),
119 {(void)iface; return "Christian Thaeter";}
120 ),
121 LUMIERA_INTERFACE_INLINE (email,
122 const char*, (LumieraInterface iface),
123 {(void)iface; return "ct@pipapo.org";}
124 ),
125 LUMIERA_INTERFACE_INLINE (copyright,
126 const char*, (LumieraInterface iface),
127 {
128 (void)iface;
129 return
130 "Copyright (C)\n"
131 " 2008, Christian Thaeter <ct@pipapo.org>";
132 }
133 ),
134 LUMIERA_INTERFACE_INLINE (license,
135 const char*, (LumieraInterface iface),
136 {
137 (void)iface;
138 return
139 "**Lumiera** is free software; you can redistribute it and/or modify it\n"
140 "under the terms of the GNU General Public License as published by the\n"
141 "Free Software Foundation; either version 2 of the License, or (at your\n"
142 "option) any later version. See the file COPYING for further details."
143 ;
144 }
145 ),
146
147 LUMIERA_INTERFACE_INLINE (state,
148 int, (LumieraInterface iface),
149 {(void)iface; return LUMIERA_INTERFACE_EXPERIMENTAL;}
150 ),
151
152 LUMIERA_INTERFACE_INLINE (versioncmp,
153 int, (const char* a, const char* b),
154 {(void)a;(void)b; return 0;}
155 )
156 );
157
158
160 LUMIERA_INTERFACE_DEFINE (lumieraorg_testhello, 0,
161 lumieraorg_hello_german,
162 LUMIERA_INTERFACE_REF (lumieraorg_interfacedescriptor, 0, lumieraorg_exampleplugin_descriptor),
163 myopen,
164 myclose,
165 LUMIERA_INTERFACE_MAP (hello,
166 hallo),
167 LUMIERA_INTERFACE_MAP (goodbye,
168 tschuess)
169 ),
170 LUMIERA_INTERFACE_DEFINE (lumieraorg_testhello, 0,
171 lumieraorg_hello_english,
172 LUMIERA_INTERFACE_REF (lumieraorg_interfacedescriptor, 0, lumieraorg_exampleplugin_descriptor),
173 myopen,
174 myclose,
175 LUMIERA_INTERFACE_MAP (hello,
176 hello),
177 LUMIERA_INTERFACE_MAP (goodbye,
178 bye)
179 ),
180 LUMIERA_INTERFACE_DEFINE (lumieraorg_testtest, 0,
181 lumieraorg_test_both,
182 LUMIERA_INTERFACE_REF (lumieraorg_interfacedescriptor, 0, lumieraorg_exampleplugin_descriptor),
183 myopen,
184 myclose,
185 LUMIERA_INTERFACE_MAP (testit,
186 yeahbabe)
187 )
188 )
External interface to the lumiera configuration system.
void tschuess(const char *m)
void myclose(LumieraInterface self)
void yeahbabe(void)
void hallo(void)
void bye(const char *m)
LUMIERA_PLUGIN_INTERFACEHANDLE
void hello(void)
LumieraInterface myopen(LumieraInterface self, LumieraInterface interfaces)
A data record to describe interface, interface instances and plug-in instances.
@ LUMIERA_INTERFACE_EXPERIMENTAL
Not finished development code.
#define LUMIERA_INTERFACE_REF(iname, version, dname)
Return a reference (pointer) to an interface implementation.
Definition interface.h:119
#define LUMIERA_PLUGIN_STORE_INTERFACEHANDLE(name)
Definition interface.h:317
#define LUMIERA_EXPORT(...)
Generate interface container suitable for enumerating interfaces.
Definition interface.h:273
#define LUMIERA_INTERFACE_INSTANCE(iname, version, name, descriptor, acquire, release,...)
Define an interface instance.
Definition interface.h:185
#define LUMIERA_INTERFACE_CLOSE(handle)
Definition interface.h:336
#define LUMIERA_INTERFACE_OPEN(interface, version, minminor, name)
Definition interface.h:333
lumiera_interface * LumieraInterface
Definition interface.h:355
#define LUMIERA_INTERFACE_HANDLE(interface, version)
create a handle for a interface (WIP)
Definition interface.h:347
return NULL
Definition llist.h:586
A mock interface to support testing of the interface system.