Re: [AD] version check in allegro_init

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


Julien Cugnière wrote:

Another possible solution that doesn't change the API would be to encode the
version numbers into the system IDs. So, instead of:

   #define SYSTEM_AUTODETECT  0
   #define SYSTEM_NONE        AL_ID('N','O','N','E')
   #define SYSTEM_BEOS        AL_ID('B','S','Y','S')
   ...

We could have something like that:

   #define AL_SYSTEM_ID(x) \
       (((x)<<24) | (ALLEGRO_VERSION<<16) | \
       (ALLEGRO_SUB_VERSION<<8) | (ALLEGRO_WIP_VERSION))

   #define SYSTEM_AUTODETECT  AL_SYSTEM_ID(0)
   #define SYSTEM_NONE        AL_SYSTEM_ID(1)
   #define SYSTEM_BEOS        AL_SYSTEM_ID(2)
   ...

Then install_allegro can extract the version numbers from the system ID, and
do the check. We get full compatibility, and the check is always done. This
is a bit hackish, but IMHO no more than turning install_allegro into a macro.

It's a decent idea, but note that the system driver ID can be used in the config file. There's only one case where it's useful: to choose the linux console system driver when launching a program from X.

Peter




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