projects
/
pspp
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Replaced implementation of psppire-axis.
[pspp]
/
src
/
language
/
stats
/
means.q
diff --git
a/src/language/stats/means.q
b/src/language/stats/means.q
index a1aa7229ebaa87d0feabe9a27d5cb51df0411bc7..071253f3efa17ab64e2f412c724011055f3186d1 100644
(file)
--- a/
src/language/stats/means.q
+++ b/
src/language/stats/means.q
@@
-1,21
+1,18
@@
-/* PSPP -
computes sample statistic
s.
+/* PSPP -
a program for statistical analysi
s.
Copyright (C) 1997-9, 2000 Free Software Foundation, Inc.
Copyright (C) 1997-9, 2000 Free Software Foundation, Inc.
- Written by Ben Pfaff <blp@gnu.org>.
- 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 the Free Software Foundation; either version 2 of the
-
License, or
(at your option) any later version.
+ 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
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
- This program is distributed in the hope that it will be useful,
but
- WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU
- General Public License for more details.
+ This program is distributed in the hope that it will be useful,
+
but
WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ G
NU G
eneral Public License for more details.
You should have received a copy of the GNU General Public License
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., 51 Franklin Street, Fifth Floor, Boston, MA
- 02110-1301, USA. */
+ along with this program. If not, see <http://www.gnu.org/licenses/>. */
#include <config.h>
#include <config.h>
@@
-27,11
+24,11
@@
#include <data/variable.h>
#include <language/command.h>
#include <language/lexer/lexer.h>
#include <data/variable.h>
#include <language/command.h>
#include <language/lexer/lexer.h>
-#include <libpspp/alloc.h>
#include <libpspp/hash.h>
#include <libpspp/hash.h>
-#include <libpspp/magic.h>
#include <libpspp/message.h>
#include <libpspp/message.h>
+#include "xalloc.h"
+
#include "gettext.h"
#define _(msgid) gettext (msgid)
#include "gettext.h"
#define _(msgid) gettext (msgid)
@@
-44,7
+41,7
@@
name:!names/nonames,
val:!values/novalues,
fmt:!table/tree;
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.
*/
+cells[cl_]=default,count,sum,mean,stddev,variance,all;
+statistics[st_]=anova,linearity,all,none.
*/
@@
-52,27
+49,26
@@
/* (functions) */
/* TABLES: Variable lists for each dimension. */
/* (functions) */
/* TABLES: Variable lists for each dimension. */
-
int n_dim;
/* Number of dimensions. */
-s
ize_t *nv_dim;
/* Number of variables in each dimension. */
-st
ruct variable ***v_dim;
/* Variables in each dimension. */
+
static int n_dim;
/* Number of dimensions. */
+s
tatic size_t *nv_dim;
/* Number of variables in each dimension. */
+st
atic const struct variable ***v_dim;
/* Variables in each dimension. */
/* VARIABLES: List of variables. */
/* VARIABLES: List of variables. */
-int n_var;
-struct variable **v_var;
+static struct variable **v_var;
/* Parses and executes the T-TEST procedure. */
int
/* 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;
{
struct cmd_means cmd;
int success = CMD_FAILURE;
-
+
n_dim = 0;
nv_dim = NULL;
v_dim = NULL;
v_var = NULL;
n_dim = 0;
nv_dim = NULL;
v_dim = NULL;
v_var = NULL;
- if (!parse_means (
&cmd
))
+ if (!parse_means (
lexer, ds, &cmd, NULL
))
goto free;
if (cmd.sbc_cells)
goto free;
if (cmd.sbc_cells)
@@
-110,28
+106,28
@@
cmd_means (void)
free:
{
int i;
free:
{
int i;
-
+
for (i = 0; i < n_dim; i++)
free (v_dim[i]);
free (nv_dim);
free (v_dim);
free (v_var);
}
for (i = 0; i < n_dim; i++)
free (v_dim[i]);
free (nv_dim);
free (v_dim);
free (v_var);
}
-
+
return success;
}
/* Parses the TABLES subcommand. */
static int
return success;
}
/* 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;
-
- if (!lex_match_id ("TABLES")
- && (
token != T_ID || dict_lookup_var (default_dict, tokid
) == NULL)
- &&
token
!= T_ALL)
+ struct
const_
var_set *var_set;
+
+ 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;
return 2;
- lex_match ('=');
+ lex_match (
lexer,
'=');
if (cmd->sbc_tables)
{
if (cmd->sbc_tables)
{
@@
-140,18
+136,18
@@
mns_custom_tables (struct cmd_means *cmd)
return 0;
}
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;
assert (var_set != NULL);
do
{
size_t nvl;
- struct variable **vl;
+
const
struct variable **vl;
- if (!parse_
var_set_vars (
var_set, &vl, &nvl,
- PV_NO_DUPLICATE | PV_NO_SCRATCH))
+ if (!parse_
const_var_set_vars (lexer,
var_set, &vl, &nvl,
+ PV_NO_DUPLICATE | PV_NO_SCRATCH))
goto lossage;
goto lossage;
-
+
n_dim++;
nv_dim = xnrealloc (nv_dim, n_dim, sizeof *nv_dim);
v_dim = xnrealloc (v_dim, n_dim, sizeof *v_dim);
n_dim++;
nv_dim = xnrealloc (nv_dim, n_dim, sizeof *nv_dim);
v_dim = xnrealloc (v_dim, n_dim, sizeof *v_dim);
@@
-159,17
+155,17
@@
mns_custom_tables (struct cmd_means *cmd)
nv_dim[n_dim - 1] = nvl;
v_dim[n_dim - 1] = vl;
}
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:
return 1;
lossage:
- var_set_destroy (var_set);
+
const_
var_set_destroy (var_set);
return 0;
}
return 0;
}
-/*
+/*
Local Variables:
mode: c
End:
Local Variables:
mode: c
End: