- struct input_program_pgm *inp = source->aux;
- size_t i;
-
- /* Nonzero if there were any END CASE commands in the set of
- transformations. If so, we don't automatically write out
- cases. */
- int end_case = 0;
-
- /* FIXME? This is the number of cases sent out of the input
- program, not the number of cases written to the procedure.
- The difference should only show up in $CASENUM in COMPUTE.
- We should check behavior against SPSS. */
- int cases_written = 0;
-
- assert (inp != NULL);
-
- /* Figure end_case. */
- for (i = 0; i < f_trns; i++)
- if (t_trns[i].proc == end_case_trns_proc)
- end_case = 1;
-
- /* FIXME: This is an ugly kluge. */
- for (i = 0; i < f_trns; i++)
- if (t_trns[i].proc == repeating_data_trns_proc)
- repeating_data_set_write_case (t_trns[i].private, write_case, wc_data);
-
- init_case (inp, c);
- for (;;)
- {
- /* Perform transformations on `blank' case. */
- for (i = 0; i < f_trns; )
- {
- int code;
-
- if (t_trns[i].proc == end_case_trns_proc)
- {
- cases_written++;
- if (!write_case (wc_data))
- return false;
- clear_case (inp, c);
- i++;
- continue;
- }
-
- code = t_trns[i].proc (t_trns[i].private, c, cases_written + 1);
- switch (code)
- {
- case TRNS_CONTINUE:
- i++;
- break;
-
- case TRNS_DROP_CASE:
- abort ();
-
- case TRNS_ERROR:
- return false;
-
- case TRNS_NEXT_CASE:
- goto next_case;
-
- case TRNS_END_FILE:
- return true;