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) 1996
32
    		 Crown Copyright (c) 1996
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
Line 91... Line 121...
91
 
121
 
92
/*
122
/*
93
    MAXIMUM AND MINIMUM WEIGHTS
123
    MAXIMUM AND MINIMUM WEIGHTS
94
*/
124
*/
95
 
125
 
96
#define  cant_use		( ( float ) -1.0e10 )
126
#define  cant_use		((float) -1.0e10)
97
 
127
 
98
 
128
 
99
/*
129
/*
100
    NUMBERS OF AVAILABLE REGISTERS
130
    NUMBERS OF AVAILABLE REGISTERS
101
*/
131
*/
102
 
132
 
103
#define  wdno		16
133
#define  wdno		16
104
#define  wano		16
134
#define  wano		16
105
#define  wfno		6
135
#define  wfno		6
106
#define  wno		( wdno + wano + wfno )
136
#define  wno		(wdno + wano + wfno)
107
 
137
 
108
 
138
 
109
/*
139
/*
110
    STRUCTURE DEFINITIONS OF weights, wp, explist
140
    STRUCTURE DEFINITIONS OF weights, wp, explist
111
*/
141
*/
112
 
142
 
113
typedef struct {
143
typedef struct {
114
    float wts [ wno ] ;
144
    float wts[wno];
115
    long d_used ;
145
    long d_used;
116
    long a_used ;
146
    long a_used;
117
    long f_used ;
147
    long f_used;
118
} weights ;
148
} weights;
119
 
149
 
120
typedef struct {
150
typedef struct {
121
    weights wt ;
151
    weights wt;
122
    long bkpt ;
152
    long bkpt;
123
} wp ;
153
} wp;
124
 
154
 
125
typedef struct elt {
155
typedef struct elt {
126
    exp member ;
156
    exp member;
127
    struct elt *next ;
157
    struct elt *next;
128
} explist  ;
158
} explist ;
129
 
159
 
130
 
160
 
131
/*
161
/*
132
    BASIC WEIGHTS
162
    BASIC WEIGHTS
133
*/
163
*/
134
 
164
 
135
static weights zeros ;
165
static weights zeros;
136
static weights weightsv PROTO_S ( ( exp, explist * ) ) ;
166
static weights weightsv(exp, explist *);
137
 
167
 
138
 
168
 
139
/*
169
/*
140
    CURRENT WEIGHTS SCALE FACTOR
170
    CURRENT WEIGHTS SCALE FACTOR
141
*/
171
*/
142
 
172
 
143
static float scale ;
173
static float scale;
144
 
174
 
145
 
175
 
146
/*
176
/*
147
    ADD TWO WEIGHT VECTORS
177
    ADD TWO WEIGHT VECTORS
148
*/
178
*/
149
 
179
 
150
static weights add_weights
180
static weights add_weights
151
    PROTO_N ( ( w1, w2 ) )
-
 
152
    PROTO_T ( weights w1 X weights w2 )
181
(weights w1, weights w2)
153
{
182
{
154
    long i ;
183
    long i;
155
    weights r ;
184
    weights r;
156
    float wa, wb ;
185
    float wa, wb;
157
    for ( i = 0 ; i < wno ; i++ ) {
186
    for (i = 0; i < wno; i++) {
158
	wa = ( w1.wts )[i] ;
187
	wa = (w1.wts)[i];
159
	wb = ( w2.wts )[i] ;
188
	wb = (w2.wts)[i];
160
	if ( wa == cant_use || wb == cant_use ) {
189
	if (wa == cant_use || wb == cant_use) {
161
	    ( r.wts )[i] = cant_use ;
190
	   (r.wts)[i] = cant_use;
162
	} else {
191
	} else {
163
	    ( r.wts )[i] = wa + wb ;
192
	   (r.wts)[i] = wa + wb;
164
	}
193
	}
165
    }
194
    }
166
    r.d_used = maximum ( w1.d_used, w2.d_used ) ;
195
    r.d_used = maximum(w1.d_used, w2.d_used);
167
    r.a_used = maximum ( w1.a_used, w2.a_used ) ;
196
    r.a_used = maximum(w1.a_used, w2.a_used);
168
    r.f_used = maximum ( w1.f_used, w2.f_used ) ;
197
    r.f_used = maximum(w1.f_used, w2.f_used);
169
    return ( r ) ;
198
    return(r);
170
}
199
}
171
 
