X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;ds=sidebyside;f=src%2Flanguage%2Fdata-io%2Fmatrix-data.c;h=4898e16ff250040855eb7aef1d68ce3e6e99a2d2;hb=77555681fa75d9b790bf8ba5f8e2aafa853cc183;hp=5c8e011b26d683a1bdda1d38d5400c5eff01ab81;hpb=8eac4df36306cd357bba29ffbfaddc537fc0be47;p=pspp-builds.git diff --git a/src/language/data-io/matrix-data.c b/src/language/data-io/matrix-data.c index 5c8e011b..4898e16f 100644 --- a/src/language/data-io/matrix-data.c +++ b/src/language/data-io/matrix-data.c @@ -1,5 +1,5 @@ /* PSPP - computes sample statistics. - Copyright (C) 1997-9, 2000 Free Software Foundation, Inc. + Copyright (C) 1997-9, 2000, 2006 Free Software Foundation, Inc. Written by Ben Pfaff . This program is free software; you can redistribute it and/or @@ -44,6 +44,7 @@ #include #include +#include "minmax.h" #include "size_max.h" #include "gettext.h" @@ -152,7 +153,7 @@ struct matrix_data_pgm /* Continuous variables. */ int n_continuous; /* Number of continuous variables. */ - int first_continuous; /* Index into dataset_dict (current_dataset).var of + int first_continuous; /* Index into dictionary of first continuous variable. */ }; @@ -168,13 +169,13 @@ static const struct case_source_class matrix_data_without_rowtype_source_class; static int compare_variables_by_mxd_var_type (const void *pa, const void *pb); -static bool read_matrices_without_rowtype (struct matrix_data_pgm *); -static bool read_matrices_with_rowtype (struct matrix_data_pgm *); -static int string_to_content_type (char *, int *); +static bool read_matrices_without_rowtype (struct dataset *ds, struct matrix_data_pgm *); +static bool read_matrices_with_rowtype (struct dataset *ds, struct matrix_data_pgm *); +static int string_to_content_type (const char *, int *); static void attach_mxd_aux (struct variable *, int var_type, int sub_type); int -cmd_matrix_data (void) +cmd_matrix_data (struct lexer *lexer, struct dataset *ds) { struct pool *pool; struct matrix_data_pgm *mx; @@ -183,7 +184,7 @@ cmd_matrix_data (void) unsigned seen = 0; - discard_variables (current_dataset); + discard_variables (ds); pool = pool_create (); mx = pool_alloc (pool, sizeof *mx); @@ -204,11 +205,11 @@ cmd_matrix_data (void) mx->n_contents = 0; mx->n_continuous = 0; mx->first_continuous = 0; - while (token != '.') + while (lex_token (lexer) != '.') { - lex_match ('/'); + lex_match (lexer, '/'); - if (lex_match_id ("VARIABLES")) + if (lex_match_id (lexer, "VARIABLES")) { char **v; size_t nv; @@ -220,8 +221,8 @@ cmd_matrix_data (void) } seen |= 1; - lex_match ('='); - if (!parse_DATA_LIST_vars (&v, &nv, PV_NO_DUPLICATE)) + lex_match (lexer, '='); + if (!parse_DATA_LIST_vars (lexer, &v, &nv, PV_NO_DUPLICATE)) goto lossage; { @@ -248,7 +249,7 @@ cmd_matrix_data (void) if (strcasecmp (v[i], "ROWTYPE_")) { - new_var = dict_create_var_assert (dataset_dict (current_dataset), v[i], 0); + new_var = dict_create_var_assert (dataset_dict (ds), v[i], 0); attach_mxd_aux (new_var, MXD_CONTINUOUS, i); } else @@ -258,47 +259,47 @@ cmd_matrix_data (void) free (v); } - mx->rowtype_ = dict_create_var_assert (dataset_dict (current_dataset), + mx->rowtype_ = dict_create_var_assert (dataset_dict (ds), "ROWTYPE_", 8); attach_mxd_aux (mx->rowtype_, MXD_ROWTYPE, 0); } - else if (lex_match_id ("FILE")) + else if (lex_match_id (lexer, "FILE")) { - lex_match ('='); - fh = fh_parse (FH_REF_FILE | FH_REF_INLINE); + lex_match (lexer, '='); + fh = fh_parse (lexer, FH_REF_FILE | FH_REF_INLINE); if (fh == NULL) goto lossage; } - else if (lex_match_id ("FORMAT")) + else if (lex_match_id (lexer, "FORMAT")) { - lex_match ('='); + lex_match (lexer, '='); - while (token == T_ID) + while (lex_token (lexer) == T_ID) { - if (lex_match_id ("LIST")) + if (lex_match_id (lexer, "LIST")) mx->fmt = LIST; - else if (lex_match_id ("FREE")) + else if (lex_match_id (lexer, "FREE")) mx->fmt = FREE; - else if (lex_match_id ("LOWER")) + else if (lex_match_id (lexer, "LOWER")) mx->section = LOWER; - else if (lex_match_id ("UPPER")) + else if (lex_match_id (lexer, "UPPER")) mx->section = UPPER; - else if (lex_match_id ("FULL")) + else if (lex_match_id (lexer, "FULL")) mx->section = FULL; - else if (lex_match_id ("DIAGONAL")) + else if (lex_match_id (lexer, "DIAGONAL")) mx->diag = DIAGONAL; - else if (lex_match_id ("NODIAGONAL")) + else if (lex_match_id (lexer, "NODIAGONAL")) mx->diag = NODIAGONAL; else { - lex_error (_("in FORMAT subcommand")); + lex_error (lexer, _("in FORMAT subcommand")); goto lossage; } } } - else if (lex_match_id ("SPLIT")) + else if (lex_match_id (lexer, "SPLIT")) { - lex_match ('='); + lex_match (lexer, '='); if (seen & 2) { @@ -307,44 +308,45 @@ cmd_matrix_data (void) } seen |= 2; - if (token != T_ID) + if (lex_token (lexer) != T_ID) { - lex_error (_("in SPLIT subcommand")); + lex_error (lexer, _("in SPLIT subcommand")); goto lossage; } - if (dict_lookup_var (dataset_dict (current_dataset), tokid) == NULL - && (lex_look_ahead () == '.' || lex_look_ahead () == '/')) + if (dict_lookup_var (dataset_dict (ds), lex_tokid (lexer)) == NULL + && (lex_look_ahead (lexer) == '.' || lex_look_ahead (lexer) == '/')) { - if (!strcasecmp (tokid, "ROWTYPE_") - || !strcasecmp (tokid, "VARNAME_")) + if (!strcasecmp (lex_tokid (lexer), "ROWTYPE_") + || !strcasecmp (lex_tokid (lexer), "VARNAME_")) { msg (SE, _("Split variable may not be named ROWTYPE_ " "or VARNAME_.")); goto lossage; } - mx->single_split = dict_create_var_assert (dataset_dict (current_dataset), - tokid, 0); + mx->single_split = dict_create_var_assert (dataset_dict (ds), + lex_tokid (lexer), 0); attach_mxd_aux (mx->single_split, MXD_CONTINUOUS, 0); - lex_get (); + lex_get (lexer); - dict_set_split_vars (dataset_dict (current_dataset), &mx->single_split, 1); + dict_set_split_vars (dataset_dict (ds), &mx->single_split, 1); } else { struct variable **split; size_t n; - if (!parse_variables (dataset_dict (current_dataset), &split, &n, PV_NO_DUPLICATE)) + if (!parse_variables (lexer, dataset_dict (ds), + &split, &n, PV_NO_DUPLICATE)) goto lossage; - dict_set_split_vars (dataset_dict (current_dataset), split, n); + dict_set_split_vars (dataset_dict (ds), split, n); } { - struct variable *const *split = dict_get_split_vars (dataset_dict (current_dataset)); - size_t split_cnt = dict_get_split_cnt (dataset_dict (current_dataset)); + struct variable *const *split = dict_get_split_vars (dataset_dict (ds)); + size_t split_cnt = dict_get_split_cnt (dataset_dict (ds)); int i; for (i = 0; i < split_cnt; i++) @@ -354,7 +356,7 @@ cmd_matrix_data (void) if (mv->var_type != MXD_CONTINUOUS) { msg (SE, _("Split variable %s is already another type."), - tokid); + lex_tokid (lexer)); goto lossage; } var_clear_aux (split[i]); @@ -362,9 +364,9 @@ cmd_matrix_data (void) } } } - else if (lex_match_id ("FACTORS")) + else if (lex_match_id (lexer, "FACTORS")) { - lex_match ('='); + lex_match (lexer, '='); if (seen & 4) { @@ -373,7 +375,7 @@ cmd_matrix_data (void) } seen |= 4; - if (!parse_variables (dataset_dict (current_dataset), &mx->factors, &mx->n_factors, + if (!parse_variables (lexer, dataset_dict (ds), &mx->factors, &mx->n_factors, PV_NONE)) goto lossage; @@ -388,7 +390,7 @@ cmd_matrix_data (void) if (mv->var_type != MXD_CONTINUOUS) { msg (SE, _("Factor variable %s is already another type."), - tokid); + lex_tokid (lexer)); goto lossage; } var_clear_aux (v); @@ -396,9 +398,9 @@ cmd_matrix_data (void) } } } - else if (lex_match_id ("CELLS")) + else if (lex_match_id (lexer, "CELLS")) { - lex_match ('='); + lex_match (lexer, '='); if (mx->cells != -1) { @@ -406,18 +408,18 @@ cmd_matrix_data (void) goto lossage; } - if (!lex_is_integer () || lex_integer () < 1) + if (!lex_is_integer (lexer) || lex_integer (lexer) < 1) { - lex_error (_("expecting positive integer")); + lex_error (lexer, _("expecting positive integer")); goto lossage; } - mx->cells = lex_integer (); - lex_get (); + mx->cells = lex_integer (lexer); + lex_get (lexer); } - else if (lex_match_id ("N")) + else if (lex_match_id (lexer, "N")) { - lex_match ('='); + lex_match (lexer, '='); if (mx->pop_n != -1) { @@ -425,16 +427,16 @@ cmd_matrix_data (void) goto lossage; } - if (!lex_is_integer () || lex_integer () < 1) + if (!lex_is_integer (lexer) || lex_integer (lexer) < 1) { - lex_error (_("expecting positive integer")); + lex_error (lexer, _("expecting positive integer")); goto lossage; } - mx->pop_n = lex_integer (); - lex_get (); + mx->pop_n = lex_integer (lexer); + lex_get (lexer); } - else if (lex_match_id ("CONTENTS")) + else if (lex_match_id (lexer, "CONTENTS")) { int inside_parens = 0; unsigned collide = 0; @@ -447,7 +449,7 @@ cmd_matrix_data (void) } seen |= 8; - lex_match ('='); + lex_match (lexer, '='); { int i; @@ -458,7 +460,7 @@ cmd_matrix_data (void) for (;;) { - if (lex_match ('(')) + if (lex_match (lexer, '(')) { if (inside_parens) { @@ -468,7 +470,7 @@ cmd_matrix_data (void) inside_parens = 1; item = LPAREN; } - else if (lex_match (')')) + else if (lex_match (lexer, ')')) { if (!inside_parens) { @@ -488,20 +490,20 @@ cmd_matrix_data (void) int content_type; int collide_index; - if (token != T_ID) + if (lex_token (lexer) != T_ID) { - lex_error (_("in CONTENTS subcommand")); + lex_error (lexer, _("in CONTENTS subcommand")); goto lossage; } - content_type = string_to_content_type (tokid, + content_type = string_to_content_type (lex_tokid (lexer), &collide_index); if (content_type == -1) { - lex_error (_("in CONTENTS subcommand")); + lex_error (lexer, _("in CONTENTS subcommand")); goto lossage; } - lex_get (); + lex_get (lexer); if (collide & (1 << collide_index)) { @@ -516,7 +518,7 @@ cmd_matrix_data (void) } mx->contents[mx->n_contents++] = item; - if (token == '/' || token == '.') + if (lex_token (lexer) == '/' || lex_token (lexer) == '.') break; } @@ -529,14 +531,14 @@ cmd_matrix_data (void) } else { - lex_error (NULL); + lex_error (lexer, NULL); goto lossage; } } - if (token != '.') + if (lex_token (lexer) != '.') { - lex_error (_("expecting end of command")); + lex_error (lexer, _("expecting end of command")); goto lossage; } @@ -572,7 +574,7 @@ cmd_matrix_data (void) } /* Create VARNAME_. */ - mx->varname_ = dict_create_var_assert (dataset_dict (current_dataset), "VARNAME_", 8); + mx->varname_ = dict_create_var_assert (dataset_dict (ds), "VARNAME_", 8); attach_mxd_aux (mx->varname_, MXD_VARNAME, 0); /* Sort the dictionary variables into the desired order for the @@ -581,9 +583,9 @@ cmd_matrix_data (void) struct variable **v; size_t nv; - dict_get_vars (dataset_dict (current_dataset), &v, &nv, 0); + dict_get_vars (dataset_dict (ds), &v, &nv, 0); qsort (v, nv, sizeof *v, compare_variables_by_mxd_var_type); - dict_reorder_vars (dataset_dict (current_dataset), v, nv); + dict_reorder_vars (dataset_dict (ds), v, nv); free (v); } @@ -601,14 +603,14 @@ cmd_matrix_data (void) int i; mx->first_continuous = -1; - for (i = 0; i < dict_get_var_cnt (dataset_dict (current_dataset)); i++) + for (i = 0; i < dict_get_var_cnt (dataset_dict (ds)); i++) { - struct variable *v = dict_get_var (dataset_dict (current_dataset), i); + struct variable *v = dict_get_var (dataset_dict (ds), i); struct mxd_var *mv = v->aux; int type = mv->var_type; assert (type >= 0 && type < MXD_COUNT); - v->print = v->write = fmt_tab[type]; + var_set_both_formats (v, &fmt_tab[type]); if (type == MXD_CONTINUOUS) mx->n_continuous++; @@ -623,14 +625,14 @@ cmd_matrix_data (void) goto lossage; } - mx->reader = dfm_open_reader (fh); + mx->reader = dfm_open_reader (fh, lexer); if (mx->reader == NULL) goto lossage; if (mx->explicit_rowtype) - ok = read_matrices_with_rowtype (mx); + ok = read_matrices_with_rowtype (ds, mx); else - ok = read_matrices_without_rowtype (mx); + ok = read_matrices_without_rowtype (ds, mx); dfm_close_reader (mx->reader); @@ -639,7 +641,7 @@ cmd_matrix_data (void) return ok ? CMD_SUCCESS : CMD_CASCADING_FAILURE; lossage: - discard_variables (current_dataset); + discard_variables (ds); free (mx->factors); pool_destroy (mx->container); return CMD_CASCADING_FAILURE; @@ -651,7 +653,7 @@ lossage: as a bit-index) which can be used for determining whether a related statistic has already been used. */ static int -string_to_content_type (char *s, int *collide) +string_to_content_type (const char *s, int *collide) { static const struct { @@ -864,17 +866,9 @@ static int s = ss_buffer (start, ss_data (p) - start); if (is_num) - { - struct data_in di; - - di.s = ss_data (s); - di.e = ss_end (s); - di.v = (union value *) &token->number; - di.f1 = dfm_get_column (reader, di.s); - di.format = make_output_format (FMT_F, token->length, 0); - - data_in (&di); - } + data_in (s, FMT_F, 0, + dfm_get_column (reader, ss_data (s)), + (union value *) &token->number, 0); else token->type = MSTR; } @@ -912,6 +906,7 @@ force_eol (struct dfm_reader *reader, const char *content) struct nr_aux_data { + const struct dictionary *dict; /* The dictionary */ struct matrix_data_pgm *mx; /* MATRIX DATA program. */ double ***data; /* MATRIX DATA data. */ double *factor_values; /* Factor values. */ @@ -932,7 +927,7 @@ static bool matrix_data_read_without_rowtype (struct case_source *source, /* Read from the data file and write it to the active file. Returns true if successful, false if an I/O error occurred. */ static bool -read_matrices_without_rowtype (struct matrix_data_pgm *mx) +read_matrices_without_rowtype (struct dataset *ds, struct matrix_data_pgm *mx) { struct nr_aux_data nr; bool ok; @@ -941,17 +936,18 @@ read_matrices_without_rowtype (struct matrix_data_pgm *mx) mx->cells = 1; nr.mx = mx; + nr.dict = dataset_dict (ds); nr.data = NULL; nr.factor_values = xnmalloc (mx->n_factors * mx->cells, sizeof *nr.factor_values); nr.max_cell_idx = 0; - nr.split_values = xnmalloc (dict_get_split_cnt (dataset_dict (current_dataset)), + nr.split_values = xnmalloc (dict_get_split_cnt (dataset_dict (ds)), sizeof *nr.split_values); - proc_set_source (current_dataset, create_case_source ( + proc_set_source (ds, create_case_source ( &matrix_data_without_rowtype_source_class, &nr)); - ok = procedure (current_dataset,NULL, NULL); + ok = procedure (ds, NULL, NULL); free (nr.split_values); free (nr.factor_values); @@ -1089,7 +1085,7 @@ nr_read_data_lines (struct nr_aux_data *nr, if (token.type != MNUM) { msg (SE, _("expecting value for %s %s"), - dict_get_var (dataset_dict (current_dataset), j)->name, + var_get_name (dict_get_var (nr->dict, j)), context (mx->reader)); return 0; } @@ -1206,7 +1202,7 @@ matrix_data_read_without_rowtype (struct case_source *source, if (!nr_output_data (nr, c, write_case, wc_data)) return false; - if (dict_get_split_cnt (dataset_dict (current_dataset)) == 0 + if (dict_get_split_cnt (nr->dict) == 0 || !another_token (mx->reader)) return true; } @@ -1229,14 +1225,14 @@ nr_read_splits (struct nr_aux_data *nr, int compare) return true; } - if (dict_get_split_vars (dataset_dict (current_dataset)) == NULL) + if (dict_get_split_vars (nr->dict) == NULL) return true; if (mx->single_split) { if (!compare) { - struct mxd_var *mv = dict_get_split_vars (dataset_dict (current_dataset))[0]->aux; + struct mxd_var *mv = dict_get_split_vars (nr->dict)[0]->aux; nr->split_values[0] = ++mv->sub_type; } return true; @@ -1245,7 +1241,7 @@ nr_read_splits (struct nr_aux_data *nr, int compare) if (!compare) just_read = 1; - split_cnt = dict_get_split_cnt (dataset_dict (current_dataset)); + split_cnt = dict_get_split_cnt (nr->dict); for (i = 0; i < split_cnt; i++) { struct matrix_token token; @@ -1264,7 +1260,7 @@ nr_read_splits (struct nr_aux_data *nr, int compare) { msg (SE, _("Expecting value %g for %s."), nr->split_values[i], - dict_get_split_vars (dataset_dict (current_dataset))[i]->name); + var_get_name (dict_get_split_vars (nr->dict)[i])); return false; } } @@ -1314,7 +1310,7 @@ nr_read_factors (struct nr_aux_data *nr, int cell) { msg (SE, _("Syntax error expecting value %g for %s %s."), nr->factor_values[i + mx->n_factors * cell], - mx->factors[i]->name, context (mx->reader)); + var_get_name (mx->factors[i]), context (mx->reader)); return false; } } @@ -1327,7 +1323,8 @@ nr_read_factors (struct nr_aux_data *nr, int cell) CP to the active file. Returns true if successful, false if an I/O error occurred. */ static bool -dump_cell_content (struct matrix_data_pgm *mx, int content, double *cp, +dump_cell_content (const struct dictionary *dict, + struct matrix_data_pgm *mx, int content, double *cp, struct ccase *c, write_case_func *write_case, write_case_data wc_data) { @@ -1351,14 +1348,14 @@ dump_cell_content (struct matrix_data_pgm *mx, int content, double *cp, for (j = 0; j < mx->n_continuous; j++) { - int fv = dict_get_var (dataset_dict (current_dataset), mx->first_continuous + j)->fv; + int fv = dict_get_var (dict, mx->first_continuous + j)->fv; case_data_rw (c, fv)->f = *cp; cp++; } if (type == 1) buf_copy_str_rpad (case_data_rw (c, mx->varname_->fv)->s, 8, - dict_get_var (dataset_dict (current_dataset), - mx->first_continuous + i)->name); + var_get_name ( + dict_get_var (dict, mx->first_continuous + i))); if (!write_case (wc_data)) return false; } @@ -1378,8 +1375,8 @@ nr_output_data (struct nr_aux_data *nr, struct ccase *c, size_t split_cnt; size_t i; - split_cnt = dict_get_split_cnt (dataset_dict (current_dataset)); - split = dict_get_split_vars (dataset_dict (current_dataset)); + split_cnt = dict_get_split_cnt (nr->dict); + split = dict_get_split_vars (nr->dict); for (i = 0; i < split_cnt; i++) case_data_rw (c, split[i]->fv)->f = nr->split_values[i]; } @@ -1407,7 +1404,8 @@ nr_output_data (struct nr_aux_data *nr, struct ccase *c, assert (nr->data[content] != NULL && nr->data[content][cell] != NULL); - if (!dump_cell_content (mx, content, nr->data[content][cell], + if (!dump_cell_content (nr->dict, mx, + content, nr->data[content][cell], c, write_case, wc_data)) return false; } @@ -1428,7 +1426,7 @@ nr_output_data (struct nr_aux_data *nr, struct ccase *c, for (content = 0; content <= PROX; content++) if (!mx->is_per_factor[content] && nr->data[content] != NULL) { - if (!dump_cell_content (mx, content, nr->data[content][0], + if (!dump_cell_content (nr->dict, mx, content, nr->data[content][0], c, write_case, wc_data)) return false; } @@ -1451,6 +1449,7 @@ struct factor_data /* With ROWTYPE_ auxiliary data. */ struct wr_aux_data { + const struct dictionary *dict; /* The dictionary */ struct matrix_data_pgm *mx; /* MATRIX DATA program. */ int content; /* Type of current row. */ double *split_values; /* SPLIT FILE variable values. */ @@ -1475,7 +1474,7 @@ static bool matrix_data_read_with_rowtype (struct case_source *, them to the output file. Returns true if successful, false if an I/O error occurred. */ static bool -read_matrices_with_rowtype (struct matrix_data_pgm *mx) +read_matrices_with_rowtype (struct dataset *ds, struct matrix_data_pgm *mx) { struct wr_aux_data wr; bool ok; @@ -1485,12 +1484,13 @@ read_matrices_with_rowtype (struct matrix_data_pgm *mx) wr.split_values = NULL; wr.data = NULL; wr.current = NULL; + wr.dict = dataset_dict (ds); mx->cells = 0; - proc_set_source (current_dataset, + proc_set_source (ds, create_case_source (&matrix_data_with_rowtype_source_class, &wr)); - ok = procedure (current_dataset,NULL, NULL); + ok = procedure (ds, NULL, NULL); free (wr.split_values); return ok; @@ -1534,7 +1534,7 @@ wr_read_splits (struct wr_aux_data *wr, bool compare; size_t split_cnt; - split_cnt = dict_get_split_cnt (dataset_dict (current_dataset)); + split_cnt = dict_get_split_cnt (wr->dict); if (split_cnt == 0) return true; @@ -1578,7 +1578,7 @@ wr_read_splits (struct wr_aux_data *wr, /* Compares doubles A and B, treating SYSMIS as greatest. */ static int -compare_doubles (const void *a_, const void *b_, void *aux UNUSED) +compare_doubles (const void *a_, const void *b_, const void *aux UNUSED) { const double *a = a_; const double *b = b_; @@ -1598,9 +1598,9 @@ compare_doubles (const void *a_, const void *b_, void *aux UNUSED) /* Return strcmp()-type comparison of the MX->n_factors factors at _A and _B. Sort missing values toward the end. */ static int -compare_factors (const void *a_, const void *b_, void *mx_) +compare_factors (const void *a_, const void *b_, const void *mx_) { - struct matrix_data_pgm *mx = mx_; + const struct matrix_data_pgm *mx = mx_; struct factor_data *const *pa = a_; struct factor_data *const *pb = b_; const double *a = (*pa)->factors; @@ -1628,8 +1628,8 @@ wr_output_data (struct wr_aux_data *wr, size_t split_cnt; size_t i; - split_cnt = dict_get_split_cnt (dataset_dict (current_dataset)); - split = dict_get_split_vars (dataset_dict (current_dataset)); + split_cnt = dict_get_split_cnt (wr->dict); + split = dict_get_split_vars (wr->dict); for (i = 0; i < split_cnt; i++) case_data_rw (c, split[i]->fv)->f = wr->split_values[i]; } @@ -1697,7 +1697,8 @@ wr_output_data (struct wr_aux_data *wr, fill_matrix (mx, content, iter->data[content]); - ok = dump_cell_content (mx, content, iter->data[content], + ok = dump_cell_content (wr->dict, mx, content, + iter->data[content], c, write_case, wc_data); if (!ok) break; @@ -1737,8 +1738,8 @@ wr_read_rowtype (struct wr_aux_data *wr, char s[16]; char *cp; - memcpy (s, token->string, min (15, token->length)); - s[min (15, token->length)] = 0; + memcpy (s, token->string, MIN (15, token->length)); + s[MIN (15, token->length)] = 0; for (cp = s; *cp; cp++) *cp = toupper ((unsigned char) *cp); @@ -1956,7 +1957,8 @@ wr_read_indeps (struct wr_aux_data *wr) if (token.type != MNUM) { msg (SE, _("Syntax error expecting value for %s %s."), - dict_get_var (dataset_dict (current_dataset), mx->first_continuous + j)->name, + var_get_name (dict_get_var (wr->dict, + mx->first_continuous + j)), context (mx->reader)); return false; }