Can you post the original c code? You point to a file that seems to be a
reworked output from h2pas. As it is now, it indeed doesn't make any sense.
I would think the su_len,su_family,su_port should make up a record but they
aren't.
I suggest you move the #defines inside the union declaration to
On Sat, Apr 30, 2011 at 10:18, Ludo Brands wrote:
> Can you post the original c code? You point to a file that seems to be a
> reworked output from h2pas. As it is now, it indeed doesn't make any sense.
> I would think the su_len,su_family,su_port should make up a record but they
> aren't.
>
Ac
Forget my previous reply. I found the original header file on sourceforge.
I have alse a better understanding now of what the code is supposed to do:
in case DOCUMENTATION_ONLY is not defined, a reference to, for example,
su_sockaddr_u.su_family will be subsstituted by
su_sockaddr_u.susa.sa_fam
Using macros, the translation looks like
{$MACRO ON}
{$ifndef DOCUMENTATION_ONLY}
{$if SU_HAVE_SOCKADDR_SA_LEN <>0}
{$define su_len:=su_sa.sa_len}
{$else}
{$define su_len:=su_array[0]}
{$endif}
{$define su_family:=su_sa.sa_family}
{$define su_port:=su_sin.sin_port}
{$define su_scope_id:=su_ar
In Turbopascal it was possible with offs()
type
rectype = record
var1 : longint;
var2 : longint;
var3 : boolean;
end;
var
o : longint;
recvar : rectype;
o := offs( recvar.var1 ); // --> 0
o := offs( recvar.var2 ); // --> 4
o := offs( recvar.var3 ); // --> 8
__
On Sat, Apr 30, 2011 at 14:30, Rainer Stratmann
wrote:
> In Turbopascal it was possible with offs()
>
> type
> rectype = record
> var1 : longint;
> var2 : longint;
> var3 : boolean;
> end;
>
> var
> o : longint;
> recvar : rectype;
>
> o := offs( recvar.var1 ); // --> 0
> o := offs( recv
> o := PtrUInt( @recvar.var1 ) - PtrUInt( @recvar );
> o := PtrIUnt( @recvar.var2 ) - PtrUInt( @recvar );
> o := PtrInUt( @recvar.var3 ) - PtrUInt( @recvar );
Actually even
o := PtrUInt(@(rectype(nil^).var1)));
is possible.
___
fpc-pascal maillist - fp
Am Saturday 30 April 2011 14:54:22 schrieb Aleksa Todorovic:
> On Sat, Apr 30, 2011 at 14:30, Rainer Stratmann
>
> wrote:
> > In Turbopascal it was possible with offs()
> >
> > type
> > rectype = record
> > var1 : longint;
> > var2 : longint;
> > var3 : boolean;
> > end;
> >
> > var
> > o :
On 30 Apr 2011, at 14:30, Rainer Stratmann wrote:
> In Turbopascal it was possible with offs()
>
> type
> rectype = record
> var1 : longint;
> var2 : longint;
> var3 : boolean;
> end;
>
> var
> o : longint;
> recvar : rectype;
>
> o := offs( recvar.var1 ); // --> 0
That's incorrect. In TP
Am Saturday 30 April 2011 15:16:08 schrieb Jonas Maebe:
> On 30 Apr 2011, at 14:30, Rainer Stratmann wrote:
> > In Turbopascal it was possible with offs()
> >
> > type
> > rectype = record
> > var1 : longint;
> > var2 : longint;
> > var3 : boolean;
> > end;
> >
> > var
> > o : longint;
> > recva
On 30 Apr 2011, at 15:20, Rainer Stratmann wrote:
> Am Saturday 30 April 2011 15:16:08 schrieb Jonas Maebe:
>> That's incorrect. In TP, Ofs(recvar.var1) (with one "f") returns the offset
>> in the segment that contains the "recvar" variable. It does not return the
>> relative offset of the field
Am Saturday 30 April 2011 15:28:03 schrieb Jonas Maebe:
> On 30 Apr 2011, at 15:20, Rainer Stratmann wrote:
> > Am Saturday 30 April 2011 15:16:08 schrieb Jonas Maebe:
> >> That's incorrect. In TP, Ofs(recvar.var1) (with one "f") returns the
> >> offset in the segment that contains the "recvar" var
This is ages ago, but IIRC getmem would allocate memory on segment
boundaries (offset 0). In a dynamically allocated record ofs(record.member)
(one f) would give you the offset to the start of record. This was obviously
a special case. I'm not sure if large/huge memory model was part of it.
Otherwi
Am Saturday 30 April 2011 15:15:21 schrieb Florian Klämpfl:
> > o := PtrUInt( @recvar.var1 ) - PtrUInt( @recvar );
> > o := PtrIUnt( @recvar.var2 ) - PtrUInt( @recvar );
> > o := PtrInUt( @recvar.var3 ) - PtrUInt( @recvar );
>
> Actually even
> o := PtrUInt(@(rectype(nil^).var1)));
> is possible.
Jonas Maebe wrote:
On 30 Apr 2011, at 14:30, Rainer Stratmann wrote:
In Turbopascal it was possible with offs()
type
rectype = record
var1 : longint;
var2 : longint;
var3 : boolean;
end;
var
o : longint;
recvar : rectype;
o := offs( recvar.var1 ); // --> 0
That's incorrect. In TP, Ofs(
On 30.04.2011 03:15, Paul Ishenin wrote:
30.04.2011 3:28, leledumbo wrote:
I see now that generics have improved a lot since latest release, we even
have Delphi compatible syntax in Delphi mode. Recursive generic type is
supported as well now (finally, I can continue my data structure library
:)
Question:
In case of DOCUMENTATION_ONLY not defined, does
su_sockaddr_u = record
(...)
1 : ( su_sa.sa_family : byte )
(...)
end;
really compile?
(From what I know about Pascal I would say: no)
Regards,
Sven
On 30.04.2011 10:53, Ludo Brands wrote:
Using macros, the translation looks like
{$
2011/4/24 Paulo Costa :
> Probably you are right. Let me know how does it works for you. Historically,
> we had a V4L unit for Kylix that was used with a Bt878 Frame Grabber and we
> had to build the new component when we wanted to use the USB cameras. Back
> then, some drivers were not available
18 matches
Mail list logo