Przeglądaj źródła

Merged revisions 1704,1711-1712,1714,1719-1721,1725-1726,1729-1730 via svnmerge from
http://[email protected]/svn/fpc/trunk

........
r1704 | vincents | 2005-11-09 14:26:22 +0100 (Wed, 09 Nov 2005) | 1 line

removed seek64bit define
........
r1711 | tom_at_work | 2005-11-10 16:01:00 +0100 (Thu, 10 Nov 2005) | 2 lines

* signal handler update, uses uc_mcontext instead of sigcontext_struct in later Linux versions
* syscalls update
........
r1712 | tom_at_work | 2005-11-10 16:04:28 +0100 (Thu, 10 Nov 2005) | 1 line

* new constants for si_code field for FPU signals (required by commit 1710)
........
r1714 | tom_at_work | 2005-11-10 16:11:06 +0100 (Thu, 10 Nov 2005) | 1 line

* removed "+0" offset generation in assembler writer
........
r1719 | michael | 2005-11-10 21:40:11 +0100 (Thu, 10 Nov 2005) | 1 line

+ Patch from Michalis Kamburelis to implement correct config dir, following basedir-spec
........
r1720 | marco | 2005-11-11 10:30:08 +0100 (Fri, 11 Nov 2005) | 2 lines

* should now also ignore comment starting with ; (bug 45something)

........
r1721 | michael | 2005-11-11 12:24:30 +0100 (Fri, 11 Nov 2005) | 1 line

+ Added TFPHashTable object, implemented by Dean Zobec
........
r1725 | florian | 2005-11-12 12:01:27 +0100 (Sat, 12 Nov 2005) | 2 lines

+ writeidx program added

........
r1726 | florian | 2005-11-12 12:14:50 +0100 (Sat, 12 Nov 2005) | 2 lines

* reset some variables which could be in an illegal state after an error, this is mainly important for the ide

........
r1729 | marco | 2005-11-13 15:56:35 +0100 (Sun, 13 Nov 2005) | 2 lines

* patch with a _lot_ more constants from JP Mugaas (for Indy)

........
r1730 | marco | 2005-11-13 16:25:26 +0100 (Sun, 13 Nov 2005) | 2 lines

* couple of redefs for bug #4509

........

git-svn-id: branches/fixes_2_0@1747 -

peter 20 lat temu
rodzic
commit
9938d1d803

+ 2 - 0
.gitattributes

@@ -1096,9 +1096,11 @@ installer/Makefile.fpc svneol=native#text/plain
 installer/install.dat -text
 installer/install.def -text
 installer/install.pas svneol=native#text/plain
+installer/insthelp.pas svneol=native#text/plain
 installer/makelink.pas svneol=native#text/plain
 installer/scroll.pas svneol=native#text/plain
 installer/winshell.pas svneol=native#text/plain
+installer/writeidx.pas svneol=native#text/plain
 packages/Makefile svneol=native#text/plain
 packages/Makefile.fpc svneol=native#text/plain
 packages/base/Makefile svneol=native#text/plain

+ 7 - 0
compiler/parser.pas

@@ -445,6 +445,13 @@ implementation
             dbx_counter:=nil;
 {$endif GDB}
           end;
+       { reset parser, a previous fatal error could have left these variables in an unreliable state, this is
+         important for the IDE }
+         afterassignment:=false;
+         in_args:=false;
+         got_addrn:=false;
+         getprocvardef:=nil;
+
        { show info }
          Message1(parser_i_compiling,filename);
 

+ 1 - 6
compiler/powerpc/agppcgas.pas

@@ -155,12 +155,7 @@ unit agppcgas;
              begin
                 if offset=0 then
                   begin
-                    if assigned(symbol) then
-                      begin
-                        if target_info.system <> system_powerpc_darwin then
-                          s:=s+'+0'
-                      end
-                    else
+                    if not (assigned(symbol)) then
                       s:=s+'0';
                   end;
                 s:=s+'('+gas_regname(base)+')';

+ 432 - 0
fcl/inc/contnrs.pp

@@ -13,6 +13,7 @@
 {$ifdef fpc}
 {$mode objfpc}
 {$endif}
+{$H+}
 unit contnrs;
 
 interface
@@ -20,6 +21,7 @@ interface
 uses
   SysUtils,Classes;
 
+
 Type
 
 {$inline on}
@@ -62,6 +64,7 @@ Type
     property List: TFPList read FList;
   end;
 
+  
   TObjectList = class(TList)
   private
     ffreeobjects : boolean;
@@ -168,9 +171,103 @@ Type
     Function Pop: TObject;
     Function Peek: TObject;
   end;
+  
+{ ---------------------------------------------------------------------
+    Hash support, implemented by Dean Zobec
+  ---------------------------------------------------------------------}
+ 
+
+  { Must return a Longword value in the range 0..TableSize,
+   usually via a mod operator;  }
+  THashFunction = function(const S: string; const TableSize: Longword): Longword;
+  
+  TIteratorMethod = procedure(Item: Pointer; const Key: string;
+     var Continue: Boolean) of object;
+
+  { THTNode }
+
+  THTNode = class(TObject)
+  private
+    FData: pointer;
+    FKey: string;
+  public
+    constructor CreateWith(const AString: String);
+    function HasKey(const AKey: string): boolean;
+    property Key: string read FKey;
+    property Data: pointer read FData write FData;
+  end;
+
+  { TFPHashTable }
+
+  TFPHashTable = class(TObject)
+  private
+    FHashTable: TFPObjectList;
+    FHashTableSize: Longword;
+    FHashFunction: THashFunction;
+    FCount: Int64;
+    function GetDensity: Longword;
+    function GetNumberOfCollisions: Int64;
+    procedure SetHashTableSize(const Value: Longword);
+    procedure InitializeHashTable;
+    function GetVoidSlots: Longword;
+    function GetLoadFactor: double;
+    function GetAVGChainLen: double;
+    function GetMaxChainLength: Longword;
+    function Chain(const index: Longword):TFPObjectList;
+  protected
+    function ChainLength(const ChainIndex: Longword): Longword; virtual;
+    procedure SetData(const index: string; const AValue: Pointer); virtual;
+    function GetData(const index: string):Pointer; virtual;
+    function FindOrCreateNew(const aKey: string): THTNode; virtual;
+    function ForEachCall(aMethod: TIteratorMethod): THTNode; virtual;
+    procedure SetHashFunction(AHashFunction: THashFunction); virtual;
+  public
+    constructor Create;
+    constructor CreateWith(AHashTableSize: Longword; aHashFunc: THashFunction);
+    destructor Destroy; override;
+    procedure ChangeTableSize(const ANewSize: Longword); virtual;
+    procedure Clear; virtual;
+    procedure Add(const aKey: string; AItem: pointer); virtual;
+    procedure Delete(const aKey: string); virtual;
+    function Find(const aKey: string): THTNode;
+    function IsEmpty: boolean;
+    property HashFunction: THashFunction read FHashFunction write SetHashFunction;
+    property Count: Int64 read FCount;
+    property HashTableSize: Longword read FHashTableSize write SetHashTableSize;
+    property Items[const index: string]: Pointer read GetData write SetData; default;
+    property HashTable: TFPObjectList read FHashTable;
+    property VoidSlots: Longword read GetVoidSlots;
+    property LoadFactor: double read GetLoadFactor;
+    property AVGChainLen: double read GetAVGChainLen;
+    property MaxChainLength: Int64 read GetMaxChainLength;
+    property NumberOfCollisions: Int64 read GetNumberOfCollisions;
+    property Density: Longword read GetDensity;
+  end;
+
+  EDuplicate = class(Exception);
+  EKeyNotFound = class(Exception);
+
+
+  function RSHash(const S: string; const TableSize: Longword): Longword;
 
 implementation
 
+ResourceString
+  DuplicateMsg = 'An item with key %0:s already exists';
+  KeyNotFoundMsg = 'Method: %0:s key [''%1:s''] not found in container';
+  NotEmptyMsg = 'Hash table not empty.';
+  
+const
+  NPRIMES = 28;
+
+  PRIMELIST: array[0 .. NPRIMES-1] of Longword =
+  ( 53,         97,         193,       389,       769,
+    1543,       3079,       6151,      12289,     24593,
+    49157,      98317,      196613,    393241,    786433,
+    1572869,    3145739,    6291469,   12582917,  25165843,
+    50331653,   100663319,  201326611, 402653189, 805306457,
+    1610612741, 3221225473, 4294967291 );
+
 constructor TFPObjectList.Create(FreeObjects : boolean);
 begin
   Create;
@@ -709,4 +806,339 @@ begin
   Result:=TObject(Inherited Push(Pointer(Aobject)));
 end;
 
