From: Lynn McGuire on
> The real question, then, is: how often is this non-standards-compliant feature used in your code, how much effort are you willing to
> expend to fix the code, and what is the estimated cost of going forward without excising this cancer _now_?

Extensively. We actually use:

structure / type64 /
union
map
character c
end map
map
double precision d
end map
map
integer i
integer i_low
end map
map
logical l
integer l_low
end map
map
character*8 s
end map
end union
end structure

and I was looking for an alternate. We cannot live without
this data structure or something functionally equivalent to it.

Thanks,
Lynn
From: Gordon Sande on
On 2010-06-21 16:04:50 -0300, Lynn McGuire <lmc(a)winsim.com> said:

>> The real question, then, is: how often is this non-standards-compliant
>> feature used in your code, how much effort are you willing to
>> expend to fix the code, and what is the estimated cost of going forward
>> without excising this cancer _now_?
>
> Extensively. We actually use:
>
> structure / type64 /
> union
> map
> character c
> end map
> map
> double precision d
> end map
> map
> integer i
> integer i_low
> end map
> map
> logical l
> integer l_low
> end map
> map
> character*8 s
> end map
> end union
> end structure
>
> and I was looking for an alternate. We cannot live without
> this data structure or something functionally equivalent to it.
>
> Thanks,
> Lynn

*IF* you are doing D-I-Y dynamic allocation as was quite common in Fortran 77
then using automatic arrays may well do what you want. But you never quite get
around to saying what the usage is so almost any advice will be suitable for
some or other guessed at usage. But those guesses are unlikely to match your
unstated usage so you get what you paid for, namely nothing of value.

You at least admit that you need a functional equivalent but leave it to the
reader to guess what the functionality might be.

If the D-I-Y dynamic allocation allocates and then passes the results the
equivalence to automatic arrays is trivial. If you are closer to running a heap
then things are more complicated but it may be the case that
ALLOCATEABLE rather
than automatic will do the job. But that depends on things that you have not
bothered to say.

As has been said many times in this newsgroup there is a small degree of skill
involved in asking for help. If you can not master that then you tend
to not get any
useful responses.



From: e p chandler on
On Jun 21, 3:04 pm, Lynn McGuire <l...(a)winsim.com> wrote:
> > The real question, then, is: how often is this non-standards-compliant feature used in your code, how much effort are you willing to
> > expend to fix the code, and what is the estimated cost of going forward without excising this cancer _now_?
>
> Extensively.  We actually use:
>
>        structure / type64 /
>           union
>              map
>                 character c
>              end map
>              map
>                 double precision d
>              end map
>              map
>                 integer i
>                 integer i_low
>              end map
>              map
>                 logical l
>                 integer l_low
>              end map
>              map
>                 character*8 s
>              end map
>           end union
>        end structure
>
> and I was looking for an alternate.  We cannot live without
> this data structure or something functionally equivalent to it.

How about a derived type (User defined type)? Does the memory layout
have to match something external EXACTLY?
It's hard to believe that there is not an automated tool to do this
for you.

-- e






From: Lynn McGuire on
> *IF* you are doing D-I-Y dynamic allocation as was quite common in Fortran 77
> then using automatic arrays may well do what you want. But you never quite get
> around to saying what the usage is so almost any advice will be suitable for
> some or other guessed at usage. But those guesses are unlikely to match your
> unstated usage so you get what you paid for, namely nothing of value.

Yes, sorry, left off the common block:

structure / type64 /
union
map
character c
end map
map
double precision d
end map
map
integer i
integer i_low
end map
map
logical l
integer l_low
end map
map
character*8 s
end map
end union
end structure
COMMON/VDYN/IERR,L8W7K1,VDY(2)
EQUIVALENCE (VDY (1), IVDY (1))
EQUIVALENCE (VDY (1), LVDY (1))
double precision VDY
record / type64 / IVDY (1)
record / type64 / LVDY (1)

We have interfaces to actually allocate dynamic memory using
the c malloc, realloc and free library functions and pass back
a pointer relative to the vdyn common block. So that you see
code like:
call dfbk ('mynewbank', location, ncp)
do i = 1, ncp
vdy (location + i) = val (i)
end do

> If the D-I-Y dynamic allocation allocates and then passes the results the
> equivalence to automatic arrays is trivial. If you are closer to running a heap
> then things are more complicated but it may be the case that ALLOCATEABLE rather
> than automatic will do the job. But that depends on things that you have not
> bothered to say.

I would guess that we are closer to running a heap. We are
still on a f77 compiler at this time so we dont have access
to ALLOCATABLE.

Thanks,
Lynn
From: Louis Krupp on
On 6/21/2010 1:28 PM, Gordon Sande wrote:
> On 2010-06-21 16:04:50 -0300, Lynn McGuire <lmc(a)winsim.com> said:
>
>>> The real question, then, is: how often is this
>>> non-standards-compliant feature used in your code, how much effort
>>> are you willing to
>>> expend to fix the code, and what is the estimated cost of going
>>> forward without excising this cancer _now_?
>>
>> Extensively. We actually use:
>>
>> structure / type64 /
>> union
>> map
>> character c
>> end map
>> map
>> double precision d
>> end map
>> map
>> integer i
>> integer i_low
>> end map
>> map
>> logical l
>> integer l_low
>> end map
>> map
>> character*8 s
>> end map
>> end union
>> end structure
>>
>> and I was looking for an alternate. We cannot live without
>> this data structure or something functionally equivalent to it.
>>
>> Thanks,
>> Lynn
>
> *IF* you are doing D-I-Y dynamic allocation as was quite common in
> Fortran 77
> then using automatic arrays may well do what you want. But you never
> quite get
> around to saying what the usage is so almost any advice will be suitable
> for
> some or other guessed at usage. But those guesses are unlikely to match
> your
> unstated usage so you get what you paid for, namely nothing of value.
>
> You at least admit that you need a functional equivalent but leave it to
> the
> reader to guess what the functionality might be.
>
> If the D-I-Y dynamic allocation allocates and then passes the results the
> equivalence to automatic arrays is trivial. If you are closer to running
> a heap
> then things are more complicated but it may be the case that
> ALLOCATEABLE rather
> than automatic will do the job. But that depends on things that you have
> not
> bothered to say.
>
> As has been said many times in this newsgroup there is a small degree of
> skill
> involved in asking for help. If you can not master that then you tend to
> not get any
> useful responses.

I was going to say be patient, that the OP was getting there, and that
might still be good advice. FWIW, the OP has been there before:

http://www.mofeel.net/849-comp-lang-fortran/5853.aspx

Louis