Kaynağa Gözat

Merged revisions 9815,9822,9825,9837-9850,9852,9855-9856,9863-9864,9867,10082,10129-10130,10137-10138,10140-10146,10148-10153,10160-10161,10168,10170,10172,10176-10178,10180,10183-10184,10187-10188,10191-10192,10200-10201,10203-10204,10206,10232,10234,10238-10239,10243,10251,10253-10254,10264,10266,10271,10273,10276-10279,10286-10294,10298,10300,10309,10313,10319,10343,10352-10356,10358-10360,10364-10366,10369-10370,10373-10374,10376-10381,10387-10391,10393,10398,10400,10403,10423,10430,10436,10441,10444-10446,10449,10452,10472,10489-10491,10503,10507,10509-10515,10522,10525-10527,10530-10531,10534,10537-10540,10547,10553,10555,10565,10570,10606,10612-10613,10617,10622-10624,10639-10641,10645-10646,10649,10658,10660-10662,10664-10667,10673-10675,10678-10680,10684-10687,10689,10695,10698-10701,10703,10709,10713-10716,10718-10719,10723,10735-10739,10749,10751,10755-10757,10759-10761,10769,10772-10778,10782-10785,10787-10790,10794-10795,10798,10830-10832,10837,10848,10858,10860,10862-10864,10866,10875,10882,10891,10907,10909,10915-10916,10922-10923,10928,10930,10933,10935,10939,10942,10948,10952-10956,10960,10964-10965,10972,10974-10975,10977,10980,10982-10983,10985,10993,11000,11004,11010,11018,11030,11032-11033,11042,11044,11046,11053,11057,11060,11062,11064,11067,11075,11078,11080,11085,11089,11094,11096,11098,11103-11104,11106,11108-11109,11111,11114,11117,11122,11124,11126,11130-11131,11133,11136,11139-11141,11146-11147,11152-11154,11157,11159,11166-11167,11170,11173,11178,11181-11182,11184-11185,11187-11189,11195-11196,11206-11209,11214-11215,11223,11225,11227,11232,11235,11239-11240,11249-11256,11258,11260,11264-11265,11271,11278,11280-11282,11284,11286-11288,11292-11294,11297,11299-11300,11302,11304-11311,11313,11315-11316,11318-11319,11324-11326,11328-11333,11335-11336,11339-11340,11346-11347,11349,11362,11369,11371-11375,11393-11396,11401,11411-11414,11420,11422,11427-11428,11431,11465,11469-11470,11487-11488,11490,11518-11521,11523,11528,11535,11551,11553,11555,11557,11562,11564,11571,11588,11619,11621-11622,11628,11640,11664-11667,11670,11683,11685,11689-11692,11694-11696,11698,11701-11702,11705-11707,11712-11718,11723-11726,11728-11729,11733-11737,11778,11780-11781,11785,11810,11822,11831,11836,11842 via svnmerge from
http://svn.freepascal.org/svn/fpc/trunk

........
r9815 | florian | 2008-01-20 15:43:22 +0100 (Sun, 20 Jan 2008) | 2 lines

* build lnfdwarf on win64
........
r10449 | florian | 2008-03-06 21:20:29 +0100 (Thu, 06 Mar 2008) | 2 lines

* fixed writing of long strings when using the crt unit on win32, resolves #8843
........
r10866 | florian | 2008-05-02 20:42:28 +0200 (Fri, 02 May 2008) | 2 lines

* flush standard files only if they are opend for output, resolves #11170
........
r11004 | florian | 2008-05-18 18:46:17 +0200 (Sun, 18 May 2008) | 1 line

* handle lineinfo in dlls correctly, resolves #4171 and #10797 for windows
........
r11010 | florian | 2008-05-18 20:42:09 +0200 (Sun, 18 May 2008) | 2 lines

+ proper handling of lineinfo retrival for dyn. libs in unix
........
r11018 | florian | 2008-05-19 22:02:23 +0200 (Mon, 19 May 2008) | 2 lines

* patch for 10812 by Danny Milosavljevic
........
r11030 | florian | 2008-05-21 22:45:20 +0200 (Wed, 21 May 2008) | 2 lines

* baseaddr must be nil on windows
........
r11057 | florian | 2008-05-23 17:35:18 +0200 (Fri, 23 May 2008) | 2 lines

* WinCE compilation fixed
........
r11284 | florian | 2008-06-26 22:01:31 +0200 (Thu, 26 Jun 2008) | 1 line

* handle booleans correctly in Typinfo.GetEnum*, resolves #11372
........
r11431 | florian | 2008-07-21 21:01:46 +0200 (Mon, 21 Jul 2008) | 2 lines

* fixes reading/writing of extended properties on arm-linux, by Koenraad Lelong
........
r11640 | florian | 2008-08-23 15:08:30 +0200 (Sat, 23 Aug 2008) | 1 line

* patch by Sergei Gorelkin improving win32 command line handling, resolves #10175
........
r11842 | florian | 2008-09-29 21:59:27 +0200 (Mon, 29 Sep 2008) | 1 line

* fixes array overflow in VarTypeAsText when an 'Array of' or 'Ref to' variant type is passed
........

git-svn-id: branches/fixes_2_2@12074 -

florian 17 yıl önce
ebeveyn
işleme
1320453f7e

+ 1 - 0
.gitattributes

@@ -8066,6 +8066,7 @@ tests/webtbs/tw1132.pp svneol=native#text/plain
 tests/webtbs/tw1133.pp svneol=native#text/plain
 tests/webtbs/tw11349.pp svneol=native#text/plain
 tests/webtbs/tw11354.pp svneol=native#text/plain
+tests/webtbs/tw11372.pp svneol=native#text/plain
 tests/webtbs/tw11431.pp svneol=native#text/plain
 tests/webtbs/tw11435b.pp svneol=native#text/plain
 tests/webtbs/tw11435c.pp svneol=native#text/plain

+ 52 - 1
rtl/inc/exeinfo.pp

