[gamecode] Support variable field width and precision

This commit is contained in:
Bill Currie 2020-04-01 19:45:33 +09:00
parent 7f4d2215e2
commit a36f72f7b4
1 changed files with 5 additions and 2 deletions

View File

@ -887,7 +887,8 @@ fmt_state_flags (fmt_state_t *state)
static void
fmt_state_var_field_width (fmt_state_t *state)
{
// XXX record width
(*state->fi)->minFieldWidth = P_INT (pr, state->fmt_count);
state->fmt_count++;
if (*++state->c == '.') {
state->state = fmt_state_precision;
} else {
@ -926,7 +927,9 @@ fmt_state_precision (fmt_state_t *state)
static void
fmt_state_var_precision (fmt_state_t *state)
{
// XXX record precision
state->c++; // skip over *
(*state->fi)->precision = P_INT (pr, state->fmt_count);
state->fmt_count++;
state->state = fmt_state_modifiers;
}