summaryrefslogtreecommitdiff
path: root/doc/manual/verifier.py
diff options
context:
space:
mode:
authorCarl Hetherington <cth@carlh.net>2024-11-26 22:07:26 +0100
committerCarl Hetherington <cth@carlh.net>2024-12-07 21:36:21 +0100
commite613e3c6343f0842f09bd6f19f6ef4656c5c104f (patch)
tree5f86407dedcff3a5457d51ab17462359dff44fd0 /doc/manual/verifier.py
parent2539a4e6c03af83c79ba1cc911fdd512ea03fc09 (diff)
Take account of new "good things" reported by libdcp verifier.
Diffstat (limited to 'doc/manual/verifier.py')
-rw-r--r--doc/manual/verifier.py27
1 files changed, 19 insertions, 8 deletions
diff --git a/doc/manual/verifier.py b/doc/manual/verifier.py
index 877a118a1..f39a00e2e 100644
--- a/doc/manual/verifier.py
+++ b/doc/manual/verifier.py
@@ -1,4 +1,7 @@
#!/usr/bin/python3
+#
+# Return DocBook markup for all the verification warnings/errors/"ok" notes of a given
+# type in verify.h
from pathlib import Path
import re
@@ -6,32 +9,39 @@ import sys
import subprocess
if len(sys.argv) < 3:
- print(f"Syntax: {sys.argv[0]} <path-to-libdcp-source-tree> <ERROR|BV21_ERROR|WARNING>")
+ print(f"Syntax: {sys.argv[0]} <path-to-libdcp-source-tree> <ERROR|BV21_ERROR|WARNING|OK>")
sys.exit(1)
libdcp = Path(sys.argv[1])
type = sys.argv[2]
header = libdcp / "src" / "verify.h"
-types = ("BV21_ERROR", "ERROR", "WARNING")
+# The types of note we have, and the strings to look for in order to recognise them
+types = {
+ "BV21_ERROR": ("BV21_ERROR", "bv21_error("),
+ "ERROR": ("ERROR", "error("),
+ "WARNING": ("WARNING", "warning("),
+ "OK": ("ok(",),
+}
def find_type(name):
"""
Search source code to find where a given code is used and hence find out whether
- it represents an error, Bv2.1 "error" or warning.
+ it represents an error, Bv2.1 "error", warning or "this is OK" note.
"""
previous = ''
- for source in ["verify_j2k.cc", "dcp.cc", "verify.cc"]:
+ for source in ["verify_j2k.cc", "dcp.cc", "verify.cc", "cpl.cc"]:
path = libdcp / "src" / source
with open(path) as s:
for line in s:
if line.find(name) != -1:
line_with_previous = previous + line
- for t in types:
- if line_with_previous.find(t) != -1:
- return t
- assert False
+ for type, signatures in types.items():
+ for s in signatures:
+ if line_with_previous.find(s) != -1:
+ return type
previous = line
+ assert False
print('<itemizedlist>')
@@ -49,6 +59,7 @@ with open(header) as h:
text = strip.replace('/**', '').replace('*/', '').strip()
elif not strip.startswith('/*') and not strip.startswith('*') and strip.endswith(','):
this_type = find_type(strip[:-1])
+ # print("find", strip[:-1], this_type)
if this_type == type:
text = re.sub(r"\[.*?\]", lambda m: f'(Bv2.1 {m[0][7:-1]})', text)
text = text.replace('<', '&lt;')