3 from pathlib import Path
9 print(f"Syntax: {sys.argv[0]} <path-to-libdcp-source-tree> <ERROR|BV21_ERROR|WARNING>")
12 libdcp = Path(sys.argv[1])
14 header = libdcp / "src" / "verify.h"
16 types = ("BV21_ERROR", "ERROR", "WARNING")
20 Search source code to find where a given code is used and hence find out whether
21 it represents an error, Bv2.1 "error" or warning.
24 for source in ["verify_j2k.cc", "dcp.cc", "verify.cc"]:
25 path = libdcp / "src" / source
28 if line.find(name) != -1:
29 line_with_previous = previous + line
31 if line_with_previous.find(t) != -1:
37 print('<itemizedlist>')
40 with open(header) as h:
43 if strip == "enum class Code {":
48 if strip.startswith('/**'):
49 text = strip.replace('/**', '').replace('*/', '').strip()
50 elif not strip.startswith('/*') and not strip.startswith('*') and strip.endswith(','):
51 this_type = find_type(strip[:-1])
53 text = re.sub(r"\[.*?\]", lambda m: f'(Bv2.1 {m[0][7:-1]})', text)
54 text = text.replace('<', '<')
55 text = text.replace('>', '>')
56 text = re.sub(r"_(.*?)_", r"<code>\1</code>", text)
57 print(f'<listitem>{text}.</listitem>')
59 print('</itemizedlist>')