1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
|
/*
* Copyright (C) 2001 Alan Robertson <alanr@unix.sh>
* This software licensed under the GNU LGPL.
*
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
*/
/*
* Sample Interface manager.
*/
#define PIL_PLUGINTYPE test
#define PIL_PLUGINTYPENAME "test"
#define PIL_PLUGIN test
#define PIL_PLUGINNAME "test"
#define PIL_PLUGINLICENSE LICENSE_LGPL
#define PIL_PLUGINLICENSEURL URL_LGPL
/* We are a interface manager... */
#define ENABLE_PLUGIN_MANAGER_PRIVATE
#include <pils/interface.h>
PIL_PLUGIN_BOILERPLATE("1.0", DebugFlag, Ourclose)
/*
* Places to store information gotten during registration.
*/
static const PILPluginImports* OurPIImports; /* Imported plugin funs */
static PILPlugin* OurPlugin; /* Our plugin info */
static PILInterfaceImports* OurIfImports; /* Interface imported funs */
static PILInterface* OurIf; /* Pointer to interface info */
static void
Ourclose (PILPlugin* us)
{
}
/*
* Our Interface Manager interfaces - exported to the universe!
*
* (or at least the interface management universe ;-).
*
*/
static PILInterfaceOps OurIfOps = {
/* FIXME -- put some in here !! */
};
PIL_rc PIL_PLUGIN_INIT(PILPlugin*us, PILPluginImports* imports, void*);
static PIL_rc
IfClose(PILInterface*intf, void* ud_interface)
{
OurPIImports->log(PIL_INFO, "In Ifclose (test plugin)");
return PIL_OK;
}
PIL_rc
PIL_PLUGIN_INIT(PILPlugin*us, PILPluginImports* imports, void *user_ptr)
{
PIL_rc ret;
/*
* Force compiler to check our parameters...
*/
PILPluginInitFun fun = &PIL_PLUGIN_INIT; (void)fun;
OurPIImports = imports;
OurPlugin = us;
imports->log(PIL_INFO, "Plugin %s: user_ptr = %lx"
, PIL_PLUGINNAME, (unsigned long)user_ptr);
imports->log(PIL_INFO, "Registering ourselves as a plugin");
/* Register as a plugin */
imports->register_plugin(us, &OurPIExports);
imports->log(PIL_INFO, "Registering our interfaces");
/* Register our interfaces */
ret = imports->register_interface
( us
, PIL_PLUGINTYPENAME
, PIL_PLUGINNAME
, &OurIfOps /* Exported interface operations */
, IfClose /* Interface Close function */
, &OurIf
, (void*)&OurIfImports
, NULL);
imports->log(PIL_INFO, "test init function: returning %d"
, ret);
return ret;
}
|