- /* Find the set of one or more FILEs whose BY values are
- minimal, as well as the set of zero or more TABLEs whose BY
- values equal those of the minimum FILEs.
-
- After each iteration of the loop, this invariant holds: the
- FILEs with minimum BY values thus far have "sequence"
- members equal to min_sequence, and "min" points to one of
- the mtf_files whose case has those minimum BY values, and
- similarly for TABLEs. */
- min_sequence = 0;
- min = NULL;
- ll_for_each (file, struct mtf_file, ll, &mtf->files)
- if (case_is_null (&file->input))
- file->sequence = -1;
- else if (file->type == MTF_FILE)
- {
- int cmp = min != NULL ? mtf_compare_BY_values (mtf, min, file) : 1;
- if (cmp <= 0)
- file->sequence = cmp < 0 ? -1 : min_sequence;
- else
- {
- file->sequence = ++min_sequence;
- min = file;
- }
- }
- else
- {
- int cmp;
- assert (min != NULL);
- do
+static void
+process_update (struct mtf_proc *mtf)
+{
+ struct ccase *cases;
+ union value *by;
+
+ while (case_matcher_read (mtf->matcher, &cases, &by))
+ {
+ struct mtf_file *min;
+ struct ccase c;
+ size_t min_idx;
+ size_t i;
+
+ create_output_case (mtf, &c);
+ min_idx = find_first_match (cases);
+ min = mtf->files[min_idx];
+ apply_case (min, &cases[min_idx], &c);
+ case_matcher_advance (mtf->matcher, min_idx, &cases[min_idx]);
+ for (i = MAX (1, min_idx); i < mtf->n_files; i++)
+ while (!case_is_null (&cases[i]))