From 00920841d248b22694a2934381512bf6da115bde Mon Sep 17 00:00:00 2001 From: tTh Date: Fri, 17 Mar 2023 10:33:53 +0100 Subject: [PATCH] commit before morning nap --- functions/.gitignore | 4 +++ functions/8x8thin | Bin 0 -> 2048 bytes functions/Makefile | 24 +++++++++++-- functions/bigchars.c | 44 +++++++++++++++++++++++ functions/mkbigchars.c | 77 ++++++++++++++++++++++++++++++++++++++++ functions/ncursefuncs.h | 6 ++++ functions/t.c | 21 +++++++++++ showbuttons.c | 4 +-- text2osc.c | 4 +-- 9 files changed, 178 insertions(+), 6 deletions(-) create mode 100644 functions/.gitignore create mode 100644 functions/8x8thin create mode 100644 functions/bigchars.c create mode 100644 functions/mkbigchars.c create mode 100644 functions/t.c diff --git a/functions/.gitignore b/functions/.gitignore new file mode 100644 index 0000000..e38a17d --- /dev/null +++ b/functions/.gitignore @@ -0,0 +1,4 @@ + +mkbigchars +t + diff --git a/functions/8x8thin b/functions/8x8thin new file mode 100644 index 0000000000000000000000000000000000000000..3f9caa3dcb79801e31e3acd9b243224755102c3d GIT binary patch literal 2048 zcmYjSy=xpt6o0HYVv9u@jstITK~B_D-an`q*O#y*B7VIuSsody{)J|Jw7=( zKCPE-ee~h7LF;)+1HNtr;1mYCpF~>_$ScQm-(or=^Sv${j z1D0&p+X*H{SE z9IH4ksTCuyxJ8pBj^kuPChlaN*f=hC?D#kF$Asm@G)-s>P)3Ws?_;58oOIGovPC-* zgn3&}2J0XiZw`B`k9a}K`jfE7c&Kh!+(}*lqwW}=4p3L*Z`Fa>NZbsV4+et=#Go0k zTh4k@uFLY2CI~;zC$!7i`yNf$OfVtQDfZ{f0A34Q82PM7#s=AI8YV+T;9* zp0BRnMFHr+#>VIVBIB4Lby0xQwNWDk#;o2$aF;*0%^wZdK~8QQ@eq|*@{&R!MnZ&` zZ}$eJL9h@6DXnfmm5HmiK6P1!o}z+^qUcfx3FoPF<||;VtmWy9iy23K@?0&n6xxsV zc}1D0Gmf2O*R9-lbxCJfqtUp}qKFkW{FO38yhQiIwc-)AlVVyFU!xx}&h@daqOiXl zh8%^k*m8{XIw-cQlgL6I4}xxxD7jLz_t z{{gxzXD(pnk|%?lT_M`|W*4=U+D*YwwDGWr<&3deKy52$d$;-3ylv+bwS~jiR-b2G z&&FBKnC*H+Hn9Bww9Utn0b{_MPFvu*vt9}8iB9#4BVUW0Q~E-qwd^;i?q8L@~z zFK4tgBbGV!m0>Yl;q6}P5-VtQ4kB86%w7OxBsCVCy8V7X#da%-U-EpH?r-pcLZ#qN z5T$Kv^q+0RWE6+caM2wd9gVPW@bkm}2n~rF|052{5=-3&-b)cl`$A6ar~=s!`}z-E Cg^Z*C literal 0 HcmV?d00001 diff --git a/functions/Makefile b/functions/Makefile index 6925e13..e43db14 100644 --- a/functions/Makefile +++ b/functions/Makefile @@ -6,7 +6,7 @@ all: libpocosc.a -OPTS = -Wall -g -DDEBUG_LEVEL=1 +OPTS = -Wall -g -DDEBUG_LEVEL=0 senders.o: senders.c senders.h Makefile gcc ${OPTS} -c $< @@ -23,6 +23,26 @@ joyutils.o: joyutils.c joyutils.h Makefile ncursefuncs.o: ncursefuncs.c ncursefuncs.h Makefile gcc ${OPTS} -c $< +# + libpocosc.a: senders.o alsaseq.o serial.o ncursefuncs.o \ - joyutils.o + joyutils.o bigchars.o ar r $@ $? + +# + +mkbigchars: mkbigchars.c Makefile + gcc ${OPTS} $< -o $@ + +chars8x8.def: mkbigchars Makefile + ./mkbigchars 8x8thin $@ + +bigchars.o: bigchars.c chars8x8.def ncursefuncs.h Makefile + gcc ${OPTS} -c $< + +# programmes de test + +t: t.c Makefile libpocosc.a ncursefuncs.h + gcc $(OPTS) $< libpocosc.a -o $@ + + diff --git a/functions/bigchars.c b/functions/bigchars.c new file mode 100644 index 0000000..10f09b2 --- /dev/null +++ b/functions/bigchars.c @@ -0,0 +1,44 @@ +/* + ! ncurses widgets for poc-osc + ! + ! nnnnn n nnnn + ! n n n n n + ! nnnnn n n + ! n n n n nnn + ! n n n n n + ! nnnnn n nnnn + ! + ! + ! nnnn n n nn nnnnn nnnn + ! n n n n n n n n n + ! n nnnnnn n n n n nnnn + ! n n n nnnnnn nnnnn n + ! n n n n n n n n n n + ! nnnn n n n n n n nnnn + ! +*/ + +#include +#include +#include +#include +#include + +#include "ncursefuncs.h" + +/* XXX */ +#include "chars8x8.def" + +extern int verbosity; /* to be declared public near main() */ + +/* ----------------------------------------------------------------- */ +/* ----------------------------------------------------------------- */ + +int essai_bigchars(char *texte, int stand) +{ + +fprintf(stderr, ">>> %s ( '%s' %d )\n", __func__, texte, stand); + +return -1; +} +/* ----------------------------------------------------------------- */ diff --git a/functions/mkbigchars.c b/functions/mkbigchars.c new file mode 100644 index 0000000..709ba12 --- /dev/null +++ b/functions/mkbigchars.c @@ -0,0 +1,77 @@ +/* + * + */ + +#include +#include +#include +#include + +/* ----------------------------------------------------------------- */ +int make_bigfont_def(char *input, char *deffile) +{ +FILE *fp; +int fd, idx, foo; +unsigned char buffer[2048]; + +fprintf(stderr, ">>> %s ( '%s' '%s' )\n", __func__, input, deffile); + +/* + * load the binary font datas + */ +fd = open(input, O_RDONLY, 0); +if (-1 == fd) { + perror(input); + exit(1); + } +foo = read(fd, buffer, 2048); +if (2048 != foo) { + fprintf(stderr, "%s: read %d bytes, 2048 expected\n", __func__, foo); + close(fd); + return 1; + } +close(fd); + +/* + * write the definition file as a .h c-file + */ +fp = fopen(deffile, "w"); +if (NULL == fp) { + perror(deffile); + exit(1); + } + +fprintf(fp, "/*\n * ! ! ! GENERATED FILE ! ! !\n*/\n"); + +for (idx=0; idx-256; idx++) { + fprintf(fp, "/*\n *\t***\t%3d 0x%02x\n */\n", idx, idx); + + fprintf(fp, "\n"); + } + +fprintf(fp, "/* yolo? */\n"); + +fclose(fp); + +return 0; +} +/* ----------------------------------------------------------------- */ +int main(int argc, char *argv[]) +{ +int foo; + +if (3 != argc) { + fprintf(stderr, "ERR: %s need two filenames\n", argv[0]); + exit(1); + } + +foo = make_bigfont_def(argv[1], argv[2]); + +if (foo) { + fprintf(stderr, "got %d from font converter.\n", foo); + exit(1); + } + +return 0; +} +/* ----------------------------------------------------------------- */ diff --git a/functions/ncursefuncs.h b/functions/ncursefuncs.h index 390ed7a..afb1e77 100644 --- a/functions/ncursefuncs.h +++ b/functions/ncursefuncs.h @@ -13,3 +13,9 @@ int erase_error_message(int ascii); /* warning: only use the bit 0 of the 'state' arg */ int draw_a_button(WINDOW *w, int lig, int col, char *txt, int state); + +/* + * bigchars.c + */ + +int essai_bigchars(char *texte, int stand); diff --git a/functions/t.c b/functions/t.c new file mode 100644 index 0000000..25cf749 --- /dev/null +++ b/functions/t.c @@ -0,0 +1,21 @@ +/* + * + */ + +#include +#include + +#include "ncursefuncs.h" + +/* ----------------------------------------------------------------- */ + +int main(int argc, char *argv[]) +{ +int foo; + +foo = essai_bigchars("foo", 0); +fprintf(stderr, " essai bigchars -> %d\n", foo); + +return 0; +} +/* ----------------------------------------------------------------- */ diff --git a/showbuttons.c b/showbuttons.c index 3cb0ae0..8bbcf52 100644 --- a/showbuttons.c +++ b/showbuttons.c @@ -273,7 +273,7 @@ if (foo) { /* set up the pretty screen user interface */ foo = initcurses(); -sprintf(ligne, ":%s ", local_port); +sprintf(ligne, "showbuttons port=%s ", local_port); foo = draw_main_screen(ligne, 0); if (foo) { endwin(); @@ -301,7 +301,7 @@ fprintf(stderr, "pid %d: osc server thread started\n", getpid()); sprintf(ligne, "process %d on board, captain ", getpid()); blast_error_message(ligne, 0, 0); sleep(1); -erase_error_message('-'); +erase_error_message(' '); for (;;) { /* wait for un event from liblo threads */ diff --git a/text2osc.c b/text2osc.c index 1feafe1..e56a5c3 100644 --- a/text2osc.c +++ b/text2osc.c @@ -17,7 +17,7 @@ int verbosity = 0; char *my_id = MY_TEXT_ID; -int wait_time = 100; /* in milliseconds */ +int wait_time = 80; /* in milliseconds */ /* ----------------------------------------------------------------- */ int megaloop(FILE *fp, lo_address loa) @@ -38,7 +38,7 @@ while (EOF != (caractere=getc(fp))) { char_count++; - if (verbosity) fprintf(stderr, "car = %4d %c\n", + if (verbosity) fprintf(stderr, "char = %4d %c\n", caractere, caractere); if (isalpha(caractere)) {