Warning: Attempt to read property "date" on null in /usr/local/www/websvn.planix.org/blame.php on line 247

Warning: Attempt to read property "msg" on null in /usr/local/www/websvn.planix.org/blame.php on line 247
WebSVN – tendra.SVN – Blame – /trunk/src/tools/tpl/find_id.c – Rev 6

Subversion Repositories tendra.SVN

Rev

Go to most recent revision | Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
6 7u83 1
/*
2
 * Copyright (c) 2002-2006 The TenDRA Project <http://www.tendra.org/>.
3
 * All rights reserved.
4
 *
5
 * Redistribution and use in source and binary forms, with or without
6
 * modification, are permitted provided that the following conditions are met:
7
 *
8
 * 1. Redistributions of source code must retain the above copyright notice,
9
 *    this list of conditions and the following disclaimer.
10
 * 2. Redistributions in binary form must reproduce the above copyright notice,
11
 *    this list of conditions and the following disclaimer in the documentation
12
 *    and/or other materials provided with the distribution.
13
 * 3. Neither the name of The TenDRA Project nor the names of its contributors
14
 *    may be used to endorse or promote products derived from this software
15
 *    without specific, prior written permission.
16
 *
17
 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS
18
 * IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
19
 * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
20
 * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR
21
 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
22
 * EXEMPLARY OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
23
 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
24
 * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
25
 * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
26
 * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
27
 * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
28
 *
29
 * $Id$
30
 */
31
/*
32
    		 Crown Copyright (c) 1997
33
 
34
    This TenDRA(r) Computer Program is subject to Copyright
35
    owned by the United Kingdom Secretary of State for Defence
36
    acting through the Defence Evaluation and Research Agency
37
    (DERA).  It is made available to Recipients with a
38
    royalty-free licence for its use, reproduction, transfer
39
    to other parties and amendment for any purpose not excluding
40
    product development provided that any such use et cetera
41
    shall be deemed to be acceptance of the following conditions:-
42
 
43
        (1) Its Recipients shall ensure that this Notice is
44
        reproduced upon any copies or amended versions of it;
45
 
46
        (2) Any amended version of it shall be clearly marked to
47
        show both the nature of and the organisation responsible
48
        for the relevant amendment or amendments;
49
 
50
        (3) Its onward transfer from a recipient to another
51
        party shall be deemed to be that party's acceptance of
52
        these conditions;
53
 
54
        (4) DERA gives no warranty or assurance as to its
55
        quality or suitability for any purpose and DERA accepts
56
        no liability whatsoever in relation to any use to which
57
        it may be put.
58
*/
59
 
60
 
61
/**********************************************************************
62
$Author: release $
63
$Date: 1998/01/17 15:57:24 $
64
$Revision: 1.1.1.1 $
65
$Log: find_id.c,v $
66
 * Revision 1.1.1.1  1998/01/17  15:57:24  release
67
 * First version to be checked into rolling release.
68
 *
69
 * Revision 1.1  1995/04/07  14:29:07  currie
70
 * Initial revision
71
 *
72
 * Revision 1.2  1994/07/21  10:36:11  currie
73
 * Added banner
74
 *
75
***********************************************************************/
76
#include "config.h"
77
#include "util.h"
78
#include "defs.h"
79
#include "find_id.h"
80
#include "syntax.h"
81
 
82
 
83
Tagdec *tagdecs;
84
Tagdec *localdecs;
85
Tokdec *tokdecs;
86
Labdec *labdecs;
87
Al_tagdec *al_tagdecs;
88
 
89
 
90
Tagdec *
91
find_tag(char * n)
92
{
93
	Tagdec *t = tagdecs;
94
	while (t != (Tagdec *)0) {
95
		if (strcmp(n, t->idname.id) == 0) {
96
			return t;
97
		}
98
		t = t->next;
99
	}
100
	t = localdecs;
101
	while (t != (Tagdec *)0) {
102
		if (strcmp(n, t->idname.id) == 0) {
103
			break;
104
		}
105
		t = t->next;
106
	}
107
	return t;
108
}
109
 
110
 
111
Tokdec *
112
find_tok(char * n)
113
{
114
	Tokdec * t = tokdecs;
115
	while (t != (Tokdec *)0) {
116
		if (strcmp(n, t->idname.id) == 0) {
117
			break;
118
		}
119
		t = t->next;
120
	}
121
	return t;
122
}
123
 
124
 
125
Labdec *
126
find_lab(char * n)
127
{
128
	Labdec *t = labdecs;
129
	while (t != (Labdec *)0) {
130
		if (strcmp(n, t->idname.id) == 0) {
131
			break;
132
		}
133
		t = t->next;
134
	}
135
	return t;
136
}
137
 
138
 
139
Al_tagdec *
140
find_al_tag(char * n)
141
{
142
	Al_tagdec *t = al_tagdecs;
143
	while (t != (Al_tagdec *)0) {
144
		if (strcmp(n, t->idname.id) == 0) {
145
			break;
146
		}
147
		t = t->next;
148
	}
149
	return t;
150
}
151
 
152
 
153
static int
154
tok_kind(Sort * x)
155
{
156
	switch (x->sort) {
157
	case access_sort:
158
		return access_tok;
159
	case al_tag_sort:
160
		return al_tag_tok;
161
	case bitfield_variety_sort:
162
		return bitfield_variety_tok;
163
	case error_treatment_sort:
164
		return error_treatment_tok;
165
	case exp_sort:
166
		return exp_tok;
167
	case floating_variety_sort:
168
		return floating_variety_tok;
169
	case label_sort:
170
		return label_tok;
171
	case nat_sort:
172
		return nat_tok;
173
	case ntest_sort:
174
		return ntest_tok;
175
	case rounding_mode_sort:
176
		return rounding_mode_tok;
177
	case shape_sort:
178
		return shape_tok;
179
	case signed_nat_sort:
180
		return signed_nat_tok;
181
	case tag_sort:
182
		return tag_tok;
183
	case token_sort:
184
		return tok_kind(&x->toksort->ressort);
185
	case variety_sort:
186
		return variety_tok;
187
	}
188
	fail("Not a sort - internal error");
189
	return 0;
190
}
191
 
192
void
193
tidy_labels(Labdec *old)
194
{
195
	Labdec **rl = &labdecs;
196
	while (*rl != old) {
197
		if ((*rl)->declared) {
198
			*rl = (*rl)->next;
199
		} else {
200
			rl = &((*rl)->next);
201
		}
202
	}
203
}