Main Page | Data Structures | File List | Data Fields | Globals

plugins.c File Reference

#include "plugins.h"

Functions

void plugins_scan_dir (char *directory)
void plugins_unload (void)
void plugins_reload (void)
void plugins_free (void)
void plugins_configs_add_all (IOpts *opts)
void plugins_configs_default_all (void)
void plugins_dump_all (void)
PluginTypeplugin_type_select (char *type_name)
int plugin_type_register (char *type_name, char *type_desc, char *info_func_name)
void plugin_type_unregister (char *type_name)
void plugin_type_free (PluginType *pt)
void plugin_type_dump (PluginType *pt)
void plugin_type_list_dump (void)
Llistplugin_list_get (char *type_name)
char ** plugin_list_names_get (char *type_name)
void plugin_list_dump (char *type_name)
Pluginplugin_select (char *type_name, char *plugin_name)
void plugin_configs_init (Plugin *plugin)
void plugin_configs_free (Plugin *plugin)
void plugin_configs_add (Plugin *plugin, IOpts *opts)
void plugin_configs_default (Plugin *plugin)
void plugin_configs_dump (PluginConfig *pc, int numofconfig)
void plugin_dump (Plugin *plugin)
void * plugin_config_data_get (int numofconfs, PluginConfig *pc, char *name)

Detailed Description

A gerneral purpose plugin loaded/handeler.

This is still in the begining stages and will still mature some. Though currently it is quite stable and flexable. If you find this useful but would like some more options just ask me <magister AT kfa.cx>.

I suggest looking at the plugins example provided with cuf inorder to better understand how to impliment this in your own program.


Function Documentation

void* plugin_config_data_get int  numofconfs,
PluginConfig pc,
char *  name
 

Parameters:
numofconfs The number of configurations.
pc The plugin's configuration array.
name The configuration's name.
Return values:
void * Of the requested configuration data.
NULL When the configuration name was not found or a parameter was NULL.
Description:
Retrives the data from a plugin's configuration by name.

void plugin_configs_add Plugin plugin,
IOpts opts
 

Parameters:
plugin The plugin to modify.
opts The IOpts list to append to.
Description:
Appends all the cofiguration options to a #IOps list for use in loading and saveing configuration files.

The format of the search string is: plugin_<plugin_name>_<plugin_config_name>

void plugin_configs_default Plugin plugin  ) 
 

Parameters:
plugin The plugin to modify.
Description:
Sets the default configuration data for the supplied plugin. Its best to call this function just after all the plugins are loaded and befor you attempt to load a configuration file.
Note:
Before this function is called you must call plugin_configs_init().

void plugin_configs_dump PluginConfig pc,
int  numofconfig
 

Description:
Prints the plugins's configuration information.

void plugin_configs_free Plugin plugin  ) 
 

Parameters:
plugin The plugin to modify.
Description:
Frees all the data pointers for the plugins configuration.

void plugin_configs_init Plugin plugin  ) 
 

Parameters:
plugin The plugin to modify.
Description:
Initalizes all the data pointers for the plugins configuration. This function is called automaticly when the plugin is loaded.

void plugin_dump Plugin plugin  ) 
 

Parameters:
plugin The plugin to print.
Description:
Prints member information about the supplied plugin.

void plugin_list_dump char *  type_name  ) 
 

Parameters:
type_name The plugin type's name.
Description:
Prints member information for every plugin loaded for the specified plugin type's name.
Note:
This is only useful for debugging.

Llist* plugin_list_get char *  type_name  ) 
 

Parameters:
type_name The plugin type's name.
Return values:
#Llist * Of the loaded plugins.
NULL When the type was not found or their was no plugins loaded.
Description:
Returns the actual list of plugins to the supplied type name.

char** plugin_list_names_get char *  type_name  ) 
 

Parameters:
type_name The plugin type's name.
Return values:
char ** Array of strings contiaining the name of the plugins.
NULL When no plugins are loaded or the plugin type was not found.
Description:
Retrives a list containing the names of the currecntly loaded plugins for the supplied plugin type's name.

Plugin* plugin_select char *  type_name,
char *  plugin_name
 

Parameters:
type_name The plugin type's name.
plugin_name The plugin's name.
Return values:
#Plugin * Of the found plugin.
NULL When a parameter was NULL, the plugin type was not found or the plugin was not found.
Description:
Finds and returns a plugin by its name and type name.

void plugin_type_dump PluginType pt  ) 
 

Parameters:
pt The plugin type.
Description:
Prints out the member information of the supplied PluginType, including the number of currently loaded plugins.
Note:
This is only useful for debugging.

void plugin_type_free PluginType pt  ) 
 

Parameters:
pt The plugin type.
Description:
Unloads all the currectly loaded plugins then frees the plugin type.

void plugin_type_list_dump void   ) 
 

Description:
Prints out the member information of all registered plugins types.
Note:
This is only useful for debugging.

int plugin_type_register char *  type_name,
char *  type_desc,
char *  info_func_name
 

Parameters:
type_name The name of the plugin type.
type_desc The description for the plugin type.
info_func_name The name of the function in the plugin to provide its information.
Return values:
#TRUE On successfully appending the new type.
#FALSE On NULL parameter.
Description:
Makes a new plugin type for loading plugins. This function is called automaticly when you use plugin_register().

PluginType* plugin_type_select char *  type_name  ) 
 

Parameters:
type_name The name of the plugin type.
Return values:
#PluginType * Of the selected plugin type.
NULL If no match was found or error.
Description:
Searches the registered plugin types for the matching type with the specifyed name.

void plugin_type_unregister char *  type_name  ) 
 

Parameters:
type_name The name of the plugin type to unregister.
Description:
Finds the plugin type by the supplied name then unloads all its currectly loaded plugins and frees the plugin type.
See also:
plugin_type_free().
Note:
This function is not currently implimented.

void plugins_configs_add_all IOpts opts  ) 
 

Parameters:
opts The configuration option list to append to.
Description:
Appends all the loaded plugins' configuration options to the supplied IOpts. This is usefull for plugins configurations you wish to save or load.

void plugins_configs_default_all void   ) 
 

Description:
Sets all plugins configurations to their default settings.

void plugins_dump_all void   ) 
 

Description:
Dumps all registered plugins types and loaded plugins member information.
Note:
Only useful for debugging.

void plugins_free void   ) 
 

Description:
Unloads all plugins from memory and unregisters all plugin types.

void plugins_reload void   ) 
 

Description:
Unloads all plugins keeping track of wher the plugins where located then reloads them. This is useful for updateding plugins with out reloading the entire program.
Note:
This function is not currently implimented.

void plugins_scan_dir char *  directory  ) 
 

Parameters:
directory The directory name to scan for plugins.
Description:
This scans the directory specified for any shared objects and attempts to load them. This function isnot recursive.

void plugins_unload void   ) 
 

Description:
Unloads all plugins from memory.
Note:
This function is not currently implimented.
See also:
plugins_free()


Generated on Fri Jun 4 18:35:19 2004 for cuf by doxygen 1.3.6