home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #16 / NN_1992_16.iso / spool / comp / lang / fortran / 2859 < prev    next >
Encoding:
Text File  |  1992-07-28  |  2.7 KB  |  91 lines

  1. Newsgroups: comp.lang.fortran
  2. Path: sparky!uunet!munnari.oz.au!bruce.cs.monash.edu.au!monu6!giaeb!simon
  3. From: simon@giaec.cc.monash.edu.au (simon shields)
  4. Subject: dynamic arrays solution from HP
  5. Message-ID: <simon.712370178@giaeb>
  6. Summary: hps solution
  7. Keywords: dynamic arrays
  8. Sender: news@monu6.cc.monash.edu.au (Usenet system)
  9. Organization: Monash University, Melb., Australia.
  10. Date: Wed, 29 Jul 1992 00:36:18 GMT
  11. Lines: 78
  12.  
  13.  
  14. SYSTEM: HP-UX giaec A.08.07 A 9000/720 2001133857
  15. Hi
  16. Alan from HP wrote to me from comp.sys.hp the following.
  17.  
  18.  
  19. From: acmeyer@hpfcso.FC.HP.COM (Alan C. Meyer)
  20. Date: Tue, 28 Jul 1992 14:13:32 GMT
  21. Subject: Re: adjustable arrays 720's f77
  22. Message-ID: <7371177@hpfcso.FC.HP.COM>
  23. Organization: Hewlett-Packard, Fort Collins, CO, USA
  24. 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
  25. Newsgroups: comp.sys.hp
  26. References: <simon.712287118@giaeb>
  27. Lines: 59
  28.  
  29. In comp.sys.hp, simon@giaec.cc.monash.edu.au (simon shields) writes:
  30.  
  31. > I am having problems compiling fortran 77 programs I wrote on an 800
  32. > series that made use of adjustable arrays. I won't compile on the
  33. > 720's we have. 
  34. > The machine I'm using is
  35. > HP-UX giaec A.08.07 A 9000/720 2001133857
  36.  
  37.     ...
  38.  
  39. >       SUBROUTINE graph (coords, curves, fname)
  40. >       EXTERNAL fill the array
  41. >       INTEGER coords, curves
  42. >       LOGICAL fill the array
  43. >       CHARACTER fname*(*)
  44. > -->>> REAL xdra (coords,curves), ydra (coords, curves),tr(curves)
  45.  
  46. The arrays xdra, ydra and tr are *automatic* arrays, not adjustable arrays
  47. (automatics are local arrays of non-constant size, and adjustables are
  48. dummy arguments of non-constant size).
  49.  
  50. S800 Fortran supports automatic arrays, also calling them dynamic arrays.
  51. At 8.07, the S700 compiler does not support this feature.  However, they
  52. have been implemented and will ship with the next S700 release.
  53.  
  54. Until then, one workaround, which will involve changing the source, would
  55. be to use the Cray pointer feature to dynamically allocate the arrays.  So,
  56. change:
  57.  
  58.        SUBROUTINE graph (coords, curves, fname)
  59.        INTEGER coords, curves
  60.        REAL xdra (coords,curves), ydra (coords, curves),tr(curves)
  61.  
  62. to
  63.        SUBROUTINE graph (coords, curves, fname)
  64.        INTEGER coords, curves
  65.        POINTER (ipxdra, xdra(coords,curves))
  66.        POINTER (ipydra, ydra(coords,curves))
  67.        POINTER (iptr, tr(curves))
  68.  
  69.        ipxdra = MALLOC(coords*curves*4)
  70.        ipydra = MALLOC(coords*curves*4)
  71.        iptr = MALLOC(curves*4)
  72.  
  73.        ! reference xdra, ydra and tr as usual
  74.  
  75.        ...
  76.        FREE(ipxdra)
  77.        FREE(ipydra)
  78.        FREE(tr)
  79.        END
  80.  
  81. Alan Meyer
  82. Hewlett-Packard
  83. Colorado Language Lab
  84. acmeyer@fc.hp.com
  85.  
  86. "These are my own opinions ..."
  87.  
  88. Hope this helps someone.
  89. Bye from simon.
  90.