More work on boolean sets.
[idzebra-moved-to-github.git] / include / rset.h
1 /*
2  * Copyright (C) 1994-1995, Index Data I/S 
3  * All rights reserved.
4  * Sebastian Hammer, Adam Dickmeiss
5  *
6  * $Log: rset.h,v $
7  * Revision 1.6  1995-09-06 16:10:58  adam
8  * More work on boolean sets.
9  *
10  * Revision 1.5  1995/09/04  15:20:13  adam
11  * More work on temp sets. is_open member removed.
12  *
13  * Revision 1.4  1995/09/04  09:09:52  adam
14  * String arg in dict lookup is const.
15  * Minor changes.
16  *
17  * Revision 1.3  1994/11/22  13:15:27  quinn
18  * Simple
19  *
20  * Revision 1.2  1994/11/04  13:21:21  quinn
21  * Working.
22  *
23  * Revision 1.1  1994/11/03  14:13:22  quinn
24  * Result set manipulation
25  *
26  */
27
28 #ifndef RSET_H
29 #define RSET_H
30
31 #include <stdlib.h>
32
33 typedef struct rset_control
34 {
35     char *desc; /* text description of set type (for debugging) */
36     void *buf;  /* state data stored by subsystem */
37     struct rset_control *(*f_create)(const struct rset_control *sel, void *parms);
38     int (*f_open)(struct rset_control *ct, int wflag);
39     void (*f_close)(struct rset_control *ct);
40     void (*f_delete)(struct rset_control *ct);
41     void (*f_rewind)(struct rset_control *ct);
42     int (*f_count)(struct rset_control *ct);
43     int (*f_read)(struct rset_control *ct, void *buf);
44     int (*f_write)(struct rset_control *ct, const void *buf);
45 } rset_control;
46
47 typedef struct rset
48 {
49     rset_control *control;
50 } rset, *RSET;
51
52 RSET rset_create(const rset_control *sel, void *parms);       /* parameters? */
53
54 /* int rset_open(RSET rs, int wflag); */
55 #define rset_open(rs, wflag) ((*(rs)->control->f_open)((rs)->control, (wflag)))
56
57 /* void rset_close(RSET rs); */
58 #define rset_close(rs) ((*(rs)->control->f_close)((rs)->control))
59
60 void rset_delete(RSET rs);
61
62 /* void rset_rewind(RSET rs); */
63 #define rset_rewind(rs) ((*(rs)->control->f_rewind)((rs)->control))
64
65 /* int rset_count(RSET rs); */
66 #define rset_count(rs) ((*(rs)->control->f_count)((rs)->control))
67
68 /* int rset_read(RSET rs, void *buf); */
69 #define rset_read(rs, buf) ((*(rs)->control->f_read)((rs)->control, (buf)))
70
71 /* int rset_write(RSET rs, const void *buf); */
72 #define rset_write(rs, buf) ((*(rs)->control->f_write)((rs)->control, (buf)))
73
74 #endif