Also, consistently use 'ch' for channel variables. This matches how we
consistently use sdi, devc, and so on all over the code-base.
This fixes parts of bug #259.
Most of the supported gear uses the ANSI C locale for communication, and if the
client sets up an incompatible locale parsing would fail.
This function ignores the client's locale and parses floating point numbers
using the ANSI C locale. This function should be always used when parsing
floating point numbers coming from the instrument.
parse_size_string() incorrectly parses a real number, e.g. 1.5 kHz ends up
being 1Hz.
This patch fixes parse_size_string() to take the fractional part as well into
account. The fractional part is parsed as an double precision floating point
number while ignoring the locale.
This patch adds helper functions for converting a string to different number
formats (double, long, float, int).
These functions are exposed in the public API.
The function previously formatted 1004 as 1.4 k and 1004000 as 1.4 M.
The function now formats 1004 as 1.004 k, 1004000 as 1.004 M and
1004000000 as 1.004 G.
Fixes#73.
Turn TODOs which should be user-visible into @todo so that Doxygen
shows them in the function docs, and also on the special "Todo List" page.
Those TODOs that should not be in the Doxygen docs are moved out of the
/** */ comment blocks.
Also fix some comments/items, and remove some obsolete ones.
All frontends will have to include <libsigrok/libsigrok.h> from now on.
This header includes proto.h and version.h, both installed from the
distribution into $INCLUDE/libsigrok/ as well.
The only dynamically changed header is now version.h, which has both
libsigrok and libtool compile-time versions in it.
This is required for some hardware, e.g. ChronoVu LA8, where
33.333333 MHz or 2.439024 MHz are valid samplerates. This is because the
hardware takes a sampleperiod (in nanoseconds) as input, not a
samplerate (in Hz).
Avoid plain malloc()/free() in sr/srd, especially in the API calls.
Also avoid g_malloc*() in favor of g_try_malloc*().
Use g_strdup() instead of strdup() so that we can use g_free()
consistently everywhere.
Exceptions: Stuff that is allocated via other libs (not using glib),
should also be properly free'd using the respective free-ing function
(instead of g_free()). Examples: Stuff allocated by libusb, libftdi, etc.
Also, use sr_err() instead of sr_warn() for actual errors. sr_warn() is
meant for non-fatal/uncritical warnings.
Use SR_API to mark public API symbols, and SR_PRIV for private symbols.
Variables and functions marked 'static' are private already and don't
need SR_PRIV. However, functions which are not static (because they need
to be used in other libsigrok-internal files) but are also not meant to
be part of the public libsigrok API, must use SR_PRIV.
This uses the 'visibility' feature of gcc (requires gcc >= 4.0).
Details: http://gcc.gnu.org/wiki/Visibility
In the lib, we should only #include "sigrok.h" or "sigrok-internal.h",
but not the (possibly installed and thus different/older versions) via
<sigrok.h> or <sigrok-internal.h>.
Frontends should of course use <sigrok.h> and <sigrok-internal.h>.