Changed the pos code to 64-bit clean. Still lots of stuff missing...
authorHeikki Levanto <heikki@indexdata.dk>
Wed, 4 Aug 2004 09:59:03 +0000 (09:59 +0000)
committerHeikki Levanto <heikki@indexdata.dk>
Wed, 4 Aug 2004 09:59:03 +0000 (09:59 +0000)
include/isamb.h
include/rset.h
isamb/isamb.c
rset/rsbetween.c
rset/rsbool.c
rset/rset.c
rset/rsisamb.c
rset/rsisams.c
rset/rsnull.c
rset/rsprox.c

index 181b7c2..358dc84 100644 (file)
@@ -1,4 +1,4 @@
-/* $Id: isamb.h,v 1.11 2004-08-04 08:35:23 adam Exp $
+/* $Id: isamb.h,v 1.12 2004-08-04 09:59:03 heikki Exp $
    Copyright (C) 1995,1996,1997,1998,1999,2000,2001,2002,2003,2004
    Index Data Aps
 
@@ -44,7 +44,7 @@ int isamb_pp_read (ISAMB_PP pp, void *buf);
 
 int isamb_pp_forward (ISAMB_PP pp, void *buf, const void *untilbuf);
 
-void isamb_pp_pos (ISAMB_PP pp, int *current, int *total);
+void isamb_pp_pos (ISAMB_PP pp, zint *current, zint *total);
 
 void isamb_pp_close (ISAMB_PP pp);
 
index e6bd856..09dcf6d 100644 (file)
@@ -1,4 +1,4 @@
-/* $Id: rset.h,v 1.23 2004-08-03 14:54:41 heikki Exp $
+/* $Id: rset.h,v 1.24 2004-08-04 09:59:03 heikki Exp $
    Copyright (C) 1995,1996,1997,1998,1999,2000,2001,2002
    Index Data Aps
 
@@ -46,8 +46,7 @@ struct rset_control
     int (*f_forward)(RSET ct, RSFD rfd, void *buf,  int *term_index,
                      int (*cmpfunc)(const void *p1, const void *p2), 
                      const void *untilbuf);
-    void (*f_pos)(RSFD rfd, int *current, int *total);
-       /* FIXME - Should be 64-bit ints !*/
+    void (*f_pos)(RSFD rfd, zint *current, zint *total);
        /* returns -1,-1 if pos function not implemented for this type */
     int (*f_read)(RSFD rfd, void *buf, int *term_index);
     int (*f_write)(RSFD rfd, const void *buf);
@@ -56,7 +55,7 @@ struct rset_control
 int rset_default_forward(RSET ct, RSFD rfd, void *buf, int *term_index, 
                      int (*cmpfunc)(const void *p1, const void *p2), 
                      const void *untilbuf);
