Re: [AD] another bug

[ Thread Index | Date Index | More lists.liballeg.org/allegro-developers Archives ]


On Mon, May 01, 2000 at 09:11:07PM +0100, Chris Jones wrote:
> >   but here stops for the key and doesn't print the last
> > message! it prints it later!
> 
> This is to do with DJGPP's buffered I/O - it won't flush the output until it
> receives a '\n' character. If you put an
> fflush(stdout);
> line in before the readkey(), it should work fine.

I think it's still a bug, because Shawn wouldn't like you
calling "fflush(stdout);" in connection with `allegro_message'.
If using `allegro_message' to issue prompts is allowed,
I think `allegro_message' should do the flushing itself -- it's not a
performance-critical function.

But I don't think prompts are really in the spirit of
`allegro_message'.  In Windows it displays a MessageBox, AFAIK,
which is a lousy prompt, and in any case I don't think things
like `readkey' are guarranteed to work outside graphics modes.

Patch attached, anyway.  I only bothered fixing the default
case for now, since I personally am not too keen on this fix.

George

-- 
Random project update:
19/03/2000: Libnet 0.10.6 uploaded -- bugfixes and new features, of course!
        http://www.canvaslink.com/libnet/  (try changes-0.10.6.txt)

--- src/allegro.c.0	Mon May  1 22:08:40 2000
+++ src/allegro.c	Mon May  1 22:08:48 2000
@@ -396,8 +396,10 @@
 
    if ((system_driver) && (system_driver->message))
       system_driver->message(buf);
-   else
+   else {
       fputs(uconvert(buf, U_CURRENT, tmp, U_ASCII_CP, 4096), stdout);
+      fflush(stdout);
+   }
 
    free(buf);
    free(tmp);


Mail converted by MHonArc 2.6.19+ http://listengine.tuxfamily.org/