Uwe Hermann | a1bb33a | 2010-04-02 20:18:27 +0200 | [diff] [blame] | 1 | /* |
Uwe Hermann | 50985c2 | 2013-04-23 22:24:30 +0200 | [diff] [blame] | 2 | * This file is part of the libsigrok project. |
Uwe Hermann | a1bb33a | 2010-04-02 20:18:27 +0200 | [diff] [blame] | 3 | * |
Bert Vermeulen | c73d2ea | 2012-02-13 14:31:51 +0100 | [diff] [blame] | 4 | * Copyright (C) 2010-2012 Bert Vermeulen <bert@biot.com> |
Uwe Hermann | a1bb33a | 2010-04-02 20:18:27 +0200 | [diff] [blame] | 5 | * |
| 6 | * This program is free software: you can redistribute it and/or modify |
| 7 | * it under the terms of the GNU General Public License as published by |
| 8 | * the Free Software Foundation, either version 3 of the License, or |
| 9 | * (at your option) any later version. |
| 10 | * |
| 11 | * This program is distributed in the hope that it will be useful, |
| 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 14 | * GNU General Public License for more details. |
| 15 | * |
| 16 | * You should have received a copy of the GNU General Public License |
| 17 | * along with this program. If not, see <http://www.gnu.org/licenses/>. |
| 18 | */ |
| 19 | |
Bert Vermeulen | 45c59c8 | 2012-07-05 00:55:07 +0200 | [diff] [blame] | 20 | #include "libsigrok.h" |
| 21 | #include "libsigrok-internal.h" |
Uwe Hermann | a1bb33a | 2010-04-02 20:18:27 +0200 | [diff] [blame] | 22 | |
Uwe Hermann | 7b870c3 | 2012-10-21 16:13:36 +0200 | [diff] [blame] | 23 | /** |
Uwe Hermann | 393fb9c | 2012-10-22 00:30:12 +0200 | [diff] [blame] | 24 | * @file |
| 25 | * |
| 26 | * Output file/data format handling. |
| 27 | */ |
| 28 | |
| 29 | /** |
Uwe Hermann | 7b870c3 | 2012-10-21 16:13:36 +0200 | [diff] [blame] | 30 | * @defgroup grp_output Output formats |
| 31 | * |
| 32 | * Output file/data format handling. |
| 33 | * |
Uwe Hermann | 07e1aad | 2013-02-22 15:12:32 +0100 | [diff] [blame] | 34 | * libsigrok supports several output (file) formats, e.g. binary, VCD, |
| 35 | * gnuplot, and so on. It provides an output API that frontends can use. |
| 36 | * New output formats can be added/implemented in libsigrok without having |
| 37 | * to change the frontends at all. |
| 38 | * |
| 39 | * All output modules are fed data in a stream. Devices that can stream data |
| 40 | * into libsigrok live, instead of storing and then transferring the whole |
| 41 | * buffer, can thus generate output live. |
| 42 | * |
| 43 | * Output modules are responsible for allocating enough memory to store |
| 44 | * their own output, and passing a pointer to that memory (and length) of |
| 45 | * the allocated memory back to the caller. The caller is then expected to |
| 46 | * free this memory when finished with it. |
| 47 | * |
Uwe Hermann | 7b870c3 | 2012-10-21 16:13:36 +0200 | [diff] [blame] | 48 | * @{ |
| 49 | */ |
| 50 | |
Uwe Hermann | b4bd708 | 2012-10-19 10:07:22 +0200 | [diff] [blame] | 51 | /** @cond PRIVATE */ |
Uwe Hermann | 7c1d391 | 2012-02-04 10:56:51 +0100 | [diff] [blame] | 52 | extern SR_PRIV struct sr_output_format output_text_bits; |
| 53 | extern SR_PRIV struct sr_output_format output_text_hex; |
| 54 | extern SR_PRIV struct sr_output_format output_text_ascii; |
| 55 | extern SR_PRIV struct sr_output_format output_binary; |
| 56 | extern SR_PRIV struct sr_output_format output_vcd; |
Bert Vermeulen | f1b296f | 2013-12-16 01:31:46 +0100 | [diff] [blame] | 57 | |
Uwe Hermann | 7c1d391 | 2012-02-04 10:56:51 +0100 | [diff] [blame] | 58 | extern SR_PRIV struct sr_output_format output_csv; |
Bert Vermeulen | 161a8a2 | 2012-09-08 13:24:48 +0200 | [diff] [blame] | 59 | extern SR_PRIV struct sr_output_format output_analog; |
Uwe Hermann | 7c1d391 | 2012-02-04 10:56:51 +0100 | [diff] [blame] | 60 | /* extern SR_PRIV struct sr_output_format output_analog_gnuplot; */ |
Uwe Hermann | b4bd708 | 2012-10-19 10:07:22 +0200 | [diff] [blame] | 61 | /* @endcond */ |
Uwe Hermann | a1bb33a | 2010-04-02 20:18:27 +0200 | [diff] [blame] | 62 | |
Uwe Hermann | f50f3f4 | 2011-01-29 16:36:57 +0100 | [diff] [blame] | 63 | static struct sr_output_format *output_module_list[] = { |
Uwe Hermann | 02076d6 | 2010-04-12 23:21:12 +0200 | [diff] [blame] | 64 | &output_text_bits, |
Uwe Hermann | a1bb33a | 2010-04-02 20:18:27 +0200 | [diff] [blame] | 65 | &output_text_hex, |
HÃ¥vard Espeland | d4f228d | 2011-01-17 22:56:14 +0100 | [diff] [blame] | 66 | &output_text_ascii, |
Uwe Hermann | 1c5b9d3 | 2010-04-12 21:22:58 +0200 | [diff] [blame] | 67 | &output_binary, |
Uwe Hermann | 4c9ffa8 | 2010-04-04 13:19:20 +0200 | [diff] [blame] | 68 | &output_vcd, |
Uwe Hermann | 02604ed | 2011-04-26 23:56:00 +0200 | [diff] [blame] | 69 | &output_csv, |
Bert Vermeulen | 161a8a2 | 2012-09-08 13:24:48 +0200 | [diff] [blame] | 70 | &output_analog, |
Uwe Hermann | 77b4544 | 2011-02-20 13:08:44 +0100 | [diff] [blame] | 71 | /* &output_analog_gnuplot, */ |
Uwe Hermann | 4c9ffa8 | 2010-04-04 13:19:20 +0200 | [diff] [blame] | 72 | NULL, |
Uwe Hermann | a1bb33a | 2010-04-02 20:18:27 +0200 | [diff] [blame] | 73 | }; |
| 74 | |
Uwe Hermann | 1a081ca | 2012-02-01 23:40:35 +0100 | [diff] [blame] | 75 | SR_API struct sr_output_format **sr_output_list(void) |
Uwe Hermann | a1bb33a | 2010-04-02 20:18:27 +0200 | [diff] [blame] | 76 | { |
Uwe Hermann | a1bb33a | 2010-04-02 20:18:27 +0200 | [diff] [blame] | 77 | return output_module_list; |
| 78 | } |
Uwe Hermann | 7b870c3 | 2012-10-21 16:13:36 +0200 | [diff] [blame] | 79 | |
| 80 | /** @} */ |