X-Git-Url: http://git.cascardo.eti.br/?a=blobdiff_plain;f=build-aux%2Fextract-ofp-msgs;h=d3c4d4cd5e5379b9325c08f8957f1974d1cb164e;hb=ca7e7bee86b4ee821d61b58bf15c89a9d8a3cb30;hp=256a6c2a08d3289dd3532c81ae6f7745c89ed286;hpb=9021969654dda9d43386c3243c15536076e51172;p=cascardo%2Fovs.git diff --git a/build-aux/extract-ofp-msgs b/build-aux/extract-ofp-msgs index 256a6c2a0..d3c4d4cd5 100755 --- a/build-aux/extract-ofp-msgs +++ b/build-aux/extract-ofp-msgs @@ -104,7 +104,7 @@ def extract_ofp_msgs(output_file_name): while not comment.endswith('*/'): get_line() if line.startswith('/*') or not line or line.isspace(): - fatal("unexpected syntax within error") + fatal("unexpected syntax within message") comment += ' %s' % line.lstrip('* \t').rstrip(' \t\r\n') comment = comment[:-2].rstrip() @@ -161,7 +161,7 @@ def extract_ofp_msgs(output_file_name): hdrs = (version, OFPT10_STATS_REPLY, number, 0, 0) else: hdrs = (version, OFPT11_STATS_REPLY, number, 0, 0) - elif type_ == 'ONF': + elif type_ == 'ONFT': hdrs = (version, OFPT_VENDOR, 0, ONF_VENDOR_ID, number) elif type_ == 'ONFST' and name.endswith('_REQUEST'): if version == VERSION["1.0"]: @@ -246,6 +246,7 @@ def extract_ofp_msgs(output_file_name): if re.match('enum ofptype', line): break + all_types = [] while True: get_line() if re.match(r'\s*/?\*', line) or line.isspace(): @@ -280,6 +281,8 @@ def extract_ofp_msgs(output_file_name): % (raw, all_raws[raw]["ofptype"])) all_raws[raw]["ofptype"] = ofptype + all_types.append(all_raws[raws[0]]["human_name"]) + input_file.close() if n_errors: @@ -346,6 +349,12 @@ def extract_ofp_msgs(output_file_name): % r["human_name"]) output.append("};") + output.append(""); + output.append("static const char *type_names[] = {"); + for t in all_types: + output.append(" \"%s\"," % t) + output.append("};") + if n_errors: sys.exit(1) @@ -356,7 +365,7 @@ if __name__ == '__main__': if '--help' in sys.argv: usage() elif len(sys.argv) != 3: - sys.stderr.write("exactly one non-option arguments required; " + sys.stderr.write("exactly two non-option arguments required; " "use --help for help\n") sys.exit(1) else: