Beginning of VFM cleanup.
[pspp-builds.git] / src / set.q
index 8683bff7ea7ef500061ce3ccb0862c78cd3a8f68..2d90ac7e66604c15b65bdb1a24cadbfa95641c7f 100644 (file)
--- a/src/set.q
+++ b/src/set.q
@@ -59,6 +59,7 @@
 */     
    
 #include <config.h>
+#include "settings.h"
 #include <assert.h>
 #include <stdio.h>
 #include <errno.h>
@@ -72,7 +73,6 @@
 #include "output.h"
 #include "var.h"
 #include "format.h"
-#include "settings.h"
 
 double set_blanks;
 int set_compression;
@@ -119,6 +119,7 @@ int set_testing_mode;
 int set_undefined;
 int set_viewlength;
 int set_viewwidth;
+size_t set_max_workspace = 4L * 1024 * 1024;
 
 static void set_routing (int q, int *setting);
 static int set_ccx (const char *cc_string, struct set_cust_currency * cc,
@@ -213,10 +214,10 @@ cmd_set (void)
     return CMD_FAILURE;
 
   if (cmd.sbc_block)
-    msg (SW, _("BLOCK is obsolete."));
+    msg (SW, _("%s is obsolete."),"BLOCK");
 
   if (cmd.sbc_boxstring)
-    msg (SW, _("BOXSTRING is obsolete."));
+    msg (SW, _("%s is obsolete."),"BOXSTRING");
 
   if (cmd.compress != -1)
     {
@@ -234,7 +235,7 @@ cmd_set (void)
        set_cpi = cmd.n_cpi;
     }
   if (cmd.sbc_histogram)
-    msg (MW, _("HISTOGRAM is obsolete."));
+    msg (MW, _("%s is obsolete."),"HISTOGRAM");
   if (cmd.n_lpi != NOT_LONG)
     {
       if (cmd.n_lpi <= 0)
@@ -303,30 +304,40 @@ cmd_set (void)
        set_mxloops = cmd.n_mxloops;
     }
   if (cmd.n_mxmemory != NOT_LONG)
-    msg (SE, _("MXMEMORY is obsolete."));
+    msg (SE, _("%s is obsolete."),"MXMEMORY");
   if (cmd.n_mxwarns != NOT_LONG)
     set_mxwarns = cmd.n_mxwarns;
   if (cmd.prtbck != -1)
     set_printback = cmd.prtbck == STC_OFF ? 0 : 1;
   if (cmd.s_scripttab)
-    msg (SE, _("SCRIPTTAB is obsolete."));
+    msg (SE, _("%s is obsolete."),"SCRIPTTAB");
   if (cmd.s_tbfonts)
-    msg (SW, _("TBFONTS not implemented."));
+    msg (SW, _("%s is not yet implemented."),"TBFONTS");
   if (cmd.s_tb1)
-    msg (SW, _("TB1 not implemented."));
+    msg (SW, _("%s is not yet implemented."),"TB1");
   if (cmd.undef != -1)
     set_undefined = cmd.undef == STC_NOWARN ? 0 : 1;
-  if (cmd.n_workspace != NOT_LONG)
-    msg (SE, _("WORKSPACE is obsolete."));
+  if (cmd.n_workspace != NOT_LONG) 
+    {
+      if (cmd.n_workspace < 1024)
+        msg (SE, _("Workspace limit must be at least 1 MB."));
+      else
+        {
+          if (cmd.n_workspace > (size_t) -1 / 1024)
+            set_max_workspace = -1;
+          else
+            set_max_workspace = 1024 * cmd.n_workspace; 
+        }
+    }
 
   /* PC+ compatible syntax. */
   if (cmd.scrn != -1)
     outp_enable_device (cmd.scrn == STC_OFF ? 0 : 1, OUTP_DEV_SCREEN);
 
   if (cmd.automenu != -1)
-    msg (SW, _("AUTOMENU is obsolete."));
+    msg (SW, _("%s is obsolete."),"AUTOMENU");
   if (cmd.beep != -1)
-    msg (SW, _("BEEP is obsolete."));
+    msg (SW, _("%s is obsolete."),"BEEP");
 
   if (cmd.s_cprompt)
     {
@@ -345,15 +356,15 @@ cmd_set (void)
   if (cmd.s_endcmd)
     set_endcmd = cmd.s_endcmd[0];
   if (cmd.eject != -1)
-    msg (SW, _("EJECT is obsolete."));
+    msg (SW, _("%s is obsolete."),"EJECT");
   if (cmd.errbrk != -1)
     set_errorbreak = cmd.errbrk == STC_OFF ? 0 : 1;
   if (cmd.helpwin != -1)
-    msg (SW, _("HELPWINDOWS is obsolete."));
+    msg (SW, _("%s is obsolete."),"HELPWINDOWS");
   if (cmd.inc != -1)
     set_include = cmd.inc == STC_OFF ? 0 : 1;
   if (cmd.menus != -1)
-    msg (MW, _("MENUS is obsolete."));
+    msg (MW, _("%s is obsolete."),"MENUS");
   if (cmd.null != -1)
     set_nullline = cmd.null == STC_OFF ? 0 : 1;
   if (cmd.more != -1)
@@ -367,13 +378,13 @@ cmd_set (void)
       cmd.s_prompt = NULL;
     }
   if (cmd.ptrans != -1)
-    msg (SW, _("PTRANSLATE is obsolete."));
+    msg (SW, _("%s is obsolete."),"PTRANSLATE");
   if (cmd.runrev != -1)
-    msg (SW, "RUNREVIEW is obsolete.");
+    msg (SW, _("%s is obsolete."),"RUNREVIEW");
   if (cmd.safe == STC_ON)
     set_safer = 1;
   if (cmd.xsort != -1)
-    msg (SW, _("XSORT is obsolete."));
+    msg (SW, _("%s is obsolete."),"XSORT");
 
   free_set (&cmd);
 
@@ -486,7 +497,7 @@ set_routing (int q, int *setting)
 }
 
 static int
