Browse Source

complicated build system is mandatory

master
tonton th 1 year ago
parent
commit
1693ad9051
  1. 2
      .gitignore
  2. 12
      Fonderie/Makefile
  3. 13
      Fonderie/craplist2h.awk
  4. 13
      Fonderie/craplist2str.awk
  5. 26
      Fonderie/crapulator.c
  6. 5
      Fonderie/crapulator.h
  7. 5
      Fonderie/crapulors.liste
  8. 16
      Fonderie/t.c

2
.gitignore vendored

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

12
Fonderie/Makefile

@ -10,7 +10,7 @@ OBJS = fonctions.o sfx.o crapulator.o glitches.o metriques.o \ @@ -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 @@ -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

@ -0,0 +1,13 @@ @@ -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

@ -0,0 +1,13 @@ @@ -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"
}

26
Fonderie/crapulator.c

@ -241,6 +241,32 @@ typedef struct { @@ -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)
{

5
Fonderie/crapulator.h

@ -10,5 +10,10 @@ @@ -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

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

16
Fonderie/t.c

@ -11,6 +11,7 @@ @@ -11,6 +11,7 @@
#include "glitches.h"
#include "sfx.h"
#include "filterstack.h"
#include "crapulator.h"
/* ----------------------------------------------------------- */
@ -69,6 +70,14 @@ int help(void) @@ -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[]) @@ -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) { @@ -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);

Loading…
Cancel
Save