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