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
/*++++++++++++++++++++++++ tbd.fc +++++++++++++++++++++++++++++++++++++++
30
.IDENTIFICATION Module tbd.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_log.h> /* LOGICAL */
49
#include <midas_def.h>
58
char *ptr1, *ptr2, *ptr3, *ptr4;
66
/*==========================================================================*/
68
/*** stat = TCFGET(tid col,form,len,dtype) ***/
70
ROUTINE TBF1(tid, col, len, dtype, status)
71
int *tid; /* IN : table identifier */
72
int *col; /* IN: Column */
73
int *len; /* OUT: Bytes required for edited elemen */
74
int *dtype; /* OUT: data type */
75
int *status; /* OUT: status return */
78
ptr1 = loc_pntr(1,&mm); /* get location of "form" */
82
char myform[TBL_FORLEN+1];
84
*status = TCFGET(*tid, *col, myform, len, dtype);
85
n = (int) strlen(myform);
86
if ((n > 0) && (n < (TBL_FORLEN+1)))
88
(void) strncpy (ptr1,myform,(size_t)n);
94
*status = TCFGET(*tid, *col, ptr1, len, dtype);
95
n = (int) strlen(ptr1);
96
if ((n > 0) && (n < mm))
105
/*==========================================================================*/
107
/*** stat = TCFPUT(tid, col, form) ***/
109
ROUTINE TBF2(tid, col, status)
110
int *tid; /* IN : table identifier */
111
int *col; /* IN : column */
112
int *status; /* OUT: status return */
115
ptr1 = strp_pntr(1); /* get stripped string of "form" */
117
*status = TCFPUT(*tid, *col, ptr1);
122
/*==========================================================================*/
124
/*** stat = TCIGET(tid, cols, rows, nsort, acols, arows) ***/
126
ROUTINE TBIGET(tid, cols, rows, nsort, acols, arows, status)
127
int *tid; /* IN : table identifier */
128
int*cols; /* OUT: Number of Columns */
129
int *rows; /* OUT: Number of Rows */
130
int *nsort; /* OUT: Sorted Column Number */
131
int *acols; /* OUT: Number of Alloc.Columns */
132
int *arows; /* OUT: Number of Alloc. Rows */
133
int *status; /* OUT: status return */
136
*status = TCIGET(*tid, cols, rows, nsort, acols, arows);
141
/*==========================================================================*/
143
/*** stat = TCIPUT(tid, cols, rows) ***/
145
ROUTINE TBIPUT(tid, cols, rows, status)
146
int *tid; /* IN : table identifier */
147
int *cols; /* IN : no. of columns */
148
int *rows; /* IN : no. of rows */
149
int *status; /* OUT: status return */
152
*status = TCIPUT(*tid, *cols, *rows);
157
/*==========================================================================*/
159
/*** stat = TCKGET(tid, col) ***/
161
ROUTINE TBKGET(tid, col, status)
162
int *tid; /* IN : table identifier */
163
int *col; /* OUT : reference column */
164
int *status; /* OUT: status return */
167
*status = TCKGET(*tid, col);
172
/*==========================================================================*/
174
/*** stat = TCKPUT(tid, col) ***/
176
ROUTINE TBKPUT(tid, col, status)
177
int *tid; /* IN : table identifier */
178
int *col; /* IN : reference column */
179
int *status; /* OUT: status return */
182
*status = TCKPUT(*tid, *col);
187
/*==========================================================================*/
189
/*** stat = TCLGET(tid, col, label) ***/
191
ROUTINE TBL1(tid, col, status)
192
int *tid; /* IN : table identifier */
193
int *col; /* IN : column no. */
194
int *status; /* OUT: status return */
197
ptr1 = loc_pntr(1,&mm); /* get location of "label" */
199
if (mm <= TBL_LABLEN)
201
char mylabel[TBL_LABLEN+1];
203
*status = TCLGET(*tid,*col,mylabel);
205
n = (int) strlen(mylabel);
206
if ((n > 0) && (n < (TBL_LABLEN+1)))
208
(void) strncpy (ptr1,mylabel,(size_t)n);
214
*status = TCLGET(*tid, *col, ptr1);
216
n = (int) strlen(ptr1);
217
if ((n > 0) && (n < mm))
227
/*==========================================================================*/
229
/*** stat = TCLPUT(tid, col, label) ***/
231
ROUTINE TBL2(tid, col, status)
232
int *tid; /* IN : table identifier */
233
int *col; /* IN : column no. */
234
int *status; /* OUT: status return */
237
ptr1 = strp_pntr(1); /* get stripped string of "label" */
239
*status = TCLPUT(*tid, *col, ptr1);
244
/*==========================================================================*/
246
/*** stat = TCLSER(tid, label, col) ***/
248
ROUTINE TBL3(tid, col, status)
249
int *tid; /* IN : table identifier */
250
int *col; /* OUT : column no. */
251
int *status; /* OUT: status return */
254
ptr1 = strp_pntr(1); /* get stripped string of "label" */
256
*status = TCLSER(*tid, ptr1, col);
261
/*==========================================================================*/
263
/*** stat = TCSGET(tid, row, value) ***/
265
ROUTINE TBSGET(tid, row, value, status)
266
int *tid; /* IN : table identifier */
267
int *row; /* IN : Row concerned */
268
int *value; /* OUT : Selection Flag */
269
int *status; /* OUT: status return */
272
*status = TCSGET(*tid, *row, value);
274
*value = (*value ? F77TRUE : F77FALSE);
279
/*==========================================================================*/
281
/*** stat = TCSPUT(tid, row, value) ***/
283
ROUTINE TBSPUT(tid, row, value, status)
284
int *tid; /* IN : table identifier */
285
int *row; /* IN : Row concerned */
286
int *value; /* IN : Selection Flag */
287
int *status; /* OUT: status return */
290
*status = TCSPUT(*tid, *row, *value == F77FALSE ? &zero : &one);
295
/*==========================================================================*/
297
/*** stat = TCSINI(tid) ***/
299
ROUTINE TBSINI(tid, status)
300
int *tid; /* IN : table identifier */
301
int *status; /* OUT: status return */
304
*status = TCSINI(*tid);
309
/*==========================================================================*/
311
/*** stat = TCUGET(tid,col,tunit) ***/
313
ROUTINE TBU1(tid,col,status)
314
int *tid; /* IN : table identifier */
315
int *col; /* IN: column number */
316
int *status; /* OUT: status return */
319
ptr1 = loc_pntr(1,&mm); /* get location of "tunit" */
321
if (mm <= TBL_UNILEN)
323
char myunit[TBL_UNILEN+1];
325
*status = TCUGET(*tid,*col,myunit);
327
n = (int) strlen(myunit);
328
if ((n > 0) && (n < (TBL_UNILEN+1)))
330
(void) strncpy (ptr1,myunit,(size_t)n);
335
*status = TCUGET(*tid, *col, ptr1);
337
n = (int) strlen(ptr1);
338
if ((n > 0) && (n < mm))
347
/*==========================================================================*/
349
/*** stat = TCUPUT(tid,col,tunit) ***/
351
ROUTINE TBU2(tid,col,status)
352
int *tid; /* IN : table identifier */
353
int *col; /* IN: column number */
354
int *status; /* OUT: status return */
357
ptr1 = strp_pntr(1); /* get stripped string of "tunit" */
359
*status = TCUPUT(*tid,*col,ptr1);
364
/*==========================================================================*/
366
/*** stat = TCDGET(tid,store) ***/
368
ROUTINE TBDGET(tid,store,status)
369
int *tid; /* IN : table identifier */
370
int *store; /* OUT: physical format (0 for columnwise) */
371
int *status; /* OUT: status return */
374
*status = TCDGET(*tid,store);