32 #include <yaz/snprintf.h>
55 NMEM nmem,
void *module_handle);
62 #if IDZEBRA_STATIC_GRS_SGML
65 extern RecType idzebra_filter_grs_sgml[];
70 #if IDZEBRA_STATIC_TEXT
73 extern RecType idzebra_filter_text[];
78 #if IDZEBRA_STATIC_GRS_XML
82 extern RecType idzebra_filter_grs_xml[];
88 #if IDZEBRA_STATIC_GRS_REGX
91 extern RecType idzebra_filter_grs_regx[];
96 #if IDZEBRA_STATIC_GRS_MARC
99 extern RecType idzebra_filter_grs_marc[];
104 #if IDZEBRA_STATIC_SAFARI
107 extern RecType idzebra_filter_safari[];
112 #if IDZEBRA_STATIC_ALVIS
115 extern RecType idzebra_filter_alvis[];
120 #if IDZEBRA_STATIC_DOM
123 extern RecType idzebra_filter_dom[];
134 DIR *dir = opendir(dirname);
139 while ((de = readdir(dir)))
141 size_t dlen = strlen(de->d_name);
143 !memcmp(de->d_name,
"mod-", 4) &&
144 !strcmp(de->d_name + dlen - 3,
".so"))
148 yaz_snprintf(fname,
sizeof(fname),
"%s/%s",
149 dirname, de->d_name);
150 mod_p = dlopen(fname, RTLD_NOW|RTLD_GLOBAL);
151 if (mod_p && (fl = dlsym(mod_p,
"idzebra_filter")))
153 yaz_log(YLOG_LOG,
"Loaded filter module %s", fname);
158 const char *err = dlerror();
159 yaz_log(YLOG_WARN,
"dlsym failed %s %s",
160 fname, err ? err :
"none");
165 const char *err = dlerror();
166 yaz_log(YLOG_WARN,
"dlopen failed %s %s",
167 fname, err ? err :
"none");
178 const char *module_path)
182 const char *comp_ptr;
186 len = yaz_filepath_comp(&module_path, &comp_ptr);
190 memcpy(comp, comp_ptr, len);
198 NMEM nmem,
void *module_handle)
203 nmem_malloc (nmem,
sizeof(*r));
217 void (*cb)(
void *cd,
const char *s))
219 for (; rtc; rtc = rtc->
next)
225 for (; rtc; rtc = rtc->
next)
242 for (; rtc; rtc = rtc->
next)
245 (*rti)->recType = rtc->
recType;
246 (*rti)->init_flag = 0;
273 && (name[slen] ==
'\0' || name[slen] ==
'.'))
NMEM data1_nmem_get(data1_handle dh)
static void destroy(struct zebra_register *reg, void *class_handle)
void recTypeClass_load_modules(RecTypeClass *rts, NMEM nmem, const char *module_path)
void recTypeClass_destroy(RecTypeClass rtc)
static void load_from_dir(RecTypeClass *rts, NMEM nmem, const char *dirname)
void recTypes_destroy(RecTypes rts)
RecTypeClass recTypeClass_create(Res res, NMEM nmem)
void recTypeClass_info(RecTypeClass rtc, void *cd, void(*cb)(void *cd, const char *s))
static void recTypeClass_add(struct recTypeClass **rts, RecType *rt, NMEM nmem, void *module_handle)
RecTypes recTypes_init(RecTypeClass rtc, data1_handle dh)
RecType recType_byName(RecTypes rts, Res res, const char *name, void **clientDataP)
struct recTypes * RecTypes
struct recTypeClass * next
struct recTypeInstance * next
ZEBRA_RES(* config)(void *clientData, Res res, const char *args)
struct recTypeInstance * entries