From 87846e5986a6828b6e614b8b298e3bc4c4a2f49b Mon Sep 17 00:00:00 2001 From: peter <peter@freepascal.org> Date: Tue, 8 Nov 2005 11:29:18 +0000 Subject: [PATCH] * fixed compile errors git-svn-id: trunk@1694 - --- fcl/tests/asiotest.pp | 33 ++++++++++++++++++--------------- fcl/tests/testser.pp | 10 +++++----- 2 files changed, 23 insertions(+), 20 deletions(-) diff --git a/fcl/tests/asiotest.pp b/fcl/tests/asiotest.pp index 34d8c4b162..c9ac6f1873 100644 --- a/fcl/tests/asiotest.pp +++ b/fcl/tests/asiotest.pp @@ -4,18 +4,19 @@ {$MODE objfpc} program asiotest; -uses SysUtils, Classes, Crt, AsyncIO; +uses SysUtils, Classes, Crt, FPAsync; type TASIOTest = class protected - FManager: TAsyncIOManager; + FManager: Teventloop; Input: THandleStream; + MyTimer : Pointer; procedure InputAvailable(UserData: TObject); - procedure Timeout(UserData: TObject); + procedure TimerHandler(UserData: TObject); public - constructor Create(AManager: TAsyncIOManager); + constructor Create(AManager: Teventloop); destructor Destroy; override; end; @@ -33,24 +34,26 @@ begin WriteLn('#', b); case b of - Ord('q'): FManager.BreakRun; - Ord('t'): FManager.ClearTimeoutHandler; + Ord('q'): FManager.Break; + Ord('t'): begin + FManager.RemoveTimerNotify(MyTimer); + writeln('Timer stopped'); + end; end; end; -procedure TASIOTest.Timeout(UserData: TObject); +procedure TASIOTest.TimerHandler(UserData: TObject); begin - WriteLn('Timeout'); + writeln('Timer'); end; -constructor TASIOTest.Create(AManager: TAsyncIOManager); +constructor TASIOTest.Create(AManager: Teventloop); begin inherited Create; FManager := AManager; Input := THandleStream.Create(StdInputHandle); - AManager.SetReadHandler(Input.Handle, @InputAvailable, nil); - AManager.SetTimeoutHandler(@Timeout, nil); - AManager.Timeout := 1000; + AManager.SetIONotify(Input.Handle, @InputAvailable, nil); + MyTimer:=AManager.AddTimerNotify(1000,true,@TimerHandler,nil); end; destructor TASIOTest.Destroy; @@ -60,13 +63,13 @@ end; var - AsyncIOManager: TAsyncIOManager; + AsyncIOManager: Teventloop; app: TASIOTest; begin - WriteLn('Exit with "q", use "t" to stop the timeout handler'); + WriteLn('Exit with "q", use "t" to stop the timer handler'); - AsyncIOManager := TAsyncIOManager.Create; + AsyncIOManager := Teventloop.Create; app := TASIOTest.Create(AsyncIOManager); AsyncIOManager.Run; diff --git a/fcl/tests/testser.pp b/fcl/tests/testser.pp index 3350f11540..f1d9436940 100644 --- a/fcl/tests/testser.pp +++ b/fcl/tests/testser.pp @@ -14,9 +14,9 @@ Const TypeNames : Array [TTYpeKind] of string[15] = ('Unknown','Integer','Char','Enumeration', 'Float','Set','Method','ShortString','LongString', 'AnsiString','WideString','Variant','Array','Record', - 'Interface','Class','Object','WideChar','Bool'); - -Const OrdinalTypes = [tkInteger,tkChar,tkENumeration,tkbool]; + 'Interface','Class','Object','WideChar','Bool','Int64', + 'QWord','DynArray','InterfaceRaw'); +Const OrdinalTypes = [tkInteger,tkChar,tkENumeration,tkbool,tkInt64,tkQWord]; Type TMyEnum = (meFirst,meSecond,meThird); @@ -563,14 +563,14 @@ end; procedure testserial(O : TComponent); -Var W : TTextwriter; +Var W : Twriter; S : TStream; begin Writeln(stderr,'Creating stream'); S:=TIOstream.Create(iosOutput); Writeln(stderr,'Creating TTextWriter'); - W:=TTextWriter.Create(S); + W:=TWriter.Create(S,1024); Writeln(stderr,'Writing component TTextWriter'); W.WriteComponent(O); Writeln(stderr,'Destroying stream');