use_provides, module_provides & module_interface

0 views
Skip to first unread message

Kurt Smith

unread,
Jun 8, 2009, 12:52:00 PM6/8/09
to f2py-dev
I'm filling out the use_provides, module_provides and module_interface dicts
inside the module statement class, and I'm a bit unclear on the differences &
interdependencies between them.

Here's how I understand it currently:

'use_provides' is all the symbols for the used modules' module_interface,
taking into account renames and the 'only' clause.

module_provides is a dict of name -> entity for all the names defined locally
in that module that are publicly available. It does not include any
names that are
use-associated.

module_interface for a module 'mod' is a dict of name -> entity for
the union of names in
module_provides and the use_provides for mod.


An example:

module mod1
implicit none
integer :: a
integer :: c
! module_provides == module_interface == {'a': <a-variable>, 'c' : <c-variable>}
! use_provides == {}
end module


module mod2
use mod1
implicit none
integer :: b
! module_provides == {'b' : <b-variable>}
! use_provides == mod1.module_interface == {'a' : <a-variable>, 'c' :
<c-variable>}
! module_interface == union(module_provides, use_provides) == {'a':
..., 'b': ..., 'c': ...}
end module

module mod3
use mod2, only: b => a
implicit none
real :: a
! module_provides == {'a' : <real-a-var>}
! use_provides == {'b' : <mod1-a-var>}
! module_interface == union(module_provides, use_provides) == {'a' :
<real-a-var>, 'b': <mod1-a-var>}
end module

Is the above correct?

Kurt

Kurt Smith

unread,
Jun 8, 2009, 2:44:02 PM6/8/09
to f2py-dev
I had it all wrong, but I *think* it's straightened out now.

On Mon, Jun 8, 2009 at 11:52 AM, Kurt Smith<kwms...@gmail.com> wrote:
> I'm filling out the use_provides, module_provides and module_interface dicts
> inside the module statement class, and I'm a bit unclear on the differences &
> interdependencies between them.
>
> Here's how I understand it currently:
>
> 'use_provides' is all the symbols for the used modules' module_interface,
> taking into account renames and the 'only' clause.
>
> module_provides is a dict of name -> entity for all the names defined locally
> in that module that are publicly available. It does not include any
> names that are
> use-associated.
>
> module_interface for a module 'mod' is a dict of name -> entity for
> the union of names in
> module_provides and the use_provides for mod.

module_interface is a name -> interface mapping of interface name to interface
entity for all interfaces defined inside the module.

module_provides is a name -> entity mapping of all public entities defined in
the current module. Although all the places where module_provides is updated
are commented out. Why is that?

use_provides: what would this be, then? All symbols imported from all 'used'
modules, which, for each used module m, includes:
m.module_provides + m.use_provides
# with any renames & only clause taken into account.

Here's the example revisited:

module mod1
implicit none
integer :: a
integer :: c

! module_provides == {'a': <a-variable>, 'c' : <c-variable>}


! use_provides == {}
end module

module mod2
use mod1
implicit none
integer :: b
! module_provides == {'b' : <b-variable>}

! use_provides == {'a' : <a-variable>, 'c' : <c-variable>}
end module

module mod3
use mod2, only: b => a
implicit none
real :: a
! module_provides == {'a' : <real-a-var>}
! use_provides == {'b' : <mod1-a-var>}

end module

This seems to be much simpler, but I'm not certain I've got it right.

Kurt

Reply all
Reply to author
Forward
0 new messages