Re: Resend: Re-implement MSVCRT *printf functions

2004-11-28 Thread Aneurin Price
Mike Hearn wrote:
On Sat, 27 Nov 2004 20:37:21 +, Aneurin Price wrote:
big snip
Thanks for that; it's just the kind of comment I was looking for.
It wasn't a full patch as I wasn't planning to get it applied, and a 
number of points were where I copied code from what was there already 
:), but you even caught a couple of places where I said to myself things 
like I'll remeber to remove that commented block. I'll get to work on 
this today with any luck.



Re: Resend: Re-implement MSVCRT *printf functions

2004-11-27 Thread Aneurin Price
Well I recently got re-motivated, by forgetting I was using an unpatched 
version of Wine, and getting my WC3 campaign file nuked :(.

So, I've had a go over this all, and here is a new version. Is it a step 
in the right direction? I still don't really know what I should be doing 
to improve this.
Aneurin Price
Index: dlls/msvcrt/Makefile.in
===
RCS file: /home/wine/wine/dlls/msvcrt/Makefile.in,v
retrieving revision 1.17
diff -u -u -r1.17 Makefile.in
--- dlls/msvcrt/Makefile.in 8 Nov 2004 22:10:43 -   1.17
+++ dlls/msvcrt/Makefile.in 27 Nov 2004 21:27:58 -
@@ -27,6 +27,7 @@
math.c \
mbcs.c \
misc.c \
+   printf.c \
process.c \
scanf.c \
string.c \
Index: dlls/msvcrt/file.c
===
RCS file: /home/wine/wine/dlls/msvcrt/file.c,v
retrieving revision 1.73
diff -u -u -r1.73 file.c
--- dlls/msvcrt/file.c  3 Nov 2004 22:17:05 -   1.73
+++ dlls/msvcrt/file.c  27 Nov 2004 21:28:00 -
@@ -2614,113 +2614,6 @@
   return file;
 }
 
