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
/*++++++++++++++++++++++++ stf.fc +++++++++++++++++++++++++++++++++++++++
30
.IDENTIFICATION Module stf.fc
32
Module contains layer between the frame 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] 880415: modified new version - the last one
39
.VERSION [2.70] 890119: add SZCFRNM
40
.VERSION [2.80] 900316: fix problem with FNAME_LEN+2 ...
41
.VERSION [3.00] 901213: Master file. CG.
44
-----------------------------------------------------------------------------*/
46
#include <ftoc_comm.h>
47
#include <midas_def.h>
54
char *ptr1, *ptr2, *ptr3, *ptr4;
62
/*==========================================================================*/
64
/*** stat = SCFOPN(name,dattype,iomode,filtype,no) ***/
66
ROUTINE STF1(dattype,iomode,filtype,no,status)
67
int *dattype; /* IN: data types as defined in Module header */
68
int *iomode; /* IN: I/O mode for opening */
69
int *filtype; /* IN: filetype, e.g. F_IMA_TYPE, ... */
70
int *no; /* OUT: file no. of the frame */
74
ptr1 = strp_pntr(1); /* get stripped string of "name" */
76
*status = SCFOPN(ptr1,*dattype,*iomode,*filtype,no);
81
/*==========================================================================*/
83
/*** stat = SCFCRE(name,dattype,iomode,filtype,size,no) ***/
85
ROUTINE STF2(dattype,iomode,filtype,size,no,status)
86
int *dattype; /* IN: data types as defined in Module header */
87
int *iomode; /* IN: I/O mode for opening */
88
int *filtype; /* IN: filetype no., e.g. F_TBL_TYPE, ... */
89
int *size; /* IN: size of object = no. of data values in file */
90
int *no; /* OUT: file no. */
94
ptr1 = strp_pntr(1); /* get stripped string of "name" */
96
*status = SCFCRE(ptr1,*dattype,*iomode,*filtype,*size,no);
101
/*==========================================================================*/
103
/*** stat = SCFXCR(name,dattype,iomode,filtype,size,optflags,no) ***/
105
ROUTINE STF3(dattype,iomode,filtype,size,optflags,no,status)
106
int *dattype; /* IN: data types as defined in Module header */
107
int *iomode; /* IN: I/O mode for opening */
108
int *filtype; /* IN: filetype no., e.g. F_TBL_TYPE, ... */
109
int *size; /* IN: size of object = no. of data values in file */
110
int *optflags; /* IN: option for cloning descriptors (int array)
111
= 0, NO (then same as SCFCRE)
112
= 1, Yes (optio(2) = imno of source frame) */
113
int *no; /* OUT: file no. */
117
ptr1 = strp_pntr(1); /* get stripped string of "name" */
119
*status = SCFXCR(ptr1,*dattype,*iomode,*filtype,*size,optflags,no);
124
/*==========================================================================*/
126
/*** stat = SCFMAP(no,iomode,felem,size,actsize,pntr) ***/
128
ROUTINE STF4(no,iomode,felem,size,actsize,pntr,status)
129
int *no; /* IN: file no */
130
int *iomode; /* IN: I/O mode for opening */
131
int *felem; /* IN : 1st pixel to be accessed in data space */
132
int *size; /* IN : number of data values (pixels) to be mapped */
133
int *actsize; /* OUT: actual no. of pixels mapped */
134
long int *pntr; /* OUT: pointer to data in memory */
144
*status = SCFMAP(*no,*iomode,*felem,*size,actsize,&mypntr);
146
lowmadr = (int) IS_HIGH(mypntr);
147
diff = (long int) COMMON_INDEX(mypntr);
156
/*==========================================================================*/
158
/*** stat = SCFCLO(no) ***/
160
ROUTINE STFCLO(no,status)
161
int *no; /* IN: file no. of data frame */
165
*status = SCFCLO(*no);
170
/*==========================================================================*/
172
/*** stat = SCFUNM(no) ***/
174
ROUTINE STFUNM(no,status)
175
int *no; /* IN: file of data frame */
179
*status = SCFUNM(*no);
184
/*==========================================================================*/
186
/*** stat = SCFDEL(name) ***/
192
ptr1 = strp_pntr(1); /* get stripped string of "name" */
194
*status = SCFDEL(ptr1);
200
/*==========================================================================*/
202
/*** stat = SCFRNM(oldname,newname) ***/
208
ptr1 = strp_pntr(1); /* get stripped string of "oldname" */
209
ptr2 = strp_pntr(2); /* get stripped string of "newname" */
211
*status = SCFRNM(ptr1,ptr2);
216
/*==========================================================================*/
218
/*** stat = SCFGET(no,felem,size,actsize,bufadr) ***/
220
ROUTINE STFGET(no,felem,size,actsize,bufadr,status)
221
int *no; /* IN : file no. of data frame */
222
int *felem; /* IN : 1st pixel to be accessed in data space */
223
int *size; /* IN : number of data values (pixels) to be read */
224
int *actsize; /* OUT: actual no. of pixels read */
225
long int *bufadr; /* IN: address of data buffer */
229
*status = SCFGET(*no,*felem,*size,actsize,(char *)bufadr);
235
/*==========================================================================*/
237
/*** stat = SCFPUT(no,felem,size,bufadr) ***/
239
ROUTINE STFPUT(no,felem,size,bufadr,status)
240
int *no; /* IN : file no. of data frame */
241
int *felem; /* IN : 1st pixel to be accessed in data space */
242
int *size; /* IN : number of data values (pixels) to be written */
243
long int *bufadr; /* IN: address of data buffer */
247
*status = SCFPUT(*no,*felem,*size,(char *)bufadr);
253
/*==========================================================================*/
255
/*** stat = SCFINF(name,fno,ibuf) ***/
257
ROUTINE STF7(fno,ibuf,status)
258
int *fno; /* IN: specify desired info,*/
260
/* 1 = version_no.,file_type,FCB.SWPSHORT */
261
/* FCB.SWPLONG,FCB.FLOTFMT */
262
/* 2 = nobyte,format,pixpbl,stblok,lastblk */
263
/* 3 = FCB.PTRLDB,LEXBDF,PEXBDF,ENDLDB, */
264
/* INDLDB,DBEGIN,DFILLED,DSIZE */
265
/* 99 = just check, if frame exists */
266
int *ibuf; /* OUT: buffer with desired info */
270
ptr1 = strp_pntr(1); /* get stripped string of "name" */
272
*status = SCFINF(ptr1,*fno,ibuf);
278
/*==========================================================================*/
280
/*** stat = SCFNAM(no,name,namlen) ***/
282
ROUTINE STF8(no,namlen,status)
283
int *no; /* IN : no. of data frame */
284
int *namlen; /* IN: max. length of name */
291
ptr1 = loc_pntr(1,&mm); /* get location of "name", available space */
293
*status = SCFNAME(*no,ptr1,*namlen);
295
n = (int) strlen(ptr1);
296
if ((n > 0) && (n < *namlen)) *(ptr1+n) = ' ';
301
/*==========================================================================*/
303
/*** stat = SCFXMP(nopix,datform,pntr) ***/
305
ROUTINE STFXMP(nopix,datform,pntr,status)
306
int *nopix; /* IN: no. of pixels we need memory for */
307
int *datform; /* IN: data format of */
308
long int *pntr; /* OUT: pointer to mapped data */
319
*status = SCFXMP(*nopix,*datform,&mypntr);
321
lowmadr = (int) IS_HIGH(mypntr);
322
diff = (long int) COMMON_INDEX(mypntr);
332
/*==========================================================================*/
334
/*** stat = SCFYMP(nopix,datform,imno,pntr) ***/
336
ROUTINE STFYMP(nopix,datform,imno,pntr,status)
337
int *nopix; /* IN: no. of pixels we need memory for */
338
int *datform; /* IN: data format of */
339
int *imno; /* OUT: file id */
340
long int *pntr; /* OUT: pointer to mapped data */
349
*status = SCFYMP(*nopix,*datform,imno,&mypntr);
351
lowmadr = (int) IS_HIGH(mypntr);
352
diff = (long int) COMMON_INDEX(mypntr);