/* 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);
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."));
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 *);
{
struct agr_var *iter;
double weight;
- int bad_warn = 1;
+ bool bad_warn = true;
weight = dict_get_case_weight (default_dict, input, &bad_warn);
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);
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);
/* 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. */
-static int bad_weight_warn = 1;
+static bool bad_weight_warn = true;
/* Perform calculations for the sub factors */
{
double weight;
size_t i;
- int bad_warn = 1;
+ bool bad_warn = true;
weight = dict_get_case_weight (default_dict, c, &bad_warn);
-static int bad_weight_warn = 1;
+static bool bad_weight_warn = true;
static struct cmd_oneway 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);
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,
else
value_is_missing = mv_is_value_missing;
- bad_weight_warn = 1;
+ bad_weight_warn = true;
ok = multipass_procedure_with_splits (calculate, &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 */
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 )
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 */
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) )
{
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 )
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;
}
/* 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(). */
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 *);