Re: [AD] update/properties

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


> Unfortunately, it increase code too much for what I'd like, and
> some one liner grab routines in plugins become twelve or so liners.

Yes, I think we can factor out the code.

> So I thought I'd show it and ask whether you like it that way or
> not. The other way to do it is to let the caller create a DATAFILE
> and pass it to the grab routine, which can then use it without
> having to create it itself, but I'm not sure I like this either,
> though it's starting to look like a better solution now, due to
> the code size increase.

I think this is the way to go. The grab method of plugins could look like

   int (*grab)(DATAFILE *dat, AL_CONST char *filename, int update, int 
depth);

where 'update' is TRUE when 'dat' is already a valid datafile. The return 
value indicates whether the grab operation was succesful (0) or not (-1).

[Btw, can't we get rid of 'depth' too?]

To minimize the changes, plugins are only required to fill dat->dat and 
dat->size if meaningful. The generic code adds the missing bits, but only if 
they are not already present.

-- 
Eric Botcazou




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