X-Git-Url: http://git.indexdata.com/?a=blobdiff_plain;f=recctrl%2Frecctrl.c;h=410effc8ad2eae08515f4298b1eff2bd7a77c0c2;hb=ecb3935e78cd9bcfdebafdee0834cfb1060d7b5e;hp=5709d8c19b27b813fd1476ddccef6fdf98a43f30;hpb=0f3b8bcc6fe2e3beeec7c834d9a64dca48a4f1b7;p=idzebra-moved-to-github.git diff --git a/recctrl/recctrl.c b/recctrl/recctrl.c index 5709d8c..410effc 100644 --- a/recctrl/recctrl.c +++ b/recctrl/recctrl.c @@ -1,5 +1,5 @@ -/* $Id: recctrl.c,v 1.20 2005-04-28 08:20:40 adam Exp $ - Copyright (C) 1995-2005 +/* $Id: recctrl.c,v 1.25 2006-05-10 08:13:28 adam Exp $ + Copyright (C) 1995-2006 Index Data ApS This file is part of the Zebra server. @@ -53,11 +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; - const char *module_path = res_get_def(res, "modulePath", - DEFAULT_MODULE_PATH); #ifdef IDZEBRA_STATIC_GRS_SGML if (1) @@ -66,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) { @@ -73,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) @@ -82,6 +83,7 @@ RecTypeClass recTypeClass_create (Res res, NMEM nmem) } #endif #endif + #ifdef IDZEBRA_STATIC_GRS_REGX if (1) { @@ -89,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) { @@ -96,6 +99,15 @@ RecTypeClass recTypeClass_create (Res res, NMEM nmem) 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 if (1) { @@ -103,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) { @@ -110,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) @@ -119,6 +133,7 @@ RecTypeClass recTypeClass_create (Res res, NMEM nmem) } #endif #endif + #ifdef IDZEBRA_STATIC_XSLT #if HAVE_XSLT if (1) @@ -128,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) { @@ -154,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) { @@ -176,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) { @@ -269,10 +288,22 @@ 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; } } return 0; } +/* + * Local variables: + * c-basic-offset: 4 + * indent-tabs-mode: nil + * End: + * vim: shiftwidth=4 tabstop=8 expandtab + */ +