This is merely a historical archive of years 2008-2021, before the migration to mailman3.
A maintained and still updated list archive can be found at https://lists.osmocom.org/hyperkitty/list/gerrit-log@lists.osmocom.org/.
Vadim Yanitskiy gerrit-no-reply at lists.osmocom.orgHello Harald Welte, Jenkins Builder, I'd like you to reexamine a change. Please visit https://gerrit.osmocom.org/1593 to look at the new patch set (#2). utils/conv_gen.py: add header generation feature Change-Id: Iae830d716f01810972edbef14fc5383ac647d0ea --- M utils/conv_gen.py 1 file changed, 44 insertions(+), 4 deletions(-) git pull ssh://gerrit.osmocom.org:29418/libosmocore refs/changes/93/1593/2 diff --git a/utils/conv_gen.py b/utils/conv_gen.py index d05ca9b..196ef72 100644 --- a/utils/conv_gen.py +++ b/utils/conv_gen.py @@ -168,6 +168,20 @@ # Up to 12 numbers should be placed per line print_formatted(self.puncture, "%3d, ", 12, fi) + def print_description(self, fi, brief = False): + if brief is True: + fi.write("/*! \\brief ") + fi.write("structure describing %s\n" + % self.description[0]) + for line in self.description[1:]: + fi.write(" * %s\n" % line) + else: + fi.write("/**\n") + for line in self.description: + fi.write(" * %s\n" % line) + + fi.write(" */\n") + def print_state_and_output(self, fi): pack = lambda n: \ sum([x << (self.rate_inv - i - 1) for i, x in enumerate(n)]) @@ -205,10 +219,7 @@ # Write description as a multi-line comment if self.description is not None: - fi.write("/**\n") - for line in self.description: - fi.write(" * %s\n" % line) - fi.write(" */\n") + self.print_description(fi) # Print a final convolutional code definition fi.write("const struct osmo_conv_code %s_%s = {\n" % (pref, self.name)) @@ -344,6 +355,31 @@ f.write("\t{ 0 /* Array terminator */ }\n") f.write("};\n") +def generate_header(codes, path, prefix, name, description = None): + # Open a new file for writing + f = open(os.path.join(path, name), 'w') + + # Print license and includes + f.write(mod_license + "\n") + f.write("#pragma once\n\n") + f.write("#include <stdint.h>\n") + f.write("#include <osmocom/core/conv.h>\n\n") + + # Print general file description if preset + if description is not None: + f.write("/*! \\file %s.h\n" % prefix) + f.write(" * %s\n" % description) + f.write(" */\n\n") + + sys.stderr.write("Generating header file...\n") + + # Generate declarations one by one + for code in codes.conv_codes: + sys.stderr.write("Generate '%s' declaration\n" % code.name) + code.print_description(f, True) + f.write("extern const struct osmo_conv_code %s_%s;\n\n" + % (prefix, code.name)) + def print_help(error = None): print("Usage: python %s [options]" % sys.argv[0]) @@ -360,6 +396,7 @@ print("\nAvailable actions:") print(" gen_codes - generate convolutional code definitions") print(" gen_vectors - generate test vectors") + print(" gen_header - generate header file") print("\nAvailable code families:") print(" gsm - GSM/GPRS/EDGE specific codes") @@ -437,6 +474,9 @@ elif action == "gen_vectors": name = prefix + "_test_vectors.c" if name is None else name generate_vectors(codes, path, prefix, name, inc) + elif action == "gen_header": + name = prefix + ".h" if name is None else name + generate_header(codes, path, prefix, name) else: print_help("Error: Unknown action!") sys.exit(1) -- To view, visit https://gerrit.osmocom.org/1593 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: newpatchset Gerrit-Change-Id: Iae830d716f01810972edbef14fc5383ac647d0ea Gerrit-PatchSet: 2 Gerrit-Project: libosmocore Gerrit-Branch: master Gerrit-Owner: Vadim Yanitskiy <axilirator at gmail.com> Gerrit-Reviewer: Harald Welte <laforge at gnumonks.org> Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: tnt <tnt at 246tNt.com>