From: John Darrington Date: Sat, 22 Feb 2014 17:20:20 +0000 (+0100) Subject: Replace syntactical keywords in error/warning messages by printf directives X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=a6f1c88d9d4dee24e1f79048c8a5d8274f68c405;p=pspp Replace syntactical keywords in error/warning messages by printf directives Continuing the effort started in commit eb06da6a334bc37108cdce9bfc7f26cfcb2003ee --- diff --git a/src/language/data-io/file-handle.q b/src/language/data-io/file-handle.q index 313adc952b..0ac59caa0c 100644 --- a/src/language/data-io/file-handle.q +++ b/src/language/data-io/file-handle.q @@ -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; diff --git a/src/language/dictionary/delete-variables.c b/src/language/dictionary/delete-variables.c index ec5d453715..770ca3f3e1 100644 --- a/src/language/dictionary/delete-variables.c +++ b/src/language/dictionary/delete-variables.c @@ -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; } diff --git a/src/language/dictionary/modify-variables.c b/src/language/dictionary/modify-variables.c index f0b03d48f9..70c700084f 100644 --- a/src/language/dictionary/modify-variables.c +++ b/src/language/dictionary/modify-variables.c @@ -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; diff --git a/src/language/dictionary/rename-variables.c b/src/language/dictionary/rename-variables.c index 4fc5bada85..f7cd9c1a61 100644 --- a/src/language/dictionary/rename-variables.c +++ b/src/language/dictionary/rename-variables.c @@ -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 { diff --git a/src/language/lexer/value-parser.c b/src/language/lexer/value-parser.c index 39f5eb68a9..cc73176a38 100644 --- a/src/language/lexer/value-parser.c +++ b/src/language/lexer/value-parser.c @@ -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; diff --git a/src/language/stats/crosstabs.q b/src/language/stats/crosstabs.q index bcb5a0ebac..a017b3c669 100644 --- a/src/language/stats/crosstabs.q +++ b/src/language/stats/crosstabs.q @@ -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; } diff --git a/src/language/stats/frequencies.q b/src/language/stats/frequencies.q index b5ad8c4779..8a8ac6c4bd 100644 --- a/src/language/stats/frequencies.q +++ b/src/language/stats/frequencies.q @@ -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:; } diff --git a/src/language/utilities/set.q b/src/language/utilities/set.q index 50ddd9443e..f90e3e14de 100644 --- a/src/language/utilities/set.q +++ b/src/language/utilities/set.q @@ -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; } }