1 /*
2  *  gretl -- Gnu Regression, Econometrics and Time-series Library
3  *  Copyright (C) 2001 Allin Cottrell and Riccardo "Jack" Lucchetti
4  *
5  *  This program is free software: you can redistribute it and/or modify
6  *  it under the terms of the GNU General Public License as published by
7  *  the Free Software Foundation, either version 3 of the License, or
8  *  (at your option) any later version.
9  *
10  *  This program is distributed in the hope that it will be useful,
11  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
12  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13  *  GNU General Public License for more details.
14  *
15  *  You should have received a copy of the GNU General Public License
16  *  along with this program.  If not, see <http://www.gnu.org/licenses/>.
17  *
18  */
19 
20 #ifndef OPTIONS_H
21 #define OPTIONS_H
22 
23 typedef enum {
24     OPT_NO_PARM = 0,
25     OPT_ACCEPTS_PARM,
26     OPT_NEEDS_PARM,
27     OPT_AMBIGUOUS
28 } OptStatus;
29 
30 gretlopt opt_from_flag (unsigned char c);
31 
32 const char *print_flags (gretlopt oflags, int ci);
33 
34 const char **get_opts_for_command (int ci, int *nopt);
35 
36 int set_options_for_command (const char *cmdword,
37 			     const char *param,
38 			     gretlopt opt);
39 
40 void maybe_get_stored_options (int ci, gretlopt *popt);
41 
42 int check_for_loop_only_options (int ci, gretlopt opt, PRN *prn);
43 
44 int cluster_option_ok (int ci);
45 
46 int matrix_data_option (int ci, gretlopt opt);
47 
48 char **get_all_option_strings (int *pn);
49 
50 gretlopt transcribe_option_flags (gretlopt *targ, gretlopt src,
51 				  gretlopt test);
52 
53 gretlopt delete_option_flags (gretlopt *targ, gretlopt test);
54 
55 int incompatible_options (gretlopt opt, gretlopt test);
56 
57 int options_incompatible_with (gretlopt opt, gretlopt base,
58 			       gretlopt test);
59 
60 int option_prereq_missing (gretlopt opt, gretlopt test,
61 			   gretlopt prereq);
62 
63 int inapplicable_option_error (int ci, gretlopt opt);
64 
65 int push_option_param (int ci, gretlopt opt, char *val);
66 
67 double get_optval_double (int ci, gretlopt opt, int *err);
68 
69 int set_optval_double (int ci, gretlopt opt, double x);
70 
71 const char *get_optval_string (int ci, gretlopt opt);
72 
73 int set_optval_string (int ci, gretlopt opt, const char *s);
74 
75 int set_optval_int (int ci, gretlopt opt, int k);
76 
77 int get_optval_int (int ci, gretlopt opt, int *err);
78 
79 int get_compression_option (int ci);
80 
81 void destroy_option_params_at_level (int level);
82 
83 void clear_stored_options_for_command (int ci);
84 
85 void stored_options_cleanup (void);
86 
87 void setopt_cleanup (void);
88 
89 void option_printing_cleanup (void);
90 
91 gretlopt valid_long_opt (int ci, const char *s, OptStatus *status);
92 
93 gretlopt valid_short_opt (int ci, char c);
94 
95 void debug_print_option_flags (const char *msg, gretlopt opt);
96 
97 #endif /* OPTIONS_H */
98