source410: engine COMPLETE (165/165) - link reaches PE emission; deep ledger cut
The tlink32 campaign after the checkpoint: eleven engine bodies back-dated from BT412 (rotation player team explode dropzone terrain cultural receiver subsystm app l4gauge - the Application core included), the WinTesla-ectomy handled by backdate.py's new unwrap rules (accessor-fn statics -> 1995 static objects, decl rewrites, pointer->reference Derivation ctor, 2007 windowed- gauge/console-marshal/idle-pump excisions), staged statics TUs opened for the game classes (MECH/BTPLAYER/BTDIRECT/PROJTILE/MISSILE/BTL4MPPR .CPP + L4APP/ NETWORK engine statics). State: every compiled symbol short of the shallow graph RESOLVED (the 52- and 17-symbol ledgers burned to zero); with 32stub.exe in place the linker reaches full vtable closure and emits the deep ledger (~210 symbols, UNRESOLVED- LEDGER.txt): remaining engine bodies (objstrm cstr gauge/gaugrend graphics pixelmap palette resfile ray scnrole explosion-table), the DOS driver extern layer (_SVGA*/_PCSerial*/_PCSPAK*/joystick/netnub/sosMIDI), the full L4App body, and the real game-TU frontier (Mech::Make et al.). Recipe proven for every category. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
@@ -19,7 +19,30 @@ def main():
|
||||
donor, out = sys.argv[1], sys.argv[2]
|
||||
name = os.path.splitext(os.path.basename(out))[0].upper()
|
||||
guard = "%s_HPP" % name
|
||||
body = open(donor, "r", errors="replace").read().splitlines()
|
||||
text = open(donor, "r", errors="replace").read()
|
||||
# WinTesla wrapped the 1995 static objects in accessor functions (its
|
||||
# static-init-order fix); unwrap them back to plain 1995 definitions.
|
||||
text = re.sub(
|
||||
r"Derivation\s*\*\s*(\w+)::GetClassDerivations\(\)\s*"
|
||||
r"\{\s*static\s+Derivation\s+\w+\s*\(([^;]*?)\);\s*return\s*&\w+;\s*\}",
|
||||
r"Derivation\n\t\1::ClassDerivations(\2);",
|
||||
text, flags=re.S)
|
||||
text = re.sub(
|
||||
r"(?:Receiver::)?MessageHandlerSet\s*&?\s*(\w+)::GetMessageHandlers\(\)\s*"
|
||||
r"\{\s*static\s+(?:\w+::)?MessageHandlerSet\s+\w+\s*\(([^;]*?)\);\s*return\s*\w+;\s*\}",
|
||||
r"\1::MessageHandlerSet\n\t\1::MessageHandlers(\2);",
|
||||
text, flags=re.S)
|
||||
text = re.sub(
|
||||
r"(?:\w+::)?AttributeIndexSet\s*&?\s*(\w+)::GetAttributeIndex\(\)\s*"
|
||||
r"\{\s*static\s+(?:\w+::)?AttributeIndexSet\s+\w+\s*\(([^;]*?)\);\s*return\s*\w+;\s*\}",
|
||||
r"\1::AttributeIndexSet\n\t\1::AttributeIndex(\2);",
|
||||
text, flags=re.S)
|
||||
text = re.sub(
|
||||
r"MemoryBlock\s*\*\s*(\w+)::GetAllocatedMemory\(\)\s*"
|
||||
r"\{\s*static\s+MemoryBlock\s+\w+\s*\(([^;]*?)\);\s*return\s*&\w+;\s*\}",
|
||||
r"MemoryBlock\n\t\1::AllocatedMemory(\2);",
|
||||
text, flags=re.S)
|
||||
body = text.splitlines()
|
||||
res = []
|
||||
warned = set()
|
||||
for line in body:
|
||||
@@ -36,6 +59,26 @@ def main():
|
||||
res.append("#\tendif")
|
||||
continue
|
||||
# post-1994 C++ the 4.52 compiler rejects: de-modernize
|
||||
line = re.sub(r"\b(\w+)::GetClassDerivations\(\)", r"\1::ClassDerivations", line)
|
||||
line = re.sub(r"\b(\w+)::GetMessageHandlers\(\)", r"\1::MessageHandlers", line)
|
||||
line = re.sub(r"\b(\w+)::GetAttributeIndex\(\)", r"\1::AttributeIndex", line)
|
||||
line = re.sub(r"\b(\w+)::GetAllocatedMemory\(\)", r"\1::AllocatedMemory", line)
|
||||
# header-side: 2007 accessor DECLARATIONS -> 1995 static objects
|
||||
line = re.sub(r"static\s+Derivation\s*\*\s*GetClassDerivations\(\);",
|
||||
"static Derivation ClassDerivations;", line)
|
||||
line = re.sub(r"static\s+(?:\w+::)?MessageHandlerSet\s*&?\s*GetMessageHandlers\(\);",
|
||||
"static MessageHandlerSet MessageHandlers;", line)
|
||||
line = re.sub(r"static\s+(?:\w+::)?AttributeIndexSet\s*&?\s*GetAttributeIndex\(\);",
|
||||
"static AttributeIndexSet AttributeIndex;", line)
|
||||
line = line.replace("Shutdown(int remainingApps);", "Shutdown(int remainingApps = 0);")
|
||||
line = re.sub(r"\*?\s*(?<![:\w])GetClassDerivations\(\)", "ClassDerivations", line)
|
||||
line = re.sub(r"(?<![:\w])GetMessageHandlers\(\)", "MessageHandlers", line)
|
||||
line = re.sub(r"(?<![:\w])GetAttributeIndex\(\)", "AttributeIndex", line)
|
||||
line = line.replace("PostQuitMessage(AbortExitCodeID);", 'Fail("Exiting");')
|
||||
for bad in ("atlbase.h", "windows.h", "winsock"):
|
||||
if bad in line and "#include" in line:
|
||||
line = ""
|
||||
break
|
||||
line = re.sub(r"\bstd::", "", line)
|
||||
line = re.sub(r"\btrue\b", "True", line)
|
||||
line = re.sub(r"\bfalse\b", "False", line)
|
||||
@@ -54,10 +97,20 @@ def main():
|
||||
# strip leading blank lines
|
||||
while res and not res[0].strip():
|
||||
res.pop(0)
|
||||
out_text = "\n".join(res)
|
||||
# cleanups after the accessor unwrap: a deref of the former pointer
|
||||
# accessor, and doubled class prefixes from the static rename
|
||||
out_text = re.sub(r"\*\s*(\w+)::ClassDerivations\b", r"\1::ClassDerivations", out_text)
|
||||
out_text = re.sub(r"\b(\w+)::\1::", r"\1::", out_text)
|
||||
is_header = out.upper().endswith((".HPP", ".H", ".THP"))
|
||||
with open(out, "w", newline="\r\n") as f:
|
||||
f.write("#if !defined(%s)\n#\tdefine %s\n\n" % (guard, guard))
|
||||
f.write("\n".join(res))
|
||||
f.write("\n\n#endif\n")
|
||||
if is_header:
|
||||
f.write("#if !defined(%s)\n#\tdefine %s\n\n" % (guard, guard))
|
||||
f.write(out_text)
|
||||
if is_header:
|
||||
f.write("\n\n#endif\n")
|
||||
else:
|
||||
f.write("\n")
|
||||
print("wrote %s (%d lines from %s)" % (out, len(res) + 5, donor))
|
||||
|
||||
if __name__ == "__main__":
|
||||
|
||||
Reference in New Issue
Block a user