فهرست منبع

+ Evaluate window

git-svn-id: trunk@5504 -
daniel 18 سال پیش
والد
کامیت
4e2c9ffa9c
7فایلهای تغییر یافته به همراه112 افزوده شده و 3 حذف شده
  1. 1 0
      .gitattributes
  2. 1 0
      ide/Makefile
  3. 1 0
      ide/Makefile.fpc
  4. 1 1
      ide/fpdebug.pas
  5. 89 0
      ide/fpevalw.pas
  6. 5 2
      ide/fpide.pas
  7. 14 0
      ide/fpmdebug.inc

+ 1 - 0
.gitattributes

@@ -1247,6 +1247,7 @@ ide/fpcygwin.pas svneol=native#text/plain
 ide/fpdebug.pas svneol=native#text/plain
 ide/fpdebug.pas svneol=native#text/plain
 ide/fpdesk.pas svneol=native#text/plain
 ide/fpdesk.pas svneol=native#text/plain
 ide/fpdpansi.pas svneol=native#text/plain
 ide/fpdpansi.pas svneol=native#text/plain
+ide/fpevalw.pas svneol=native#text/x-pascal
 ide/fphelp.pas svneol=native#text/plain
 ide/fphelp.pas svneol=native#text/plain
 ide/fpide.pas svneol=native#text/plain
 ide/fpide.pas svneol=native#text/plain
 ide/fpini.pas svneol=native#text/plain
 ide/fpini.pas svneol=native#text/plain

+ 1 - 0
ide/Makefile

@@ -2527,6 +2527,7 @@ buildfp:
 	$(MAKE) fpc_all
 	$(MAKE) fpc_all
 	$(MAKE) postgdbinfo
 	$(MAKE) postgdbinfo
 gdb:
 gdb:
+	$(MAKE) -C ../packages/base/gdbint
 	$(MAKE) buildfp
 	$(MAKE) buildfp
 nogdb:
 nogdb:
 	$(MAKE) buildfp NOGDB=1
 	$(MAKE) buildfp NOGDB=1

+ 1 - 0
ide/Makefile.fpc

@@ -141,6 +141,7 @@ buildfp:
         $(MAKE) postgdbinfo
         $(MAKE) postgdbinfo
 
 
 gdb:
 gdb:
+        $(MAKE) -C ../packages/base/gdbint
         $(MAKE) buildfp
         $(MAKE) buildfp
 
 
 nogdb:
 nogdb:

+ 1 - 1
ide/fpdebug.pas

@@ -209,9 +209,9 @@ type
       procedure Force_new_value;
       procedure Force_new_value;
       destructor done;virtual;
       destructor done;virtual;
       expr : pstring;
       expr : pstring;
+      last_value,current_value : pchar;
     private
     private
       GDBRunCount : longint;
       GDBRunCount : longint;
-      last_value,current_value : pchar;
     end;
     end;
 
 
     PWatchesCollection = ^TWatchesCollection;
     PWatchesCollection = ^TWatchesCollection;

+ 89 - 0
ide/fpevalw.pas

@@ -0,0 +1,89 @@
+unit fpevalw;
+
+{****************************************************************************}
+                                  interface
+{****************************************************************************}
+
+uses fpdebug,dialogs,views,objects,fpconst,drivers;
+
+type  Pevaluate_dialog=^Tevaluate_dialog;
+      Tevaluate_dialog=object(Tdialog)
+        watch:Pwatch;
+        expr_input,expr_output:Pinputline;
+        constructor init(var bounds:Trect);
+        procedure evaluate;
+        procedure handleevent(var event:Tevent);virtual;
+        destructor done;
+      end;
+
+{****************************************************************************}
+                                implementation
+{****************************************************************************}
+
+constructor Tevaluate_dialog.init(var bounds:Trect);
+
+var r:Trect;
+    l:Plabel;
+    b:Pbutton;
+
+begin
+  inherited init(bounds,'Evaluate expression');
+  options:=options or ofcentered;
+  {watch is auto initialized to nil.}
+
+  r.assign(2,3,size.x-20,4);
+  new(expr_input,init(r,255));
+  insert(expr_input);
+
+  r.assign(2,2,size.x-20,3);
+  new(l,init(r,'E~x~pression:',expr_input));
+  insert(l);
+
+  r.assign(2,6,size.x-20,7);
+  new(expr_output,init(r,255));
+  insert(expr_output);
+
+  r.assign(2,5,size.x-20,6);
+  new(l,init(r,'~R~esult:',expr_output));
+  insert(l);
+
+  r.assign(size.x-14,3,size.x-3,5);
+  new(b,init(r,'~E~valuate',cmEvaluate,bfDefault));
+  insert(b);
+
+  r.assign(size.x-14,6,size.x-3,8);
+  new(b,init(r,'Help',cmHelp,bfNormal));
+  insert(b);
+
+  expr_input^.select;
+end;
+
+procedure Tevaluate_dialog.evaluate;
+
+begin
+  if watch<>nil then
+    dispose(watch,done);
+  new(watch,init(expr_input^.data^));
+  expr_output^.data^:=strpas(watch^.current_value);
+  expr_output^.drawview;
+end;
+
+procedure Tevaluate_dialog.handleevent(var event:Tevent);
+
+begin
+  inherited handleevent(event);
+  if event.what=evCommand then
+    case event.command of
+      cmEvaluate:
+        evaluate;
+    end;
+end;
+
+destructor Tevaluate_dialog.done;
+
+begin
+  if watch<>nil then
+    dispose(watch,done);
+end;
+
+end.

