Results 1 to 4 of 4

Thread: Phoenix with Delphi 6.

  1. #1

    Phoenix with Delphi 6.

    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 ?
    Check out my Delphi programs, music and writing.
    <br />http://digitalfunnybone.com/Programming.html

  2. #2

    Phoenix with Delphi 6.

    http://www.pascalgamedevelopment.com...r=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}

  3. #3

    Phoenix with Delphi 6.

    PosEx is defined as
    Code:
    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.
    Amnoxx

    Oh, and this code appears to be an approximate replacement for return(random() & 0x01);

    Phoenix Wiki
    http://www.phoenixlib.net/

    Phoenix Forum
    http://www.pascalgamedevelopment.com/viewforum.php?f=71

  4. #4

    Phoenix with Delphi 6.

    Quote Originally Posted by Andreaz
    PosEx is defined as
    Code:
    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
    Check out my Delphi programs, music and writing.
    <br />http://digitalfunnybone.com/Programming.html

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •