Преглед на файлове

* cleaning out use of old endianess routines (these are centralized in system since 2.0.x days)

git-svn-id: trunk@16621 -
marco преди 14 години
родител
ревизия
9c4675def5
променени са 2 файла, в които са добавени 18 реда и са изтрити 68 реда
  1. 1 33
      ide/whelp.pas
  2. 17 35
      ide/woahelp.pas

+ 1 - 33
ide/whelp.pas

@@ -176,12 +176,6 @@ function  GetHelpFileTypeCount: integer;
 procedure GetHelpFileType(Index: sw_integer; var HT: THelpFileType);
 procedure GetHelpFileType(Index: sw_integer; var HT: THelpFileType);
 procedure DoneHelpFilesTypes;
 procedure DoneHelpFilesTypes;
 
 
-{$ifdef ENDIAN_BIG}
-Procedure SwapLong(var x : longint);
-Procedure SwapWord(var x : word);
-{$endif ENDIAN_BIG}
-
-
 implementation
 implementation
 
 
 uses
 uses
@@ -212,32 +206,6 @@ const
   HelpFileTypes : PHelpFileTypeCollection = nil;
   HelpFileTypes : PHelpFileTypeCollection = nil;
 
 
 
 
-{$ifdef ENDIAN_BIG}
-Procedure SwapLong(var x : longint);
-var
-  y : word;
-  z : word;
-Begin
-  y := (x shr 16) and $FFFF;
-  y := ((y shl 8) and $FFFF) or ((y shr 8) and $ff);
-  z := x and $FFFF;
-  z := ((z shl 8) and $FFFF) or ((z shr 8) and $ff);
-  x := (longint(z) shl 16) or longint(y);
-End;
-
-
-Procedure SwapWord(var x : word);
-var
-  z : byte;
-Begin
-  z := (x shr 8) and $ff;
-  x := x and $ff;
-  x := (x shl 8);
-  x := x or z;
-End;
-{$endif ENDIAN_BIG}
-
-
 function NewHelpFileType(AOpenProc: THelpFileOpenProc): PHelpFileType;
 function NewHelpFileType(AOpenProc: THelpFileOpenProc): PHelpFileType;
 var P: PHelpFileType;
 var P: PHelpFileType;
 begin
 begin
@@ -386,7 +354,7 @@ begin
     P^.Links:=nil;
     P^.Links:=nil;
     if P^.Param<>nil then DisposeStr(P^.Param); P^.Param:=nil;
     if P^.Param<>nil then DisposeStr(P^.Param); P^.Param:=nil;
     if Assigned(P^.ExtData) then
     if Assigned(P^.ExtData) then
-      FreeMem(P^.ExtData{$ifndef FPC},P^.ExtDataSize{$endif});
+      FreeMem(P^.ExtData);
     if Assigned(P^.NamedMarks) then Dispose(P^.NamedMarks, Done); P^.NamedMarks:=nil;
     if Assigned(P^.NamedMarks) then Dispose(P^.NamedMarks, Done); P^.NamedMarks:=nil;
     Dispose(P);
     Dispose(P);
   end;
   end;

+ 17 - 35
ide/woahelp.pas

