Fixed bug regarding USE_TIMES var.
[idzebra-moved-to-github.git] / index / zrpn.c
index 8a6af0b..7ec5e01 100644 (file)
@@ -4,7 +4,19 @@
  * Sebastian Hammer, Adam Dickmeiss
  *
  * $Log: zrpn.c,v $
- * Revision 1.63  1997-09-17 12:19:18  adam
+ * Revision 1.67  1997-09-29 09:06:10  adam
+ * Removed one static var in order to make this module thread safe.
+ *
+ * Revision 1.66  1997/09/25 14:58:03  adam
+ * Windows NT port.
+ *
+ * Revision 1.65  1997/09/22 12:39:06  adam
+ * Added get_pos method for the ranked result sets.
+ *
+ * Revision 1.64  1997/09/18 08:59:20  adam
+ * Extra generic handle for the character mapping routines.
+ *
+ * Revision 1.63  1997/09/17 12:19:18  adam
  * Zebra version corresponds to YAZ version 1.4.
  * Changed Zebra server so that it doesn't depend on global common_resource.
  *
  */
 #include <stdio.h>
 #include <assert.h>
+#ifdef WINDOWS
+#include <io.h>
+#else
 #include <unistd.h>
+#endif
 #include <ctype.h>
 
 #include "zserver.h"
@@ -359,7 +375,7 @@ static int term_pre (const char **src, const char *ct1, const char *ct2)
         if (ct2 && strchr (ct2, *s0))
             break;
         s1 = s0;
-        map = map_chrs_input (&s1, strlen(s1));
+        map = map_chrs_input (0, &s1, strlen(s1));
         if (**map != *CHR_SPACE)
             break;
         s0 = s1;
@@ -380,7 +396,7 @@ static int term_100 (const char **src, char *dst, int space_split)
     while (*s0)
     {
         s1 = s0;
-        map = map_chrs_input (&s0, strlen(s0));
+        map = map_chrs_input (0, &s0, strlen(s0));
         if (space_split && **map == *CHR_SPACE)
             break;
         while (s1 < s0)
@@ -415,7 +431,7 @@ static int term_101 (const char **src, char *dst, int space_split)
         else
         {
             s1 = s0;
-            map = map_chrs_input (&s0, strlen(s0));
+            map = map_chrs_input (0, &s0, strlen(s0));
             if (space_split && **map == *CHR_SPACE)
                 break;
             while (s1 < s0)
@@ -456,7 +472,7 @@ static int term_103 (const char **src, char *dst, int *errors, int space_split)
         else
         {
             s1 = s0;
-            map = map_chrs_input (&s0, strlen(s0));
+            map = map_chrs_input (0, &s0, strlen(s0));
             if (**map == *CHR_SPACE)
                 break;
             while (s1 < s0)
@@ -819,7 +835,7 @@ static void trans_scan_term (ZServerInfo *zi, Z_AttributesPlusTerm *zapt,
     
     while ((len = (cp_end - cp)) > 0)
     {
-        map = map_chrs_input (&cp, len);
+        map = map_chrs_input (0, &cp, len);
         if (**map == *CHR_SPACE)
             space_map = *map;
         else
@@ -851,6 +867,7 @@ static RSET rpn_search_APT_relevance (ZServerInfo *zi,
     parms.key_size = sizeof(struct it_key);
     parms.max_rec = 1000;
     parms.cmp = key_compare_it;
+    parms.get_pos = key_get_pos;
     parms.is = zi->isam;
     parms.isc = zi->isamc;
     parms.no_terms = 0;
@@ -1330,7 +1347,7 @@ static RSET rpn_search_structure (ZServerInfo *zi, Z_RPNStructure *zs,
             }
             if (*zop->u.prox->proximityUnitCode != Z_ProxUnit_word)
             {
-                static char val[16];
+                char *val = odr_malloc (zi->odr, 16);
                 zi->errCode = 132;
                 zi->errString = val;
                 sprintf (val, "%d", *zop->u.prox->proximityUnitCode);
@@ -1441,7 +1458,7 @@ int rpn_search (ZServerInfo *zi,
     oident *attrset;
     oid_value attributeSet;
 
-    dict_grep_cmap (zi->dict, map_chrs_input);
+    dict_grep_cmap (zi->dict, 0, map_chrs_input);
     zlog_rpn (rpn);
 
     zi->errCode = 0;