-/* Sets all the lag-related variables based on value of n_lag. */
-static void
-setup_lag (void)
-{
- int i;
-
- if (n_lag == 0)
- return;
-
- lag_count = 0;
- lag_head = 0;
- lag_queue = xmalloc (n_lag * sizeof *lag_queue);
- for (i = 0; i < n_lag; i++)
- lag_queue[i] = xmalloc (dict_get_case_size (temp_dict));
-}
-
-/* There is a lot of potential confusion in the vfm and related
- routines over the number of `value's at each stage of the process.
- Here is each nval count, with explanation, as set up by
- open_active_file():
-
- vfm_source_info.nval: Number of `value's in the cases returned by
- the source stream. This value turns out not to be very useful, but
- we maintain it anyway.
-
- vfm_sink_info.nval: Number of `value's in the cases after all
- transformations have been performed. Never less than
- vfm_source_info.nval.
-
- temp_dict->nval: Number of `value's in the cases after the
- transformations leading up to TEMPORARY have been performed. If
- TEMPORARY was not specified, this is equal to vfm_sink_info.nval.
- Never less than vfm_sink_info.nval.
-
- compaction_nval: Number of `value's in the cases after the
- transformations leading up to TEMPORARY have been performed and the
- case has been compacted by compact_case(), if compaction is
- necessary. This the number of `value's in the cases saved by the
- sink stream. (However, note that the cases passed to the sink
- stream have not yet been compacted. It is the responsibility of
- the data sink to call compact_case().) This may be less than,
- greater than, or equal to vfm_source_info.nval. `compaction'
- becomes the new value of default_dict.nval after the procedure is
- completed.
-
- default_dict.nval: This is often an alias for temp_dict->nval. As
- such it can really have no separate existence until the procedure
- is complete. For this reason it should *not* be referenced inside
- the execution of a procedure. */
-/* Makes all preparations for reading from the data source and writing
- to the data sink. */
-static void
-open_active_file (void)
-{
- /* Sometimes we want to refer to the dictionary that applies to the
- data actually written to the sink. This is either temp_dict or
- default_dict. However, if TEMPORARY is not on, then temp_dict
- does not apply. So, we can set temp_dict to default_dict in this
- case. */
- if (!temporary)
- {
- temp_trns = n_trns;
- temp_dict = default_dict;
- }
-
- /* No cases passed to the procedure yet. */
- case_count = 0;
-
- /* The rest. */
- prepare_for_writing ();
- arrange_compaction ();
- make_temp_case ();
- vector_initialization ();
- discard_ctl_stack ();
- setup_lag ();
-
- /* Debug output. */
- debug_printf (("vfm: reading from %s source, writing to %s sink.\n",
- vfm_source->name, vfm_sink->name));
- debug_printf (("vfm: vfm_source_info.nval=%d, vfm_sink_info.nval=%d, "
- "temp_dict->nval=%d, compaction_nval=%d, "
- "default_dict.nval=%d\n",
- vfm_source_info.nval, vfm_sink_info.nval, temp_dict->nval,
- compaction_nval, default_dict.nval));
-}
-\f