- char *desc; /* text description of set type (for debugging) */
- 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);
- void (*f_delete)(struct rset_control *ct);
- void (*f_rewind)(struct rset_control *ct);
- int (*f_count)(struct rset_control *ct);
- int (*f_read)(struct rset_control *ct, void *buf);
- int (*f_write)(struct rset_control *ct, const void *buf);
-} rset_control;
+ /** text description of set type (for debugging) */
+ char *desc;
+/* RSET rs_something_create(const struct rset_control *sel, ...); */
+ void (*f_delete)(RSET ct);
+
+ /** recursively fills the terms array with terms. call with curterm=0 */
+ /* always counts them all into cur, but of course won't touch the term */
+ /* array past max. You can use this to count, set max=0 */
+ void (*f_getterms)(RSET ct, TERMID *terms, int maxterms, int *curterm);
+
+ RSFD (*f_open)(RSET ct, int wflag);
+ void (*f_close)(RSFD rfd);
+ /** forward behaves like a read, but it skips some items first */
+ int (*f_forward)(RSFD rfd, void *buf, TERMID *term, const void *untilbuf);
+ void (*f_pos)(RSFD rfd, double *current, double *total);
+ /* returns -1,-1 if pos function not implemented for this type */
+ int (*f_read)(RSFD rfd, void *buf, TERMID *term);
+ int (*f_write)(RSFD rfd, const void *buf);
+};
+
+/** rset_default_forward implements a generic forward with a read-loop */
+int rset_default_forward(RSFD rfd, void *buf, TERMID *term,
+ const void *untilbuf);
+
+/** rset_default_read implements a generic read */
+int rset_default_read(RSFD rfd, void *buf, TERMID *term);
+
+void rset_get_one_term(RSET ct,TERMID *terms,int maxterms,int *curterm);
+
+/**
+ * key_control contains all there is to know about the keys stored in
+ * an isam, and therefore operated by the rsets. Other than this info,
+ * all we assume is that all keys are the same size, and they can be
+ * memcpy'd around
+ */
+struct rset_key_control {
+ void *context;
+ int key_size;
+ int scope; /* default for what level we operate (book/chapter/verse) on*/
+ /* usual sysno/seqno is 2 */
+ int (*cmp)(const void *p1, const void *p2);
+ void (*key_logdump_txt) (int logmask, const void *p, const char *txt);
+ zint (*getseq)(const void *p);
+ zint (*get_segment)(const void *p);
+ int (*filter_func)(const void *p, void *data);
+ void *filter_data;
+ void (*inc)(struct rset_key_control *kc);
+ void (*dec)(struct rset_key_control *kc);
+ /* FIXME - Should not need a getseq, it won't make much sense with */
+ /* higher-order keys. Use a (generalized) cmp instead, or something */
+ /* FIXME - decode and encode, and lots of other stuff */
+};