* Sebastian Hammer, Adam Dickmeiss
*
* $Log: rset.h,v $
- * Revision 1.4 1995-09-04 09:09:52 adam
+ * 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
* String arg in dict lookup is const.
* Minor changes.
*
#ifndef RSET_H
#define RSET_H
+#include <stdlib.h>
+
typedef struct rset_control
{
char *desc; /* text description of set type (for debugging) */
- char *buf; /* state data stored by subsystem */
+ void *buf; /* state data stored by subsystem */
struct rset_control *(*f_create)(const struct rset_control *sel, void *parms);
int (*f_open)(struct rset_control *ct, int wflag);
void (*f_close)(struct rset_control *ct);
typedef struct rset
{
- int is_open;
rset_control *control;
} rset, *RSET;
* Sebastian Hammer, Adam Dickmeiss
*
* $Log: rstemp.h,v $
- * Revision 1.1 1994-11-04 13:21:23 quinn
+ * Revision 1.2 1995-09-04 15:20:13 adam
+ * More work on temp sets. is_open member removed.
+ *
+ * Revision 1.1 1994/11/04 13:21:23 quinn
* Working.
*
*/
extern const rset_control *rset_kind_temp;
+typedef struct rset_temp_parms
+{
+ int key_size;
+} rset_temp_parms;
+
#endif
* Sebastian Hammer, Adam Dickmeiss
*
* $Log: rset.c,v $
- * Revision 1.2 1995-09-04 12:33:56 adam
+ * 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
* Various cleanup. YAZ util used instead.
*
* Revision 1.1 1994/11/04 13:21:28 quinn
*
*/
-/* TODO: mem management */
-
#include <stdio.h>
#include <alexutil.h>
void rset_delete(RSET rs)
{
- if (rs->is_open)
- rset_close(rs);
+ rset_close(rs);
(*rs->control->f_delete)(rs->control);
xfree(rs);
}
* Sebastian Hammer, Adam Dickmeiss
*
* $Log: rstemp.c,v $
- * Revision 1.2 1995-09-04 09:10:56 adam
+ * Revision 1.3 1995-09-04 15:20:40 adam
+ * More work on temp sets. is_open member removed.
+ *
+ * Revision 1.2 1995/09/04 09:10:56 adam
* Minor changes.
*
* Revision 1.1 1994/11/04 13:21:30 quinn
*
*/
+#include <stdio.h>
+
+#include <alexutil.h>
#include <rstemp.h>
static struct rset_control *r_create(const struct rset_control *sel,
const rset_control *rset_kind_temp = &control;
-static struct rset_control *r_create(const struct rset_control *sel, void *parms)
-{}
+struct rset_temp_private {
+ int fd;
+ char *fname;
+ size_t key_size;
+ char *buf_mem;
+ size_t buf_size;
+ size_t pos_end;
+ size_t pos_cur;
+ size_t pos_buf;
+};
+
+static struct rset_control *r_create(const struct rset_control *sel,
+ void *parms)
+{
+ rset_control *newct;
+ rset_temp_parms *temp_parms = parms;
+ struct rset_temp_private *info;
+
+ logf (LOG_DEBUG, "ritemp_create(%s)", sel->desc);
+ newct = xmalloc(sizeof(*newct));
+ memcpy(newct, sel, sizeof(*sel));
+ newct->buf = xmalloc (sizeof(struct rset_temp_private));
+ info = newct->buf;
+
+ info->fd = -1;
+ info->fname = NULL;
+ info->key_size = temp_parms->key_size;
+ info->buf_size = 1024;
+ info->buf_mem = xmalloc (info->buf_size);
+ info->pos_cur = 0;
+ info->pos_end = 0;
+ info->pos_buf = 0;
+
+ return newct;
+}
static int r_open(struct rset_control *ct, int wflag)
-{}
+{
+ struct rset_temp_private *info = ct->buf;
+ info->pos_cur = 0;
+ info->pos_buf = 0;
+}
static void r_close(struct rset_control *ct)
{}