diff --git a/.gitmodules b/.gitmodules deleted file mode 100644 index 00fb2a5..0000000 --- a/.gitmodules +++ /dev/null @@ -1,3 +0,0 @@ -[submodule "lib/c-argh"] - path = lib/c-argh - url = git@git.disroot.org:80486DX2-66/c-argh.git diff --git a/bytebeat_compiler.py b/bytebeat_compiler.py index 1933ad6..2bd56e8 100644 --- a/bytebeat_compiler.py +++ b/bytebeat_compiler.py @@ -78,6 +78,8 @@ if __name__ == "__main__": help="length (seconds)") parser.add_argument("-a", "--no-return", default=False, action="store_true", help="do not insert return statement before the code") + parser.add_argument("-q", "--silent", default=False, action="store_true", + help="do not output anything during generation") args = parser.parse_args() bytebeat_contents = read_from_file_or_stdin(args.file).strip() @@ -113,6 +115,8 @@ if __name__ == "__main__": args.channels, substitute) substitute = substitute_var("seconds", args.seconds, substitute) + substitute = substitute_var("silent_mode", + "true" if args.silent else "false", substitute) rewrite_file(PATHS["substitute"], substitute) # Compile by invoking the shell script diff --git a/lib/c-argh b/lib/c-argh deleted file mode 160000 index 540d94b..0000000 --- a/lib/c-argh +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 540d94bd1d41fb19c82c50904c2322c93e6718b3 diff --git a/src/template.c b/src/template.c index 49e19ad..1c544b4 100644 --- a/src/template.c +++ b/src/template.c @@ -7,9 +7,6 @@ #include #include -// libraries -#include "../lib/c-argh/argh.h" - // constants #if defined(_WIN32) # define __ANSI_CLEAR_STRING "\r" @@ -52,7 +49,7 @@ const char* dbgpnt_labels[3] = { "memory allocation", (unsigned int)(sizeof(dbgpnt_labels) / sizeof(dbgpnt_labels[0])) // global variables -bool silent_mode = false; +#define SILENT_MODE `silent_mode` // function prototypes SAMPLE_TYPE @@ -67,22 +64,14 @@ bytebeat(long double w) `bytebeat_contents`; } -#define USAGE "render_bytebeat [-s | --silent]" - int -main(int argc, char** argv) +main(void) { - // * parse CLI arguments - ARGH_PARSE { - ARGH_NEXT(); - if ARGH_BOOL("-s", "--silent") { silent_mode = true; } - } - // * log -> welcome printf(":: C bytebeat generator runtime unit\n"); fflush(stdout); - if (!silent_mode) { + if (!SILENT_MODE) { printf( "\n" "Sample rate: %d Hz\n" @@ -142,7 +131,7 @@ main(int argc, char** argv) // 6. log if ( - !silent_mode && + !SILENT_MODE && (w % FREQUENCY_OF_STATUS_REPORTING == 0 || w >= PRODUCT - 1 /* writing last sample */)) { printf(