aboutsummaryrefslogtreecommitdiff
path: root/pkg/xtools/catquery/cqistat.x
blob: 0ae3552785cec7fce4b9fceb98ec2e1265d836d5 (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
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
include "cqdef.h"
include "cq.h"


# CQ_ISTATI -- Get an integer image results parameter.

int procedure cq_istati (res, param)

pointer res                     #I pointer to the results descriptor
int     param                   #I the integer parameter to be retrieved

begin
        switch (param) {
	case CQINQPARS:
            return (CQ_INQPARS(res))
        case CQIMTYPE:
            return (CQ_IMTYPE(res))
        case CQWCS:
            return (CQ_WCS(res))
        case CQNWCS:
            return (CQ_NWCS(res))
        case CQNIMPARS:
            return (CQ_NIMPARS(res))
        default:
            call error (0, "Error fetching integer image results parameter")
        }
end


# CQ_ISTATR -- Get a real image results parameter.

real procedure cq_istatr (res, param)

pointer res                     #I pointer to the image results descriptor
int     param                   #I the real image parameter to be retrieved

begin
        switch (param) {
        default:
            call error (0, "Error fetching real results parameter")
        }
end


# CQ_ISTATD -- Get a double precision image results parameter.

double procedure cq_istatd (res, param)

pointer res                     #I pointer to the image results descriptor
int     param                   #I the double parameter to be retrieved

begin
        switch (param) {
        default:
            call error (0, "Error fetching double results parameter")
        }
end


# CQ_ISTATS -- Get a string image results parameter.

procedure cq_istats (res, param, str, maxch)

pointer res                     #I pointer to the results descriptor
int     param                   #I the string parameter to be retrieved
char    str[ARB]                #O the output string parameter
int     maxch                   #I the maximum size of the string parameter

begin
        switch (param) {
        case CQIQPNAMES:
            call strcpy (Memc[CQ_IQPNAMES(res)], str, maxch)
        case CQIQPVALUES:
            call strcpy (Memc[CQ_IQPVALUES(res)], str, maxch)
        case CQIQPUNITS:
            call strcpy (Memc[CQ_IQPUNITS(res)], str, maxch)
        case CQIMCATDB:
            call strcpy (CQ_IMCATDB(res), str, maxch)
        case CQIMCATNAME:
            call strcpy (CQ_IMCATNAME(res), str, maxch)
        case CQIMADDRESS:
            call strcpy (CQ_IMADDRESS(res), str, maxch)
        case CQIMQUERY:
            call strcpy (CQ_IMQUERY(res), str, maxch)
        case CQIMNAME:
            call strcpy (CQ_IMNAME(res), str, maxch)
        default:
            call error (0, "Error fetching string results parameter")
        }
end


# CQ_ISTATT -- Get a text list results parameter. A text list is a
# string with items separated from each other by newlines.

int procedure cq_istatt (res, param, str, maxch)

pointer res                     #I pointer to the results descriptor
int     param                   #I the list parameter to be retrieved
char    str[ARB]                #O the output string parameter
int     maxch                   #I the maximum size of the string parameter

pointer	sp, tstr
int     i, fd
int     stropen(), cq_wrdstr()

begin
        switch (param) {

        case CQIQPNAMES:
	    call smark (sp)
	    call salloc (tstr, CQ_SZ_QPNAME, TY_CHAR)
            fd = stropen (str, maxch, NEW_FILE)
	    str[1] = EOS
            do i = 1, CQ_INQPARS(res) {
		if (cq_wrdstr (i, Memc[tstr], CQ_SZ_QPNAME,
		    Memc[CQ_IQPNAMES(res)]) > 0) {
                    call fprintf (fd, "%s\n")
                        call pargstr (Memc[tstr])
		}
            }
            call close (fd)
	    call sfree (sp)
            return (CQ_INQPARS(res))

        case CQIQPVALUES:
	    call smark (sp)
	    call salloc (tstr, CQ_SZ_QPVALUE, TY_CHAR)
            fd = stropen (str, maxch, NEW_FILE)
	    str[1] = EOS
            do i = 1, CQ_INQPARS(res) {
		if (cq_wrdstr (i, Memc[tstr], CQ_SZ_QPVALUE,
		    Memc[CQ_IQPVALUES(res)]) > 0) {
                    call fprintf (fd, "%s\n")
                        call pargstr (Memc[tstr])
		}
            }
            call close (fd)
	    call sfree (sp)
            return (CQ_INQPARS(res))

        case CQIQPUNITS:
	    call smark (sp)
	    call salloc (tstr, CQ_SZ_QPUNITS, TY_CHAR)
            fd = stropen (str, maxch, NEW_FILE)
	    str[1] = EOS
            do i = 1, CQ_INQPARS(res) {
		if (cq_wrdstr (i, Memc[tstr], CQ_SZ_QPUNITS,
		    Memc[CQ_IQPUNITS(res)]) > 0) {
                    call fprintf (fd, "%s\n")
                        call pargstr (Memc[tstr])
		}
            }
            call close (fd)
	    call sfree (sp)
            return (CQ_INQPARS(res))

        default:
            call error (0, "Error fetching list image results parameter")
        }
end