Use of libfdb's SendText instead of WriteLn for debug messages

This commit is contained in:
ocoursiere
2003-05-09 21:13:06 +00:00
parent 5994abf5e8
commit 1af3447fb2
6 changed files with 50 additions and 39 deletions

View File

@@ -21,7 +21,7 @@ unit Application;
interface interface
uses uses
beobj, looper, appdefs, supportdefs, message, os; beobj, looper, appdefs, supportdefs, message, os, fdblib;
type type
TApplication = class(TLooper) TApplication = class(TLooper)
@@ -98,18 +98,18 @@ end;
procedure TApplication.AppActivated(Active : boolean); procedure TApplication.AppActivated(Active : boolean);
begin begin
{$IFDEF DEBUG} {$IFDEF DEBUG}
WriteLn(Active); SendText(Active);
if Active then if Active then
WriteLn('Application activée !') SendText('Application activée !')
else else
WriteLn('Application désactivée !'); SendText('Application désactivée !');
{$ENDIF} {$ENDIF}
end; end;
procedure Application_ReadyToRun_hook_func(Application : TApplication); cdecl; procedure Application_ReadyToRun_hook_func(Application : TApplication); cdecl;
begin begin
{$IFDEF DEBUG} {$IFDEF DEBUG}
WriteLn('Hook ReadyToRun !'); SendText('Hook ReadyToRun !');
{$ENDIF} {$ENDIF}
if Application <> nil then if Application <> nil then
Application.ReadyToRun; Application.ReadyToRun;
@@ -120,7 +120,7 @@ var
Message : TMessage; Message : TMessage;
begin begin
{$IFDEF DEBUG} {$IFDEF DEBUG}
WriteLn('Hook MessageReceived !'); SendText('Hook MessageReceived !');
{$ENDIF} {$ENDIF}
Message := TMessage.Wrap(aMessage); Message := TMessage.Wrap(aMessage);
try try
@@ -134,7 +134,7 @@ end;
procedure TApplication.ReadyToRun; procedure TApplication.ReadyToRun;
begin begin
{$IFDEF DEBUG} {$IFDEF DEBUG}
WriteLn('Prêt à démarer !'); SendText('Prêt à démarer !');
{$ENDIF} {$ENDIF}
end; end;
@@ -170,4 +170,4 @@ finalization
Application_ReadyToRun_hook := nil; Application_ReadyToRun_hook := nil;
be_app := nil; be_app := nil;
end. end.

View File

@@ -21,7 +21,7 @@ unit handler;
interface interface
uses uses
beobj, archivable, message; beobj, archivable, message, fdblib;
type type
THandler = class(TArchivable) THandler = class(TArchivable)
@@ -40,8 +40,8 @@ var
procedure THandler.MessageReceived(aMessage : TMessage); procedure THandler.MessageReceived(aMessage : TMessage);
begin begin
{$IFDEF DEBUG} {$IFDEF DEBUG}
WriteLn(ClassName + '.MessageReceived'); SendText(ClassName + '.MessageReceived');
WriteLn('Message reçue'); SendText('Message reçue');
aMessage.PrintToStream; aMessage.PrintToStream;
{$ENDIF} {$ENDIF}
end; end;
@@ -52,7 +52,7 @@ var
begin begin
try try
{$IFDEF DEBUG} {$IFDEF DEBUG}
WriteLn('Hook MessageReceived !'); SendText('Hook MessageReceived !');
{$ENDIF} {$ENDIF}
Message := TMessage.Wrap(aMessage); Message := TMessage.Wrap(aMessage);
try try
@@ -65,7 +65,7 @@ begin
on e : exception do on e : exception do
begin begin
{$IFDEF DEBUG} {$IFDEF DEBUG}
WriteLn(e.Message + 'Handler_MessageReceived'); SendText(e.Message + 'Handler_MessageReceived');
{$ENDIF} {$ENDIF}
end; end;
end end
@@ -77,4 +77,4 @@ initialization
finalization finalization
Handler_MessageReceived_hook := nil; Handler_MessageReceived_hook := nil;
end. end.

View File

@@ -89,6 +89,9 @@ function BMessenger_Team(AObject : TCPlusObject) : TTeam_id; cdecl; external BeP
//procedure BMessenger_bool extra3(AObject : TCPlusObject); cdecl; external BePascalLibName name 'BMessenger_bool extra3'; //procedure BMessenger_bool extra3(AObject : TCPlusObject); cdecl; external BePascalLibName name 'BMessenger_bool extra3';
//procedure BMessenger_bool extra4(AObject : TCPlusObject); cdecl; external BePascalLibName name 'BMessenger_bool extra4'; //procedure BMessenger_bool extra4(AObject : TCPlusObject); cdecl; external BePascalLibName name 'BMessenger_bool extra4';
var
be_app_messenger : TMessenger;
implementation implementation
constructor TMessenger.Create; constructor TMessenger.Create;
@@ -236,5 +239,10 @@ end;
// BMessenger_bool extra4(CPlusObject); // BMessenger_bool extra4(CPlusObject);
//end; //end;
initialization
be_app_messenger := nil;
finalization
be_app_messenger := nil;
end. end.

