Subversion Repositories tendra.SVN

Rev

Rev 2 | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
2 7u83 1
/*
7 7u83 2
 * Copyright (c) 2002-2005 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
/*
2 7u83 32
    		 Crown Copyright (c) 1997
7 7u83 33
 
2 7u83 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:-
7 7u83 42
 
2 7u83 43
        (1) Its Recipients shall ensure that this Notice is
44
        reproduced upon any copies or amended versions of it;
7 7u83 45
 
2 7u83 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;
7 7u83 49
 
2 7u83 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;
7 7u83 53
 
2 7u83 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
#include "config.h"
62
#include "types.h"
63
#include "de_types.h"
7 7u83 64
#include "de_capsule.h"
2 7u83 65
#include "de_unit.h"
66
#include "decode.h"
67
#include "fetch.h"
68
#include "names.h"
69
#include "node.h"
70
#include "table.h"
71
#include "tdf.h"
72
#include "utility.h"
73
 
74
 
75
/*
76
    FLAG : DECODE STATUS
77
 
78
    A value of 0 indicates that we are decoding the names at the start
79
    of the capsule, 1 that we are decoding the linkage information, and
80
    2 that we are decoding a main equation body.
81
*/
82
 
7 7u83 83
int decode_status = -1;
2 7u83 84
 
85
 
86
/*
87
    FLAG : ONLY DECODE TOKEN DECLARATIONS
88
 
89
    This flag is true if we are only interested in the token
90
    declarations in a capsule.
91
*/
92
 
7 7u83 93
boolean extract_tokdecs = 0;
2 7u83 94
 
95
 
96
/*
97
    THE ARRAY OF ALL VARIABLE SORTS
98
 
99
    The array vars of size no_var gives all variable sorts.  The
100
    indexes in this array of the alignment tags, tags and tokens are
101
    given by al_tag_var, tag_var, tok_var respectively.
102
*/
103
 
7 7u83 104
static long no_var;
105
static var_sort *vars;
106
long al_tag_var, tag_var, tok_var;
2 7u83 107
 
108
 
109
/*
110
    LIST OF UNUSED CONSTRUCTS
111
 
112
    All unused constructs in a capsule are formed into a list for
113
    later reuse.
114
*/
115
 
7 7u83 116
static construct *garbage = null;
2 7u83 117
 
118
 
119
/*
120
    CURRENT BINDINGS
121
 
122
    The current bindings are held in crt_binding.  spare_binding, if not
123
    null, contains a binding suitable for reuse.
124
*/
125
 
7 7u83 126
binding *crt_binding;
127
static binding *spare_binding = null;
2 7u83 128
 
129
 
130
/*
131
    CREATE A NEW BINDING
132
 
133
    A new binding with space for no_var variable sorts is created and
134
    cleared.
135
*/
136
 
7 7u83 137
static binding *
138
new_binding(void)
2 7u83 139
{
7 7u83 140
    binding *b;
141
    long i, n = no_var;
142
    if (n == 0) return(null);
143
    if (spare_binding) {
144
	b = spare_binding;
145
	spare_binding = null;
146
	for (i = 0; i < n; i++)b[i].max_no = 0;
147
	return(b);
2 7u83 148
    }
7 7u83 149
    b = alloc_nof(binding, n);
150
    for (i = 0; i < n; i++) {
151
	b[i].max_no = 0;
152
	b[i].sz = 0;
153
	b[i].table = null;
2 7u83 154
    }
7 7u83 155
    return(b);
2 7u83 156
}
157
 
158
 
159
/*
160
    FREE A BINDING
161
 
162
    The binding b is returned to free.
163
*/
164
 
7 7u83 165
static void
166
free_binding(binding *b)
2 7u83 167
{
7 7u83 168
    spare_binding = b;
169
    return;
2 7u83 170
}
171
 
172
 
173
/*
174
    SET THE SIZE OF AN ENTRY IN A BINDING
175
 
176
    The size of the table of the vth variable sort in the binding bt
177
    is set to n.
178
*/
179
 
7 7u83 180
static void
181
set_binding_size(binding *bt, long v, long n)
2 7u83 182
{
7 7u83 183
    binding *b;
184
    construct **p;
185
    long i, m = n + 10;
186
    if (v < 0 || v >= no_var) {
187
	input_error("Illegal binding sort");
188
	return;
2 7u83 189
    }
7 7u83 190
    b = bt + v;
191
    b->max_no = n;
192
    if (b->sz < m) {
193
	p = realloc_nof(b->table, construct *, m);
194
	b->sz = m;
195
	b->table = p;
2 7u83 196
    } else {
7 7u83 197
	p = b->table;
2 7u83 198
    }
7 7u83 199
    for (i = 0; i < b->sz; i++)p[i] = null;
200
    return;
2 7u83 201
}
202
 
