From: Adam Dickmeiss Date: Wed, 6 Sep 1995 13:27:15 +0000 (+0000) Subject: New set type: bool. Not finished yet. X-Git-Tag: ZEBRA.1.0~772 X-Git-Url: http://git.indexdata.com/?p=idzebra-moved-to-github.git;a=commitdiff_plain;h=1d0ee69119ae254a033b5c9e25aad14b3e627f9e New set type: bool. Not finished yet. --- diff --git a/include/rsbool.h b/include/rsbool.h new file mode 100644 index 0000000..2a636ce --- /dev/null +++ b/include/rsbool.h @@ -0,0 +1,25 @@ +/* + * Copyright (C) 1994-1995, Index Data I/S + * All rights reserved. + * Sebastian Hammer, Adam Dickmeiss + * + * $Log: rsbool.h,v $ + * Revision 1.1 1995-09-06 13:27:37 adam + * New set type: bool. Not finished yet. + * + */ + +#ifndef RSET_BOOL_H +#define RSET_BOOL_H + +#include + +extern const rset_control *rset_kind_bool; + +typedef struct rset_bool_parms +{ + int key_size; + int op; +} rset_bool_parms; + +#endif diff --git a/rset/Makefile b/rset/Makefile index 362b5d0..7769f03 100644 --- a/rset/Makefile +++ b/rset/Makefile @@ -1,7 +1,7 @@ # Copyright (C) 1994, Index Data I/S # All rights reserved. # Sebastian Hammer, Adam Dickmeiss -# $Id: Makefile,v 1.5 1995-09-06 10:35:44 adam Exp $ +# $Id: Makefile,v 1.6 1995-09-06 13:27:15 adam Exp $ SHELL=/bin/sh RANLIB=ranlib @@ -11,7 +11,7 @@ INCLUDE=-I../include -I$(YAZ)/include DEFS=$(INCLUDE) LIB=../lib/rset.a PROG= -PO=rset.o rstemp.o rsisam.o rsnull.o +PO=rset.o rstemp.o rsisam.o rsnull.o rsbool.o CPP=cc -E all: $(LIB) diff --git a/rset/rsbool.c b/rset/rsbool.c new file mode 100644 index 0000000..c4aee9c --- /dev/null +++ b/rset/rsbool.c @@ -0,0 +1,101 @@ +/* + * Copyright (C) 1994-1995, Index Data I/S + * All rights reserved. + * Sebastian Hammer, Adam Dickmeiss + * + * $Log: rsbool.c,v $ + * Revision 1.1 1995-09-06 13:27:15 adam + * New set type: bool. Not finished yet. + * + */ + +#include +#include +#include + +static rset_control *r_create(const struct rset_control *sel, void *parms); +static int r_open (rset_control *ct, int wflag); +static void r_close (rset_control *ct); +static void r_delete (rset_control *ct); +static void r_rewind (rset_control *ct); +static int r_count (rset_control *ct); +static int r_read (rset_control *ct, void *buf); +static int r_write (rset_control *ct, const void *buf); + +static const rset_control control = +{ + "BOOL set type", + 0, + r_create, + r_open, + r_close, + r_delete, + r_rewind, + r_count, + r_read, + r_write +}; + +const rset_control *rset_kind_bool = &control; + +struct rset_bool_info { + int key_size; + int op; +}; + +static rset_control *r_create(const struct rset_control *sel, void *parms) +{ + rset_control *newct; + rset_bool_parms *bool_parms = parms; + struct rset_bool_info *info; + + logf (LOG_DEBUG, "rsbool_create(%s)", sel->desc); + newct = xmalloc(sizeof(*newct)); + 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; + return newct; +} + +static int r_open(rset_control *ct, int wflag) +{ + if (wflag) + { + logf (LOG_FATAL, "bool set type is read-only"); + return -1; + } + return 0; +} + +static void r_close(rset_control *ct) +{ + /* NOP */ +} + +static void r_delete(rset_control *ct) +{ + xfree(ct); +} + +static void r_rewind(rset_control *ct) +{ + logf (LOG_DEBUG, "rsbool_rewind"); +} + +static int r_count (rset_control *ct) +{ + return 0; +} + +static int r_read (rset_control *ct, void *buf) +{ + return 0; +} + +static int r_write (rset_control *ct, const void *buf) +{ + logf (LOG_FATAL, "bool set type is read-only"); + return -1; +}