+Thu Nov 4 11:09:01 WST 2004 John Darrington <john@darrington.wattle.id.au>
+
+ * q2c.c examine.q Fixed a bug (feature?) whereby arrays in the
+ command which had settings didn't get the appropriate code
+ generated.
+
+ * val.h value-labels.[ch] var-labs.c Added v*to_string functions
+ to convert variables/values to strings.
+
+ * examine.q Added framework for the EXAMINE command.
+
Mon Nov 1 12:46:17 WST 2004 John Darrington <john@darrington.wattle.id.au>
* q2c.c frequencies.q set.q t-test.q Fixed the q2c parsing of DBL
#include "casefile.h"
/* (specification)
- "EXAMINE" (examine_):
+ "EXAMINE" (xmn_):
*variables=custom;
+total=custom;
+nototal=custom;
int i;
short total=1;
+
+
if ( !parse_examine(&cmd) )
return CMD_FAILURE;
+
+ if ( cmd.st_n == SYSMIS )
+ cmd.st_n = 5;
if ( ! cmd.sbc_cinterval)
cmd.n_cinterval[0] = 95.0;
if ( cmd.sbc_statistics )
{
- if ( cmd.a_statistics[EXAMINE_ST_DESCRIPTIVES])
+ if ( cmd.a_statistics[XMN_ST_DESCRIPTIVES])
show_descriptives(dependent_vars, n_dependent_vars, 0);
- if ( cmd.st_n != SYSMIS )
+ if ( cmd.a_statistics[XMN_ST_EXTREME])
show_extremes(dependent_vars, n_dependent_vars, 0, cmd.st_n);
}
}
if ( cmd.sbc_statistics )
{
- if ( cmd.a_statistics[EXAMINE_ST_DESCRIPTIVES])
+ if ( cmd.a_statistics[XMN_ST_DESCRIPTIVES])
show_descriptives(dependent_vars, n_dependent_vars,f);
- if ( cmd.st_n != SYSMIS )
+ if ( cmd.a_statistics[XMN_ST_EXTREME])
show_extremes(dependent_vars, n_dependent_vars,f,cmd.st_n);
}
}
/* TOTAL and NOTOTAL are simple, mutually exclusive flags */
static int
-examine_custom_total(struct cmd_examine *p)
+xmn_custom_total(struct cmd_examine *p)
{
if ( p->sbc_nototal )
{
}
static int
-examine_custom_nototal(struct cmd_examine *p)
+xmn_custom_nototal(struct cmd_examine *p)
{
if ( p->sbc_total )
{
/* Parser for the variables sub command */
static int
-examine_custom_variables(struct cmd_examine *cmd )
+xmn_custom_variables(struct cmd_examine *cmd )
{
lex_match('=');
}
skip_token (':');
+ if ( sbc->type == SBC_ARRAY && token == T_ID )
+ {
+ spec->varname = xstrdup (st_lower (tokstr));
+ spec->index = sbc->narray;
+ sbc->narray++;
+ }
+
+
+
/* Parse all the settings. */
{
setting **s = &spec->s;
sbc->type = SBC_ARRAY;
parse_specifiers (sbc);
+
}
else
{
specifier *spec;
for (spec = sbc->spec; spec; spec = spec->next)
- if (!spec->s)
dump (0, "%s%s%s = %d,",
st_upper (prefix), st_upper (sbc->prefix),
st_upper (spec->varname), spec->index);
spec->varname);
else if (f == 0)
{
- dump (0, "int a_%s[%d];",
- st_lower (sbc->name), sbc->narray);
+ dump (0, "int a_%s[%s%scount];",
+ st_lower (sbc->name),
+ st_upper (prefix),
+ st_upper (sbc->prefix)
+ );
+
f = 1;
}
}
dump (1, "%sif (%s)", first ? "" : "else ",
make_match (s->specname));
+
/* Handle values. */
if (s->value == VAL_NONE)
dump (0, "p->%s%s = %s%s;", sbc->prefix, spec->varname,
dump (1, "{");
if (spec->varname)
- dump (0, "p->%s%s = %s%s;", sbc->prefix, spec->varname,
- st_upper (prefix), find_symbol (s->con)->name);
-
+ {
+ dump (0, "p->%s%s = %s%s;", sbc->prefix, spec->varname,
+ st_upper (prefix), find_symbol (s->con)->name);
+
+ if ( sbc->type == SBC_ARRAY )
+ dump (0, "p->a_%s[%s%s%s] = 1;",
+ st_lower (sbc->name),
+ st_upper (prefix), st_upper (sbc->prefix),
+ st_upper (spec->varname));
+ }
+
+
if (s->valtype == VT_PAREN)
{
if (s->optvalue)
struct val_labs_iterator **);
void val_labs_done (struct val_labs_iterator **);
+/* Return a string representing this value, in the form most
+ appropriate from a human factors perspective.
+ (IE: the label if it has one, otherwise the alpha/numeric )
+*/
+const char *value_to_string(const union value *, const struct variable *);
+
#endif /* value-labels.h */
int parse_DATA_LIST_vars (char ***names, int *cnt, int opts);
int parse_mixed_vars (char ***names, int *cnt, int opts);
+
+
+/* Return a string representing this variable, in the form most
+ appropriate from a human factors perspective.
+ (IE: the label if it has one, otherwise the name )
+*/
+const char * var_to_string(const struct variable *var);
+
+
#endif /* !var_h */