Add SET TVARS option. Closes bug #31566
[pspp] / src / language / utilities / set.q
index dcf7a327be79e2681bbfbe841affb0a02b370592..243de30063c8b12332009d185ed02274c0a5bb06 100644 (file)
@@ -108,6 +108,7 @@ int tgetnum (const char *);
      scripttab=string;
      seed=custom;
      tnumbers=custom;
+     tvars=custom;
      tb1=string;
      tbfonts=string;
      undefined=undef:warn/nowarn;
@@ -357,6 +358,35 @@ stc_custom_tnumbers (struct lexer *lexer,
 }
 
 
+static int
+stc_custom_tvars (struct lexer *lexer,
+                  struct dataset *ds UNUSED,
+                  struct cmd_set *cmd UNUSED, void *aux UNUSED)
+{
+  lex_match (lexer, T_EQUALS);
+
+  if (lex_match_id (lexer, "NAMES"))
+    {
+      settings_set_var_style (SETTINGS_VAR_STYLE_NAMES);
+    }
+  else if (lex_match_id (lexer, "LABELS"))
+    {
+      settings_set_var_style (SETTINGS_VAR_STYLE_LABELS);
+    }
+  else if (lex_match_id (lexer, "BOTH"))
+    {
+      settings_set_var_style (SETTINGS_VAR_STYLE_BOTH);
+    }
+  else
+    {
+      lex_error_expecting (lexer, "NAMES", "LABELS", "BOTH", NULL_SENTINEL);
+      return 0;
+    }
+
+  return 1;
+}
+
+
 /* Parses the EPOCH subcommand, which controls the epoch used for
    parsing 2-digit years. */
 static int