+{ ---------------------------------------------------------------------
+    Hash support, by Dean Zobec
+  ---------------------------------------------------------------------}
+
+{ Default hash function }
+
+function RSHash(const S: string; const TableSize: Longword): Longword;
+const
+  b = 378551;
+var
+  a: Longword;
+  i: Longword;
+begin
+ a := 63689;
+ Result := 0;
+ for i := 1 to Length(S) do
+ begin
+   Result := Result * a + Ord(S[i]);
+   a := a * b;
+ end;
+ Result := (Result and $7FFFFFFF) mod TableSize;
+end;
+  
+{ THTNode }
+
+constructor THTNode.CreateWith(const AString: string);
+begin
+  inherited Create;
+  FKey := AString;
+end;
+
+function THTNode.HasKey(const AKey: string): boolean;
+begin
+  if Length(AKey) <> Length(FKey) then
+  begin
+    Result := false;
+    exit;
+  end
+  else
+    Result := CompareMem(PChar(FKey), PChar(AKey), length(AKey));
+end;
+
+{ TFPHashTable }
+
+constructor TFPHashTable.Create;
+begin
+  Inherited Create;
+  FHashTable := TFPObjectList.Create(True);
+  HashTableSize := 196613;
+  FHashFunction := @RSHash;
+end;
+
+constructor TFPHashTable.CreateWith(AHashTableSize: Longword;
+  aHashFunc: THashFunction);
+begin
+  Inherited Create;
+  FHashTable := TFPObjectList.Create(True);
+  HashTableSize := AHashTableSize;
+  FHashFunction := aHashFunc;
+end;
+
+destructor TFPHashTable.Destroy;
+begin
+  FHashTable.Free;
+  inherited Destroy;
+end;
+
+function TFPHashTable.GetDensity: Longword;
+begin
+  Result := FHashTableSize - VoidSlots
+end;
+
+function TFPHashTable.GetNumberOfCollisions: Int64;
+begin
+  Result := FCount -(FHashTableSize - VoidSlots)
+end;
+
+procedure TFPHashTable.SetData(const index: string; const AValue: Pointer);
+begin
+  FindOrCreateNew(index).Data := AValue;
+end;
+
+procedure TFPHashTable.SetHashTableSize(const Value: Longword);
+var
+  i: Longword;
+  newSize: Longword;
+begin
+  if Value <> FHashTableSize then
+  begin
+    i := 0;
+    while (PRIMELIST[i] < Value) and (i < 27) do
+     inc(i);
+    newSize := PRIMELIST[i];
+    if Count = 0 then
+    begin
+      FHashTableSize := newSize;
+      InitializeHashTable;
+    end
+    else
+      ChangeTableSize(newSize);
+  end;
+end;
+
+procedure TFPHashTable.InitializeHashTable;
+var
+  i: LongWord;
+begin
+  for i := 0 to FHashTableSize-1 do
+    FHashTable.Add(nil);
+  FCount := 0;
+end;
+
+procedure TFPHashTable.ChangeTableSize(const ANewSize: Longword);
+var
+  SavedTable: TFPObjectList;
+  SavedTableSize: Longword;
+  i, j: Longword;
+  temp: THTNode;
+begin
+  SavedTable := FHashTable;
+  SavedTableSize := FHashTableSize;
+  FHashTableSize := ANewSize;
+  FHashTable := TFPObjectList.Create(True);
+  InitializeHashTable;
+  for i := 0 to SavedTableSize-1 do
+  begin
+    if Assigned(SavedTable[i]) then
+    for j := 0 to TFPObjectList(SavedTable[i]).Count -1 do
+    begin
+      temp := THTNode(TFPObjectList(SavedTable[i])[j]);
+      Add(temp.Key, temp.Data);
+    end;
+  end;
+  SavedTable.Free;
+end;
+
+procedure TFPHashTable.SetHashFunction(AHashFunction: THashFunction);
+begin
+  if IsEmpty then
+    FHashFunction := AHashFunction
+  else
+    raise Exception.Create(NotEmptyMsg);
+end;
+
+function TFPHashTable.Find(const aKey: string): THTNode;
+var
+  hashCode: Longword;
+  chn: TFPObjectList;
+  i: Longword;
+begin
+  hashCode := FHashFunction(aKey, FHashTableSize);
+  chn := Chain(hashCode);
+  if Assigned(chn) then
+  begin
+    for i := 0 to chn.Count - 1 do
+    if THTNode(chn[i]).HasKey(aKey) then
+    begin
+      result := THTNode(chn[i]);
+      exit;
+    end;
+  end;
+  Result := nil;
+end;
+
+function TFPHashTable.GetData(const Index: string): Pointer;
+var
+  node: THTNode;
+begin
+  node := Find(Index);
+  if Assigned(node) then
+    Result := node.Data
+  else
+    Result := nil;
+end;
+
+function TFPHashTable.FindOrCreateNew(const aKey: string): THTNode;
+var
+  hashCode: Longword;
+  chn: TFPObjectList;
+  i: Longword;
+begin
+  hashCode := FHashFunction(aKey, FHashTableSize);
+  chn := Chain(hashCode);
+  if Assigned(chn)  then
+  begin
+    for i := 0 to chn.Count - 1 do
+    if THTNode(chn[i]).HasKey(aKey) then
+    begin
+      Result := THTNode(chn[i]);
+      exit;
+    end
+  end
+  else
+    begin
+      FHashTable[hashcode] := TFPObjectList.Create(true);
+      chn := Chain(hashcode);
+    end;
+  inc(FCount);
+  Result := THTNode.CreateWith(aKey);
+  chn.Add(Result);
+end;
+
+function TFPHashTable.ChainLength(const ChainIndex: Longword): Longword;
+begin
+  if Assigned(Chain(ChainIndex)) then
+    Result := Chain(ChainIndex).Count
+  else
+    Result := 0;
+end;
+
+procedure TFPHashTable.Clear;
+var
+  i: Longword;
+begin
+  for i := 0 to FHashTableSize - 1 do
+  begin
+    if Assigned(Chain(i)) then
+      Chain(i).Clear;
+  end;
+  FCount := 0;
+end;
+
+function TFPHashTable.ForEachCall(aMethod: TIteratorMethod): THTNode;
+var
+  i, j: Longword;
+  continue: boolean;
+begin
+  Result := nil;
+  continue := true;
+  for i := 0 to FHashTableSize-1 do
+  begin
+    if assigned(Chain(i)) then
+    begin
+      for j := 0 to Chain(i).Count-1 do
+      begin
+        aMethod(THTNode(Chain(i)[j]).Data, THTNode(Chain(i)[j]).Key, continue);
+        if not continue then
+        begin
+          Result := THTNode(Chain(i)[j]);
+          Exit;
+        end;
+      end;
+    end;
+  end;
+end;
+
+procedure TFPHashTable.Add(const aKey: string; aItem: pointer);
+var
+  hashCode: Longword;
+  chn: TFPObjectList;
+  i: Longword;
+  NewNode: THtNode;
+begin
+  hashCode := FHashFunction(aKey, FHashTableSize);
+  chn := Chain(hashCode);
+  if Assigned(chn)  then
+  begin
+    for i := 0 to chn.Count - 1 do
+      if THTNode(chn[i]).HasKey(aKey) then
+        Raise EDuplicate.CreateFmt(DuplicateMsg, [aKey]);
+  end
+  else
+    begin
+      FHashTable[hashcode] := TFPObjectList.Create(true);
+      chn := Chain(hashcode);
+    end;
+  inc(FCount);
+  NewNode := THTNode.CreateWith(aKey);
+  NewNode.Data := aItem;
+  chn.Add(NewNode);
+end;
+
+procedure TFPHashTable.Delete(const aKey: string);
+var
+  hashCode: Longword;
+  chn: TFPObjectList;
+  i: Longword;
+begin
+  hashCode := FHashFunction(aKey, FHashTableSize);
+  chn := Chain(hashCode);
+  if Assigned(chn) then
+  begin
+    for i := 0 to chn.Count - 1 do
+      if THTNode(chn[i]).HasKey(aKey) then
+      begin
+        chn.Delete(i);
+        dec(FCount);
+        exit;
+      end;
+  end;
+  raise EKeyNotFound.CreateFmt(KeyNotFoundMsg, ['Delete', aKey]);
+end;
+
+function TFPHashTable.IsEmpty: boolean;
+begin
+  Result := (FCount = 0);
+end;
+
+function TFPHashTable.Chain(const index: Longword): TFPObjectList;
+begin
+  Result := TFPObjectList(FHashTable[index]);
+end;
+
+function TFPHashTable.GetVoidSlots: Longword;
+var
+  i: Longword;
+  num: Longword;
+begin
+  num := 0;
+  for i:= 0 to FHashTableSize-1 do
+    if Not Assigned(Chain(i)) then
+      inc(num);
+  result := num;
+end;
+
+function TFPHashTable.GetLoadFactor: double;
+begin
+  Result := Count / FHashTableSize;
+end;
+
+function TFPHashTable.GetAVGChainLen: double;
+begin
+  result := Count / (FHashTableSize - VoidSlots);
+end;
+
+function TFPHashTable.GetMaxChainLength: Longword;
+var
+  i: Longword;
+begin
+  Result := 0;
+  for i := 0 to FHashTableSize-1 do
+    if ChainLength(i) > Result then
+      Result := ChainLength(i);
+end;
+
 end.

