Browse Source

* LineEnd bug corrected, now goes end of text even if selected
+ Until Return for debugger
+ Code for Quit inside GDB Window

pierre 26 years ago
parent
commit
823d269c08

+ 9 - 1
ide/text/fpcompil.pas

@@ -560,7 +560,10 @@ begin
        Shell(PpasFile+source_os.scriptext);
 {$else}
        Dos.Exec(GetEnv('COMSPEC'),'/C '+PpasFile+source_os.scriptext);
+       if DosError<>0 then
+         Inc(status.errorCount);
 {$endif}
+
     end;
 {$ifdef TEMPHEAP}
   switch_to_base_heap;
@@ -610,7 +613,12 @@ end;
 end.
 {
   $Log$
-  Revision 1.31  1999-06-28 19:32:17  peter
+  Revision 1.32  1999-07-12 13:14:13  pierre
+    * LineEnd bug corrected, now goes end of text even if selected
+    + Until Return for debugger
+    + Code for Quit inside GDB Window
+
+  Revision 1.31  1999/06/28 19:32:17  peter
     * fixes from gabor
 
   Revision 1.30  1999/06/28 15:59:04  pierre

+ 8 - 1
ide/text/fpconst.pas

@@ -119,6 +119,7 @@ const
      cmStack             = 236;
      cmBreakpointList    = 237;
      cmWatches           = 238;
+     cmUntilReturn       = 239;
 
      cmNotImplemented    = 1000;
      cmNewFromTemplate   = 1001;
@@ -255,6 +256,7 @@ const
      hcParameters        = hcShift+cmParameters;
      hcResetDebugger     = hcShift+cmResetDebugger;
      hcContToCursor      = hcShift+cmContToCursor;
+     hcUntilReturn       = hcShift+cmUntilReturn;
      hcOpenGDBWindow     = hcShift+cmOpenGDBWindow;
      hcToolsMsgNext      = hcShift+cmToolsMsgNext;
      hcToolsMsgPrev      = hcShift+cmToolsMsgPrev;
@@ -335,7 +337,12 @@ implementation
 END.
 {
   $Log$
-  Revision 1.21  1999-07-10 01:24:13  pierre
+  Revision 1.22  1999-07-12 13:14:14  pierre
+    * LineEnd bug corrected, now goes end of text even if selected
+    + Until Return for debugger
+    + Code for Quit inside GDB Window
+
+  Revision 1.21  1999/07/10 01:24:13  pierre
    + First implementation of watches window
 
   Revision 1.20  1999/06/30 23:58:11  pierre

+ 26 - 2
ide/text/fpdebug.pas

@@ -45,8 +45,10 @@ type
     procedure Reset;virtual;
     procedure Run;virtual;
     procedure Continue;virtual;
+    procedure UntilReturn;virtual;
     procedure CommandBegin(const s:string);virtual;
     procedure CommandEnd(const s:string);virtual;
+    function  AllowQuit : boolean;virtual;
   end;
 
   BreakpointType = (bt_function,bt_file_line,bt_watch,bt_awatch,bt_rwatch,bt_invalid);
@@ -313,12 +315,20 @@ end;
 
 procedure TDebugController.Continue;
 begin
-  if not debugger_started then
+  if not debuggee_started then
     Run
   else
     inherited Continue;
 end;
 
+procedure TDebugController.UntilReturn;
+begin
+  Command('finish');
+  { We could try to get the return value !
+    Not done yet }
+end;
+
+
 procedure TDebugController.CommandBegin(const s:string);
 begin
   if assigned(GDBWindow) and (in_command>1) then
@@ -344,6 +354,15 @@ begin
     end;
 end;
 
+function  TDebugController.AllowQuit : boolean;
+begin
+  if ConfirmBox('Really quit editor ?',nil,true)=cmOK then
+    begin
+      Message(@MyApp,evCommand,cmQuit,nil);
+    end
+  else
+    AllowQuit:=false;
+end;
 
 procedure TDebugController.Reset;
 var
@@ -1929,7 +1948,12 @@ end.
 
 {
   $Log$
-  Revision 1.21  1999-07-11 00:35:14  pierre
+  Revision 1.22  1999-07-12 13:14:15  pierre
+    * LineEnd bug corrected, now goes end of text even if selected
+    + Until Return for debugger
+    + Code for Quit inside GDB Window
+
+  Revision 1.21  1999/07/11 00:35:14  pierre
    * fix problems for wrong watches
 
   Revision 1.20  1999/07/10 01:24:14  pierre

+ 7 - 1
ide/text/fphelp.pas

@@ -135,6 +135,7 @@ begin
     hcParameters    : S:='Set command-line parameters passed to program at execution';
     hcResetDebugger : S:='Reset Program';
     hcContToCursor  : S:='Go on until Cursor position';
+    hcUntilReturn   : S:='Go on until end of current function';
     hcUserScreen    : S:='Switch to the full-screen user output';
 
     hcCompileMenu   : S:='Compile, build & make';
@@ -386,7 +387,12 @@ end;
 END.
 {
   $Log$
-  Revision 1.18  1999-07-10 01:24:16  pierre
+  Revision 1.19  1999-07-12 13:14:17  pierre
+    * LineEnd bug corrected, now goes end of text even if selected
+    + Until Return for debugger
+    + Code for Quit inside GDB Window
+
+  Revision 1.18  1999/07/10 01:24:16  pierre
    + First implementation of watches window
 
   Revision 1.17  1999/06/30 23:58:14  pierre

+ 11 - 3
ide/text/fpide.pas

@@ -60,6 +60,7 @@ type
       procedure DoRun;
       procedure DoResetDebugger;
       procedure DoContToCursor;
+      procedure DoContUntilReturn; 
       procedure Target;
       procedure DoCompilerMessages;
       procedure DoPrimaryFile;
@@ -230,9 +231,10 @@ begin
       NewItem('~S~tep over','F8', kbF8, cmStepOver, hcRun,
       NewItem('~T~race into','F7', kbF7, cmTraceInto, hcRun,
       NewItem('~G~oto Cursor','F4', kbF4, cmContToCursor, hcContToCursor,
+      NewItem('~U~ntil return','', kbNoKey,cmUntilReturn,hcUntilReturn,
       NewItem('P~a~rameters...','', kbNoKey, cmParameters, hcParameters,
       NewItem('~P~rogram reset','Ctrl+F2', kbCtrlF2, cmResetDebugger, hcResetDebugger,
-      nil))))))),
+      nil)))))))),
     NewSubMenu('~C~ompile',hcCompileMenu, NewMenu(
       NewItem('~C~ompile','Alt+F9', kbAltF9, cmCompile, hcCompile,
       NewItem('~M~ake','F9', kbF9, cmMake, hcMake,
@@ -413,6 +415,7 @@ begin
              cmRun           : DoRun;
              cmResetDebugger : DoResetDebugger;
              cmContToCursor  : DoContToCursor;
+             cmUntilReturn   : DoContUntilReturn;
            { -- Compile menu -- }
              cmCompile       : DoCompile(cCompile);
              cmBuild         : DoCompile(cBuild);
@@ -582,7 +585,7 @@ begin
   SetCmdState([cmCloseAll,cmTile,cmCascade,cmWindowList],IsThereAnyWindow);
   SetCmdState([cmFindProcedure,cmObjects,cmModules,cmGlobals,cmSymbol{,cmInformation}],IsSymbolInfoAvailable);
 {$ifndef NODEBUG}
-  SetCmdState([cmResetDebugger],assigned(debugger) and debugger^.debugger_started);
+  SetCmdState([cmResetDebugger,cmUntilReturn],assigned(debugger) and debugger^.debuggee_started);
 {$endif}
   SetCmdState([cmToolsMsgNext,cmToolsMsgPrev],MessagesWindow<>nil);
   UpdateTools;
@@ -766,7 +769,12 @@ end;
 END.
 {
   $Log$
-  Revision 1.32  1999-07-10 01:24:17  pierre
+  Revision 1.33  1999-07-12 13:14:18  pierre
+    * LineEnd bug corrected, now goes end of text even if selected
+    + Until Return for debugger
+    + Code for Quit inside GDB Window
+
+  Revision 1.32  1999/07/10 01:24:17  pierre
    + First implementation of watches window
 
   Revision 1.31  1999/06/29 22:50:14  peter

+ 38 - 5
ide/text/fpmrun.inc

@@ -24,12 +24,12 @@ begin
      if not assigned(Debugger) then
       exit;
    end;
-  if not debugger^.debugger_started then
+  if not debugger^.debuggee_started then
     Debugger^.StartTrace
   else
     Debugger^.TraceNext;
   While (Debugger^.InvalidSourceLine and
-         Debugger^.Debugger_started and
+         Debugger^.debuggee_started and
          not Debugger^.error) do
     begin
       Inc(Debugger^.HiddenStepsCount);
@@ -51,14 +51,14 @@ begin
      if not assigned(Debugger) then
        exit;
    end;
-  if not debugger^.debugger_started then
+  if not debugger^.debuggee_started then
     Debugger^.StartTrace
   else
    Debugger^.TraceStep;
   { I think we should not try to go deeper !
     if the source is not found PM }
   While (Debugger^.InvalidSourceLine and
-         Debugger^.Debugger_started and
+         Debugger^.debuggee_started and
          not Debugger^.error) do
     begin
       Inc(Debugger^.HiddenStepsCount);
@@ -70,6 +70,34 @@ begin
 {$endif NODEBUG}
 end;
 
+procedure TIDEApp.DoContUntilReturn;
+begin
+{$ifndef NODEBUG}
+  if not assigned(Debugger) then
+   begin
+     InitDebugger;
+     if not assigned(Debugger) then
+       exit;
+   end;
+  if not debugger^.debuggee_started then
+    Debugger^.StartTrace
+  else
+   Debugger^.TraceStep;                                                                                                                                                                                                                                        
+  { I think we should not try to go deeper !                                                                                                                                                                                                                   
+    if the source is not found PM }                                                                                                                                                                                                                            
+  While (Debugger^.InvalidSourceLine and                                                                                                                                                                                                                       
+         Debugger^.debuggee_started and
+         not Debugger^.error) do
+    begin                                                                                                                                                                                                                                                      
+      Inc(Debugger^.HiddenStepsCount);                                                                                                                                                                                                                         
+      Debugger^.TraceNext;                                                                                                                                                                                                                                     
+    end;                                                                                                                                                                                                                                                       
+  Debugger^.AnnotateError;                                                                                                                                                                                                                                     
+{$else NODEBUG}                                                                                                                                                                                                                                                
+  NoDebugger;                                                                                                                                                                                                                                                  
+{$endif NODEBUG}                                                                                                                                                                                                                                               
+end;                                                                                                                                                                                                                                                           
+                                                                                                                                                                                                                                                               
 
 procedure TIDEApp.DoRun;
 begin
@@ -211,7 +239,12 @@ end;
 
 {
   $Log$
-  Revision 1.15  1999-04-07 21:55:50  peter
+  Revision 1.16  1999-07-12 13:14:19  pierre
+    * LineEnd bug corrected, now goes end of text even if selected
+    + Until Return for debugger
+    + Code for Quit inside GDB Window
+
+  Revision 1.15  1999/04/07 21:55:50  peter
     + object support for browser
     * html help fixes
     * more desktop saving things

+ 22 - 3
ide/text/fpmtools.inc

@@ -46,6 +46,7 @@ end;
 procedure TIDEApp.ExecuteTool(Idx: integer);
 var Title,ProgramPath,Params: string;
     W: PSourceWindow;
+    ToFocus : sw_integer;
     Wo: word;
     Err: integer;
     CaptureFile: string;
@@ -72,8 +73,12 @@ begin
   EraseFile(FilterCaptureName);
 
   if CaptureToolTo=capMessageWindow then
-    AddToolCommand(ProgramPath+' '+Params);
-
+    begin
+      AddToolCommand(ProgramPath+' '+Params);
+      ToFocus:=ToolMessages^.count-1;
+    end
+  else
+    ToFocus:=-1;
   if CaptureToolTo<>capNone then
     ShowMessage('Executing tool '+KillTilde(Title)+'...');
 
@@ -111,6 +116,9 @@ begin
             if DosExitCode<>0 then
               ErrorBox('Filter execution successful. Exit code '+IntToStr(DosExitCode),nil);
           UpdateToolMessages;
+          if (ToFocus<>-1) then
+            if Assigned(MessagesWindow) then
+              MessagesWindow^.FocusItem(ToFocus);
           if DosError=0 then
             Messages;
         end;
@@ -139,6 +147,7 @@ var
   p,lineNb : longint;
   error : word;
   showmsg : boolean;
+  ToFocus : sw_integer;
   searchword,
   GrepExe,GrepArgs,Line,ModuleName : String;
   GrepOut : text;
@@ -199,6 +208,8 @@ begin
          GrepArgs:=IL2^.Data^;
          ReplaceStr(GrepArgs,'$TEXT',SearchWord);
          { Linux ? }
+         AddToolCommand(GrepExe+' '+GrepArgs);
+         ToFocus:=ToolMessages^.count-1;
          if not ExecuteRedir(GrepExe,GrepArgs,'',GrepOutName,GrepErrName) then
            Begin
               { 2 as exit code just means that
@@ -239,6 +250,9 @@ begin
     end;
   Dispose(PGrepDialog, Done);
   UpdateToolMessages;
+  if (ToFocus<>-1) then
+    if Assigned(MessagesWindow) then
+      MessagesWindow^.FocusItem(ToFocus);
   if showmsg then
     Messages;
 end;
@@ -246,7 +260,12 @@ end;
 
 {
   $Log$
-  Revision 1.11  1999-03-02 13:48:30  peter
+  Revision 1.12  1999-07-12 13:14:20  pierre
+    * LineEnd bug corrected, now goes end of text even if selected
+    + Until Return for debugger
+    + Code for Quit inside GDB Window
+
+  Revision 1.11  1999/03/02 13:48:30  peter
     * fixed far problem is fpdebug
     * tile/cascading with message window
     * grep fixes

+ 12 - 1
ide/text/fptools.pas

@@ -111,6 +111,7 @@ type
       constructor Load(var S: TStream);
       procedure   Store(var S: TStream);
       destructor  Done; virtual;
+      procedure   FocusItem(i : sw_integer);                                                                                                                                                                                                   
       procedure   SizeLimits(var Min, Max: TPoint); virtual;
     private
       MsgLB : PToolMessageListBox;
@@ -1436,6 +1437,11 @@ begin
   MsgLB^.Update;
 end;
 
+procedure TMessagesWindow.FocusItem(i : sw_integer);
+begin
+  MsgLB^.FocusItem(i);
+end;                                                                                                                                                                                                                                                           
+                                                                                                                                                                                                                                                               
 procedure TMessagesWindow.HandleEvent(var Event: TEvent);
 begin
   case Event.What of
@@ -1499,7 +1505,12 @@ end;
 END.
 {
   $Log$
-  Revision 1.10  1999-06-28 19:32:24  peter
+  Revision 1.11  1999-07-12 13:14:21  pierre
+    * LineEnd bug corrected, now goes end of text even if selected
+    + Until Return for debugger
+    + Code for Quit inside GDB Window
+
+  Revision 1.10  1999/06/28 19:32:24  peter
     * fixes from gabor
 
   Revision 1.9  1999/05/22 13:44:32  peter

+ 20 - 2
ide/text/fpviews.pas

@@ -349,6 +349,9 @@ implementation
 uses
   Video,Strings,Keyboard,Memory,MsgBox,Validate,
   Tokens,Version,
+{$ifndef NODEBUG}
+  gdbint,
+{$endif NODEBUG}
   {$ifdef VESA}Vesa,{$endif}
   FPSwitch,FPSymbol,FPDebug,FPVars,FPUtils,FPCompile,FPHelp;
 
@@ -2452,7 +2455,18 @@ begin
   Insert(New(PStaticText, Init(R2, ^C' Version '+VersionStr)));
   R2.Move(0,1);
   Insert(New(PStaticText, Init(R2, ^C'(Compiler Version '+Version_String+')')));
+{$ifndef NODEBUG}
+  if pos('Fake',GDBVersion)=0 then
+    begin
+      R2.Move(0,1);
+      Insert(New(PStaticText, Init(R2, ^C'(Debugging based on '+GDBVersion+')')));
+      R2.Move(0,1);
+    end
+  else
+    R2.Move(0,2);
+{$else NODEBUG}
   R2.Move(0,2);
+{$endif NODEBUG}
   Insert(New(PStaticText, Init(R2, ^C'Copyright (C) 1998-99 by')));
   R2.Move(0,2);
   Insert(New(PStaticText, Init(R2, ^C'B‚rczi G bor')));
@@ -2460,7 +2474,6 @@ begin
   Insert(New(PStaticText, Init(R2, ^C'and')));
   R2.Move(0,1);
   Insert(New(PStaticText, Init(R2, ^C'Peter Vreman')));
-
   New(C, Init(50,10));
   for I:=1 to 7 do
   AddLine('');
@@ -2611,7 +2624,12 @@ end;
 END.
 {
   $Log$
-  Revision 1.34  1999-06-30 23:58:20  pierre
+  Revision 1.35  1999-07-12 13:14:22  pierre
+    * LineEnd bug corrected, now goes end of text even if selected
+    + Until Return for debugger
+    + Code for Quit inside GDB Window
+
+  Revision 1.34  1999/06/30 23:58:20  pierre
     + BreakpointsList Window implemented
       with Edit/New/Delete functions
     + Individual breakpoint dialog with support for all types

+ 23 - 3
ide/text/weditor.pas

@@ -1988,9 +1988,18 @@ begin
 end;
 
 procedure TCodeEditor.LineEnd;
+var
+  s : string;
+  i : longint;
 begin
   if CurPos.Y<GetLineCount then
-    SetCurPtr(length(GetDisplayText(CurPos.Y)),CurPos.Y)
+    begin
+      s:=GetDisplayText(CurPos.Y);
+      i:=length(s);
+      while (i>0) and (s[i]=' ') do
+        dec(i);
+      SetCurPtr(i,CurPos.Y);
+    end
   else
     SetCurPtr(0,CurPos.Y);
 end;
@@ -2025,8 +2034,14 @@ begin
 end;
 
 procedure TCodeEditor.TextEnd;
+var s : string;
+    i : longint;
 begin
-  SetCurPtr(length(GetDisplayText(GetLineCount-1)),GetLineCount-1);
+  s:=GetDisplayText(GetLineCount-1);
+  i:=length(s);
+  while (i>0) and (s[i]=' ') do
+    dec(i);
+  SetCurPtr(i,GetLineCount-1);
 end;
 
 procedure TCodeEditor.JumpSelStart;
@@ -3934,7 +3949,12 @@ end;
 END.
 {
   $Log$
-  Revision 1.37  1999-06-29 22:50:16  peter
+  Revision 1.38  1999-07-12 13:14:24  pierre
+    * LineEnd bug corrected, now goes end of text even if selected
+    + Until Return for debugger
+    + Code for Quit inside GDB Window
+
+  Revision 1.37  1999/06/29 22:50:16  peter
     * more fixes from gabor
 
   Revision 1.36  1999/06/29 08:51:34  pierre