blob: c40d5de6dbd0e9f114cf69b6e6d0267bf4a8983e (
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
57
58
59
60
61
62
63
|
# Copyright(c) 1986 Association of Universities for Research in Astronomy Inc.
include <syserr.h>
include "../qpoe.h"
# QP_GET -- Return the value of the named header parameter. Automatic type
# conversion is performed where possible. While only scalar values can be
# returned by this function, the scalar may be an element of a one-dimensional
# array, e.g., "param[N]".
int procedure qp_geti (qp, param)
pointer qp #I QPOE descriptor
char param[ARB] #I parameter name
pointer pp
int dtype
int value
int qp_getparam()
errchk qp_getparam, syserrs
begin
# Lookup the parameter and it's value.
dtype = qp_getparam (qp, param, pp)
if (pp == NULL)
call syserrs (SYS_QPNOVAL, param)
# Set default value of INDEF or NULL.
value = (INDEFI)
# Get a valid parameter value.
switch (dtype) {
case TY_CHAR:
value = (Memc[pp])
case TY_SHORT:
if (!IS_INDEFS(Mems[pp]))
value = (Mems[pp])
case TY_INT:
if (!IS_INDEFI(Memi[pp]))
value = (Memi[pp])
case TY_LONG:
if (!IS_INDEFL(Meml[pp]))
value = (Meml[pp])
case TY_REAL:
if (!IS_INDEFR(Memr[pp]))
value = (Memr[pp])
case TY_DOUBLE:
if (!IS_INDEFD(Memd[pp]))
value = (Memd[pp])
default:
call syserrs (SYS_QPBADCONV, param)
}
if (QP_DEBUG(qp) > 1) {
call eprintf ("qp_get: `%s', TYP=(%d->%d) returns %g\n")
call pargstr (param)
call pargi (dtype)
call pargi (TY_INT)
call pargi (value)
}
return (value)
end
|