complicated build system is mandatory

This commit is contained in:
tonton th 2020-12-29 16:40:26 +01:00
parent f39f7ec830
commit 1693ad9051
8 changed files with 89 additions and 3 deletions

2
.gitignore vendored
View File

@ -70,4 +70,6 @@ Fonderie/*.gif
Fonderie/fonderie Fonderie/fonderie
Fonderie/interpolator Fonderie/interpolator
Fonderie/t Fonderie/t
Fonderie/crapdef.h
Fonderie/crapstr.h

View File

@ -10,7 +10,7 @@ OBJS = fonctions.o sfx.o crapulator.o glitches.o metriques.o \
filterstack.o filterstack.o
DEPS = fonctions.h crapulator.h metriques.h glitches.h sfx.h \ DEPS = fonctions.h crapulator.h metriques.h glitches.h sfx.h \
filterstack.h filterstack.h crapdef.h crapstr.h
all: fonderie interpolator t all: fonderie interpolator t
@ -31,6 +31,16 @@ fonderie: fonderie.c ${DEPS} ${OBJS} Makefile
interpolator: interpolator.c ${DEPS} ${OBJS} Makefile interpolator: interpolator.c ${DEPS} ${OBJS} Makefile
gcc ${COPT} $< ${OBJS} ${LIBS} -lz -o $@ 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 # a lot of silly functions

13
Fonderie/craplist2h.awk Executable file
View File

@ -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 !"
}

13
Fonderie/craplist2str.awk Executable file
View File

@ -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"
}

View File

@ -241,6 +241,32 @@ typedef struct {
int flags; int flags;
} Crapulor; } 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<NBCRAP; idx++) {
fprintf(stderr, "%3d : %3d %-12s %5d %f\n", idx,
CrapL[idx].id,
CrapL[idx].name,
CrapL[idx].ipar,
CrapL[idx].fpar);
}
}
/* -------------------------------------------------------------- */ /* -------------------------------------------------------------- */
char * crap_name_from_number(int num) char * crap_name_from_number(int num)
{ {

View File

@ -10,5 +10,10 @@
int crapulator(FloatImg *image, int id_effect, float fparam); int crapulator(FloatImg *image, int id_effect, float fparam);
void list_crapulors(char *texte);
char *crap_name_from_number(int num); char *crap_name_from_number(int num);
int crap_number_from_name(char *name); int crap_number_from_name(char *name);
#include "crapdef.h"

5
Fonderie/crapulors.liste Normal file
View File

@ -0,0 +1,5 @@
0 none
1 cos01
2 cos010
3 fx3
-1 end

View File

@ -11,6 +11,7 @@
#include "glitches.h" #include "glitches.h"
#include "sfx.h" #include "sfx.h"
#include "filterstack.h" #include "filterstack.h"
#include "crapulator.h"
/* ----------------------------------------------------------- */ /* ----------------------------------------------------------- */
@ -69,6 +70,14 @@ int help(void)
{ {
puts("yolo!"); puts("yolo!");
exit(0); exit(0);
}
/* ----------------------------------------------------------- */
void experiment(void)
{
fprintf(stderr, "EXPERIMENT\n");
list_crapulors("experiment");
} }
/* ----------------------------------------------------------- */ /* ----------------------------------------------------------- */
@ -77,16 +86,19 @@ int main(int argc, char *argv[])
int foo; int foo;
int opt; int opt;
char *filterchain = "18"; char *filterchain = "18";
char *infile = "mire.fimg";
fprintf(stderr, "*** %s : compiled by tTh, %s %s\n", __FILE__, fprintf(stderr, "*** %s : compiled by tTh, %s %s\n", __FILE__,
__DATE__, __TIME__); __DATE__, __TIME__);
fimg_print_version(2); fimg_print_version(2);
while ((opt = getopt(argc, argv, "hF:v")) != -1) { while ((opt = getopt(argc, argv, "hF:vx")) != -1) {
switch(opt) { switch(opt) {
case 'h': help(); break; case 'h': help(); break;
case 'F': filterchain = optarg; break; case 'F': filterchain = optarg; break;
case 'v': verbosity++; break; case 'v': verbosity++; break;
case 'x': experiment(); break;
default: exit(1);
} }
} }
@ -100,7 +112,7 @@ if (foo) {
exit(1); exit(1);
} }
foo = essai_filterstack("01137.fimg"); foo = essai_filterstack(infile);
if (foo) { if (foo) {
fprintf(stderr, "err %d in essai_filterstack\n", foo); fprintf(stderr, "err %d in essai_filterstack\n", foo);
exit(1); exit(1);