200
 
172
 
201
 
173
/*
202
/*
174
    INITIALIZE BASIC WEIGHTS
203
    INITIALIZE BASIC WEIGHTS
175
*/
204
*/
176
 
205
 
177
void init_weights
206
void init_weights
178
    PROTO_Z ()
207
(void)
179
{
208
{
180
    long i ;
209
    long i;
181
    for ( i = 0 ; i < wno ; i++ ) ( zeros.wts )[i] = ( float ) 0.0 ;
210
    for (i = 0; i < wno; i++)(zeros.wts)[i] = (float)0.0;
182
    zeros.d_used = -1 ;
211
    zeros.d_used = -1;
183
    zeros.a_used = -1 ;
212
    zeros.a_used = -1;
184
    zeros.f_used = -1 ;
213
    zeros.f_used = -1;
185
    return ;
214
    return;
186
}
215
}
187
 
216
 
188
 
217
 
189
/*
218
/*
190
    MARK A LIST OF EXPS
219
    MARK A LIST OF EXPS
191
*/
220
*/
192
 
221
 
193
static void markcall
222
static void markcall
194
    PROTO_N ( ( el, b ) )
-
 
195
    PROTO_T ( explist *el X bitpattern b )
223
(explist *el, bitpattern b)
196
{
224
{
197
    explist *t ;
225
    explist *t;
198
    for ( t = el ; t != null ; t = t->next ) props ( t->member ) |= b ;
226
    for (t = el; t != null; t = t->next)props(t->member) |= b;
199
    return ;
227
    return;
200
}
228
}
201
 
229
 
202
 
230
 
203
/*
231
/*
204
    WORK OUT WEIGHTS FOR A DECLARATION
232
    WORK OUT WEIGHTS FOR A DECLARATION
205
*/
233
*/
206
 
234
 
207
static wp max_weights
235
static wp max_weights
208
    PROTO_N ( ( s, locp, ws, rtype ) )
-
 
209
    PROTO_T ( long s X float locp X weights ws X int rtype )
