From 6fe2c54cfb33fcd0ffe1a8406129113286943aeb Mon Sep 17 00:00:00 2001 From: tth Date: Thu, 10 Jan 2019 01:44:47 +0100 Subject: [PATCH] boilerplate for ncurses interface --- viz/curses/7segments.c | 21 ++++++++++++ viz/curses/Makefile | 21 ++++++++++++ viz/curses/README.md | 2 ++ viz/curses/ecran.c | 50 +++++++++++++++++++++++++++++ viz/curses/ecran.h | 6 ++++ viz/curses/t.c | 73 ++++++++++++++++++++++++++++++++++++++++++ viz/curses/waterfall.c | 59 ++++++++++++++++++++++++++++++++++ 7 files changed, 232 insertions(+) create mode 100644 viz/curses/7segments.c create mode 100644 viz/curses/Makefile create mode 100644 viz/curses/README.md create mode 100644 viz/curses/ecran.c create mode 100644 viz/curses/ecran.h create mode 100644 viz/curses/t.c create mode 100644 viz/curses/waterfall.c diff --git a/viz/curses/7segments.c b/viz/curses/7segments.c new file mode 100644 index 0000000..fd45595 --- /dev/null +++ b/viz/curses/7segments.c @@ -0,0 +1,21 @@ +/* + * DD2 Monitoring + * + * ncurses seven segment display + */ + +#include +#include +#include +#include +#include + + +#include "ecran.h" + +int verbosity; + +/* ---------------------------------------------------------------- */ + +/* ---------------------------------------------------------------- */ + diff --git a/viz/curses/Makefile b/viz/curses/Makefile new file mode 100644 index 0000000..63d91f6 --- /dev/null +++ b/viz/curses/Makefile @@ -0,0 +1,21 @@ + + +# --------------- *** + +ecran.o: ecran.c Makefile ecran.h + gcc -Wall -c $< + +7segments.o: 7segments.c Makefile + gcc -Wall -c $< + +waterfall.o: waterfall.c Makefile + gcc -Wall -c $< + +# --------------- *** + +OBJ = ecran.o waterfall.o 7segments.o + +t: t.c Makefile $(OBJ) ecran.h + gcc -Wall $< $(OBJ) -lncurses -o $@ + +# --------------- *** diff --git a/viz/curses/README.md b/viz/curses/README.md new file mode 100644 index 0000000..4169e43 --- /dev/null +++ b/viz/curses/README.md @@ -0,0 +1,2 @@ +# Dataviz with AsciiArt + diff --git a/viz/curses/ecran.c b/viz/curses/ecran.c new file mode 100644 index 0000000..46a8ec5 --- /dev/null +++ b/viz/curses/ecran.c @@ -0,0 +1,50 @@ +#include +#include +#include +#include +#include + + +#include "ecran.h" + +int verbosity; + +/* ---------------------------------------------------------------- */ +/* ---------------------------------------------------------------- */ +void barre_inverse(char c, int ligne) +{ +int foo; +standout(); +for (foo=0; foo +#include +#include +#include +#include +#include + +#include "ecran.h" + +int verbosity; + +/* ---------------------------------------------------------------- */ +void demo(int nbl, int k) +{ +int loop; +char line[100]; +WINDOW *water; + +water = open_waterfall("premier essai", 0); + +for (loop=0; loop +#include +#include +#include +#include + + +#include "ecran.h" + +extern int verbosity; + +/* ---------------------------------------------------------------- */ +WINDOW *open_waterfall(char *title, int flags) +{ +WINDOW *win; +int l, c, w, h; + +l = 2; c = 1; +w = COLS - 2; h = LINES -3; + +win = newwin(h, w, l, c); + +return win; +} +/* ---------------------------------------------------------------- */ +int plot_waterfall(WINDOW *wf, float values[4]) +{ +#define TL 1000 +int foo; +char tag, ligne[TL+1]; + +for(foo=0; foo