2 * (c) copyright 1987 by the Vrije Universiteit, Amsterdam, The Netherlands.
3 * See the copyright notice in the ACK home directory, in the file "Copyright".
6 static char rcsid[]= "$Id: iocc.c,v 0.5 1994/06/24 10:37:32 ceriel Exp $";
21 extern set_t l_sets[];
28 iocc_t subr_iocc(tokarg,subreg) {
33 insta.in_which = IN_COPY;
34 insta.in_info[0] = tokarg;
35 insta.in_info[1] = subreg;
36 result.in_index = instalookup(insta,2);
37 if (tokarg < 1) tokarg = 1;
39 for (i=0;i<SETSIZE;i++)
40 result.in_set[i] = l_sets[tokpatset[tokarg-1]].set_val[i];
42 for (i=0;i<SETSIZE;i++)
44 subregset(l_sets[tokpatset[tokarg-1]].set_val,subreg,result.in_set);
49 iocc_t tokm_iocc(tokarg,ident) char *ident; {
56 for(i=0;i<SETSIZE;i++)
58 insta.in_which = IN_MEMB;
59 insta.in_info[0] = tokarg;
60 if (tokarg < 1) tokarg = 1;
61 sprintf(app,"%%%d.%s",tokarg,ident);
62 insta.in_info[1] = 1+membset(tokpatset[tokarg-1],ident,result.in_set,
64 result.in_index = instalookup(insta,2);
68 iocc_t percident_iocc(ident) char *ident; {
75 for(i=0;i<SETSIZE;i++)
77 insta.in_which = IN_MEMB;
79 sprintf(app,"%%%s",ident);
80 insta.in_info[1] = 1+membset(cursetno,ident,result.in_set,
82 result.in_index = instalookup(insta,2);
86 iocc_t ident_iocc(ident) char *ident; {
90 register symbol *sy_p;
92 for(i=0;i<SETSIZE;i++)
94 insta.in_which = IN_RIDENT;
95 sy_p = lookup(ident,symreg,mustexist);
96 insta.in_info[0] = sy_p->sy_value.syv_regno;
97 result.in_index = instalookup(insta,1);
98 BIS(result.in_set,sy_p->sy_value.syv_regno);
102 iocc_t all_iocc(all_no,subreg) {
109 sp = l_props[allreg[all_no]].pr_regset;
110 for (i=0;i<SETSIZE;i++)
111 localset.set_val[i] = i<SZOFSET(MAXREGS) ? sp[i] : 0;
112 for(i=0;i<SETSIZE;i++)
113 result.in_set[i] = 0;
114 insta.in_which = IN_ALLOC;
115 insta.in_info[0] = all_no;
116 insta.in_info[1] = subreg;
117 subregset(localset.set_val,subreg,result.in_set);
118 result.in_index = instalookup(insta,2);
122 iocc_t descr_iocc(ident) char *ident; {
125 register symbol *sy_p;
130 for(i=0;i<SETSIZE;i++)
131 result.in_set[i] = 0;
132 sy_p = lookup(ident,symtok,mustexist);
133 tp = l_tokens[sy_p->sy_value.syv_tokno];
134 BIS(result.in_set,sy_p->sy_value.syv_tokno+nregs);
135 insta.in_which = IN_DESCR;
136 if (rvused&SL_REGVAR && strcmp(ident,"LOCAL")==0)
137 insta.in_which = IN_S_DESCR;
138 else if (rvused&DL_REGVAR && strcmp(ident,"DLOCAL")==0)
139 insta.in_which = IN_D_DESCR;
140 insta.in_info[0] = sy_p->sy_value.syv_tokno;
141 for (i=0;i<MAXATT;i++) {
142 if (tp->tk_att[i].ta_type == -3) {
144 error("token %s initialized with too many attributes",ident);
148 error("token %s initialized with too few attributes",
153 switch(arexp[i].ex_typ) {
156 if (tp->tk_att[i].ta_type != -1)
157 if (tp->tk_att[i].ta_type == -2)
158 arexp[i] = iextoaddr(arexp[i]);
165 if (tp->tk_att[i].ta_type != -2)
169 if (tp->tk_att[i].ta_type<0)
171 else if (!subset(arexp[i].ex_regset,
172 l_props[tp->tk_att[i].ta_type].pr_regset,
178 error("Attribute %s.%s given wrong type of value",
179 ident,tp->tk_att[i].ta_name);
180 insta.in_info[i+1] = arexp[i].ex_index;
182 result.in_index = instalookup(insta,i+1);
186 /* low level instance package */
189 inst_t l_instances[MAXINSTANCES];
191 instalookup(insta,filled) inst_t insta; {
194 for (j=filled;j<=MAXATT;j++)
195 insta.in_info[j] = 0;
196 for (i=0;i<ninstances;i++) {
197 if (insta.in_which != l_instances[i].in_which)
199 for(j=0;j<=MAXATT;j++)
200 if (insta.in_info[j]!= l_instances[i].in_info[j])
205 NEXT(ninstances,MAXINSTANCES,"Instances");
206 l_instances[i] = insta;