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
51
52
53
54
55
56
57
|
# Copyright(c) 1986 Association of Universities for Research in Astronomy Inc.
include <mach.h>
include <ctype.h>
include <imhdr.h>
define FIRST 1
define LAST MAX_LONG
define STEP 1
# CLGSEC -- Get an image section and decode it.
#
# A section string may be either a null string or bracketed by [].
# The arrays x1, x2, and step are initialized to FIRST, LAST, and STEP.
# The number of subscripts decoded is returned in nsubscripts.
# This routine uses the same decode routine as IMIO.
procedure clgsec (prompt, section, x1, x2, step, nsubscripts)
char prompt[ARB]
char section[ARB]
long x1[IM_MAXDIM]
long x2[IM_MAXDIM]
long step[IM_MAXDIM]
int nsubscripts
int i, ip
begin
# Get section string.
call clgstr (prompt, section ,SZ_LINE)
# Set default values.
nsubscripts = 0
call amovkl (long (FIRST), x1, IM_MAXDIM)
call amovkl (long (LAST), x2, IM_MAXDIM)
call amovkl (long (STEP), step, IM_MAXDIM)
# Skip leading whitespace.
ip = 1
while (IS_WHITE(section[ip]))
ip = ip + 1
# Check for absent section.
if (section[ip] == EOS)
return
# Check for start of section string.
if (section[ip] != '[')
call error (0, "Invalid image section")
# Decode section.
ip = ip + 1
for (i=1; i <= IM_MAXDIM && section[ip] != ']'; i=i+1)
call im_decode_subscript (section, ip, x1[i], x2[i], step[i])
nsubscripts = i - 1
end
|