203
 
204
/*
205
    COMPLETE A BINDING
206
 
207
    The unused entries in the binding b are filled in.
208
*/
209
 
7 7u83 210
static void
211
complete_binding(binding *b)
2 7u83 212
{
7 7u83 213
    long v;
214
    for (v = 0; v < no_var; v++) {
215
	long i;
216
	binding *bv = b + v;
217
	sortname s = vars[v].sortnum;
218
	for (i = 0; i < bv->max_no; i++) {
219
	    if (bv->table[i] == null) {
220
		construct *p = make_construct(s);
221
		if (extract_tokdecs) {
2 7u83 222
		    /* This construct is unused - free it */
7 7u83 223
		   (sort_count[s]) --;
224
		    p->next = garbage;
225
		    garbage = p;
2 7u83 226
		} else {
227
		    /* Make up an internal name */
7 7u83 228
		    long n = p->encoding;
229
		    char *nm = alloc_nof(char, 32);
230
		    IGNORE sprintf(nm, "~~%s_%ld", vars[v].name, n);
231
		    p->name = nm;
232
		    if (add_to_var_hash(p, s)) {
233
			input_error("%s has already been defined", nm);
2 7u83 234
		    }
235
		}
7 7u83 236
		bv->table[i] = p;
2 7u83 237
	    }
238
	}
239
    }
7 7u83 240
    return;
2 7u83 241
}
242
 
243
 
244
/*
245
    SET AN ENTRY IN A BINDING
246
 
247
    The nth entry of the vth variable sort of the binding bt is set to
248
    the construct p.
249
*/
250
 
7 7u83 251
static void
252
set_binding(binding *bt, long v, long n, construct *p)
2 7u83 253
{
7 7u83 254
    binding *b;
255
    if (v < 0 || v >= no_var) {
256
	input_error("Illegal binding sort");
257
	return;
2 7u83 258
    }
7 7u83 259
    b = bt + v;
260
    if (n >= b->max_no || n < 0) {
261
	input_error("Object number %ld (%s) too big", n, vars[v].name);
262
	return;
2 7u83 263
    }
7 7u83 264
    if (b->table[n]) {
265
	input_error("Object %ld (%s) already bound", n, vars[v].name);
266
	return;
2 7u83 267
    }
7 7u83 268
    b->table[n] = p;
269
    return;
2 7u83 270
}
271
 
272
 
273
/*
274
    FIND AN ENTRY IN A BINDING
275
 
276
    The nth entry of the vth variable sort of the binding bt is returned.
277
*/
278
 
7 7u83 279
construct *
280
find_binding(binding *bt, long v, long n)
2 7u83 281
{
7 7u83 282
    binding *b;
283
    if (v < 0 || v >= no_var) {
284
	input_error("Illegal binding sort");
285
	return(null);
2 7u83 286
    }
7 7u83 287
    b = bt + v;
288
    if (n >= b->max_no || n < 0) {
289
	input_error("Object number %ld (%s) too big", n, vars[v].name);
290
	return(null);
2 7u83 291
    }
7 7u83 292
    return(b->table[n]);
2 7u83 293
}
294
 
295
 
296
/*
297
    DECODE AN ALIGNED STRING
298
 
299
    An aligned string (in an external name) is decoded and returned
300
    as an array of characters.
301
*/
302
 
7 7u83 303
static char *
304
de_aligned_string(void)
2 7u83 305
{
7 7u83 306
    char *p;
307
    long i, n = tdf_int();
308
    if (n != 8)input_error("Only 8-bit strings allowed");
309
    n = tdf_int();
310
    byte_align();
311
    p = alloc_nof(char, n + 1);
2 7u83 312
    for ( i = 0 ; i < n ; i++ ) p [i] = ( char ) fetch ( 8 ) /* LINT */ ;
7 7u83 313
    p[n] = 0;
314
    byte_align();
315
    return(p);
2 7u83 316
}
317
 
318
 
319
/*
320
    FLAG INDICATING SKIP PASS
321
 
322
    This flag is true if we are in the skip pass of a set of equations
323
    (primarily token definitions).
324
*/
325
 
7 7u83 326
boolean in_skip_pass = 0;
2 7u83 327
 
328
 
329
/*
330
    DECODE A SET OF EQUATIONS
331
 
332
    A set of equations with decoding routine f is decoded.  If f is null
333
    the equations are stepped over, otherwise they are decoded.
334
*/
335
 
