Rewrite PSPP output engine.
[pspp-builds.git] / src / output / options.h
1 /* PSPP - a program for statistical analysis.
2    Copyright (C) 1997-9, 2000, 2007, 2009, 2010 Free Software Foundation, Inc.
3
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.
8
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.
13
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/>. */
16
17 #ifndef OUTPUT_OPTIONS_H
18 #define OUTPUT_OPTIONS_H 1
19
20 /* Helper functions for driver option parsing. */
21
22 #include <stdbool.h>
23 #include "libpspp/compiler.h"
24
25 struct output_driver;
26 struct string_map;
27
28 /* An option being parsed. */
29 struct driver_option
30   {
31     char *driver_name;          /* Driver's name, for use in error messages. */
32     char *name;                 /* Option name, for use in error messages.  */
33     char *value;                /* Value supplied by user (NULL if none). */
34     char *default_value;        /* Default value supplied by driver. */
35   };
36
37 struct driver_option *driver_option_create (const char *driver_name,
38                                             const char *name,
39                                             const char *value,
40                                             const char *default_value);
41 struct driver_option *driver_option_get (struct output_driver *,
42                                          struct string_map *,
43                                          const char *name,
44                                          const char *default_value);
45 void driver_option_destroy (struct driver_option *);
46
47 void parse_paper_size (struct driver_option *, int *h, int *v);
48 bool parse_boolean (struct driver_option *);
49 int parse_enum (struct driver_option *, ...) SENTINEL(0);
50 int parse_int (struct driver_option *, int min_value, int max_value);
51 int parse_dimension (struct driver_option *);
52 char *parse_string (struct driver_option *);
53 char *parse_chart_file_name (struct driver_option *);
54
55 #endif /* output/options.h */