RE: [AD] Allegro 5 new config routines, alpha 2

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


Title: RE: [AD] Allegro 5 new config routines, alpha 2

> >  int al_is_set(const char *name) ?
>
> There's already al_get_type(char *key) which returns the type of
> specified variable.

Oh, sorry, missed it.

> > How about adding (I know, I add plenty of stuff... :)):
> > void al_cd(const char*);
>
> This is nice! It would remove the need of much typing making lazy
> programmers happy :)

And allow nifty tricks like defining a coherent tree for several
similar modules, and have each one use the same config code.

> > How about using Lua ?
>
> I'd not go for this. It would make Allegro to depend on Lua, and we
> don't need more dependencies IMHO... Remember one of the goals of
> Allegro 5 is to reduce the bloatiness, and for me depending
> on Lua would
> just increase it.

Yes, I know. I was only half serious. But still half serious
depending on the way you look at it :)


And now for yet another suggestion:
How about making the config system an object with a vtable ?
Then add the following:

CONFIG *create_config(const char *filename);
void destroy_config(CONFIG*);

and to preserve more or less compatibility with previous code:

set_default_config(CONFIG*);
CONIFG *get_default_config();

Then pass the CONFIG object (possibly NULL, in which case the code
would use the default config set via set_default_config (which could
be, if NULL, create a CONFIG the current way, from allegro.cfg,
which would maintain total code compatibility)) to all config API
routines (al_get_int et al).
The vtable bit would allow having different ways to create/read/
access/fiddle with configs, or load two configs at a time and
still be able to see what is overriden, etc).

--
Vincent Penquerc'h



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