Add initial support for 'F', 'a', and 'A' conversion specifiers for printf (C99).

'F' is currently treated identically to 'f'. This should be a correct implementation for 'F' under C99. (It's not quite correct for 'f', which should print "inf" or "nan" in lower case according to C99.)

'A' and 'a' are not correctly formatted (they are currently treated identically to 'E' and 'e', rather than using the hexadecimal floating-point representation specified by C99), but at least they print the number in some form and consume the correct number of bytes so that the stack isn't corrupted and subsequent conversion specifications print the right values.

The floating-point formats are also moved to the top of the list of conversion specifiers to check, which means they are checked last. This should marginally speed up the integer cases.
This commit is contained in:
Stephen Heumann 2018-02-27 21:29:22 -06:00
parent f58ef8aea3
commit a6d7d91f37
1 changed files with 8 additions and 5 deletions

View File

@ -4162,6 +4162,14 @@ val ds 2 value
; List of format specifiers and the equivalent subroutines
;
fList dc c'%',i1'0',a'~Format_Percent' %
dc c'a',i1'0',a'~Format_e' a (not formatted correctly)
dc c'A',i1'0',a'~Format_E' A (not formatted correctly)
dc c'f',i1'0',a'~Format_f' f
dc c'F',i1'0',a'~Format_f' F
dc c'e',i1'0',a'~Format_e' e
dc c'E',i1'0',a'~Format_E' E
dc c'g',i1'0',a'~Format_g' g
dc c'G',i1'0',a'~Format_G' G
dc c'n',i1'0',a'~Format_n' n
dc c's',i1'0',a'~Format_s' s
dc c'b',i1'0',a'~Format_b' b
@ -4173,11 +4181,6 @@ fList dc c'%',i1'0',a'~Format_Percent' %
dc c'u',i1'0',a'~Format_u' u
dc c'd',i1'0',a'~Format_d' d
dc c'i',i1'0',a'~Format_d' i
dc c'f',i1'0',a'~Format_f' f
dc c'e',i1'0',a'~Format_e' e
dc c'E',i1'0',a'~Format_E' E
dc c'g',i1'0',a'~Format_g' g
dc c'G',i1'0',a'~Format_G' G
fListEnd anop
end