-/*
- * vfprintf (MSVCRT.@)
- */
-int MSVCRT_vfprintf(MSVCRT_FILE* file, const char *format, va_list valist)
-{
-  char buf[2048], *mem = buf;
-  int written, resize = sizeof(buf), retval;
-  /* There are two conventions for vsnprintf failing:
-   * Return -1 if we truncated, or
-   * Return the number of bytes that would have been written
-   * The code below handles both cases
-   */
-  while ((written = vsnprintf(mem, resize, format, valist)) == -1 ||
-  written  resize)
-  {
-resize = (written == -1 ? resize * 2 : written + 1);
-if (mem != buf)
-  MSVCRT_free (mem);
-if (!(mem = (char *)MSVCRT_malloc(resize)))
-  return MSVCRT_EOF;
-  }
-  retval = MSVCRT_fwrite(mem, sizeof(*mem), written, file);
-  if (mem != buf)
-MSVCRT_free (mem);
-  return retval;
-}
-
-/*
- * vfwprintf (MSVCRT.@)
- * FIXME:
- * Is final char included in written (then resize is too big) or not
- * (then we must test for equality too)?
- */
-int MSVCRT_vfwprintf(MSVCRT_FILE* file, const MSVCRT_wchar_t *format, va_list 
valist)
-{
-  MSVCRT_wchar_t buf[2048], *mem = buf;
-  int written, resize = sizeof(buf) / sizeof(MSVCRT_wchar_t), retval;
-  /* See vfprintf comments */
-  while ((written = _vsnwprintf(mem, resize, format, valist)) == -1 ||
-  written  resize)
-  {
-resize = (written == -1 ? resize * 2 : written + sizeof(MSVCRT_wchar_t));
-if (mem != buf)
-  MSVCRT_free (mem);
-if (!(mem = (MSVCRT_wchar_t *)MSVCRT_malloc(resize*sizeof(*mem
-  return MSVCRT_EOF;
-  }
-  retval = MSVCRT_fwrite(mem, sizeof(*mem), written, file);
-  if (mem != buf)
-MSVCRT_free (mem);
-  return retval;
-}
-
-/*
- * vprintf (MSVCRT.@)
- */
-int MSVCRT_vprintf(const char *format, va_list valist)
-{
-  return MSVCRT_vfprintf(MSVCRT_stdout,format,valist);
-}
-
-/*
- * vwprintf (MSVCRT.@)
- */
-int MSVCRT_vwprintf(const MSVCRT_wchar_t *format, va_list valist)
-{
-  return MSVCRT_vfwprintf(MSVCRT_stdout,format,valist);
-}
-
-/*
- * fprintf (MSVCRT.@)
- */
-int MSVCRT_fprintf(MSVCRT_FILE* file, const char *format, ...)
-{
-va_list valist;
-int res;
-va_start(valist, format);
-res = MSVCRT_vfprintf(file, format, valist);
-va_end(valist);
-return res;
-}
-
-/*
- * fwprintf (MSVCRT.@)
- */
-int MSVCRT_fwprintf(MSVCRT_FILE* file, const MSVCRT_wchar_t *format, ...)
-{
-va_list valist;
-int res;
-va_start(valist, format);
-res = MSVCRT_vfwprintf(file, format, valist);
-va_end(valist);
-return res;
-}
-
-/*
- * printf (MSVCRT.@)
- */
-int MSVCRT_printf(const char *format, ...)
-{
-va_list valist;
-int res;
-va_start(valist, format);
-res = MSVCRT_vfprintf(MSVCRT_stdout, format, valist);
-va_end(valist);
-return res;
-}
 
 /*
  * ungetc (MSVCRT.@)
@@ -2753,17 +2646,4 @@
return MSVCRT_WEOF;
}
return mwc;
-}
-
-/*
- * wprintf (MSVCRT.@)
- */
-int MSVCRT_wprintf(const MSVCRT_wchar_t *format, ...)
-{
-va_list valist;
-int res;
-va_start(valist, format);
-res = MSVCRT_vwprintf(format, valist);
-va_end(valist);
-return res;
 }
Index: 

Re: Resend: Re-implement MSVCRT *printf functions

2004-11-18 Thread Aneurin Price
Alexandre Julliard wrote:
Aneurin Price [EMAIL PROTECTED] writes:

Any further comments on this?

Hard to say, that code is really painful to read. Please try to better
follow the coding conventions used in the rest of the code.
Apologies for long delay; I've been playing World of Warcraft for the 
duration of the open beta :-).
I don't really understand what it is you want, but I think I'm going to 
have to give up on this for the moment, until I get enough time to get 
more coding practice.
Aneurin Price



Re: Resend: Re-implement MSVCRT *printf functions

2004-11-18 Thread Jesse Allen
On Thu, Nov 18, 2004 at 04:16:02PM +, Aneurin Price wrote:
 I don't really understand what it is you want, but I think I'm going to 
 have to give up on this for the moment, until I get enough time to get 
 more coding practice.
 Aneurin Price

If you don't mind, I will take up hacking it.  Like I said, I started my own
printf a while back.  I'm not sure what path I would take with your code.  I'll
have to study it thoroughly.  I may just improve on it, or I may use ideas from
it to make mine functional.  My last version may be worth reviving, because
it tried to mimick wine style coding as much as it could.  If I were to use 
your code, I have some reproducible issues that need to be solved to start.
But I need to see how well I can understand your code.  So lets see what 
happens this next week.

Jesse




Re: Resend: Re-implement MSVCRT *printf functions

2004-11-08 Thread Aneurin Price
Any further comments on this?


Re: Resend: Re-implement MSVCRT *printf functions

2004-11-08 Thread Alexandre Julliard
Aneurin Price [EMAIL PROTECTED] writes:

 Any further comments on this?

Hard to say, that code is really painful to read. Please try to better
follow the coding conventions used in the rest of the code.

-- 
Alexandre Julliard
[EMAIL PROTECTED]