+ 1 - 58
installer/install.pas

@@ -90,7 +90,7 @@ program install;
      unzipdll,
 {$ENDIF}
      app,dialogs,views,menus,msgbox,colortxt,tabs,scroll,
-     WHTMLScn;
+     WHTMLScn,insthelp;
 
   const
      installerversion='1.0.8';
@@ -450,63 +450,6 @@ program install;
        GetProgDir := D;
     end;
 
-  function RTrim(const S: string): string;
-  var
-    i : longint;
-  begin
-    i:=length(s);
-    while (i>0) and (s[i]=' ') do
-     dec(i);
-    RTrim:=Copy(s,1,i);
-  end;
-
-  function LTrim(const S: string): string;
-  var
-    i : longint;
-  begin
-    i:=1;
-    while (i<length(s)) and (s[i]=' ') do
-     inc(i);
-    LTrim:=Copy(s,i,255);
-  end;
-
-  function Trim(const S: string): string;
-  begin
-    Trim:=RTrim(LTrim(S));
-  end;
-
-  function CompareText(S1, S2: string): integer;
-  var R: integer;
-  begin
-    S1:=Upcase(S1);
-    S2:=Upcase(S2);
-    if S1<S2 then R:=-1 else
-    if S1>S2 then R:= 1 else
-    R:=0;
-    CompareText:=R;
-  end;
-
-  function ExtOf(const S: string): string;
-  var D: DirStr; E: ExtStr; N: NameStr;
-  begin
-    FSplit(S,D,N,E);
-    ExtOf:=E;
-  end;
-
-  function DirAndNameOf(const S: string): string;
-  var D: DirStr; E: ExtStr; N: NameStr;
-  begin
-    FSplit(S,D,N,E);
-    DirAndNameOf:=D+N;
-  end;
-
-  function DirOf(const S: string): string;
-  var D: DirStr; E: ExtStr; N: NameStr;
-  begin
-    FSplit(S,D,N,E);
-    DirOf:=D;
-  end;
-
   function GetZipErrorInfo(error : longint) : string;
   var
     ErrorStr : string;

+ 91 - 0
installer/insthelp.pas

@@ -0,0 +1,91 @@
+{
+    Helper routines for installer
+
+    This file is part of the Free Pascal installer.
+
+    Copyright (c) 1993-2005 by Florian Klaempfl
+    member of the Free Pascal development team
+
+    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 insthelp;
+
+  interface
+
+    function RTrim(const S: string): string;
+    function LTrim(const S: string): string;
+    function Trim(const S: string): string;
+    function CompareText(S1, S2: string): integer;
+    function ExtOf(const S: string): string;
+    function DirAndNameOf(const S: string): string;
+    function DirOf(const S: string): string;
+
+  implementation
+
+    uses
+      dos;
+
+    function RTrim(const S: string): string;
+      var
+        i : longint;
+      begin
+        i:=length(s);
+        while (i>0) and (s[i]=' ') do
+         dec(i);
+        RTrim:=Copy(s,1,i);
+      end;
+
+    function LTrim(const S: string): string;
+      var
+        i : longint;
+      begin
+        i:=1;
+        while (i<length(s)) and (s[i]=' ') do
+         inc(i);
+        LTrim:=Copy(s,i,255);
+      end;
+
+    function Trim(const S: string): string;
+      begin
+        Trim:=RTrim(LTrim(S));
+      end;
+
+    function CompareText(S1, S2: string): integer;
+      var R: integer;
+      begin
+        S1:=Upcase(S1);
+        S2:=Upcase(S2);
+        if S1<S2 then R:=-1 else
+        if S1>S2 then R:= 1 else
+        R:=0;
+        CompareText:=R;
+      end;
+
+    function ExtOf(const S: string): string;
+      var D: DirStr; E: ExtStr; N: NameStr;
+      begin
+        FSplit(S,D,N,E);
+        ExtOf:=E;
+      end;
+
+    function DirAndNameOf(const S: string): string;
+      var D: DirStr; E: ExtStr; N: NameStr;
+      begin
+        FSplit(S,D,N,E);
+        DirAndNameOf:=D+N;
+      end;
+
+    function DirOf(const S: string): string;
+      var D: DirStr; E: ExtStr; N: NameStr;
+      begin
+        FSplit(S,D,N,E);
+        DirOf:=D;
+      end;
+
+  end.

+ 112 - 0
installer/writeidx.pas

@@ -0,0 +1,112 @@
+{
+    Help program to generate html help index
+
+    This file is part of Free Pascal.
+    Copyright (c) 1993-2005 by Florian Klaempfl
+    member of the Free Pascal development team
+
+    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.
+
+ **********************************************************************}
+{$mode objfpc}
+  uses
+    insthelp,sysutils,dos,objects,WHTMLScn;
+
+  type
+    PFPHTMLFileLinkScanner = ^TFPHTMLFileLinkScanner;
+    TFPHTMLFileLinkScanner = object(THTMLFileLinkScanner)
+      function    CheckURL(const URL: string): boolean; virtual;
+      function    CheckText(const Text: string): boolean; virtual;
+      procedure   ProcessDoc(Doc: PHTMLLinkScanFile); virtual;
+    end;
+
+
+  const
+    HTMLIndexExt = '.htx';
+
+
+  procedure TFPHTMLFileLinkScanner.ProcessDoc(Doc: PHTMLLinkScanFile);
+    begin
+    end;
+
+
+  function TFPHTMLFileLinkScanner.CheckURL(const URL: string): boolean;
+    var OK: boolean;
+    const HTTPPrefix = 'http:';
+          FTPPrefix  = 'ftp:';
+    begin
+      OK:=inherited CheckURL(URL);
+      if OK then OK:=DirAndNameOf(URL)<>'';
+      if OK then OK:=CompareText(copy(ExtOf(URL),1,4),'.HTM')=0;
+      if OK then OK:=CompareText(copy(URL,1,length(HTTPPrefix)),HTTPPrefix)<>0;
+      if OK then OK:=CompareText(copy(URL,1,length(FTPPrefix)),FTPPrefix)<>0;
+      CheckURL:=OK;
+    end;
+
+
+  function TFPHTMLFileLinkScanner.CheckText(const Text: string): boolean;
+    var OK: boolean;
+      S: string;
+    begin
+      S:=Trim(Text);
+      OK:=(S<>'') and (copy(S,1,1)<>'[');
+      CheckText:=OK;
+    end;
+
+
+  procedure doerror(const s : ansistring);
+    begin
+      writeln(s);
+      writeln;
+      writeln('Press ENTER to continue');
+      readln;
+    end;
+
+
+  procedure writehlpindex(filename : ansistring);
+
+    var
+      LS : PFPHTMLFileLinkScanner;
+      BS : PBufStream;
+      Re : Word;
+      params : array[0..0] of pointer;
+      dir    : searchrec;
+
+    begin
+      writeln('Creating HTML index file, please wait ...');
+      New(LS, Init(DirOf(FileName)));
+      LS^.ProcessDocument(FileName,[soSubDocsOnly]);
+      if LS^.GetDocumentCount=0 then
+        doerror(format('Problem creating help index %1, aborting',[filename]))
+      else
+        begin
+          FileName:=DirAndNameOf(FileName)+HTMLIndexExt;
+          begin
+            New(BS, Init(FileName, stCreate, 4096));
+            if not(Assigned(BS)) then
+              doerror(format('Error while writing help index! '+
+                'No help index is created',[filename]))
+            else
+              begin
+                LS^.StoreDocuments(BS^);
+                if BS^.Status<>stOK then
+                  doerror(format('Error while writing help index! '+
+                    'No help index is created',[filename]));
+                Dispose(BS, Done);
+              end;
+          end;
+        end;
+      Dispose(LS, Done);
+    end;
+
+  begin
+    if paramcount<>1 then
+      writeln('Usage: writeidx <index name>')
+    else
+      writehlpindex(paramstr(1));
+  end.

+ 7 - 1
packages/base/netdb/netdb.pp

@@ -209,7 +209,13 @@ begin
       Readln(R,L);
       I:=Pos('#',L);
       If (I<>0) then
-        L:=Copy(L,1,I-1);
+        L:=Copy(L,1,I-1)
+      else
+        begin
+          I:=Pos(';',L);
+          If (I<>0) then
+            L:=Copy(L,1,I-1)
+	end;
       If CheckDirective('nameserver') then
         begin
         H:=HostToNet(StrToHostAddr(L));

+ 12 - 19
rtl/linux/powerpc/sighnd.inc

@@ -15,8 +15,7 @@
 
  **********************************************************************}
 
-
-procedure SignalToRunerror(sig : longint; SigInfo: PSigInfo; SigContext: PSigContext);cdecl;
+procedure SignalToRunerror(sig : longint; SigInfo: PSigInfo; context: PUContext);cdecl;
 var
   res : word;
 {  fpustate: longint; }
@@ -26,30 +25,24 @@ begin
   fpc_enable_ppc_fpu_exceptions;
   case sig of
     SIGFPE :
