More XPATH work; common sequence numbers for extract keys
[idzebra-moved-to-github.git] / recctrl / rectext.c
index 24d1c63..f102e7c 100644 (file)
@@ -1,10 +1,19 @@
 /*
- * Copyright (C) 1994-1998, Index Data 
+ * Copyright (C) 1994-2001, Index Data 
  * All rights reserved.
  * Sebastian Hammer, Adam Dickmeiss
  *
  * $Log: rectext.c,v $
- * Revision 1.11  1999-05-21 12:00:17  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
@@ -91,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;
@@ -144,7 +153,7 @@ static int text_extract (void *clientData, struct recExtractCtrl *p)
         {
             recWord.string = w;
            recWord.length = i;
-            (*p->addWord)(&recWord);
+            (*p->tokenAdd)(&recWord);
         }
     } while (r > 0);
     buf_close (fi);
@@ -164,6 +173,9 @@ static int text_retrieve (void *clientData, 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)
@@ -171,7 +183,7 @@ static int text_retrieve (void *clientData, 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);