pspp-dev
[Top][All Lists]
Advanced

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

[PATCH 1/4] Remove the NULLINE and ENDCMD settings.


From: Ben Pfaff
Subject: [PATCH 1/4] Remove the NULLINE and ENDCMD settings.
Date: Sat, 4 Dec 2010 11:37:35 -0800

These settings change the lexical structure of the language, which makes
lexical analysis difficult.
---
 NEWS                          |    5 ++++-
 doc/language.texi             |    9 +--------
 doc/utilities.texi            |   18 ------------------
 src/data/settings.c           |   32 --------------------------------
 src/data/settings.h           |    6 ------
 src/language/control/repeat.c |    4 ++--
 src/language/lexer/lexer.c    |    3 +--
 src/language/utilities/set.q  |   13 -------------
 8 files changed, 8 insertions(+), 82 deletions(-)

diff --git a/NEWS b/NEWS
index 3846c4b..ade64c0 100644
--- a/NEWS
+++ b/NEWS
@@ -1,5 +1,5 @@
 PSPP NEWS -- history of user-visible changes.
-Time-stamp: <2010-10-16 13:05:30 blp>
+Time-stamp: <2010-11-21 11:14:27 blp>
 Copyright (C) 1996-9, 2000, 2008, 2009, 2010 Free Software Foundation, Inc.
 See the end for copying conditions.
 
@@ -20,6 +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.
+
 Changes from 0.7.2 to 0.7.3:
 
  * Charts are now produced with Cairo and Pango, instead of libplot.
diff --git a/doc/language.texi b/doc/language.texi
index d117a0e..78d38ac 100644
--- a/doc/language.texi
+++ b/doc/language.texi
@@ -147,11 +147,6 @@ punctuator only as the last character on a line (except 
white space).
 When it is the last non-space character on a line, a period is not
 treated as part of another token, even if it would otherwise be part
 of, e.g.@:, an identifier or a floating-point number.
-
-Actually, the character that ends a command can be changed with
address@hidden's ENDCMD subcommand (@pxref{SET}), but we do not recommend
-doing so.  Throughout the remainder of this manual we will assume that
-the default setting is in effect.
 @end table
 
 @node Commands
@@ -179,9 +174,7 @@ by a forward slash (@samp{/}).
 There are multiple ways to mark the end of a command.  The most common
 way is to end the last line of the command with a period (@samp{.}) as
 described in the previous section (@pxref{Tokens}).  A blank line, or
-one that consists only of white space or comments, also ends a command
-by default, although you can use the NULLINE subcommand of @cmd{SET}
-to disable this feature (@pxref{SET}).
+one that consists only of white space or comments, also ends a command.
 
 @node Syntax Variants
 @section Variants of syntax.
diff --git a/doc/utilities.texi b/doc/utilities.texi
index bcb9761..b132f6b 100644
--- a/doc/utilities.texi
+++ b/doc/utilities.texi
@@ -358,10 +358,6 @@ SET
         /address@hidden,MSBFIRST,LSBFIRST,address@hidden
         /address@hidden,ISL,ISB,IDL,IDB,VF,VD,VG,ZS,address@hidden
 
-(program input)
-        /ENDCMD='.'
-        /address@hidden,address@hidden
-
 (interaction)
         /CPROMPT='cprompt_string'
         /DPROMPT='dprompt_string'
@@ -530,19 +526,6 @@ formats are only for use with very old input files.
 The default is NATIVE.
 @end table
 
-Program input subcommands affect the way that programs are parsed when
-they are typed interactively or run from a command file.  They are
-
address@hidden @asis
address@hidden ENDCMD
-This is a single character indicating the end of a command.  The default
-is @samp{.}.  Don't change this.
-
address@hidden NULLINE
-Whether a blank line is interpreted as ending the current command.  The
-default is ON.
address@hidden table
-
 Interaction subcommands affect the way that PSPP interacts with an
 online user.  The interaction subcommands are
 
@@ -807,7 +790,6 @@ SHOW
         [CCE]
         [COPYING]
         [DECIMALS]
-        [ENDCMD]
         [FORMAT]
         [LENGTH]
         [MXERRS]
diff --git a/src/data/settings.c b/src/data/settings.c
index 092187a..ec026d4 100644
--- a/src/data/settings.c
+++ b/src/data/settings.c
@@ -64,8 +64,6 @@ struct settings
   bool printback;
   bool mprint;
   int mxloops;
-  bool nulline;
-  char endcmd;
   size_t workspace;
   struct fmt_spec default_format;
   bool testing_mode;
@@ -105,8 +103,6 @@ static struct settings the_settings = {
   true,                         /* printback */
   true,                         /* mprint */
   1,                            /* mxloops */
-  true,                         /* nulline */
-  '.',                          /* endcmd */
   64L * 1024 * 1024,            /* workspace */
   {FMT_F, 8, 2},                /* default_format */
   false,                        /* testing_mode */
@@ -429,34 +425,6 @@ settings_set_mxloops ( int mxloops)
   the_settings.mxloops = mxloops;
 }
 
