Browse Source

+ added col info in MessageItem
+ grep uses HighLightExts and should work for linux

pierre 26 years ago
parent
commit
e10e79b38e
4 changed files with 59 additions and 22 deletions
  1. 14 7
      ide/text/fpcompil.pas
  2. 9 3
      ide/text/fpmtools.inc
  3. 31 12
      ide/text/fpviews.pas
  4. 5 0
      ide/text/test2.pas

+ 14 - 7
ide/text/fpcompil.pas

@@ -139,9 +139,11 @@ begin
   if (status.verbosity and Level)=Level then
 {$endif}
    begin
-     ProgramInfoWindow^.AddMessage(Level,S,status.currentsourcepath+status.currentsource,status.currentline);
+     ProgramInfoWindow^.AddMessage(Level,S,status.currentsourcepath+status.currentsource,
+       status.currentline,status.currentcolumn);
      if SD<>nil then
-     SD^.MsgLB^.AddItem(New(PCompilerMessage, Init(Level, S, SmartPath(status.currentmodule),status.currentline)));
+     SD^.MsgLB^.AddItem(New(PCompilerMessage, Init(Level, S, SmartPath(status.currentmodule),
+       status.currentline,status.currentcolumn)));
    end;
 {$ifdef TEMPHEAP}
   switch_to_temp_heap;
@@ -223,10 +225,13 @@ begin
   do_stop:=CompilerStop;
   do_comment:=CompilerComment;
 
-{$ifdef go32v2}
+{$ifndef debug}
+  { this avoids all flickers
+    and allows to get assembler and linker messages
+    but also forbids to use GDB inside !! }
   ChangeRedir('fp$$$.out',false);
   ChangeErrorRedir('fp$$$.err',false);
-{$endif def go32v2}
+{$endif ndef debug}
 {$ifdef TEMPHEAP}
   split_heap;
   switch_to_temp_heap;
@@ -235,10 +240,8 @@ begin
 {$ifdef TEMPHEAP}
   switch_to_base_heap;
 {$endif TEMPHEAP}
-{$ifdef go32v2}
   RestoreRedir;
   RestoreErrorRedir;
-{$endif def go32v2}
 
   if status.errorCount=0
      then CompilationPhase:=cpDone
@@ -269,7 +272,11 @@ end;
 end.
 {
   $Log$
-  Revision 1.11  1999-02-08 09:31:00  florian
+  Revision 1.12  1999-02-22 11:29:36  pierre
+    + added col info in MessageItem
+    + grep uses HighLightExts and should work for linux
+
+  Revision 1.11  1999/02/08 09:31:00  florian
     + some split heap stuff, in $ifdef TEMPHEAP
 
   Revision 1.10  1999/02/05 13:51:39  peter

+ 9 - 3
ide/text/fpmtools.inc

@@ -83,7 +83,9 @@ begin
     Searchword:=PSourceWindow(DeskTop^.First)^.Editor^.GetCurrentWord
   else
     Searchword:='';
-  GrepArgs:='-n -i $TEXT *.pas *.pp *.inc';
+  { add "" for args with spaces }
+  { WARNING : text must still be entered in usual grep syntax }
+  GrepArgs:='-n -i "$TEXT" '+HighlightExts;
 { Dialog }
   R.Assign(0,0,45,8);
   new(PGrepDialog,Init(R,'Grep arguments'));
@@ -144,7 +146,7 @@ begin
                  val(copy(Line,1,p-1),lineNb,error);
                  if error=0 then
                    ProgramInfoWindow^.AddMessage(V_Normal,Copy(Line,p+1,255),
-                     ModuleName,LineNb);
+                     ModuleName,LineNb,1);
                end;
              ProgramInfoWindow^.Show;
              ProgramInfoWindow^.MakeFirst;
