1 /* PSPP - computes sample statistics.
2 Copyright (C) 1997-9, 2000 Free Software Foundation, Inc.
3 Written by Ben Pfaff <blp@gnu.org>.
5 This program is free software; you can redistribute it and/or
6 modify it under the terms of the GNU General Public License as
7 published by the Free Software Foundation; either version 2 of the
8 License, or (at your option) any later version.
10 This program is distributed in the hope that it will be useful, but
11 WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 General Public License for more details.
15 You should have received a copy of the GNU General Public License
16 along with this program; if not, write to the Free Software
17 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
28 #include <data/file-name.h>
29 #include <data/settings.h>
30 #include <data/variable.h>
31 #include <language/command.h>
32 #include <language/lexer/lexer.h>
33 #include <libpspp/alloc.h>
34 #include <libpspp/assertion.h>
35 #include <libpspp/message.h>
36 #include <libpspp/message.h>
37 #include <libpspp/str.h>
38 #include <libpspp/verbose-msg.h>
39 #include <libpspp/version.h>
40 #include <output/table.h>
42 /* Current prompts in each style. */
43 static char *prompts[PROMPT_CNT];
45 /* Current prompting style. */
46 static enum prompt_style current_style;
48 /* Initializes prompts. */
52 prompts[PROMPT_FIRST] = xstrdup ("PSPP> ");
53 prompts[PROMPT_LATER] = xstrdup (" > ");
54 prompts[PROMPT_DATA] = xstrdup ("data> ");
55 current_style = PROMPT_FIRST;
64 for (i = 0; i < PROMPT_CNT; i++)
71 /* Gets the command prompt for the given STYLE. */
73 prompt_get (enum prompt_style style)
75 assert (style < PROMPT_CNT);
76 return prompts[style];
79 /* Sets the given STYLE's prompt to STRING. */
81 prompt_set (enum prompt_style style, const char *string)
83 assert (style < PROMPT_CNT);
84 free (prompts[style]);
85 prompts[style] = xstrdup (string);
88 /* Sets STYLE as the current prompt style. */
90 prompt_set_style (enum prompt_style style)
92 assert (style < PROMPT_CNT);
93 current_style = style;
96 /* Returns the current prompt. */
98 prompt_get_style (void)
100 return current_style;