Re: [AD] Custom packfiles |
[ Thread Index |
Date Index
| More lists.liballeg.org/allegro-developers Archives
]
- To: alleg-developers@xxxxxxxxxx
- Subject: Re: [AD] Custom packfiles
- From: Chris <chris.kcat@xxxxxxxxxx>
- Date: Sat, 01 Jan 2005 22:41:08 -0800
- Domainkey-signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; h=received:message-id:date:from:user-agent:x-accept-language:mime-version:to:subject:references:in-reply-to:content-type:content-transfer-encoding; b=bgeXTd3mhPXsV1YqUodDS1d13VjQTn7toeFrqK+FaiEWZ1veF8Hjd6AgToOUmEtXckzzLXdMYUNTr5eXO0GkwGJIa/JPFWkEx0E7IlKU9owupHWGL8vmlCzgZHzt4ud12dOCyJr9vRovDvi3039g94BxTQ2L2vdKtZX9cEWMQYY=
Peter Wang wrote:
I don't see how it cuts down on duplicate code. Say you're going to
write a wrapper like:
PACKFILE *load_wad_object(const char *filename, int index);
That is, of course, assuming there is that extra wrapper. There are
times where it'd be better not to throw an extra wrapper around on top
of Allegro, which itself is a wrapper, so the programmer would be
calling pack_fopen_vtable(...) directly.
I personally am not fond of making a wrapper around Allegro routines,
because Allegro routines are, themselves, wrappers. Unless you plan on
supporting more than one method on top of the function in question
(which is not always the best thing to do), there's no reason to
abstract more than Allegro already abstracts.
Besides that, even if the vtable contains fp_fopen and fp_fclose
methods, there's nothing forcing the user to make use of them.. they can
just leave them NULL. However it will leave the option open for those
that want to take advantage of it.
i.e. with my style pack_fopen_vtable() is only called after the rest of
the opening process is complete.
I don't know. I just think if a function is going to open something, it
itself should open it.. not have it "pre-opened".
> You don't have to stuff input
> arguments into a struct just to get it through to pf_fopen.
You wouldn't have to even if pf_open and pf_close existed, either (as I
said, the user doesn't *have* to use it). I just think it's a nice way
to organize things.