Subversion Repositories tendra.SVN

Rev

Rev 2 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 2 Rev 7
Line -... Line 1...
-
 
1
/*
-
 
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
 */
1
/*
31
/*
2
    		 Crown Copyright (c) 1997
32
    		 Crown Copyright (c) 1997
3
    
33
 
4
    This TenDRA(r) Computer Program is subject to Copyright
34
    This TenDRA(r) Computer Program is subject to Copyright
5
    owned by the United Kingdom Secretary of State for Defence
35
    owned by the United Kingdom Secretary of State for Defence
6
    acting through the Defence Evaluation and Research Agency
36
    acting through the Defence Evaluation and Research Agency
7
    (DERA).  It is made available to Recipients with a
37
    (DERA).  It is made available to Recipients with a
8
    royalty-free licence for its use, reproduction, transfer
38
    royalty-free licence for its use, reproduction, transfer
9
    to other parties and amendment for any purpose not excluding
39
    to other parties and amendment for any purpose not excluding
10
    product development provided that any such use et cetera
40
    product development provided that any such use et cetera
11
    shall be deemed to be acceptance of the following conditions:-
41
    shall be deemed to be acceptance of the following conditions:-
12
    
42
 
13
        (1) Its Recipients shall ensure that this Notice is
43
        (1) Its Recipients shall ensure that this Notice is
14
        reproduced upon any copies or amended versions of it;
44
        reproduced upon any copies or amended versions of it;
15
    
45
 
16
        (2) Any amended version of it shall be clearly marked to
46
        (2) Any amended version of it shall be clearly marked to
17
        show both the nature of and the organisation responsible
47
        show both the nature of and the organisation responsible
18
        for the relevant amendment or amendments;
48
        for the relevant amendment or amendments;
19
    
49
 
20
        (3) Its onward transfer from a recipient to another
50
        (3) Its onward transfer from a recipient to another
21
        party shall be deemed to be that party's acceptance of
51
        party shall be deemed to be that party's acceptance of
22
        these conditions;
52
        these conditions;
23
    
53
 
24
        (4) DERA gives no warranty or assurance as to its
54
        (4) DERA gives no warranty or assurance as to its
25
        quality or suitability for any purpose and DERA accepts
55
        quality or suitability for any purpose and DERA accepts
26
        no liability whatsoever in relation to any use to which
56
        no liability whatsoever in relation to any use to which
27
        it may be put.
57
        it may be put.
28
*/
58
*/
29
 
59
 
30
 
60
 
31
#include "config.h"
61
#include "config.h"
32
#include "types.h"
62
#include "types.h"
-
 
63
#include "capsule.h"
33
#include "basic.h"
64
#include "basic.h"
34
#include "binding.h"
65
#include "binding.h"
35
#include "file.h"
66
#include "file.h"
36
#include "sort.h"
67
#include "sort.h"
37
#include "tdf.h"
68
#include "tdf.h"
Line 47... Line 78...
47
    attempt to rationalize its input, or whether it will just blindly
78
    attempt to rationalize its input, or whether it will just blindly
48
    output what it reads.  If show_stuff is true information on the
79
    output what it reads.  If show_stuff is true information on the
49
    number of tags and tokens etc will be output.
80
    number of tags and tokens etc will be output.
50
*/
81
*/
51
 
82
 
52
int dumb_mode = 0 ;
83
int dumb_mode = 0;
53
int show_stuff = 0 ;
84
int show_stuff = 0;
54
 
85
 
55
 
86
 
56
/*
87
/*
57
    SKIP PASS FOR TOKEN DEFINITIONS FLAG
88
    SKIP PASS FOR TOKEN DEFINITIONS FLAG
58
 
89
 
Line 62... Line 93...
62
    This feature can be switch on and off using the skip_pass flag.
93
    This feature can be switch on and off using the skip_pass flag.
63
    If show_skip is true the information read on the skip pass is
94
    If show_skip is true the information read on the skip pass is
64
    displayed.  skipping is true iff we are in the skip pass.
95
    displayed.  skipping is true iff we are in the skip pass.
65
*/
96
*/
66
 
97
 
67
int skip_pass = 1 ;
98
int skip_pass = 1;
68
int show_skip = 0 ;
99
int show_skip = 0;
69
int skipping = 0 ;
100
int skipping = 0;
70
 
