More work on boolean sets.
authorAdam Dickmeiss <adam@indexdata.dk>
Wed, 6 Sep 1995 16:10:57 +0000 (16:10 +0000)
committerAdam Dickmeiss <adam@indexdata.dk>
Wed, 6 Sep 1995 16:10:57 +0000 (16:10 +0000)
include/isam.h
include/rsbool.h
include/rset.h
rset/rsbool.c
rset/rset.c
rset/rsisam.c
rset/rstemp.c

index 2051bf5..e38edc1 100644 (file)
@@ -4,7 +4,10 @@
  * Sebastian Hammer, Adam Dickmeiss
  *
  * $Log: isam.h,v $
- * Revision 1.9  1994-09-28 16:58:26  quinn
+ * Revision 1.10  1995-09-06 16:10:57  adam
+ * More work on boolean sets.
+ *
+ * Revision 1.9  1994/09/28  16:58:26  quinn
  * Small mod.
  *
  * Revision 1.8  1994/09/28  12:56:09  quinn
@@ -98,7 +101,7 @@ typedef struct ispt_struct
  * Open isam file.
  */
 ISAM is_open(const char *name, int (*cmp)(const void *p1, const void *p2),
-    int writeflag);
+    int writeflag, int keysize);
 
 /*
  * Close isam file.
index 2a636ce..03dccc1 100644 (file)
@@ -4,7 +4,10 @@
  * Sebastian Hammer, Adam Dickmeiss
  *
  * $Log: rsbool.h,v $
- * Revision 1.1  1995-09-06 13:27:37  adam
+ * Revision 1.2  1995-09-06 16:10:57  adam
+ * More work on boolean sets.
+ *
+ * Revision 1.1  1995/09/06  13:27:37  adam
  * New set type: bool. Not finished yet.
  *
  */
@@ -20,6 +23,9 @@ typedef struct rset_bool_parms
 {
     int     key_size;
     int     op;
+    RSET    rset_l;
+    RSET    rset_r;
+    int (*cmp)(const void *p1, const void *p2);
 } rset_bool_parms;
 
 #endif
index 69496a3..b370071 100644 (file)
@@ -1,10 +1,13 @@
 /*
- * Copyright (C) 1994, Index Data I/S 
+ * Copyright (C) 1994-1995, Index Data I/S 
  * All rights reserved.
  * Sebastian Hammer, Adam Dickmeiss
  *
  * $Log: rset.h,v $
- * Revision 1.5  1995-09-04 15:20:13  adam
+ * Revision 1.6  1995-09-06 16:10:58  adam
+ * More work on boolean sets.
+ *
+ * Revision 1.5  1995/09/04  15:20:13  adam
  * More work on temp sets. is_open member removed.
  *
  * Revision 1.4  1995/09/04  09:09:52  adam
@@ -57,10 +60,10 @@ RSET rset_create(const rset_control *sel, void *parms);       /* parameters? */
 void rset_delete(RSET rs);
 
 /* void rset_rewind(RSET rs); */
-#define rset_rewind(rs, wflag) ((*(rs)->control->f_rewind)((rs)->control))
+#define rset_rewind(rs) ((*(rs)->control->f_rewind)((rs)->control))
 
 /* int rset_count(RSET rs); */
-#define rset_count(rs, wflag) ((*(rs)->control->f_count)((rs)->control))
+#define rset_count(rs) ((*(rs)->control->f_count)((rs)->control))
 
 /* int rset_read(RSET rs, void *buf); */
 #define rset_read(rs, buf) ((*(rs)->control->f_read)((rs)->control, (buf)))
index c4aee9c..d1bddb8 100644 (file)
@@ -4,7 +4,10 @@
  * Sebastian Hammer, Adam Dickmeiss
  *
  * $Log: rsbool.c,v $
- * Revision 1.1  1995-09-06 13:27:15  adam
+ * Revision 1.2  1995-09-06 16:11:55  adam
+ * More work on boolean sets.
+ *
+ * Revision 1.1  1995/09/06  13:27:15  adam
  * New set type: bool. Not finished yet.
  *
  */
@@ -41,6 +44,13 @@ const rset_control *rset_kind_bool = &control;
 struct rset_bool_info {
     int key_size;
     int op;
+    RSET rset_l;
+    RSET rset_r;
+    int more_l;
+    int more_r;
+    void *buf_l;
+    void *buf_r;
+    int (*cmp)(const void *p1, const void *p2);
 };
 
 static rset_control *r_create(const struct rset_control *sel, void *parms)
