Re: [fpc-pascal] TReader.ReadProperty

2010-11-03 Thread Michael Van Canneyt



On Wed, 3 Nov 2010, Fred Flinestone wrote:


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.
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal


[fpc-pascal] Endian issues when porting FPC programs from x86 to other platforms

2010-11-03 Thread _-jane-_
Hello!

In order to address the endian problem I use some auxiliary types to access the 
entities:

(* Standard types *)
type
  t_32u=longint;  // 32 bit unsigned
  t_bool=boolean;

(* Endian types *)
(*$a1 *)
type
  t_intel_32u=object  // Delphi forbids "packed object"; trusting $a1 instead...
value: t_32u;

procedure assign(q:t_32u);
procedure do_add(q:t_32u);
procedure do_sub(q:t_32u);
procedure do_or(q:t_32u);
procedure do_and(q:t_32u);
procedure do_xor(q:t_32u);
procedure do_and_not(q:t_32u);
procedure do_not;
function is_equal(const q:t_intel_32u):t_bool;
    end;

  t_motorola_32u=object
  private
x: packed array [0..4-1] of t_8u;  // or t_32u
  public
function value:t_32u;
procedure assign(q:t_32u);
procedure do_add(q:t_32u);
procedure do_sub(q:t_32u);
procedure do_or(q:t_32u);
procedure do_and(q:t_32u);
procedure do_xor(q:t_32u);
procedure do_and_not(q:t_32u);
procedure do_not;
function is_equal(const q:t_motorola_32u):t_bool;
    end;

The corresponding code has some ifdefs. I then use these types to build my 
exchange types such as:

type
  t_my_record=packed record
   a,b: t_motorola_32u;
   c: packed array [0..8-1] of t_motorola_32u;
   end;

The interface for all these types is more or less the same.
In the application I always read the values via "value" and write them via 
"assign".
All exchange types should be packed records with only such types.
BTW: I often use t_motorola_24u to access ASPI stuff...

Jasper
PS: Wouldn't it make sense to have such types in a standard library for FPC?
___
WEB.DE DSL Doppel-Flat ab 19,99 €/mtl.! Jetzt auch mit 
gratis Notebook-Flat! http://produkte.web.de/go/DSL_Doppel_Flatrate/2
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] Re: Endian issues when porting FPC programs from x86 to other platforms

2010-11-03 Thread Bernd Mueller

Jonas Maebe wrote:

On 02 Nov 2010, at 21:39, Felipe Monteiro de Carvalho wrote:


On Tue, Nov 2, 2010 at 7:04 PM, Bo Berglund  wrote:

Thanks, that helps a lot! Are there also overloaded BEtoN functions
for floating point values?

I think that single and double have always the same binary layout.


That's incorrect, their endianess changes in the same way as that of integer 
data (except on ARM when using the FPA floating point unit, which uses its own 
special byte ordering).


on ARM/OABI with double precision Netwinder FPE it is little endian with 
low and high dwords swapped.


Regards, Bernd.

___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] Re: Endian issues when porting FPC programs from x86 to other platforms

2010-11-03 Thread Thomas Schatzl
Hi,

On Tue, 02 Nov 2010 23:49:03 +0100, Bo Berglund 
wrote:
> On Tue, 02 Nov 2010 22:53:21 +0100, Vinzent Höfler
>  wrote:
> 
>>On Tue, 02 Nov 2010 21:39:31 +0100, Felipe Monteiro de Carvalho  
>> wrote:
>>
>>> On Tue, Nov 2, 2010 at 7:04 PM, Bo Berglund   
>>> wrote:
 Thanks, that helps a lot! Are there also overloaded BEtoN functions
 for floating point values?
>>>
>>> I think that single and double have always the same binary layout.
>>
>>Mostly, I'd guess. But I wouldn't count on that.
>>
> I know for sure that on the Motorola system the floats are 4 bytes
> (single precision) and have to be swapped in order to be used on
> Windows. I have done it on Delphi already so I know this is a fact.
> So now I need to find an endian corrector working with floating point
> values as well...

Coming back to the suggestion from jonas:

function BEtoN(const AValue : single) : single;
type
  TData = packed record
case integer of
  0 : (s : single);
  1 : (l : longint);
  end;
var
  d : TData;
begin
  d.s := AValue;
  d.l := system.BEtoN(d.l);
  result := d.s;
end;

A BEtoN function for doubles is similar, just replace the single type by
double, and longint by int64.

Hth,
  Thomas

___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal


[fpc-pascal] Cross-Compiling win32 -> Linux 64, how to get the cross compiler ?

2010-11-03 Thread Julien Devillers
Hello

 

I'm working on a project which cross compile from win32 to linux64.
Today it uses FPC-2.1.5.

I need to move to fpc 2.4.0.

I downloaded fpc-2.4.0.i386-win32.exe and after some attemps, I
understood that I did not have everything 

to cross compile (units dir and some exes). I tried with
fpc-2.4.0.x86_64-win64.exe but this did not solve the 

problem.

 

I tried to build everything from scratch with fpc source code, but I did
not find the correct make target.

How should I do ?

 

regards

Julien

___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal

Re: [fpc-pascal] Cross-Compiling win32 -> Linux 64, how to get the cross compiler ?

2010-11-03 Thread Jonas Maebe


On 03 Nov 2010, at 13:55, Julien Devillers wrote:

