X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=src%2Flanguage%2Fexpressions%2Fprivate.h;h=4283b4ae694236d6118eb48c9890cfc26b70fd5c;hb=392ab4052e2743f80664a4130b2b4ee5d82af7fe;hp=85b82587f5f895e4f0d8bb4eed29d1cb61b67ce5;hpb=dcf9b154cbcaa35c3d8459a201b77eec8bcb30bd;p=pspp-builds.git diff --git a/src/language/expressions/private.h b/src/language/expressions/private.h index 85b82587..4283b4ae 100644 --- a/src/language/expressions/private.h +++ b/src/language/expressions/private.h @@ -1,34 +1,32 @@ -/* PSPP - computes sample statistics. +/* PSPP - a program for statistical analysis. Copyright (C) 1997-9, 2000 Free Software Foundation, Inc. - Written by Ben Pfaff . - This program is free software; you can redistribute it and/or - modify it under the terms of the GNU General Public License as - published by the Free Software Foundation; either version 2 of the - License, or (at your option) any later version. + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. - This program is distributed in the hope that it will be useful, but - WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - General Public License for more details. + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA - 02110-1301, USA. */ + along with this program. If not, see . */ -#ifndef EXPRESSIONS_PRIVATE_H +#ifndef EXPRESSIONS_PRIVATE_H #define EXPRESSIONS_PRIVATE_H #include #include -#include "format.h" -#include "str.h" +#include #include "public.h" #include "operations.h" -enum operation_flags +#include + +enum operation_flags { /* Most operations produce a missing output value if any input value is missing. Setting this bit indicates that @@ -47,7 +45,7 @@ enum operation_flags to be non-missing. The operation must have an array operand and the array must contain `double's. Both OPF_ABSORB_MISS and OPF_ARRAY_OPERAND must also be set. */ - OPF_MIN_VALID = 002, + OPF_MIN_VALID = 002, /* If set, operation is non-optimizable in general. Unless combined with OPF_ABSORB_MISS, missing input values are @@ -58,7 +56,14 @@ enum operation_flags OPF_UNIMPLEMENTED = 020, /* If set, this operation is a PSPP extension. */ - OPF_EXTENSION = 040 + OPF_EXTENSION = 040, + + /* If set, this operation may not occur after TEMPORARY. + (Currently this applies only to LAG.) */ + OPF_PERM_ONLY = 0100, + + /* If set, this operation's name may not be abbreviated. */ + OPF_NO_ABBREV = 0200 }; #define EXPR_ARG_MAX 4 @@ -74,12 +79,12 @@ struct operation int array_granularity; }; -extern struct operation operations[]; +extern const struct operation operations[]; -/* Tree structured expressions. */ +/* Tree structured expressions. */ /* Atoms. */ -struct number_node +struct number_node { operation_type type; /* OP_number. */ double n; @@ -88,13 +93,13 @@ struct number_node struct string_node { operation_type type; /* OP_string. */ - struct fixed_string s; + struct substring s; }; struct variable_node { operation_type type; /* OP_variable. */ - struct variable *v; + const struct variable *v; }; struct integer_node @@ -137,12 +142,12 @@ union any_node struct composite_node composite; }; -union operation_data +union operation_data { operation_type operation; double number; - struct fixed_string string; - struct variable *variable; + struct substring string; + const struct variable *variable; const struct vector *vector; struct fmt_spec *format; int integer; @@ -152,7 +157,7 @@ union operation_data struct expression { struct pool *expr_pool; /* Pool for expression static data. */ - struct dictionary *dict; /* Dictionary for variables, vectors. */ + struct dataset *ds ; /* The dataset */ atom_type type; /* Type of expression result. */ union operation_data *ops; /* Expression data. */ @@ -160,11 +165,11 @@ struct expression size_t op_cnt, op_cap; /* Number of ops, amount of allocated space. */ double *number_stack; /* Evaluation stack: numerics, Booleans. */ - struct fixed_string *string_stack; /* Evaluation stack: strings. */ + struct substring *string_stack; /* Evaluation stack: strings. */ struct pool *eval_pool; /* Pool for evaluation temporaries. */ }; -struct expression *expr_parse_any (struct dictionary *, bool optimize); +struct expression *expr_parse_any (struct lexer *lexer, struct dataset *, bool optimize); void expr_debug_print_postfix (const struct expression *); union any_node *expr_optimize (union any_node *, struct expression *); @@ -186,9 +191,9 @@ union any_node *expr_allocate_pos_int (struct expression *e, int); union any_node *expr_allocate_string_buffer (struct expression *e, const char *string, size_t length); union any_node *expr_allocate_string (struct expression *e, - struct fixed_string); + struct substring); union any_node *expr_allocate_variable (struct expression *e, - struct variable *); + const struct variable *); union any_node *expr_allocate_format (struct expression *e, const struct fmt_spec *); union any_node *expr_allocate_vector (struct expression *e,