Add sr_ prefix to input/output structs.

This commit is contained in:
Uwe Hermann 2011-01-29 16:36:57 +01:00
parent e46b8fb154
commit f50f3f40d9
16 changed files with 81 additions and 81 deletions

View File

@ -19,15 +19,15 @@
#include <sigrok.h> #include <sigrok.h>
extern struct input_format input_binary; extern struct sr_input_format input_binary;
struct input_format *input_module_list[] = { static struct sr_input_format *input_module_list[] = {
/* This one has to be last, because it will take any input. */ /* This one has to be last, because it will take any input. */
&input_binary, &input_binary,
NULL, NULL,
}; };
struct input_format **input_list(void) struct sr_input_format **sr_input_list(void)
{ {
return input_module_list; return input_module_list;
} }

View File

@ -39,7 +39,7 @@ static int format_match(const char *filename)
return TRUE; return TRUE;
} }
static int init(struct input *in) static int init(struct sr_input *in)
{ {
int num_probes; int num_probes;
@ -56,7 +56,7 @@ static int init(struct input *in)
return SR_OK; return SR_OK;
} }
static int loadfile(struct input *in, const char *filename) static int loadfile(struct sr_input *in, const char *filename)
{ {
struct datafeed_header header; struct datafeed_header header;
struct datafeed_packet packet; struct datafeed_packet packet;
@ -98,7 +98,7 @@ static int loadfile(struct input *in, const char *filename)
return SR_OK; return SR_OK;
} }
struct input_format input_binary = { struct sr_input_format input_binary = {
"binary", "binary",
"Raw binary", "Raw binary",
format_match, format_match,

View File

@ -19,17 +19,17 @@
#include <sigrok.h> #include <sigrok.h>
extern struct output_format output_text_bits; extern struct sr_output_format output_text_bits;
extern struct output_format output_text_hex; extern struct sr_output_format output_text_hex;
extern struct output_format output_text_ascii; extern struct sr_output_format output_text_ascii;
extern struct output_format output_binary; extern struct sr_output_format output_binary;
extern struct output_format output_vcd; extern struct sr_output_format output_vcd;
extern struct output_format output_ols; extern struct sr_output_format output_ols;
extern struct output_format output_gnuplot; extern struct sr_output_format output_gnuplot;
extern struct output_format output_analog_bits; extern struct sr_output_format output_analog_bits;
extern struct output_format output_analog_gnuplot; extern struct sr_output_format output_analog_gnuplot;
struct output_format *output_module_list[] = { static struct sr_output_format *output_module_list[] = {
&output_text_bits, &output_text_bits,
&output_text_hex, &output_text_hex,
&output_text_ascii, &output_text_ascii,
@ -42,7 +42,7 @@ struct output_format *output_module_list[] = {
NULL, NULL,
}; };
struct output_format **output_list(void) struct sr_output_format **sr_output_list(void)
{ {
return output_module_list; return output_module_list;
} }

View File

@ -89,7 +89,7 @@ static void flush_linebufs(struct context *ctx, char *outbuf)
memset(ctx->linebuf, 0, i * ctx->linebuf_len); memset(ctx->linebuf, 0, i * ctx->linebuf_len);
} }
static int init(struct output *o, int default_spl, enum outputmode mode) static int init(struct sr_output *o, int default_spl, enum outputmode mode)
{ {
struct context *ctx; struct context *ctx;
struct probe *probe; struct probe *probe;
@ -163,7 +163,7 @@ static int init(struct output *o, int default_spl, enum outputmode mode)
return SR_OK; return SR_OK;
} }
static int event(struct output *o, int event_type, char **data_out, static int event(struct sr_output *o, int event_type, char **data_out,
uint64_t *length_out) uint64_t *length_out)
{ {
struct context *ctx; struct context *ctx;
@ -197,12 +197,12 @@ static int event(struct output *o, int event_type, char **data_out,
return SR_OK; return SR_OK;
} }
static int init_bits(struct output *o) static int init_bits(struct sr_output *o)
{ {
return init(o, DEFAULT_BPL_BITS, MODE_BITS); return init(o, DEFAULT_BPL_BITS, MODE_BITS);
} }
static int data_bits(struct output *o, char *data_in, uint64_t length_in, static int data_bits(struct sr_output *o, char *data_in, uint64_t length_in,
char **data_out, uint64_t *length_out) char **data_out, uint64_t *length_out)
{ {
struct context *ctx; struct context *ctx;
@ -283,12 +283,12 @@ static int data_bits(struct output *o, char *data_in, uint64_t length_in,
return SR_OK; return SR_OK;
} }
#if 0 #if 0
static int init_hex(struct output *o) static int init_hex(struct sr_output *o)
{ {
return init(o, DEFAULT_BPL_HEX, MODE_HEX); return init(o, DEFAULT_BPL_HEX, MODE_HEX);
} }
static int data_hex(struct output *o, char *data_in, uint64_t length_in, static int data_hex(struct sr_output *o, char *data_in, uint64_t length_in,
char **data_out, uint64_t *length_out) char **data_out, uint64_t *length_out)
{ {
struct context *ctx; struct context *ctx;
@ -348,12 +348,12 @@ static int data_hex(struct output *o, char *data_in, uint64_t length_in,
return SR_OK; return SR_OK;
} }
static int init_ascii(struct output *o) static int init_ascii(struct sr_output *o)
{ {
return init(o, DEFAULT_BPL_ASCII, MODE_ASCII); return init(o, DEFAULT_BPL_ASCII, MODE_ASCII);
} }
static int data_ascii(struct output *o, char *data_in, uint64_t length_in, static int data_ascii(struct sr_output *o, char *data_in, uint64_t length_in,
char **data_out, uint64_t *length_out) char **data_out, uint64_t *length_out)
{ {
struct context *ctx; struct context *ctx;
@ -438,7 +438,7 @@ static int data_ascii(struct output *o, char *data_in, uint64_t length_in,
} }
#endif #endif
struct output_format output_analog_bits = { struct sr_output_format output_analog_bits = {
"analog_bits", "analog_bits",
"Bits (takes argument, default 64)", "Bits (takes argument, default 64)",
DF_ANALOG, DF_ANALOG,
@ -447,7 +447,7 @@ struct output_format output_analog_bits = {
event, event,
}; };
#if 0 #if 0
struct output_format output_analog_hex = { struct sr_output_format output_analog_hex = {
"analog_hex", "analog_hex",
"Hexadecimal (takes argument, default 192)", "Hexadecimal (takes argument, default 192)",
DF_ANALOG, DF_ANALOG,
@ -456,7 +456,7 @@ struct output_format output_analog_hex = {
event, event,
}; };
struct output_format output_analog_ascii = { struct sr_output_format output_analog_ascii = {
"analog_ascii", "analog_ascii",
"ASCII (takes argument, default 74)", "ASCII (takes argument, default 74)",
DF_ANALOG, DF_ANALOG,

View File

@ -25,7 +25,7 @@
#include "config.h" #include "config.h"
static int data(struct output *o, char *data_in, uint64_t length_in, static int data(struct sr_output *o, char *data_in, uint64_t length_in,
char **data_out, uint64_t *length_out) char **data_out, uint64_t *length_out)
{ {
char *outbuf; char *outbuf;
@ -43,7 +43,7 @@ static int data(struct output *o, char *data_in, uint64_t length_in,
return SR_OK; return SR_OK;
} }
struct output_format output_binary = { struct sr_output_format output_binary = {
"binary", "binary",
"Raw binary", "Raw binary",
DF_LOGIC, DF_LOGIC,

View File

@ -46,7 +46,7 @@ const char *gnuplot_header = "\
const char *gnuplot_header_comment = "\ const char *gnuplot_header_comment = "\
# Comment: Acquisition with %d/%d probes at %s\n"; # Comment: Acquisition with %d/%d probes at %s\n";
static int init(struct output *o) static int init(struct sr_output *o)
{ {
struct context *ctx; struct context *ctx;
struct probe *probe; struct probe *probe;
@ -119,7 +119,7 @@ static int init(struct output *o)
return 0; return 0;
} }
static int event(struct output *o, int event_type, char **data_out, static int event(struct sr_output *o, int event_type, char **data_out,
uint64_t *length_out) uint64_t *length_out)
{ {
struct context *ctx; struct context *ctx;
@ -141,7 +141,7 @@ static int event(struct output *o, int event_type, char **data_out,
return SR_OK; return SR_OK;
} }
static int data(struct output *o, char *data_in, uint64_t length_in, static int data(struct sr_output *o, char *data_in, uint64_t length_in,
char **data_out, uint64_t *length_out) char **data_out, uint64_t *length_out)
{ {
struct context *ctx; struct context *ctx;
@ -191,7 +191,7 @@ static int data(struct output *o, char *data_in, uint64_t length_in,
return SR_OK; return SR_OK;
} }
static int analog_init(struct output *o) static int analog_init(struct sr_output *o)
{ {
struct context *ctx; struct context *ctx;
struct probe *probe; struct probe *probe;
@ -266,7 +266,7 @@ static int analog_init(struct output *o)
return 0; return 0;
} }
static int analog_data(struct output *o, char *data_in, uint64_t length_in, static int analog_data(struct sr_output *o, char *data_in, uint64_t length_in,
char **data_out, uint64_t *length_out) char **data_out, uint64_t *length_out)
{ {
struct context *ctx; struct context *ctx;
@ -326,7 +326,7 @@ static int analog_data(struct output *o, char *data_in, uint64_t length_in,
return SR_OK; return SR_OK;
} }
struct output_format output_gnuplot = { struct sr_output_format output_gnuplot = {
"gnuplot", "gnuplot",
"Gnuplot", "Gnuplot",
DF_LOGIC, DF_LOGIC,
@ -335,7 +335,7 @@ struct output_format output_gnuplot = {
event, event,
}; };
struct output_format output_analog_gnuplot = { struct sr_output_format output_analog_gnuplot = {
"analog_gnuplot", "analog_gnuplot",
"Gnuplot analog", "Gnuplot analog",
DF_ANALOG, DF_ANALOG,

View File

@ -66,7 +66,7 @@ struct context {
const char *ols_header_comment = "\ const char *ols_header_comment = "\
# Comment: Acquisition with %d/%d probes at %s"; # Comment: Acquisition with %d/%d probes at %s";
static int init(struct output *o) static int init(struct sr_output *o)
{ {
struct context *ctx; struct context *ctx;
struct probe *probe; struct probe *probe;
@ -155,7 +155,7 @@ static int init(struct output *o)
return 0; return 0;
} }
static int event(struct output *o, int event_type, char **data_out, static int event(struct sr_output *o, int event_type, char **data_out,
uint64_t *length_out) uint64_t *length_out)
{ {
struct context *ctx; struct context *ctx;
@ -177,7 +177,7 @@ static int event(struct output *o, int event_type, char **data_out,
return SR_OK; return SR_OK;
} }
static int data(struct output *o, char *data_in, uint64_t length_in, static int data(struct sr_output *o, char *data_in, uint64_t length_in,
char **data_out, uint64_t *length_out) char **data_out, uint64_t *length_out)
{ {
struct context *ctx; struct context *ctx;
@ -218,7 +218,7 @@ static int data(struct output *o, char *data_in, uint64_t length_in,
return SR_OK; return SR_OK;
} }
struct output_format output_ols = { struct sr_output_format output_ols = {
"ols", "ols",
"OpenBench Logic Sniffer", "OpenBench Logic Sniffer",
DF_LOGIC, DF_LOGIC,

View File

@ -20,24 +20,24 @@
#include <stdint.h> #include <stdint.h>
#include <sigrok.h> #include <sigrok.h>
static int init(struct output *o) static int init(struct sr_output *o)
{ {
return 0; return 0;
} }
static int data(struct output *o, char *data_in, uint64_t length_in, static int data(struct sr_output *o, char *data_in, uint64_t length_in,
char **data_out, uint64_t *length_out) char **data_out, uint64_t *length_out)
{ {
return SR_OK; return SR_OK;
} }
static int event(struct output *o, int event_type, char **data_out, static int event(struct sr_output *o, int event_type, char **data_out,
uint64_t *length_out) uint64_t *length_out)
{ {
return SR_OK; return SR_OK;
} }
struct output_format output_foo = { struct sr_output_format output_foo = {
"foo", "foo",
"The foo format", "The foo format",
DF_LOGIC, DF_LOGIC,

View File

@ -49,7 +49,7 @@ $dumpvars\n";
const char *vcd_header_comment = "\ const char *vcd_header_comment = "\
$comment\n Acquisition with %d/%d probes at %s\n$end\n"; $comment\n Acquisition with %d/%d probes at %s\n$end\n";
static int init(struct output *o) static int init(struct sr_output *o)
{ {
struct context *ctx; struct context *ctx;
struct probe *probe; struct probe *probe;
@ -141,7 +141,7 @@ static int init(struct output *o)
return SR_OK; return SR_OK;
} }
static int event(struct output *o, int event_type, char **data_out, static int event(struct sr_output *o, int event_type, char **data_out,
uint64_t *length_out) uint64_t *length_out)
{ {
struct context *ctx; struct context *ctx;
@ -165,7 +165,7 @@ static int event(struct output *o, int event_type, char **data_out,
return SR_OK; return SR_OK;
} }
static int data(struct output *o, char *data_in, uint64_t length_in, static int data(struct sr_output *o, char *data_in, uint64_t length_in,
char **data_out, uint64_t *length_out) char **data_out, uint64_t *length_out)
{ {
struct context *ctx; struct context *ctx;
@ -222,7 +222,7 @@ static int data(struct output *o, char *data_in, uint64_t length_in,
return SR_OK; return SR_OK;
} }
struct output_format output_vcd = { struct sr_output_format output_vcd = {
"vcd", "vcd",
"Value Change Dump (VCD)", "Value Change Dump (VCD)",
DF_LOGIC, DF_LOGIC,

View File

@ -25,12 +25,12 @@
#include "text.h" #include "text.h"
int init_ascii(struct output *o) int init_ascii(struct sr_output *o)
{ {
return init(o, DEFAULT_BPL_ASCII, MODE_ASCII); return init(o, DEFAULT_BPL_ASCII, MODE_ASCII);
} }
int data_ascii(struct output *o, char *data_in, uint64_t length_in, int data_ascii(struct sr_output *o, char *data_in, uint64_t length_in,
char **data_out, uint64_t *length_out) char **data_out, uint64_t *length_out)
{ {
struct context *ctx; struct context *ctx;
@ -115,7 +115,7 @@ int data_ascii(struct output *o, char *data_in, uint64_t length_in,
} }
struct output_format output_text_ascii = { struct sr_output_format output_text_ascii = {
"ascii", "ascii",
"ASCII (takes argument, default 74)", "ASCII (takes argument, default 74)",
DF_LOGIC, DF_LOGIC,

View File

@ -25,12 +25,12 @@
#include "text.h" #include "text.h"
int init_bits(struct output *o) int init_bits(struct sr_output *o)
{ {
return init(o, DEFAULT_BPL_BITS, MODE_BITS); return init(o, DEFAULT_BPL_BITS, MODE_BITS);
} }
int data_bits(struct output *o, char *data_in, uint64_t length_in, int data_bits(struct sr_output *o, char *data_in, uint64_t length_in,
char **data_out, uint64_t *length_out) char **data_out, uint64_t *length_out)
{ {
struct context *ctx; struct context *ctx;
@ -102,7 +102,7 @@ int data_bits(struct output *o, char *data_in, uint64_t length_in,
} }
struct output_format output_text_bits = { struct sr_output_format output_text_bits = {
"bits", "bits",
"Bits (takes argument, default 64)", "Bits (takes argument, default 64)",
DF_LOGIC, DF_LOGIC,

View File

@ -25,12 +25,12 @@
#include "text.h" #include "text.h"
int init_hex(struct output *o) int init_hex(struct sr_output *o)
{ {
return init(o, DEFAULT_BPL_HEX, MODE_HEX); return init(o, DEFAULT_BPL_HEX, MODE_HEX);
} }
int data_hex(struct output *o, char *data_in, uint64_t length_in, int data_hex(struct sr_output *o, char *data_in, uint64_t length_in,
char **data_out, uint64_t *length_out) char **data_out, uint64_t *length_out)
{ {
struct context *ctx; struct context *ctx;
@ -91,7 +91,7 @@ int data_hex(struct output *o, char *data_in, uint64_t length_in,
} }
struct output_format output_text_hex = { struct sr_output_format output_text_hex = {
"hex", "hex",
"Hexadecimal (takes argument, default 192)", "Hexadecimal (takes argument, default 192)",
DF_LOGIC, DF_LOGIC,

View File

@ -64,7 +64,7 @@ void flush_linebufs(struct context *ctx, char *outbuf)
memset(ctx->linebuf, 0, i * ctx->linebuf_len); memset(ctx->linebuf, 0, i * ctx->linebuf_len);
} }
int init(struct output *o, int default_spl, enum outputmode mode) int init(struct sr_output *o, int default_spl, enum outputmode mode)
{ {
struct context *ctx; struct context *ctx;
struct probe *probe; struct probe *probe;
@ -137,7 +137,7 @@ int init(struct output *o, int default_spl, enum outputmode mode)
return SR_OK; return SR_OK;
} }
int event(struct output *o, int event_type, char **data_out, int event(struct sr_output *o, int event_type, char **data_out,
uint64_t *length_out) uint64_t *length_out)
{ {
struct context *ctx; struct context *ctx;

View File

@ -48,21 +48,21 @@ struct context {
}; };
void flush_linebufs(struct context *ctx, char *outbuf); void flush_linebufs(struct context *ctx, char *outbuf);
int init(struct output *o, int default_spl, enum outputmode mode); int init(struct sr_output *o, int default_spl, enum outputmode mode);
int event(struct output *o, int event_type, char **data_out, int event(struct sr_output *o, int event_type, char **data_out,
uint64_t *length_out); uint64_t *length_out);
int init_bits(struct output *o); int init_bits(struct sr_output *o);
int data_bits(struct output *o, char *data_in, uint64_t length_in, int data_bits(struct sr_output *o, char *data_in, uint64_t length_in,
char **data_out, uint64_t *length_out); char **data_out, uint64_t *length_out);
int init_hex(struct output *o); int init_hex(struct sr_output *o);
int data_hex(struct output *o, char *data_in, uint64_t length_in, int data_hex(struct sr_output *o, char *data_in, uint64_t length_in,
char **data_out, uint64_t *length_out); char **data_out, uint64_t *length_out);
int init_ascii(struct output *o); int init_ascii(struct sr_output *o);
int data_ascii(struct output *o, char *data_in, uint64_t length_in, int data_ascii(struct sr_output *o, char *data_in, uint64_t length_in,
char **data_out, uint64_t *length_out); char **data_out, uint64_t *length_out);

View File

@ -122,11 +122,11 @@ void session_source_remove(int fd);
/*--- input/input.c ---------------------------------------------------------*/ /*--- input/input.c ---------------------------------------------------------*/
struct input_format **input_list(void); struct sr_input_format **sr_input_list(void);
/*--- output/output.c -------------------------------------------------------*/ /*--- output/output.c -------------------------------------------------------*/
struct output_format **output_list(void); struct sr_output_format **sr_output_list(void);
/*--- output/common.c -------------------------------------------------------*/ /*--- output/common.c -------------------------------------------------------*/

View File

@ -129,35 +129,35 @@ struct analog_sample {
struct analog_probe probes[]; struct analog_probe probes[];
}; };
struct input { struct sr_input {
struct input_format *format; struct sr_input_format *format;
char *param; char *param;
struct device *vdevice; struct device *vdevice;
}; };
struct input_format { struct sr_input_format {
char *extension; char *extension;
char *description; char *description;
int (*format_match) (const char *filename); int (*format_match) (const char *filename);
int (*init) (struct input *in); int (*init) (struct sr_input *in);
int (*loadfile) (struct input *in, const char *filename); int (*loadfile) (struct sr_input *in, const char *filename);
}; };
struct output { struct sr_output {
struct output_format *format; struct sr_output_format *format;
struct device *device; struct device *device;
char *param; char *param;
void *internal; void *internal;
}; };
struct output_format { struct sr_output_format {
char *extension; char *extension;
char *description; char *description;
int df_type; int df_type;
int (*init) (struct output *o); int (*init) (struct sr_output *o);
int (*data) (struct output *o, char *data_in, uint64_t length_in, int (*data) (struct sr_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 sr_output *o, int event_type, char **data_out,
uint64_t *length_out); uint64_t *length_out);
}; };