commit before morning nap

This commit is contained in:
tTh 2023-03-17 10:33:53 +01:00
parent f804d2c7ab
commit 00920841d2
9 changed files with 178 additions and 6 deletions

4
functions/.gitignore vendored Normal file
View File

@ -0,0 +1,4 @@
mkbigchars
t

BIN
functions/8x8thin Normal file

Binary file not shown.

View File

@ -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 $@

44
functions/bigchars.c Normal file
View File

@ -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 <stdio.h>
#include <stdlib.h>
#include <curses.h>
#include <signal.h>
#include <locale.h>
#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;
}
/* ----------------------------------------------------------------- */

77
functions/mkbigchars.c Normal file
View File

@ -0,0 +1,77 @@
/*
*
*/
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <fcntl.h>
/* ----------------------------------------------------------------- */
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;
}
/* ----------------------------------------------------------------- */

View File

@ -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);

21
functions/t.c Normal file
View File

@ -0,0 +1,21 @@
/*
*
*/
#include <stdio.h>
#include <stdlib.h>
#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;
}
/* ----------------------------------------------------------------- */

View File

@ -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 */

View File

@ -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)) {