@@ -46,12 +46,63 @@ function FindExeSection(var e:TExeFile;const secname:string;var secofs,seclen:lo
 function CloseExeFile(var e:TExeFile):boolean;
 function ReadDebugLink(var e:TExeFile;var dbgfn:string):boolean;
 
+procedure GetModuleByAddr(addr: pointer; var baseaddr: pointer; var filename: string);
 
 implementation
 
 uses
-  strings;
+  strings{$ifdef windows},windows{$endif windows};
 
+{$ifdef unix}
+
+  procedure GetModuleByAddr(addr: pointer; var baseaddr: pointer; var filename: string);
+    begin
+      if assigned(UnixGetModuleByAddrHook) then
+        UnixGetModuleByAddrHook(addr,baseaddr,filename)
+      else
+        begin
+          baseaddr:=nil;
+          filename:=ParamStr(0);
+        end;
+    end;
+
+{$else unix}
+{$ifdef windows}
+
+  var
+    Tmm: TMemoryBasicInformation;
+{$ifdef wince}
+    TST: array[0..Max_Path] of WideChar;
+{$else wince}
+    TST: array[0..Max_Path] of Char;
+{$endif wince}
+  procedure GetModuleByAddr(addr: pointer; var baseaddr: pointer; var filename: string);
+    begin
+      baseaddr:= nil;
+      if VirtualQuery(addr, @Tmm, SizeOf(Tmm))<>sizeof(Tmm) then
+        filename:=ParamStr(0)
+      else
+        begin
+          TST[0]:= #0;
+          GetModuleFileName(THandle(Tmm.AllocationBase), TST, Length(TST));
+{$ifdef wince}
+          filename:= String(PWideChar(@TST));
+{$else wince}
+          filename:= String(PChar(@TST));
+{$endif wince}
+        end;
+    end;
+
+{$else windows}
+
+  procedure GetModuleByAddr(addr: pointer; var baseaddr: pointer; var filename: string);
+    begin
+      baseaddr:= nil;
+      filename:=ParamStr(0);
+    end;
+
+{$endif windows}
+{$endif unix}
 
 {****************************************************************************
                              Executable Loaders

+ 35 - 12
rtl/inc/lineinfo.pp

@@ -22,8 +22,7 @@ interface
 {$S-}
 {$Q-}
 
-procedure GetLineInfo(addr:ptruint;var func,source:string;var line:longint);
-
+function GetLineInfo(addr:ptruint;var func,source:string;var line:longint) : boolean;
 
 implementation
 
@@ -71,16 +70,24 @@ var
   linestab,             { stab with current line info }
   dirstab,              { stab with current directory info }
   filestab   : tstab;   { stab with current file info }
+  filename,
+  dbgfn : string;
 
 
-function OpenStabs:boolean;
-var
-  dbgfn : string;
+function OpenStabs(addr : pointer) : boolean;
+  var
+    baseaddr : pointer;
 begin
   OpenStabs:=false;
   if staberr then
     exit;
-  if not OpenExeFile(e,paramstr(0)) then
+
+  GetModuleByAddr(addr,baseaddr,filename);
+{$ifdef DEBUG_LINEINFO}
+  writeln(stderr,filename,' Baseaddr: ',hexstr(ptruint(baseaddr),sizeof(baseaddr)*2));
+{$endif DEBUG_LINEINFO}
+
+  if not OpenExeFile(e,filename) then
     exit;
   if ReadDebugLink(e,dbgfn) then
     begin
@@ -88,6 +95,7 @@ begin
       if not OpenExeFile(e,dbgfn) then
         exit;
     end;
+  e.processaddress:=e.processaddress+dword(baseaddr);
   StabsFunctionRelative := E.FunctionRelative;
   if FindExeSection(e,'.stab',stabofs,stablen) and
      FindExeSection(e,'.stabstr',stabstrofs,stabstrlen) then
@@ -109,7 +117,7 @@ begin
 end;
 
 
-procedure GetLineInfo(addr:ptruint;var func,source:string;var line:longint);
+function GetLineInfo(addr:ptruint;var func,source:string;var line:longint) : boolean;
 var
   res,
   stabsleft,
@@ -117,6 +125,10 @@ var
   found : boolean;
   lastfunc : tstab;
 begin
+  GetLineInfo:=false;
+{$ifdef DEBUG_LINEINFO}
+  writeln(stderr,'GetLineInfo called');
+{$endif DEBUG_LINEINFO}
   fillchar(func,high(func)+1,0);
   fillchar(source,high(source)+1,0);
   line:=0;
@@ -124,7 +136,7 @@ begin
     exit;
   if not e.isopen then
    begin
-     if not OpenStabs then
+     if not OpenStabs(pointer(addr)) then
       exit;
    end;
 
@@ -132,6 +144,10 @@ begin
   { processaddress is set in OpenStabs                   }
   addr := addr - e.processaddress;
 
+{$ifdef DEBUG_LINEINFO}
+  writeln(stderr,'Addr: ',hexstr(addr,sizeof(addr)*2));
+{$endif DEBUG_LINEINFO}
+
   fillchar(funcstab,sizeof(tstab),0);
   fillchar(filestab,sizeof(tstab),0);
   fillchar(dirstab,sizeof(tstab),0);
@@ -230,6 +246,9 @@ begin
      if i>0 then
       Delete(func,i,255);
    end;
+  if e.isopen then
+    CloseStabs;
+  GetLineInfo:=true;
 end;
 
 
@@ -240,11 +259,16 @@ var
   hs     : string[32];
   line   : longint;
   Store  : TBackTraceStrFunc;
+  Success : boolean;
 begin
+{$ifdef DEBUG_LINEINFO}
+  writeln(stderr,'StabBackTraceStr called');
+{$endif DEBUG_LINEINFO}
   { reset to prevent infinite recursion if problems inside the code PM }
+  Success:=false;
   Store:=BackTraceStrFunc;
   BackTraceStrFunc:=@SysBackTraceStr;
-  GetLineInfo(ptruint(addr),func,source,line);
+  Success:=GetLineInfo(ptruint(addr),func,source,line);
 { create string }
 {$ifdef netware}
   { we need addr relative to code start on netware }
@@ -254,7 +278,7 @@ begin
   StabBackTraceStr:='  $'+HexStr(ptruint(addr),sizeof(ptruint)*2);
 {$endif}
   if func<>'' then
-   StabBackTraceStr:=StabBackTraceStr+'  '+func;
+    StabBackTraceStr:=StabBackTraceStr+'  '+func;
   if source<>'' then
    begin
      if func<>'' then
@@ -266,7 +290,7 @@ begin
       end;
      StabBackTraceStr:=StabBackTraceStr+' of '+source;
    end;
-  if e.IsOpen then
+  if Success then
     BackTraceStrFunc:=Store;
 end;
 
@@ -277,5 +301,4 @@ initialization
 finalization
   if e.isopen then
    CloseStabs;
-
 end.

+ 27 - 10
rtl/inc/lnfodwrf.pp

@@ -25,7 +25,7 @@ interface
 
 {$S-}
 
-procedure GetLineInfo(addr:ptruint;var func,source:string;var line:longint);
+function GetLineInfo(addr:ptruint;var func,source:string;var line:longint) : boolean;
 
 implementation
 
@@ -129,15 +129,22 @@ type
 var
   base, limit : SizeInt;
   index : SizeInt;
-
-function Opendwarf:boolean;
-var
+  baseaddr : pointer;
+  filename,
   dbgfn : string;
+
+function Opendwarf(addr : pointer) : boolean;
 begin
   Opendwarf:=false;
   if dwarferr then
     exit;
-  if not OpenExeFile(e,paramstr(0)) then
+
+  GetModuleByAddr(addr,baseaddr,filename);
+{$ifdef DEBUG_LINEINFO}
+  writeln(stderr,filename,' Baseaddr: ',hexstr(ptruint(baseaddr),sizeof(baseaddr)*2));
+{$endif DEBUG_LINEINFO}
+
+  if not OpenExeFile(e,filename) then
     exit;
   if ReadDebugLink(e,dbgfn) then
     begin
@@ -145,6 +152,9 @@ begin
       if not OpenExeFile(e,dbgfn) then
         exit;
     end;
+
+  e.processaddress:=e.processaddress+dword(baseaddr);
+
   if FindExeSection(e,'.debug_line',dwarfoffset,dwarfsize) then
     Opendwarf:=true
   else
@@ -667,7 +677,7 @@ begin
   end;
 end;
 
-procedure GetLineInfo(addr : ptruint; var func, source : string; var line : longint);
+function GetLineInfo(addr : ptruint; var func, source : string; var line : longint) : boolean;
 var
   current_offset : QWord;
   end_offset : QWord;
@@ -678,15 +688,17 @@ begin
   func := '';
   source := '';
   found := false;
-
+  GetLineInfo:=false;
   if DwarfErr then
     exit;
   if not e.isopen then
    begin
-     if not OpenDwarf then
+     if not OpenDwarf(pointer(addr)) then
       exit;
    end;
 
+  addr := addr - e.processaddress;
+
   current_offset := DwarfOffset;
   end_offset := DwarfOffset + DwarfSize;
 
@@ -695,6 +707,9 @@ begin
     current_offset := ParseCompilationUnit(addr, current_offset,
       source, line, found);
   end;
+  if e.isopen then
+    CloseDwarf;
+  GetLineInfo:=true;
 end;
 
 
@@ -705,11 +720,13 @@ var
   hs     : string[32];
   line   : longint;
   Store  : TBackTraceStrFunc;
+  Success : boolean;
 begin
   { reset to prevent infinite recursion if problems inside the code }
+  Success:=false;
   Store := BackTraceStrFunc;
   BackTraceStrFunc := @SysBackTraceStr;
-  GetLineInfo(ptruint(addr), func, source, line);
+  Success:=GetLineInfo(ptruint(addr), func, source, line);
   { create string }
   DwarfBackTraceStr :='  $' + HexStr(ptruint(addr), sizeof(ptruint) * 2);
   if func<>'' then
@@ -724,7 +741,7 @@ begin
     end;
     DwarfBackTraceStr := DwarfBackTraceStr + ' of ' + source;
   end;
-  if e.IsOpen then
+  if Success then
     BackTraceStrFunc := Store;
 end;
 

+ 8 - 4
rtl/inc/system.inc

@@ -800,10 +800,14 @@ Begin
    End;
 
   { Make sure that all output is written to the redirected file }
-  Flush(Output);
-  Flush(ErrOutput);
-  Flush(pstdout^);
-  Flush(StdErr);
+  if Textrec(Output).Mode=fmOutput then
+    Flush(Output);
+  if Textrec(ErrOutput).Mode=fmOutput then
+    Flush(ErrOutput);
+  if Textrec(pstdout^).Mode=fmOutput then
+    Flush(pstdout^);
+  if Textrec(StdErr).Mode=fmOutput then
+    Flush(StdErr);
 {$endif FPC_HAS_FEATURE_CONSOLEIO}
 
 {$if defined(MSWINDOWS) or defined(OS2)}

+ 62 - 35
rtl/objpas/typinfo.pp

@@ -63,7 +63,7 @@ unit typinfo;
 
    type
       TTypeKinds = set of TTypeKind;
-		  ShortStringBase = string[255];
+      ShortStringBase = string[255];
 
 {$PACKRECORDS 1}
       TTypeInfo = record
@@ -142,14 +142,14 @@ unit typinfo;
                RawIntfUnit: ShortString;
                IIDStr: ShortString;
               );
-			      tkDynArray: 
-			        (
-			        elSize     : PtrUInt;
-			        elType2    : PPTypeInfo;
-			        varType    : Longint;
-			        elType     : PPTypeInfo;
-			        DynUnitName: ShortStringBase
-			        );
+            tkDynArray:
+              (
+              elSize     : PtrUInt;
+              elType2    : PPTypeInfo;
+              varType    : Longint;
+              elType     : PPTypeInfo;
+              DynUnitName: ShortStringBase
+              );
       end;
 
       // unsed, just for completeness
@@ -342,16 +342,26 @@ Function GetEnumName(TypeInfo : PTypeInfo;Value : Integer) : string;
       PT : PTypeData;
 
 begin
- PT:=GetTypeData(TypeInfo);
- // ^.BaseType);
- //      If PT^.MinValue<0 then Value:=Ord(Value<>0); {map to 0/1}
- PS:=@PT^.NameList;
- While Value>0 Do
-  begin
-    PS:=PShortString(pointer(PS)+PByte(PS)^+1);
-    Dec(Value);
-  end;
- Result:=PS^;
+  PT:=GetTypeData(TypeInfo);
+  if TypeInfo^.Kind=tkBool then 
+    begin
+      case Value of
+        0,1:
+          Result:=BooleanIdents[Boolean(Value)];
+        else
+          Result:='';
+      end;
+    end
+ else
+   begin
+     PS:=@PT^.NameList;
+     While Value>0 Do
+       begin
+         PS:=PShortString(pointer(PS)+PByte(PS)^+1);
+         Dec(Value);
+       end;
+     Result:=PS^;
+   end;
 end;
 
 
@@ -369,14 +379,26 @@ begin
   PT:=GetTypeData(TypeInfo);
   Count:=0;
   Result:=-1;
-  PS:=@PT^.NameList;
-  While (Result=-1) and (PByte(PS)^<>0) do
+  
+  if TypeInfo^.Kind=tkBool then 
     begin
-      If ShortCompareText(PS^, sName) = 0 then
-        Result:=Count;
-      PS:=PShortString(pointer(PS)+PByte(PS)^+1);
-      Inc(Count);
-    end;
+    If CompareText(BooleanIdents[false],Name)=0 then
+      result:=0
+    else if CompareText(BooleanIdents[true],Name)=0 then
+      result:=1;
+    end
+ else
+   begin
+  
+     PS:=@PT^.NameList;
+     While (Result=-1) and (PByte(PS)^<>0) do
+       begin
+         If ShortCompareText(PS^, sName) = 0 then
+           Result:=Count;
+         PS:=PShortString(pointer(PS)+PByte(PS)^+1);
+         Inc(Count);
+       end;
+   end;
 end;
 
 
@@ -387,17 +409,22 @@ var
   Count: SizeInt;
 begin
   PT:=GetTypeData(enum1);
-  Count:=0;
-  Result:=0;
-
-  PS:=@PT^.NameList;
-  While (PByte(PS)^<>0) do
+  if enum1^.Kind=tkBool then 
+    Result:=2
+  else
     begin
-      PS:=PShortString(pointer(PS)+PByte(PS)^+1);
-      Inc(Count);
+      Count:=0;
+      Result:=0;
+    
+      PS:=@PT^.NameList;
+      While (PByte(PS)^<>0) do
+        begin
+          PS:=PShortString(pointer(PS)+PByte(PS)^+1);
+          Inc(Count);
+        end;
+    
+      Result := Count;
     end;
-
-  Result := Count;
 end;
 
 

+ 11 - 1
rtl/unix/crt.pp

@@ -1002,11 +1002,12 @@ Begin
         4 : begin {Esc[1}
               case ch of
                '~' : PushExt(71);
+               '5' : State := 8;
                '7' : PushExt(64);
                '8' : PushExt(65);
                '9' : PushExt(66);
               end;
-              if (Ch<>'~') then
+              if not (Ch in ['~', '5']) then
                State:=255;
             end;
         5 : begin {Esc[2}
@@ -1044,9 +1045,18 @@ Begin
                'B' : PushExt(80);
                'C' : PushExt(77);
                'D' : PushExt(75);
+               'P' : PushExt(59);
+               'Q' : PushExt(60); 
+               'R' : PushExt(61);
+               'S' : PushExt(62);
               end;
           end;
 {$endif}
+        8 : begin {Esc[15}
+            case ch of
+              '~' : PushExt(63);
+            end;
+          end;
       255 : ;
         end;
         if State<>0 then

+ 53 - 8
rtl/unix/dl.pp

@@ -1,11 +1,25 @@
+{
+    This file is part of the Free Pascal run time library.
+    Copyright (c) 1999-2008 by the Free Pascal development team
+
+    This file implements dyn. lib calls calls for Unix
+
+    See the file COPYING.FPC, included in this distribution,
+    for details about the copyright.
+
+    This program is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+
+ **********************************************************************}
 unit dl;
 
 interface
 
 const
- {$ifdef BSD}   // dlopen is in libc on FreeBSD.
+{$ifdef BSD}   // dlopen is in libc on FreeBSD.
   LibDL = 'c';
- {$else}
+{$else}
   LibDL = 'dl';
 {$endif}
 
@@ -19,18 +33,17 @@ const
   RTLD_BINDING_MASK = $003;
   RTLD_GLOBAL       = $100;
   RTLD_NEXT         = pointer(-1);
-  {$ifdef LINUX}
+{$ifdef LINUX}
   RTLD_DEFAULT      = nil;
-  {$endif}
-  {$ifdef BSD}
+{$endif}
+{$ifdef BSD}
   RTLD_DEFAULT      = pointer(-2);
   RTLD_MODEMASK     = RTLD_BINDING_MASK;
-  {$endif}
+{$endif}
 
 type
   Pdl_info = ^dl_info;
-  dl_info =
-  record
+  dl_info = record
     dli_fname      : Pchar;
     dli_fbase      : pointer;
     dli_sname      : Pchar;
@@ -48,4 +61,36 @@ function dladdr(Lib: pointer; info: Pdl_info): Longint; cdecl; external;
 
 implementation
 
+  function PosLastSlash(const s : string) : longint;
+    var
+      i : longint;
+    begin 
+      PosLastSlash:=0;
+      for i:=1 to length(s) do
+        if s[i]='/' then
+          PosLastSlash:=i;
+    end;
+    
+    
+  function SimpleExtractFilename(const s : string) : string;
+    begin
+      SimpleExtractFilename:=Copy(s,PosLastSlash(s)+1,Length(s)-PosLastSlash(s));
+    end;
+      
+
+  procedure UnixGetModuleByAddr(addr: pointer; var baseaddr: pointer; var filename: openstring);
+    var
+      dlinfo: dl_info;
+    begin
+      baseaddr:=nil;
+      FillChar(dlinfo, sizeof(dlinfo), 0);
+      dladdr(addr, @dlinfo);
+      baseaddr:=dlinfo.dli_fbase;
+      filename:=String(dlinfo.dli_fname);
+      if SimpleExtractFilename(filename)=SimpleExtractFilename(ParamStr(0)) then
+        baseaddr:=nil;
+    end;
+
+begin
+  UnixGetModuleByAddrHook:=@UnixGetModuleByAddr;
 end.

+ 7 - 0
rtl/unix/sysunixh.inc

@@ -62,3 +62,10 @@ var argc:longint;external name 'operatingsystem_parameter_argc';
 {$endif}
 {$endif}
 
+{$ifdef unix}
+const
+  { hook for lineinfo, to get the module name from an address,
+    unit dl sets it if it is used
+  }
+  UnixGetModuleByAddrHook : procedure (addr: pointer; var baseaddr: pointer; var filename: string) = nil;
+{$endif unix}

+ 19 - 9
rtl/win/crt.pp

@@ -645,19 +645,29 @@ var
   WinAttr : word;
   i: integer;
 begin
-  WritePos.X := currX - 1;
-  WritePos.Y := currY - 1;
-
-  WriteConsoleOutputCharacter(GetStdhandle(STD_OUTPUT_HANDLE), @s[1], Length(s), writePos, numWritten);
+  WritePos.X:=currX-2;
+  WritePos.Y:=currY-1;
 
   WinAttr:=TextAttr;
-  dec(WritePos.X);
-  for i:=0 to Length(s)-1 do
+  for i:=1 to Length(s) do
     begin
-      inc(WritePos.X);
+      Inc(WritePos.X);
+      WriteConsoleOutputCharacter(GetStdhandle(STD_OUTPUT_HANDLE), @s[i], 1, writePos, numWritten);
       WriteConsoleOutputAttribute(GetStdhandle(STD_OUTPUT_HANDLE),@WinAttr, 1, writePos, numWritten);
+      Inc(CurrX);
+      if CurrX>WindMaxX then
+        begin
+          CurrX:=WindMinX;
+          Inc(CurrY);
+          While CurrY>WindMaxY do
+            begin
+              RemoveLine(1);
+              Dec(CurrY);
+            end;
+          WritePos.X:=currX-2;
+          WritePos.Y:=currY-1;
+        end;
     end;
-  Inc(CurrX,Length(s));
 end;
 
 
@@ -678,7 +688,7 @@ begin
         if s<>'' then
           begin
             WriteStr(s);
- 	          s:='';
+ 	    s:='';
           end;
         WriteChar(f.buffer[i]);
       end

+ 19 - 41
rtl/win32/system.pp

@@ -145,24 +145,15 @@ function SysReAllocStringLen(var bstr:pointer;psz: pointer;
                               Parameter Handling
 *****************************************************************************}
 
-var
-  ModuleName : array[0..255] of char;
-
-function GetCommandFile:pchar;
-begin
-  GetModuleFileName(0,@ModuleName,255);
-  GetCommandFile:=@ModuleName;
-end;
-
-
 procedure setup_arguments;
 var
   arglen,
   count   : longint;
   argstart,
   pc,arg  : pchar;
-  quote   : char;
+  quote   : Boolean;
   argvlen : longint;
+  buf: array[0..259] of char;  // need MAX_PATH bytes, not 256!
 
   procedure allocarg(idx,len:longint);
     var
@@ -188,13 +179,10 @@ begin
   count:=0;
   argv:=nil;
   argvlen:=0;
-  pc:=getcommandfile;
-  Arglen:=0;
-  repeat
-    Inc(Arglen);
-  until (pc[Arglen]=#0);
-  allocarg(count,arglen);
-  move(pc^,argv[count]^,arglen+1);
+  ArgLen := GetModuleFileName(0, @buf[0], sizeof(buf));
+  buf[ArgLen] := #0; // be safe
+  allocarg(0,arglen);
+  move(buf,argv[0]^,arglen+1);
   { Setup cmdline variable }
   cmdline:=GetCommandLine;
   { process arguments }
@@ -210,7 +198,7 @@ begin
      if pc^=#0 then
       break;
      { calc argument length }
-     quote:=' ';
+     quote:=False;
      argstart:=pc;
      arglen:=0;
      while (pc^<>#0) do
@@ -218,20 +206,15 @@ begin
         case pc^ of
           #1..#32 :
             begin
-              if quote<>' ' then
+              if quote then
                inc(arglen)
               else
                break;
             end;
           '"' :
-            if pchar(pc+1)^<>'"' then
-            begin
-              if quote='"' then
-               quote:=' '
+            if pc[1]<>'"' then
+              quote := not quote
               else
-               quote:='"';
-            end
-            else
               inc(pc);
           else
             inc(arglen);
@@ -243,7 +226,7 @@ begin
      If Count<>0 then
       begin
         allocarg(count,arglen);
-        quote:=' ';
+        quote:=False;
         pc:=argstart;
         arg:=argv[count];
         while (pc^<>#0) do
@@ -251,7 +234,7 @@ begin
            case pc^ of
              #1..#32 :
                begin
-                 if quote<>' ' then
+                 if quote then
                   begin
                     arg^:=pc^;
                     inc(arg);
@@ -260,14 +243,9 @@ begin
                   break;
                end;
              '"' :
-               if pchar(pc+1)^<>'"' then
-                begin
-                  if quote='"' then
-                   quote:=' '
+               if pc[1]<>'"' then
+                 quote := not quote
                   else
-                   quote:='"';
-                end
-               else
                 inc(pc);
              else
                begin
@@ -284,11 +262,11 @@ begin
  {$EndIf SYSTEM_DEBUG_STARTUP}
      inc(count);
    end;
-  { get argc and create an nil entry }
+  { get argc }
   argc:=count;
-  allocarg(argc,0);
-  { free unused memory }
-  sysreallocmem(argv,(argc+1)*sizeof(pointer));
+  { free unused memory, leaving a nil entry at the end }
+  sysreallocmem(argv,(count+1)*sizeof(pointer));
+  argv[count] := nil;
 end;
 
 
@@ -1203,7 +1181,7 @@ begin
   { some misc Win32 stuff }
   hprevinst:=0;
   if not IsLibrary then
-    SysInstance:=getmodulehandle(GetCommandFile);
+    SysInstance:=getmodulehandle(nil);
 
   MainInstance:=HInstance;
 

+ 63 - 59
rtl/win64/Makefile

@@ -1,5 +1,5 @@
 #
-# Don't edit, this file is generated by FPCMake Version 2.0.0 [2008/06/15]
+# Don't edit, this file is generated by FPCMake Version 2.0.0 [2008/11/12]
 #
 default: all
 MAKEFILETARGETS=i386-linux i386-go32v2 i386-win32 i386-os2 i386-freebsd i386-beos i386-haiku i386-netbsd i386-solaris i386-qnx i386-netware i386-openbsd i386-wdosx i386-darwin i386-emx i386-watcom i386-netwlibc i386-wince i386-embedded i386-symbian m68k-linux m68k-freebsd m68k-netbsd m68k-amiga m68k-atari m68k-openbsd m68k-palmos m68k-embedded powerpc-linux powerpc-netbsd powerpc-amiga powerpc-macos powerpc-darwin powerpc-morphos powerpc-embedded sparc-linux sparc-netbsd sparc-solaris sparc-embedded x86_64-linux x86_64-freebsd x86_64-darwin x86_64-win64 x86_64-embedded arm-linux arm-palmos arm-darwin arm-wince arm-gba arm-nds arm-embedded arm-symbian powerpc64-linux powerpc64-darwin powerpc64-embedded avr-embedded armeb-linux armeb-embedded
@@ -116,6 +116,10 @@ FPC:=$(shell $(FPCPROG) -PB)
 endif
 ifneq ($(findstring Error,$(FPC)),)
 override FPC=$(firstword $(strip $(wildcard $(addsuffix /ppc386$(SRCEXEEXT),$(SEARCHPATH)))))
+else
+ifeq ($(strip $(wildcard $(FPC))),)
+FPC:=$(firstword $(FPCPROG))
+endif
 endif
 else
 override FPC=$(firstword $(strip $(wildcard $(addsuffix /ppc386$(SRCEXEEXT),$(SEARCHPATH)))))
@@ -274,178 +278,178 @@ endif
 OBJPASDIR=$(RTL)/objpas
 WINDOWS_SOURCE_FILES=$(addprefix $(WININC)/,$(addsuffix .inc,$(WINDOWS_FILES)))
 ifeq ($(FULL_TARGET),i386-linux)
-override TARGET_UNITS+=system objpas macpas buildrtl
+override TARGET_UNITS+=system objpas macpas buildrtl lineinfo lnfodwrf
 endif
 ifeq ($(FULL_TARGET),i386-go32v2)
-override TARGET_UNITS+=system objpas macpas buildrtl
+override TARGET_UNITS+=system objpas macpas buildrtl lineinfo lnfodwrf
 endif
 ifeq ($(FULL_TARGET),i386-win32)
-override TARGET_UNITS+=system objpas macpas buildrtl
+override TARGET_UNITS+=system objpas macpas buildrtl lineinfo lnfodwrf
 endif
 ifeq ($(FULL_TARGET),i386-os2)
-override TARGET_UNITS+=system objpas macpas buildrtl
+override TARGET_UNITS+=system objpas macpas buildrtl lineinfo lnfodwrf
 endif
 ifeq ($(FULL_TARGET),i386-freebsd)
-override TARGET_UNITS+=system objpas macpas buildrtl
+override TARGET_UNITS+=system objpas macpas buildrtl lineinfo lnfodwrf
 endif
 ifeq ($(FULL_TARGET),i386-beos)
-override TARGET_UNITS+=system objpas macpas buildrtl
+override TARGET_UNITS+=system objpas macpas buildrtl lineinfo lnfodwrf
 endif
 ifeq ($(FULL_TARGET),i386-haiku)
-override TARGET_UNITS+=system objpas macpas buildrtl
+override TARGET_UNITS+=system objpas macpas buildrtl lineinfo lnfodwrf
 endif
 ifeq ($(FULL_TARGET),i386-netbsd)
-override TARGET_UNITS+=system objpas macpas buildrtl
+override TARGET_UNITS+=system objpas macpas buildrtl lineinfo lnfodwrf
 endif
 ifeq ($(FULL_TARGET),i386-solaris)
-override TARGET_UNITS+=system objpas macpas buildrtl
+override TARGET_UNITS+=system objpas macpas buildrtl lineinfo lnfodwrf
 endif
 ifeq ($(FULL_TARGET),i386-qnx)
-override TARGET_UNITS+=system objpas macpas buildrtl
+override TARGET_UNITS+=system objpas macpas buildrtl lineinfo lnfodwrf
 endif
 ifeq ($(FULL_TARGET),i386-netware)
-override TARGET_UNITS+=system objpas macpas buildrtl
+override TARGET_UNITS+=system objpas macpas buildrtl lineinfo lnfodwrf
 endif
 ifeq ($(FULL_TARGET),i386-openbsd)
-override TARGET_UNITS+=system objpas macpas buildrtl
+override TARGET_UNITS+=system objpas macpas buildrtl lineinfo lnfodwrf
 endif
 ifeq ($(FULL_TARGET),i386-wdosx)
-override TARGET_UNITS+=system objpas macpas buildrtl
+override TARGET_UNITS+=system objpas macpas buildrtl lineinfo lnfodwrf
 endif
 ifeq ($(FULL_TARGET),i386-darwin)
-override TARGET_UNITS+=system objpas macpas buildrtl
+override TARGET_UNITS+=system objpas macpas buildrtl lineinfo lnfodwrf
 endif
 ifeq ($(FULL_TARGET),i386-emx)
-override TARGET_UNITS+=system objpas macpas buildrtl
+override TARGET_UNITS+=system objpas macpas buildrtl lineinfo lnfodwrf
 endif
 ifeq ($(FULL_TARGET),i386-watcom)
-override TARGET_UNITS+=system objpas macpas buildrtl
+override TARGET_UNITS+=system objpas macpas buildrtl lineinfo lnfodwrf
 endif
 ifeq ($(FULL_TARGET),i386-netwlibc)
-override TARGET_UNITS+=system objpas macpas buildrtl
+override TARGET_UNITS+=system objpas macpas buildrtl lineinfo lnfodwrf
 endif
 ifeq ($(FULL_TARGET),i386-wince)
-override TARGET_UNITS+=system objpas macpas buildrtl
+override TARGET_UNITS+=system objpas macpas buildrtl lineinfo lnfodwrf
 endif
 ifeq ($(FULL_TARGET),i386-embedded)
-override TARGET_UNITS+=system objpas macpas buildrtl
+override TARGET_UNITS+=system objpas macpas buildrtl lineinfo lnfodwrf
 endif
 ifeq ($(FULL_TARGET),i386-symbian)
-override TARGET_UNITS+=system objpas macpas buildrtl
+override TARGET_UNITS+=system objpas macpas buildrtl lineinfo lnfodwrf
 endif
 ifeq ($(FULL_TARGET),m68k-linux)
-override TARGET_UNITS+=system objpas macpas buildrtl
+override TARGET_UNITS+=system objpas macpas buildrtl lineinfo lnfodwrf
 endif
 ifeq ($(FULL_TARGET),m68k-freebsd)
-override TARGET_UNITS+=system objpas macpas buildrtl
+override TARGET_UNITS+=system objpas macpas buildrtl lineinfo lnfodwrf
 endif
 ifeq ($(FULL_TARGET),m68k-netbsd)
-override TARGET_UNITS+=system objpas macpas buildrtl
+override TARGET_UNITS+=system objpas macpas buildrtl lineinfo lnfodwrf
 endif
 ifeq ($(FULL_TARGET),m68k-amiga)
-override TARGET_UNITS+=system objpas macpas buildrtl
+override TARGET_UNITS+=system objpas macpas buildrtl lineinfo lnfodwrf
 endif
 ifeq ($(FULL_TARGET),m68k-atari)
-override TARGET_UNITS+=system objpas macpas buildrtl
+override TARGET_UNITS+=system objpas macpas buildrtl lineinfo lnfodwrf
 endif
 ifeq ($(FULL_TARGET),m68k-openbsd)
-override TARGET_UNITS+=system objpas macpas buildrtl
+override TARGET_UNITS+=system objpas macpas buildrtl lineinfo lnfodwrf
 endif
 ifeq ($(FULL_TARGET),m68k-palmos)
-override TARGET_UNITS+=system objpas macpas buildrtl
+override TARGET_UNITS+=system objpas macpas buildrtl lineinfo lnfodwrf
 endif
 ifeq ($(FULL_TARGET),m68k-embedded)
-override TARGET_UNITS+=system objpas macpas buildrtl
+override TARGET_UNITS+=system objpas macpas buildrtl lineinfo lnfodwrf
 endif
 ifeq ($(FULL_TARGET),powerpc-linux)
-override TARGET_UNITS+=system objpas macpas buildrtl
+override TARGET_UNITS+=system objpas macpas buildrtl lineinfo lnfodwrf
 endif
 ifeq ($(FULL_TARGET),powerpc-netbsd)
-override TARGET_UNITS+=system objpas macpas buildrtl
+override TARGET_UNITS+=system objpas macpas buildrtl lineinfo lnfodwrf
 endif
 ifeq ($(FULL_TARGET),powerpc-amiga)
-override TARGET_UNITS+=system objpas macpas buildrtl
+override TARGET_UNITS+=system objpas macpas buildrtl lineinfo lnfodwrf
 endif
 ifeq ($(FULL_TARGET),powerpc-macos)
-override TARGET_UNITS+=system objpas macpas buildrtl
+override TARGET_UNITS+=system objpas macpas buildrtl lineinfo lnfodwrf
 endif
 ifeq ($(FULL_TARGET),powerpc-darwin)
-override TARGET_UNITS+=system objpas macpas buildrtl
+override TARGET_UNITS+=system objpas macpas buildrtl lineinfo lnfodwrf
 endif
 ifeq ($(FULL_TARGET),powerpc-morphos)
-override TARGET_UNITS+=system objpas macpas buildrtl
+override TARGET_UNITS+=system objpas macpas buildrtl lineinfo lnfodwrf
 endif
 ifeq ($(FULL_TARGET),powerpc-embedded)
-override TARGET_UNITS+=system objpas macpas buildrtl
+override TARGET_UNITS+=system objpas macpas buildrtl lineinfo lnfodwrf
 endif
 ifeq ($(FULL_TARGET),sparc-linux)
-override TARGET_UNITS+=system objpas macpas buildrtl
+override TARGET_UNITS+=system objpas macpas buildrtl lineinfo lnfodwrf
 endif
 ifeq ($(FULL_TARGET),sparc-netbsd)
-override TARGET_UNITS+=system objpas macpas buildrtl
+override TARGET_UNITS+=system objpas macpas buildrtl lineinfo lnfodwrf
 endif
 ifeq ($(FULL_TARGET),sparc-solaris)
-override TARGET_UNITS+=system objpas macpas buildrtl
+override TARGET_UNITS+=system objpas macpas buildrtl lineinfo lnfodwrf
 endif
 ifeq ($(FULL_TARGET),sparc-embedded)
-override TARGET_UNITS+=system objpas macpas buildrtl
+override TARGET_UNITS+=system objpas macpas buildrtl lineinfo lnfodwrf
 endif
 ifeq ($(FULL_TARGET),x86_64-linux)
-override TARGET_UNITS+=system objpas macpas buildrtl
+override TARGET_UNITS+=system objpas macpas buildrtl lineinfo lnfodwrf
 endif
 ifeq ($(FULL_TARGET),x86_64-freebsd)
-override TARGET_UNITS+=system objpas macpas buildrtl
+override TARGET_UNITS+=system objpas macpas buildrtl lineinfo lnfodwrf
 endif
 ifeq ($(FULL_TARGET),x86_64-darwin)
-override TARGET_UNITS+=system objpas macpas buildrtl
+override TARGET_UNITS+=system objpas macpas buildrtl lineinfo lnfodwrf
 endif
 ifeq ($(FULL_TARGET),x86_64-win64)
-override TARGET_UNITS+=system objpas macpas buildrtl
+override TARGET_UNITS+=system objpas macpas buildrtl lineinfo lnfodwrf
 endif
 ifeq ($(FULL_TARGET),x86_64-embedded)
-override TARGET_UNITS+=system objpas macpas buildrtl
+override TARGET_UNITS+=system objpas macpas buildrtl lineinfo lnfodwrf
 endif
 ifeq ($(FULL_TARGET),arm-linux)
-override TARGET_UNITS+=system objpas macpas buildrtl
+override TARGET_UNITS+=system objpas macpas buildrtl lineinfo lnfodwrf
 endif
 ifeq ($(FULL_TARGET),arm-palmos)
-override TARGET_UNITS+=system objpas macpas buildrtl
+override TARGET_UNITS+=system objpas macpas buildrtl lineinfo lnfodwrf
 endif
 ifeq ($(FULL_TARGET),arm-darwin)
-override TARGET_UNITS+=system objpas macpas buildrtl
+override TARGET_UNITS+=system objpas macpas buildrtl lineinfo lnfodwrf
 endif
 ifeq ($(FULL_TARGET),arm-wince)
-override TARGET_UNITS+=system objpas macpas buildrtl
+override TARGET_UNITS+=system objpas macpas buildrtl lineinfo lnfodwrf
 endif
 ifeq ($(FULL_TARGET),arm-gba)
-override TARGET_UNITS+=system objpas macpas buildrtl
+override TARGET_UNITS+=system objpas macpas buildrtl lineinfo lnfodwrf
 endif
 ifeq ($(FULL_TARGET),arm-nds)
-override TARGET_UNITS+=system objpas macpas buildrtl
+override TARGET_UNITS+=system objpas macpas buildrtl lineinfo lnfodwrf
 endif
 ifeq ($(FULL_TARGET),arm-embedded)
-override TARGET_UNITS+=system objpas macpas buildrtl
+override TARGET_UNITS+=system objpas macpas buildrtl lineinfo lnfodwrf
 endif
 ifeq ($(FULL_TARGET),arm-symbian)
-override TARGET_UNITS+=system objpas macpas buildrtl
+override TARGET_UNITS+=system objpas macpas buildrtl lineinfo lnfodwrf
 endif
 ifeq ($(FULL_TARGET),powerpc64-linux)
-override TARGET_UNITS+=system objpas macpas buildrtl
+override TARGET_UNITS+=system objpas macpas buildrtl lineinfo lnfodwrf
 endif
 ifeq ($(FULL_TARGET),powerpc64-darwin)
-override TARGET_UNITS+=system objpas macpas buildrtl
+override TARGET_UNITS+=system objpas macpas buildrtl lineinfo lnfodwrf
 endif
 ifeq ($(FULL_TARGET),powerpc64-embedded)
-override TARGET_UNITS+=system objpas macpas buildrtl
+override TARGET_UNITS+=system objpas macpas buildrtl lineinfo lnfodwrf
 endif
 ifeq ($(FULL_TARGET),avr-embedded)
-override TARGET_UNITS+=system objpas macpas buildrtl
+override TARGET_UNITS+=system objpas macpas buildrtl lineinfo lnfodwrf
 endif
 ifeq ($(FULL_TARGET),armeb-linux)
-override TARGET_UNITS+=system objpas macpas buildrtl
+override TARGET_UNITS+=system objpas macpas buildrtl lineinfo lnfodwrf
 endif
 ifeq ($(FULL_TARGET),armeb-embedded)
-override TARGET_UNITS+=system objpas macpas buildrtl
+override TARGET_UNITS+=system objpas macpas buildrtl lineinfo lnfodwrf
 endif
 ifeq ($(FULL_TARGET),i386-linux)
 override TARGET_IMPLICITUNITS+=ctypes strings lineinfo lnfodwrf heaptrc matrix dos crt objects messages windows winsock winsock2 cmem dynlibs rtlconsts sysconst sysutils math types strutils convutils dateutils varutils variants typinfo fgl classes getopts stdconvs sockets printer charset ucomplex fmtbcd winevent video mouse keyboard sharemem exeinfo

+ 1 - 1
rtl/win64/Makefile.fpc

@@ -7,7 +7,7 @@ main=rtl
 
 [target]
 loaders=$(LOADERS)
-units=system objpas macpas buildrtl
+units=system objpas macpas buildrtl lineinfo lnfodwrf
 implicitunits=ctypes strings \
       lineinfo lnfodwrf heaptrc matrix \
       dos crt objects messages \

+ 6 - 2
rtl/wince/Makefile

@@ -1,5 +1,5 @@
 #
-# Don't edit, this file is generated by FPCMake Version 2.0.0 [2008/06/15]
+# Don't edit, this file is generated by FPCMake Version 2.0.0 [2008/11/12]
 #
 default: all
 MAKEFILETARGETS=i386-linux i386-go32v2 i386-win32 i386-os2 i386-freebsd i386-beos i386-haiku i386-netbsd i386-solaris i386-qnx i386-netware i386-openbsd i386-wdosx i386-darwin i386-emx i386-watcom i386-netwlibc i386-wince i386-embedded i386-symbian m68k-linux m68k-freebsd m68k-netbsd m68k-amiga m68k-atari m68k-openbsd m68k-palmos m68k-embedded powerpc-linux powerpc-netbsd powerpc-amiga powerpc-macos powerpc-darwin powerpc-morphos powerpc-embedded sparc-linux sparc-netbsd sparc-solaris sparc-embedded x86_64-linux x86_64-freebsd x86_64-darwin x86_64-win64 x86_64-embedded arm-linux arm-palmos arm-darwin arm-wince arm-gba arm-nds arm-embedded arm-symbian powerpc64-linux powerpc64-darwin powerpc64-embedded avr-embedded armeb-linux armeb-embedded
@@ -116,6 +116,10 @@ FPC:=$(shell $(FPCPROG) -PB)
 endif
 ifneq ($(findstring Error,$(FPC)),)
 override FPC=$(firstword $(strip $(wildcard $(addsuffix /ppc386$(SRCEXEEXT),$(SEARCHPATH)))))
+else
+ifeq ($(strip $(wildcard $(FPC))),)
+FPC:=$(firstword $(FPCPROG))
+endif
 endif
 else
 override FPC=$(firstword $(strip $(wildcard $(addsuffix /ppc386$(SRCEXEEXT),$(SEARCHPATH)))))
@@ -2294,7 +2298,7 @@ macpas$(PPUEXT) : $(INC)/macpas.pp $(SYSTEMUNIT)$(PPUEXT)
 getopts$(PPUEXT) : $(INC)/getopts.pp $(SYSTEMUNIT)$(PPUEXT)
 heaptrc$(PPUEXT) : $(INC)/heaptrc.pp $(SYSTEMUNIT)$(PPUEXT)
 	$(COMPILER) -Sg $(INC)/heaptrc.pp
-lineinfo$(PPUEXT) : $(INC)/lineinfo.pp $(SYSTEMUNIT)$(PPUEXT)
+lineinfo$(PPUEXT) : $(INC)/lineinfo.pp windows$(PPUEXT) $(SYSTEMUNIT)$(PPUEXT)
 lnfodwrf$(PPUEXT) : $(INC)/lnfodwrf.pp $(SYSTEMUNIT)$(PPUEXT)
 charset$(PPUEXT) : $(INC)/charset.pp $(SYSTEMUNIT)$(PPUEXT)
 cmem$(PPUEXT) : $(INC)/cmem.pp $(SYSTEMUNIT)$(PPUEXT)

+ 2 - 2
rtl/wince/Makefile.fpc

@@ -186,7 +186,7 @@ varutils$(PPUEXT) : $(OBJPASDIR)/cvarutil.inc $(OBJPASDIR)/varutils.inc \
 
 variants$(PPUEXT) : $(INC)/variants.pp varutils$(PPUEXT) sysutils$(PPUEXT) sysconst$(PPUEXT) typinfo$(PPUEXT) rtlconsts$(PPUEXT)
         $(COMPILER) -Fi$(INC) $(INC)/variants.pp
-        
+
 fmtbcd$(PPUEXT) : $(OBJPASDIR)/fmtbcd.pp objpas$(PPUEXT) sysutils$(PPUEXT) variants$(PPUEXT) classes$(PPUEXT) system$(PPUEXT)
         $(COMPILER) $(OBJPASDIR)/fmtbcd.pp
 
@@ -224,7 +224,7 @@ getopts$(PPUEXT) : $(INC)/getopts.pp $(SYSTEMUNIT)$(PPUEXT)
 heaptrc$(PPUEXT) : $(INC)/heaptrc.pp $(SYSTEMUNIT)$(PPUEXT)
         $(COMPILER) -Sg $(INC)/heaptrc.pp
 
-lineinfo$(PPUEXT) : $(INC)/lineinfo.pp $(SYSTEMUNIT)$(PPUEXT)
+lineinfo$(PPUEXT) : $(INC)/lineinfo.pp windows$(PPUEXT) $(SYSTEMUNIT)$(PPUEXT)
 
 lnfodwrf$(PPUEXT) : $(INC)/lnfodwrf.pp $(SYSTEMUNIT)$(PPUEXT)
 

+ 46 - 0
tests/webtbs/tw11372.pp

@@ -0,0 +1,46 @@
+program BoolAsEnumTest_FPC;
+
+{$MODE Delphi}
+
+{$APPTYPE CONSOLE}
+
+uses
+  SysUtils,
+  TypInfo;
+
+procedure Test_GetEnumName;
+begin
+  writeln('Testing GetEnumName');
+  if TypInfo.GetEnumName(TypeInfo(Boolean),Ord(False))<>'False' then
+    halt(1);
+  if TypInfo.GetEnumName(TypeInfo(Boolean),Ord(True))<>'True' then
+    halt(1);
+end;
+
+
+procedure Test_GetEnumValue;
+begin
+  writeln('Testing GetEnumValue');
+  if TypInfo.GetEnumValue(TypeInfo(Boolean),'false')<>0 then
+    halt(1);
+  if TypInfo.GetEnumValue(TypeInfo(Boolean),'true')<>1 then
+    halt(1);
+end;
+
+
+procedure Test_GetEnumCount;
+begin
+  writeln('Testing GetEnumCount');
+  if TypInfo.GetEnumNameCount(TypeInfo(Boolean))<>Ord(High(Boolean))+1 then
+    halt(1);    
+end;
+
+
+
+
+begin
+  Test_GetEnumCount;
+  Test_GetEnumValue;
+  Test_GetEnumName;
+  writeln('Ok');
+end.