X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=src%2Flanguage%2Fstats%2Fmeans.q;h=10c6d3c11a68be154466e08e5ce45d6d00af2699;hb=363146425140109e009256f769b78a44a4f27bb6;hp=017b53fe96278c06c1d00dbfa86f6dcd7c75f6d8;hpb=dcf9b154cbcaa35c3d8459a201b77eec8bcb30bd;p=pspp-builds.git diff --git a/src/language/stats/means.q b/src/language/stats/means.q index 017b53fe..10c6d3c1 100644 --- a/src/language/stats/means.q +++ b/src/language/stats/means.q @@ -1,6 +1,5 @@ /* PSPP - computes sample statistics. Copyright (C) 1997-9, 2000 Free Software Foundation, Inc. - Written by Ben Pfaff . This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as @@ -18,25 +17,25 @@ 02110-1301, USA. */ #include + #include #include -#include "dictionary.h" -#include "message.h" -#include "alloc.h" -#include "command.h" -#include "hash.h" -#include "lexer.h" -#include "message.h" -#include "magic.h" -#include "variable.h" + +#include +#include +#include +#include +#include +#include +#include +#include +#include #include "gettext.h" #define _(msgid) gettext (msgid) /* (headers) */ -#include "debug-print.h" - /* (specification) means (mns_): *tables=custom; @@ -44,7 +43,7 @@ name:!names/nonames, val:!values/novalues, fmt:!table/tree; - +missing=miss:!table/include/dependent; + missing=miss:!table/include/dependent; +cells[cl_]=default,count,sum,mean,stddev,variance,all; +statistics[st_]=anova,linearity,all,none. */ @@ -52,17 +51,16 @@ /* (functions) */ /* TABLES: Variable lists for each dimension. */ -int n_dim; /* Number of dimensions. */ -size_t *nv_dim; /* Number of variables in each dimension. */ -struct variable ***v_dim; /* Variables in each dimension. */ +static int n_dim; /* Number of dimensions. */ +static size_t *nv_dim; /* Number of variables in each dimension. */ +static const struct variable ***v_dim; /* Variables in each dimension. */ /* VARIABLES: List of variables. */ -int n_var; -struct variable **v_var; +static struct variable **v_var; /* Parses and executes the T-TEST procedure. */ int -cmd_means (void) +cmd_means (struct lexer *lexer, struct dataset *ds) { struct cmd_means cmd; int success = CMD_FAILURE; @@ -72,7 +70,7 @@ cmd_means (void) v_dim = NULL; v_var = NULL; - if (!parse_means (&cmd)) + if (!parse_means (lexer, ds, &cmd, NULL)) goto free; if (cmd.sbc_cells) @@ -123,15 +121,15 @@ free: /* Parses the TABLES subcommand. */ static int -mns_custom_tables (struct cmd_means *cmd) +mns_custom_tables (struct lexer *lexer, struct dataset *ds, struct cmd_means *cmd, void *aux UNUSED) { - struct var_set *var_set; + struct const_var_set *var_set; - if (!lex_match_id ("TABLES") - && (token != T_ID || dict_lookup_var (default_dict, tokid) == NULL) - && token != T_ALL) + if (!lex_match_id (lexer, "TABLES") + && (lex_token (lexer) != T_ID || dict_lookup_var (dataset_dict (ds), lex_tokid (lexer)) == NULL) + && lex_token (lexer) != T_ALL) return 2; - lex_match ('='); + lex_match (lexer, '='); if (cmd->sbc_tables) { @@ -140,15 +138,15 @@ mns_custom_tables (struct cmd_means *cmd) return 0; } - var_set = var_set_create_from_dict (default_dict); + var_set = const_var_set_create_from_dict (dataset_dict (ds)); assert (var_set != NULL); do { size_t nvl; - struct variable **vl; + const struct variable **vl; - if (!parse_var_set_vars (var_set, &vl, &nvl, + if (!parse_const_var_set_vars (lexer, var_set, &vl, &nvl, PV_NO_DUPLICATE | PV_NO_SCRATCH)) goto lossage; @@ -159,13 +157,13 @@ mns_custom_tables (struct cmd_means *cmd) nv_dim[n_dim - 1] = nvl; v_dim[n_dim - 1] = vl; } - while (lex_match (T_BY)); + while (lex_match (lexer, T_BY)); - var_set_destroy (var_set); + const_var_set_destroy (var_set); return 1; lossage: - var_set_destroy (var_set); + const_var_set_destroy (var_set); return 0; }