I tried to build everything from scratch with fpc source code, but I  
did

not find the correct make target.

How should I do ?


make OS_TARGET=linux CPU_TARGET=x86_64 clean all


Jonas
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] TReader.ReadProperty

2010-11-03 Thread Fred Flinestone
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?

Thanks, F.
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal

Re: [fpc-pascal] TReader.ReadProperty

2010-11-03 Thread Michael Van Canneyt



On Wed, 3 Nov 2010, Fred Flinestone wrote:




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.
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal


RE: [fpc-pascal] Cross-Compiling win32 -> Linux 64, how to get the cross compiler ?

2010-11-03 Thread Julien Devillers

-Message d'origine-
De : fpc-pascal-boun...@lists.freepascal.org 
[mailto:fpc-pascal-boun...@lists.freepascal.org] De la part de Jonas Maebe
Envoyé : mercredi 3 novembre 2010 14:01
À : FPC-Pascal users discussions
Objet : Re: [fpc-pascal] Cross-Compiling win32 -> Linux 64,how to get the cross 
compiler ?


On 03 Nov 2010, at 13:55, Julien Devillers wrote:

> I tried to build everything from scratch with fpc source code, but I  
> did
> not find the correct make target.
>
> How should I do ?

make OS_TARGET=linux CPU_TARGET=x86_64 clean all


Jonas



Hello Jonas

Thanks for your answer.
If I do that, I have a error on :
x86_64-linux-as --64 -o 
D:/tmp/partage/fpc-2.4.0.source/fpc-2.4.0/rtl/units/x86_64-linux/prt0.o 
x86_64/prt0.as

The file x86_64-linux-as does not exists on my system.

Julien
 

__ Information provenant d'ESET NOD32 Antivirus, version de la base des 
signatures de virus 5588 (20101103) __

Le message a été vérifié par ESET NOD32 Antivirus.

http://www.eset.com
 
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal


RE: [fpc-pascal] Cross-Compiling win32 -> Linux 64, how to get the cross compiler ?

2010-11-03 Thread Julien Devillers

-Message d'origine-
De : fpc-pascal-boun...@lists.freepascal.org 
[mailto:fpc-pascal-boun...@lists.freepascal.org] De la part de Julien Devillers
Envoyé : mercredi 3 novembre 2010 17:27
À : FPC-Pascal users discussions
Objet : RE: [fpc-pascal] Cross-Compiling win32 -> Linux 64,how to get the cross 
compiler ?


-Message d'origine-
De : fpc-pascal-boun...@lists.freepascal.org 
[mailto:fpc-pascal-boun...@lists.freepascal.org] De la part de Jonas Maebe
Envoyé : mercredi 3 novembre 2010 14:01
À : FPC-Pascal users discussions
Objet : Re: [fpc-pascal] Cross-Compiling win32 -> Linux 64,how to get the cross 
compiler ?


On 03 Nov 2010, at 13:55, Julien Devillers wrote:

> I tried to build everything from scratch with fpc source code, but I  
> did
> not find the correct make target.
>
> How should I do ?

make OS_TARGET=linux CPU_TARGET=x86_64 clean all


Jonas



Hello Jonas

Thanks for your answer.
If I do that, I have a error on :
x86_64-linux-as --64 -o 
D:/tmp/partage/fpc-2.4.0.source/fpc-2.4.0/rtl/units/x86_64-linux/prt0.o 
x86_64/prt0.as

The file x86_64-linux-as does not exists on my system.

Julien
 

-

Ok, I Found them. 

thanks
Julien
 

__ Information provenant d'ESET NOD32 Antivirus, version de la base des 
signatures de virus 5588 (20101103) __

Le message a été vérifié par ESET NOD32 Antivirus.

http://www.eset.com
 
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal


[fpc-pascal] looking for a book - "XLIB Programming Manual Rel.5 Volume One"

2010-11-03 Thread Graeme Geldenhuys
Hi,

Anybody know where I can purchase this book in paper or eBook format? I
emailed O'Reilly Customer Support, and they told me the book is out of
print and they don't have an eBook version. I'm located in South Africa, so
I would need a supplier that will be willing to ship to here too (if it is
in paper format). If I can choose, I would prefer a ebook format though.



XLIB Programming Manual, Rel. 5 Volume One, Third Edition
Print ISBN:
978-1-56592-002-6
ISBN 10:
1-56592-002-3



Regards,
  - Graeme -

-- 
fpGUI Toolkit - a cross-platform GUI toolkit using Free Pascal
http://opensoft.homeip.net:8080/fpgui/

___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] looking for a book - "XLIB Programming Manual Rel.5 Volume One"

2010-11-03 Thread Marten Feldtmann
They seem to be (in used condition) available via amazon (as I looked 
today).


Marten


Am 04.11.2010 07:20, schrieb Graeme Geldenhuys:

Hi,

Anybody know where I can purchase this book in paper or eBook format? I
emailed O'Reilly Customer Support, and they told me the book is out of
print and they don't have an eBook version. I'm located in South Africa, so
I would need a supplier that will be willing to ship to here too (if it is
in paper format). If I can choose, I would prefer a ebook format though.



XLIB Programming Manual, Rel. 5 Volume One, Third Edition
Print ISBN:
 978-1-56592-002-6
ISBN 10:
 1-56592-002-3



Regards,
   - Graeme -



___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal