X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=src%2Fcrosstabs.q;h=21d2d3df4ce2bf6d964d0a860d4b964533e4eeac;hb=64f58bbdab17e4a09b725e713f4f82f567f44076;hp=9c17ed0297379c06887ada4803d55de8bad91543;hpb=b321086267ad1014dc5d09886396cde30f094437;p=pspp-builds.git diff --git a/src/crosstabs.q b/src/crosstabs.q index 9c17ed02..21d2d3df 100644 --- a/src/crosstabs.q +++ b/src/crosstabs.q @@ -14,8 +14,8 @@ You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA - 02111-1307, USA. */ + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA + 02110-1301, USA. */ /* FIXME: @@ -53,13 +53,17 @@ #include "var.h" #include "vfm.h" +#include "gettext.h" +#define _(msgid) gettext (msgid) +#define N_(msgid) msgid + /* (headers) */ #include "debug-print.h" /* (specification) crosstabs (crs_): - *tables=custom; + *^tables=custom; +variables=custom; +missing=miss:!table/include/report; +write[wr_]=none,cells,all; @@ -338,7 +342,7 @@ crs_custom_tables (struct cmd_crosstabs *cmd UNUSED) } { - int *by_iter = xcalloc (sizeof *by_iter * n_by); + int *by_iter = xcalloc (n_by, sizeof *by_iter); int i; xtab = xrealloc (xtab, sizeof *xtab * (nxtab + nx)); @@ -572,11 +576,11 @@ calc_general (struct ccase *c, void *aux UNUSED) assert (x != NULL); for (j = 0; j < x->nvar; j++) { - if ((cmd.miss == CRS_TABLE - && is_missing (case_data (c, x->vars[j]->fv), x->vars[j])) + const union value *v = case_data (c, x->vars[j]->fv); + const struct missing_values *mv = &x->vars[j]->miss; + if ((cmd.miss == CRS_TABLE && mv_is_value_missing (mv, v)) || (cmd.miss == CRS_INCLUDE - && is_system_missing (case_data (c, x->vars[j]->fv), - x->vars[j]))) + && mv_is_value_system_missing (mv, v))) { x->missing += weight; goto next_crosstab; @@ -646,7 +650,8 @@ calc_integer (struct ccase *c, void *aux UNUSED) /* Note that the first test also rules out SYSMIS. */ if ((value < vr->min || value >= vr->max) - || (cmd.miss == CRS_TABLE && is_num_user_missing (value, v))) + || (cmd.miss == CRS_TABLE + && mv_is_num_user_missing (&v->miss, value))) { x->missing += weight; goto next_crosstab; @@ -1406,7 +1411,7 @@ delete_missing (void) int r; for (r = 0; r < n_rows; r++) - if (is_num_user_missing (rows[r].f, x->vars[ROW_VAR])) + if (mv_is_num_user_missing (&x->vars[ROW_VAR]->miss, rows[r].f)) { int c; @@ -1420,7 +1425,7 @@ delete_missing (void) int c; for (c = 0; c < n_cols; c++) - if (is_num_user_missing (cols[c].f, x->vars[COL_VAR])) + if (mv_is_num_user_missing (&x->vars[COL_VAR]->miss, cols[c].f)) { int r; @@ -1641,7 +1646,7 @@ static void table_value_missing (struct tab_table *table, int c, int r, unsigned char opt, const union value *v, const struct variable *var) { - struct len_string s; + struct fixed_string s; const char *label = val_labs_find (var->val_labs, *v); if (label) @@ -1653,7 +1658,7 @@ table_value_missing (struct tab_table *table, int c, int r, unsigned char opt, s.string = tab_alloc (table, var->print.w); format_short (s.string, &var->print, v); s.length = strlen (s.string); - if (cmd.miss == CRS_REPORT && is_num_user_missing (v->f, var)) + if (cmd.miss == CRS_REPORT && mv_is_num_user_missing (&var->miss, v->f)) s.string[s.length++] = 'M'; while (s.length && *s.string == ' ') { @@ -1688,7 +1693,7 @@ format_cell_entry (struct tab_table *table, int c, int r, double value, { const struct fmt_spec f = {FMT_F, 10, 1}; union value v; - struct len_string s; + struct fixed_string s; s.length = 10; s.string = tab_alloc (table, 16); @@ -1736,8 +1741,9 @@ display_crosstabulation (void) int mark_missing = 0; double expected_value = row_tot[r] * col_tot[c] / W; if (cmd.miss == CRS_REPORT - && (is_num_user_missing (cols[c].f, x->vars[COL_VAR]) - || is_num_user_missing (rows[r].f, x->vars[ROW_VAR]))) + && (mv_is_num_user_missing (&x->vars[COL_VAR]->miss, cols[c].f) + || mv_is_num_user_missing (&x->vars[ROW_VAR]->miss, + rows[r].f))) mark_missing = 1; for (i = 0; i < num_cells; i++) { @@ -1802,7 +1808,7 @@ display_crosstabulation (void) int mark_missing = 0; if (cmd.miss == CRS_REPORT - && is_num_user_missing (rows[r].f, x->vars[ROW_VAR])) + && mv_is_num_user_missing (&x->vars[ROW_VAR]->miss, rows[r].f)) mark_missing = 1; for (i = 0; i < num_cells; i++) @@ -1858,7 +1864,7 @@ display_crosstabulation (void) int i; if (cmd.miss == CRS_REPORT && c < n_cols - && is_num_user_missing (cols[c].f, x->vars[COL_VAR])) + && mv_is_num_user_missing (&x->vars[COL_VAR]->miss, cols[c].f)) mark_missing = 1; for (i = 0; i < num_cells; i++)