@@ -51,37 +61,62 @@ static rset_control *r_create(const struct rset_control *sel, void *parms)
 
     logf (LOG_DEBUG, "rsbool_create(%s)", sel->desc);
     newct = xmalloc(sizeof(*newct));
-    memcpy(newct, sel, sizeof(*sel));
+    memcpy (newct, sel, sizeof(*sel));
     newct->buf = xmalloc (sizeof(struct rset_bool_info));
     info = (struct rset_bool_info*) newct->buf;
     info->key_size = bool_parms->key_size;
     info->op = bool_parms->op;
+    info->rset_l = bool_parms->rset_l;
+    info->rset_r = bool_parms->rset_r;
+    info->cmp = bool_parms->cmp;
+    info->buf_l = xmalloc (info->key_size);
+    info->buf_r = xmalloc (info->key_size);
     return newct;
 }
 
 static int r_open(rset_control *ct, int wflag)
 {
+    struct rset_bool_info *info = ct->buf;
+
     if (wflag)
     {
        logf (LOG_FATAL, "bool set type is read-only");
        return -1;
     }
+    rset_open (info->rset_l, wflag);
+    rset_open (info->rset_r, wflag);
+    info->more_l = rset_read (info->rset_l, info->buf_l);
+    info->more_r = rset_read (info->rset_r, info->buf_r);
     return 0;
 }
 
 static void r_close(rset_control *ct)
 {
-    /* NOP */
+    struct rset_bool_info *info = ct->buf;
+
+    rset_close (info->rset_l);
+    rset_close (info->rset_r);
 }
 
 static void r_delete(rset_control *ct)
 {
-    xfree(ct);
+    struct rset_bool_info *info = ct->buf;
+
+    rset_delete (info->rset_l);
+    rset_delete (info->rset_r);
+    xfree (info->buf_l);
+    xfree (info->buf_r);
+    xfree (ct->buf);
+    xfree (ct);
 }
 
 static void r_rewind(rset_control *ct)
 {
+    struct rset_bool_info *info = ct->buf;
+
     logf (LOG_DEBUG, "rsbool_rewind");
+    rset_rewind (info->rset_l);
+    rset_rewind (info->rset_r);
 }
 
 static int r_count (rset_control *ct)
@@ -91,6 +126,10 @@ static int r_count (rset_control *ct)
 
 static int r_read (rset_control *ct, void *buf)
 {
+    struct rset_bool_info *info = ct->buf;
+
+    if (!info->more_l && !info->more_r)
+        return 0;
     return 0;
 }
 
index 2b5e57f..0a2f92a 100644 (file)
@@ -1,10 +1,13 @@
 /*
- * Copyright (C) 1994, Index Data I/S 
+ * Copyright (C) 1994-1995, Index Data I/S 
  * All rights reserved.
  * Sebastian Hammer, Adam Dickmeiss
  *
  * $Log: rset.c,v $
- * Revision 1.3  1995-09-04 15:20:39  adam
+ * Revision 1.4  1995-09-06 16:11:56  adam
+ * More work on boolean sets.
+ *
+ * Revision 1.3  1995/09/04  15:20:39  adam
  * More work on temp sets. is_open member removed.
  *
  * Revision 1.2  1995/09/04  12:33:56  adam
index c194bf7..e9f7958 100644 (file)
@@ -1,10 +1,13 @@
 /*
- * Copyright (C) 1994, Index Data I/S 
+ * Copyright (C) 1994-1995, Index Data I/S 
  * All rights reserved.
  * Sebastian Hammer, Adam Dickmeiss
  *
  * $Log: rsisam.c,v $
- * Revision 1.7  1995-09-06 10:35:44  adam
+ * Revision 1.8  1995-09-06 16:11:56  adam
+ * More work on boolean sets.
+ *
+ * Revision 1.7  1995/09/06  10:35:44  adam
  * Null set implemented.
  *
  * Revision 1.6  1995/09/05  11:43:24  adam
index d02cce5..10412c4 100644 (file)
@@ -1,10 +1,13 @@
 /*
- * Copyright (C) 1994, Index Data I/S 
+ * Copyright (C) 1994-1995, Index Data I/S 
  * All rights reserved.
  * Sebastian Hammer, Adam Dickmeiss
  *
  * $Log: rstemp.c,v $
- * Revision 1.5  1995-09-05 16:36:59  adam
+ * Revision 1.6  1995-09-06 16:11:56  adam
+ * More work on boolean sets.
+ *
+ * Revision 1.5  1995/09/05  16:36:59  adam
  * Minor changes.
  *
  * Revision 1.4  1995/09/05  11:43:24  adam