This seems like a better interface.
}
/* Returns the format to use for weights. */
-const struct fmt_spec *
+struct fmt_spec
dict_get_weight_format (const struct dictionary *d)
{
- return d->weight ? var_get_print_format (d->weight) : &F_8_0;
+ return d->weight ? *var_get_print_format (d->weight) : F_8_0;
}
/* Sets the weighting variable of D to V, or turning off
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 *);
+struct fmt_spec dict_get_weight_format (const struct dictionary *);
/* Filter variable. */
struct variable *dict_get_filter (const struct dictionary *);
.exclude = MV_ANY,
.barchart = false,
.bad_warn = true,
- .weight_format = *dict_get_weight_format (dataset_dict (ds)),
+ .weight_format = dict_get_weight_format (dataset_dict (ds)),
.variables = NULL,
.n_variables = 0,
struct pivot_table *table = pivot_table_create__ (
pivot_value_new_user_text_nocopy (ds_steal_cstr (&title)),
"Crosstabulation");
- pivot_table_set_weight_format (table, &proc->weight_format);
+ pivot_table_set_weight_format (table, proc->weight_format);
struct pivot_dimension *statistics = pivot_dimension_create (
table, PIVOT_AXIS_ROW, N_("Statistics"));
create_chisq_table (struct crosstabulation *xt)
{
struct pivot_table *chisq = pivot_table_create (N_("Chi-Square Tests"));
- pivot_table_set_weight_format (chisq, &xt->weight_format);
+ pivot_table_set_weight_format (chisq, xt->weight_format);
pivot_dimension_create (
chisq, PIVOT_AXIS_ROW, N_("Statistics"),
create_sym_table (struct crosstabulation *xt)
{
struct pivot_table *sym = pivot_table_create (N_("Symmetric Measures"));
- pivot_table_set_weight_format (sym, &xt->weight_format);
+ pivot_table_set_weight_format (sym, xt->weight_format);
pivot_dimension_create (
sym, PIVOT_AXIS_COLUMN, N_("Values"),
struct pivot_dimension **risk_statistics)
{
struct pivot_table *risk = pivot_table_create (N_("Risk Estimate"));
- pivot_table_set_weight_format (risk, &xt->weight_format);
+ pivot_table_set_weight_format (risk, xt->weight_format);
struct pivot_dimension *values = pivot_dimension_create (
risk, PIVOT_AXIS_COLUMN, N_("Values"),
create_direct_table (struct crosstabulation *xt)
{
struct pivot_table *direct = pivot_table_create (N_("Directional Measures"));
- pivot_table_set_weight_format (direct, &xt->weight_format);
+ pivot_table_set_weight_format (direct, xt->weight_format);
pivot_dimension_create (
direct, PIVOT_AXIS_COLUMN, N_("Values"),
};
static void show_jt (const struct n_sample_test *, const struct jt *,
- const struct fmt_spec *wfmt);
+ const struct fmt_spec wfmt);
void
\f
static void
show_jt (const struct n_sample_test *nst, const struct jt *jt,
- const struct fmt_spec *wfmt)
+ const struct fmt_spec wfmt)
{
struct pivot_table *table = pivot_table_create (
N_("Jonckheere-Terpstra Test"));
}
}
-static void show_results (const struct ks *, const struct ks_one_sample_test *, const struct fmt_spec *);
+static void show_results (const struct ks *, const struct ks_one_sample_test *, const struct fmt_spec);
void
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 fmt_spec *wfmt = dict_get_weight_format (dict);
+ const struct fmt_spec wfmt = dict_get_weight_format (dict);
bool warn = true;
int v;
struct casereader *r = casereader_clone (input);
static void
show_results (const struct ks *ks,
const struct ks_one_sample_test *kst,
- const struct fmt_spec *wfmt)
+ const struct fmt_spec wfmt)
{
struct pivot_table *table = pivot_table_create (
N_("One-Sample Kolmogorov-Smirnov Test"));
do_summary_box (const struct descriptives *desc,
const struct variable *const *vv,
int n_vars,
- const struct fmt_spec *wfmt)
+ const struct fmt_spec wfmt)
{
if (!desc)
return;
do_summary_box (const struct descriptives *desc,
const struct variable *const *vv,
int n_vars,
- const struct fmt_spec *wfmt);
+ const struct fmt_spec wfmt);
void npar_summary_calc_descriptives (struct descriptives *desc,
struct casereader *input,
/* The weight variable */
const struct variable *wv;
- const struct fmt_spec *wfmt;
+ const struct fmt_spec wfmt;
/* The confidence level for multiple comparisons */
double alpha;
const struct variable *wv)
{
if (wv)
- pivot_table_set_weight_format (table, var_get_print_format (wv));
+ pivot_table_set_weight_format (table, *var_get_print_format (wv));
}
/* Sets the format used for PIVOT_RC_COUNT cells to WFMT, which should be the
- format for the dictionary whose data or statistics are being put into TABLE.
-
- This has no effect if WFMT is NULL. */
+ format for the dictionary whose data or statistics are being put into
+ TABLE. */
void
pivot_table_set_weight_format (struct pivot_table *table,
- const struct fmt_spec *wfmt)
+ const struct fmt_spec wfmt)
{
- if (wfmt)
- table->weight_format = *wfmt;
+ table->weight_format = wfmt;
}
/* Returns true if TABLE has no cells, false otherwise. */
void pivot_table_set_weight_var (struct pivot_table *,
const struct variable *);
void pivot_table_set_weight_format (struct pivot_table *,
- const struct fmt_spec *);
+ const struct fmt_spec);
/* Query. */
bool pivot_table_is_empty (const struct pivot_table *);