RE: [AD] Allegro version helpers

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


Speaking of version helpers, here is a replacement for the definition of
ALLEGRO_VERSION_STR



#define STRINGIFY(x) #x
#define ISWIP

#ifdef ISWIP
#define MAKEALVERSTR(ver, subver, wipver) STRINGIFY(ver.subver.wipver (WIP))
#else
#define MAKEALVERSTR(ver, subver, wipver) STRINGIFY(ver.subver.wipver)
#endif

#define ALLEGRO_VERSION_STR
MAKEALVERSTR(ALLEGRO_VERSION,ALLEGRO_SUB_VERSION,ALLEGRO_WIP_VERSION)



The advantage this has is that when changing the version, you just have to
change the Version number, the Subversion number and the WIP-version number
and if it's not a WIP version, omit the "#define ISWIP" line. You no longer
have to change the string as well as the number. The ISWIP #define (and
possibly STRINGIFY too) could be used elsewhere too.


AE.





-----Original Message-----
From: alleg-developers-admin@xxxxxxxxxx
[mailto:alleg-developers-admin@xxxxxxxxxx Behalf Of Vincent
Penquerc'h
Sent: 23 May 2003 11:15
To: 'alleg-developers@xxxxxxxxxx'
Subject: RE: [AD] Allegro version helpers


> > That's to help people make cpp tests against the Allegro version.
> > Not exceedingly useful since previous versions did not include it,
> > but still you might want to add this.
>
> Could it not be a bit dangerous too? Version parameters are
> meant to be used
> in conjunction with cpp to avoid using unavailable stuff, so
> would it not be
> a mess if the version parameters are unavailable themselves in older
> versions?
Yes, that's just what I said above.
However, you can transform:
#if
ALLEGRO_VERSION*0x10000+ALLEGRO_SUB_VERSION*0x100+ALLEGRO_WIP_VERSION>=0x040
104
with
#if defined ALLEGRO_MAKE_VERSION &&
ALLEGRO_FULL_VERSION<ALLEGRO_MAKE_VERSION(4,1,4)
which is more readable, though I grant you the program could define
ALLEGRO_MAKE_VERSION itself. I just posted this to see if people saw
it as useful, even with its shortcomings.
BTW, ALLEGRO_WIP_VERSION is kinda ill named now that we have something
like 4.0.3 lying around, though this is hardly changeable.
--
Vincent Penquerc'h





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