File: tld.html

package info (click to toggle)
tendra-doc 4.1.2-7
  • links: PTS
  • area: main
  • in suites: sarge
  • size: 2,600 kB
  • ctags: 1,566
  • sloc: makefile: 32; sh: 3
file content (609 lines) | stat: -rw-r--r-- 28,967 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
<!-- Crown Copyright (c) 1998 -->
<HTML>
<HEAD>
<TITLE>
TDF Linker  
</TITLE>
</HEAD>

<BODY TEXT="#000000" BGCOLOR="#FFFFFF" LINK="#0000FF" VLINK="#400080" ALINK="#FF0000">

<H1>The TDF Linker</H1>
<H3>January 1998</H3>
<IMG SRC="../images/no_next.gif" ALT="next section">
<IMG SRC="../images/no_prev.gif" ALT="previous section">
<IMG SRC="../images/no_top.gif" ALT="current document">
<A HREF="../index.html"><IMG SRC="../images/home.gif" ALT="TenDRA home page">
</A>
<IMG SRC="../images/no_index.gif" ALT="document index"><P>

<HR>
<DL>
<DT><A HREF="#S1"><B>1</B> - Introduction</A><DD>
<DT><A HREF="#S2"><B>2</B> - Basic TDF structures</A><DD>
<DT><A HREF="#S3"><B>3</B> - Structure of a TDF Capsule</A><DD>
<DT><A HREF="#S4"><B>4</B> - Linker information unit groups</A><DD>
<DT><A HREF="#S5"><B>5</B> - Structure of a TDF library</A><DD>
<DT><A HREF="#S6"><B>6</B> - Purpose</A><DD>
<DT><A HREF="#S7"><B>7</B> - TDF Linking</A><DD>
<DL>
<DT><A HREF="#S71"><B>7.1</B> - Basic linking</A><DD>
<DT><A HREF="#S72"><B>7.2</B> - Renaming</A><DD>
<DT><A HREF="#S73"><B>7.3</B> - Library capsules</A><DD>
<DT><A HREF="#S74"><B>7.4</B> - Hiding</A><DD>
<DT><A HREF="#S75"><B>7.5</B> - Writing out the capsule</A><DD>
</DL>
<DT><A HREF="#S8"><B>8</B> - Constructing TDF Libraries</A><DD>
</DL>
<HR>
<H2><A NAME=S1>1. Introduction</A></H2>
<P>
This document describes the formats of the files used by the TDF linker
and the linker's required behaviour.  There are two file formats:
the capsule format and the library format.  It also describes the
format of the linker information units within capsules.  The capsule
format is described in more detail in the TDF specification.  
<P>
<HR>
<H2><A NAME=S2>2. Basic TDF structures</A></H2>
<P>
The structure of a TDF capsule is defined properly in the TDF specification.
This section describes the basic components of the TDF format that
the linker uses, and the remaining sections describe the format of
a TDF capsule, a TDF library and a linker information unit in terms
of these components.  The basic components are:  
<DL>
<DT><CODE>ALIGN</CODE><DD> This is a byte alignment.  It forces the
next object to begin on an eight bit boundary.<P>
<DT><CODE>TDFINT</CODE><DD> This is an unsigned number of unbounded
size.  Its representation is described properly in the TDF specification.
It is a series of nibbles (four bits), with the high bit used as a
terminator and the low three bits used as an octal digit.  The terminator
bit is set on the final octal digit.  As an example, the number ten
would be represented (in binary) as: 0001 1010.<P>
<DT><CODE>BYTE</CODE><DD>This is an eight bit quantity.  <CODE>BYTE</CODE>s
are always aligned on an eight bit boundary.<P>
<DT><CODE>TDFIDENT</CODE><DD>A <CODE>TDFIDENT</CODE> is a sequence
of characters.  It is possible to change the size of the characters,
although the current implementation will produce an error for <CODE>TDFIDENT
</CODE>s with character sizes other than eight bits.  A <CODE>TDFIDENT</CODE>
is represented by two <CODE>TDFINT</CODE>s (the size of the characters
in bits and the number of characters in the <CODE>TDFIDENT</CODE>),
and a sequence of <CODE>BYTE</CODE>s.<P>
<DT><CODE>UNIQUE</CODE><DD>A <CODE>UNIQUE</CODE> is a list of <CODE>TDFIDENT
</CODE>s.  It is represented as a  
<CODE>TDFINT</CODE> specifying the number of <CODE>TDFIDENT</CODE>s
in the <CODE>UNIQUE</CODE>, followed by that many <CODE>TDFIDENT</CODE>s.<P>
<DT><CODE>EXTERNAL</CODE><DD>An <CODE>EXTERNAL</CODE> is a mechanism
for identifying external identifiers.  It is represented as a discriminating
tag, followed by a byte alignment, followed by either a <CODE>TDFIDENT</CODE>
or a <CODE>UNIQUE</CODE>.  The tag is a two bit number, where one
represents a <CODE>TDFIDENT</CODE>, two represents a  
<CODE>UNIQUE</CODE>, and zero and three are currently illegal.  <CODE>UNIQUE
</CODE>s are only used as part of an <CODE>EXTERNAL</CODE>; <CODE>TDFIDENT
</CODE>s are used as entities in their own right, as well as in <CODE>EXTERNAL
</CODE>s.  
</DL>
<P>
In the following descriptions, the syntax <I>name: type</I> is used
to specify an object in the structure.  The <I>name</I> is used to
describe the purpose of the object; the <I>type</I> is used to describe
what the object is.  A <I>type</I> is one of the following:  
<DL>
<DT><I>basic_type</I><DD>This represents one of the basic types listed
above.<P>
<DT><I>type</I> * <I>integer</I><DD>This represents a sequence of
objects of the specified   type.  The <I>integer</I> may be either
an integer literal, or a   name that has been previously mentioned
and is a <CODE>TDFINT</CODE>
object.<P>
<DT>{ <I>name1</I>: <I>type1</I> ... <I>nameN</I>: <I>typeN</I> }<DD>This
represents a structure composed of the elements   <I>name1: type1</I>
to <I>nameN: typeN</I>.  It is used for   sequences of objects where
the objects are not of basic   types.<P>
<DT><I>type</I> = ( <I>value1</I> | ... | <I>valueN</I> )<DD>This
represents a type with a constraint imposed upon it.   The object
value must be one of <I>value1</I> to <I>valueN</I>.  
</DL>
<P>
<HR>
<H2><A NAME=S3>3. Structure of a TDF Capsule</A></H2>
<P>
A TDF capsule has the following structure:  
<PRE>
    magic				BYTE * 4 = &quot;TDFC&quot;
    major_version			TDFINT
    minor_version			TDFINT
					ALIGN
    num_prop_names:			TDFINT
    prop_names:				TDFIDENT * num_prop_names
    num_linkable_entities:		TDFINT
    linkable_entities: {
	name:				TDFIDENT
	num_capsule_scope_identifiers:	TDFINT
    } * num_linkable_entities
    num_external_linkages:		TDFINT = num_linkable_entities
    external_linkages: {
	num_entries:			TDFINT
	entries: {
	    capsule_scope_id:		TDFINT
	    external_name:		EXTERNAL
	} * num_entries
    } * num_external_linkages
    num_unit_groups:			TDFINT = num_prop_names
    unit_groups: {
	num_units:			TDFINT
	units: {
	    num_counts:			TDFINT = (num_linkable_entities | 0)
	    counts:			TDFINT * num_counts
	    num_link_sets:		TDFINT = num_counts
	    link_sets: {
		num_links:		TDFINT
		links: {
		    internal:		TDFINT
		    external:		TDFINT
		} * num_links
	    } * num_link_sets
	    num_bytes_tdf:		TDFINT
	    tdf:			BYTE * num_bytes_tdf
	} * num_units
    } * num_unit_groups
