/* @(#)tbcopytk.c 17.1.1.1 (ES0-DMD) 01/25/02 17:47:11 */ /*=========================================================================== Copyright (C) 1995 European Southern Observatory (ESO) This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 675 Massachusetss Ave, Cambridge, MA 02139, USA. Corresponding concerning ESO-MIDAS should be addressed as follows: Internet e-mail: midas@eso.org Postal address: European Southern Observatory Data Management Division Karl-Schwarzschild-Strasse 2 D 85748 Garching bei Muenchen GERMANY ===========================================================================*/ /*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ .TYPE Module .NAME tbcopytk.c .LANGUAGE C .AUTHOR IPG-ESO Garching .CATEGORY table utilities .RETURNS status .PURPOSE \begin{TeX} Copy table entry(s) into a keyword. If columns are not defined in the command, the full table row is copied into the keyword. If the keyword does not exist, it is created by the program. This command is equivalent to the MCL statement keyword = table,column,row Parameters: \begin{description} \item[p1] table name. \item[p2-pj] column reference(s). \item[pj+1] entry (row) number. \item[pj+2] output keyword. \end{description} \end{TeX} .VERSION 1.0 25-Mar-1990 Definition J.D. Ponz . Corrected 7-Mar-1990 M.Peron . Corrected 8-Oct-1990 M,Peron ------------------------------------------------------------*/ #include #include #include #include #define STRINGLEN 256 #define PARLEN 80 #define NCOL 10 tbl_copytk() { char table[PARLEN], column[PARLEN], line[STRINGLEN]; char form[9], ws[10], keyw[PARLEN], kname[10], cval[STRINGLEN], *kun; int tid, ncol, nrow, nsort, ncall, nrall, niden, knul; int len, i, status, ival, ierr, ic, irow, type, k, iav, sel; int ktype, istart, nval, j, npar, inull[NCOL], ibuf[NCOL], icol[NCOL]; float rval, rerr, rbuf[NCOL]; double dval, derr, dbuf[NCOL]; double atof(); ierr = 0; rerr = 0; derr = 0; status = SCKRDI("PCOUNT",1,1,&iav,&npar,&kun,&knul); if (npar < 3) {SCTPUT("Wrong number of parameters"); return (status); } /* read parameter */ status = tbl_getpar("P1",PARLEN,table); /* open tablefile */ status = TCTOPN(table, F_I_MODE, &tid); if (status != ERR_NORMAL) {SCTPUT("Error opening the table"); return (status); } TCIGET(tid, &ncol, &nrow, &nsort, &ncall, &nrall); /* read keyword */ sprintf(ws,"P%d",npar); status = tbl_getpar(ws,PARLEN,keyw); for (i=0; i