]> sigrok.org Git - libsigrokdecode.git/log
libsigrokdecode.git
13 years agoConsistently use _exit prefix for functions.
Uwe Hermann [Sun, 30 Jan 2011 18:22:13 +0000 (19:22 +0100)]
Consistently use _exit prefix for functions.

13 years agoChange SIGROKDECODE_ prefix to SRD_.
Uwe Hermann [Sat, 29 Jan 2011 14:41:39 +0000 (15:41 +0100)]
Change SIGROKDECODE_ prefix to SRD_.

Do the same for sigrokdecode_ -> srd_ in struct names and function names.

13 years agoProperly free all memory upon sigrokdecode_shutdown().
Uwe Hermann [Thu, 27 Jan 2011 23:56:46 +0000 (00:56 +0100)]
Properly free all memory upon sigrokdecode_shutdown().

13 years agolibsigrokdecode: Always load all decoders upon init.
Uwe Hermann [Thu, 27 Jan 2011 23:11:00 +0000 (00:11 +0100)]
libsigrokdecode: Always load all decoders upon init.

Let sigrokdecode_init() always load all decoders it can find in the
decoders directory, i.e., the user doesn't need to manually load decoders.
Instead he can just look up the list via sigrokdecode_list_decoders()
after sigrokdecode_init() has run.

This is not a problem, as sigrokdecode_init() is only run once per
sigrok-cli or sigrok-gui invocation, and even with many decoders this
should not take too long.

The list of decoders within libsigrokdecode is no longer a string, but
rather a list of 'struct sigrokdecode_decoder *' pointers.

Add sigrokdecode_get_decoder_by_id() API function which returns the
decoder with the specified ID (file name without ".py" suffix, for now),
or NULL if it cannot be found.

sigrokdecode_load_decoder() is now a private function and not exported
via the lib, i.e. not available to users of libsigrokdecode.

13 years agoFix some compiler warnings.
Uwe Hermann [Thu, 27 Jan 2011 22:17:47 +0000 (23:17 +0100)]
Fix some compiler warnings.

13 years agodecode.c: Simplify the import code.
Uwe Hermann [Thu, 27 Jan 2011 22:12:34 +0000 (23:12 +0100)]
decode.c: Simplify the import code.

Use PyImport_ImportModule() instead of PyImport_Import(), so we don't
have to temporarily create a py_name object.

13 years agoSome more simplifications in decode.c.
Uwe Hermann [Thu, 27 Jan 2011 22:02:39 +0000 (23:02 +0100)]
Some more simplifications in decode.c.

13 years agoUse Py_XINCREF/Py_XDECREF, not Py_INCREF/Py_DECREF.
Uwe Hermann [Thu, 27 Jan 2011 21:53:29 +0000 (22:53 +0100)]
Use Py_XINCREF/Py_XDECREF, not Py_INCREF/Py_DECREF.

They're defined like this in Python.h:

  /* Macros to use in case the object pointer may be NULL: */
  #define Py_XINCREF(op) if ((op) == NULL) ; else Py_INCREF(op)
  #define Py_XDECREF(op) if ((op) == NULL) ; else Py_DECREF(op)

I.e., the performance penalty we take by using Py_XINCREF/Py_XDECREF is
pretty much non-existant.

13 years agodecode.c: Simplify sigrokdecode_run_decoder().
Uwe Hermann [Thu, 27 Jan 2011 21:50:57 +0000 (22:50 +0100)]
decode.c: Simplify sigrokdecode_run_decoder().

13 years agoBugfix: Add missing Py_INCREF()s.
Uwe Hermann [Thu, 27 Jan 2011 21:13:08 +0000 (22:13 +0100)]
Bugfix: Add missing Py_INCREF()s.

This should fix an error/segfault when running a decoder on bigger
datasets.

13 years agodecode.c: Better documentation.
Uwe Hermann [Thu, 27 Jan 2011 20:07:40 +0000 (21:07 +0100)]
decode.c: Better documentation.

Mark all Python/C API functions returning a new reference with "NEWREF",
and those that steal references with "STEAL".