236
(long s, float locp, weights ws, int rtype)
210
{
237
{
211
    wp res ;
238
    wp res;
212
    bool bkset = 0 ;
239
    bool bkset = 0;
213
    long i, n ;
240
    long i, n;
214
    long sz = ( s + 31 ) / 32, bk = 1 ;
241
    long sz = (s + 31) / 32, bk = 1;
215
    long q = 0 ;
242
    long q = 0;
216
    float *w, *pw ;
243
    float *w, *pw;
217
    long used, total, offset ;
244
    long used, total, offset;
218
 
245
 
219
    /* Find values for this register type */
246
    /* Find values for this register type */
220
    switch ( rtype ) {
247
    switch (rtype) {
221
 
248
 
222
	case Dreg : {
249
	case Dreg: {
223
	    offset = 0 ;
250
	    offset = 0;
224
	    total = wdno ;
251
	    total = wdno;
225
	    used = ws.d_used ;
252
	    used = ws.d_used;
226
	    break ;
253
	    break;
227
	}
254
	}
228
 
255
 
229
	case Areg : {
256
	case Areg: {
230
	    offset = wdno ;
257
	    offset = wdno;
231
	    total = wano ;
258
	    total = wano;
232
	    used = ws.a_used ;
259
	    used = ws.a_used;
233
	    break ;
260
	    break;
234
	}
261
	}
235
 
262
 
236
	case Freg : {
263
	case Freg: {
237
	    offset = wdno + wano ;
264
	    offset = wdno + wano;
238
	    total = wfno ;
265
	    total = wfno;
239
	    used = ws.f_used ;
266
	    used = ws.f_used;
240
	    break ;
267
	    break;
241
	}
268
	}
242
 
269
 
243
	default : {
270
	default : {
244
	    error ( "Illegal register type" ) ;
271
	    error("Illegal register type");
245
	    exit ( EXIT_FAILURE ) ;
272
	    exit(EXIT_FAILURE);
246
	}
273
	}
247
    }
274
    }
248
    w = &( ws.wts )[ offset ] ;
275
    w = & (ws.wts)[offset];
249
    pw = &( ( res.wt ).wts )[ offset ] ;
276
    pw = & ((res.wt).wts)[offset];
250
    n = used + sz + 1 ;
277
    n = used + sz + 1;
251
    if ( n > total ) n = total ;
278
    if (n > total)n = total;
252
 
279
 
253
    /* Copy ws to res.wt */
280
    /* Copy ws to res.wt */
254
    for ( i = 0 ; i < wno ; i++ ) ( ( res.wt ).wts )[i] = ( ws.wts )[i] ;
281
    for (i = 0; i < wno; i++)((res.wt).wts)[i] = (ws.wts)[i];
255
    res.wt.d_used = ws.d_used ;
282
    res.wt.d_used = ws.d_used;
256
    res.wt.a_used = ws.a_used ;
283
    res.wt.a_used = ws.a_used;
257
    res.wt.f_used = ws.f_used ;
284
    res.wt.f_used = ws.f_used;
258
 
285
 
259
    if ( locp == cant_use ) {
286
    if (locp == cant_use) {
260
	for ( i = 0 ; i < n ; i++ ) pw [i] = cant_use ;
287
	for (i = 0; i < n; i++)pw[i] = cant_use;
261
	for ( i = n ; i < total ; i++ ) pw [i] = w [i] ;
288
	for (i = n; i < total; i++)pw[i] = w[i];
262
	switch ( rtype ) {
289
	switch (rtype) {
263
	    case Dreg : res.wt.d_used = ws.d_used + sz ; break ;
290
	    case Dreg: res.wt.d_used = ws.d_used + sz; break;
264
	    case Areg : res.wt.a_used = ws.a_used + sz ; break ;
291
	    case Areg: res.wt.a_used = ws.a_used + sz; break;
265
	    case Freg : res.wt.f_used = ws.f_used + sz ; break ;
292
	    case Freg: res.wt.f_used = ws.f_used + sz; break;
266
	}
293
	}
267
	bk = 0 ;
294
	bk = 0;
268
    } else {
295
    } else {
269
	float loc = locp * ( ( float ) sz ) ;
296
	float loc = locp *((float)sz);
270
	q = -1 ;
297
	q = -1;
271
	for ( i = 0 ; i < total ; i++ ) {
298
	for (i = 0; i < total; i++) {
272
	    if ( w [i] == cant_use ) {
299
	    if (w[i] == cant_use) {
273
		pw [i] = cant_use ;
300
		pw[i] = cant_use;
274
		q = i ;
301
		q = i;
275
	    } else {
302
	    } else {
276
		if ( i < ( sz + q ) ) {
303
		if (i < (sz + q)) {
277
		    pw [i] = w [i] ;
304
		    pw[i] = w[i];
278
		} else {
305
		} else {
279
		    if ( i == ( sz + q ) ) {
306
		    if (i == (sz + q)) {
280
			if ( loc >= w [i] && used <= q ) {
307
			if (loc >= w[i] && used <= q) {
281
			    pw [i] = loc ;
308
			    pw[i] = loc;
282
			    bk = i + 1 ;
309
			    bk = i + 1;
283
			    bkset = 1 ;
310
			    bkset = 1;
284
			} else {
311
			} else {
285
			    pw [i] = w [i] ;
312
			    pw[i] = w[i];
286
			}
313
			}
287
		    } else {
314
		    } else {
288
			float z = loc + w [ i - sz ] ;
315
			float z = loc + w[i - sz];
289
			if ( z >= w [i] ) {
316
			if (z >= w[i]) {
290
			    pw [i] = z ;
317
			    pw[i] = z;
291
			    if ( !bkset ) { bk = i + 1 ; bkset = 1 ; }
318
			    if (!bkset) { bk = i + 1; bkset = 1; }
292
			} else {
319
			} else {
293
			    pw [i] = w [i] ;
320
			    pw[i] = w[i];
294
			}
321
			}
295
		    }
322
		    }
296
		}
323
		}
297
	    }
324
	    }
298
	}
325
	}
299
    }
326
    }
300
    /* Set the breakpoint */
327
    /* Set the breakpoint */
301
    res.bkpt = bk ;
328
    res.bkpt = bk;
302
    return ( res ) ;
329
    return(res);
303
}
330
}
304
 
