Removed snippet code from alvis filter
[idzebra-moved-to-github.git] / index / alvis.c
1 /* $Id: alvis.c,v 1.18 2007-08-21 07:49:18 adam Exp $
2    Copyright (C) 1995-2007
3    Index Data ApS
4
5 This file is part of the Zebra server.
6
7 Zebra is free software; you can redistribute it and/or modify it under
8 the terms of the GNU General Public License as published by the Free
9 Software Foundation; either version 2, or (at your option) any later
10 version.
11
12 Zebra is distributed in the hope that it will be useful, but WITHOUT ANY
13 WARRANTY; without even the implied warranty of MERCHANTABILITY or
14 FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
15 for more details.
16
17 You should have received a copy of the GNU General Public License
18 along with this program; if not, write to the Free Software
19 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
20
21 */
22
23 #include <stdio.h>
24 #include <assert.h>
25 #include <ctype.h>
26
27 #include <yaz/diagbib1.h>
28 #include <yaz/tpath.h>
29 #include <yaz/oid_db.h>
30
31 #include <libxml/xmlversion.h>
32 #include <libxml/parser.h>
33 #include <libxml/tree.h>
34 #include <libxml/xmlIO.h>
35 #include <libxml/xmlreader.h>
36 #include <libxslt/transform.h>
37 #include <libxslt/xsltutils.h>
38
39 #if YAZ_HAVE_EXSLT
40 #include <libexslt/exslt.h>
41 #endif
42
43 #include <idzebra/util.h>
44 #include <idzebra/recctrl.h>
45
46 struct filter_schema {
47     const char *name;
48     const char *identifier;
49     const char *stylesheet;
50     struct filter_schema *next;
51     const char *default_schema;
52     /* char default_schema; */
53     xsltStylesheetPtr stylesheet_xsp;
54 };
55
56 struct filter_info {
57     xmlDocPtr doc;
58     char *fname;
59     char *full_name;
60     const char *profile_path;
61     int split_level;
62     const char *split_path;
63     ODR odr;
64     struct filter_schema *schemas;
65     xmlTextReaderPtr reader;
66 };
67
68 #define ZEBRA_SCHEMA_XSLT_NS "http://indexdata.dk/zebra/xslt/1"
69
70 #define XML_STRCMP(a,b)   strcmp((char*)a, b)
71 #define XML_STRLEN(a) strlen((char*)a)
72
73 static const char *zebra_xslt_ns = ZEBRA_SCHEMA_XSLT_NS;
74
75 static void set_param_xml(const char **params, const char *name,
76                           const char *value, ODR odr)
77 {
78     while (*params)
79         params++;
80     params[0] = name;
81     params[1] = value;
82     params[2] = 0;
83 }
84
85 static void set_param_str(const char **params, const char *name,
86                           const char *value, ODR odr)
87 {
88     char *quoted = odr_malloc(odr, 3 + strlen(value));
89     sprintf(quoted, "'%s'", value);
90     while (*params)
91         params++;
92     params[0] = name;
93     params[1] = quoted;
94     params[2] = 0;
95 }
96
97 static void set_param_int(const char **params, const char *name,
98                           zint value, ODR odr)
99 {
100     char *quoted = odr_malloc(odr, 30); /* 25 digits enough for 2^64 */
101     while (*params)
102         params++;
103     sprintf(quoted, "'" ZINT_FORMAT "'", value);
104     params[0] = name;
105     params[1] = quoted;
106     params[2] = 0;
107 }
108
109 #define ENABLE_INPUT_CALLBACK 0
110
111 #if ENABLE_INPUT_CALLBACK
112 static int zebra_xmlInputMatchCallback (char const *filename)
113 {
114     yaz_log(YLOG_LOG, "match %s", filename);
115     return 0;
116 }
117
118 static void * zebra_xmlInputOpenCallback (char const *filename)
119 {
120     return 0;
121 }
122
123 static int zebra_xmlInputReadCallback (void * context, char * buffer, int len)
124 {
125     return 0;
126 }
127
128 static int zebra_xmlInputCloseCallback (void * context)
129 {
130     return 0;
131 }
132 #endif
133
134 static void *filter_init(Res res, RecType recType)
135 {
136     struct filter_info *tinfo = (struct filter_info *) xmalloc(sizeof(*tinfo));
137     tinfo->reader = 0;
138     tinfo->fname = 0;
139     tinfo->full_name = 0;
140     tinfo->profile_path = 0;
141     tinfo->split_level = 0;
142     tinfo->split_path = 0;
143     tinfo->odr = odr_createmem(ODR_ENCODE);
144     tinfo->doc = 0;
145     tinfo->schemas = 0;
146
147 #if YAZ_HAVE_EXSLT
148     exsltRegisterAll(); 
149 #endif
150
151 #if ENABLE_INPUT_CALLBACK
152     xmlRegisterDefaultInputCallbacks();
153     xmlRegisterInputCallbacks(zebra_xmlInputMatchCallback,
154                               zebra_xmlInputOpenCallback,
155                               zebra_xmlInputReadCallback,
156                               zebra_xmlInputCloseCallback);
157 #endif
158     return tinfo;
159 }
160
161 static int attr_content(struct _xmlAttr *attr, const char *name,
162                         const char **dst_content)
163 {
164     if (!XML_STRCMP(attr->name, name) && attr->children 
165         && attr->children->type == XML_TEXT_NODE)
166     {
167         *dst_content = (const char *)(attr->children->content);
168         return 1;
169     }
170     return 0;
171 }
172
173 static void destroy_schemas(struct filter_info *tinfo)
174 {
175     struct filter_schema *schema = tinfo->schemas;
176     while (schema)
177     {
178         struct filter_schema *schema_next = schema->next;
179         if (schema->stylesheet_xsp)
180             xsltFreeStylesheet(schema->stylesheet_xsp);
181         xfree(schema);
182         schema = schema_next;
183     }
184     tinfo->schemas = 0;
185     xfree(tinfo->fname);
186     if (tinfo->doc)
187         xmlFreeDoc(tinfo->doc);    
188     tinfo->doc = 0;
189 }
190
191 static ZEBRA_RES create_schemas(struct filter_info *tinfo, const char *fname)
192 {
193     char tmp_full_name[1024];
194     xmlNodePtr ptr;
195     tinfo->fname = xstrdup(fname);
196     
197     if (yaz_filepath_resolve(tinfo->fname, tinfo->profile_path, 
198                              NULL, tmp_full_name))
199         tinfo->full_name = xstrdup(tmp_full_name);
200     else
201         tinfo->full_name = xstrdup(tinfo->fname);
202     
203     yaz_log(YLOG_LOG, "alvis filter: loading config file %s", tinfo->full_name);
204     
205     tinfo->doc = xmlParseFile(tinfo->full_name);
206     
207     if (!tinfo->doc)
208     {
209         yaz_log(YLOG_WARN, "alvis filter: could not parse config file %s", 
210                 tinfo->full_name);
211         
212         return ZEBRA_FAIL;
213     }
214     
215     ptr = xmlDocGetRootElement(tinfo->doc);
216     if (!ptr || ptr->type != XML_ELEMENT_NODE 
217         || XML_STRCMP(ptr->name, "schemaInfo"))
218     {
219         yaz_log(YLOG_WARN, 
220                 "alvis filter:  config file %s :" 
221                 " expected root element <schemaInfo>", 
222                 tinfo->full_name);  
223         return ZEBRA_FAIL;
224     }
225
226     for (ptr = ptr->children; ptr; ptr = ptr->next)
227     {
228         if (ptr->type != XML_ELEMENT_NODE)
229             continue;
230         if (!XML_STRCMP(ptr->name, "schema"))
231         {  
232             struct _xmlAttr *attr;
233             struct filter_schema *schema = xmalloc(sizeof(*schema));
234             schema->name = 0;
235             schema->identifier = 0;
236             schema->stylesheet = 0;
237             schema->default_schema = 0;
238             schema->next = tinfo->schemas;
239             schema->stylesheet_xsp = 0;
240             tinfo->schemas = schema;
241             for (attr = ptr->properties; attr; attr = attr->next)
242             {
243                 attr_content(attr, "identifier", &schema->identifier);
244                 attr_content(attr, "name", &schema->name);
245                 attr_content(attr, "stylesheet", &schema->stylesheet);
246                 attr_content(attr, "default", &schema->default_schema);
247             }
248             /*yaz_log(YLOG_LOG, "XSLT add %s %s %s", 
249               schema->name, schema->identifier, schema->stylesheet); */
250
251             /* find requested schema */
252
253             if (schema->stylesheet)
254             {
255                 char tmp_xslt_full_name[1024];
256                 if (!yaz_filepath_resolve(schema->stylesheet, tinfo->profile_path, 
257                                           NULL, tmp_xslt_full_name)) 
258                 {
259                     yaz_log(YLOG_WARN, 
260                             "alvis filter: stylesheet %s not found in path %s",
261                             schema->stylesheet, tinfo->profile_path);
262                     return ZEBRA_FAIL;
263                 }
264                 schema->stylesheet_xsp 
265                     = xsltParseStylesheetFile((const xmlChar*) tmp_xslt_full_name);
266                 if (!schema->stylesheet_xsp)
267                 {
268                     yaz_log(YLOG_WARN, 
269                             "alvis filter: could not parse xslt stylesheet %s", 
270                             tmp_xslt_full_name);
271                     return ZEBRA_FAIL;
272                 }
273             }
274         }
275         else if (!XML_STRCMP(ptr->name, "split"))
276         {
277             struct _xmlAttr *attr;
278             for (attr = ptr->properties; attr; attr = attr->next)
279             {
280                 const char *split_level_str = 0;
281                 attr_content(attr, "level", &split_level_str);
282                 tinfo->split_level = 
283                     split_level_str ? atoi(split_level_str) : 0;
284             }
285         }
286         else
287         {
288             yaz_log(YLOG_WARN, "Bad element %s in %s", ptr->name, fname);
289             return ZEBRA_FAIL;
290         }
291     }
292     return ZEBRA_OK;
293 }
294
295 static struct filter_schema *lookup_schema(struct filter_info *tinfo,
296                                            const char *est)
297 {
298     struct filter_schema *schema;
299
300     for (schema = tinfo->schemas; schema; schema = schema->next)
301     { 
302         /* find requested schema */
303         if (est) 
304         {    
305             if (schema->identifier && !strcmp(schema->identifier, est))
306                 return schema;
307             
308             if (schema->name && !strcmp(schema->name, est))
309                 return schema;
310         } 
311         /* or return default schema if defined */
312         else if (schema->default_schema)
313             return schema;
314     }
315
316     /* return first schema if no default schema defined */
317     if (tinfo->schemas)
318         return tinfo->schemas;
319     
320     return 0;
321 }
322
323 static ZEBRA_RES filter_config(void *clientData, Res res, const char *args)
324 {
325     struct filter_info *tinfo = clientData;
326     if (!args || !*args)
327     {
328         yaz_log(YLOG_WARN, "alvis filter: need config file");
329         return ZEBRA_FAIL;
330     }
331
332     if (tinfo->fname && !strcmp(args, tinfo->fname))
333         return ZEBRA_OK;
334     
335     tinfo->profile_path = res_get(res, "profilePath");
336     yaz_log(YLOG_LOG, "alvis filter: profilePath %s", tinfo->profile_path);
337
338     destroy_schemas(tinfo);
339     return create_schemas(tinfo, args);
340 }
341
342 static void filter_destroy(void *clientData)
343 {
344     struct filter_info *tinfo = clientData;
345     destroy_schemas(tinfo);
346     xfree(tinfo->full_name);
347     if (tinfo->reader)
348         xmlFreeTextReader(tinfo->reader);
349     odr_destroy(tinfo->odr);
350     xfree(tinfo);
351 }
352
353 static int ioread_ex(void *context, char *buffer, int len)
354 {
355     struct recExtractCtrl *p = context;
356     return p->stream->readf(p->stream, buffer, len);
357 }
358
359 static int ioclose_ex(void *context)
360 {
361     return 0;
362 }
363
364 static void index_cdata(struct filter_info *tinfo, struct recExtractCtrl *ctrl,
365                         xmlNodePtr ptr, RecWord *recWord)
366 {
367     for(; ptr; ptr = ptr->next)
368     {
369         index_cdata(tinfo, ctrl, ptr->children, recWord);
370         if (ptr->type != XML_TEXT_NODE)
371             continue;
372         recWord->term_buf = (const char *)ptr->content;
373         recWord->term_len = XML_STRLEN(ptr->content);
374         (*ctrl->tokenAdd)(recWord);
375     }
376 }
377
378 static void index_node(struct filter_info *tinfo,  struct recExtractCtrl *ctrl,
379                        xmlNodePtr ptr, RecWord *recWord)
380 {
381     for(; ptr; ptr = ptr->next)
382     {
383         index_node(tinfo, ctrl, ptr->children, recWord);
384         if (ptr->type != XML_ELEMENT_NODE || !ptr->ns ||
385             XML_STRCMP(ptr->ns->href, zebra_xslt_ns))
386             continue;
387         if (!XML_STRCMP(ptr->name, "index"))
388         {
389             const char *name_str = 0;
390             const char *type_str = 0;
391             const char *xpath_str = 0;
392             struct _xmlAttr *attr;
393             for (attr = ptr->properties; attr; attr = attr->next)
394             {
395                 attr_content(attr, "name", &name_str);
396                 attr_content(attr, "xpath", &xpath_str);
397                 attr_content(attr, "type", &type_str);
398             }
399             if (name_str)
400             {
401                 int prev_type = recWord->index_type; /* save default type */
402
403                 if (type_str && *type_str)
404                     recWord->index_type = *type_str; /* type was given */
405                 recWord->index_name = name_str;
406                 index_cdata(tinfo, ctrl, ptr->children, recWord);
407
408                 recWord->index_type = prev_type;     /* restore it again */
409             }
410         }
411     }
412 }
413
414 static void index_record(struct filter_info *tinfo,struct recExtractCtrl *ctrl,
415                          xmlNodePtr ptr, RecWord *recWord)
416 {
417     const char *type_str = "update";
418
419     if (ptr && ptr->type == XML_ELEMENT_NODE && ptr->ns &&
420         !XML_STRCMP(ptr->ns->href, zebra_xslt_ns)
421         && !XML_STRCMP(ptr->name, "record"))
422     {
423         const char *id_str = 0;
424         const char *rank_str = 0;
425         struct _xmlAttr *attr;
426         for (attr = ptr->properties; attr; attr = attr->next)
427         {
428             attr_content(attr, "type", &type_str);
429             attr_content(attr, "id", &id_str);
430             attr_content(attr, "rank", &rank_str);
431         }
432         if (id_str)
433             sscanf(id_str, "%255s", ctrl->match_criteria);
434
435         if (rank_str)
436             ctrl->staticrank = atozint(rank_str);
437         ptr = ptr->children;
438     }
439
440     if (!strcmp("update", type_str))
441         index_node(tinfo, ctrl, ptr, recWord);
442     else if (!strcmp("delete", type_str))
443          yaz_log(YLOG_WARN, "alvis filter delete: to be implemented");
444     else
445          yaz_log(YLOG_WARN, "alvis filter: unknown record type '%s'", 
446                  type_str);
447 }
448     
449 static int extract_doc(struct filter_info *tinfo, struct recExtractCtrl *p,
450                        xmlDocPtr doc)
451 {
452     RecWord recWord;
453     const char *params[10];
454     xmlChar *buf_out;
455     int len_out;
456
457     struct filter_schema *schema = lookup_schema(tinfo, zebra_xslt_ns);
458
459     params[0] = 0;
460     set_param_str(params, "schema", zebra_xslt_ns, tinfo->odr);
461
462     (*p->init)(p, &recWord);
463
464     if (schema && schema->stylesheet_xsp)
465     {
466         xmlNodePtr root_ptr;
467         xmlDocPtr resDoc = 
468             xsltApplyStylesheet(schema->stylesheet_xsp,
469                                 doc, params);
470         if (p->flagShowRecords)
471         {
472             xmlDocDumpMemory(resDoc, &buf_out, &len_out);
473             fwrite(buf_out, len_out, 1, stdout);
474             xmlFree(buf_out);
475         }
476         root_ptr = xmlDocGetRootElement(resDoc);
477         if (root_ptr)
478             index_record(tinfo, p, root_ptr, &recWord);
479         else
480         {
481             yaz_log(YLOG_WARN, "No root for index XML record."
482                     " split_level=%d stylesheet=%s",
483                     tinfo->split_level, schema->stylesheet);
484         }
485         xmlFreeDoc(resDoc);
486     }
487     xmlDocDumpMemory(doc, &buf_out, &len_out);
488     if (p->flagShowRecords)
489         fwrite(buf_out, len_out, 1, stdout);
490     (*p->setStoreData)(p, buf_out, len_out);
491     xmlFree(buf_out);
492     
493     xmlFreeDoc(doc);
494     return RECCTRL_EXTRACT_OK;
495 }
496
497 static int extract_split(struct filter_info *tinfo, struct recExtractCtrl *p)
498 {
499     int ret;
500
501     if (p->first_record)
502     {
503         if (tinfo->reader)
504             xmlFreeTextReader(tinfo->reader);
505         tinfo->reader = xmlReaderForIO(ioread_ex, ioclose_ex,
506                                        p /* I/O handler */,
507                                        0 /* URL */, 
508                                        0 /* encoding */,
509                                        XML_PARSE_XINCLUDE
510                                        | XML_PARSE_NOENT
511                                        | XML_PARSE_NONET);
512     }
513     if (!tinfo->reader)
514         return RECCTRL_EXTRACT_ERROR_GENERIC;
515
516     ret = xmlTextReaderRead(tinfo->reader);
517     while (ret == 1)
518     {
519         int type = xmlTextReaderNodeType(tinfo->reader);
520         int depth = xmlTextReaderDepth(tinfo->reader);
521         if (type == XML_READER_TYPE_ELEMENT && tinfo->split_level == depth)
522         {
523             xmlNodePtr ptr = xmlTextReaderExpand(tinfo->reader);
524             if (ptr)
525             {
526                 xmlNodePtr ptr2 = xmlCopyNode(ptr, 1);
527                 xmlDocPtr doc = xmlNewDoc((const xmlChar*) "1.0");
528                 
529                 xmlDocSetRootElement(doc, ptr2);
530                 
531                 return extract_doc(tinfo, p, doc);
532             }
533             else
534             {
535                 xmlFreeTextReader(tinfo->reader);
536                 tinfo->reader = 0;
537                 return RECCTRL_EXTRACT_ERROR_GENERIC;
538             }
539         }
540         ret = xmlTextReaderRead(tinfo->reader);
541     }
542     xmlFreeTextReader(tinfo->reader);
543     tinfo->reader = 0;
544     return RECCTRL_EXTRACT_EOF;
545 }
546
547 static int extract_full(struct filter_info *tinfo, struct recExtractCtrl *p)
548 {
549     if (p->first_record) /* only one record per stream */
550     {
551        xmlDocPtr doc = xmlReadIO(ioread_ex, ioclose_ex, p /* I/O handler */,
552                                  0 /* URL */,
553                                  0 /* encoding */,
554                                  XML_PARSE_XINCLUDE
555                                  | XML_PARSE_NOENT
556                                  | XML_PARSE_NONET);
557        if (!doc)
558            return RECCTRL_EXTRACT_ERROR_GENERIC;
559        /* else {
560            xmlNodePtr root = xmlDocGetRootElement(doc);
561             if (!root)
562                 return RECCTRL_EXTRACT_ERROR_GENERIC;
563                 } */
564        
565        return extract_doc(tinfo, p, doc);
566     }
567     else
568        return RECCTRL_EXTRACT_EOF;
569 }
570
571 static int filter_extract(void *clientData, struct recExtractCtrl *p)
572 {
573     struct filter_info *tinfo = clientData;
574
575     odr_reset(tinfo->odr);
576     if (tinfo->split_level == 0)
577         return extract_full(tinfo, p);
578     else
579         return extract_split(tinfo, p);
580 }
581
582 static int ioread_ret(void *context, char *buffer, int len)
583 {
584     struct recRetrieveCtrl *p = context;
585     return p->stream->readf(p->stream, buffer, len);
586 }
587
588 static int ioclose_ret(void *context)
589 {
590     return 0;
591 }
592
593 static int filter_retrieve (void *clientData, struct recRetrieveCtrl *p)
594 {
595     /* const char *esn = zebra_xslt_ns; */
596     const char *esn = 0;
597     const char *params[32];
598     struct filter_info *tinfo = clientData;
599     xmlDocPtr resDoc;
600     xmlDocPtr doc;
601     struct filter_schema *schema;
602
603     if (p->comp)
604     {
605         if (p->comp->which == Z_RecordComp_simple
606             && p->comp->u.simple->which == Z_ElementSetNames_generic)
607         {
608             esn = p->comp->u.simple->u.generic;
609         }
610         else if (p->comp->which == Z_RecordComp_complex 
611                  && p->comp->u.complex->generic->elementSpec
612                  && p->comp->u.complex->generic->elementSpec->which ==
613                  Z_ElementSpec_elementSetName)
614         {
615             esn = p->comp->u.complex->generic->elementSpec->u.elementSetName;
616         }
617     }
618     schema = lookup_schema(tinfo, esn);
619     if (!schema)
620     {
621         p->diagnostic =
622             YAZ_BIB1_SPECIFIED_ELEMENT_SET_NAME_NOT_VALID_FOR_SPECIFIED_;
623         return 0;
624     }
625
626     params[0] = 0;
627     set_param_int(params, "id", p->localno, p->odr);
628     if (p->fname)
629         set_param_str(params, "filename", p->fname, p->odr);
630     if (p->staticrank >= 0)
631         set_param_int(params, "rank", p->staticrank, p->odr);
632
633     if (esn)
634         set_param_str(params, "schema", esn, p->odr);
635     else
636         if (schema->name)
637             set_param_str(params, "schema", schema->name, p->odr);
638         else if (schema->identifier)
639             set_param_str(params, "schema", schema->identifier, p->odr);
640         else
641             set_param_str(params, "schema", "", p->odr);
642
643     if (p->score >= 0)
644         set_param_int(params, "score", p->score, p->odr);
645     set_param_int(params, "size", p->recordSize, p->odr);
646
647     doc = xmlReadIO(ioread_ret, ioclose_ret, p /* I/O handler */,
648                     0 /* URL */,
649                     0 /* encoding */,
650                     XML_PARSE_XINCLUDE | XML_PARSE_NOENT | XML_PARSE_NONET);
651     if (!doc)
652     {
653         p->diagnostic = YAZ_BIB1_SYSTEM_ERROR_IN_PRESENTING_RECORDS;
654         return 0;
655     }
656
657     if (!schema->stylesheet_xsp)
658         resDoc = doc;
659     else
660     {
661         resDoc = xsltApplyStylesheet(schema->stylesheet_xsp,
662                                      doc, params);
663         xmlFreeDoc(doc);
664     }
665     if (!resDoc)
666     {
667         p->diagnostic = YAZ_BIB1_SYSTEM_ERROR_IN_PRESENTING_RECORDS;
668     }
669     else if (!p->input_format 
670              || !oid_oidcmp(p->input_format, yaz_oid_recsyn_xml))
671     {
672         xmlChar *buf_out;
673         int len_out;
674
675         if (schema->stylesheet_xsp)
676             xsltSaveResultToString(&buf_out, &len_out, resDoc,
677                                    schema->stylesheet_xsp);     
678         else
679             xmlDocDumpMemory(resDoc, &buf_out, &len_out);            
680
681         p->output_format = yaz_oid_recsyn_xml;
682         p->rec_len = len_out;
683         p->rec_buf = odr_malloc(p->odr, p->rec_len);
684         memcpy(p->rec_buf, buf_out, p->rec_len);
685         xmlFree(buf_out);
686     }
687     else if (!oid_oidcmp(p->output_format, yaz_oid_recsyn_sutrs))
688     {
689         xmlChar *buf_out;
690         int len_out;
691
692         if (schema->stylesheet_xsp)
693             xsltSaveResultToString(&buf_out, &len_out, resDoc,
694                                    schema->stylesheet_xsp);
695         else
696             xmlDocDumpMemory(resDoc, &buf_out, &len_out);            
697
698         p->output_format = yaz_oid_recsyn_sutrs;
699         p->rec_len = len_out;
700         p->rec_buf = odr_malloc(p->odr, p->rec_len);
701         memcpy(p->rec_buf, buf_out, p->rec_len);
702         
703         xmlFree(buf_out);
704     }
705     else
706     {
707         p->diagnostic = YAZ_BIB1_RECORD_SYNTAX_UNSUPP;
708     }
709     xmlFreeDoc(resDoc);
710     return 0;
711 }
712
713 static struct recType filter_type = {
714     0,
715     "alvis",
716     filter_init,
717     filter_config,
718     filter_destroy,
719     filter_extract,
720     filter_retrieve
721 };
722
723 RecType
724 #ifdef IDZEBRA_STATIC_ALVIS
725 idzebra_filter_alvis
726 #else
727 idzebra_filter
728 #endif
729
730 [] = {
731     &filter_type,
732     0,
733 };
734 /*
735  * Local variables:
736  * c-basic-offset: 4
737  * indent-tabs-mode: nil
738  * End:
739  * vim: shiftwidth=4 tabstop=8 expandtab
740  */
741