Re: [msvcrt] Implement %I types for printf
Jesse Allen <the3dfxdude(a)gmail.com> writes:
@@ -191,11 +191,14 @@ } buf; } pf_output;
+#define INTEGERSIZE_LONG 1 +#define INTEGERSIZE_LONGLONG 2 + typedef struct pf_flags_t { char Sign, LeftAlign, Alternate, PadZero; char FieldLength, Precision; - char IntegerLength, IntegerDouble; + char IntegerLength, IntegerDouble, IntegerSize;
The IntegerDouble field was supposed to be used for that already, no need to add another one.
@@ -384,6 +387,16 @@ sprintf(p, ".%d", flags->Precision); p += strlen(p); } + if( flags->IntegerLength == 'I' ) + { + sprintf(p, "l"); + p++; + } + if( flags->IntegerSize == INTEGERSIZE_LONGLONG ) + { + sprintf(p, "l"); + p++; + }
This assumes that the system printf supports %ll formats, that's not portable. -- Alexandre Julliard julliard(a)winehq.org
On 06 Jun 2005 10:44:22 +0200, Alexandre Julliard <julliard(a)winehq.org> wrote:
Jesse Allen <the3dfxdude(a)gmail.com> writes:
@@ -191,11 +191,14 @@ } buf; } pf_output;
+#define INTEGERSIZE_LONG 1 +#define INTEGERSIZE_LONGLONG 2 + typedef struct pf_flags_t { char Sign, LeftAlign, Alternate, PadZero; char FieldLength, Precision; - char IntegerLength, IntegerDouble; + char IntegerLength, IntegerDouble, IntegerSize;
The IntegerDouble field was supposed to be used for that already, no need to add another one.
OK I changed it back to that.
@@ -384,6 +387,16 @@ sprintf(p, ".%d", flags->Precision); p += strlen(p); } + if( flags->IntegerLength == 'I' ) + { + sprintf(p, "l"); + p++; + } + if( flags->IntegerSize == INTEGERSIZE_LONGLONG ) + { + sprintf(p, "l"); + p++; + }
This assumes that the system printf supports %ll formats, that's not portable.
Well it's rebuilding the format string, I thought for libc. Is there another %ll-like specifier? %I64 certainly is not. =) Jesse
Jesse Allen <the3dfxdude(a)gmail.com> writes:
Well it's rebuilding the format string, I thought for libc. Is there another %ll-like specifier? %I64 certainly is not. =)
No, I'm afraid there is no standard way of doing that. You won't be able to simply forward this one to libc, you'll need to do at least part of the formatting by hand. -- Alexandre Julliard julliard(a)winehq.org
On Mon, Jun 06, 2005 at 05:32:52PM +0200, Alexandre Julliard wrote:
Jesse Allen <the3dfxdude(a)gmail.com> writes:
Well it's rebuilding the format string, I thought for libc. Is there another %ll-like specifier? %I64 certainly is not. =)
No, I'm afraid there is no standard way of doing that. You won't be able to simply forward this one to libc, you'll need to do at least part of the formatting by hand.
The ll flag is specified by POSIX (2001, "System Interfaces", p. 404) and is described by the Linux (dated 2000-10-16) and Solaris (SunOS 5.9) manpages. I'd certainly call that a "standard way", even if it's not supported everywhere. Apparently 4.4 BSD and older versions of Linux libc used a "%q" flag for the same thing. Would it be OK for Jesse to use a "configure" check to see which is supported, at compile-time? -- David Lee Lambert (also as4109(a)wayne.edu) cell ph# 586-873-8813 PGP key at http://www.cse.msu.edu/~lamber45/newmail.htm#GPGKey resume at http://www.cse.msu.edu/~lamber45/resume.htm
On 6/7/05, David Lee Lambert <lamber45(a)cse.msu.edu> wrote:
On Mon, Jun 06, 2005 at 05:32:52PM +0200, Alexandre Julliard wrote:
No, I'm afraid there is no standard way of doing that. You won't be able to simply forward this one to libc, you'll need to do at least part of the formatting by hand.
The ll flag is specified by POSIX (2001, "System Interfaces", p. 404) and is described by the Linux (dated 2000-10-16) and Solaris (SunOS 5.9) manpages. I'd certainly call that a "standard way", even if it's not supported everywhere.
Apparently 4.4 BSD and older versions of Linux libc used a "%q" flag for the same thing. Would it be OK for Jesse to use a "configure" check to see which is supported, at compile-time?
Doing a configure check will help as a temporary option as there is no support for %I64 as there is. If %ll or %q are not supported, then it can be disabled and it will work the same as it is now.
On 06 Jun 2005 10:44:22 +0200, Alexandre Julliard <julliard(a)winehq.org> wrote:
+ char IntegerLength, IntegerDouble, IntegerSize;
The IntegerDouble field was supposed to be used for that already, no need to add another one.
The reason why I added IntegerSize is some how we need to remember if we have been requested I32, because if we don't, then it won't work right on 64-bit systems? Therefore, instead of IntegerDouble, IntegerSize. It was untested anyway so I changed it back.
participants (3)
-
Alexandre Julliard -
David Lee Lambert -
Jesse Allen