From: Uwe Hermann Date: Tue, 30 Oct 2012 19:30:25 +0000 (+0100) Subject: Remove 'float' output module. X-Git-Tag: dsupstream~607 X-Git-Url: https://sigrok.org/gitweb/?p=libsigrok.git;a=commitdiff_plain;h=db7d0626c918209db0ba5dc6e896232c8c2e4f6c Remove 'float' output module. This has been replaced by the 'analog' output module. --- diff --git a/output/Makefile.am b/output/Makefile.am index 44b4bd4d..0d3f8450 100644 --- a/output/Makefile.am +++ b/output/Makefile.am @@ -29,7 +29,6 @@ libsigrokoutput_la_SOURCES = \ gnuplot.c \ chronovu_la8.c \ csv.c \ - float.c \ analog.c \ output.c diff --git a/output/float.c b/output/float.c deleted file mode 100644 index 7812413d..00000000 --- a/output/float.c +++ /dev/null @@ -1,150 +0,0 @@ -/* - * This file is part of the sigrok project. - * - * Copyright (C) 2012 Bert Vermeulen - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ - -#include -#include -#include -#include "libsigrok.h" -#include "libsigrok-internal.h" - -struct context { - unsigned int num_enabled_probes; - GPtrArray *probelist; -}; - -static int init(struct sr_output *o) -{ - struct context *ctx; - struct sr_probe *probe; - GSList *l; - - if (!o) - return SR_ERR_ARG; - - if (!o->sdi) - return SR_ERR_ARG; - - if (!o->sdi->driver) - return SR_ERR_ARG; - - if (!(ctx = g_try_malloc0(sizeof(struct context)))) { - sr_err("output/float: Context malloc failed."); - return SR_ERR_MALLOC; - } - - o->internal = ctx; - - /* Get the number of probes and their names. */ - ctx->probelist = g_ptr_array_new(); - for (l = o->sdi->probes; l; l = l->next) { - probe = l->data; - if (!probe || !probe->enabled) - continue; - g_ptr_array_add(ctx->probelist, probe->name); - ctx->num_enabled_probes++; - } - - return SR_OK; -} - -static int event(struct sr_output *o, int event_type, uint8_t **data_out, - uint64_t *length_out) -{ - struct context *ctx; - - if (!o) - return SR_ERR_ARG; - - if (!(ctx = o->internal)) - return SR_ERR_ARG; - - if (!data_out) - return SR_ERR_ARG; - - switch (event_type) { - case SR_DF_FRAME_BEGIN: - *data_out = (uint8_t *)g_strdup("FRAME-BEGIN\n"); - *length_out = 12; - break; - case SR_DF_FRAME_END: - *data_out = (uint8_t *)g_strdup("FRAME-END\n"); - *length_out = 10; - break; - case SR_DF_END: - *data_out = NULL; - *length_out = 0; - g_ptr_array_free(ctx->probelist, TRUE); - g_free(o->internal); - o->internal = NULL; - break; - default: - /* Ignore everything else. */ - *data_out = NULL; - *length_out = 0; - break; - } - - return SR_OK; -} - -static int data(struct sr_output *o, const uint8_t *data_in, - uint64_t length_in, uint8_t **data_out, uint64_t *length_out) -{ - struct context *ctx; - GString *outstr; - float *fdata; - uint64_t max, i; - unsigned int j; - - if (!o) - return SR_ERR_ARG; - - if (!(ctx = o->internal)) - return SR_ERR_ARG; - - if (!data_in || !data_out) - return SR_ERR_ARG; - - outstr = g_string_sized_new(512); - - fdata = (float *)data_in; - max = length_in / sizeof(float); - for (i = 0; i < max;) { - for (j = 0; j < ctx->num_enabled_probes; j++) { - g_string_append_printf(outstr, "%s: %.12f\n", - (char *)g_ptr_array_index(ctx->probelist, j), - fdata[i++]); - } - } - - *data_out = (uint8_t *)outstr->str; - *length_out = outstr->len; - g_string_free(outstr, FALSE); - - return SR_OK; -} - -SR_PRIV struct sr_output_format output_float = { - .id = "float", - .description = "Floating point", - .df_type = SR_DF_ANALOG, - .init = init, - .data = data, - .event = event, -}; diff --git a/output/output.c b/output/output.c index d726ad93..91fdf388 100644 --- a/output/output.c +++ b/output/output.c @@ -44,7 +44,6 @@ extern SR_PRIV struct sr_output_format output_ols; extern SR_PRIV struct sr_output_format output_gnuplot; extern SR_PRIV struct sr_output_format output_chronovu_la8; extern SR_PRIV struct sr_output_format output_csv; -extern SR_PRIV struct sr_output_format output_float; extern SR_PRIV struct sr_output_format output_analog; /* extern SR_PRIV struct sr_output_format output_analog_gnuplot; */ /* @endcond */ @@ -59,7 +58,6 @@ static struct sr_output_format *output_module_list[] = { &output_gnuplot, &output_chronovu_la8, &output_csv, - &output_float, &output_analog, /* &output_analog_gnuplot, */ NULL,