BSD 4_3_Reno development
[unix-history] / usr / src / old / efl / temp.c
CommitLineData
64836102
C
1#include "defs"
2
3ptr gentemp(t)
4ptr t;
5{
6register ptr oldp;
7register ptr p;
8register ptr q;
9int ttype;
10ptr ttypep, tdim;
11
12/* search the temporary list for a matching type */
13
14ttype = t->vtype;
15ttypep = t->vtypep;
16tdim = t->vdim;
17
18for(oldp = &tempvarlist ; p = oldp->nextp ; oldp = p)
19 if( (q = p->datap) && (q->vtype == ttype) &&
20 (q->vtypep == ttypep) && eqdim(q->vdim,tdim) )
21 {
22 oldp->nextp = p->nextp;
23 break;
24 }
25
26if(p == PNULL)
27 {
28 q = allexpblock();
29 q->tag = TTEMP;
30 q->subtype = t->subtype;
31 q->vtype = ttype;
32 q->vclass = t->vclass;
33 q->vtypep = ( ttypep ? cpexpr(ttypep) : PNULL);
34 q->vdim = tdim;
35 mkftnp(q); /* assign fortran types */
36
37 p = mkchain(q, CHNULL);
38 p->datap = q;
39 }
40
41p->nextp = thisexec->temps;
42thisexec->temps = p;
43
44return( cpexpr(q) );
45/* need a copy of the block for the temporary list and another for use */
46}
47
48
49ptr gent(t,tp) /* make a temporary of type t, typepointer tp */
50int t;
51ptr tp;
52{
53static struct varblock model;
54
55model.vtype = t;
56model.vtypep = tp;
57
58return( gentemp(&model) );
59}