-stc_custom_pager (struct cmd_set *cmd unused)
+stc_custom_pager (struct cmd_set *cmd UNUSED)
 {
   lex_match ('=');
 #if !USE_INTERNAL_PAGER
@@ -519,7 +530,7 @@ stc_custom_pager (struct cmd_set *cmd unused)
    SYSMIS or a numeric value; PC+: Syntax is '.', which is equivalent
    to SYSMIS, or a numeric value. */
 static int
-stc_custom_blanks (struct cmd_set *cmd unused)
+stc_custom_blanks (struct cmd_set *cmd UNUSED)
 {
   lex_match ('=');
   if ((token == T_ID && lex_id_match ("SYSMIS", tokid))
@@ -539,7 +550,7 @@ stc_custom_blanks (struct cmd_set *cmd unused)
 }
 
 static int
-stc_custom_length (struct cmd_set *cmd unused)
+stc_custom_length (struct cmd_set *cmd UNUSED)
 {
   int page_length;
 
@@ -564,7 +575,7 @@ stc_custom_length (struct cmd_set *cmd unused)
 }
 
 static int
-stc_custom_results (struct cmd_set *cmd unused)
+stc_custom_results (struct cmd_set *cmd UNUSED)
 {
   struct tuple
     {  
@@ -605,7 +616,7 @@ stc_custom_results (struct cmd_set *cmd unused)
 }
 
 static int
-stc_custom_seed (struct cmd_set *cmd unused)
+stc_custom_seed (struct cmd_set *cmd UNUSED)
 {
   lex_match ('=');
   if (lex_match_id ("RANDOM"))
@@ -617,11 +628,12 @@ stc_custom_seed (struct cmd_set *cmd unused)
       set_seed = tokval;
       lex_get ();
     }
+  set_seed_used=1;
   return 1;
 }
 
 static int
-stc_custom_width (struct cmd_set *cmd unused)
+stc_custom_width (struct cmd_set *cmd UNUSED)
 {
   int page_width;
 
@@ -650,7 +662,7 @@ stc_custom_width (struct cmd_set *cmd unused)
 /* Parses FORMAT subcommand, which consists of a numeric format
    specifier. */
 static int
-stc_custom_format (struct cmd_set *cmd unused)
+stc_custom_format (struct cmd_set *cmd UNUSED)
 {
   struct fmt_spec fmt;
 
@@ -670,7 +682,7 @@ stc_custom_format (struct cmd_set *cmd unused)
 }
 
 static int
-stc_custom_journal (struct cmd_set *cmd unused)
+stc_custom_journal (struct cmd_set *cmd UNUSED)
 {
   lex_match ('=');
   if (lex_match_id ("ON"))
@@ -688,9 +700,9 @@ stc_custom_journal (struct cmd_set *cmd unused)
 /* Parses COLOR subcommand.  PC+: either ON or OFF or two or three
    comma-delimited numbers inside parentheses. */
 static int
-stc_custom_color (struct cmd_set *cmd unused)
+stc_custom_color (struct cmd_set *cmd UNUSED)
 {
-  msg (MW, "COLOR is obsolete.");
+  msg (MW, _("%s is obsolete."),"COLOR");
 
   lex_match ('=');
   if (!lex_match_id ("ON") && !lex_match_id ("YES") && !lex_match_id ("OFF") && !lex_match_id ("NO"))
@@ -739,7 +751,7 @@ stc_custom_color (struct cmd_set *cmd unused)
 }
 
 static int
-stc_custom_listing (struct cmd_set *cmd unused)
+stc_custom_listing (struct cmd_set *cmd UNUSED)
 {
   lex_match ('=');
   if (lex_match_id ("ON") || lex_match_id ("YES"))
@@ -755,23 +767,23 @@ stc_custom_listing (struct cmd_set *cmd unused)
 }
 
 static int
-stc_custom_disk (struct cmd_set *cmd unused)
+stc_custom_disk (struct cmd_set *cmd UNUSED)
 {
   stc_custom_listing (cmd);
   return 0;
 }
 
 static int
-stc_custom_log (struct cmd_set *cmd unused)
+stc_custom_log (struct cmd_set *cmd UNUSED)
 { 
   stc_custom_journal (cmd);
   return 0;
 }
 
 static int
-stc_custom_rcolor (struct cmd_set *cmd unused)
+stc_custom_rcolor (struct cmd_set *cmd UNUSED)
 {
-  msg (SW, _("RCOLOR is obsolete."));
+  msg (SW, _("%s is obsolete."),"RCOLOR");
 
   lex_match ('=');
   if (!lex_force_match ('('))
@@ -818,7 +830,7 @@ stc_custom_rcolor (struct cmd_set *cmd unused)
 }
 
 static int
-stc_custom_viewlength (struct cmd_set *cmd unused)
+stc_custom_viewlength (struct cmd_set *cmd UNUSED)
 {
   if (lex_match_id ("MINIMUM"))
     set_viewlength = 25;
@@ -830,7 +842,7 @@ stc_custom_viewlength (struct cmd_set *cmd unused)
     {
       if (!lex_force_int ())
        return 0;
-#if __MSDOS__
+#ifdef __MSDOS__
       if (lex_integer () >= (43 + 25) / 2)
        set_viewlength = 43;
       else
@@ -841,18 +853,18 @@ stc_custom_viewlength (struct cmd_set *cmd unused)
       lex_get ();
     }
 
-#if __MSDOS__
-  msg (SW, _("VIEWLENGTH not implemented."));
+#ifdef __MSDOS__
+  msg (SW, _("%s is not yet implemented."),"VIEWLENGTH");
 #endif /* dos */
   return 1;
 }
 
 static int
-stc_custom_workdev (struct cmd_set *cmd unused)
+stc_custom_workdev (struct cmd_set *cmd UNUSED)
 {
   char c[2];
 
-  msg (SW, _("WORKDEV is obsolete."));
+  msg (SW, _("%s is obsolete."),"WORKDEV");
 
   c[1] = 0;
   for (*c = 'A'; *c <= 'Z'; (*c)++)
@@ -865,16 +877,6 @@ stc_custom_workdev (struct cmd_set *cmd unused)
   return 0;
 }
 
-\f
-/* GSET. */
-
-int
-cmd_gset (void)
-{
-  /* FIXME */
-  return CMD_FAILURE;
-}
-
 /*
    Local Variables:
    mode: c