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 |
/*** map-entry.c --- Mapping table entry ADT.
|
|
|
32 |
*
|
|
|
33 |
** Author: Steve Folkes <smf@hermes.mod.uk>
|
|
|
34 |
*
|
|
|
35 |
*** Commentary:
|
|
|
36 |
*
|
|
|
37 |
* This file implements the mapping table entry routines used by the TDF
|
|
|
38 |
* linker.
|
|
|
39 |
*
|
|
|
40 |
*** Change Log:
|
|
|
41 |
* $Log: map-entry.c,v $
|
|
|
42 |
* Revision 1.1.1.1 1998/01/17 15:57:18 release
|
|
|
43 |
* First version to be checked into rolling release.
|
|
|
44 |
*
|
|
|
45 |
* Revision 1.3 1995/09/22 08:39:21 smf
|
|
|
46 |
* Fixed problems with incomplete structures (to shut "tcc" up).
|
|
|
47 |
* Fixed some problems in "name-key.c" (no real problems, but rewritten to
|
|
|
48 |
* reduce the warnings that were output by "tcc" and "gcc").
|
|
|
49 |
* Fixed bug CR95_354.tld-common-id-problem (library capsules could be loaded
|
|
|
50 |
* more than once).
|
|
|
51 |
*
|
|
|
52 |
* Revision 1.2 1994/12/12 11:46:27 smf
|
|
|
53 |
* Performing changes for 'CR94_178.sid+tld-update' - bringing in line with
|
|
|
54 |
* OSSG C Coding Standards.
|
|
|
55 |
*
|
|
|
56 |
* Revision 1.1.1.1 1994/07/25 16:03:32 smf
|
|
|
57 |
* Initial import of TDF linker 3.5 non shared files.
|
|
|
58 |
*
|
|
|
59 |
**/
|
|
|
60 |
|
|
|
61 |
/****************************************************************************/
|
|
|
62 |
|
|
|
63 |
#include "map-entry.h"
|
|
|
64 |
#include "shape-table.h"
|
|
|
65 |
|
|
|
66 |
#include "solve-cycles.h"
|
|
|
67 |
|
|
|
68 |
/*--------------------------------------------------------------------------*/
|
|
|
69 |
|
|
|
70 |
MapEntryP
|
|
|
71 |
map_entry_create PROTO_N ((key, next, count))
|
|
|
72 |
PROTO_T (NStringP key X
|
|
|
73 |
MapEntryP next X
|
|
|
74 |
unsigned count)
|
|
|
75 |
{
|
|
|
76 |
MapEntryP entry = ALLOCATE (MapEntryT);
|
|
|
77 |
|
|
|
78 |
entry->next = next;
|
|
|
79 |
nstring_copy (&(entry->key), key);
|
|
|
80 |
entry->count = count;
|
|
|
81 |
return (entry);
|
|
|
82 |
}
|
|
|
83 |
|
|
|
84 |
MapEntryP
|
|
|
85 |
map_entry_next PROTO_N ((entry))
|
|
|
86 |
PROTO_T (MapEntryP entry)
|
|
|
87 |
{
|
|
|
88 |
return (entry->next);
|
|
|
89 |
}
|
|
|
90 |
|
|
|
91 |
NStringP
|
|
|
92 |
map_entry_key PROTO_N ((entry))
|
|
|
93 |
PROTO_T (MapEntryP entry)
|
|
|
94 |
{
|
|
|
95 |
return (&(entry->key));
|
|
|
96 |
}
|
|
|
97 |
|
|
|
98 |
void
|
|
|
99 |
map_entry_set_num_links PROTO_N ((entry, num_links))
|
|
|
100 |
PROTO_T (MapEntryP entry X
|
|
|
101 |
unsigned num_links)
|
|
|
102 |
{
|
|
|
103 |
entry->num_links = num_links;
|
|
|
104 |
entry->links = ALLOCATE_VECTOR (MapLinkT, num_links);
|
|
|
105 |
}
|
|
|
106 |
|
|
|
107 |
void
|
|
|
108 |
map_entry_set_link PROTO_N ((entry, link, internal, external))
|
|
|
109 |
PROTO_T (MapEntryP entry X
|
|
|
110 |
unsigned link X
|
|
|
111 |
unsigned internal X
|
|
|
112 |
unsigned external)
|
|
|
113 |
{
|
|
|
114 |
ASSERT (link < entry->num_links);
|
|
|
115 |
entry->links [link].internal = internal;
|
|
|
116 |
entry->links [link].external = external;
|
|
|
117 |
}
|
|
|
118 |
|
|
|
119 |
unsigned
|
|
|
120 |
map_entry_get_count PROTO_N ((entry))
|
|
|
121 |
PROTO_T (MapEntryP entry)
|
|
|
122 |
{
|
|
|
123 |
return (entry->count);
|
|
|
124 |
}
|
|
|
125 |
|
|
|
126 |
unsigned
|
|
|
127 |
map_entry_get_num_links PROTO_N ((entry))
|
|
|
128 |
PROTO_T (MapEntryP entry)
|
|
|
129 |
{
|
|
|
130 |
return (entry->num_links);
|
|
|
131 |
}
|
|
|
132 |
|
|
|
133 |
void
|
|
|
134 |
map_entry_get_link PROTO_N ((entry, link, internal_ref, external_ref))
|
|
|
135 |
PROTO_T (MapEntryP entry X
|
|
|
136 |
unsigned link X
|
|
|
137 |
unsigned *internal_ref X
|
|
|
138 |
unsigned *external_ref)
|
|
|
139 |
{
|
|
|
140 |
ASSERT (link < entry->num_links);
|
|
|
141 |
*internal_ref = entry->links [link].internal;
|
|
|
142 |
*external_ref = entry->links [link].external;
|
|
|
143 |
}
|
|
|
144 |
|
|
|
145 |
/*--------------------------------------------------------------------------*/
|
|
|
146 |
|
|
|
147 |
void
|
|
|
148 |
map_entry_check_non_empty PROTO_N ((entry, gclosure))
|
|
|
149 |
PROTO_T (MapEntryP entry X
|
|
|
150 |
GenericP gclosure)
|
|
|
151 |
{
|
|
|
152 |
ShapeTableP table = (ShapeTableP) gclosure;
|
|
|
153 |
|
|
|
154 |
if (entry->count > 0) {
|
|
|
155 |
NStringP key = map_entry_key (entry);
|
|
|
156 |
ShapeEntryP shape_entry = shape_table_get (table, key);
|
|
|
157 |
|
|
|
158 |
shape_entry_set_non_empty (shape_entry);
|
|
|
159 |
}
|
|
|
160 |
}
|
|
|
161 |
|
|
|
162 |
/*
|
|
|
163 |
* Local variables(smf):
|
|
|
164 |
* eval: (include::add-path-entry "../os-interface" "../library")
|
|
|
165 |
* eval: (include::add-path-entry "../generated")
|
|
|
166 |
* end:
|
|
|
167 |
**/
|