Put local variables footer in all c, h files.
[idzebra-moved-to-github.git] / index / zrpn.c
index db339e5..2a25753 100644 (file)
@@ -1,4 +1,4 @@
-/* $Id: zrpn.c,v 1.206 2005-11-02 11:43:26 adam Exp $
+/* $Id: zrpn.c,v 1.212 2006-05-10 08:13:23 adam Exp $
    Copyright (C) 1995-2005
    Index Data ApS
 
@@ -181,8 +181,12 @@ void zebra_term_untrans(ZebraHandle zh, int reg_type,
     {
         const char *cp = zebra_maps_output(zh->reg->zebra_maps,
                                           reg_type, &src);
-        if (!cp && len < IT_MAX_WORD-1)
-            dst[len++] = *src++;
+       if (!cp)
+       {
+           if (len < IT_MAX_WORD-1)
+               dst[len++] = *src;
+           src++;
+       }
         else
             while (*cp && len < IT_MAX_WORD-1)
                 dst[len++] = *cp++;
@@ -241,7 +245,7 @@ static void add_isam_p(const char *name, const char *info,
         zebra_term_untrans  (p->zh, p->reg_type, term_tmp, name+len+1);
         yaz_log(log_level_rpn, "grep: %d %c %s", ord, name[len], term_tmp);
         zebraExplain_lookup_ord (p->zh->reg->zei,
-                                 ord, 0 /* index_type */, &db, &set, &use);
+                                 ord, 0 /* index_type */, &db, &set, &use, 0);
         yaz_log(log_level_rpn, "grep:  set=%d use=%d db=%s", set, use, db);
         
         resultSetAddTerm(p->zh, p->termset, name[len], db,
@@ -1005,7 +1009,7 @@ static ZEBRA_RES term_limits_APT(ZebraHandle zh,
 
     attr_init(&term_ref_id_attr, zapt, 10);
     term_ref_id_int = attr_find_ex(&term_ref_id_attr, NULL, term_ref_id_str);
-    if (term_ref_id_int != -1)
+    if (term_ref_id_int >= 0)
     {
        char *res = nmem_malloc(nmem, 20);
        sprintf(res, "%d", term_ref_id_int);
@@ -1235,17 +1239,14 @@ static ZEBRA_RES string_term(ZebraHandle zh, Z_AttributesPlusTerm *zapt,
                term_dict[prefix_len++] = 1;
                term_dict[prefix_len++] = ord_buf[i];
            }
+           if (ord_len > init_pos)
+               init_pos = ord_len;
        }
        bases_ok++;
         if (prefix_len)
            attr_ok = 1;
 
         term_dict[prefix_len++] = ')';
-#if REG_TYPE_PREFIX
-        term_dict[prefix_len++] = 1;
-        term_dict[prefix_len++] = reg_type;
-        yaz_log(log_level_rpn, "reg_type = %d", term_dict[prefix_len-1]);
-#endif
         term_dict[prefix_len] = '\0';
         j = prefix_len;
         switch (truncation_value)
@@ -1319,7 +1320,6 @@ static ZEBRA_RES string_term(ZebraHandle zh, Z_AttributesPlusTerm *zapt,
         case 103:       /* Regexp-2 */
             regex_range = 1;
             term_dict[j++] = '(';
-           init_pos = 2;
             if (!term_103(zh->reg->zebra_maps, reg_type,
                           &termp, term_dict + j, &regex_range,
                          space_split, term_dst))
@@ -1893,11 +1893,6 @@ static ZEBRA_RES numeric_term(ZebraHandle zh, Z_AttributesPlusTerm *zapt,
         }
         bases_ok++;
         term_dict[prefix_len++] = ')';
-#if REG_TYPE_PREFIX    
-        term_dict[prefix_len++] = 1;
-        term_dict[prefix_len++] = reg_type;
-        yaz_log(YLOG_DEBUG, "reg_type = %d", term_dict[prefix_len-1]);
-#endif
         term_dict[prefix_len] = '\0';
         if (!numeric_relation(zh, zapt, &termp, term_dict,
                              attributeSet, grep_info, &max_pos, reg_type,
@@ -2158,10 +2153,6 @@ static RSET xpath_trunc(ZebraHandle zh, NMEM stream,
         term_dict[prefix_len++] = ord_buf[i];
     }
     term_dict[prefix_len++] = ')';
-#if REG_TYPE_PREFIX
-    term_dict[prefix_len++] = 1;
-    term_dict[prefix_len++] = reg_type;
-#endif
     strcpy(term_dict+prefix_len, term);
     
     grep_info.isam_p_indx = 0;
@@ -2926,9 +2917,6 @@ ZEBRA_RES rpn_scan(ZebraHandle zh, ODR stream, Z_AttributesPlusTerm *zapt,
             scan_info->list[j].term = NULL;
 
         prefix_len += key_SU_encode (ords[i], termz + prefix_len);
-#if REG_TYPE_PREFIX
-        termz[prefix_len++] = reg_id;
-#endif
         termz[prefix_len] = 0;
         strcpy(scan_info->prefix, termz);
 
@@ -3139,3 +3127,11 @@ ZEBRA_RES rpn_scan(ZebraHandle zh, ODR stream, Z_AttributesPlusTerm *zapt,
     return ZEBRA_OK;
 }
 
+/*
+ * Local variables:
+ * c-basic-offset: 4
+ * indent-tabs-mode: nil
+ * End:
+ * vim: shiftwidth=4 tabstop=8 expandtab
+ */
+