pspp-dev
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH 2/4] Remove the PROMPT, CPROMPT, and DPROMPT settings.


From: Ben Pfaff
Subject: [PATCH 2/4] Remove the PROMPT, CPROMPT, and DPROMPT settings.
Date: Sat, 4 Dec 2010 11:37:36 -0800

These settings will be insufficient to configure prompting for the new
lexer, which is able to detect more special cases in syntax and report
them through the prompt.  (However, if users actually want this feature,
then we could add it; it's not difficult.)
---
 NEWS                         |    7 +++--
 doc/utilities.texi           |   13 -----------
 src/language/prompt.c        |   50 +++++++++++------------------------------
 src/language/prompt.h        |   10 +------
 src/language/utilities/set.q |   11 ---------
 src/ui/terminal/main.c       |    3 --
 6 files changed, 20 insertions(+), 74 deletions(-)

diff --git a/NEWS b/NEWS
index ade64c0..a960684 100644
--- a/NEWS
+++ b/NEWS
@@ -1,5 +1,5 @@
 PSPP NEWS -- history of user-visible changes.
-Time-stamp: <2010-11-21 11:14:27 blp>
+Time-stamp: <2010-11-21 11:58:30 blp>
 Copyright (C) 1996-9, 2000, 2008, 2009, 2010 Free Software Foundation, Inc.
 See the end for copying conditions.
 
@@ -20,8 +20,9 @@ Changes from 0.7.3 to 0.7.6:
 
  * The HOST command has been updated to use more modern syntax.
 
- * The SET and SHOW commands no longer support the ENDCMD and NULLINE
-   subcommands.  The defaults are now the only supported values.
+ * The SET and SHOW commands no longer support the ENDCMD, NULLINE,
+   PROMPT, CPROMPT, and DPROMPT subcommands.  The defaults are now the
+   only supported values.
 
 Changes from 0.7.2 to 0.7.3:
 
diff --git a/doc/utilities.texi b/doc/utilities.texi
index b132f6b..b729b88 100644
--- a/doc/utilities.texi
+++ b/doc/utilities.texi
@@ -359,11 +359,8 @@ SET
         /address@hidden,ISL,ISB,IDL,IDB,VF,VD,VG,ZS,address@hidden
 
 (interaction)
-        /CPROMPT='cprompt_string'
-        /DPROMPT='dprompt_string'
         /MXERRS=max_errs
         /MXWARNS=max_warnings
-        /PROMPT='prompt'
         /WORKSPACE=workspace_size
 
 (program execution)
@@ -530,13 +527,6 @@ Interaction subcommands affect the way that PSPP interacts 
with an
 online user.  The interaction subcommands are
 
 @table @asis
address@hidden CPROMPT
-The command continuation prompt.  The default is @samp{    > }.
-
address@hidden DPROMPT
-Prompt used when expecting data input within @cmd{BEGIN DATA} (@pxref{BEGIN
-DATA}).  The default is @samp{data> }.
-
 @item MXERRS
 The maximum number of errors before PSPP halts processing of the current
 command file.  The default is 50.
@@ -548,9 +538,6 @@ The special value of zero means that all warning situations 
should be ignored.
 No warnings will be issued, except a single initial warning advising the user
 that warnings will not be given.
 The default value is 100.
-
address@hidden PROMPT
-The command prompt.  The default is @samp{PSPP> }.
 @end table
 
 Program execution subcommands control the way that PSPP commands
diff --git a/src/language/prompt.c b/src/language/prompt.c
index b527807..8701f6c 100644
--- a/src/language/prompt.c
+++ b/src/language/prompt.c
@@ -35,50 +35,28 @@
 
 #include "xalloc.h"
 
-/* Current prompts in each style. */
-static char *prompts[PROMPT_CNT];
-
 /* 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. */
diff --git a/src/language/prompt.h b/src/language/prompt.h
index 648eb9d..aa5733a 100644
--- a/src/language/prompt.h
+++ b/src/language/prompt.h
@@ -1,5 +1,5 @@
 /* PSPP - a program for statistical analysis.
-   Copyright (C) 1997-9, 2000 Free Software Foundation, Inc.
+   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
@@ -27,15 +27,9 @@ enum prompt_style
     PROMPT_CNT
   };
 
-
-void prompt_init (void);
-void prompt_done (void);
-
 enum prompt_style prompt_get_style (void);
-
-const char *prompt_get (enum prompt_style);
-void prompt_set (enum prompt_style, const char *);
 void prompt_set_style (enum prompt_style);
 
+const char *prompt_get (enum prompt_style);
 
 #endif /* PROMPT_H */
diff --git a/src/language/utilities/set.q b/src/language/utilities/set.q
index a07efed..5fa7406 100644
--- a/src/language/utilities/set.q
+++ b/src/language/utilities/set.q
@@ -32,7 +32,6 @@
 #include <language/command.h>
 #include <language/lexer/format-parser.h>
 #include <language/lexer/lexer.h>
-#include <language/prompt.h>
 #include <libpspp/compiler.h>
 #include <libpspp/copyleft.h>
 #include <libpspp/float-format.h>
@@ -70,9 +69,7 @@ int tgetnum (const char *);
      cce=string;
      compression=compress:on/off;
      cpi=integer "x>0" "%s must be greater than 0";
-     cprompt=string;
      decimal=dec:dot/comma;
-     dprompt=string;
      epoch=custom;
      errors=custom;
      format=custom;
@@ -97,7 +94,6 @@ int tgetnum (const char *);
      mxmemory=integer;
      mxwarns=integer;
      printback=custom;
-     prompt=string;
      results=custom;
      rib=rib:msbfirst/lsbfirst/vax/native;
      rrb=rrb:native/isl/isb/idl/idb/vf/vd/vg/zs/zl;
@@ -146,13 +142,6 @@ cmd_set (struct lexer *lexer, struct dataset *ds)
   if (cmd.sbc_cce)
     settings_set_cc ( cmd.s_cce, FMT_CCE);
 
-  if (cmd.sbc_prompt)
-    prompt_set (PROMPT_FIRST, cmd.s_prompt);
-  if (cmd.sbc_cprompt)
-    prompt_set (PROMPT_LATER, cmd.s_cprompt);
-  if (cmd.sbc_dprompt)
-    prompt_set (PROMPT_DATA, cmd.s_dprompt);
-
   if (cmd.sbc_decimal)
     settings_set_decimal_char (cmd.dec == STC_DOT ? '.' : ',');
 
diff --git a/src/ui/terminal/main.c b/src/ui/terminal/main.c
index 64a7d2e..5fa1604 100644
--- a/src/ui/terminal/main.c
+++ b/src/ui/terminal/main.c
@@ -39,7 +39,6 @@
 #include "gsl/gsl_errno.h"
 #include "language/command.h"
 #include "language/lexer/lexer.h"
-#include "language/prompt.h"
 #include "language/syntax-file.h"
 #include "libpspp/argv-parser.h"
 #include "libpspp/compiler.h"
@@ -94,7 +93,6 @@ main (int argc, char **argv)
 
   fh_init ();
   the_source_stream = create_source_stream ();
-  prompt_init ();
   readln_initialize ();
   settings_init ();
   terminal_check_size ();
@@ -159,7 +157,6 @@ main (int argc, char **argv)
   fh_done ();
   lex_destroy (the_lexer);
   destroy_source_stream (the_source_stream);
-  prompt_done ();
   readln_uninitialize ();
   output_close ();
   msg_ui_done ();
-- 
1.7.1




reply via email to

[Prev in Thread] Current Thread [Next in Thread]