]> sigrok.org Git - libsigrok.git/commit - src/input/vcd.c
input/vcd: detect and skip string data types (value not used)
authorGerhard Sittig <redacted>
Sun, 5 Sep 2021 10:45:26 +0000 (12:45 +0200)
committerGerhard Sittig <redacted>
Sat, 8 Jan 2022 09:03:47 +0000 (10:03 +0100)
commitc1310f7deba7ac1f4ce75fbb5cc9b498ee66aa49
treedf0c48c674e101d04c6e4a269be379acdab58950
parent1a35f71170e46d8fff91d0b285f737ccdd3b3796
input/vcd: detect and skip string data types (value not used)

The nMigen utility was reported to emit string values in VCD files (by
means of the pyvcd Python module). The $var declaration specifies the
'string' data type, and text values are prefixed with 's' similar to
integer or real numbers and bit vectors.

It is desirable to process these files and skip the unsupported type
which does not map to any sigrok channel type. Add support to detect the
type in declarations and change entries, skip these change entries and
emit warnings so that users remain aware of the incomplete import. Check
the validity of the entry though, to keep robustness of the existing
implementation of the VCD input module.

The validity check is an educated guess that was written in the absence
of an official specification or any public documentation, encodes rather
arbitrary assumptions. Deals with cases that were reported, may need
more test coverage and future tweaking. This version forbids whitespace
in values, and exclusively accepts printable ASCII in the string
presentation, with a few escape sequences. Empty strings are covered.

This also resolves bug #1757.

Reported-By: Anton Blanchard <redacted> via github PR 157
src/input/vcd.c