#include <language/command.h>
#include <language/data-io/file-handle.h>
#include <language/lexer/lexer.h>
+#include <language/lexer/variable-parser.h>
#include <language/stats/sort-criteria.h>
#include <libpspp/alloc.h>
-#include <libpspp/message.h>
+#include <libpspp/assertion.h>
#include <libpspp/message.h>
#include <libpspp/misc.h>
#include <libpspp/pool.h>
const struct ccase *);
/* Prototypes. */
-static int parse_aggregate_functions (struct agr_proc *);
+static bool parse_aggregate_functions (struct agr_proc *);
static void agr_destroy (struct agr_proc *);
-static int aggregate_single_case (struct agr_proc *agr,
+static bool aggregate_single_case (struct agr_proc *agr,
const struct ccase *input,
struct ccase *output);
static void dump_aggregate_info (struct agr_proc *agr, struct ccase *output);
}
/* Parse all the aggregate functions. */
-static int
+static bool
parse_aggregate_functions (struct agr_proc *agr)
{
struct agr_var *tail; /* Tail of linked list starting at agr->vars. */
if (token == T_STRING)
{
ds_truncate (&tokstr, 255);
- dest_label[n_dest - 1] = xstrdup (ds_c_str (&tokstr));
+ dest_label[n_dest - 1] = ds_xstrdup (&tokstr);
lex_get ();
}
}
lex_match (',');
if (token == T_STRING)
{
- arg[i].c = xstrdup (ds_c_str (&tokstr));
+ arg[i].c = ds_xstrdup (&tokstr);
type = ALPHA;
}
else if (lex_is_number ())
if (!lex_match ('/'))
{
if (token == '.')
- return 1;
+ return true;
lex_error ("expecting end of command");
- return 0;
+ return false;
}
continue;
}
free (src);
- return 0;
+ return false;
}
}
static void dump_aggregate_info (struct agr_proc *, struct ccase *);
/* Processes a single case INPUT for aggregation. If output is
- warranted, writes it to OUTPUT and returns nonzero.
- Otherwise, returns zero and OUTPUT is unmodified. */
-static int
+ warranted, writes it to OUTPUT and returns true.
+ Otherwise, returns false and OUTPUT is unmodified. */
+static bool
aggregate_single_case (struct agr_proc *agr,
const struct ccase *input, struct ccase *output)
{
{
struct agr_var *iter;
double weight;
- int bad_warn = 1;
+ bool bad_warn = true;
weight = dict_get_case_weight (default_dict, input, &bad_warn);
caught earlier. Nothing to do. */
break;
default:
- assert (0);
+ NOT_REACHED ();
}
} else {
switch (iter->function)
iter->int1++;
break;
default:
- assert (0);
+ NOT_REACHED ();
}
}
}
v->f = i->int1;
break;
default:
- assert (0);
+ NOT_REACHED ();
}
}
}