1
/*===========================================================================
2
Copyright (C) 1995-2005 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
/*+++++++++ Remove ESO extensions to FORTRAN 77 ++++++++++++++++++++
29
.COPYRIGHT (c) 1994-2005 European Southern Observatory
32
.AUTHOR Preben J. Grosbol [ESO/IPG]
33
.KEYWORDS identifier table, long names
36
.VERSION 1.0 12-Nov-1987: Creation, PJG
37
.VERSION 1.1 14-Jan-1988: Add check for all id's, PJG
38
.VERSION 1.2 08-Sep-1988: Standard error lists, PJG
39
.VERSION 1.3 27-Apr-1994: Correct unique ID check, PJG
42
------------------------------------------------------------------------*/
45
#include <stdio.h> /* standard I/O functions */
46
#include <ctype.h> /* character types */
47
#include <string.h> /* string functions */
48
#include <f77ext.h> /* definition of constants */
50
extern int no_id; /* no. of identifiers */
51
extern ID idtbl[]; /* table of identifiers */
53
ID *add_id(id,size,type,group,err) /* add new identifier to list */
64
if (size<=0) return (ID *) 0; /* if zero length - return */
65
pidtbl = idtbl; *err = 0;
66
for (n=0; n<no_id; n++) { /* go through identifiers */
67
pid = id; tid = pidtbl->lname; i = size;
68
while ((c = *tid++) == *pid++ && c != '\0') i--;
69
if (!(c || i)) { /* identifier found, check it */
75
fprintf(stderr,"Error: Too many identifiers\n");
79
pidtbl->size = size; /* add new identifier to table */
81
pidtbl->group = group;
82
pidtbl->sname[0] = '\0';
84
while (size--) *tid++ = *id++; /* copy identifier over */
91
void new_id(id,size,new) /* make short identifier */
99
nomod = size < MXIDENT; /* no modification for short */
102
while (size--) { /* construct short ident. */
104
if (c=='_') { nomod = 0; continue; }
106
if (n<MXIDENT-1 || !size) *new++ = c;
108
if (nomod) *pc = '\0'; else *new = '\0';
113
int chk_id() /* check if short id's are uniq */
119
pid = idtbl; err = 0;
120
for (n=0; n<no_id; n++, pid++) {
121
if (*(sid = pid->sname)) { /* check only new ident's */
122
for (i=0; i<no_id; i++) /* compare with all short id */
123
if (i!=n && *(ssd=idtbl[i].sname))
124
if (!strcmp(ssd,sid)) {
126
fprintf(stderr,"Error: Identifier >%s< - >%s< : >%s<\n",
127
pid->lname,idtbl[i].lname,sid);
130
for (i=0; i<no_id; i++) /* compare with all long id */
131
if (!strcmp(idtbl[i].lname,sid)) {
133
fprintf(stderr,"Error: Identifier error >%s< : >%s<\n",