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
===========================================================================*/
36
#include <midas_def.h>
40
extern int sstrfind(), ssdelim(), sstsnum();
43
int decrypt1(column,line,selecrit,temp)
44
char *line,*selecrit,*column,*temp;
48
if (!*line) return(0);
49
oscfill(temp,256,'\0');
50
strcat(selecrit,column);
51
if (!*line) return(0);
53
if (sstrfind(line,"~*[=")) {
54
/* strcat(selecrit,".EQ."); */
55
if (*line == '=') line++;
57
else if ((*line == '!') && (*(line+1) == '=')) {
60
strcat(selecrit,".NE.");
62
else if (*line == '<') {
66
strcat(selecrit,".LE.");
69
else strcat(selecrit,".LT.");
71
else if (*line == '>') {
75
strcat(selecrit,".GE.");
78
else strcat(selecrit,".GT.");
80
/* else strcat(selecrit,".EQ."); */
82
while(!ssdelim(line) && (*line)) {
86
k = strindex(temp,"..");
88
strcat(selecrit,".GE.");
89
strncat(selecrit,temp,k);
90
strcat(selecrit,".AND.");
91
strcat(selecrit,column);
93
strcat(selecrit,".LE.");
94
strcat(selecrit,temp);
97
if (!str) strcat(selecrit,".EQ.");
98
if (sstsnum(temp) <= 0) {
99
strcat(selecrit,"\"");
100
strcat(selecrit,temp);
101
strcat(selecrit,"\"");
103
else strcat(selecrit,temp);
105
if (*line == '|') strcat(selecrit,".OR.");
106
else if (*line == '&') strcat(selecrit,".AND.");
107
if (*line == '\0') return(0);
109
decrypt1(column,line,selecrit,temp);