7 /* object management routines */
10 * Open new field for a record.
12 void openrc(word prot, virtaddr *virt, word *addr)
16 request(prototype[prot]->appetite, &t1, addr);
17 M[*addr + PROTNUM] = prot;
19 virt->mark = M[t1 + 1];
25 void slopen(word prot, virtaddr *sladr, word *ah, word *am)
29 virts = thisp->prochead + M[thisp->prochead] + VIRTSC;
30 /* preserve for compactifier */
31 storevirt(*sladr, virts);
32 t1 = prototype[prot]->appetite;
37 M[*am + PROTNUM] = prot;
40 /* prepare SL pointer */
41 M[t1 + SL] = M[virts];
42 M[t1 + SL + 1] = M[virts + 1];
44 t2 = M[display2 + M[c1 + PROTNUM]];
46 M[t1 + DL + 1] = M[t2 + 1];
50 void openobj(word prot, word *ah, word *am)
55 t1 = M[display2 + prototype[prot]->slprototype];
59 slopen(prot, &v1, ah, am);
63 * Reserve room for array
65 void newarry(word low, word up, word kind, virtaddr *virt, word *am)
86 /* illegal array bounds */
90 request(up - low + ap, &virt->addr, am);
93 virt->mark = M[virt->addr + 1];
99 void gkill(virtaddr *virt)
106 /* kill remote process */
107 if (isprocess(virt)) {
108 msg.control.type = KILLPR;
109 obj2mess( M, virt, &msg.control.receiver );
110 /* send remote kill request */
113 else if (virt->mark == M[virt->addr + 1]) {
116 t2 = M[t1 + PROTNUM];
117 if (t2 == AINT || t2 == AREAL || t2 == AVIRT) {
118 /* simple kill for array */
121 else if (t2 == FILEOBJECT) {
122 /* First close file if opened */
123 if (M[t1 + FSTAT] != UNKNOWN)
124 if (fclose(MF(t1 + FFILE)))
126 /* Delete file if temporary */
127 if (M[t1 + FTEMP] == LTRUE)
128 if (unlink(MN(t1 + FNAME)))
133 /* more than array or file */
135 ptr = prototype[ t2 ];
136 if (ptr->kind == RECORD)
143 if (M[t3 + STATSL] != 0)
145 /* next object in DL */
155 loadvirt(vt, t3 + DL);
157 virt->addr = vt.addr;
158 virt->mark = vt.mark;
160 } while (M[virt->addr + 1] == virt->mark);
167 * Copy object to a new object and locate it by fresh.
169 void copy(virtaddr *old, virtaddr *fresh)
171 word t1, t2, t3, virts;
175 /* fine copy for none */
176 if (M[ old->addr+1 ] != old->mark) {
178 /* note M[ 1 ] <> 0 */
185 /* assume it is a record */
187 t2 = M[t1 + PROTNUM];
188 /* if not array nor file */
189 if (t2 != AINT && t2 != AREAL && t2 != AVIRT &&
192 /* our assumption was wrong */
193 if (ptr->kind != RECORD) {
195 t3 = t1 + M[t1] + DL;
196 /* non-terminated object */
197 if (M[t3] != old->addr ||
198 M[t3 + 1] != old->mark) {
203 virts = thisp->prochead + M[thisp->prochead] + VIRTSC;
204 /* preserve for compactification */
205 storevirt(*old, virts);
207 request(M[ t1 ], &t2, &t3);
210 fresh->mark = M[fresh->addr + 1];
212 for (t2 = 1; t2 < M[t1]; t2++)
213 M[t3 + t2] = M[t1 + t2];
217 storevirt(*fresh, t3 + M[t3] + DL);
218 /* not in any SL chain */
219 M[t3 + M[t3] + STATSL] = 0;