</PRE>
The rest of this section describes the format of a capsule.  
<P>
The capsule begins with a header that contains a four byte magic number
(<I>magic</I>: &quot;TDFC&quot;), followed by the major (<I>major_version</I>)
and minor (<I>minor_version</I>) version numbers of the TDF in the
capsule.  This is then followed by a byte alignment and then the the
capsule body.  
<P>
The first part of a capsule tells the linker how many types of unit
groups there are in the capsule (<I>num_prop_names</I>), and what
the names of these unit group types are (<I>prop_names</I>).  There
can be many unit group types, but the linker must know what they are
called, and the order in which they should occur.  At present the
linker knows about <I>tld</I>, <I>tld2</I>, <I>versions</I>,  
<I>tokdec</I>, <I>tokdef</I>, <I>aldef</I>, <I>diagtype</I>, <I>tagdec</I>,
<I>diagdef</I>, <I>tagdef</I> and  
<I>linkinfo</I> (this can be changed from the command line).  There
is nothing special about any unit group type except for the <I>tld</I>
unit group type, which contains information that the linker uses (and
the <I>tld2</I> unit group type, which is obsolete, but is treated
as a special case of the <I>tld</I> unit group type).  The format
of the <I>tld</I> unit group type is described in a later section.
<P>
The second part of the capsule tells the linker how many linkable
entities it should be linking on (<I>num_linkable_entities</I>), the
name of each linkable entity (<I>name</I>), and the number of identifiers
of each linkable entity at capsule scope (<I>num_capsule_scope_identifiers</I>).
Identifiers at capsule scope should be numbers from zero to one less
than  
<I>num_capsule_scope_identifiers</I>.  The identifier allocation may
be sparse, but the linker is optimized for continuous identifier allocation.
<P>
The third part of the capsule tells the linker which external names
the capsule contains for each linkable entity.  For each linkable
entity listed in the second part, the number of external names of
that linkable entity are listed in this part (<I>num_entries</I>),
along with each of the external names (<I>external_name</I>) and the
corresponding capsule scope identifiers (<I>capsule_scope_id</I>).
The ordering of the linkable entities in part three must be identical
to the ordering of linkable entities in part two.  
<P>
The fourth and final part of the capsule contains the unit groups
themselves.  The unit groups occur in the same order as the unit group
types were listed in part one.  For each unit group, there is a <CODE>TDFINT
</CODE> specifying the number of units in that unit group (<I>num_units</I>),
followed by that many units.  
<P>
Each unit contains a list of counts (<I>counts</I>) and the number
of counts in that list (<I>num_counts</I>), which must be either zero
or the same as the number of linkable entities in the capsule (<I>num_linkable_entities
</I>). Each count contains the number of unit scope identifiers of
the given linkable entity in the unit.  If the number of counts is
non-zero, then the counts must be in the same order as the linkable
entity names.  
<P>
After the counts come the unit scope identifier to capsule scope identifier
mapping tables.  The number of these tables is specified by  
<I>num_link_sets</I> and must be the same as the number of counts
(<I>num_counts</I>), which is either zero or the same as the number
of linkable entities in the capsule.  There is one table for each
linkable entity (if  
<I>num_link_sets</I> is non-zero), and each table contains <I>num_links</I>
pairs of <CODE>TDFINT</CODE>s.  The <I>internal</I> <CODE>TDFINT</CODE>
is the unit scope identifier; the  
<I>external</I> <CODE>TDFINT</CODE> is the capsule scope identifier.
<P>
After the mapping tables there is a length (<I>num_bytes_tdf</I>),
and that many bytes of TDF data (<I>tdf</I>).  
<P>
<HR>
<H2><A NAME=S4>4. Linker information unit groups</A></H2>
<P>
The <I>tld</I> unit group (if it exists in the capsule) should contain
one unit only.  This unit should begin with two zeroes (i.e. no counts,
and no identifier mapping tables), a length (which must be correct),
and a sequence of bytes.  
<P>
The bytes encode information useful to the linker.  The first thing
in the byte sequence of a <I>tld</I> unit is a <CODE>TDFINT</CODE>
that is the type of the unit. What follows depends upon the type.
There are currently two types that are supported: zero and one.  Type
zero units contain the same information as the old <I>tld2</I> units
(if a <I>tld2</I> unit is read, it is treated as if it were a <I>tld</I>
unit that began with a type of zero; it is illegal for a capsule to
contain both a <I>tld</I> unit group and a <I>tld2</I> unit group).
Type one units contain more information (described below), and are
what the linker writes out in the generated capsule.  
<P>
A version one unit contains a sequence of <CODE>TDFINT</CODE>s.  There
is one <CODE>TDFINT</CODE> for each external name in part two of the
capsule.  These <CODE>TDFINT</CODE>s should be in the same order as
the external names were.  The <CODE>TDFINT</CODE>s are treated as
a sequence of bits, with the following meanings:  
<BLOCKQUOTE>
<P>0 =  The name is used within this capsule.  
<P>1 =  The name is declared within this capsule.  
<P>2 =  The name is uniquely defined within this capsule.   If this
bit is set for a tag, then the declared bit   must also be set (i.e.
a declaration must exist).  
<P>3 =  The name is defined in this capsule, but may have   other
definitions provided by other capsules.  This   bit may not be set
for tokens.  If a tag has this   bit set, then the declared bit must
also be set   (i.e. a declaration must exist).  
</BLOCKQUOTE>
<P>
All of the other bits in the <CODE>TDFINT</CODE> are reserved.  The
linker uses the information provided by this unit to check that names
do not have multiple unique definitions, and to decide whether libraries
should be consulted to provide a definition for an external name.
If a capsule contains no linker information unit group, then the external
names in that capsule will have no information, and hence these checks
will not be made.  A similar situation arises when the information
for a name has no bits set.  
<P>
A version zero unit contains a sequence of <CODE>TDFINT</CODE>s. 
There is one <CODE>TDFINT</CODE>
for each external token name, and one <CODE>TDFINT</CODE> for each
external tag name. These <CODE>TDFINT</CODE>s should be in the same
order as the external names were (but the tokens always come before
the tags).  The <CODE>TDFINT</CODE>s are treated as a sequence of
bits, with the same meanings as above.  
<P>
<HR>
<H2><A NAME=S5>5. Structure of a TDF library</A></H2>
<P>
A TDF library begins with a header, followed by a <CODE>TDFINT</CODE>,
that is the type of the library.  At present only type zero libraries
are supported.  The format of a type zero library is as follows: 
<PRE>
    magic:				BYTE * 4 = &quot;TDFL&quot;
    major_version:			TDFINT
    minor_version:			TDFINT
					ALIGN
    type:				TDFINT = 0
    num_capsules:			TDFINT
    capsules: {
	capsule_name:			TDFIDENT
	capsule_length:			TDFINT
	capsule_body:			BYTE * capsule_length
    } * num_capsules
    num_linkable_entities:		TDFINT
    linkable_entities: {
	linkable_entity_name:		TDFIDENT
	num_this_linkable_entity:	TDFINT
	this_linkable_entity_names: {
	    name:			EXTERNAL
	    info:			TDFINT
	    capsule:			TDFINT
        } * num_this_linkable_entity
    } * num_linkable_entities
