Re: [AD] allegro_message

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


Chris La Mantia <chrislm@xxxxxxxxxx> writes:
> > except that then we'd have a core part of the system driver (the 
> > allegro_message() implementation) calling graphics and GUI functions, 
> > which would result in all that code being linked into every executable
> 
> There *has* to be a way around this!  Now, I know little of function
> pointers, so this could be way off base, but could there be a global
> alert_function variable that could be initialized as NULL originally and 
> set as a pointer to the alert() function after a graphics mode gets set?

Yes, that sort of thing works, and is how SET isolated the datafile and 
sound systems from being directly linked with the core lib and graphics 
code. But these tricks make it much harder to follow the thread of 
execution, so I think should only be used if there is a strong need for 
them.

In this case, I just don't see the value of having allegro_message() work 
in graphics modes: if that would just be implemented by calling alert(), 
why shouldn't people call alert() directly themselves? The only reason for 
doing this is to be more forgiving of programmer errors, but if that 
results in any extra library complexity, IMHO it's better that people 
should just be required not to make those errors in the first place :-)

In the case of allegro_message(), it is intended as a portable replacement 
for printf(), because Windows doesn't have anywhere to printf() to. Since 
you obviously wouldn't call printf() while in a graphics mode, I think it 
is reasonable not to be able to use allegro_message() there either. Also, 
an alert() isn't the same functionality as allegro_message(), because it 
doesn't handle more than three lines of text, carriage returns, or tabs, 
and will get stuck if you call it without having the mouse or keyboard 
installed first, wheras allegro_message() works even if none of the rest 
of Allegro is alive. The two routines just don't behave the same, so it 
could be confusing to implement one of them by calling the other...


--
Shawn Hargreaves - shawn@xxxxxxxxxx - http://www.talula.demon.co.uk/
"A binary is barely software: it's more like hardware on a floppy disk."



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