1 /* PSPP - a program for statistical analysis.
2 Copyright (C) 2009, 2011 Free Software Foundation, Inc.
4 This program is free software: you can redistribute it and/or modify
5 it under the terms of the GNU General Public License as published by
6 the Free Software Foundation, either version 3 of the License, or
7 (at your option) any later version.
9 This program is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 GNU General Public License for more details.
14 You should have received a copy of the GNU General Public License
15 along with this program. If not, see <http://www.gnu.org/licenses/>. */
17 #ifndef OUTPUT_SELECT_H
18 #define OUTPUT_SELECT_H 1
20 #include "output/output-item.h"
22 /* Selecting subsets of a tree of output items based on user-specified
23 criteria. pspp-output uses this; a future OMS or OUTPUT MODIFY command
26 /* Classifications for output items. These only roughly correspond to the
27 output item types; for example, "warnings" are a subset of text items.
28 These classifications really */
29 #define OUTPUT_CLASSES \
30 OUTPUT_CLASS(CHARTS, "charts") \
31 OUTPUT_CLASS(HEADINGS, "headings") \
32 OUTPUT_CLASS(LOGS, "logs") \
33 OUTPUT_CLASS(MODELS, "models") \
34 OUTPUT_CLASS(TABLES, "tables") \
35 OUTPUT_CLASS(TEXTS, "texts") \
36 OUTPUT_CLASS(TREES, "trees") \
37 OUTPUT_CLASS(WARNINGS, "warnings") \
38 OUTPUT_CLASS(OUTLINEHEADERS, "outlineheaders") \
39 OUTPUT_CLASS(PAGETITLE, "pagetitle") \
40 OUTPUT_CLASS(NOTES, "notes") \
41 OUTPUT_CLASS(UNKNOWN, "unknown") \
42 OUTPUT_CLASS(OTHER, "other")
43 enum output_item_class
45 #define OUTPUT_CLASS(ENUM, NAME) OUTPUT_CLASS_##ENUM,
51 #define OUTPUT_CLASS(ENUM, NAME) +1
52 OUTPUT_N_CLASSES = OUTPUT_CLASSES
55 #define OUTPUT_ALL_CLASSES ((1u << OUTPUT_N_CLASSES) - 1)
57 const char *output_item_class_to_string (enum output_item_class);
58 enum output_item_class output_item_class_from_string (const char *);
60 enum output_item_class output_item_classify (const struct output_item *);
62 /* Matching criteria for commands, subtypes, and labels.
64 Each of the members is an array of strings. A string that ends in '*'
65 matches anything that begins with the rest of the string, otherwise a string
66 requires an exact (case-insensitive) match. */
67 struct output_criteria_match
69 struct string_array commands;
70 struct string_array subtypes;
71 struct string_array labels;
74 struct output_criteria
76 /* Include objects that are not visible? */
79 /* If false, include all objects.
80 If true, include only objects that have an error on loading. */
83 /* Bit-mask of OUTPUT_CLASS_* for the classes to include. */
86 /* Include all of the objects that match 'include' and do not match
87 'exclude', except that objects are included by default if 'include' is
89 struct output_criteria_match include;
90 struct output_criteria_match exclude;
92 /* Include objects under commands with indexes listed in COMMANDS. Indexes
93 are 1-based. Everything is included if N_COMMANDS is 0. */
97 /* Include XML and binary member names that match (except that everything
98 is included by default if empty). */
99 struct string_array members;
101 /* Include the objects with indexes listed in INSTANCES within each of the
102 commands that are included. Indexes are 1-based. Index -1 means the
103 last object within a command. */
108 #define OUTPUT_CRITERIA_INITIALIZER { .classes = OUTPUT_ALL_CLASSES }
110 struct output_item *output_select (struct output_item *,
111 const struct output_criteria[],
114 #endif /* output/select.h */