30#include <gwenhywfar/debug.h>
91 p->fileName=strdup(fileName);
103 if (--(p->refCount)==0) {
173 return p->pluginDescription;
181 if (p->pluginDescription)
183 p->pluginDescription=pd;
202 pm->name=strdup(name);
203 pm->destLib=strdup(destLib);
204 pm->plugins=GWEN_Plugin_List_new();
215 GWEN_Plugin_List_free(pm->plugins);
276 const char *callingLib,
290 snprintf(nbuffer,
sizeof(nbuffer), keypath);
293 if (RegOpenKey(HKEY_LOCAL_MACHINE, nbuffer, &hkey)) {
300 nsize=
sizeof(nbuffer);
301 vsize=
sizeof(vbuffer);
302 if (ERROR_SUCCESS!=RegEnumValue(hkey,
311 if (strcasecmp(nbuffer, varname)==0 && typ==REG_SZ) {
346 if (libLoader==
NULL) {
376 if (pathList==
NULL) {
445 plugin=fn(pm, modname,
"");
477 "Could not load plugin \"%s\" (%s)", modname, fname);
506 plugin=fn(pm, modname, fname);
535 GWEN_Plugin_List_Add(p, pm->plugins);
551 if (strcasecmp(pm->name, s)==0)
553 pm=GWEN_PluginManager_List_Next(pm);
571 "Plugin type \"%s\" already registered",
579 pm->destLib, pm->name);
585 "Plugin type \"%s\" registered",
602 "Plugin type \"%s\" not registered",
610 pm->destLib, pm->name);
614 GWEN_PluginManager_List_Del(pm);
616 "Plugin type \"%s\" unregistered",
631 if (pdlFromPluginList && pdlLoaded){
639 else if (pdlFromPluginList) {
640 return pdlFromPluginList;
682 if (modname && *modname) {
686 if (pdInPlugin==
NULL) {
696 GWEN_Plugin_List_Add(p, pm->plugins);
710 p=GWEN_Plugin_List_First(pm->plugins);
712 if (strcasecmp(p->name, s)==0)
714 p=GWEN_Plugin_List_Next(p);
726 p=GWEN_Plugin_List_First(pm->plugins);
737 p=GWEN_Plugin_List_Next(p);
860 const char *nameInList;
863 if (nameInList && *nameInList && strcasecmp(nameInList, name)==0)
879 fprintf(stderr,
"Descriptor List: %s\n", text?text:
"");
892 fprintf(stderr,
"- %s\n", name?name:
"<empty>");
900 fprintf(stderr,
"- <empty list>\n");
GWEN_BUFFER * GWEN_Buffer_new(char *buffer, uint32_t size, uint32_t used, int take)
void GWEN_Buffer_free(GWEN_BUFFER *bf)
int GWEN_Buffer_AppendString(GWEN_BUFFER *bf, const char *buffer)
char * GWEN_Buffer_GetStart(const GWEN_BUFFER *bf)
int GWEN_Buffer_AppendByte(GWEN_BUFFER *bf, char c)
#define DBG_MEM_INC(o, attach)
#define DBG_INFO_ERR(dbg_logger, dbg_err)
#define DBG_INFO(dbg_logger, format,...)
#define DBG_ERROR(dbg_logger, format,...)
#define DBG_ERROR_ERR(dbg_logger, dbg_err)
#define DBG_DEBUG(dbg_logger, format,...)
struct GWEN_BUFFER GWEN_BUFFER
A dynamically resizeable text buffer.
#define GWEN_INHERIT_FUNCTIONS(t)
#define GWEN_INHERIT_INIT(t, element)
#define GWEN_INHERIT_FINI(t, element)
GWENHYWFAR_API int GWEN_LibLoader_OpenLibraryWithPath(GWEN_LIBLOADER *h, const char *path, const char *name)
GWENHYWFAR_API GWEN_LIBLOADER * GWEN_LibLoader_new(void)
GWENHYWFAR_API int GWEN_LibLoader_OpenLibrary(GWEN_LIBLOADER *h, const char *name)
GWENHYWFAR_API int GWEN_LibLoader_CloseLibrary(GWEN_LIBLOADER *h)
GWENHYWFAR_API int GWEN_LibLoader_Resolve(GWEN_LIBLOADER *h, const char *name, void **p)
GWENHYWFAR_API void GWEN_LibLoader_free(GWEN_LIBLOADER *h)
struct GWEN_LIBLOADER GWEN_LIBLOADER
#define GWEN_LIST_FINI(t, element)
#define GWEN_LIST_FUNCTIONS(t, pr)
#define GWEN_LIST_INIT(t, element)
struct GWEN_PLUGIN_DESCRIPTION_LIST2 GWEN_PLUGIN_DESCRIPTION_LIST2
unsigned int GWEN_PluginDescription_List2_GetSize(GWEN_PLUGIN_DESCRIPTION_LIST2 *l)
GWEN_PLUGIN_DESCRIPTION * GWEN_PluginDescription_List2Iterator_Data(GWEN_PLUGIN_DESCRIPTION_LIST2_ITERATOR *li)
GWEN_PLUGIN_DESCRIPTION * GWEN_PluginDescription_List2Iterator_Next(GWEN_PLUGIN_DESCRIPTION_LIST2_ITERATOR *li)
GWEN_PLUGIN_DESCRIPTION_LIST2_ITERATOR * GWEN_PluginDescription_List2_First(GWEN_PLUGIN_DESCRIPTION_LIST2 *l)
void GWEN_PluginDescription_List2_PushBack(GWEN_PLUGIN_DESCRIPTION_LIST2 *l, GWEN_PLUGIN_DESCRIPTION *p)
struct GWEN_PLUGIN_DESCRIPTION_LIST2_ITERATOR GWEN_PLUGIN_DESCRIPTION_LIST2_ITERATOR
void GWEN_PluginDescription_List2Iterator_free(GWEN_PLUGIN_DESCRIPTION_LIST2_ITERATOR *li)
void GWEN_PluginDescription_List2_free(GWEN_PLUGIN_DESCRIPTION_LIST2 *l)
GWEN_PLUGIN_DESCRIPTION_LIST2 * GWEN_PluginDescription_List2_new()
#define GWEN_FREE_OBJECT(varname)
#define GWEN_NEW_OBJECT(typ, varname)
int GWEN_PathManager_AddRelPath(const char *callingLib, const char *destLib, const char *pathName, const char *pathValue, GWEN_PATHMANAGER_RELMODE rm)
int GWEN_PathManager_InsertPath(const char *callingLib, const char *destLib, const char *pathName, const char *pathValue)
GWEN_STRINGLIST * GWEN_PathManager_GetPaths(const char *destLib, const char *pathName)
int GWEN_PathManager_RemovePath(const char *callingLib, const char *destLib, const char *pathName, const char *pathValue)
int GWEN_PathManager_UndefinePath(const char *destLib, const char *pathName)
int GWEN_PathManager_AddPath(const char *callingLib, const char *destLib, const char *pathName, const char *pathValue)
int GWEN_PathManager_InsertRelPath(const char *callingLib, const char *destLib, const char *pathName, const char *pathValue, GWEN_PATHMANAGER_RELMODE rm)
int GWEN_PathManager_DefinePath(const char *destLib, const char *pathName)
int GWEN_Plugin_ModuleFini(void)
GWEN_PLUGIN_MANAGER * GWEN_PluginManager_new(const char *name, const char *destLib)
GWEN_PLUGIN_DESCRIPTION_LIST2 * GWEN_PluginManager_GetPluginDescrs(GWEN_PLUGIN_MANAGER *pm)
const char * GWEN_PluginManager_GetName(const GWEN_PLUGIN_MANAGER *pm)
int GWEN_PluginManager_RemovePath(GWEN_PLUGIN_MANAGER *pm, const char *callingLib, const char *s)
GWEN_LIBLOADER * GWEN_Plugin_GetLibLoader(const GWEN_PLUGIN *p)
void GWEN_PluginManager_AddPlugin(GWEN_PLUGIN_MANAGER *pm, GWEN_PLUGIN *p)
GWEN_PLUGIN * GWEN_PluginManager_LoadPluginFile(GWEN_PLUGIN_MANAGER *pm, const char *modname, const char *fname)
static GWEN_LIBLOADER * _searchAndLoadModule(GWEN_PLUGIN_MANAGER *pm, const char *modname)
int GWEN_PluginManager_AddPathFromWinReg(GWEN_UNUSED GWEN_PLUGIN_MANAGER *pm, GWEN_UNUSED const char *callingLib, GWEN_UNUSED const char *keypath, GWEN_UNUSED const char *varname)
void GWEN_PluginManager_free(GWEN_PLUGIN_MANAGER *pm)
int GWEN_PluginManager_AddPath(GWEN_PLUGIN_MANAGER *pm, const char *callingLib, const char *s)
int GWEN_PluginManager_InsertPath(GWEN_PLUGIN_MANAGER *pm, const char *callingLib, const char *s)
GWEN_PLUGIN_MANAGER * GWEN_PluginManager_FindPluginManager(const char *s)
int GWEN_PluginManager_Unregister(GWEN_PLUGIN_MANAGER *pm)
int GWEN_Plugin_ModuleInit(void)
GWEN_PLUGIN * GWEN_PluginManager_GetPlugin(GWEN_PLUGIN_MANAGER *pm, const char *s)
static GWEN_PLUGIN_DESCRIPTION_LIST2 * _loadPluginDescrs(GWEN_PLUGIN_MANAGER *pm)
const GWEN_PLUGIN_DESCRIPTION * GWEN_Plugin_GetPluginDescription(const GWEN_PLUGIN *p)
static void _setLibLoader(GWEN_PLUGIN *p, GWEN_LIBLOADER *ll)
static GWEN_PLUGIN_DESCRIPTION_LIST2 * _combinedPluginDescrList(const GWEN_PLUGIN_DESCRIPTION_LIST2 *pdlLoaded, const GWEN_PLUGIN_DESCRIPTION_LIST2 *pdlFromPluginList)
static GWEN_PLUGIN * _createPluginFromLibloader(GWEN_PLUGIN_MANAGER *pm, GWEN_LIBLOADER *libLoader, const char *modname)
GWEN_PLUGIN_MANAGER * GWEN_Plugin_GetManager(const GWEN_PLUGIN *p)
static GWEN_PLUGIN * _findPluginInListByName(GWEN_PLUGIN_MANAGER *pm, const char *s)
static GWEN_PLUGIN_MANAGER_LIST * gwen_plugin_manager__list
int GWEN_PluginManager_InsertRelPath(GWEN_PLUGIN_MANAGER *pm, const char *callingLib, const char *relpath, GWEN_PATHMANAGER_RELMODE rm)
void GWEN_Plugin_Attach(GWEN_PLUGIN *p)
static GWEN_PLUGIN_DESCRIPTION_LIST2 * _getPluginDescrsFromPluginList(GWEN_PLUGIN_MANAGER *pm)
GWEN_PLUGIN * GWEN_Plugin_new(GWEN_PLUGIN_MANAGER *pm, const char *name, const char *fileName)
void GWEN_Plugin_free(GWEN_PLUGIN *p)
const char * GWEN_Plugin_GetName(const GWEN_PLUGIN *p)
const char * GWEN_Plugin_GetFileName(const GWEN_PLUGIN *p)
GWEN_STRINGLIST * GWEN_PluginManager_GetPaths(const GWEN_PLUGIN_MANAGER *pm)
int GWEN_PluginManager_Register(GWEN_PLUGIN_MANAGER *pm)
void GWEN_Plugin_SetPluginDescription(GWEN_PLUGIN *p, GWEN_PLUGIN_DESCRIPTION *pd)
int GWEN_PluginManager_AddRelPath(GWEN_PLUGIN_MANAGER *pm, const char *callingLib, const char *s, GWEN_PATHMANAGER_RELMODE rm)
GWEN_PLUGIN_DESCRIPTION * GWEN_PluginManager_GetPluginDescr(GWEN_PLUGIN_MANAGER *pm, const char *modName)
static GWEN_PLUGIN_DESCRIPTION * _findPluginDescrByNameInList2(const GWEN_PLUGIN_DESCRIPTION_LIST2 *pdl, const char *name)
GWEN_PLUGIN * GWEN_PluginManager_LoadPlugin(GWEN_PLUGIN_MANAGER *pm, const char *modname)
struct GWEN_PLUGIN_MANAGER GWEN_PLUGIN_MANAGER
GWEN_PLUGIN *(* GWEN_PLUGIN_FACTORYFN)(GWEN_PLUGIN_MANAGER *pm, const char *name, const char *fileName)
struct GWEN_PLUGIN GWEN_PLUGIN
void GWEN_PluginDescription_SetName(GWEN_PLUGIN_DESCRIPTION *pd, const char *s)
GWEN_PLUGIN_DESCRIPTION * GWEN_PluginDescription_new(void)
void GWEN_PluginDescription_List2_freeAll(GWEN_PLUGIN_DESCRIPTION_LIST2 *pdl)
void GWEN_PluginDescription_free(GWEN_PLUGIN_DESCRIPTION *pd)
void GWEN_PluginDescription_Attach(GWEN_PLUGIN_DESCRIPTION *pd)
void GWEN_PluginDescription_SetType(GWEN_PLUGIN_DESCRIPTION *pd, const char *s)
int GWEN_LoadPluginDescrsByType(const char *folder, const char *pluginType, GWEN_PLUGIN_DESCRIPTION_LIST2 *pdl)
const char * GWEN_PluginDescription_GetName(const GWEN_PLUGIN_DESCRIPTION *pd)
GWEN_PLUGIN_DESCRIPTION * GWEN_PluginDescription_dup(const GWEN_PLUGIN_DESCRIPTION *pd)
struct GWEN_PLUGIN_DESCRIPTION GWEN_PLUGIN_DESCRIPTION
void GWEN_StringList_free(GWEN_STRINGLIST *sl)
const char * GWEN_StringListEntry_Data(const GWEN_STRINGLISTENTRY *se)
GWEN_STRINGLISTENTRY * GWEN_StringListEntry_Next(const GWEN_STRINGLISTENTRY *se)
GWEN_STRINGLISTENTRY * GWEN_StringList_FirstEntry(const GWEN_STRINGLIST *sl)
struct GWEN_STRINGLISTENTRYSTRUCT GWEN_STRINGLISTENTRY
struct GWEN_STRINGLISTSTRUCT GWEN_STRINGLIST