@@ -159,7 +161,11 @@ begin
 end;
 {
   $Log$
-  Revision 1.8  1999-02-22 02:15:17  peter
+  Revision 1.9  1999-02-22 11:29:37  pierre
+    + added col info in MessageItem
+    + grep uses HighLightExts and should work for linux
+
+  Revision 1.8  1999/02/22 02:15:17  peter
     + default extension for save in the editor
     + Separate Text to Find for the grep dialog
     * fixed redir crash with tp7

+ 31 - 12
ide/text/fpviews.pas

@@ -199,8 +199,8 @@ type
       TClass    : longint;
       Text      : PString;
       Module    : PString;
-      ID        : longint;
-      constructor Init(AClass: longint; AText, AModule: string; AID: longint);
+      ID,Col    : longint;
+      constructor Init(AClass: longint; AText, AModule: string; AID,ACol: longint);
       function    GetText(MaxLen: integer): string; virtual;
       procedure   Selected; virtual;
       function    GetModuleName: string; virtual;
@@ -234,7 +234,7 @@ type
       InfoST: PColorStaticText;
       LogLB : PMessageListBox;
       constructor Init;
-      procedure   AddMessage(AClass: longint; Msg, Module: string; Line: longint);
+      procedure   AddMessage(AClass: longint; Msg, Module: string; Line,Column: longint);
       procedure   SizeLimits(var Min, Max: TPoint); virtual;
       procedure   Close; virtual;
       procedure   HandleEvent(var Event: TEvent); virtual;
@@ -401,7 +401,11 @@ function EditorWindowFile(const Name : String): PSourceWindow;
 function EditorWindow(P: PView): boolean; {$ifndef FPC}far;{$endif}
 begin
   EditorWindow:=(TypeOf(P^)=TypeOf(TSourceWindow)) and
+{$ifdef linux}
                  (PSourceWindow(P)^.Editor^.FileName=Name);
+{$else linux}
+                 (UpCaseStr(PSourceWindow(P)^.Editor^.FileName)=UpCaseStr(Name));
+{$endif def linux}
 end;
 begin
   EditorWindowFile:=pointer(Desktop^.FirstThat(@EditorWindow));
@@ -2367,7 +2371,17 @@ begin
   GetNextEditorBounds(R);
   if Assigned(Owner) and (Owner=pointer(ProgramInfoWindow)) then
     R.B.Y:=Owner^.Origin.Y;
-  W:=TryToOpenFile(@R,P^.GetModuleName,0,P^.ID-1);
+  W:=EditorWindowFile(P^.GetModuleName);
+  if assigned(W) then
+    begin
+      W^.GetExtent(R);
+      if Assigned(Owner) and (Owner=pointer(ProgramInfoWindow)) then
+        R.B.Y:=Owner^.Origin.Y;
+      W^.ChangeBounds(R);
+      W^.Editor^.SetCurPtr(P^.Col-1,P^.ID-1);
+    end
+  else
+    W:=TryToOpenFile(@R,P^.GetModuleName,P^.Col-1,P^.ID-1);
   if W<>nil then
     begin
       W^.Select;
@@ -2386,7 +2400,7 @@ begin
   P:=List^.At(Focused);
   if P^.ID=0 then Exit;
   Desktop^.Lock;
-  W:=TryToOpenFile(nil,P^.GetModuleName,0,P^.ID-1);
+  W:=TryToOpenFile(nil,P^.GetModuleName,P^.Col-1,P^.ID-1);
   Message(Owner,evCommand,cmClose,nil);
   Desktop^.UnLock;
 end;
@@ -2467,13 +2481,14 @@ begin
   if List<>nil then Dispose(List, Done);
 end;
 
-constructor TMessageItem.Init(AClass: longint; AText, AModule: string; AID: longint);
+constructor TMessageItem.Init(AClass: longint; AText, AModule: string; AID,ACol: longint);
 begin
   inherited Init;
   TClass:=AClass;
   Text:=NewStr(AText);
   Module:=NewStr(AModule);
   ID:=AID;
+  Col:=ACol;
 end;
 
 function TMessageItem.GetText(MaxLen: integer): string;
@@ -2507,10 +2522,10 @@ begin
   if TClass=
     V_Fatal       then ClassS:='Fatal'       else if TClass =
     V_Error       then ClassS:='Error'       else if TClass =
-    V_Normal      then ClassS:=''           else if TClass =
+    V_Normal      then ClassS:=''            else if TClass =
     V_Warning     then ClassS:='Warning'     else if TClass =
-    V_Note      then ClassS:='Note'     else if TClass =
-    V_Hint      then ClassS:='Hint'     else if TClass =
+    V_Note        then ClassS:='Note'        else if TClass =
+    V_Hint        then ClassS:='Hint'        else if TClass =
     V_Macro       then ClassS:='Macro'       else if TClass =
     V_Procedure   then ClassS:='Procedure'   else if TClass =
     V_Conditional then ClassS:='Conditional' else if TClass =
@@ -2562,10 +2577,10 @@ begin
   Update;
 end;
 
-procedure TProgramInfoWindow.AddMessage(AClass: longint; Msg, Module: string; Line: longint);
+procedure TProgramInfoWindow.AddMessage(AClass: longint; Msg, Module: string; Line,Column: longint);
 begin
   if AClass>=V_Info then Line:=0;
-  LogLB^.AddItem(New(PCompilerMessage, Init(AClass, Msg, Module, Line)));
+  LogLB^.AddItem(New(PCompilerMessage, Init(AClass, Msg, Module, Line,Column)));
 end;
 
 procedure TProgramInfoWindow.SizeLimits(var Min, Max: TPoint);
@@ -3269,7 +3284,11 @@ end;
 END.
 {
   $Log$
-  Revision 1.17  1999-02-22 02:15:22  peter
+  Revision 1.18  1999-02-22 11:29:38  pierre
+    + added col info in MessageItem
+    + grep uses HighLightExts and should work for linux
+
+  Revision 1.17  1999/02/22 02:15:22  peter
     + default extension for save in the editor
     + Separate Text to Find for the grep dialog
     * fixed redir crash with tp7

+ 5 - 0
ide/text/test2.pas

@@ -1,3 +1,4 @@
+{$L+}
 unit Test2;
 
 interface
@@ -21,4 +22,8 @@ begin
   IsOdd:=(X mod 2)=1;
 end;
 
+procedure static;
+begin
+end;
+
 END.