-void rset_default_pos(RSFD rfd, int *current, int *total);
+void rset_default_pos(RSFD rfd, zint *current, zint *total);
 
 struct rset_term {
     char *name;
index ebf0bd2..5bcc0c9 100644 (file)
@@ -1,4 +1,4 @@
-/* $Id: isamb.c,v 1.48 2004-08-04 08:35:24 adam Exp $
+/* $Id: isamb.c,v 1.49 2004-08-04 09:59:03 heikki Exp $
    Copyright (C) 1995,1996,1997,1998,1999,2000,2001,2002,2003,2004
    Index Data Aps
 
@@ -1804,7 +1804,7 @@ int isamb_pp_num (ISAMB_PP pp)
 }
 
 static void isamb_pp_leaf_pos( ISAMB_PP pp, 
-                               int *current, int *total, void *dummybuf )
+                               zint *current, zint *total, void *dummybuf )
 {
     struct ISAMB_block *p = pp->block[pp->level];
     const char *src=p->bytes;
@@ -1825,13 +1825,14 @@ static void isamb_pp_leaf_pos( ISAMB_PP pp,
         if (src<=cur)
              (*current)++;
     }
-    logf(LOG_DEBUG, "isamb_pp_leaf_pos: cur=%d tot=%d ofs=%d sz=%d lev=%d",
+    logf(LOG_DEBUG, "isamb_pp_leaf_pos: cur="ZINT_FORMAT" tot="ZINT_FORMAT
+                    " ofs=%d sz=%d lev=%d",
                     *current, *total, p->offset, p->size, pp->level);
     assert(src==end);
 }
 
-static void isamb_pp_upper_pos( ISAMB_PP pp, int *current, int *total, 
-                                int size, int level )
+static void isamb_pp_upper_pos( ISAMB_PP pp, zint *current, zint *total, 
+                                zint size, int level )
 { /* estimates total/current occurrences from here up, excl leaf */
     struct ISAMB_block *p = pp->block[level];
     const char *src=p->bytes;
@@ -1842,7 +1843,8 @@ static void isamb_pp_upper_pos( ISAMB_PP pp, int *current, int *total,
     assert(level>=0);
     assert(!p->leaf);
     logf(LOG_DEBUG,"isamb_pp_upper_pos at beginning     l=%d "
-                   "cur=%d tot=%d ofs=%d sz=%d pos=" ZINT_FORMAT, 
+                   "cur="ZINT_FORMAT" tot="ZINT_FORMAT
+                   " ofs=%d sz=%d pos=" ZINT_FORMAT, 
                    level, *current, *total, p->offset, p->size, p->pos);
     assert (p->offset <= p->size);
     decode_ptr (&src, &child ); /* first child */
@@ -1861,7 +1863,7 @@ static void isamb_pp_upper_pos( ISAMB_PP pp, int *current, int *total,
         isamb_pp_upper_pos(pp, current, total, *total, level-1);
 } /* upper_pos */
 
-void isamb_pp_pos( ISAMB_PP pp, int *current, int *total )
+void isamb_pp_pos( ISAMB_PP pp, zint *current, zint *total )
 { /* return an estimate of the current position and of the total number of */
   /* occureences in the isam tree, based on the current leaf */
     struct ISAMB_block *p = pp->block[pp->level];
@@ -1872,8 +1874,4 @@ void isamb_pp_pos( ISAMB_PP pp, int *current, int *total )
     isamb_pp_leaf_pos(pp,current, total, dummy);
     if (pp->level>0)
         isamb_pp_upper_pos(pp, current, total, *total, pp->level-1);
-    /*
-    logf(LOG_DEBUG,"isamb_pp_pos: C=%d T=%d =%6.2f%%",
-                    *current, *total, 100.0*(*current)/(*total));
-    */
 }
index e04c746..774535c 100644 (file)
@@ -1,4 +1,4 @@
-/* $Id: rsbetween.c,v 1.15 2004-08-03 14:54:41 heikki Exp $
+/* $Id: rsbetween.c,v 1.16 2004-08-04 09:59:03 heikki Exp $
    Copyright (C) 1995,1996,1997,1998,1999,2000,2001,2002
    Index Data Aps
 
@@ -35,8 +35,8 @@ Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA
 #include <string.h>
 #include <assert.h>
 
-#include <rsbetween.h>
 #include <zebrautl.h>
+#include <rsbetween.h>
 
 #define RSBETWEEN_DEBUG 0
 
index 380ef6a..1a6b3c9 100644 (file)
@@ -1,4 +1,4 @@
-/* $Id: rsbool.c,v 1.32 2004-08-03 14:54:41 heikki Exp $
+/* $Id: rsbool.c,v 1.33 2004-08-04 09:59:03 heikki Exp $
    Copyright (C) 1995,1996,1997,1998,1999,2000,2001,2002,2003,2004
    Index Data Aps
 
@@ -25,8 +25,8 @@ Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA
 #include <string.h>
 #include <assert.h>
 
-#include <rsbool.h>
 #include <zebrautl.h>
+#include <rsbool.h>
 
 #ifndef RSET_DEBUG
 #define RSET_DEBUG 0
index 2f4896e..4421587 100644 (file)
@@ -1,4 +1,4 @@
-/* $Id: rset.c,v 1.21 2004-08-03 14:54:41 heikki Exp $
+/* $Id: rset.c,v 1.22 2004-08-04 09:59:03 heikki Exp $
    Copyright (C) 1995,1996,1997,1998,1999,2000,2001,2002,2003,2004
    Index Data Aps
 
@@ -65,7 +65,7 @@ RSET rset_dup (RSET rs)
     return rs;
 }
 
-void rset_default_pos (RSFD rfd, int *current, int *total)
+void rset_default_pos (RSFD rfd, zint *current, zint *total)
 { /* FIXME - This function should not be needed, only while */
   /*         coding the pos functions. */
     assert(rfd);
index bac75e9..0bc7107 100644 (file)
@@ -1,4 +1,4 @@
-/* $Id: rsisamb.c,v 1.10 2004-08-03 14:54:41 heikki Exp $
+/* $Id: rsisamb.c,v 1.11 2004-08-04 09:59:03 heikki Exp $
    Copyright (C) 1995,1996,1997,1998,1999,2000,2001,2002,2003,2004
    Index Data Aps
 
@@ -39,7 +39,7 @@ static void r_rewind (RSFD rfd);
 static int r_forward(RSET ct, RSFD rfd, void *buf, int *term_index,
                      int (*cmpfunc)(const void *p1, const void *p2),
                      const void *untilbuf);
-static void r_pos (RSFD rfd, int *current, int *total);
+static void r_pos (RSFD rfd, zint *current, zint *total);
 static int r_read (RSFD rfd, void *buf, int *term_index);
 static int r_write (RSFD rfd, const void *buf);
 
@@ -172,7 +172,7 @@ static int r_forward(RSET ct, RSFD rfd, void *buf, int *term_index,
     return i;
 }
 
-static void r_pos (RSFD rfd, int *current, int *total)
+static void r_pos (RSFD rfd, zint *current, zint *total)
 {
     struct rset_pp_info *pinfo = (struct rset_pp_info *) rfd;
     assert(rfd);
index 30f3cd7..7ebdc4b 100644 (file)
@@ -1,4 +1,4 @@
-/* $Id: rsisams.c,v 1.6 2004-08-03 14:54:41 heikki Exp $
+/* $Id: rsisams.c,v 1.7 2004-08-04 09:59:03 heikki Exp $
    Copyright (C) 1995,1996,1997,1998,1999,2000,2001,2002
    Index Data Aps
 
@@ -24,8 +24,8 @@ Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA
 
 #include <stdio.h>
 #include <assert.h>
-#include <rsisams.h>
 #include <zebrautl.h>
+#include <rsisams.h>
 
 static void *r_create(RSET ct, const struct rset_control *sel, void *parms);
 static RSFD r_open (RSET ct, int flag);
index e2bf398..c02ff4f 100644 (file)
@@ -1,4 +1,4 @@
-/* $Id: rsnull.c,v 1.18 2004-08-03 14:54:41 heikki Exp $
+/* $Id: rsnull.c,v 1.19 2004-08-04 09:59:03 heikki Exp $
    Copyright (C) 1995,1996,1997,1998,1999,2000,2001,2002
    Index Data Aps
 
@@ -24,15 +24,15 @@ Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA
 
 #include <stdio.h>
 #include <assert.h>
-#include <rsnull.h>
 #include <zebrautl.h>
+#include <rsnull.h>
 
 static void *r_create(RSET ct, const struct rset_control *sel, void *parms);
 static RSFD r_open (RSET ct, int flag);
 static void r_close (RSFD rfd);
 static void r_delete (RSET ct);
 static void r_rewind (RSFD rfd);
-static void r_pos (RSFD rfd, int *current, int *total);
+static void r_pos (RSFD rfd, zint *current, zint *total);
 static int r_read (RSFD rfd, void *buf, int *term_index);
 static int r_write (RSFD rfd, const void *buf);
 
@@ -93,7 +93,7 @@ static void r_rewind (RSFD rfd)
     logf (LOG_DEBUG, "rsnull_rewind");
 }
 
-static void r_pos (RSFD rfd, int *current, int *total)
+static void r_pos (RSFD rfd, zint *current, zint *total)
 {
     assert(rfd);
     assert(current);
index 9090495..60f80ab 100644 (file)
@@ -1,4 +1,4 @@
-/* $Id: rsprox.c,v 1.5 2004-08-03 14:54:41 heikki Exp $
+/* $Id: rsprox.c,v 1.6 2004-08-04 09:59:03 heikki Exp $
    Copyright (C) 1995,1996,1997,1998,1999,2000,2001,2002,2003,2004
    Index Data Aps
 
@@ -25,8 +25,8 @@ Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA
 #include <string.h>
 #include <assert.h>
 
-#include <rsprox.h>
 #include <zebrautl.h>
+#include <rsprox.h>
 
 #ifndef RSET_DEBUG
 #define RSET_DEBUG 0