Just a convenience.
}
}
+/* Returns the format to use for weights. */
+const struct fmt_spec *
+dict_get_weight_format (const struct dictionary *d)
+{
+ return d->weight ? var_get_print_format (d->weight) : &F_8_0;
+}
+
/* Sets the weighting variable of D to V, or turning off
weighting if V is a null pointer. */
void
const struct ccase *, bool *);
struct variable *dict_get_weight (const struct dictionary *);
void dict_set_weight (struct dictionary *, struct variable *);
+const struct fmt_spec *dict_get_weight_format (const struct dictionary *);
/* Filter variable. */
struct variable *dict_get_filter (const struct dictionary *);
if (do_binomial (dataset_dict (ds), input, ost, cat[0], cat[1], exclude))
{
- const struct variable *wvar = dict_get_weight (dict);
- const struct fmt_spec *wfmt = wvar ?
- var_get_print_format (wvar) : & F_8_0;
+ const struct fmt_spec *wfmt = dict_get_weight_format (dict);
struct tab_table *table = tab_create (7, ost->n_vars * 3 + 1);
tab_set_format (table, RC_WEIGHT, wfmt);
struct tab_table *table ;
- const struct variable *wvar = dict_get_weight (dict);
- const struct fmt_spec *wfmt = wvar ? var_get_print_format (wvar) : & F_8_0;
+ const struct fmt_spec *wfmt = dict_get_weight_format (dict);
int n_cells = test->hi - test->lo + 1;
show_freqs_box (const struct one_sample_test *ost, const struct cochran *ct)
{
int i;
- const struct variable *weight = dict_get_weight (ct->dict);
- const struct fmt_spec *wfmt = weight ? var_get_print_format (weight) : &F_8_0;
+ const struct fmt_spec *wfmt = dict_get_weight_format (ct->dict);
const int row_headers = 1;
const int column_headers = 2;
static void
show_sig_box (const struct cochran *ch)
{
- const struct variable *weight = dict_get_weight (ch->dict);
- const struct fmt_spec *wfmt = weight ? var_get_print_format (weight) : &F_8_0;
+ const struct fmt_spec *wfmt = dict_get_weight_format (ch->dict);
const int row_headers = 1;
const int column_headers = 0;
int
cmd_crosstabs (struct lexer *lexer, struct dataset *ds)
{
- const struct variable *wv = dict_get_weight (dataset_dict (ds));
struct var_range *range, *next_range;
struct crosstabs_proc proc;
struct casegrouper *grouper;
proc.pivots = NULL;
proc.n_pivots = 0;
proc.descending = false;
- proc.weight_format = wv ? *var_get_print_format (wv) : F_8_0;
+ proc.weight_format = *dict_get_weight_format (dataset_dict (ds));
if (!parse_crosstabs (lexer, ds, &cmd, &proc))
{
const struct friedman_test *ft = UP_CAST (ost, const struct friedman_test, parent);
int row = 0;
- const struct variable *weight = dict_get_weight (fr->dict);
- const struct fmt_spec *wfmt = weight ? var_get_print_format (weight) : &F_8_0;
+ const struct fmt_spec *wfmt = dict_get_weight_format (fr->dict);
const int row_headers = 1;
const int column_headers = 0;
const struct ks_one_sample_test *kst = UP_CAST (test, const struct ks_one_sample_test, parent.parent);
const struct one_sample_test *ost = &kst->parent;
struct ccase *c;
- const struct variable *wvar = dict_get_weight (dict);
- const struct fmt_spec *wfmt = wvar ? var_get_print_format (wvar) : & F_8_0;
+ const struct fmt_spec *wfmt = dict_get_weight_format (dict);
bool warn = true;
int v;
struct casereader *r = casereader_clone (input);
struct tab_table *table = tab_create (header_cols + 2, header_rows + 2);
- const struct variable *wv = dict_get_weight (dict);
- const struct fmt_spec *wfmt = wv ? var_get_print_format (wv) : & F_8_0;
+ const struct fmt_spec *wfmt = dict_get_weight_format (dict);
struct string pair_name;
struct tab_table *table = tab_create (5, t2s->n_pairs + 1);
- const struct variable *wv = dict_get_weight (dict);
- const struct fmt_spec *wfmt = wv ? var_get_print_format (wv) : & F_8_0;
+ const struct fmt_spec *wfmt = dict_get_weight_format (dict);
tab_title (table, _("Test Statistics"));
tab_set_format (table, RC_WEIGHT, wfmt);
static void
show_frequencies (const struct n_sample_test *nst, const struct results *results, int n_vals, const struct dictionary *dict)
{
- const struct variable *weight = dict_get_weight (dict);
- const struct fmt_spec *wfmt = weight ? var_get_print_format (weight) : &F_8_0;
+ const struct fmt_spec *wfmt = dict_get_weight_format (dict);
int i;
int v;
int n_vals,
const struct dictionary *dict)
{
- const struct variable *weight = dict_get_weight (dict);
- const struct fmt_spec *wfmt = weight ? var_get_print_format (weight) : &F_8_0;
+ const struct fmt_spec *wfmt = dict_get_weight_format (dict);
int v;
case_processing_summary (casenumber n_valid, casenumber n_missing,
const struct dictionary *dict)
{
- const struct variable *wv = dict_get_weight (dict);
- const struct fmt_spec *wfmt = wv ? var_get_print_format (wv) : & F_8_0;
+ const struct fmt_spec *wfmt = dict_get_weight_format (dict);
casenumber total;
int n_cols = 4;
static void
show_runs_result (const struct runs_test *rt, const struct run_state *rs, const struct dictionary *dict)
{
- const struct variable *weight = dict_get_weight (dict);
- const struct fmt_spec *wfmt = weight ? var_get_print_format (weight) : &F_8_0;
+ const struct fmt_spec *wfmt = dict_get_weight_format (dict);
const struct one_sample_test *otp = &rt->parent;
int i;
struct tab_table *table = tab_create (3, 1 + 4 * t2s->n_pairs);
- const struct variable *wv = dict_get_weight (dict);
- const struct fmt_spec *wfmt = wv ? var_get_print_format (wv) : & F_8_0;
+ const struct fmt_spec *wfmt = dict_get_weight_format (dict);
tab_set_format (table, RC_WEIGHT, wfmt);
tab_title (table, _("Frequencies"));
{
size_t i;
- const struct variable *wv = dict_get_weight (dict);
- const struct fmt_spec *wfmt = wv ? var_get_print_format (wv) : & F_8_0;
+ const struct fmt_spec *wfmt = dict_get_weight_format (dict);
struct tab_table *table = tab_create (5, 1 + 4 * t2s->n_pairs);
tab_set_format (table, RC_WEIGHT, wfmt);