From 376c7be2211b3e32b8e738e2bb3acf4cf833f720 Mon Sep 17 00:00:00 2001 From: Intel A80486DX2-66 Date: Mon, 23 Sep 2024 01:21:13 +0300 Subject: [PATCH] use name `custom_return_code` instead of `no_return` --- bytebeat_compiler.py | 12 +++++++----- samples/beeper.c | 2 +- samples/melody.c | 2 +- 3 files changed, 9 insertions(+), 7 deletions(-) diff --git a/bytebeat_compiler.py b/bytebeat_compiler.py index a281854..5ebcab1 100644 --- a/bytebeat_compiler.py +++ b/bytebeat_compiler.py @@ -141,7 +141,7 @@ ALLOWED_ARGUMENTS_FROM_FILE = ( "bit_depth", "signed", "channels", - "no_return", + "custom_return_code", ) DEFAULT_ARGS = { @@ -150,7 +150,7 @@ DEFAULT_ARGS = { "bit_depth": 8, "signed": False, "channels": 1, - "no_return": False + "custom_return_code": False } is_cmd_available = lambda cmd: which(cmd) is not None @@ -201,8 +201,9 @@ if __name__ == "__main__": parser.add_argument("-k", "--repeat", default=0, type=int, help="how many times to repeat the bytebeat : " "default = 0") - parser.add_argument("-a", "--no-return", default=None, action="store_true", - help="do not insert return statement before the code") + parser.add_argument("-a", "--custom-return-code", default=None, + action="store_true", + help="do not insert return statement before the code") parser.add_argument("-U", "--mode", default="sequential", type=str, help="mode of writing: `sequential` or `instant` (the latter is not " "recommended, since the whole result would be stored in RAM)") @@ -237,6 +238,7 @@ if __name__ == "__main__": parsed_parameters = line[match.start(0):].split(",") for parameter in parsed_parameters: kv = [x.strip() for x in parameter.split("=")] + kv[0] = kv[0].split(" ")[-1] key = None value = None @@ -263,7 +265,7 @@ if __name__ == "__main__": args.signed = False # - Compilation - if not args.no_return: # Insert `return` statement + if not args.custom_return_code: # Insert `return` statement # XXX: The bytebeat code is enclosed in parentheses to allow for the # use of commas as a comma operator, enabling more formulas to function. bytebeat_contents = f"return ({bytebeat_contents})" diff --git a/samples/beeper.c b/samples/beeper.c index 54034a7..72d571f 100644 --- a/samples/beeper.c +++ b/samples/beeper.c @@ -1,4 +1,4 @@ -// RENDER PARAMETERS: sample_rate = 44100, no_return +// RENDER PARAMETERS: sample_rate = 44100, custom_return_code bb_counter_t u = t << 1; SAMPLE_TYPE x = u & u >> 8; diff --git a/samples/melody.c b/samples/melody.c index 19a6530..e136dc8 100644 --- a/samples/melody.c +++ b/samples/melody.c @@ -1,4 +1,4 @@ -// RENDER PARAMETERS: sample_rate = 44100, no_return +// RENDER PARAMETERS: sample_rate = 44100, custom_return_code // FIXME: The sound disappears after a few cycles