From: Uwe Hermann Date: Wed, 6 Apr 2011 17:42:49 +0000 (+0200) Subject: input/output formats: Explicit struct member names. X-Git-Tag: libsigrok-0.1.0~297 X-Git-Url: https://sigrok.org/gitaction?a=commitdiff_plain;h=d494a4aa9dcbd90126d86757d16fa3e0f0a419f3;p=libsigrok.git input/output formats: Explicit struct member names. This makes it immediately clear what an entry is supposed to be, no need to look it up in some header file. --- diff --git a/input/input_binary.c b/input/input_binary.c index be67f2d2..e89dc84c 100644 --- a/input/input_binary.c +++ b/input/input_binary.c @@ -99,9 +99,9 @@ static int loadfile(struct sr_input *in, const char *filename) } struct sr_input_format input_binary = { - "binary", - "Raw binary", - format_match, - init, - loadfile, + .extension = "binary", + .description = "Raw binary", + .format_match = format_match, + .init = init, + .loadfile = loadfile, }; diff --git a/output/output_analog.c b/output/output_analog.c index 0f60dd35..e45100ca 100644 --- a/output/output_analog.c +++ b/output/output_analog.c @@ -439,29 +439,29 @@ static int data_ascii(struct sr_output *o, const char *data_in, #endif struct sr_output_format output_analog_bits = { - "analog_bits", - "Bits (takes argument, default 64)", - SR_DF_ANALOG, - init_bits, - data_bits, - event, + .extension = "analog_bits", + .description = "Bits (takes argument, default 64)", + .df_type = SR_DF_ANALOG, + .init = init_bits, + .data = data_bits, + .event = event, }; #if 0 struct sr_output_format output_analog_hex = { - "analog_hex", - "Hexadecimal (takes argument, default 192)", - SR_DF_ANALOG, - init_hex, - data_hex, - event, + .extension = "analog_hex", + .description = "Hexadecimal (takes argument, default 192)", + .df_type = SR_DF_ANALOG, + .init = init_hex, + .data = data_hex, + .event = event, }; struct sr_output_format output_analog_ascii = { - "analog_ascii", - "ASCII (takes argument, default 74)", - SR_DF_ANALOG, - init_ascii, - data_ascii, - event, + .extension = "analog_ascii", + .description = "ASCII (takes argument, default 74)", + .df_type = SR_DF_ANALOG, + .init = init_ascii, + .data = data_ascii, + .event = event, }; #endif diff --git a/output/output_binary.c b/output/output_binary.c index 076d497c..fb7c3f58 100644 --- a/output/output_binary.c +++ b/output/output_binary.c @@ -43,10 +43,10 @@ static int data(struct sr_output *o, const char *data_in, uint64_t length_in, } struct sr_output_format output_binary = { - "binary", - "Raw binary", - SR_DF_LOGIC, - NULL, - data, - NULL, + .extension = "binary", + .description = "Raw binary", + .df_type = SR_DF_LOGIC, + .init = NULL, + .data = data, + .event = NULL, }; diff --git a/output/output_gnuplot.c b/output/output_gnuplot.c index a52c3dc1..1b6d78c2 100644 --- a/output/output_gnuplot.c +++ b/output/output_gnuplot.c @@ -194,12 +194,12 @@ static int data(struct sr_output *o, const char *data_in, uint64_t length_in, } struct sr_output_format output_gnuplot = { - "gnuplot", - "Gnuplot", - SR_DF_LOGIC, - init, - data, - event, + .extension = "gnuplot", + .description = "Gnuplot", + .df_type = SR_DF_LOGIC, + .init = init, + .data = data, + .event = event, }; /* Temporarily disabled. */ @@ -340,11 +340,11 @@ static int analog_data(struct sr_output *o, char *data_in, uint64_t length_in, } struct sr_output_format output_analog_gnuplot = { - "analog_gnuplot", - "Gnuplot analog", - SR_DF_ANALOG, - analog_init, - analog_data, - event, + .extension = "analog_gnuplot", + .description = "Gnuplot analog", + .df_type = SR_DF_ANALOG, + .init = analog_init, + .data = analog_data, + .event = event, }; #endif diff --git a/output/output_ols.c b/output/output_ols.c index dd9ffdf6..8116472d 100644 --- a/output/output_ols.c +++ b/output/output_ols.c @@ -124,10 +124,10 @@ static int data(struct sr_output *o, const char *data_in, uint64_t length_in, } struct sr_output_format output_ols = { - "ols", - "OpenBench Logic Sniffer", - SR_DF_LOGIC, - init, - data, - event, + .extension = "ols", + .description = "OpenBench Logic Sniffer", + .df_type = SR_DF_LOGIC, + .init = init, + .data = data, + .event = event, }; diff --git a/output/output_skeleton.c b/output/output_skeleton.c index e4b3baf6..af82d5b4 100644 --- a/output/output_skeleton.c +++ b/output/output_skeleton.c @@ -38,10 +38,10 @@ static int event(struct sr_output *o, int event_type, char **data_out, } struct sr_output_format output_foo = { - "foo", - "The foo format", - SR_DF_LOGIC, - init, - data, - event, + .extension = "foo", + .description = "The foo format", + .df_type = SR_DF_LOGIC, + .init = init, + .data = data, + .event = event, }; diff --git a/output/output_vcd.c b/output/output_vcd.c index 1c5d723d..bd16bc2e 100644 --- a/output/output_vcd.c +++ b/output/output_vcd.c @@ -213,10 +213,10 @@ static int data(struct sr_output *o, const char *data_in, uint64_t length_in, } struct sr_output_format output_vcd = { - "vcd", - "Value Change Dump (VCD)", - SR_DF_LOGIC, - init, - data, - event, + .extension = "vcd", + .description = "Value Change Dump (VCD)", + .df_type = SR_DF_LOGIC, + .init = init, + .data = data, + .event = event, }; diff --git a/output/text/ascii.c b/output/text/ascii.c index 75ab60b9..4d1611fa 100644 --- a/output/text/ascii.c +++ b/output/text/ascii.c @@ -114,10 +114,10 @@ int data_ascii(struct sr_output *o, const char *data_in, uint64_t length_in, } struct sr_output_format output_text_ascii = { - "ascii", - "ASCII (takes argument, default 74)", - SR_DF_LOGIC, - init_ascii, - data_ascii, - event, + .extension = "ascii", + .description = "ASCII (takes argument, default 74)", + .df_type = SR_DF_LOGIC, + .init = init_ascii, + .data = data_ascii, + .event = event, }; diff --git a/output/text/bits.c b/output/text/bits.c index cb8ec598..cc17a929 100644 --- a/output/text/bits.c +++ b/output/text/bits.c @@ -101,10 +101,10 @@ int data_bits(struct sr_output *o, const char *data_in, uint64_t length_in, } struct sr_output_format output_text_bits = { - "bits", - "Bits (takes argument, default 64)", - SR_DF_LOGIC, - init_bits, - data_bits, - event, + .extension = "bits", + .description = "Bits (takes argument, default 64)", + .df_type = SR_DF_LOGIC, + .init = init_bits, + .data = data_bits, + .event = event, }; diff --git a/output/text/hex.c b/output/text/hex.c index 285102ee..e4806355 100644 --- a/output/text/hex.c +++ b/output/text/hex.c @@ -90,10 +90,10 @@ int data_hex(struct sr_output *o, const char *data_in, uint64_t length_in, } struct sr_output_format output_text_hex = { - "hex", - "Hexadecimal (takes argument, default 192)", - SR_DF_LOGIC, - init_hex, - data_hex, - event, + .extension = "hex", + .description = "Hexadecimal (takes argument, default 192)", + .df_type = SR_DF_LOGIC, + .init = init_hex, + .data = data_hex, + .event = event, };