X-Git-Url: http://git.indexdata.com/?a=blobdiff_plain;f=recctrl%2Frectext.c;h=f102e7cde287c35a11161f4a750345824bdc81b6;hb=5adb31268b057741850de38eafd42baf8dc947ea;hp=9993d70cdb0e5e3bd0a40bd9c40415c824ad5db1;hpb=5c693d36af8be6f6642257160b3c6441d2e2d762;p=idzebra-moved-to-github.git diff --git a/recctrl/rectext.c b/recctrl/rectext.c index 9993d70..f102e7c 100644 --- a/recctrl/rectext.c +++ b/recctrl/rectext.c @@ -1,10 +1,35 @@ /* - * Copyright (C) 1994-1998, Index Data I/S + * Copyright (C) 1994-2001, Index Data * All rights reserved. * Sebastian Hammer, Adam Dickmeiss * * $Log: rectext.c,v $ - * Revision 1.6 1998-02-10 12:03:06 adam + * Revision 1.14 2001-01-22 11:41:41 adam + * Added support for raw retrieval (element set name "R"). + * + * Revision 1.13 1999/09/07 07:19:21 adam + * Work on character mapping. Implemented replace rules. + * + * Revision 1.12 1999/05/26 07:49:14 adam + * C++ compilation. + * + * Revision 1.11 1999/05/21 12:00:17 adam + * Better diagnostics for extraction process. + * + * Revision 1.10 1999/05/20 12:57:18 adam + * Implemented TCL filter. Updated recctrl system. + * + * Revision 1.9 1998/10/16 08:14:38 adam + * Updated record control system. + * + * Revision 1.8 1998/05/20 10:12:27 adam + * Implemented automatic EXPLAIN database maintenance. + * Modified Zebra to work with ASN.1 compiled version of YAZ. + * + * Revision 1.7 1998/03/11 11:19:05 adam + * Changed the way sequence numbers are generated. + * + * Revision 1.6 1998/02/10 12:03:06 adam * Implemented Sort. * * Revision 1.5 1997/10/27 14:33:06 adam @@ -57,7 +82,12 @@ #include #include "rectext.h" -static void text_init (void) +static void *text_init (RecType recType) +{ + return 0; +} + +static void text_destroy (void *clientData) { } @@ -70,10 +100,10 @@ struct buf_info { struct buf_info *buf_open (struct recExtractCtrl *p) { - struct buf_info *fi = xmalloc (sizeof(*fi)); + struct buf_info *fi = (struct buf_info *) xmalloc (sizeof(*fi)); fi->p = p; - fi->buf = xmalloc (4096); + fi->buf = (char *) xmalloc (4096); fi->offset = 1; fi->max = 1; return fi; @@ -100,11 +130,11 @@ void buf_close (struct buf_info *fi) xfree (fi); } -static int text_extract (struct recExtractCtrl *p) +static int text_extract (void *clientData, struct recExtractCtrl *p) { char w[512]; RecWord recWord; - int r, seqno = 1; + int r; struct buf_info *fi = buf_open (p); (*p->init)(p, &recWord); @@ -121,17 +151,16 @@ static int text_extract (struct recExtractCtrl *p) } if (i) { - recWord.seqno = seqno++; recWord.string = w; recWord.length = i; - (*p->add)(&recWord); + (*p->tokenAdd)(&recWord); } } while (r > 0); buf_close (fi); - return 0; + return RECCTRL_EXTRACT_OK; } -static int text_retrieve (struct recRetrieveCtrl *p) +static int text_retrieve (void *clientData, struct recRetrieveCtrl *p) { int r, text_ptr = 0; static char *text_buf = NULL; @@ -144,6 +173,9 @@ static int text_retrieve (struct recRetrieveCtrl *p) p->comp->u.simple->which == Z_ElementSetNames_generic) elementSetName = p->comp->u.simple->u.generic; + /* don't make header for the R(aw) element set name */ + if (elementSetName && !strcmp(elementSetName, "R")) + start_flag = 0; while (1) { if (text_ptr + 4096 >= text_size) @@ -151,7 +183,7 @@ static int text_retrieve (struct recRetrieveCtrl *p) char *nb; text_size = 2*text_size + 8192; - nb = xmalloc (text_size); + nb = (char *) xmalloc (text_size); if (text_buf) { memcpy (nb, text_buf, text_ptr); @@ -205,6 +237,7 @@ static int text_retrieve (struct recRetrieveCtrl *p) static struct recType text_type = { "text", text_init, + text_destroy, text_extract, text_retrieve };