1
0

template.c: remove "debug mode"

This commit is contained in:
Intel A80486DX2-66 2023-11-25 20:14:05 +03:00
parent 24dc6a338e
commit 64cfda4a33
Signed by: 80486DX2-66
GPG Key ID: 83631EF27054609B

View File

@ -52,33 +52,13 @@ const char* dbgpnt_labels[3] = { "memory allocation",
(unsigned int)(sizeof(dbgpnt_labels) / sizeof(dbgpnt_labels[0]))
// global variables
bool silent_mode = false, debug_mode = false;
bool silent_mode = false;
// function prototypes
void
debug_print(void);
SAMPLE_TYPE
bytebeat(long double w);
// function implementations
void
debug_print(void)
{
if (!debug_mode)
return;
int has_label = dbgpnt_counter <= dbgpnt_labels_size;
printf("[OK] ");
if (has_label)
printf("%s", dbgpnt_labels[dbgpnt_counter++]);
else
printf("debug point %d", ++dbgpnt_counter);
return;
}
SAMPLE_TYPE
bytebeat(long double w)
{
@ -87,7 +67,7 @@ bytebeat(long double w)
`bytebeat_contents`;
}
#define USAGE "render_bytebeat [-s | --silent] [-d | --debug]"
#define USAGE "render_bytebeat [-s | --silent]"
int
main(int argc, char** argv)
@ -95,8 +75,7 @@ main(int argc, char** argv)
// * parse CLI arguments
ARGH_PARSE {
ARGH_NEXT();
if ARGH_BOOL("-s", "--silent") { silent_mode = true; }
else if ARGH_BOOL("-d", "--debug") { debug_mode = true; }
if ARGH_BOOL("-s", "--silent") { silent_mode = true; }
}
// * log -> welcome
@ -139,8 +118,6 @@ main(int argc, char** argv)
return 1;
}
debug_print();
// * bytebeat generating loop
for (size_t w = 0; w < PRODUCT; w++) {
// 1. generate audio data
@ -178,7 +155,6 @@ main(int argc, char** argv)
}
printf("%s", ANSI_CLEAR);
debug_print();
// * wave file output
// 0. log
@ -230,7 +206,6 @@ main(int argc, char** argv)
// 5. close file
fclose(output_file);
debug_print();
// * end of program
printf("Done!\n");