+ ctrl-c capture with confirm dialog

+ ascii table in the tools menu
  + heapviewer
  * empty file fixed
  * fixed callback routines in fpdebug to have far for tp7
This commit is contained in:
peter 1999-02-20 15:18:25 +00:00
parent afba976e1a
commit be2415693b
11 changed files with 301 additions and 83 deletions

View File

@ -22,11 +22,7 @@ uses
Dos,
BrowCol,
FPIni,FPViews,FPConst,FPVars,FPUtils,FPIde,FPHelp,FPSwitch,FPUsrScr,
FPTools,FPDebug,FPTemplt
{$ifdef TEMPHEAP}
,dpmiexcp
{$endif TEMPHEAP}
;
FPTools,FPDebug,FPTemplt,FPCatch;
procedure ProcessParams(BeforeINI: boolean);
@ -111,7 +107,14 @@ BEGIN
END.
{
$Log$
Revision 1.11 1999-02-18 13:44:30 peter
Revision 1.12 1999-02-20 15:18:25 peter
+ ctrl-c capture with confirm dialog
+ ascii table in the tools menu
+ heapviewer
* empty file fixed
* fixed callback routines in fpdebug to have far for tp7
Revision 1.11 1999/02/18 13:44:30 peter
* search fixed
+ backward search
* help fixes

View File

@ -93,7 +93,7 @@ const
procedure TCalcButton.HandleEvent(var Event: TEvent);
var
Call : boolean;
i : Sw_Word;
i : longint;
begin
Call:=true;
case Event.What of
@ -423,7 +423,14 @@ end;
end.
{
$Log$
Revision 1.1 1998-12-22 14:27:54 peter
Revision 1.2 1999-02-20 15:18:27 peter
+ ctrl-c capture with confirm dialog
+ ascii table in the tools menu
+ heapviewer
* empty file fixed
* fixed callback routines in fpdebug to have far for tp7
Revision 1.1 1998/12/22 14:27:54 peter
* moved
Revision 1.2 1998/12/22 10:39:39 peter

92
ide/text/fpcatch.pas Normal file
View File

@ -0,0 +1,92 @@
{
$Id$
Copyright (c) 1997-98 by Michael Van Canneyt
Unit to catch segmentation faults and Ctrl-C and exit gracefully
under linux and go32v2
See the file COPYING.FPC, included in this distribution,
for details about the copyright.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
**********************************************************************}
Unit fpcatch;
interface
{$ifdef linux}
{$define has_signal}
uses
linux;
{$endif}
{$ifdef go32v2}
{$define has_signal}
uses
dpmiexcp;
{$endif}
{$ifdef has_signal}
Var
NewSignal,OldSigSegm,OldSigInt : SignalHandler;
{$endif}
Implementation
uses
commands,msgbox,
fpide,fpviews;
{$ifdef has_signal}
{$ifdef linux}
Procedure CatchSignal(Sig : Integer);cdecl;
{$else}
Function CatchSignal(Sig : longint):longint;
{$endif}
begin
case Sig of
SIGSEGV : begin
MyApp.Done;
Writeln('Internal Error caught');
Halt;
end;
SIGINT : begin
if MessageBox(#3'Do You really want to quit?',nil,mferror+mfyesbutton+mfnobutton)=cmYes then
begin
MyApp.Done;
Halt;
end;
end;
end;
{$ifndef linux}
CatchSignal:=0;
{$endif}
end;
{$endif def has_signal}
begin
{$ifdef has_signal}
{$ifndef TP}
NewSignal:=SignalHandler(@CatchSignal);
{$else TP}
NewSignal:=SignalHandler(CatchSignal);
{$endif TP}
OldSigSegm:=Signal (SIGSEGV,NewSignal);
OldSigInt:=Signal (SIGINT,NewSignal);
{$endif}
end.
{
$Log$
Revision 1.1 1999-02-20 15:18:28 peter
+ ctrl-c capture with confirm dialog
+ ascii table in the tools menu
+ heapviewer
* empty file fixed
* fixed callback routines in fpdebug to have far for tp7
}

View File

@ -78,7 +78,7 @@ const
cmResetDebugger = 228;
cmContToCursor = 229;
cmOpenGDBWindow = 230;
cmNotImplemented = 1000;
cmNewFromTemplate = 1001;
@ -99,6 +99,7 @@ const
cmUserScreenWindow = 1651;
cmEvaluate = 1652;
cmCalculator = 1653;
cmAsciiTable = 1654;
cmToolsMessages = 1700;
cmToolsBase = 1800;
@ -172,6 +173,7 @@ const
hcSaveINI = hcShift+cmSaveINI;
hcSaveAsINI = hcShift+cmSaveAsINI;
hcCalculator = hcShift+cmCalculator;
hcAsciiTable = hcShift+cmAsciiTable;
hcGrep = hcShift+cmGrep;
hcSwitchesMode = hcShift+cmSwitchesMode;
hcAbout = hcShift+cmAbout;
@ -254,7 +256,7 @@ const
#6#12;
CGDBInputLine = #9#9#10#11#12;
CIDEAppColor = CAppColor +
{ CIDEHelpDialog }
{128-143}#$70#$7F#$7A#$13#$13#$70#$70#$7F#$7E#$20#$2B#$2F#$78#$2E#$70#$30 + { 1-16}
@ -273,7 +275,14 @@ implementation
END.
{
$Log$
Revision 1.10 1999-02-11 19:07:19 pierre
Revision 1.11 1999-02-20 15:18:28 peter
+ ctrl-c capture with confirm dialog
+ ascii table in the tools menu
+ heapviewer
* empty file fixed
* fixed callback routines in fpdebug to have far for tp7
Revision 1.10 1999/02/11 19:07:19 pierre
* GDBWindow redesigned :
normal editor apart from
that any kbEnter will send the line (for begin to cursor)

View File

@ -128,7 +128,8 @@ begin
end;
procedure TDebugController.InsertBreakpoints;
procedure DoInsert(PB : PBreakpoint);
procedure DoInsert(PB : PBreakpoint);{$ifndef FPC}far;{$endif}
begin
PB^.Insert;
end;
@ -139,16 +140,18 @@ end;
procedure TDebugController.RemoveBreakpoints;
procedure DoDelete(PB : PBreakpoint);
procedure DoDelete(PB : PBreakpoint);{$ifndef FPC}far;{$endif}
begin
PB^.Remove;
end;
begin
BreakpointCollection^.ForEach(@DoDelete);
end;
procedure TDebugController.ResetBreakpointsValues;
procedure DoResetVal(PB : PBreakpoint);
procedure DoResetVal(PB : PBreakpoint);{$ifndef FPC}far;{$endif}
begin
PB^.ResetValues;
end;
@ -544,7 +547,7 @@ end;
procedure TBreakpointCollection.ShowBreakpoints(W : PSourceWindow);
procedure SetInSource(P : PBreakpoint);
procedure SetInSource(P : PBreakpoint);{$ifndef FPC}far;{$endif}
begin
If assigned(P^.FileName) and (P^.FileName^=W^.Editor^.FileName) then
W^.Editor^.SetLineBreakState(P^.Line,P^.state=bs_enabled);
@ -556,7 +559,7 @@ end;
function TBreakpointCollection.GetType(typ : BreakpointType;Const s : String) : PBreakpoint;
function IsThis(P : PBreakpoint) : boolean;
function IsThis(P : PBreakpoint) : boolean;{$ifndef FPC}far;{$endif}
begin
IsThis:=(P^.typ=typ) and (P^.Name^=S);
end;
@ -569,7 +572,7 @@ function TBreakpointCollection.ToggleFileLine(Const FileName: String;LineNr : Lo
var PB : PBreakpoint;
function IsThere(P : PBreakpoint) : boolean;
function IsThere(P : PBreakpoint) : boolean;{$ifndef FPC}far;{$endif}
begin
IsThere:=(P^.typ=bt_file_line) and (P^.FileName^=FileName) and (P^.Line=LineNr);
end;
@ -676,7 +679,14 @@ end.
{
$Log$
Revision 1.14 1999-02-16 12:47:36 pierre
Revision 1.15 1999-02-20 15:18:29 peter
+ ctrl-c capture with confirm dialog
+ ascii table in the tools menu
+ heapviewer
* empty file fixed
* fixed callback routines in fpdebug to have far for tp7
Revision 1.14 1999/02/16 12:47:36 pierre
* GDBWindow does not popup on F7 or F8 anymore
Revision 1.13 1999/02/16 10:43:54 peter

View File

@ -17,14 +17,16 @@ unit fpide;
interface
uses
Drivers,Views,App,
Drivers,Views,App,Gadgets,
{$ifdef EDITORS}Editors,{$else}WEditor,{$endif}
Comphook,
FPViews;
type
TIDEApp = object(TApplication)
Heap : PHeapView;
constructor Init;
procedure Idle;virtual;
procedure InitMenuBar; virtual;
procedure InitStatusLine; virtual;
procedure Open(FileName: string);
@ -60,6 +62,7 @@ type
procedure DoOpenGDBWindow;
procedure DoToggleBreak;
procedure Information;
procedure DoAsciiTable;
procedure Calculator;
procedure ExecuteTool(Idx: integer);
procedure SetSwitchesMode;
@ -112,6 +115,7 @@ uses
{$endif}
Video,Mouse,Keyboard,
Dos,Objects,Memory,Menus,Dialogs,StdDlg,ColorSel,Commands,HelpCtx,
AsciiTab,
Systems,BrowCol,
WHelp,WHlpView,WINI,
FPConst,FPVars,FPUtils,FPSwitch,FPIni,FPIntf,FPCompile,FPHelp,
@ -129,6 +133,8 @@ begin
end;
constructor TIDEApp.Init;
var
R : TRect;
begin
{$ifndef EDITORS}
UseSyntaxHighlight:=IDEUseSyntaxHighlight;
@ -144,6 +150,18 @@ begin
Desktop^.Insert(ProgramInfoWindow);
Message(@Self,evBroadcast,cmUpdate,nil);
CurDirChanged;
{ heap viewer }
GetExtent(R);
Dec(R.B.X);
R.A.X := R.B.X - 9; R.A.Y := R.B.Y - 1;
Heap := New(PHeapView, InitKb(R));
Insert(Heap);
end;
procedure TIDEApp.Idle;
begin
inherited Idle;
Heap^.Update;
end;
procedure TIDEApp.InitMenuBar;
@ -216,7 +234,8 @@ begin
NewLine(
NewItem('~G~rep', 'Shift+F2', kbShiftF2, cmGrep, hcGrep,
NewItem('~C~alculator', '', kbNoKey, cmCalculator, hcCalculator,
nil))))),
NewItem('Ascii ~t~able', '', kbNoKey, cmAsciiTable, hcAsciiTable,
nil)))))),
NewSubMenu('~O~ptions', hcOptionsMenu, NewMenu(
NewItem('Mode~.~..','', kbNoKey, cmSwitchesMode, hcSwitchesMode,
NewItem('~C~ompiler...','', kbNoKey, cmCompiler, hcCompiler,
@ -375,6 +394,7 @@ begin
cmSaveINI : SaveINI;
cmSaveAsINI : SaveAsINI;
{ -- Tools menu -- }
cmAsciiTable : DoAsciiTable;
cmCalculator : Calculator;
cmGrep : Grep;
cmToolsBase+1..
@ -662,7 +682,14 @@ end;
END.
{
$Log$
Revision 1.16 1999-02-18 13:44:31 peter
Revision 1.17 1999-02-20 15:18:30 peter
+ ctrl-c capture with confirm dialog
+ ascii table in the tools menu
+ heapviewer
* empty file fixed
* fixed callback routines in fpdebug to have far for tp7
Revision 1.16 1999/02/18 13:44:31 peter
* search fixed
+ backward search
* help fixes

View File

@ -14,6 +14,16 @@
**********************************************************************}
procedure TIDEApp.DoAsciiTable;
var
P: PAsciiChart;
begin
P := New(PAsciiChart, Init);
P^.HelpCtx := hcAsciiTable;
InsertWindow(P);
end;
procedure TIDEApp.Calculator;
begin
with CalcWindow^ do
@ -127,7 +137,14 @@ begin
end;
{
$Log$
Revision 1.6 1999-02-05 13:51:42 peter
Revision 1.7 1999-02-20 15:18:31 peter
+ ctrl-c capture with confirm dialog
+ ascii table in the tools menu
+ heapviewer
* empty file fixed
* fixed callback routines in fpdebug to have far for tp7
Revision 1.6 1999/02/05 13:51:42 peter
* unit name of FPSwitches -> FPSwitch which is easier to use
* some fixes for tp7 compiling

View File

@ -72,20 +72,23 @@ Type
Var
PrefSeg : Word;
{$IfDef MsDos}
MinBlockSize : Word;
FName : PathStr;
F,FE : File;
MyBlockSize : Word;
{$endif}
F,FE : File;
RedirChanged : Boolean;
RedirErrorChanged : Boolean;
Handles : PHandles;
OldHandle,OldErrorHandle : Byte;
{$ifdef UseDUP}
TempH, TempErrorH : longint;
{$endif}
{$ifdef FPC}
HandlesOffset : word;
{$else}
Handles : PHandles;
{$endif FPC}
function dup(fh : longint) : longint;
var
Regs : Registers;
@ -377,7 +380,14 @@ Begin
End.
{
$Log$
Revision 1.6 1999-02-05 13:51:43 peter
Revision 1.7 1999-02-20 15:18:32 peter
+ ctrl-c capture with confirm dialog
+ ascii table in the tools menu
+ heapviewer
* empty file fixed
* fixed callback routines in fpdebug to have far for tp7
Revision 1.6 1999/02/05 13:51:43 peter
* unit name of FPSwitches -> FPSwitch which is easier to use
* some fixes for tp7 compiling

View File

@ -778,10 +778,12 @@ end;
PLine,TLineCollection
*****************************************************************************}
function NewLine(S: string): PLine;
var P: PLine;
function NewLine(const S: string): PLine;
var
P: PLine;
begin
New(P); FillChar(P^,SizeOf(P^),0);
New(P);
FillChar(P^,SizeOf(P^),0);
P^.Text:=NewStr(S);
NewLine:=P;
end;
@ -883,6 +885,8 @@ constructor TCodeEditor.Init(var Bounds: TRect; AHScrollBar, AVScrollBar:
begin
inherited Init(Bounds,AHScrollBar,AVScrollBar);
New(Lines, Init(500,1000));
{ we have always need at least 1 line }
Lines^.Insert(NewLine(''));
SetState(sfCursorVis,true);
SetFlags(DefaultCodeEditorFlags); TabSize:=DefaultTabSize;
SetHighlightRow(-1);
@ -1683,50 +1687,66 @@ begin
end;
function TCodeEditor.InsertLine: Sw_integer;
var Ind: Sw_integer;
S,IndentStr: string;
procedure CalcIndent(LineOver: Sw_integer);
begin
if (LineOver<0) or (LineOver>GetLineCount) then Ind:=0 else
var
SelBack,Ind: Sw_integer;
S,IndentStr: string;
procedure CalcIndent(LineOver: Sw_integer);
begin
IndentStr:=GetLineText(LineOver);
Ind:=0;
while (Ind<length(IndentStr)) and (IndentStr[Ind+1]=' ') do
Inc(Ind);
if (LineOver<0) or (LineOver>GetLineCount) then Ind:=0 else
begin
IndentStr:=GetLineText(LineOver);
Ind:=0;
while (Ind<length(IndentStr)) and (IndentStr[Ind+1]=' ') do
Inc(Ind);
end;
IndentStr:=CharStr(' ',Ind);
end;
IndentStr:=CharStr(' ',Ind);
end;
var SelBack: integer;
begin
if IsReadOnly then begin InsertLine:=-1; Exit; end;
if CurPos.Y<GetLineCount then S:=GetLineText(CurPos.Y) else S:='';
if IsReadOnly then
begin
InsertLine:=-1;
Exit;
end;
if CurPos.Y<GetLineCount then
S:=GetLineText(CurPos.Y)
else
S:='';
if Overwrite=false then
begin
SelBack:=0;
if GetLineCount>0 then
begin
S:=GetDisplayText(CurPos.Y);
SelBack:=length(S)-SelEnd.X;
SetDisplayText(CurPos.Y,RTrim(S));
end;
CalcIndent(CurPos.Y);
Lines^.AtInsert(CurPos.Y+1,NewLine(IndentStr+copy(S,CurPos.X+1,255)));
LimitsChanged;
SetDisplayText(CurPos.Y,copy(S,1,CurPos.X-1+1));
if PointOfs(SelStart)<>PointOfs(SelEnd) then { !!! check it - it's buggy !!! }
begin SelEnd.Y:=CurPos.Y+1; SelEnd.X:=length(GetLineText(CurPos.Y+1))-SelBack; end;
UpdateAttrs(CurPos.Y,attrAll);
SetCurPtr(Ind,CurPos.Y+1);
end else
begin
if CurPos.Y=GetLineCount-1 then
CalcIndent(CurPos.Y);
begin
Lines^.Insert(NewLine(IndentStr));
LimitsChanged;
end;
SetCurPtr(Ind,CurPos.Y+1);
end;
begin
SelBack:=0;
if GetLineCount>0 then
begin
S:=GetDisplayText(CurPos.Y);
SelBack:=length(S)-SelEnd.X;
SetDisplayText(CurPos.Y,RTrim(S));
CalcIndent(CurPos.Y);
Lines^.AtInsert(CurPos.Y+1,NewLine(IndentStr+copy(S,CurPos.X+1,255)));
end
else
begin
CalcIndent(0);
Lines^.Insert(NewLine(IndentStr));
end;
LimitsChanged;
SetDisplayText(CurPos.Y,copy(S,1,CurPos.X-1+1));
if PointOfs(SelStart)<>PointOfs(SelEnd) then { !!! check it - it's buggy !!! }
begin
SelEnd.Y:=CurPos.Y+1;
SelEnd.X:=length(GetLineText(CurPos.Y+1))-SelBack;
end;
UpdateAttrs(CurPos.Y,attrAll);
SetCurPtr(Ind,CurPos.Y+1);
end
else
begin
if CurPos.Y=GetLineCount-1 then
CalcIndent(CurPos.Y);
Lines^.Insert(NewLine(IndentStr));
LimitsChanged;
SetCurPtr(Ind,CurPos.Y+1);
end;
DrawLines(CurPos.Y);
end;
@ -1739,11 +1759,11 @@ begin
begin
if CurPos.Y>0 then
begin
S:=GetLineText(CurPos.Y-1);
SetLineText(CurPos.Y-1,S+GetLineText(CurPos.Y));
Lines^.AtDelete(CurPos.Y);
LimitsChanged;
SetCurPtr(length(S),CurPos.Y-1);
S:=GetLineText(CurPos.Y-1);
SetLineText(CurPos.Y-1,S+GetLineText(CurPos.Y));
Lines^.AtDelete(CurPos.Y);
LimitsChanged;
SetCurPtr(length(S),CurPos.Y-1);
end;
end
else
@ -2833,12 +2853,17 @@ begin
Reset(f);
{$ifdef TPUNIXLF}OnlyLF:=true;{$endif}
OK:=(IOResult=0);
while OK and (Eof(f)=false) and (GetLineCount<MaxLineCount) do
begin
readln(f,S);
OK:=OK and (IOResult=0);
if OK then AddLine(S);
end;
if Eof(f) then
AddLine('')
else
begin
while OK and (Eof(f)=false) and (GetLineCount<MaxLineCount) do
begin
readln(f,S);
OK:=OK and (IOResult=0);
if OK then AddLine(S);
end;
end;
FileMode:=FM;
Close(F);
EatIO;
@ -3217,7 +3242,14 @@ end;
END.
{
$Log$
Revision 1.20 1999-02-18 17:27:57 pierre
Revision 1.21 1999-02-20 15:18:33 peter
+ ctrl-c capture with confirm dialog
+ ascii table in the tools menu
+ heapviewer
* empty file fixed
* fixed callback routines in fpdebug to have far for tp7
Revision 1.20 1999/02/18 17:27:57 pierre
* find/replace dialogs need packed records !!
Revision 1.19 1999/02/18 13:44:36 peter

View File

@ -409,6 +409,7 @@ end;
function THelpFile.LoadIndex: boolean;
begin
Abstract;
LoadIndex:=false;
end;
function THelpFile.SearchTopic(HelpCtx: THelpCtx): PTopic;
@ -421,6 +422,7 @@ end;
function THelpFile.ReadTopic(T: PTopic): boolean;
begin
Abstract;
ReadTopic:=false;
end;
procedure THelpFile.MaintainTopicCache;
@ -943,7 +945,14 @@ end;
END.
{
$Log$
Revision 1.5 1999-02-19 15:43:22 peter
Revision 1.6 1999-02-20 15:18:35 peter
+ ctrl-c capture with confirm dialog
+ ascii table in the tools menu
+ heapviewer
* empty file fixed
* fixed callback routines in fpdebug to have far for tp7
Revision 1.5 1999/02/19 15:43:22 peter
* compatibility fixes for FV
Revision 1.4 1999/02/18 13:44:37 peter

View File

@ -128,6 +128,7 @@ end;
function TTextFile.GetLine(Idx: sw_integer; var S: string): boolean;
begin
Abstract;
GetLine:=false;
end;
constructor TDOSTextFile.Init(AFileName: string);
@ -288,6 +289,7 @@ begin
end;
if WasThereAnyText then DocSoftBreak;
ProcessLine:=true;
end;
procedure TSGMLParser.DocSoftBreak;