File: dsget.r

package info (click to toggle)
iraf 2.17-4
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 95,288 kB
  • sloc: ansic: 228,894; fortran: 75,606; lisp: 18,369; xml: 8,401; sh: 6,111; yacc: 5,648; lex: 596; makefile: 575; asm: 153; csh: 95; sed: 4
file content (50 lines) | stat: -rw-r--r-- 932 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
include	defs

# dsget --- get pointer to block of at least w available words

   pointer function dsget (w)
   integer w

   DS_COMMON

   pointer p, q, l

   integer n, k, junk
   integer getlin

   character c (10)

   n = w + DS_OHEAD
   q = DS_AVAIL

   repeat {
      p = Mem (q + DS_LINK)
      if (p == LAMBDA) {
	 call remark ("in dsget: out of storage space.")
	 call remark ("type 'c' or 'i' for char or integer dump.")
	 junk = getlin (c, STDIN)
	 if (c (1) == LETC | c (1) == BIGC)
	    call dsdump (LETTER)
	 else if (c (1) == LETI | c (1) == BIGI)
	    call dsdump (DIGIT)
	 call error ("program terminated.")
	 }
      if (Mem (p + DS_SIZE) >= n)
	 break
      q = p
      }

   k = Mem (p + DS_SIZE) - n
   if (k >= DS_CLOSE) {
      Mem (p + DS_SIZE) = k
      l = p + k
      Mem (l + DS_SIZE) = n
      }
   else {
      Mem (q + DS_LINK) = Mem (p + DS_LINK)
      l = p
      }

   return (l + DS_OHEAD)

   end