]> sigrok.org Git - libsigrok.git/commitdiff
input: vcd: try to continue when a vector was found
authorWolfram Sang <redacted>
Sat, 9 Jan 2016 17:27:14 +0000 (18:27 +0100)
committerUwe Hermann <redacted>
Thu, 28 Jan 2016 18:03:53 +0000 (19:03 +0100)
No need to bail out on vectors. As long as there are tokens left, we can
try to parse the rest. Also, print a message so the user knows what's
going on. Here is a testcase vcd:

$timescale 1 ns $end
$var wire 1 n0 addr_0 $end
$var wire 1 n1 addr_1 $end
$enddefinitions $end
#0
0n0
b1 n1
#1
1n0
b0 n1
#2
0n0
b1 n1

Signed-off-by: Wolfram Sang <redacted>
src/input/vcd.c

index 91c22fcaea30df775d6726f25cdc45e29afa582c..6f84f659c05b32ef3252871413859ccfb1cc7d92 100644 (file)
@@ -407,8 +407,13 @@ static void parse_contents(const struct sr_input *in, char *data)
                                break;
                        }
                } else if (strchr("bBrR", tokens[i][0]) != NULL) {
-                       /* A vector value, not supported yet. */
-                       break;
+                       sr_dbg("Vector values not supported yet");
+                       if (!tokens[++i])
+                               /* No tokens left, bail out */
+                               break;
+                       else
+                               /* Process next token */
+                               continue;
                } else if (strchr("01xXzZ", tokens[i][0]) != NULL) {
                        /* A new 1-bit sample value */
                        bit = (tokens[i][0] == '1');