home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.lang.fortran
- Path: sparky!uunet!munnari.oz.au!bruce.cs.monash.edu.au!monu6!giaeb!simon
- From: simon@giaec.cc.monash.edu.au (simon shields)
- Subject: dynamic arrays solution from HP
- Message-ID: <simon.712370178@giaeb>
- Summary: hps solution
- Keywords: dynamic arrays
- Sender: news@monu6.cc.monash.edu.au (Usenet system)
- Organization: Monash University, Melb., Australia.
- Date: Wed, 29 Jul 1992 00:36:18 GMT
- Lines: 78
-
-
- SYSTEM: HP-UX giaec A.08.07 A 9000/720 2001133857
- Hi
- Alan from HP wrote to me from comp.sys.hp the following.
-
-
- From: acmeyer@hpfcso.FC.HP.COM (Alan C. Meyer)
- Date: Tue, 28 Jul 1992 14:13:32 GMT
- Subject: Re: adjustable arrays 720's f77
- Message-ID: <7371177@hpfcso.FC.HP.COM>
- Organization: Hewlett-Packard, Fort Collins, CO, USA
- Path: monu6!bruce.cs.monash.edu.au!munnari.oz.au!network.ucsd.edu!sdd.hp.com!hpscdc!cupnews0.cup.hp.com!hppad.waterloo.hp.com!hppad!hpfcso!acmeyer
- Newsgroups: comp.sys.hp
- References: <simon.712287118@giaeb>
- Lines: 59
-
- In comp.sys.hp, simon@giaec.cc.monash.edu.au (simon shields) writes:
-
- > I am having problems compiling fortran 77 programs I wrote on an 800
- > series that made use of adjustable arrays. I won't compile on the
- > 720's we have.
- >
- > The machine I'm using is
- > HP-UX giaec A.08.07 A 9000/720 2001133857
-
- ...
-
- > SUBROUTINE graph (coords, curves, fname)
- > EXTERNAL fill the array
- > INTEGER coords, curves
- > LOGICAL fill the array
- > CHARACTER fname*(*)
- > -->>> REAL xdra (coords,curves), ydra (coords, curves),tr(curves)
-
- The arrays xdra, ydra and tr are *automatic* arrays, not adjustable arrays
- (automatics are local arrays of non-constant size, and adjustables are
- dummy arguments of non-constant size).
-
- S800 Fortran supports automatic arrays, also calling them dynamic arrays.
- At 8.07, the S700 compiler does not support this feature. However, they
- have been implemented and will ship with the next S700 release.
-
- Until then, one workaround, which will involve changing the source, would
- be to use the Cray pointer feature to dynamically allocate the arrays. So,
- change:
-
- SUBROUTINE graph (coords, curves, fname)
- INTEGER coords, curves
- REAL xdra (coords,curves), ydra (coords, curves),tr(curves)
-
- to
- SUBROUTINE graph (coords, curves, fname)
- INTEGER coords, curves
- POINTER (ipxdra, xdra(coords,curves))
- POINTER (ipydra, ydra(coords,curves))
- POINTER (iptr, tr(curves))
-
- ipxdra = MALLOC(coords*curves*4)
- ipydra = MALLOC(coords*curves*4)
- iptr = MALLOC(curves*4)
-
- ! reference xdra, ydra and tr as usual
-
- ...
- FREE(ipxdra)
- FREE(ipydra)
- FREE(tr)
- END
-
- Alan Meyer
- Hewlett-Packard
- Colorado Language Lab
- acmeyer@fc.hp.com
-
- "These are my own opinions ..."
-
- Hope this helps someone.
- Bye from simon.
-