From: Martin Mares Date: Sat, 7 Apr 2018 08:26:58 +0000 (+0200) Subject: Unified terminology: arguments, not parameters X-Git-Tag: v0.1~4 X-Git-Url: http://mj.ucw.cz/gitweb/?a=commitdiff_plain;h=43eb90021878c17da6865de175dfc87dceec913a;p=paperjam.git Unified terminology: arguments, not parameters --- diff --git a/TODO b/TODO index e0f9465..48bcd54 100644 --- a/TODO +++ b/TODO @@ -2,7 +2,6 @@ - What if an input page specifies /Rotate? - "-f" switch - Help -- Parameters vs. arguments - More precise parsing errors | # Position bbox on a new paper diff --git a/cmds.cc b/cmds.cc index ece509d..e446c83 100644 --- a/cmds.cc +++ b/cmds.cc @@ -1079,7 +1079,7 @@ public: else if (by == "tile" || by == "t") fill_by = BY_TILE; else - err("Parameter \"by\" must be rows/cols/tile"); + err("Argument \"by\" must be rows/cols/tile"); crop = c->arg("crop")->as_int(0); mixed = c->arg("mixed")->as_int(0); diff --git a/parse.cc b/parse.cc index 5f1b1d0..37ee377 100644 --- a/parse.cc +++ b/parse.cc @@ -214,7 +214,7 @@ static double parse_dimen(const arg_def *adef) { token_type t = next_token(); if (t != TOK_NUMBER) - parse_error("Parameter %s must be a dimension", adef->name); + parse_error("Argument %s must be a dimension", adef->name); double tmp = token_num; t = next_token(); @@ -225,7 +225,7 @@ static double parse_dimen(const arg_def *adef) return_token(); return 0; } - parse_error("Parameter %s must have a unit", adef->name); + parse_error("Argument %s must have a unit", adef->name); } for (uint i=0; units[i].name; i++) if (token == units[i].name) @@ -316,9 +316,9 @@ static void parse_args(cmd *c) while (adefs[argi].name && token != adefs[argi].name) argi++; if (!adefs[argi].name) - parse_error("Command %s has no parameter %s", cdef->name, token.c_str()); + parse_error("Command %s has no argument %s", cdef->name, token.c_str()); if (c->args.count(token)) - parse_error("Parameter %s given multiple times", token.c_str()); + parse_error("Argument %s given multiple times", token.c_str()); t = next_token(); if (t == TOK_EQUAL) has_value = true; @@ -327,7 +327,7 @@ static void parse_args(cmd *c) saw_named = true; } else if (saw_named) - parse_error("Positional parameters must precede named ones"); + parse_error("Positional arguments must precede named ones"); else { return_token(); @@ -349,19 +349,19 @@ static void parse_args(cmd *c) case AT_STRING: t = next_token(); if (t != TOK_STRING) - parse_error("Parameter %s must be a string", adef->name); + parse_error("Argument %s must be a string", adef->name); val = new arg_string(token); break; case AT_INT: t = next_token(); if (t != TOK_NUMBER || !token_is_int()) - parse_error("Parameter %s must be an integer", adef->name); + parse_error("Argument %s must be an integer", adef->name); val = new arg_int((int) token_num); break; case AT_DOUBLE: t = next_token(); if (t != TOK_NUMBER) - parse_error("Parameter %s must be a number", adef->name); + parse_error("Argument %s must be a number", adef->name); val = new arg_double(token_num); break; case AT_DIMEN: @@ -370,7 +370,7 @@ static void parse_args(cmd *c) case AT_SWITCH: t = next_token(); if (t != TOK_NUMBER || !token_is_int() || ((int) token_num != 0 && (int) token_num != 1)) - parse_error("Parameter %s must be a switch", adef->name); + parse_error("Argument %s must be a switch", adef->name); val = new arg_int((int) token_num); break; default: @@ -382,7 +382,7 @@ static void parse_args(cmd *c) if (type == AT_SWITCH) val = new arg_int(1); else - parse_error("Parameter %s must have a value", adef->name); + parse_error("Argument %s must have a value", adef->name); } c->args[adef->name] = val; @@ -391,12 +391,12 @@ static void parse_args(cmd *c) if (t == TOK_CLOSE_PAREN) break; if (t != TOK_COMMA) - parse_error("Comma expected after parameter %s", adef->name); + parse_error("Comma expected after argument %s", adef->name); } for (uint i=0; iargs.count(adefs[i].name)) - parse_error("Command %s is missing a parameter %s", cdef->name, adefs[i].name); + parse_error("Command %s is missing an argument %s", cdef->name, adefs[i].name); } static void debug_cmd(cmd *c, uint indent=0)