API redesign progress

Jef Driesen jefdriesen at telenet.be
Mon Aug 27 14:18:37 PDT 2012


On 22-06-12 13:51, Jef Driesen wrote:
> I have committed some several backwards incompatible changes to the
> libdivecomputer api. To keep the inconvenience to a minimum, a stable
> "release-0.1" branch has been created, which will only receive pure
> bugfixes. Applications are recommended to stick to this stable branch
> for now. Especially because these changes are only the first in a
> series, and backwards compatibility will be broken again in the master
> branch.

I have committed another change to the master branch. There is now a new 
dc_context_t object that is intended to initialize and shutdown the library. All 
public interfaces have been changed to include a context pointer as one of their 
arguments. If you are using the dc_device_open() and dc_parser_new() functions, 
you'll only have to update the dc_device_open() call, because the context 
pointer is automatically inherited.

At the moment, the main benefit is the improved logging, which can be 
enabled/disabled at both compile time (--enable-logging configure option) or 
runtime (dc_context_set_loglevel). By default, all logging goes to stderr as 
before, but an application can register a custom logging function 
(dc_context_set_logfunc). This will make it easier to display the log messages 
in your user interface.

As usual, feedback is always welcome!

Jef


More information about the subsurface mailing list