Subversion Repositories tendra.SVN

Rev

Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
2 7u83 1
/*
2
    		 Crown Copyright (c) 1997
3
 
4
    This TenDRA(r) Computer Program is subject to Copyright
5
    owned by the United Kingdom Secretary of State for Defence
6
    acting through the Defence Evaluation and Research Agency
7
    (DERA).  It is made available to Recipients with a
8
    royalty-free licence for its use, reproduction, transfer
9
    to other parties and amendment for any purpose not excluding
10
    product development provided that any such use et cetera
11
    shall be deemed to be acceptance of the following conditions:-
12
 
13
        (1) Its Recipients shall ensure that this Notice is
14
        reproduced upon any copies or amended versions of it;
15
 
16
        (2) Any amended version of it shall be clearly marked to
17
        show both the nature of and the organisation responsible
18
        for the relevant amendment or amendments;
19
 
20
        (3) Its onward transfer from a recipient to another
21
        party shall be deemed to be that party's acceptance of
22
        these conditions;
23
 
24
        (4) DERA gives no warranty or assurance as to its
25
        quality or suitability for any purpose and DERA accepts
26
        no liability whatsoever in relation to any use to which
27
        it may be put.
28
*/
29
 
30
 
31
/**********************************************************************
32
$Author: release $
33
$Date: 1998/01/17 15:57:24 $
34
$Revision: 1.1.1.1 $
35
$Log: find_id.c,v $
36
 * Revision 1.1.1.1  1998/01/17  15:57:24  release
37
 * First version to be checked into rolling release.
38
 *
39
 * Revision 1.1  1995/04/07  14:29:07  currie
40
 * Initial revision
41
 *
42
 * Revision 1.2  1994/07/21  10:36:11  currie
43
 * Added banner
44
 *
45
***********************************************************************/
46
#include "config.h"
47
#include "util.h"
48
#include "defs.h"
49
#include "find_id.h"
50
#include "syntax.h"
51
 
52
 
53
Tagdec * tagdecs;
54
Tagdec * localdecs;
55
Tokdec * tokdecs;
56
Labdec * labdecs;
57
Al_tagdec * al_tagdecs;
58
 
59
 
60
Tagdec * find_tag
61
    PROTO_N ( (n) )
62
    PROTO_T ( char * n )
63
{
64
    Tagdec * t = tagdecs;
65
    while (t != (Tagdec *)0) {
66
  	if (strcmp(n, t->idname.id) == 0) return t;
67
  	t = t->next;
68
    }
69
    t = localdecs;
70
    while (t != (Tagdec *)0) {
71
  	if (strcmp(n, t->idname.id) == 0) break;
72
  	t = t->next;
73
    }
74
    return t;
75
}
76
 
77
Tokdec * find_tok
78
    PROTO_N ( (n) )
79
    PROTO_T ( char * n )
80
{
81
    Tokdec * t = tokdecs;
82
    while (t != (Tokdec *)0) {
83
  	if (strcmp(n, t->idname.id) == 0) break;
84
  	t = t->next;
85
    }
86
    return t;
87
}
88
 
89
Labdec * find_lab
90
    PROTO_N ( (n) )
91
    PROTO_T ( char * n )
92
{
93
    Labdec * t = labdecs;
94
    while (t != (Labdec *)0) {
95
  	if (strcmp(n, t->idname.id) == 0) break;
96
  	t = t->next;
97
    }
98
    return t;
99
}
100
 
101
Al_tagdec * find_al_tag
102
    PROTO_N ( (n) )
103
    PROTO_T ( char * n )
104
{
105
    Al_tagdec * t = al_tagdecs;
106
    while (t != (Al_tagdec *)0) {
107
  	if (strcmp(n, t->idname.id) == 0) break;
108
  	t = t->next;
109
    }
110
    return t;
111
}
112
 
113
static int tok_kind
114
    PROTO_N ( (x) )
115
    PROTO_T ( Sort * x )
116
{
117
    switch(x->sort) {
118
	case access_sort: return access_tok;
119
	case al_tag_sort: return al_tag_tok;
120
	case bitfield_variety_sort:return bitfield_variety_tok;
121
	case error_treatment_sort: return error_treatment_tok;
122
	case exp_sort: return exp_tok;
123
	case floating_variety_sort: return floating_variety_tok;
124
	case label_sort: return label_tok;
125
	case nat_sort: return nat_tok;
126
	case ntest_sort: return ntest_tok;
127
	case rounding_mode_sort: return rounding_mode_tok;
128
	case shape_sort: return shape_tok;
129
	case signed_nat_sort: return signed_nat_tok;
130
	case tag_sort: return tag_tok;
131
	case token_sort: return tok_kind(&x->toksort->ressort);
132
	case variety_sort: return variety_tok;
133
    }
134
    fail("Not a sort - internal error");
135
    return 0;
136
}
137
 
138
void tidy_labels
139
    PROTO_N ( (old) )
140
    PROTO_T ( Labdec * old )
141
{
142
    Labdec ** rl = & labdecs;
143
    while (*rl != old) {
144
	if ((*rl)->declared) {
145
	    *rl = (*rl)->next;
146
	} else {
147
	    rl = &((*rl)->next);
148
	}
149
    }
150
}