TurboPower_iPro: Remove Delphi specific defines and comments. Issue #37990, patch from Zaher Dirkey.

git-svn-id: trunk@64099 -
This commit is contained in:
juha 2020-11-02 10:04:43 +00:00
parent b5c82b66cd
commit 8fe85cc110
7 changed files with 249 additions and 550 deletions

View File

@ -29,7 +29,7 @@ type
TIpDefContentInfo = record TIpDefContentInfo = record
Typ : string; { content type, e.g. 'application' } Typ : string; { content type, e.g. 'application' }
Sub : string; { content subtype, e.g. 'octet-stream' } Sub : string; { content subtype, e.g. 'octet-stream' }
Enc : TIpMimeEncodingMethod; { encoding method, e.g. 'base64' } {!!.02} Enc : TIpMimeEncodingMethod; { encoding method, e.g. 'base64' }
end; end;
const const

View File

@ -33,181 +33,27 @@
so options specified here could be overridden by hardcoded so options specified here could be overridden by hardcoded
options in the unit source file.} options in the unit source file.}
{$IFDEF LCL} {$MODE DELPHI}{$H+}
{$DEFINE IP_LAZARUS}
{$ENDIF}
// Activate several features of the package by enabling the following DEFINEs.
{$IFDEF IP_LAZARUS} // Best flexibility is achieved by doing this in the "Additions and Overrides"
// of the Project options.
{$MODE DELPHI}{$H+}
{$DEFINE VERSION7} { Delphi 7.0 or higher }
{$DEFINE VERSION4}
{$DEFINE VERSION5}
{$DEFINE Version6OrHigher}
{$DEFINE Version7OrHigher}
// Activate several features of the package by enabling the following DEFINEs.
// Best flexibility is achieved by doing this in the "Additions and Overrides"
// of the Project options.
// Uncomment if you want to enable printing functionality
// (requires extra build/runtime dependencies for Linux like cairo,etc)
//{$DEFINE Html_print}
// Uncomment if you want to disable RTTI access to properties of the HTML nodes
//{$DEFINE Html_RTTI}
{$ELSE}
{====Compiler options that can be changed====}
{$A+ Force alignment on word/dword boundaries}
{$S- No stack checking}
{====Global fixed compiler options (do NOT change)====}
{$B- Incomplete boolean evaluation}
{$H+ Long string support}
{$J+ Writeable typed constants}
{$P- No open string parameters}
{$Q- No arithmetic overflow checking}
{$R- No range checking}
{$T- No type-checked pointers}
{$V- No var string checking}
{$X+ Extended syntax}
{$Z1 Enumerations are byte sized}
{====General defines=================================================}
{.$DEFINE UseGifImageUnit}
{$IFDEF VER110}
{.$DEFINE UseJPegUnit} {BCB3 does not include the JPeg unit by default}
{$ELSE}
{$DEFINE UseJPegUnit}
{$ENDIF}
// Define the following symbol to use the TIpAnimatedGIFImage class. To use
// this class, you must have Ander's TGIFImage.
{.$DEFINE AndersGIFImage }
// Define the following symbol to use the TIpAnimatedImageLibImage. To use
// this class, you must have the ImageLib ILWebImage component.
{.$DEFINE ImageLibGIFImage }
// Define this symbol to use the TIpPNGImage class. TIpPNGImage requires the
// ZLib library.
{$DEFINE UsePNGGraphic }
// !!.12 Define this symbol to exclude all support for HTTP and sockets in
// an application using the HTML panels, e.g. for HTML based wizards
{.$DEFINE HtmlWithoutHttp}
// Uncomment if you want to enable printing functionality // Uncomment if you want to enable printing functionality
//{$DEFINECSS_CASESENSITIVE_CLASSID}
//{$DEFINE IP_LAZARUS_DBG}
// (requires extra build/runtime dependencies for Linux like cairo,etc) // (requires extra build/runtime dependencies for Linux like cairo,etc)
{$DEFINE Html_print} //{$DEFINE Html_print}
// we do not want to include PNG support when building the design-time package // Uncomment if you want to disable RTTI access to properties of the HTML nodes
// (that would cause problems if another package also included ZLib). We also //{$DEFINE Html_RTTI}
// do not want to include units that aren't ours, so we'll undefine the other
// graphics stuff too. When rebuilding the design-time package, the
// 'BuildingDesignTime' define must be defined
{$IFDEF BuildingDesignTime}
{$UNDEF UseGifImageUnit}
{$UNDEF AndersGIFImage}
{$UNDEF ImageLibGIFImage}
{$UNDEF UsePNGGraphic}
{$DEFINE HtmlWithoutHttp}
{$ENDIF}
{-------- !! DO NOT CHANGE DEFINES BELOW THIS LINE !! --------} // TODO removing it from source code or enable it
//{$UNDEF UseGifImageUnit}
{ Compiler stoppers for unsupported compilers } //{$UNDEF AndersGIFImage}
//{$UNDEF ImageLibGIFImage}
{$IFDEF VER80} //{$UNDEF UsePNGGraphic}
!!! Internet Professional does not support Delphi 1 //{$DEFINE HtmlWithoutHttp}
{$ENDIF}
{$IFDEF VER90}
!!! Internet Professional does not support Delphi 2
{$ENDIF}
{$IFDEF VER93}
!!! Internet Professional does not support C++Builder 1
{$ENDIF}
{$DEFINE VERSION3} { Delphi 3.0 or BCB 3.0 or higher }
{ General define indicating use under C++ Builder }
{$IFDEF VER110} { C++ Builder 3 }
{$DEFINE CBuilder}
{$ObjExportAll On}
{$ENDIF}
{$IFDEF VER125} { C++ Builder 4 }
{$DEFINE CBuilder}
{$ObjExportAll On}
{$ENDIF}
{$IFDEF VER130} { Delphi 5 & C++ Builder 5 }
{$IFDEF BCB} { C++ Builder 5 }
{$DEFINE CBuilder}
{$ObjExportAll On}
{$ENDIF}
{$ENDIF}
{$IFDEF VER140} { Delphi 6 & C++Builder 6 }
{$IFDEF BCB} { C++ Builder 6}
{$DEFINE CBuilder}
{$ObjExportAll On}
{$ENDIF}
{$ENDIF}
{$IFDEF VERSION3}
{$IFNDEF VER100} { Delphi 3 }
{$IFNDEF VER110} { BCB 3 }
{$DEFINE VERSION4} { Delphi 4.0 or higher }
{$ENDIF}
{$ENDIF}
{$ENDIF}
{$IFDEF VERSION4}
{$IFNDEF VER120} { Delphi 4 }
{$IFNDEF VER125} { BCB 4 }
{$DEFINE VERSION5} { Delphi 5.0 or higher }
{$ENDIF}
{$ENDIF}
{$ENDIF}
{$IFDEF VERSION3}
{$IFNDEF VERSION4}
{$DEFINE VERSION3ONLY}
{$ENDIF}
{$ENDIF}
{$IFDEF VERSION3}
{$IFDEF VER140}
{$DEFINE VERSION6} { Delphi 6.0 or higher }
{$DEFINE Version6OrHigher}
{$ENDIF}
{$ENDIF}
{$IFDEF VERSION3}
{$IFDEF VER150}
{$DEFINE VERSION7} { Delphi 7.0 or higher }
{$DEFINE Version6OrHigher}
{$DEFINE Version7OrHigher}
{$ENDIF}
{$ENDIF}
{$IFDEF VERSION7}
{$WARN UNIT_PLATFORM OFF}
{$WARN UNSAFE_CODE OFF}
{$WARN UNSAFE_TYPE OFF}
{$WARN UNSAFE_CAST OFF}
{$WARN UNIT_DEPRECATED OFF}
{$ENDIF}
{$ENDIF}

