mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-11-01 22:09:28 +01:00
* Several things added (I cannot commit them independently !)
+ added TBreakpoint and TBreakpointCollection
+ added cmResetDebugger,cmGrep,CmToggleBreakpoint
+ Breakpoint list in INIFile
* Select items now also depend of SwitchMode
* Reading of option '-g' was not possible !
+ added search for -Fu args pathes in TryToOpen
+ added code for automatic opening of FileDialog
if source not found
This commit is contained in:
parent
9b3222cfbb
commit
b4b1e80dff
@ -21,7 +21,7 @@ LIBDIR=/usr/lib/gcc-lib/i486-linux/2.7.2.3
|
||||
endif
|
||||
|
||||
# We always need the API and FV
|
||||
NEEDUNITDIR=../../api ../../fv
|
||||
NEEDUNITDIR=../../api ../../fv ../../fv/base ../../fv/app ../../fv/dialogs
|
||||
|
||||
# when making a full version include the compiler
|
||||
ifdef FULL
|
||||
@ -32,10 +32,14 @@ override NEEDUNITDIR+=../fake/compiler
|
||||
endif
|
||||
|
||||
# when including debugger include the gdbinterface
|
||||
ifndef GDBINT
|
||||
GDBINT=gdbint
|
||||
endif
|
||||
|
||||
ifdef GDB
|
||||
override NEEDUNITDIR+=../../gdbint
|
||||
NEEDLIBDIR+=../../gdbint/libgdb
|
||||
NEEDOBJDIR+=../../gdbint/libgdb
|
||||
override NEEDUNITDIR+=../../$(GDBINT)
|
||||
NEEDLIBDIR+=../../$(GDBINT)/libgdb
|
||||
NEEDOBJDIR+=../../$(GDBINT)/libgdb
|
||||
else
|
||||
override NEEDUNITDIR+=../fake/gdb
|
||||
endif
|
||||
@ -84,12 +88,26 @@ fp$(EXEEXT): $(wildcard *.pas) $(wildcard *.inc)
|
||||
full:
|
||||
make all FULL=1
|
||||
|
||||
fullgdb:
|
||||
fullgdb: clean_compiler
|
||||
make all FULL=1 GDB=1
|
||||
|
||||
clean_compiler:
|
||||
make -C ../../compiler clean
|
||||
|
||||
#
|
||||
# $Log$
|
||||
# Revision 1.6 1999-01-29 10:34:31 peter
|
||||
# Revision 1.7 1999-02-04 13:32:00 pierre
|
||||
# * Several things added (I cannot commit them independently !)
|
||||
# + added TBreakpoint and TBreakpointCollection
|
||||
# + added cmResetDebugger,cmGrep,CmToggleBreakpoint
|
||||
# + Breakpoint list in INIFile
|
||||
# * Select items now also depend of SwitchMode
|
||||
# * Reading of option '-g' was not possible !
|
||||
# + added search for -Fu args pathes in TryToOpen
|
||||
# + added code for automatic opening of FileDialog
|
||||
# if source not found
|
||||
#
|
||||
# Revision 1.6 1999/01/29 10:34:31 peter
|
||||
# + needobjdir,needlibdir
|
||||
#
|
||||
# Revision 1.5 1999/01/28 19:58:23 peter
|
||||
|
||||
@ -42,6 +42,9 @@ uses
|
||||
Dos,Video,
|
||||
Objects,Drivers,Views,App,
|
||||
CompHook,
|
||||
{$ifdef go32v2}
|
||||
FPRedir,
|
||||
{$endif def go32v2}
|
||||
FPConst,FPVars,FPUtils,FPIntf,FPSwitches;
|
||||
|
||||
constructor TCompileStatusDialog.Init;
|
||||
@ -207,7 +210,15 @@ begin
|
||||
do_stop:=CompilerStop;
|
||||
do_comment:=CompilerComment;
|
||||
|
||||
{$ifdef go32v2}
|
||||
ChangeRedir('fp$$$.out',false);
|
||||
ChangeErrorRedir('fp$$$.err',false);
|
||||
{$endif def go32v2}
|
||||
Compile(FileName);
|
||||
{$ifdef go32v2}
|
||||
RestoreRedir;
|
||||
RestoreErrorRedir;
|
||||
{$endif def go32v2}
|
||||
|
||||
if status.errorCount=0
|
||||
then CompilationPhase:=cpDone
|
||||
@ -233,7 +244,18 @@ end;
|
||||
end.
|
||||
{
|
||||
$Log$
|
||||
Revision 1.7 1999-01-21 11:54:11 peter
|
||||
Revision 1.8 1999-02-04 13:32:01 pierre
|
||||
* Several things added (I cannot commit them independently !)
|
||||
+ added TBreakpoint and TBreakpointCollection
|
||||
+ added cmResetDebugger,cmGrep,CmToggleBreakpoint
|
||||
+ Breakpoint list in INIFile
|
||||
* Select items now also depend of SwitchMode
|
||||
* Reading of option '-g' was not possible !
|
||||
+ added search for -Fu args pathes in TryToOpen
|
||||
+ added code for automatic opening of FileDialog
|
||||
if source not found
|
||||
|
||||
Revision 1.7 1999/01/21 11:54:11 peter
|
||||
+ tools menu
|
||||
+ speedsearch in symbolbrowser
|
||||
* working run command
|
||||
|
||||
@ -17,35 +17,61 @@ unit FPDebug;
|
||||
interface
|
||||
|
||||
uses
|
||||
GDBCon;
|
||||
Objects,GDBCon;
|
||||
|
||||
type
|
||||
PDebugController=^TDebugController;
|
||||
TDebugController=object(TGDBController)
|
||||
Invalid_line : boolean;
|
||||
LastFileName : string;
|
||||
constructor Init(const exefn:string);
|
||||
destructor Done;
|
||||
procedure DoSelectSourceline(const fn:string;line:longint);virtual;
|
||||
{ procedure DoStartSession;virtual;
|
||||
procedure DoBreakSession;virtual;
|
||||
procedure DoEndSession(code:longint);virtual; }
|
||||
procedure DoBreakSession;virtual;}
|
||||
procedure DoEndSession(code:longint);virtual;
|
||||
procedure AnnotateError;
|
||||
procedure DoDebuggerScreen;virtual;
|
||||
procedure DoUserScreen;virtual;
|
||||
end;
|
||||
|
||||
BreakpointType = (bt_function,bt_file_line,bt_invalid);
|
||||
BreakpointState = (bs_enabled,bs_disabled,bs_invalid);
|
||||
|
||||
PBreakpointCollection=^TBreakpointCollection;
|
||||
|
||||
PBreakpoint=^TBreakpoint;
|
||||
TBreakpoint=object(TObject)
|
||||
typ : BreakpointType;
|
||||
state : BreakpointState;
|
||||
owner : PBreakpointCollection;
|
||||
Name : PString; { either function name or file name }
|
||||
Line : Longint; { only used for bt_file_line type }
|
||||
constructor Init_function(Const AFunc : String);
|
||||
constructor Init_file_line(Const AFile : String; ALine : longint);
|
||||
destructor Done;virtual;
|
||||
end;
|
||||
|
||||
TBreakpointCollection=object(TCollection)
|
||||
function At(Index: Integer): PBreakpoint;
|
||||
function ToggleFileLine(Const FileName: String;LineNr : Longint) : boolean;
|
||||
procedure FreeItem(Item: Pointer); virtual;
|
||||
end;
|
||||
|
||||
var
|
||||
Debugger : PDebugController;
|
||||
|
||||
BreakpointCollection : PBreakpointCollection;
|
||||
|
||||
procedure InitDebugger;
|
||||
procedure DoneDebugger;
|
||||
|
||||
|
||||
implementation
|
||||
|
||||
uses
|
||||
Dos,Mouse,Video,
|
||||
App,
|
||||
FPViews,FPVars,FPUtils,FPIntf,
|
||||
FPCompile,FPIDe;
|
||||
FPCompile,FPIde;
|
||||
|
||||
|
||||
{****************************************************************************
|
||||
@ -63,9 +89,21 @@ end;
|
||||
|
||||
destructor TDebugController.Done;
|
||||
begin
|
||||
{ kill the program if running }
|
||||
Reset;
|
||||
inherited Done;
|
||||
end;
|
||||
|
||||
procedure TDebugController.AnnotateError;
|
||||
var errornb : longint;
|
||||
begin
|
||||
if error then
|
||||
begin
|
||||
errornb:=error_num;
|
||||
ErrorBox(#3'Error within GDB'#13#3'Error code = %d',@errornb);
|
||||
end;
|
||||
end;
|
||||
|
||||
|
||||
procedure TDebugController.DoSelectSourceLine(const fn:string;line:longint);
|
||||
var
|
||||
@ -79,10 +117,25 @@ begin
|
||||
begin
|
||||
W^.Editor^.SetHighlightRow(Line);
|
||||
W^.Select;
|
||||
end;
|
||||
Invalid_line:=false;
|
||||
end
|
||||
{ only search a file once }
|
||||
else if fn<>LastFileName then
|
||||
begin
|
||||
if not MyApp.OpenSearch(fn+'*') then
|
||||
Invalid_line:=true;
|
||||
end
|
||||
else
|
||||
Invalid_line:=true;
|
||||
LastFileName:=fn;
|
||||
Desktop^.UnLock;
|
||||
end;
|
||||
|
||||
procedure TDebugController.DoEndSession(code:longint);
|
||||
begin
|
||||
InformationBox(#3'Program exited with '#13#3'exitcode = %d',@code);
|
||||
end;
|
||||
|
||||
|
||||
procedure TDebugController.DoDebuggerScreen;
|
||||
begin
|
||||
@ -96,6 +149,79 @@ begin
|
||||
end;
|
||||
|
||||
|
||||
{****************************************************************************
|
||||
TBreakpoint
|
||||
****************************************************************************}
|
||||
|
||||
constructor TBreakpoint.Init_function(Const AFunc : String);
|
||||
begin
|
||||
typ:=bt_function;
|
||||
state:=bs_enabled;
|
||||
GetMem(Name,Length(AFunc)+1);
|
||||
Name^:=AFunc;
|
||||
end;
|
||||
|
||||
constructor TBreakpoint.Init_file_line(Const AFile : String; ALine : longint);
|
||||
begin
|
||||
typ:=bt_file_line;
|
||||
state:=bs_enabled;
|
||||
GetMem(Name,Length(AFile)+1);
|
||||
Name^:=AFile;
|
||||
Line:=ALine;
|
||||
end;
|
||||
|
||||
|
||||
destructor TBreakpoint.Done;
|
||||
begin
|
||||
if assigned(Name) then
|
||||
FreeMem(Name,Length(Name^)+1);
|
||||
inherited Done;
|
||||
end;
|
||||
|
||||
{****************************************************************************
|
||||
TBreakpointCollection
|
||||
****************************************************************************}
|
||||
|
||||
function TBreakpointCollection.At(Index: Integer): PBreakpoint;
|
||||
begin
|
||||
At:=inherited At(Index);
|
||||
end;
|
||||
|
||||
procedure TBreakpointCollection.FreeItem(Item: Pointer);
|
||||
begin
|
||||
if Item<>nil then Dispose(PBreakpoint(Item),Done);
|
||||
end;
|
||||
|
||||
function TBreakpointCollection.ToggleFileLine(Const FileName: String;LineNr : Longint) : boolean;
|
||||
|
||||
var PB : PBreakpoint;
|
||||
|
||||
function IsThere(P : PBreakpoint) : boolean;
|
||||
begin
|
||||
IsThere:=(P^.typ=bt_file_line) and (P^.Name^=FileName) and (P^.Line=LineNr);
|
||||
end;
|
||||
begin
|
||||
PB:=FirstThat(@IsThere);
|
||||
ToggleFileLine:=false;
|
||||
If Assigned(PB) then
|
||||
if PB^.state=bs_disabled then
|
||||
begin
|
||||
PB^.state:=bs_enabled;
|
||||
ToggleFileLine:=true;
|
||||
end
|
||||
else if PB^.state=bs_enabled then
|
||||
PB^.state:=bs_disabled;
|
||||
If not assigned(PB) then
|
||||
begin
|
||||
PB:= New(PBreakpoint,Init_file_line(FileName,LineNr));
|
||||
if assigned(PB) then
|
||||
Begin
|
||||
Insert(PB);
|
||||
ToggleFileLine:=true;
|
||||
End;
|
||||
end;
|
||||
end;
|
||||
|
||||
{****************************************************************************
|
||||
Initialize
|
||||
****************************************************************************}
|
||||
@ -124,12 +250,24 @@ begin
|
||||
dispose(Debugger,Done);
|
||||
end;
|
||||
|
||||
|
||||
begin
|
||||
New(BreakpointCollection,init(10,10));
|
||||
end.
|
||||
|
||||
{
|
||||
$Log$
|
||||
Revision 1.3 1999-02-02 16:41:38 peter
|
||||
Revision 1.4 1999-02-04 13:32:02 pierre
|
||||
* Several things added (I cannot commit them independently !)
|
||||
+ added TBreakpoint and TBreakpointCollection
|
||||
+ added cmResetDebugger,cmGrep,CmToggleBreakpoint
|
||||
+ Breakpoint list in INIFile
|
||||
* Select items now also depend of SwitchMode
|
||||
* Reading of option '-g' was not possible !
|
||||
+ added search for -Fu args pathes in TryToOpen
|
||||
+ added code for automatic opening of FileDialog
|
||||
if source not found
|
||||
|
||||
Revision 1.3 1999/02/02 16:41:38 peter
|
||||
+ automatic .pas/.pp adding by opening of file
|
||||
* better debuggerscreen changes
|
||||
|
||||
|
||||
@ -19,6 +19,7 @@ interface
|
||||
uses
|
||||
Drivers,Views,App,
|
||||
{$ifdef EDITORS}Editors,{$else}WEditor,{$endif}
|
||||
Comphook,
|
||||
FPViews;
|
||||
|
||||
type
|
||||
@ -27,6 +28,7 @@ type
|
||||
procedure InitMenuBar; virtual;
|
||||
procedure InitStatusLine; virtual;
|
||||
procedure Open(FileName: string);
|
||||
function OpenSearch(FileName: string) : boolean;
|
||||
procedure HandleEvent(var Event: TEvent); virtual;
|
||||
function GetPalette: PPalette; virtual;
|
||||
procedure DosShell; virtual;
|
||||
@ -48,11 +50,13 @@ type
|
||||
procedure DoStepOver;
|
||||
procedure DoTraceInto;
|
||||
procedure DoRun;
|
||||
procedure DoResetDebugger;
|
||||
procedure Target;
|
||||
procedure PrimaryFile_;
|
||||
procedure ClearPrimary;
|
||||
procedure DoUserScreenWindow;
|
||||
procedure DoUserScreen;
|
||||
procedure DoToggleBreak;
|
||||
procedure Information;
|
||||
procedure Calculator;
|
||||
procedure ExecuteTool(Idx: integer);
|
||||
@ -63,6 +67,7 @@ type
|
||||
procedure DoDebuggerSwitch;
|
||||
procedure Directories;
|
||||
procedure Tools;
|
||||
procedure Grep;
|
||||
procedure EditorOptions(Editor: PEditor);
|
||||
procedure Mouse;
|
||||
procedure Colors;
|
||||
@ -105,7 +110,7 @@ uses
|
||||
Systems,BrowCol,
|
||||
WHelp,WHlpView,WINI,
|
||||
FPConst,FPVars,FPUtils,FPSwitches,FPIni,FPIntf,FPCompile,FPHelp,
|
||||
FPTemplt,FPCalc,FPUsrScr,FPSymbol,FPTools,FPDebug;
|
||||
FPTemplt,FPCalc,FPUsrScr,FPSymbol,FPTools,FPDebug,FPRedir;
|
||||
|
||||
|
||||
function IDEUseSyntaxHighlight(Editor: PFileEditor): boolean; {$ifndef FPC}far;{$endif}
|
||||
@ -113,9 +118,17 @@ begin
|
||||
IDEUseSyntaxHighlight:=(Editor^.FileName='') or MatchesFileList(NameAndExtOf(Editor^.FileName),HighlightExts);
|
||||
end;
|
||||
|
||||
function IDEUseTabsPattern(Editor: PFileEditor): boolean; {$ifndef FPC}far;{$endif}
|
||||
begin
|
||||
IDEUseTabsPattern:=(Editor^.FileName='') or MatchesFileList(NameAndExtOf(Editor^.FileName),TabsPattern);
|
||||
end;
|
||||
|
||||
constructor TIDEApp.Init;
|
||||
begin
|
||||
{$ifndef EDITORS}UseSyntaxHighlight:=IDEUseSyntaxHighlight;{$endif}
|
||||
{$ifndef EDITORS}
|
||||
UseSyntaxHighlight:=IDEUseSyntaxHighlight;
|
||||
UseTabsPattern:=IDEUseTabsPattern;
|
||||
{$endif}
|
||||
inherited Init;
|
||||
New(ClipboardWindow, Init);
|
||||
Desktop^.Insert(ClipboardWindow);
|
||||
@ -172,7 +185,8 @@ begin
|
||||
NewItem('~S~tep Over','F8', kbF8, cmStepOver, hcRun,
|
||||
NewItem('~T~race Into','F7', kbF7, cmTraceInto, hcRun,
|
||||
NewItem('P~a~rameters...','', kbNoKey, cmParameters, hcParameters,
|
||||
nil))))),
|
||||
NewItem('Reset ~P~rog','Ctrl+F2', kbCtrlF2, cmResetDebugger, hcResetDebugger,
|
||||
nil)))))),
|
||||
NewSubMenu('~C~ompile',hcCompileMenu, NewMenu(
|
||||
NewItem('~C~ompile','Alt+F9', kbAltF9, cmCompile, hcCompile,
|
||||
NewItem('~M~ake','F9', kbF9, cmMake, hcMake,
|
||||
@ -187,11 +201,14 @@ begin
|
||||
NewSubMenu('~D~ebug', hcDebugMenu, NewMenu(
|
||||
NewItem('~O~utput','', kbNoKey, cmUserScreenWindow, hcUserScreenWindow,
|
||||
NewItem('~U~ser screen','Alt+F5', kbAltF5, cmUserScreen, hcUserScreen,
|
||||
nil))),
|
||||
NewItem('~B~reakpoint','Ctrl+F8', kbCtrlF8, cmToggleBreakpoint, hcToggleBreakpoint,
|
||||
nil)))),
|
||||
NewSubMenu('~T~ools', hcToolsMenu, NewMenu(
|
||||
NewItem('~M~essages', '', kbNoKey, cmToolsMessages, hcToolsMessages,
|
||||
NewLine(
|
||||
NewItem('~G~rep', 'Shift+F2', kbShiftF2, cmGrep, hcGrep,
|
||||
NewItem('~C~alculator', '', kbNoKey, cmCalculator, hcCalculator,
|
||||
nil))),
|
||||
nil))))),
|
||||
NewSubMenu('~O~ptions', hcOptionsMenu, NewMenu(
|
||||
NewItem('Mode~.~..','', kbNoKey, cmSwitchesMode, hcSwitchesMode,
|
||||
NewItem('~C~ompiler...','', kbNoKey, cmCompiler, hcCompiler,
|
||||
@ -320,6 +337,8 @@ begin
|
||||
cmStepOver : DoStepOver;
|
||||
cmTraceInto : DoTraceInto;
|
||||
cmRun : DoRun;
|
||||
cmResetDebugger : DoResetDebugger;
|
||||
|
||||
{ -- Compile menu -- }
|
||||
cmCompile : DoCompile(cCompile);
|
||||
cmBuild : DoCompile(cBuild);
|
||||
@ -330,6 +349,7 @@ begin
|
||||
cmInformation : Information;
|
||||
{ -- Debug menu -- }
|
||||
cmUserScreen : DoUserScreen;
|
||||
cmToggleBreakpoint : DoToggleBreak;
|
||||
{ -- Options menu -- }
|
||||
cmSwitchesMode : SetSwitchesMode;
|
||||
cmCompiler : DoCompilerSwitch;
|
||||
@ -347,6 +367,7 @@ begin
|
||||
cmSaveAsINI : SaveAsINI;
|
||||
{ -- Tools menu -- }
|
||||
cmCalculator : Calculator;
|
||||
cmGrep : Grep;
|
||||
cmToolsBase+1..
|
||||
cmToolsBase+MaxToolCount
|
||||
: ExecuteTool(Event.Command-cmToolsBase);
|
||||
@ -623,7 +644,18 @@ end;
|
||||
END.
|
||||
{
|
||||
$Log$
|
||||
Revision 1.6 1999-02-02 16:41:39 peter
|
||||
Revision 1.7 1999-02-04 13:32:03 pierre
|
||||
* Several things added (I cannot commit them independently !)
|
||||
+ added TBreakpoint and TBreakpointCollection
|
||||
+ added cmResetDebugger,cmGrep,CmToggleBreakpoint
|
||||
+ Breakpoint list in INIFile
|
||||
* Select items now also depend of SwitchMode
|
||||
* Reading of option '-g' was not possible !
|
||||
+ added search for -Fu args pathes in TryToOpen
|
||||
+ added code for automatic opening of FileDialog
|
||||
if source not found
|
||||
|
||||
Revision 1.6 1999/02/02 16:41:39 peter
|
||||
+ automatic .pas/.pp adding by opening of file
|
||||
* better debuggerscreen changes
|
||||
|
||||
|
||||
@ -36,39 +36,55 @@ implementation
|
||||
uses
|
||||
Dos,Objects,Drivers,
|
||||
WINI,{$ifndef EDITORS}WEditor{$else}Editors{$endif},
|
||||
FPConst,FPVars,FPIntf,FPTools;
|
||||
FPDebug,FPConst,FPVars,
|
||||
FPIntf,FPTools,FPSwitch;
|
||||
|
||||
const
|
||||
{ INI file sections }
|
||||
secFiles = 'Files';
|
||||
secRun = 'Run';
|
||||
secCompile = 'Compile';
|
||||
secColors = 'Colors';
|
||||
secHelp = 'Help';
|
||||
secEditor = 'Editor';
|
||||
secFiles = 'Files';
|
||||
secRun = 'Run';
|
||||
secCompile = 'Compile';
|
||||
secColors = 'Colors';
|
||||
secHelp = 'Help';
|
||||
secEditor = 'Editor';
|
||||
secBreakpoint = 'Breakpoints';
|
||||
secHighlight = 'Highlight';
|
||||
secMouse = 'Mouse';
|
||||
secSearch = 'Search';
|
||||
secTools = 'Tools';
|
||||
secMouse = 'Mouse';
|
||||
secSearch = 'Search';
|
||||
secTools = 'Tools';
|
||||
|
||||
{ INI file tags }
|
||||
ieRecentFile = 'RecentFile';
|
||||
ieRunParameters = 'Parameters';
|
||||
iePrimaryFile = 'PrimaryFile';
|
||||
iePalette = 'Palette';
|
||||
ieHelpFiles = 'Files';
|
||||
ieCompileMode = 'CompileMode';
|
||||
iePalette = 'Palette';
|
||||
ieHelpFiles = 'Files';
|
||||
ieDefaultTabSize = 'DefaultTabSize';
|
||||
ieDefaultEditorFlags='DefaultFlags';
|
||||
ieHighlightExts = 'Exts';
|
||||
ieTabsPattern = 'NeedsTabs';
|
||||
ieDoubleClickDelay = 'DoubleDelay';
|
||||
ieReverseButtons = 'ReverseButtons';
|
||||
ieAltClickAction = 'AltClickAction';
|
||||
ieCtrlClickAction = 'CtrlClickAction';
|
||||
ieFindFlags = 'FindFlags';
|
||||
ieToolName = 'Title';
|
||||
ieFindFlags = 'FindFlags';
|
||||
ieToolName = 'Title';
|
||||
ieToolProgram = 'Program';
|
||||
ieToolParams = 'Params';
|
||||
ieToolHotKey = 'HotKey';
|
||||
ieBreakpointTyp = 'Type';
|
||||
ieBreakpointCount = 'Count';
|
||||
ieBreakpointState = 'State';
|
||||
ieBreakpointFunc = 'Function';
|
||||
ieBreakpointFile = 'FileName';
|
||||
ieBreakpointLine = 'LineNumber';
|
||||
|
||||
const
|
||||
BreakpointTypeStr : Array[BreakpointType] of String[9]
|
||||
= ( 'function','file-line','invalid' );
|
||||
BreakpointStateStr : Array[BreakpointState] of String[8]
|
||||
= ( 'enabled','disabled','invalid' );
|
||||
|
||||
procedure InitINIFile;
|
||||
var S: string;
|
||||
@ -106,13 +122,13 @@ begin
|
||||
P:=Pos('#',copy(S,I,255)); if P>0 then P:=I+P-1 else P:=length(S)+1;
|
||||
if Hex=false then
|
||||
begin
|
||||
X:=StrToInt(copy(S,I,P-I));
|
||||
OK:=(LastStrToIntResult=0) and (0<=X) and (X<=255);
|
||||
X:=StrToInt(copy(S,I,P-I));
|
||||
OK:=(LastStrToIntResult=0) and (0<=X) and (X<=255);
|
||||
end
|
||||
else
|
||||
begin
|
||||
X:=HexToInt(copy(S,I,P-I));
|
||||
OK:=(LastHexToIntResult=0) and (0<=X) and (X<=255);
|
||||
X:=HexToInt(copy(S,I,P-I));
|
||||
OK:=(LastHexToIntResult=0) and (0<=X) and (X<=255);
|
||||
end;
|
||||
if OK then C:=C+chr(X);
|
||||
Inc(I,P-I);
|
||||
@ -120,11 +136,75 @@ begin
|
||||
StrToPalette:=C;
|
||||
end;
|
||||
|
||||
procedure WriteOneBreakPointEntry(I : longint;INIFile : PINIFile);
|
||||
var PB : PBreakpoint;
|
||||
S : String;
|
||||
begin
|
||||
Str(I,S);
|
||||
PB:=BreakpointCollection^.At(I);
|
||||
If assigned(PB) then
|
||||
With PB^ do
|
||||
Begin
|
||||
INIFile^.SetEntry(secBreakpoint,ieBreakpointTyp+S,BreakpointTypeStr[typ]);
|
||||
INIFile^.SetEntry(secBreakpoint,ieBreakpointState+S,BreakpointStateStr[state]);
|
||||
case typ of
|
||||
bt_function :
|
||||
INIFile^.SetEntry(secBreakpoint,ieBreakpointFunc+S,Name^);
|
||||
bt_file_line :
|
||||
begin
|
||||
INIFile^.SetEntry(secBreakpoint,ieBreakpointFile+S,Name^);
|
||||
INIFile^.SetIntEntry(secBreakpoint,ieBreakpointLine+S,Line);
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure ReadOneBreakPointEntry(i : longint;INIFile : PINIFile);
|
||||
var PB : PBreakpoint;
|
||||
S,S2 : string;
|
||||
Line : longint;
|
||||
typ : BreakpointType;
|
||||
state : BreakpointState;
|
||||
|
||||
begin
|
||||
Str(I,S2);
|
||||
typ:=bt_invalid;
|
||||
S:=INIFile^.GetEntry(secBreakpoint,ieBreakpointTyp+S2,BreakpointTypeStr[typ]);
|
||||
for typ:=low(BreakpointType) to high(BreakpointType) do
|
||||
If pos(BreakpointTypeStr[typ],S)>0 then break;
|
||||
state:=bs_invalid;
|
||||
S:=INIFile^.GetEntry(secBreakpoint,ieBreakpointState+S2,BreakpointStateStr[state]);
|
||||
for state:=low(BreakpointState) to high(BreakpointState) do
|
||||
If pos(BreakpointStateStr[state],S)>0 then break;
|
||||
case typ of
|
||||
bt_invalid :;
|
||||
bt_function :
|
||||
begin
|
||||
S:=INIFile^.GetEntry(secBreakpoint,ieBreakpointFunc+S2,'');
|
||||
end;
|
||||
bt_file_line :
|
||||
begin
|
||||
S:=INIFile^.GetEntry(secBreakpoint,ieBreakpointFile+S2,'');
|
||||
Line:=INIFile^.GetIntEntry(secBreakpoint,ieBreakpointLine+S2,0);
|
||||
end;
|
||||
end;
|
||||
if (typ=bt_function) and (S<>'') then
|
||||
new(PB,init_function(S))
|
||||
else if (typ=bt_file_line) and (S<>'') then
|
||||
new(PB,init_file_line(S,Line));
|
||||
If assigned(PB) then
|
||||
PB^.state:=state;
|
||||
If assigned(PB) then
|
||||
BreakpointCollection^.Insert(PB);
|
||||
end;
|
||||
|
||||
function ReadINIFile: boolean;
|
||||
var INIFile: PINIFile;
|
||||
S,PS,S1,S2,S3: string;
|
||||
I,P: integer;
|
||||
BreakPointCount:longint;
|
||||
OK: boolean;
|
||||
ts : TSwitchMode;
|
||||
W: word;
|
||||
begin
|
||||
OK:=ExistsFile(INIPath);
|
||||
@ -138,16 +218,26 @@ begin
|
||||
if (S='') and (RecentFileCount>I-1) then RecentFileCount:=I-1;
|
||||
with RecentFiles[I] do
|
||||
begin
|
||||
P:=Pos(',',S); if P=0 then P:=length(S)+1;
|
||||
FileName:=copy(S,1,P-1); Delete(S,1,P);
|
||||
P:=Pos(',',S); if P=0 then P:=length(S)+1;
|
||||
LastPos.X:=Max(0,StrToInt(copy(S,1,P-1))); Delete(S,1,P);
|
||||
P:=Pos(',',S); if P=0 then P:=length(S)+1;
|
||||
LastPos.Y:=Max(0,StrToInt(copy(S,1,P-1))); Delete(S,1,P);
|
||||
P:=Pos(',',S); if P=0 then P:=length(S)+1;
|
||||
FileName:=copy(S,1,P-1); Delete(S,1,P);
|
||||
P:=Pos(',',S); if P=0 then P:=length(S)+1;
|
||||
LastPos.X:=Max(0,StrToInt(copy(S,1,P-1))); Delete(S,1,P);
|
||||
P:=Pos(',',S); if P=0 then P:=length(S)+1;
|
||||
LastPos.Y:=Max(0,StrToInt(copy(S,1,P-1))); Delete(S,1,P);
|
||||
end;
|
||||
end;
|
||||
SetRunParameters(INIFile^.GetEntry(secRun,ieRunParameters,GetRunParameters));
|
||||
PrimaryFile:=INIFile^.GetEntry(secCompile,iePrimaryFile,PrimaryFile);
|
||||
{ SwitchesModeStr : array[TSwitchMode] of string[8]=
|
||||
('NORMAL','DEBUG','RELEASE');}
|
||||
S:=INIFile^.GetEntry(secCompile,ieCompileMode,'');
|
||||
for ts:=low(TSwitchMode) to high(TSwitchMode) do
|
||||
begin
|
||||
if SwitchesModeStr[ts]=S then
|
||||
begin
|
||||
SwitchesMode:=ts;
|
||||
end;
|
||||
end;
|
||||
S:=INIFile^.GetEntry(secHelp,ieHelpFiles,'');
|
||||
repeat
|
||||
P:=Pos(';',S); if P=0 then P:=length(S)+1;
|
||||
@ -160,10 +250,17 @@ begin
|
||||
DefaultCodeEditorFlags:=INIFile^.GetIntEntry(secEditor,ieDefaultEditorFlags,DefaultCodeEditorFlags);
|
||||
{$endif}
|
||||
HighlightExts:=INIFile^.GetEntry(secHighlight,ieHighlightExts,HighlightExts);
|
||||
TabsPattern:=INIFile^.GetEntry(secHighlight,ieTabsPattern,TabsPattern);
|
||||
DoubleDelay:=INIFile^.GetIntEntry(secMouse,ieDoubleClickDelay,DoubleDelay);
|
||||
MouseReverse:=boolean(INIFile^.GetIntEntry(secMouse,ieReverseButtons,byte(MouseReverse)));
|
||||
AltMouseAction:=INIFile^.GetIntEntry(secMouse,ieAltClickAction,AltMouseAction);
|
||||
CtrlMouseAction:=INIFile^.GetIntEntry(secMouse,ieCtrlClickAction,CtrlMouseAction);
|
||||
FindFlags:=INIFile^.GetIntEntry(secSearch,ieFindFlags,FindFlags);
|
||||
{ Breakpoints }
|
||||
BreakpointCount:=INIFile^.GetIntEntry(secBreakpoint,ieBreakpointCount,0);
|
||||
for i:=1 to BreakpointCount do
|
||||
ReadOneBreakPointEntry(i-1,INIFile);
|
||||
|
||||
for I:=1 to MaxToolCount do
|
||||
begin
|
||||
S:=IntToStr(I);
|
||||
@ -192,6 +289,7 @@ var INIFile: PINIFile;
|
||||
S: string;
|
||||
S1,S2,S3: string;
|
||||
W: word;
|
||||
BreakPointCount:longint;
|
||||
I: integer;
|
||||
OK: boolean;
|
||||
procedure ConcatName(P: PString); {$ifndef FPC}far;{$endif}
|
||||
@ -204,13 +302,14 @@ begin
|
||||
for I:=1 to High(RecentFiles) do
|
||||
begin
|
||||
if I<=RecentFileCount then
|
||||
with RecentFiles[I] do S:=FileName+','+IntToStr(LastPos.X)+','+IntToStr(LastPos.Y)
|
||||
with RecentFiles[I] do S:=FileName+','+IntToStr(LastPos.X)+','+IntToStr(LastPos.Y)
|
||||
else
|
||||
S:='';
|
||||
S:='';
|
||||
INIFile^.SetEntry(secFiles,ieRecentFile+IntToStr(I),S);
|
||||
end;
|
||||
INIFile^.SetEntry(secRun,ieRunParameters,GetRunParameters);
|
||||
INIFile^.SetEntry(secCompile,iePrimaryFile,PrimaryFile);
|
||||
INIFile^.SetEntry(secCompile,ieCompileMode,SwitchesModeStr[SwitchesMode]);
|
||||
S:='';
|
||||
HelpFiles^.ForEach(@ConcatName);
|
||||
INIFile^.SetEntry(secHelp,ieHelpFiles,'"'+S+'"');
|
||||
@ -219,11 +318,17 @@ begin
|
||||
INIFile^.SetIntEntry(secEditor,ieDefaultEditorFlags,DefaultCodeEditorFlags);
|
||||
{$endif}
|
||||
INIFile^.SetEntry(secHighlight,ieHighlightExts,'"'+HighlightExts+'"');
|
||||
INIFile^.SetEntry(secHighlight,ieTabsPattern,'"'+TabsPattern+'"');
|
||||
INIFile^.SetIntEntry(secMouse,ieDoubleClickDelay,DoubleDelay);
|
||||
INIFile^.SetIntEntry(secMouse,ieReverseButtons,byte(MouseReverse));
|
||||
INIFile^.SetIntEntry(secMouse,ieAltClickAction,AltMouseAction);
|
||||
INIFile^.SetIntEntry(secMouse,ieCtrlClickAction,CtrlMouseAction);
|
||||
INIFile^.SetIntEntry(secSearch,ieFindFlags,FindFlags);
|
||||
{ Breakpoints }
|
||||
BreakPointCount:=BreakpointCollection^.Count;
|
||||
INIFile^.SetIntEntry(secBreakpoint,ieBreakpointCount,BreakpointCount);
|
||||
for i:=1 to BreakpointCount do
|
||||
WriteOneBreakPointEntry(I-1,INIFile);
|
||||
INIFile^.DeleteSection(secTools);
|
||||
for I:=1 to GetToolCount do
|
||||
begin
|
||||
@ -258,7 +363,18 @@ end;
|
||||
end.
|
||||
{
|
||||
$Log$
|
||||
Revision 1.5 1999-01-21 11:54:15 peter
|
||||
Revision 1.6 1999-02-04 13:32:04 pierre
|
||||
* Several things added (I cannot commit them independently !)
|
||||
+ added TBreakpoint and TBreakpointCollection
|
||||
+ added cmResetDebugger,cmGrep,CmToggleBreakpoint
|
||||
+ Breakpoint list in INIFile
|
||||
* Select items now also depend of SwitchMode
|
||||
* Reading of option '-g' was not possible !
|
||||
+ added search for -Fu args pathes in TryToOpen
|
||||
+ added code for automatic opening of FileDialog
|
||||
if source not found
|
||||
|
||||
Revision 1.5 1999/01/21 11:54:15 peter
|
||||
+ tools menu
|
||||
+ speedsearch in symbolbrowser
|
||||
* working run command
|
||||
|
||||
@ -80,10 +80,13 @@ begin
|
||||
OpenIt:=FileName<>'';
|
||||
if not OpenIt then
|
||||
begin
|
||||
New(D, Init('*.pas','Open a file','*.pas',fdOpenButton,0));
|
||||
New(D, Init(OpenFileLastExt,'Open a file','File to open',fdOpenButton,0));
|
||||
OpenIt:=Desktop^.ExecView(D)<>cmCancel;
|
||||
if OpenIt then
|
||||
D^.GetFileName(FileName);
|
||||
Begin
|
||||
D^.GetFileName(FileName);
|
||||
OpenFileLastExt:=D^.WildCard;
|
||||
End;
|
||||
Dispose(D, Done);
|
||||
end;
|
||||
if OpenIt then
|
||||
@ -93,6 +96,29 @@ begin
|
||||
end;
|
||||
end;
|
||||
|
||||
function TIDEApp.OpenSearch(FileName: string) : boolean;
|
||||
var D: PFileDialog;
|
||||
OpenIt: boolean;
|
||||
begin
|
||||
OpenIt:=False;
|
||||
if not OpenIt then
|
||||
begin
|
||||
New(D, Init(FileName,'Open a file','File to open',fdOpenButton,0));
|
||||
OpenIt:=Desktop^.ExecView(D)<>cmCancel;
|
||||
if OpenIt then
|
||||
Begin
|
||||
D^.GetFileName(FileName);
|
||||
End;
|
||||
Dispose(D, Done);
|
||||
end;
|
||||
if OpenIt then
|
||||
begin
|
||||
FileName:=FExpand(LocatePasFile(FileName));
|
||||
OpenEditorWindow(nil,FileName,0,0);
|
||||
end;
|
||||
OpenSearch:=OpenIt;
|
||||
end;
|
||||
|
||||
|
||||
procedure TIDEApp.OpenRecentFile(RecentIndex: integer);
|
||||
begin
|
||||
@ -121,7 +147,18 @@ end;
|
||||
|
||||
{
|
||||
$Log$
|
||||
Revision 1.6 1999-02-02 16:41:41 peter
|
||||
Revision 1.7 1999-02-04 13:32:05 pierre
|
||||
* Several things added (I cannot commit them independently !)
|
||||
+ added TBreakpoint and TBreakpointCollection
|
||||
+ added cmResetDebugger,cmGrep,CmToggleBreakpoint
|
||||
+ Breakpoint list in INIFile
|
||||
* Select items now also depend of SwitchMode
|
||||
* Reading of option '-g' was not possible !
|
||||
+ added search for -Fu args pathes in TryToOpen
|
||||
+ added code for automatic opening of FileDialog
|
||||
if source not found
|
||||
|
||||
Revision 1.6 1999/02/02 16:41:41 peter
|
||||
+ automatic .pas/.pp adding by opening of file
|
||||
* better debuggerscreen changes
|
||||
|
||||
|
||||
@ -426,7 +426,7 @@ begin
|
||||
if Editor=nil
|
||||
then begin TabSize:=DefaultTabSize; EFlags:=DefaultCodeEditorFlags; end
|
||||
else begin TabSize:=Editor^.TabSize; EFlags:=Editor^.Flags; end;
|
||||
R.Assign(0,0,56,15);
|
||||
R.Assign(0,0,56,18);
|
||||
New(D, Init(R, 'Editor Options'));
|
||||
with D^ do
|
||||
begin
|
||||
@ -467,6 +467,14 @@ begin
|
||||
Insert(ExtIL);
|
||||
R2.Move(0,-1);
|
||||
Insert(New(PLabel, Init(R2, '~H~ighlight extensions', ExtIL)));
|
||||
|
||||
R.Move(0,(R.B.Y-R.A.Y)+1); R.B.Y:=R.A.Y+2;
|
||||
R2.Copy(R); Inc(R2.A.Y);
|
||||
New(ExtIL, Init(R2, 128));
|
||||
ExtIL^.SetData(TabsPattern);
|
||||
Insert(ExtIL);
|
||||
R2.Move(0,-1);
|
||||
Insert(New(PLabel, Init(R2, 'File ~p~atterns needing tabs', ExtIL)));
|
||||
end;
|
||||
InsertButtons(D);
|
||||
CB^.Select;
|
||||
@ -673,7 +681,18 @@ end;
|
||||
|
||||
{
|
||||
$Log$
|
||||
Revision 1.7 1999-01-22 10:24:04 peter
|
||||
Revision 1.8 1999-02-04 13:32:06 pierre
|
||||
* Several things added (I cannot commit them independently !)
|
||||
+ added TBreakpoint and TBreakpointCollection
|
||||
+ added cmResetDebugger,cmGrep,CmToggleBreakpoint
|
||||
+ Breakpoint list in INIFile
|
||||
* Select items now also depend of SwitchMode
|
||||
* Reading of option '-g' was not possible !
|
||||
+ added search for -Fu args pathes in TryToOpen
|
||||
+ added code for automatic opening of FileDialog
|
||||
if source not found
|
||||
|
||||
Revision 1.7 1999/01/22 10:24:04 peter
|
||||
* first debugger things
|
||||
|
||||
Revision 1.6 1999/01/21 11:54:19 peter
|
||||
|
||||
@ -26,6 +26,11 @@ begin
|
||||
end
|
||||
else
|
||||
Debugger^.TraceNext;
|
||||
While (Debugger^.invalid_line and
|
||||
Debugger^.Debugger_started and
|
||||
not Debugger^.error) do
|
||||
Debugger^.TraceNext;
|
||||
Debugger^.AnnotateError;
|
||||
end;
|
||||
|
||||
|
||||
@ -40,6 +45,13 @@ begin
|
||||
end
|
||||
else
|
||||
Debugger^.TraceStep;
|
||||
{ I think we should not try to go deeper !
|
||||
if the source is not found PM }
|
||||
While (Debugger^.invalid_line and
|
||||
Debugger^.Debugger_started and
|
||||
not Debugger^.error) do
|
||||
Debugger^.TraceNext;
|
||||
Debugger^.AnnotateError;
|
||||
end;
|
||||
|
||||
|
||||
@ -61,9 +73,13 @@ begin
|
||||
Exit;
|
||||
end;
|
||||
|
||||
DoExecute(ExeFile,GetRunParameters,false);
|
||||
|
||||
LastExitCode:=DosExitCode;
|
||||
if not assigned(Debugger) then
|
||||
begin
|
||||
DoExecute(ExeFile,GetRunParameters,false);
|
||||
LastExitCode:=DosExitCode;
|
||||
end
|
||||
else
|
||||
Debugger^.Continue;
|
||||
end;
|
||||
|
||||
|
||||
@ -93,9 +109,51 @@ begin
|
||||
Dispose(D, Done);
|
||||
end;
|
||||
|
||||
procedure TIDEApp.DoResetDebugger;
|
||||
begin
|
||||
if assigned(Debugger) then
|
||||
DoneDebugger;
|
||||
end;
|
||||
|
||||
procedure TIDEApp.DoToggleBreak;
|
||||
var
|
||||
W : PSourceWindow;
|
||||
FileName : string;
|
||||
b : boolean;
|
||||
LineNr : longint;
|
||||
Info : record
|
||||
F : pstring;
|
||||
L : longint;
|
||||
end;
|
||||
begin
|
||||
W:=FirstEditorWindow;
|
||||
If assigned(W) then
|
||||
begin
|
||||
FileName:=W^.Editor^.FileName;
|
||||
LineNr:=W^.Editor^.CurPos.Y+1;
|
||||
Info.F:=@FileName;
|
||||
Info.L:=LineNr;
|
||||
InformationBox(#3'Trying to set a breakpoint at'#13#3+
|
||||
'%s : %d',@Info);
|
||||
b:=BreakpointCollection^.ToggleFileLine(FileName,LineNr);
|
||||
W^.Editor^.SetLineBreakState(LineNr-1,b);
|
||||
end;
|
||||
end;
|
||||
|
||||
{
|
||||
$Log$
|
||||
Revision 1.6 1999-01-22 10:24:05 peter
|
||||
Revision 1.7 1999-02-04 13:32:07 pierre
|
||||
* Several things added (I cannot commit them independently !)
|
||||
+ added TBreakpoint and TBreakpointCollection
|
||||
+ added cmResetDebugger,cmGrep,CmToggleBreakpoint
|
||||
+ Breakpoint list in INIFile
|
||||
* Select items now also depend of SwitchMode
|
||||
* Reading of option '-g' was not possible !
|
||||
+ added search for -Fu args pathes in TryToOpen
|
||||
+ added code for automatic opening of FileDialog
|
||||
if source not found
|
||||
|
||||
Revision 1.6 1999/01/22 10:24:05 peter
|
||||
* first debugger things
|
||||
|
||||
Revision 1.5 1999/01/21 11:54:20 peter
|
||||
|
||||
@ -22,7 +22,8 @@ procedure TIDEApp.Globals;
|
||||
var R: TRect;
|
||||
S: PSortedSymbolCollection;
|
||||
Overflow: boolean;
|
||||
|
||||
Level : longint;
|
||||
|
||||
procedure InsertInS(P: PSymbol); {$ifndef FPC}far;{$endif}
|
||||
|
||||
procedure InsertItemsInS(P: PSymbolCollection);
|
||||
@ -33,14 +34,19 @@ var R: TRect;
|
||||
end;
|
||||
|
||||
begin
|
||||
Inc(level);
|
||||
if S^.Count=MaxCollectionSize then
|
||||
begin Overflow:=true; Exit; end;
|
||||
S^.Insert(P);
|
||||
if P^.Items<>nil then
|
||||
{ this is wrong because it inserted args or locals of proc
|
||||
in the globals list !! PM}
|
||||
if (P^.Items<>nil) and (level=1) then
|
||||
InsertItemsInS(P^.Items);
|
||||
Dec(level);
|
||||
end;
|
||||
|
||||
begin
|
||||
level:=0;
|
||||
if BrowCol.Modules=nil then
|
||||
begin ErrorBox('No debug info available.',nil); Exit; end;
|
||||
Overflow:=false;
|
||||
@ -70,7 +76,18 @@ end;
|
||||
|
||||
{
|
||||
$Log$
|
||||
Revision 1.2 1999-01-14 21:42:23 peter
|
||||
Revision 1.3 1999-02-04 13:32:08 pierre
|
||||
* Several things added (I cannot commit them independently !)
|
||||
+ added TBreakpoint and TBreakpointCollection
|
||||
+ added cmResetDebugger,cmGrep,CmToggleBreakpoint
|
||||
+ Breakpoint list in INIFile
|
||||
* Select items now also depend of SwitchMode
|
||||
* Reading of option '-g' was not possible !
|
||||
+ added search for -Fu args pathes in TryToOpen
|
||||
+ added code for automatic opening of FileDialog
|
||||
if source not found
|
||||
|
||||
Revision 1.2 1999/01/14 21:42:23 peter
|
||||
* source tracking from Gabor
|
||||
|
||||
Revision 1.1 1999/01/12 14:29:37 peter
|
||||
|
||||
@ -41,9 +41,97 @@ begin
|
||||
ErrorBox('Execution successful. Exit code '+IntToStr(DosExitCode),nil);
|
||||
end;
|
||||
|
||||
procedure TIDEApp.Grep;
|
||||
|
||||
var PGrepDialog : PCenterDialog;
|
||||
R,R2 : TRect;
|
||||
IL : PInputLine;
|
||||
p,lineNb : longint;
|
||||
error : word;
|
||||
GrepArgs,Line,ModuleName : String;
|
||||
GrepOut : text;
|
||||
Params : Array[0..4] of longint;
|
||||
|
||||
Const GrepOutName = 'grep$$.out';
|
||||
{$ifdef linux}
|
||||
GrepExeName = 'grep';
|
||||
{$else linux}
|
||||
GrepExeName = 'c:\djgpp\bin\grep.exe';
|
||||
{$endif linux}
|
||||
begin
|
||||
R.Assign(0,0,45,6);
|
||||
new(PGrepDialog,Init(R,'Grep arguments'));
|
||||
with PGrepDialog^ do
|
||||
begin
|
||||
R2.A.Y:=R.A.Y+3;
|
||||
R2.B.Y:=R2.A.Y+1;
|
||||
R2.A.X:=R.A.X+3;
|
||||
R2.B.X:=R.B.X-3;
|
||||
New(IL, Init(R2, 128));
|
||||
If Assigned(DeskTop^.First) and
|
||||
(DeskTop^.First^.HelpCtx=hcSourceWindow) then
|
||||
GrepArgs:=PSourceWindow(DeskTop^.First)^.Editor^.GetCurrentWord
|
||||
else
|
||||
GrepArgs:='';
|
||||
GrepArgs:='-n -i '+GrepArgs+' *.pas *.pp *.inc';
|
||||
IL^.Data^:=GrepArgs;
|
||||
Insert(IL);
|
||||
R2.Move(0,-1);
|
||||
Insert(New(PLabel, Init(R2, '~G~rep arguments', IL)));
|
||||
end;
|
||||
|
||||
InsertButtons(PGrepDialog);
|
||||
if Desktop^.ExecView(PGrepDialog)=cmOK then
|
||||
begin
|
||||
GrepArgs:=IL^.Data^;
|
||||
{ Linux ? }
|
||||
if not ExecuteRedir(GrepExeName,GrepArgs,GrepOutName,'grep$$.err') then
|
||||
Begin
|
||||
{ 2 as exit code just means that
|
||||
some file vwere not found ! }
|
||||
if (IOStatus<>0) or (ExecuteResult<>2) then
|
||||
begin
|
||||
Params[0]:=IOStatus;
|
||||
Params[1]:=ExecuteResult;
|
||||
WarningBox(#3'Error running Grep'#13#3'DosError = %d'#13#3'Exit code = %d',@Params);
|
||||
end;
|
||||
End;
|
||||
Assign(GrepOut,GrepOutName);
|
||||
Reset(GrepOut);
|
||||
While not eof(GrepOut) do
|
||||
begin
|
||||
readln(GrepOut,Line);
|
||||
p:=pos(':',line);
|
||||
if p>0 then
|
||||
begin
|
||||
ModuleName:=copy(Line,1,p-1);
|
||||
Line:=Copy(Line,p+1,255);
|
||||
p:=pos(':',Line);
|
||||
val(copy(Line,1,p-1),lineNb,error);
|
||||
if error=0 then
|
||||
ProgramInfoWindow^.AddMessage(V_Normal,Copy(Line,p+1,255),
|
||||
ModuleName,LineNb);
|
||||
end;
|
||||
ProgramInfoWindow^.Show;
|
||||
ProgramInfoWindow^.MakeFirst;
|
||||
end;
|
||||
end;
|
||||
Dispose(PGrepDialog, Done);
|
||||
end;
|
||||
{
|
||||
$Log$
|
||||
Revision 1.2 1999-01-21 11:54:21 peter
|
||||
Revision 1.3 1999-02-04 13:32:09 pierre
|
||||
* Several things added (I cannot commit them independently !)
|
||||
+ added TBreakpoint and TBreakpointCollection
|
||||
+ added cmResetDebugger,cmGrep,CmToggleBreakpoint
|
||||
+ Breakpoint list in INIFile
|
||||
* Select items now also depend of SwitchMode
|
||||
* Reading of option '-g' was not possible !
|
||||
+ added search for -Fu args pathes in TryToOpen
|
||||
+ added code for automatic opening of FileDialog
|
||||
if source not found
|
||||
|
||||
Revision 1.2 1999/01/21 11:54:21 peter
|
||||
+ tools menu
|
||||
+ speedsearch in symbolbrowser
|
||||
* working run command
|
||||
|
||||
@ -102,7 +102,7 @@ type
|
||||
private
|
||||
IsSel : boolean;
|
||||
Prefix : char;
|
||||
SelNr : integer;
|
||||
SelNr : array[TSwitchMode] of integer;
|
||||
Items : PCollection;
|
||||
end;
|
||||
|
||||
@ -137,6 +137,7 @@ procedure ReadSwitches(const fn:string);
|
||||
{ initialize }
|
||||
procedure InitSwitches;
|
||||
procedure DoneSwitches;
|
||||
function GetUnitDirectories : string;
|
||||
|
||||
|
||||
implementation
|
||||
@ -150,7 +151,7 @@ var
|
||||
CfgFile : text;
|
||||
|
||||
{*****************************************************************************
|
||||
TSwitchItem
|
||||
TSwitchItem
|
||||
*****************************************************************************}
|
||||
|
||||
constructor TSwitchItem.Init(const n,p:string);
|
||||
@ -179,7 +180,7 @@ end;
|
||||
|
||||
|
||||
{*****************************************************************************
|
||||
TSelectItem
|
||||
TSelectItem
|
||||
*****************************************************************************}
|
||||
|
||||
constructor TSelectItem.Init(const n,p:string);
|
||||
@ -190,7 +191,7 @@ end;
|
||||
|
||||
|
||||
{*****************************************************************************
|
||||
TBooleanItem
|
||||
TBooleanItem
|
||||
*****************************************************************************}
|
||||
|
||||
constructor TBooleanItem.Init(const n,p:string);
|
||||
@ -214,7 +215,7 @@ end;
|
||||
|
||||
|
||||
{*****************************************************************************
|
||||
TStringItem
|
||||
TStringItem
|
||||
*****************************************************************************}
|
||||
|
||||
constructor TStringItem.Init(const n,p:string;mult:boolean);
|
||||
@ -245,7 +246,7 @@ end;
|
||||
|
||||
|
||||
{*****************************************************************************
|
||||
TLongintItem
|
||||
TLongintItem
|
||||
*****************************************************************************}
|
||||
|
||||
constructor TLongintItem.Init(const n,p:string);
|
||||
@ -278,14 +279,14 @@ end;
|
||||
|
||||
|
||||
{*****************************************************************************
|
||||
TSwitch
|
||||
TSwitch
|
||||
*****************************************************************************}
|
||||
|
||||
constructor TSwitches.Init(ch:char);
|
||||
begin
|
||||
new(Items,Init(10,5));
|
||||
Prefix:=ch;
|
||||
SelNr:=0;
|
||||
FillChar(SelNr,SizeOf(SelNr),#0);
|
||||
IsSel:=false;
|
||||
end;
|
||||
|
||||
@ -294,7 +295,7 @@ constructor TSwitches.InitSelect(ch:char);
|
||||
begin
|
||||
new(Items,Init(10,5));
|
||||
Prefix:=ch;
|
||||
SelNr:=0;
|
||||
FillChar(SelNr,SizeOf(SelNr),#0);
|
||||
IsSel:=true;
|
||||
end;
|
||||
|
||||
@ -428,7 +429,7 @@ end;
|
||||
function TSwitches.GetCurrSel:integer;
|
||||
begin
|
||||
if IsSel then
|
||||
GetCurrSel:=SelNr
|
||||
GetCurrSel:=SelNr[SwitchesMode]
|
||||
else
|
||||
GetCurrSel:=-1;
|
||||
end;
|
||||
@ -437,7 +438,7 @@ end;
|
||||
procedure TSwitches.SetCurrSel(index:integer);
|
||||
begin
|
||||
if IsSel then
|
||||
SelNr:=index;
|
||||
SelNr[SwitchesMode]:=index;
|
||||
end;
|
||||
|
||||
|
||||
@ -453,27 +454,27 @@ var
|
||||
if P^.NeedParam then
|
||||
begin
|
||||
if (P^.Typ=ot_string) and (PStringItem(P)^.Multiple) then
|
||||
begin
|
||||
s:=PStringItem(P)^.Str[SwitchesMode];
|
||||
repeat
|
||||
i:=pos(';',s);
|
||||
if i=0 then
|
||||
i:=255;
|
||||
s1:=Copy(s,1,i-1);
|
||||
if s1<>'' then
|
||||
writeln(CfgFile,' -'+Pref+P^.Param+s1);
|
||||
Delete(s,1,i);
|
||||
until s='';
|
||||
end
|
||||
begin
|
||||
s:=PStringItem(P)^.Str[SwitchesMode];
|
||||
repeat
|
||||
i:=pos(';',s);
|
||||
if i=0 then
|
||||
i:=256;
|
||||
s1:=Copy(s,1,i-1);
|
||||
if s1<>'' then
|
||||
writeln(CfgFile,' -'+Pref+P^.Param+s1);
|
||||
Delete(s,1,i);
|
||||
until s='';
|
||||
end
|
||||
else
|
||||
Writeln(CfgFile,' -'+Pref+P^.Param+P^.ParamValue);
|
||||
Writeln(CfgFile,' -'+Pref+P^.Param+P^.ParamValue);
|
||||
end;
|
||||
end;
|
||||
|
||||
begin
|
||||
Pref:=Prefix;
|
||||
if IsSel then
|
||||
writeln(CfgFile,' '+ItemParam(SelNr))
|
||||
writeln(CfgFile,' '+ItemParam(SelNr[SwitchesMode]))
|
||||
else
|
||||
Items^.ForEach(@writeitem);
|
||||
end;
|
||||
@ -483,7 +484,9 @@ function TSwitches.ReadItemsCfg(const s:string):boolean;
|
||||
|
||||
function checkitem(P:PSwitchItem):boolean;{$ifndef FPC}far;{$endif}
|
||||
begin
|
||||
CheckItem:=(P^.Param=Copy(s,1,length(P^.Param)));
|
||||
{ empty items are not equivalent to others !! }
|
||||
CheckItem:=((S='') and (P^.Param='')) or
|
||||
((Length(S)>0) and (P^.Param=Copy(s,1,length(P^.Param))));
|
||||
end;
|
||||
|
||||
var
|
||||
@ -494,15 +497,15 @@ begin
|
||||
if assigned(FoundP) then
|
||||
begin
|
||||
case FoundP^.Typ of
|
||||
ot_Select : SelNr:=Items^.IndexOf(FoundP);
|
||||
ot_Select : SelNr[SwitchesMode]:=Items^.IndexOf(FoundP);
|
||||
ot_Boolean : PBooleanItem(FoundP)^.IsSet[SwitchesMode]:=true;
|
||||
ot_String : begin
|
||||
if (PStringItem(FoundP)^.Multiple) and (PStringItem(FoundP)^.Str[SwitchesMode]<>'') then
|
||||
PStringItem(FoundP)^.Str[SwitchesMode]:=PStringItem(FoundP)^.Str[SwitchesMode]+';'+
|
||||
Copy(s,length(FoundP^.Param)+1,255)
|
||||
else
|
||||
PStringItem(FoundP)^.Str[SwitchesMode]:=Copy(s,length(FoundP^.Param)+1,255);
|
||||
end;
|
||||
if (PStringItem(FoundP)^.Multiple) and (PStringItem(FoundP)^.Str[SwitchesMode]<>'') then
|
||||
PStringItem(FoundP)^.Str[SwitchesMode]:=PStringItem(FoundP)^.Str[SwitchesMode]+';'+
|
||||
Copy(s,length(FoundP^.Param)+1,255)
|
||||
else
|
||||
PStringItem(FoundP)^.Str[SwitchesMode]:=Copy(s,length(FoundP^.Param)+1,255);
|
||||
end;
|
||||
ot_Longint : Val(Copy(s,length(FoundP^.Param)+1,255),PLongintItem(FoundP)^.Val[SwitchesMode],code);
|
||||
end;
|
||||
ReadItemsCfg:=true;
|
||||
@ -513,7 +516,7 @@ end;
|
||||
|
||||
|
||||
{*****************************************************************************
|
||||
Read / Write
|
||||
Read / Write
|
||||
*****************************************************************************}
|
||||
|
||||
procedure WriteSwitches(const fn:string);
|
||||
@ -572,40 +575,40 @@ begin
|
||||
begin
|
||||
readln(CfgFile,s);
|
||||
s:=LTrim(s);
|
||||
if (length(s)>2) and (s[1]='-') then
|
||||
if (length(s)>=2) and (s[1]='-') then
|
||||
begin
|
||||
c:=s[2];
|
||||
Delete(s,1,2);
|
||||
case c of
|
||||
'd' : ConditionalSwitches^.ReadItemsCfg(s);
|
||||
'X' : LibLinkerSwitches^.ReadItemsCfg(s);
|
||||
'g' : DebugInfoSwitches^.ReadItemsCfg(s);
|
||||
'p' : ProfileInfoSwitches^.ReadItemsCfg(s);
|
||||
'S' : SyntaxSwitches^.ReadItemsCfg(s);
|
||||
'F' : DirectorySwitches^.ReadItemsCfg(s);
|
||||
'T' : TargetSwitches^.ReadItemsCfg(s);
|
||||
'R' : AsmReaderSwitches^.ReadItemsCfg(s);
|
||||
'C' : begin
|
||||
CodegenSwitches^.ReadItemsCfg(s);
|
||||
MemorySizeSwitches^.ReadItemsCfg(s);
|
||||
end;
|
||||
'v' : VerboseSwitches^.ReadItemsCfg(s);
|
||||
'O' : begin
|
||||
if not OptimizationSwitches^.ReadItemsCfg(s) then
|
||||
ProcessorSwitches^.ReadItemsCfg(s);
|
||||
end;
|
||||
end;
|
||||
c:=s[2];
|
||||
Delete(s,1,2);
|
||||
case c of
|
||||
'd' : ConditionalSwitches^.ReadItemsCfg(s);
|
||||
'X' : LibLinkerSwitches^.ReadItemsCfg(s);
|
||||
'g' : DebugInfoSwitches^.ReadItemsCfg(s);
|
||||
'p' : ProfileInfoSwitches^.ReadItemsCfg(s);
|
||||
'S' : SyntaxSwitches^.ReadItemsCfg(s);
|
||||
'F' : DirectorySwitches^.ReadItemsCfg(s);
|
||||
'T' : TargetSwitches^.ReadItemsCfg(s);
|
||||
'R' : AsmReaderSwitches^.ReadItemsCfg(s);
|
||||
'C' : begin
|
||||
CodegenSwitches^.ReadItemsCfg(s);
|
||||
MemorySizeSwitches^.ReadItemsCfg(s);
|
||||
end;
|
||||
'v' : VerboseSwitches^.ReadItemsCfg(s);
|
||||
'O' : begin
|
||||
if not OptimizationSwitches^.ReadItemsCfg(s) then
|
||||
ProcessorSwitches^.ReadItemsCfg(s);
|
||||
end;
|
||||
end;
|
||||
end
|
||||
else
|
||||
if (Copy(s,1,7)='#IFDEF ') then
|
||||
begin
|
||||
Delete(s,1,7);
|
||||
for i:=low(TSwitchMode) to high(TSwitchMode) do
|
||||
if s=SwitchesModeStr[i] then
|
||||
begin
|
||||
SwitchesMode:=i;
|
||||
break;
|
||||
end;
|
||||
Delete(s,1,7);
|
||||
for i:=low(TSwitchMode) to high(TSwitchMode) do
|
||||
if s=SwitchesModeStr[i] then
|
||||
begin
|
||||
SwitchesMode:=i;
|
||||
break;
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
close(CfgFile);
|
||||
@ -613,9 +616,25 @@ begin
|
||||
end;
|
||||
|
||||
|
||||
function GetUnitDirectories : string;
|
||||
var
|
||||
P : PStringItem;
|
||||
function checkitem(P:PSwitchItem):boolean;{$ifndef FPC}far;{$endif}
|
||||
begin
|
||||
CheckItem:=(P^.Typ=ot_string) and (P^.Param='u');
|
||||
end;
|
||||
begin
|
||||
GetUnitDirectories:='';
|
||||
P:=DirectorySwitches^.Items^.FirstThat(@CheckItem);
|
||||
if assigned(P) then
|
||||
Begin
|
||||
GetUnitDirectories:=P^.Str[SwitchesMode];
|
||||
exit;
|
||||
End;
|
||||
end;
|
||||
|
||||
{*****************************************************************************
|
||||
Initialize
|
||||
Initialize
|
||||
*****************************************************************************}
|
||||
|
||||
procedure InitSwitches;
|
||||
@ -714,9 +733,10 @@ begin
|
||||
New(DebugInfoSwitches,InitSelect('g'));
|
||||
with DebugInfoSwitches^ do
|
||||
begin
|
||||
AddSelectItem('~S~trip all symbols from executable','-');
|
||||
AddSelectItem('Generate ~g~sym symbol information','g');
|
||||
AddSelectItem('Generate ~d~bx symbol information','d');
|
||||
AddSelectItem('~S~trip all debug symbols from executable','-');
|
||||
AddSelectItem('Generate ~d~ebug symbol information','');
|
||||
{ AddSelectItem('Generate ~d~bx symbol information','d');
|
||||
does not work anyhow (PM) }
|
||||
end;
|
||||
New(ProfileInfoSwitches,InitSelect('p'));
|
||||
with ProfileInfoSwitches^ do
|
||||
@ -755,7 +775,18 @@ end;
|
||||
end.
|
||||
{
|
||||
$Log$
|
||||
Revision 1.3 1999-01-12 14:29:39 peter
|
||||
Revision 1.4 1999-02-04 13:32:10 pierre
|
||||
* Several things added (I cannot commit them independently !)
|
||||
+ added TBreakpoint and TBreakpointCollection
|
||||
+ added cmResetDebugger,cmGrep,CmToggleBreakpoint
|
||||
+ Breakpoint list in INIFile
|
||||
* Select items now also depend of SwitchMode
|
||||
* Reading of option '-g' was not possible !
|
||||
+ added search for -Fu args pathes in TryToOpen
|
||||
+ added code for automatic opening of FileDialog
|
||||
if source not found
|
||||
|
||||
Revision 1.3 1999/01/12 14:29:39 peter
|
||||
+ Implemented still missing 'switch' entries in Options menu
|
||||
+ Pressing Ctrl-B sets ASCII mode in editor, after which keypresses (even
|
||||
ones with ASCII < 32 ; entered with Alt+<###>) are interpreted always as
|
||||
|
||||
@ -317,6 +317,7 @@ const
|
||||
CalcClipboard : extended = 0;
|
||||
|
||||
OpenFileName : string = '';
|
||||
OpenFileLastExt : string = '*.pas';
|
||||
NewEditorOpened: boolean = false;
|
||||
|
||||
var MsgParms : array[1..10] of
|
||||
@ -330,7 +331,7 @@ implementation
|
||||
|
||||
uses
|
||||
Keyboard,Memory,MsgBox,Validate,
|
||||
Tokens,
|
||||
Tokens,FPSwitch,
|
||||
FPVars,FPUtils,FPHelp,FPCompile;
|
||||
|
||||
const
|
||||
@ -2165,6 +2166,7 @@ begin
|
||||
W:=TryToOpenFile(@R,P^.GetModuleName,0,P^.ID-1);
|
||||
if W<>nil then
|
||||
begin
|
||||
W^.Select;
|
||||
W^.Editor^.SetHighlightRow(P^.ID-1);
|
||||
end;
|
||||
if Assigned(Owner) then
|
||||
@ -2315,7 +2317,7 @@ begin
|
||||
if ClassS<>'' then
|
||||
ClassS:=RExpand(ClassS,0)+': ';
|
||||
S:=ClassS;
|
||||
if (Module<>nil) and (ID<>0) then
|
||||
if (Module<>nil) {and (ID<>0)} then
|
||||
S:=S+Module^+' ('+IntToStr(ID)+'): ';
|
||||
if Text<>nil then S:=ClassS+Text^;
|
||||
if length(S)>MaxLen then S:=copy(S,1,MaxLen-2)+'..';
|
||||
@ -2951,6 +2953,8 @@ function TryToOpenFile(Bounds: PRect; FileName: string; CurX,CurY: integer): PSo
|
||||
var D : DirStr;
|
||||
N : NameStr;
|
||||
E : ExtStr;
|
||||
DrStr : String;
|
||||
|
||||
function CheckDir(NewDir: DirStr; NewName: NameStr; NewExt: ExtStr): boolean;
|
||||
var OK: boolean;
|
||||
begin
|
||||
@ -2967,10 +2971,11 @@ begin
|
||||
if CheckDir('.'+DirSep,N,NewExt) then OK:=true;
|
||||
CheckExt:=OK;
|
||||
end;
|
||||
function TryToOpen: PSourceWindow;
|
||||
function TryToOpen(const DD : dirstr): PSourceWindow;
|
||||
var Found: boolean;
|
||||
W : PSourceWindow;
|
||||
begin
|
||||
D:=DD;
|
||||
Found:=true;
|
||||
if E<>'' then Found:=CheckExt(E) else
|
||||
if CheckExt('.pp') then Found:=true else
|
||||
@ -2988,7 +2993,7 @@ function SearchOnDesktop: PSourceWindow;
|
||||
var W: PWindow;
|
||||
I: integer;
|
||||
Found: boolean;
|
||||
SName: string;
|
||||
SName : string;
|
||||
begin
|
||||
for I:=1 to 100 do
|
||||
begin
|
||||
@ -3031,7 +3036,15 @@ begin
|
||||
end
|
||||
else
|
||||
begin
|
||||
W:=TryToOpen;
|
||||
DrStr:=GetUnitDirectories;
|
||||
While pos(';',DrStr)>0 do
|
||||
Begin
|
||||
W:=TryToOpen(Copy(DrStr,1,pos(';',DrStr)-1));
|
||||
if assigned(W) then
|
||||
break;
|
||||
DrStr:=Copy(DrStr,pos(';',DrStr)+1,255);
|
||||
End;
|
||||
W:=TryToOpen(DrStr);
|
||||
NewEditorOpened:=W<>nil;
|
||||
end;
|
||||
TryToOpenFile:=W;
|
||||
@ -3041,7 +3054,18 @@ end;
|
||||
END.
|
||||
{
|
||||
$Log$
|
||||
Revision 1.6 1999-01-21 11:54:27 peter
|
||||
Revision 1.7 1999-02-04 13:32:11 pierre
|
||||
* Several things added (I cannot commit them independently !)
|
||||
+ added TBreakpoint and TBreakpointCollection
|
||||
+ added cmResetDebugger,cmGrep,CmToggleBreakpoint
|
||||
+ Breakpoint list in INIFile
|
||||
* Select items now also depend of SwitchMode
|
||||
* Reading of option '-g' was not possible !
|
||||
+ added search for -Fu args pathes in TryToOpen
|
||||
+ added code for automatic opening of FileDialog
|
||||
if source not found
|
||||
|
||||
Revision 1.6 1999/01/21 11:54:27 peter
|
||||
+ tools menu
|
||||
+ speedsearch in symbolbrowser
|
||||
* working run command
|
||||
|
||||
@ -9,8 +9,7 @@ var Hello : word;
|
||||
X: PRecord;
|
||||
T : TRecord;
|
||||
|
||||
function Func1: shortint;
|
||||
var X: word;
|
||||
function Func1(x,z : word;y : boolean): shortint;
|
||||
begin
|
||||
if Hello=0 then X:=0 else X:=1;
|
||||
Func1:=X;
|
||||
@ -20,6 +19,6 @@ BEGIN
|
||||
X:=nil;
|
||||
writeln('Hello world!');
|
||||
writeln(IsOdd(3));
|
||||
writeln(Func1);
|
||||
writeln(Func1(5,5,true));
|
||||
Halt;
|
||||
END.
|
||||
|
||||
Loading…
Reference in New Issue
Block a user