101
 
71
 
102
 
72
/*
103
/*
73
    ARRAYS OF EQUATION AND VARIABLE NAMES
104
    ARRAYS OF EQUATION AND VARIABLE NAMES
74
 
105
 
75
    These arrays store the names of the types of equations (e.g. tokdefs)
106
    These arrays store the names of the types of equations (e.g. tokdefs)
76
    and the types of variables these equations are in (e.g. tags and tokens).
107
    and the types of variables these equations are in (e.g. tags and tokens).
77
    The number of types of variables is given by no_variables.
108
    The number of types of variables is given by no_variables.
78
*/
109
*/
79
 
110
 
80
string *eqn_types = null ;
111
string *eqn_types = null;
81
string *var_types = null ;
112
string *var_types = null;
82
char *var_letters = "" ;
113
char *var_letters = "";
83
long *var_count = null ;
114
long *var_count = null;
84
long no_variables = 0 ;
115
long no_variables = 0;
85
 
116
 
86
 
117
 
87
/*
118
/*
88
    CURRENT BINDINGS
119
    CURRENT BINDINGS
89
 
120
 
90
    The current binding table is given by crt_binding.
121
    The current binding table is given by crt_binding.
91
*/
122
*/
92
 
123
 
93
binding *crt_binding ;
124
binding *crt_binding;
94
 
125
 
95
 
126
 
96
/*
127
/*
97
    DECODE AN EXTERNAL LINKAGE
128
    DECODE AN EXTERNAL LINKAGE
98
 
129
 
99
    An external name is decoded and associated with a variable of type v.
130
    An external name is decoded and associated with a variable of type v.
100
    r gives the order information.
131
    r gives the order information.
101
*/
132
*/
102
 
133
 
103
static void de_linkextern
134
static void
104
    PROTO_N ( ( v, r ) )
-
 
105
    PROTO_T ( long v X long r )
135
de_linkextern(long v, long r)
106
{
136
{
107
    object *p ;
137
    object *p;
108
    external ext ;
138
    external ext;
109
    long n = tdf_int () ;
139
    long n = tdf_int();
110
    ext = de_extern_name () ;
140
    ext = de_extern_name();
111
    p = new_object ( v ) ;
141
    p = new_object(v);
112
    set_binding ( crt_binding, v, n, p ) ;
142
    set_binding(crt_binding, v, n, p);
113
    p->named = 1 ;
143
    p->named = 1;
114
    p->name = ext ;
144
    p->name = ext;
115
    p->order = r ;
145
    p->order = r;
116
    if ( v == var_token && ext.simple ) {
146
    if (v == var_token && ext.simple) {
117
	/* Look for special tokens */
147
	/* Look for special tokens */
118
	char *nm = ext.val.str ;
148
	char *nm = ext.val.str;
119
	if ( nm [0] == '~' && diagnostics ) {
149
	if (nm[0] == '~' && diagnostics) {
120
	    if ( streq ( nm, "~dg_exp" ) ) {
150
	    if (streq(nm, "~dg_exp")) {
121
		token_sort ( p, sort_exp, "xG", n ) ;
151
		token_sort(p, sort_exp, "xG", n);
122
	    } else if ( streq ( nm, "~exp_to_source" ) ) {
152
	    } else if (streq(nm, "~exp_to_source")) {
123
		token_sort ( p, sort_exp, "xMM", n ) ;
153
		token_sort(p, sort_exp, "xMM", n);
124
	    } else if ( streq ( nm, "~diag_id_scope" ) ) {
154
	    } else if (streq(nm, "~diag_id_scope")) {
125
		token_sort ( p, sort_exp, "x$xd", n ) ;
155
		token_sort(p, sort_exp, "x$xd", n);
126
	    } else if ( streq ( nm, "~diag_type_scope" ) ) {
156
	    } else if (streq(nm, "~diag_type_scope")) {
127
		token_sort ( p, sort_exp, "x$d", n ) ;
157
		token_sort(p, sort_exp, "x$d", n);
128
	    } else if ( streq ( nm, "~diag_tag_scope" ) ) {
158
	    } else if (streq(nm, "~diag_tag_scope")) {
129
		token_sort ( p, sort_exp, "x$d", n ) ;
159
		token_sort(p, sort_exp, "x$d", n);
130
	    }
160
	    }
131
	}
161
	}
132
    }
162
    }
133
    if ( dumb_mode ) {
163
    if (dumb_mode) {
134
	word *w1, *w2 ;
164
	word *w1, *w2;
135
	w1 = new_word ( HORIZ_NONE ) ;
165
	w1 = new_word(HORIZ_NONE);
136
	out_string ( var_types [v] ) ;
166
	out_string(var_types[v]);
137
	w2 = new_word ( HORIZ_BRACKETS ) ;
167
	w2 = new_word(HORIZ_BRACKETS);
138
	out_int ( n ) ;
168
	out_int(n);
139
	end_word ( w2 ) ;
169
	end_word(w2);
140
	out_string ( "represents " ) ;
170
	out_string("represents ");
141
	if ( ext.simple ) {
171
	if (ext.simple) {
142
	    out ( ext.val.str ) ;
172
	    out(ext.val.str);
143
	} else {
173
	} else {
144
	    out_unique ( ext.val.uniq ) ;
174
	    out_unique(ext.val.uniq);
145
	}
175
	}
146
	end_word ( w1 ) ;
176
	end_word(w1);
147
    }
177
    }
148
    return ;
178
    return;
149
}
179
}
150
 
