1 /* PSPPIRE - a graphical user interface for PSPP.
2 Copyright (C) 2008, 2010, 2014 Free Software Foundation
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/>. */
19 #include "source-init-opts.h"
25 #include "data/settings.h"
26 #include "language/lexer/include-path.h"
27 #include "language/lexer/lexer.h"
28 #include "libpspp/assertion.h"
29 #include "libpspp/argv-parser.h"
30 #include "libpspp/llx.h"
31 #include "libpspp/message.h"
32 #include "ui/syntax-gen.h"
35 #include "gl/xalloc.h"
38 #define _(msgid) gettext (msgid)
39 #define N_(msgid) msgid
51 static const struct argv_option source_init_options
[N_SOURCE_INIT_OPTIONS
] =
53 {"algorithm", 'a', required_argument
, OPT_ALGORITHM
},
54 {"include", 'I', required_argument
, OPT_INCLUDE
},
55 {"no-include", 0, no_argument
, OPT_NO_INCLUDE
},
56 {"safer", 's', no_argument
, OPT_SAFER
},
57 {"syntax", 'x', required_argument
, OPT_SYNTAX
},
61 source_init_option_callback (int id
, void *aux UNUSED
)
66 if (!strcmp (optarg
, "compatible"))
67 settings_set_algorithm (COMPATIBLE
);
68 else if (!strcmp (optarg
, "enhanced"))
69 settings_set_algorithm (ENHANCED
);
72 _("Algorithm must be either `%s' or `%s'."), "compatible", "enhanced");
76 if (!strcmp (optarg
, "-"))
77 include_path_clear ();
79 include_path_add (optarg
);
83 include_path_clear ();
87 settings_set_safer_mode ();
91 if (!strcmp (optarg
, "compatible"))
92 settings_set_syntax (COMPATIBLE
);
93 else if (!strcmp (optarg
, "enhanced"))
94 settings_set_syntax (ENHANCED
);
97 _("Syntax must be either `%s' or `%s'."), "compatible", "enhanced");
106 source_init_register_argv_parser (struct argv_parser
*ap
)
108 argv_parser_add_options (ap
, source_init_options
, N_SOURCE_INIT_OPTIONS
,
109 source_init_option_callback
, NULL
);