dc8aadc932d0986ca4ca916d24f8e1e88124fe74
[pspp-builds.git] / src / language / expressions / public.h
1 /* PSPP - computes sample statistics.
2    Copyright (C) 1997-9, 2000 Free Software Foundation, Inc.
3    Written by Ben Pfaff <blp@gnu.org>.
4
5    This program is free software; you can redistribute it and/or
6    modify it under the terms of the GNU General Public License as
7    published by the Free Software Foundation; either version 2 of the
8    License, or (at your option) any later version.
9
10    This program is distributed in the hope that it will be useful, but
11    WITHOUT ANY WARRANTY; without even the implied warranty of
12    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
13    General Public License for more details.
14
15    You should have received a copy of the GNU General Public License
16    along with this program; if not, write to the Free Software
17    Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
18    02110-1301, USA. */
19
20 #if !expr_h
21 #define expr_h 1
22
23 #include <stddef.h>
24
25 /* Expression parsing flags. */
26 enum expr_type
27   {
28     EXPR_NUMBER = 0xf000,       /* Number. */
29     EXPR_STRING,                /* String. */
30     EXPR_BOOLEAN,               /* Boolean (number limited to 0, 1, SYSMIS). */
31   };
32
33 struct dictionary;
34 struct expression;
35 struct ccase;
36 struct pool;
37 union value;
38 struct dataset ;
39 struct lexer ;
40
41 struct expression *expr_parse (struct lexer *lexer, struct dataset *, enum expr_type);
42 struct expression *expr_parse_pool (struct lexer *, 
43                                     struct pool *,
44                                     struct dataset *,
45                                     enum expr_type);
46 void expr_free (struct expression *);
47
48 struct dataset;
49 double expr_evaluate_num (struct expression *, const struct ccase *,
50                           int case_idx);
51 void expr_evaluate_str (struct expression *, const struct ccase *,
52                         int case_idx, char *dst, size_t dst_size);
53
54 #endif /* expr.h */