180
 
151
 
181
 
152
/*
182
/*
153
    COUNT OF TOTAL NUMBER OF EQUATIONS OF A PARTICULAR TYPE
183
    COUNT OF TOTAL NUMBER OF EQUATIONS OF A PARTICULAR TYPE
154
 
184
 
155
    This should be increased appropriately by each unit decoding function.
185
    This should be increased appropriately by each unit decoding function.
156
*/
186
*/
157
 
187
 
158
long total = 0 ;
188
long total = 0;
159
long blank_lines = 0 ;
189
long blank_lines = 0;
160
 
190
 
161
 
191
 
162
/*
192
/*
163
    DECODE A SET OF EQUATIONS
193
    DECODE A SET OF EQUATIONS
164
 
194
 
165
    A set of equations is decoded.  f gives the procedure which is to be
195
    A set of equations is decoded.  f gives the procedure which is to be
166
    used to decode the equation body.
196
    used to decode the equation body.
167
*/
197
*/
168
 
198
 
169
static void de_equation
199
static void
170
    PROTO_N ( ( f ) )
-
 
171
    PROTO_T ( equation_func f )
200
de_equation(equation_func f)
172
{
201
{
173
    long i, n ;
202
    long i, n;
174
    long no_var ;
203
    long no_var;
175
    int needs_it = 0 ;
204
    int needs_it = 0;
176
    static long unitno = 1 ;
205
    static long unitno = 1;
177
 
206
 
178
    /* Record old bindings */
207
    /* Record old bindings */
179
    binding *old_binding = crt_binding ;
208
    binding *old_binding = crt_binding;
180
 
209
 
181
    /* Read the number of each type of variable */
210
    /* Read the number of each type of variable */
182
    no_var = tdf_int () ;
211
    no_var = tdf_int();
183
    if ( no_var ) {
212
    if (no_var) {
184
	if ( no_var != no_variables ) {
213
	if (no_var != no_variables) {
185
	    input_error ( "Number of local variables wrong" ) ;
214
	    input_error("Number of local variables wrong");
186
	}
215
	}
187
	crt_binding = new_binding_table () ;
216
	crt_binding = new_binding_table();
188
	for ( i = 0 ; i < no_var ; i++ ) {
217
	for (i = 0; i < no_var; i++) {
189
	    long sz = tdf_int () ;
218
	    long sz = tdf_int();
190
	    set_binding_size ( crt_binding, i, sz ) ;
219
	    set_binding_size(crt_binding, i, sz);
191
	    if ( show_stuff ) {
220
	    if (show_stuff) {
192
		out_string ( var_types [i] ) ;
221
		out_string(var_types[i]);
193
		out_string ( " x " ) ;
222
		out_string(" x ");
194
		out_int ( sz ) ;
223
		out_int(sz);
195
	    }
224
	    }
196
	}
225
	}
197
	if ( show_stuff ) blank_line () ;
226
	if (show_stuff)blank_line();
198
    }
227
    }
199
 
228
 
200
    /* Read linkage for each type of variable */
229
    /* Read linkage for each type of variable */
201
    n = tdf_int () ;
230
    n = tdf_int();
202
    if ( n != no_var ) input_error ( "Number of linkage units wrong" ) ;
231
    if (n != no_var)input_error("Number of linkage units wrong");
203
    if ( no_var ) {
232
    if (no_var) {
204
	if ( dumb_mode ) {
233
	if (dumb_mode) {
205
	    word *w = new_word ( HORIZ_NONE ) ;
234
	    word *w = new_word(HORIZ_NONE);
206
	    out_string ( "Bindings for Unit " ) ;
235
	    out_string("Bindings for Unit ");
207
	    out_int ( unitno ) ;
236
	    out_int(unitno);
208
	    out ( "(inner->outer)" ) ;
237
	    out("(inner->outer)");
209
	    end_word ( w ) ;
238
	    end_word(w);
210
	    blank_line () ;
239
	    blank_line();
211
	}
240
	}
212
	for ( i = 0 ; i < no_var ; i++ ) {
241
	for (i = 0; i < no_var; i++) {
213
	    long j, no_links = tdf_int () ;
242
	    long j, no_links = tdf_int();
214
	    for ( j = 0 ; j < no_links ; j++ ) {
243
	    for (j = 0; j < no_links; j++) {
215
		object *p ;
244
		object *p;
216
		long inner = tdf_int () ;
245
		long inner = tdf_int();
217
		long outer = tdf_int () ;
246
		long outer = tdf_int();
218
		if ( dumb_mode ) {
247
		if (dumb_mode) {
219
		    /* Output the linkage information */
248
		    /* Output the linkage information */
220
		    word *w1, *w2 ;
249
		    word *w1, *w2;
221
		    w1 = new_word ( HORIZ_NONE ) ;
250
		    w1 = new_word(HORIZ_NONE);
222
		    out_string ( var_types [i] ) ;
251
		    out_string(var_types[i]);
223
		    w2 = new_word ( HORIZ_BRACKETS ) ;
252
		    w2 = new_word(HORIZ_BRACKETS);
224
		    out_int ( inner ) ;
253
		    out_int(inner);
225
		    end_word ( w2 ) ;
254
		    end_word(w2);
226
		    out_string ( "is bound to " ) ;
255
		    out_string("is bound to ");
227
		    out_string ( var_types [i] ) ;
256
		    out_string(var_types[i]);
228
		    w2 = new_word ( HORIZ_BRACKETS ) ;
257
		    w2 = new_word(HORIZ_BRACKETS);
229
		    out_int ( outer ) ;
258
		    out_int(outer);
230
		    end_word ( w2 ) ;
259
		    end_word(w2);
231
		    end_word ( w1 ) ;
260
		    end_word(w1);
232
		    needs_it = 1 ;
261
		    needs_it = 1;
233
		}
262
		}
234
		p = find_binding ( old_binding, i, outer ) ;
263
		p = find_binding(old_binding, i, outer);
235
		set_binding ( crt_binding, i, inner, p ) ;
264
		set_binding(crt_binding, i, inner, p);
236
	    }
265
	    }
237
	}
266
	}
238
	if ( dumb_mode ) {
267
	if (dumb_mode) {
239
	    if ( needs_it ) blank_line () ;
268
	    if (needs_it)blank_line();
240
	    blank_lines = 1 ;
269
	    blank_lines = 1;
241
	}
270
	}
242
 
271
 
243
	/* Complete the bindings */
272
	/* Complete the bindings */
244
	complete_binding ( crt_binding ) ;
273
	complete_binding(crt_binding);
245
    }
274
    }
246
 
275
 
247
    /* Read the unit body */
276
    /* Read the unit body */
248
    n = BYTESIZE * tdf_int () ;
277
    n = BYTESIZE * tdf_int();
249
    byte_align () ;
278
    byte_align();
250
    if ( f == null ) {
279
    if (f == null) {
251
	skip_bits ( n ) ;
280
	skip_bits(n);
252
	if ( dumb_mode ) {
281
	if (dumb_mode) {
253
	    out ( "(skipped)" ) ;
282
	    out("(skipped)");
254
	    blank_line () ;
283
	    blank_line();
255
	    blank_lines = 1 ;
284
	    blank_lines = 1;
256
	}
285
	}
257
	total++ ;
286
	total++;
258
    } else {
287
    } else {
259
	long end = posn ( here ) + n ;
288
	long end = posn(here) + n;
260
	( *f ) () ;
289
	(*f)();
261
	byte_align () ;
290
	byte_align();
262
	if ( posn ( here ) != end ) input_error ( "Unit length wrong" ) ;
291
	if (posn(here)!= end)input_error("Unit length wrong");
263
    }
292
    }
264
 
293
 
265
    /* Restore old bindings */
294
    /* Restore old bindings */
266
    if ( no_var ) {
295
    if (no_var) {
267
	free_binding_table ( crt_binding ) ;
296
	free_binding_table(crt_binding);
268
	crt_binding = old_binding ;
297
	crt_binding = old_binding;
269
	if ( dumb_mode ) {
298
	if (dumb_mode) {
270
	    for ( i = blank_lines ; i < 2 ; i++ ) blank_line () ;
299
	    for (i = blank_lines; i < 2; i++)blank_line();
271
	    out_string ( "End of Bindings for Unit " ) ;
300
	    out_string("End of Bindings for Unit ");
272
	    out_int ( unitno++ ) ;
301
	    out_int(unitno++);
273
	    blank_line () ;
302
	    blank_line();
274
	    blank_line () ;
303
	    blank_line();
275
	    blank_lines = 2 ;
304
	    blank_lines = 2;
276
	}
305
	}
277
    }
306
    }
278
    return ;
307
    return;
279
}
308
}
280
 
