Introduction
Introduction Statistics Contact Development Disclaimer Help
vlist -> csv - ploot - simple plotting tools
git clone git://bitreich.org/ploot git://enlrupgkhuxnvlhsf6lc3fziv5h2hhfrinws65…
Log
Files
Refs
Tags
README
LICENSE
---
commit 5e3a15dfb77b6b94cba1df9918ce30c6e07d3904
parent a07960fb4acccb2f1cc7d5dab19e3ec4ffc89684
Author: Josuah Demangeon <[email protected]>
Date: Sat, 22 Feb 2020 17:29:26 +0100
vlist -> csv
Diffstat:
M ploot-braille.c | 8 +++++---
M ploot-farbfeld.c | 10 +++++-----
M src/csv.c | 12 ++++++------
M src/csv.h | 10 +++++-----
M src/scale.c | 4 ++--
M src/scale.h | 2 +-
6 files changed, 24 insertions(+), 22 deletions(-)
---
diff --git a/ploot-braille.c b/ploot-braille.c
@@ -20,7 +20,7 @@ char const *arg0 = NULL;
* a vertical and horizontal axis.
*/
int
-braille_histogram(struct vlist *vl, struct drawille *drw,
+braille_histogram(struct csv *vl, struct drawille *drw,
time_t tmin, time_t tmax, double vmin, double vmax)
{
int x, xprev, y, yprev, zero;
@@ -102,7 +102,7 @@ braille_render(struct drawille *drw, FILE *fp, double vmin,…
}
static void
-plot(struct vlist *vl, FILE *fp, size_t ncol, int row, int col)
+plot(struct csv *vl, FILE *fp, size_t ncol, int row, int col)
{
size_t len;
double vmin, vmax, vstep;
@@ -136,7 +136,7 @@ usage(void)
int
main(int argc, char **argv)
{
- struct vlist *vl;
+ struct csv *vl;
size_t ncol;
int c;
@@ -153,7 +153,9 @@ main(int argc, char **argv)
if (argc > 0)
usage();
+ debug("label");
csv_labels(stdin, &vl, &ncol);
+ debug("values");
csv_values(stdin, vl, ncol);
plot(vl, stdout, ncol, 20, 80);
diff --git a/ploot-farbfeld.c b/ploot-farbfeld.c
@@ -144,7 +144,7 @@ farbfeld_title(struct ffplot *plot,
}
static void
-farbfeld_plot(struct ffplot *plot, struct vlist *vl, struct ffcolor *color,
+farbfeld_plot(struct ffplot *plot, struct csv *vl, struct ffcolor *color,
double vmin, double vmax,
time_t tmin, time_t tmax)
{
@@ -167,7 +167,7 @@ farbfeld_plot(struct ffplot *plot, struct vlist *vl, struct…
}
static void
-farbfeld_values(struct ffplot *plot, struct vlist *vl, struct ffcolor **cl, si…
+farbfeld_values(struct ffplot *plot, struct csv *vl, struct ffcolor **cl, size…
time_t tmin, time_t tmax,
double vmin, double vmax)
{
@@ -176,7 +176,7 @@ farbfeld_values(struct ffplot *plot, struct vlist *vl, stru…
}
static void
-farbfeld_legend(struct ffplot *plot, struct ffcolor *fg, struct vlist *vl, str…
+farbfeld_legend(struct ffplot *plot, struct ffcolor *fg, struct csv *vl, struc…
{
size_t x, y;
@@ -200,7 +200,7 @@ farbfeld_legend(struct ffplot *plot, struct ffcolor *fg, st…
* x label here
*/
static void
-plot(struct vlist *vl, struct ffcolor **cl, size_t ncol, char *name, char *uni…
+plot(struct csv *vl, struct ffcolor **cl, size_t ncol, char *name, char *units)
{
struct ffplot plot = { IMAGE_W, IMAGE_H, 0, 0, NULL };
struct ffcolor plot_bg = { 0x2222, 0x2222, 0x2222, 0xffff };
@@ -279,7 +279,7 @@ usage(void)
int
main(int argc, char **argv)
{
- struct vlist *vl;
+ struct csv *vl;
struct ffcolor **cl;
size_t ncol;
int c;
diff --git a/src/csv.c b/src/csv.c
@@ -9,18 +9,18 @@
#include "tool.h"
/*
- * Read CSV data onto a set of (struct vlist).
+ * Read CSV data onto a set of (struct csv).
*/
static void
-csv_addtime(struct vlist *vl, time_t epoch)
+csv_addtime(struct csv *vl, time_t epoch)
{
assert(vl->t = realloc(vl->t, (vl->n + 1) * sizeof(*vl->t)));
vl->t[vl->n] = epoch;
}
static void
-csv_addval(struct vlist *vl, double field)
+csv_addval(struct csv *vl, double field)
{
assert(vl->v = realloc(vl->v, (vl->n + 1) * sizeof(*vl->v)));
vl->v[vl->n] = field;
@@ -31,7 +31,7 @@ csv_addval(struct vlist *vl, double field)
* buffer is shared among all fields.
*/
void
-csv_addrow(struct vlist *vl, size_t ncol, char *line)
+csv_addrow(struct csv *vl, size_t ncol, char *line)
{
char *field;
time_t *tbuf;
@@ -58,7 +58,7 @@ csv_addrow(struct vlist *vl, size_t ncol, char *line)
* epoch,label1,label2,label3
*/
void
-csv_labels(FILE *fp, struct vlist **vl, size_t *ncol)
+csv_labels(FILE *fp, struct csv **vl, size_t *ncol)
{
char *field, *line, *cp, *label;
size_t sz;
@@ -92,7 +92,7 @@ csv_labels(FILE *fp, struct vlist **vl, size_t *ncol)
* epoch,a3,b3,c3 v
*/
void
-csv_values(FILE *fp, struct vlist *vl, size_t ncol)
+csv_values(FILE *fp, struct csv *vl, size_t ncol)
{
char *line;
size_t sz;
diff --git a/src/csv.h b/src/csv.h
@@ -5,9 +5,9 @@
/*
* List of values and timestamps. Both have their dedicated buffer
- * so that the timestamp buffer can be shared across vlist objects.
+ * so that the timestamp buffer can be shared across csv objects.
*/
-struct vlist {
+struct csv {
time_t *t; /* array of timestamps */
double *v; /* array of values */
size_t n; /* number of values */
@@ -15,8 +15,8 @@ struct vlist {
};
/**/
-void csv_addrow (struct vlist *, size_t, char *);
-void csv_labels (FILE *, struct vlist **, size_t…
-void csv_values (FILE *, struct vlist *, size_t);
+void csv_addrow (struct csv *, size_t, char *);
+void csv_labels (FILE *, struct csv **, size_t *…
+void csv_values (FILE *, struct csv *, size_t);
#endif
diff --git a/src/scale.c b/src/scale.c
@@ -32,7 +32,7 @@ scale_xpos(time_t t, time_t t1, time_t t2, int szx)
}
static void
-scale_minmax(struct vlist *vl, int ncol,
+scale_minmax(struct csv *vl, int ncol,
time_t *tmin, time_t *tmax,
double *vmin, double *vmax)
{
@@ -131,7 +131,7 @@ scale_vminmax(double *min, double *max, int row)
}
void
-scale(struct vlist *vl, int ncol,
+scale(struct csv *vl, int ncol,
time_t *tmin, time_t *tmax, time_t *tstep,
double *vmin, double *vmax, double *vstep)
{
diff --git a/src/scale.h b/src/scale.h
@@ -13,6 +13,6 @@
int scale_ypos (double, double, double, int);
int scale_xpos (time_t, time_t, time_t, int);
void scale_vminmax (double *, double *, int);
-void scale (struct vlist *, int, time_t …
+void scale (struct csv *, int, time_t *,…
#endif
You are viewing proxied material from bitreich.org. The copyright of proxied material belongs to its original authors. Any comments or complaints in relation to proxied material should be directed to the original authors of the content concerned. Please see the disclaimer for more details.