1
0

bytebeat_compiler.py: extract preprocessor_bool

This commit is contained in:
パチュリー・ノーレッジ 2024-01-09 18:20:27 +03:00
parent 65fac992d6
commit d045eb7355
Signed by: 80486DX2-66
GPG Key ID: 83631EF27054609B

View File

@ -70,6 +70,8 @@ def substitute_vars(replacements: dict, text: str, verbose: bool) -> str:
print() print()
return text return text
preprocessor_bool = lambda value: "1" if value else "0"
CC = fetch("CC") CC = fetch("CC")
CFLAGS = fetch("CFLAGS") CFLAGS = fetch("CFLAGS")
INPUT_FILE = fetch("INPUT_FILE") INPUT_FILE = fetch("INPUT_FILE")
@ -180,14 +182,14 @@ if __name__ == "__main__":
"original_sample_rate": original_sample_rate, "original_sample_rate": original_sample_rate,
"final_sample_rate_code": final_sample_rate_code, "final_sample_rate_code": final_sample_rate_code,
"bit_depth": args.bit_depth, "bit_depth": args.bit_depth,
"is_signed": "1" if args.signed else "0", "is_signed": preprocessor_bool(args.signed),
"precalculated_ratio": "1" if args.precalculate_ratio else "0", "precalculated_ratio": preprocessor_bool(args.precalculate_ratio),
"faster_sample_ratio_math": "1" if args.precalculate_ratio else "0", "faster_sample_ratio_math": preprocessor_bool(args.precalculate_ratio),
"fp_return_type": "1" if args.floating_point else "0", "fp_return_type": preprocessor_bool(args.floating_point),
"channels": args.channels, "channels": args.channels,
"length": samples, "length": samples,
"silent_mode": "true" if args.silent else "false", "silent_mode": preprocessor_bool(args.silent),
"verbose_mode": "true" if args.verbose and not args.silent else "false", "verbose_mode": preprocessor_bool(args.verbose and not args.silent),
"fwrite_le": "../" + PATHS["fwrite_le_header"] "fwrite_le": "../" + PATHS["fwrite_le_header"]
}, read_file(PATHS["template"]), args.show_substituted_values)) }, read_file(PATHS["template"]), args.show_substituted_values))