-        begin
-{
-         fpscr is cleared by the kernel -> can't find out cause :(
-          fpustate := fpc_get_ppc_fpscr;
-          if (fpustate and ppc_fpu_underflow) <> 0 then
-            res := 206
-          else if (fpustate and ppc_fpu_overflow) <> 0 then
-            res := 205
-          else if (fpustate and ppc_fpu_divbyzero) <> 0 then
-            res := 200
-          else
-}
-            res := 207;
-        end;
+      case (SigInfo^.si_code) of
+        FPE_FLTDIV : res := 200;
+        FPE_FLTOVF : res := 205;
+        FPE_FLTUND : res := 206;
+        else
+          res := 207;
+      end;
     SIGBUS :
-        res:=214;
+      res:=214;
     SIGILL,
     SIGSEGV :
-        res:=216;
+      res:=216;
   end;
   reenable_signal(sig);
   { give runtime error at the position where the signal was raised }
   if res<>0 then
-    HandleErrorAddrFrame(res,pointer(SigContext^.pt_regs^.nip),pointer(SigContext^.pt_regs^.gpr[1]));
+    HandleErrorAddrFrame(res, pointer(context^.uc_mcontext.pt_regs^.nip),
+      pointer(context^.uc_mcontext.pt_regs^.gpr[1]));
 end;
 
 

+ 25 - 33
rtl/linux/powerpc/sighndh.inc

@@ -3,7 +3,8 @@
     Copyright (c) 1999-2000 by Jonas Maebe,
     member of the Free Pascal development team.
 
-    TSigContext
+    TSigContext and related records. Translated from headers from
+    2.6.11 kernel sources.
 
     See the file COPYING.FPC, included in this distribution,
     for details about the copyright.
@@ -17,63 +18,54 @@
 {$packrecords C}
 
 type
+  gpr_reg = cULong;
+
   { from include/ppc/ptrace.h }
   pptregs = ^tptregs;
   tptregs = record
-    gpr: array[0..31] of cardinal;
-    nip: cardinal;
-    msr: cardinal;
-    orig_gpr3: cardinal; { Used for restarting system calls }
-    ctr: cardinal;
-    link: cardinal;
-    xer: cardinal;
-    ccr: cardinal;
-    mq: cardinal;        { 601 only (not used at present)  }
-                         { Used on APUS to hold IPL value. }
-    trap: cardinal;      { Reason for being here }
-    dar: cardinal;       { Fault registers }
-    dsisr: cardinal;
-    result: cardinal;    { Result of a system call }
+    gpr: array[0..31] of gpr_reg;
+    nip: gpr_reg;
+    msr: gpr_reg;
+    orig_gpr3: gpr_reg; { Used for restarting system calls }
+    ctr: gpr_reg;
+    link: gpr_reg;
+    xer: gpr_reg;
+    ccr: gpr_reg;
+    mq: gpr_reg;        { 601 only (not used at present)  }
+                        { Used on APUS to hold IPL value. }
+    trap: gpr_reg;      { Reason for being here }
+    dar: gpr_reg;       { Fault registers }
+    dsisr: gpr_reg;
+    result: gpr_reg;    { Result of a system call }
   end;
 
   { from include/asm-ppc/signal.h }
   stack_t = record
     ss_sp: pointer;
-    ss_flags: longint;
+    ss_flags: cInt;
     ss_size: size_t;
   end;
 
   { from include/asm-ppc/sigcontext.h }
   tsigcontext_struct = record
-    _unused: array[0..3] of dword;
-    signal: longint;
-    handler: dword;
-    oldmask: dword;
+    _unused: array[0..3] of cULong;
+    signal: cInt;
+    handler: cULong;
+    oldmask: cULong;
     pt_regs: pptregs;
   end;
 
   { from include/asm-ppc/ucontext.h }
   pucontext = ^tucontext;
   tucontext = record
-    uc_flags : dword;
+    uc_flags : cULong;
     uc_link : pucontext;
     uc_stack : stack_t;
     uc_mcontext : tsigcontext_struct;
     uc_sigmask : sigset_t;
   end;
 
-
   { from arch/ppc/kernel/signal.c, the type of the actual parameter passed }
   { to the sigaction handler                                               }
-  t_rt_sigframe = record
-    _unused: array[0..1] of cardinal;
-    pinfo: psiginfo;
-    puc: pointer;
-    siginfo: tsiginfo;
-    uc: tucontext;
-  end;
-
   PSigContext = ^TSigContext;
-  TSigContext= tsigcontext_struct;
-
-
+  TSigContext= tucontext;

+ 275 - 241
rtl/linux/powerpc/sysnr.inc

@@ -3,7 +3,7 @@
     Copyright (c) 1999-2000 by Michael Van Canneyt,
     member of the Free Pascal development team.
 
-    Syscall nrs for 2.4.18
+    Syscall nrs for 2.6.11
 
     See the file COPYING.FPC, included in this distribution,
     for details about the copyright.
@@ -14,247 +14,281 @@
 
  **********************************************************************}
 
-
 {
-* This file contains the system call numbers.
+  Automatically converted by H2Pas 1.0.0 from 
+  /usr/include/asm-ppc/unistd.h
 }
 
