1
/*===========================================================================
2
Copyright (C) 1995-2009 European Southern Observatory (ESO)
4
This program is free software; you can redistribute it and/or
5
modify it under the terms of the GNU General Public License as
6
published by the Free Software Foundation; either version 2 of
7
the License, or (at your option) any later version.
9
This program is distributed in the hope that it will be useful,
10
but WITHOUT ANY WARRANTY; without even the implied warranty of
11
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12
GNU General Public License for more details.
14
You should have received a copy of the GNU General Public
15
License along with this program; if not, write to the Free
16
Software Foundation, Inc., 675 Massachusetts Ave, Cambridge,
19
Correspondence concerning ESO-MIDAS should be addressed as follows:
20
Internet e-mail: midas@eso.org
21
Postal address: European Southern Observatory
22
Data Management Division
23
Karl-Schwarzschild-Strasse 2
24
D 85748 Garching bei Muenchen
26
===========================================================================*/
28
/*++++++++++++++++++++++++ stk.fc +++++++++++++++++++++++++++++++++++++++
30
.IDENTIFICATION Module stk.fc
32
Module contains layer between the keyword related FORTRAN STxxxx interfaces
33
and the SC_interfaces written in (hopefully independent) C
34
.AUTHOR K. Banse ESO - Garching
35
.KEYWORDS standard interfaces.
36
.ENVIRONMENT FORTRAN and C standards
37
.VERSION [1.00] 871207: created from SXFTOC.C
38
.VERSION [2.60] 880411: modified new version - the last one
39
.VERSION [2.70] 900316: fix problems with TEXT_LEN+2
42
-----------------------------------------------------------------------------*/
45
#include <midas_def.h>
50
static int kunit = 0, knull = -1;
53
char *ptr1, *ptr2, *ptr3, *ptr4;
61
/*==========================================================================*/
63
/*** stat = SCKRDI(key,felem,maxvals,actvals,values,kunit,knull) ***/
65
ROUTINE STK1(felem,maxvals,actvals,values,status)
66
int *felem; /* IN : first data item to be read */
67
int *maxvals; /* IN : max. vals to read */
68
int *actvals; /* OUT: actual no. of elements returned */
69
int *values; /* OUT: buffer for data values */
73
ptr1 = strp_pntr(1); /* get stripped string of "key" */
75
*status = SCKRDI(ptr1,*felem,*maxvals,actvals,values,&kunit,&knull);
81
/*==========================================================================*/
83
/*** stat = SCKRDR(key,felem,maxvals,actvals,values,kunit,knull) ***/
85
ROUTINE STK2(felem,maxvals,actvals,values,status)
86
int *felem; /* IN : first data item to be read */
87
int *maxvals; /* IN : max. vals to read */
88
int *actvals; /* OUT: actual no. of elements returned */
89
float *values; /* OUT: buffer for data values */
93
ptr1 = strp_pntr(1); /* get stripped string of "key" */
95
*status = SCKRDR(ptr1,*felem,*maxvals,actvals,values,&kunit,&knull);
101
/*==========================================================================*/
103
/*** stat = SCKRDD(key,felem,maxvals,actvals,values,kunit,knull) ***/
105
ROUTINE STK3(felem,maxvals,actvals,values,status)
106
int *felem; /* IN : first data item to be read */
107
int *maxvals; /* IN : max. vals to read */
108
int *actvals; /* OUT: actual no. of elements returned */
109
double *values; /* OUT: buffer for data values */
113
ptr1 = strp_pntr(1); /* get stripped string of "key" */
115
*status = SCKRDD(ptr1,*felem,*maxvals,actvals,values,&kunit,&knull);
121
/*==========================================================================*/
123
/*** stat = SCKRDC(key,noelm,felem,maxvals,actvals,values,kunit,knull) ***/
125
ROUTINE STK4(noelm,felem,maxvals,actvals,status)
126
int *noelm; /* IN : no. of bytes (chars) per element */
127
int *felem; /* IN : first data item to be read */
128
int *maxvals; /* IN : max. vals to read */
129
int *actvals; /* OUT: actual no. of elements returned */
135
ptr1 = strp_pntr(1); /* get stripped string of "key" */
136
ptr2 = loc_pntr(1,&mm); /* get location of "values" */
138
*status = SCKRDC(ptr1,*noelm,*felem,*maxvals,actvals,ptr2,&kunit,&knull);
141
if ((n > 0) && (n < mm)) *(ptr2+n) = ' ';
147
/*==========================================================================*/
149
/*** stat = SCKPRC(prompt,key,noelm,felem,maxvals,actvals,values,kunit,knull) ***/
151
ROUTINE STK5(noelm,felem,maxvals,actvals,status)
152
int *noelm; /* IN : no. of bytes (chars) per element */
153
int *felem; /* IN : first data item to be read */
154
int *maxvals; /* IN : max. vals to read */
155
int *actvals; /* OUT: actual no. of elements returned */
161
ptr1 = strp_pntr(1); /* get stripped string of "key" */
162
ptr1 = strp_pntr(1); /* get stripped string of "key" */
163
ptr2 = strp_pntr(2); /* get stripped string of "prompt" */
164
ptr3 = loc_pntr(1,&mm); /* get location of "values" */
167
*status = SCKPRC(ptr2,ptr1,*noelm,*felem,*maxvals,actvals,ptr3,&kunit,&knull);
170
if ((n > 0) && (n < mm)) *(ptr3+n) = ' ';
176
/*==========================================================================*/
178
/*** stat = SCKPRI(prompt,key,felem,maxvals,actvals,values,kunit,knull) ***/
180
ROUTINE STK6(felem,maxvals,actvals,values,status)
181
int *felem; /* IN : first data item to be read */
182
int *maxvals; /* IN : max. vals to read */
183
int *actvals; /* OUT: actual no. of elements returned */
184
int *values; /* OUT: buffer for data values */
188
ptr1 = strp_pntr(1); /* get stripped string of "key" */
189
ptr2 = strp_pntr(2); /* get stripped string of "prompt" */
191
*status = SCKPRI(ptr2,ptr1,*felem,*maxvals,actvals,values,&kunit,&knull);
197
/*==========================================================================*/
199
/*** stat = SCKPRR(prompt,key,felem,maxvals,actvals,values,kunit,knull) ***/
201
ROUTINE STK7(felem,maxvals,actvals,values,status)
202
int *felem; /* IN : first data item to be read */
203
int *maxvals; /* IN : max. vals to read */
204
int *actvals; /* OUT: actual no. of elements returned */
205
float *values; /* OUT: buffer for data values */
209
ptr1 = strp_pntr(1); /* get stripped string of "key" */
210
ptr2 = strp_pntr(2); /* get stripped string of "prompt" */
212
*status = SCKPRR(ptr2,ptr1,*felem,*maxvals,actvals,values,&kunit,&knull);
217
/*==========================================================================*/
219
/*** stat = SCKPRD(prompt,key,felem,maxvals,actvals,values,kunit,knull) ***/
221
ROUTINE STK8(felem,maxvals,actvals,values,status)
222
int *felem; /* IN : first data item to be read */
223
int *maxvals; /* IN : max. vals to read */
224
int *actvals; /* OUT: actual no. of elements returned */
225
double *values; /* OUT: buffer for data values */
229
ptr1 = strp_pntr(1); /* get stripped string of "key" */
230
ptr2 = strp_pntr(2); /* get stripped string of "prompt" */
232
*status = SCKPRD(ptr2,ptr1,*felem,*maxvals,actvals,values,&kunit,&knull);
237
/*==========================================================================*/
239
/*** stat = SCKWRC(key,noelm,values,felem,maxvals,kunit) ***/
241
ROUTINE STK9(noelm,felem,maxvals,status)
242
int *noelm; /* IN: no. of chars (bytes) per data value */
243
int *felem; /* IN : first data item to be read */
244
int *maxvals; /* IN : max. vals to read */
248
ptr1 = strp_pntr(1); /* get stripped string of "key" */
249
ptr2 = loc_pntr(1,&mm); /* get location of "values" */
251
*status = SCKWRC(ptr1,*noelm,ptr2,*felem,*maxvals,&kunit);
256
/*==========================================================================*/
258
/*** stat = SCKWRI(key,values,felem,maxvals,kunit) ***/
260
ROUTINE STK10(values,felem,maxvals,status)
261
int *values; /* IN : buffer with data values */
262
int *felem; /* IN : first data item to be read */
263
int *maxvals; /* IN : max. vals to read */
267
ptr1 = strp_pntr(1); /* get stripped string of "key" */
269
*status = SCKWRI(ptr1,values,*felem,*maxvals,&kunit);
274
/*==========================================================================*/
276
/*** stat = SCKWRD(key,values,felem,maxvals,kunit) ***/
278
ROUTINE STK11(values,felem,maxvals,status)
279
double *values; /* IN : buffer with data values */
280
int *felem; /* IN : first data item to be read */
281
int *maxvals; /* IN : max. vals to read */
285
ptr1 = strp_pntr(1); /* get stripped string of "key" */
287
*status = SCKWRD(ptr1,values,*felem,*maxvals,&kunit);
292
/*==========================================================================*/
294
/*** stat = SCKWRR(key,values,felem,maxvals,kunit) ***/
296
ROUTINE STK12(values,felem,maxvals,status)
297
float *values; /* IN : buffer with data values */
298
int *felem; /* IN : first data item to be read */
299
int *maxvals; /* IN : max. vals to read */
303
ptr1 = strp_pntr(1); /* get stripped string of "key" */
305
*status = SCKWRR(ptr1,values,*felem,*maxvals,&kunit);
310
/*==========================================================================*/
312
/*** stat = SCKFND(key,type,noelem,bytelem,status) ***/
314
ROUTINE STK13(noelem,bytelem,status)
315
int *noelem; /* OUT: no. of elements */
316
int *bytelem; /* OUT: no. of bytes per element */
322
ptr1 = strp_pntr(1); /* get stripped string of "key" */
323
ptr1 = strp_pntr(1); /* get stripped string of "key" */
324
ptr2 = loc_pntr(1,&mm); /* get location of "type" */
326
*status = SCKFND(ptr1,ptr2,noelem,bytelem);
328
n = (int) strlen(ptr2);
329
if ((n > 0) && (n < mm)) *(ptr2+n) = ' ';
334
/*==========================================================================*/
336
/*** stat = SCKINF(npos,field,buf,numbuf) ***/
338
ROUTINE STK14(npos,field,numbuf,status)
339
int *npos; /* IN : position of keyword */
340
int *field; /* IN :specifies desired info, */
341
/* 1 = NAME, 2 = TYPE, 3 = SIZE */
342
int *numbuf; /* IN : max. length of buffer above */
348
ptr1 = loc_pntr(1,&mm); /* get location of "buf" */
351
*status = SCKINF(*npos,*field,ptr1,(mm-1),numbuf);
353
if (n != 3) /* treat char. result buffer */
355
n = (int) strlen(ptr1);
356
if ((n > 0) && (n < mm)) *(ptr1+n) = ' ';