diff --git a/components/codetools/fileprocs.pas b/components/codetools/fileprocs.pas index 471b039b88..e38f7711a9 100644 --- a/components/codetools/fileprocs.pas +++ b/components/codetools/fileprocs.pas @@ -248,47 +248,42 @@ function SimpleFormat(const Fmt: String; const Args: Array of const): String; procedure RaiseCatchableException(const Msg: string); procedure RaiseAndCatchException; -type - TCTDbgOutEvent = procedure(const s: string); -var - CTDbgOutEvent: TCTDbgOutEvent = nil; - procedure DebugLn(Args: array of const); procedure DebugLn(const S: String; Args: array of const);// similar to Format(s,Args) -procedure DebugLn; -procedure DebugLn(const s: string); -procedure DebugLn(const s1,s2: string); -procedure DebugLn(const s1,s2,s3: string); -procedure DebugLn(const s1,s2,s3,s4: string); -procedure DebugLn(const s1,s2,s3,s4,s5: string); -procedure DebugLn(const s1,s2,s3,s4,s5,s6: string); -procedure DebugLn(const s1,s2,s3,s4,s5,s6,s7: string); -procedure DebugLn(const s1,s2,s3,s4,s5,s6,s7,s8: string); -procedure DebugLn(const s1,s2,s3,s4,s5,s6,s7,s8,s9: string); -procedure DebugLn(const s1,s2,s3,s4,s5,s6,s7,s8,s9,s10: string); -procedure DebugLn(const s1,s2,s3,s4,s5,s6,s7,s8,s9,s10,s11: string); -procedure DebugLn(const s1,s2,s3,s4,s5,s6,s7,s8,s9,s10,s11,s12: string); +procedure DebugLn; inline; +procedure DebugLn(const s: string); inline; +procedure DebugLn(const s1,s2: string); inline; +procedure DebugLn(const s1,s2,s3: string); inline; +procedure DebugLn(const s1,s2,s3,s4: string); inline; +procedure DebugLn(const s1,s2,s3,s4,s5: string); inline; +procedure DebugLn(const s1,s2,s3,s4,s5,s6: string); inline; +procedure DebugLn(const s1,s2,s3,s4,s5,s6,s7: string); inline; +procedure DebugLn(const s1,s2,s3,s4,s5,s6,s7,s8: string); inline; +procedure DebugLn(const s1,s2,s3,s4,s5,s6,s7,s8,s9: string); inline; +procedure DebugLn(const s1,s2,s3,s4,s5,s6,s7,s8,s9,s10: string); inline; +procedure DebugLn(const s1,s2,s3,s4,s5,s6,s7,s8,s9,s10,s11: string); inline; +procedure DebugLn(const s1,s2,s3,s4,s5,s6,s7,s8,s9,s10,s11,s12: string); inline; procedure DbgOut(Args: array of const); -procedure DbgOut(const s: string); -procedure DbgOut(const s1,s2: string); -procedure DbgOut(const s1,s2,s3: string); -procedure DbgOut(const s1,s2,s3,s4: string); -procedure DbgOut(const s1,s2,s3,s4,s5: string); -procedure DbgOut(const s1,s2,s3,s4,s5,s6: string); +procedure DbgOut(const s: string); inline; +procedure DbgOut(const s1,s2: string); inline; +procedure DbgOut(const s1,s2,s3: string); inline; +procedure DbgOut(const s1,s2,s3,s4: string); inline; +procedure DbgOut(const s1,s2,s3,s4,s5: string); inline; +procedure DbgOut(const s1,s2,s3,s4,s5,s6: string); inline; function DbgS(Args: array of const): string; overload; function DbgS(const c: char): string; overload; -function DbgS(const c: cardinal): string; overload; -function DbgS(const i: integer): string; overload; -function DbgS(const i: QWord): string; overload; -function DbgS(const i: int64): string; overload; -function DbgS(const r: TRect): string; overload; -function DbgS(const p: TPoint): string; overload; -function DbgS(const p: pointer): string; overload; +function DbgS(const c: cardinal): string; inline; overload; +function DbgS(const i: integer): string; inline; overload; +function DbgS(const i: QWord): string; inline; overload; +function DbgS(const i: int64): string; inline; overload; +function DbgS(const r: TRect): string; inline; overload; +function DbgS(const p: TPoint): string; inline; overload; +function DbgS(const p: pointer): string; inline; overload; function DbgS(const e: extended; MaxDecimals: integer = 999): string; overload; inline; function DbgS(const b: boolean): string; overload; inline; -function DbgS(const ms: TCustomMemoryStream; Count: PtrInt = -1): string; overload; +function DbgS(const ms: TCustomMemoryStream; Count: PtrInt = -1): string; inline; overload; function DbgSName(const p: TObject): string; overload; inline; function DbgSName(const p: TClass): string; overload; inline; function dbgMemRange(P: PByte; Count: integer; Width: integer = 0): string; inline; @@ -1968,117 +1963,113 @@ end; procedure DebugLn(Args: array of const); begin - DbgOut(Args); - DebugLn; + LazLogger.Debugln(Args); end; procedure DebugLn(const S: String; Args: array of const); begin - DebugLn(Format(S, Args)); + LazLogger.DebugLn(Format(S, Args)); end; procedure DebugLn; begin - DebugLn(''); + LazLogger.DebugLn(''); end; procedure DebugLn(const s: string); begin - DbgOut(s+LineEnding); + LazLogger.Debugln(s); end; procedure DebugLn(const s1, s2: string); begin - DebugLn(s1+s2); + LazLogger.Debugln(s1,s2); end; procedure DebugLn(const s1, s2, s3: string); begin - DebugLn(s1+s2+s3); + LazLogger.Debugln(s1,s2,s3); end; procedure DebugLn(const s1, s2, s3, s4: string); begin - DebugLn(s1+s2+s3+s4); + LazLogger.Debugln(s1,s2,s3,s4); end; procedure DebugLn(const s1, s2, s3, s4, s5: string); begin - DebugLn(s1+s2+s3+s4+s5); + LazLogger.Debugln(s1,s2,s3,s4,s5); end; procedure DebugLn(const s1, s2, s3, s4, s5, s6: string); begin - DebugLn(s1+s2+s3+s4+s5+s6); + LazLogger.Debugln(s1,s2,s3,s4,s5,s6); end; procedure DebugLn(const s1, s2, s3, s4, s5, s6, s7: string); begin - DebugLn(s1+s2+s3+s4+s5+s6+s7); + LazLogger.Debugln(s1,s2,s3,s4,s5,s6,s7); end; procedure DebugLn(const s1, s2, s3, s4, s5, s6, s7, s8: string); begin - DebugLn(s1+s2+s3+s4+s5+s6+s7+s8); + LazLogger.Debugln(s1,s2,s3,s4,s5,s6,s7,s8); end; procedure DebugLn(const s1, s2, s3, s4, s5, s6, s7, s8, s9: string); begin - DebugLn(s1+s2+s3+s4+s5+s6+s7+s8+s9); + LazLogger.Debugln(s1,s2,s3,s4,s5,s6,s7,s8,s9); end; procedure DebugLn(const s1, s2, s3, s4, s5, s6, s7, s8, s9, s10: string); begin - DebugLn(s1+s2+s3+s4+s5+s6+s7+s8+s9+s10); + LazLogger.Debugln(s1,s2,s3,s4,s5,s6,s7,s8,s9,s10); end; procedure DebugLn(const s1, s2, s3, s4, s5, s6, s7, s8, s9, s10, s11: string); begin - DebugLn(s1+s2+s3+s4+s5+s6+s7+s8+s9+s10+s11); + LazLogger.Debugln(s1,s2,s3,s4,s5,s6,s7,s8,s9,s10,s11); end; procedure DebugLn(const s1, s2, s3, s4, s5, s6, s7, s8, s9, s10, s11, s12: string); begin - DebugLn(s1+s2+s3+s4+s5+s6+s7+s8+s9+s10+s11+s12); + LazLogger.Debugln(s1,s2,s3,s4,s5,s6,s7,s8,s9,s10,s11,s12); end; procedure DbgOut(Args: array of const); begin - dbgout(dbgs(Args)); + LazLogger.DbgOut(dbgs(Args)); end; procedure DbgOut(const s: string); begin - if Assigned(CTDbgOutEvent) then - CTDbgOutEvent(s) - else if TextRec(Output).Mode<>fmClosed then - write(s); + LazLogger.DbgOut(s); end; procedure DbgOut(const s1, s2: string); begin - DbgOut(s1+s2); + LazLogger.DbgOut(s1,s2); end; procedure DbgOut(const s1, s2, s3: string); begin - DbgOut(s1+s2+s3); + LazLogger.DbgOut(s1,s2,s3); end; procedure DbgOut(const s1, s2, s3, s4: string); begin - DbgOut(s1+s2+s3+s4); + LazLogger.DbgOut(s1,s2,s3,s4); end; procedure DbgOut(const s1, s2, s3, s4, s5: string); begin - DbgOut(s1+s2+s3+s4+s5); + LazLogger.DbgOut(s1,s2,s3,s4,s5); end; procedure DbgOut(const s1, s2, s3, s4, s5, s6: string); begin - DbgOut(s1+s2+s3+s4+s5+s6); + LazLogger.DbgOut(s1,s2,s3,s4,s5,s6); end; function DbgS(Args: array of const): string; @@ -2128,38 +2119,37 @@ end; function DbgS(const c: cardinal): string; begin - Result:=IntToStr(c); + Result:=LazLogger.DbgS(c); end; function DbgS(const i: integer): string; begin - Result:=IntToStr(i); + Result:=LazLogger.DbgS(i); end; function DbgS(const i: QWord): string; begin - Result:=IntToStr(i); + Result:=LazLogger.DbgS(i); end; function DbgS(const i: int64): string; begin - Result:=IntToStr(i); + Result:=LazLogger.DbgS(i); end; function DbgS(const r: TRect): string; begin - Result:=' l='+IntToStr(r.Left)+',t='+IntToStr(r.Top) - +',r='+IntToStr(r.Right)+',b='+IntToStr(r.Bottom); + Result:=LazLogger.DbgS(r); end; function DbgS(const p: TPoint): string; begin - Result:=' x='+IntToStr(p.x)+',y='+IntToStr(p.y); + Result:=LazLogger.DbgS(p); end; function DbgS(const p: pointer): string; begin - Result:=HexStr(p-nil,2*sizeof(PtrInt)); + Result:=LazLogger.DbgS(p); end; function DbgS(const e: extended; MaxDecimals: integer = 999): string; @@ -2178,20 +2168,8 @@ begin end; function DbgS(const ms: TCustomMemoryStream; Count: PtrInt): string; -var - OldPos: Int64; begin - if Count<0 then - Count:=ms.Size-ms.Position; - if Count=0 then - exit(''); - OldPos:=ms.Position; - try - SetLength(Result,Count); - ms.Read(Result[1],length(Result)); - finally - ms.Position:=OldPos; - end; + Result:=dbgMemStream(ms,Count); end; function DbgSName(const p: TObject): string; diff --git a/ide/ideprocs.pp b/ide/ideprocs.pp index b6ba3dc421..a09dcf3d6d 100644 --- a/ide/ideprocs.pp +++ b/ide/ideprocs.pp @@ -2670,10 +2670,5 @@ begin LCLProc.DbgOut(s); end; -initialization - CTDbgOutEvent:=@CTDbgOut; -finalization - CTDbgOutEvent:=nil; - end.