331
 
305
 
332
 
306
/*
333
/*
307
    WORK OUT WEIGHTS FOR A LIST OF EXPS
334
    WORK OUT WEIGHTS FOR A LIST OF EXPS
308
*/
335
*/
309
 
336
 
310
static weights add_wlist
337
static weights add_wlist
311
    PROTO_N ( ( re, el ) )
-
 
312
    PROTO_T ( exp re X explist *el )
338
(exp re, explist *el)
313
{
339
{
314
    weights wl1, wl2 ;
340
    weights wl1, wl2;
315
    if ( re == nilexp ) return ( zeros ) ;
341
    if (re == nilexp) return(zeros);
316
 
342
 
317
    wl1 = weightsv ( re, el ) ;
343
    wl1 = weightsv(re, el);
318
 
344
 
319
    while ( !last ( re ) ) {
345
    while (!last(re)) {
320
	re = bro ( re ) ;
346
	re = bro(re);
321
	wl2 = weightsv ( re, el ) ;
347
	wl2 = weightsv(re, el);
322
	wl1 = add_weights ( wl1, wl2 ) ;
348
	wl1 = add_weights(wl1, wl2);
323
    }
349
    }
324
    return ( wl1 ) ;
350
    return(wl1);
325
}
351
}
326
 
352
 
327
 
353
 
328
/*
354
/*
329
    IS X AN ASSIGNMENT?
355
    IS X AN ASSIGNMENT?
330
*/
356
*/
331
 
357
 
332
#define  ass( X )	( name ( X ) == ass_tag || name ( X ) == assvol_tag )
358
#define  ass(X)	(name(X) == ass_tag || name(X) == assvol_tag)
333
 
359
 
334
 
360
 
335
/*
361
/*
336
    WORK OUT WEIGHTS FOR e SCALED BY scale AND SET BREAK POINTS
362
    WORK OUT WEIGHTS FOR e SCALED BY scale AND SET BREAK POINTS
337
*/
363
*/
338
 
364
 
339
static weights weightsv
365
static weights weightsv
340
    PROTO_N ( ( e, el ) )
-
 
341
    PROTO_T ( exp e X explist *el )
