This commit is contained in:
edoapra 2019-06-21 09:42:53 -07:00
parent e74d0aa3d7
commit 97243785fc
No known key found for this signature in database
GPG key ID: 48E12DA1EDE9E1B0
2 changed files with 26 additions and 11 deletions

View file

@ -21,13 +21,7 @@ c implicit integer (a-z)
integer llword !< [Input] The maximum number of words
c
#include "errquit.fh"
c
integer lword, ltop, lmax, lmin, junk, nword, iad, mfr
c
integer selci_mptr, selci_mleft, selci_mfree, selci_mstats
c
common /selci_corep/ lword, ltop, lmax, lmin
save /selci_corep/
#include "selci_minit.fh"
c
c initialise the memory management ... simple single direction
c stack ... removed ability to grow from top down also
@ -42,18 +36,25 @@ c
lword = llword
selci_minit = 0
return
end
c
entry selci_mleft(junk)
integer function selci_mleft(junk)
c
c return the no. of REAL words free
c
implicit none
#include "selci_minit.fh"
selci_mleft = lword - ltop
return
end
c
entry selci_mptr(nword)
integer function selci_mptr(nword)
c
c return pointer into REAL stack for nword REALS
c
implicit none
#include "errquit.fh"
#include "selci_minit.fh"
if (nword.lt.0) call errquit('MALOC: nword < 0',nword, INPUT_ERR)
mfr = lword - ltop
if (nword .le. mfr) then
@ -62,26 +63,34 @@ c
lmin = max0(ltop,lmin)
return
else
selci_mptr=0
write (6,20) nword,mfr
20 format(///' core request:',i10,5x,'available:',i10/)
call errquit('MPTR: need this much more memory', nword-mfr,
& MEM_ERR)
endif
end
c
entry selci_mfree(iad)
integer function selci_mfree(iad)
c
c free REAL memory back to this pointer
c
implicit none
#include "selci_minit.fh"
#include "errquit.fh"
if (iad.lt.1 .or. iad.gt.(ltop+1))
$ call errquit('MFREE: invalid argument',iad, INPUT_ERR)
ltop = iad - 1
selci_mfree = 0
return
end
c
entry selci_mstats(junk)
integer function selci_mstats(junk)
c
c print out statistics about core usage
c
implicit none
#include "selci_minit.fh"
write (6,30) lmin,lword-lmin
30 format(/' minimal core high water =',i10,
1 ' real numbers (spare =',i10,')')

6
src/selci/selci_minit.fh Normal file
View file

@ -0,0 +1,6 @@
c
integer lword, ltop, lmax, lmin, junk, nword, iad, mfr
c
c
common /selci_corep/ lword, ltop, lmax, lmin
save /selci_corep/