Community
cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted
New Contributor I
21 Views

Help remembering Fortran syntax

Jump to solution

Returning to some old Fortran code after many years absence.  At one time I must have known what %VU%PTR_VAL in

        iptString = SourceArray(Index)%VU%PTR_VAL
        intLength = SysStringLen(%Val(iptString))

meant.  But I no longer recall, and none of my searches have helped me find the meaning.  Perhaps it is some form of casting.  The surrounding code also contains several constructs of the form variable%aa.

Can anyone point me in the right direction where I might find documentation of these constructs.

Thanks,
Randy

 

0 Kudos

Accepted Solutions
Highlighted
Valued Contributor III
21 Views
          TYPE VARIANT
            SEQUENCE
                INTEGER*2       VT
                INTEGER*2       RESERVED1
                INTEGER*2       RESERVED2
                INTEGER*2       RESERVED3
                RECORD /VARIANT_UNION/ VU
          END TYPE VARIANT

C:\Program Files (x86)\IntelSWTools\compilers_and_libraries_2017\windows\compiler\include\ifwinty.f90

View solution in original post

0 Kudos
7 Replies
Highlighted
Valued Contributor II
21 Views

These are two very different uses of the percent sign, where only the first is standard Fortran (>= Fortran 90):

iptString = SourceArray(Index)%VU%PTR_VAL

here the percent sign means: take the component from a derived type. Something along these lines:

type vu_data
    integer :: ptr_val  ! Type "integer: just a wild guess ...
    ... probably other components ...
end type vu_data
type source_data
    type(vu_data) :: vu
    ... and other components ...
end type 

The second one, %Val(iptString), is the use of a non-standard function, %val, which - at least in some compiler extension - means/meant "take the value at the address identified by the value of iptString". With the introduction of the pointer attribute in Fortran 90 and the standard C-Fortran interfacing in Fortran 2003, this has become quite superfluous.

 

 

0 Kudos
Highlighted
New Contributor I
21 Views

Hi, Arjen,

Thanks for your input.  Actually I did remember what the %VAL was all about.  I had included that line to show that iptString (declared as an Integer) was being used like a pointer in case that would be a clue.  It was the %VU and %PTR_VAL that are mysterious to me.  There are no explicit Type definitions in the accompanying code, but the code uses these and also %VT etc.  The code is managing the passing of SafeArrays between Visual Basic and Fortran.  The code references the module Comty

	Use IFCOMTY

and I suspect the types may be defined in that module.  That module is not explicitly defined in the code, so I guess it must be part of the Fortran package, but I haven't been able to locate it or find either documentation or source code for it, and my google searches yield nothing. 

Assuming that's where these types are defined, do you know where I can find either documentation (or source) for this module?

Thanks,
Randy

0 Kudos
Highlighted
Black Belt
21 Views

The source code for ifcomty and the other compiler supplied windows interface modules is provided in your compiler installation folder under c:\program files or the like.

You are looking at components of a VARIANT.

0 Kudos
Highlighted
New Contributor I
21 Views

Thanks for that, Ian.  The trouble is... it just ain't there.  ifcomty.com is (in both 32 and 64 bit versions), but no source to go along with it.

0 Kudos
Highlighted
Valued Contributor III
22 Views
          TYPE VARIANT
            SEQUENCE
                INTEGER*2       VT
                INTEGER*2       RESERVED1
                INTEGER*2       RESERVED2
                INTEGER*2       RESERVED3
                RECORD /VARIANT_UNION/ VU
          END TYPE VARIANT

C:\Program Files (x86)\IntelSWTools\compilers_and_libraries_2017\windows\compiler\include\ifwinty.f90

View solution in original post

0 Kudos
Highlighted
Employee
21 Views

And C:\Program Files (x86)\IntelSWTools\compilers_and_libraries_2017\windows\compiler\include\ifcom.f90

0 Kudos
Highlighted
New Contributor I
21 Views

Hi, Andrew and Kevin,

I had been searching for files named "ifcomty.*".  Looking through the files you have pointed me to makes it all clear, so thanks for that. 

I suppose if ifcomty.f90 ever existed it was supplanted by ifcom, and I see that ifwinty has also supplanted ifcom.  So thanks to everyone for your help.  I think I can move forward again.

Cheers,
Randy

 

0 Kudos