+ 5 - 2
ide/fpide.pas

@@ -21,7 +21,7 @@ uses
   Objects,Drivers,Views,App,Gadgets,MsgBox,Tabs,
   Objects,Drivers,Views,App,Gadgets,MsgBox,Tabs,
   WEditor,WCEdit,
   WEditor,WCEdit,
   Comphook,Browcol,
   Comphook,Browcol,
-  WHTMLScn,
+  WHTMLScn,fpevalw,
   FPViews,FPSymbol,fpstring;
   FPViews,FPSymbol,fpstring;
 
 
 type
 type
@@ -92,6 +92,7 @@ type
       procedure DoShowBreakpointList;
       procedure DoShowBreakpointList;
       procedure DoShowWatches;
       procedure DoShowWatches;
       procedure DoAddWatch;
       procedure DoAddWatch;
+      procedure do_evaluate;
       procedure DoShowRegisters;
       procedure DoShowRegisters;
       procedure DoShowFPU;
       procedure DoShowFPU;
       procedure DoShowVector;
       procedure DoShowVector;
@@ -404,6 +405,7 @@ begin
       NewItem(menu_debug_watches,'', kbNoKey, cmWatches, hcWatchesWindow,
       NewItem(menu_debug_watches,'', kbNoKey, cmWatches, hcWatchesWindow,
       NewItem(menu_debug_breakpoint,menu_key_debug_breakpoint, kbCtrlF8, cmToggleBreakpoint, hcToggleBreakpoint,
       NewItem(menu_debug_breakpoint,menu_key_debug_breakpoint, kbCtrlF8, cmToggleBreakpoint, hcToggleBreakpoint,
       NewItem(menu_debug_breakpointlist,'', kbNoKey, cmBreakpointList, hcBreakpointList,
       NewItem(menu_debug_breakpointlist,'', kbNoKey, cmBreakpointList, hcBreakpointList,
+      NewItem('~E~valuate...','Ctrl+F4', kbCtrlF4, cmEvaluate, hcEvaluate,
       NewItem(menu_debug_callstack,menu_key_debug_callstack, kbCtrlF3, cmStack, hcStackWindow,
       NewItem(menu_debug_callstack,menu_key_debug_callstack, kbCtrlF3, cmStack, hcStackWindow,
       NewLine(
       NewLine(
       NewItem(menu_debug_disassemble,'', kbNoKey, cmDisassemble, hcStackWindow,
       NewItem(menu_debug_disassemble,'', kbNoKey, cmDisassemble, hcStackWindow,
@@ -416,7 +418,7 @@ begin
 {$ifdef SUPPORT_REMOTE}
 {$ifdef SUPPORT_REMOTE}
       )
       )
 {$endif SUPPORT_REMOTE}
 {$endif SUPPORT_REMOTE}
-      )))))))))))))))),
+      ))))))))))))))))),
     NewSubMenu(menu_tools, hcToolsMenu, NewMenu(
     NewSubMenu(menu_tools, hcToolsMenu, NewMenu(
       NewItem(menu_tools_messages,menu_key_tools_messages, kbF11, cmToolsMessages, hcToolsMessages,
       NewItem(menu_tools_messages,menu_key_tools_messages, kbF11, cmToolsMessages, hcToolsMessages,
       NewItem(menu_tools_msgnext,menu_key_tools_msgnext, kbAltF8, cmToolsMsgNext, hcToolsMsgNext,
       NewItem(menu_tools_msgnext,menu_key_tools_msgnext, kbAltF8, cmToolsMsgNext, hcToolsMsgNext,
@@ -765,6 +767,7 @@ begin
              cmRegisters     : DoShowRegisters;
              cmRegisters     : DoShowRegisters;
              cmFPURegisters     : DoShowFPU;
              cmFPURegisters     : DoShowFPU;
              cmVectorRegisters : DoShowVector;
              cmVectorRegisters : DoShowVector;
+             cmEvaluate      : do_evaluate;
            { -- Options menu -- }
            { -- Options menu -- }
              cmSwitchesMode  : SetSwitchesMode;
              cmSwitchesMode  : SetSwitchesMode;
              cmCompiler      : DoCompilerSwitch;
              cmCompiler      : DoCompilerSwitch;

+ 14 - 0
ide/fpmdebug.inc

@@ -254,5 +254,19 @@ begin
   else
   else
     dispose(P,Done);
     dispose(P,Done);
 end;
 end;
+
+procedure TIDEapp.do_evaluate;
+
+var d:Pevaluate_dialog;
+    r:Trect;
+
+begin
+  desktop^.getextent(r);
+  r.b.x:=r.b.x*3 div 4;
+  r.b.y:=12;
+  new(d,init(r));
+  desktop^.execview(d);
+  dispose(d,done);
+end;
 {$endif NODEBUG}
 {$endif NODEBUG}