</PRE>
The library begins with a four byte magic number (<I>magic</I>: &quot;TDFL&quot;),
followed by the major (<I>major_version</I>) and minor (<I>minor_version</I>)
versions of the TDF in the library (the major version must be the
same for each capsule in the library; the minor version is the highest
of the minor version numbers of all of the the capsules contained
in the library).  This is followed by a byte alignment, the type of
the library (<I>type</I>: 0), and the number of capsules in the library
(<I>num_capsules</I>), followed by that many capsules.  
<P>
Each of the <I>capsules</I> has a name (<I>capsule_name</I>), and
the capsule content, which consists of the length of the capsule (<I>capsule_length
</I>) and that many bytes (<I>capsule_body</I>).  The capsule name
is the name of the file from which the capsule was obtained when the
library was built.  The names of capsules within a library must all
be different.  
<P>
The library is terminated by the index.  This contains information
about where to find definitions for external names.  The index begins
with the number of linkable entities whose external names the library
will provide definitions for (<I>num_linkable_entities</I>).  
<P>
For each of these linkable entities, the linkable entity index begins
with the name of the linkable entity (<I>linkable_entity_name</I>),
followed by the number of external names of the linkable entity that
have entries in the index (<I>num_this_linkable_entity</I>).  This
is followed by the index information for each of the names.  
<P>
For each name, the index contains the name (<I>name</I>); a <CODE>TDFINT</CODE>
that provides information about the name (<I>info</I>) with the same
meaning as the  
<CODE>TDFINT</CODE>s in the linker information units; and the index
of the capsule that contains the definition for the name (<I>capsule</I>).
The index of the first capsule is zero.  
<P>
<HR>
<H2><A NAME=S6>6. Purpose</A></H2>
<P>
The TDF linker has four uses:  
<UL>
<LI>To bind together a number of TDF capsules (including those in
libraries) to produce a single capsule.<P>
<LI>To produce a TDF library from a set of capsules.<P>
<LI>To list the contents of a TDF library.<P>
<LI>To extract capsules from a TDF library.  
</UL>
The most complex part of the linker is the normal linking process,
which is described in the next section.  Constructing libraries is
described in the section after the one on linking.  Listing the contents
of a library, and extracting capsules from a library are not very
complicated so they aren't described in this document.  
<P>
<HR>
<H2><A NAME=S7>7. TDF Linking</A></H2>
<P>
This section describes the requirements of linking capsules together.
The first sub-section describes the basic linking requirements.  Subsequent
sub-sections detail the requirements of some more advanced features.
<P>
Before the linking process is described in detail, here is an outline
of the stages of the link process:  
<BLOCKQUOTE>
<P>
The linker is invoked with the following inputs: a set of input  
capsules, a set of libraries, a set of hiding rules, a set of keeping
rules, a set of renaming rules, and a set of link suppression rules.
<P>
The first thing that the linker does is to enter the renaming rules
into the name hash table.  The name entry lookup routines will automatically
pick up the new name when a renamed name is looked up in a name table.
<P>
The next stage is to load the input capsules, and to bind them together.
As part of this binding process, the capsule scope identifiers for
all     input capsules are mapped into a single capsule scope (to
be output to     the final capsule).  The rules for this mapping are
described below.  
<P>
After binding the input capsules together, the linker tries to provide
definitions for undefined names using the specified libraries.  When
a     definition is found in a library (and it hasn't been suppressed
by the     link suppression rules), the capsule that contains it is
loaded and     bound to the input capsules as if it had been one itself.
<P>
After the library capsules have been bound in, external names are
hidden     according to the hiding rules, and kept according to the
keeping rules.     Hiding means removing an entry from the external
name list of the output     capsule.  Keeping means forcing an entry
into the list, if it would     otherwise be hidden.  It is illegal
to hide names that have no     definition.  
<P>
Finally the output capsule is written to a file.  
</BLOCKQUOTE>
<P>
<H3><A NAME=S71>7.1. Basic linking</A></H3>
<P>
This sub-section describes the process of binding capsules together
in greater detail.  
<P>
The first thing that the linker does when reading a capsule is to
read in the magic number, and the major and minor version numbers.
Capsules with an incorrect magic number are rejected.  The major version
number of each capsule read in must be at least four.  In addition,
the major version numbers of all capsules that are read in must be
the same.  
<P>

