X-Git-Url: http://jsfdemo.indexdata.com/?a=blobdiff_plain;f=recctrl%2Frecctrl.c;h=1130d011df8f80fa6665894e2a7468c4c2e8a6fc;hb=b6ff969813b5ac4c0a6b266979469b0cc24201fd;hp=c4dbdbc956347988e7da08eaa46e5701f17f9764;hpb=5437b50633032595afe6f87dc0f989bc92a5aea8;p=idzebra-moved-to-github.git diff --git a/recctrl/recctrl.c b/recctrl/recctrl.c index c4dbdbc..1130d01 100644 --- a/recctrl/recctrl.c +++ b/recctrl/recctrl.c @@ -1,6 +1,6 @@ -/* $Id: recctrl.c,v 1.13 2004-11-19 10:27:12 heikki Exp $ - Copyright (C) 1995,1996,1997,1998,1999,2000,2001,2002,2003,2004 - Index Data Aps +/* $Id: recctrl.c,v 1.23 2006-04-26 11:12:31 adam Exp $ + Copyright (C) 1995-2005 + Index Data ApS This file is part of the Zebra server. @@ -24,10 +24,12 @@ Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA #include #include #include +#if HAVE_DLFCN_H #include +#endif #include -#include +#include #include struct recTypeClass { @@ -48,53 +50,95 @@ struct recTypes { struct recTypeInstance *entries; }; -#ifdef IDZEBRA_STATIC_TEXT - extern RecType idzebra_filter_text[]; -#endif -#ifdef IDZEBRA_STATIC_GRS_XML -#if HAVE_EXPAT_H - extern RecType idzebra_filter_grs_xml[]; -#endif -#endif -#ifdef IDZEBRA_STATIC_GRS_REGX - extern RecType idzebra_filter_grs_regx[]; -#endif -#ifdef IDZEBRA_STATIC_GRS_MARC - extern RecType idzebra_filter_grs_marc[]; -#endif -#ifdef IDZEBRA_STATIC_GRS_DANBIB - extern RecType idzebra_filter_grs_danbib[]; -#endif - 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 - extern RecType idzebra_filter_grs_sgml[]; - recTypeClass_add (&rts, idzebra_filter_grs_sgml, nmem, 0); +#ifdef IDZEBRA_STATIC_GRS_SGML + if (1) + { + extern RecType idzebra_filter_grs_sgml[]; + recTypeClass_add (&rts, idzebra_filter_grs_sgml, nmem, 0); + } +#endif #ifdef IDZEBRA_STATIC_TEXT - recTypeClass_add (&rts, idzebra_filter_text, nmem, 0); + if (1) + { + extern RecType idzebra_filter_text[]; + recTypeClass_add (&rts, idzebra_filter_text, nmem, 0); + } #endif #ifdef IDZEBRA_STATIC_GRS_XML #if HAVE_EXPAT_H - recTypeClass_add (&rts, idzebra_filter_grs_xml, nmem, 0); + if (1) + { + extern RecType idzebra_filter_grs_xml[]; + recTypeClass_add (&rts, idzebra_filter_grs_xml, nmem, 0); + } #endif #endif #ifdef IDZEBRA_STATIC_GRS_REGX - recTypeClass_add (&rts, idzebra_filter_grs_regx, nmem, 0); + if (1) + { + extern RecType idzebra_filter_grs_regx[]; + recTypeClass_add (&rts, idzebra_filter_grs_regx, nmem, 0); + } #endif #ifdef IDZEBRA_STATIC_GRS_MARC - recTypeClass_add (&rts, idzebra_filter_grs_marc, nmem, 0); + if (1) + { + extern RecType idzebra_filter_grs_marc[]; + recTypeClass_add (&rts, idzebra_filter_grs_marc, nmem, 0); + } +#endif +#ifdef IDZEBRA_STATIC_GRS_CSV + if (1) + { + extern RecType idzebra_filter_grs_csv[]; + recTypeClass_add (&rts, idzebra_filter_grs_csv, nmem, 0); + } #endif #ifdef IDZEBRA_STATIC_GRS_DANBIB - recTypeClass_add (&rts, idzebra_filter_grs_danbib, nmem, 0); + if (1) + { + extern RecType idzebra_filter_grs_danbib[]; + recTypeClass_add (&rts, idzebra_filter_grs_danbib, nmem, 0); + } +#endif +#ifdef IDZEBRA_STATIC_SAFARI + if (1) + { + extern RecType idzebra_filter_safari[]; + recTypeClass_add (&rts, idzebra_filter_safari, nmem, 0); + } +#endif +#ifdef IDZEBRA_STATIC_ALVIS +#if HAVE_XSLT + if (1) + { + extern RecType idzebra_filter_alvis[]; + recTypeClass_add (&rts, idzebra_filter_alvis, nmem, 0); + } +#endif +#endif +#ifdef IDZEBRA_STATIC_XSLT +#if HAVE_XSLT + if (1) + { + extern RecType idzebra_filter_xslt[]; + recTypeClass_add (&rts, idzebra_filter_xslt, nmem, 0); + } +#endif #endif +#if HAVE_DLFCN_H if (module_path) { DIR *dir = opendir(module_path); @@ -140,6 +184,7 @@ RecTypeClass recTypeClass_create (Res res, NMEM nmem) closedir(dir); } } +#endif return rts; } @@ -174,8 +219,10 @@ void recTypeClass_destroy(RecTypeClass rtc) { for (; rtc; rtc = rtc->next) { +#if HAVE_DLFCN_H if (rtc->module_handle) dlclose(rtc->module_handle); +#endif } } @@ -231,7 +278,11 @@ RecType recType_byName (RecTypes rts, Res res, const char *name, slen++; /* skip . */ if (rti->recType->config) - (*(rti->recType)->config)(rti->clientData, res, name+slen); + { + if ((*(rti->recType)->config) + (rti->clientData, res, name+slen) != ZEBRA_OK) + return 0; + } return rti->recType; } }