From: John Darrington Date: Sat, 23 Sep 2006 00:15:58 +0000 (+0000) Subject: Changed int to bool in dict_get_weight and sort_active_file_in_place X-Git-Tag: v0.6.0~739 X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=e16d30a43af6ada7b8846f48a55eb3cb8f4e5f22;p=pspp-builds.git Changed int to bool in dict_get_weight and sort_active_file_in_place --- diff --git a/src/data/dictionary.c b/src/data/dictionary.c index 16809032..a7ba0274 100644 --- a/src/data/dictionary.c +++ b/src/data/dictionary.c @@ -687,11 +687,11 @@ dict_get_weight (const struct dictionary *d) /* Returns the value of D's weighting variable in case C, except that a negative weight is returned as 0. Returns 1 if the dictionary is unweighted. Will warn about missing, negative, or zero values if - warn_on_invalid is nonzero. The function will set warn_on_invalid to zero + warn_on_invalid is true. The function will set warn_on_invalid to false if an invalid weight is found. */ double dict_get_case_weight (const struct dictionary *d, const struct ccase *c, - int *warn_on_invalid) + bool *warn_on_invalid) { assert (d != NULL); assert (c != NULL); @@ -704,7 +704,7 @@ dict_get_case_weight (const struct dictionary *d, const struct ccase *c, if (w < 0.0 || mv_is_num_missing (&d->weight->miss, w)) w = 0.0; if ( w == 0.0 && *warn_on_invalid ) { - *warn_on_invalid = 0; + *warn_on_invalid = false; msg (SW, _("At least one case in the data file had a weight value " "that was user-missing, system-missing, zero, or " "negative. These case(s) were ignored.")); diff --git a/src/data/dictionary.h b/src/data/dictionary.h index 1a7e8de0..828b75a9 100644 --- a/src/data/dictionary.h +++ b/src/data/dictionary.h @@ -68,7 +68,7 @@ bool dict_rename_vars (struct dictionary *, struct ccase; struct variable *dict_get_weight (const struct dictionary *); double dict_get_case_weight (const struct dictionary *, - const struct ccase *, int *); + const struct ccase *, bool *); void dict_set_weight (struct dictionary *, struct variable *); struct variable *dict_get_filter (const struct dictionary *); diff --git a/src/language/stats/aggregate.c b/src/language/stats/aggregate.c index 7c8245e0..eaaccf30 100644 --- a/src/language/stats/aggregate.c +++ b/src/language/stats/aggregate.c @@ -743,7 +743,7 @@ accumulate_aggregate_info (struct agr_proc *agr, { struct agr_var *iter; double weight; - int bad_warn = 1; + bool bad_warn = true; weight = dict_get_case_weight (default_dict, input, &bad_warn); diff --git a/src/language/stats/crosstabs.q b/src/language/stats/crosstabs.q index a2115cef..d67fb62c 100644 --- a/src/language/stats/crosstabs.q +++ b/src/language/stats/crosstabs.q @@ -564,7 +564,7 @@ precalc (const struct ccase *first, void *aux UNUSED) static bool calc_general (const struct ccase *c, void *aux UNUSED) { - int bad_warn = 1; + bool bad_warn = true; /* Case weight. */ double weight = dict_get_case_weight (default_dict, c, &bad_warn); @@ -638,7 +638,7 @@ calc_general (const struct ccase *c, void *aux UNUSED) static bool calc_integer (const struct ccase *c, void *aux UNUSED) { - int bad_warn = 1; + bool bad_warn = true; /* Case weight. */ double weight = dict_get_case_weight (default_dict, c, &bad_warn); diff --git a/src/language/stats/descriptives.c b/src/language/stats/descriptives.c index 958c00d8..eaf9bb7f 100644 --- a/src/language/stats/descriptives.c +++ b/src/language/stats/descriptives.c @@ -159,7 +159,7 @@ struct dsc_proc /* Accumulated results. */ double missing_listwise; /* Sum of weights of cases missing listwise. */ double valid; /* Sum of weights of valid cases. */ - int bad_warn; /* Warn if bad weight found. */ + bool bad_warn; /* Warn if bad weight found. */ enum dsc_statistic sort_by_stat; /* Statistic to sort by; -1: name. */ int sort_ascending; /* !0: ascending order; 0: descending. */ unsigned long show_stats; /* Statistics to display. */ diff --git a/src/language/stats/examine.q b/src/language/stats/examine.q index c930cf01..443aaa17 100644 --- a/src/language/stats/examine.q +++ b/src/language/stats/examine.q @@ -618,7 +618,7 @@ void populate_summary(struct tab_table *t, int col, int row, -static int bad_weight_warn = 1; +static bool bad_weight_warn = true; /* Perform calculations for the sub factors */ diff --git a/src/language/stats/frequencies.q b/src/language/stats/frequencies.q index c1e40d62..7174cf4c 100644 --- a/src/language/stats/frequencies.q +++ b/src/language/stats/frequencies.q @@ -509,7 +509,7 @@ calc (const struct ccase *c, void *aux UNUSED) { double weight; size_t i; - int bad_warn = 1; + bool bad_warn = true; weight = dict_get_case_weight (default_dict, c, &bad_warn); diff --git a/src/language/stats/oneway.q b/src/language/stats/oneway.q index cda3c17b..bdf1ec90 100644 --- a/src/language/stats/oneway.q +++ b/src/language/stats/oneway.q @@ -67,7 +67,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA -static int bad_weight_warn = 1; +static bool bad_weight_warn = true; static struct cmd_oneway cmd; @@ -917,7 +917,7 @@ run_oneway(const struct ccase *first, const struct casefile *cf, void *cmd_) size_t i; const double weight = - dict_get_case_weight(default_dict,&c,&bad_weight_warn); + dict_get_case_weight (default_dict, &c, &bad_weight_warn); const union value *indep_val = case_data (&c, indep_var->fv); diff --git a/src/language/stats/t-test.q b/src/language/stats/t-test.q index 9e332df8..1f182ec8 100644 --- a/src/language/stats/t-test.q +++ b/src/language/stats/t-test.q @@ -242,7 +242,7 @@ static int mode; static struct cmd_t_test cmd; -static int bad_weight_warn; +static bool bad_weight_warn = false; static int compare_group_binary(const struct group_statistics *a, @@ -343,7 +343,7 @@ cmd_t_test(void) else value_is_missing = mv_is_value_missing; - bad_weight_warn = 1; + bad_weight_warn = true; ok = multipass_procedure_with_splits (calculate, &cmd); @@ -1416,7 +1416,7 @@ common_calc (const struct ccase *c, void *_cmd) int i; struct cmd_t_test *cmd = (struct cmd_t_test *)_cmd; - double weight = dict_get_case_weight(default_dict,c,&bad_weight_warn); + double weight = dict_get_case_weight (default_dict, c, &bad_weight_warn); /* Skip the entire case if /MISSING=LISTWISE is set */ @@ -1516,7 +1516,7 @@ one_sample_calc (const struct ccase *c, void *cmd_) struct cmd_t_test *cmd = (struct cmd_t_test *)cmd_; - double weight = dict_get_case_weight(default_dict,c,&bad_weight_warn); + double weight = dict_get_case_weight (default_dict, c, &bad_weight_warn); /* Skip the entire case if /MISSING=LISTWISE is set */ if ( cmd->miss == TTS_LISTWISE ) @@ -1606,7 +1606,7 @@ paired_calc (const struct ccase *c, void *cmd_) struct cmd_t_test *cmd = (struct cmd_t_test *) cmd_; - double weight = dict_get_case_weight(default_dict,c,&bad_weight_warn); + double weight = dict_get_case_weight (default_dict, c, &bad_weight_warn); /* Skip the entire case if /MISSING=LISTWISE is set , AND one member of a pair is missing */ @@ -1751,7 +1751,8 @@ group_calc (const struct ccase *c, struct cmd_t_test *cmd) const union value *gv = case_data (c, indep_var->fv); - const double weight = dict_get_case_weight(default_dict,c,&bad_weight_warn); + const double weight = + dict_get_case_weight (default_dict, c, &bad_weight_warn); if ( value_is_missing(&indep_var->miss, gv) ) { diff --git a/src/math/levene.c b/src/math/levene.c index 86a32e7a..92044010 100644 --- a/src/math/levene.c +++ b/src/math/levene.c @@ -187,11 +187,11 @@ static int levene_calc (const struct ccase *c, void *_l) { size_t i; - int warn = 0; + bool warn = false; struct levene_info *l = (struct levene_info *) _l; const union value *gv = case_data (c, l->v_indep->fv); struct group_statistics key; - double weight = dict_get_case_weight(default_dict,c,&warn); + double weight = dict_get_case_weight (default_dict, c, &warn); /* Skip the entire case if /MISSING=LISTWISE is set */ if ( l->missing == LEV_LISTWISE ) @@ -291,11 +291,11 @@ static int levene2_calc (const struct ccase *c, void *_l) { size_t i; - int warn = 0; + bool warn = false; struct levene_info *l = (struct levene_info *) _l; - double weight = dict_get_case_weight(default_dict,c,&warn); + double weight = dict_get_case_weight (default_dict, c, &warn); const union value *gv = case_data (c, l->v_indep->fv); struct group_statistics key; diff --git a/src/math/sort.c b/src/math/sort.c index 732c4b86..90bbdf64 100644 --- a/src/math/sort.c +++ b/src/math/sort.c @@ -67,23 +67,23 @@ prepare_to_sort_active_file (void) } /* Sorts the active file in-place according to CRITERIA. - Returns nonzero if successful. */ -int + Returns true if successful. */ +bool sort_active_file_in_place (const struct sort_criteria *criteria) { struct casefile *in, *out; prepare_to_sort_active_file (); if (!procedure (NULL, NULL)) - return 0; + return false; in = proc_capture_output (); out = sort_execute (casefile_get_destructive_reader (in), criteria); if (out == NULL) - return 0; + return false; proc_set_source (storage_source_create (out)); - return 1; + return true; } /* Data passed to sort_to_casefile_callback(). */ diff --git a/src/math/sort.h b/src/math/sort.h index 267384b2..bccf494a 100644 --- a/src/math/sort.h +++ b/src/math/sort.h @@ -60,7 +60,7 @@ void sort_destroy_criteria (struct sort_criteria *); struct casefile *sort_execute (struct casereader *, const struct sort_criteria *); -int sort_active_file_in_place (const struct sort_criteria *); +bool sort_active_file_in_place (const struct sort_criteria *); struct casefile *sort_active_file_to_casefile (const struct sort_criteria *);