After this, the linker reads the unit group type names (also called
`prop names'), and checks that the they are known and that they are
in the correct order.  There is a default list of names built into
the linker (the list specified in the TDF specification) and that
should be sufficient for most uses of the linker, but it is possible
to provide a new list by specifying a file containing the new list
on the command line.  
<P>
The next thing the linker does is to read in the linkable entity names
and the capsule scope identifier limit for each linkable entity. 
It checks that there are no duplicate names, and creates a mapping
vector for each linkable entity, to contain the mapping from the capsule
scope identifiers in the capsule being read in to the capsule scope
identifiers in the capsule that will be written out.  
<P>
After reading the linkable entity names, the linker reads the external
names for each linkable entity.  For each name, it checks that its
capsule scope identifier is in range, and maps that to the next available
capsule scope identifier (for the same linkable entity) in the output
capsule, unless a name with the same linkable entity and the same
name (subject to the renaming rules) has already been read (in which
case it is mapped to the same capsule scope identifier as the identical
name).  The linker also checks to ensure that each capsule scope identifier
has no more than one external name bound to it.  
<P>
The final phase of reading a capsule is to read the unit groups. 
For normal (i.e. not <I>tld</I> or <I>tld2</I>) unit groups, the following
occurs for each unit in the unit group:  
<BLOCKQUOTE>
<P>
The unit scope identifier limits for each linkable entity are read
and     saved in the unit data structure (which is appended to the
list of units     in that unit group for all input capsules).  When
the unit is written     out in the output capsule, it may be necessary
to add extra unit scope     identifier limits (and extra mapping tables)
as other capsules may have     different linkable entities, which
will also need entries (they will     just be zero length).  
<P>
The capsule scope to unit scope identifier mapping tables are read,
and     the old capsule scope identifier (which is first checked to
see if it is     in range) is replaced by a new capsule scope identifier.
This     information is also saved in the unit data structure.  The
new capsule     scope identifiers are either the ones that were allocated
when reading     in the external names (if the old identifier is bound
to an external     name), or the next free capsule scope identifier
of the required     linkable entity.  
<P>
Finally, the unit body is read, and saved with the unit.  
</BLOCKQUOTE>
<P>
For <I>tld</I> and <I>tld2</I> unit groups, the unit group count is
checked to ensure that it is one, and the number of unit scope identifier
limits and identifier mapping tables are checked to ensure that they
are both zero. The size of the body is read (and it must be correct
as this is checked after reading the unit), and then the body is read.
If the unit is a <I>tld</I>
unit, then the type is read, and the body is read depending upon the
type; if the unit is a <I>tld2</I> unit, then the body is read as
if it where a type zero <I>tld</I> unit.  
<P>
A type zero <I>tld</I> unit consists of a number of integers: one
for each external token name, followed by one for each external tag
name (in the same order as the external name tables, but tokens always
precede tags).  A type one <I>tld</I> unit consists of a number of
integers: one for each external name (of all linkable entities), in
the same order as the external name tables.  
<P>
Each of the integers is interpreted as a series of bits, with the
bits having the following meanings:  
<BLOCKQUOTE>
0 =  The name is used within this capsule.  
<P>
1 =  The name is declared within this capsule.  
<P>
2 =  The name is uniquely defined within this capsule.  If    this
bit is set for a tag, then the declared bit    must also be set. 
It is illegal to have a name    uniquely defined in more than one
capsule.  If this    occurs, the linker will report an error.  
<P>
3 =  The name is defined in this capsule, but may have    other definitions
provided by other capsules.  This    bit may not be set for tokens.
If a tag has this    bit set, the declared bit must also be set. 
It is    possible for a name to provide a unique definition,    but
still allow other non-unique definitions to be    linked in from other
capsules.  
</BLOCKQUOTE>
All of the other bits in the integer are reserved.  The linker uses
the information provided by this unit to check that names do not have
multiple unique definitions, and to decide whether libraries should
be consulted to provide a definition for a name.  If a capsule contains
no linker information unit group, then the names in that capsule will
have no information, and hence will not receive the extra checking
or library definition.  
<P>
<H3><A NAME=S72>7.2. Renaming</A></H3>
<P>
Renaming just requires that any occurrence of the name being renamed
is treated as though it were an occurrence of the name it is being
renamed to. This includes names read from library indices.  
<P>
<H3><A NAME=S73>7.3. Library capsules</A></H3>
<P>
After reading in all of the specified capsules, the linker loads the
libraries.  The library indices are read, and checked to ensure that
there is no more than one definition for any external name.  If there
is no unique definition, but there is a single multiple definition,
then this is considered to be a definition (although this can be turned
off with a command line option).  
<P>
Once the libraries have been loaded, each of the external names in
the bound capsules that are used, but not defined are looked up in
the library index. If a definition is found (and it hasn't been suppressed)
then the defining capsule is loaded from the library.  This process
is repeated until definitions have been found for all external names
that need them (and that definitions exist for), including those that
are undefined in the capsules read in from the libraries.  
<P>
<H3><A NAME=S74>7.4. Hiding</A></H3>
<P>
Hiding and keeping just require that all names which should be hidden,
and are not required to be kept, are not written to the external name
table of the output capsule.  
<P>
<H3><A NAME=S75>7.5. Writing out the capsule</A></H3>
<P>
The magic number is written out, followed by the major and minor version
numbers.  The major version number is the same as that in each of
the loaded capsules.  The minor version number is the largest of the
minor version numbers in the loaded capsules.  
<P>
The unit group type names are written out first.  Only those unit
groups that are non-empty are actually written out.  They are written
out in the order specified by the current unit group name list.  
<P>
The linkable entity names are written out next, followed by their
capsule scope identifier limit.  Again, only those linkable entity
names that are non empty (i.e.  have some unit scope or capsule scope
identifiers) are written out.  
<P>
After the linkable entity names have been written out, the external
names are written out.  These are written out in an arbitrary order
within their linkable entities, with the linkable entities being written
out in the same order as in the linkable entity name section (which
is itself arbitrary, but must be repeatable).  The names are written
out with their new capsule scope identifiers.  External names that
have been hidden must not be written out.  
<P>
Finally the unit groups are written out in the same order as the unit
group type names in the first section.  For normal units, the old
counts (plus some zero counts that may be necessary if there are new
linkable entities that weren't in the unit's original capsule) are
written out in the same order as the linkable entity names in section
two.  The counts are followed by the new capsule scope to unit scope
identifier mapping tables, in the same order as the counts.  Finally
the old unit content is written out.  
<P>
For <I>tld</I> unit groups, a single version one <I>tld</I> unit is
written out containing the use information for each of the external
names, in the same order that the external names were written out
in.  
<P>
<HR>
<H2><A NAME=S8>8. Constructing TDF Libraries</A></H2>
<P>
This section describes the requirements of building TDF libraries.
Here is an outline of the stages of the construction process:  
<BLOCKQUOTE>
<P>
The linker is invoked with the following inputs: a set of input  
capsules, a set of libraries, and a set of link suppression rules.
<P>
The first thing that the linker does is to load the input capsules
(including all capsules that are included in any of the specified
libraries), and to extract their external name information into a
central index.  The index is checked to ensure that there is only
one     definition for any given name.  The capsules are read in in
the same way     as for linking them (this checks them for validity).
<P>
The suppression rules are applied, to ensure that no suppressed external
name will end up in the index in the output library.  
<P>
The library is written out.  The library consists of a magic number,
and     the major and minor version numbers of the TDF in the library
(calculated in the same way as for capsules), the type zero, followed
by     the number of capsules.  This is followed by that many capsule
name and     capsule content pairs.  Finally, the index is appended
to the library.  
<P>
The index only contains entries for linkable entities that have external
names defined by the library.  Only external names for which there
is a     definition are written into the index, although this is not
a     requirement (when linking, the linker will ignore index entries
that     don't provide a definition).  Either a unique definition
or a single     multiple definition are considered to be definitions
(although the     latter can be disabled using a command line option).
</BLOCKQUOTE>
<P>
<HR>
<P><I>Part of the <A HREF="../index.html">TenDRA Web</A>.<BR>Crown
Copyright &copy; 1998.</I></P>
</BODY>
</HTML>