From: Ben Pfaff Date: Thu, 7 May 2009 05:58:01 +0000 (-0700) Subject: output: Add auxiliary data parameter to tab_dim. X-Git-Tag: v0.7.3~85 X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=c6fe58a22249f4f486b42f35fd8bd537c91e8e6e;p=pspp-builds.git output: Add auxiliary data parameter to tab_dim. Until now, the tab_dim function has not provided any way to pass auxiliary data to the table dimensioning function. This commit adds this ability and updates all the callers of tab_dim to do so. --- diff --git a/src/language/data-io/data-parser.c b/src/language/data-io/data-parser.c index 87fd1b79..1b9eb899 100644 --- a/src/language/data-io/data-parser.c +++ b/src/language/data-io/data-parser.c @@ -647,7 +647,7 @@ dump_fixed_table (const struct data_parser *parser, tab_text (t, 3, 0, TAB_CENTER | TAT_TITLE, _("Format")); tab_box (t, TAL_1, TAL_1, TAL_0, TAL_1, 0, 0, 3, parser->field_cnt); tab_hline (t, TAL_2, 0, 3, 1); - tab_dim (t, tab_natural_dimensions); + tab_dim (t, tab_natural_dimensions, NULL); for (i = 0; i < parser->field_cnt; i++) { @@ -686,7 +686,7 @@ dump_delimited_table (const struct data_parser *parser, tab_text (t, 1, 0, TAB_CENTER | TAT_TITLE, _("Format")); tab_box (t, TAL_1, TAL_1, TAL_0, TAL_1, 0, 0, 1, parser->field_cnt); tab_hline (t, TAL_2, 0, 1, 1); - tab_dim (t, tab_natural_dimensions); + tab_dim (t, tab_natural_dimensions, NULL); for (i = 0; i < parser->field_cnt; i++) { diff --git a/src/language/data-io/print.c b/src/language/data-io/print.c index ab25ec75..aae8b38a 100644 --- a/src/language/data-io/print.c +++ b/src/language/data-io/print.c @@ -404,7 +404,7 @@ dump_table (struct print_trns *trns, const struct file_handle *fh) tab_text (t, 1, 0, TAB_CENTER | TAT_TITLE, _("Record")); tab_text (t, 2, 0, TAB_CENTER | TAT_TITLE, _("Columns")); tab_text (t, 3, 0, TAB_CENTER | TAT_TITLE, _("Format")); - tab_dim (t, tab_natural_dimensions); + tab_dim (t, tab_natural_dimensions, NULL); row = 1; ll_for_each (spec, struct prt_out_spec, ll, &trns->specs) { diff --git a/src/language/dictionary/split-file.c b/src/language/dictionary/split-file.c index 91c27c95..155cfa12 100644 --- a/src/language/dictionary/split-file.c +++ b/src/language/dictionary/split-file.c @@ -1,5 +1,5 @@ /* PSPP - a program for statistical analysis. - Copyright (C) 1997-9, 2000 Free Software Foundation, Inc. + Copyright (C) 1997-9, 2000, 2009 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -78,7 +78,7 @@ output_split_file_values (const struct dataset *ds, const struct ccase *c) return; t = tab_create (3, split_cnt + 1, 0); - tab_dim (t, tab_natural_dimensions); + tab_dim (t, tab_natural_dimensions, NULL); tab_vline (t, TAL_GAP, 1, 0, split_cnt); tab_vline (t, TAL_GAP, 2, 0, split_cnt); tab_text (t, 0, 0, TAB_NONE, _("Variable")); diff --git a/src/language/dictionary/sys-file-info.c b/src/language/dictionary/sys-file-info.c index 6d033419..ce25f78a 100644 --- a/src/language/dictionary/sys-file-info.c +++ b/src/language/dictionary/sys-file-info.c @@ -1,5 +1,5 @@ /* PSPP - a program for statistical analysis. - Copyright (C) 1997-9, 2000, 2006 Free Software Foundation, Inc. + Copyright (C) 1997-9, 2000, 2006, 2009 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -69,7 +69,7 @@ static int describe_variable (const struct variable *v, struct tab_table *t, /* Sets the widths of all the columns and heights of all the rows in table T for driver D. */ static void -sysfile_info_dim (struct tab_table *t, struct outp_driver *d) +sysfile_info_dim (struct tab_table *t, struct outp_driver *d, void *aux UNUSED) { static const int max[] = {20, 5, 35, 3, 0}; const int *p; @@ -160,11 +160,11 @@ cmd_sysfile_info (struct lexer *lexer, struct dataset *ds UNUSED) dict_get_encoding(d) ? dict_get_encoding(d) : _("Unknown")); - tab_dim (t, tab_natural_dimensions); + tab_dim (t, tab_natural_dimensions, NULL); tab_submit (t); t = tab_create (4, 1 + 2 * dict_get_var_cnt (d), 1); - tab_dim (t, sysfile_info_dim); + tab_dim (t, sysfile_info_dim, NULL); tab_headers (t, 0, 0, 1, 0); tab_text (t, 0, 0, TAB_LEFT | TAT_TITLE, _("Variable")); tab_joint_text (t, 1, 0, 2, 0, TAB_LEFT | TAT_TITLE, _("Description")); @@ -344,7 +344,7 @@ static int _flags; /* Sets the widths of all the columns and heights of all the rows in table T for driver D. */ static void -variables_dim (struct tab_table *t, struct outp_driver *d) +variables_dim (struct tab_table *t, struct outp_driver *d, void *aux UNUSED) { int pc; int i; @@ -397,7 +397,7 @@ display_variables (const struct variable **vl, size_t n, int flags) ? _("Description") : _("Label"))); if (flags & DF_DICT_INDEX) tab_text (t, pc, 0, TAB_LEFT | TAT_TITLE, _("Position")); - tab_dim (t, variables_dim); + tab_dim (t, variables_dim, NULL); r = 1; for (i = 0; i < n; i++) @@ -487,7 +487,7 @@ display_data_file_attributes (struct attrset *set, int flags) tab_text (t, 1, 0, TAB_LEFT | TAT_TITLE, _("Value")); display_attributes (t, set, flags, 0, 1); tab_columns (t, TAB_COL_DOWN, 1); - tab_dim (t, tab_natural_dimensions); + tab_dim (t, tab_natural_dimensions, NULL); tab_title (t, "Custom data file attributes."); tab_submit (t); } @@ -707,7 +707,7 @@ display_vectors (const struct dictionary *dict, int sorted) t = tab_create (4, nrow + 1, 0); tab_headers (t, 0, 0, 1, 0); tab_columns (t, TAB_COL_DOWN, 1); - tab_dim (t, tab_natural_dimensions); + tab_dim (t, tab_natural_dimensions, NULL); tab_box (t, TAL_1, TAL_1, -1, -1, 0, 0, 3, nrow); tab_box (t, -1, -1, -1, TAL_1, 0, 0, 3, nrow); tab_hline (t, TAL_2, 0, 3, 1); diff --git a/src/language/stats/binomial.c b/src/language/stats/binomial.c index f4344b76..94b41193 100644 --- a/src/language/stats/binomial.c +++ b/src/language/stats/binomial.c @@ -202,7 +202,7 @@ binomial_execute (const struct dataset *ds, struct tab_table *table = tab_create (7, ost->n_vars * 3 + 1, 0); - tab_dim (table, tab_natural_dimensions); + tab_dim (table, tab_natural_dimensions, NULL); tab_title (table, _("Binomial Test")); diff --git a/src/language/stats/chisquare.c b/src/language/stats/chisquare.c index 6cb7fc0b..7354f8e4 100644 --- a/src/language/stats/chisquare.c +++ b/src/language/stats/chisquare.c @@ -202,7 +202,7 @@ create_variable_frequency_table (const struct dictionary *dict, } table = tab_create(4, n_cells + 2, 0); - tab_dim (table, tab_natural_dimensions); + tab_dim (table, tab_natural_dimensions, NULL); tab_title (table, var_to_string(var)); tab_text (table, 1, 0, TAB_LEFT, _("Observed N")); @@ -238,7 +238,7 @@ create_combo_frequency_table (const struct chisquare_test *test) int n_cells = test->hi - test->lo + 1; table = tab_create(1 + ost->n_vars * 4, n_cells + 3, 0); - tab_dim (table, tab_natural_dimensions); + tab_dim (table, tab_natural_dimensions, NULL); tab_title (table, _("Frequencies")); for ( i = 0 ; i < ost->n_vars ; ++i ) @@ -294,7 +294,7 @@ create_stats_table (const struct chisquare_test *test) struct tab_table *table; table = tab_create (1 + ost->n_vars, 4, 0); - tab_dim (table, tab_natural_dimensions); + tab_dim (table, tab_natural_dimensions, NULL); tab_title (table, _("Test Statistics")); tab_headers (table, 1, 0, 1, 0); diff --git a/src/language/stats/crosstabs.q b/src/language/stats/crosstabs.q index 0a5e3409..b71524a1 100644 --- a/src/language/stats/crosstabs.q +++ b/src/language/stats/crosstabs.q @@ -1019,7 +1019,7 @@ static void display_chisq (const struct dictionary *); static void display_symmetric (const struct dictionary *); static void display_risk (const struct dictionary *); static void display_directional (void); -static void crosstabs_dim (struct tab_table *, struct outp_driver *); +static void crosstabs_dim (struct tab_table *, struct outp_driver *, void *); static void table_value_missing (struct tab_table *table, int c, int r, unsigned char opt, const union value *v, const struct variable *var); @@ -1525,14 +1525,14 @@ submit (struct tab_table *t) tab_box (t, -1, -1, -1, TAL_GAP, 0, tab_t (t), tab_l (t) - 1, tab_nr (t) - 1); tab_vline (t, TAL_2, tab_l (t), 0, tab_nr (t) - 1); - tab_dim (t, crosstabs_dim); + tab_dim (t, crosstabs_dim, NULL); tab_submit (t); } /* Sets the widths of all the columns and heights of all the rows in table T for driver D. */ static void -crosstabs_dim (struct tab_table *t, struct outp_driver *d) +crosstabs_dim (struct tab_table *t, struct outp_driver *d, void *aux UNUSED) { int i; diff --git a/src/language/stats/descriptives.c b/src/language/stats/descriptives.c index 23bb1aa8..58144ceb 100644 --- a/src/language/stats/descriptives.c +++ b/src/language/stats/descriptives.c @@ -560,7 +560,7 @@ dump_z_table (struct dsc_proc *dsc) tab_hline (t, TAL_2, 0, 1, 1); tab_text (t, 0, 0, TAB_CENTER | TAT_TITLE, _("Source")); tab_text (t, 1, 0, TAB_CENTER | TAT_TITLE, _("Target")); - tab_dim (t, tab_natural_dimensions); + tab_dim (t, tab_natural_dimensions, NULL); { size_t i, y; @@ -879,7 +879,7 @@ display (struct dsc_proc *dsc) tab_box (t, -1, -1, -1, TAL_1, 1, 0, nc - 1, dsc->var_cnt); tab_hline (t, TAL_2, 0, nc - 1, 1); tab_vline (t, TAL_2, 1, 0, dsc->var_cnt); - tab_dim (t, tab_natural_dimensions); + tab_dim (t, tab_natural_dimensions, NULL); nc = 0; tab_text (t, nc++, 0, TAB_LEFT | TAT_TITLE, _("Variable")); diff --git a/src/language/stats/examine.q b/src/language/stats/examine.q index 3d0b077c..4a7f1f03 100644 --- a/src/language/stats/examine.q +++ b/src/language/stats/examine.q @@ -1243,7 +1243,7 @@ show_summary (const struct variable **dependent_var, int n_dep_var, tbl = tab_create (n_cols, n_rows, 0); tab_headers (tbl, heading_columns, 0, heading_rows, 0); - tab_dim (tbl, tab_natural_dimensions); + tab_dim (tbl, tab_natural_dimensions, NULL); /* Outline the box */ tab_box (tbl, @@ -1480,7 +1480,7 @@ show_descriptives (const struct variable **dependent_var, tbl = tab_create (n_cols, n_rows, 0); tab_headers (tbl, heading_columns, 0, heading_rows, 0); - tab_dim (tbl, tab_natural_dimensions); + tab_dim (tbl, tab_natural_dimensions, NULL); /* Outline the box */ tab_box (tbl, @@ -1793,7 +1793,7 @@ show_extremes (const struct variable **dependent_var, tbl = tab_create (n_cols, n_rows, 0); tab_headers (tbl, heading_columns, 0, heading_rows, 0); - tab_dim (tbl, tab_natural_dimensions); + tab_dim (tbl, tab_natural_dimensions, NULL); /* Outline the box */ tab_box (tbl, @@ -1998,7 +1998,7 @@ show_percentiles (const struct variable **dependent_var, tbl = tab_create (n_cols, n_rows, 0); tab_headers (tbl, heading_columns, 0, heading_rows, 0); - tab_dim (tbl, tab_natural_dimensions); + tab_dim (tbl, tab_natural_dimensions, NULL); /* Outline the box */ tab_box (tbl, diff --git a/src/language/stats/frequencies.q b/src/language/stats/frequencies.q index ea42475c..82670e3e 100644 --- a/src/language/stats/frequencies.q +++ b/src/language/stats/frequencies.q @@ -1011,7 +1011,7 @@ compare_freq_alpha_d (const void *a_, const void *b_, const void *v_) /* Sets the widths of all the columns and heights of all the rows in table T for driver D. */ static void -full_dim (struct tab_table *t, struct outp_driver *d) +full_dim (struct tab_table *t, struct outp_driver *d, void *aux UNUSED) { int i = 0; int columns = 5; @@ -1075,7 +1075,7 @@ dump_full (const struct variable *v, const struct variable *wv) n_categories = ft->n_valid + ft->n_missing; t = tab_create (5 + lab, n_categories + 3, 0); tab_headers (t, 0, 0, 2, 0); - tab_dim (t, full_dim); + tab_dim (t, full_dim, NULL); if (lab) tab_text (t, 0, 1, TAB_CENTER | TAT_TITLE, _("Value Label")); @@ -1146,7 +1146,7 @@ dump_full (const struct variable *v, const struct variable *wv) /* Sets the widths of all the columns and heights of all the rows in table T for driver D. */ static void -condensed_dim (struct tab_table *t, struct outp_driver *d) +condensed_dim (struct tab_table *t, struct outp_driver *d, void *aux UNUSED) { int cum_w = MAX (outp_string_width (d, _("Cum"), OUTP_PROPORTIONAL), MAX (outp_string_width (d, _("Cum"), OUTP_PROPORTIONAL), @@ -1186,7 +1186,7 @@ dump_condensed (const struct variable *v, const struct variable *wv) tab_text (t, 2, 1, TAB_CENTER | TAT_TITLE, _("Pct")); tab_text (t, 3, 0, TAB_CENTER | TAT_TITLE, _("Cum")); tab_text (t, 3, 1, TAB_CENTER | TAT_TITLE, _("Pct")); - tab_dim (t, condensed_dim); + tab_dim (t, condensed_dim, NULL); r = 2; for (f = ft->valid; f < ft->missing; f++) @@ -1385,7 +1385,7 @@ dump_statistics (const struct variable *v, bool show_varname, calc_stats (v, stat_value); t = tab_create (3, n_stats + n_percentiles + 2, 0); - tab_dim (t, tab_natural_dimensions); + tab_dim (t, tab_natural_dimensions, NULL); tab_box (t, TAL_1, TAL_1, -1, -1 , 0 , 0 , 2, tab_nr(t) - 1) ; diff --git a/src/language/stats/npar-summary.c b/src/language/stats/npar-summary.c index 2e4fe585..d626dffa 100644 --- a/src/language/stats/npar-summary.c +++ b/src/language/stats/npar-summary.c @@ -104,7 +104,7 @@ do_summary_box (const struct descriptives *desc, table = tab_create (columns, 2 + n_vars, 0); - tab_dim (table, tab_natural_dimensions); + tab_dim (table, tab_natural_dimensions, NULL); tab_title (table, _("Descriptive Statistics")); diff --git a/src/language/stats/oneway.q b/src/language/stats/oneway.q index 40107f77..8794ad5c 100644 --- a/src/language/stats/oneway.q +++ b/src/language/stats/oneway.q @@ -261,7 +261,7 @@ show_anova_table (void) t = tab_create (n_cols, n_rows, 0); tab_headers (t, 2, 0, 1, 0); - tab_dim (t, tab_natural_dimensions); + tab_dim (t, tab_natural_dimensions, NULL); tab_box (t, @@ -372,7 +372,7 @@ show_descriptives (const struct dictionary *dict) t = tab_create (n_cols, n_rows, 0); tab_headers (t, 2, 0, 2, 0); - tab_dim (t, tab_natural_dimensions); + tab_dim (t, tab_natural_dimensions, NULL); /* Put a frame around the entire box, and vertical lines inside */ @@ -518,7 +518,7 @@ show_homogeneity (void) t = tab_create (n_cols, n_rows, 0); tab_headers (t, 1, 0, 1, 0); - tab_dim (t, tab_natural_dimensions); + tab_dim (t, tab_natural_dimensions, NULL); /* Put a frame around the entire box, and vertical lines inside */ tab_box (t, @@ -579,7 +579,7 @@ show_contrast_coeffs (short *bad_contrast) t = tab_create (n_cols, n_rows, 0); tab_headers (t, 2, 0, 2, 0); - tab_dim (t, tab_natural_dimensions); + tab_dim (t, tab_natural_dimensions, NULL); /* Put a frame around the entire box, and vertical lines inside */ tab_box (t, @@ -661,7 +661,7 @@ show_contrast_tests (short *bad_contrast) t = tab_create (n_cols, n_rows, 0); tab_headers (t, 3, 0, 1, 0); - tab_dim (t, tab_natural_dimensions); + tab_dim (t, tab_natural_dimensions, NULL); /* Put a frame around the entire box, and vertical lines inside */ tab_box (t, diff --git a/src/language/stats/regression.q b/src/language/stats/regression.q index 13cc4f69..05c08dfa 100644 --- a/src/language/stats/regression.q +++ b/src/language/stats/regression.q @@ -150,7 +150,7 @@ reg_stats_r (pspp_linreg_cache * c) adjrsq = 1.0 - (1.0 - rsq) * (c->n_obs - 1.0) / (c->n_obs - c->n_indeps); std_error = sqrt (pspp_linreg_mse (c)); t = tab_create (n_cols, n_rows, 0); - tab_dim (t, tab_natural_dimensions); + tab_dim (t, tab_natural_dimensions, NULL); tab_box (t, TAL_2, TAL_2, -1, TAL_1, 0, 0, n_cols - 1, n_rows - 1); tab_hline (t, TAL_2, 0, n_cols - 1, 1); tab_vline (t, TAL_2, 2, 0, n_rows - 1); @@ -193,7 +193,7 @@ reg_stats_coeff (pspp_linreg_cache * c) t = tab_create (n_cols, n_rows, 0); tab_headers (t, 2, 0, 1, 0); - tab_dim (t, tab_natural_dimensions); + tab_dim (t, tab_natural_dimensions, NULL); tab_box (t, TAL_2, TAL_2, -1, TAL_1, 0, 0, n_cols - 1, n_rows - 1); tab_hline (t, TAL_2, 0, n_cols - 1, 1); tab_vline (t, TAL_2, 2, 0, n_rows - 1); @@ -290,7 +290,7 @@ reg_stats_anova (pspp_linreg_cache * c) assert (c != NULL); t = tab_create (n_cols, n_rows, 0); tab_headers (t, 2, 0, 1, 0); - tab_dim (t, tab_natural_dimensions); + tab_dim (t, tab_natural_dimensions, NULL); tab_box (t, TAL_2, TAL_2, -1, TAL_1, 0, 0, n_cols - 1, n_rows - 1); @@ -381,7 +381,7 @@ reg_stats_bcov (pspp_linreg_cache * c) n_rows = 2 * (c->n_indeps + 1); t = tab_create (n_cols, n_rows, 0); tab_headers (t, 2, 0, 1, 0); - tab_dim (t, tab_natural_dimensions); + tab_dim (t, tab_natural_dimensions, NULL); tab_box (t, TAL_2, TAL_2, -1, TAL_1, 0, 0, n_cols - 1, n_rows - 1); tab_hline (t, TAL_2, 0, n_cols - 1, 1); tab_vline (t, TAL_2, 2, 0, n_rows - 1); diff --git a/src/language/stats/reliability.q b/src/language/stats/reliability.q index 0e7f91a0..0e8165a4 100644 --- a/src/language/stats/reliability.q +++ b/src/language/stats/reliability.q @@ -382,7 +382,7 @@ run_reliability (struct casereader *input, struct dataset *ds, { struct tab_table *tab = tab_create(1, 1, 0); - tab_dim (tab, tab_natural_dimensions); + tab_dim (tab, tab_natural_dimensions, NULL); tab_flags (tab, SOMF_NO_TITLE ); tab_text(tab, 0, 0, TAT_PRINTF, "Scale: %s", ds_cstr (&rel->scale_name)); @@ -427,7 +427,7 @@ reliability_statistics (const struct reliability *rel) struct tab_table *tbl = tab_create (n_cols, n_rows, 0); tab_headers (tbl, heading_columns, 0, heading_rows, 0); - tab_dim (tbl, tab_natural_dimensions); + tab_dim (tbl, tab_natural_dimensions, NULL); tab_title (tbl, _("Reliability Statistics")); @@ -470,7 +470,7 @@ reliability_summary_total (const struct reliability *rel) struct tab_table *tbl = tab_create (n_cols, n_rows, 0); tab_headers (tbl, heading_columns, 0, heading_rows, 0); - tab_dim (tbl, tab_natural_dimensions); + tab_dim (tbl, tab_natural_dimensions, NULL); tab_title (tbl, _("Item-Total Statistics")); @@ -680,7 +680,7 @@ case_processing_summary (casenumber n_valid, casenumber n_missing, tbl = tab_create (n_cols, n_rows, 0); tab_headers (tbl, heading_columns, 0, heading_rows, 0); - tab_dim (tbl, tab_natural_dimensions); + tab_dim (tbl, tab_natural_dimensions, NULL); tab_title (tbl, _("Case Processing Summary")); diff --git a/src/language/stats/sign.c b/src/language/stats/sign.c index b76d9e33..2ef60899 100644 --- a/src/language/stats/sign.c +++ b/src/language/stats/sign.c @@ -56,7 +56,7 @@ output_frequency_table (const struct two_sample_test *t2s, const struct variable *wv = dict_get_weight (dict); const struct fmt_spec *wfmt = wv ? var_get_print_format (wv) : & F_8_0; - tab_dim (table, tab_natural_dimensions); + tab_dim (table, tab_natural_dimensions, NULL); tab_title (table, _("Frequencies")); @@ -109,7 +109,7 @@ output_statistics_table (const struct two_sample_test *t2s, int i; struct tab_table *table = tab_create (1 + t2s->n_pairs, 4, 0); - tab_dim (table, tab_natural_dimensions); + tab_dim (table, tab_natural_dimensions, NULL); tab_title (table, _("Test Statistics")); diff --git a/src/language/stats/t-test.q b/src/language/stats/t-test.q index 8446f835..3affde20 100644 --- a/src/language/stats/t-test.q +++ b/src/language/stats/t-test.q @@ -671,7 +671,7 @@ ssbox_base_init (struct ssbox *this, int cols,int rows) tab_headers (this->t,0,0,1,0); tab_box (this->t, TAL_2, TAL_2, TAL_0, TAL_1, 0, 0, cols -1, rows -1 ); tab_hline (this->t, TAL_2,0,cols-1,1); - tab_dim (this->t, tab_natural_dimensions); + tab_dim (this->t, tab_natural_dimensions, NULL); } void ssbox_one_sample_populate (struct ssbox *ssb, @@ -1380,7 +1380,7 @@ trbox_base_init (struct trbox *self, size_t data_rows, int cols) tab_headers (self->t,0,0,3,0); tab_box (self->t, TAL_2, TAL_2, TAL_0, TAL_0, 0, 0, cols -1, rows -1); tab_hline (self->t, TAL_2,0,cols-1,3); - tab_dim (self->t, tab_natural_dimensions); + tab_dim (self->t, tab_natural_dimensions, NULL); } @@ -1412,7 +1412,7 @@ pscbox (const struct dictionary *dict) tab_box (table, TAL_2, TAL_2, TAL_0, TAL_1, 0, 0, cols -1, rows -1 ); tab_hline (table, TAL_2, 0, cols - 1, 1); tab_vline (table, TAL_2, 2, 0, rows - 1); - tab_dim (table, tab_natural_dimensions); + tab_dim (table, tab_natural_dimensions, NULL); tab_title (table, _ ("Paired Samples Correlations")); /* column headings */ diff --git a/src/language/stats/wilcoxon.c b/src/language/stats/wilcoxon.c index c0329f6c..ebc2f1e2 100644 --- a/src/language/stats/wilcoxon.c +++ b/src/language/stats/wilcoxon.c @@ -211,7 +211,7 @@ show_ranks_box (const struct wilcoxon_state *ws, struct tab_table *table = tab_create (5, 1 + 4 * t2s->n_pairs, 0); - tab_dim (table, tab_natural_dimensions); + tab_dim (table, tab_natural_dimensions, NULL); tab_title (table, _("Ranks")); @@ -292,7 +292,7 @@ show_tests_box (const struct wilcoxon_state *ws, size_t i; struct tab_table *table = tab_create (1 + t2s->n_pairs, exact ? 5 : 3, 0); - tab_dim (table, tab_natural_dimensions); + tab_dim (table, tab_natural_dimensions, NULL); tab_title (table, _("Test Statistics")); diff --git a/src/language/utilities/echo.c b/src/language/utilities/echo.c index 74136da3..19e9f9e5 100644 --- a/src/language/utilities/echo.c +++ b/src/language/utilities/echo.c @@ -1,5 +1,5 @@ /* PSPP - a program for statistical analysis. - Copyright (C) 2005 Free Software Foundation, Inc. + Copyright (C) 2005, 2009 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -35,7 +35,7 @@ cmd_echo (struct lexer *lexer, struct dataset *ds UNUSED) tab = tab_create(1, 1, 0); - tab_dim (tab, tab_natural_dimensions); + tab_dim (tab, tab_natural_dimensions, NULL); tab_flags (tab, SOMF_NO_TITLE ); tab_text(tab, 0, 0, 0, ds_cstr (lex_tokstr (lexer))); diff --git a/src/output/table.c b/src/output/table.c index 5c8dc6f7..9e925a44 100644 --- a/src/output/table.c +++ b/src/output/table.c @@ -1,5 +1,5 @@ /* PSPP - a program for statistical analysis. - Copyright (C) 1997-9, 2000, 2006 Free Software Foundation, Inc. + Copyright (C) 1997-9, 2000, 2006, 2009 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -399,10 +399,11 @@ tab_title (struct tab_table *t, const char *title, ...) /* Set DIM_FUNC as the dimension function for table T. */ void -tab_dim (struct tab_table *t, tab_dim_func *dim_func) +tab_dim (struct tab_table *t, tab_dim_func *dim_func, void *aux) { assert (t != NULL && t->dim == NULL); t->dim = dim_func; + t->dim_aux = aux; } /* Returns the natural width of column C in table T for driver D, that @@ -496,7 +497,8 @@ tab_natural_height (struct tab_table *t, struct outp_driver *d, int r) /* Callback function to set all columns and rows to their natural dimensions. Not really meant to be called directly. */ void -tab_natural_dimensions (struct tab_table *t, struct outp_driver *d) +tab_natural_dimensions (struct tab_table *t, struct outp_driver *d, + void *aux UNUSED) { int i; @@ -787,7 +789,7 @@ tab_raw (struct tab_table *table, int c, int r, unsigned opt, /* Sets the widths of all the columns and heights of all the rows in table T for driver D. */ static void -nowrap_dim (struct tab_table *t, struct outp_driver *d) +nowrap_dim (struct tab_table *t, struct outp_driver *d, void *aux UNUSED) { t->w[0] = tab_natural_width (t, d, 0); t->h[0] = d->font_height; @@ -796,7 +798,7 @@ nowrap_dim (struct tab_table *t, struct outp_driver *d) /* Sets the widths of all the columns and heights of all the rows in table T for driver D. */ static void -wrap_dim (struct tab_table *t, struct outp_driver *d) +wrap_dim (struct tab_table *t, struct outp_driver *d, void *aux UNUSED) { t->w[0] = tab_natural_width (t, d, 0); t->h[0] = tab_natural_height (t, d, 0); @@ -822,7 +824,7 @@ tab_output_text (int options, const char *buf, ...) tab_text (t, 0, 0, options & ~TAT_PRINTF, buf); tab_flags (t, SOMF_NO_TITLE | SOMF_NO_SPACING); - tab_dim (t, options & TAT_NOWRAP ? nowrap_dim : wrap_dim); + tab_dim (t, options & TAT_NOWRAP ? nowrap_dim : wrap_dim, NULL); tab_submit (t); free (tmp_buf); @@ -982,7 +984,7 @@ tabi_driver (struct outp_driver *driver) #endif assert (t->dim != NULL); - t->dim (t, d); + t->dim (t, d, t->dim_aux); #if DEBUGGING { diff --git a/src/output/table.h b/src/output/table.h index 829410ed..2777c59d 100644 --- a/src/output/table.h +++ b/src/output/table.h @@ -1,5 +1,5 @@ /* PSPP - a program for statistical analysis. - Copyright (C) 1997-9, 2000 Free Software Foundation, Inc. + Copyright (C) 1997-9, 2000, 2009 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -67,7 +67,8 @@ struct tab_joined_cell struct outp_driver; struct tab_table; -typedef void tab_dim_func (struct tab_table *, struct outp_driver *); +typedef void tab_dim_func (struct tab_table *, struct outp_driver *, + void *aux); /* A table. */ struct tab_table @@ -87,6 +88,7 @@ struct tab_table unsigned char *rh; /* Horiz rules; unsigned char[nr+1][nc]. */ unsigned char *rv; /* Vert rules; unsigned char[nr][nc+1]. */ tab_dim_func *dim; /* Calculates cell widths and heights. */ + void *dim_aux; /* Auxiliary data for dim function. */ /* Calculated during output. */ int *w; /* Column widths; [nc]. */ @@ -133,7 +135,7 @@ void tab_submit (struct tab_table *); tab_dim_func tab_natural_dimensions; int tab_natural_width (struct tab_table *t, struct outp_driver *d, int c); int tab_natural_height (struct tab_table *t, struct outp_driver *d, int r); -void tab_dim (struct tab_table *, tab_dim_func *); +void tab_dim (struct tab_table *, tab_dim_func *, void *aux); /* Rules. */ void tab_hline (struct tab_table *, int style, int x1, int x2, int y);