WriteLn are now under compiler directives (DEBUG) + small updates

This commit is contained in:
ocoursiere
2003-01-17 21:30:46 +00:00
parent 81f507e6a0
commit 6933ef3f74
11 changed files with 20 additions and 21 deletions

View File

@@ -97,16 +97,20 @@ end;
procedure TApplication.AppActivated(Active : boolean); procedure TApplication.AppActivated(Active : boolean);
begin begin
{$IFDEF DEBUG}
WriteLn(Active); WriteLn(Active);
if Active then if Active then
WriteLn('Application activée !') WriteLn('Application activée !')
else else
WriteLn('Application désactivée !'); WriteLn('Application désactivée !');
{$ENDIF}
end; end;
procedure Application_ReadyToRun_hook_func(Application : TApplication); cdecl; procedure Application_ReadyToRun_hook_func(Application : TApplication); cdecl;
begin begin
{$IFDEF DEBUG}
WriteLn('Hook ReadyToRun !'); WriteLn('Hook ReadyToRun !');
{$ENDIF}
if Application <> nil then if Application <> nil then
Application.ReadyToRun; Application.ReadyToRun;
end; end;
@@ -115,7 +119,9 @@ procedure Application_MessageReceived_hook_func(Application : TApplication; aMes
var var
Message : TMessage; Message : TMessage;
begin begin
{$IFDEF DEBUG}
WriteLn('Hook MessageReceived !'); WriteLn('Hook MessageReceived !');
{$ENDIF}
Message := TMessage.Wrap(aMessage); Message := TMessage.Wrap(aMessage);
try try
if Application <> nil then if Application <> nil then
@@ -127,7 +133,9 @@ end;
procedure TApplication.ReadyToRun; procedure TApplication.ReadyToRun;
begin begin
{$IFDEF DEBUG}
WriteLn('Prêt à démarer !'); WriteLn('Prêt à démarer !');
{$ENDIF}
end; end;
procedure TApplication.ShowCursor; procedure TApplication.ShowCursor;
@@ -153,7 +161,6 @@ end;
// end TApplication // end TApplication
initialization initialization
WriteLn('Initialisation');
be_app := nil; be_app := nil;
Application_AppActivated_hook := @Application_AppActivated_hook_func; Application_AppActivated_hook := @Application_AppActivated_hook_func;
Application_ReadyToRun_hook := @Application_ReadyToRun_hook_func; Application_ReadyToRun_hook := @Application_ReadyToRun_hook_func;

View File

@@ -39,9 +39,11 @@ var
procedure THandler.MessageReceived(aMessage : TMessage); procedure THandler.MessageReceived(aMessage : TMessage);
begin begin
{$IFDEF DEBUG}
WriteLn(ClassName + '.MessageReceived'); WriteLn(ClassName + '.MessageReceived');
WriteLn('Message reçue'); WriteLn('Message reçue');
aMessage.PrintToStream; aMessage.PrintToStream;
{$ENDIF}
end; end;
procedure Handler_MessageReceived_hook_func(Handler : THandler; aMessage : TCPlusObject); cdecl; procedure Handler_MessageReceived_hook_func(Handler : THandler; aMessage : TCPlusObject); cdecl;
@@ -49,7 +51,9 @@ var
Message : TMessage; Message : TMessage;
begin begin
try try
{$IFDEF DEBUG}
WriteLn('Hook MessageReceived !'); WriteLn('Hook MessageReceived !');
{$ENDIF}
Message := TMessage.Wrap(aMessage); Message := TMessage.Wrap(aMessage);
try try
if Handler <> nil then if Handler <> nil then
@@ -60,7 +64,9 @@ begin
except except
on e : exception do on e : exception do
begin begin
{$IFDEF DEBUG}
WriteLn(e.Message + 'Handler_MessageReceived'); WriteLn(e.Message + 'Handler_MessageReceived');
{$ENDIF}
end; end;
end end
end; end;

View File

@@ -133,23 +133,18 @@ end;
function TInvoker.SetTarget(h : THandler; loop : TLooper) : TStatus_t; function TInvoker.SetTarget(h : THandler; loop : TLooper) : TStatus_t;
begin begin
WriteLn('Start of SetTarget');
if loop <> nil then if loop <> nil then
begin begin
WriteLn('Différent de nil');
Result := BInvoker_SetTarget(CPlusObject, h.CPlusObject, loop.CPlusObject); Result := BInvoker_SetTarget(CPlusObject, h.CPlusObject, loop.CPlusObject);
end end
else if h <> nil then else if h <> nil then
begin begin
WriteLn('Egale de nil');
// Result := BInvoker_SetTarget(CPlusObject, h.CPlusObject, nil); // Result := BInvoker_SetTarget(CPlusObject, h.CPlusObject, nil);
end end
else else
begin begin
WriteLn('nil et nil');
Result := BInvoker_SetTarget(CPlusObject, nil, nil); Result := BInvoker_SetTarget(CPlusObject, nil, nil);
end; end;
WriteLn('End of SetTarget');
end; end;
function TInvoker.SetTarget(aMessenger : TMessenger) : TStatus_t; function TInvoker.SetTarget(aMessenger : TMessenger) : TStatus_t;

View File

@@ -48,12 +48,10 @@ var
procedure TLooper.DispatchMessage(aMessage : TMessage; aTarget : THandler); procedure TLooper.DispatchMessage(aMessage : TMessage; aTarget : THandler);
begin begin
WriteLn('Looper.DispatchMessage');
end; end;
function TLooper.QuitRequested() : boolean; function TLooper.QuitRequested() : boolean;
begin begin
WriteLn('Looper.QuitRequested');
Result := True; Result := True;
end; end;
@@ -75,7 +73,6 @@ var
Message : TMessage; Message : TMessage;
Target : THandler; Target : THandler;
begin begin
WriteLn('Hook DispatchMessage !');
Message := TMessage.Wrap(aMessage); Message := TMessage.Wrap(aMessage);
try try
Target := THandler.Wrap(aTarget); Target := THandler.Wrap(aTarget);
@@ -91,7 +88,6 @@ end;
function Looper_QuitRequested_hook_func(Looper : TLooper) : boolean; cdecl; function Looper_QuitRequested_hook_func(Looper : TLooper) : boolean; cdecl;
begin begin
WriteLn('Hook QuitRequested !');
if Looper <> nil then if Looper <> nil then
Result := Looper.QuitRequested(); Result := Looper.QuitRequested();
end; end;

View File

@@ -90,11 +90,13 @@ procedure TBeObject.Debug;
var var
size : cardinal; size : cardinal;
begin begin
{$IFDEF DEBUG}
size := 0; size := 0;
size := SizeOf(Self.ClassType); size := SizeOf(Self.ClassType);
WriteLn('Instance de ' + Self.ClassName + '(' + HexStr(longint(pointer(Self)), 8) + ')' + WriteLn('Instance de ' + Self.ClassName + '(' + HexStr(longint(pointer(Self)), 8) + ')' +
'(' + IntToStr(size) + ')' + '(' + IntToStr(size) + ')' +
' '); ' ');
{$ENDIF}
end; end;
// Destructeur utilisé pour libérer l'objet pascal sans // Destructeur utilisé pour libérer l'objet pascal sans
// détruire l'objet C++ correspondant. Utile pour // détruire l'objet C++ correspondant. Utile pour
@@ -103,7 +105,9 @@ end;
// (cas des messages passés aux fonctions de rappel) // (cas des messages passés aux fonctions de rappel)
destructor TBeObject.UnWrap; destructor TBeObject.UnWrap;
begin begin
{$IFDEF DEBUG}
WriteLn('UnWrap'); WriteLn('UnWrap');
{$ENDIF}
// On passe CPlusObject à nil pour éviter de libérer // On passe CPlusObject à nil pour éviter de libérer
// l'objet C++ lors de l'appel de free // l'objet C++ lors de l'appel de free
Self.CPlusObject := nil; Self.CPlusObject := nil;

View File

@@ -55,7 +55,7 @@ void BPWindow::MessageReceived(BMessage *message)
{ {
MessageReceived_hookCall(message); MessageReceived_hookCall(message);
BWindow::MessageReceived(message); BWindow::MessageReceived(message);
message->PrintToStream(); // message->PrintToStream();
} }
void BPWindow::DispatchMessage(BMessage *message, BHandler *target) void BPWindow::DispatchMessage(BMessage *message, BHandler *target)

View File

@@ -125,7 +125,6 @@ end;
constructor TButton.Create(frame : TRect; name, aLabel : PChar; message : TMessage; resizingMode, flags : Cardinal); constructor TButton.Create(frame : TRect; name, aLabel : PChar; message : TMessage; resizingMode, flags : Cardinal);
begin begin
CreatePas; CreatePas;
WriteLn('Creation bouton');
CPlusObject := BButton_Create(Self, frame.CPlusObject, name, aLabel, message.CPlusObject, resizingMode, flags); CPlusObject := BButton_Create(Self, frame.CPlusObject, name, aLabel, message.CPlusObject, resizingMode, flags);
end; end;
@@ -182,7 +181,6 @@ end;
procedure TButton.MessageReceived(msg : TMessage); procedure TButton.MessageReceived(msg : TMessage);
begin begin
WriteLn('Bonjour, ici le bouton !');
// BButton_MessageReceived(CPlusObject, msg.CPlusObject); // BButton_MessageReceived(CPlusObject, msg.CPlusObject);
end; end;

View File

@@ -358,9 +358,7 @@ function TControl.GetInvoker : TInvoker;
begin begin
if FInvoker = nil then if FInvoker = nil then
begin begin
WriteLn('Before GetInvoker');
Result := TInvoker.Wrap(CPlusObject); Result := TInvoker.Wrap(CPlusObject);
WriteLn('After GetInvoker');
end; end;
Result := FInvoker; Result := FInvoker;
end; end;

View File

@@ -235,13 +235,11 @@ end;
procedure TView.WindowActivated(active : boolean); procedure TView.WindowActivated(active : boolean);
begin begin
// WriteLn('WindowActivated in View');
end; end;
procedure TView.MessageReceived(aMessage : TMessage); procedure TView.MessageReceived(aMessage : TMessage);
begin begin
inherited; inherited;
WriteLn('View.MessageReceived, PASCAL');
end; end;
function TView.RemoveSelf : boolean; function TView.RemoveSelf : boolean;

View File

@@ -462,8 +462,7 @@ end;
procedure TWindow.DispatchMessage(message : TMessage; handler : THandler); procedure TWindow.DispatchMessage(message : TMessage; handler : THandler);
begin begin
WriteLn(ClassName);
message.PrintToStream;
end; end;
procedure TWindow.MessageReceived(message : TMessage); procedure TWindow.MessageReceived(message : TMessage);

View File

@@ -41,12 +41,10 @@ var
function Archivable_Instantiate_hook_func(from : TCPlusObject) : TCPlusObject; function Archivable_Instantiate_hook_func(from : TCPlusObject) : TCPlusObject;
begin begin
WriteLn('Bonjour');
end; end;
function Archivable_Archive_hook_func(into : TCPlusObject; deep : boolean) : TCPlusObject; function Archivable_Archive_hook_func(into : TCPlusObject; deep : boolean) : TCPlusObject;
begin begin
WriteLn('Bonjour');
end; end;
initialization initialization