-Const
-        syscall_nr_exit                 =  1;
-        syscall_nr_fork                 =  2;
-        syscall_nr_read                 =  3;
-        syscall_nr_write                =  4;
-        syscall_nr_open                 =  5;
-        syscall_nr_close                =  6;
-        syscall_nr_waitpid              =  7;
-        syscall_nr_creat                =  8;
-        syscall_nr_link                 =  9;
-        syscall_nr_unlink               = 10;
-        syscall_nr_execve               = 11;
-        syscall_nr_chdir                = 12;
-        syscall_nr_time                 = 13;
-        syscall_nr_mknod                = 14;
-        syscall_nr_chmod                = 15;
-        syscall_nr_lchown               = 16;
-        syscall_nr_break                = 17;
-        syscall_nr_oldstat              = 18;
-        syscall_nr_lseek                = 19;
-        syscall_nr_getpid               = 20;
-        syscall_nr_mount                = 21;
-        syscall_nr_umount               = 22;
-        syscall_nr_setuid               = 23;
-        syscall_nr_getuid               = 24;
-        syscall_nr_stime                = 25;
-        syscall_nr_ptrace               = 26;
-        syscall_nr_alarm                = 27;
-        syscall_nr_oldfstat             = 28;
-        syscall_nr_pause                = 29;
-        syscall_nr_utime                = 30;
-        syscall_nr_stty                 = 31;
-        syscall_nr_gtty                 = 32;
-        syscall_nr_access               = 33;
-        syscall_nr_nice                 = 34;
-        syscall_nr_ftime                = 35;
-        syscall_nr_sync                 = 36;
-        syscall_nr_kill                 = 37;
-        syscall_nr_rename               = 38;
-        syscall_nr_mkdir                = 39;
-        syscall_nr_rmdir                = 40;
-        syscall_nr_dup                  = 41;
-        syscall_nr_pipe                 = 42;
-        syscall_nr_times                = 43;
-        syscall_nr_prof                 = 44;
-        syscall_nr_brk                  = 45;
-        syscall_nr_setgid               = 46;
-        syscall_nr_getgid               = 47;
-        syscall_nr_signal               = 48;
-        syscall_nr_geteuid              = 49;
-        syscall_nr_getegid              = 50;
-        syscall_nr_acct                 = 51;
-        syscall_nr_umount2              = 52;
-        syscall_nr_lock                 = 53;
-        syscall_nr_ioctl                = 54;
-        syscall_nr_fcntl                = 55;
-        syscall_nr_mpx                  = 56;
-        syscall_nr_setpgid              = 57;
-        syscall_nr_ulimit               = 58;
-        syscall_nr_oldolduname          = 59;
-        syscall_nr_umask                = 60;
-        syscall_nr_chroot               = 61;
-        syscall_nr_ustat                = 62;
-        syscall_nr_dup2                 = 63;
-        syscall_nr_getppid              = 64;
-        syscall_nr_getpgrp              = 65;
-        syscall_nr_setsid               = 66;
-        syscall_nr_sigaction            = 67;
-        syscall_nr_sgetmask             = 68;
-        syscall_nr_ssetmask             = 69;
-        syscall_nr_setreuid             = 70;
-        syscall_nr_setregid             = 71;
-        syscall_nr_sigsuspend           = 72;
-        syscall_nr_sigpending           = 73;
-        syscall_nr_sethostname          = 74;
-        syscall_nr_setrlimit            = 75;
-        syscall_nr_getrlimit            = 76;   { Back compatible 2Gig limited rlimit }
-        syscall_nr_getrusage            = 77;
-        syscall_nr_gettimeofday         = 78;
-        syscall_nr_settimeofday         = 79;
-        syscall_nr_getgroups            = 80;
-        syscall_nr_setgroups            = 81;
-        syscall_nr_select               = 82;
-        syscall_nr_symlink              = 83;
-        syscall_nr_oldlstat             = 84;
-        syscall_nr_readlink             = 85;
-        syscall_nr_uselib               = 86;
-        syscall_nr_swapon               = 87;
-        syscall_nr_reboot               = 88;
-        syscall_nr_readdir              = 89;
-        syscall_nr_mmap                 = 90;
-        syscall_nr_munmap               = 91;
-        syscall_nr_truncate             = 92;
-        syscall_nr_ftruncate            = 93;
-        syscall_nr_fchmod               = 94;
-        syscall_nr_fchown               = 95;
-        syscall_nr_getpriority          = 96;
-        syscall_nr_setpriority          = 97;
-        syscall_nr_profil               = 98;
-        syscall_nr_statfs               = 99;
-        syscall_nr_fstatfs              = 100;
-        syscall_nr_ioperm               = 101;
-        syscall_nr_socketcall           = 102;
-        syscall_nr_syslog               = 103;
-        syscall_nr_setitimer            = 104;
-        syscall_nr_getitimer            = 105;
-        syscall_nr_stat                 = 106;
-        syscall_nr_lstat                = 107;
-        syscall_nr_fstat                = 108;
-        syscall_nr_olduname             = 109;
-        syscall_nr_iopl                 = 110;
-        syscall_nr_vhangup              = 111;
-        syscall_nr_idle                 = 112;
-        syscall_nr_vm86old              = 113;
-        syscall_nr_wait4                = 114;
-        syscall_nr_swapoff              = 115;
-        syscall_nr_sysinfo              = 116;
-        syscall_nr_ipc                  = 117;
-        syscall_nr_fsync                = 118;
-        syscall_nr_sigreturn            = 119;
-        syscall_nr_clone                = 120;
-        syscall_nr_setdomainname        = 121;
-        syscall_nr_uname                = 122;
-        syscall_nr_modify_ldt           = 123;
-        syscall_nr_adjtimex             = 124;
-        syscall_nr_mprotect             = 125;
-        syscall_nr_sigprocmask          = 126;
-        syscall_nr_create_module        = 127;
-        syscall_nr_init_module          = 128;
-        syscall_nr_delete_module        = 129;
-        syscall_nr_get_kernel_syms      = 130;
-        syscall_nr_quotactl             = 131;
-        syscall_nr_getpgid              = 132;
-        syscall_nr_fchdir               = 133;
-        syscall_nr_bdflush              = 134;
-        syscall_nr_sysfs                = 135;
-        syscall_nr_personality          = 136;
-        syscall_nr_afs_syscall          = 137; { Syscall for Andrew File System }
-        syscall_nr_setfsuid             = 138;
-        syscall_nr_setfsgid             = 139;
-        syscall_nr__llseek              = 140;
-        syscall_nr_getdents             = 141;
-        syscall_nr__newselect           = 142;
-        syscall_nr_flock                = 143;
-        syscall_nr_msync                = 144;
-        syscall_nr_readv                = 145;
-        syscall_nr_writev               = 146;
-        syscall_nr_getsid               = 147;
-        syscall_nr_fdatasync            = 148;
-        syscall_nr__sysctl              = 149;
-        syscall_nr_mlock                = 150;
-        syscall_nr_munlock              = 151;
-        syscall_nr_mlockall             = 152;
-        syscall_nr_munlockall           = 153;
-        syscall_nr_sched_setparam       = 154;
-        syscall_nr_sched_getparam       = 155;
-        syscall_nr_sched_setscheduler   = 156;
-        syscall_nr_sched_getscheduler   = 157;
-        syscall_nr_sched_yield          = 158;
-        syscall_nr_sched_get_priority_max       = 159;
-        syscall_nr_sched_get_priority_min       = 160;
-        syscall_nr_sched_rr_get_interval        = 161;
-        syscall_nr_nanosleep            = 162;
-        syscall_nr_mremap               = 163;
-        syscall_nr_setresuid            = 164;
-        syscall_nr_getresuid            = 165;
-        syscall_nr_vm86                 = 166;
-        syscall_nr_query_module         = 167;
-        syscall_nr_poll                 = 168;
-        syscall_nr_nfsservctl           = 169;
-        syscall_nr_setresgid            = 170;
-        syscall_nr_getresgid            = 171;
-        syscall_nr_prctl                = 172;
-        syscall_nr_rt_sigreturn         = 173;
-        syscall_nr_rt_sigaction         = 174;
-        syscall_nr_rt_sigprocmask       = 175;
-        syscall_nr_rt_sigpending        = 176;
-        syscall_nr_rt_sigtimedwait      = 177;
-        syscall_nr_rt_sigqueueinfo      = 178;
-        syscall_nr_rt_sigsuspend        = 179;
-        syscall_nr_pread                = 180;
-        syscall_nr_pwrite               = 181;
-        syscall_nr_chown                = 182;
-        syscall_nr_getcwd               = 183;
-        syscall_nr_capget               = 184;
-        syscall_nr_capset               = 185;
-        syscall_nr_sigaltstack          = 186;
-        syscall_nr_sendfile             = 187;
-        syscall_nr_getpmsg              = 188;  { some people actually want streams }
-        syscall_nr_putpmsg              = 189;  { some people actually want streams }
-        syscall_nr_vfork                = 190;
-        syscall_nr_ugetrlimit           = 191;  { SuS compliant getrlimit }
-        syscall_nr_mmap2                = 192;
-        syscall_nr_truncate64           = 193;
-        syscall_nr_ftruncate64          = 194;
-        syscall_nr_stat64               = 195;
-        syscall_nr_lstat64              = 196;
-        syscall_nr_fstat64              = 197;
-        syscall_nr_lchown32             = 198;
-        syscall_nr_getuid32             = 199;
-        syscall_nr_getgid32             = 200;
-        syscall_nr_geteuid32            = 201;
-        syscall_nr_getegid32            = 202;
-        syscall_nr_setreuid32           = 203;
-        syscall_nr_setregid32           = 204;
-        syscall_nr_getgroups32          = 205;
-        syscall_nr_setgroups32          = 206;
-        syscall_nr_fchown32             = 207;
-        syscall_nr_setresuid32          = 208;
-        syscall_nr_getresuid32          = 209;
-        syscall_nr_setresgid32          = 210;
-        syscall_nr_getresgid32          = 211;
-        syscall_nr_chown32              = 212;
-        syscall_nr_setuid32             = 213;
-        syscall_nr_setgid32             = 214;
-        syscall_nr_setfsuid32           = 215;
-        syscall_nr_setfsgid32           = 216;
-        syscall_nr_pivot_root           = 217;
-        syscall_nr_mincore              = 218;
-        syscall_nr_madvise              = 219;
-        syscall_nr_madvise1             = 219;  { delete when C lib stub is removed }
-        syscall_nr_getdents64           = 220;
-        syscall_nr_fcntl64              = 221;
-        syscall_nr_security             = 223;  { syscall for security modules }
-        syscall_nr_gettid               = 224;
-        syscall_nr_readahead            = 225;
-        syscall_nr_setxattr             = 226;
-        syscall_nr_lsetxattr            = 227;
-        syscall_nr_fsetxattr            = 228;
-        syscall_nr_getxattr             = 229;
-        syscall_nr_lgetxattr            = 230;
-        syscall_nr_fgetxattr            = 231;
-        syscall_nr_listxattr            = 232;
-        syscall_nr_llistxattr           = 233;
-        syscall_nr_flistxattr           = 234;
-        syscall_nr_removexattr          = 235;
-        syscall_nr_lremovexattr         = 236;
-        syscall_nr_fremovexattr         = 237;
+{ This file contains the system call numbers.  }
 
