X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=src%2Flanguage%2Fstats%2Fcrosstabs.q;h=b12bf6cfe60915dd91afa4f249b6a3f4b6fc3300;hb=81579d9e9f994fb2908f50af41c3eb033d216e58;hp=0e7b3daecb01ce1ddc3c0e70fc45e9f39c79af3c;hpb=691c25e36fd1ee722dd35419d6110e3876b99f9c;p=pspp-builds.git diff --git a/src/language/stats/crosstabs.q b/src/language/stats/crosstabs.q index 0e7b3dae..b12bf6cf 100644 --- a/src/language/stats/crosstabs.q +++ b/src/language/stats/crosstabs.q @@ -1,5 +1,5 @@ /* PSPP - a program for statistical analysis. - Copyright (C) 1997-9, 2000, 2006, 2009, 2010 Free Software Foundation, Inc. + Copyright (C) 1997-9, 2000, 2006, 2009, 2010, 2011 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 @@ -33,34 +33,34 @@ #include #include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include "minmax.h" -#include "xalloc.h" -#include "xsize.h" +#include "data/case.h" +#include "data/casegrouper.h" +#include "data/casereader.h" +#include "data/data-out.h" +#include "data/dictionary.h" +#include "data/format.h" +#include "data/procedure.h" +#include "data/value-labels.h" +#include "data/variable.h" +#include "language/command.h" +#include "language/dictionary/split-file.h" +#include "language/lexer/lexer.h" +#include "language/lexer/variable-parser.h" +#include "libpspp/array.h" +#include "libpspp/assertion.h" +#include "libpspp/compiler.h" +#include "libpspp/hash-functions.h" +#include "libpspp/hmap.h" +#include "libpspp/hmapx.h" +#include "libpspp/message.h" +#include "libpspp/misc.h" +#include "libpspp/pool.h" +#include "libpspp/str.h" +#include "output/tab.h" + +#include "gl/minmax.h" +#include "gl/xalloc.h" +#include "gl/xsize.h" #include "gettext.h" #define _(msgid) gettext (msgid) @@ -381,7 +381,7 @@ crs_custom_tables (struct lexer *lexer, struct dataset *ds, /* Ensure that this is a TABLES subcommand. */ if (!lex_match_id (lexer, "TABLES") && (lex_token (lexer) != T_ID || - dict_lookup_var (dataset_dict (ds), lex_tokid (lexer)) == NULL) + dict_lookup_var (dataset_dict (ds), lex_tokcstr (lexer)) == NULL) && lex_token (lexer) != T_ALL) return 2; lex_match (lexer, T_EQUALS); @@ -1189,20 +1189,15 @@ create_crosstab_table (struct crosstabs_proc *proc, struct pivot_table *pt) for (i = 0; i < pt->n_consts; i++) { const struct variable *var = pt->const_vars[i]; - size_t ofs; - char *s = NULL; + char *s; ds_put_format (&title, ", %s=", var_get_name (var)); - /* Insert the formatted value of the variable, then trim - leading spaces in what was just inserted. */ - ofs = ds_length (&title); + /* Insert the formatted value of VAR without any leading spaces. */ s = data_out (&pt->const_values[i], var_get_encoding (var), var_get_print_format (var)); - ds_put_cstr (&title, s); + ds_put_cstr (&title, s + strspn (s, " ")); free (s); - ds_remove (&title, ofs, ss_cspan (ds_substr (&title, ofs, SIZE_MAX), - ss_cstr (" "))); } ds_put_cstr (&title, " [");