mirror of
https://github.com/gbdev/rgbds.git
synced 2025-11-20 10:12:06 +00:00
Fix q format spec (#1811)
This commit is contained in:
@@ -196,12 +196,19 @@ If specified, pads right-aligned numbers with zeros instead of spaces.
|
|||||||
If specified, pads the value to this width, right-aligned with spaces by default.
|
If specified, pads the value to this width, right-aligned with spaces by default.
|
||||||
.It Ql <frac> Ta May be
|
.It Ql <frac> Ta May be
|
||||||
.Ql \&.
|
.Ql \&.
|
||||||
followed by one or more
|
followed by zero or more
|
||||||
.Ql 0
|
.Ql 0
|
||||||
\[en]
|
\[en]
|
||||||
.Ql 9 .
|
.Ql 9 .
|
||||||
If specified, prints this many fractional digits of a fixed-point number.
|
If specified, prints this many fractional digits of a fixed-point number.
|
||||||
Defaults to 5 digits, maximum 255 digits.
|
Defaults to 5 digits, maximum 255 digits.
|
||||||
|
(A
|
||||||
|
.Ql \&.
|
||||||
|
followed by zero
|
||||||
|
.Ql 0
|
||||||
|
\[en]
|
||||||
|
.Ql 9
|
||||||
|
prints zero fractional digits.)
|
||||||
.It Ql <prec> Ta May be
|
.It Ql <prec> Ta May be
|
||||||
.Ql q
|
.Ql q
|
||||||
followed by one or more
|
followed by one or more
|
||||||
|
|||||||
@@ -77,9 +77,9 @@ void FormatSpec::useCharacter(int c) {
|
|||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
|
|
||||||
// width
|
// frac
|
||||||
case '.':
|
case '.':
|
||||||
if (state > FORMAT_WIDTH) {
|
if (state >= FORMAT_FRAC) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
state = FORMAT_FRAC;
|
state = FORMAT_FRAC;
|
||||||
@@ -88,7 +88,7 @@ void FormatSpec::useCharacter(int c) {
|
|||||||
|
|
||||||
// prec
|
// prec
|
||||||
case 'q':
|
case 'q':
|
||||||
if (state > FORMAT_PREC) {
|
if (state >= FORMAT_PREC) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
state = FORMAT_PREC;
|
state = FORMAT_PREC;
|
||||||
|
|||||||
@@ -2,7 +2,7 @@ println STRFMT("%+d %++d", 42, 42)
|
|||||||
println STRFMT("%#x %##x", 42, 42)
|
println STRFMT("%#x %##x", 42, 42)
|
||||||
println STRFMT("%-4d %--4d", 42, 42)
|
println STRFMT("%-4d %--4d", 42, 42)
|
||||||
println STRFMT("%.f %..f", 42.0, 42.0)
|
println STRFMT("%.f %..f", 42.0, 42.0)
|
||||||
println STRFMT("%qf %q.16f", 42.0, 42.0)
|
println STRFMT("%qf %q.16f %qq16f", 42.0, 42.0, 42.0)
|
||||||
|
|
||||||
DEF N = 42
|
DEF N = 42
|
||||||
println "{5d:N} {5d5:N}"
|
println "{5d:N} {5d5:N}"
|
||||||
|
|||||||
@@ -10,6 +10,8 @@ error: Fixed-point constant precision 0 invalid, defaulting to 16
|
|||||||
at invalid-format.asm(5)
|
at invalid-format.asm(5)
|
||||||
error: STRFMT: Invalid format spec for argument 2
|
error: STRFMT: Invalid format spec for argument 2
|
||||||
at invalid-format.asm(5)
|
at invalid-format.asm(5)
|
||||||
|
error: STRFMT: Invalid format spec for argument 3
|
||||||
|
at invalid-format.asm(5)
|
||||||
error: Invalid format spec "5d5"
|
error: Invalid format spec "5d5"
|
||||||
at invalid-format.asm(8)
|
at invalid-format.asm(8)
|
||||||
error: Invalid format spec "xx"
|
error: Invalid format spec "xx"
|
||||||
@@ -28,4 +30,4 @@ error: Formatting type 'd' with fractional width
|
|||||||
at invalid-format.asm(17)
|
at invalid-format.asm(17)
|
||||||
error: Formatting type 'd' with fractional precision
|
error: Formatting type 'd' with fractional precision
|
||||||
at invalid-format.asm(18)
|
at invalid-format.asm(18)
|
||||||
Assembly aborted with 15 errors!
|
Assembly aborted with 16 errors!
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
$2a %x
|
$2a %x
|
||||||
42 %4d
|
42 %4d
|
||||||
42 %f
|
42 %f
|
||||||
42.00000 %16f
|
42.00000 %16f %16f
|
||||||
42 42
|
42 42
|
||||||
2a 2a
|
2a 2a
|
||||||
hello
|
hello
|
||||||
|
|||||||
Reference in New Issue
Block a user