+const
+  syscall_nr_exit = 1;
+  syscall_nr_fork = 2;
+  syscall_nr_read = 3;
+  syscall_nr_write = 4;
+  syscall_nr_open = 5;
+  syscall_nr_close = 6;
+  syscall_nr_waitpid = 7;
+  syscall_nr_creat = 8;
+  syscall_nr_link = 9;
+  syscall_nr_unlink = 10;
+  syscall_nr_execve = 11;
+  syscall_nr_chdir = 12;
+  syscall_nr_time = 13;
+  syscall_nr_mknod = 14;
+  syscall_nr_chmod = 15;
+  syscall_nr_lchown = 16;
+  syscall_nr_break = 17;
+  syscall_nr_oldstat = 18;
+  syscall_nr_lseek = 19;
+  syscall_nr_getpid = 20;
+  syscall_nr_mount = 21;
+  syscall_nr_umount = 22;
+  syscall_nr_setuid = 23;
+  syscall_nr_getuid = 24;
+  syscall_nr_stime = 25;
+  syscall_nr_ptrace = 26;
+  syscall_nr_alarm = 27;
+  syscall_nr_oldfstat = 28;
+  syscall_nr_pause = 29;
+  syscall_nr_utime = 30;
+  syscall_nr_stty = 31;
+  syscall_nr_gtty = 32;
+  syscall_nr_access = 33;
+  syscall_nr_nice = 34;
+  syscall_nr_ftime = 35;
+  syscall_nr_sync = 36;
+  syscall_nr_kill = 37;
+  syscall_nr_rename = 38;
+  syscall_nr_mkdir = 39;
+  syscall_nr_rmdir = 40;
+  syscall_nr_dup = 41;
+  syscall_nr_pipe = 42;
+  syscall_nr_times = 43;
+  syscall_nr_prof = 44;
+  syscall_nr_brk = 45;
+  syscall_nr_setgid = 46;
+  syscall_nr_getgid = 47;
+  syscall_nr_signal = 48;
+  syscall_nr_geteuid = 49;
+  syscall_nr_getegid = 50;
+  syscall_nr_acct = 51;
+  syscall_nr_umount2 = 52;
+  syscall_nr_lock = 53;
+  syscall_nr_ioctl = 54;
+  syscall_nr_fcntl = 55;
+  syscall_nr_mpx = 56;
+  syscall_nr_setpgid = 57;
+  syscall_nr_ulimit = 58;
+  syscall_nr_oldolduname = 59;
+  syscall_nr_umask = 60;
+  syscall_nr_chroot = 61;
+  syscall_nr_ustat = 62;
+  syscall_nr_dup2 = 63;
+  syscall_nr_getppid = 64;
+  syscall_nr_getpgrp = 65;
+  syscall_nr_setsid = 66;
+  syscall_nr_sigaction = 67;
+  syscall_nr_sgetmask = 68;
+  syscall_nr_ssetmask = 69;
+  syscall_nr_setreuid = 70;
+  syscall_nr_setregid = 71;
+  syscall_nr_sigsuspend = 72;
+  syscall_nr_sigpending = 73;
+  syscall_nr_sethostname = 74;
+  syscall_nr_setrlimit = 75;
+  syscall_nr_getrlimit = 76;
+  syscall_nr_getrusage = 77;
+  syscall_nr_gettimeofday = 78;
+  syscall_nr_settimeofday = 79;
+  syscall_nr_getgroups = 80;
+  syscall_nr_setgroups = 81;
+  syscall_nr_select = 82;
+  syscall_nr_symlink = 83;
+  syscall_nr_oldlstat = 84;
+  syscall_nr_readlink = 85;
+  syscall_nr_uselib = 86;
+  syscall_nr_swapon = 87;
+  syscall_nr_reboot = 88;
+  syscall_nr_readdir = 89;
+  syscall_nr_mmap = 90;
+  syscall_nr_munmap = 91;
+  syscall_nr_truncate = 92;
+  syscall_nr_ftruncate = 93;
+  syscall_nr_fchmod = 94;
+  syscall_nr_fchown = 95;
+  syscall_nr_getpriority = 96;
+  syscall_nr_setpriority = 97;
+  syscall_nr_profil = 98;
+  syscall_nr_statfs = 99;
+  syscall_nr_fstatfs = 100;
+  syscall_nr_ioperm = 101;
+  syscall_nr_socketcall = 102;
+  syscall_nr_syslog = 103;
+  syscall_nr_setitimer = 104;
+  syscall_nr_getitimer = 105;
+  syscall_nr_stat = 106;
+  syscall_nr_lstat = 107;
+  syscall_nr_fstat = 108;
+  syscall_nr_olduname = 109;
+  syscall_nr_iopl = 110;
+  syscall_nr_vhangup = 111;
+  syscall_nr_idle = 112;
+  syscall_nr_vm86 = 113;
+  syscall_nr_wait4 = 114;
+  syscall_nr_swapoff = 115;
+  syscall_nr_sysinfo = 116;
+  syscall_nr_ipc = 117;
+  syscall_nr_fsync = 118;
+  syscall_nr_sigreturn = 119;
+  syscall_nr_clone = 120;
+  syscall_nr_setdomainname = 121;
+  syscall_nr_uname = 122;
+  syscall_nr_modify_ldt = 123;
+  syscall_nr_adjtimex = 124;
+  syscall_nr_mprotect = 125;
+  syscall_nr_sigprocmask = 126;
+  syscall_nr_create_module = 127;
+  syscall_nr_init_module = 128;
+  syscall_nr_delete_module = 129;
+  syscall_nr_get_kernel_syms = 130;
+  syscall_nr_quotactl = 131;
+  syscall_nr_getpgid = 132;
+  syscall_nr_fchdir = 133;
+  syscall_nr_bdflush = 134;
+  syscall_nr_sysfs = 135;
+  syscall_nr_personality = 136;
+  { Syscall for Andrew File System  }
+  syscall_nr_afs_syscall = 137;
+  syscall_nr_setfsuid = 138;
+  syscall_nr_setfsgid = 139;
+  syscall_nr__llseek = 140;
+  syscall_nr_getdents = 141;
+  syscall_nr__newselect = 142;
+  syscall_nr_flock = 143;
+  syscall_nr_msync = 144;
+  syscall_nr_readv = 145;
+  syscall_nr_writev = 146;
+  syscall_nr_getsid = 147;
+  syscall_nr_fdatasync = 148;
+  syscall_nr__sysctl = 149;
+  syscall_nr_mlock = 150;
+  syscall_nr_munlock = 151;
+  syscall_nr_mlockall = 152;
+  syscall_nr_munlockall = 153;
+  syscall_nr_sched_setparam = 154;
+  syscall_nr_sched_getparam = 155;
+  syscall_nr_sched_setscheduler = 156;
+  syscall_nr_sched_getscheduler = 157;
+  syscall_nr_sched_yield = 158;
+  syscall_nr_sched_get_priority_max = 159;
+  syscall_nr_sched_get_priority_min = 160;
+  syscall_nr_sched_rr_get_interval = 161;
+  syscall_nr_nanosleep = 162;
+  syscall_nr_mremap = 163;
+  syscall_nr_setresuid = 164;
+  syscall_nr_getresuid = 165;
+  syscall_nr_query_module = 166;
+  syscall_nr_poll = 167;
+  syscall_nr_nfsservctl = 168;
+  syscall_nr_setresgid = 169;
+  syscall_nr_getresgid = 170;
+  syscall_nr_prctl = 171;
+  syscall_nr_rt_sigreturn = 172;
+  syscall_nr_rt_sigaction = 173;
+  syscall_nr_rt_sigprocmask = 174;
+  syscall_nr_rt_sigpending = 175;
+  syscall_nr_rt_sigtimedwait = 176;
+  syscall_nr_rt_sigqueueinfo = 177;
+  syscall_nr_rt_sigsuspend = 178;
+  syscall_nr_pread = 179;
+  syscall_nr_pwrite = 180;
+  syscall_nr_chown = 181;
+  syscall_nr_getcwd = 182;
+  syscall_nr_capget = 183;
+  syscall_nr_capset = 184;
+  syscall_nr_sigaltstack = 185;
+  syscall_nr_sendfile = 186;
+  { some people actually want streams  }
+  syscall_nr_getpmsg = 187;
+  { some people actually want streams  }
+  syscall_nr_putpmsg = 188;
+  syscall_nr_vfork = 189;
+  { SuS compliant getrlimit  }
+  syscall_nr_ugetrlimit = 190;
+  syscall_nr_readahead = 191;
+  syscall_nr_mmap2 = 192;
+  syscall_nr_truncate64 = 193;
+  syscall_nr_ftruncate64 = 194;
+  syscall_nr_stat64 = 195;
+  syscall_nr_lstat64 = 196;
+  syscall_nr_fstat64 = 197;
+  syscall_nr_pciconfig_read = 198;
+  syscall_nr_pciconfig_write = 199;
+  syscall_nr_pciconfig_iobase = 200;
+  syscall_nr_multiplexer = 201;
+  syscall_nr_getdents64 = 202;
+  syscall_nr_pivot_root = 203;
+  syscall_nr_fcntl64 = 204;
+  syscall_nr_madvise = 205;
+  syscall_nr_mincore = 206;
+  syscall_nr_gettid = 207;
+  syscall_nr_tkill = 208;
+  syscall_nr_setxattr = 209;
+  syscall_nr_lsetxattr = 210;
+  syscall_nr_fsetxattr = 211;
+  syscall_nr_getxattr = 212;
+  syscall_nr_lgetxattr = 213;
+  syscall_nr_fgetxattr = 214;
+  syscall_nr_listxattr = 215;
+  syscall_nr_llistxattr = 216;
+  syscall_nr_flistxattr = 217;
+  syscall_nr_removexattr = 218;
+  syscall_nr_lremovexattr = 219;
+  syscall_nr_fremovexattr = 220;
+  syscall_nr_futex = 221;
+  syscall_nr_sched_setaffinity = 222;
+  syscall_nr_sched_getaffinity = 223;
+  { 224 currently unused  }
+  syscall_nr_tuxcall = 225;
+  syscall_nr_sendfile64 = 226;
+  syscall_nr_io_setup = 227;
+  syscall_nr_io_destroy = 228;
+  syscall_nr_io_getevents = 229;
+  syscall_nr_io_submit = 230;
+  syscall_nr_io_cancel = 231;
+  syscall_nr_set_tid_address = 232;
+  syscall_nr_fadvise64 = 233;
+  syscall_nr_exit_group = 234;
+  syscall_nr_lookup_dcookie = 235;
+  syscall_nr_epoll_create = 236;
+  syscall_nr_epoll_ctl = 237;
+  syscall_nr_epoll_wait = 238;
+  syscall_nr_remap_file_pages = 239;
+  syscall_nr_timer_create = 240;
+  syscall_nr_timer_settime = 241;
+  syscall_nr_timer_gettime = 242;
+  syscall_nr_timer_getoverrun = 243;
+  syscall_nr_timer_delete = 244;
+  syscall_nr_clock_settime = 245;
+  syscall_nr_clock_gettime = 246;
+  syscall_nr_clock_getres = 247;
+  syscall_nr_clock_nanosleep = 248;
+  syscall_nr_swapcontext = 249;
+  syscall_nr_tgkill = 250;
+  syscall_nr_utimes = 251;
+  syscall_nr_statfs64 = 252;
+  syscall_nr_fstatfs64 = 253;
+  syscall_nr_fadvise64_64 = 254;
+  syscall_nr_rtas = 255;
+  syscall_nr_mq_open = 262;
+  syscall_nr_mq_unlink = 263;
+  syscall_nr_mq_timedsend = 264;
+  syscall_nr_mq_timedreceive = 265;
+  syscall_nr_mq_notify = 266;
+  syscall_nr_mq_getsetattr = 267;
+  syscall_nr_kexec_load = 268;
+  syscall_nr_add_key = 269;
+  syscall_nr_request_key = 270;
+  syscall_nr_keyctl = 271;
+  syscall_nr_waitid = 272;