13 years agodecode.c: Fix typos.
Uwe Hermann [Thu, 27 Jan 2011 19:57:09 +0000 (20:57 +0100)]
decode.c: Fix typos.

13 years agoBugfix: PyTuple_SetItem() "steals" a reference.
Uwe Hermann [Thu, 27 Jan 2011 19:56:39 +0000 (20:56 +0100)]
Bugfix: PyTuple_SetItem() "steals" a reference.

13 years agoconfigure.ac: Fix firmware/decoders dir variables.
Uwe Hermann [Sun, 23 Jan 2011 23:24:27 +0000 (00:24 +0100)]
configure.ac: Fix firmware/decoders dir variables.

FIRMWARE_DIR and DECODERS_DIR as defined in config.h need some magic applied
to resolve the $prefix/$data variable to an absolute path.

13 years agoIntroduce proper libtool versioning for the libs.
Uwe Hermann [Sun, 23 Jan 2011 18:53:50 +0000 (19:53 +0100)]
Introduce proper libtool versioning for the libs.

13 years agolib headers: Add 'extern "C"' for C++ usage.
Uwe Hermann [Thu, 20 Jan 2011 22:00:59 +0000 (23:00 +0100)]
lib headers: Add 'extern "C"' for C++ usage.

13 years agoRe-enable stuff we temporarily disabled for 0.1.
Uwe Hermann [Wed, 19 Jan 2011 23:39:59 +0000 (00:39 +0100)]
Re-enable stuff we temporarily disabled for 0.1.

13 years agoDisable decoders and session CLI options for 0.1.
Uwe Hermann [Wed, 19 Jan 2011 21:32:00 +0000 (22:32 +0100)]
Disable decoders and session CLI options for 0.1.

13 years agoDon't install libs and headers in the 0.1 release.
Uwe Hermann [Wed, 19 Jan 2011 18:20:44 +0000 (19:20 +0100)]
Don't install libs and headers in the 0.1 release.

The library APIs are not yet usable or finalized, so don't expose the
libs for now. Instead, only install sigrok-cli, the manpages, and
the decoders.

13 years agolibsigrokdecode fix to handle unusual dirnames.
Uwe Hermann [Sat, 15 Jan 2011 03:26:07 +0000 (04:26 +0100)]
libsigrokdecode fix to handle unusual dirnames.

Windows paths such as c:\... and/or those with spaces in them were
problematic.

13 years agoOnly load decoders from $(datadir)/sigrok/decoders.
Uwe Hermann [Sat, 15 Jan 2011 02:30:26 +0000 (03:30 +0100)]
Only load decoders from $(datadir)/sigrok/decoders.

Drop convenience locations which were supposed to allow running
./cli/sigrok-cli in the build directory. That will not really work fine
due to some other reasons. We only support running sigrok-cli after an
installation (into /usr/local or /opt or $HOME/sigrokinst or whatever).

13 years agoDon't print .py suffix in protocol decoder names.
Uwe Hermann [Sat, 15 Jan 2011 02:07:00 +0000 (03:07 +0100)]
Don't print .py suffix in protocol decoder names.

13 years agoBugfix: Use only .py decoders, ignore .pyc files.
Uwe Hermann [Sat, 15 Jan 2011 02:00:15 +0000 (03:00 +0100)]
Bugfix: Use only .py decoders, ignore .pyc files.

13 years agoDon't expose libsigrokdecode's interal GSList.
Uwe Hermann [Sat, 15 Jan 2011 01:37:51 +0000 (02:37 +0100)]
Don't expose libsigrokdecode's interal GSList.

Instead, add a libsigrokdecode_list_decoders() API call which gives you
the list of known protocol decoders.

13 years agoInstall decoders into a decoders/ subdir.
Uwe Hermann [Sat, 15 Jan 2011 01:32:03 +0000 (02:32 +0100)]
Install decoders into a decoders/ subdir.

Use $(datadir)/sigrok/decoders as subdirectory for the protocol decoders
(instead of installing them in the top-level $(datadir)/sigrok), just
as we do for $(datadir)/sigrok/firmware.

13 years agoCLI: Support for running protocol decoders.
Uwe Hermann [Sat, 15 Jan 2011 00:44:41 +0000 (01:44 +0100)]
CLI: Support for running protocol decoders.

