aboutsummaryrefslogtreecommitdiff
path: root/pkg/utilities/nttools/stxtools/od/odopep.x
blob: cd757f93d864cd91a57eccb2de4534c38204caf8 (plain) (blame)
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
include "od.h"

#---------------------------------------------------------------------------
.help od_open_group 11Jul95 source
.ih
NAME
od_open_group -- Open another "group" of the file
.ih
USAGE
call od_open_group (od, group)
.fi
.ih
ARGUMENTS
.ls od (pointer :input)
The OD I/O descriptor.
.le
.ls group (int :input)
The "group" to open.  For tables, this means the column number to open.
.le
.endhelp
#---------------------------------------------------------------------------
procedure od_open_group (od, group)

pointer od                      # I:  The 1D descriptor.
int     group                   # I:  The group to open.

# Misc.
real    rx                      # Generic.

errchk	gf_opengr, mw_close, od_wcs_open

begin
        switch (OD_TYPE(od)) {
        case OD_TABLE:
            if (group > OD_NGRP(od))
                call error (1, "Attempt to open non-existant column")
            OD_GRP(od) = group

        case OD_IMAGE:
            if (group > OD_NGRP(od))
                call error (1, "Attempt to open non-existant group")

            call mw_close (OD_MW(od))

            if (OD_OLD(od) != NULL)
                call gf_opengr (OD_FD(od), group, rx, rx, OD_FD(OD_OLD(od)))
            else
                call gf_opengr (OD_FD(od), group, rx, rx, NULL)
            OD_GRP(od) = group

            call od_wcs_open (od)
        }       
end
#---------------------------------------------------------------------------
# End of od_open_group
#---------------------------------------------------------------------------