+ 10 - 1
rtl/linux/signal.inc

@@ -118,11 +118,20 @@ Const
   SIGUNUSED  = 31;
 {$endif cpusparc}
 
+{ si_code field values for tsiginfo.si_code when si_signo = SIGFPE }
+const
+  FPE_INTDIV = 1; { integer divide by zero }
+  FPE_INTOVF = 2; { integer overflow }
+  FPE_FLTDIV = 3; { floating point divide by zero }
+  FPE_FLTOVF = 4; { floating point overflow }
+  FPE_FLTUND = 5; { floating point underflow }
+  FPE_FLTRES = 6; { floating point inexact result }
+  FPE_FLTINV = 7; { floating point invalid operation }
+  FPE_FLTSUB = 8; { floating point subscript out of range }
 
 const
   SI_PAD_SIZE   = ((128 div sizeof(longint)) - 3);
 
-
 type
   SigSet  =  array[0..wordsinsigset-1] of cint;
   sigset_t= SigSet;

+ 151 - 3
rtl/linux/unxsockh.inc

@@ -129,8 +129,156 @@ Const
          SCM_TIMESTAMP   = SO_TIMESTAMP;
          SO_ACCEPTCONN   = 30;
 
+// Following from kernel 2.6.14-1.1637_FC4
 
-        SHUT_RD         =0;             { shut down the reading side }
-        SHUT_WR         =1;             { shut down the writing side }
-        SHUT_RDWR       =2;             { shut down both sides }
+        SHUT_RD          = 0;             { shut down the reading side }
+        SHUT_WR          = 1;             { shut down the writing side }
+        SHUT_RDWR        = 2;             { shut down both sides }
 
