prevents orphaned or misplaced comments from being written to symbol

files.
This commit is contained in:
Norayr Chilingarian 2025-07-19 05:56:37 +04:00
parent a517a42357
commit 84516b2ac6

View file

@ -1348,16 +1348,20 @@ BEGIN
IF obj^.mode IN {Con, Typ, Var, LProc, XProc, CProc, IProc} THEN IF obj^.mode IN {Con, Typ, Var, LProc, XProc, CProc, IProc} THEN
(* Write comment BEFORE the object *) (* Write comment BEFORE the object *)
IF obj^.comment # NIL THEN IF obj^.comment # NIL THEN
OPM.SymWInt(Scomment); (* Only write comments for objects that make sense *)
(* Calculate actual length of comment text *) IF (obj^.mode IN {Con, Typ, Var, XProc, IProc, CProc}) & (obj^.vis # internal) THEN
k := 0; OPM.SymWInt(Scomment);
WHILE (k < OPM.MaxCommentLen - 1) & (obj^.comment^[k] # 0X) DO INC(k) END; (* Calculate actual length of comment text *)
OPM.SymWInt(k); (* length prefix *) k := 0;
(* Write comment data as individual characters *) WHILE (k < OPM.MaxCommentLen - 1) & (obj^.comment^[k] # 0X) DO INC(k) END;
l := 0; OPM.SymWInt(k); (* length prefix *)
WHILE l < k DO (* Write comment data as individual characters *)
OPM.SymWCh(obj^.comment^[l]); INC(l) l := 0;
WHILE l < k DO
OPM.SymWCh(obj^.comment^[l]); INC(l)
END
END END
(* If condition is false, we skip the comment entirely *)
END; END;
IF obj^.history = removed THEN FPrintErr(obj, 250) IF obj^.history = removed THEN FPrintErr(obj, 250)