Compare commits

...

2 Commits

Author SHA1 Message Date
tonton th 1693ad9051 complicated build system is mandatory 2020-12-29 16:40:26 +01:00
tonton th f39f7ec830 bla 2020-12-29 15:58:43 +01:00
9 changed files with 92 additions and 3 deletions

2
.gitignore vendored
View File

@ -70,4 +70,6 @@ Fonderie/*.gif
Fonderie/fonderie
Fonderie/interpolator
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
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

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;
} 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)
{

View File

@ -10,5 +10,10 @@
int crapulator(FloatImg *image, int id_effect, float fparam);
void list_crapulors(char *texte);
char *crap_name_from_number(int num);
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

@ -19,3 +19,6 @@ int brotche_rand48_a(FloatImg *fimg, float ratio, float mval);
int brotche_rand48_b(FloatImg *fimg, float ratio, float mval);
int colors_brotcher(FloatImg *fimg, float fval);
/*
* see also "crapulator.h" for some #define's
*/

View File

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