From: Adam Dickmeiss Date: Fri, 5 May 2006 07:34:25 +0000 (+0000) Subject: By default, no searching for loadable modules is performed unless X-Git-Tag: before.bug.529~141 X-Git-Url: http://git.indexdata.com/?p=idzebra-moved-to-github.git;a=commitdiff_plain;h=f49130df276ecd0cdc157338da45ae5c46546d3a By default, no searching for loadable modules is performed unless modulePath is defined. --- diff --git a/include/idzebra/recctrl.h b/include/idzebra/recctrl.h index 88a91db..1fbc831 100644 --- a/include/idzebra/recctrl.h +++ b/include/idzebra/recctrl.h @@ -1,4 +1,4 @@ -/* $Id: recctrl.h,v 1.16 2006-05-02 08:27:43 marc Exp $ +/* $Id: recctrl.h,v 1.17 2006-05-05 07:34:25 adam Exp $ Copyright (C) 1995-2006 Index Data ApS @@ -138,6 +138,10 @@ YAZ_EXPORT RecTypeClass recTypeClass_create (Res res, NMEM nmem); YAZ_EXPORT +RecTypeClass recTypeClass_add_modules(Res res, NMEM nmem, + const char *module_path); + +YAZ_EXPORT void recTypeClass_destroy(RecTypeClass rtc); YAZ_EXPORT diff --git a/index/zebraapi.c b/index/zebraapi.c index 1b24783..9a88ead 100644 --- a/index/zebraapi.c +++ b/index/zebraapi.c @@ -1,4 +1,4 @@ -/* $Id: zebraapi.c,v 1.215 2006-05-03 09:31:26 marc Exp $ +/* $Id: zebraapi.c,v 1.216 2006-05-05 07:34:25 adam Exp $ Copyright (C) 1995-2005 Index Data ApS @@ -246,6 +246,14 @@ ZebraService zebra_start_res (const char *configName, Res def_res, Res over_res) zh->path_root = res_get (zh->global_res, "root"); zh->nmem = nmem_create(); zh->record_classes = recTypeClass_create (zh->global_res, zh->nmem); + + if (1) + { + const char *module_path = res_get(res, "modulePath"); + if (module_path) + recTypeClass_load_modules(&zh->record_classes, zh->nmem, + module_path); + } return zh; } return 0; diff --git a/recctrl/Makefile.am b/recctrl/Makefile.am index 522ed9d..bbe5e6e 100644 --- a/recctrl/Makefile.am +++ b/recctrl/Makefile.am @@ -1,4 +1,4 @@ -## $Id: Makefile.am,v 1.18 2005-12-05 12:18:40 marc Exp $ +## $Id: Makefile.am,v 1.19 2006-05-05 07:34:26 adam Exp $ common_libs = libidzebra-recctrl.la \ ../data1/libidzebra-data1.la \ @@ -81,4 +81,4 @@ EXTRA_libidzebra_recctrl_la_SOURCES = \ $(mod_xslt_la_SOURCES) AM_CPPFLAGS = -I$(srcdir)/../include $(YAZINC) $(XSLT_CFLAGS) \ - $(TCL_INCLUDE) -DDEFAULT_MODULE_PATH=\"$(pkglibdir)\" + $(TCL_INCLUDE) diff --git a/recctrl/recctrl.c b/recctrl/recctrl.c index 1130d01..586a187 100644 --- a/recctrl/recctrl.c +++ b/recctrl/recctrl.c @@ -1,5 +1,5 @@ -/* $Id: recctrl.c,v 1.23 2006-04-26 11:12:31 adam Exp $ - Copyright (C) 1995-2005 +/* $Id: recctrl.c,v 1.24 2006-05-05 07:34:26 adam Exp $ + Copyright (C) 1995-2006 Index Data ApS This file is part of the Zebra server. @@ -53,13 +53,10 @@ struct recTypes { static void recTypeClass_add (struct recTypeClass **rts, RecType *rt, NMEM nmem, void *module_handle); + RecTypeClass recTypeClass_create (Res res, NMEM nmem) { struct recTypeClass *rts = 0; -#if HAVE_DLFCN_H - const char *module_path = res_get_def(res, "modulePath", - DEFAULT_MODULE_PATH); -#endif #ifdef IDZEBRA_STATIC_GRS_SGML if (1) @@ -68,6 +65,7 @@ RecTypeClass recTypeClass_create (Res res, NMEM nmem) recTypeClass_add (&rts, idzebra_filter_grs_sgml, nmem, 0); } #endif + #ifdef IDZEBRA_STATIC_TEXT if (1) { @@ -75,6 +73,7 @@ RecTypeClass recTypeClass_create (Res res, NMEM nmem) recTypeClass_add (&rts, idzebra_filter_text, nmem, 0); } #endif + #ifdef IDZEBRA_STATIC_GRS_XML #if HAVE_EXPAT_H if (1) @@ -84,6 +83,7 @@ RecTypeClass recTypeClass_create (Res res, NMEM nmem) } #endif #endif + #ifdef IDZEBRA_STATIC_GRS_REGX if (1) { @@ -91,6 +91,7 @@ RecTypeClass recTypeClass_create (Res res, NMEM nmem) recTypeClass_add (&rts, idzebra_filter_grs_regx, nmem, 0); } #endif + #ifdef IDZEBRA_STATIC_GRS_MARC if (1) { @@ -98,6 +99,7 @@ RecTypeClass recTypeClass_create (Res res, NMEM nmem) recTypeClass_add (&rts, idzebra_filter_grs_marc, nmem, 0); } #endif + #ifdef IDZEBRA_STATIC_GRS_CSV if (1) { @@ -105,6 +107,7 @@ RecTypeClass recTypeClass_create (Res res, NMEM nmem) recTypeClass_add (&rts, idzebra_filter_grs_csv, nmem, 0); } #endif + #ifdef IDZEBRA_STATIC_GRS_DANBIB if (1) { @@ -112,6 +115,7 @@ RecTypeClass recTypeClass_create (Res res, NMEM nmem) recTypeClass_add (&rts, idzebra_filter_grs_danbib, nmem, 0); } #endif + #ifdef IDZEBRA_STATIC_SAFARI if (1) { @@ -119,6 +123,7 @@ RecTypeClass recTypeClass_create (Res res, NMEM nmem) recTypeClass_add (&rts, idzebra_filter_safari, nmem, 0); } #endif + #ifdef IDZEBRA_STATIC_ALVIS #if HAVE_XSLT if (1) @@ -128,6 +133,7 @@ RecTypeClass recTypeClass_create (Res res, NMEM nmem) } #endif #endif + #ifdef IDZEBRA_STATIC_XSLT #if HAVE_XSLT if (1) @@ -137,7 +143,12 @@ RecTypeClass recTypeClass_create (Res res, NMEM nmem) } #endif #endif + return rts; +} +void recTypeClass_load_modules(RecTypeClass *rts, NMEM nmem, + const char *module_path) +{ #if HAVE_DLFCN_H if (module_path) { @@ -163,7 +174,7 @@ RecTypeClass recTypeClass_create (Res res, NMEM nmem) if (mod_p && (fl = dlsym(mod_p, "idzebra_filter"))) { yaz_log(YLOG_LOG, "Loaded filter module %s", fname); - recTypeClass_add(&rts, fl, nmem, mod_p); + recTypeClass_add(rts, fl, nmem, mod_p); } else if (mod_p) { @@ -185,11 +196,10 @@ RecTypeClass recTypeClass_create (Res res, NMEM nmem) } } #endif - return rts; } -static void recTypeClass_add (struct recTypeClass **rts, RecType *rt, - NMEM nmem, void *module_handle) +static void recTypeClass_add(struct recTypeClass **rts, RecType *rt, + NMEM nmem, void *module_handle) { while (*rt) {