Sign in Join

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

Mailing lists / fpc-devel / 2007-07

TRect and TPoint on OsX have different layout.

6 messages · 3 people ·

Reply by email Subscribe to this list Your subscription

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

Den Jean

Hi,

On OsX rect and point have a different layout.

Is there somewhere in the fpc rtl
a rect and point type that conforms to this ?

Would you consider adapting the definition of Types.TRect ?

This is actually an old request:
http://lists.freepascal.org/lists/fpc-devel/2006-April/007515.html

Qt4 header extracts that shows platform dependant layout:

qrect.h:
#if defined(Q_OS_MAC)
    int y1;
    int x1;
    int y2;
    int x2;
#else
    int x1;
    int y1;
    int x2;
    int y2;
#endif
qpoint.h
#if defined(Q_OS_MAC)
    int yp;
    int xp;
#else
    int xp;
    int yp;
#endif

regards,

Den Jean

Reply by email

Florian Klaempfl
to Den Jean
Show quoted text 8 lines
Hi, On OsX rect and point have a different layout. Is there somewhere in the fpc rtl a rect and point type that conforms to this ? Would you consider adapting the definition of Types.TRect ?

Hmm, I wouldn't bet that no lazarus etc. code depends on the layout ...

Show quoted text 36 lines
This is actually an old request: http://lists.freepascal.org/lists/fpc-devel/2006-April/007515.html Qt4 header extracts that shows platform dependant layout: qrect.h: #if defined(Q_OS_MAC) int y1; int x1; int y2; int x2; #else int x1; int y1; int x2; int y2; #endif qpoint.h #if defined(Q_OS_MAC) int yp; int xp; #else int xp; int yp; #endif regards, Den Jean _______________________________________________ fpc-devel maillist - http://lists.freepascal.org/mailman/listinfo/fpc-devel

Reply by email

Den Jean
to Florian Klaempfl
pm Florian Klaempfl wrote
Hmm, I wouldn't bet that no lazarus etc. code depends on the layout ...

with different member names, there already is a defintion

rtl/macos/macostp.inc:

  Point = record
    case INTEGER of
     0: (
       v: INTEGER;
       h: INTEGER;
     );
     1: (
       vh: array[0..1] of INTEGER;
     );
   end;
  PointPtr = ^Point;
  Rect = record
    case INTEGER of
     0: (
       top: INTEGER;
       left: INTEGER;
       bottom: INTEGER;
       right: INTEGER;
     );
     1: (
       topLeft: Point;
       botRight: Point;
     );
   end;
  RectPtr = ^Rect;

Reply by email

Felipe Monteiro de Carvalho
to Den Jean
Den Jean wrote
with different member names, there already is a defintion

Point is not the same things as TPoint

Also several files declare TPoint and Point.

Here is the declarations from types unit:

{$ifdef Windows}
  TPoint = Windows.TPoint;
{$else}
  TPoint =
{$ifndef FPC_REQUIRES_PROPER_ALIGNMENT}
  packed
{$endif FPC_REQUIRES_PROPER_ALIGNMENT}
  record
    X : Longint;
    Y : Longint;
  end;
{$endif}
  PPoint = ^TPoint;

My recomendation is to define a new point type on qt4.pas (TQPoint or anything like that), make it compatible with what Qt expects and use that.

Felipe Monteiro de Carvalho

Reply by email

Den Jean
to Felipe Monteiro de Carvalho
pm Felipe Monteiro de Carvalho wrote
My recomendation is to define a new point type on qt4.pas (TQPoint or anything like that), make it compatible with what Qt expects and use that.

you want to use your rect in LCL code, what does LCL pass around ? Types.TRect I suppose ?

I will just use this for now and fix DARWIN in my copy functions.

regards,

Den Jean

Reply by email