main.c: show custom seed

Print configuration in parts in order to do that
This commit is contained in:
Intel A80486DX2-66 2024-07-07 20:56:36 +03:00
parent 4570bf7609
commit 5fcddd0aaf
Signed by: 80486DX2-66
GPG key ID: 83631EF27054609B
2 changed files with 32 additions and 20 deletions

View file

@ -71,19 +71,6 @@ enum configurations {
return EXIT_FAILURE; \
} while (0)
/* macros: lambdas */
#define STRINGIZE(x) #x
#define INT2STR(x) STRINGIZE(x)
#define YES_NO(x) ((x) ? "yes" : "no")
#define READ_CONFIG(x) (config & (x))
#define SET_CONFIG(x) \
config |= (x)
#define CLEAR_CONFIG(x) \
config &= ~(x)
#define LOOP_ACTION_CONFIG(f, x) \
f(x); \
continue
/* macros: definitions */
#ifndef SIZE_T_C
# if defined(UINT64_MAX) && SIZE_MAX == UINT64_MAX
@ -99,4 +86,20 @@ enum configurations {
# define SIZE_MAX (~SIZE_T_C(0))
#endif
#define STR_YN_YES "yes"
#define STR_YN_NO "no"
/* macros: lambdas */
#define STRINGIZE(x) #x
#define INT2STR(x) STRINGIZE(x)
#define YES_NO(x) ((x) ? STR_YN_YES : STR_YN_NO)
#define READ_CONFIG(x) (config & (x))
#define SET_CONFIG(x) \
config |= (x)
#define CLEAR_CONFIG(x) \
config &= ~(x)
#define LOOP_ACTION_CONFIG(f, x) \
f(x); \
continue
#endif /* _COMMON_H */

View file

@ -287,18 +287,27 @@ int main(int argc, char** argv) {
// FIXME: interprets *.txt files as binary
file_type = determine_file_type(file, file_path);
// print configuration: only damaging file contents, preserving line
// endings, operating on printable ASCII characters exclusively
printf("Configuration:\n"
"> Only damaging file contents (PNG, BMP, WAV): %s\n"
"> Preserving line endings: %s\n"
"> Operating on printable ASCII characters exclusively: %s\n"
"> Custom seed: %s\n"
"> File type: %s\n"
"\n",
"> Operating on printable ASCII characters exclusively: %s\n",
YES_NO(READ_CONFIG(C_CONTENTS)),
YES_NO(READ_CONFIG(C_LINE_ENDINGS)),
YES_NO(READ_CONFIG(C_PRINTABLE)),
YES_NO(READ_CONFIG(C_CUSTOM_SEED)),
file_type_to_string(file_type));
YES_NO(READ_CONFIG(C_PRINTABLE)));
// print configuration: custom seed
printf("> Custom seed: ");
if (READ_CONFIG(C_CUSTOM_SEED)) {
printf("%" PRIu32 "\n", PRNG_seed_value);
} else {
puts(STR_YN_NO);
}
// print configuration: file type
printf("> File type: %s\n"
"\n", file_type_to_string(file_type));
printf("Parameters:\n"
"> Probability: %" PRIu8 "\n"