Compare commits
10 Commits
e6b72e5faa
...
master
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
8202df9a63 | ||
|
|
67ba638690 | ||
|
|
e8a7bf28e3 | ||
|
|
b19107d71b | ||
|
|
fabe94792b | ||
|
|
d1e67f7397 | ||
|
|
28453e862a | ||
|
|
2147d4b164 | ||
|
|
b0983ab18b | ||
|
|
08fcf513cc |
@@ -7,12 +7,12 @@ COPT = -g -fpic -no-pie -Wall -DDEBUG_LEVEL=0 -Werror=parentheses
|
||||
LIBS = ../libfloatimg.a -ltiff -lpnglite -lm -lz -lcfitsio
|
||||
|
||||
OBJS = fifo.o sfx.o crapulator.o glitches.o metriques.o \
|
||||
filterstack.o single.o
|
||||
filterstack.o single.o utilfuncs.o
|
||||
|
||||
DEPS = ../floatimg.h \
|
||||
../libfloatimg.a \
|
||||
fifo.h crapulator.h metriques.h glitches.h sfx.h \
|
||||
filterstack.h crapdef.h crapstr.h single.h
|
||||
filterstack.h crapdef.h crapstr.h single.h utilfuncs.h
|
||||
|
||||
all: fonderie interpolator singlepass t
|
||||
|
||||
@@ -71,4 +71,7 @@ metriques.o: metriques.c metriques.h Makefile
|
||||
glitches.o: glitches.c glitches.h Makefile
|
||||
gcc ${COPT} -c $<
|
||||
|
||||
utilfuncs.o: utilfuncs.c utilfuncs.h Makefile
|
||||
gcc ${COPT} -c $<
|
||||
|
||||
# ---------------------------------------------------------
|
||||
|
||||
@@ -10,6 +10,7 @@
|
||||
#include <glob.h>
|
||||
#include "../floatimg.h"
|
||||
|
||||
#include "utilfuncs.h"
|
||||
#include "fifo.h"
|
||||
#include "glitches.h"
|
||||
#include "crapulator.h"
|
||||
@@ -190,6 +191,8 @@ puts("\t-O\toutput directory (default p8/)");
|
||||
puts("\t-T\tfifo size");
|
||||
puts("\t-v\tincrease verbosity");
|
||||
|
||||
if (verbosity) { puts(""); fimg_print_version(2); puts(""); }
|
||||
|
||||
exit(0);
|
||||
}
|
||||
/* -------------------------------------------------------------- */
|
||||
@@ -206,7 +209,6 @@ char *OutFchain = "none";
|
||||
|
||||
fprintf(stderr, "*** %s\n\tcompiled %s, %s, pid %d\n",
|
||||
argv[0], __DATE__, __TIME__, getpid());
|
||||
if (verbosity) fimg_print_version(2);
|
||||
|
||||
while ((opt = getopt(argc, argv, "B:E:F:ghI:LO:T:vw:x:")) != -1) {
|
||||
switch(opt) {
|
||||
@@ -240,6 +242,15 @@ if (verbosity) {
|
||||
fprintf(stderr, "\tout filter '%s'\n", OutFchain);
|
||||
fprintf(stderr, "\tfifo size %d\n", fifosize);
|
||||
}
|
||||
/*
|
||||
* check for the export directory
|
||||
*/
|
||||
foo = check_if_export_dir_is_valid(out_dir, 0);
|
||||
if ( !foo ) {
|
||||
fprintf(stderr, "** export dir (%s) not valid\n", out_dir);
|
||||
fprintf(stderr, "** may be you have to create it ?\n");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
foo = parse_filter_chain(0, InFchain);
|
||||
if (foo) {
|
||||
|
||||
@@ -17,6 +17,7 @@
|
||||
|
||||
#include "../floatimg.h"
|
||||
|
||||
#include "utilfuncs.h"
|
||||
#include "fifo.h"
|
||||
#include "glitches.h"
|
||||
#include "crapulator.h"
|
||||
@@ -55,7 +56,7 @@ IdxValue *idxvalues;
|
||||
|
||||
#if DEBUG_LEVEL
|
||||
fprintf(stderr, ">>> %s ( %p %p %d %p)\n", __func__, ptr_glob,
|
||||
ptr_idxval, method, average);
|
||||
ptr_idxval, method, p_average);
|
||||
#endif
|
||||
|
||||
if (0==method && verbosity) {
|
||||
@@ -140,8 +141,8 @@ foo = glob(pattern, 0, NULL, &globbuf);
|
||||
fprintf(stderr, " globbing '%s' -> %d, %d files found\n",
|
||||
pattern, foo, (int)globbuf.gl_pathc);
|
||||
if (0 == globbuf.gl_pathc) {
|
||||
fprintf(stderr, "%s : no file found, aborting\n", __func__);
|
||||
return -1;
|
||||
fprintf(stderr, "%s : no file found, ABEND\n", __func__);
|
||||
exit(1);
|
||||
}
|
||||
|
||||
idx_values = NULL;
|
||||
@@ -240,9 +241,7 @@ puts("\t-S nn\t\tmysterious sort");
|
||||
puts("\t-L\t\tlist available filters");
|
||||
puts("\t-v\t\tincrease verbosity");
|
||||
|
||||
if (verbosity) {
|
||||
list_crapulors("available filters");
|
||||
}
|
||||
if (verbosity) { puts(""); fimg_print_version(2); puts(""); }
|
||||
|
||||
exit(0);
|
||||
}
|
||||
@@ -257,6 +256,7 @@ int opt;
|
||||
int sort = 0;
|
||||
char *InFchain = "0";
|
||||
char *OutFchain = "0";
|
||||
char *out_dir = "p8/";
|
||||
|
||||
fprintf(stderr, "*** %s\n\tcompiled on %s %s\n", argv[0],
|
||||
__DATE__, __TIME__);
|
||||
@@ -292,6 +292,18 @@ if (3 != (argc-optind)) {
|
||||
exit(1);
|
||||
}
|
||||
|
||||
out_dir = argv[optind+1];
|
||||
|
||||
/*
|
||||
* check for the export directory
|
||||
*/
|
||||
foo = check_if_export_dir_is_valid(out_dir, 0);
|
||||
if ( !foo ) {
|
||||
fprintf(stderr, "** export dir (%s) not valid\n", out_dir);
|
||||
fprintf(stderr, "** may be you have to create it ?\n");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
foo = parse_filter_chain(0, InFchain);
|
||||
if (foo) {
|
||||
fprintf(stderr, "err %d parsing '%s'\n", foo, InFchain);
|
||||
|
||||
@@ -13,6 +13,7 @@
|
||||
|
||||
#include "../floatimg.h"
|
||||
|
||||
#include "utilfuncs.h"
|
||||
#include "crapulator.h"
|
||||
#include "filterstack.h"
|
||||
#include "single.h"
|
||||
@@ -198,6 +199,13 @@ if (repeat < 1) {
|
||||
exit(2);
|
||||
}
|
||||
|
||||
foo = check_if_export_dir_is_valid(outdir, 0);
|
||||
if ( !foo ) {
|
||||
fprintf(stderr, "** export dir (%s) not valid\n", outdir);
|
||||
fprintf(stderr, "** may be you have to create it ?\n");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
foo = parse_filter_chain(FILTERS, filterchain);
|
||||
if (foo) {
|
||||
fprintf(stderr, "err %d in parse_filter_chain\n", foo);
|
||||
|
||||
41
Fonderie/t.c
41
Fonderie/t.c
@@ -16,6 +16,8 @@
|
||||
#include "crapulator.h"
|
||||
#include "single.h"
|
||||
|
||||
#include "utilfuncs.h"
|
||||
|
||||
/* ----------------------------------------------------------- */
|
||||
|
||||
int verbosity;
|
||||
@@ -28,6 +30,30 @@ int verbosity;
|
||||
|
||||
#define STK 6
|
||||
|
||||
/* ----------------------------------------------------------- */
|
||||
/* new Sat Nov 9 22:17:46 UTC 2024 */
|
||||
int essai_test_export_dir(char *footxt)
|
||||
{
|
||||
int foo;
|
||||
|
||||
#if DEBUG_LEVEL
|
||||
fprintf(stderr, ">>> %s ( '%s' )\n", __func__, footxt);
|
||||
#endif
|
||||
|
||||
foo = check_if_export_dir_is_valid("/tmp/quux", 0);
|
||||
fprintf(stderr, " got %d\n\n", foo);
|
||||
|
||||
foo = check_if_export_dir_is_valid("/home", 0);
|
||||
fprintf(stderr, " got %d\n\n", foo);
|
||||
|
||||
foo = check_if_export_dir_is_valid("./", 0);
|
||||
fprintf(stderr, " got %d\n\n", foo);
|
||||
|
||||
foo = check_if_export_dir_is_valid("Makefile", 0);
|
||||
fprintf(stderr, " got %d\n\n", foo);
|
||||
|
||||
return -1;
|
||||
}
|
||||
/* ----------------------------------------------------------- */
|
||||
|
||||
int essai_filterstack(char *fIname, char *fOname)
|
||||
@@ -36,6 +62,11 @@ int foo;
|
||||
FloatImg image;
|
||||
double debut, fin;
|
||||
|
||||
#if DEBUG_LEVEL
|
||||
fprintf(stderr, ">>> %s ( '%s' '%s' )\n", __func__, fIname, fOname);
|
||||
#endif
|
||||
|
||||
|
||||
// filterstack_list(STK, __func__);
|
||||
|
||||
foo = fimg_create_from_dump(fIname, &image);
|
||||
@@ -218,15 +249,23 @@ while ((opt = getopt(argc, argv, "hF:g:i:Lo:O:svx")) != -1) {
|
||||
}
|
||||
|
||||
#if DEBUG_LEVEL
|
||||
fprintf(stderr, "%s : argc = %d, optind = %d\n", argv[0], argc, optind);
|
||||
fprintf(stderr, ">>> %s : argc=%d, optind=%d\n", argv[0], argc, optind);
|
||||
#endif
|
||||
|
||||
foo = essai_test_export_dir("bla bla");
|
||||
if (foo) {
|
||||
fprintf(stderr, "err %d in essai_test_export_dir\n", foo);
|
||||
exit(1);
|
||||
}
|
||||
exit(0);
|
||||
|
||||
foo = parse_filter_chain(STK, filterchain);
|
||||
if (foo) {
|
||||
fprintf(stderr, "err %d in parse_filter_chain\n", foo);
|
||||
exit(1);
|
||||
}
|
||||
|
||||
|
||||
if (do_xper) {
|
||||
experiment(infile);
|
||||
return 0;
|
||||
|
||||
53
Fonderie/utilfuncs.c
Normal file
53
Fonderie/utilfuncs.c
Normal file
@@ -0,0 +1,53 @@
|
||||
/*
|
||||
* utilfuncs.c
|
||||
*
|
||||
* new Sat Nov 9 22:15:15 UTC 2024
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <unistd.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
|
||||
#include "utilfuncs.h"
|
||||
|
||||
extern int verbosity;
|
||||
|
||||
/* -------------------------------------------------------------- */
|
||||
int check_if_export_dir_is_valid(char *path, int action)
|
||||
{
|
||||
int foo;
|
||||
struct stat statbuf;
|
||||
|
||||
#if DEBUG_LEVEL
|
||||
fprintf(stderr, ">>> %s ( '%s', %d )\n", __func__, path, action);
|
||||
#endif
|
||||
|
||||
foo = stat(path, &statbuf);
|
||||
if (foo) {
|
||||
if (verbosity) perror(path);
|
||||
return 0;
|
||||
}
|
||||
|
||||
#if DEBUG_LEVEL
|
||||
fprintf(stderr, " mode 0x%x\n", statbuf.st_mode);
|
||||
#endif
|
||||
if ((statbuf.st_mode & S_IFMT) != S_IFDIR) {
|
||||
if (verbosity) fprintf(stderr, "%s: Not a directory\n", path);
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* OK, c'est un repertoire, mais peut-on écrire dedans ? */
|
||||
foo = access(path, W_OK);
|
||||
#if DEBUG_LEVEL
|
||||
fprintf(stderr, " access '%s' = %d\n", path, foo);
|
||||
#endif
|
||||
if (0 != foo) {
|
||||
if (verbosity) fprintf(stderr, "%s: can't write\n", path);
|
||||
return 0;
|
||||
}
|
||||
|
||||
return 1; /* export dir is OK */
|
||||
}
|
||||
/* -------------------------------------------------------------- */
|
||||
|
||||
11
Fonderie/utilfuncs.h
Normal file
11
Fonderie/utilfuncs.h
Normal file
@@ -0,0 +1,11 @@
|
||||
/*
|
||||
* utilfuncs.c
|
||||
*
|
||||
* new Sat Nov 9 22:15:49 UTC 2024
|
||||
*/
|
||||
|
||||
/* -------------------------------------------------------------- */
|
||||
|
||||
int check_if_export_dir_is_valid(char *path, int action);
|
||||
|
||||
/* -------------------------------------------------------------- */
|
||||
2
build.sh
2
build.sh
@@ -1,5 +1,7 @@
|
||||
#!/bin/bash
|
||||
|
||||
set -e ; set -u
|
||||
|
||||
# ------------------------------------------------------------------
|
||||
|
||||
function build
|
||||
|
||||
@@ -20,7 +20,7 @@
|
||||
* https://git.tetalab.org/tTh/FloatImg
|
||||
*/
|
||||
|
||||
#define FIMG_VERSION (243)
|
||||
#define FIMG_VERSION (245)
|
||||
#define RELEASE_NAME ("noname")
|
||||
#define PATCH_LEVEL ("aaaa")
|
||||
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
#!/bin/bash -v
|
||||
|
||||
set -e ; set -u
|
||||
|
||||
cp libfloatimg.a /usr/local/lib
|
||||
cp floatimg.h /usr/local/include
|
||||
|
||||
|
||||
@@ -92,6 +92,7 @@ if (2 != argc-optind) {
|
||||
foo = convertir_fimg_en_PNG(argv[optind], argv[optind+1], to_gray);
|
||||
if (foo) {
|
||||
fprintf(stderr, "%s : got a %d from convertor\n", argv[0], foo);
|
||||
exit(1);
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
||||
Reference in New Issue
Block a user