From 2989bae3e4d22437b6f225385f70423851612a2a Mon Sep 17 00:00:00 2001 From: Ben Pfaff Date: Thu, 27 Apr 2006 03:01:57 +0000 Subject: [PATCH] * variable.h: (struct variable) Rename `reinit' member as `leave' and invert sense. Fix up all references. --- src/ChangeLog | 5 +++++ src/data/ChangeLog | 5 +++++ src/data/dictionary.c | 4 ++-- src/data/variable.h | 2 +- src/language/data-io/inpt-pgm.c | 2 +- src/language/dictionary/numeric.c | 6 +----- src/language/xforms/compute.c | 2 +- src/procedure.c | 4 ++-- 8 files changed, 18 insertions(+), 12 deletions(-) diff --git a/src/ChangeLog b/src/ChangeLog index beadbd2c..604fb254 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,8 @@ +Wed Apr 26 20:00:00 2006 Ben Pfaff + + * procedure.c (create_trns_case): Fix inverted decision on whether + numeric values should be initialized to 0 or SYSMIS. + Wed Apr 26 19:48:52 2006 Ben Pfaff Continue reforming procedure execution. In this phase, assert diff --git a/src/data/ChangeLog b/src/data/ChangeLog index 07df9af0..3d8e910e 100644 --- a/src/data/ChangeLog +++ b/src/data/ChangeLog @@ -1,3 +1,8 @@ +Wed Apr 26 20:01:19 2006 Ben Pfaff + + * variable.h: (struct variable) Rename `reinit' member as `leave' + and invert sense. Fix up all references. + Wed Apr 26 19:39:28 2006 Ben Pfaff Continue reforming procedure execution. In this phase, break diff --git a/src/data/dictionary.c b/src/data/dictionary.c index b2fe10cf..ad5b5067 100644 --- a/src/data/dictionary.c +++ b/src/data/dictionary.c @@ -282,7 +282,7 @@ dict_create_var (struct dictionary *d, const char *name, int width) v->width = width; v->fv = d->next_value_idx; v->nv = width == 0 ? 1 : DIV_RND_UP (width, 8); - v->reinit = dict_class_from_id (v->name) != DC_SCRATCH; + v->leave = dict_class_from_id (v->name) == DC_SCRATCH; v->index = d->var_cnt; mv_init (&v->miss, width); if (v->type == NUMERIC) @@ -358,7 +358,7 @@ dict_clone_var (struct dictionary *d, const struct variable *ov, short_name[] is intentionally not copied, because there is no reason to give a new variable with potentially a new name the same short name. */ - nv->reinit = ov->reinit; + nv->leave = ov->leave; mv_copy (&nv->miss, &ov->miss); nv->print = ov->print; nv->write = ov->write; diff --git a/src/data/variable.h b/src/data/variable.h index 3a5015be..fa7c0d6d 100644 --- a/src/data/variable.h +++ b/src/data/variable.h @@ -64,7 +64,7 @@ struct variable /* Case information. */ int fv, nv; /* Index into `value's, number of values. */ - bool reinit; /* True: reinitialize; false: leave. */ + bool leave; /* Leave value from case to case? */ /* Data for use by containing dictionary. */ int index; /* Dictionary index. */ diff --git a/src/language/data-io/inpt-pgm.c b/src/language/data-io/inpt-pgm.c index abda6c93..e24c89b5 100644 --- a/src/language/data-io/inpt-pgm.c +++ b/src/language/data-io/inpt-pgm.c @@ -124,7 +124,7 @@ cmd_input_program (void) size_t j; value_init = var->type == NUMERIC ? INP_NUMERIC : INP_STRING; - value_init |= var->reinit ? INP_REINIT : INP_INIT_ONCE; + value_init |= var->leave ? INP_INIT_ONCE : INP_REINIT; for (j = 0; j < var->nv; j++) inp->init[j + var->fv] = value_init; diff --git a/src/language/dictionary/numeric.c b/src/language/dictionary/numeric.c index 826f0ebf..9d94cf3f 100644 --- a/src/language/dictionary/numeric.c +++ b/src/language/dictionary/numeric.c @@ -192,11 +192,7 @@ cmd_leave (void) if (!parse_variables (default_dict, &v, &nv, PV_NONE)) return CMD_CASCADING_FAILURE; for (i = 0; i < nv; i++) - { - if (!v[i]->reinit) - continue; - v[i]->reinit = 0; - } + v[i]->leave = true; free (v); return lex_end_of_command (); diff --git a/src/language/xforms/compute.c b/src/language/xforms/compute.c index ae2ceaf5..e6a17553 100644 --- a/src/language/xforms/compute.c +++ b/src/language/xforms/compute.c @@ -392,7 +392,7 @@ lvalue_finalize (struct lvalue *lvalue, struct compute_trns *compute) /* Goofy behavior, but compatible: Turn off LEAVE. */ if (dict_class_from_id (compute->variable->name) != DC_SCRATCH) - compute->variable->reinit = 1; + compute->variable->leave = false; } else { diff --git a/src/procedure.c b/src/procedure.c index 725e8ec5..7dcd37ba 100644 --- a/src/procedure.c +++ b/src/procedure.c @@ -227,7 +227,7 @@ create_trns_case (struct ccase *trns_case, struct dictionary *dict) union value *value = case_data_rw (trns_case, v->fv); if (v->type == NUMERIC) - value->f = v->reinit ? 0.0 : SYSMIS; + value->f = v->leave ? 0.0 : SYSMIS; else memset (value->s, ' ', v->width); } @@ -428,7 +428,7 @@ clear_case (struct ccase *c) for (i = 0; i < var_cnt; i++) { struct variable *v = dict_get_var (default_dict, i); - if (v->reinit) + if (!v->leave) { if (v->type == NUMERIC) case_data_rw (c, v->fv)->f = SYSMIS; -- 2.30.2