7 7u83 336
typedef void(*equation_func)(void);
2 7u83 337
 
7 7u83 338
static void
339
de_equation(equation_func f)
2 7u83 340
{
7 7u83 341
    long i, n;
342
    binding *old_binding = null;
2 7u83 343
 
344
    /* Read new bindings */
7 7u83 345
    n = tdf_int();
346
    if (n) {
347
	if (n != no_var)input_error("Number of local variables wrong");
348
	old_binding = crt_binding;
349
	crt_binding = new_binding();
350
	for (i = 0; i < n; i++) {
351
	    long sz = tdf_int();
352
	    set_binding_size(crt_binding, i, sz);
2 7u83 353
	}
7 7u83 354
	n = tdf_int();
355
	if (n != no_var)input_error("Number of linkage units wrong");
356
	for (i = 0; i < n; i++) {
357
	    long j, no_links = tdf_int();
358
	    for (j = 0; j < no_links; j++) {
359
		long inner = tdf_int();
360
		long outer = tdf_int();
361
		construct *p = find_binding(old_binding, i, outer);
362
		set_binding(crt_binding, i, inner, p);
2 7u83 363
	    }
364
	}
7 7u83 365
	complete_binding(crt_binding);
2 7u83 366
    } else {
7 7u83 367
	n = tdf_int();
368
	if (n)input_error("Number of linkage units wrong");
2 7u83 369
    }
370
 
371
    /* Read the actual equation */
7 7u83 372
    n = BYTESIZE * tdf_int();
373
    byte_align();
374
    if (f == null) {
375
	input_skip(n);
2 7u83 376
    } else {
7 7u83 377
	long end_posn = input_posn() + n;
378
	decode_status = 2;
379
	(*f)();
380
	byte_align();
381
	decode_status = 1;
382
	if (input_posn()!= end_posn)input_error("Unit length wrong");
2 7u83 383
    }
384
 
385
    /* Restore the old bindings */
7 7u83 386
    if (old_binding) {
387
	free_binding(crt_binding);
388
	crt_binding = old_binding;
2 7u83 389
    }
7 7u83 390
    return;
2 7u83 391
}
392
 
393
 
394
/*
395
    DECODE A CAPSULE
396
 
397
    An entire TDF capsule is decoded.
398
*/
399
 
