PDA

View Full Version : Phoenix with Delphi 6.



Bones
26-09-2007, 05:55 PM
Hi .
I was trying to compile a Phoenix package for delphi 6.
The first problem I ran into was that the function 'PosEx' does not seem to exist in D6, I have BDS2006 too , and could probrably use the, but I was hoping to get it working in D6 ..

Any ideas ?

loriendesign
26-09-2007, 11:18 PM
http://www.pascalgamedevelopment.com/viewtopic.php?t=4750&postdays=0&postorder=asc&start=15

In phxLogger.pas starting at line 315 it should read:

{$IFDEF FPC}
{$IFDEF VER1}
WriteLn(FLogFile, ' <compiler>Free Pascal 1.x.x</compiler>');
{$ELSIF VER1_0}
WriteLn(FLogFile, ' <compiler>Free Pascal 1.x.x</compiler>');
{$ELSE}
WriteLn(FLogFile, ' <compiler>Free Pascal</compiler>');
{$ENDIF}
{$ELSE}
{$IFDEF VER180}
WriteLn(FLogFile, ' <compiler>Delphi 2006</compiler>');
{$ELSEIF VER170}
WriteLn(FLogFile, ' <compiler>Delphi 2006</compiler>');
{$ELSEIF VER160}
WriteLn(FLogFile, ' <compiler>Delphi 8</compiler>');
{$ELSEIF VER150}
WriteLn(FLogFile, ' <compiler>Delphi 7</compiler>');
{$ELSEIF VER140}
WriteLn(FLogFile, ' <compiler>Delphi 6</compiler>');
{$ELSEIF VER130}
WriteLn(FLogFile, ' <compiler>Delphi 5</compiler>');
{$ELSE}
WriteLn(FLogFile, ' <compiler>Delphi</compiler>');
{$IFEND}
{$ENDIF}

Andreaz
27-09-2007, 05:53 AM
PosEx is defined as


function PosEx&#40;const SubStr, S&#58; string; Offset&#58; Cardinal = 1&#41;&#58; Integer;
var
I,X&#58; Integer;
Len, LenSubStr&#58; Integer;
begin
if Offset = 1 then
Result &#58;= Pos&#40;SubStr, S&#41;
else
begin
I &#58;= Offset;
LenSubStr &#58;= Length&#40;SubStr&#41;;
Len &#58;= Length&#40;S&#41; - LenSubStr + 1;
while I <= Len do
begin
if S&#91;I&#93; = SubStr&#91;1&#93; then
begin
X &#58;= 1;
while &#40;X < LenSubStr&#41; and &#40;S&#91;I + X&#93; = SubStr&#91;X + 1&#93;&#41; do
Inc&#40;X&#41;;
if &#40;X = LenSubStr&#41; then
begin
Result &#58;= I;
exit;
end;
end;
Inc&#40;I&#41;;
end;
Result &#58;= 0;
end;
end;


in delphi 7, it search for a string in a string with a start offset.

Bones
27-09-2007, 06:48 AM
PosEx is defined as


function PosEx&#40;const SubStr, S&#58; string; Offset&#58; Cardinal = 1&#41;&#58; Integer;
var
I,X&#58; Integer;
Len, LenSubStr&#58; Integer;
begin
if Offset = 1 then
Result &#58;= Pos&#40;SubStr, S&#41;
else
begin
I &#58;= Offset;
LenSubStr &#58;= Length&#40;SubStr&#41;;
Len &#58;= Length&#40;S&#41; - LenSubStr + 1;
while I <= Len do
begin
if S&#91;I&#93; = SubStr&#91;1&#93; then
begin
X &#58;= 1;
while &#40;X < LenSubStr&#41; and &#40;S&#91;I + X&#93; = SubStr&#91;X + 1&#93;&#41; do
Inc&#40;X&#41;;
if &#40;X = LenSubStr&#41; then
begin
Result &#58;= I;
exit;
end;
end;
Inc&#40;I&#41;;
end;
Result &#58;= 0;
end;
end;


in delphi 7, it search for a string in a string with a start offset.

Excellent..

I couldn't find the source for that anywhere, I'll include it in my dclUser package . thanks andreaz