瀏覽代碼

* fixes for new fv

peter 21 年之前
父節點
當前提交
d379e7285a
共有 7 個文件被更改,包括 115 次插入69 次删除
  1. 21 30
      ide/fpcompil.pas
  2. 14 10
      ide/fpdebug.pas
  3. 5 2
      ide/fpviews.pas
  4. 6 0
      ide/globdir.inc
  5. 8 5
      ide/weditor.pas
  6. 48 15
      ide/wini.pas
  7. 13 7
      ide/wviews.pas

+ 21 - 30
ide/fpcompil.pas

@@ -280,40 +280,28 @@ var
   ClassS: string[20];
   S: string;
 begin
-  if TClass=
-    V_Fatal       then ClassS:=msg_class_Fatal   else if TClass =
-    V_Error       then ClassS:=msg_class_Error   else if TClass =
-    V_Normal      then ClassS:=msg_class_Normal  else if TClass =
-    V_Warning     then ClassS:=msg_class_Warning else if TClass =
-    V_Note        then ClassS:=msg_class_Note    else if TClass =
-    V_Hint        then ClassS:=msg_class_Hint
+  case TClass and V_LevelMask of
+    V_Fatal   : ClassS:=msg_class_Fatal;  
+    V_Error   : ClassS:=msg_class_Error;  
+    V_Normal  : ClassS:=msg_class_Normal; 
+    V_Warning : ClassS:=msg_class_Warning;
+    V_Note    : ClassS:=msg_class_Note;   
+    V_Hint    : ClassS:=msg_class_Hint;
 {$ifdef VERBOSETXT}
-    else if TClass =
-{$ifdef COMPILER_1_0}
-    V_Macro       then ClassS:=msg_class_macro   else if TClass =
-    V_Procedure   then ClassS:=msg_class_procedure else if TClass =
-{$endif}
-    V_Conditional then ClassS:=msg_class_conditional else if TClass =
-    V_Info        then ClassS:=msg_class_info    else if TClass =
-    V_Status      then ClassS:=msg_class_status  else if TClass =
-    V_Used        then ClassS:=msg_class_used    else if TClass =
-    V_Tried       then ClassS:=msg_class_tried   else if TClass =
-    V_Debug       then ClassS:=msg_class_debug
-  else
-   ClassS:='???';
-{$else}
-  else
-   ClassS:='';
+    V_Conditional : ClassS:=msg_class_conditional;
+    V_Info    : ClassS:=msg_class_info;
+    V_Status  : ClassS:=msg_class_status;
+    V_Used    : ClassS:=msg_class_used;
+    V_Tried   : ClassS:=msg_class_tried;
+    V_Debug   : ClassS:=msg_class_debug;
 {$endif}
+    else
+      ClassS:='???';
+  end;  
   if ClassS<>'' then
    ClassS:=RExpand(ClassS,0)+': ';
   if assigned(Module) and
-{$ifdef COMPILER_1_0}
-     (TClass<=V_ShowFile)
-{$else}
-     ((TClass and V_LineInfo)=V_LineInfo)
-{$endif}
-     {and (status.currentsource<>'') and (status.currentline>0)} then
+     ((TClass and V_LineInfo)=V_LineInfo) then
     begin
       if Row>0 then
        begin
