MODIFY VARIABLES: Eliminate VAR_NAME_LEN limit on variable names.
[pspp-builds.git] / src / language / prompt.c
index 3d97e42d4d8d295c44143c8d06d3f115b3a381ce..8701f6c9b5ccce54d4a2e6e7c9e2948dd27557a5 100644 (file)
@@ -1,20 +1,18 @@
-/* PSPP - computes sample statistics.
-   Copyright (C) 1997-9, 2000 Free Software Foundation, Inc.
+/* PSPP - a program for statistical analysis.
+   Copyright (C) 1997-9, 2000, 2010 Free Software Foundation, Inc.
 
-   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 the Free Software Foundation; either version 2 of the
-   License, or (at your option) any later version.
+   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
+   the Free Software Foundation, either version 3 of the License, or
+   (at your option) any later version.
 
-   This program is distributed in the hope that it will be useful, but
-   WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-   General Public License for more details.
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
 
    You should have received a copy of the GNU General Public License
-   along with this program; if not, write to the Free Software
-   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-   02110-1301, USA. */
+   along with this program.  If not, see <http://www.gnu.org/licenses/>. */
 
 #include <config.h>
 
 #include <data/variable.h>
 #include <language/command.h>
 #include <language/lexer/lexer.h>
-#include <libpspp/alloc.h>
 #include <libpspp/assertion.h>
 #include <libpspp/message.h>
-#include <libpspp/message.h>
 #include <libpspp/str.h>
-#include <libpspp/verbose-msg.h>
 #include <libpspp/version.h>
-#include <output/table.h>
+#include <output/tab.h>
 
-/* Current prompts in each style. */
-static char *prompts[PROMPT_CNT];
+#include "xalloc.h"
 
 /* Current prompting style. */
 static enum prompt_style current_style;
 
-/* Initializes prompts. */
-void
-prompt_init (void)
-{
-  prompts[PROMPT_FIRST] = xstrdup ("PSPP> ");
-  prompts[PROMPT_LATER] = xstrdup ("    > ");
-  prompts[PROMPT_DATA] = xstrdup ("data> ");
-  current_style = PROMPT_FIRST;
-}
-
-/* Frees prompts. */
-void
-prompt_done (void)
-{
-  int i;
-
-  for (i = 0; i < PROMPT_CNT; i++)
-    {
-      free (prompts[i]);
-      prompts[i] = NULL;
-    }
-}
-
 /* Gets the command prompt for the given STYLE. */
 const char *
 prompt_get (enum prompt_style style)
 {
-  assert (style < PROMPT_CNT);
-  return prompts[style];
-}
+  switch (style)
+    {
+    case PROMPT_FIRST:
+      return "PSPP> ";
 
-/* Sets the given STYLE's prompt to STRING. */
-void
-prompt_set (enum prompt_style style, const char *string)
-{
-  assert (style < PROMPT_CNT);
-  free (prompts[style]);
-  prompts[style] = xstrdup (string);
+    case PROMPT_LATER:
+      return "    > ";
+
+    case PROMPT_DATA:
+      return "data> ";
+
+    case PROMPT_CNT:
+      NOT_REACHED ();
+    }
+  NOT_REACHED ();
 }
 
 /* Sets STYLE as the current prompt style. */