C to CVF Structure Translation
  Home FAQ Contact Sign in
comp.lang.fortran only
 
Advanced search
POPULAR GROUPS

more...

comp.lang.fortran Profile…
 Up
C to CVF Structure Translation         


Author: Gary Scott
Date: Aug 16, 2008 12:49

Given this C structure:

typedef struct MTTRIGGER
{
U16BIT wCmdWrd1; /* CmdWrd1 value */
U16BIT wCmdMsk1; /* CmdWrd1 mask */
U16BIT wCmdWrd2; /* CmdWrd2 value */
U16BIT wCmdMsk2; /* CmdWrd2 mask */
U16BIT wStsWrd1; /* StsWrd1 value */
U16BIT wStsMsk1; /* StsWrd1 mask */
U16BIT wStsWrd2; /* StsWrd2 value */
U16BIT wStsMsk2; /* StsWrd2 mask */
U16BIT wDataWrd; /* DataWrd value */
U16BIT wDataMsk; /* DataWrd mask */
U16BIT wDataPos; /* DataWrd position in message */
U16BIT wErrWrd; /* ErrWrd value (errors in Block Status) */
U16BIT wErrFlg; /* should all errors be met or only one */

U16BIT wCount; /* # of trig's needed to produce real trigger */
U16BIT wTrigFlags; /* should all conditions be met or only one */
Show full article (2.64Kb)
5 Comments
Re: C to CVF Structure Translation         


Author: nospam
Date: Aug 16, 2008 14:06

Gary Scott sbcglobal.net> wrote:
> Given this C structure:
>
> typedef struct MTTRIGGER
> {
>...
> struct MTTRIGGER *pNextTrg;/* indicates next condition to trigger on*/
> } MTTRIGGER;
>
> Is this CVF translation complete (the recursive pointer to structure
> definition)? Seems like I want a pointer there...
> Do I need "sequence" as most win32 API definitions used to need it?
>
> type MTTRIGGER
...
> type (MTTRIGGER) :: pNextTrg !/* indicates next condition to
> trigger on*/
> end type
Show full article (1.39Kb)
no comments
Re: C to CVF Structure Translation         


Author: dpb
Date: Aug 16, 2008 19:10

Richard Maine wrote:
> Gary Scott sbcglobal.net> wrote:
>
>> Given this C structure:
>>
>> typedef struct MTTRIGGER
>> {
>> ...
>> struct MTTRIGGER *pNextTrg;/* indicates next condition to trigger on*/
>> } MTTRIGGER;
>>
>> Is this CVF translation complete (the recursive pointer to structure
>> definition)? Seems like I want a pointer there...
>
>> Do I need "sequence" as most win32 API definitions used to need it?
>>
>> type MTTRIGGER
> ...
>> type (MTTRIGGER) :: pNextTrg !/* indicates next condition to
>> trigger on*/ ...
Show full article (1.26Kb)
no comments
Re: C to CVF Structure Translation         


Author: Gary Scott
Date: Aug 17, 2008 10:31

dpb wrote:
> Richard Maine wrote:
>
>> Gary Scott sbcglobal.net> wrote:
>>
>>> Given this C structure:
>>>
>>> typedef struct MTTRIGGER
>>> {
>>> ...
>>> struct MTTRIGGER *pNextTrg;/* indicates next...
Show full article (1.93Kb)
no comments
Re: C to CVF Structure Translation         


Author: James Van Buskirk
Date: Aug 17, 2008 13:41

"Gary Scott" sbcglobal.net> wrote in message
news:MfZpk.21827$N87.5237@nlpi068.nbdc.sbc.com...
> In DFWINTY.f90, it appears that everywhere there's a pointer, including
> pointers to structures, they just used INTEGER(LPVOID) ::
> (LPVOID=kind type 4) within a SEQUENCE type so I guess that's what I'll
> try first.

That's what I would do except that I would minimize the pain by
setting LPVOID = INT_PTR_KIND() (with C interop, you could set it to
C_INTPTR_T). This would make the Cray pointer approach work on my
system as well.

--
write(*,*) transfer((/17.392111325966148d0,6.5794487871554595D-85, &
6.0134700243160014d-154/),(/'x'/)); end
no comments
Re: C to CVF Structure Translation         


Author: Gary Scott
Date: Aug 17, 2008 14:14

James Van Buskirk wrote:
> "Gary Scott" sbcglobal.net> wrote in message
> news:MfZpk.21827$N87.5237@nlpi068.nbdc.sbc.com...
>
>
>>In DFWINTY.f90, it appears that everywhere there's a pointer, including
>>pointers to structures, they just used INTEGER(LPVOID) ::
>>(LPVOID=kind type 4) within a SEQUENCE type so I guess that's what I'll
>>try first.
>
>
> That's what I would do except that I would minimize the pain by
> setting LPVOID = INT_PTR_KIND() (with C interop, you could set it to
> C_INTPTR_T). This would make the Cray pointer approach work on my
> system as well.
>
Thanks, I will change that.

--
Show full article (0.98Kb)
no comments