Replace syntactical keywords in error/warning messages by printf directives
authorJohn Darrington <john@darrington.wattle.id.au>
Sat, 22 Feb 2014 17:20:20 +0000 (18:20 +0100)
committerJohn Darrington <john@darrington.wattle.id.au>
Sat, 22 Feb 2014 17:20:20 +0000 (18:20 +0100)
Continuing the effort started in commit eb06da6a334bc37108cdce9bfc7f26cfcb2003ee

src/language/data-io/file-handle.q
src/language/dictionary/delete-variables.c
src/language/dictionary/modify-variables.c
src/language/dictionary/rename-variables.c
src/language/lexer/value-parser.c
src/language/stats/crosstabs.q
src/language/stats/frequencies.q
src/language/utilities/set.q

index 313adc952b8bdcf14190c6186924bc0a43394897..0ac59caa0c337cf7470a376bda727c44bbfec40f 100644 (file)
@@ -72,8 +72,8 @@ cmd_file_handle (struct lexer *lexer, struct dataset *ds)
   if (handle != NULL)
     {
       msg (SE, _("File handle %s is already defined.  "
-                 "Use CLOSE FILE HANDLE before redefining a file handle."),
-          handle_name);
+                 "Use %s before redefining a file handle."),
+          handle_name, "CLOSE FILE HANDLE");
       goto exit_free_handle_name;
     }
 
@@ -132,7 +132,7 @@ cmd_file_handle (struct lexer *lexer, struct dataset *ds)
         }
       else
         {
-          msg (SE, _("RECFORM must be specified with MODE=360."));
+          msg (SE, _("%s must be specified with %s."), "RECFORM", "MODE=360");
           goto exit_free_cmd;
         }
       break;
index ec5d45371551ed5824101337b0e02bd7ef9757da..770ca3f3e13540e90dcf5f511ebc82b9b4c9a55f 100644 (file)
@@ -37,16 +37,17 @@ cmd_delete_variables (struct lexer *lexer, struct dataset *ds)
   bool ok;
 
   if (proc_make_temporary_transformations_permanent (ds))
-    msg (SE, _("DELETE VARIABLES may not be used after TEMPORARY.  "
-               "Temporary transformations will be made permanent."));
+    msg (SE, _("%s may not be used after %s.  "
+               "Temporary transformations will be made permanent."), 
+        "DELETE VARIABLES", "TEMPORARY");
 
   if (!parse_variables (lexer, dataset_dict (ds), &vars, &var_cnt, PV_NONE))
     goto error;
   if (var_cnt == dict_get_var_cnt (dataset_dict (ds)))
     {
-      msg (SE, _("DELETE VARIABLES may not be used to delete all variables "
+      msg (SE, _("%s may not be used to delete all variables "
                  "from the active dataset dictionary.  "
-                 "Use NEW FILE instead."));
+                 "Use %s instead."), "DELETE VARIABLES", "NEW FILE");
       goto error;
     }
 
index f0b03d48f9ee426e264a462ac48ca48c4ae2892c..70c700084fdf765450ce59a2d758f1a7da609ffa 100644 (file)
@@ -89,8 +89,8 @@ cmd_modify_vars (struct lexer *lexer, struct dataset *ds)
   size_t i;
 
   if (proc_make_temporary_transformations_permanent (ds))
-    msg (SE, _("MODIFY VARS may not be used after TEMPORARY.  "
-               "Temporary transformations will be made permanent."));
+    msg (SE, _("%s may not be used after %s.  "
+               "Temporary transformations will be made permanent."), "MODIFY VARS", "TEMPORARY");
 
   vm.reorder_vars = NULL;
   vm.reorder_cnt = 0;
@@ -229,8 +229,9 @@ cmd_modify_vars (struct lexer *lexer, struct dataset *ds)
 
          if (already_encountered & 4)
            {
-             msg (SE, _("KEEP subcommand may be given at most once.  It may "
-                   "not be given in conjunction with the DROP subcommand."));
+             msg (SE, _("%s subcommand may be given at most once.  It may "
+                        "not be given in conjunction with the %s subcommand."),
+                  "KEEP", "DROP");
              goto done;
            }
          already_encountered |= 4;
@@ -272,9 +273,11 @@ cmd_modify_vars (struct lexer *lexer, struct dataset *ds)
 
          if (already_encountered & 4)
            {
-             msg (SE, _("DROP subcommand may be given at most once.  It may "
-                         "not be given in conjunction with the KEEP "
-                         "subcommand."));
+             msg (SE, _("%s subcommand may be given at most once.  It may "
+                         "not be given in conjunction with the %s "
+                         "subcommand."),
+                  "DROP", "KEEP"
+                  );
              goto done;
            }
          already_encountered |= 4;
