projects
/
pspp
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Make the expression code a little nicer and fix bugs found
[pspp]
/
src
/
descript.q
diff --git
a/src/descript.q
b/src/descript.q
index 6ccec2a44a4f361747c58813bd051a762cfacfc5..9ba2b569c79dbf69e80e90e493c71579d30ff0de 100644
(file)
--- a/
src/descript.q
+++ b/
src/descript.q
@@
-20,7
+20,7
@@
/* FIXME: Many possible optimizations. */
#include <config.h>
/* FIXME: Many possible optimizations. */
#include <config.h>
-#include
<assert.h>
+#include
"error.h"
#include <limits.h>
#include <math.h>
#include <stdlib.h>
#include <limits.h>
#include <math.h>
#include <stdlib.h>
@@
-30,7
+30,6
@@
#include "command.h"
#include "lexer.h"
#include "error.h"
#include "command.h"
#include "lexer.h"
#include "error.h"
-#include "approx.h"
#include "magic.h"
#include "stats.h"
#include "som.h"
#include "magic.h"
#include "stats.h"
#include "som.h"
@@
-178,9
+177,9
@@
static void dump_z_table (void);
static void run_z_pass (void);
/* Procedure execution functions. */
static void run_z_pass (void);
/* Procedure execution functions. */
-static int calc (struct ccase *);
-static void precalc (void);
-static void postcalc (void);
+static int calc (struct ccase *
, void *
);
+static void precalc (void
*
);
+static void postcalc (void
*
);
static void display (void);
\f
/* Parser and outline. */
static void display (void);
\f
/* Parser and outline. */
@@
-194,8
+193,6
@@
cmd_descriptives (void)
v_variables = NULL;
n_variables = 0;
v_variables = NULL;
n_variables = 0;
- lex_match_id ("DESCRIPTIVES");
- lex_match_id ("CONDESCRIPTIVES");
if (!parse_descriptives (&cmd))
goto lossage;
if (!parse_descriptives (&cmd))
goto lossage;
@@
-289,7
+286,7
@@
cmd_descriptives (void)
/* Data pass! */
bad_weight = 0;
/* Data pass! */
bad_weight = 0;
- procedure
(precalc, calc, postcalc
);
+ procedure
_with_splits (precalc, calc, postcalc, NULL
);
if (bad_weight)
msg (SW, _("At least one case in the data file had a weight value "
if (bad_weight)
msg (SW, _("At least one case in the data file had a weight value "
@@
-477,7
+474,8
@@
dump_z_table (void)
/* Transformation function to calculate Z-scores. */
static int
/* Transformation function to calculate Z-scores. */
static int
-descriptives_trns_proc (struct trns_header * trns, struct ccase * c)
+descriptives_trns_proc (struct trns_header * trns, struct ccase * c,
+ int case_num UNUSED)
{
struct descriptives_trns *t = (struct descriptives_trns *) trns;
struct dsc_z_score *z;
{
struct descriptives_trns *t = (struct descriptives_trns *) trns;
struct dsc_z_score *z;
@@
-539,9
+537,9
@@
run_z_pass (void)
struct variable *d;
t->z[count].s = v;
struct variable *d;
t->z[count].s = v;
- t->z[count].d = d = dict_create_var (default_dict,
- v->p.dsc.zname, 0);
-
assert (d != NULL)
;
+ t->z[count].d = d = dict_create_var
_assert
(default_dict,
+
v->p.dsc.zname, 0);
+
d->init = 0
;
if (v->label)
{
d->label = xmalloc (strlen (v->label) + 12);
if (v->label)
{
d->label = xmalloc (strlen (v->label) + 12);
@@
-556,8
+554,7
@@
run_z_pass (void)
}
t->z[count].mean = v->p.dsc.stats[dsc_mean];
t->z[count].std_dev = v->p.dsc.stats[dsc_stddev];
}
t->z[count].mean = v->p.dsc.stats[dsc_mean];
t->z[count].std_dev = v->p.dsc.stats[dsc_stddev];
- if (t->z[count].std_dev == SYSMIS
- || approx_eq (t->z[count].std_dev, 0.0))
+ if (t->z[count].std_dev == SYSMIS || t->z[count].std_dev == 0.0)
t->z[count].mean = SYSMIS;
count++;
}
t->z[count].mean = SYSMIS;
count++;
}
@@
-569,7
+566,7
@@
run_z_pass (void)
/* Statistical calculation. */
static void
/* Statistical calculation. */
static void
-precalc (void)
+precalc (void
*aux UNUSED
)
{
int i;
{
int i;
@@
-593,7
+590,7
@@
precalc (void)
}
static int
}
static int
-calc (struct ccase * c)
+calc (struct ccase * c
, void *aux UNUSED
)
{
int i;
{
int i;
@@
-685,7
+682,7
@@
iterate:
}
static void
}
static void
-postcalc (void)
+postcalc (void
*aux UNUSED
)
{
int i;
{
int i;