+
+static void r_get_terms(RSET ct, TERMID *terms, int maxterms, int *curterm)
+{
+ struct rset_between_info *info = (struct rset_between_info *) ct->priv;
+ rset_getterms(info->rset_m, terms, maxterms, curterm);
+}
+
+/* Better algorithm
+ * One of the major problems with rsbetween is the complexity of keeping track
+ * of start tags, stop tags, hits, and attributes, together with record
+ * boundaries etc.
+ *
+ * Things can be divided into finding the right records, and then processing
+ * hits inside the record.
+ *
+ * Finding the record is mostly a matter of forwarding until we have a start
+ * tag and a hit in the same record.
+ *
+ * Handling stuff inside a record, we can simplify things by implementing a
+ * glorified OR operator that returns all the occurrences in proper order,
+ * together with info on what type it was. Then the main logic can just keep
+ * reading, and consider each type separately:
+ * - if a start tag, increment level (some trickery with attributes!)
+ * - if a stop tag, decrement level
+ * - if a hit, and we have a level, return it
+ * - if a hit, but no level, ignore it
+ *
+ * The attributes can be detected when ever reading start tags. The main
+ * routine needs to keep a stack of attribute match bits, so when ever we read
+ * a start tag, we must report back if we have a matching attribute or not.
+ *
+ */
+