the case passed to procedure()'s callback.
Updated all users of procedure() as well.
+Sat May 6 10:58:05 2006 Ben Pfaff <blp@gnu.org>
+
+ Continue reforming procedure execution. In this phase, add
+ `const' to the case passed to procedure()'s callback.
+
+ Updated all users of procedure() as well.
+
+ * procedure.c: (struct write_case_data) Add "const" to ccase
+ parameter for case_func member.
+ (procedure) Add "const" to ccase parameter for proc_func
+ parameter.
+ (multipass_case_func) Make ccase parameter const.
+ (internal_procedure) Add "const" to ccase parameter for case_func
+ parameter.
+ (split_procedure_case_func) Make ccase parameter const.
+ (multipass_split_case_func) Make ccase parameter const.
+
Sat May 6 10:30:33 2006 Ben Pfaff <blp@gnu.org>
Continue reforming procedure execution. In this phase, get rid of
struct write_case_data
{
/* Function to call for each case. */
- bool (*case_func) (struct ccase *, void *); /* Function. */
- void *aux; /* Auxiliary data. */
+ bool (*case_func) (const struct ccase *, void *);
+ void *aux;
struct ccase trns_case; /* Case used for transformations. */
struct ccase sink_case; /* Case written to sink, if
static void add_filter_trns (void);
static void add_process_if_trns (void);
-static bool internal_procedure (bool (*case_func) (struct ccase *, void *),
+static bool internal_procedure (bool (*case_func) (const struct ccase *,
+ void *),
bool (*end_func) (void *),
void *aux);
static void update_last_vfm_invocation (void);
Returns true if successful, false if an I/O error occurred. */
bool
-procedure (bool (*proc_func) (struct ccase *, void *), void *aux)
+procedure (bool (*proc_func) (const struct ccase *, void *), void *aux)
{
return internal_procedure (proc_func, NULL, aux);
}
/* Case processing function for multipass_procedure(). */
static bool
-multipass_case_func (struct ccase *c, void *aux_data_)
+multipass_case_func (const struct ccase *c, void *aux_data_)
{
struct multipass_aux_data *aux_data = aux_data_;
return casefile_append (aux_data->casefile, c);
Returns true if successful, false if an I/O error occurred (or
if CASE_FUNC or END_FUNC ever returned false). */
static bool
-internal_procedure (bool (*case_func) (struct ccase *, void *),
+internal_procedure (bool (*case_func) (const struct ccase *, void *),
bool (*end_func) (void *),
void *aux)
{
};
static int equal_splits (const struct ccase *, const struct ccase *);
-static bool split_procedure_case_func (struct ccase *c, void *split_aux_);
-static bool split_procedure_end_func (void *split_aux_);
+static bool split_procedure_case_func (const struct ccase *c, void *);
+static bool split_procedure_end_func (void *);
/* Like procedure(), but it automatically breaks the case stream
into SPLIT FILE break groups. Before each group of cases with
/* Case callback used by procedure_with_splits(). */
static bool
-split_procedure_case_func (struct ccase *c, void *split_aux_)
+split_procedure_case_func (const struct ccase *c, void *split_aux_)
{
struct split_aux_data *split_aux = split_aux_;
void *func_aux; /* Auxiliary data. */
};
-static bool multipass_split_case_func (struct ccase *c, void *aux_);
+static bool multipass_split_case_func (const struct ccase *c, void *aux_);
static bool multipass_split_end_func (void *aux_);
static bool multipass_split_output (struct multipass_split_aux_data *);
/* Case callback used by multipass_procedure_with_splits(). */
static bool
-multipass_split_case_func (struct ccase *c, void *aux_)
+multipass_split_case_func (const struct ccase *c, void *aux_)
{
struct multipass_split_aux_data *aux = aux_;
bool ok = true;
void proc_set_sink (struct case_sink *);
struct casefile *proc_capture_output (void);
-bool procedure (bool (*proc_func) (struct ccase *, void *),
+bool procedure (bool (*proc_func) (const struct ccase *, void *),
void *aux);
bool procedure_with_splits (void (*begin_func) (const struct ccase *, void *),
bool (*proc_func) (const struct ccase *, void *),
/* Writes case C to writer AW. */
static bool
-case_writer_write_case (struct case_writer *aw, struct ccase *c)
+case_writer_write_case (struct case_writer *aw, const struct ccase *c)
{
if (aw->map != NULL)
{
\f
/* SAVE and EXPORT. */
-static bool output_proc (struct ccase *, void *);
+static bool output_proc (const struct ccase *, void *);
/* Parses and performs the SAVE or EXPORT procedure. */
static int
/* Writes case C to file. */
static bool
-output_proc (struct ccase *c, void *aw_)
+output_proc (const struct ccase *c, void *aw_)
{
struct case_writer *aw = aw_;
return case_writer_write_case (aw, c);
static bool mtf_read_nonactive_records (void *);
static bool mtf_processing_finish (void *);
-static bool mtf_processing (struct ccase *, void *);
+static bool mtf_processing (const struct ccase *, void *);
static char *var_type_description (struct variable *);
static inline int
mtf_compare_BY_values (struct mtf_proc *mtf,
struct mtf_file *a, struct mtf_file *b,
- struct ccase *c)
+ const struct ccase *c)
{
- struct ccase *ca = case_is_null (&a->input) ? c : &a->input;
- struct ccase *cb = case_is_null (&b->input) ? c : &b->input;
+ const struct ccase *ca = case_is_null (&a->input) ? c : &a->input;
+ const struct ccase *cb = case_is_null (&b->input) ? c : &b->input;
assert ((a == NULL) + (b == NULL) + (c == NULL) <= 1);
return case_compare_2dict (ca, cb, a->by, b->by, mtf->by_cnt);
}
/* Perform one iteration of steps 3...7 above.
Returns true if successful, false if an I/O error occurred. */
static bool
-mtf_processing (struct ccase *c, void *mtf_)
+mtf_processing (const struct ccase *c, void *mtf_)
{
struct mtf_proc *mtf = mtf_;
if (mv != NULL && mtf->seq_nums[mv->index] != mtf->seq_num)
{
- struct ccase *record
+ const struct ccase *record
= case_is_null (&iter->input) ? c : &iter->input;
union value *out = case_data_rw (&mtf->mtf_case, mv->fv);
static void dump_aggregate_info (struct agr_proc *agr, struct ccase *output);
/* Aggregating to the active file. */
-static bool agr_to_active_file (struct ccase *, void *aux);
+static bool agr_to_active_file (const struct ccase *, void *aux);
/* Aggregating to a system file. */
-static bool presorted_agr_to_sysfile (struct ccase *, void *aux);
+static bool presorted_agr_to_sysfile (const struct ccase *, void *aux);
\f
/* Parsing. */
are dropped.
Returns true if successful, false if an I/O error occurred. */
static bool
-agr_to_active_file (struct ccase *c, void *agr_)
+agr_to_active_file (const struct ccase *c, void *agr_)
{
struct agr_proc *agr = agr_;
/* Aggregate the current case and output it if we passed a
breakpoint. */
static bool
-presorted_agr_to_sysfile (struct ccase *c, void *agr_)
+presorted_agr_to_sysfile (const struct ccase *c, void *agr_)
{
struct agr_proc *agr = agr_;
static trns_proc_func autorecode_trns_proc;
static trns_free_func autorecode_trns_free;
-static bool autorecode_proc_func (struct ccase *, void *);
+static bool autorecode_proc_func (const struct ccase *, void *);
static hsh_compare_func compare_alpha_value, compare_numeric_value;
static hsh_hash_func hash_alpha_value, hash_numeric_value;
}
static bool
-autorecode_proc_func (struct ccase *c, void *arc_)
+autorecode_proc_func (const struct ccase *c, void *arc_)
{
struct autorecode_pgm *arc = arc_;
size_t i;