Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / fpc-pascal / 2010-11

TReader.ReadProperty

6 messages · 4 people · –

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Fred Flinestone

hi all,

i am trying to replace the code from delphi to fpc where the code looks like:

TYPE THackReader =class(TReader);

...

    FReaderStream.Position := 0;
    {$IFDEF FPC}
    try
      FReader.ReadListBegin;
      while not FReader.EndOfList do begin
        THackReader(FReader).ReadProperty(Obj1);
      end;
      Freader.ReadListEnd;
    except
    end;
    {$ELSE}
    FReader.Position := 0;
    try
      while FReader.Position < FReaderStream.Size do
        THackReader(FReader).ReadProperty(Obj1);
    except
    end;
    {$ENDIF}

but my code in FPC raises an exception in ReadListBegin method and I am not sure if it is correct way to read back properties to Obj1.

PS: How can I debug TReader class, because debuger steps over my calls from TReader.

Thanx.

Fred.

Reply by email

Michael Van Canneyt
to Fred Flinestone
Fred Flinestone wrote 32 lines
hi all, i am trying to replace the code from delphi to fpc where the code looks like: TYPE THackReader =class(TReader); ... FReaderStream.Position := 0; {$IFDEF FPC} try FReader.ReadListBegin; while not FReader.EndOfList do begin THackReader(FReader).ReadProperty(Obj1); end; Freader.ReadListEnd; except end; {$ELSE} FReader.Position := 0; try while FReader.Position < FReaderStream.Size do THackReader(FReader).ReadProperty(Obj1); except end; {$ENDIF} but my code in FPC raises an exception in ReadListBegin method and I am not sure if it is correct way to read back properties to Obj1.

No, it is not. However, based on the sample code, it's not possible to give detailed advice. The above is already a Delphi hack - you can't expect it to work as-is in FPC.

In general, I would expect you to use DefineProperties.

PS: How can I debug TReader class, because debuger steps over my calls from TReader.

You must recompile the RTL with debug information, and then recompile your project.

Michael.

Reply by email

Roland Turčan - RoTurSoft
to Michael Van Canneyt
Michael Van Canneyt wrote 8 lines
PS: How can I debug TReader class, because debuger steps over my calls from > TReader. > You must recompile the RTL with debug information, and then recompile your project.

Thanks for answer, but please could you assist me how to build RTL with debug infos.

Thanks.

Best regards, TRoland http://www.rotursoft.sk

Reply by email

Michael Van Canneyt
to Fred Flinestone
Fred Flinestone wrote 11 lines
On Wed, Nov 3, 2010 at 9:17 AM, Michael Van Canneyt wrote: You must recompile the RTL with debug information, and then recompile your project. I am using Ubuntu 10.04 with create_fpc_deb.sh script to get FPC DEB package and this script doesn't have option to set OPT=-gl to build debug version. How can I build it then?

I don't know that, I have no experience with the .deb packaging, so I can't help there.

I use

make OPT=-gl all

in the sources directory. After that a 'make install' installs everything.

Michael.

Reply by email

Brian Winfrey
to Roland Turčan - RoTurSoft: On Wed, Nov 3, 2010 at 9:17 AM, Michael Van Canneyt Thanks for answer, but please could…

See post from about two weeks ago. "Building FPC with debug information"

Roland Turčan - RoTurSoft wrote 27 lines
On Wed, Nov 3, 2010 at 9:17 AM, Michael Van Canneyt wrote: >> >> PS: How can I debug TReader class, because debuger steps over my calls >> from >> TReader. > > You must recompile the RTL with debug information, and then recompile your > project. > Thanks for answer, but please could you assist me how to build RTL with debug infos. Thanks. -- Best regards, TRoland http://www.rotursoft.sk _______________________________________________ fpc-pascal maillist  -   http://lists.freepascal.org/mailman/listinfo/fpc-pascal

Reply by email