-/* Whether a blank line is a command terminator. */
-bool
-settings_get_nulline (void)
-{
-  return the_settings.nulline;
-}
-
-/* Set whether a blank line is a command terminator. */
-void
-settings_set_nulline ( bool nulline)
-{
-  the_settings.nulline = nulline;
-}
-
-/* The character used to terminate commands. */
-char
-settings_get_endcmd (void)
-{
-  return the_settings.endcmd;
-}
-
-/* Set the character used to terminate commands. */
-void
-settings_set_endcmd ( char endcmd)
-{
-  the_settings.endcmd = endcmd;
-}
-
 /* Approximate maximum amount of memory to use for cases, in
    bytes. */
 size_t
diff --git a/src/data/settings.h b/src/data/settings.h
index e68325f..963458d 100644
--- a/src/data/settings.h
+++ b/src/data/settings.h
@@ -92,12 +92,6 @@ void settings_set_mprint (bool);
 int settings_get_mxloops (void);
 void settings_set_mxloops ( int);
 
-bool settings_get_nulline (void);
-void settings_set_nulline (bool);
-
-char settings_get_endcmd (void);
-void settings_set_endcmd (char);
-
 size_t settings_get_workspace (void);
 size_t settings_get_workspace_cases (const struct caseproto *);
 void settings_set_workspace (size_t);
diff --git a/src/language/control/repeat.c b/src/language/control/repeat.c
index 130dfd6..7b5634c 100644
--- a/src/language/control/repeat.c
+++ b/src/language/control/repeat.c
@@ -527,7 +527,7 @@ do_repeat_filter (struct getl_interface *interface, struct 
string *line)
 
   /* Strip trailing whitespace, check for & remove terminal dot. */
   ds_rtrim (line, ss_cstr (CC_SPACES));
-  dot = ds_chomp (line, settings_get_endcmd ());
+  dot = ds_chomp (line, '.');
   input = ds_ss (line);
   in_apos = in_quote = false;
   while ((c = ss_first (input)) != EOF)
@@ -550,7 +550,7 @@ do_repeat_filter (struct getl_interface *interface, struct 
string *line)
         }
     }
   if (dot)
-    ds_put_byte (&output, settings_get_endcmd ());
+    ds_put_byte (&output, '.');
 
   ds_swap (line, &output);
   ds_destroy (&output);
diff --git a/src/language/lexer/lexer.c b/src/language/lexer/lexer.c
index 4a899bd..00724e6 100644
--- a/src/language/lexer/lexer.c
+++ b/src/language/lexer/lexer.c
@@ -917,8 +917,7 @@ lex_preprocess_line (struct string *line,
 {
   strip_comments (line);
   ds_rtrim (line, ss_cstr (CC_SPACES));
-  *line_ends_command = (ds_chomp (line, settings_get_endcmd ())
-                        || (ds_is_empty (line) && settings_get_nulline ()));
+  *line_ends_command = ds_chomp (line, '.') || ds_is_empty (line);
   *line_starts_command = false;
   if (syntax == GETL_BATCH)
     {
diff --git a/src/language/utilities/set.q b/src/language/utilities/set.q
index f109e45..a07efed 100644
--- a/src/language/utilities/set.q
+++ b/src/language/utilities/set.q
@@ -73,7 +73,6 @@ int tgetnum (const char *);
      cprompt=string;
      decimal=dec:dot/comma;
      dprompt=string;
-     endcmd=string "x==1" "one character long";
      epoch=custom;
      errors=custom;
      format=custom;
@@ -97,7 +96,6 @@ int tgetnum (const char *);
      mxloops=integer "x >=1" "%s must be at least 1";
      mxmemory=integer;
      mxwarns=integer;
-     nulline=null:on/off;
      printback=custom;
      prompt=string;
      results=custom;
@@ -158,16 +156,12 @@ cmd_set (struct lexer *lexer, struct dataset *ds)
   if (cmd.sbc_decimal)
     settings_set_decimal_char (cmd.dec == STC_DOT ? '.' : ',');
 
-  if (cmd.sbc_endcmd)
-    settings_set_endcmd (cmd.s_endcmd[0]);
   if (cmd.sbc_include)
     settings_set_include (cmd.inc == STC_ON);
   if (cmd.sbc_mxerrs)
     settings_set_max_messages (MSG_S_ERROR, cmd.n_mxerrs[0]);
   if (cmd.sbc_mxwarns)
     settings_set_max_messages (MSG_S_WARNING, cmd.n_mxwarns[0]);
-  if (cmd.sbc_nulline)
-    settings_set_nulline (cmd.null == STC_ON);
   if (cmd.sbc_rib)
     settings_set_input_integer_format (stc_to_integer_format (cmd.rib));
   if (cmd.sbc_rrb)
@@ -621,12 +615,6 @@ show_decimals (const struct dataset *ds UNUSED)
 }
 
 static char *
-show_endcmd (const struct dataset *ds UNUSED)
-{
-  return xasprintf ("`%c'", settings_get_endcmd ());
-}
-
-static char *
 show_errors (const struct dataset *ds UNUSED)
 {
   return show_output_routing (SETTINGS_OUTPUT_ERROR);
@@ -810,7 +798,6 @@ const struct show_sbc show_table[] =
     {"CCD", show_ccd},
     {"CCE", show_cce},
     {"DECIMALS", show_decimals},
-    {"ENDCMD", show_endcmd},
     {"ERRORS", show_errors},
     {"FORMAT", show_format},
     {"LENGTH", show_length},
-- 
1.7.1




reply via email to

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