1
0

use name custom_return_code instead of no_return

This commit is contained in:
Intel A80486DX2-66 2024-09-23 01:21:13 +03:00
parent 301ad4292b
commit 376c7be221
Signed by: 80486DX2-66
GPG Key ID: 83631EF27054609B
3 changed files with 9 additions and 7 deletions

View File

@ -141,7 +141,7 @@ ALLOWED_ARGUMENTS_FROM_FILE = (
"bit_depth", "bit_depth",
"signed", "signed",
"channels", "channels",
"no_return", "custom_return_code",
) )
DEFAULT_ARGS = { DEFAULT_ARGS = {
@ -150,7 +150,7 @@ DEFAULT_ARGS = {
"bit_depth": 8, "bit_depth": 8,
"signed": False, "signed": False,
"channels": 1, "channels": 1,
"no_return": False "custom_return_code": False
} }
is_cmd_available = lambda cmd: which(cmd) is not None is_cmd_available = lambda cmd: which(cmd) is not None
@ -201,7 +201,8 @@ if __name__ == "__main__":
parser.add_argument("-k", "--repeat", default=0, type=int, parser.add_argument("-k", "--repeat", default=0, type=int,
help="how many times to repeat the bytebeat : " help="how many times to repeat the bytebeat : "
"default = 0") "default = 0")
parser.add_argument("-a", "--no-return", default=None, action="store_true", parser.add_argument("-a", "--custom-return-code", default=None,
action="store_true",
help="do not insert return statement before the code") help="do not insert return statement before the code")
parser.add_argument("-U", "--mode", default="sequential", type=str, parser.add_argument("-U", "--mode", default="sequential", type=str,
help="mode of writing: `sequential` or `instant` (the latter is not " help="mode of writing: `sequential` or `instant` (the latter is not "
@ -237,6 +238,7 @@ if __name__ == "__main__":
parsed_parameters = line[match.start(0):].split(",") parsed_parameters = line[match.start(0):].split(",")
for parameter in parsed_parameters: for parameter in parsed_parameters:
kv = [x.strip() for x in parameter.split("=")] kv = [x.strip() for x in parameter.split("=")]
kv[0] = kv[0].split(" ")[-1]
key = None key = None
value = None value = None
@ -263,7 +265,7 @@ if __name__ == "__main__":
args.signed = False args.signed = False
# - Compilation # - 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 # XXX: The bytebeat code is enclosed in parentheses to allow for the
# use of commas as a comma operator, enabling more formulas to function. # use of commas as a comma operator, enabling more formulas to function.
bytebeat_contents = f"return ({bytebeat_contents})" bytebeat_contents = f"return ({bytebeat_contents})"

View File

@ -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; bb_counter_t u = t << 1;
SAMPLE_TYPE x = u & u >> 8; SAMPLE_TYPE x = u & u >> 8;

View File

@ -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 // FIXME: The sound disappears after a few cycles