Jan Doggen
Jan Doggen

Reputation: 9096

How to compare two large Delphi units where order of definitions/implementations is all different?

I have two Delphi units generated from the same WSDL import, one by XE2 and one by XE3. I want to check if there are any significant differences, but the order of the definitions/implementations are all different in the two files. No way I'm going to be able to edit these 25000+ line files to match up....

Does anyone have a smart idea how I could do my compare? It could well be that the files are completely identical, but I'm interested in any tiny differences...

Example parts of XE2 file:

FreeBusyResponseType = class;                 { "http://schemas.microsoft.com/exchange/services/2006/messages"[GblCplx] }
GetUserAvailabilityResponseType = class;      { "http://schemas.microsoft.com/exchange/services/2006/messages"[Lit][GblCplx] }
SetUserOofSettingsResponse2 = class;          { "http://schemas.microsoft.com/exchange/services/2006/messages"[Lit][GblCplx] }
FieldURIOrConstantType = class;               { "http://schemas.microsoft.com/exchange/services/2006/types"[GblCplx] }
MessageXml           = class;                 { "http://schemas.microsoft.com/exchange/services/2006/messages"[Cplx] }
BaseRequestType      = class;                 { "http://schemas.microsoft.com/exchange/services/2006/messages"[GblCplx] }
GetFolderType        = class;                 { "http://schemas.microsoft.com/exchange/services/2006/messages"[Lit][GblCplx] }
BaseMoveCopyItemType = class;                 { "http://schemas.microsoft.com/exchange/services/2006/messages"[GblCplx] }
CopyItemType         = class;                 { "http://schemas.microsoft.com/exchange/services/2006/messages"[Lit][GblCplx] }
MoveItemType         = class;                 { "http://schemas.microsoft.com/exchange/services/2006/messages"[Lit][GblCplx] }
CreateAttachmentType = class;                 { "http://schemas.microsoft.com/exchange/services/2006/messages"[Lit][GblCplx] }
BaseMoveCopyFolderType = class;               { "http://schemas.microsoft.com/exchange/services/2006/messages"[GblCplx] }
MoveFolderType       = class;                 { "http://schemas.microsoft.com/exchange/services/2006/messages"[Lit][GblCplx] }
CopyFolderType       = class;                 { "http://schemas.microsoft.com/exchange/services/2006/messages"[Lit][GblCplx] }
GetItemType          = class;                 { "http://schemas.microsoft.com/exchange/services/2006/messages"[Lit][GblCplx] }
SetUserOofSettingsRequest2 = class;           { "http://schemas.microsoft.com/exchange/services/2006/messages"[Lit][GblCplx] }
GetUserOofSettingsRequest2 = class;           { "http://schemas.microsoft.com/exchange/services/2006/messages"[Lit][GblCplx] }
BaseDelegateType     = class;                 { "http://schemas.microsoft.com/exchange/services/2006/messages"[GblCplx] }
GetRoomListsType     = class;                 { "http://schemas.microsoft.com/exchange/services/2006/messages"[Lit][GblCplx] }
GetRoomsType         = class;                 { "http://schemas.microsoft.com/exchange/services/2006/messages"[Lit][GblCplx] }

[snip]

implementation
  uses SysUtils;

destructor FreeBusyResponseType.Destroy;
begin
  SysUtils.FreeAndNil(FResponseMessage);
  SysUtils.FreeAndNil(FFreeBusyView);
  inherited Destroy;
end;

procedure FreeBusyResponseType.SetResponseMessage(Index: Integer; const AResponseMessageType: ResponseMessageType);
begin
  FResponseMessage := AResponseMessageType;
  FResponseMessage_Specified := True;
end;

Example parts of XE3 file:

GetUserAvailabilityResponseType = class;      { "http://schemas.microsoft.com/exchange/services/2006/messages"[Lit][GblCplx] }
FreeBusyResponseType = class;                 { "http://schemas.microsoft.com/exchange/services/2006/messages"[GblCplx] }
FieldURIOrConstantType = class;               { "http://schemas.microsoft.com/exchange/services/2006/types"[GblCplx] }
SetUserOofSettingsResponse2 = class;          { "http://schemas.microsoft.com/exchange/services/2006/messages"[Lit][GblCplx] }
MessageXml           = class;                 { "http://schemas.microsoft.com/exchange/services/2006/messages"[Cplx] }
BaseRequestType      = class;                 { "http://schemas.microsoft.com/exchange/services/2006/messages"[GblCplx] }
BaseMoveCopyFolderType = class;               { "http://schemas.microsoft.com/exchange/services/2006/messages"[GblCplx] }
MoveFolderType       = class;                 { "http://schemas.microsoft.com/exchange/services/2006/messages"[Lit][GblCplx] }
CopyFolderType       = class;                 { "http://schemas.microsoft.com/exchange/services/2006/messages"[Lit][GblCplx] }
CreateAttachmentType = class;                 { "http://schemas.microsoft.com/exchange/services/2006/messages"[Lit][GblCplx] }
GetItemType          = class;                 { "http://schemas.microsoft.com/exchange/services/2006/messages"[Lit][GblCplx] }
BaseMoveCopyItemType = class;                 { "http://schemas.microsoft.com/exchange/services/2006/messages"[GblCplx] }
MoveItemType         = class;                 { "http://schemas.microsoft.com/exchange/services/2006/messages"[Lit][GblCplx] }
CopyItemType         = class;                 { "http://schemas.microsoft.com/exchange/services/2006/messages"[Lit][GblCplx] }
GetRoomsType         = class;                 { "http://schemas.microsoft.com/exchange/services/2006/messages"[Lit][GblCplx] }
SetUserOofSettingsRequest2 = class;           { "http://schemas.microsoft.com/exchange/services/2006/messages"[Lit][GblCplx] }
BaseDelegateType     = class;                 { "http://schemas.microsoft.com/exchange/services/2006/messages"[GblCplx] }
DeleteUserConfigurationType = class;          { "http://schemas.microsoft.com/exchange/services/2006/messages"[Lit][GblCplx] }
CreateUserConfigurationType = class;          { "http://schemas.microsoft.com/exchange/services/2006/messages"[Lit][GblCplx] }
UpdateUserConfigurationType = class;          { "http://schemas.microsoft.com/exchange/services/2006/messages"[Lit][GblCplx] }

[snip]

implementation
  uses SysUtils;

constructor GetUserAvailabilityResponseType.Create;
begin
  inherited Create;
  FSerializationOptions := [xoLiteralParam];
end;

destructor GetUserAvailabilityResponseType.Destroy;
var
  I: Integer;
begin
  for I := 0 to System.Length(FFreeBusyResponseArray)-1 do
    SysUtils.FreeAndNil(FFreeBusyResponseArray[I]);
  System.SetLength(FFreeBusyResponseArray, 0);
  SysUtils.FreeAndNil(FSuggestionsResponse);
  inherited Destroy;
end;

Upvotes: 2

Views: 416

Answers (1)

Toto
Toto

Reputation: 1440

ModelMaker has a compare tool on class/method implementation level. It is not affected by the order of them in the source file.

Upvotes: 2

Related Questions