diff --git a/.gitignore b/.gitignore index e95e035..3cb5414 100644 --- a/.gitignore +++ b/.gitignore @@ -70,4 +70,6 @@ Fonderie/*.gif Fonderie/fonderie Fonderie/interpolator Fonderie/t +Fonderie/crapdef.h +Fonderie/crapstr.h diff --git a/Fonderie/Makefile b/Fonderie/Makefile index 9541db8..3a379f6 100644 --- a/Fonderie/Makefile +++ b/Fonderie/Makefile @@ -10,7 +10,7 @@ OBJS = fonctions.o sfx.o crapulator.o glitches.o metriques.o \ filterstack.o DEPS = fonctions.h crapulator.h metriques.h glitches.h sfx.h \ - filterstack.h + filterstack.h crapdef.h crapstr.h all: fonderie interpolator t @@ -31,6 +31,16 @@ fonderie: fonderie.c ${DEPS} ${OBJS} Makefile interpolator: interpolator.c ${DEPS} ${OBJS} Makefile gcc ${COPT} $< ${OBJS} ${LIBS} -lz -o $@ +# --------------------------------------------------------- +# +# some files are generated, sorry. +# +crapdef.h: crapulors.liste Makefile craplist2h.awk + ./craplist2h.awk < $< | tee $@ + +crapstr.h: crapulors.liste Makefile craplist2str.awk + ./craplist2str.awk < $< | tee $@ + # --------------------------------------------------------- # # a lot of silly functions diff --git a/Fonderie/craplist2h.awk b/Fonderie/craplist2h.awk new file mode 100755 index 0000000..f97e2c0 --- /dev/null +++ b/Fonderie/craplist2h.awk @@ -0,0 +1,13 @@ +#!/usr/bin/awk -f + +BEGIN { + print "// generated file, do not edit by hand !" + } + + { + printf "#define CR_%s %d\n", $2, $1 + } + +END { + print "// generated file, do not edit by hand !" + } diff --git a/Fonderie/craplist2str.awk b/Fonderie/craplist2str.awk new file mode 100755 index 0000000..33aa7f4 --- /dev/null +++ b/Fonderie/craplist2str.awk @@ -0,0 +1,13 @@ +#!/usr/bin/awk -f + +BEGIN { + print "// generated file, do not edit by hand" + } + + { + printf "char str_%s[] = \"%s\" ;\t\t// %d\n", $2, $2, $1 + } + +END { + print "// generated file, do not edit by hand" + } diff --git a/Fonderie/crapulator.c b/Fonderie/crapulator.c index 73703a4..97e34cc 100644 --- a/Fonderie/crapulator.c +++ b/Fonderie/crapulator.c @@ -241,6 +241,32 @@ typedef struct { int flags; } Crapulor; +#include "crapstr.h" + +Crapulor CrapL[] = { + { CR_none, str_none }, + { CR_cos01, str_cos01 }, + { CR_cos010, str_cos010 }, + { CR_fx3, str_fx3 }, + { CR_end, str_end } + }; + +#define NBCRAP (sizeof(CrapL)/sizeof(Crapulor)) + +void list_crapulors(char *texte) +{ +int idx; + +for (idx=0; idx