[ECOS] serial_devio renamaed to cyg_serial_devio
Bart Veer
bartv@redhat.com
Wed Jun 14 04:58:00 GMT 2000
>>>>> "Andrew" == Andrew Lunn <andrew.lunn@ascom.ch> writes:
Andrew> Unfortunally this only works for 1.3.x. 1.2.x does not have the
Andrew> version info, just a #define if the package is included.
Andrew> My problem is 1.2.x defines
Andrew> #define CYGPKG_IO_SERIAL
Andrew> and 1.3.x defines
Andrew> #define CYGPKG_IO_SERIAL v1_3_5
Andrew> #define CYGPKG_IO_SERIAL_v1_3_5
Andrew> and i want something which says
Andrew> #if CYGPKG_IO_SERIAL > v1.2
Andrew> new serial code fragment
Andrew> #else
Andrew> old serial code fragment
Andrew> #endif
Andrew> Any ideas anyone?
I do not think there is any easy way of achieving this at present. The
C preprocessor can only do numerical comparisons. Version numbers can
be much more complicated than just a simple number, so trying to use
the > or < operators is not going to work.
What might be possible is for the configuration tools to generate
additional #define's along the lines of:
#define CYGPKG_IO_SERIAL v1_3_5
#define CYGPKG_IO_SERIAL_VERSION_MAJOR 1
#define CYGPKG_IO_SERIAL_VERSION_MINOR 3
...
Some other systems like Tcl already do this, updating the exported
header file by hand for every release and every snapshot. In the CDL
world this could be automated.
I am not quite sure what to call the versioning levels after major or
minor, there could be any number of these. Also versions may include
letters or text, e.g. 1.3.5beta, and attempting to use C preprocessor
operators on 5beta will probably give a strange compiler error
message. There could also be problems if packages try to define
options with those names.
Arguably the correct solution is a more powerful C preprocessor, but
that is not likely to happen any time soon.
Bart
More information about the Ecos-discuss
mailing list