index 4fc5bada85df3cc3f716bfb816767173660329b2..f7cd9c1a613ad3f7a4ccc1078dea9a37ff034ee7 100644 (file)
@@ -45,8 +45,8 @@ cmd_rename_variables (struct lexer *lexer, struct dataset *ds)
   int status = CMD_CASCADING_FAILURE;
 
   if (proc_make_temporary_transformations_permanent (ds))
-    msg (SE, _("RENAME VARS may not be used after TEMPORARY.  "
-               "Temporary transformations will be made permanent."));
+    msg (SE, _("%s may not be used after %s.  "
+               "Temporary transformations will be made permanent."), "RENAME VARS", "TEMPORARY");
 
   do
     {
index 39f5eb68a9ffc6c881db6e83d99b00b8e5dc8ff5..cc73176a38db24f2c0b940666d71b277943db23d 100644 (file)
@@ -79,7 +79,7 @@ parse_num_range (struct lexer *lexer,
     {
       if (*x == LOWEST)
         {
-          msg (SE, _("%s or %s must be part of a range."), "LO", "LOWEEST");
+          msg (SE, _("%s or %s must be part of a range."), "LO", "LOWEST");
           return false;
         }
       *y = *x;
index bcb5a0ebacc5c546f2ab4127c5f33280b9a60379..a017b3c6696e38821b0d2715e11a5b02fc025bb1 100644 (file)
@@ -295,8 +295,8 @@ cmd_crosstabs (struct lexer *lexer, struct dataset *ds)
                    : MV_NEVER);
   if (proc.mode == GENERAL && proc.exclude == MV_NEVER)
     {
-      msg (SE, _("Missing mode REPORT not allowed in general mode.  "
-                "Assuming MISSING=TABLE."));
+      msg (SE, _("Missing mode %s not allowed in general mode.  "
+                "Assuming %s."), "REPORT", "MISSING=TABLE");
       proc.exclude = MV_ANY;
     }
 
@@ -479,7 +479,7 @@ crs_custom_variables (struct lexer *lexer, struct dataset *ds,
   struct crosstabs_proc *proc = proc_;
   if (proc->n_pivots)
     {
-      msg (SE, _("VARIABLES must be specified before TABLES."));
+      msg (SE, _("%s must be specified before %s."), "VARIABLES", "TABLES");
       return 0;
     }
 
index b5ad8c47793eef15064a887023eead28732c8845..8a8ac6c4bd64b4633099c5db1b5f53e69774cb38 100644 (file)
@@ -397,10 +397,13 @@ determine_charts (struct frq_proc *frq, const struct cmd_frequencies *cmd)
       if (hist->x_min != SYSMIS && hist->x_max != SYSMIS
           && hist->x_min >= hist->x_max)
         {
-          msg (SE, _("MAX for histogram must be greater than or equal to MIN, "
-                     "but MIN was specified as %.15g and MAX as %.15g.  "
-                     "MIN and MAX will be ignored."),
-               hist->x_min, hist->x_max);
+          msg (SE, _("%s for histogram must be greater than or equal to %s, "
+                     "but %s was specified as %.15g and %s as %.15g.  "
+                     "%s and %s will be ignored."),
+              "MAX", "MIN", 
+              "MIN", hist->x_min, 
+              "MAX", hist->x_max,
+              "MIN", "MAX");
           hist->x_min = hist->x_max = SYSMIS;
         }
     }
@@ -418,9 +421,13 @@ determine_charts (struct frq_proc *frq, const struct cmd_frequencies *cmd)
       if (pie->x_min != SYSMIS && pie->x_max != SYSMIS
           && pie->x_min >= pie->x_max)
         {
-          msg (SE, _("MAX for pie chart must be greater than or equal to MIN, "
-                     "but MIN was specified as %.15g and MAX as %.15g.  "
-                     "MIN and MAX will be ignored."), pie->x_min, pie->x_max);
+          msg (SE, _("%s for pie chart must be greater than or equal to %s, "
+                     "but %s was specified as %.15g and %s as %.15g.  "
+                     "%s and %s will be ignored."), 
+              "MAX", "MIN", 
+              "MIN", pie->x_min,
+              "MAX", pie->x_max,
+              "MIN", "MAX");
           pie->x_min = pie->x_max = SYSMIS;
         }
     }
@@ -725,7 +732,7 @@ frq_custom_grouped (struct lexer *lexer, struct dataset *ds, struct cmd_frequenc
                   {
                     if (vf->groups != NULL)
                       msg (SE, _("Variables %s specified multiple times on "
-                                 "GROUPED subcommand."), var_get_name (v[i]));
+                                 "%s subcommand."), var_get_name (v[i]), "GROUPED");
                     else
                       {
                         vf->n_groups = nl;
@@ -734,8 +741,8 @@ frq_custom_grouped (struct lexer *lexer, struct dataset *ds, struct cmd_frequenc
                     goto found;
                   }
               }
-            msg (SE, _("Variables %s specified on GROUPED but not on "
-                       "VARIABLES."), var_get_name (v[i]));
+            msg (SE, _("Variables %s specified on %s but not on "
+                       "%s."), var_get_name (v[i]), "GROUPED", "VARIABLES");
 
           found:;
           }
