- case_count = 0;
- initialize_aggregate_info ();
-
- /* How to implement all this... There are three important variables:
- whether output is going to the active file (0) or a separate file
- (1); whether the input data is presorted (0) or needs sorting
- (1); whether there is a temporary transformation (1) or not (0).
- The eight cases are as follows:
-
- 000 (0): Pass it through an aggregate transformation that
- modifies the data.
-
- 001 (1): Cancel the temporary transformation and handle as 000.
-
- 010 (2): Set up a SORT CASES and aggregate the output, writing
- the results to the active file.
-
- 011 (3): Cancel the temporary transformation and handle as 010.
-
- 100 (4): Pass it through an aggregate transformation that doesn't
- modify the data but merely writes it to the output file.
-
- 101 (5): Handled as 100.
-
- 110 (6): Set up a SORT CASES and capture the output, aggregate
- it, write it to the output file without modifying the active
- file.
-
- 111 (7): Handled as 110. */
-
- {
- unsigned type = 0;
-
- if (outfile != NULL)
- type |= 4;
- if (nv_sort != 0 && (seen & 4) == 0)
- type |= 2;
- if (temporary)
- type |= 1;
-
- switch (type)
- {
- case 3:
- cancel_temporary ();
- /* fall through */
- case 2:
- sort_cases (0);
- goto case0;
-
- case 1:
- cancel_temporary ();
- /* fall through */
- case 0:
- case0:
- {
- struct trns_header *t = xmalloc (sizeof *t);
- t->proc = agr_00x_trns_proc;
- t->free = NULL;
- add_transformation (t);
-
- temporary = 2;
- temp_dict = agr_dict;
- temp_trns = n_trns;
-
- agr_dict = NULL;
-
- procedure (NULL, NULL, agr_00x_end_func);
- break;
- }
-
- case 4:
- case 5:
- {
- if (!create_sysfile ())
- goto lossage;
-
- {
- struct trns_header *t = xmalloc (sizeof *t);
- t->proc = agr_10x_trns_proc;
- t->free = agr_10x_trns_free;
- add_transformation (t);
-
- procedure (NULL, NULL, agr_10x_end_func);
- }
-
- break;
- }
-
- case 6:
- case 7:
- sort_cases (1);
-
- if (!create_sysfile ())
- goto lossage;
- read_sort_output (agr_11x_func);
-
- {
- struct ccase *save_temp_case = temp_case;
- temp_case = NULL;
- agr_11x_func ();
- temp_case = save_temp_case;
- }
-
- break;