Add a new -A | --list-protocol-decoders option to show the list of
protocol decoders we could find.

Add -a | --protocol-decoders to specify a list of decoders that shall
be applied to the datastream. Currently only works for one decoder.

Define DECODERS_DIR, which is the directory where the decoders will be
installed upon 'make install', and where libsigrokdecode_init() will
search for them.

Thanks Olivier Fauchon <redacted> for the initial patch,
merged in slightly different form.

13 years agoRename the scripts/ directory to decoders/.
Uwe Hermann [Mon, 10 Jan 2011 22:27:15 +0000 (23:27 +0100)]
Rename the scripts/ directory to decoders/.

13 years agoFix compile for Python >= 3.0.
Uwe Hermann [Sat, 8 Jan 2011 16:00:18 +0000 (17:00 +0100)]
Fix compile for Python >= 3.0.

Python docs tells us more about string functions:
"These functions have been renamed to PyBytes_* in Python 3.x. Unless
otherwise noted, the PyBytes functions available in 3.x are aliased to
their PyString_* equivalents to help porting."
(http://docs.python.org/c-api/string.html)

Use #defines to map the new names and fix the compile for Python >= 3.0.

Thanks Olivier Fauchon <redacted> for the patch.

14 years agolibsigrokdecode: Use SIGROKDECODE_OK.
Uwe Hermann [Fri, 14 May 2010 10:50:01 +0000 (12:50 +0200)]
libsigrokdecode: Use SIGROKDECODE_OK.

14 years agopkg-config: Add libsigrokdecode.pc.
Uwe Hermann [Tue, 11 May 2010 19:55:35 +0000 (21:55 +0200)]
pkg-config: Add libsigrokdecode.pc.

14 years agoUse CLEANFILES instead of extra target.
Uwe Hermann [Tue, 11 May 2010 15:16:38 +0000 (17:16 +0200)]
Use CLEANFILES instead of extra target.

14 years agoscripts: Add clean-local target for *.pyc.
Uwe Hermann [Sun, 9 May 2010 19:07:03 +0000 (21:07 +0200)]
scripts: Add clean-local target for *.pyc.

14 years agoI2C: Convert output to more usable format.
Uwe Hermann [Tue, 4 May 2010 21:19:31 +0000 (23:19 +0200)]
I2C: Convert output to more usable format.

14 years agoi2c.py: Fix typo resulting in a nonworking script.
Uwe Hermann [Tue, 27 Apr 2010 21:18:05 +0000 (23:18 +0200)]
i2c.py: Fix typo resulting in a nonworking script.

14 years agoAdd Python decoder for the Wii Nunchuk.
Uwe Hermann [Tue, 27 Apr 2010 21:13:45 +0000 (23:13 +0200)]
Add Python decoder for the Wii Nunchuk.

Untested, unfinished.

14 years agoI2C decoder format draft (unfinished).
Uwe Hermann [Sat, 24 Apr 2010 14:52:55 +0000 (16:52 +0200)]
I2C decoder format draft (unfinished).

14 years agoVarious small decoder script fixes.
Uwe Hermann [Fri, 23 Apr 2010 23:33:52 +0000 (01:33 +0200)]
Various small decoder script fixes.

14 years agodist_pkgdata_SCRIPTS: Add i2c.py.
Uwe Hermann [Fri, 23 Apr 2010 23:12:09 +0000 (01:12 +0200)]
dist_pkgdata_SCRIPTS: Add i2c.py.

14 years agoVarious Python decoder infrastructure improvements.
Uwe Hermann [Fri, 23 Apr 2010 23:04:20 +0000 (01:04 +0200)]
Various Python decoder infrastructure improvements.

 - Introduce 'struct sigrokdecode_decoder'.

 - Decoders are now handled via two C functions:
   - sigrokdecode_load_decoder(): Fills a 'struct sigrokdecode_decoder'.
   - sigrokdecode_run_decoder(): Runs a decoder function.

 - There are now two decoder API functions a script needs to implement:
   - register(): Returns a Python dict with certain metadata.
   - decode(): Runs the actual decoder code.

 - libsigrokdecode: Add and use some more #defines for errors:
   - SIGROKDECODE_ERR_ARGS
   - SIGROKDECODE_ERR_PYTHON

 - Various other smaller Python decode script infrastructure issues.

14 years agosigrokdecode.h: Add struct sigrokdecode_decoder_info.
unknown [Fri, 23 Apr 2010 16:49:17 +0000 (18:49 +0200)]
sigrokdecode.h: Add struct sigrokdecode_decoder_info.

14 years agoRename sigrokdecode_register_i2c() to register().
unknown [Fri, 23 Apr 2010 16:47:43 +0000 (18:47 +0200)]
Rename sigrokdecode_register_i2c() to register().

14 years agotransitioncounter: Add register() function.
unknown [Fri, 23 Apr 2010 16:46:36 +0000 (18:46 +0200)]
transitioncounter: Add register() function.

14 years agosigrokdecode_run_decoder(): Pass in the module name.
unknown [Fri, 23 Apr 2010 16:06:22 +0000 (18:06 +0200)]
sigrokdecode_run_decoder(): Pass in the module name.

14 years agoPython: Use "enums" as states, not strings.
Uwe Hermann [Wed, 21 Apr 2010 18:31:10 +0000 (20:31 +0200)]
Python: Use "enums" as states, not strings.

Also, fix a typo.

14 years agoPython: Bugfixes (True/False != 1/0).
Uwe Hermann [Sun, 18 Apr 2010 01:15:06 +0000 (03:15 +0200)]
Python: Bugfixes (True/False != 1/0).

14 years agoPython: Use range instead of xrange.
Uwe Hermann [Sun, 18 Apr 2010 00:02:35 +0000 (02:02 +0200)]
Python: Use range instead of xrange.

For small numbers range seems to be faster, and xramge is being removed
anyway in Python 3 AFAIK.

14 years agosigrokdecode_init: Add more Python search paths.
Uwe Hermann [Sat, 17 Apr 2010 23:58:45 +0000 (01:58 +0200)]
sigrokdecode_init: Add more Python search paths.

14 years agotransitioncounter.py: Simplify and optimize a bit.
Uwe Hermann [Sat, 17 Apr 2010 23:54:49 +0000 (01:54 +0200)]
transitioncounter.py: Simplify and optimize a bit.

14 years agolibsigrok: Coding style fixes.
Uwe Hermann [Thu, 15 Apr 2010 18:07:16 +0000 (20:07 +0200)]
libsigrok: Coding style fixes.

14 years agoUse psyco (if available) to improve performance.
Uwe Hermann [Mon, 12 Apr 2010 17:42:35 +0000 (19:42 +0200)]
Use psyco (if available) to improve performance.

14 years agoFirst attempt at an I2C decoder (untested).
Uwe Hermann [Sun, 11 Apr 2010 19:44:12 +0000 (21:44 +0200)]
First attempt at an I2C decoder (untested).

14 years agoImplement a simple transition counter script.
Uwe Hermann [Sun, 11 Apr 2010 01:58:05 +0000 (03:58 +0200)]
Implement a simple transition counter script.

14 years agoFix all warnings and re-enable -Wextra.
Uwe Hermann [Fri, 9 Apr 2010 20:18:46 +0000 (22:18 +0200)]
Fix all warnings and re-enable -Wextra.

14 years agoMore paths to the libsigrokdecode Python scripts.
Uwe Hermann [Tue, 6 Apr 2010 00:11:01 +0000 (02:11 +0200)]
More paths to the libsigrokdecode Python scripts.

14 years agoFix incorrect path to the Python decoder scripts.
Uwe Hermann [Tue, 6 Apr 2010 00:06:55 +0000 (02:06 +0200)]
Fix incorrect path to the Python decoder scripts.

14 years agolibsigrokdecode: Add initial return code list.
Uwe Hermann [Mon, 5 Apr 2010 23:29:32 +0000 (01:29 +0200)]
libsigrokdecode: Add initial return code list.

14 years agoStart of code base layout restructuring.
Uwe Hermann [Fri, 2 Apr 2010 18:18:27 +0000 (20:18 +0200)]
Start of code base layout restructuring.