+//from /usr/include/netinet/in.h
+
+        IPPROTO_IP       = 0;       { Dummy protocol for TCP.  }
+        IPPROTO_HOPOPTS  = 0;      { IPv6 Hop-by-Hop options.  }
+
+        IPPROTO_ICMP     = 1;       { Internet Control Message Protocol.  }
+        IPPROTO_IGMP     = 2;       { Internet Group Management Protocol. }
+        IPPROTO_IPIP     = 4;       { IPIP tunnels (older KA9Q tunnels use 94).  }
+        IPPROTO_TCP      = 6;       { Transmission Control Protocol.  }
+        IPPROTO_EGP      = 8;       { Exterior Gateway Protocol.  }
+
+        IPPROTO_PUP      = 12;       { PUP protocol.  }
+        IPPROTO_UDP      = 17;       { User Datagram Protocol.  }
+        IPPROTO_IDP      = 22;       { XNS IDP protocol.  }
+        IPPROTO_TP       = 29;       { SO Transport Protocol Class 4.  }
+        IPPROTO_IPV6     = 41;     { IPv6 header.  }
+
+         IPPROTO_ROUTING = 43;  { IPv6 routing header.  }
+         IPPROTO_FRAGMENT = 44; { IPv6 fragmentation header.  }
+         IPPROTO_RSVP    = 46;       { Reservation Protocol.  }
+         IPPROTO_GRE     = 47;       { General Routing Encapsulation.  }
+         IPPROTO_ESP     = 50;     { encapsulating security payload.  }
+         IPPROTO_AH      = 51;     { authentication header.  }
+         IPPROTO_ICMPV6  = 58;     { ICMPv6.  }
+         IPPROTO_NONE    = 59;     { IPv6 no next header.  }
+         IPPROTO_DSTOPTS = 60;     { IPv6 destination options.  }
+         IPPROTO_MTP     = 92;       { Multicast Transport Protocol.  }
+         IPPROTO_ENCAP   = 98;       { Encapsulation Header.  }
+         IPPROTO_PIM     = 103;       { Protocol Independent Multicast.  }
+         IPPROTO_COMP    = 108;       { Compression Header Protocol.  }
+         IPPROTO_SCTP    = 132;       { Stream Control Transmission Protocol.  }
+         IPPROTO_RAW     = 255;       { Raw IP packets.  }
+         IPPROTO_MAX     = 255;
+//from /usr/include/bits/in.h
+{/* Options for use with etsockopt' and etsockopt' at the IP level.
+   The first word in the comment at the right is the data type used;
+   "bool" means a boolean value stored in an 	nt'.  */
+}
+        IP_OPTIONS              = 4;               { ip_opts; IP per-packet options.  }
+        IP_HDRINCL              = 3;               { int; Header is included with data.  }
+        IP_TOS                  = 1;               { int; IP type of service and precedence.  }
+        IP_TTL                  = 2;               { int; IP time to live.  }
+        IP_RECVOPTS             = 6;               { bool; Receive all IP options w/datagram.  }
+{ For BSD compatibility.  }
+        IP_RETOPTS              = 7;               { ip_opts; Set/get IP per-packet options.  }
+        IP_RECVRETOPTS          = IP_RETOPTS;      { bool; Receive IP options for response.  }
+
+        IP_MULTICAST_IF         = 32;                { in_addr; set/get IP multicast i/f }
+        IP_MULTICAST_TTL        = 33;               { u_char; set/get IP multicast ttl }
+        IP_MULTICAST_LOOP       = 34;              { i_char; set/get IP multicast loopback }
+        IP_ADD_MEMBERSHIP       = 35;               { ip_mreq; add an IP group membership }
+        IP_DROP_MEMBERSHIP      = 36;            { ip_mreq; drop an IP group membership }
+        IP_UNBLOCK_SOURCE       = 37;                 { ip_mreq_source: unblock data from source }
+        IP_BLOCK_SOURCE         = 38;              { ip_mreq_source: block data from source }
+        IP_ADD_SOURCE_MEMBERSHIP = 39;             { ip_mreq_source: join source group }
+        IP_DROP_SOURCE_MEMBERSHIP = 40;            { ip_mreq_source: leave source group }
+        IP_MSFILTER             = 41;
+        MCAST_JOIN_GROUP        = 42;    { group_req: join any-source group }
+        MCAST_BLOCK_SOURCE      = 43;    { group_source_req: block from given group }
+        MCAST_UNBLOCK_SOURCE    = 44;    { group_source_req: unblock from given group}
+        MCAST_LEAVE_GROUP       = 45;    { group_req: leave any-source group }
+        MCAST_JOIN_SOURCE_GROUP = 46;   { group_source_req: join source-spec gr }
+        MCAST_LEAVE_SOURCE_GROUP = 47;  { group_source_req: leave source-spec gr}
+        MCAST_MSFILTER          = 48;
+
+        MCAST_EXCLUDE           = 0;
+        MCAST_INCLUDE           = 1;
+
+        IP_ROUTER_ALERT         = 5;    { bool }
+        IP_PKTINFO              = 8;    { bool }
+        IP_PKTOPTIONS           = 9;
+        IP_PMTUDISC             = 10;    { obsolete name? }
+        IP_MTU_DISCOVER         = 10;   { int; see below }
+        IP_RECVERR              = 11;    { bool }
+        IP_RECVTTL              = 12;   { bool }
+        IP_RECVTOS              = 13;    { bool }
+
+
+{ IP_MTU_DISCOVER arguments.  }
+        IP_PMTUDISC_DONT        = 0;    { Never send DF frames.  }
+        IP_PMTUDISC_WANT        = 1;    { Use per route hints.  }
+        IP_PMTUDISC_DO          = 2;    { Always DF.  }
+
+{ To select the IP level.  }
+        SOL_IP                  = 0;
+
+        IP_DEFAULT_MULTICAST_TTL = 1;
+        IP_DEFAULT_MULTICAST_LOOP = 1;
+        IP_MAX_MEMBERSHIPS       = 20;
+
+
+{  Options for use with etsockopt' and etsockopt' at the IPv6 level.
+   The first word in the comment at the right is the data type used;
+   "bool" means a boolean value stored in an 	nt'.  }
+        IPV6_ADDRFORM         = 1;
+        IPV6_PKTINFO             = 2;
+        IPV6_HOPOPTS             = 3;
+        IPV6_DSTOPTS             = 4;
+        IPV6_RTHDR          = 5;
+        IPV6_RXSRCRT             = IPV6_RTHDR;
+        //this may be an old name, I couldn't find it in my include files but
+        //I found it with google.  It may have been depreciated because I only
+        //saw it in earlier files.
+        IPV6_PKTOPTIONS         = 6;
+        IPV6_CHECKSUM            = 7;
+        IPV6_HOPLIMIT            = 8;
+
+        SCM_SRCRT                = IPV6_RXSRCRT;
+
+        IPV6_NEXTHOP         = 9;
+        IPV6_AUTHHDR         = 10;
+        IPV6_UNICAST_HOPS        = 16;
+        IPV6_MULTICAST_IF     = 17;
+        IPV6_MULTICAST_HOPS     = 18;
+        IPV6_MULTICAST_LOOP      = 19;
+        IPV6_JOIN_GROUP             = 20;
+        IPV6_LEAVE_GROUP     = 21;
+        IPV6_ROUTER_ALERT     = 22;
+        IPV6_MTU_DISCOVER     = 23;
+        IPV6_MTU         = 24;
+        IPV6_RECVERR         = 25;
+        IPV6_V6ONLY         = 26;
+        IPV6_JOIN_ANYCAST     = 27;
+        IPV6_LEAVE_ANYCAST     = 28;
+        IPV6_IPSEC_POLICY     = 34;
+        IPV6_XFRM_POLICY     = 35;
+
+{ Obsolete synonyms for the above.  }
+        IPV6_ADD_MEMBERSHIP     = IPV6_JOIN_GROUP;
+        IPV6_DROP_MEMBERSHIP     = IPV6_LEAVE_GROUP;
+        IPV6_RXHOPOPTS         = IPV6_HOPOPTS;
+        IPV6_RXDSTOPTS           = IPV6_DSTOPTS;
+
+{ IPV6_MTU_DISCOVER values.  }
+        IPV6_PMTUDISC_DONT     = 0;    { Never send DF frames.  }
+        IPV6_PMTUDISC_WANT      = 1;    { Use per route hints.  }
+        IPV6_PMTUDISC_DO     = 2;    { Always DF.  }
+
+{ Socket level values for IPv6.  }
+        SOL_IPV6                 = 41;
+        SOL_ICMPV6               = 58;
+
+{ Routing header options for IPv6.  }
+        IPV6_RTHDR_LOOSE         = 0;   { Hop doesn't need to be neighbour. }
+        IPV6_RTHDR_STRICT     = 1;    { Hop must be a neighbour.  }
+
+        IPV6_RTHDR_TYPE_0        = 0;    { IPv6 Routing header type 0.  }

+ 2 - 56
rtl/objpas/classes/streams.inc

@@ -14,7 +14,6 @@
 {*                             TStream                                      *}
 {****************************************************************************}
 
-{$ifdef seek64bit}
   function TStream.GetPosition: Int64;
 
     begin
@@ -101,40 +100,6 @@
       Result:=Seek(longint(Offset),ord(Origin));
     end;
 
-{$else seek64bit}
-
-  function TStream.GetPosition: Longint;
-
-    begin
-       Result:=Seek(0,soFromCurrent);
-    end;
-
-  procedure TStream.SetPosition(Pos: Longint);
-
-    begin
-       Seek(pos,soFromBeginning);
-    end;
-
-  function TStream.GetSize: Longint;
-
-    var
-       p : longint;
-
-    begin
-       p:=GetPosition;
-       GetSize:=Seek(0,soFromEnd);
-       Seek(p,soFromBeginning);
-    end;
-
-  procedure TStream.SetSize(NewSize: Longint);
-
-    begin
-    // We do nothing. Pipe streams don't support this
-    // As wel as possible read-ony streams !!
-    end;
-
-{$endif seek64bit}
-
   procedure TStream.ReadBuffer(var Buffer; Count: Longint);
 
     begin
@@ -421,8 +386,6 @@ begin
   If Result=-1 then Result:=0;
 end;
 
-{$ifdef seek64bit}
-
 Procedure THandleStream.SetSize(NewSize: Longint);
 
 begin
@@ -443,21 +406,6 @@ begin
   Result:=FileSeek(FHandle,Offset,ord(Origin));
 end;
 
-{$else seek64bit}
-
-Procedure THandleStream.SetSize(NewSize: Longint);
-begin
-  FileTruncate(FHandle,NewSize);
-end;
-
-
-function THandleStream.Seek(Offset: Longint; Origin: Word): Longint;
-begin
-  Result:=FileSeek(FHandle,Offset,Origin);
-end;
-
-{$endif seek64bit}
-
 
 {****************************************************************************}
 {*                             TFileStream                                  *}
@@ -512,14 +460,12 @@ begin
   FSize:=ASize;
 end;
 
-{$ifdef seek64bit}
+
 function TCustomMemoryStream.GetSize: Int64;
 
 begin
   Result:=FSize;
 end;
-{$endif seek64bit}
-
 
 
 function TCustomMemoryStream.Read(var Buffer; Count: Longint): Longint;
@@ -738,7 +684,7 @@ begin
   Result:=Count;
   SetSize(FPosition+Count);
   // This supposes that FDataString is of type AnsiString)
-  Move (Buffer,PCHar(FDataString)[Fposition],Count);
+  Move (Buffer,PChar(FDataString)[Fposition],Count);
   FPosition:=FPosition+Count;
 end;
 

+ 15 - 4
rtl/unix/sysutils.pp

@@ -1083,7 +1083,19 @@ Function GetHomeDir : String;
 begin
   Result:=GetEnvironmentVariable('HOME');
   If (Result<>'') then
-  Result:=IncludeTrailingPathDelimiter(Result);
+    Result:=IncludeTrailingPathDelimiter(Result);
+end;
+
+{ Follows base-dir spec, 
+  see [http://freedesktop.org/Standards/basedir-spec].
+  Always ends with PathDelim. }
+Function XdgConfigHome : String;
+begin
+  Result:=GetEnvironmentVariable('XDG_CONFIG_HOME');
+  if (Result='') then
+    Result:=GetHomeDir + '.config/' 
+  else
+    Result:=IncludeTrailingPathDelimiter(Result);
 end;
 
 Function GetAppConfigDir(Global : Boolean) : String;
@@ -1092,7 +1104,7 @@ begin
   If Global then
     Result:=SysConfigDir
   else
-    Result:=GetHomeDir+ApplicationName;
+    Result:=XdgConfigHome + ApplicationName;
 end;
 
 Function GetAppConfigFile(Global : Boolean; SubDir : Boolean) : String;
@@ -1114,8 +1126,7 @@ begin
       end
     else
       begin
-      Result:=GetHomeDir;
-      Result:=Result+'.'+ApplicationName;
+      Result:=XdgConfigHome + ApplicationName + ConfigExtension;
       end;
     end;
 end;

+ 6 - 0
rtl/win32/wininc/redef.inc

@@ -176,6 +176,12 @@ function InitializeCriticalSectionAndSpinCount(var CriticalSection : TRTLCritica
 function SetCriticalSectionSpinCount(var CriticalSection : TRTLCriticalSection;dwSpinCount : DWORD ): DWORD; external 'kernel32' name 'SetCriticalSectionSpinCount';
 function TryEnterCriticalSection(var CriticalSection : TRTLCriticalSection) : BOOL; external 'kernel32' name 'TryEnterCriticalSection';
 
+
+
+function ControlService(hService:SC_HANDLE; dwControl:DWORD; var ServiceStatus:TSERVICESTATUS):WINBOOL; external 'advapi32' name 'ControlService';
+function QueryServiceStatus(hService:SC_HANDLE; var lpServiceStatus:TSERVICESTATUS):WINBOOL; external 'advapi32' name 'QueryServiceStatus';
+function SetServiceStatus(hServiceStatus:SERVICE_STATUS_HANDLE; const ServiceStatus:TSERVICESTATUS):WINBOOL; external 'advapi32' name 'SetServiceStatus';
+
 //function _lwrite(hFile: HFILE; const lpBuffer: LPCSTR; uBytes: UINT): UINT; external 'kernel32' name '_lwrite';
 //function AccessCheck(pSecurityDescriptor: PSecurityDescriptor; ClientToken: THandle; DesiredAccess: DWORD; const GenericMapping: TGenericMapping; var PrivilegeSet: TPrivilegeSet; var PrivilegeSetLength: DWORD; var GrantedAccess: DWORD;
 //  var AccessStatus: BOOL): BOOL; external 'advapi32' name 'AccessCheck';