mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-10-18 21:51:48 +02:00
+ Correct indent/deindent of method enter/exit
git-svn-id: trunk@1331 -
This commit is contained in:
parent
7d99a8e45b
commit
66bb1e0a95
@ -28,7 +28,6 @@ procedure SendInteger(const Identifier: string; const Value: Integer; HexNotatio
|
||||
procedure SendPointer(const Identifier: string; const Value: Pointer);
|
||||
procedure SendDebugEx(const Msg: string; MType: TDebugLevel);
|
||||
procedure SendDebug(const Msg: string);
|
||||
procedure SendInteger(const Identifier: string; const Value: Integer);
|
||||
procedure SendMethodEnter(const MethodName: string);
|
||||
procedure SendMethodExit(const MethodName: string);
|
||||
procedure SendSeparator;
|
||||
@ -60,12 +59,13 @@ Const
|
||||
DmtError = lctError;
|
||||
ErrorLevel : Array[TDebugLevel] of integer
|
||||
= (dmtInformation,dmtWarning,dmtError);
|
||||
|
||||
IndentChars = 2;
|
||||
|
||||
var
|
||||
DebugClient : TSimpleIPCClient = nil;
|
||||
MsgBuffer : TMemoryStream = Nil;
|
||||
ServerID : Integer;
|
||||
|
||||
Indent : Integer = 0;
|
||||
|
||||
Procedure WriteMessage(Const Msg : TDebugMessage);
|
||||
|
||||
@ -76,12 +76,14 @@ begin
|
||||
end;
|
||||
|
||||
|
||||
procedure SendDebugMessage(Const Msg : TDebugMessage);
|
||||
procedure SendDebugMessage(Var Msg : TDebugMessage);
|
||||
|
||||
begin
|
||||
try
|
||||
If (DebugClient=Nil) then
|
||||
InitDebugClient;
|
||||
if (Indent>0) then
|
||||
Msg.Msg:=StringOfChar(' ',Indent)+Msg.Msg;
|
||||
WriteMessage(Msg);
|
||||
except
|
||||
On E : Exception do
|
||||
@ -142,21 +144,19 @@ begin
|
||||
SendDebugMessage(Mesg);
|
||||
end;
|
||||
|
||||
procedure SendInteger(const Identifier: string; const Value: Integer);
|
||||
|
||||
begin
|
||||
SendDebugFmt('%s = %d',[identifier,Value]);
|
||||
end;
|
||||
|
||||
procedure SendMethodEnter(const MethodName: string);
|
||||
|
||||
begin
|
||||
SendDebug(SEntering+MethodName);
|
||||
inc(Indent,IndentChars);
|
||||
end;
|
||||
|
||||
procedure SendMethodExit(const MethodName: string);
|
||||
|
||||
begin
|
||||
Dec(Indent,IndentChars);
|
||||
If (Indent<0) then
|
||||
Indent:=0;
|
||||
SendDebug(SExiting+MethodName);
|
||||
end;
|
||||
|
||||
|
@ -20,6 +20,7 @@ Var
|
||||
S : String;
|
||||
|
||||
begin
|
||||
SendMethodEnter('Program');
|
||||
Repeat
|
||||
Writeln('Enter message to send to debug server (STOP exits): ');
|
||||
Write('> ');
|
||||
@ -28,4 +29,6 @@ begin
|
||||
If (SendError<>'') then
|
||||
Writeln('Error : ',SendError);
|
||||
Until (S='STOP');
|
||||
SendMethodExit('Program');
|
||||
SendDebug('Ending');
|
||||
end.
|
||||
|
Loading…
Reference in New Issue
Block a user