View File

@ -105,7 +105,6 @@ type
TIpAbstractHtmlDataProvider = class; TIpAbstractHtmlDataProvider = class;
{.$DEFINE CSS_CASESENSITIVE_CLASSID}
{$DEFINE CSS_INTERFACE} {$DEFINE CSS_INTERFACE}
{$I ipcss.inc} {$I ipcss.inc}
{$UNDEF CSS_INTERFACE} {$UNDEF CSS_INTERFACE}
@ -2740,16 +2739,12 @@ type
property Align; property Align;
property ALinkColor; property ALinkColor;
property AllowTextSelect; property AllowTextSelect;
{$IFDEF VERSION4}
property Anchors; property Anchors;
{$ENDIF}
property BgColor; property BgColor;
property BorderSpacing; property BorderSpacing;
property BorderWidth; property BorderWidth;
property BorderStyle; property BorderStyle;
{$IFDEF VERSION4}
property Constraints; property Constraints;
{$ENDIF}
property DataProvider; property DataProvider;
property Enabled; property Enabled;
property FixedTypeface; property FixedTypeface;
@ -2773,12 +2768,8 @@ type
property VLinkColor; property VLinkColor;
property WantTabs; property WantTabs;
property OnClick; property OnClick;
{$IFDEF VERSION4}
property OnConstrainedResize; property OnConstrainedResize;
{$ENDIF}
{$IFDEF VERSION5}
property OnContextPopup; property OnContextPopup;
{$ENDIF}
property OnControlClick; property OnControlClick;
property OnControlClick2; property OnControlClick2;
property OnControlChange; property OnControlChange;
@ -3110,7 +3101,6 @@ begin
RegisterComponents('IPro', [TIpHtmlPanel]); RegisterComponents('IPro', [TIpHtmlPanel]);
end; end;
{$IFNDEF VERSION3ONLY}
type type
THtmlRadioButton = class(TRadioButton) THtmlRadioButton = class(TRadioButton)
protected protected
@ -3169,8 +3159,6 @@ begin
end; end;
*) *)
{$ENDIF}
function GetAlignmentForStr(str: string; function GetAlignmentForStr(str: string;
pDefault: TIpHtmlAlign = haDefault) : TIpHtmlAlign; pDefault: TIpHtmlAlign = haDefault) : TIpHtmlAlign;
var var
@ -3938,7 +3926,6 @@ begin
FMax := -1; FMax := -1;
end; end;
{ TIpHtmlNode } { TIpHtmlNode }
function TIpHtmlNode.GetHint: string; function TIpHtmlNode.GetHint: string;
@ -4186,7 +4173,7 @@ function GetPropertyValue(PI: PPropInfo; const AObject: TObject): string;
function GetPropType : PTypeInfo; function GetPropType : PTypeInfo;
begin begin
Result := PI.PropType{$IFDEF VERSION3}^{$ENDIF}; Result := PI.PropType;
end; end;
function GetIntegerProperty : string; function GetIntegerProperty : string;
@ -4224,11 +4211,7 @@ function GetPropertyValue(PI: PPropInfo; const AObject: TObject): string;
function GetVariantProperty : string; function GetVariantProperty : string;
begin begin
{$IFDEF FPC}
Result := AnsiString(GetVariantProp(AObject, PI)); Result := AnsiString(GetVariantProp(AObject, PI));
{$ELSE}
Result := GetVariantProp(AObject, PI);
{$ENDIF}
end; end;
function GetStringProperty : string; function GetStringProperty : string;
@ -4281,7 +4264,7 @@ procedure SetPropertyValueLow(PI: PPropInfo;
function GetPropType : PTypeInfo; function GetPropType : PTypeInfo;
begin begin
Result := PI.PropType{$IFDEF VERSION3}^{$ENDIF}; Result := PI.PropType;
end; end;
procedure SetIntegerProperty; procedure SetIntegerProperty;
@ -4296,9 +4279,7 @@ procedure SetPropertyValueLow(PI: PPropInfo;
procedure SetEnumProperty; procedure SetEnumProperty;
begin begin
{$IFDEF VERSION5}
SetEnumProp(AObject, PI, NewValue); SetEnumProp(AObject, PI, NewValue);
{$ENDIF}
end; end;
procedure SetFloatProperty; procedure SetFloatProperty;
@ -4316,9 +4297,7 @@ procedure SetPropertyValueLow(PI: PPropInfo;
procedure SetSetProperty; procedure SetSetProperty;
begin begin
{$IFDEF VERSION5}
SetSetProp(AObject, PI, NewValue); SetSetProp(AObject, PI, NewValue);
{$ENDIF}
end; end;
begin begin
@ -11616,11 +11595,7 @@ begin
end; end;
hitRadio : hitRadio :
begin begin
{$IFDEF VERSION3ONLY}
with FControl do
{$ELSE}
with THtmlRadioButton(FControl) do with THtmlRadioButton(FControl) do
{$ENDIF}
Checked := Self.Checked; Checked := Self.Checked;
end; end;
end; end;
@ -11708,18 +11683,10 @@ begin
end; end;
hitRadio : hitRadio :
begin begin
{$IFDEF VERSION3ONLY}
FControl := TRadioButton.Create(Parent);
{$ELSE}
FControl := THtmlRadioButton.Create(Parent); FControl := THtmlRadioButton.Create(Parent);
{$ENDIF}
FControl.Tag := PtrInt(OwnerForm); FControl.Tag := PtrInt(OwnerForm);
setCommonProperties; setCommonProperties;
{$IFDEF VERSION3ONLY}
with TRadioButton(FControl) do begin
{$ELSE}
with THtmlRadioButton(FControl) do begin with THtmlRadioButton(FControl) do begin
{$ENDIF}
Color := Brush.Color; Color := Brush.Color;
SetWidthHeight(1, 8, 0); SetWidthHeight(1, 8, 0);
Checked := Self.Checked; Checked := Self.Checked;
@ -11841,7 +11808,7 @@ begin
} }
inherited; inherited;
if (Props.BgColor <> clNone) and ( if (Props.BgColor <> clNone) and (
(FControl is {$IFDEF VERSION3ONLY}TRadioButton{$ELSE}THtmlRadioButton{$ENDIF}) or (FControl is THtmlRadioButton) or
(FControl is TCustomEdit)) then (FControl is TCustomEdit)) then
FControl.Color := Props.BgColor; FControl.Color := Props.BgColor;
end; end;
@ -11899,11 +11866,7 @@ begin
hitCheckbox : hitCheckbox :
Result := TCheckBox(FControl).Checked; Result := TCheckBox(FControl).Checked;
hitRadio : hitRadio :
{$IFDEF VERSION3ONLY}
Result := TRadioButton(FControl).Checked;
{$ELSE}
Result := THtmlRadioButton(FControl).Checked; Result := THtmlRadioButton(FControl).Checked;
{$ENDIF}
hitFile : hitFile :
Result := FFileEdit.Text <> ''; Result := FFileEdit.Text <> '';
hitHidden : hitHidden :
@ -11935,11 +11898,7 @@ begin
hitCheckbox : hitCheckbox :
Checked := TCheckBox(FControl).Checked; Checked := TCheckBox(FControl).Checked;
hitRadio : hitRadio :
{$IFDEF VERSION3ONLY}
Checked := TRadioButton(FControl).Checked;
{$ELSE}
Checked := THtmlRadioButton(FControl).Checked; Checked := THtmlRadioButton(FControl).Checked;
{$ENDIF}
end; end;
end; end;

View File

@ -114,18 +114,14 @@ function TIpHttpDataProvider.CheckURL(const AUrl: string;
var var
VAddrRec: TIpAddrRec; VAddrRec: TIpAddrRec;
begin begin
{$IFDEF VER2_6}
FillChar(VAddrRec, SizeOf(TIpAddrRec), 0);
{$ELSE}
VAddrRec := Default(TIpAddrRec); VAddrRec := Default(TIpAddrRec);
{$ENDIF}
Initialize(VAddrRec); Initialize(VAddrRec);
try try
IpParseURL(AUrl, VAddrRec); IpParseURL(AUrl, VAddrRec);
FDocumment.Clear; FDocumment.Clear;
FClient.Get(AUrl, FDocumment); FClient.Get(AUrl, FDocumment);
Result := (FClient.ResponseStatusCode = 200) Result := (FClient.ResponseStatusCode = 200)
{$IF FPC_FULLVERSION > 30000}or FClient.IsRedirect(FClient.ResponseStatusCode){$ENDIF}; or FClient.IsRedirect(FClient.ResponseStatusCode);
if Result then if Result then
begin begin
FContentType := AllTrimSpaces(FClient.ResponseHeaders.Values['Content-Type']); FContentType := AllTrimSpaces(FClient.ResponseHeaders.Values['Content-Type']);

File diff suppressed because it is too large Load Diff

View File

@ -157,7 +157,7 @@ type
constructor CreateEmpty; constructor CreateEmpty;
destructor Destroy; override; destructor Destroy; override;
procedure Flush; {!!.12} procedure Flush;
{ Flush any unwritten changes to the stream. } { Flush any unwritten changes to the stream. }
procedure FreeStream; procedure FreeStream;
function ReadChar(var aCh : AnsiChar) : Boolean; function ReadChar(var aCh : AnsiChar) : Boolean;
@ -211,7 +211,7 @@ type
destructor Destroy; override; destructor Destroy; override;
function AtEndOfStream : Boolean; function AtEndOfStream : Boolean;
procedure bsInitForNewStream; override; {!!.01} procedure bsInitForNewStream; override;
function ReadLine : string; function ReadLine : string;
function ReadLineArray(aCharArray : PAnsiChar; aLen : Longint) : Longint; function ReadLineArray(aCharArray : PAnsiChar; aLen : Longint) : Longint;
function ReadLineZ(aSt : PAnsiChar; aMaxLen : Longint) : PAnsiChar; function ReadLineZ(aSt : PAnsiChar; aMaxLen : Longint) : PAnsiChar;
@ -725,7 +725,6 @@ begin
raise EIpBaseException.Create(SCannotWriteToStream); raise EIpBaseException.Create(SCannotWriteToStream);
FDirty := false; FDirty := false;
end; end;
{Begin !!.12}
{-----------------------------------------------------------------------------} {-----------------------------------------------------------------------------}
@ -734,7 +733,6 @@ begin
if FDirty then if FDirty then
bsWriteToStream; bsWriteToStream;
end; end;
{End !!.12}
{-----------------------------------------------------------------------------} {-----------------------------------------------------------------------------}
@ -1482,7 +1480,6 @@ end;
{-----------------------------------------------------------------------------} {-----------------------------------------------------------------------------}
procedure TIpAnsiTextStream.WriteLine(const aSt : string); procedure TIpAnsiTextStream.WriteLine(const aSt : string);
{Rewritten !!.15}
begin begin
if Length(aSt) > 0 then if Length(aSt) > 0 then
WriteLineArray(@aSt[1], length(aSt)) WriteLineArray(@aSt[1], length(aSt))
@ -1555,11 +1552,7 @@ begin
FHandle := THandle(FileOpen(FFileName, fmShareDenyNone + fmOpenReadWrite)); FHandle := THandle(FileOpen(FFileName, fmShareDenyNone + fmOpenReadWrite));
if (Handle = IpFileOpenFailed) then if (Handle = IpFileOpenFailed) then
{$IFDEF Version6OrHigher} RaiseLastOSError;
RaiseLastOSError;
{$ELSE}
RaiseLastWin32Error;
{$ENDIF}
end; end;
destructor TIpDownloadFileStream.Destroy; destructor TIpDownloadFileStream.Destroy;
@ -1585,7 +1578,7 @@ begin
raise EIpBaseException.Create(SBadPath); raise EIpBaseException.Create(SBadPath);
{ Create a new uniquely named file in that folder. } { Create a new uniquely named file in that folder. }
FFileName := GetTemporaryFile(FPath); {!!.12} FFileName := GetTemporaryFile(FPath);
end; end;
function TIpDownloadFileStream.Read(var Buffer; Count : Longint) : Longint; function TIpDownloadFileStream.Read(var Buffer; Count : Longint) : Longint;
@ -1618,14 +1611,8 @@ begin
{calculate the full new name} {calculate the full new name}
NewFullName := FPath + '\' + aNewName; NewFullName := FPath + '\' + aNewName;
{rename the file} {rename the file}
{$IFDEF Version6OrHigher} if not RenameFile(FFileName, NewFullName) then
{$IFNDEF IP_LAZARUS} //TODO need review
if not MoveFile(PAnsiChar(FFileName), PAnsiChar(NewFullName)) then
RaiseLastOSError; RaiseLastOSError;
{$ENDIF}
{$ELSE}
Win32Check(MoveFile(PAnsiChar(FFileName), PAnsiChar(NewFullName)));
{$ENDIF}
{open up the same file, but with its new name} {open up the same file, but with its new name}
FFileName := NewFullName; FFileName := NewFullName;
try try
@ -1635,11 +1622,7 @@ begin
end; end;
if (Handle = IpFileOpenFailed) then if (Handle = IpFileOpenFailed) then
{$IFDEF Version6OrHigher}
RaiseLastOSError; RaiseLastOSError;
{$ELSE}
RaiseLastWin32Error;
{$ENDIF}
FRenamed := true; FRenamed := true;
end; end;
@ -1650,16 +1633,9 @@ begin
{close the current handle} {close the current handle}
//CloseHandle(Handle); //CloseHandle(Handle);
FHandle := IpFileOpenFailed; FHandle := IpFileOpenFailed;
{copy the file} {!!.01} {copy the file}
{$IFDEF Version6OrHigher} if not RenameFile(FFileName, aNewName) then
{$IFNDEF IP_LAZARUS} //TODO Need review
if not CopyFile(PAnsiChar(FFileName), PAnsiChar(aNewName), False) then
RaiseLastOSError; RaiseLastOSError;
{$ENDIF}
{$ELSE}
Win32Check(CopyFile(PAnsiChar(FFileName), {!!.01}
PAnsiChar(aNewName), False)); {!!.01}
{$ENDIF}
{open up the same file, but with its new name} {open up the same file, but with its new name}
FFileName := aNewName; FFileName := aNewName;
@ -1670,11 +1646,7 @@ begin
end; end;
if (Handle = IpFileOpenFailed) then if (Handle = IpFileOpenFailed) then
{$IFDEF Version6OrHigher}
RaiseLastOSError; RaiseLastOSError;
{$ELSE}
RaiseLastWin32Error;
{$ENDIF}
FRenamed := true; FRenamed := true;
end; end;

View File

@ -1156,7 +1156,7 @@ end;
function IpParseURL(const URL : string; var Rslt : TIpAddrRec) : Boolean; function IpParseURL(const URL : string; var Rslt : TIpAddrRec) : Boolean;
{ Splits URL into components } { Splits URL into components }
{!!.03 -- rewritten { -- rewritten
- Parsing UserName and Password fields out of Mailto: urls of the form: - Parsing UserName and Password fields out of Mailto: urls of the form:
mailto:user:pass@myserver.net mailto:user:pass@myserver.net
- Username and Password fields added to TIpAddrRec in support of - Username and Password fields added to TIpAddrRec in support of
@ -2020,7 +2020,7 @@ Canonical Internet header date strings are in one of three standard formats:
Sun Nov 6 08:49:37 1994 ; ANSI C's asctime() format Sun Nov 6 08:49:37 1994 ; ANSI C's asctime() format
} }
{!!.03 -- rewritten to handle common variants such as the Day or Month name {-- rewritten to handle common variants such as the Day or Month name
to be fully spelled out where they are not in the canonical form, or to have to be fully spelled out where they are not in the canonical form, or to have
a 4 digit year in the RFC 850 style a 4 digit year in the RFC 850 style
} }
@ -2668,13 +2668,11 @@ begin
Result:=DirPathExists(Dir); Result:=DirPathExists(Dir);
end; end;
{Begin !!.12}
{ Get temporary filename as string } { Get temporary filename as string }
function GetTemporaryFile(const Path : string) : string; function GetTemporaryFile(const Path : string) : string;
begin begin
Result:=GetTempFileNameUTF8(Path,'IP_'); Result:=GetTempFileNameUTF8(Path,'IP_');
end; end;
{End !!.12}
{ Get Windows system TEMP path in a string } { Get Windows system TEMP path in a string }
function GetTemporaryPath: string; function GetTemporaryPath: string;