mirror of
https://github.com/Druthulu/BFM-decomp
synced 2026-10-10 02:08:36 -04:00
tools(phase-37): argcheck sees indented file-scope definitions and keeps every K&R definition per binary (116 false lies); restruct --redraw takes VERDICT:cause keys; D40–D47 done (3,489 canonical); census 2,367 lying / 256 callees (+5,082 K&R, +511 cross-binary apart) | 🛑 T4 in progress (S108)
This commit is contained in:
+5
-3
@@ -43,7 +43,8 @@ import lever_census as lc
|
||||
|
||||
REPO = pathlib.Path(__file__).resolve().parent.parent
|
||||
NAME = r"[A-Za-z_]\w*"
|
||||
DEF = re.compile(r"^[A-Za-z_][\w \t*]*?\b(" + NAME + r")\s*\(([^;{]*)\)\s*\{", re.M)
|
||||
DEF = re.compile(r"^[ \t]*[A-Za-z_][\w \t*]*?\b(" + NAME + r")\s*\(([^;{]*)\)\s*\{", re.M) # leading blanks: 116 indented file-scope
|
||||
# definitions were invisible (P37 T4, 2026-09-12)
|
||||
DECL = re.compile(r"\bextern\s+[A-Za-z_][\w \t*]*?\b(" + NAME + r")\s*\(([^;)]*)\)\s*;")
|
||||
|
||||
|
||||
@@ -93,12 +94,13 @@ def definitions():
|
||||
# receives, so a prototype cast built from it stays compatible with the definition.
|
||||
for m in KR_DEF.finditer(masked):
|
||||
name, names = m.group(1), [n.strip() for n in m.group(2).split(",")]
|
||||
if name in ("if", "for", "while", "switch", "return", "sizeof") or name in out:
|
||||
if name in ("if", "for", "while", "switch", "return", "sizeof"):
|
||||
continue
|
||||
ptypes = kr_params(names, m.group(3))
|
||||
head = masked[m.start():m.start(1)].strip()
|
||||
out.setdefault(name, (len(names), ", ".join(ptypes), rel, head or "int"))
|
||||
_ALL[name].append((len(names), ", ".join(ptypes), rel, head or "int"))
|
||||
if (len(names), ", ".join(ptypes), rel) not in {(a_, p_, r_) for (a_, p_, r_, _) in _ALL[name]}:
|
||||
_ALL[name].append((len(names), ", ".join(ptypes), rel, head or "int")) # every definition, per binary (R48)
|
||||
return out
|
||||
|
||||
|
||||
|
||||
+8
-3
@@ -2485,12 +2485,17 @@ def plan_D(headers, batch, only, settled=frozenset()):
|
||||
|
||||
|
||||
def settled_units(rows, redraw=()):
|
||||
"""{(tu, callee)} whose LATEST rung-D row is a DONE verdict not in `redraw` (R70: the last row is the verdict)."""
|
||||
"""{(tu, callee)} whose LATEST rung-D row is a DONE verdict not lifted by `redraw` (R70: the last row is the verdict). A redraw key is a
|
||||
verdict (`DECL-KEPT`) or `VERDICT:cause-substring` (`DECL-NONE:no visible definition` — the 667 rows settled before defs_visible's
|
||||
fleet-unique level; the plain `DECL-NONE` key redraws every "already canonical"/external pair too, the t4_D21–D36 REDRAW's cost)."""
|
||||
latest = {}
|
||||
for r in rows:
|
||||
if r.get("rung") == "D" and r.get("unit", "").startswith("decl:"):
|
||||
latest[(r["tu"], r["callee"])] = r.get("verdict")
|
||||
return {k for k, v in latest.items() if v in DONE_VERDICTS and v not in set(redraw)}
|
||||
latest[(r["tu"], r["callee"])] = (r.get("verdict"), r.get("cause") or "")
|
||||
keys = [(k.split(":", 1)[0], k.split(":", 1)[1] if ":" in k else None) for k in redraw]
|
||||
def lifted(v, c):
|
||||
return any(v == kv and (ks is None or ks in c) for kv, ks in keys)
|
||||
return {k for k, (v, c) in latest.items() if v in DONE_VERDICTS and not lifted(v, c)}
|
||||
|
||||
|
||||
def plan_L(headers, batch, only):
|
||||
|
||||
Reference in New Issue
Block a user