From e9aa6e433b846849da90550f6800095d569fb549 Mon Sep 17 00:00:00 2001 From: Ben Pfaff Date: Tue, 27 Jun 2006 19:09:21 +0000 Subject: [PATCH] Move var_set and variable parsing declarations into new header. --- src/data/ChangeLog | 6 ++ src/data/variable.h | 42 ------------- src/language/control/repeat.c | 1 + src/language/data-io/data-list.c | 1 + src/language/data-io/get.c | 1 + src/language/data-io/matrix-data.c | 1 + src/language/data-io/print.c | 1 + src/language/dictionary/formats.c | 1 + src/language/dictionary/missing-values.c | 1 + src/language/dictionary/modify-variables.c | 19 +++--- src/language/dictionary/numeric.c | 1 + src/language/dictionary/rename-variables.c | 1 + src/language/dictionary/split-file.c | 1 + src/language/dictionary/sys-file-info.c | 1 + src/language/dictionary/value-labels.c | 1 + src/language/dictionary/variable-display.c | 1 + src/language/dictionary/variable-label.c | 1 + src/language/dictionary/vector.c | 1 + src/language/dictionary/weight.c | 1 + src/language/expressions/parse.c | 1 + src/language/lexer/ChangeLog | 7 +++ src/language/lexer/q2c.c | 1 + src/language/lexer/variable-parser.c | 2 + src/language/lexer/variable-parser.h | 69 ++++++++++++++++++++++ src/language/stats/aggregate.c | 1 + src/language/stats/autorecode.c | 1 + src/language/stats/correlations.q | 1 + src/language/stats/crosstabs.q | 1 + src/language/stats/descriptives.c | 1 + src/language/stats/flip.c | 1 + src/language/stats/sort-criteria.c | 1 + src/language/xforms/count.c | 1 + src/language/xforms/recode.c | 1 + src/language/xforms/select-if.c | 1 + 34 files changed, 123 insertions(+), 50 deletions(-) create mode 100644 src/language/lexer/variable-parser.h diff --git a/src/data/ChangeLog b/src/data/ChangeLog index f1132b2b..8683f041 100644 --- a/src/data/ChangeLog +++ b/src/data/ChangeLog @@ -1,3 +1,9 @@ +Tue Jun 27 12:06:49 2006 Ben Pfaff + + * variable.h: Move var_set and variable parsing declarations to + new header, src/language/lexer/variable-parser.h. Modified lots + of files to include the new header. + Sun Jun 25 22:39:32 2006 Ben Pfaff * value-labels.c (value_to_string): When there's no value label, diff --git a/src/data/variable.h b/src/data/variable.h index 8a4609f0..8668119b 100644 --- a/src/data/variable.h +++ b/src/data/variable.h @@ -125,48 +125,6 @@ struct vector struct variable **var; /* Vector of variables. */ int cnt; /* Number of variables. */ }; - -struct var_set; - -struct dictionary; -struct var_set *var_set_create_from_dict (const struct dictionary *d); -struct var_set *var_set_create_from_array (struct variable *const *var, - size_t); - -size_t var_set_get_cnt (const struct var_set *vs); -struct variable *var_set_get_var (const struct var_set *vs, size_t idx); -struct variable *var_set_lookup_var (const struct var_set *vs, - const char *name); -bool var_set_lookup_var_idx (const struct var_set *vs, const char *name, - size_t *idx); -void var_set_destroy (struct var_set *vs); - -/* Variable parsers. */ - -enum - { - PV_NONE = 0, /* No options. */ - PV_SINGLE = 0001, /* Restrict to a single name or TO use. */ - PV_DUPLICATE = 0002, /* Don't merge duplicates. */ - PV_APPEND = 0004, /* Append to existing list. */ - PV_NO_DUPLICATE = 0010, /* Error on duplicates. */ - PV_NUMERIC = 0020, /* Vars must be numeric. */ - PV_STRING = 0040, /* Vars must be string. */ - PV_SAME_TYPE = 00100, /* All vars must be the same type. */ - PV_NO_SCRATCH = 00200 /* Disallow scratch variables. */ - }; - -struct pool; -struct variable *parse_variable (void); -struct variable *parse_dict_variable (const struct dictionary *); -int parse_variables (const struct dictionary *, struct variable ***, size_t *, - int opts); -int parse_var_set_vars (const struct var_set *, struct variable ***, size_t *, - int opts); -int parse_DATA_LIST_vars (char ***names, size_t *cnt, int opts); -int parse_mixed_vars (char ***names, size_t *cnt, int opts); -int parse_mixed_vars_pool (struct pool *, - char ***names, size_t *cnt, int opts); /* Return a string representing this variable, in the form most diff --git a/src/language/control/repeat.c b/src/language/control/repeat.c index d2d894a9..42481dfa 100644 --- a/src/language/control/repeat.c +++ b/src/language/control/repeat.c @@ -30,6 +30,7 @@ #include #include #include +#include #include #include #include diff --git a/src/language/data-io/data-list.c b/src/language/data-io/data-list.c index 92ad0793..6998cc92 100644 --- a/src/language/data-io/data-list.c +++ b/src/language/data-io/data-list.c @@ -39,6 +39,7 @@ #include #include #include +#include #include #include #include diff --git a/src/language/data-io/get.c b/src/language/data-io/get.c index 2657b506..651d222a 100644 --- a/src/language/data-io/get.c +++ b/src/language/data-io/get.c @@ -39,6 +39,7 @@ #include #include #include +#include #include #include #include diff --git a/src/language/data-io/matrix-data.c b/src/language/data-io/matrix-data.c index c725ed4a..5a664911 100644 --- a/src/language/data-io/matrix-data.c +++ b/src/language/data-io/matrix-data.c @@ -33,6 +33,7 @@ #include #include #include +#include #include #include #include diff --git a/src/language/data-io/print.c b/src/language/data-io/print.c index 34cca99a..061aafc6 100644 --- a/src/language/data-io/print.c +++ b/src/language/data-io/print.c @@ -32,6 +32,7 @@ #include #include #include +#include #include #include #include diff --git a/src/language/dictionary/formats.c b/src/language/dictionary/formats.c index 8658634b..7b01b2b8 100644 --- a/src/language/dictionary/formats.c +++ b/src/language/dictionary/formats.c @@ -27,6 +27,7 @@ #include #include #include +#include #include #include #include diff --git a/src/language/dictionary/missing-values.c b/src/language/dictionary/missing-values.c index e37fa987..21a5b639 100644 --- a/src/language/dictionary/missing-values.c +++ b/src/language/dictionary/missing-values.c @@ -26,6 +26,7 @@ #include #include #include +#include #include #include #include diff --git a/src/language/dictionary/modify-variables.c b/src/language/dictionary/modify-variables.c index 1b0a27b0..c17bb562 100644 --- a/src/language/dictionary/modify-variables.c +++ b/src/language/dictionary/modify-variables.c @@ -18,21 +18,24 @@ 02110-1301, USA. */ #include + #include -#include -#include + +#include +#include +#include +#include +#include +#include #include +#include #include -#include #include -#include -#include #include -#include +#include +#include #include #include -#include -#include #include "gettext.h" #define _(msgid) gettext (msgid) diff --git a/src/language/dictionary/numeric.c b/src/language/dictionary/numeric.c index 37934883..a914b06a 100644 --- a/src/language/dictionary/numeric.c +++ b/src/language/dictionary/numeric.c @@ -26,6 +26,7 @@ #include #include #include +#include #include #include #include diff --git a/src/language/dictionary/rename-variables.c b/src/language/dictionary/rename-variables.c index 6165787f..b2bd3d76 100644 --- a/src/language/dictionary/rename-variables.c +++ b/src/language/dictionary/rename-variables.c @@ -26,6 +26,7 @@ #include #include #include +#include #include #include #include diff --git a/src/language/dictionary/split-file.c b/src/language/dictionary/split-file.c index 201a999e..5e327984 100644 --- a/src/language/dictionary/split-file.c +++ b/src/language/dictionary/split-file.c @@ -30,6 +30,7 @@ #include #include #include +#include #include #include #include diff --git a/src/language/dictionary/sys-file-info.c b/src/language/dictionary/sys-file-info.c index 5c3985be..3f77b1de 100644 --- a/src/language/dictionary/sys-file-info.c +++ b/src/language/dictionary/sys-file-info.c @@ -31,6 +31,7 @@ #include #include #include +#include #include #include #include diff --git a/src/language/dictionary/value-labels.c b/src/language/dictionary/value-labels.c index dec757c3..a1310227 100644 --- a/src/language/dictionary/value-labels.c +++ b/src/language/dictionary/value-labels.c @@ -27,6 +27,7 @@ #include #include #include +#include #include #include #include diff --git a/src/language/dictionary/variable-display.c b/src/language/dictionary/variable-display.c index 2348b721..4d13514e 100644 --- a/src/language/dictionary/variable-display.c +++ b/src/language/dictionary/variable-display.c @@ -26,6 +26,7 @@ #include #include #include +#include #include #include #include diff --git a/src/language/dictionary/variable-label.c b/src/language/dictionary/variable-label.c index dcd607fe..17f88112 100644 --- a/src/language/dictionary/variable-label.c +++ b/src/language/dictionary/variable-label.c @@ -26,6 +26,7 @@ #include #include #include +#include #include #include #include diff --git a/src/language/dictionary/vector.c b/src/language/dictionary/vector.c index 82870d9d..b4a212d2 100644 --- a/src/language/dictionary/vector.c +++ b/src/language/dictionary/vector.c @@ -26,6 +26,7 @@ #include #include #include +#include #include #include #include diff --git a/src/language/dictionary/weight.c b/src/language/dictionary/weight.c index 5d492c4f..58ed524d 100644 --- a/src/language/dictionary/weight.c +++ b/src/language/dictionary/weight.c @@ -26,6 +26,7 @@ #include #include #include +#include #include #include diff --git a/src/language/expressions/parse.c b/src/language/expressions/parse.c index f220509a..72604ed9 100644 --- a/src/language/expressions/parse.c +++ b/src/language/expressions/parse.c @@ -30,6 +30,7 @@ #include #include "helpers.h" #include +#include #include #include #include diff --git a/src/language/lexer/ChangeLog b/src/language/lexer/ChangeLog index c1b5f984..99b6e3e4 100644 --- a/src/language/lexer/ChangeLog +++ b/src/language/lexer/ChangeLog @@ -1,3 +1,10 @@ +Tue Jun 27 12:07:34 2006 Ben Pfaff + + * variable-parser.h: New header. Moved the var_set and variable + parsing declarations here. + + * q2c.c (main): Emit include for new variable-parser.h header. + Sun Jun 25 22:41:00 2006 Ben Pfaff * q2c.c (dump_free): For SBC_DBL_LIST, enclose the output code in diff --git a/src/language/lexer/q2c.c b/src/language/lexer/q2c.c index 50a0856a..d66dcc01 100644 --- a/src/language/lexer/q2c.c +++ b/src/language/lexer/q2c.c @@ -2032,6 +2032,7 @@ main (int argc, char *argv[]) dump (0, "#include "); dump (0, "#include "); dump (0, "#include "); + dump (0, "#include "); dump (0, "#include "); dump (0, "#include "); dump (0, "#include "); diff --git a/src/language/lexer/variable-parser.c b/src/language/lexer/variable-parser.c index 64792aaa..7f25d8eb 100644 --- a/src/language/lexer/variable-parser.c +++ b/src/language/lexer/variable-parser.c @@ -19,6 +19,8 @@ #include +#include + #include #include #include diff --git a/src/language/lexer/variable-parser.h b/src/language/lexer/variable-parser.h new file mode 100644 index 00000000..f7520285 --- /dev/null +++ b/src/language/lexer/variable-parser.h @@ -0,0 +1,69 @@ +/* PSPP - computes sample statistics. + Copyright (C) 1997-9, 2000, 2006 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 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. */ + +#ifndef VARIABLE_PARSER_H +#define VARIABLE_PARSER_H 1 + +#include +#include + +struct pool; +struct dictionary; +struct var_set; +struct variable; + +struct var_set *var_set_create_from_dict (const struct dictionary *d); +struct var_set *var_set_create_from_array (struct variable *const *var, + size_t); + +size_t var_set_get_cnt (const struct var_set *vs); +struct variable *var_set_get_var (const struct var_set *vs, size_t idx); +struct variable *var_set_lookup_var (const struct var_set *vs, + const char *name); +bool var_set_lookup_var_idx (const struct var_set *vs, const char *name, + size_t *idx); +void var_set_destroy (struct var_set *vs); + +/* Variable parsers. */ + +enum + { + PV_NONE = 0, /* No options. */ + PV_SINGLE = 0001, /* Restrict to a single name or TO use. */ + PV_DUPLICATE = 0002, /* Don't merge duplicates. */ + PV_APPEND = 0004, /* Append to existing list. */ + PV_NO_DUPLICATE = 0010, /* Error on duplicates. */ + PV_NUMERIC = 0020, /* Vars must be numeric. */ + PV_STRING = 0040, /* Vars must be string. */ + PV_SAME_TYPE = 00100, /* All vars must be the same type. */ + PV_NO_SCRATCH = 00200 /* Disallow scratch variables. */ + }; + +struct variable *parse_variable (void); +struct variable *parse_dict_variable (const struct dictionary *); +int parse_variables (const struct dictionary *, struct variable ***, size_t *, + int opts); +int parse_var_set_vars (const struct var_set *, struct variable ***, size_t *, + int opts); +int parse_DATA_LIST_vars (char ***names, size_t *cnt, int opts); +int parse_mixed_vars (char ***names, size_t *cnt, int opts); +int parse_mixed_vars_pool (struct pool *, + char ***names, size_t *cnt, int opts); + +#endif /* variable-parser.h */ diff --git a/src/language/stats/aggregate.c b/src/language/stats/aggregate.c index aef4bbbf..78c29c4f 100644 --- a/src/language/stats/aggregate.c +++ b/src/language/stats/aggregate.c @@ -35,6 +35,7 @@ #include #include #include +#include #include #include #include diff --git a/src/language/stats/autorecode.c b/src/language/stats/autorecode.c index 560f9f99..4d3513ee 100644 --- a/src/language/stats/autorecode.c +++ b/src/language/stats/autorecode.c @@ -27,6 +27,7 @@ #include #include #include +#include #include #include #include diff --git a/src/language/stats/correlations.q b/src/language/stats/correlations.q index 594a5387..f998e1df 100644 --- a/src/language/stats/correlations.q +++ b/src/language/stats/correlations.q @@ -28,6 +28,7 @@ #include #include #include +#include #include #include diff --git a/src/language/stats/crosstabs.q b/src/language/stats/crosstabs.q index ee729920..c821ce0a 100644 --- a/src/language/stats/crosstabs.q +++ b/src/language/stats/crosstabs.q @@ -44,6 +44,7 @@ #include #include #include +#include #include #include #include diff --git a/src/language/stats/descriptives.c b/src/language/stats/descriptives.c index 90f8b8f2..958c00d8 100644 --- a/src/language/stats/descriptives.c +++ b/src/language/stats/descriptives.c @@ -34,6 +34,7 @@ #include #include #include +#include #include #include #include diff --git a/src/language/stats/flip.c b/src/language/stats/flip.c index 59f0c090..0e9b56c5 100644 --- a/src/language/stats/flip.c +++ b/src/language/stats/flip.c @@ -38,6 +38,7 @@ #include #include #include +#include #include #include #include diff --git a/src/language/stats/sort-criteria.c b/src/language/stats/sort-criteria.c index fd90af22..b09dee39 100644 --- a/src/language/stats/sort-criteria.c +++ b/src/language/stats/sort-criteria.c @@ -26,6 +26,7 @@ #include #include #include +#include #include #include #include "sort-criteria.h" diff --git a/src/language/xforms/count.c b/src/language/xforms/count.c index 284cdeeb..38e3e955 100644 --- a/src/language/xforms/count.c +++ b/src/language/xforms/count.c @@ -29,6 +29,7 @@ #include #include #include +#include #include #include #include diff --git a/src/language/xforms/recode.c b/src/language/xforms/recode.c index 86bd8b88..5aaeb559 100644 --- a/src/language/xforms/recode.c +++ b/src/language/xforms/recode.c @@ -31,6 +31,7 @@ #include #include #include +#include #include #include #include diff --git a/src/language/xforms/select-if.c b/src/language/xforms/select-if.c index ddeb4a05..e6dc9b4b 100644 --- a/src/language/xforms/select-if.c +++ b/src/language/xforms/select-if.c @@ -28,6 +28,7 @@ #include #include #include +#include #include #include #include -- 2.30.2