X-Git-Url: https://sigrok.org/gitweb/?a=blobdiff_plain;f=output%2Ftext%2Fbits.c;h=1d9181849e720d5b65c45ab0afc7f422375162d3;hb=cd315a80d87a24a19a7846497d74c5ca85d494a0;hp=c124ece5a6c5f596c313ce0318a9690e87695336;hpb=97554432e8d8bcf7f5af2dd770bcf752c9cd7d75;p=libsigrok.git diff --git a/output/text/bits.c b/output/text/bits.c index c124ece5..1d918184 100644 --- a/output/text/bits.c +++ b/output/text/bits.c @@ -21,17 +21,17 @@ #include #include #include -#include +#include "sigrok.h" +#include "sigrok-internal.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); } -int data_bits(struct output *o, char *data_in, uint64_t length_in, - char **data_out, uint64_t *length_out) +int data_bits(struct sr_output *o, const char *data_in, uint64_t length_in, + char **data_out, uint64_t *length_out) { struct context *ctx; unsigned int outsize, offset, p; @@ -40,7 +40,7 @@ int data_bits(struct output *o, char *data_in, uint64_t length_in, char *outbuf, c; ctx = o->internal; - max_linelen = MAX_PROBENAME_LEN + 3 + ctx->samples_per_line + max_linelen = SR_MAX_PROBENAME_LEN + 3 + ctx->samples_per_line + ctx->samples_per_line / 8; /* * Calculate space needed for probes. Set aside 512 bytes for @@ -50,7 +50,7 @@ int data_bits(struct output *o, char *data_in, uint64_t length_in, * (ctx->num_enabled_probes * max_linelen); if (!(outbuf = calloc(1, outsize + 1))) - return SIGROK_ERR_MALLOC; + return SR_ERR_MALLOC; outbuf[0] = '\0'; if (ctx->header) { @@ -92,22 +92,20 @@ int data_bits(struct output *o, char *data_in, uint64_t length_in, } } } else { - g_message("short buffer (length_in=%" PRIu64 ")", length_in); + sr_info("short buffer (length_in=%" PRIu64 ")", length_in); } *data_out = outbuf; *length_out = strlen(outbuf); - return SIGROK_OK; + return SR_OK; } - -struct output_format output_text_bits = { - "bits", - "Bits (takes argument, default 64)", - DF_LOGIC, - init_bits, - data_bits, - event, +struct sr_output_format output_text_bits = { + .id = "bits", + .description = "Bits (takes argument, default 64)", + .df_type = SR_DF_LOGIC, + .init = init_bits, + .data = data_bits, + .event = event, }; -