7 7u83 400
void
401
de_capsule(void)
2 7u83 402
{
7 7u83 403
    long i, n;
404
    long no_eqn;
405
    char **eqns;
2 7u83 406
 
407
    /* Reset variables */
7 7u83 408
    al_tag_var = -1;
409
    tag_var = -2;
410
    tok_var = -3;
411
    spare_binding = null;
412
    have_version = 0;
413
    decode_status = 0;
2 7u83 414
 
415
    /* Read magic number */
7 7u83 416
    de_magic(MAGIC_NUMBER);
2 7u83 417
 
418
    /* Read equation names */
7 7u83 419
    no_eqn = tdf_int();
420
    eqns = alloc_nof(char *, no_eqn);
421
    for (i = 0; i < no_eqn; i++)eqns[i] = de_aligned_string();
2 7u83 422
 
423
    /* Read variable sort names */
7 7u83 424
    no_var = tdf_int();
425
    vars = alloc_nof(var_sort, no_var);
426
    crt_binding = new_binding();
427
    for (i = 0; i < no_var; i++) {
428
	char *s = de_aligned_string();
429
	long sz = tdf_int();
430
	vars[i].name = s;
431
	if (streq(s, LINK_al_tag)) {
432
	    vars[i].sortnum = SORT_al_tag;
433
	    al_tag_var = i;
434
	} else if (streq(s, LINK_tag)) {
435
	    vars[i].sortnum = SORT_tag;
436
	    tag_var = i;
437
	} else if (streq(s, LINK_token)) {
438
	    vars[i].sortnum = SORT_token;
439
	    tok_var = i;
2 7u83 440
	} else {
7 7u83 441
	    vars[i].sortnum = SORT_unknown;
2 7u83 442
	}
7 7u83 443
	set_binding_size(crt_binding, i, sz);
2 7u83 444
    }
445
 
446
    /* Read external names */
7 7u83 447
    decode_status = 1;
448
    n = tdf_int();
449
    if (n != no_var)input_error("Number of variable sorts wrong");
450
    for (i = 0; i < no_var; i++) {
451
	static int un = 0;
452
	sortname si = vars[i].sortnum;
453
	long j, no_links = tdf_int();
454
	boolean reject = 0;
455
	if (extract_tokdecs && i != tok_var)reject = 1;
456
	for (j = 0; j < no_links; j++) {
457
	    construct *p, *q;
458
	    long id = tdf_int();
459
	    n = de_external_bits();
460
	    byte_align();
461
	    p = make_construct(si);
462
	    if (extract_tokdecs) {
463
		(sort_count[si]) --;
464
		p->encoding = -1;
2 7u83 465
	    }
466
 
7 7u83 467
	    if (n == ENC_string_extern) {
2 7u83 468
		/* Simple external name */
7 7u83 469
		boolean name_ok = 1;
470
		node *ns = de_node("=");
471
		if (reject) {
472
		    free_node(ns);
2 7u83 473
		} else {
474
		    /* Check that name is a valid identifier */
7 7u83 475
		    char *nm = ns->cons->name;
476
		    if (alpha(*nm)) {
477
			long k;
478
			for (k = 1; k < ns->cons->encoding; k++) {
479
			    char c = nm[k];
480
			    if (!alphanum(c))name_ok = 0;
2 7u83 481
			}
482
		    } else {
7 7u83 483
			name_ok = 0;
2 7u83 484
		    }
7 7u83 485
		    if (name_ok) {
2 7u83 486
			/* Use external name as internal name */
7 7u83 487
			p->name = nm;
488
			if (!is_local_name(nm)) {
489
			    p->ename = new_node();
490
			    p->ename->cons = &false_cons;
2 7u83 491
			}
492
		    } else {
493
			/* Make up internal name */
7 7u83 494
			p->name = alloc_nof(char, 32);
495
			IGNORE sprintf(p->name, "~~extern_%d", un++);
496
			if (!is_local_name(nm)) {
497
			    p->ename = new_node();
498
			    p->ename->cons = &true_cons;
499
			    p->ename->son = ns;
2 7u83 500
			}
501
		    }
502
		}
7 7u83 503
	    } else if (n == ENC_unique_extern) {
2 7u83 504
		/* Unique external name */
7 7u83 505
		node *nu = de_node("%[=]");
506
		if (reject) {
507
		    free_node(nu);
2 7u83 508
		} else {
509
		    /* Make up internal name */
7 7u83 510
		    p->name = alloc_nof(char, 32);
511
		    IGNORE sprintf(p->name, "~~extern_%d", un++);
512
		    p->ename = new_node();
513
		    p->ename->cons = &true_cons;
514
		    p->ename->son = nu;
2 7u83 515
		}
7 7u83 516
	    } else if (n == ENC_chain_extern) {
2 7u83 517
		/* Chain external name */
7 7u83 518
		node *nc = de_node("=i");
519
		if (reject) {
520
		    free_node(nc);
2 7u83 521
		} else {
522
		    /* Make up internal name */
7 7u83 523
		    p->name = alloc_nof(char, 32);
524
		    IGNORE sprintf(p->name, "~~extern_%d", un++);
525
		    p->ename = new_node();
526
		    p->ename->cons = &true_cons;
527
		    p->ename->son = nc;
2 7u83 528
		}
529
	    } else {
7 7u83 530
		input_error("Illegal EXTERN value, %ld", n);
2 7u83 531
	    }
532
 
533
	    /* Add construct to tables */
7 7u83 534
	    if (reject) {
535
		set_binding(crt_binding, i, id, p);
536
		p->next = garbage;
537
		garbage = p;
2 7u83 538
	    } else {
7 7u83 539
		q = add_to_var_hash(p, si);
540
		if (q) {
541
		    if (!extract_tokdecs) {
542
			(sort_count[si]) --;
543
			if (q->encoding == -1) {
544
			    q->encoding = (sort_count[si]) ++;
2 7u83 545
			}
546
		    }
7 7u83 547
		    set_binding(crt_binding, i, id, q);
548
		    p->next = garbage;
549
		    garbage = p;
2 7u83 550
		} else {
7 7u83 551
		    set_binding(crt_binding, i, id, p);
2 7u83 552
		}
553
	    }
554
	}
555
    }
556
 
557
    /* Complete the bindings */
7 7u83 558
    complete_binding(crt_binding);
2 7u83 559
 
560
    /* Read the equations */
7 7u83 561
    n = tdf_int();
562
    if (n != no_eqn)input_error("Number of equations wrong");
563
    for (i = 0; i < no_eqn; i++) {
564
	char *eq = eqns[i];
565
	long j, no_units = tdf_int();
566
	if (no_units) {
567
	    boolean skip_pass = 0;
568
	    equation_func f = null;
2 7u83 569
 
570
	    /* Find equation decoding routine */
7 7u83 571
	    if (extract_tokdecs) {
572
		if (streq(eq, LINK_tokdec_props)) {
573
		    f = de_tokdec;
574
		} else if (streq(eq, LINK_tokdef_props)) {
575
		    f = de_tokdef;
576
		    in_skip_pass = 1;
2 7u83 577
		}
578
	    } else {
7 7u83 579
		if (streq(eq, LINK_al_tagdef_props)) {
580
		    f = de_aldef;
581
		} else if (streq(eq, LINK_tagdec_props)) {
582
		    f = de_tagdec;
583
		} else if (streq(eq, LINK_tagdef_props)) {
584
		    f = de_tagdef;
585
		} else if (streq(eq, LINK_tokdec_props)) {
586
		    f = de_tokdec;
587
		} else if (streq(eq, LINK_tokdef_props)) {
588
		    f = de_tokdef;
589
		    skip_pass = 1;
590
		} else if (streq(eq, LINK_version_props)) {
591
		    f = de_version;
2 7u83 592
		}
593
	    }
594
 
595
	    /* Skip pass */
7 7u83 596
	    if (skip_pass) {
597
		long old_posn = input_posn();
598
		in_skip_pass = 1;
599
		for (j = 0; j < no_units; j++)de_equation(f);
600
		in_skip_pass = 0;
601
		input_goto(old_posn);
2 7u83 602
	    }
603
 
604
	    /* Main pass */
7 7u83 605
	    for (j = 0; j < no_units; j++)de_equation(f);
606
	    in_skip_pass = 0;
2 7u83 607
	}
608
    }
609
 
610
    /* Free unused constructs */
7 7u83 611
    free_construct(&garbage);
612
    return;
2 7u83 613
}
614
 