@@ -1,5 +1,5 @@
 {
 {
-    This file is part of the Free Pascal Integrated Development Environment
+    wThis file is part of the Free Pascal Integrated Development Environment
     Copyright (c) 2000 by Berczi Gabor
     Copyright (c) 2000 by Berczi Gabor
 
 
     Borland OA .HLP reader objects and routines
     Borland OA .HLP reader objects and routines
@@ -223,11 +223,9 @@ begin
       OK:=ReadRecord(R,true);
       OK:=ReadRecord(R,true);
       OK:=OK and (R.SClass=oa_rtFileHeader) and (R.Size=SizeOf(Header));
       OK:=OK and (R.SClass=oa_rtFileHeader) and (R.Size=SizeOf(Header));
       if OK then Move(R.Data^,Header,SizeOf(Header));
       if OK then Move(R.Data^,Header,SizeOf(Header));
-{$ifdef ENDIAN_BIG}
-      SwapWord(Header.Options);
-      SwapWord(Header.MainIndexScreen);
-      SwapWord(Header.MaxScreenSize);
-{$endif ENDIAN_BIG}
+      Header.Options        :=LEToN(Header.Options);
+      Header.MainIndexScreen:=LEToN(Header.MainIndexScreen);
+      Header.MaxScreenSize  :=LEToN(Header.MaxScreenSize );
       DisposeRecord(R);
       DisposeRecord(R);
     end;
     end;
   end;
   end;
@@ -240,9 +238,7 @@ var OK: boolean;
     L,I: longint;
     L,I: longint;
 function GetCtxPos(C: THLPContextPos): longint;
 function GetCtxPos(C: THLPContextPos): longint;
 begin
 begin
-{$ifdef ENDIAN_BIG}
-  SwapWord(C.LoW);
-{$endif ENDIAN_BIG}
+  c.LoW:=LEToN(Word(C.LoW));
   GetCtxPos:=longint(C.HiB) shl 16 + C.LoW;
   GetCtxPos:=longint(C.HiB) shl 16 + C.LoW;
 end;
 end;
 begin
 begin
@@ -250,9 +246,7 @@ begin
   if OK then
   if OK then
   with THLPContexts(R.Data^) do
   with THLPContexts(R.Data^) do
   begin
   begin
-{$ifdef ENDIAN_BIG}
-  SwapWord(ContextCount);
-{$endif ENDIAN_BIG}
+  ContextCount:=LEToN(ContextCount);
   for I:=1 to longint(ContextCount)-1 do
   for I:=1 to longint(ContextCount)-1 do
   begin
   begin
     if Topics^.Count=MaxCollectionSize then Break;
     if Topics^.Count=MaxCollectionSize then Break;
@@ -289,9 +283,7 @@ begin
   if OK then
   if OK then
   with THLPIndexTable(R.Data^) do
   with THLPIndexTable(R.Data^) do
   begin
   begin
-{$ifdef ENDIAN_BIG}
-  SwapWord(IndexCount);
-{$endif ENDIAN_BIG}
+  IndexCount:=LEToN(IndexCount);
   for I:=0 to IndexCount-1 do
   for I:=0 to IndexCount-1 do
   begin
   begin
     LenCode:=PByteArray(@Entries)^[CurPtr];
     LenCode:=PByteArray(@Entries)^[CurPtr];
@@ -335,9 +327,7 @@ var OK: boolean;
 begin
 begin
   FillChar(R, SizeOf(R), 0);
   FillChar(R, SizeOf(R), 0);
   F^.Read(H,SizeOf(H));
   F^.Read(H,SizeOf(H));
-{$ifdef ENDIAN_BIG}
-  SwapWord(H.RecLength);
-{$endif ENDIAN_BIG}
+  H.RecLength:=LEToN(H.RecLength);
   OK:=F^.Status=stOK;
   OK:=F^.Status=stOK;
   if OK then
   if OK then
   begin
   begin
@@ -447,7 +437,7 @@ begin
                 end;
                 end;
     ncRepChar : begin
     ncRepChar : begin
                   Cnt:=2+GetNextNibble;
                   Cnt:=2+GetNextNibble;
-                  C:=GetNextChar{$ifdef FPC}(){$endif};
+                  C:=GetNextChar();
                   for I:=1 to Cnt-1 do AddChar(C);
                   for I:=1 to Cnt-1 do AddChar(C);
                 end;
                 end;
   end;
   end;
@@ -516,19 +506,15 @@ begin
         TP55FormatVersion :
         TP55FormatVersion :
            with THLPKeywordRecord55(KeyWR.Data^) do
            with THLPKeywordRecord55(KeyWR.Data^) do
            begin
            begin
-{$ifdef ENDIAN_BIG}
-             SwapWord(UpContext);
-             SwapWord(DownContext);
-{$endif ENDIAN_BIG}
+             UpContext:=LEToN(UpContext);
+             DownContext:=LEToN(DownContext);
              T^.LinkCount:=KeywordCount;
              T^.LinkCount:=KeywordCount;
              GetMem(T^.Links,T^.LinkSize);
              GetMem(T^.Links,T^.LinkSize);
              if T^.LinkCount>0 then
              if T^.LinkCount>0 then
              for I:=0 to T^.LinkCount-1 do
              for I:=0 to T^.LinkCount-1 do
              with Keywords[I] do
              with Keywords[I] do
              begin
              begin
-{$ifdef ENDIAN_BIG}
-               SwapWord(KwContext);
-{$endif ENDIAN_BIG}
+               KwContext:=LEToN(KwContext);
                T^.Links^[I].Context:=KwContext;
                T^.Links^[I].Context:=KwContext;
                T^.Links^[I].FileID:=ID;
                T^.Links^[I].FileID:=ID;
                Inc(LinkPosCount);
                Inc(LinkPosCount);
@@ -542,19 +528,15 @@ begin
       else
       else
            with THLPKeywordRecord(KeyWR.Data^) do
            with THLPKeywordRecord(KeyWR.Data^) do
            begin
            begin
-{$ifdef ENDIAN_BIG}
-             SwapWord(KeywordCount);
-             SwapWord(UpContext);
-             SwapWord(DownContext);
-{$endif ENDIAN_BIG}
+             KeywordCount:=LEToN(KeywordCount);
+             UpContext:=LEToN(UpContext);
+             DownContext:=LEToN(DownContext);
              T^.LinkCount:=KeywordCount;
              T^.LinkCount:=KeywordCount;
              GetMem(T^.Links,T^.LinkSize);
              GetMem(T^.Links,T^.LinkSize);
              if KeywordCount>0 then
              if KeywordCount>0 then
              for I:=0 to KeywordCount-1 do
              for I:=0 to KeywordCount-1 do
              begin
              begin
-{$ifdef ENDIAN_BIG}
-               SwapWord(Keywords[I].KwContext);
-{$endif ENDIAN_BIG}
+               Keywords[I].KwContext:=LEToN(Keywords[I].KwContext);
                T^.Links^[I].Context:=Keywords[I].KwContext;
                T^.Links^[I].Context:=Keywords[I].KwContext;
                T^.Links^[I].FileID:=ID;
                T^.Links^[I].FileID:=ID;
              end;
              end;
@@ -588,7 +570,7 @@ end;
 
 
 procedure RegisterHelpType;
 procedure RegisterHelpType;
 begin
 begin
-  RegisterHelpFileType({$ifdef FPC}@{$endif}CreateProc);
+  RegisterHelpFileType(@CreateProc);
 end;
 end;
 
 
 END.
 END.