@@ -1306,7 +1294,10 @@ end;
 end.
 {
   $Log$
-  Revision 1.26  2004-11-05 00:00:33  peter
+  Revision 1.27  2004-11-06 17:22:52  peter
+    * fixes for new fv
+
+  Revision 1.26  2004/11/05 00:00:33  peter
   set exefile after compilation, before the target_info is not filled
 
   Revision 1.25  2004/11/02 23:53:19  peter

+ 14 - 10
ide/fpdebug.pas

@@ -1403,10 +1403,11 @@ begin
 {$else}
   CurDir:=LowerCaseStr(GetCurDir);
 {$endif Unix}
-  if Pos(CurDir,OSFileName(FEXpand(AFile)))=1 then
-    FileName:=NewStr(Copy(OSFileName(FExpand(AFile)),length(CurDir)+1,255))
+  AFile:=FEXpand(AFile);
+  if Pos(CurDir,OSFileName(AFile))=1 then
+    FileName:=NewStr(Copy(OSFileName(AFile),length(CurDir)+1,255))
   else
-    FileName:=NewStr(OSFileName(FExpand(AFile)));
+    FileName:=NewStr(OSFileName(AFile));
   Name:=nil;
   Line:=ALine;
   IgnoreCount:=0;
@@ -1597,7 +1598,7 @@ var W: PSourceWindow;
 begin
   if typ=bt_file_line then
     begin
-      W:=SearchOnDesktop(FExpand(OSFileName(GetStr(FileName))),false);
+      W:=SearchOnDesktop(OSFileName(GetStr(FileName)),false);
       If assigned(W) then
         begin
           if state=bs_enabled then
@@ -1663,7 +1664,7 @@ procedure TBreakpointCollection.ShowBreakpoints(W : PFPWindow);
   procedure SetInSource(P : PBreakpoint);{$ifndef FPC}far;{$endif}
   begin
     If assigned(P^.FileName) and
-      (OSFileName(FExpand(P^.FileName^))=OSFileName(FExpand(PSourceWindow(W)^.Editor^.FileName))) then
+      (OSFileName(P^.FileName^)=OSFileName(FExpand(PSourceWindow(W)^.Editor^.FileName))) then
       PSourceWindow(W)^.Editor^.SetLineFlagState(P^.Line-1,lfBreakpoint,P^.state=bs_enabled);
   end;
 
@@ -1683,7 +1684,7 @@ procedure TBreakpointCollection.ShowBreakpoints(W : PFPWindow);
                 S:=PDisassemblyWindow(W)^.Editor^.GetDisplayText(i);
                 ps:=pos(':',S);
                 qs:=pos(' ',copy(S,ps+1,High(S)));
-                if (GDBFileName(FExpand(P^.FileName^))=GDBFileName(FExpand(Copy(S,1,ps-1)))) and
+                if (GDBFileName(P^.FileName^)=GDBFileName(FExpand(Copy(S,1,ps-1)))) and
                    (StrToInt(copy(S,ps+1,qs-1))=P^.line) then
                   PDisassemblyWindow(W)^.Editor^.SetLineFlagState(i,lfBreakpoint,P^.state=bs_enabled);
               end;
@@ -1709,7 +1710,7 @@ procedure TBreakpointCollection.AdaptBreakpoints(Editor : PSourceEditor; Pos, Ch
   procedure AdaptInSource(P : PBreakpoint);{$ifndef FPC}far;{$endif}
   begin
     If assigned(P^.FileName) and
-      (OSFileName(FExpand(P^.FileName^))=OSFileName(FExpand(Editor^.FileName))) then
+      (OSFileName(P^.FileName^)=OSFileName(FExpand(Editor^.FileName))) then
         begin
           if P^.state=bs_enabled then
             Editor^.SetLineFlagState(P^.Line-1,lfBreakpoint,false);
@@ -1747,7 +1748,7 @@ function TBreakpointCollection.FindBreakpointAt(Editor : PSourceEditor; Line : l
   function IsAtLine(P : PBreakpoint) : boolean;{$ifndef FPC}far;{$endif}
   begin
     If assigned(P^.FileName) and
-       (OSFileName(FExpand(P^.FileName^))=OSFileName(FExpand(Editor^.FileName))) and
+       (OSFileName(P^.FileName^)=OSFileName(FExpand(Editor^.FileName))) and
        (Line=P^.Line) then
       IsAtLine:=true
     else
@@ -1794,7 +1795,7 @@ var PB : PBreakpoint;
   function IsThere(P : PBreakpoint) : boolean;{$ifndef FPC}far;{$endif}
   begin
     IsThere:=(P^.typ=bt_file_line) and assigned(P^.FileName) and
-      (OSFileName(FExpand(P^.FileName^))=FileName) and (P^.Line=LineNr);
+      (OSFileName(P^.FileName^)=FileName) and (P^.Line=LineNr);
   end;
 begin
     FileName:=OSFileName(FileName);
@@ -3603,7 +3604,10 @@ end.
 
 {
   $Log$
-  Revision 1.51  2004-07-09 23:17:25  peter
+  Revision 1.52  2004-11-06 17:22:52  peter
+    * fixes for new fv
+
+  Revision 1.51  2004/07/09 23:17:25  peter
     * revert isatty patch
 
   Revision 1.49  2004/02/20 21:46:06  peter

+ 5 - 2
ide/fpviews.pas

@@ -2107,7 +2107,7 @@ procedure TSourceWindow.SetTitle(ATitle: string);
 begin
   if Title<>nil then DisposeStr(Title);
   Title:=NewStr(ATitle);
-{$ifdef FVISION}
+{$ifdef OLDGVFVISION}
   If assigned(Owner) then
     DrawBorder;
 {$else}
@@ -4581,7 +4581,10 @@ end;
 END.
 {
   $Log$
-  Revision 1.45  2004-11-05 00:21:56  peter
+  Revision 1.46  2004-11-06 17:22:52  peter
+    * fixes for new fv
+
+  Revision 1.45  2004/11/05 00:21:56  peter
   version info at startup
 
   Revision 1.44  2004/05/03 21:12:54  peter

+ 6 - 0
ide/globdir.inc

@@ -134,6 +134,12 @@
 {$ifdef FPC}
   {$define USERESSTRINGS}
   {$define USE_FREEVISION}
+  
+  { Use inlining for small functions }
+  {$ifndef VER1_0}
+    {$inline on}
+    {.$define USEINLINE}
+  {$endif}
 {$endif}
 
 {$define TEST_PARTIAL_SYNTAX}

+ 8 - 5
ide/weditor.pas

@@ -280,7 +280,7 @@ type
    {a}function    GetEditorInfo(Editor: PCustomCodeEditor): PEditorLineInfo; virtual;
    {a}function    GetFlags: longint; virtual;
    {a}procedure   SetFlags(AFlags: longint); virtual;
-      function    IsFlagSet(AFlag: longint): boolean;
+      function    IsFlagSet(AFlag: longint): boolean; {$ifdef USEINLINE}inline;{$endif}
       procedure   SetFlagState(AFlag: longint; ASet: boolean);
       destructor  Done; virtual;
     public { internal use only! }
@@ -493,7 +493,7 @@ type
    {a}procedure   SetSyntaxCompleted(SC: boolean); virtual;
    {a}function    GetLastSyntaxedLine: sw_integer; virtual;
    {a}procedure   SetLastSyntaxedLine(ALine: sw_integer); virtual;
-      function    IsFlagSet(AFlag: longint): boolean;
+      function    IsFlagSet(AFlag: longint): boolean;{$ifdef USEINLINE}inline;{$endif}
       function    GetReservedColCount: sw_integer; virtual;
    {a}function    GetTabSize: integer; virtual;
    {a}procedure   SetTabSize(ATabSize: integer); virtual;
@@ -1311,7 +1311,7 @@ begin
   Abstract;
 end;
 
-function TCustomLine.IsFlagSet(AFlag: longint): boolean;
+function TCustomLine.IsFlagSet(AFlag: longint): boolean;{$ifdef USEINLINE}inline;{$endif}
 begin
   IsFlagSet:=(GetFlags and AFlag)=AFlag;
 end;
@@ -2739,7 +2739,7 @@ begin
   Abstract;
 end;
 
-function TCustomCodeEditor.IsFlagSet(AFlag: longint): boolean;
+function TCustomCodeEditor.IsFlagSet(AFlag: longint): boolean;{$ifdef USEINLINE}inline;{$endif}
 begin
   IsFlagSet:=(GetFlags and AFlag)=AFlag;
 end;
@@ -7271,7 +7271,10 @@ end;
 END.
 {
   $Log$
-  Revision 1.46  2004-11-03 12:08:30  peter
+  Revision 1.47  2004-11-06 17:22:53  peter
+    * fixes for new fv
+
+  Revision 1.46  2004/11/03 12:08:30  peter
     * fixed newline broken by valgrind patch
 
   Revision 1.45  2004/11/02 23:53:19  peter

+ 48 - 15
ide/wini.pas

@@ -31,6 +31,7 @@ type
       procedure   SetValue(const S: string);
       destructor  Done; virtual;
     private
+      TagHash  : Cardinal;
       Tag      : PString;
       Value    : PString;
       Comment  : PString;
@@ -49,6 +50,7 @@ type
       procedure   ForEachEntry(EnumProc: pointer); virtual;
       destructor  Done; virtual;
     private
+      NameHash : Cardinal;
       Name     : PString;
       Entries  : PCollection;
     end;
@@ -87,6 +89,15 @@ implementation
 uses
   WUtils;
 
+function CalcHash(const s: String): Cardinal;
+var
+  i: integer;
+begin
+  CalcHash := 0;
+  for i := 1 to Length(s) do
+    CalcHash := CalcHash shl 9 - CalcHash shl 4 + Ord(S[I]);
+end;
+
 constructor TINIEntry.Init(const ALine: string);
 begin
   inherited Init;
@@ -154,6 +165,7 @@ begin
   if P<>0 then
     begin
       Tag:=NewStr(copy(S,1,P-1));
+      TagHash:=CalcHash(UpcaseStr(Tag^));
       P2:=P+1; InString:=false; ValueS:='';
       StartP:=P2;
       while (P2<=length(S)) do
@@ -170,6 +182,7 @@ begin
     end else
     begin
       Tag:=nil;
+      TagHash:=0;
       Value:=nil;
       Comment:=NewStr(S);
     end;
@@ -190,6 +203,7 @@ constructor TINISection.Init(const AName: string);
 begin
   inherited Init;
   Name:=NewStr(AName);
+  NameHash:=CalcHash(UpcaseStr(AName));
   New(Entries, Init(50,500));
 end;
 
@@ -230,13 +244,23 @@ begin
 end;
 
 function TINISection.SearchEntry(Tag: string): PINIEntry;
-function MatchingEntry(E: PINIEntry): boolean;
-begin
-  MatchingEntry:=UpcaseStr(E^.GetTag)=Tag;
-end;
+var
+  P : PINIEntry;
+  I : Sw_integer;
+  Hash : Cardinal;
 begin
+  SearchEntry:=nil;
   Tag:=UpcaseStr(Tag);
-  SearchEntry:=Entries^.FirstThat(@MatchingEntry);
+  Hash:=CalcHash(Tag);
+  for I:=0 to Entries^.Count-1 do
+    begin
+      P:=Entries^.At(I);
+      if (P^.TagHash=Hash) and (UpcaseStr(P^.GetTag)=Tag) then
+        begin
+	  SearchEntry:=P;
+	  break;
+	end;
+    end;	
 end;
 
 procedure TINISection.DeleteEntry(Tag: string);
@@ -368,17 +392,23 @@ begin
 end;
 
 function TINIFile.SearchSection(Section: string): PINISection;
-function MatchingSection(P: PINISection): boolean;
-var SN: string;
-    M: boolean;
-begin
-  SN:=UpcaseStr(P^.GetName);
-  M:=SN=Section;
-  MatchingSection:=M;
-end;
+var
+  P : PINISection;
+  I : Sw_integer;
+  Hash : Cardinal;
 begin
+  SearchSection:=nil;
   Section:=UpcaseStr(Section);
-  SearchSection:=Sections^.FirstThat(@MatchingSection);
+  Hash:=CalcHash(Section);
+  for I:=0 to Sections^.Count-1 do
+    begin
+      P:=Sections^.At(I);
+      if (P^.NameHash=Hash) and (UpcaseStr(P^.GetName)=Section) then
+        begin
+	  SearchSection:=P;
+	  break;
+	end;
+    end;	
 end;
 
 function TINIFile.SearchEntry(const Section, Tag: string): PINIEntry;
@@ -479,7 +509,10 @@ end;
 END.
 {
   $Log$
-  Revision 1.4  2004-11-02 23:53:19  peter
+  Revision 1.5  2004-11-06 17:22:53  peter
+    * fixes for new fv
+
+  Revision 1.4  2004/11/02 23:53:19  peter
     * fixed crashes with ide and 1.9.x
 
   Revision 1.3  2002/09/07 15:40:50  peter

+ 13 - 7
ide/wviews.pas

@@ -1637,6 +1637,7 @@ end;
 
 function UpdateMenu(M: PMenu): boolean;
 var P: PMenuItem;
+    Enable,
     IsEnabled: boolean;
 begin
   if M=nil then begin UpdateMenu:=false; Exit; end;
@@ -1649,12 +1650,14 @@ begin
          if not P^.Disabled then
            IsEnabled:=true;
        end
-    else if (IsSeparator(P)=false) {and (P^.Disabled=false)} and
-       (Application^.CommandEnabled(P^.Command)=true) then
-       begin
-         p^.disabled:=not Application^.CommandEnabled(P^.Command);
-         if not p^.disabled then
-           IsEnabled:=true;
+    else
+      begin
+        if not IsSeparator(P) and
+	   Application^.CommandEnabled(P^.Command) then
+	  begin
+            p^.disabled:=false;
+            IsEnabled:=true;
+	  end;  
        end;
     P:=P^.Next;
   end;
@@ -2535,7 +2538,10 @@ end;
 END.
 {
   $Log$
-  Revision 1.8  2004-02-13 06:26:46  pierre
+  Revision 1.9  2004-11-06 17:22:53  peter
+    * fixes for new fv
+
+  Revision 1.8  2004/02/13 06:26:46  pierre
   * try to fix webbug 2931 completely
 
   Revision 1.7  2004/02/10 07:16:28  pierre