615
 
616
/*
617
    NAME OF CURRENT CAPSULE
618
 
619
    The current capsule of a library is recorded to use in error messages.
620
*/
621
 
7 7u83 622
char *capname = null;
2 7u83 623
 
624
 
625
/*
626
    DECODE A TDF LIBRARY
627
*/
628
 
7 7u83 629
void
630
de_library(void)
2 7u83 631
{
7 7u83 632
    long old_posn;
633
    long i, no_cap;
634
    boolean old_extract = extract_tokdecs;
2 7u83 635
 
7 7u83 636
    de_magic(MAGIC_LINK_NUMBER);
637
    IGNORE tdf_int();
638
    no_cap = tdf_int();
639
    old_posn = input_posn();
2 7u83 640
 
641
    /* First pass - extract all token declaration */
7 7u83 642
    extract_tokdecs = 1;
643
    for (i = 0; i < no_cap; i++) {
644
	long end_posn;
645
	long j, n;
646
	decode_status = 0;
647
	n = tdf_int();
648
	if (n != 8)input_error("Only 8-bit strings allowed");
649
	n = tdf_int();
650
	byte_align();
651
	capname = alloc_nof(char, n + 1);
652
	for (j = 0; j < n; j++) {
2 7u83 653
	    capname [j] = ( char ) fetch ( 8 ) ; /* LINT */
654
	}
7 7u83 655
	capname[n] = 0;
656
	n = BYTESIZE * tdf_int();
657
	byte_align();
658
	end_posn = input_posn() + n;
659
	de_capsule();
660
	byte_align();
661
	if (input_posn()!= end_posn) {
662
	    input_error("Capsule length wrong");
2 7u83 663
	}
7 7u83 664
	capname = null;
2 7u83 665
    }
666
 
667
    /* Second pass - if the first pass didn't do everything */
7 7u83 668
    extract_tokdecs = old_extract;
669
    if (extract_tokdecs) return;
670
    input_goto(old_posn);
671
    for (i = 0; i < no_cap; i++) {
672
	long end_posn;
673
	long j, n;
674
	decode_status = 0;
675
	n = tdf_int();
676
	if (n != 8)input_error("Only 8-bit strings allowed");
677
	n = tdf_int();
678
	byte_align();
679
	capname = alloc_nof(char, n + 1);
680
	for (j = 0; j < n; j++) {
2 7u83 681
	    capname [j] = ( char ) fetch ( 8 ) ; /* LINT */
682
	}
7 7u83 683
	capname[n] = 0;
684
	n = BYTESIZE * tdf_int();
685
	byte_align();
686
	end_posn = input_posn() + n;
687
	de_capsule();
688
	byte_align();
689
	if (input_posn()!= end_posn) {
690
	    input_error("Capsule length wrong");
2 7u83 691
	}
7 7u83 692
	capname = null;
2 7u83 693
    }
7 7u83 694
    return;
2 7u83 695
}