Lumiera  0.pre.03
»edit your freedom«
plugin.h
Go to the documentation of this file.
1 /*
2  PLUGIN.h - Plugin loader
3 
4  Copyright (C) Lumiera.org
5  2008, Christian Thaeter <ct@pipapo.org>
6 
7  This program is free software; you can redistribute it and/or
8  modify it under the terms of the GNU General Public License as
9  published by the Free Software Foundation; either version 2 of
10  the License, or (at your option) any later version.
11 
12  This program is distributed in the hope that it will be useful,
13  but WITHOUT ANY WARRANTY; without even the implied warranty of
14  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15  GNU General Public License for more details.
16 
17  You should have received a copy of the GNU General Public License
18  along with this program; if not, write to the Free Software
19  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
20 
21 */
22 
23 
50 #ifndef COMMON_PLUGIN_H
51 #define COMMON_PLUGIN_H
52 
53 #include "lib/psplay.h"
54 #include "lib/error.h"
55 
56 #include "common/interface.h"
57 
58 #include <stdlib.h>
59 #include <nobug.h>
60 
61 
62 LUMIERA_ERROR_DECLARE(PLUGIN_INIT);
63 LUMIERA_ERROR_DECLARE(PLUGIN_OPEN);
64 LUMIERA_ERROR_DECLARE(PLUGIN_WTF);
65 LUMIERA_ERROR_DECLARE(PLUGIN_REGISTER);
66 LUMIERA_ERROR_DECLARE(PLUGIN_VERSION);
67 
68 
69 
70 
72 typedef struct lumiera_plugin_struct lumiera_plugin;
73 typedef lumiera_plugin* LumieraPlugin;
74 
75 
82 LumieraPlugin
83 lumiera_plugin_new (const char* name);
84 
93 LumieraPlugin
94 lumiera_plugin_init (LumieraPlugin self, void* handle, LumieraInterface plugin);
95 
96 
104 LumieraPlugin
105 lumiera_plugin_load (const char* plugin);
106 
107 
117 int
118 lumiera_plugin_register (LumieraPlugin self);
119 
120 
126 lumiera_err
127 lumiera_plugin_error (LumieraPlugin self);
128 
134 void*
135 lumiera_plugin_handle (LumieraPlugin self);
136 
137 
144 const char*
145 lumiera_plugin_name (LumieraPlugin self);
146 
147 
152 void
153 lumiera_plugin_refinc (LumieraPlugin self);
154 
155 
160 void
161 lumiera_plugin_refdec (LumieraPlugin self);
162 
163 
170 unsigned
171 lumiera_plugin_unload (LumieraPlugin self);
172 
173 
179 LumieraPlugin
180 lumiera_plugin_lookup (const char* name);
181 
182 
189 int
190 lumiera_plugin_discover (LumieraPlugin (*callback_load)(const char* plugin),
191  int (*callback_register) (LumieraPlugin));
192 
193 
194 /* === psplay support functions === */
195 
196 int
197 lumiera_plugin_cmp_fn (const void* keya, const void* keyb);
198 
199 const void*
200 lumiera_plugin_key_fn (const PSplaynode node);
201 
202 void
203 lumiera_plugin_delete_fn (PSplaynode node);
204 
205 
206 
207 #endif /*COMMON_PLUGIN_H*/
unsigned lumiera_plugin_unload(LumieraPlugin self)
Tries to unload a plugin.
Definition: plugin.c:306
int lumiera_plugin_register(LumieraPlugin self)
Register a plugin and its interfaces.
Definition: plugin.c:269
void * lumiera_plugin_handle(LumieraPlugin self)
Query the plugin handle.
Definition: plugin.c:166
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...
Definition: plugin.c:196
void lumiera_plugin_refdec(LumieraPlugin self)
Definition: plugin.c:188
void lumiera_plugin_refinc(LumieraPlugin self)
Definition: plugin.c:181
LumieraPlugin lumiera_plugin_lookup(const char *name)
Lookup a plugin handle in the pluginregistry.
Definition: plugin.c:347
lumiera_err lumiera_plugin_error(LumieraPlugin self)
Query the error state of a plugin.
Definition: plugin.c:158
#define LUMIERA_ERROR_DECLARE(err)
Forward declare an error constant.
Definition: error.h:71
Lumiera error handling (C interface).
Lumiera interface macros and structures.
Probabilistic splay tree.
LumieraPlugin lumiera_plugin_new(const char *name)
Allocates an preinitialises a plugin structure.
Definition: plugin.c:132
const char * lumiera_plugin_name(LumieraPlugin self)
Query the plugin name The name is the path and filename under which it was loaded.
Definition: plugin.c:174
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...
Definition: plugin.c:250
ElementBoxWidget::Config::Qualifier name(string id)
define the name-ID displayed in the caption
LumieraPlugin lumiera_plugin_init(LumieraPlugin self, void *handle, LumieraInterface plugin)
Definition: plugin.c:148