View File

@@ -22,6 +22,9 @@ interface
{$M+} {$M+}
uses
fdblib;
// FreePascal use ld on BeOS (like on LINUX) to link to libraries. // FreePascal use ld on BeOS (like on LINUX) to link to libraries.
// ld use the environment variable BELIBRARIES to find libraries. // ld use the environment variable BELIBRARIES to find libraries.
@@ -93,7 +96,7 @@ begin
{$IFDEF DEBUG} {$IFDEF DEBUG}
size := 0; size := 0;
size := SizeOf(Self.ClassType); size := SizeOf(Self.ClassType);
WriteLn('Instance de ' + Self.ClassName + '(' + HexStr(longint(pointer(Self)), 8) + ')' + SendText('Instance de ' + Self.ClassName + '(' + HexStr(longint(pointer(Self)), 8) + ')' +
'(' + IntToStr(size) + ')' + '(' + IntToStr(size) + ')' +
' '); ' ');
{$ENDIF} {$ENDIF}
@@ -106,7 +109,7 @@ end;
destructor TBeObject.UnWrap; destructor TBeObject.UnWrap;
begin begin
{$IFDEF DEBUG} {$IFDEF DEBUG}
WriteLn('UnWrap'); SendText('UnWrap');
{$ENDIF} {$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
@@ -120,4 +123,4 @@ initialization
finalization finalization
PasObject_GetPasClassName_hook := nil; PasObject_GetPasClassName_hook := nil;
end. end.

View File

@@ -22,7 +22,7 @@ interface
uses uses
beobj, view, message, archivable, SupportDefs, rect, list, beobj, view, message, archivable, SupportDefs, rect, list,
handler, messenger; handler, messenger, fdblib;
type type
TMenu_Info = record TMenu_Info = record
@@ -791,82 +791,82 @@ end;
function TMenu.AddItem(item : TMenuItem) : boolean; function TMenu.AddItem(item : TMenuItem) : boolean;
begin begin
WriteLn('function TMenu.AddItem(item : TMenuItem) : boolean;'); SendText('function TMenu.AddItem(item : TMenuItem) : boolean;');
Result := BMenu_AddItem_1(CPlusObject, item.CPlusObject); Result := BMenu_AddItem_1(CPlusObject, item.CPlusObject);
end; end;
function TMenu.AddItem(item : TMenuItem; index : integer) : boolean; function TMenu.AddItem(item : TMenuItem; index : integer) : boolean;
begin begin
WriteLn('function TMenu.AddItem(item : TMenuItem; index : integer) : boolean;'); SendText('function TMenu.AddItem(item : TMenuItem; index : integer) : boolean;');
Result := BMenu_AddItem_2(CPlusObject, item.CPlusObject, index); Result := BMenu_AddItem_2(CPlusObject, item.CPlusObject, index);
end; end;
function TMenu.AddItem(item : TMenuItem; frame : TRect) : boolean; function TMenu.AddItem(item : TMenuItem; frame : TRect) : boolean;
begin begin
WriteLn('ici'); SendText('ici');
WriteLn('function TMenu.AddItem(item : TMenuItem; frame : TRect) : boolean;'); SendText('function TMenu.AddItem(item : TMenuItem; frame : TRect) : boolean;');
frame.PrintToStream; frame.PrintToStream;
Writeln('toto'); SendText('toto');
Result := BMenu_AddItem_3(CPlusObject, item.CPlusObject, frame.CPlusObject); Result := BMenu_AddItem_3(CPlusObject, item.CPlusObject, frame.CPlusObject);
end; end;
function TMenu.AddItem(menu : TMenu) : boolean; function TMenu.AddItem(menu : TMenu) : boolean;
begin begin
WriteLn('function TMenu.AddItem(menu : TMenu) : boolean;'); SendText('function TMenu.AddItem(menu : TMenu) : boolean;');
WriteLn('Bonjour'); SendText('Bonjour');
Result := BMenu_AddItem_4(CPlusObject, menu.CPlusObject); Result := BMenu_AddItem_4(CPlusObject, menu.CPlusObject);
end; end;
function TMenu.AddItem(menu : TMenu; index : integer) : boolean; function TMenu.AddItem(menu : TMenu; index : integer) : boolean;
begin begin
WriteLn('function TMenu.AddItem(menu : TMenu; index : integer) : boolean;'); SendText('function TMenu.AddItem(menu : TMenu; index : integer) : boolean;');
Result := BMenu_AddItem_5(CPlusObject, menu.CPlusObject, index); Result := BMenu_AddItem_5(CPlusObject, menu.CPlusObject, index);
end; end;
function TMenu.AddItem(menu : TMenu; frame : TRect) : boolean; function TMenu.AddItem(menu : TMenu; frame : TRect) : boolean;
begin begin
WriteLn('function TMenu.AddItem(menu : TMenu; frame : TRect) : boolean;'); SendText('function TMenu.AddItem(menu : TMenu; frame : TRect) : boolean;');
Result := BMenu_AddItem_6(CPlusObject, menu.CPlusObject, frame.CPlusObject); Result := BMenu_AddItem_6(CPlusObject, menu.CPlusObject, frame.CPlusObject);
end; end;
{function TMenu.AddItem(item : TMenuItem) : boolean; {function TMenu.AddItem(item : TMenuItem) : boolean;
begin begin
WriteLn('function TMenu.AddItem(item : TMenuItem) : boolean;'); SendText('function TMenu.AddItem(item : TMenuItem) : boolean;');
Result := BMenu_AddItem_1(CPlusObject, item.CPlusObject); Result := BMenu_AddItem_1(CPlusObject, item.CPlusObject);
end; end;
function TMenu.AddItem(item : TMenuItem; index : integer) : boolean; function TMenu.AddItem(item : TMenuItem; index : integer) : boolean;
begin begin
WriteLn('function TMenu.AddItem(item : TMenuItem; index : integer) : boolean;'); SendText('function TMenu.AddItem(item : TMenuItem; index : integer) : boolean;');
Result := BMenu_AddItem_2(CPlusObject, item.CPlusObject, index); Result := BMenu_AddItem_2(CPlusObject, item.CPlusObject, index);
end; end;
function TMenu.AddItem(item : TMenuItem; frame : TRect) : boolean; function TMenu.AddItem(item : TMenuItem; frame : TRect) : boolean;
begin begin
WriteLn('ici'); SendText('ici');
WriteLn('function TMenu.AddItem(item : TMenuItem; frame : TRect) : boolean;'); SendText('function TMenu.AddItem(item : TMenuItem; frame : TRect) : boolean;');
frame.PrintToStream; frame.PrintToStream;
Writeln('toto'); SendText('toto');
Result := BMenu_AddItem_3(CPlusObject, item.CPlusObject, frame.CPlusObject); Result := BMenu_AddItem_3(CPlusObject, item.CPlusObject, frame.CPlusObject);
end; end;
function TMenu.AddItem(menu : TMenu) : boolean; function TMenu.AddItem(menu : TMenu) : boolean;
begin begin
WriteLn('function TMenu.AddItem(menu : TMenu) : boolean;'); SendText('function TMenu.AddItem(menu : TMenu) : boolean;');
WriteLn('Bonjour'); SendText('Bonjour');
Result := BMenu_AddItem_4(CPlusObject, menu.CPlusObject); Result := BMenu_AddItem_4(CPlusObject, menu.CPlusObject);
end; end;
function TMenu.AddItem(menu : TMenu; index : integer) : boolean; function TMenu.AddItem(menu : TMenu; index : integer) : boolean;
begin begin
WriteLn('function TMenu.AddItem(menu : TMenu; index : integer) : boolean;'); SendText('function TMenu.AddItem(menu : TMenu; index : integer) : boolean;');
Result := BMenu_AddItem_5(CPlusObject, menu.CPlusObject, index); Result := BMenu_AddItem_5(CPlusObject, menu.CPlusObject, index);
end; end;
function TMenu.AddItem(menu : TMenu; frame : TRect) : boolean; function TMenu.AddItem(menu : TMenu; frame : TRect) : boolean;
begin begin
WriteLn('function TMenu.AddItem(menu : TMenu; frame : TRect) : boolean;'); SendText('function TMenu.AddItem(menu : TMenu; frame : TRect) : boolean;');
Result := BMenu_AddItem_6(CPlusObject, menu.CPlusObject, frame.CPlusObject); Result := BMenu_AddItem_6(CPlusObject, menu.CPlusObject, frame.CPlusObject);
end; end;
} }

View File

@@ -22,7 +22,7 @@ interface
uses uses
beobj, handler, rect, os, application, appdefs, message, beobj, handler, rect, os, application, appdefs, message,
graphicdefs; graphicdefs, fdblib;
type type
// TWindow = class(TBeObject); // TWindow = class(TBeObject);
@@ -191,7 +191,7 @@ end;
procedure TView.Draw(updateRect : TRect); procedure TView.Draw(updateRect : TRect);
begin begin
WriteLn('Drawing view'); SendText('Drawing view');
end; end;
@@ -516,4 +516,4 @@ initialization
// View_TargetedByScrollView_hook := @View_TargetedByScrollView_hook_func; // View_TargetedByScrollView_hook := @View_TargetedByScrollView_hook_func;
View_WindowActivated_hook := @View_WindowActivated_hook_func; View_WindowActivated_hook := @View_WindowActivated_hook_func;
end. end.