mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-09-09 21:49:18 +02:00
* Patch from Dariusz Mazur to fix compilation with Delphi
git-svn-id: trunk@13602 -
This commit is contained in:
parent
ec8364904c
commit
612d58c80f
@ -43,6 +43,10 @@ uses
|
||||
// -------------------------------------------------------
|
||||
// DOMException
|
||||
// -------------------------------------------------------
|
||||
{$ifndef fpc}
|
||||
type
|
||||
tFpList = tList;
|
||||
{$endif}
|
||||
|
||||
const
|
||||
|
||||
@ -101,6 +105,8 @@ type
|
||||
TDOMAttrDef = class;
|
||||
PNodePool = ^TNodePool;
|
||||
TNodePool = class;
|
||||
TTabNodePool = array[0..0] of TNodePool;
|
||||
PTabNodePool = ^TTabNodePool;
|
||||
|
||||
|
||||
// -------------------------------------------------------
|
||||
@ -430,7 +436,7 @@ type
|
||||
FEmptyNode: TDOMElement;
|
||||
FNodeLists: THashTable;
|
||||
FMaxPoolSize: Integer;
|
||||
FPools: PNodePool;
|
||||
FPools: PTabNodePool;
|
||||
FDocumentURI: DOMString;
|
||||
function GetDocumentElement: TDOMElement;
|
||||
function GetDocType: TDOMDocumentType;
|
||||
@ -3167,24 +3173,24 @@ var
|
||||
sz: Integer;
|
||||
begin
|
||||
ext := FCurrExtent;
|
||||
ptr := Pointer(FCurrBlock) + FElementSize;
|
||||
ptrInt(ptr) := ptrInt(FCurrBlock) + FElementSize;
|
||||
sz := FCurrExtentSize;
|
||||
while Assigned(ext) do
|
||||
begin
|
||||
// call destructors for everyone still there
|
||||
ptr_end := Pointer(ext) + sizeof(TExtent) + (sz - 1) * FElementSize;
|
||||
while ptr <= ptr_end do
|
||||
ptrInt(ptr_end) := ptrInt(ext) + sizeof(TExtent) + (sz - 1) * FElementSize;
|
||||
while ptrInt(ptr) <= ptrInt(ptr_end) do
|
||||
begin
|
||||
if TDOMNode(ptr).FPool = Self then
|
||||
TObject(ptr).Destroy;
|
||||
Inc(ptr, FElementSize);
|
||||
Inc(ptrInt(ptr), FElementSize);
|
||||
end;
|
||||
// dispose the extent and pass to the next one
|
||||
next := ext^.Next;
|
||||
FreeMem(ext);
|
||||
ext := next;
|
||||
sz := sz div 2;
|
||||
ptr := Pointer(ext) + sizeof(TExtent);
|
||||
ptrInt(ptr) := ptrInt(ext) + sizeof(TExtent);
|
||||
end;
|
||||
inherited Destroy;
|
||||
end;
|
||||
@ -3194,13 +3200,13 @@ var
|
||||
ext: PExtent;
|
||||
begin
|
||||
Assert((FCurrExtent = nil) or
|
||||
(Pointer(FCurrBlock) = Pointer(FCurrExtent) + sizeof(TExtent)));
|
||||
(ptrInt(FCurrBlock) = ptrInt(FCurrExtent) + sizeof(TExtent)));
|
||||
Assert(AElemCount > 0);
|
||||
|
||||
GetMem(ext, sizeof(TExtent) + AElemCount * FElementSize);
|
||||
ext^.Next := FCurrExtent;
|
||||
// point to the beginning of the last block of extent
|
||||
FCurrBlock := TDOMNode(Pointer(ext) + sizeof(TExtent) + (AElemCount - 1) * FElementSize);
|
||||
FCurrBlock := TDOMNode(ptrInt(ext) + sizeof(TExtent) + (AElemCount - 1) * FElementSize);
|
||||
FCurrExtent := ext;
|
||||
FCurrExtentSize := AElemCount;
|
||||
end;
|
||||
@ -3214,7 +3220,7 @@ begin
|
||||
end
|
||||
else
|
||||
begin
|
||||
if Pointer(FCurrBlock) = Pointer(FCurrExtent) + sizeof(TExtent) then
|
||||
if ptrInt(FCurrBlock) = ptrInt(FCurrExtent) + sizeof(TExtent) then
|
||||
AddExtent(FCurrExtentSize * 2);
|
||||
Result := FCurrBlock;
|
||||
Dec(PChar(FCurrBlock), FElementSize);
|
||||
|
@ -14,14 +14,20 @@
|
||||
**********************************************************************}
|
||||
unit xmlutils;
|
||||
|
||||
{$mode objfpc}
|
||||
{$H+}
|
||||
{$ifdef fpc}
|
||||
{$MODE objfpc}{$H+}
|
||||
{$endif}
|
||||
|
||||
interface
|
||||
|
||||
uses
|
||||
SysUtils;
|
||||
|
||||
{$IFNDEF FPC}
|
||||
|
||||
type ptrint=integer;
|
||||
{$ENDIF}
|
||||
|
||||
function IsXmlName(const Value: WideString; Xml11: Boolean = False): Boolean; overload;
|
||||
function IsXmlName(Value: PWideChar; Len: Integer; Xml11: Boolean = False): Boolean; overload;
|
||||
function IsXmlNames(const Value: WideString; Xml11: Boolean = False): Boolean;
|
||||
@ -38,6 +44,7 @@ function WStrLIComp(S1, S2: PWideChar; Len: Integer): Integer;
|
||||
{ a simple hash table with WideString keys }
|
||||
|
||||
type
|
||||
PTabPHashItem = ^TTabPHashItem;
|
||||
PPHashItem = ^PHashItem;
|
||||
PHashItem = ^THashItem;
|
||||
THashItem = record
|
||||
@ -46,6 +53,7 @@ type
|
||||
Next: PHashItem;
|
||||
Data: TObject;
|
||||
end;
|
||||
TTabPHashItem = array[0..0] of pHashItem;
|
||||
|
||||
THashForEach = function(Entry: PHashItem; arg: Pointer): Boolean;
|
||||
|
||||
@ -53,7 +61,7 @@ type
|
||||
private
|
||||
FCount: LongWord;
|
||||
FBucketCount: LongWord;
|
||||
FBucket: PPHashItem;
|
||||
FBucket: PTabPHashItem;
|
||||
FOwnsObjects: Boolean;
|
||||
function Lookup(Key: PWideChar; KeyLength: Integer; var Found: Boolean; CanCreate: Boolean): PHashItem;
|
||||
procedure Resize(NewCapacity: LongWord);
|
||||
@ -82,12 +90,15 @@ type
|
||||
lname: PWideChar;
|
||||
lnameLen: Integer;
|
||||
end;
|
||||
PTabExpHashEntry = ^TTabExpHashEntry;
|
||||
tTabExpHashEntry = array[0..0] of TExpHashEntry;
|
||||
|
||||
|
||||
TDblHashArray = class(TObject)
|
||||
private
|
||||
FSizeLog: Integer;
|
||||
FRevision: LongWord;
|
||||
FData: PExpHashEntry;
|
||||
FData: PTabExpHashEntry;
|
||||
public
|
||||
procedure Init(NumSlots: Integer);
|
||||
function Locate(uri: PWideString; localName: PWideChar; localLength: Integer): Boolean;
|
||||
@ -347,7 +358,11 @@ end;
|
||||
|
||||
function KeyCompare(const Key1: WideString; Key2: Pointer; Key2Len: Integer): Boolean;
|
||||
begin
|
||||
{$IFDEF FPC}
|
||||
Result := (Length(Key1)=Key2Len) and (CompareWord(Pointer(Key1)^, Key2^, Key2Len) = 0);
|
||||
{$ELSE}
|
||||
Result := comparemem(Pointer(Key1),key2,key2len*2);
|
||||
{$ENDIF}
|
||||
end;
|
||||
|
||||
{ THashTable }
|
||||
@ -461,7 +476,8 @@ end;
|
||||
|
||||
procedure THashTable.Resize(NewCapacity: LongWord);
|
||||
var
|
||||
p, chain: PPHashItem;
|
||||
p : PTabPHashItem;
|
||||
chain: PPHashItem;
|
||||
i: Integer;
|
||||
e, n: PHashItem;
|
||||
begin
|
||||
|
@ -17,8 +17,10 @@
|
||||
|
||||
unit XMLWrite;
|
||||
|
||||
{$MODE objfpc}
|
||||
{$H+}
|
||||
|
||||
{$ifdef fpc}
|
||||
{$MODE objfpc}{$H+}
|
||||
{$endif}
|
||||
|
||||
interface
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user