diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2012-05-02 09:36:55 -0700 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2012-05-02 09:36:55 -0700 |
commit | 2d1a316d848441a7d1137cb51b1ee0b8222aaa74 (patch) | |
tree | 1eec770ddb707306d916523fecf95e1814899242 /xslt | |
parent | 99708bb40e2d0f0e1ddfa6ec56a192e3878d511b (diff) | |
download | subsurface-2d1a316d848441a7d1137cb51b1ee0b8222aaa74.tar.gz |
Make subsurface compile with current libdivecomputer git tree
libdivecomputer has the absolute worst interfaces to any library *ever*,
and randomly changes those crappy interfaces when it adds support for
new dive computers.
It would have been much better if the interface was just a "open this
device" with a device descriptor structure pointer, so that when Jef
adds support for new devices, the old descriptors still stay around and
work the same way - there's just a new descriptor structure that you
*can* use if you want. Along with a data structure to name the devices
and their descriptors, this would actually mean that users could just
support pretty much any random device that LD supports.
But no, that's not how libdivecomputer works. It has random enums and
crazy different ad-hoc interfaces for different dive computers. Or,
like in this case, crazy different ad-hoc interfaces for the *same*old*
dive computer.
Right now, for example, the support for the new Heinrichs Weikamp "Frog"
computer added a flag to the interface for the old OSTC_2 support.
Breaking any libdivecomputer users even if you didn't need Frog support.
And is there a version number in the header files to check for? Yes,
there's a version number. But no, it's not useful, since it doesn't
actually change with the interface changes. This time, Jef actually did
change the version number (from 0.1.0 to 0.2.0) as part of new
development version, but there's no reason to believe that it will
change in the future as the interfaces change - it never has before.
So it's actually safer - and easier to understand - to check for the
existence of the new header file inclusion mechanism. A new version of
libdivecomputer that supports the HW Frog computer will include the
"ostc_frog.h" header file when you include the libdivecomputer device.h
file, and that will result in HW_FROG_H being defined.
So we can check whether libdivecomputer has the new interface and
supports the Frog by doing an "#ifdef HW_FROG_H" hack. Ugh.
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'xslt')
0 files changed, 0 insertions, 0 deletions