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