From 5d4af28c0ff54f1b7d6d97f35a55074865612445 Mon Sep 17 00:00:00 2001 From: nickysn Date: Mon, 17 Jun 2019 01:53:38 +0000 Subject: [PATCH] + implemented TOmfRecord_COMENT_IMPDEF.DecodeFrom git-svn-id: trunk@42242 - --- compiler/omfbase.pas | 41 +++++++++++++++++++++++++++++++++++++++-- 1 file changed, 39 insertions(+), 2 deletions(-) diff --git a/compiler/omfbase.pas b/compiler/omfbase.pas index 476fa810e1..dd8b615b34 100644 --- a/compiler/omfbase.pas +++ b/compiler/omfbase.pas @@ -1602,9 +1602,46 @@ implementation { TOmfRecord_COMENT_IMPDEF } procedure TOmfRecord_COMENT_IMPDEF.DecodeFrom(ComentRecord: TOmfRecord_COMENT); + var + InternalNameLen, ModuleNameLenIdx, ModuleNameLen, NameLenIdx, + NameLen, OrdinalIdx: Integer; begin - {todo: implement} - internalerror(2019061502); + if ComentRecord.CommentClass<>CC_OmfExtension then + internalerror(2019061621); + if Length(ComentRecord.CommentString)<5 then + internalerror(2019061622); + if ComentRecord.CommentString[1]<>Chr(CC_OmfExtension_IMPDEF) then + internalerror(2019061623); + ImportByOrdinal:=Ord(ComentRecord.CommentString[2])<>0; + InternalNameLen:=Ord(ComentRecord.CommentString[3]); + InternalName:=Copy(ComentRecord.CommentString,4,InternalNameLen); + ModuleNameLenIdx:=4+InternalNameLen; + if ModuleNameLenIdx>Length(ComentRecord.CommentString) then + internalerror(2019061624); + ModuleNameLen:=Ord(ComentRecord.CommentString[ModuleNameLenIdx]); + ModuleName:=Copy(ComentRecord.CommentString,ModuleNameLenIdx+1,ModuleNameLen); + if ImportByOrdinal then + begin + Name:=''; + OrdinalIdx:=ModuleNameLenIdx+1+ModuleNameLen; + if (OrdinalIdx+1)>Length(ComentRecord.CommentString) then + internalerror(2019061625); + Ordinal:=Ord(ComentRecord.CommentString[OrdinalIdx]) or + (Word(Ord(ComentRecord.CommentString[OrdinalIdx+1])) shl 8); + end + else + begin + Ordinal:=0; + NameLenIdx:=ModuleNameLenIdx+1+ModuleNameLen; + if NameLenIdx>Length(ComentRecord.CommentString) then + internalerror(2019061626); + NameLen:=Ord(ComentRecord.CommentString[NameLenIdx]); + if (NameLenIdx+NameLen)>Length(ComentRecord.CommentString) then + internalerror(2019061627); + Name:=Copy(ComentRecord.CommentString,NameLenIdx+1,NameLen); + if Name='' then + Name:=InternalName; + end; end; procedure TOmfRecord_COMENT_IMPDEF.EncodeTo(ComentRecord: TOmfRecord_COMENT);