diff options
author | Joe Hunkeler <jhunkeler@gmail.com> | 2015-08-11 16:51:37 -0400 |
---|---|---|
committer | Joe Hunkeler <jhunkeler@gmail.com> | 2015-08-11 16:51:37 -0400 |
commit | 40e5a5811c6ffce9b0974e93cdd927cbcf60c157 (patch) | |
tree | 4464880c571602d54f6ae114729bf62a89518057 /sys/symtab/stfree.x | |
download | iraf-osx-40e5a5811c6ffce9b0974e93cdd927cbcf60c157.tar.gz |
Repatch (from linux) of OSX IRAF
Diffstat (limited to 'sys/symtab/stfree.x')
-rw-r--r-- | sys/symtab/stfree.x | 44 |
1 files changed, 44 insertions, 0 deletions
diff --git a/sys/symtab/stfree.x b/sys/symtab/stfree.x new file mode 100644 index 00000000..1a960fe5 --- /dev/null +++ b/sys/symtab/stfree.x @@ -0,0 +1,44 @@ +# Copyright(c) 1986 Association of Universities for Research in Astronomy Inc. + +include "symtab.h" + +# STFREE -- Free storage back to the last marker. No storage is actually +# returned to the system, rather the storage is made available for reuse +# by SYMTAB (the stacks are pruned). + +procedure stfree (stp, marker) + +pointer stp # symtab descriptor +int marker # magic marker + +int el +pointer index, stab, ep, mp + +begin + index = ST_INDEX(stp) + stab = ST_STABP(stp) + mp = stab + marker + ep = NULL + + # Ignore requests with out of range markers. + if (marker <= 0 || marker >= ST_STABOP(stp)) + return + + # Descend the global (time ordered) list, unlinking each symbol until + # the marker position is reached. + + for (el = ST_LASTSYMBOL(stp); el > marker; el = E_NEXTGLOB(ep)) { + ep = stab + el + Memi[index+E_THREAD(ep)] = E_NEXTHASH(ep) + } + + # Reset the stack pointers and set the head of the global list to + # point to the symbol immediately preceding the marker. + + ST_NSYMBOLS(stp) = M_NSYMBOLS(mp) + ST_SBUFOP(stp) = M_SBUFOP(mp) + ST_STABOP(stp) = marker + + if (ep != NULL) + ST_LASTSYMBOL(stp) = E_NEXTGLOB(ep) +end |