366
(exp e, explist *el)
342
{
367
{
343
    unsigned char n = name ( e ) ;
368
    unsigned char n = name(e);
344
    switch ( n ) {
369
    switch (n) {
345
 
370
 
346
	case name_tag : {
371
	case name_tag: {
347
	    if ( !isglob ( son ( e ) ) ) fno ( son ( e ) ) += scale ;
372
	    if (!isglob(son(e)))fno(son(e)) += scale;
348
	    /* Add value to the no field of the declaration */
373
	    /* Add value to the no field of the declaration */
349
	    return ( zeros ) ;
374
	    return(zeros);
350
	}
375
	}
351
 
376
 
352
	case make_lv_tag : {
377
	case make_lv_tag: {
353
	    return ( zeros ) ;
378
	    return(zeros);
354
	}
379
	}
355
 
380
 
356
	case ident_tag : {
381
	case ident_tag: {
357
	    wp p ;
382
	    wp p;
358
	    long sz ;
383
	    long sz;
359
	    shape sha ;
384
	    shape sha;
360
 
385
 
361
	    /* Starting point for pt list */
386
	    /* Starting point for pt list */
362
	    exp t = pt ( e ) ;
387
	    exp t = pt(e);
363
	    exp d = son ( e ) ;
388
	    exp d = son(e);
364
 
389
 
365
	    /* Add e to the list of exps */
390
	    /* Add e to the list of exps */
366
	    explist nel ;
391
	    explist nel;
367
	    nel.member = e ;
392
	    nel.member = e;
368
	    nel.next = el ;
393
	    nel.next = el;
369
 
394
 
370
	    while ( isvar ( e ) && !isvis ( e ) && t != nilexp ) {
395
	    while (isvar(e) && !isvis(e) && t != nilexp) {
371
		/* Scan along pt list */
396
		/* Scan along pt list */
372
		if ( !( last ( t ) && name ( bro ( t ) ) == cont_tag ) &&
397
		if (!(last(t) && name(bro(t)) == cont_tag) &&
373
		     !( last ( bro ( t ) ) &&
398
		     !(last(bro(t)) &&
374
		     ass ( bro ( bro ( t ) ) ) ) )
399
		     ass(bro(bro(t)))))
375
		    /* Make sure it will not go in register */
400
		    /* Make sure it will not go in register */
376
		    setvis ( e ) ;
401
		    setvis(e);
377
		t = pt ( t ) ;
402
		t = pt(t);
378
	    }
403
	    }
379
 
404
 
380
	    if ( d != nilexp ) {
405
	    if (d != nilexp) {
381
		int sht ;
406
		int sht;
382
		weights wdef, wbody ;
407
		weights wdef, wbody;
383
		fno ( e ) = ( float ) 0.0 ;
408
		fno(e) = (float)0.0;
384
 
409
 
385
		/* Work out weights for the body */
410
		/* Work out weights for the body */
386
		wbody = weightsv ( bro ( d ), &nel ) ;
411
		wbody = weightsv(bro(d), &nel);
387
 
412
 
388
		/* Work out weights for the definition */
413
		/* Work out weights for the definition */
389
		if ( name ( d ) == clear_tag ) {
414
		if (name(d) == clear_tag) {
390
		    wdef = zeros ;
415
		    wdef = zeros;
391
		} else {
416
		} else {
392
		    float old_scale = scale ;
417
		    float old_scale = scale;
393
		    if ( name ( d ) == name_tag ) scale = fno ( e ) ;
418
		    if (name(d) == name_tag)scale = fno(e);
394
		    wdef = weightsv ( d, el ) ;
419
		    wdef = weightsv(d, el);
395
		    scale = old_scale ;
420
		    scale = old_scale;
396
		}
421
		}
397
 
422
 
398
		/* Shape information */
423
		/* Shape information */
399
		sha = sh ( d ) ;
424
		sha = sh(d);
400
		sz = shape_size ( sha ) ;
425
		sz = shape_size(sha);
401
		sht = shtype ( sha ) ;
426
		sht = shtype(sha);
402
 
427
 
403
#if 0
428
#if 0
404
		/* Correct producer bug */
429
		/* Correct producer bug */
405
		if ( name ( sha ) == slonghd && name ( d ) == val_tag &&
430
		if (name(sha) == slonghd && name(d) == val_tag &&
406
		     no ( d ) == 0 ) {
431
		     no(d) == 0) {
407
		    bool fix = 0 ;
432
		    bool fix = 0;
408
		    t = pt ( e ) ;
433
		    t = pt(e);
409
		    while ( t != nilexp ) {
434
		    while (t != nilexp) {
410
			exp f = father ( t ) ;
435
			exp f = father(t);
411
			if ( name ( f ) == cont_tag &&
436
			if (name(f) == cont_tag &&
412
			     name ( sh ( f ) ) == ptrhd ) fix = 1 ;
437
			     name(sh(f)) == ptrhd)fix = 1;
413
			t = ( last ( t ) ? nilexp : pt ( t ) ) ;
438
			t = (last(t)? nilexp : pt(t));
414
		    }
439
		    }
415
		    if ( fix ) {
440
		    if (fix) {
416
			sh ( d ) = ptr_shape ( sha ) ;
441
			sh(d) = ptr_shape(sha);
417
			sht = Areg ;
442
			sht = Areg;
418
		    }
443
		    }
419
		}
444
		}
420
#endif
445
#endif
421
 
446
 
422
		if ( isusereg ( e ) ) {
447
		if (isusereg(e)) {
423
		    /* Work out breakpoint */
448
		    /* Work out breakpoint */
424
		    p = max_weights ( sz, cant_use, wbody, sht ) ;
449
		    p = max_weights(sz, cant_use, wbody, sht);
425
		    no ( e ) = p.bkpt ;
450
		    no(e) = p.bkpt;
426
		    if ( no ( e ) == 13 ) error ( "Bad breakpoint" ) ;
451
		    if (no(e) == 13)error("Bad breakpoint");
427
		    return ( add_weights ( wdef, p.wt ) ) ;
452
		    return(add_weights(wdef, p.wt));
428
		}
453
		}
429
 
454
 
430
		if ( regable ( e ) ) {
455
		if (regable(e)) {
431
		    /* Work out breakpoint */
456
		    /* Work out breakpoint */
432
		    float loc = fno ( e ) ;
457
		    float loc = fno(e);
433
		    if ( name ( d ) == name_tag && isusereg ( e ) ) {
458
		    if (name(d) == name_tag && isusereg(e)) {
434
			loc = ( float ) 1.0 ;
459
			loc = (float)1.0;
435
		    }
460
		    }
436
		    p = max_weights ( sz, loc, wbody, sht ) ;
461
		    p = max_weights(sz, loc, wbody, sht);
437
		    no ( e ) = p.bkpt ;
462
		    no(e) = p.bkpt;
438
		    return ( add_weights ( wdef, p.wt ) ) ;
463
		    return(add_weights(wdef, p.wt));
439
		}
464
		}
440
 
465
 
441
		no ( e ) = 16 ;
466
		no(e) = 16;
442
		return ( add_weights ( wdef, wbody ) ) ;
467
		return(add_weights(wdef, wbody));
443
	    }
468
	    }
444
	    return ( zeros ) ;
469
	    return(zeros);
445
	}
470
	}
446
 
471
 
447
	case labst_tag : {
472
	case labst_tag: {
448
	    /* Add e to list of exps */
473
	    /* Add e to list of exps */
449
	    explist nel ;
474
	    explist nel;
450
	    nel.member = e ;
475
	    nel.member = e;
451
	    nel.next = el ;
476
	    nel.next = el;
452
	    if ( regable ( e ) ) {
477
	    if (regable(e)) {
453
		weights wbody ;
478
		weights wbody;
454
		float old_scale = scale ;
479
		float old_scale = scale;
455
		scale = fno ( e ) ;
480
		scale = fno(e);
456
		wbody = weightsv ( bro ( son ( e ) ), &nel ) ;
481
		wbody = weightsv(bro(son(e)), &nel);
457
		scale = old_scale ;
482
		scale = old_scale;
458
		return ( wbody ) ;
483
		return(wbody);
459
	    } else {
484
	    } else {
460
		return ( add_wlist ( bro ( son ( e ) ), &nel ) ) ;
485
		return(add_wlist(bro(son(e)), &nel));
461
	    }
486
	    }
462
	}
487
	}
463
 
488
 
464
	case rep_tag : {
489
	case rep_tag: {
465
	    weights swl, bwl ;
490
	    weights swl, bwl;
466
	    swl = weightsv ( son ( e ), el ) ;
491
	    swl = weightsv(son(e), el);
467
	    bwl = weightsv ( bro ( son ( e ) ), el ) ;
492
	    bwl = weightsv(bro(son(e)), el);
468
	    return ( add_weights ( swl, bwl ) ) ;
493
	    return(add_weights(swl, bwl));
469
	}
494
	}
470
 
495
 
471
	case compound_tag : {
496
	case compound_tag: {
472
	    return ( add_wlist ( son ( e ), el ) ) ;
497
	    return(add_wlist(son(e), el));
473
	}
498
	}
474
 
499
 
475
        case untidy_return_tag :
500
        case untidy_return_tag:
476
	case case_tag :
501
	case case_tag:
477
	case res_tag : {
502
	case res_tag: {
478
	    return ( weightsv ( son ( e ), el ) ) ;
503
	    return(weightsv(son(e), el));
479
	}
504
	}
480
	case apply_general_tag :
505
	case apply_general_tag:
481
	case apply_tag :
506
	case apply_tag:
482
	case round_tag :
507
	case round_tag:
483
	case float_tag : {
508
	case float_tag: {
484
	    markcall ( el, ( bitpattern ) 0x80 ) ;
509
	    markcall(el,(bitpattern)0x80);
485
	    return ( add_wlist ( son ( e ), el ) ) ;
510
	    return(add_wlist(son(e), el));
486
	}
511
	}
487
 
512
 
488
	case ass_tag :
513
	case ass_tag:
489
	case assvol_tag : {
514
	case assvol_tag: {
490
	    weights swl, bwl ;
515
	    weights swl, bwl;
491
	    swl = weightsv ( son ( e ), el ) ;
516
	    swl = weightsv(son(e), el);
492
	    bwl = weightsv ( bro ( son ( e ) ), el ) ;
517
	    bwl = weightsv(bro(son(e)), el);
493
	    return ( add_weights ( swl, bwl ) ) ;
518
	    return(add_weights(swl, bwl));
494
	}
519
	}
495
 
520
 
496
	case general_proc_tag :
521
	case general_proc_tag:
497
	case proc_tag : {
522
	case proc_tag: {
498
	    weightsv ( son ( e ), null ) ;
523
	    weightsv(son(e), null);
499
	    return ( zeros ) ;
524
	    return(zeros);
500
	}
525
	}
501
 
526
 
502
	case env_offset_tag : {
527
	case env_offset_tag: {
503
	    return ( zeros ) ;
528
	    return(zeros);
504
	}
529
	}
505
 
530
 
506
	case val_tag :
531
	case val_tag:
507
	case real_tag : {
532
	case real_tag: {
508
	    return ( zeros ) ;
533
	    return(zeros);
509
	}
534
	}
510
 
535
 
511
	case test_tag : {
536
	case test_tag: {
512
	    weights twl ;
537
	    weights twl;
513
	    twl = add_wlist ( son ( e ), el ) ;
538
	    twl = add_wlist(son(e), el);
514
	    /* scale = scale * ( ( ( float ) 1.0 ) - fno ( e ) ) ; */
539
	    /* scale = scale * ( ( ( float ) 1.0 ) - fno ( e ) ) ; */
515
	    return ( twl ) ;
540
	    return(twl);
516
	}
541
	}
517
 
542
 
518
	default : {
543
	default : {
519
	    return ( add_wlist ( son ( e ), el ) ) ;
544
	    return(add_wlist(son(e), el));
520
	}
545
	}
521
    }
546
    }
522
}
547
}
523
 
548
 
524
 
549
 
525
/*
550
/*
526
    COMPUTE WEIGHTS
551
    COMPUTE WEIGHTS
527
*/
552
*/
528
 
553
 
529
void comp_weights
554
void comp_weights
530
    PROTO_N ( ( e ) )
-
 
531
    PROTO_T ( exp e )
555
(exp e)
532
{
556
{
533
    scale = ( float ) 1.0 ;
557
    scale = (float)1.0;
534
    weightsv ( e, null ) ;
558
    weightsv(e, null);
535
    return ;
559
    return;
536
}
560
}