[AD] ungetc

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


Does it really make sense for every file interface to define their own
ungetc routine? Couldn't Allegro just handle a single universal one?
Basically:

ungetc => appends to a buffer up to hard coded limit
ftell => returns driver reported value - buffer length
fwrite => clears buffer, writes to actual location
fread => reads from ungetc buffer first, and alters call to driver's
fread as necessary
fseek => if seek_cur, then it alters the offset by - buffer length.
then clears buffer
feof => returns false if ungetc buffer exists, else returns driver
reported value

Or alternatively, only if the ungetc hook is left null, is the above
default implementation is used. Otherwise, drivers could fill it in
and do something non-standard.

It just seems cumbersome to implement essentially the same thing over
and over again for every interface.

--
Matthew Leverton




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