index 50ddd9443ed8dc92d956068e8d3d3f07b2e09fc1..f90e3e14de3d8e675b7988879a79c3a2cca83b67 100644 (file)
@@ -194,9 +194,9 @@ cmd_set (struct lexer *lexer, struct dataset *ds)
   if (cmd.sbc_workspace)
     {
       if ( cmd.n_workspace[0] < 1024 && ! settings_get_testing_mode ())
-       msg (SE, _("WORKSPACE must be at least 1MB"));
+       msg (SE, _("%s must be at least 1MB"), "WORKSPACE");
       else if (cmd.n_workspace[0] <= 0)
-       msg (SE, _("WORKSPACE must be positive"));
+       msg (SE, _("%s must be positive"), "WORKSPACE");
       else
        settings_set_workspace (cmd.n_workspace[0] * 1024L);
     }
@@ -404,14 +404,14 @@ stc_custom_epoch (struct lexer *lexer,
       lex_get (lexer);
       if (new_epoch < 1500)
         {
-          msg (SE, _("EPOCH must be 1500 or later."));
+          msg (SE, _("%s must be 1500 or later."), "EPOCH");
           return 0;
         }
       settings_set_epoch (new_epoch);
     }
   else
     {
-      lex_error (lexer, _("expecting AUTOMATIC or year"));
+      lex_error (lexer, _("expecting %s or year"), "AUTOMATIC");
       return 0;
     }
 
@@ -439,7 +439,7 @@ stc_custom_length (struct lexer *lexer, struct dataset *ds UNUSED, struct cmd_se
        return 0;
       if (lex_integer (lexer) < 1)
        {
-         msg (SE, _("LENGTH must be at least 1."));
+         msg (SE, _("%s must be at least %d."), "LENGTH", 1);
          return 0;
        }
       page_length = lex_integer (lexer);
@@ -536,7 +536,7 @@ stc_custom_width (struct lexer *lexer, struct dataset *ds UNUSED, struct cmd_set
        return 0;
       if (lex_integer (lexer) < 40)
        {
-         msg (SE, _("WIDTH must be at least 40."));
+         msg (SE, _("%s must be at least %d."), "WIDTH", 40);
          return 0;
        }
       settings_set_viewwidth (lex_integer (lexer));
@@ -563,8 +563,9 @@ stc_custom_format (struct lexer *lexer, struct dataset *ds UNUSED, struct cmd_se
   if (fmt_is_string (fmt.type))
     {
       char str[FMT_STRING_LEN_MAX + 1];
-      msg (SE, _("FORMAT requires numeric output format as an argument.  "
+      msg (SE, _("%s requires numeric output format as an argument.  "
                 "Specified format %s is of type string."),
+          "FORMAT",
           fmt_to_string (&fmt, str));
       return 0;
     }
@@ -1082,8 +1083,9 @@ cmd_preserve (struct lexer *lexer UNUSED, struct dataset *ds UNUSED)
     }
   else
     {
-      msg (SE, _("Too many PRESERVE commands without a RESTORE: at most "
+      msg (SE, _("Too many %s commands without a %s: at most "
                  "%d levels of saved settings are allowed."),
+          "PRESERVE", "RESTORE",
            MAX_SAVED_SETTINGS);
       return CMD_CASCADING_FAILURE;
     }
@@ -1101,7 +1103,7 @@ cmd_restore (struct lexer *lexer UNUSED, struct dataset *ds UNUSED)
     }
   else
     {
-      msg (SE, _("RESTORE without matching PRESERVE."));
+      msg (SE, _("%s without matching %s."), "RESTORE", "PRESERVE");
       return CMD_FAILURE;
     }
 }