1 /****************************************************************
2 Copyright (C) 1997 Lucent Technologies
3 All Rights Reserved
4 
5 Permission to use, copy, modify, and distribute this software and
6 its documentation for any purpose and without fee is hereby
7 granted, provided that the above copyright notice appear in all
8 copies and that both that the copyright notice and this
9 permission notice and warranty disclaimer appear in supporting
10 documentation, and that the name of Lucent or any of its entities
11 not be used in advertising or publicity pertaining to
12 distribution of the software without specific, written prior
13 permission.
14 
15 LUCENT DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
16 INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS.
17 IN NO EVENT SHALL LUCENT OR ANY OF ITS ENTITIES BE LIABLE FOR ANY
18 SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
19 WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER
20 IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
21 ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF
22 THIS SOFTWARE.
23 ****************************************************************/
24 
25 #include "nlp.h"
26 
27  void
28 #ifdef KR_headers
comeval_ASL(asl,i,ie)29 comeval_ASL(asl, i, ie) ASL_fg *asl; int i, ie;
30 #else
31 comeval_ASL(ASL_fg *asl, int i, int ie)
32 #endif
33 {
34 	register cexp *c, *ce;
35 	register expr *e;
36 	register expr_v *V = var_ex + i;
37 	register linpart *L, *Le;
38 	real t;
39 	c = cexps + i;
40 	ce = cexps + ie;
41 	do {
42 		cv_index = ++i;	/* identify var in case of error */
43 		e = c->e;
44 		t = (*e->op)(e C_ASL);
45 		if ((L = c->L))
46 			for(Le = L + c->nlin; L < Le; L++)
47 				t += L->fac * *L->v.rp;
48 		(*V++).v = t;
49 		}
50 		while(++c < ce);
51 	cv_index = 0;
52 	}
53 
54  void
55 #ifdef KR_headers
com1eval_ASL(asl,i,ie)56 com1eval_ASL(asl, i, ie)ASL_fg *asl;  int i, ie;
57 #else
58 com1eval_ASL(ASL_fg *asl, int i, int ie)
59 #endif
60 
61 {
62 	register cexp1 *c, *ce;
63 	register expr *e;
64 	register expr_v *V = var_ex1 + i;
65 	register linpart *L, *Le;
66 	real t;
67 	c = cexps1 + i;
68 	ce = cexps1 + ie;
69 	i += ncom0;
70 	do {
71 		cv_index = ncom0 + ++i;	/* identify var in case of error */
72 		e = c->e;
73 		t = (*e->op)(e C_ASL);
74 		if ((L = c->L))
75 			for(Le = L + c->nlin; L < Le; L++)
76 				t += L->fac * *L->v.rp;
77 		(*V++).v = t;
78 		}
79 		while(++c < ce);
80 	cv_index = 0;
81 	}
82 
83  void
84 #ifdef KR_headers
funnelset_ASL(asl,f)85 funnelset_ASL(asl, f) ASL_fg *asl; register funnel *f;
86 #else
87 funnelset_ASL(ASL_fg *asl, register funnel *f)
88 #endif
89 {
90 	register derp	*d;
91 	register cplist	*cl;
92 
93 	for(; f; f = f->next) {
94 		memset(adjoints_nv1, 0, f->fcde.zaplen);
95 		cl = f->cl;
96 		do *cl->ca.rp = 0;
97 			while((cl = cl->next));
98 		d = f->fcde.d;
99 		*d->b.rp = 1.;
100 		do *d->a.rp += *d->b.rp * *d->c.rp;
101 			while((d = d->next));
102 		cl = f->cl;
103 		do *cl->cfa = *cl->ca.rp;
104 			while((cl = cl->next));
105 		}
106 	}
107