projects
/
pspp-builds.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Reverse order of arguments to DATEDIFF, for compatibility. Thanks to
[pspp-builds.git]
/
src
/
language
/
expressions
/
optimize.c
diff --git
a/src/language/expressions/optimize.c
b/src/language/expressions/optimize.c
index b280b6d737485527d92e5fde4b6d48af97d63e99..90d90c676ca553339ff895208b57a2d8969e6511 100644
(file)
--- a/
src/language/expressions/optimize.c
+++ b/
src/language/expressions/optimize.c
@@
-1,6
+1,5
@@
/* PSPP - computes sample statistics.
Copyright (C) 1997-9, 2000 Free Software Foundation, Inc.
/* PSPP - computes sample statistics.
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
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
@@
-23,17
+22,18
@@
#include <ctype.h>
#include <errno.h>
#include <stdlib.h>
#include <ctype.h>
#include <errno.h>
#include <stdlib.h>
-#include "alloc.h"
-#include "calendar.h"
-#include "data-in.h"
-#include "message.h"
+#include <libpspp/alloc.h>
+#include <libpspp/assertion.h>
+#include <data/calendar.h>
+#include <data/data-in.h>
+#include <libpspp/message.h>
#include "evaluate.h"
#include "helpers.h"
#include "evaluate.h"
#include "helpers.h"
-#include
"misc.h"
-#include
"pool.h"
+#include
<libpspp/misc.h>
+#include
<libpspp/pool.h>
#include "public.h"
#include "public.h"
-#include
"str.h"
-#include
"variable.h"
+#include
<libpspp/str.h>
+#include
<data/variable.h>
static union any_node *evaluate_tree (struct composite_node *,
struct expression *);
static union any_node *evaluate_tree (struct composite_node *,
struct expression *);
@@
-44,7
+44,7
@@
expr_optimize (union any_node *node, struct expression *e)
{
int nonconst_cnt = 0; /* Number of nonconstant children. */
int sysmis_cnt = 0; /* Number of system-missing children. */
{
int nonconst_cnt = 0; /* Number of nonconstant children. */
int sysmis_cnt = 0; /* Number of system-missing children. */
- struct operation *op;
+
const
struct operation *op;
struct composite_node *c;
int i;
struct composite_node *c;
int i;
@@
-141,9
+141,9
@@
static double get_number_arg (struct composite_node *, size_t arg_idx);
static double *get_number_args (struct composite_node *,
size_t arg_idx, size_t arg_cnt,
struct expression *);
static double *get_number_args (struct composite_node *,
size_t arg_idx, size_t arg_cnt,
struct expression *);
-static struct
fixed_
string get_string_arg (struct composite_node *,
+static struct
sub
string get_string_arg (struct composite_node *,
size_t arg_idx);
size_t arg_idx);
-static struct
fixed_
string *get_string_args (struct composite_node *,
+static struct
sub
string *get_string_args (struct composite_node *,
size_t arg_idx, size_t arg_cnt,
struct expression *);
static const struct fmt_spec *get_format_arg (struct composite_node *,
size_t arg_idx, size_t arg_cnt,
struct expression *);
static const struct fmt_spec *get_format_arg (struct composite_node *,
@@
-157,12
+157,10
@@
evaluate_tree (struct composite_node *node, struct expression *e)
#include "optimize.inc"
default:
#include "optimize.inc"
default:
-
assert (0
);
+
NOT_REACHED (
);
}
}
- /* Not reached. */
- assert (0);
- abort ();
+ NOT_REACHED ();
}
static double
}
static double
@@
-187,7
+185,7
@@
get_number_args (struct composite_node *c, size_t arg_idx, size_t arg_cnt,
return d;
}
return d;
}
-static struct
fixed_
string
+static struct
sub
string
get_string_arg (struct composite_node *c, size_t arg_idx)
{
assert (arg_idx < c->arg_cnt);
get_string_arg (struct composite_node *c, size_t arg_idx)
{
assert (arg_idx < c->arg_cnt);
@@
-195,11
+193,11
@@
get_string_arg (struct composite_node *c, size_t arg_idx)
return c->args[arg_idx]->string.s;
}
return c->args[arg_idx]->string.s;
}
-static struct
fixed_
string *
+static struct
sub
string *
get_string_args (struct composite_node *c, size_t arg_idx, size_t arg_cnt,
struct expression *e)
{
get_string_args (struct composite_node *c, size_t arg_idx, size_t arg_cnt,
struct expression *e)
{
- struct
fixed_
string *s;
+ struct
sub
string *s;
size_t i;
s = pool_alloc (e->expr_pool, sizeof *s * arg_cnt);
size_t i;
s = pool_alloc (e->expr_pool, sizeof *s * arg_cnt);
@@
-236,7
+234,7
@@
emit_number (struct expression *e, double n)
}
static void
}
static void
-emit_string (struct expression *e, struct
fixed_
string s)
+emit_string (struct expression *e, struct
sub
string s)
{
allocate_aux (e, OP_string)->string = s;
}
{
allocate_aux (e, OP_string)->string = s;
}
@@
-302,14
+300,14
@@
flatten_atom (union any_node *n, struct expression *e)
break;
default:
break;
default:
-
abort
();
+
NOT_REACHED
();
}
}
static void
flatten_composite (union any_node *n, struct expression *e)
{
}
}
static void
flatten_composite (union any_node *n, struct expression *e)
{
- struct operation *op = &operations[n->type];
+
const
struct operation *op = &operations[n->type];
size_t i;
for (i = 0; i < n->composite.arg_cnt; i++)
size_t i;
for (i = 0; i < n->composite.arg_cnt; i++)
@@
-363,7
+361,7
@@
flatten_node (union any_node *n, struct expression *e)
else if (is_composite (n->type))
flatten_composite (n, e);
else
else if (is_composite (n->type))
flatten_composite (n, e);
else
-
abort
();
+
NOT_REACHED
();
}
static union operation_data *
}
static union operation_data *