309
 
281
 
310
 
282
/*
311
/*
283
    DECODE A CAPSULE
312
    DECODE A CAPSULE
Line 285... Line 314...
285
    A capsule consists of a number of equation types, a number of variable
314
    A capsule consists of a number of equation types, a number of variable
286
    sorts, a number of external names for variables and a number of
315
    sorts, a number of external names for variables and a number of
287
    equations of certain types.
316
    equations of certain types.
288
*/
317
*/
289
 
318
 
290
void de_capsule
319
void
291
    PROTO_Z ()
320
de_capsule(void)
292
{
321
{
293
    long i, n ;
322
    long i, n;
294
    long no_eqn, no_var ;
323
    long no_eqn, no_var;
295
    if ( dumb_mode ) show_stuff = 1 ;
324
    if (dumb_mode)show_stuff = 1;
296
 
325
 
297
    /* Read the magic number */
326
    /* Read the magic number */
298
    out ( "MAGIC NUMBER" ) ;
327
    out("MAGIC NUMBER");
299
    blank_line () ;
328
    blank_line();
300
    de_magic ( version_magic ) ;
329
    de_magic(version_magic);
301
    blank_line () ;
330
    blank_line();
302
    blank_line () ;
331
    blank_line();
303
 
332
 
304
    /* Read the equation types */
333
    /* Read the equation types */
305
    no_eqn = tdf_int () ;
334
    no_eqn = tdf_int();
306
    if ( no_eqn ) {
335
    if (no_eqn) {
307
	if ( show_stuff ) {
336
	if (show_stuff) {
308
	    out ( "EQUATION TYPES" ) ;
337
	    out("EQUATION TYPES");
309
	    blank_line () ;
338
	    blank_line();
310
	}
339
	}
311
	eqn_types = alloc_nof ( string, no_eqn ) ;
340
	eqn_types = alloc_nof(string, no_eqn);
312
	for ( i = 0 ; i < no_eqn ; i++ ) {
341
	for (i = 0; i < no_eqn; i++) {
313
	    string s = de_tdfstring_align () ;
342
	    string s = de_tdfstring_align();
314
	    eqn_types [i] = s ;
343
	    eqn_types[i] = s;
315
	    if ( show_stuff ) out ( s ) ;
344
	    if (show_stuff)out(s);
316
	}
345
	}
317
	if ( show_stuff ) {
346
	if (show_stuff) {
318
	    blank_line () ;
347
	    blank_line();
319
	    blank_line () ;
348
	    blank_line();
320
	}
349
	}
321
    }
350
    }
322
 
351
 
323
    /* Read the variable types and initialize the bindings */
352
    /* Read the variable types and initialize the bindings */
324
    no_var = tdf_int () ;
353
    no_var = tdf_int();
325
    no_variables = no_var ;
354
    no_variables = no_var;
326
    crt_binding = new_binding_table () ;
355
    crt_binding = new_binding_table();
327
    if ( no_var ) {
356
    if (no_var) {
328
	if ( show_stuff ) {
357
	if (show_stuff) {
329
	    out ( "VARIABLE TYPES" ) ;
358
	    out("VARIABLE TYPES");
330
	    blank_line () ;
359
	    blank_line();
331
	}
360
	}
332
	var_types = alloc_nof ( string, no_var ) ;
361
	var_types = alloc_nof(string, no_var);
333
	var_letters = alloc_nof ( char, no_var + 1 ) ;
362
	var_letters = alloc_nof(char, no_var + 1);
334
	var_count = alloc_nof ( long, no_var ) ;
363
	var_count = alloc_nof(long, no_var);
335
	var_letters [ no_var ] = 0 ;
364
	var_letters[no_var] = 0;
336
 
365
 
337
	for ( i = 0 ; i < no_var ; i++ ) {
366
	for (i = 0; i < no_var; i++) {
338
	    string sv = de_tdfstring_align () ;
367
	    string sv = de_tdfstring_align();
339
	    long sz = tdf_int () ;
368
	    long sz = tdf_int();
340
	    var_letters [i] = find_variable ( sv, i ) ;
369
	    var_letters[i] = find_variable(sv, i);
341
	    var_types [i] = sv ;
370
	    var_types[i] = sv;
342
	    var_count [i] = 0 ;
371
	    var_count[i] = 0;
343
	    set_binding_size ( crt_binding, i, sz ) ;
372
	    set_binding_size(crt_binding, i, sz);
344
	    if ( show_stuff ) {
373
	    if (show_stuff) {
345
		out_string ( sv ) ;
374
		out_string(sv);
346
		out_string ( " x " ) ;
375
		out_string(" x ");
347
		out_int ( sz ) ;
376
		out_int(sz);
348
	    }
377
	    }
349
	}
378
	}
350
	if ( show_stuff ) {
379
	if (show_stuff) {
351
	    blank_line () ;
380
	    blank_line();
352
	    blank_line () ;
381
	    blank_line();
353
	}
382
	}
354
    }
383
    }
355
 
384
 
356
    /* Read the external variable names */
385
    /* Read the external variable names */
357
    n = tdf_int () ;
386
    n = tdf_int();
358
    if ( n != no_var ) input_error ( "Number of variables wrong" ) ;
387
    if (n != no_var)input_error("Number of variables wrong");
359
    if ( no_var ) {
388
    if (no_var) {
360
	if ( dumb_mode ) {
389
	if (dumb_mode) {
361
	    out ( "EXTERNAL NAMES" ) ;
390
	    out("EXTERNAL NAMES");
362
	    blank_line () ;
391
	    blank_line();
363
	}
392
	}
364
	for ( i = 0 ; i < no_var ; i++ ) {
393
	for (i = 0; i < no_var; i++) {
365
	    long j, no_links = tdf_int () ;
394
	    long j, no_links = tdf_int();
366
	    for ( j = 0 ; j < no_links ; j++ ) de_linkextern ( i, j ) ;
395
	    for (j = 0; j < no_links; j++)de_linkextern(i, j);
367
	}
396
	}
368
	if ( dumb_mode ) {
397
	if (dumb_mode) {
369
	    blank_line () ;
398
	    blank_line();
370
	    blank_line () ;
399
	    blank_line();
371
	}
400
	}
372
    }
401
    }
373
 
402
 
374
    /* Complete the bindings */
403
    /* Complete the bindings */
375
    complete_binding ( crt_binding ) ;
404
    complete_binding(crt_binding);
376
 
405
 
377
    /* Read the equations */
406
    /* Read the equations */
378
    n = tdf_int () ;
407
    n = tdf_int();
379
    if ( n != no_eqn ) input_error ( "Number of equations wrong" ) ;
408
    if (n != no_eqn)input_error("Number of equations wrong");
380
    for ( i = 0 ; i < no_eqn ; i++ ) {
409
    for (i = 0; i < no_eqn; i++) {
381
	int used = 0 ;
410
	int used = 0;
382
	char *title = null ;
411
	char *title = null;
383
	long j, no_units = tdf_int () ;
412
	long j, no_units = tdf_int();
384
	string se = eqn_types [i] ;
413
	string se = eqn_types[i];
385
	equation_func f = find_equation ( se, &title, &used ) ;
414
	equation_func f = find_equation(se, &title, &used);
386
	if ( !used ) {
415
	if (!used) {
387
	    title = null ;
416
	    title = null;
388
	    f = null ;
417
	    f = null;
389
	}
418
	}
390
	total = 0 ;
419
	total = 0;
391
	if ( f == de_tokdef_props && no_units ) {
420
	if (f == de_tokdef_props && no_units) {
392
	    /* Skip pass */
421
	    /* Skip pass */
393
	    place pl ;
422
	    place pl;
394
	    int old_pf = printflag ;
423
	    int old_pf = printflag;
395
	    if ( !show_skip ) printflag = 0 ;
424
	    if (!show_skip)printflag = 0;
396
	    skipping = 1 ;
425
	    skipping = 1;
397
	    pl.byte = here.byte ;
426
	    pl.byte = here.byte;
398
	    pl.bit = here.bit ;
427
	    pl.bit = here.bit;
399
	    if ( printflag && ( dumb_mode || f ) ) {
428
	    if (printflag && (dumb_mode || f)) {
400
		if ( title && !show_stuff ) {
429
		if (title && !show_stuff) {
401
		    out_string ( title ) ;
430
		    out_string(title);
402
		} else {
431
		} else {
403
		    out_string ( "EQUATIONS OF TYPE " ) ;
432
		    out_string("EQUATIONS OF TYPE ");
404
		    out_string ( se ) ;
433
		    out_string(se);
405
		}
434
		}
406
		out ( " (SKIP PASS)" ) ;
435
		out(" (SKIP PASS)");
407
		blank_line () ;
436
		blank_line();
408
		blank_lines = 1 ;
437
		blank_lines = 1;
409
	    }
438
	    }
410
	    for ( j = 0 ; j < no_units ; j++ ) de_equation ( f ) ;
439
	    for (j = 0; j < no_units; j++)de_equation(f);
411
	    if ( printflag && ( dumb_mode || f ) ) {
440
	    if (printflag && (dumb_mode || f)) {
412
		if ( total == 0 ) {
441
		if (total == 0) {
413
		    out ( "(none)" ) ;
442
		    out("(none)");
414
		    blank_lines = 0 ;
443
		    blank_lines = 0;
415
		}
444
		}
416
		for ( j = blank_lines ; j < 2 ; j++ ) blank_line () ;
445
		for (j = blank_lines; j < 2; j++)blank_line();
417
		blank_lines = 2 ;
446
		blank_lines = 2;
418
	    }
447
	    }
419
	    total = 0 ;
448
	    total = 0;
420
	    set_place ( &pl ) ;
449
	    set_place(&pl);
421
	    skipping = 0 ;
450
	    skipping = 0;
422
	    printflag = old_pf ;
451
	    printflag = old_pf;
423
	}
452
	}
424
 
453
 
425
	/* Main pass */
454
	/* Main pass */
426
	if ( dumb_mode || f ) {
455
	if (dumb_mode || f) {
427
	    if ( title && !show_stuff ) {
456
	    if (title && !show_stuff) {
428
		out ( title ) ;
457
		out(title);
429
	    } else {
458
	    } else {
430
		out_string ( "EQUATIONS OF TYPE " ) ;
459
		out_string("EQUATIONS OF TYPE ");
431
		out ( se ) ;
460
		out(se);
432
	    }
461
	    }
433
	    blank_line () ;
462
	    blank_line();
434
	    blank_lines = 1 ;
463
	    blank_lines = 1;
435
	}
464
	}
436
	for ( j = 0 ; j < no_units ; j++ ) de_equation ( f ) ;
465
	for (j = 0; j < no_units; j++)de_equation(f);
437
	if ( dumb_mode || f ) {
466
	if (dumb_mode || f) {
438
	    if ( total == 0 ) {
467
	    if (total == 0) {
439
		out ( "(none)" ) ;
468
		out("(none)");
440
		blank_lines = 0 ;
469
		blank_lines = 0;
441
	    }
470
	    }
442
	    for ( j = blank_lines ; j < 2 ; j++ ) blank_line () ;
471
	    for (j = blank_lines; j < 2; j++)blank_line();
443
	    blank_lines = 2 ;
472
	    blank_lines = 2;
444
	}
473
	}
445
    }
474
    }
446
    return ;
475
    return;
447
}
476
}