~ubuntu-branches/debian/jessie/eso-midas/jessie

« back to all changes in this revision

Viewing changes to stdred/do/src/tbcheck.c

  • Committer: Package Import Robot
  • Author(s): Ole Streicher
  • Date: 2014-04-22 14:44:58 UTC
  • Revision ID: package-import@ubuntu.com-20140422144458-okiwi1assxkkiz39
Tags: upstream-13.09pl1.2+dfsg
ImportĀ upstreamĀ versionĀ 13.09pl1.2+dfsg

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*===========================================================================
 
2
  Copyright (C) 1993-2009 European Southern Observatory (ESO)
 
3
 
 
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.
 
8
 
 
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.
 
13
 
 
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 Massachusetss Ave, Cambridge, 
 
17
  MA 02139, USA.
 
18
 
 
19
  Corresponding 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 
 
25
                        GERMANY
 
26
===========================================================================*/
 
27
 
 
28
/*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 
29
..TYPE        Module
 
30
..NAME        tbrules.c
 
31
..LANGUAGE    C
 
32
..AUTHOR      IPG-ESO Garching
 
33
..CATEGORY    Data Organizer utilities 
 
34
..COMMENTS       This module implements the following Midas commands:
 
35
\begin{TeX}
 
36
\begin{enumerate}
 
37
\item {\tt CREATE/RULE table rule
 
38
\end{enumerate}
 
39
\end{TeX}
 
40
 
 
41
..VERSION  1.0   15-Mar-1993  Definition     M. Peron
 
42
 
 
43
 130703         last modif
 
44
-----------------------------------------------------------------*/
 
45
 
 
46
#include <atype.h>
 
47
#include <tbldef.h>
 
48
#include <tblsys.h>
 
49
#include <tblerr.h>
 
50
#include <midas_def.h>
 
51
#include <macrogen.h>
 
52
#include <proto_tbl.h>
 
53
#define issign(c)               ((c == '+') || (c == '-'))
 
54
 
 
55
 
 
56
 
 
57
int main()
 
58
{
 
59
int tid,tid0,nicol,nirow,norow;
 
60
int null, dummy,exist;
 
61
int colc,colb,colf,cold,colname,col[256];
 
62
int i,j,coltype,mycol,nmiss ;
 
63
char action[2],*descrname;
 
64
char intable[60],inkey[60],label[1+TBL_LABLEN],exptype[60],filename[60];
 
65
char text[256];
 
66
int kuni;
 
67
double dvalue;
 
68
 
 
69
 
 
70
SCSPRO("tbcheck");
 
71
SCKGETC("IN_A",1L,60L,&dummy,intable);
 
72
SCKGETC("IN_B",1L,60L,&dummy,inkey);
 
73
SCKGETC("ACTION",1L,1L,&dummy,action);
 
74
TCTOPN(intable,F_IO_MODE,&tid0);
 
75
TCIGET(tid0,&nicol,&nirow,&dummy,&dummy,&dummy);
 
76
TCLSER(tid0,"EXPTYPE",&coltype);
 
77
TCLSER(tid0,"FILENAME",&colname);
 
78
strcpy(action,"K");
 
79
if (action[0] == 'C') {
 
80
      TCTINI("TEMP_TAB",F_TRANS,F_IO_MODE,4,nicol,&tid);
 
81
      TCCINI(tid,D_C_FORMAT,17L,"A17"," ","COLUMN",&colc);
 
82
      for (i=0; i<nicol; i++) {
 
83
         TCLGET(tid0,i+1,label);
 
84
         TCEWRC(tid,i+1,1L,label);
 
85
      }
 
86
      TCCINI(tid,D_I4_FORMAT,1,"I1"," ","BIAS",&colb);
 
87
      TCCINI(tid,D_I4_FORMAT,1,"I1"," ","DARK",&cold);
 
88
      TCCINI(tid,D_I4_FORMAT,1,"I1"," ","FF",&colf);
 
89
      }
 
90
else {
 
91
     TCTOPN(inkey,F_I_MODE,&tid);
 
92
     TCIGET(tid,&dummy,&norow,&dummy,&dummy,&dummy);
 
93
     descrname = osmmget(norow*(1+TBL_LABLEN));
 
94
     for (j=0; j<norow; j++) {
 
95
         TCERDC(tid,j+1,1,descrname+j*(1+TBL_LABLEN),&null);
 
96
         TCLSER(tid0,descrname+j*(1+TBL_LABLEN),&col[j]);
 
97
     }
 
98
     for (i=1; i<=nirow; i++) {
 
99
         TCERDC(tid0,i,colname,filename,&null);
 
100
         TCERDC(tid0,i,coltype,exptype,&null); 
 
101
         TCCSER(tid,exptype,&mycol);
 
102
         nmiss = 0;
 
103
         strcpy(text,"Missing Keywords: ");
 
104
         for (j=0; j<norow; j++) {
 
105
             TCERDI(tid,j+1,mycol,&exist,&null);
 
106
             if (exist) {
 
107
                TCERDD(tid0,i,col[j],&dvalue,&null);
 
108
                if (null) {
 
109
                   strcat(text,descrname+j*(1+TBL_LABLEN));
 
110
                   strcat(text," ");
 
111
                   nmiss++;
 
112
                   }
 
113
                }
 
114
             }
 
115
         if (nmiss) SCDWRC(tid0,filename,1,text,1,256,&kuni);
 
116
         }
 
117
}
 
118
SCSEPI();
 
119
return 0;
 
120
}
 
121