X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;ds=sidebyside;f=src%2Fui%2Fterminal%2Fterminal-opts.c;h=c55dc57fd20b994c5e524e2717a4c8a5c106e034;hb=e14e3990ef75795b40ee06a4b59a3e6af2d3aef0;hp=d2ddc6eeffa2b611f9d524d5b13fb8453d4dcb9e;hpb=14aac9fe7a7efbb6c9bded2ed5969a643cb76645;p=pspp-builds.git diff --git a/src/ui/terminal/terminal-opts.c b/src/ui/terminal/terminal-opts.c index d2ddc6ee..c55dc57f 100644 --- a/src/ui/terminal/terminal-opts.c +++ b/src/ui/terminal/terminal-opts.c @@ -1,5 +1,5 @@ /* PSPPIRE - a graphical user interface for PSPP. - Copyright (C) 2008 Free Software Foundation + Copyright (C) 2008, 2010 Free Software Foundation 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 @@ -15,30 +15,34 @@ along with this program. If not, see . */ #include + +#include "terminal-opts.h" + #include #include #include #include + #include -#include -#include "msg-ui.h" -#include -#include -#include #include -#include "terminal-opts.h" -#include #include -#include "read-line.h" +#include +#include +#include +#include +#include +#include +#include +#include + +#include "gl/error.h" #include "gettext.h" #define _(msgid) gettext (msgid) #define N_(msgid) msgid - static const struct argp_option test_options [] = { - {"verbose", 'v', 0, 0, N_("Increase diagnostic verbosity level"), 0}, {"testing-mode", 'T', 0, OPTION_HIDDEN, 0, 0}, { 0, 0, 0, 0, 0, 0 } @@ -52,9 +56,6 @@ parse_test_opts (int key, char *arg, struct argp_state *state) case 'T': settings_set_testing_mode (true); break; - case 'v': - verbose_increment_level (); - break; default: return ARGP_ERR_UNKNOWN; } @@ -85,8 +86,11 @@ parse_io_opts (int key, char *arg, struct argp_state *state) struct source_init { struct llx_list file_list; - bool cleared_device_defaults; bool interactive; + + /* Output devices. */ + struct string_map macros; + struct string_set drivers; }; struct fn_element { @@ -105,10 +109,15 @@ parse_io_opts (int key, char *arg, struct argp_state *state) case ARGP_KEY_INIT: state->hook = sip = xzalloc (sizeof (struct source_init)); llx_init (&sip->file_list); + string_map_init (&sip->macros); + string_set_init (&sip->drivers); break; case ARGP_KEY_ARG: if (strchr (arg, '=')) - outp_configure_macro (arg); + { + if (!output_define_macro (arg, &sip->macros)) + error (0, 0, _("\"%s\" is not a valid macro definition"), arg); + } else { llx_push_tail (&sip->file_list, arg, &llx_malloc_mgr); @@ -136,9 +145,16 @@ parse_io_opts (int key, char *arg, struct argp_state *state) ERRMODE_CONTINUE ); - if (!sip->cleared_device_defaults) - outp_configure_add ("interactive"); + string_set_insert (&sip->drivers, "interactive"); } + + if (!settings_get_testing_mode ()) + output_read_configuration (&sip->macros, &sip->drivers); + else + output_configure_driver ("csv:csv::"); + + string_map_destroy (&sip->macros); + string_set_destroy (&sip->drivers); } break; case ARGP_KEY_FINI: @@ -151,15 +167,10 @@ parse_io_opts (int key, char *arg, struct argp_state *state) sip->interactive = true; break; case 'l': - outp_list_classes (); + output_list_classes (); break; case 'o': - if (! sip->cleared_device_defaults) - { - outp_configure_clear (); - sip->cleared_device_defaults = true; - } - outp_configure_add (arg); + string_set_insert (&sip->drivers, arg); break; default: return ARGP_ERR_UNKNOWN;