#include <glib.h>
#include <stdio.h>
#include <string.h>
-#include "libsigrok.h"
+#include <libsigrok/libsigrok.h>
#include "libsigrok-internal.h"
#define LOG_PREFIX "input/vcd"
gchar *identifier;
};
-
/*
* Reads a single VCD section from input file and parses it to name/contents.
* e.g. $timescale 1ps $end => "timescale" "1ps"
static int init(struct sr_input *in, GHashTable *options)
{
- struct sr_channel *ch;
int num_channels, i;
char name[16];
struct context *inc;
inc->skip = g_variant_get_int32(g_hash_table_lookup(options, "skip"));
inc->skip /= inc->downsample;
- in->sdi = sr_dev_inst_new(SR_ST_ACTIVE, NULL, NULL, NULL);
+ in->sdi = g_malloc0(sizeof(struct sr_dev_inst));
in->priv = inc;
for (i = 0; i < num_channels; i++) {
snprintf(name, 16, "%d", i);
- ch = sr_channel_new(i, SR_CHANNEL_LOGIC, TRUE, name);
- in->sdi->channels = g_slist_append(in->sdi->channels, ch);
+ sr_channel_new(in->sdi, i, SR_CHANNEL_LOGIC, TRUE, name);
}
return SR_OK;
if (!inc->got_header) {
if (!have_header(in->buf))
return SR_OK;
- if (!parse_header(in, in->buf) != SR_OK)
+ if (!parse_header(in, in->buf))
/* There was a header in there, but it was malformed. */
return SR_ERR;
.id = "vcd",
.name = "VCD",
.desc = "Value Change Dump",
+ .exts = (const char*[]){"vcd", NULL},
.metadata = { SR_INPUT_META_HEADER | SR_INPUT_META_REQUIRED },
.options = get_options,
.format_match = format_match,