Allow output_format.init() to return errors.
This commit is contained in:
parent
4c100f3244
commit
5a8fda158b
|
@ -23,11 +23,9 @@
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
static void init(struct output *o)
|
static int init(struct output *o)
|
||||||
{
|
{
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -66,7 +66,7 @@ static void flush_linebufs(struct context *ctx, GSList *probes, char *outbuf)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static void init(struct output *o, int default_spl)
|
static int init(struct output *o, int default_spl)
|
||||||
{
|
{
|
||||||
struct context *ctx;
|
struct context *ctx;
|
||||||
struct probe *probe;
|
struct probe *probe;
|
||||||
|
@ -109,6 +109,7 @@ static void init(struct output *o, int default_spl)
|
||||||
ctx->linebuf = calloc(1, num_probes * ctx->linebuf_len);
|
ctx->linebuf = calloc(1, num_probes * ctx->linebuf_len);
|
||||||
ctx->linevalues = calloc(1, num_probes);
|
ctx->linevalues = calloc(1, num_probes);
|
||||||
|
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -137,10 +138,10 @@ static int event(struct output *o, int event_type, char **data_out, uint64_t *le
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static void init_binary(struct output *o)
|
static int init_binary(struct output *o)
|
||||||
{
|
{
|
||||||
|
|
||||||
init(o, DEFAULT_BPL_BIN);
|
return init(o, DEFAULT_BPL_BIN);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -199,10 +200,10 @@ static int data_binary(struct output *o, char *data_in, uint64_t length_in, char
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static void init_hex(struct output *o)
|
static int init_hex(struct output *o)
|
||||||
{
|
{
|
||||||
|
|
||||||
init(o, DEFAULT_BPL_BIN);
|
return init(o, DEFAULT_BPL_BIN);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -30,7 +30,6 @@ struct context {
|
||||||
char *probelist[65];
|
char *probelist[65];
|
||||||
int *prevbits;
|
int *prevbits;
|
||||||
char *header;
|
char *header;
|
||||||
char *data;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
const char *vcd_header = "\
|
const char *vcd_header = "\
|
||||||
|
@ -44,7 +43,7 @@ $upscope $end\n\
|
||||||
$enddefinitions $end\n\
|
$enddefinitions $end\n\
|
||||||
$dumpvars\n";
|
$dumpvars\n";
|
||||||
|
|
||||||
static void init(struct output *o)
|
static int init(struct output *o)
|
||||||
{
|
{
|
||||||
/* Maximum header length */
|
/* Maximum header length */
|
||||||
#define MAX_HEADER_LEN 2048
|
#define MAX_HEADER_LEN 2048
|
||||||
|
@ -100,6 +99,8 @@ static void init(struct output *o)
|
||||||
(char *)&sbuf, 1, "ns", PACKAGE, (char *)&wbuf);
|
(char *)&sbuf, 1, "ns", PACKAGE, (char *)&wbuf);
|
||||||
|
|
||||||
ctx->prevbits = calloc(sizeof(int), num_probes);
|
ctx->prevbits = calloc(sizeof(int), num_probes);
|
||||||
|
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int event(struct output *o, int event_type, char **data_out,
|
static int event(struct output *o, int event_type, char **data_out,
|
||||||
|
|
2
sigrok.h
2
sigrok.h
|
@ -99,7 +99,7 @@ struct output {
|
||||||
struct output_format {
|
struct output_format {
|
||||||
char *extension;
|
char *extension;
|
||||||
char *description;
|
char *description;
|
||||||
void (*init) (struct output *o);
|
int (*init) (struct output *o);
|
||||||
int (*data) (struct output *o, char *data_in, uint64_t length_in,
|
int (*data) (struct output *o, char *data_in, uint64_t length_in,
|
||||||
char **data_out, uint64_t *length_out);
|
char **data_out, uint64_t *length_out);
|
||||||
int (*event) (struct output *o, int event_type, char **data_out,
|
int (*event) (struct output *o, int event_type, char **data_out,
|
||||||
|
|
Loading…
Reference in New Issue